]> Git Repo - linux.git/commitdiff
NET: mdio-octeon: Enable the hardware before using it.
authorDavid Daney <[email protected]>
Fri, 2 Apr 2010 01:17:54 +0000 (18:17 -0700)
committerRalf Baechle <[email protected]>
Fri, 30 Apr 2010 19:52:52 +0000 (20:52 +0100)
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: David Daney <[email protected]>
To: [email protected]
To: [email protected]
To: [email protected]
Patchwork: http://patchwork.linux-mips.org/patch/1090/
Acked-by: David S. Miller <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ralf Baechle <[email protected]>
drivers/net/phy/mdio-octeon.c

index a872aea4ed7455f5b3f539c193232b4297cab860..f443d43edd80e242fba17e9ea3cf9de7c7b403fb 100644 (file)
@@ -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)
 {
        struct octeon_mdiobus *bus;
+       union cvmx_smix_en smi_en;
        int i;
        int err = -ENOENT;
 
@@ -103,6 +104,10 @@ static int __init octeon_mdiobus_probe(struct platform_device *pdev)
        if (!bus->mii_bus)
                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
         * interrupts, we need to poll.
@@ -133,17 +138,22 @@ err_register:
 
 err:
        devm_kfree(&pdev->dev, bus);
+       smi_en.u64 = 0;
+       cvmx_write_csr(CVMX_SMIX_EN(bus->unit), smi_en.u64);
        return err;
 }
 
 static int __exit octeon_mdiobus_remove(struct platform_device *pdev)
 {
        struct octeon_mdiobus *bus;
+       union cvmx_smix_en smi_en;
 
        bus = dev_get_drvdata(&pdev->dev);
 
        mdiobus_unregister(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;
 }
 
This page took 0.055261 seconds and 4 git commands to generate.