]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/sysdev/mv64x60_dev.c
Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-omap-h63xx.git] / arch / powerpc / sysdev / mv64x60_dev.c
index 047b31027fa6500ec03ba55727da52d6b1fc58ad..32e0ad0ebea8286af9b5b3b8cc1bd18ac1a42ed0 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/console.h>
 #include <linux/mv643xx.h>
 #include <linux/platform_device.h>
+#include <linux/of_platform.h>
 
 #include <asm/prom.h>
 
  * PowerPC of_platform_bus_type.  They support platform_bus_type instead.
  */
 
+static struct of_device_id __initdata of_mv64x60_devices[] = {
+       { .compatible = "marvell,mv64306-devctrl", },
+       {}
+};
+
 /*
  * Create MPSC platform devices
  */
@@ -239,6 +245,8 @@ static int __init mv64x60_eth_device_setup(struct device_node *np, int id,
 
        memset(&pdata, 0, sizeof(pdata));
 
+       pdata.shared = shared_pdev;
+
        prop = of_get_property(np, "reg", NULL);
        if (!prop)
                return -ENODEV;
@@ -338,15 +346,13 @@ static int __init mv64x60_i2c_device_setup(struct device_node *np, int id)
 
        pdata.freq_m = 8;       /* default */
        prop = of_get_property(np, "freq_m", NULL);
-       if (!prop)
-               return -ENODEV;
-       pdata.freq_m = *prop;
+       if (prop)
+               pdata.freq_m = *prop;
 
        pdata.freq_m = 3;       /* default */
        prop = of_get_property(np, "freq_n", NULL);
-       if (!prop)
-               return -ENODEV;
-       pdata.freq_n = *prop;
+       if (prop)
+               pdata.freq_n = *prop;
 
        pdata.timeout = 1000;                           /* default: 1 second */
 
@@ -433,9 +439,13 @@ static int __init mv64x60_device_setup(void)
        int err;
 
        id = 0;
-       for_each_compatible_node(np, "serial", "marvell,mv64360-mpsc")
-               if ((err = mv64x60_mpsc_device_setup(np, id++)))
-                       goto error;
+       for_each_compatible_node(np, "serial", "marvell,mv64360-mpsc") {
+               err = mv64x60_mpsc_device_setup(np, id++);
+               if (err)
+                       printk(KERN_ERR "Failed to initialize MV64x60 "
+                                       "serial device %s: error %d.\n",
+                                       np->full_name, err);
+       }
 
        id = 0;
        id2 = 0;
@@ -443,38 +453,48 @@ static int __init mv64x60_device_setup(void)
                pdev = mv64x60_eth_register_shared_pdev(np, id++);
                if (IS_ERR(pdev)) {
                        err = PTR_ERR(pdev);
-                       goto error;
+                       printk(KERN_ERR "Failed to initialize MV64x60 "
+                                       "network block %s: error %d.\n",
+                                       np->full_name, err);
+                       continue;
                }
                for_each_child_of_node(np, np2) {
                        if (!of_device_is_compatible(np2,
                                        "marvell,mv64360-eth"))
                                continue;
                        err = mv64x60_eth_device_setup(np2, id2++, pdev);
-                       if (err) {
-                               of_node_put(np2);
-                               goto error;
-                       }
+                       if (err)
+                               printk(KERN_ERR "Failed to initialize "
+                                               "MV64x60 network device %s: "
+                                               "error %d.\n",
+                                               np2->full_name, err);
                }
        }
 
        id = 0;
-       for_each_compatible_node(np, "i2c", "marvell,mv64360-i2c")
-               if ((err = mv64x60_i2c_device_setup(np, id++)))
-                       goto error;
+       for_each_compatible_node(np, "i2c", "marvell,mv64360-i2c") {
+               err = mv64x60_i2c_device_setup(np, id++);
+               if (err)
+                       printk(KERN_ERR "Failed to initialize MV64x60 I2C "
+                                       "bus %s: error %d.\n",
+                                       np->full_name, err);
+       }
 
        /* support up to one watchdog timer */
        np = of_find_compatible_node(np, NULL, "marvell,mv64360-wdt");
        if (np) {
                if ((err = mv64x60_wdt_device_setup(np, id)))
-                       goto error;
+                       printk(KERN_ERR "Failed to initialize MV64x60 "
+                                       "Watchdog %s: error %d.\n",
+                                       np->full_name, err);
                of_node_put(np);
        }
 
-       return 0;
+       /* Now add every node that is on the device bus */
+       for_each_compatible_node(np, NULL, "marvell,mv64360")
+               of_platform_bus_probe(np, of_mv64x60_devices, NULL);
 
-error:
-       of_node_put(np);
-       return err;
+       return 0;
 }
 arch_initcall(mv64x60_device_setup);