Commit 6c17812d authored by David Daney's avatar David Daney Committed by Ralf Baechle

NET: mdio-octeon: Enable the hardware before using it.

In some cases the mdio bus is not enabled at the time of probing.
This prevents anything from working, so we will enable it before
trying to use it, and disable it when the driver is removed.
Signed-off-by: default avatarDavid Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: netdev@vger.kernel.org
To: gregkh@suse.de
Patchwork: http://patchwork.linux-mips.org/patch/1090/Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 20f12160
...@@ -88,6 +88,7 @@ static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id, ...@@ -88,6 +88,7 @@ static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id,
static int __init octeon_mdiobus_probe(struct platform_device *pdev) static int __init octeon_mdiobus_probe(struct platform_device *pdev)
{ {
struct octeon_mdiobus *bus; struct octeon_mdiobus *bus;
union cvmx_smix_en smi_en;
int i; int i;
int err = -ENOENT; int err = -ENOENT;
...@@ -103,6 +104,10 @@ static int __init octeon_mdiobus_probe(struct platform_device *pdev) ...@@ -103,6 +104,10 @@ static int __init octeon_mdiobus_probe(struct platform_device *pdev)
if (!bus->mii_bus) if (!bus->mii_bus)
goto err; goto err;
smi_en.u64 = 0;
smi_en.s.en = 1;
cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
/* /*
* Standard Octeon evaluation boards don't support phy * Standard Octeon evaluation boards don't support phy
* interrupts, we need to poll. * interrupts, we need to poll.
...@@ -133,17 +138,22 @@ static int __init octeon_mdiobus_probe(struct platform_device *pdev) ...@@ -133,17 +138,22 @@ static int __init octeon_mdiobus_probe(struct platform_device *pdev)
err: err:
devm_kfree(&pdev->dev, bus); devm_kfree(&pdev->dev, bus);
smi_en.u64 = 0;
cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
return err; return err;
} }
static int __exit octeon_mdiobus_remove(struct platform_device *pdev) static int __exit octeon_mdiobus_remove(struct platform_device *pdev)
{ {
struct octeon_mdiobus *bus; struct octeon_mdiobus *bus;
union cvmx_smix_en smi_en;
bus = dev_get_drvdata(&pdev->dev); bus = dev_get_drvdata(&pdev->dev);
mdiobus_unregister(bus->mii_bus); mdiobus_unregister(bus->mii_bus);
mdiobus_free(bus->mii_bus); mdiobus_free(bus->mii_bus);
smi_en.u64 = 0;
cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment