Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 May 2009 17:06:34 GMT
From:      Sylvestre Gallon <syl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 162585 for review
Message-ID:  <200905231706.n4NH6Y4J072081@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=162585

Change 162585 by syl@syl_rincewind on 2009/05/23 17:05:51

	Update at91_machdep to be SoC independant. Add sdramcreg for atmel
	sdramc controller and delete sdramc entries from at91rm92reg.h.
	Add the pmap_devmap into SoC file.

Affected files ...

.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/at91_machdep.c#2 edit
.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/at91_sdramcreg.h#1 add
.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/at91rm92reg.h#3 edit
.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/at91var.h#3 edit
.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/soc_at91rm9200.c#3 edit

Differences ...

==== //depot/projects/soc2009/syl_usb/src/sys/arm/at91/at91_machdep.c#2 (text+ko) ====

@@ -91,9 +91,8 @@
 #include <sys/reboot.h>
 
 #include <arm/at91/at91board.h>
-#include <arm/at91/at91rm92reg.h>
-#include <arm/at91/at91_piovar.h>
-#include <arm/at91/at91_pio_rm9200.h>
+#include <arm/at91/at91var.h>
+#include <arm/at91/at91_sdramcreg.h>
 
 #define KERNEL_PT_SYS		0	/* Page table for mapping proc0 zero page */
 #define KERNEL_PT_KERN		1
@@ -140,65 +139,10 @@
 
 static struct trapframe proc0_tf;
 
-/* Static device mappings. */
-static const struct pmap_devmap at91rm9200_devmap[] = {
-	/*
-	 * Map the on-board devices VA == PA so that we can access them
-	 * with the MMU on or off.
-	 */
-	{
-		/*
-		 * This at least maps the interrupt controller, the UART
-		 * and the timer. Other devices should use newbus to
-		 * map their memory anyway.
-		 */
-		0xdff00000,
-		0xfff00000,
-		0x100000,
-		VM_PROT_READ|VM_PROT_WRITE,
-		PTE_NOCACHE,
-	},
-	/*
-	 * We can't just map the OHCI registers VA == PA, because
-	 * AT91RM92_OHCI_BASE belongs to the userland address space.
-	 * We could just choose a different virtual address, but a better
-	 * solution would probably be to just use pmap_mapdev() to allocate
-	 * KVA, as we don't need the OHCI controller before the vm
-	 * initialization is done. However, the AT91 resource allocation
-	 * system doesn't know how to use pmap_mapdev() yet.
-	 */
-	{
-		/*
-		 * Add the ohci controller, and anything else that might be
-		 * on this chip select for a VA/PA mapping.
-		 */
-		AT91RM92_OHCI_BASE,
-		AT91RM92_OHCI_PA_BASE,
-		AT91RM92_OHCI_SIZE,
-		VM_PROT_READ|VM_PROT_WRITE,
-		PTE_NOCACHE,
-	},
-	{
-		/* CompactFlash controller. */
-		AT91RM92_CF_BASE,
-		AT91RM92_CF_PA_BASE,
-		AT91RM92_CF_SIZE,
-		VM_PROT_READ|VM_PROT_WRITE,
-		PTE_NOCACHE,
-	},
-	{
-		0,
-		0,
-		0,
-		0,
-		0,
-	}
-};
-
 long
 at91_ramsize(void)
 {
-	uint32_t *SDRAMC = (uint32_t *)(AT91RM92_BASE + AT91RM92_SDRAMC_BASE);
+	uint32_t *SDRAMC = (uint32_t *)(at91_base() + at91_sdramc_base());
 	uint32_t cr, mr;
 	int banks, rows, cols, bw;
 
@@ -317,7 +261,7 @@
 		    VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
 	}
 
-	pmap_devmap_bootstrap(l1pagetable, at91rm9200_devmap);
+	pmap_devmap_bootstrap(l1pagetable, at91_devmap);
 	cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
 	setttb(kernel_l1pt.pv_pa);
 	cpu_tlb_flushID();

==== //depot/projects/soc2009/syl_usb/src/sys/arm/at91/at91rm92reg.h#3 (text) ====

@@ -333,41 +333,5 @@
 /* SDRAMC */
 
 #define AT91RM92_SDRAMC_BASE	0xfffff90
