Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
[powerpc.git] / arch / powerpc / sysdev / tsi108_dev.c
index 26a0cc8..7d3b09b 100644 (file)
@@ -9,7 +9,6 @@
  * option) any later version.
  */
 
-#include <linux/config.h>
 #include <linux/stddef.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -49,7 +48,7 @@ phys_addr_t get_csrbase(void)
        tsi = of_find_node_by_type(NULL, "tsi-bridge");
        if (tsi) {
                unsigned int size;
-               void *prop = get_property(tsi, "reg", &size);
+               const void *prop = of_get_property(tsi, "reg", &size);
                tsi108_csr_base = of_translate_address(tsi, prop);
                of_node_put(tsi);
        };
@@ -78,10 +77,10 @@ static int __init tsi108_eth_of_init(void)
                struct resource r[2];
                struct device_node *phy;
                hw_info tsi_eth_data;
-               unsigned int *id;
-               unsigned int *phy_id;
-               void *mac_addr;
-               phandle *ph;
+               const unsigned int *id;
+               const unsigned int *phy_id;
+               const void *mac_addr;
+               const phandle *ph;
 
                memset(r, 0, sizeof(r));
                memset(&tsi_eth_data, 0, sizeof(tsi_eth_data));
@@ -93,23 +92,26 @@ static int __init tsi108_eth_of_init(void)
                        goto err;
 
                r[1].name = "tx";
-               r[1].start = np->intrs[0].line;
-               r[1].end = np->intrs[0].line;
+               r[1].start = irq_of_parse_and_map(np, 0);
+               r[1].end = irq_of_parse_and_map(np, 0);
                r[1].flags = IORESOURCE_IRQ;
+               DBG("%s: name:start->end = %s:0x%lx-> 0x%lx\n",
+                       __FUNCTION__,r[1].name, r[1].start, r[1].end);
 
                tsi_eth_dev =
                    platform_device_register_simple("tsi-ethernet", i, &r[0],
-                                                   np->n_intrs + 1);
+                                                   1);
 
                if (IS_ERR(tsi_eth_dev)) {
                        ret = PTR_ERR(tsi_eth_dev);
                        goto err;
                }
 
-               mac_addr = get_property(np, "address", NULL);
-               memcpy(tsi_eth_data.mac_addr, mac_addr, 6);
+               mac_addr = of_get_mac_address(np);
+               if (mac_addr)
+                       memcpy(tsi_eth_data.mac_addr, mac_addr, 6);
 
-               ph = (phandle *) get_property(np, "phy-handle", NULL);
+               ph = of_get_property(np, "phy-handle", NULL);
                phy = of_find_node_by_phandle(*ph);
 
                if (phy == NULL) {
@@ -117,8 +119,8 @@ static int __init tsi108_eth_of_init(void)
                        goto unreg;
                }
 
-               id = (u32 *) get_property(phy, "reg", NULL);
-               phy_id = (u32 *) get_property(phy, "phy-id", NULL);
+               id = of_get_property(phy, "reg", NULL);
+               phy_id = of_get_property(phy, "phy-id", NULL);
                ret = of_address_to_resource(phy, 0, &res);
                if (ret) {
                        of_node_put(phy);
@@ -127,7 +129,9 @@ static int __init tsi108_eth_of_init(void)
                tsi_eth_data.regs = r[0].start;
                tsi_eth_data.phyregs = res.start;
                tsi_eth_data.phy = *phy_id;
-               tsi_eth_data.irq_num = np->intrs[0].line;
+               tsi_eth_data.irq_num = irq_of_parse_and_map(np, 0);
+               if (of_device_is_compatible(phy, "bcm54xx"))
+                       tsi_eth_data.phy_type = TSI108_PHY_BCM54XX;
                of_node_put(phy);
                ret =
                    platform_device_add_data(tsi_eth_dev, &tsi_eth_data,