Changeset 33571


Ignore:
Timestamp:
2012-09-27T12:18:15+02:00 (5 years ago)
Author:
juhosg
Message:

ramips: add memory detection code for RT5350

Location:
trunk/target/linux/ramips/files/arch/mips
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ramips/files/arch/mips/include/asm/mach-ralink/rt305x_regs.h

    r33381 r33571  
    104104#define RT5350_SYSCFG0_CPUCLK_320       0x2 
    105105#define RT5350_SYSCFG0_CPUCLK_300       0x3 
     106#define RT5350_SYSCFG0_DRAM_SIZE_SHIFT  12 
     107#define RT5350_SYSCFG0_DRAM_SIZE_MASK   7 
     108#define RT5350_SYSCFG0_DRAM_SIZE_2M     0 
     109#define RT5350_SYSCFG0_DRAM_SIZE_8M     1 
     110#define RT5350_SYSCFG0_DRAM_SIZE_16M    2 
     111#define RT5350_SYSCFG0_DRAM_SIZE_32M    3 
     112#define RT5350_SYSCFG0_DRAM_SIZE_64M    4 
    106113 
    107114#define RT3352_SYSCFG1_USB0_HOST_MODE   BIT(10) 
  • trunk/target/linux/ramips/files/arch/mips/ralink/rt305x/rt305x.c

    r33381 r33571  
    2626void __iomem * rt305x_memc_base; 
    2727enum rt305x_soc_type rt305x_soc; 
     28 
     29static unsigned long rt5350_get_mem_size(void) 
     30{ 
     31        void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE); 
     32        unsigned long ret; 
     33        u32 t; 
     34 
     35        t = __raw_readl(sysc + SYSC_REG_SYSTEM_CONFIG); 
     36        t = (t >> RT5350_SYSCFG0_DRAM_SIZE_SHIFT) & 
     37            RT5350_SYSCFG0_DRAM_SIZE_MASK; 
     38 
     39        switch (t) { 
     40        case RT5350_SYSCFG0_DRAM_SIZE_2M: 
     41                ret = 2 * 1024 * 1024; 
     42                break; 
     43        case RT5350_SYSCFG0_DRAM_SIZE_8M: 
     44                ret = 8 * 1024 * 1024; 
     45                break; 
     46        case RT5350_SYSCFG0_DRAM_SIZE_16M: 
     47                ret = 16 * 1024 * 1024; 
     48                break; 
     49        case RT5350_SYSCFG0_DRAM_SIZE_32M: 
     50                ret = 32 * 1024 * 1024; 
     51                break; 
     52        case RT5350_SYSCFG0_DRAM_SIZE_64M: 
     53                ret = 64 * 1024 * 1024; 
     54                break; 
     55        default: 
     56                panic("rt5350: invalid DRAM size: %u", t); 
     57                break; 
     58        } 
     59 
     60        return ret; 
     61} 
    2862 
    2963void __init ramips_soc_prom_init(void) 
     
    72106        ramips_mem_base = RT305X_SDRAM_BASE; 
    73107 
    74         if (soc_is_rt305x() || soc_is_rt3350() || soc_is_rt5350()) { 
     108        if (soc_is_rt5350()) { 
     109                ramips_get_mem_size = rt5350_get_mem_size; 
     110        } else if (soc_is_rt305x() || soc_is_rt3350() ) { 
    75111                ramips_mem_size_min = RT305X_MEM_SIZE_MIN; 
    76112                ramips_mem_size_max = RT305X_MEM_SIZE_MAX; 
Note: See TracChangeset for help on using the changeset viewer.