[PATCH v2 0/6] net: dwc_eth_qos: add support of device tree configuration for reset delay

It is the V2 version of [1] after Marek remarks: all commit are new.
I change the DWC_ETH_QOS STM32 variant by using generic eth phy driver.
This driver is updated to use the gpio reset and assert/deassert delay from DT with the generic binding defined in linux: Documentation/devicetree/bindings/net/ethernet-phy.yaml or in U-Boot: doc/device-tree-bindings/net/phy.txt
[1] net: dwc_eth_qos: add support of device tree configuration for reset delay http://patchwork.ozlabs.org/project/uboot/list/?series=238253&state=*
Changes in v2: - Update eth-phy driver (NEW) - use log macro in eth-phy driver (NEW) - update eth-phy driver to support STM32 binding with a mdio0 subnode (NEW) - remove unused element in the struct eqos_priv (NEW) - use generic ethernet phy for stm32 variant, this patch is a REWORK of previous serie: the device parsing is done in eth-phy driver and the gpio support is removed in stm32 variant: eqos_start/stop_resets_stm32 and eqos_probe_resources_stm32. - cleanup ops by adding a common null ops (NEW)
Patrick Delaunay (6): net: eth-phy: add support of device tree configuration for gpio reset net: eth-phy: use dev_dbg and log_notice net: eth-phy: manage subnode mdio0 net: dwc_eth_qos: remove the field phyaddr of the struct eqos_priv net: dwc_eth_qos: use generic ethernet phy for stm32 variant net: dwc: add a common empty ops eqos_null_ops
drivers/net/Kconfig | 1 + drivers/net/dwc_eth_qos.c | 152 +++++------------------------------ drivers/net/eth-phy-uclass.c | 78 +++++++++++++++--- 3 files changed, 91 insertions(+), 140 deletions(-)

The gpio reset and the assert or deassert delay are defined in generic binding of the ethernet phy in Linux: Documentation/devicetree/bindings/net/ethernet-phy.yaml
reset-gpios: maxItems: 1 description: The GPIO phandle and specifier for the PHY reset signal.
reset-assert-us: description: Delay after the reset was asserted in microseconds. If this property is missing the delay will be skipped.
reset-deassert-us: description: Delay after the reset was deasserted in microseconds. If this property is missing the delay will be skipped.
See also U-Boot: doc/device-tree-bindings/net/phy.txt
This patch adds the parsing of this common DT properties in the u-class "eth_phy_generic", used by default in the associated driver "eth_phy_generic_drv"
This parsing function eth_phy_of_to_plat can be reused by other ethernet phy drivers for this uclass UCLASS_ETH_PHY.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
Changes in v2: - Update eth-phy driver (NEW)
drivers/net/eth-phy-uclass.c | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c index 07aebd935e..153f6909eb 100644 --- a/drivers/net/eth-phy-uclass.c +++ b/drivers/net/eth-phy-uclass.c @@ -6,12 +6,17 @@ #include <common.h> #include <dm.h> #include <net.h> +#include <asm-generic/gpio.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h> #include <dm/lists.h> +#include <linux/delay.h>
struct eth_phy_device_priv { struct mii_dev *mdio_bus; + struct gpio_desc reset_gpio; + u32 reset_assert_delay; + u32 reset_deassert_delay; };
int eth_phy_binds_nodes(struct udevice *eth_dev) @@ -110,13 +115,58 @@ int eth_phy_get_addr(struct udevice *dev) return reg; }
+/* parsing generic properties of devicetree/bindings/net/ethernet-phy.yaml */ +static int eth_phy_of_to_plat(struct udevice *dev) +{ + struct eth_phy_device_priv *uc_priv = dev_get_uclass_priv(dev); + int ret; + + /* search "reset-gpios" in phy node */ + ret = gpio_request_by_name(dev, "reset-gpios", 0, + &uc_priv->reset_gpio, + GPIOD_IS_OUT); + if (ret != -ENOENT) + return ret; + + uc_priv->reset_assert_delay = dev_read_u32_default(dev, "reset-assert-us", 0); + uc_priv->reset_deassert_delay = dev_read_u32_default(dev, "reset-deassert-us", 0); + + return 0; +} + +void eth_phy_reset(struct udevice *dev, int value) +{ + struct eth_phy_device_priv *uc_priv = dev_get_uclass_priv(dev); + u32 delay; + + if (!dm_gpio_is_valid(&uc_priv->reset_gpio)) + return; + + dm_gpio_set_value(&uc_priv->reset_gpio, value); + + delay = value ? uc_priv->reset_assert_delay : uc_priv->reset_deassert_delay; + if (delay) + udelay(delay); +} + +static int eth_phy_pre_probe(struct udevice *dev) +{ + /* Assert and deassert the reset signal */ + eth_phy_reset(dev, 1); + eth_phy_reset(dev, 0); + + return 0; +} + UCLASS_DRIVER(eth_phy_generic) = { .id = UCLASS_ETH_PHY, .name = "eth_phy_generic", .per_device_auto = sizeof(struct eth_phy_device_priv), + .pre_probe = eth_phy_pre_probe, };
U_BOOT_DRIVER(eth_phy_generic_drv) = { .name = "eth_phy_generic_drv", .id = UCLASS_ETH_PHY, + .of_to_plat = eth_phy_of_to_plat, };

