diff --git a/iopsys-brcm63xx-arm/panther/bsp-patches/0003-Use-bus_read-for-RGMII-on-panther.patch b/iopsys-brcm63xx-arm/panther/bsp-patches/0003-Use-bus_read-for-RGMII-on-panther.patch new file mode 100644 index 0000000000000000000000000000000000000000..dc19c169c40949e72eea8f61cfc53625ab1f342d --- /dev/null +++ b/iopsys-brcm63xx-arm/panther/bsp-patches/0003-Use-bus_read-for-RGMII-on-panther.patch @@ -0,0 +1,91 @@ +From b791d53f15b87d635fcce9a6359a82d577462be6 Mon Sep 17 00:00:00 2001 +From: Markus Gothe <markus.gothe@genexis.eu> +Date: Tue, 30 Nov 2021 18:25:01 +0100 +Subject: [PATCH] Use bus_read() for RGMII on panther + +--- + .../net/enet/impl7/bcmenet_ioctl_compat.c | 59 +++++++++++++++---- + 1 file changed, 48 insertions(+), 11 deletions(-) + +diff --git a/bcm963xx/bcmdrivers/opensource/net/enet/impl7/bcmenet_ioctl_compat.c b/bcm963xx/bcmdrivers/opensource/net/enet/impl7/bcmenet_ioctl_compat.c +index 38c5db77d..20b21475a 100644 +--- a/bcm963xx/bcmdrivers/opensource/net/enet/impl7/bcmenet_ioctl_compat.c ++++ b/bcm963xx/bcmdrivers/opensource/net/enet/impl7/bcmenet_ioctl_compat.c +@@ -1870,26 +1870,63 @@ cd_end: + #elif defined(CONFIG_BCM_PON) + { + uint16_t val = ethctl->val; +- phy_dev_t *phy_dev = phy_dev_get(PHY_TYPE_UNKNOWN, ethctl->phy_addr); ++ bus_drv_t *bus_drv = NULL; + +- if (!phy_dev || !phy_dev->phy_drv) ++ if (ethctl->flags == ETHCTL_FLAG_ACCESS_INT_PHY) + { +- enet_err("No PHY at address %d has been found.\n", ethctl->phy_addr); ++#ifdef CONFIG_BCM96858 ++ bus_drv = bus_drv_get(BUS_TYPE_6858_LPORT); ++#endif ++#ifdef CONFIG_BCM96856 ++ bus_drv = bus_drv_get(BUS_TYPE_MDIO_V1_INT); ++#endif ++#ifdef CONFIG_BCM96846 ++ bus_drv = bus_drv_get(BUS_TYPE_MDIO_V1_INT); ++#endif ++#ifdef CONFIG_BCM96878 ++ bus_drv = bus_drv_get(BUS_TYPE_MDIO_V1_INT); ++#endif ++ } ++ else if (ethctl->flags == ETHCTL_FLAG_ACCESS_EXT_PHY) ++ { ++#ifdef CONFIG_BCM96858 ++ bus_drv = bus_drv_get(BUS_TYPE_6858_LPORT); ++#endif ++#ifdef CONFIG_BCM96856 ++ bus_drv = bus_drv_get(BUS_TYPE_MDIO_V1_EXT); ++#endif ++#ifdef CONFIG_BCM96846 ++ bus_drv = bus_drv_get(BUS_TYPE_MDIO_V1_EXT); ++#endif ++#ifdef CONFIG_BCM96878 ++ bus_drv = bus_drv_get(BUS_TYPE_MDIO_V1_EXT); ++#endif ++ } ++ ++ if (!bus_drv) ++ { ++ enet_err("cannot resolve phy bus driver for phy_addr %d, flags %d\n", ethctl->phy_addr, ethctl->flags); + return -EFAULT; + } + + if (ethctl->op == ETHGETMIIREG) +- ret = ethsw_phy_exp_read(phy_dev, ethctl->phy_reg, &val); +- else +- ret = ethsw_phy_exp_write(phy_dev, ethctl->phy_reg, val); ++ { ++ if (bus_read(bus_drv, ethctl->phy_addr, ethctl->phy_reg, &val)) ++ return -EFAULT; + +- if (ret) +- return ret; ++ ethctl->val = val; ++ enet_dbg("get phy_id: %d; reg_num = %d; val = 0x%x \n", ethctl->phy_addr, ethctl->phy_reg, val); + +- ethctl->val = val; ++ if (copy_to_user(rq->ifr_data, ethctl, sizeof(struct ethctl_data))) ++ return -EFAULT; ++ } ++ else ++ { ++ if (bus_write(bus_drv, ethctl->phy_addr, ethctl->phy_reg, ethctl->val)) ++ return -EFAULT; + +- if (copy_to_user(rq->ifr_data, ethctl, sizeof(struct ethctl_data))) +- return -EFAULT; ++ enet_dbg("set phy_id: %d; reg_num = %d; val = 0x%x \n", ethctl->phy_addr, ethctl->phy_reg, ethctl->val); ++ } + + return 0; + } +-- +2.34.0 + diff --git a/iopsys-brcm63xx-arm/panther/bsp-patches/series b/iopsys-brcm63xx-arm/panther/bsp-patches/series index 26b0084ce2f9f1187a31fe8e340e621ca3fbbcb1..468728f28059aa1bccaffa1a72103dada24dea4f 100644 --- a/iopsys-brcm63xx-arm/panther/bsp-patches/series +++ b/iopsys-brcm63xx-arm/panther/bsp-patches/series @@ -1,2 +1,3 @@ 0001-Disable-EXT1-RGMII-in-u-boot-for-panther-devices.patch 0002-Force-full-duplex-on-RGMII.patch +0003-Use-bus_read-for-RGMII-on-panther.patch