-#define AT91RM92_SDRAMC_MR	0x00
-#define AT91RM92_SDRAMC_MR_MODE_NORMAL	0
-#define AT91RM92_SDRAMC_MR_MODE_NOP	1
-#define AT91RM92_SDRAMC_MR_MODE_PRECHARGE 2
-#define AT91RM92_SDRAMC_MR_MODE_LOAD_MODE_REGISTER 3
-#define AT91RM92_SDRAMC_MR_MODE_REFRESH	4
-#define AT91RM92_SDRAMC_MR_DBW_16	0x10
-#define AT91RM92_SDRAMC_TR	0x04
-#define AT91RM92_SDRAMC_CR	0x08
-#define AT91RM92_SDRAMC_CR_NC_8		0x0
-#define AT91RM92_SDRAMC_CR_NC_9		0x1
-#define AT91RM92_SDRAMC_CR_NC_10	0x2
-#define AT91RM92_SDRAMC_CR_NC_11	0x3
-#define AT91RM92_SDRAMC_CR_NC_MASK	0x00000003
-#define AT91RM92_SDRAMC_CR_NR_11	0x0
-#define AT91RM92_SDRAMC_CR_NR_12	0x4
-#define AT91RM92_SDRAMC_CR_NR_13	0x8
-#define AT91RM92_SDRAMC_CR_NR_RES	0xc
-#define AT91RM92_SDRAMC_CR_NR_MASK	0x0000000c
-#define AT91RM92_SDRAMC_CR_NB_2		0x00
-#define AT91RM92_SDRAMC_CR_NB_4		0x10
-#define AT91RM92_SDRAMC_CR_NB_MASK	0x00000010
-#define AT91RM92_SDRAMC_CR_NCAS_MASK	0x00000060
-#define AT91RM92_SDRAMC_CR_TWR_MASK	0x00000780
-#define AT91RM92_SDRAMC_CR_TRC_MASK	0x00007800
-#define AT91RM92_SDRAMC_CR_TRP_MASK	0x00078000
-#define AT91RM92_SDRAMC_CR_TRCD_MASK	0x00780000
-#define AT91RM92_SDRAMC_CR_TRAS_MASK	0x07800000
-#define AT91RM92_SDRAMC_CR_TXSR_MASK	0x78000000
-#define AT91RM92_SDRAMC_SRR	0x0c
-#define AT91RM92_SDRAMC_LPR	0x10
-#define AT91RM92_SDRAMC_IER	0x14
-#define AT91RM92_SDRAMC_IDR	0x18
-#define AT91RM92_SDRAMC_IMR	0x1c
-#define AT91RM92_SDRAMC_ISR	0x20
-#define AT91RM92_SDRAMC_IER_RES	0x1
 
 #endif /* AT91RM92REG_H_ */

==== //depot/projects/soc2009/syl_usb/src/sys/arm/at91/at91var.h#3 (text) ====

@@ -29,6 +29,9 @@
 #define _AT91VAR_H_
 
 #include <sys/rman.h>
+#include <vm/vm.h>
+#include <vm/pmap.h>
+#include <machine/pmap.h>
 
 struct at91_softc {
 	device_t dev;
@@ -54,14 +57,18 @@
 	int irq2;
 };
 
+struct pmap_devmap;
+
 extern uint32_t at91_master_clock;
 extern struct cpu_devs at91_devs[];
 extern int at91_irq_prio[32];
+extern const struct pmap_devmap at91_devmap[];
 
 void soc_attach(struct at91_softc *sc);
 uint32_t at91_sys_base(void);
 uint32_t at91_sys_size(void);
 uint32_t at91_base(void);
 uint32_t at91_irq_sys(void);
+uint32_t at91_sdramc_base(void);
 
 #endif /* _AT91VAR_H_ */

==== //depot/projects/soc2009/syl_usb/src/sys/arm/at91/soc_at91rm9200.c#3 (text+ko) ====

@@ -33,6 +33,61 @@
 
 uint32_t at91_master_clock = AT91C_MASTER_CLOCK;
 
+/* Static device mappings. */
+const struct pmap_devmap at91_devmap[] = {
+	/*
+	 * Map the on-board devices VA == PA so that we can access them
+	 * with the MMU on or off.
+	 */
+	{
+		/*
+		 * This at least maps the interrupt controller, the UART
+		 * and the timer. Other devices should use newbus to
+		 * map their memory anyway.
+		 */
+		0xdff00000,
+		0xfff00000,
+		0x100000,
+		VM_PROT_READ|VM_PROT_WRITE,
+		PTE_NOCACHE,
+	},
+	/*
+	 * We can't just map the OHCI registers VA == PA, because
+	 * AT91RM92_OHCI_BASE belongs to the userland address space.
+	 * We could just choose a different virtual address, but a better
+	 * solution would probably be to just use pmap_mapdev() to allocate
+	 * KVA, as we don't need the OHCI controller before the vm
+	 * initialization is done. However, the AT91 resource allocation
+	 * system doesn't know how to use pmap_mapdev() yet.
+	 */
+	{
+		/*
+		 * Add the ohci controller, and anything else that might be
+		 * on this chip select for a VA/PA mapping.
+		 */
+		AT91RM92_OHCI_BASE,
+		AT91RM92_OHCI_PA_BASE,
+		AT91RM92_OHCI_SIZE,
+		VM_PROT_READ|VM_PROT_WRITE,
+		PTE_NOCACHE,
+	},
+	{
+		/* CompactFlash controller. */
+		AT91RM92_CF_BASE,
+		AT91RM92_CF_PA_BASE,
+		AT91RM92_CF_SIZE,
+		VM_PROT_READ|VM_PROT_WRITE,
+		PTE_NOCACHE,
+	},
+	{
+		0,
+		0,
+		0,
+		0,
+		0,
+	}
+};
+
 /*
  * Standard priority levels for the system.  0 is lowest and 7 is highest.
  * These values are the ones Atmel uses for its Linux port, which differ
@@ -262,3 +317,8 @@
 	return (AT91RM92_IRQ_SYSTEM);
 }
 
+uint32_t
+at91_sdramc_base(void)
+{
+	return (AT91RM92_SDRAMC_BASE);
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905231706.n4NH6Y4J072081>