Index: drivers/net/gianfar_mii.c =================================================================== --- drivers/net/gianfar_mii.c (revision 4872) +++ drivers/net/gianfar_mii.c (working copy) @@ -101,25 +101,36 @@ /* Write value to the PHY at mii_id at register regnum, * on the bus, waiting until the write is done before returning. * All PHY configuration is done through the TSEC1 MIIM regs */ -int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) +int _gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) { struct gfar_mii __iomem *regs = (void __iomem *)bus->priv; /* Write to the local MII regs */ return(gfar_local_mdio_write(regs, mii_id, regnum, value)); } +int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) +{ + int res = _gfar_mdio_write(bus, mii_id, regnum, value); + printk("%s(%p, %d, %d, %x) = %x\n", __FUNCTION__, bus, mii_id, regnum, value, res); + return res; +} /* Read the bus for PHY at addr mii_id, register regnum, and * return the value. Clears miimcom first. All PHY * configuration has to be done through the TSEC1 MIIM regs */ -int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) +int _gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) { struct gfar_mii __iomem *regs = (void __iomem *)bus->priv; /* Read the local MII regs */ return(gfar_local_mdio_read(regs, mii_id, regnum)); } - +int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) +{ + int res = _gfar_mdio_read(bus, mii_id, regnum); + printk("%s(%p, %d, %d) = %x\n", __FUNCTION__, bus, mii_id, regnum, res); + return res; +} /* Reset the MIIM registers, and wait for the bus to free */ static int gfar_mdio_reset(struct mii_bus *bus) { @@ -150,6 +161,9 @@ return 0; } +// HACK +struct device *gianfar_mdio; +// HACK static int gfar_mdio_probe(struct device *dev) { @@ -174,6 +188,11 @@ new_bus->reset = &gfar_mdio_reset, snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id); + // HACK + gianfar_mdio = dev; + printk("Set gianfar_mdio = %p, mii_bus = %p\n", dev, new_bus); + // HACK + pdata = (struct gianfar_mdio_data *)pdev->dev.platform_data; if (NULL == pdata) { Index: drivers/net/gianfar.c =================================================================== --- drivers/net/gianfar.c (revision 4872) +++ drivers/net/gianfar.c (working copy) @@ -152,6 +152,30 @@ return (priv->vlan_enable || priv->rx_csum_enable); } +// HACK +#include +struct device *gianfar_eth0; +extern struct device *gianfar_mdio; +struct dsa_platform_data _switch_data = { + .port_names[0] = "lan1.1", + .port_names[1] = "lan1.2", + .port_names[2] = "lan1.3", + .port_names[3] = "lan1.4", + .port_names[4] = "lan1.5", + .port_names[5] = "lan1.6", + .port_names[6] = "lan1.7", + .port_names[7] = "lan1.8", + .port_names[10] = "cpu", +}; + +struct platform_device _switch_device = { + .name = "dsa", + .id = 0, + .num_resources = 0, +}; + +// HACK + /* Set up the ethernet device structure, private data, * and anything else we need before we start */ static int gfar_probe(struct platform_device *pdev) @@ -164,6 +188,17 @@ int err = 0, irq; DECLARE_MAC_BUF(mac); + // HACK + if (!gianfar_eth0) { + gianfar_eth0 = &pdev->dev; + printk("Set gianfar_eth0 = %p\n", &pdev->dev); + _switch_data.netdev = gianfar_eth0; + _switch_data.mii_bus = gianfar_mdio; + _switch_device.dev.platform_data = &_switch_data; + platform_device_register(&_switch_device); + } + // HACK + einfo = (struct gianfar_platform_data *) pdev->dev.platform_data; if (NULL == einfo) {