MIPS: ralink: add memory definition for MT7620
authorJohn Crispin <blogic@openwrt.org>
Sun, 14 Apr 2013 07:55:29 +0000 (09:55 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 7 May 2013 23:19:12 +0000 (01:19 +0200)
Populate struct soc_info with the data that describes our RAM window.

Signed-off-by: John Crispin <blogic@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/5183/

arch/mips/include/asm/mach-ralink/mt7620.h
arch/mips/ralink/mt7620.c

index b272649933c9229861e00e25eb7bf7b3536b1f6e..9809972ea8822908680fc5c79cc95fad5342c1df 100644 (file)
 #define SYSCFG0_DRAM_TYPE_DDR1         1
 #define SYSCFG0_DRAM_TYPE_DDR2         2
 
+#define MT7620_DRAM_BASE               0x0
+#define MT7620_SDRAM_SIZE_MIN          2
+#define MT7620_SDRAM_SIZE_MAX          64
+#define MT7620_DDR1_SIZE_MIN           32
+#define MT7620_DDR1_SIZE_MAX           128
+#define MT7620_DDR2_SIZE_MIN           32
+#define MT7620_DDR2_SIZE_MAX           256
+
 #define MT7620_GPIO_MODE_I2C           BIT(0)
 #define MT7620_GPIO_MODE_UART0_SHIFT   2
 #define MT7620_GPIO_MODE_UART0_MASK    0x7
index af19ae740162b2cb9fe4a7988b15cdd859e55960..0018b1a661f6a0a193ea29601cb319b32f200ef4 100644 (file)
@@ -211,4 +211,24 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
 
        cfg0 = __raw_readl(sysc + SYSC_REG_SYSTEM_CONFIG0);
        dram_type = (cfg0 >> SYSCFG0_DRAM_TYPE_SHIFT) & SYSCFG0_DRAM_TYPE_MASK;
+
+       switch (dram_type) {
+       case SYSCFG0_DRAM_TYPE_SDRAM:
+               soc_info->mem_size_min = MT7620_SDRAM_SIZE_MIN;
+               soc_info->mem_size_max = MT7620_SDRAM_SIZE_MAX;
+               break;
+
+       case SYSCFG0_DRAM_TYPE_DDR1:
+               soc_info->mem_size_min = MT7620_DDR1_SIZE_MIN;
+               soc_info->mem_size_max = MT7620_DDR1_SIZE_MAX;
+               break;
+
+       case SYSCFG0_DRAM_TYPE_DDR2:
+               soc_info->mem_size_min = MT7620_DDR2_SIZE_MIN;
+               soc_info->mem_size_max = MT7620_DDR2_SIZE_MAX;
+               break;
+       default:
+               BUG();
+       }
+       soc_info->mem_base = MT7620_DRAM_BASE;
 }