diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-09-27 10:18:15 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2012-09-27 10:18:15 +0000 |
commit | b4ae759bbb9a29362786f143f890733119c1d294 (patch) | |
tree | d310ef10bbb87fb3e37e6b609891356cddf55b32 /target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c | |
parent | ae436c404b87c21bd715cad72df7c39a5ad6ebaf (diff) | |
download | upstream-b4ae759bbb9a29362786f143f890733119c1d294.tar.gz upstream-b4ae759bbb9a29362786f143f890733119c1d294.tar.bz2 upstream-b4ae759bbb9a29362786f143f890733119c1d294.zip |
ramips: add memory detection code for RT5350
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33571 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c')
-rw-r--r-- | target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c b/target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c index 856d869ebe..8a7a58b7d5 100644 --- a/target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c +++ b/target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c @@ -26,6 +26,40 @@ void __iomem * rt305x_sysc_base; void __iomem * rt305x_memc_base; enum rt305x_soc_type rt305x_soc; +static unsigned long rt5350_get_mem_size(void) +{ + void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE); + unsigned long ret; + u32 t; + + t = __raw_readl(sysc + SYSC_REG_SYSTEM_CONFIG); + t = (t >> RT5350_SYSCFG0_DRAM_SIZE_SHIFT) & + RT5350_SYSCFG0_DRAM_SIZE_MASK; + + switch (t) { + case RT5350_SYSCFG0_DRAM_SIZE_2M: + ret = 2 * 1024 * 1024; + break; + case RT5350_SYSCFG0_DRAM_SIZE_8M: + ret = 8 * 1024 * 1024; + break; + case RT5350_SYSCFG0_DRAM_SIZE_16M: + ret = 16 * 1024 * 1024; + break; + case RT5350_SYSCFG0_DRAM_SIZE_32M: + ret = 32 * 1024 * 1024; + break; + case RT5350_SYSCFG0_DRAM_SIZE_64M: + ret = 64 * 1024 * 1024; + break; + default: + panic("rt5350: invalid DRAM size: %u", t); + break; + } + + return ret; +} + void __init ramips_soc_prom_init(void) { void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE); @@ -71,7 +105,9 @@ void __init ramips_soc_prom_init(void) ramips_mem_base = RT305X_SDRAM_BASE; - if (soc_is_rt305x() || soc_is_rt3350() || soc_is_rt5350()) { + if (soc_is_rt5350()) { + ramips_get_mem_size = rt5350_get_mem_size; + } else if (soc_is_rt305x() || soc_is_rt3350() ) { ramips_mem_size_min = RT305X_MEM_SIZE_MIN; ramips_mem_size_max = RT305X_MEM_SIZE_MAX; } else if (soc_is_rt3352()) { |