aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/tsi108_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev/tsi108_dev.c')
-rw-r--r--arch/powerpc/sysdev/tsi108_dev.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c
index 7d3b09b7d544..a113d800cbf0 100644
--- a/arch/powerpc/sysdev/tsi108_dev.c
+++ b/arch/powerpc/sysdev/tsi108_dev.c
@@ -72,12 +72,11 @@ static int __init tsi108_eth_of_init(void)
72 int ret; 72 int ret;
73 73
74 for (np = NULL, i = 0; 74 for (np = NULL, i = 0;
75 (np = of_find_compatible_node(np, "network", "tsi-ethernet")) != NULL; 75 (np = of_find_compatible_node(np, "network", "tsi108-ethernet")) != NULL;
76 i++) { 76 i++) {
77 struct resource r[2]; 77 struct resource r[2];
78 struct device_node *phy; 78 struct device_node *phy, *mdio;
79 hw_info tsi_eth_data; 79 hw_info tsi_eth_data;
80 const unsigned int *id;
81 const unsigned int *phy_id; 80 const unsigned int *phy_id;
82 const void *mac_addr; 81 const void *mac_addr;
83 const phandle *ph; 82 const phandle *ph;
@@ -111,6 +110,13 @@ static int __init tsi108_eth_of_init(void)
111 if (mac_addr) 110 if (mac_addr)
112 memcpy(tsi_eth_data.mac_addr, mac_addr, 6); 111 memcpy(tsi_eth_data.mac_addr, mac_addr, 6);
113 112
113 ph = of_get_property(np, "mdio-handle", NULL);
114 mdio = of_find_node_by_phandle(*ph);
115 ret = of_address_to_resource(mdio, 0, &res);
116 of_node_put(mdio);
117 if (ret)
118 goto unreg;
119
114 ph = of_get_property(np, "phy-handle", NULL); 120 ph = of_get_property(np, "phy-handle", NULL);
115 phy = of_find_node_by_phandle(*ph); 121 phy = of_find_node_by_phandle(*ph);
116 122
@@ -119,20 +125,25 @@ static int __init tsi108_eth_of_init(void)
119 goto unreg; 125 goto unreg;
120 } 126 }
121 127
122 id = of_get_property(phy, "reg", NULL); 128 phy_id = of_get_property(phy, "reg", NULL);
123 phy_id = of_get_property(phy, "phy-id", NULL); 129
124 ret = of_address_to_resource(phy, 0, &res);
125 if (ret) {
126 of_node_put(phy);
127 goto unreg;
128 }
129 tsi_eth_data.regs = r[0].start; 130 tsi_eth_data.regs = r[0].start;
130 tsi_eth_data.phyregs = res.start; 131 tsi_eth_data.phyregs = res.start;
131 tsi_eth_data.phy = *phy_id; 132 tsi_eth_data.phy = *phy_id;
132 tsi_eth_data.irq_num = irq_of_parse_and_map(np, 0); 133 tsi_eth_data.irq_num = irq_of_parse_and_map(np, 0);
133 if (of_device_is_compatible(phy, "bcm54xx")) 134
135 /* Some boards with the TSI108 bridge (e.g. Holly)
136 * have a miswiring of the ethernet PHYs which
137 * requires a workaround. The special
138 * "txc-rxc-delay-disable" property enables this
139 * workaround. FIXME: Need to port the tsi108_eth
140 * driver itself to phylib and use a non-misleading
141 * name for the workaround flag - it's not actually to
142 * do with the model of PHY in use */
143 if (of_get_property(phy, "txc-rxc-delay-disable", NULL))
134 tsi_eth_data.phy_type = TSI108_PHY_BCM54XX; 144 tsi_eth_data.phy_type = TSI108_PHY_BCM54XX;
135 of_node_put(phy); 145 of_node_put(phy);
146
136 ret = 147 ret =
137 platform_device_add_data(tsi_eth_dev, &tsi_eth_data, 148 platform_device_add_data(tsi_eth_dev, &tsi_eth_data,
138 sizeof(hw_info)); 149 sizeof(hw_info));