]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
net: phy: Disable external master access in bcm mdio mux driver
authorArun Parameswaran <arun.parameswaran@broadcom.com>
Thu, 2 Aug 2018 00:53:49 +0000 (17:53 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Aug 2018 21:36:49 +0000 (14:36 -0700)
Configure the scan control register in the Broadcom iProc
mdio mux driver to disable access to external master.

In some SoC's, the scan control register defaults to an incorrect
value.

Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mdio-mux-bcm-iproc.c

index 9b31670548433276a431458b69e515aa62debe7f..4a253c28edbc7fc91796611204ec8eab76294519 100644 (file)
@@ -22,6 +22,9 @@
 #include <linux/mdio-mux.h>
 #include <linux/delay.h>
 
+#define MDIO_SCAN_CTRL_OFFSET          0x008
+#define MDIO_SCAN_CTRL_OVRIDE_EXT_MSTR 28
+
 #define MDIO_PARAM_OFFSET              0x23c
 #define MDIO_PARAM_MIIM_CYCLE          29
 #define MDIO_PARAM_INTERNAL_SEL                25
@@ -53,6 +56,16 @@ struct iproc_mdiomux_desc {
        struct mii_bus *mii_bus;
 };
 
+static void mdio_mux_iproc_config(struct iproc_mdiomux_desc *md)
+{
+       u32 val;
+
+       /* Disable external mdio master access */
+       val = readl(md->base + MDIO_SCAN_CTRL_OFFSET);
+       val |= BIT(MDIO_SCAN_CTRL_OVRIDE_EXT_MSTR);
+       writel(val, md->base + MDIO_SCAN_CTRL_OFFSET);
+}
+
 static int iproc_mdio_wait_for_idle(void __iomem *base, bool result)
 {
        unsigned int timeout = 1000; /* loop for 1s */
@@ -216,6 +229,8 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev)
                goto out_register;
        }
 
+       mdio_mux_iproc_config(md);
+
        dev_info(md->dev, "iProc mdiomux registered\n");
        return 0;