]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-kirkwood/common.c
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
[linux-2.6-omap-h63xx.git] / arch / arm / mach-kirkwood / common.c
index 2e79dabac53cd3787b0e67f8ad78a02270e31f10..0bb1fbd84ccb9f561cbb6cb6ebc14cdc485f6784 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/mv643xx_eth.h>
 #include <linux/ata_platform.h>
 #include <linux/spi/orion_spi.h>
+#include <net/dsa.h>
 #include <asm/page.h>
 #include <asm/timex.h>
 #include <asm/mach/map.h>
@@ -151,6 +152,40 @@ void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
 }
 
 
+/*****************************************************************************
+ * Ethernet switch
+ ****************************************************************************/
+static struct resource kirkwood_switch_resources[] = {
+       {
+               .start  = 0,
+               .end    = 0,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device kirkwood_switch_device = {
+       .name           = "dsa",
+       .id             = 0,
+       .num_resources  = 0,
+       .resource       = kirkwood_switch_resources,
+};
+
+void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq)
+{
+       if (irq != NO_IRQ) {
+               kirkwood_switch_resources[0].start = irq;
+               kirkwood_switch_resources[0].end = irq;
+               kirkwood_switch_device.num_resources = 1;
+       }
+
+       d->mii_bus = &kirkwood_ge00_shared.dev;
+       d->netdev = &kirkwood_ge00.dev;
+       kirkwood_switch_device.dev.platform_data = d;
+
+       platform_device_register(&kirkwood_switch_device);
+}
+
+
 /*****************************************************************************
  * SoC RTC
  ****************************************************************************/
@@ -532,6 +567,12 @@ int kirkwood_tclk;
 
 int __init kirkwood_find_tclk(void)
 {
+       u32 dev, rev;
+
+       kirkwood_pcie_id(&dev, &rev);
+       if (dev == MV88F6281_DEV_ID && rev == MV88F6281_REV_A0)
+               return 200000000;
+
        return 166666667;
 }
 
@@ -549,23 +590,48 @@ struct sys_timer kirkwood_timer = {
 /*****************************************************************************
  * General
  ****************************************************************************/
+/*
+ * Identify device ID and revision.
+ */
 static char * __init kirkwood_id(void)
 {
-       switch (readl(DEVICE_ID) & 0x3) {
-       case 0:
-               return "88F6180";
-       case 1:
-               return "88F6192";
-       case 2:
-               return "88F6281";
+       u32 dev, rev;
+
+       kirkwood_pcie_id(&dev, &rev);
+
+       if (dev == MV88F6281_DEV_ID) {
+               if (rev == MV88F6281_REV_Z0)
+                       return "MV88F6281-Z0";
+               else if (rev == MV88F6281_REV_A0)
+                       return "MV88F6281-A0";
+               else
+                       return "MV88F6281-Rev-Unsupported";
+       } else if (dev == MV88F6192_DEV_ID) {
+               if (rev == MV88F6192_REV_Z0)
+                       return "MV88F6192-Z0";
+               else if (rev == MV88F6192_REV_A0)
+                       return "MV88F6192-A0";
+               else
+                       return "MV88F6192-Rev-Unsupported";
+       } else if (dev == MV88F6180_DEV_ID) {
+               if (rev == MV88F6180_REV_A0)
+                       return "MV88F6180-Rev-A0";
+               else
+                       return "MV88F6180-Rev-Unsupported";
+       } else {
+               return "Device-Unknown";
        }
-
-       return "unknown 88F6000 variant";
 }
 
-static int __init is_l2_writethrough(void)
+static void __init kirkwood_l2_init(void)
 {
-       return !!(readl(L2_CONFIG_REG) & L2_WRITETHROUGH);
+#ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH
+       writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG);
+       feroceon_l2_init(1);
+#else
+       writel(readl(L2_CONFIG_REG) & ~L2_WRITETHROUGH, L2_CONFIG_REG);
+       feroceon_l2_init(0);
+#endif
 }
 
 void __init kirkwood_init(void)
@@ -580,6 +646,6 @@ void __init kirkwood_init(void)
        kirkwood_setup_cpu_mbus();
 
 #ifdef CONFIG_CACHE_FEROCEON_L2
-       feroceon_l2_init(is_l2_writethrough());
+       kirkwood_l2_init();
 #endif
 }