On Mon, Apr 26, 2021 at 6:47 PM Patrick Delaunay patrick.delaunay@foss.st.com wrote:
The gpio reset and the assert or deassert delay are defined in generic binding of the ethernet phy in Linux: Documentation/devicetree/bindings/net/ethernet-phy.yaml
reset-gpios: maxItems: 1 description: The GPIO phandle and specifier for the PHY reset signal.
reset-assert-us: description: Delay after the reset was asserted in microseconds. If this property is missing the delay will be skipped.
reset-deassert-us: description: Delay after the reset was deasserted in microseconds. If this property is missing the delay will be skipped.
See also U-Boot: doc/device-tree-bindings/net/phy.txt
This patch adds the parsing of this common DT properties in the u-class "eth_phy_generic", used by default in the associated driver "eth_phy_generic_drv"
This parsing function eth_phy_of_to_plat can be reused by other ethernet phy drivers for this uclass UCLASS_ETH_PHY.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
Changes in v2:
- Update eth-phy driver (NEW)
drivers/net/eth-phy-uclass.c | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c index 07aebd935e..153f6909eb 100644 --- a/drivers/net/eth-phy-uclass.c +++ b/drivers/net/eth-phy-uclass.c @@ -6,12 +6,17 @@ #include <common.h> #include <dm.h> #include <net.h> +#include <asm-generic/gpio.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h> #include <dm/lists.h> +#include <linux/delay.h>
struct eth_phy_device_priv { struct mii_dev *mdio_bus;
struct gpio_desc reset_gpio;
u32 reset_assert_delay;
u32 reset_deassert_delay;
};
int eth_phy_binds_nodes(struct udevice *eth_dev) @@ -110,13 +115,58 @@ int eth_phy_get_addr(struct udevice *dev) return reg; }
+/* parsing generic properties of devicetree/bindings/net/ethernet-phy.yaml */ +static int eth_phy_of_to_plat(struct udevice *dev) +{
struct eth_phy_device_priv *uc_priv = dev_get_uclass_priv(dev);
int ret;
/* search "reset-gpios" in phy node */
ret = gpio_request_by_name(dev, "reset-gpios", 0,
&uc_priv->reset_gpio,
GPIOD_IS_OUT);
if (ret != -ENOENT)
return ret;
uc_priv->reset_assert_delay = dev_read_u32_default(dev, "reset-assert-us", 0);
uc_priv->reset_deassert_delay = dev_read_u32_default(dev, "reset-deassert-us", 0);
return 0;
+}
+void eth_phy_reset(struct udevice *dev, int value) +{
struct eth_phy_device_priv *uc_priv = dev_get_uclass_priv(dev);
u32 delay;
if (!dm_gpio_is_valid(&uc_priv->reset_gpio))
return;
dm_gpio_set_value(&uc_priv->reset_gpio, value);
delay = value ? uc_priv->reset_assert_delay : uc_priv->reset_deassert_delay;
if (delay)
udelay(delay);
+}
+static int eth_phy_pre_probe(struct udevice *dev) +{
/* Assert and deassert the reset signal */
eth_phy_reset(dev, 1);
eth_phy_reset(dev, 0);
return 0;
+}
UCLASS_DRIVER(eth_phy_generic) = { .id = UCLASS_ETH_PHY, .name = "eth_phy_generic", .per_device_auto = sizeof(struct eth_phy_device_priv),
.pre_probe = eth_phy_pre_probe,
};
U_BOOT_DRIVER(eth_phy_generic_drv) = { .name = "eth_phy_generic_drv", .id = UCLASS_ETH_PHY,
.of_to_plat = eth_phy_of_to_plat,
};
2.17.1
Reviewed-by: Ramon Fried rfried.dev@gmail.com

