aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/tsi108_dev.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-06-13 00:53:00 -0400
committerPaul Mackerras <paulus@samba.org>2007-06-14 08:30:17 -0400
commite58ca3de64927e96beb2f1594975dc4a29b79459 (patch)
tree135627322650910d05fe9ee988efd55832758b82 /arch/powerpc/sysdev/tsi108_dev.c
parente60c526fba3ba77070d0c97fac52c86243ad694d (diff)
[POWERPC] Fix problems with device tree representation of TSI-1xx bridges
This fixes some problems with the way the some things represented in the device tree for the Holly and Taiga boards. This means changes both to the dts files, and to the code which instantiates the tsi108 ethernet platform devices based on the device tree. - First, and most importantly, the ethernet PHYs are given with an identical 'reg' property. This reg currently encodes the accessible register used to initiate mdio interaction with the PHYs, rather than a meaningful address on the parent bus (mdio in this case), which is incorrect. Instead we give the address of these registers as 'reg' in the mdio node itself, and encode the ID of each phy in their 'reg' propertyies. - Currently the platform device constructor enables a workaround in the tsi108 ethernet driver based on the compatible property of the PHY. This is incorrect, because the workaround in question is necessary due to the board's wiring of the PHY, not the model of PHY itself. This patch alters the constructor to instead enable the workaround based on a new special property in the PHY node. - The compatible properties on a number of nodes in the device tree are insufficiently precise. In particular the PHYs give only "bcm54xx", which is broken, since there are many bcm54xx PHY models, and they have differences which matter. The mdio had a compatible property of "tsi-ethernet" identical to the ethernet MAC nodes, which doesn't make sense. The ethernet, i2c, bridge and PCI nodes were given only as "tsi-*" which is somewhat inprecise, we replace with "tsi108-*" in the case of Taiga (which has a TSI108 bridge), and "tsi109-*", "tsi108-*" in the case of Holly (which has a TSI109 bridge). - We remove some "model" properties from the ethernets on Taiga board which were neither useful nor adequately precise. - On Holly we change to using a dtc label instead of a full path to reference the MPIC node, which makes the dts a little more readable. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
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));