auto_mem.patch

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--- linux-2.6.17/arch/m68knommu/platform/5307/head.S	2006-10-17 18:47:27.000000000 -0600
+++ linux-2.6.17/arch/m68knommu/platform/5307/head.S	2006-10-18 04:36:16.000000000 -0600
@@ -65,6 +65,26 @@
 	negl	%d0			/* negate bits */
 .endm
 
+#elif defined(CONFIG_M520x)
+.macro GET_MEM_SIZE
+	clrl	%d0
+	movel	MCF_MBAR+MCFSIM_SDCS0, %d2 /* Get SDRAM chip select 0 config */
+	andl	#0x1f, %d2		/* Get only the chip select size */
+	beq		3f		/* Check if it is enabled */
+	addql	#1, %d2			/* Form exponent */
+	moveql	#1,	%d0
+	lsll	%d2, %d0		/* 2 ^ exponent */
+3:
+	movel	MCF_MBAR+MCFSIM_SDCS1, %d2 /* Get SDRAM chip select 1 config */
+	andl	#0x1f, %d2		/* Get only the chip select size */
+	beq		4f		/* Check if it is enabled */
+	addql	#1, %d2			/* Form exponent */
+	moveql	#1,	%d1
+	lsll	%d2, %d1		/* 2 ^ exponent */
+	addl	%d1, %d0		/* Total size of SDRAM in d0 */
+4:
+.endm
+
 #else
 #error "ERROR: I don't know how to probe your boards memory size?"
 #endif
--- linux-2.6.17/include/asm-m68knommu/m520xsim.h	2006-06-17 19:49:35.000000000 -0600
+++ linux-2.6.17/include/asm-m68knommu/m520xsim.h	2006-10-18 23:35:54.000000000 -0600
@@ -32,6 +32,16 @@
 #define MCFINT_QSPI         31          /* Interrupt number for QSPI */
 #define MCFINT_PIT1         4           /* Interrupt number for PIT1 (PIT0 in processor) */
 
+/*
+ *	SDRAM configuration registers.
+ */
+#define	MCFSIM_SDMR	0x000a8000	/* SDRAM Mode/Extended Mode Register */
+#define	MCFSIM_SDCR	0x000a8004	/* SDRAM Control Register */
+#define	MCFSIM_SDCFG1	0x000a8008	/* SDRAM Configuration Register 1 */
+#define	MCFSIM_SDCFG2	0x000a800c	/* SDRAM Configuration Register 2 */
+#define	MCFSIM_SDCS0	0x000a8110	/* SDRAM Chip Select 0 Configuration */
+#define	MCFSIM_SDCS1	0x000a8114	/* SDRAM Chip Select 1 Configuration */
+
 
 #define MCF_GPIO_PAR_UART                   (0xA4036)
 #define MCF_GPIO_PAR_FECI2C                 (0xA4033)