diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2007-12-04 19:14:28 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-12-07 15:09:06 -0500 |
commit | 1f57877a39105ec4d99d63d02058f6db6ca6abe0 (patch) | |
tree | e975e9f66a8b66687b66d32f00160c9fcc98d699 /drivers | |
parent | 911b237d7d327db5371a762f4d8d8cd9ea763662 (diff) |
ibm_newemac: Cleanup/Fix RGMII MDIO support detection
More than just "AXON" version of EMAC RGMII supports MDIO, so replace
the current test with a generic property in the device-tree that
indicates such support.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Stefan Roese <sr@denx.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ibm_newemac/rgmii.c | 20 | ||||
-rw-r--r-- | drivers/net/ibm_newemac/rgmii.h | 5 |
2 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c index de416951a435..328726978587 100644 --- a/drivers/net/ibm_newemac/rgmii.c +++ b/drivers/net/ibm_newemac/rgmii.c | |||
@@ -140,7 +140,7 @@ void rgmii_get_mdio(struct of_device *ofdev, int input) | |||
140 | 140 | ||
141 | RGMII_DBG2(dev, "get_mdio(%d)" NL, input); | 141 | RGMII_DBG2(dev, "get_mdio(%d)" NL, input); |
142 | 142 | ||
143 | if (dev->type != RGMII_AXON) | 143 | if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO)) |
144 | return; | 144 | return; |
145 | 145 | ||
146 | mutex_lock(&dev->lock); | 146 | mutex_lock(&dev->lock); |
@@ -161,7 +161,7 @@ void rgmii_put_mdio(struct of_device *ofdev, int input) | |||
161 | 161 | ||
162 | RGMII_DBG2(dev, "put_mdio(%d)" NL, input); | 162 | RGMII_DBG2(dev, "put_mdio(%d)" NL, input); |
163 | 163 | ||
164 | if (dev->type != RGMII_AXON) | 164 | if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO)) |
165 | return; | 165 | return; |
166 | 166 | ||
167 | fer = in_be32(&p->fer); | 167 | fer = in_be32(&p->fer); |
@@ -250,11 +250,13 @@ static int __devinit rgmii_probe(struct of_device *ofdev, | |||
250 | goto err_free; | 250 | goto err_free; |
251 | } | 251 | } |
252 | 252 | ||
253 | /* Check for RGMII type */ | 253 | /* Check for RGMII flags */ |
254 | if (of_get_property(ofdev->node, "has-mdio", NULL)) | ||
255 | dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; | ||
256 | |||
257 | /* CAB lacks the right properties, fix this up */ | ||
254 | if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon")) | 258 | if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon")) |
255 | dev->type = RGMII_AXON; | 259 | dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO; |
256 | else | ||
257 | dev->type = RGMII_STANDARD; | ||
258 | 260 | ||
259 | DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n", | 261 | DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n", |
260 | in_be32(&dev->base->fer), in_be32(&dev->base->ssr)); | 262 | in_be32(&dev->base->fer), in_be32(&dev->base->ssr)); |
@@ -263,9 +265,9 @@ static int __devinit rgmii_probe(struct of_device *ofdev, | |||
263 | out_be32(&dev->base->fer, 0); | 265 | out_be32(&dev->base->fer, 0); |
264 | 266 | ||
265 | printk(KERN_INFO | 267 | printk(KERN_INFO |
266 | "RGMII %s %s initialized\n", | 268 | "RGMII %s initialized with%s MDIO support\n", |
267 | dev->type == RGMII_STANDARD ? "standard" : "axon", | 269 | ofdev->node->full_name, |
268 | ofdev->node->full_name); | 270 | (dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out"); |
269 | 271 | ||
270 | wmb(); | 272 | wmb(); |
271 | dev_set_drvdata(&ofdev->dev, dev); | 273 | dev_set_drvdata(&ofdev->dev, dev); |
diff --git a/drivers/net/ibm_newemac/rgmii.h b/drivers/net/ibm_newemac/rgmii.h index 57806833121e..44a0f201064d 100644 --- a/drivers/net/ibm_newemac/rgmii.h +++ b/drivers/net/ibm_newemac/rgmii.h | |||
@@ -35,8 +35,9 @@ struct rgmii_regs { | |||
35 | struct rgmii_instance { | 35 | struct rgmii_instance { |
36 | struct rgmii_regs __iomem *base; | 36 | struct rgmii_regs __iomem *base; |
37 | 37 | ||
38 | /* Type of RGMII bridge */ | 38 | /* RGMII bridge flags */ |
39 | int type; | 39 | int flags; |
40 | #define EMAC_RGMII_FLAG_HAS_MDIO 0x00000001 | ||
40 | 41 | ||
41 | /* Only one EMAC whacks us at a time */ | 42 | /* Only one EMAC whacks us at a time */ |
42 | struct mutex lock; | 43 | struct mutex lock; |