aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/of_mdio.c
diff options
context:
space:
mode:
authorJeremy Kerr <jeremy.kerr@canonical.com>2010-01-30 03:45:26 -0500
committerGrant Likely <grant.likely@secretlab.ca>2010-02-09 10:34:10 -0500
commit337148812f97368a8ec4a69f1691e4c5ce3af494 (patch)
tree3fa2e5477c657cb2ebc40db9182d0989a5d60e13 /drivers/of/of_mdio.c
parent2e89e685a8fd0e8334de967739d11e2e28c1a4dd (diff)
of: assume big-endian properties, adding conversions where necessary
Properties in the device tree are specified as big-endian. At present, the only platforms to support device trees are also big-endian, so we've been acessing the properties as raw values. We'd like to add device tree support to little-endian platforms too, so add endian conversion to the sites where we access property values in the common of code. Compiled on powerpc (ppc44x_defconfig & ppc64_defconfig) and arm (fdt support only for now). Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of/of_mdio.c')
-rw-r--r--drivers/of/of_mdio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 4b22ba568b19..18ecae4a4375 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -51,7 +51,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
51 51
52 /* Loop over the child nodes and register a phy_device for each one */ 52 /* Loop over the child nodes and register a phy_device for each one */
53 for_each_child_of_node(np, child) { 53 for_each_child_of_node(np, child) {
54 const u32 *addr; 54 const __be32 *addr;
55 int len; 55 int len;
56 56
57 /* A PHY must have a reg property in the range [0-31] */ 57 /* A PHY must have a reg property in the range [0-31] */
@@ -68,7 +68,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
68 mdio->irq[*addr] = PHY_POLL; 68 mdio->irq[*addr] = PHY_POLL;
69 } 69 }
70 70
71 phy = get_phy_device(mdio, *addr); 71 phy = get_phy_device(mdio, be32_to_cpup(addr));
72 if (!phy) { 72 if (!phy) {
73 dev_err(&mdio->dev, "error probing PHY at address %i\n", 73 dev_err(&mdio->dev, "error probing PHY at address %i\n",
74 *addr); 74 *addr);
@@ -160,7 +160,7 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
160 struct device_node *net_np; 160 struct device_node *net_np;
161 char bus_id[MII_BUS_ID_SIZE + 3]; 161 char bus_id[MII_BUS_ID_SIZE + 3];
162 struct phy_device *phy; 162 struct phy_device *phy;
163 const u32 *phy_id; 163 const __be32 *phy_id;
164 int sz; 164 int sz;
165 165
166 if (!dev->dev.parent) 166 if (!dev->dev.parent)
@@ -174,7 +174,7 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
174 if (!phy_id || sz < sizeof(*phy_id)) 174 if (!phy_id || sz < sizeof(*phy_id))
175 return NULL; 175 return NULL;
176 176
177 sprintf(bus_id, PHY_ID_FMT, "0", phy_id[0]); 177 sprintf(bus_id, PHY_ID_FMT, "0", be32_to_cpu(phy_id[0]));
178 178
179 phy = phy_connect(dev, bus_id, hndlr, 0, iface); 179 phy = phy_connect(dev, bus_id, hndlr, 0, iface);
180 return IS_ERR(phy) ? NULL : phy; 180 return IS_ERR(phy) ? NULL : phy;