bcm53xx: backport MDIO bus clock initialization fix
[openwrt/openwrt.git] / target / linux / bcm53xx / patches-4.9 / 060-0001-net-phy-Initialize-mdio-clock-at-probe-function.patch
1 From bb1a619735b4660f21bce3e728b937640024b4ad Mon Sep 17 00:00:00 2001
2 From: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>
3 Date: Wed, 8 Feb 2017 17:14:26 -0500
4 Subject: [PATCH] net: phy: Initialize mdio clock at probe function
5
6 USB PHYs need the MDIO clock divisor enabled earlier to work.
7 Initialize mdio clock divisor in probe function. The ext bus
8 bit available in the same register will be used by mdio mux
9 to enable external mdio.
10
11 Signed-off-by: Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com>
12 Fixes: ddc24ae1 ("net: phy: Broadcom iProc MDIO bus driver")
13 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
14 Signed-off-by: Jon Mason <jon.mason@broadcom.com>
15 Signed-off-by: David S. Miller <davem@davemloft.net>
16 ---
17 drivers/net/phy/mdio-bcm-iproc.c | 6 ++----
18 1 file changed, 2 insertions(+), 4 deletions(-)
19
20 --- a/drivers/net/phy/mdio-bcm-iproc.c
21 +++ b/drivers/net/phy/mdio-bcm-iproc.c
22 @@ -81,8 +81,6 @@ static int iproc_mdio_read(struct mii_bu
23 if (rc)
24 return rc;
25
26 - iproc_mdio_config_clk(priv->base);
27 -
28 /* Prepare the read operation */
29 cmd = (MII_DATA_TA_VAL << MII_DATA_TA_SHIFT) |
30 (reg << MII_DATA_RA_SHIFT) |
31 @@ -112,8 +110,6 @@ static int iproc_mdio_write(struct mii_b
32 if (rc)
33 return rc;
34
35 - iproc_mdio_config_clk(priv->base);
36 -
37 /* Prepare the write operation */
38 cmd = (MII_DATA_TA_VAL << MII_DATA_TA_SHIFT) |
39 (reg << MII_DATA_RA_SHIFT) |
40 @@ -163,6 +159,8 @@ static int iproc_mdio_probe(struct platf
41 bus->read = iproc_mdio_read;
42 bus->write = iproc_mdio_write;
43
44 + iproc_mdio_config_clk(priv->base);
45 +
46 rc = of_mdiobus_register(bus, pdev->dev.of_node);
47 if (rc) {
48 dev_err(&pdev->dev, "MDIO bus registration failed\n");