Merge branch 'merge'
[linux-block.git] / arch / powerpc / sysdev / fsl_soc.c
index 7b45670c7af387c34d670018dcc76108958d45fb..ca54563d5c7ecc2bd769c8f30aab4760f5e273f5 100644 (file)
@@ -389,8 +389,8 @@ static int __init gfar_of_init(void)
                        }
 
                        gfar_data.phy_id = *id;
-                       snprintf(gfar_data.bus_id, MII_BUS_ID_SIZE, "%x",
-                                       res.start);
+                       snprintf(gfar_data.bus_id, MII_BUS_ID_SIZE, "%llx",
+                                (unsigned long long)res.start);
 
                        of_node_put(phy);
                        of_node_put(mdio);
@@ -418,22 +418,22 @@ arch_initcall(gfar_of_init);
 #include <linux/i2c.h>
 struct i2c_driver_device {
        char    *of_device;
-       char    *i2c_driver;
        char    *i2c_type;
 };
 
 static struct i2c_driver_device i2c_devices[] __initdata = {
-       {"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",},
-       {"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",},
-       {"ricoh,rv5c386",  "rtc-rs5c372", "rv5c386",},
-       {"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",},
-       {"dallas,ds1307",  "rtc-ds1307",  "ds1307",},
-       {"dallas,ds1337",  "rtc-ds1307",  "ds1337",},
-       {"dallas,ds1338",  "rtc-ds1307",  "ds1338",},
-       {"dallas,ds1339",  "rtc-ds1307",  "ds1339",},
-       {"dallas,ds1340",  "rtc-ds1307",  "ds1340",},
-       {"stm,m41t00",     "rtc-ds1307",  "m41t00"},
-       {"dallas,ds1374",  "rtc-ds1374",  "rtc-ds1374",},
+       {"ricoh,rs5c372a", "rs5c372a"},
+       {"ricoh,rs5c372b", "rs5c372b"},
+       {"ricoh,rv5c386",  "rv5c386"},
+       {"ricoh,rv5c387a", "rv5c387a"},
+       {"dallas,ds1307",  "ds1307"},
+       {"dallas,ds1337",  "ds1337"},
+       {"dallas,ds1338",  "ds1338"},
+       {"dallas,ds1339",  "ds1339"},
+       {"dallas,ds1340",  "ds1340"},
+       {"stm,m41t00",     "m41t00"},
+       {"dallas,ds1374",  "ds1374"},
+       {"cirrus,cs4270",  "cs4270"},
 };
 
 static int __init of_find_i2c_driver(struct device_node *node,
@@ -444,13 +444,15 @@ static int __init of_find_i2c_driver(struct device_node *node,
        for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
                if (!of_device_is_compatible(node, i2c_devices[i].of_device))
                        continue;
-               if (strlcpy(info->driver_name, i2c_devices[i].i2c_driver,
-                           KOBJ_NAME_LEN) >= KOBJ_NAME_LEN ||
-                   strlcpy(info->type, i2c_devices[i].i2c_type,
+               if (strlcpy(info->type, i2c_devices[i].i2c_type,
                            I2C_NAME_SIZE) >= I2C_NAME_SIZE)
                        return -ENOMEM;
                return 0;
        }
+
+       pr_warning("fsl_soc.c: unrecognized i2c node %s\n",
+               (const char *) of_get_property(node, "compatible", NULL));
+
        return -ENODEV;
 }
 
@@ -494,6 +496,8 @@ static int __init fsl_i2c_of_init(void)
                struct resource r[2];
                struct fsl_i2c_platform_data i2c_data;
                const unsigned char *flags = NULL;
+               int idx;
+               const u32 *iprop;
 
                memset(&r, 0, sizeof(r));
                memset(&i2c_data, 0, sizeof(i2c_data));
@@ -504,7 +508,10 @@ static int __init fsl_i2c_of_init(void)
 
                of_irq_to_resource(np, 0, &r[1]);
 
-               i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
+               iprop = of_get_property(np, "cell-index", NULL);
+               idx = iprop ? *iprop : i;
+
+               i2c_dev = platform_device_register_simple("fsl-i2c", idx, r, 2);
                if (IS_ERR(i2c_dev)) {
                        ret = PTR_ERR(i2c_dev);
                        goto err;
@@ -526,7 +533,8 @@ static int __init fsl_i2c_of_init(void)
                if (ret)
                        goto unreg;
 
-               of_register_i2c_devices(np, i++);
+               of_register_i2c_devices(np, idx);
+               i++;
        }
 
        return 0;