9
0
Fork 0

net mii: add a parent pointer to miidevs and set it to the hardware device

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2011-08-15 09:30:46 +02:00
parent 6d16fbdcd4
commit 8fddb2edf6
13 changed files with 14 additions and 0 deletions

View File

@ -549,6 +549,7 @@ static int tse_probe(struct device_d *dev)
miidev->write = tse_phy_write;
miidev->flags = 0;
miidev->edev = edev;
miidev->parent = dev;
if (dev->platform_data != NULL)
miidev->address = *((int8_t *)(dev->platform_data));

View File

@ -541,6 +541,7 @@ static int dm9000_probe(struct device_d *dev)
priv->miidev.address = 0;
priv->miidev.flags = 0;
priv->miidev.edev = edev;
priv->miidev.parent = dev;
mii_register(&priv->miidev);
eth_register(edev);

View File

@ -503,6 +503,7 @@ static int ep93xx_eth_probe(struct device_d *dev)
priv->miidev.write = ep93xx_phy_write;
priv->miidev.address = 0;
priv->miidev.flags = 0;
priv->miidev.parent = dev;
priv->tx_dq.base = calloc(NUMTXDESC,
sizeof(struct tx_descriptor));

View File

@ -645,6 +645,7 @@ static int fec_probe(struct device_d *dev)
fec->miidev.address = pdata->phy_addr;
fec->miidev.flags = pdata->xcv_type == MII10 ? MIIDEV_FORCE_10 : 0;
fec->miidev.edev = edev;
fec->miidev.parent = dev;
mii_register(&fec->miidev);
}

View File

@ -688,6 +688,7 @@ int mpc5xxx_fec_probe(struct device_d *dev)
fec->miidev.address = CONFIG_PHY_ADDR;
fec->miidev.flags = pdata->xcv_type == MII10 ? MIIDEV_FORCE_10 : 0;
fec->miidev.edev = edev;
fec->miidev.parent = dev;
mii_register(&fec->miidev);
}

View File

@ -441,6 +441,7 @@ static int macb_probe(struct device_d *dev)
macb->miidev.flags = pdata->flags & AT91SAM_ETHER_FORCE_LINK ?
MIIDEV_FORCE_LINK : 0;
macb->miidev.edev = edev;
macb->miidev.parent = dev;
macb->flags = pdata->flags;
macb->rx_buffer = xmalloc(CFG_MACB_RX_BUFFER_SIZE);

View File

@ -210,6 +210,8 @@ int mii_register(struct mii_device *mdev)
mdev->dev.priv = mdev;
mdev->dev.id = -1;
strcpy(mdev->dev.name, "miidev");
if (mdev->parent)
dev_add_child(mdev->parent, &mdev->dev);
return register_device(&mdev->dev);
}

View File

@ -264,6 +264,7 @@ static int netx_eth_probe(struct device_d *dev)
priv->miidev.write = netx_miidev_write;
priv->miidev.address = 0;
priv->miidev.flags = 0;
priv->miidev.parent = dev;
netx_eth_init_phy();
mii_register(&priv->miidev);

View File

@ -1318,6 +1318,7 @@ static int smc91c111_probe(struct device_d *dev)
priv->miidev.address = 0;
priv->miidev.flags = 0;
priv->miidev.edev = edev;
priv->miidev.parent = dev;
priv->base = dev_request_mem_region(dev, 0);
smc91c111_reset(edev);

View File

@ -732,6 +732,7 @@ static int smc911x_probe(struct device_d *dev)
priv->miidev.address = 1;
priv->miidev.flags = 0;
priv->miidev.edev = edev;
priv->miidev.parent = dev;
priv->base = base;
smc911x_reset(edev);

View File

@ -474,6 +474,7 @@ static int asix_init_mii(struct usbnet *dev)
dev->miidev.address = asix_get_phy_addr(dev);
dev->miidev.flags = 0;
dev->miidev.edev = &dev->edev;
dev->miidev.parent = &dev->udev->dev;
return mii_register(&dev->miidev);
}

View File

@ -444,6 +444,7 @@ static int smsc95xx_phy_initialize(struct usbnet *dev)
dev->miidev.address = 1; /* FIXME: asix_get_phy_addr(dev); */
dev->miidev.flags = 0;
dev->miidev.edev = &dev->edev;
dev->miidev.parent = &dev->udev->dev;
// dev->miidev.name = dev->edev.name;
/* reset phy and wait for reset to complete */

View File

@ -33,6 +33,7 @@
struct mii_device {
struct device_d dev;
struct device_d *parent;
int address; /* The address the phy has on the bus */
int (*read) (struct mii_device *dev, int addr, int reg);