提交 1f57877a 编写于 作者: B Benjamin Herrenschmidt 提交者: Jeff Garzik

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: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: NStefan Roese <sr@denx.de>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 911b237d
...@@ -245,6 +245,7 @@ ...@@ -245,6 +245,7 @@
device_type = "rgmii-interface"; device_type = "rgmii-interface";
compatible = "ibm,rgmii-440epx", "ibm,rgmii"; compatible = "ibm,rgmii-440epx", "ibm,rgmii";
reg = <ef601000 8>; reg = <ef601000 8>;
has-mdio;
}; };
EMAC0: ethernet@ef600e00 { EMAC0: ethernet@ef600e00 {
......
...@@ -140,7 +140,7 @@ void rgmii_get_mdio(struct of_device *ofdev, int input) ...@@ -140,7 +140,7 @@ void rgmii_get_mdio(struct of_device *ofdev, int input)
RGMII_DBG2(dev, "get_mdio(%d)" NL, input); RGMII_DBG2(dev, "get_mdio(%d)" NL, input);
if (dev->type != RGMII_AXON) if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO))
return; return;
mutex_lock(&dev->lock); mutex_lock(&dev->lock);
...@@ -161,7 +161,7 @@ void rgmii_put_mdio(struct of_device *ofdev, int input) ...@@ -161,7 +161,7 @@ void rgmii_put_mdio(struct of_device *ofdev, int input)
RGMII_DBG2(dev, "put_mdio(%d)" NL, input); RGMII_DBG2(dev, "put_mdio(%d)" NL, input);
if (dev->type != RGMII_AXON) if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO))
return; return;
fer = in_be32(&p->fer); fer = in_be32(&p->fer);
...@@ -250,11 +250,13 @@ static int __devinit rgmii_probe(struct of_device *ofdev, ...@@ -250,11 +250,13 @@ static int __devinit rgmii_probe(struct of_device *ofdev,
goto err_free; goto err_free;
} }
/* Check for RGMII type */ /* Check for RGMII flags */
if (of_get_property(ofdev->node, "has-mdio", NULL))
dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO;
/* CAB lacks the right properties, fix this up */
if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon")) if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon"))
dev->type = RGMII_AXON; dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO;
else
dev->type = RGMII_STANDARD;
DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n", DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n",
in_be32(&dev->base->fer), in_be32(&dev->base->ssr)); in_be32(&dev->base->fer), in_be32(&dev->base->ssr));
...@@ -263,9 +265,9 @@ static int __devinit rgmii_probe(struct of_device *ofdev, ...@@ -263,9 +265,9 @@ static int __devinit rgmii_probe(struct of_device *ofdev,
out_be32(&dev->base->fer, 0); out_be32(&dev->base->fer, 0);
printk(KERN_INFO printk(KERN_INFO
"RGMII %s %s initialized\n", "RGMII %s initialized with%s MDIO support\n",
dev->type == RGMII_STANDARD ? "standard" : "axon", ofdev->node->full_name,
ofdev->node->full_name); (dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out");
wmb(); wmb();
dev_set_drvdata(&ofdev->dev, dev); dev_set_drvdata(&ofdev->dev, dev);
......
...@@ -35,8 +35,9 @@ struct rgmii_regs { ...@@ -35,8 +35,9 @@ struct rgmii_regs {
struct rgmii_instance { struct rgmii_instance {
struct rgmii_regs __iomem *base; struct rgmii_regs __iomem *base;
/* Type of RGMII bridge */ /* RGMII bridge flags */
int type; int flags;
#define EMAC_RGMII_FLAG_HAS_MDIO 0x00000001
/* Only one EMAC whacks us at a time */ /* Only one EMAC whacks us at a time */
struct mutex lock; struct mutex lock;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册