www.usr.com/support/gpl/USR9113_release1.0.tar.gz
[bcm963xx.git] / kernel / linux / arch / mips / brcm-boards / bcm963xx / prom.c
index 45a6c5b..4de81ff 100755 (executable)
@@ -47,16 +47,18 @@ void __init create_root_nfs_cmdline( char *cmdline );
 #define CPU_CLOCK                   240000000
 #define MACH_BCM                    MACH_BCM96338
 #endif
-#if defined(CONFIG_BCM96345)
-#define CPU_CLOCK                   140000000
-#define MACH_BCM                    MACH_BCM96345
-#endif
 #if defined(CONFIG_BCM96348)
 void __init calculateCpuSpeed(void);
 static unsigned long cpu_speed;
 #define CPU_CLOCK                   cpu_speed
 #define MACH_BCM                    MACH_BCM96348
 #endif
+#if defined(CONFIG_BCM96358)
+void __init calculateCpuSpeed(void);
+static unsigned long cpu_speed;
+#define CPU_CLOCK                   cpu_speed
+#define MACH_BCM                    MACH_BCM96358
+#endif
 
 const char *get_system_type(void)
 {
@@ -117,9 +119,13 @@ void __init prom_init(void)
     strcpy(arcs_cmdline, CONFIG_ROOT_FLASHFS);
 #endif
 
+#if defined(CONFIG_BCM96358) && defined(CONFIG_BCM_ENDPOINT_MODULE)
+    add_memory_region(0, (getMemorySize() - 1024*1024), BOOT_MEM_RAM);
+#else
     add_memory_region(0, (getMemorySize() - ADSL_SDRAM_IMAGE_SIZE), BOOT_MEM_RAM);
+#endif
 
-#if defined(CONFIG_BCM96348)
+#if defined(CONFIG_BCM96348) || defined(CONFIG_BCM96358) 
     calculateCpuSpeed();
 #endif
     /* Count register increments every other clock */
@@ -231,3 +237,25 @@ void __init calculateCpuSpeed(void)
 }
 #endif
 
+#if defined(CONFIG_BCM96358)
+/*  *********************************************************************
+    *  calculateCpuSpeed()
+    *      Calculate the BCM6358 CPU speed by reading the PLL Config register
+    *      and applying the following formula:
+    *      Fcpu_clk = (25 * MIPSDDR_NDIV) / MIPS_MDIV
+    *  Input parameters:
+    *      none
+    *  Return value:
+    *      none
+    ********************************************************************* */
+void __init calculateCpuSpeed(void)
+{
+    UINT32 pllConfig = DDR->MIPSDDRPLLConfig;
+    int numerator;
+
+    cpu_speed = 64000000 / ((pllConfig & MIPS_MDIV_MASK) >> MIPS_MDIV_SHFT);
+    numerator = (((pllConfig & MIPSDDR_N2_MASK) >> MIPSDDR_N2_SHFT) * ((pllConfig & MIPSDDR_N1_MASK) >> MIPSDDR_N1_SHFT));
+    cpu_speed = (cpu_speed * numerator) / 4;
+
+}
+#endif