Hi Ramon,
On 4/26/21 5:46 PM, Patrick Delaunay wrote:
The gpio reset and the assert or deassert delay are defined in generic binding of the ethernet phy in Linux: Documentation/devicetree/bindings/net/ethernet-phy.yaml
reset-gpios: maxItems: 1 description: The GPIO phandle and specifier for the PHY reset signal.
reset-assert-us: description: Delay after the reset was asserted in microseconds. If this property is missing the delay will be skipped.
reset-deassert-us: description: Delay after the reset was deasserted in microseconds. If this property is missing the delay will be skipped.
See also U-Boot: doc/device-tree-bindings/net/phy.txt
This patch adds the parsing of this common DT properties in the u-class "eth_phy_generic", used by default in the associated driver "eth_phy_generic_drv"
This parsing function eth_phy_of_to_plat can be reused by other ethernet phy drivers for this uclass UCLASS_ETH_PHY.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
Changes in v2:
Update eth-phy driver (NEW)
drivers/net/eth-phy-uclass.c | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
This patch cause issue on some board without CONFIG_DM_GPIO
powerpc: w+ ids8313 socrates UCP1020 P3041DS P3041DS_NAND P3041DS_SDCARD P3041DS_SPIFLASH P4080DS P4080DS_SDCARD P4080DS_SPIFLASH P5040DS P5040DS_NAND P5040DS_SDCARD P5040DS_SPIFLASH MPC8548CDS MPC8548CDS_36BIT MPC8548CDS_legacy T2080QDS T2080QDS_NAND T2080QDS_SDCARD T2080QDS_SECURE_BOOT T2080QDS_SPIFLASH T2080QDS_SRIO_PCIE_BOOT kmcent2 MCR3000 MPC8349EMDS MPC8349EMDS_PCI64 MPC8349EMDS_SDRAM MPC8349EMDS_SLAVE + MPC837XERDB kmcoge5ne kmeter1 kmopti2 kmsupx5 kmtegr1 kmtepr2 tuge1 tuxx1 +powerpc-linux-ld.bfd: drivers/net/eth-phy-uclass.o: in function `eth_phy_of_to_plat': +drivers/net/eth-phy-uclass.c:133: undefined reference to `gpio_request_by_name' +powerpc-linux-ld.bfd: drivers/net/eth-phy-uclass.o: in function `eth_phy_reset': +drivers/net/eth-phy-uclass.c:153: undefined reference to `dm_gpio_set_value' +make[1]: *** [Makefile:1788: u-boot] Error 1 +make: *** [Makefile:177: sub-make] Error 2
I detect the issue in my stm32/next branch
but I will sent a V3 of the serie with an correction.
Patrick

Replace debug trace and printf to log macros: - debug() replaced by dev_dbg() when device is available, this macro indicate the device name since commit ceb70bb870ac ("dm: Print device name in dev_xxx like Linux") - printf() replaced by log_notice() to allow dispatch to log backends.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
Changes in v2: - use log macro in eth-phy driver (NEW)
drivers/net/eth-phy-uclass.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c index 153f6909eb..962084a7c9 100644 --- a/drivers/net/eth-phy-uclass.c +++ b/drivers/net/eth-phy-uclass.c @@ -5,8 +5,10 @@
#include <common.h> #include <dm.h> +#include <log.h> #include <net.h> #include <asm-generic/gpio.h> +#include <dm/device_compat.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h> #include <dm/lists.h> @@ -27,25 +29,25 @@ int eth_phy_binds_nodes(struct udevice *eth_dev)
mdio_node = dev_read_subnode(eth_dev, "mdio"); if (!ofnode_valid(mdio_node)) { - debug("%s: %s mdio subnode not found!", __func__, - eth_dev->name); + dev_dbg(eth_dev, "%s: %s mdio subnode not found!", __func__, + eth_dev->name); return -ENXIO; }
ofnode_for_each_subnode(phy_node, mdio_node) { node_name = ofnode_get_name(phy_node);
- debug("* Found child node: '%s'\n", node_name); + dev_dbg(eth_dev, "* Found child node: '%s'\n", node_name);
ret = device_bind_driver_to_node(eth_dev, "eth_phy_generic_drv", node_name, phy_node, NULL); if (ret) { - debug(" - Eth phy binding error: %d\n", ret); + dev_dbg(eth_dev, " - Eth phy binding error: %d\n", ret); continue; }
- debug(" - bound phy device: '%s'\n", node_name); + dev_dbg(eth_dev, " - bound phy device: '%s'\n", node_name); }
return 0; @@ -86,14 +88,14 @@ struct mii_dev *eth_phy_get_mdio_bus(struct udevice *eth_dev) */ uc_priv = (struct eth_phy_device_priv *)(dev_get_uclass_priv(phy_dev)); if (uc_priv->mdio_bus) - printf("Get shared mii bus on %s\n", eth_dev->name); + log_notice("Get shared mii bus on %s\n", eth_dev->name); else - printf("Can't get shared mii bus on %s\n", eth_dev->name); + log_notice("Can't get shared mii bus on %s\n", eth_dev->name);
return uc_priv->mdio_bus; } } else { - printf("FEC: can't find phy-handle\n"); + log_notice("FEC: can't find phy-handle\n"); }
return NULL; @@ -106,7 +108,7 @@ int eth_phy_get_addr(struct udevice *dev)
if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0, &phandle_args)) { - debug("Failed to find phy-handle"); + dev_dbg(dev, "Failed to find phy-handle"); return -ENODEV; }

On Mon, Apr 26, 2021 at 6:47 PM Patrick Delaunay patrick.delaunay@foss.st.com wrote:
Replace debug trace and printf to log macros:
- debug() replaced by dev_dbg() when device is available, this macro
indicate the device name since commit ceb70bb870ac ("dm: Print device name in dev_xxx like Linux")
- printf() replaced by log_notice() to allow dispatch to log backends.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
Changes in v2:
- use log macro in eth-phy driver (NEW)
drivers/net/eth-phy-uclass.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c index 153f6909eb..962084a7c9 100644 --- a/drivers/net/eth-phy-uclass.c +++ b/drivers/net/eth-phy-uclass.c @@ -5,8 +5,10 @@
#include <common.h> #include <dm.h> +#include <log.h> #include <net.h> #include <asm-generic/gpio.h> +#include <dm/device_compat.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h> #include <dm/lists.h> @@ -27,25 +29,25 @@ int eth_phy_binds_nodes(struct udevice *eth_dev)
mdio_node = dev_read_subnode(eth_dev, "mdio"); if (!ofnode_valid(mdio_node)) {
debug("%s: %s mdio subnode not found!", __func__,
eth_dev->name);
dev_dbg(eth_dev, "%s: %s mdio subnode not found!", __func__,
eth_dev->name); return -ENXIO; } ofnode_for_each_subnode(phy_node, mdio_node) { node_name = ofnode_get_name(phy_node);
debug("* Found child node: '%s'\n", node_name);
dev_dbg(eth_dev, "* Found child node: '%s'\n", node_name); ret = device_bind_driver_to_node(eth_dev, "eth_phy_generic_drv", node_name, phy_node, NULL); if (ret) {
debug(" - Eth phy binding error: %d\n", ret);
dev_dbg(eth_dev, " - Eth phy binding error: %d\n", ret); continue; }
debug(" - bound phy device: '%s'\n", node_name);
dev_dbg(eth_dev, " - bound phy device: '%s'\n", node_name); } return 0;
@@ -86,14 +88,14 @@ struct mii_dev *eth_phy_get_mdio_bus(struct udevice *eth_dev) */ uc_priv = (struct eth_phy_device_priv *)(dev_get_uclass_priv(phy_dev)); if (uc_priv->mdio_bus)
printf("Get shared mii bus on %s\n", eth_dev->name);
log_notice("Get shared mii bus on %s\n", eth_dev->name); else
printf("Can't get shared mii bus on %s\n", eth_dev->name);
log_notice("Can't get shared mii bus on %s\n", eth_dev->name); return uc_priv->mdio_bus; } } else {
printf("FEC: can't find phy-handle\n");
log_notice("FEC: can't find phy-handle\n"); } return NULL;
@@ -106,7 +108,7 @@ int eth_phy_get_addr(struct udevice *dev)
if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0, &phandle_args)) {
debug("Failed to find phy-handle");
dev_dbg(dev, "Failed to find phy-handle"); return -ENODEV; }
-- 2.17.1
Reviewed-by: Ramon Fried rfried.dev@gmail.com

Bind any subnode with name beginning by mdio, mdio0 for example, and not only the "mdio" as namei of subnode.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
Changes in v2: - update eth-phy driver to support STM32 binding with a mdio0 subnode (NEW)
drivers/net/eth-phy-uclass.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c index 962084a7c9..f04f1c8f09 100644 --- a/drivers/net/eth-phy-uclass.c +++ b/drivers/net/eth-phy-uclass.c @@ -27,12 +27,18 @@ int eth_phy_binds_nodes(struct udevice *eth_dev) const char *node_name; int ret;
- mdio_node = dev_read_subnode(eth_dev, "mdio"); + /* search a subnode named "mdio.*" */ + dev_for_each_subnode(mdio_node, eth_dev) { + node_name = ofnode_get_name(mdio_node); + if (!strncmp(node_name, "mdio", 4)) + break; + } if (!ofnode_valid(mdio_node)) { - dev_dbg(eth_dev, "%s: %s mdio subnode not found!", __func__, + dev_dbg(eth_dev, "%s: %s mdio subnode not found!\n", __func__, eth_dev->name); return -ENXIO; } + dev_dbg(eth_dev, "%s: %s subnode found!\n", __func__, node_name);
ofnode_for_each_subnode(phy_node, mdio_node) { node_name = ofnode_get_name(phy_node);

On Mon, Apr 26, 2021 at 6:47 PM Patrick Delaunay patrick.delaunay@foss.st.com wrote:
Bind any subnode with name beginning by mdio, mdio0 for example, and not only the "mdio" as namei of subnode.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
Changes in v2:
- update eth-phy driver to support STM32 binding with a mdio0 subnode (NEW)
drivers/net/eth-phy-uclass.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c index 962084a7c9..f04f1c8f09 100644 --- a/drivers/net/eth-phy-uclass.c +++ b/drivers/net/eth-phy-uclass.c @@ -27,12 +27,18 @@ int eth_phy_binds_nodes(struct udevice *eth_dev) const char *node_name; int ret;
mdio_node = dev_read_subnode(eth_dev, "mdio");
/* search a subnode named "mdio.*" */
dev_for_each_subnode(mdio_node, eth_dev) {
node_name = ofnode_get_name(mdio_node);
if (!strncmp(node_name, "mdio", 4))
break;
} if (!ofnode_valid(mdio_node)) {
dev_dbg(eth_dev, "%s: %s mdio subnode not found!", __func__,
dev_dbg(eth_dev, "%s: %s mdio subnode not found!\n", __func__, eth_dev->name); return -ENXIO; }
dev_dbg(eth_dev, "%s: %s subnode found!\n", __func__, node_name); ofnode_for_each_subnode(phy_node, mdio_node) { node_name = ofnode_get_name(phy_node);
-- 2.17.1
Reviewed-by: Ramon Fried rfried.dev@gmail.com

Since the commit commit 6a895d039ba7 ("net: Update eQos driver and FEC driver to use eth phy interfaces") the field phyaddr of driver private data struct eqos_priv is no more used in eqos_start() for the phy_connect() parameter.
Now this variable is only initialized in eqos_probe_resources_stm32() it can be removed.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
Changes in v2: - remove unused element in the struct eqos_priv (NEW)
drivers/net/dwc_eth_qos.c | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index e8242ca4e1..e625aea8d1 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -311,7 +311,6 @@ struct eqos_priv { struct clk clk_slave_bus; struct mii_dev *mii; struct phy_device *phy; - int phyaddr; u32 max_speed; void *descs; int tx_desc_idx, rx_desc_idx; @@ -1826,7 +1825,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev) if (ret) pr_warn("No phy clock provided %d", ret);
- eqos->phyaddr = -1; ret = dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0, &phandle_args); if (!ret) { @@ -1839,9 +1837,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev) if (ret) pr_warn("gpio_request_by_name(phy reset) not provided %d", ret); - - eqos->phyaddr = ofnode_read_u32_default(phandle_args.node, - "reg", -1); }
debug("%s: OK\n", __func__);

On Mon, Apr 26, 2021 at 6:47 PM Patrick Delaunay patrick.delaunay@foss.st.com wrote:
Since the commit commit 6a895d039ba7 ("net: Update eQos driver and FEC driver to use eth phy interfaces") the field phyaddr of driver private data struct eqos_priv is no more used in eqos_start() for the phy_connect() parameter.
Now this variable is only initialized in eqos_probe_resources_stm32() it can be removed.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
Changes in v2:
- remove unused element in the struct eqos_priv (NEW)
drivers/net/dwc_eth_qos.c | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index e8242ca4e1..e625aea8d1 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -311,7 +311,6 @@ struct eqos_priv { struct clk clk_slave_bus; struct mii_dev *mii; struct phy_device *phy;
int phyaddr; u32 max_speed; void *descs; int tx_desc_idx, rx_desc_idx;
@@ -1826,7 +1825,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev) if (ret) pr_warn("No phy clock provided %d", ret);
eqos->phyaddr = -1; ret = dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0, &phandle_args); if (!ret) {
@@ -1839,9 +1837,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev) if (ret) pr_warn("gpio_request_by_name(phy reset) not provided %d", ret);
eqos->phyaddr = ofnode_read_u32_default(phandle_args.node,
"reg", -1); } debug("%s: OK\n", __func__);
-- 2.17.1
Reviewed-by: Ramon Fried rfried.dev@gmail.com

Use the generic ethernet phy which already manages the correct binding for gpio reset, including the assert an deassert delays.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
Changes in v2: - use generic ethernet phy for stm32 variant, this patch is a REWORK of previous serie: the device parsing is done in eth-phy driver and the gpio support is removed in stm32 variant: eqos_start/stop_resets_stm32 and eqos_probe_resources_stm32.
drivers/net/Kconfig | 1 + drivers/net/dwc_eth_qos.c | 50 --------------------------------------- 2 files changed, 1 insertion(+), 50 deletions(-)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 382639044b..adf43fb42a 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -206,6 +206,7 @@ config DWC_ETH_QOS_IMX config DWC_ETH_QOS_STM32 bool "Synopsys DWC Ethernet QOS device support for STM32" depends on DWC_ETH_QOS + select DM_ETH_PHY default y if ARCH_STM32MP help The Synopsys Designware Ethernet QOS IP block with the specific diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index e625aea8d1..3fb8bfaf3a 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -700,29 +700,6 @@ static int eqos_start_resets_tegra186(struct udevice *dev)
static int eqos_start_resets_stm32(struct udevice *dev) { - struct eqos_priv *eqos = dev_get_priv(dev); - int ret; - - debug("%s(dev=%p):\n", __func__, dev); - if (dm_gpio_is_valid(&eqos->phy_reset_gpio)) { - ret = dm_gpio_set_value(&eqos->phy_reset_gpio, 1); - if (ret < 0) { - pr_err("dm_gpio_set_value(phy_reset, assert) failed: %d", - ret); - return ret; - } - - udelay(2); - - ret = dm_gpio_set_value(&eqos->phy_reset_gpio, 0); - if (ret < 0) { - pr_err("dm_gpio_set_value(phy_reset, deassert) failed: %d", - ret); - return ret; - } - } - debug("%s: OK\n", __func__); - return 0; }
@@ -743,18 +720,6 @@ static int eqos_stop_resets_tegra186(struct udevice *dev)
static int eqos_stop_resets_stm32(struct udevice *dev) { - struct eqos_priv *eqos = dev_get_priv(dev); - int ret; - - if (dm_gpio_is_valid(&eqos->phy_reset_gpio)) { - ret = dm_gpio_set_value(&eqos->phy_reset_gpio, 1); - if (ret < 0) { - pr_err("dm_gpio_set_value(phy_reset, assert) failed: %d", - ret); - return ret; - } - } - return 0; }
@@ -1785,7 +1750,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev) struct eqos_priv *eqos = dev_get_priv(dev); int ret; phy_interface_t interface; - struct ofnode_phandle_args phandle_args;
debug("%s(dev=%p):\n", __func__, dev);
@@ -1825,20 +1789,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev) if (ret) pr_warn("No phy clock provided %d", ret);
- ret = dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0, - &phandle_args); - if (!ret) { - /* search "reset-gpios" in phy node */ - ret = gpio_request_by_name_nodev(phandle_args.node, - "reset-gpios", 0, - &eqos->phy_reset_gpio, - GPIOD_IS_OUT | - GPIOD_IS_OUT_ACTIVE); - if (ret) - pr_warn("gpio_request_by_name(phy reset) not provided %d", - ret); - } - debug("%s: OK\n", __func__); return 0;

On Mon, Apr 26, 2021 at 6:47 PM Patrick Delaunay patrick.delaunay@foss.st.com wrote:
Use the generic ethernet phy which already manages the correct binding for gpio reset, including the assert an deassert delays.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
Changes in v2:
- use generic ethernet phy for stm32 variant, this patch is a REWORK of previous serie: the device parsing is done in eth-phy driver and the gpio support is removed in stm32 variant: eqos_start/stop_resets_stm32 and eqos_probe_resources_stm32.
drivers/net/Kconfig | 1 + drivers/net/dwc_eth_qos.c | 50 --------------------------------------- 2 files changed, 1 insertion(+), 50 deletions(-)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 382639044b..adf43fb42a 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -206,6 +206,7 @@ config DWC_ETH_QOS_IMX config DWC_ETH_QOS_STM32 bool "Synopsys DWC Ethernet QOS device support for STM32" depends on DWC_ETH_QOS
select DM_ETH_PHY default y if ARCH_STM32MP help The Synopsys Designware Ethernet QOS IP block with the specific
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index e625aea8d1..3fb8bfaf3a 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -700,29 +700,6 @@ static int eqos_start_resets_tegra186(struct udevice *dev)
static int eqos_start_resets_stm32(struct udevice *dev) {
struct eqos_priv *eqos = dev_get_priv(dev);
int ret;
debug("%s(dev=%p):\n", __func__, dev);
if (dm_gpio_is_valid(&eqos->phy_reset_gpio)) {
ret = dm_gpio_set_value(&eqos->phy_reset_gpio, 1);
if (ret < 0) {
pr_err("dm_gpio_set_value(phy_reset, assert) failed: %d",
ret);
return ret;
}
udelay(2);
ret = dm_gpio_set_value(&eqos->phy_reset_gpio, 0);
if (ret < 0) {
pr_err("dm_gpio_set_value(phy_reset, deassert) failed: %d",
ret);
return ret;
}
}
debug("%s: OK\n", __func__);
return 0;
}
@@ -743,18 +720,6 @@ static int eqos_stop_resets_tegra186(struct udevice *dev)
static int eqos_stop_resets_stm32(struct udevice *dev) {
struct eqos_priv *eqos = dev_get_priv(dev);
int ret;
if (dm_gpio_is_valid(&eqos->phy_reset_gpio)) {
ret = dm_gpio_set_value(&eqos->phy_reset_gpio, 1);
if (ret < 0) {
pr_err("dm_gpio_set_value(phy_reset, assert) failed: %d",
ret);
return ret;
}
}
return 0;
}
@@ -1785,7 +1750,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev) struct eqos_priv *eqos = dev_get_priv(dev); int ret; phy_interface_t interface;
struct ofnode_phandle_args phandle_args; debug("%s(dev=%p):\n", __func__, dev);
@@ -1825,20 +1789,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev) if (ret) pr_warn("No phy clock provided %d", ret);
ret = dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
&phandle_args);
if (!ret) {
/* search "reset-gpios" in phy node */
ret = gpio_request_by_name_nodev(phandle_args.node,
"reset-gpios", 0,
&eqos->phy_reset_gpio,
GPIOD_IS_OUT |
GPIOD_IS_OUT_ACTIVE);
if (ret)
pr_warn("gpio_request_by_name(phy reset) not provided %d",
ret);
}
debug("%s: OK\n", __func__); return 0;
-- 2.17.1
Reviewed-by: Ramon Fried rfried.dev@gmail.com

Add a common empty ops: eqos_null_ops() to remove the duplicated empty functions and reduce the driver size for stm32 and imx config.
This patch also aligns the prototype of ops 'eqos_stop_clks' with other eqos ops by adding return value.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com ---
Changes in v2: - cleanup ops by adding a common null ops (NEW)
drivers/net/dwc_eth_qos.c | 97 +++++++++------------------------------ 1 file changed, 22 insertions(+), 75 deletions(-)
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index 3fb8bfaf3a..4d1e5d6f8f 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -285,7 +285,7 @@ struct eqos_ops { int (*eqos_remove_resources)(struct udevice *dev); int (*eqos_stop_resets)(struct udevice *dev); int (*eqos_start_resets)(struct udevice *dev); - void (*eqos_stop_clks)(struct udevice *dev); + int (*eqos_stop_clks)(struct udevice *dev); int (*eqos_start_clks)(struct udevice *dev); int (*eqos_calibrate_pads)(struct udevice *dev); int (*eqos_disable_calibration)(struct udevice *dev); @@ -615,12 +615,7 @@ err: #endif }
-static int eqos_start_clks_imx(struct udevice *dev) -{ - return 0; -} - -static void eqos_stop_clks_tegra186(struct udevice *dev) +static int eqos_stop_clks_tegra186(struct udevice *dev) { #ifdef CONFIG_CLK struct eqos_priv *eqos = dev_get_priv(dev); @@ -635,9 +630,10 @@ static void eqos_stop_clks_tegra186(struct udevice *dev) #endif
debug("%s: OK\n", __func__); + return 0; }
-static void eqos_stop_clks_stm32(struct udevice *dev) +static int eqos_stop_clks_stm32(struct udevice *dev) { #ifdef CONFIG_CLK struct eqos_priv *eqos = dev_get_priv(dev); @@ -652,11 +648,7 @@ static void eqos_stop_clks_stm32(struct udevice *dev) #endif
debug("%s: OK\n", __func__); -} - -static void eqos_stop_clks_imx(struct udevice *dev) -{ - /* empty */ + return 0; }
static int eqos_start_resets_tegra186(struct udevice *dev) @@ -698,16 +690,6 @@ static int eqos_start_resets_tegra186(struct udevice *dev) return 0; }
-static int eqos_start_resets_stm32(struct udevice *dev) -{ - return 0; -} - -static int eqos_start_resets_imx(struct udevice *dev) -{ - return 0; -} - static int eqos_stop_resets_tegra186(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -718,16 +700,6 @@ static int eqos_stop_resets_tegra186(struct udevice *dev) return 0; }
-static int eqos_stop_resets_stm32(struct udevice *dev) -{ - return 0; -} - -static int eqos_stop_resets_imx(struct udevice *dev) -{ - return 0; -} - static int eqos_calibrate_pads_tegra186(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -816,26 +788,6 @@ static ulong eqos_get_tick_clk_rate_imx(struct udevice *dev) return imx_get_eqos_csr_clk(); }
-static int eqos_calibrate_pads_stm32(struct udevice *dev) -{ - return 0; -} - -static int eqos_calibrate_pads_imx(struct udevice *dev) -{ - return 0; -} - -static int eqos_disable_calibration_stm32(struct udevice *dev) -{ - return 0; -} - -static int eqos_disable_calibration_imx(struct udevice *dev) -{ - return 0; -} - static int eqos_set_full_duplex(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -932,11 +884,6 @@ static int eqos_set_tx_clk_speed_tegra186(struct udevice *dev) return 0; }
-static int eqos_set_tx_clk_speed_stm32(struct udevice *dev) -{ - return 0; -} - static int eqos_set_tx_clk_speed_imx(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -1894,11 +1841,6 @@ static int eqos_remove_resources_stm32(struct udevice *dev) return 0; }
-static int eqos_remove_resources_imx(struct udevice *dev) -{ - return 0; -} - static int eqos_probe(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -1987,6 +1929,11 @@ static int eqos_remove(struct udevice *dev) return 0; }
+static int eqos_null_ops(struct udevice *dev) +{ + return 0; +} + static const struct eth_ops eqos_ops = { .start = eqos_start, .stop = eqos_stop, @@ -2032,13 +1979,13 @@ static struct eqos_ops eqos_stm32_ops = { .eqos_flush_buffer = eqos_flush_buffer_generic, .eqos_probe_resources = eqos_probe_resources_stm32, .eqos_remove_resources = eqos_remove_resources_stm32, - .eqos_stop_resets = eqos_stop_resets_stm32, - .eqos_start_resets = eqos_start_resets_stm32, + .eqos_stop_resets = eqos_null_ops, + .eqos_start_resets = eqos_null_ops, .eqos_stop_clks = eqos_stop_clks_stm32, .eqos_start_clks = eqos_start_clks_stm32, - .eqos_calibrate_pads = eqos_calibrate_pads_stm32, - .eqos_disable_calibration = eqos_disable_calibration_stm32, - .eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_stm32, + .eqos_calibrate_pads = eqos_null_ops, + .eqos_disable_calibration = eqos_null_ops, + .eqos_set_tx_clk_speed = eqos_null_ops, .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_stm32 };
@@ -2059,13 +2006,13 @@ static struct eqos_ops eqos_imx_ops = { .eqos_inval_buffer = eqos_inval_buffer_generic, .eqos_flush_buffer = eqos_flush_buffer_generic, .eqos_probe_resources = eqos_probe_resources_imx, - .eqos_remove_resources = eqos_remove_resources_imx, - .eqos_stop_resets = eqos_stop_resets_imx, - .eqos_start_resets = eqos_start_resets_imx, - .eqos_stop_clks = eqos_stop_clks_imx, - .eqos_start_clks = eqos_start_clks_imx, - .eqos_calibrate_pads = eqos_calibrate_pads_imx, - .eqos_disable_calibration = eqos_disable_calibration_imx, + .eqos_remove_resources = eqos_null_ops, + .eqos_stop_resets = eqos_null_ops, + .eqos_start_resets = eqos_null_ops, + .eqos_stop_clks = eqos_null_ops, + .eqos_start_clks = eqos_null_ops, + .eqos_calibrate_pads = eqos_null_ops, + .eqos_disable_calibration = eqos_null_ops, .eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_imx, .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_imx };

On Mon, Apr 26, 2021 at 6:47 PM Patrick Delaunay patrick.delaunay@foss.st.com wrote:
Add a common empty ops: eqos_null_ops() to remove the duplicated empty functions and reduce the driver size for stm32 and imx config.
This patch also aligns the prototype of ops 'eqos_stop_clks' with other eqos ops by adding return value.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
Changes in v2:
- cleanup ops by adding a common null ops (NEW)
drivers/net/dwc_eth_qos.c | 97 +++++++++------------------------------ 1 file changed, 22 insertions(+), 75 deletions(-)
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index 3fb8bfaf3a..4d1e5d6f8f 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -285,7 +285,7 @@ struct eqos_ops { int (*eqos_remove_resources)(struct udevice *dev); int (*eqos_stop_resets)(struct udevice *dev); int (*eqos_start_resets)(struct udevice *dev);
void (*eqos_stop_clks)(struct udevice *dev);
int (*eqos_stop_clks)(struct udevice *dev); int (*eqos_start_clks)(struct udevice *dev); int (*eqos_calibrate_pads)(struct udevice *dev); int (*eqos_disable_calibration)(struct udevice *dev);
@@ -615,12 +615,7 @@ err: #endif }
-static int eqos_start_clks_imx(struct udevice *dev) -{
return 0;
-}
-static void eqos_stop_clks_tegra186(struct udevice *dev) +static int eqos_stop_clks_tegra186(struct udevice *dev) { #ifdef CONFIG_CLK struct eqos_priv *eqos = dev_get_priv(dev); @@ -635,9 +630,10 @@ static void eqos_stop_clks_tegra186(struct udevice *dev) #endif
debug("%s: OK\n", __func__);
return 0;
}
-static void eqos_stop_clks_stm32(struct udevice *dev) +static int eqos_stop_clks_stm32(struct udevice *dev) { #ifdef CONFIG_CLK struct eqos_priv *eqos = dev_get_priv(dev); @@ -652,11 +648,7 @@ static void eqos_stop_clks_stm32(struct udevice *dev) #endif
debug("%s: OK\n", __func__);
-}
-static void eqos_stop_clks_imx(struct udevice *dev) -{
/* empty */
return 0;
}
static int eqos_start_resets_tegra186(struct udevice *dev) @@ -698,16 +690,6 @@ static int eqos_start_resets_tegra186(struct udevice *dev) return 0; }
-static int eqos_start_resets_stm32(struct udevice *dev) -{
return 0;
-}
-static int eqos_start_resets_imx(struct udevice *dev) -{
return 0;
-}
static int eqos_stop_resets_tegra186(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -718,16 +700,6 @@ static int eqos_stop_resets_tegra186(struct udevice *dev) return 0; }
-static int eqos_stop_resets_stm32(struct udevice *dev) -{
return 0;
-}
-static int eqos_stop_resets_imx(struct udevice *dev) -{
return 0;
-}
static int eqos_calibrate_pads_tegra186(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -816,26 +788,6 @@ static ulong eqos_get_tick_clk_rate_imx(struct udevice *dev) return imx_get_eqos_csr_clk(); }
-static int eqos_calibrate_pads_stm32(struct udevice *dev) -{
return 0;
-}
-static int eqos_calibrate_pads_imx(struct udevice *dev) -{
return 0;
-}
-static int eqos_disable_calibration_stm32(struct udevice *dev) -{
return 0;
-}
-static int eqos_disable_calibration_imx(struct udevice *dev) -{
return 0;
-}
static int eqos_set_full_duplex(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -932,11 +884,6 @@ static int eqos_set_tx_clk_speed_tegra186(struct udevice *dev) return 0; }
-static int eqos_set_tx_clk_speed_stm32(struct udevice *dev) -{
return 0;
-}
static int eqos_set_tx_clk_speed_imx(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -1894,11 +1841,6 @@ static int eqos_remove_resources_stm32(struct udevice *dev) return 0; }
-static int eqos_remove_resources_imx(struct udevice *dev) -{
return 0;
-}
static int eqos_probe(struct udevice *dev) { struct eqos_priv *eqos = dev_get_priv(dev); @@ -1987,6 +1929,11 @@ static int eqos_remove(struct udevice *dev) return 0; }
+static int eqos_null_ops(struct udevice *dev) +{
return 0;
+}
static const struct eth_ops eqos_ops = { .start = eqos_start, .stop = eqos_stop, @@ -2032,13 +1979,13 @@ static struct eqos_ops eqos_stm32_ops = { .eqos_flush_buffer = eqos_flush_buffer_generic, .eqos_probe_resources = eqos_probe_resources_stm32, .eqos_remove_resources = eqos_remove_resources_stm32,
.eqos_stop_resets = eqos_stop_resets_stm32,
.eqos_start_resets = eqos_start_resets_stm32,
.eqos_stop_resets = eqos_null_ops,
.eqos_start_resets = eqos_null_ops, .eqos_stop_clks = eqos_stop_clks_stm32, .eqos_start_clks = eqos_start_clks_stm32,
.eqos_calibrate_pads = eqos_calibrate_pads_stm32,
.eqos_disable_calibration = eqos_disable_calibration_stm32,
.eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_stm32,
.eqos_calibrate_pads = eqos_null_ops,
.eqos_disable_calibration = eqos_null_ops,
.eqos_set_tx_clk_speed = eqos_null_ops, .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_stm32
};
@@ -2059,13 +2006,13 @@ static struct eqos_ops eqos_imx_ops = { .eqos_inval_buffer = eqos_inval_buffer_generic, .eqos_flush_buffer = eqos_flush_buffer_generic, .eqos_probe_resources = eqos_probe_resources_imx,
.eqos_remove_resources = eqos_remove_resources_imx,
.eqos_stop_resets = eqos_stop_resets_imx,
.eqos_start_resets = eqos_start_resets_imx,
.eqos_stop_clks = eqos_stop_clks_imx,
.eqos_start_clks = eqos_start_clks_imx,
.eqos_calibrate_pads = eqos_calibrate_pads_imx,
.eqos_disable_calibration = eqos_disable_calibration_imx,
.eqos_remove_resources = eqos_null_ops,
.eqos_stop_resets = eqos_null_ops,
.eqos_start_resets = eqos_null_ops,
.eqos_stop_clks = eqos_null_ops,
.eqos_start_clks = eqos_null_ops,
.eqos_calibrate_pads = eqos_null_ops,
.eqos_disable_calibration = eqos_null_ops, .eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_imx, .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_imx
};
2.17.1
Reviewed-by: Ramon Fried rfried.dev@gmail.com

Hi Ramon,
On 4/26/21 5:46 PM, Patrick Delaunay wrote:
It is the V2 version of [1] after Marek remarks: all commit are new.
I change the DWC_ETH_QOS STM32 variant by using generic eth phy driver.
This driver is updated to use the gpio reset and assert/deassert delay from DT with the generic binding defined in linux: Documentation/devicetree/bindings/net/ethernet-phy.yaml or in U-Boot: doc/device-tree-bindings/net/phy.txt
[1] net: dwc_eth_qos: add support of device tree configuration for reset delay http://patchwork.ozlabs.org/project/uboot/list/?series=238253&state=*
Changes in v2:
- Update eth-phy driver (NEW)
- use log macro in eth-phy driver (NEW)
- update eth-phy driver to support STM32 binding with a mdio0 subnode (NEW)
- remove unused element in the struct eqos_priv (NEW)
- use generic ethernet phy for stm32 variant, this patch is a REWORK of previous serie: the device parsing is done in eth-phy driver and the gpio support is removed in stm32 variant: eqos_start/stop_resets_stm32 and eqos_probe_resources_stm32.
- cleanup ops by adding a common null ops (NEW)
Patrick Delaunay (6): net: eth-phy: add support of device tree configuration for gpio reset net: eth-phy: use dev_dbg and log_notice net: eth-phy: manage subnode mdio0 net: dwc_eth_qos: remove the field phyaddr of the struct eqos_priv net: dwc_eth_qos: use generic ethernet phy for stm32 variant net: dwc: add a common empty ops eqos_null_ops
drivers/net/Kconfig | 1 + drivers/net/dwc_eth_qos.c | 152 +++++------------------------------ drivers/net/eth-phy-uclass.c | 78 +++++++++++++++--- 3 files changed, 91 insertions(+), 140 deletions(-)
This serie is also accepted in patchwork, but not merged in u-boot-net/network_master:
http://patchwork.ozlabs.org/project/uboot/list/?series=240808&state=*
Do you plan to integrate it in you next pull request for v2021.10 ?
Regards
Patrick

On Fri, Jul 9, 2021 at 1:35 PM Patrick DELAUNAY patrick.delaunay@foss.st.com wrote:
Hi Ramon,
On 4/26/21 5:46 PM, Patrick Delaunay wrote:
It is the V2 version of [1] after Marek remarks: all commit are new.
I change the DWC_ETH_QOS STM32 variant by using generic eth phy driver.
This driver is updated to use the gpio reset and assert/deassert delay from DT with the generic binding defined in linux: Documentation/devicetree/bindings/net/ethernet-phy.yaml or in U-Boot: doc/device-tree-bindings/net/phy.txt
[1] net: dwc_eth_qos: add support of device tree configuration for reset delay http://patchwork.ozlabs.org/project/uboot/list/?series=238253&state=*
Changes in v2:
- Update eth-phy driver (NEW)
- use log macro in eth-phy driver (NEW)
- update eth-phy driver to support STM32 binding with a mdio0 subnode (NEW)
- remove unused element in the struct eqos_priv (NEW)
- use generic ethernet phy for stm32 variant, this patch is a REWORK of previous serie: the device parsing is done in eth-phy driver and the gpio support is removed in stm32 variant: eqos_start/stop_resets_stm32 and eqos_probe_resources_stm32.
- cleanup ops by adding a common null ops (NEW)
Patrick Delaunay (6): net: eth-phy: add support of device tree configuration for gpio reset net: eth-phy: use dev_dbg and log_notice net: eth-phy: manage subnode mdio0 net: dwc_eth_qos: remove the field phyaddr of the struct eqos_priv net: dwc_eth_qos: use generic ethernet phy for stm32 variant net: dwc: add a common empty ops eqos_null_ops
drivers/net/Kconfig | 1 + drivers/net/dwc_eth_qos.c | 152 +++++------------------------------ drivers/net/eth-phy-uclass.c | 78 +++++++++++++++--- 3 files changed, 91 insertions(+), 140 deletions(-)
This serie is also accepted in patchwork, but not merged in u-boot-net/network_master:
http://patchwork.ozlabs.org/project/uboot/list/?series=240808&state=*
Do you plan to integrate it in you next pull request for v2021.10 ?
Regards
Patrick
Slipped under my arms someway, I will review shortly. Sorry.
participants (3)
-
Patrick DELAUNAY
-
Patrick Delaunay
-
Ramon Fried