From c5e1b87a87fa8ded31dbb297156e7296899a55b6 Mon Sep 17 00:00:00 2001 From: Markus Gothe <markus.gothe@genexis.eu> Date: Tue, 30 Nov 2021 17:44:09 +0100 Subject: [PATCH] Fixup how we use the RGMII bus on panther. The RGMII bus on the panther is special and weird. We just need to ensure it is working. This commit patch the code for communicating with via RGMII with the functional one used in 5.04L02. The new code in 5.04L02p1 will probably never work. --- ...03-Use-bus_read-for-RGMII-on-panther.patch | 91 +++++++++++++++++++ .../panther/bsp-patches/series | 1 + 2 files changed, 92 insertions(+) create mode 100644 iopsys-brcm63xx-arm/panther/bsp-patches/0003-Use-bus_read-for-RGMII-on-panther.patch 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 000000000..dc19c169c --- /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 26b0084ce..468728f28 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 -- GitLab