some mvneta changes, cleanups, fixes
Subsystems (3)
cover some mvneta changes, cleanups, fixes
From: Marek Behún <[email protected]>
Hello Stefan,
here come some refactors, cleanups and fixed for the mvneta driver.
Marek Behún (19):
net: mvneta: Get rid of platdata
net: mvneta: Fix 10Mbps speed
net: mvneta: Use DM MDIO API for connecting PHY
net: mvneta: Remember fixed link instead of PHY address in priv data
arm: mvebu: Espressobin: Use DM registered MDIO to configure switch
net: mdio-uclass: add dm_phy_find_by_ofnode() helper
arm: mvebu: turris_mox: Use DM registered MDIO
net: mvneta: Don't register MDIO bus
net: mvneta: Fix unused variable warning if DM_GPIO is disabled
net: mvneta: Drop one indentation level in mvneta_adjust_link()
net: mvneta: Use bool instead of int for boolean variable
net: mvneta: Drop unnecessary space
net: mventa: Don't check for CONFIG_PHYLIB
net: mvneta: Rename CONFIG_NR_CPUS to MVNETA_NR_CPUS
net: mvneta: Convert to use PHY_FIXED for fixed-link
net: mvneta: Write PHY address just before enabling HW polling
net: mvneta: Drop fixed_link member from private struct
net: mvneta: Disable fixed PHY code if PHY_FIXED is not compiled in
net: mvneta: Drop unneeded macro
.../dts/armada-3720-turris-mox-u-boot.dtsi | 19 - board/CZ.NIC/turris_mox/turris_mox.c | 88 ++--- board/Marvell/mvebu_armada-37xx/board.c | 26 +- configs/clearfog_defconfig | 1 + configs/controlcenterdc_defconfig | 1 + configs/db-88f6820-amc_defconfig | 1 + configs/db-88f6820-gp_defconfig | 1 + configs/db-mv784mp-gp_defconfig | 1 + configs/ds414_defconfig | 1 + configs/helios4_defconfig | 1 + configs/maxbcm_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 3 + configs/theadorable_debug_defconfig | 1 + configs/turris_mox_defconfig | 1 + configs/turris_omnia_defconfig | 2 + configs/uDPU_defconfig | 1 + drivers/net/Kconfig | 1 + drivers/net/mvneta.c | 343 ++++-------------- include/miiphy.h | 9 + net/mdio-uclass.c | 22 ++ 20 files changed, 181 insertions(+), 343 deletions(-)
Signature · 1 line
2.35.1
PATCH 1/19 net: mvneta: Get rid of platdata
From: Marek Behún <[email protected]>
Drop .of_to_plat() from the mvneta driver and parse the two properties in .probe().
--- drivers/net/mvneta.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-)
drivers/net/mvneta.c +4 -20
@@ -1692,7 +1692,6 @@ static int mvneta_recv(struct udevice *dev, int flags, uchar **packetp)static int mvneta_probe (struct udevice *dev) { -struct eth_pdata *pdata =dev_get_plat (dev);struct mvneta_port *pp =dev_get_priv (dev);#if CONFIG_IS_ENABLED (DM_GPIO )struct ofnode_phandle_args sfp_args;
@@ -1729,7 +1728,10 @@ static int mvneta_probe(struct udevice *dev) buffer_loc.rx_buffers = (phys_addr_t)(bd_space + size); } - pp->base = (void __iomem *)pdata->iobase; + pp->base =dev_read_addr_ptr (dev); + pp->phy_interface =dev_read_phy_mode (dev); +if (pp->phy_interface ==PHY_INTERFACE_MODE_NA ) +return -EINVAL ;/* Configure MBUS address windows */ if (device_is_compatible (dev,"marvell,armada-3700-neta" ))
@@ -1737,9 +1739,6 @@ static int mvneta_probe(struct udevice *dev)else mvneta_conf_mbus_windows (pp); -/* PHY interface is already decoded in mvneta_of_to_plat() */ - pp->phy_interface = pdata->phy_interface; -/* fetch 'fixed-link' property from 'neta' node */ fl_node =fdt_subnode_offset (blob, node,"fixed-link" );if (fl_node != -FDT_ERR_NOTFOUND ) {
@@ -1808,20 +1807,6 @@ static const struct eth_ops mvneta_ops = { .write_hwaddr = mvneta_write_hwaddr, }; -static int mvneta_of_to_plat (struct udevice *dev) -{ -struct eth_pdata *pdata =dev_get_plat (dev); - - pdata->iobase =dev_read_addr (dev); - -/* Get phy-mode / phy_interface from DT */ - pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) -return -EINVAL ; - -return 0 ; -} -static const struct udevice_id mvneta_ids[] = { { .compatible ="marvell,armada-370-neta" }, { .compatible ="marvell,armada-xp-neta" },
@@ -1833,7 +1818,6 @@ U_BOOT_DRIVER(mvneta) = { .name = "mvneta", .id = UCLASS_ETH, .of_match = mvneta_ids, - .of_to_plat = mvneta_of_to_plat, .probe = mvneta_probe, .ops = &mvneta_ops, .priv_auto = sizeof(struct mvneta_port),
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 01/19] net: mvneta: Get rid of platdata
Quoted 75 lines · Marek Behún
From: Marek Behún <[email protected]>
Drop .of_to_plat() from the mvneta driver and parse the two properties in .probe().
Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-)drivers/net/mvneta.c +4
-21@@ -1692,7 +1692,6 @@ static int mvneta_recv(struct udevice *dev, int flags, uchar **packetp)static int mvneta_probe (struct udevice *dev) { -struct eth_pdata *pdata =dev_get_plat (dev);struct mvneta_port *pp =dev_get_priv (dev);#if CONFIG_IS_ENABLED (DM_GPIO )struct ofnode_phandle_args sfp_args;@@ -1729,7 +1728,10 @@ static int mvneta_probe(struct udevice *dev) buffer_loc.rx_buffers = (phys_addr_t)(bd_space + size); } - pp->base = (void __iomem *)pdata->iobase; + pp->base =dev_read_addr_ptr (dev); + pp->phy_interface =dev_read_phy_mode (dev); +if (pp->phy_interface ==PHY_INTERFACE_MODE_NA ) +return -EINVAL ;/* Configure MBUS address windows */ if (device_is_compatible (dev,"marvell,armada-3700-neta" ))@@ -1737,9 +1739,6 @@ static int mvneta_probe(struct udevice *dev)else mvneta_conf_mbus_windows (pp); -/* PHY interface is already decoded in mvneta_of_to_plat() */ - pp->phy_interface = pdata->phy_interface; -/* fetch 'fixed-link' property from 'neta' node */ fl_node =fdt_subnode_offset (blob, node,"fixed-link" );if (fl_node != -FDT_ERR_NOTFOUND ) {@@ -1808,20 +1807,6 @@ static const struct eth_ops mvneta_ops = { .write_hwaddr = mvneta_write_hwaddr, }; -static int mvneta_of_to_plat (struct udevice *dev) -{ -struct eth_pdata *pdata =dev_get_plat (dev); - - pdata->iobase =dev_read_addr (dev); - -/* Get phy-mode / phy_interface from DT */ - pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) -return -EINVAL ; - -return 0 ; -} -static const struct udevice_id mvneta_ids[] = { { .compatible ="marvell,armada-370-neta" }, { .compatible ="marvell,armada-xp-neta" },@@ -1833,7 +1818,6 @@ U_BOOT_DRIVER(mvneta) = { .name = "mvneta", .id = UCLASS_ETH, .of_match = mvneta_ids, - .of_to_plat = mvneta_of_to_plat, .probe = mvneta_probe, .ops = &mvneta_ops, .priv_auto = sizeof(struct mvneta_port), --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 01/19] net: mvneta: Get rid of platdata
In reply to Marek BehúnQuoted 6 lines · Marek Behún
From: Marek Behún <[email protected]>
Drop .of_to_plat() from the mvneta driver and parse the two properties in .probe().
Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 60 lines
--- drivers/net/mvneta.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-)drivers/net/mvneta.c +4
-19@@ -1692,7 +1692,6 @@ static int mvneta_recv(struct udevice *dev, int flags, uchar **packetp)static int mvneta_probe (struct udevice *dev) { -struct eth_pdata *pdata =dev_get_plat (dev);struct mvneta_port *pp =dev_get_priv (dev);#if CONFIG_IS_ENABLED (DM_GPIO )struct ofnode_phandle_args sfp_args;@@ -1729,7 +1728,10 @@ static int mvneta_probe(struct udevice *dev) buffer_loc.rx_buffers = (phys_addr_t)(bd_space + size); } - pp->base = (void __iomem *)pdata->iobase; + pp->base =dev_read_addr_ptr (dev); + pp->phy_interface =dev_read_phy_mode (dev); +if (pp->phy_interface ==PHY_INTERFACE_MODE_NA ) +return -EINVAL ;/* Configure MBUS address windows */ if (device_is_compatible (dev,"marvell,armada-3700-neta" ))@@ -1737,9 +1739,6 @@ static int mvneta_probe(struct udevice *dev)else mvneta_conf_mbus_windows (pp); -/* PHY interface is already decoded in mvneta_of_to_plat() */ - pp->phy_interface = pdata->phy_interface; -/* fetch 'fixed-link' property from 'neta' node */ fl_node =fdt_subnode_offset (blob, node,"fixed-link" );if (fl_node != -FDT_ERR_NOTFOUND ) {@@ -1808,20 +1807,6 @@ static const struct eth_ops mvneta_ops = { .write_hwaddr = mvneta_write_hwaddr, }; -static int mvneta_of_to_plat (struct udevice *dev) -{ -struct eth_pdata *pdata =dev_get_plat (dev); - - pdata->iobase =dev_read_addr (dev); - -/* Get phy-mode / phy_interface from DT */ - pdata->phy_interface =dev_read_phy_mode (dev); -if (pdata->phy_interface ==PHY_INTERFACE_MODE_NA ) -return -EINVAL ; - -return 0 ; -} -static const struct udevice_id mvneta_ids[] = { { .compatible ="marvell,armada-370-neta" }, { .compatible ="marvell,armada-xp-neta" },
drivers/net/mvneta.c U_BOOT_DRIVER(mvneta) = { · line 1823
Quoted 7 lines
drivers/net/mvneta.c +0
-1@@ -1833,7 +1818,6 @@ U_BOOT_DRIVER(mvneta) = { .name = "mvneta", .id = UCLASS_ETH, .of_match = mvneta_ids, - .of_to_plat = mvneta_of_to_plat, .probe = mvneta_probe, .ops = &mvneta_ops, .priv_auto = sizeof(struct mvneta_port),
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 2/19 net: mvneta: Fix 10Mbps speed
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
In mvneta_adjust_link() we need to set MII_SPEED bit only if PHY reports the speed at 100Mbps.
--- drivers/net/mvneta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mvneta.c +1 -1
@@ -1195,7 +1195,7 @@ static void mvneta_adjust_link(struct udevice *dev)if (phydev->speed ==SPEED_1000 ) val |=MVNETA_GMAC_CONFIG_GMII_SPEED ; -else +else if (pp->speed ==SPEED_100 ) val |=MVNETA_GMAC_CONFIG_MII_SPEED ;mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val);
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 02/19] net: mvneta: Fix 10Mbps speed
Quoted 25 lines · Marek Behún
From: Marek Behún <[email protected]>
In
mvneta_adjust_link()we need to setMII_SPEEDbit only if PHY reports the speed at 100Mbps.Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/mvneta.c +1
-2@@ -1195,7 +1195,7 @@ static void mvneta_adjust_link(struct udevice *dev)if (phydev->speed ==SPEED_1000 ) val |=MVNETA_GMAC_CONFIG_GMII_SPEED ; -else +else if (pp->speed ==SPEED_100 ) val |=MVNETA_GMAC_CONFIG_MII_SPEED ;mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 02/19] net: mvneta: Fix 10Mbps speed
In reply to Marek BehúnQuoted 6 lines · Marek Behún
From: Marek Behún <[email protected]>
In
mvneta_adjust_link()we need to setMII_SPEEDbit only if PHY reports the speed at 100Mbps.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 9 lines
--- drivers/net/mvneta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/mvneta.c +0
-0
drivers/net/mvneta.c static void mvneta_adjust_link(struct udevice *dev) · line 1201
Quoted 8 lines
drivers/net/mvneta.c +1
-1@@ -1195,7 +1195,7 @@ static void mvneta_adjust_link(struct udevice *dev)if (phydev->speed ==SPEED_1000 ) val |=MVNETA_GMAC_CONFIG_GMII_SPEED ; -else +else if (pp->speed ==SPEED_100 ) val |=MVNETA_GMAC_CONFIG_MII_SPEED ;mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val);
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 3/19 net: mvneta: Use DM MDIO API for connecting PHY
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Use the modern DM MDIO API for connecting PHY in the mvneta driver.
This requires enabling MVMDIO driver in several config files.
--- configs/clearfog_defconfig | 1 + configs/controlcenterdc_defconfig | 1 + configs/db-88f6820-amc_defconfig | 1 + configs/db-88f6820-gp_defconfig | 1 + configs/db-mv784mp-gp_defconfig | 1 + configs/ds414_defconfig | 1 + configs/helios4_defconfig | 1 + configs/maxbcm_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/theadorable_debug_defconfig | 1 + configs/turris_mox_defconfig | 1 + configs/turris_omnia_defconfig | 1 + configs/uDPU_defconfig | 1 + drivers/net/Kconfig | 1 + drivers/net/mvneta.c | 11 +++++------ 15 files changed, 19 insertions(+), 6 deletions(-)
configs/clearfog_defconfig +1 -0
@@ -63,6 +63,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_SCSI=y
configs/controlcenterdc_defconfig +1 -0
@@ -77,6 +77,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_MVEBU=y
configs/db-88f6820-amc_defconfig +1 -0
@@ -67,6 +67,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_DEBUG_UART_SHIFT=2
configs/db-88f6820-gp_defconfig +1 -0
@@ -62,6 +62,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_SCSI=y
configs/db-mv784mp-gp_defconfig +1 -0
@@ -65,6 +65,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_DEBUG_UART_SHIFT=2
configs/ds414_defconfig +1 -0
@@ -65,6 +65,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_DEBUG_UART_SHIFT=2
configs/helios4_defconfig +1 -0
@@ -63,6 +63,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_SCSI=y
configs/maxbcm_defconfig +1 -0
@@ -47,6 +47,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y CONFIG_KIRKWOOD_SPI=y
configs/mvebu_espressobin-88f3720_defconfig +1 -0
@@ -76,6 +76,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MVNETA=y +CONFIG_MVMDIO=y CONFIG_NVME_PCI=y CONFIG_PCI=y CONFIG_PCI_AARDVARK=y
configs/theadorable_debug_defconfig +1 -0
@@ -70,6 +70,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_MVEBU=y
configs/turris_mox_defconfig +1 -0
@@ -82,6 +82,7 @@ CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y +CONFIG_MVMDIO=y CONFIG_NVME_PCI=y CONFIG_PCI=y CONFIG_PCI_AARDVARK=y
configs/turris_omnia_defconfig +1 -0
@@ -82,6 +82,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_NVME_PCI=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y
configs/uDPU_defconfig +1 -0
@@ -73,6 +73,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MVNETA=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_AARDVARK=y CONFIG_PHY=y
drivers/net/Kconfig +1 -0
@@ -445,6 +445,7 @@ config MVNETA bool "Marvell Armada XP/385/3700 network interface support" depends on ARMADA_XP || ARMADA_38X || ARMADA_3700 select PHYLIB + select DM_MDIO help This driver supports the network interface units in the Marvell ARMADA XP, ARMADA 38X and ARMADA 3700 SoCs
drivers/net/mvneta.c +5 -6
@@ -1571,16 +1571,15 @@ static int mvneta_start(struct udevice *dev)mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); }else { -/* Set phy address of the port */ -mvreg_write (pp,MVNETA_PHY_ADDR , pp->phyaddr); - - phydev =phy_connect (pp->bus, pp->phyaddr, dev, - pp->phy_interface); + phydev =dm_eth_phy_connect (dev);if (!phydev) { -printf ("phy_connect failed\n" ); +printf ("dm_eth_phy_connect failed\n" );return -ENODEV ; } +/* Set PHY address in case we will enable HW polling */ +mvreg_write (pp,MVNETA_PHY_ADDR , phydev->addr); + pp->phydev = phydev;phy_config (phydev);phy_startup (phydev);
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 03/19] net: mvneta: Use DM MDIO API for connecting PHY
Quoted 221 lines · Marek Behún
From: Marek Behún <[email protected]>
Use the modern DM MDIO API for connecting PHY in the mvneta driver.
This requires enabling MVMDIO driver in several config files.
Signed-off-by Marek Behún <[email protected]>--- configs/clearfog_defconfig | 1 + configs/controlcenterdc_defconfig | 1 + configs/db-88f6820-amc_defconfig | 1 + configs/db-88f6820-gp_defconfig | 1 + configs/db-mv784mp-gp_defconfig | 1 + configs/ds414_defconfig | 1 + configs/helios4_defconfig | 1 + configs/maxbcm_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/theadorable_debug_defconfig | 1 + configs/turris_mox_defconfig | 1 + configs/turris_omnia_defconfig | 1 + configs/uDPU_defconfig | 1 + drivers/net/Kconfig | 1 + drivers/net/mvneta.c | 11 +++++------ 15 files changed, 19 insertions(+), 6 deletions(-)configs/clearfog_defconfig +1
-0@@ -63,6 +63,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_SCSI=yconfigs/controlcenterdc_defconfig +1
-0@@ -77,6 +77,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_MVEBU=yconfigs/db-88f6820-amc_defconfig +1
-0@@ -67,6 +67,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_DEBUG_UART_SHIFT=2configs/db-88f6820-gp_defconfig +1
-0@@ -62,6 +62,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_SCSI=yconfigs/db-mv784mp-gp_defconfig +1
-0@@ -65,6 +65,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_DEBUG_UART_SHIFT=2configs/ds414_defconfig +1
-0@@ -65,6 +65,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_DEBUG_UART_SHIFT=2configs/helios4_defconfig +1
-0@@ -63,6 +63,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_SCSI=yconfigs/maxbcm_defconfig +1
-0@@ -47,6 +47,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y CONFIG_KIRKWOOD_SPI=yconfigs/mvebu_espressobin-88f3720_defconfig +1
-0@@ -76,6 +76,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MVNETA=y +CONFIG_MVMDIO=y CONFIG_NVME_PCI=y CONFIG_PCI=y CONFIG_PCI_AARDVARK=yconfigs/theadorable_debug_defconfig +1
-0@@ -70,6 +70,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_MVEBU=yconfigs/turris_mox_defconfig +1
-0@@ -82,6 +82,7 @@ CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y +CONFIG_MVMDIO=y CONFIG_NVME_PCI=y CONFIG_PCI=y CONFIG_PCI_AARDVARK=yconfigs/turris_omnia_defconfig +1
-0@@ -82,6 +82,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_NVME_PCI=y CONFIG_PCI=y CONFIG_PCI_MVEBU=yconfigs/uDPU_defconfig +1
-0@@ -73,6 +73,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MVNETA=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_AARDVARK=y CONFIG_PHY=ydrivers/net/Kconfig +1
-0@@ -445,6 +445,7 @@ config MVNETA bool "Marvell Armada XP/385/3700 network interface support" depends on ARMADA_XP || ARMADA_38X || ARMADA_3700 select PHYLIB + select DM_MDIO help This driver supports the network interface units in the Marvell ARMADA XP, ARMADA 38X and ARMADA 3700 SoCsdrivers/net/mvneta.c +5
-7@@ -1571,16 +1571,15 @@ static int mvneta_start(struct udevice *dev)mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); }else { -/* Set phy address of the port */ -mvreg_write (pp,MVNETA_PHY_ADDR , pp->phyaddr); - - phydev =phy_connect (pp->bus, pp->phyaddr, dev, - pp->phy_interface); + phydev =dm_eth_phy_connect (dev);if (!phydev) { -printf ("phy_connect failed\n" ); +printf ("dm_eth_phy_connect failed\n" );return -ENODEV ; } +/* Set PHY address in case we will enable HW polling */ +mvreg_write (pp,MVNETA_PHY_ADDR , phydev->addr); + pp->phydev = phydev;phy_config (phydev);phy_startup (phydev); --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 03/19] net: mvneta: Use DM MDIO API for connecting PHY
In reply to Marek BehúnQuoted 7 lines · Marek Behún
From: Marek Behún <[email protected]>
Use the modern DM MDIO API for connecting PHY in the mvneta driver.
This requires enabling MVMDIO driver in several config files.
Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 202 lines
--- configs/clearfog_defconfig | 1 + configs/controlcenterdc_defconfig | 1 + configs/db-88f6820-amc_defconfig | 1 + configs/db-88f6820-gp_defconfig | 1 + configs/db-mv784mp-gp_defconfig | 1 + configs/ds414_defconfig | 1 + configs/helios4_defconfig | 1 + configs/maxbcm_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/theadorable_debug_defconfig | 1 + configs/turris_mox_defconfig | 1 + configs/turris_omnia_defconfig | 1 + configs/uDPU_defconfig | 1 + drivers/net/Kconfig | 1 + drivers/net/mvneta.c | 11 +++++------ 15 files changed, 19 insertions(+), 6 deletions(-)configs/clearfog_defconfig +1
-0@@ -63,6 +63,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_SCSI=yconfigs/controlcenterdc_defconfig +1
-0@@ -77,6 +77,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_MVEBU=yconfigs/db-88f6820-amc_defconfig +1
-0@@ -67,6 +67,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_DEBUG_UART_SHIFT=2configs/db-88f6820-gp_defconfig +1
-0@@ -62,6 +62,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_SCSI=yconfigs/db-mv784mp-gp_defconfig +1
-0@@ -65,6 +65,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_DEBUG_UART_SHIFT=2configs/ds414_defconfig +1
-0@@ -65,6 +65,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_DEBUG_UART_SHIFT=2configs/helios4_defconfig +1
-0@@ -63,6 +63,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_MVEBU=y CONFIG_SCSI=yconfigs/maxbcm_defconfig +1
-0@@ -47,6 +47,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y CONFIG_KIRKWOOD_SPI=yconfigs/mvebu_espressobin-88f3720_defconfig +1
-0@@ -76,6 +76,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MVNETA=y +CONFIG_MVMDIO=y CONFIG_NVME_PCI=y CONFIG_PCI=y CONFIG_PCI_AARDVARK=yconfigs/theadorable_debug_defconfig +1
-0@@ -70,6 +70,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_MVEBU=yconfigs/turris_mox_defconfig +1
-0@@ -82,6 +82,7 @@ CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y +CONFIG_MVMDIO=y CONFIG_NVME_PCI=y CONFIG_PCI=y CONFIG_PCI_AARDVARK=yconfigs/turris_omnia_defconfig +1
-0@@ -82,6 +82,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y +CONFIG_MVMDIO=y CONFIG_NVME_PCI=y CONFIG_PCI=y CONFIG_PCI_MVEBU=yconfigs/uDPU_defconfig +1
-0@@ -73,6 +73,7 @@ CONFIG_PHY_MARVELL=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MVNETA=y +CONFIG_MVMDIO=y CONFIG_PCI=y CONFIG_PCI_AARDVARK=y CONFIG_PHY=ydrivers/net/Kconfig +1
-0@@ -445,6 +445,7 @@ config MVNETA bool "Marvell Armada XP/385/3700 network interface support" depends on ARMADA_XP || ARMADA_38X || ARMADA_3700 select PHYLIB + select DM_MDIO help This driver supports the network interface units in the Marvell ARMADA XP, ARMADA 38X and ARMADA 3700 SoCsdrivers/net/mvneta.c +1
-6@@ -1571,16 +1571,15 @@ static int mvneta_start(struct udevice *dev)mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); }else { -/* Set phy address of the port */ -mvreg_write (pp,MVNETA_PHY_ADDR , pp->phyaddr); - - phydev =phy_connect (pp->bus, pp->phyaddr, dev, - pp->phy_interface); + phydev =dm_eth_phy_connect (dev);if (!phydev) { -printf ("phy_connect failed\n" );
drivers/net/mvneta.c static int mvneta_start(struct udevice *dev) · line 1585
Quoted 10 lines
drivers/net/mvneta.c +4
-0+printf ("dm_eth_phy_connect failed\n" );return -ENODEV ; } +/* Set PHY address in case we will enable HW polling */ +mvreg_write (pp,MVNETA_PHY_ADDR , phydev->addr); + pp->phydev = phydev;phy_config (phydev);phy_startup (phydev);
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 4/19 net: mvneta: Remember fixed link instead of PHY address in priv data
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
We don't need to remember PHY address anymore, because since using DM MDIO for connecting PHY, the address is parsed by mdio-uclass from the ofnode.
But the driver uses a special value of the address to signal fixed link usage.
Drop phyaddr add fixed_link in driver private structure. This simplifies code a little.
--- drivers/net/mvneta.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
drivers/net/mvneta.c +5 -18
@@ -277,12 +277,12 @@ struct mvneta_port {u16 rx_ring_size;phy_interface_t phy_interface; +bool fixed_link;unsigned int link;unsigned int duplex;unsigned int speed;int init; -int phyaddr;struct phy_device *phydev;#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc phy_reset_gpio;
@@ -576,13 +576,6 @@ static void mvneta_rxq_buf_size_set(struct mvneta_port *pp,mvreg_write (pp,MVNETA_RXQ_SIZE_REG (rxq->id), val); } -static int mvneta_port_is_fixed_link (struct mvneta_port *pp) -{ -/* phy_addr is set to invalid value for fixed link */ -return pp->phyaddr >PHY_MAX_ADDR ; -} - -/* Start the Ethernet port RX and TX activity */ static void mvneta_port_up (struct mvneta_port *pp) {
@@ -834,7 +827,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)mvreg_write (pp,MVNETA_SDMA_CONFIG , val);/* Enable PHY polling in hardware if not in fixed-link mode */ -if (!mvneta_port_is_fixed_link (pp)) { +if (!pp->fixed_link) { val =mvreg_read (pp,MVNETA_UNIT_CONTROL ); val |=MVNETA_PHY_POLLING_ENABLE ;mvreg_write (pp,MVNETA_UNIT_CONTROL , val);
@@ -1173,7 +1166,7 @@ static void mvneta_adjust_link(struct udevice *dev)struct phy_device *phydev = pp->phydev;int status_change =0 ; -if (mvneta_port_is_fixed_link (pp)) { +if (pp->fixed_link) {debug ("Using fixed link, skip link adjust\n" );return ; }
@@ -1548,7 +1541,7 @@ static int mvneta_start(struct udevice *dev)mvneta_port_power_up (pp, pp->phy_interface);if (!pp->init || pp->link ==0 ) { -if (mvneta_port_is_fixed_link (pp)) { +if (pp->fixed_link) {u32 val; pp->init =1 ;
@@ -1698,7 +1691,6 @@ static int mvneta_probe(struct udevice *dev)void *blob = (void *)gd->fdt_blob;int node =dev_of_offset (dev);struct mii_dev *bus; -unsigned long addr;void *bd_space;int ret;int fl_node;
@@ -1742,14 +1734,9 @@ static int mvneta_probe(struct udevice *dev) fl_node =fdt_subnode_offset (blob, node,"fixed-link" );if (fl_node != -FDT_ERR_NOTFOUND ) {/* set phy_addr to invalid value for fixed link */ - pp->phyaddr =PHY_MAX_ADDR +1 ; pp->duplex =fdtdec_get_bool (blob, fl_node,"full-duplex" ); pp->speed =fdtdec_get_int (blob, fl_node,"speed" ,0 ); - }else { -/* Now read phyaddr from DT */ - addr =fdtdec_get_int (blob, node,"phy" ,0 ); - addr =fdt_node_offset_by_phandle (blob, addr); - pp->phyaddr =fdtdec_get_int (blob, addr,"reg" ,0 ); + pp->fixed_link = true; } bus =mdio_alloc ();
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 04/19] net: mvneta: Remember fixed link instead of PHY address in priv data
Quoted 102 lines · Marek Behún
From: Marek Behún <[email protected]>
We don't need to remember PHY address anymore, because since using DM MDIO for connecting PHY, the address is parsed by mdio-uclass from the ofnode.
But the driver uses a special value of the address to signal fixed link usage.
Drop phyaddr add
fixed_linkin driver private structure. This simplifies code a little.Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)drivers/net/mvneta.c +5
-19@@ -277,12 +277,12 @@ struct mvneta_port {u16 rx_ring_size;phy_interface_t phy_interface; +bool fixed_link;unsigned int link;unsigned int duplex;unsigned int speed;int init; -int phyaddr;struct phy_device *phydev;#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc phy_reset_gpio;@@ -576,13 +576,6 @@ static void mvneta_rxq_buf_size_set(struct mvneta_port *pp,mvreg_write (pp,MVNETA_RXQ_SIZE_REG (rxq->id), val); } -static int mvneta_port_is_fixed_link (struct mvneta_port *pp) -{ -/* phy_addr is set to invalid value for fixed link */ -return pp->phyaddr >PHY_MAX_ADDR ; -} - -/* Start the Ethernet port RX and TX activity */ static void mvneta_port_up (struct mvneta_port *pp) {@@ -834,7 +827,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)mvreg_write (pp,MVNETA_SDMA_CONFIG , val);/* Enable PHY polling in hardware if not in fixed-link mode */ -if (!mvneta_port_is_fixed_link (pp)) { +if (!pp->fixed_link) { val =mvreg_read (pp,MVNETA_UNIT_CONTROL ); val |=MVNETA_PHY_POLLING_ENABLE ;mvreg_write (pp,MVNETA_UNIT_CONTROL , val);@@ -1173,7 +1166,7 @@ static void mvneta_adjust_link(struct udevice *dev)struct phy_device *phydev = pp->phydev;int status_change =0 ; -if (mvneta_port_is_fixed_link (pp)) { +if (pp->fixed_link) {debug ("Using fixed link, skip link adjust\n" );return ; }@@ -1548,7 +1541,7 @@ static int mvneta_start(struct udevice *dev)mvneta_port_power_up (pp, pp->phy_interface);if (!pp->init || pp->link ==0 ) { -if (mvneta_port_is_fixed_link (pp)) { +if (pp->fixed_link) {u32 val; pp->init =1 ;@@ -1698,7 +1691,6 @@ static int mvneta_probe(struct udevice *dev)void *blob = (void *)gd->fdt_blob;int node =dev_of_offset (dev);struct mii_dev *bus; -unsigned long addr;void *bd_space;int ret;int fl_node;@@ -1742,14 +1734,9 @@ static int mvneta_probe(struct udevice *dev) fl_node =fdt_subnode_offset (blob, node,"fixed-link" );if (fl_node != -FDT_ERR_NOTFOUND ) {/* set phy_addr to invalid value for fixed link */ - pp->phyaddr =PHY_MAX_ADDR +1 ; pp->duplex =fdtdec_get_bool (blob, fl_node,"full-duplex" ); pp->speed =fdtdec_get_int (blob, fl_node,"speed" ,0 ); - }else { -/* Now read phyaddr from DT */ - addr =fdtdec_get_int (blob, node,"phy" ,0 ); - addr =fdt_node_offset_by_phandle (blob, addr); - pp->phyaddr =fdtdec_get_int (blob, addr,"reg" ,0 ); + pp->fixed_link = true; } bus =mdio_alloc (); --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 04/19] net: mvneta: Remember fixed link instead of PHY address in priv data
In reply to Marek BehúnQuoted 6 lines · Marek Behún
From: Marek Behún <[email protected]>
We don't need to remember PHY address anymore, because since using DM MDIO for connecting PHY, the address is parsed by mdio-uclass from the ofnode.
Quoted 7 lines
But the driver uses a special value of the address to signal fixed link usage.
Drop phyaddr add
fixed_linkin driver private structure. This simplifies code a little.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 77 lines
--- drivers/net/mvneta.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)drivers/net/mvneta.c +4
-13@@ -277,12 +277,12 @@ struct mvneta_port {u16 rx_ring_size;phy_interface_t phy_interface; +bool fixed_link;unsigned int link;unsigned int duplex;unsigned int speed;int init; -int phyaddr;struct phy_device *phydev;#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc phy_reset_gpio;@@ -576,13 +576,6 @@ static void mvneta_rxq_buf_size_set(struct mvneta_port *pp,mvreg_write (pp,MVNETA_RXQ_SIZE_REG (rxq->id), val); } -static int mvneta_port_is_fixed_link (struct mvneta_port *pp) -{ -/* phy_addr is set to invalid value for fixed link */ -return pp->phyaddr >PHY_MAX_ADDR ; -} - -/* Start the Ethernet port RX and TX activity */ static void mvneta_port_up (struct mvneta_port *pp) {@@ -834,7 +827,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)mvreg_write (pp,MVNETA_SDMA_CONFIG , val);/* Enable PHY polling in hardware if not in fixed-link mode */ -if (!mvneta_port_is_fixed_link (pp)) { +if (!pp->fixed_link) { val =mvreg_read (pp,MVNETA_UNIT_CONTROL ); val |=MVNETA_PHY_POLLING_ENABLE ;mvreg_write (pp,MVNETA_UNIT_CONTROL , val);@@ -1173,7 +1166,7 @@ static void mvneta_adjust_link(struct udevice *dev)struct phy_device *phydev = pp->phydev;int status_change =0 ; -if (mvneta_port_is_fixed_link (pp)) { +if (pp->fixed_link) {debug ("Using fixed link, skip link adjust\n" );return ; }@@ -1548,7 +1541,7 @@ static int mvneta_start(struct udevice *dev)mvneta_port_power_up (pp, pp->phy_interface);if (!pp->init || pp->link ==0 ) { -if (mvneta_port_is_fixed_link (pp)) { +if (pp->fixed_link) {u32 val; pp->init =1 ;@@ -1698,7 +1691,6 @@ static int mvneta_probe(struct udevice *dev)void *blob = (void *)gd->fdt_blob;int node =dev_of_offset (dev);struct mii_dev *bus; -unsigned long addr;void *bd_space;int ret;int fl_node;@@ -1742,14 +1734,9 @@ static int mvneta_probe(struct udevice *dev) fl_node =fdt_subnode_offset (blob, node,"fixed-link" );if (fl_node != -FDT_ERR_NOTFOUND ) {/* set phy_addr to invalid value for fixed link */ - pp->phyaddr =PHY_MAX_ADDR +1 ; pp->duplex =fdtdec_get_bool (blob, fl_node,"full-duplex" );
drivers/net/mvneta.c static int mvneta_probe(struct udevice *dev) · line 1742
Quoted 10 lines
drivers/net/mvneta.c +1
-5pp->speed =fdtdec_get_int (blob, fl_node,"speed" ,0 ); - }else { -/* Now read phyaddr from DT */ - addr =fdtdec_get_int (blob, node,"phy" ,0 ); - addr =fdt_node_offset_by_phandle (blob, addr); - pp->phyaddr =fdtdec_get_int (blob, addr,"reg" ,0 ); + pp->fixed_link = true; } bus =mdio_alloc ();
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 5/19 arm: mvebu: Espressobin: Use DM registered MDIO to configure switch
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
In order to be able to get rid of the non-DM MDIO bus registered in mvneta driver, we need to stop using board_network_enable() and instead use the DM registered MDIO device to configure switch in last_stage_init().
--- board/Marvell/mvebu_armada-37xx/board.c | 26 ++++++++++++++++----- configs/mvebu_espressobin-88f3720_defconfig | 1 + 2 files changed, 21 insertions(+), 6 deletions(-)
board/Marvell/mvebu_armada-37xx/board.c +20 -6
@@ -11,6 +11,7 @@#include <i2c.h> #include <init.h> #include <mmc.h> +#include <miiphy.h> #include <phy.h> #include <asm/global_data.h> #include <asm/io.h>
@@ -254,14 +255,15 @@ int board_xhci_enable(fdt_addr_t base)return 0 ; } +#ifdef CONFIG_LAST_STAGE_INIT /* Helper function for accessing switch devices in multi-chip connection mode */ -static int mii_multi_chip_mode_write (struct mii_dev *bus,int dev_smi_addr, +static int mii_multi_chip_mode_write (struct udevice *bus,int dev_smi_addr,int smi_addr,int reg,u16 value) {u16 smi_cmd =0 ; -if (bus->write (bus, dev_smi_addr,0 , -MVEBU_SW_SMI_DATA_REG , value) !=0 ) { +if (dm_mdio_write (bus, dev_smi_addr,MDIO_DEVAD_NONE , +MVEBU_SW_SMI_DATA_REG , value) !=0 ) {printf ("Error writing to the PHY addr=%02x reg=%02x\n" , smi_addr, reg);return -EFAULT ;
@@ -272,8 +274,8 @@ static int mii_multi_chip_mode_write(struct mii_dev *bus, int dev_smi_addr, (1 <<SW_SMI_CMD_SMI_OP_OFF ) | (smi_addr <<SW_SMI_CMD_DEV_ADDR_OFF ) | (reg <<SW_SMI_CMD_REG_ADDR_OFF ); -if (bus->write (bus, dev_smi_addr,0 , -MVEBU_SW_SMI_CMD_REG , smi_cmd) !=0 ) { +if (dm_mdio_write (bus, dev_smi_addr,MDIO_DEVAD_NONE , +MVEBU_SW_SMI_CMD_REG , smi_cmd) !=0 ) {printf ("Error writing to the PHY addr=%02x reg=%02x\n" , smi_addr, reg);return -EFAULT ;
@@ -283,11 +285,22 @@ static int mii_multi_chip_mode_write(struct mii_dev *bus, int dev_smi_addr, }/* Bring-up board-specific network stuff */ -int board_network_enable (struct mii_dev *bus) +int last_stage_init (void ) { +struct udevice *bus; +ofnode node; +if (!of_machine_is_compatible ("globalscale,espressobin" ))return 0 ; + node =ofnode_by_compatible (ofnode_null (),"marvell,orion-mdio" ); +if (!ofnode_valid (node) || +uclass_get_device_by_ofnode (UCLASS_MDIO , node, &bus) || +device_probe (bus)) { +printf ("Cannot find MDIO bus\n" ); +return 0 ; + } +/* * FIXME: remove this code once Topaz driver gets available * A3720 Community Board Only
@@ -327,6 +340,7 @@ int board_network_enable(struct mii_dev *bus) return 0; } +#endif #ifdef CONFIG_OF_BOARD_SETUP int ft_board_setup (void *blob,struct bd_info *bd)
configs/mvebu_espressobin-88f3720_defconfig +1 -0
@@ -25,6 +25,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_ARCH_EARLY_INIT_R=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_BOARD_LATE_INIT=y +CONFIG_LAST_STAGE_INIT=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_FUSE=y CONFIG_CMD_GPIO=y
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 05/19] arm: mvebu: Espressobin: Use DM registered MDIO to configure switch
Quoted 8 lines · Marek Behún
From: Marek Behún <[email protected]>
In order to be able to get rid of the non-DM MDIO bus registered in mvneta driver, we need to stop using
board_network_enable()and instead use the DM registered MDIO device to configure switch inlast_stage_init().Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 84 lines
--- board/Marvell/mvebu_armada-37xx/board.c | 26 ++++++++++++++++----- configs/mvebu_espressobin-88f3720_defconfig | 1 + 2 files changed, 21 insertions(+), 6 deletions(-)board/Marvell/mvebu_armada-37xx/board.c +20
-6@@ -11,6 +11,7 @@#include <i2c.h> #include <init.h> #include <mmc.h> +#include <miiphy.h> #include <phy.h> #include <asm/global_data.h> #include <asm/io.h> @@ -254,14 +255,15 @@ int board_xhci_enable(fdt_addr_t base)return 0 ; } +#ifdef CONFIG_LAST_STAGE_INIT /* Helper function for accessing switch devices in multi-chip connection mode */ -static int mii_multi_chip_mode_write (struct mii_dev *bus,int dev_smi_addr, +static int mii_multi_chip_mode_write (struct udevice *bus,int dev_smi_addr,int smi_addr,int reg,u16 value) {u16 smi_cmd =0 ; -if (bus->write (bus, dev_smi_addr,0 , -MVEBU_SW_SMI_DATA_REG , value) !=0 ) { +if (dm_mdio_write (bus, dev_smi_addr,MDIO_DEVAD_NONE , +MVEBU_SW_SMI_DATA_REG , value) !=0 ) {printf ("Error writing to the PHY addr=%02x reg=%02x\n" , smi_addr, reg);return -EFAULT ;@@ -272,8 +274,8 @@ static int mii_multi_chip_mode_write(struct mii_dev *bus, int dev_smi_addr, (1 <<SW_SMI_CMD_SMI_OP_OFF ) | (smi_addr <<SW_SMI_CMD_DEV_ADDR_OFF ) | (reg <<SW_SMI_CMD_REG_ADDR_OFF ); -if (bus->write (bus, dev_smi_addr,0 , -MVEBU_SW_SMI_CMD_REG , smi_cmd) !=0 ) { +if (dm_mdio_write (bus, dev_smi_addr,MDIO_DEVAD_NONE , +MVEBU_SW_SMI_CMD_REG , smi_cmd) !=0 ) {printf ("Error writing to the PHY addr=%02x reg=%02x\n" , smi_addr, reg);return -EFAULT ;@@ -283,11 +285,22 @@ static int mii_multi_chip_mode_write(struct mii_dev *bus, int dev_smi_addr, }/* Bring-up board-specific network stuff */ -int board_network_enable (struct mii_dev *bus) +int last_stage_init (void ) { +struct udevice *bus; +ofnode node; +if (!of_machine_is_compatible ("globalscale,espressobin" ))return 0 ; + node =ofnode_by_compatible (ofnode_null (),"marvell,orion-mdio" ); +if (!ofnode_valid (node) || +uclass_get_device_by_ofnode (UCLASS_MDIO , node, &bus) || +device_probe (bus)) { +printf ("Cannot find MDIO bus\n" ); +return 0 ; + } +/* * FIXME: remove this code once Topaz driver gets available * A3720 Community Board Only @@ -327,6 +340,7 @@ int board_network_enable(struct mii_dev *bus) return 0; } +#endif #ifdef CONFIG_OF_BOARD_SETUP int ft_board_setup (void *blob,struct bd_info *bd)configs/mvebu_espressobin-88f3720_defconfig +0
-0
configs/mvebu_espressobin-88f3720_defconfig CONFIG_DISPLAY_BOARDINFO_LATE=y · line 31
Quoted 7 lines
configs/mvebu_espressobin-88f3720_defconfig +1
-0@@ -25,6 +25,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_ARCH_EARLY_INIT_R=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_BOARD_LATE_INIT=y +CONFIG_LAST_STAGE_INIT=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_FUSE=y CONFIG_CMD_GPIO=y
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 6/19 net: mdio-uclass: add dm_phy_find_by_ofnode() helper
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Add helper to resolve PHY node from it's ofnode via DM MDIO subsystem.
--- include/miiphy.h | 9 +++++++++ net/mdio-uclass.c | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+)
include/miiphy.h +9 -0
@@ -188,6 +188,15 @@ int dm_mdio_write(struct udevice *mdio_dev, int addr, int devad, int reg, u16 va*/ int dm_mdio_reset (struct udevice *mdio_dev); +/** +* dm_phy_find_by_ofnode - Find PHY device by ofnode +* +* @phynode: PHY's ofnode +* +* Return: pointer to phy_device, or NULL on error +*/ +struct phy_device *dm_phy_find_by_ofnode (ofnode phynode); +/** * dm_mdio_phy_connect - Wrapper over phy_connect for DM MDIO *
net/mdio-uclass.c +22 -0
@@ -129,6 +129,28 @@ static int dm_mdio_pre_remove(struct udevice *dev)return 0 ; } +struct phy_device *dm_phy_find_by_ofnode (ofnode phynode) +{ +struct mdio_perdev_priv *pdata; +struct udevice *mdiodev; +u32 phy_addr; + +if (ofnode_read_u32 (phynode,"reg" , &phy_addr)) +return NULL ; + +if (uclass_get_device_by_ofnode (UCLASS_MDIO , +ofnode_get_parent (phynode), + &mdiodev)) +return NULL ; + +if (device_probe (mdiodev)) +return NULL ; + + pdata =dev_get_uclass_priv (mdiodev); + +return phy_find_by_mask (pdata->mii_bus,BIT (phy_addr)); +} +struct phy_device *dm_mdio_phy_connect (struct udevice *mdiodev,int phyaddr,struct udevice *ethdev,phy_interface_t interface)
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 06/19] net: mdio-uclass: add dm_phy_find_by_ofnode() helper
Quoted 65 lines · Marek Behún
From: Marek Behún <[email protected]>
Add helper to resolve PHY node from it's ofnode via DM MDIO subsystem.
Signed-off-by Marek Behún <[email protected]>--- include/miiphy.h | 9 +++++++++ net/mdio-uclass.c | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+)include/miiphy.h +9
-0@@ -188,6 +188,15 @@ int dm_mdio_write(struct udevice *mdio_dev, int addr, int devad, int reg, u16 va*/ int dm_mdio_reset (struct udevice *mdio_dev); +/** +* dm_phy_find_by_ofnode - Find PHY device by ofnode +* +* @phynode: PHY's ofnode +* +* Return: pointer to phy_device, or NULL on error +*/ +struct phy_device *dm_phy_find_by_ofnode (ofnode phynode); +/** * dm_mdio_phy_connect - Wrapper over phy_connect for DM MDIO * net/mdio-uclass.c +22
-1@@ -129,6 +129,28 @@ static int dm_mdio_pre_remove(struct udevice *dev)return 0 ; } +struct phy_device *dm_phy_find_by_ofnode (ofnode phynode) +{ +struct mdio_perdev_priv *pdata; +struct udevice *mdiodev; +u32 phy_addr; + +if (ofnode_read_u32 (phynode,"reg" , &phy_addr)) +return NULL ; + +if (uclass_get_device_by_ofnode (UCLASS_MDIO , +ofnode_get_parent (phynode), + &mdiodev)) +return NULL ; + +if (device_probe (mdiodev)) +return NULL ; + + pdata =dev_get_uclass_priv (mdiodev); + +return phy_find_by_mask (pdata->mii_bus,BIT (phy_addr)); +} +struct phy_device *dm_mdio_phy_connect (struct udevice *mdiodev,int phyaddr,struct udevice *ethdev,phy_interface_t interface) --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 06/19] net: mdio-uclass: add dm_phy_find_by_ofnode() helper
In reply to Marek BehúnQuoted 5 lines · Marek Behún
From: Marek Behún <[email protected]>
Add helper to resolve PHY node from it's ofnode via DM MDIO subsystem.
Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 48 lines
--- include/miiphy.h | 9 +++++++++ net/mdio-uclass.c | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+)include/miiphy.h +9
-0@@ -188,6 +188,15 @@ int dm_mdio_write(struct udevice *mdio_dev, int addr, int devad, int reg, u16 va*/ int dm_mdio_reset (struct udevice *mdio_dev); +/** +* dm_phy_find_by_ofnode - Find PHY device by ofnode +* +* @phynode: PHY's ofnode +* +* Return: pointer to phy_device, or NULL on error +*/ +struct phy_device *dm_phy_find_by_ofnode (ofnode phynode); +/** * dm_mdio_phy_connect - Wrapper over phy_connect for DM MDIO * net/mdio-uclass.c +15
-0@@ -129,6 +129,28 @@ static int dm_mdio_pre_remove(struct udevice *dev)return 0 ; } +struct phy_device *dm_phy_find_by_ofnode (ofnode phynode) +{ +struct mdio_perdev_priv *pdata; +struct udevice *mdiodev; +u32 phy_addr; + +if (ofnode_read_u32 (phynode,"reg" , &phy_addr)) +return NULL ; + +if (uclass_get_device_by_ofnode (UCLASS_MDIO , +ofnode_get_parent (phynode), + &mdiodev)) +return NULL ; + +if (device_probe (mdiodev))
net/mdio-uclass.c static int dm_mdio_pre_remove(struct udevice *dev) · line 156
Quoted 10 lines
net/mdio-uclass.c +7
-0+return NULL ; + + pdata =dev_get_uclass_priv (mdiodev); + +return phy_find_by_mask (pdata->mii_bus,BIT (phy_addr)); +} +struct phy_device *dm_mdio_phy_connect (struct udevice *mdiodev,int phyaddr,struct udevice *ethdev,phy_interface_t interface)
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 7/19 arm: mvebu: turris_mox: Use DM registered MDIO
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
In order to be able to get rid of the non-DM MDIO bus registered in mvneta driver, start using the DM registered one in Turris MOX board code.
This also allows us to drop the hack introduced in MOX' -u-boot.dtsi file.
--- .../dts/armada-3720-turris-mox-u-boot.dtsi | 19 ---- board/CZ.NIC/turris_mox/turris_mox.c | 88 +++++++++---------- 2 files changed, 44 insertions(+), 63 deletions(-)
arch/arm/dts/armada-3720-turris-mox-u-boot.dtsi +0 -19
@@ -3,25 +3,6 @@ * 2022 by Marek Behún <[email protected]> */ -/ { - mdio { - #address-cells = <1>; - #size-cells = <0>; - - old_binding_phy1: ethernet-phy@1 { - reg = <1>; - }; - }; -}; - -ð0 { - pinctrl-0 = <&rgmii_pins>, <&smi_pins>; - /delete-property/ phy-handle; - phy = <&old_binding_phy1>; -}; - -/delete-node/ &mdio; - &usb3 { vbus-supply = <&exp_usb3_vbus>; };
board/CZ.NIC/turris_mox/turris_mox.c +44 -44
150 lines not on this page · raw message
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 07/19] arm: mvebu: turris_mox: Use DM registered MDIO
Quoted 10 lines · Marek Behún
From: Marek Behún <[email protected]>
In order to be able to get rid of the non-DM MDIO bus registered in mvneta driver, start using the DM registered one in Turris MOX board code.
This also allows us to drop the hack introduced in MOX'
-u-boot.dtsifile.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 185 lines
--- .../dts/armada-3720-turris-mox-u-boot.dtsi | 19 ---- board/CZ.NIC/turris_mox/turris_mox.c | 88 +++++++++---------- 2 files changed, 44 insertions(+), 63 deletions(-)arch/arm/dts/armada-3720-turris-mox-u-boot.dtsi +0
-19@@ -3,25 +3,6 @@ * 2022 by Marek Behún <[email protected]> */ -/ { - mdio { - #address-cells = <1>; - #size-cells = <0>; - - old_binding_phy1: ethernet-phy@1 { - reg = <1>; - }; - }; -}; - -ð0 { - pinctrl-0 = <&rgmii_pins>, <&smi_pins>; - /delete-property/ phy-handle; - phy = <&old_binding_phy1>; -}; - -/delete-node/ &mdio; - &usb3 { vbus-supply = <&exp_usb3_vbus>; };board/CZ.NIC/turris_mox/turris_mox.c +43
-38@@ -13,6 +13,7 @@#include <button.h> #include <clk.h> #include <dm.h> +#include <dm/of_extra.h> #include <env.h> #include <fdt_support.h> #include <init.h> @@ -216,35 +217,35 @@ static int mox_get_topology(const u8 **ptopology, int *psize, int *pis_sd)#define SW_SMI_CMD_R (d, r) (0x9800 | (((d) & 0x1f) << 5) | ((r) & 0x1f))#define SW_SMI_CMD_W (d, r) (0x9400 | (((d) & 0x1f) << 5) | ((r) & 0x1f)) -static int sw_multi_read (struct mii_dev *bus,int sw,int dev,int reg) +static int sw_multi_read (struct udevice *bus,int sw,int dev,int reg) { - bus->write (bus, sw,0 ,0 ,SW_SMI_CMD_R (dev, reg)); +dm_mdio_write (bus, sw,MDIO_DEVAD_NONE ,0 ,SW_SMI_CMD_R (dev, reg));mdelay (5 ); -return bus->read (bus, sw,0 ,1 ); +return dm_mdio_read (bus, sw,MDIO_DEVAD_NONE ,1 ); } -static void sw_multi_write (struct mii_dev *bus,int sw,int dev,int reg, +static void sw_multi_write (struct udevice *bus,int sw,int dev,int reg,u16 val) { - bus->write (bus, sw,0 ,1 , val); - bus->write (bus, sw,0 ,0 ,SW_SMI_CMD_W (dev, reg)); +dm_mdio_write (bus, sw,MDIO_DEVAD_NONE ,1 , val); +dm_mdio_write (bus, sw,MDIO_DEVAD_NONE ,0 ,SW_SMI_CMD_W (dev, reg));mdelay (5 ); } -static int sw_scratch_read (struct mii_dev *bus,int sw,int reg) +static int sw_scratch_read (struct udevice *bus,int sw,int reg) {sw_multi_write (bus, sw,0x1c ,0x1a , (reg &0x7f ) <<8 );return sw_multi_read (bus, sw,0x1c ,0x1a ) &0xff ; } -static void sw_led_write (struct mii_dev *bus,int sw,int port,int reg, +static void sw_led_write (struct udevice *bus,int sw,int port,int reg,u16 val) {sw_multi_write (bus, sw, port,0x16 ,0x8000 | ((reg &7 ) <<12 ) | (val &0x7ff )); } -static void sw_blink_leds (struct mii_dev *bus,int peridot,int topaz) +static void sw_blink_leds (struct udevice *bus,int peridot,int topaz) {int i, p;struct {@@ -275,7 +276,7 @@ static void sw_blink_leds(struct mii_dev *bus, int peridot, int topaz) } } -static void check_switch_address (struct mii_dev *bus,int addr) +static void check_switch_address (struct udevice *bus,int addr) {if (sw_scratch_read (bus, addr,0x70 ) >>3 != addr) printf("Check of switch MDIO address failed for 0x%02x\n",@@ -374,36 +375,22 @@ static void mox_phy_modify(struct phy_device *phydev, int page, int reg,static void mox_phy_leds_start_blinking (void ) {struct phy_device *phydev; -struct mii_dev *bus; -const char *node_name; -int node; +ofnode phy_node; - node =fdt_path_offset (gd->fdt_blob,"ethernet0" ); -if (node <0 ) { -printf ("Cannot get eth0!\n" ); -return ; - } + phy_node =ofnode_get_phy_node (ofnode_path ("ethernet0" )); +if (!ofnode_valid (phy_node)) + goto err; - node_name =fdt_get_name (gd->fdt_blob, node,NULL ); -if (!node_name) { -printf ("Cannot get eth0 node name!\n" ); -return ; - } - - bus =miiphy_get_dev_by_name (node_name); -if (!bus) { -printf ("Cannot get MDIO bus device!\n" ); -return ; - } - - phydev =phy_find_by_mask (bus,BIT (1 )); -if (!phydev) { -printf ("Cannot get ethernet PHY!\n" ); -return ; - } + phydev =dm_phy_find_by_ofnode (phy_node); +if (!phydev) + goto err;mox_phy_modify (phydev,3 ,0x12 ,0x700 ,0x400 );mox_phy_modify (phydev,3 ,0x10 ,0xff ,0xbb ); + +return ; +err: +printf ("Cannot get ethernet PHY!\n" ); }static bool read_reset_button (void )@@ -611,6 +598,26 @@ int show_board_info(void)return 0 ; } +static struct udevice *mox_mdio_bus (void ) +{ +struct udevice *bus; +ofnode node; + + node =ofnode_by_compatible (ofnode_null (),"marvell,orion-mdio" ); +if (!ofnode_valid (node)) + goto err; + +dm_mdio_probe_devices (); + +if (uclass_get_device_by_ofnode (UCLASS_MDIO , node, &bus)) + goto err; + +return bus; +err: +printf ("Cannot get MDIO bus device!\n" ); +return NULL ; +} +int last_stage_init (void ) {struct gpio_desc reset_gpio = {};@@ -636,16 +643,9 @@ int last_stage_init(void)* 0x70 of Peridot (and potentially Topaz) modules */ if (peridot || topaz) { -struct mii_dev *bus; -const char *node_name; -int node; +struct udevice *bus =mox_mdio_bus ();
board/CZ.NIC/turris_mox/turris_mox.c int last_stage_init(void) · line 651
Quoted 10 lines
board/CZ.NIC/turris_mox/turris_mox.c +1
-6- node =fdt_path_offset (gd->fdt_blob,"ethernet0" ); - node_name = (node >=0 ) ?fdt_get_name (gd->fdt_blob, node,NULL ) :NULL ; - bus = node_name ?miiphy_get_dev_by_name (node_name) :NULL ; -if (!bus) { -printf ("Cannot get MDIO bus device!\n" ); - }else { +if (bus) {int i;for (i =0 ; i < peridot; ++i)
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 8/19 net: mvneta: Don't register MDIO bus
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
This MDIO bus is now handled by a proper mvmdio DM driver. Remove it from mvneta.
--- drivers/net/mvneta.c | 143 +------------------------------------------ 1 file changed, 2 insertions(+), 141 deletions(-)
drivers/net/mvneta.c +2 -141
@@ -288,7 +288,6 @@ struct mvneta_port {struct gpio_desc phy_reset_gpio;struct gpio_desc sfp_tx_disable_gpio;#endif -struct mii_dev *bus; };/* The mvneta_tx_desc and mvneta_rx_desc structures describe the
@@ -414,15 +413,6 @@ static struct buffer_location buffer_loc;*/ #define BD_SPACE (1 << 20) -/* -* Dummy implementation that can be overwritten by a board -* specific function -*/ -__weak int board_network_enable (struct mii_dev *bus) -{ -return 0 ; -} -/* Utility/helper methods */ /* Write helper method */
@@ -1421,118 +1411,6 @@ static int mvneta_init(struct udevice *dev)/* U-Boot only functions follow here */ -/* SMI / MDIO functions */ - -static int smi_wait_ready (struct mvneta_port *pp) -{ -u32 timeout =MVNETA_SMI_TIMEOUT ; -u32 smi_reg; - -/* wait till the SMI is not busy */ -do { -/* read smi register */ - smi_reg =mvreg_read (pp,MVNETA_SMI ); -if (timeout-- ==0 ) { -printf ("Error: SMI busy timeout\n" ); -return -EFAULT ; - } - }while (smi_reg &MVNETA_SMI_BUSY ); - -return 0 ; -} - -/* -* mvneta_mdio_read - miiphy_read callback function. -* -* Returns 16bit phy register value, or 0xffff on error -*/ -static int mvneta_mdio_read (struct mii_dev *bus,int addr,int devad,int reg) -{ -struct mvneta_port *pp = bus->priv; -u32 smi_reg; -u32 timeout; - -/* check parameters */ -if (addr >MVNETA_PHY_ADDR_MASK ) { -printf ("Error: Invalid PHY address %d\n" , addr); -return -EFAULT ; - } - -if (reg >MVNETA_PHY_REG_MASK ) { -printf ("Err: Invalid register offset %d\n" , reg); -return -EFAULT ; - } - -/* wait till the SMI is not busy */ -if (smi_wait_ready (pp) <0 ) -return -EFAULT ; - -/* fill the phy address and regiser offset and read opcode */ - smi_reg = (addr <<MVNETA_SMI_DEV_ADDR_OFFS ) - | (reg <<MVNETA_SMI_REG_ADDR_OFFS ) - |MVNETA_SMI_OPCODE_READ ; - -/* write the smi register */ -mvreg_write (pp,MVNETA_SMI , smi_reg); - -/* wait till read value is ready */ - timeout =MVNETA_SMI_TIMEOUT ; - -do { -/* read smi register */ - smi_reg =mvreg_read (pp,MVNETA_SMI ); -if (timeout-- ==0 ) { -printf ("Err: SMI read ready timeout\n" ); -return -EFAULT ; - } - }while (!(smi_reg &MVNETA_SMI_READ_VALID )); - -/* Wait for the data to update in the SMI register */ -for (timeout =0 ; timeout <MVNETA_SMI_TIMEOUT ; timeout++) - ; - -return mvreg_read (pp,MVNETA_SMI ) &MVNETA_SMI_DATA_MASK ; -} - -/* -* mvneta_mdio_write - miiphy_write callback function. -* -* Returns 0 if write succeed, -EINVAL on bad parameters -* -ETIME on timeout -*/ -static int mvneta_mdio_write (struct mii_dev *bus,int addr,int devad,int reg, -u16 value) -{ -struct mvneta_port *pp = bus->priv; -u32 smi_reg; - -/* check parameters */ -if (addr >MVNETA_PHY_ADDR_MASK ) { -printf ("Error: Invalid PHY address %d\n" , addr); -return -EFAULT ; - } - -if (reg >MVNETA_PHY_REG_MASK ) { -printf ("Err: Invalid register offset %d\n" , reg); -return -EFAULT ; - } - -/* wait till the SMI is not busy */ -if (smi_wait_ready (pp) <0 ) -return -EFAULT ; - -/* fill the phy addr and reg offset and write opcode and data */ - smi_reg = value <<MVNETA_SMI_DATA_OFFS ; - smi_reg |= (addr <<MVNETA_SMI_DEV_ADDR_OFFS ) - | (reg <<MVNETA_SMI_REG_ADDR_OFFS ); - smi_reg &= ~MVNETA_SMI_OPCODE_READ ; - -/* write the smi register */ -mvreg_write (pp,MVNETA_SMI , smi_reg); - -return 0 ; -} -static int mvneta_start (struct udevice *dev) {struct mvneta_port *pp =dev_get_priv (dev);
@@ -1690,10 +1568,9 @@ static int mvneta_probe(struct udevice *dev)#endif void *blob = (void *)gd->fdt_blob;int node =dev_of_offset (dev); -struct mii_dev *bus;void *bd_space; -int ret;int fl_node; +int ret;/* * Allocate buffer area for descs and rx_buffers. This is only
@@ -1739,22 +1616,6 @@ static int mvneta_probe(struct udevice *dev) pp->fixed_link = true; } - bus =mdio_alloc (); -if (!bus) { -printf ("Failed to allocate MDIO bus\n" ); -return -ENOMEM ; - } - - bus->read = mvneta_mdio_read; - bus->write = mvneta_mdio_write; -snprintf (bus->name,sizeof (bus->name), dev->name); - bus->priv = (void *)pp; - pp->bus = bus; - - ret =mdio_register (bus); -if (ret) -return ret; -#if CONFIG_IS_ENABLED (DM_GPIO ) ret =dev_read_phandle_with_args (dev,"sfp" ,NULL ,0 ,0 , &sfp_args);if (!ret &&ofnode_is_enabled (sfp_args.node))
@@ -1774,7 +1635,7 @@ static int mvneta_probe(struct udevice *dev)dm_gpio_set_value (&pp->sfp_tx_disable_gpio,0 );#endif -return board_network_enable (bus); +return 0 ; }static void mvneta_stop (struct udevice *dev)
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 08/19] net: mvneta: Don't register MDIO bus
Quoted 203 lines · Marek Behún
From: Marek Behún <[email protected]>
This MDIO bus is now handled by a proper mvmdio DM driver. Remove it from mvneta.
Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 143 +------------------------------------------ 1 file changed, 2 insertions(+), 141 deletions(-)drivers/net/mvneta.c +2
-142@@ -288,7 +288,6 @@ struct mvneta_port {struct gpio_desc phy_reset_gpio;struct gpio_desc sfp_tx_disable_gpio;#endif -struct mii_dev *bus; };/* The mvneta_tx_desc and mvneta_rx_desc structures describe the @@ -414,15 +413,6 @@ static struct buffer_location buffer_loc;*/ #define BD_SPACE (1 << 20) -/* -* Dummy implementation that can be overwritten by a board -* specific function -*/ -__weak int board_network_enable (struct mii_dev *bus) -{ -return 0 ; -} -/* Utility/helper methods */ /* Write helper method */ @@ -1421,118 +1411,6 @@ static int mvneta_init(struct udevice *dev)/* U-Boot only functions follow here */ -/* SMI / MDIO functions */ - -static int smi_wait_ready (struct mvneta_port *pp) -{ -u32 timeout =MVNETA_SMI_TIMEOUT ; -u32 smi_reg; - -/* wait till the SMI is not busy */ -do { -/* read smi register */ - smi_reg =mvreg_read (pp,MVNETA_SMI ); -if (timeout-- ==0 ) { -printf ("Error: SMI busy timeout\n" ); -return -EFAULT ; - } - }while (smi_reg &MVNETA_SMI_BUSY ); - -return 0 ; -} - -/* -* mvneta_mdio_read - miiphy_read callback function. -* -* Returns 16bit phy register value, or 0xffff on error -*/ -static int mvneta_mdio_read (struct mii_dev *bus,int addr,int devad,int reg) -{ -struct mvneta_port *pp = bus->priv; -u32 smi_reg; -u32 timeout; - -/* check parameters */ -if (addr >MVNETA_PHY_ADDR_MASK ) { -printf ("Error: Invalid PHY address %d\n" , addr); -return -EFAULT ; - } - -if (reg >MVNETA_PHY_REG_MASK ) { -printf ("Err: Invalid register offset %d\n" , reg); -return -EFAULT ; - } - -/* wait till the SMI is not busy */ -if (smi_wait_ready (pp) <0 ) -return -EFAULT ; - -/* fill the phy address and regiser offset and read opcode */ - smi_reg = (addr <<MVNETA_SMI_DEV_ADDR_OFFS ) - | (reg <<MVNETA_SMI_REG_ADDR_OFFS ) - |MVNETA_SMI_OPCODE_READ ; - -/* write the smi register */ -mvreg_write (pp,MVNETA_SMI , smi_reg); - -/* wait till read value is ready */ - timeout =MVNETA_SMI_TIMEOUT ; - -do { -/* read smi register */ - smi_reg =mvreg_read (pp,MVNETA_SMI ); -if (timeout-- ==0 ) { -printf ("Err: SMI read ready timeout\n" ); -return -EFAULT ; - } - }while (!(smi_reg &MVNETA_SMI_READ_VALID )); - -/* Wait for the data to update in the SMI register */ -for (timeout =0 ; timeout <MVNETA_SMI_TIMEOUT ; timeout++) - ; - -return mvreg_read (pp,MVNETA_SMI ) &MVNETA_SMI_DATA_MASK ; -} - -/* -* mvneta_mdio_write - miiphy_write callback function. -* -* Returns 0 if write succeed, -EINVAL on bad parameters -* -ETIME on timeout -*/ -static int mvneta_mdio_write (struct mii_dev *bus,int addr,int devad,int reg, -u16 value) -{ -struct mvneta_port *pp = bus->priv; -u32 smi_reg; - -/* check parameters */ -if (addr >MVNETA_PHY_ADDR_MASK ) { -printf ("Error: Invalid PHY address %d\n" , addr); -return -EFAULT ; - } - -if (reg >MVNETA_PHY_REG_MASK ) { -printf ("Err: Invalid register offset %d\n" , reg); -return -EFAULT ; - } - -/* wait till the SMI is not busy */ -if (smi_wait_ready (pp) <0 ) -return -EFAULT ; - -/* fill the phy addr and reg offset and write opcode and data */ - smi_reg = value <<MVNETA_SMI_DATA_OFFS ; - smi_reg |= (addr <<MVNETA_SMI_DEV_ADDR_OFFS ) - | (reg <<MVNETA_SMI_REG_ADDR_OFFS ); - smi_reg &= ~MVNETA_SMI_OPCODE_READ ; - -/* write the smi register */ -mvreg_write (pp,MVNETA_SMI , smi_reg); - -return 0 ; -} -static int mvneta_start (struct udevice *dev) {struct mvneta_port *pp =dev_get_priv (dev);@@ -1690,10 +1568,9 @@ static int mvneta_probe(struct udevice *dev)#endif void *blob = (void *)gd->fdt_blob;int node =dev_of_offset (dev); -struct mii_dev *bus;void *bd_space; -int ret;int fl_node; +int ret;/* * Allocate buffer area for descs and rx_buffers. This is only @@ -1739,22 +1616,6 @@ static int mvneta_probe(struct udevice *dev) pp->fixed_link = true; } - bus =mdio_alloc (); -if (!bus) { -printf ("Failed to allocate MDIO bus\n" ); -return -ENOMEM ; - } - - bus->read = mvneta_mdio_read; - bus->write = mvneta_mdio_write; -snprintf (bus->name,sizeof (bus->name), dev->name); - bus->priv = (void *)pp; - pp->bus = bus; - - ret =mdio_register (bus); -if (ret) -return ret; -#if CONFIG_IS_ENABLED (DM_GPIO ) ret =dev_read_phandle_with_args (dev,"sfp" ,NULL ,0 ,0 , &sfp_args);if (!ret &&ofnode_is_enabled (sfp_args.node))@@ -1774,7 +1635,7 @@ static int mvneta_probe(struct udevice *dev)dm_gpio_set_value (&pp->sfp_tx_disable_gpio,0 );#endif -return board_network_enable (bus); +return 0 ; }static void mvneta_stop (struct udevice *dev) --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 08/19] net: mvneta: Don't register MDIO bus
In reply to Marek BehúnQuoted 6 lines · Marek Behún
From: Marek Behún <[email protected]>
This MDIO bus is now handled by a proper mvmdio DM driver. Remove it from mvneta.
Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 187 lines
--- drivers/net/mvneta.c | 143 +------------------------------------------ 1 file changed, 2 insertions(+), 141 deletions(-)drivers/net/mvneta.c +1
-140@@ -288,7 +288,6 @@ struct mvneta_port {struct gpio_desc phy_reset_gpio;struct gpio_desc sfp_tx_disable_gpio;#endif -struct mii_dev *bus; };/* The mvneta_tx_desc and mvneta_rx_desc structures describe the @@ -414,15 +413,6 @@ static struct buffer_location buffer_loc;*/ #define BD_SPACE (1 << 20) -/* -* Dummy implementation that can be overwritten by a board -* specific function -*/ -__weak int board_network_enable (struct mii_dev *bus) -{ -return 0 ; -} -/* Utility/helper methods */ /* Write helper method */ @@ -1421,118 +1411,6 @@ static int mvneta_init(struct udevice *dev)/* U-Boot only functions follow here */ -/* SMI / MDIO functions */ - -static int smi_wait_ready (struct mvneta_port *pp) -{ -u32 timeout =MVNETA_SMI_TIMEOUT ; -u32 smi_reg; - -/* wait till the SMI is not busy */ -do { -/* read smi register */ - smi_reg =mvreg_read (pp,MVNETA_SMI ); -if (timeout-- ==0 ) { -printf ("Error: SMI busy timeout\n" ); -return -EFAULT ; - } - }while (smi_reg &MVNETA_SMI_BUSY ); - -return 0 ; -} - -/* -* mvneta_mdio_read - miiphy_read callback function. -* -* Returns 16bit phy register value, or 0xffff on error -*/ -static int mvneta_mdio_read (struct mii_dev *bus,int addr,int devad,int reg) -{ -struct mvneta_port *pp = bus->priv; -u32 smi_reg; -u32 timeout; - -/* check parameters */ -if (addr >MVNETA_PHY_ADDR_MASK ) { -printf ("Error: Invalid PHY address %d\n" , addr); -return -EFAULT ; - } - -if (reg >MVNETA_PHY_REG_MASK ) { -printf ("Err: Invalid register offset %d\n" , reg); -return -EFAULT ; - } - -/* wait till the SMI is not busy */ -if (smi_wait_ready (pp) <0 ) -return -EFAULT ; - -/* fill the phy address and regiser offset and read opcode */ - smi_reg = (addr <<MVNETA_SMI_DEV_ADDR_OFFS ) - | (reg <<MVNETA_SMI_REG_ADDR_OFFS ) - |MVNETA_SMI_OPCODE_READ ; - -/* write the smi register */ -mvreg_write (pp,MVNETA_SMI , smi_reg); - -/* wait till read value is ready */ - timeout =MVNETA_SMI_TIMEOUT ; - -do { -/* read smi register */ - smi_reg =mvreg_read (pp,MVNETA_SMI ); -if (timeout-- ==0 ) { -printf ("Err: SMI read ready timeout\n" ); -return -EFAULT ; - } - }while (!(smi_reg &MVNETA_SMI_READ_VALID )); - -/* Wait for the data to update in the SMI register */ -for (timeout =0 ; timeout <MVNETA_SMI_TIMEOUT ; timeout++) - ; - -return mvreg_read (pp,MVNETA_SMI ) &MVNETA_SMI_DATA_MASK ; -} - -/* -* mvneta_mdio_write - miiphy_write callback function. -* -* Returns 0 if write succeed, -EINVAL on bad parameters -* -ETIME on timeout -*/ -static int mvneta_mdio_write (struct mii_dev *bus,int addr,int devad,int reg, -u16 value) -{ -struct mvneta_port *pp = bus->priv; -u32 smi_reg; - -/* check parameters */ -if (addr >MVNETA_PHY_ADDR_MASK ) { -printf ("Error: Invalid PHY address %d\n" , addr); -return -EFAULT ; - } - -if (reg >MVNETA_PHY_REG_MASK ) { -printf ("Err: Invalid register offset %d\n" , reg); -return -EFAULT ; - } - -/* wait till the SMI is not busy */ -if (smi_wait_ready (pp) <0 ) -return -EFAULT ; - -/* fill the phy addr and reg offset and write opcode and data */ - smi_reg = value <<MVNETA_SMI_DATA_OFFS ; - smi_reg |= (addr <<MVNETA_SMI_DEV_ADDR_OFFS ) - | (reg <<MVNETA_SMI_REG_ADDR_OFFS ); - smi_reg &= ~MVNETA_SMI_OPCODE_READ ; - -/* write the smi register */ -mvreg_write (pp,MVNETA_SMI , smi_reg); - -return 0 ; -} -static int mvneta_start (struct udevice *dev) {struct mvneta_port *pp =dev_get_priv (dev);@@ -1690,10 +1568,9 @@ static int mvneta_probe(struct udevice *dev)#endif void *blob = (void *)gd->fdt_blob;int node =dev_of_offset (dev); -struct mii_dev *bus;void *bd_space; -int ret;int fl_node; +int ret;/* * Allocate buffer area for descs and rx_buffers. This is only @@ -1739,22 +1616,6 @@ static int mvneta_probe(struct udevice *dev) pp->fixed_link = true; } - bus =mdio_alloc (); -if (!bus) { -printf ("Failed to allocate MDIO bus\n" ); -return -ENOMEM ; - } - - bus->read = mvneta_mdio_read; - bus->write = mvneta_mdio_write; -snprintf (bus->name,sizeof (bus->name), dev->name); - bus->priv = (void *)pp; - pp->bus = bus; - - ret =mdio_register (bus); -if (ret) -return ret; -#if CONFIG_IS_ENABLED (DM_GPIO ) ret =dev_read_phandle_with_args (dev,"sfp" ,NULL ,0 ,0 , &sfp_args);if (!ret &&ofnode_is_enabled (sfp_args.node))
drivers/net/mvneta.c static int mvneta_probe(struct udevice *dev) · line 1641
Quoted 8 lines
drivers/net/mvneta.c +1
-1@@ -1774,7 +1635,7 @@ static int mvneta_probe(struct udevice *dev)dm_gpio_set_value (&pp->sfp_tx_disable_gpio,0 );#endif -return board_network_enable (bus); +return 0 ; }static void mvneta_stop (struct udevice *dev)
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 9/19 net: mvneta: Fix unused variable warning if DM_GPIO is disabled
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
The ret variable in mvneta_probe() is unused if DM_GPIO is disabled.
Since the variable is used only once after assigning value, we can inline the usage and drop the variable.
--- drivers/net/mvneta.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/mvneta.c +2 -3
@@ -1570,7 +1570,6 @@ static int mvneta_probe(struct udevice *dev)int node =dev_of_offset (dev);void *bd_space;int fl_node; -int ret;/* * Allocate buffer area for descs and rx_buffers. This is only
@@ -1617,8 +1616,8 @@ static int mvneta_probe(struct udevice *dev) }#if CONFIG_IS_ENABLED (DM_GPIO ) - ret =dev_read_phandle_with_args (dev,"sfp" ,NULL ,0 ,0 , &sfp_args); -if (!ret &&ofnode_is_enabled (sfp_args.node)) +if (!dev_read_phandle_with_args (dev,"sfp" ,NULL ,0 ,0 , &sfp_args) && +ofnode_is_enabled (sfp_args.node))gpio_request_by_name_nodev (sfp_args.node,"tx-disable-gpio" ,0 , &pp->sfp_tx_disable_gpio,GPIOD_IS_OUT );
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 09/19] net: mvneta: Fix unused variable warning if DM_GPIO is disabled
Quoted 37 lines · Marek Behún
From: Marek Behún <[email protected]>
The
retvariable inmvneta_probe()is unused ifDM_GPIOis disabled.Since the variable is used only once after assigning value, we can inline the usage and drop the variable.
Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/net/mvneta.c +2
-4@@ -1570,7 +1570,6 @@ static int mvneta_probe(struct udevice *dev)int node =dev_of_offset (dev);void *bd_space;int fl_node; -int ret;/* * Allocate buffer area for descs and rx_buffers. This is only @@ -1617,8 +1616,8 @@ static int mvneta_probe(struct udevice *dev) }#if CONFIG_IS_ENABLED (DM_GPIO ) - ret =dev_read_phandle_with_args (dev,"sfp" ,NULL ,0 ,0 , &sfp_args); -if (!ret &&ofnode_is_enabled (sfp_args.node)) +if (!dev_read_phandle_with_args (dev,"sfp" ,NULL ,0 ,0 , &sfp_args) && +ofnode_is_enabled (sfp_args.node))gpio_request_by_name_nodev (sfp_args.node,"tx-disable-gpio" ,0 , &pp->sfp_tx_disable_gpio,GPIOD_IS_OUT ); --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 09/19] net: mvneta: Fix unused variable warning if DM_GPIO is disabled
In reply to Marek BehúnQuoted 8 lines · Marek Behún
From: Marek Behún <[email protected]>
The
retvariable inmvneta_probe()is unused ifDM_GPIOis disabled.Since the variable is used only once after assigning value, we can inline the usage and drop the variable.
Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 17 lines
--- drivers/net/mvneta.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/net/mvneta.c +0
-1@@ -1570,7 +1570,6 @@ static int mvneta_probe(struct udevice *dev)int node =dev_of_offset (dev);void *bd_space;int fl_node; -int ret;/* * Allocate buffer area for descs and rx_buffers. This is only
drivers/net/mvneta.c static int mvneta_probe(struct udevice *dev) · line 1623
Quoted 10 lines
drivers/net/mvneta.c +2
-2@@ -1617,8 +1616,8 @@ static int mvneta_probe(struct udevice *dev) }#if CONFIG_IS_ENABLED (DM_GPIO ) - ret =dev_read_phandle_with_args (dev,"sfp" ,NULL ,0 ,0 , &sfp_args); -if (!ret &&ofnode_is_enabled (sfp_args.node)) +if (!dev_read_phandle_with_args (dev,"sfp" ,NULL ,0 ,0 , &sfp_args) && +ofnode_is_enabled (sfp_args.node))gpio_request_by_name_nodev (sfp_args.node,"tx-disable-gpio" ,0 , &pp->sfp_tx_disable_gpio,GPIOD_IS_OUT );
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 10/19 net: mvneta: Drop one indentation level in mvneta_adjust_link()
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Drop one indentation level in the mvneta_adjust_link() function.
--- drivers/net/mvneta.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-)
drivers/net/mvneta.c +18 -20
@@ -1161,31 +1161,29 @@ static void mvneta_adjust_link(struct udevice *dev)return ; } -if (phydev->link) { -if ((pp->speed != phydev->speed) || - (pp->duplex != phydev->duplex)) { -u32 val; +if (phydev->link && + (pp->speed != phydev->speed || pp->duplex != phydev->duplex)) { +u32 val; - val =mvreg_read (pp,MVNETA_GMAC_AUTONEG_CONFIG ); - val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED | -MVNETA_GMAC_CONFIG_GMII_SPEED | -MVNETA_GMAC_CONFIG_FULL_DUPLEX | -MVNETA_GMAC_AN_SPEED_EN | -MVNETA_GMAC_AN_DUPLEX_EN ); + val =mvreg_read (pp,MVNETA_GMAC_AUTONEG_CONFIG ); + val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED | +MVNETA_GMAC_CONFIG_GMII_SPEED | +MVNETA_GMAC_CONFIG_FULL_DUPLEX | +MVNETA_GMAC_AN_SPEED_EN | +MVNETA_GMAC_AN_DUPLEX_EN ); -if (phydev->duplex) - val |=MVNETA_GMAC_CONFIG_FULL_DUPLEX ; +if (phydev->duplex) + val |=MVNETA_GMAC_CONFIG_FULL_DUPLEX ; -if (phydev->speed ==SPEED_1000 ) - val |=MVNETA_GMAC_CONFIG_GMII_SPEED ; -else if (pp->speed ==SPEED_100 ) - val |=MVNETA_GMAC_CONFIG_MII_SPEED ; +if (phydev->speed ==SPEED_1000 ) + val |=MVNETA_GMAC_CONFIG_GMII_SPEED ; +else if (pp->speed ==SPEED_100 ) + val |=MVNETA_GMAC_CONFIG_MII_SPEED ; -mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); +mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); - pp->duplex = phydev->duplex; - pp->speed = phydev->speed; - } + pp->duplex = phydev->duplex; + pp->speed = phydev->speed; }if (phydev->link != pp->link) {
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 10/19] net: mvneta: Drop one indentation level in mvneta_adjust_link()
Quoted 65 lines · Marek Behún
From: Marek Behún <[email protected]>
Drop one indentation level in the
mvneta_adjust_link()function.Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-)drivers/net/mvneta.c +18
-21@@ -1161,31 +1161,29 @@ static void mvneta_adjust_link(struct udevice *dev)return ; } -if (phydev->link) { -if ((pp->speed != phydev->speed) || - (pp->duplex != phydev->duplex)) { -u32 val; +if (phydev->link && + (pp->speed != phydev->speed || pp->duplex != phydev->duplex)) { +u32 val; - val =mvreg_read (pp,MVNETA_GMAC_AUTONEG_CONFIG ); - val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED | -MVNETA_GMAC_CONFIG_GMII_SPEED | -MVNETA_GMAC_CONFIG_FULL_DUPLEX | -MVNETA_GMAC_AN_SPEED_EN | -MVNETA_GMAC_AN_DUPLEX_EN ); + val =mvreg_read (pp,MVNETA_GMAC_AUTONEG_CONFIG ); + val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED | +MVNETA_GMAC_CONFIG_GMII_SPEED | +MVNETA_GMAC_CONFIG_FULL_DUPLEX | +MVNETA_GMAC_AN_SPEED_EN | +MVNETA_GMAC_AN_DUPLEX_EN ); -if (phydev->duplex) - val |=MVNETA_GMAC_CONFIG_FULL_DUPLEX ; +if (phydev->duplex) + val |=MVNETA_GMAC_CONFIG_FULL_DUPLEX ; -if (phydev->speed ==SPEED_1000 ) - val |=MVNETA_GMAC_CONFIG_GMII_SPEED ; -else if (pp->speed ==SPEED_100 ) - val |=MVNETA_GMAC_CONFIG_MII_SPEED ; +if (phydev->speed ==SPEED_1000 ) + val |=MVNETA_GMAC_CONFIG_GMII_SPEED ; +else if (pp->speed ==SPEED_100 ) + val |=MVNETA_GMAC_CONFIG_MII_SPEED ; -mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); +mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); - pp->duplex = phydev->duplex; - pp->speed = phydev->speed; - } + pp->duplex = phydev->duplex; + pp->speed = phydev->speed; }if (phydev->link != pp->link) { --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 10/19] net: mvneta: Drop one indentation level in mvneta_adjust_link()
In reply to Marek BehúnQuoted 5 lines · Marek Behún
From: Marek Behún <[email protected]>
Drop one indentation level in the
mvneta_adjust_link()function.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 48 lines
--- drivers/net/mvneta.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-)drivers/net/mvneta.c +15
-17@@ -1161,31 +1161,29 @@ static void mvneta_adjust_link(struct udevice *dev)return ; } -if (phydev->link) { -if ((pp->speed != phydev->speed) || - (pp->duplex != phydev->duplex)) { -u32 val; +if (phydev->link && + (pp->speed != phydev->speed || pp->duplex != phydev->duplex)) { +u32 val; - val =mvreg_read (pp,MVNETA_GMAC_AUTONEG_CONFIG ); - val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED | -MVNETA_GMAC_CONFIG_GMII_SPEED | -MVNETA_GMAC_CONFIG_FULL_DUPLEX | -MVNETA_GMAC_AN_SPEED_EN | -MVNETA_GMAC_AN_DUPLEX_EN ); + val =mvreg_read (pp,MVNETA_GMAC_AUTONEG_CONFIG ); + val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED | +MVNETA_GMAC_CONFIG_GMII_SPEED | +MVNETA_GMAC_CONFIG_FULL_DUPLEX | +MVNETA_GMAC_AN_SPEED_EN | +MVNETA_GMAC_AN_DUPLEX_EN ); -if (phydev->duplex) - val |=MVNETA_GMAC_CONFIG_FULL_DUPLEX ; +if (phydev->duplex) + val |=MVNETA_GMAC_CONFIG_FULL_DUPLEX ; -if (phydev->speed ==SPEED_1000 ) - val |=MVNETA_GMAC_CONFIG_GMII_SPEED ; -else if (pp->speed ==SPEED_100 ) - val |=MVNETA_GMAC_CONFIG_MII_SPEED ; +if (phydev->speed ==SPEED_1000 ) + val |=MVNETA_GMAC_CONFIG_GMII_SPEED ; +else if (pp->speed ==SPEED_100 ) + val |=MVNETA_GMAC_CONFIG_MII_SPEED ; -mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val);
drivers/net/mvneta.c static void mvneta_adjust_link(struct udevice *dev) · line 1189
Quoted 10 lines
drivers/net/mvneta.c +3
-3+mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); - pp->duplex = phydev->duplex; - pp->speed = phydev->speed; - } + pp->duplex = phydev->duplex; + pp->speed = phydev->speed; }if (phydev->link != pp->link) {
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 11/19 net: mvneta: Use bool instead of int for boolean variable
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Use the bool type instead of int for status_change variable.
--- drivers/net/mvneta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mvneta.c +2 -2
@@ -1154,7 +1154,7 @@ static void mvneta_adjust_link(struct udevice *dev) {struct mvneta_port *pp =dev_get_priv (dev);struct phy_device *phydev = pp->phydev; -int status_change =0 ; +bool status_change = false;if (pp->fixed_link) {debug ("Using fixed link, skip link adjust\n" );
@@ -1193,7 +1193,7 @@ static void mvneta_adjust_link(struct udevice *dev) } pp->link = phydev->link; - status_change =1 ; + status_change = true; }if (status_change) {
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 11/19] net: mvneta: Use bool instead of int for boolean variable
Quoted 33 lines · Marek Behún
From: Marek Behún <[email protected]>
Use the bool type instead of int for
status_changevariable.Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/mvneta.c +2
-3@@ -1154,7 +1154,7 @@ static void mvneta_adjust_link(struct udevice *dev) {struct mvneta_port *pp =dev_get_priv (dev);struct phy_device *phydev = pp->phydev; -int status_change =0 ; +bool status_change = false;if (pp->fixed_link) {debug ("Using fixed link, skip link adjust\n" );@@ -1193,7 +1193,7 @@ static void mvneta_adjust_link(struct udevice *dev) } pp->link = phydev->link; - status_change =1 ; + status_change = true; }if (status_change) { --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 11/19] net: mvneta: Use bool instead of int for boolean variable
In reply to Marek BehúnQuoted 5 lines · Marek Behún
From: Marek Behún <[email protected]>
Use the bool type instead of int for
status_changevariable.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 18 lines
--- drivers/net/mvneta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/mvneta.c +1
-1@@ -1154,7 +1154,7 @@ static void mvneta_adjust_link(struct udevice *dev) {struct mvneta_port *pp =dev_get_priv (dev);struct phy_device *phydev = pp->phydev; -int status_change =0 ; +bool status_change = false;if (pp->fixed_link) {debug ("Using fixed link, skip link adjust\n" );
drivers/net/mvneta.c static void mvneta_adjust_link(struct udevice *dev) · line 1199
Quoted 8 lines
drivers/net/mvneta.c +1
-1@@ -1193,7 +1193,7 @@ static void mvneta_adjust_link(struct udevice *dev) } pp->link = phydev->link; - status_change =1 ; + status_change = true; }if (status_change) {
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 12/19 net: mvneta: Drop unnecessary space
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Drop unnecessary space in mvneta_adjust_link().
--- drivers/net/mvneta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mvneta.c +1 -1
@@ -1183,7 +1183,7 @@ static void mvneta_adjust_link(struct udevice *dev)mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); pp->duplex = phydev->duplex; - pp->speed = phydev->speed; + pp->speed = phydev->speed; }if (phydev->link != pp->link) {
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 12/19] net: mvneta: Drop unnecessary space
Quoted 24 lines · Marek Behún
From: Marek Behún <[email protected]>
Drop unnecessary space in
mvneta_adjust_link().Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/mvneta.c +1
-2@@ -1183,7 +1183,7 @@ static void mvneta_adjust_link(struct udevice *dev)mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); pp->duplex = phydev->duplex; - pp->speed = phydev->speed; + pp->speed = phydev->speed; }if (phydev->link != pp->link) { --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 12/19] net: mvneta: Drop unnecessary space
In reply to Marek BehúnQuoted 5 lines · Marek Behún
From: Marek Behún <[email protected]>
Drop unnecessary space in
mvneta_adjust_link().Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 9 lines
--- drivers/net/mvneta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/mvneta.c +0
-0
drivers/net/mvneta.c static void mvneta_adjust_link(struct udevice *dev) · line 1189
Quoted 8 lines
drivers/net/mvneta.c +1
-1@@ -1183,7 +1183,7 @@ static void mvneta_adjust_link(struct udevice *dev)mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); pp->duplex = phydev->duplex; - pp->speed = phydev->speed; + pp->speed = phydev->speed; }if (phydev->link != pp->link) {
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 13/19 net: mvneta: Don't check for CONFIG_PHYLIB
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Drop checking for CONFIG_PHYLIB in mvneta, this is already done in Kconfig.
--- drivers/net/mvneta.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/mvneta.c +0 -4
@@ -40,10 +40,6 @@DECLARE_GLOBAL_DATA_PTR ; -#if !defined(CONFIG_PHYLIB ) -# error Marvell mvneta requires PHYLIB -#endif -#define CONFIG_NR_CPUS 1#define ETH_HLEN 14/* Total octets in header */
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 13/19] net: mvneta: Don't check for CONFIG_PHYLIB
Quoted 27 lines · Marek Behún
From: Marek Behún <[email protected]>
Drop checking for
CONFIG_PHYLIBin mvneta, this is already done inKconfig.Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 4 ---- 1 file changed, 4 deletions(-)drivers/net/mvneta.c +0
-5@@ -40,10 +40,6 @@DECLARE_GLOBAL_DATA_PTR ; -#if !defined(CONFIG_PHYLIB ) -# error Marvell mvneta requires PHYLIB -#endif -#define CONFIG_NR_CPUS 1#define ETH_HLEN 14/* Total octets in header */ --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 13/19] net: mvneta: Don't check for CONFIG_PHYLIB
In reply to Marek BehúnQuoted 6 lines · Marek Behún
From: Marek Behún <[email protected]>
Drop checking for
CONFIG_PHYLIBin mvneta, this is already done inKconfig.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 9 lines
--- drivers/net/mvneta.c | 4 ---- 1 file changed, 4 deletions(-)drivers/net/mvneta.c +0
-0
drivers/net/mvneta.c line 45
Quoted 10 lines
drivers/net/mvneta.c +0
-4@@ -40,10 +40,6 @@DECLARE_GLOBAL_DATA_PTR ; -#if !defined(CONFIG_PHYLIB ) -# error Marvell mvneta requires PHYLIB -#endif -#define CONFIG_NR_CPUS 1#define ETH_HLEN 14/* Total octets in header */
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 14/19 net: mvneta: Rename CONFIG_NR_CPUS to MVNETA_NR_CPUS
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
The CONFIG_* macros are reserved for Kconfig. This was probably done when this driver was being imported from Linux. Rename the macro.
--- drivers/net/mvneta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mvneta.c +2 -2
@@ -40,7 +40,7 @@DECLARE_GLOBAL_DATA_PTR ; -#define CONFIG_NR_CPUS 1 +#define MVNETA_NR_CPUS 1#define ETH_HLEN 14/* Total octets in header */ /* 2(HW hdr) 14(MAC hdr) 4(CRC) 32(extra for cache prefetch) */
@@ -770,7 +770,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)/* Set CPU queue access map - all CPUs have access to all RX * queues and to all TX queues */ -for (cpu =0 ; cpu <CONFIG_NR_CPUS ; cpu++) +for (cpu =0 ; cpu <MVNETA_NR_CPUS ; cpu++)mvreg_write (pp,MVNETA_CPU_MAP (cpu), (MVNETA_CPU_RXQ_ACCESS_ALL_MASK |MVNETA_CPU_TXQ_ACCESS_ALL_MASK ));
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 14/19] net: mvneta: Rename CONFIG_NR_CPUS to MVNETA_NR_CPUS
Quoted 34 lines · Marek Behún
From: Marek Behún <[email protected]>
The CONFIG_* macros are reserved for
Kconfig. This was probably done when this driver was being imported from Linux. Rename the macro.Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/mvneta.c +2
-3@@ -40,7 +40,7 @@DECLARE_GLOBAL_DATA_PTR ; -#define CONFIG_NR_CPUS 1 +#define MVNETA_NR_CPUS 1#define ETH_HLEN 14/* Total octets in header */ /* 2(HW hdr) 14(MAC hdr) 4(CRC) 32(extra for cache prefetch) */ @@ -770,7 +770,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)/* Set CPU queue access map - all CPUs have access to all RX * queues and to all TX queues */ -for (cpu =0 ; cpu <CONFIG_NR_CPUS ; cpu++) +for (cpu =0 ; cpu <MVNETA_NR_CPUS ; cpu++)mvreg_write (pp,MVNETA_CPU_MAP (cpu), (MVNETA_CPU_RXQ_ACCESS_ALL_MASK |MVNETA_CPU_TXQ_ACCESS_ALL_MASK )); --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 14/19] net: mvneta: Rename CONFIG_NR_CPUS to MVNETA_NR_CPUS
In reply to Marek BehúnQuoted 6 lines · Marek Behún
From: Marek Behún <[email protected]>
The CONFIG_* macros are reserved for
Kconfig. This was probably done when this driver was being imported from Linux. Rename the macro.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 18 lines
--- drivers/net/mvneta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/mvneta.c +1
-1@@ -40,7 +40,7 @@DECLARE_GLOBAL_DATA_PTR ; -#define CONFIG_NR_CPUS 1 +#define MVNETA_NR_CPUS 1#define ETH_HLEN 14/* Total octets in header */ /* 2(HW hdr) 14(MAC hdr) 4(CRC) 32(extra for cache prefetch) */
drivers/net/mvneta.c static void mvneta_defaults_set(struct mvneta_port *pp) · line 776
Quoted 8 lines
drivers/net/mvneta.c +1
-1@@ -770,7 +770,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)/* Set CPU queue access map - all CPUs have access to all RX * queues and to all TX queues */ -for (cpu =0 ; cpu <CONFIG_NR_CPUS ; cpu++) +for (cpu =0 ; cpu <MVNETA_NR_CPUS ; cpu++)mvreg_write (pp,MVNETA_CPU_MAP (cpu), (MVNETA_CPU_RXQ_ACCESS_ALL_MASK |MVNETA_CPU_TXQ_ACCESS_ALL_MASK ));
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 15/19 net: mvneta: Convert to use PHY_FIXED for fixed-link
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Stop parsing fixed-link in the MAC driver. Instead support only PHY mode and let the fixed PHY driver handle the fixed-link case.
Enable CONFIG_PHY_FIXED for mvneta boards that need it: Turris Omnia and ESPRESSObin.
--- configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/turris_omnia_defconfig | 1 + drivers/net/mvneta.c | 98 ++++++++------------- 3 files changed, 39 insertions(+), 61 deletions(-)
configs/mvebu_espressobin-88f3720_defconfig +1 -0
@@ -74,6 +74,7 @@ CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_MARVELL=y +CONFIG_PHY_FIXED=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MVNETA=y
configs/turris_omnia_defconfig +1 -0
@@ -79,6 +79,7 @@ CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_MARVELL=y +CONFIG_PHY_FIXED=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=y
drivers/net/mvneta.c +37 -61
135 lines not on this page · raw message
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 15/19] net: mvneta: Convert to use PHY_FIXED for fixed-link
Quoted 185 lines · Marek Behún
From: Marek Behún <[email protected]>
Stop parsing fixed-link in the MAC driver. Instead support only PHY mode and let the fixed PHY driver handle the fixed-link case.
Enable
CONFIG_PHY_FIXEDfor mvneta boards that need it: Turris Omnia and ESPRESSObin.Signed-off-by Marek Behún <[email protected]>--- configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/turris_omnia_defconfig | 1 + drivers/net/mvneta.c | 98 ++++++++------------- 3 files changed, 39 insertions(+), 61 deletions(-)configs/mvebu_espressobin-88f3720_defconfig +1
-0@@ -74,6 +74,7 @@ CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_MARVELL=y +CONFIG_PHY_FIXED=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MVNETA=yconfigs/turris_omnia_defconfig +1
-0@@ -79,6 +79,7 @@ CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_MARVELL=y +CONFIG_PHY_FIXED=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=ydrivers/net/mvneta.c +37
-62@@ -1152,11 +1152,6 @@ static void mvneta_adjust_link(struct udevice *dev)struct phy_device *phydev = pp->phydev;bool status_change = false; -if (pp->fixed_link) { -debug ("Using fixed link, skip link adjust\n" ); -return ; - } -if (phydev->link && (pp->speed != phydev->speed || pp->duplex != phydev->duplex)) {u32 val;@@ -1168,6 +1163,21 @@ static void mvneta_adjust_link(struct udevice *dev)MVNETA_GMAC_AN_SPEED_EN | MVNETA_GMAC_AN_DUPLEX_EN); +/* FIXME: For fixed-link case, these were the initial settings +* used before the code was converted to use PHY_FIXED. Some of +* these may look nonsensical (for example BYPASS_AN makes sense +* for 1000base-x and 2500base-x modes, AFAIK), and in fact this +* may be changed in the future (when support for inband AN will +* be added). Also, why is ADVERT_FC enabled if we don't enable +* inband AN at all? +*/ +if (pp->fixed_link) + val =MVNETA_GMAC_FORCE_LINK_UP | +MVNETA_GMAC_IB_BYPASS_AN_EN | +MVNETA_GMAC_SET_FC_EN | +MVNETA_GMAC_ADVERT_FC_EN | +MVNETA_GMAC_SAMPLE_TX_CFG_EN ; +if (phydev->duplex) val |=MVNETA_GMAC_CONFIG_FULL_DUPLEX ;@@ -1413,56 +1423,34 @@ static int mvneta_start(struct udevice *dev)mvneta_port_power_up (pp, pp->phy_interface);if (!pp->init || pp->link ==0 ) { -if (pp->fixed_link) { -u32 val; - - pp->init =1 ; - pp->link =1 ; -mvneta_init (dev); - - val =MVNETA_GMAC_FORCE_LINK_UP | -MVNETA_GMAC_IB_BYPASS_AN_EN | -MVNETA_GMAC_SET_FC_EN | -MVNETA_GMAC_ADVERT_FC_EN | -MVNETA_GMAC_SAMPLE_TX_CFG_EN ; - -if (pp->duplex) - val |=MVNETA_GMAC_CONFIG_FULL_DUPLEX ; - -if (pp->speed ==SPEED_1000 ) - val |=MVNETA_GMAC_CONFIG_GMII_SPEED ; -else if (pp->speed ==SPEED_100 ) - val |=MVNETA_GMAC_CONFIG_MII_SPEED ; + phydev =dm_eth_phy_connect (dev); +if (!phydev) { +printf ("dm_eth_phy_connect failed\n" ); +return -ENODEV ; + } -mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); - }else { - phydev =dm_eth_phy_connect (dev); -if (!phydev) { -printf ("dm_eth_phy_connect failed\n" ); -return -ENODEV ; - } + pp->fixed_link = phydev->phy_id ==PHY_FIXED_ID ; -/* Set PHY address in case we will enable HW polling */ +/* Set PHY address in case we will enable HW polling */ +if (!pp->fixed_link)mvreg_write (pp,MVNETA_PHY_ADDR , phydev->addr); - pp->phydev = phydev; -phy_config (phydev); -phy_startup (phydev); -if (!phydev->link) { -printf ("%s: No link.\n" , phydev->dev->name); -return -1 ; - } - -/* Full init on first call */ -mvneta_init (dev); - pp->init =1 ; -return 0 ; + pp->phydev = phydev; +phy_config (phydev); +phy_startup (phydev); +if (!phydev->link) { +printf ("%s: No link.\n" , phydev->dev->name); +return -1 ; } - } -/* Upon all following calls, this is enough */ -mvneta_port_up (pp); -mvneta_port_enable (pp); +/* Full init on first call */ +mvneta_init (dev); + pp->init =1 ; + }else { +/* Upon all following calls, this is enough */ +mvneta_port_up (pp); +mvneta_port_enable (pp); + }return 0 ; }@@ -1560,10 +1548,7 @@ static int mvneta_probe(struct udevice *dev)#if CONFIG_IS_ENABLED (DM_GPIO )struct ofnode_phandle_args sfp_args;#endif -void *blob = (void *)gd->fdt_blob; -int node =dev_of_offset (dev);void *bd_space; -int fl_node;/* * Allocate buffer area for descs and rx_buffers. This is only @@ -1600,15 +1585,6 @@ static int mvneta_probe(struct udevice *dev)else mvneta_conf_mbus_windows (pp); -/* fetch 'fixed-link' property from 'neta' node */ - fl_node =fdt_subnode_offset (blob, node,"fixed-link" ); -if (fl_node != -FDT_ERR_NOTFOUND ) { -/* set phy_addr to invalid value for fixed link */ - pp->duplex =fdtdec_get_bool (blob, fl_node,"full-duplex" ); - pp->speed =fdtdec_get_int (blob, fl_node,"speed" ,0 ); - pp->fixed_link = true; - } -#if CONFIG_IS_ENABLED (DM_GPIO )if (!dev_read_phandle_with_args (dev,"sfp" ,NULL ,0 ,0 , &sfp_args) &&ofnode_is_enabled (sfp_args.node)) --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 15/19] net: mvneta: Convert to use PHY_FIXED for fixed-link
In reply to Marek BehúnQuoted 9 lines · Marek Behún
From: Marek Behún <[email protected]>
Stop parsing fixed-link in the MAC driver. Instead support only PHY mode and let the fixed PHY driver handle the fixed-link case.
Enable
CONFIG_PHY_FIXEDfor mvneta boards that need it: Turris Omnia and ESPRESSObin.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 164 lines
--- configs/mvebu_espressobin-88f3720_defconfig | 1 + configs/turris_omnia_defconfig | 1 + drivers/net/mvneta.c | 98 ++++++++------------- 3 files changed, 39 insertions(+), 61 deletions(-)configs/mvebu_espressobin-88f3720_defconfig +1
-0@@ -74,6 +74,7 @@ CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_MARVELL=y +CONFIG_PHY_FIXED=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_MVNETA=yconfigs/turris_omnia_defconfig +1
-0@@ -79,6 +79,7 @@ CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_MTD=y CONFIG_PHY_MARVELL=y +CONFIG_PHY_FIXED=y CONFIG_PHY_GIGE=y CONFIG_MVNETA=y CONFIG_MII=ydrivers/net/mvneta.c +37
-54@@ -1152,11 +1152,6 @@ static void mvneta_adjust_link(struct udevice *dev)struct phy_device *phydev = pp->phydev;bool status_change = false; -if (pp->fixed_link) { -debug ("Using fixed link, skip link adjust\n" ); -return ; - } -if (phydev->link && (pp->speed != phydev->speed || pp->duplex != phydev->duplex)) {u32 val;@@ -1168,6 +1163,21 @@ static void mvneta_adjust_link(struct udevice *dev)MVNETA_GMAC_AN_SPEED_EN | MVNETA_GMAC_AN_DUPLEX_EN); +/* FIXME: For fixed-link case, these were the initial settings +* used before the code was converted to use PHY_FIXED. Some of +* these may look nonsensical (for example BYPASS_AN makes sense +* for 1000base-x and 2500base-x modes, AFAIK), and in fact this +* may be changed in the future (when support for inband AN will +* be added). Also, why is ADVERT_FC enabled if we don't enable +* inband AN at all? +*/ +if (pp->fixed_link) + val =MVNETA_GMAC_FORCE_LINK_UP | +MVNETA_GMAC_IB_BYPASS_AN_EN | +MVNETA_GMAC_SET_FC_EN | +MVNETA_GMAC_ADVERT_FC_EN | +MVNETA_GMAC_SAMPLE_TX_CFG_EN ; +if (phydev->duplex) val |=MVNETA_GMAC_CONFIG_FULL_DUPLEX ;@@ -1413,56 +1423,34 @@ static int mvneta_start(struct udevice *dev)mvneta_port_power_up (pp, pp->phy_interface);if (!pp->init || pp->link ==0 ) { -if (pp->fixed_link) { -u32 val; - - pp->init =1 ; - pp->link =1 ; -mvneta_init (dev); - - val =MVNETA_GMAC_FORCE_LINK_UP | -MVNETA_GMAC_IB_BYPASS_AN_EN | -MVNETA_GMAC_SET_FC_EN | -MVNETA_GMAC_ADVERT_FC_EN | -MVNETA_GMAC_SAMPLE_TX_CFG_EN ; - -if (pp->duplex) - val |=MVNETA_GMAC_CONFIG_FULL_DUPLEX ; - -if (pp->speed ==SPEED_1000 ) - val |=MVNETA_GMAC_CONFIG_GMII_SPEED ; -else if (pp->speed ==SPEED_100 ) - val |=MVNETA_GMAC_CONFIG_MII_SPEED ; + phydev =dm_eth_phy_connect (dev); +if (!phydev) { +printf ("dm_eth_phy_connect failed\n" ); +return -ENODEV ; + } -mvreg_write (pp,MVNETA_GMAC_AUTONEG_CONFIG , val); - }else { - phydev =dm_eth_phy_connect (dev); -if (!phydev) { -printf ("dm_eth_phy_connect failed\n" ); -return -ENODEV ; - } + pp->fixed_link = phydev->phy_id ==PHY_FIXED_ID ; -/* Set PHY address in case we will enable HW polling */ +/* Set PHY address in case we will enable HW polling */ +if (!pp->fixed_link)mvreg_write (pp,MVNETA_PHY_ADDR , phydev->addr); - pp->phydev = phydev; -phy_config (phydev); -phy_startup (phydev); -if (!phydev->link) { -printf ("%s: No link.\n" , phydev->dev->name); -return -1 ; - } - -/* Full init on first call */ -mvneta_init (dev); - pp->init =1 ; -return 0 ; + pp->phydev = phydev; +phy_config (phydev); +phy_startup (phydev); +if (!phydev->link) { +printf ("%s: No link.\n" , phydev->dev->name); +return -1 ; } - } -/* Upon all following calls, this is enough */ -mvneta_port_up (pp); -mvneta_port_enable (pp); +/* Full init on first call */ +mvneta_init (dev); + pp->init =1 ; + }else { +/* Upon all following calls, this is enough */ +mvneta_port_up (pp); +mvneta_port_enable (pp); + }return 0 ; }@@ -1560,10 +1548,7 @@ static int mvneta_probe(struct udevice *dev)#if CONFIG_IS_ENABLED (DM_GPIO )struct ofnode_phandle_args sfp_args;#endif -void *blob = (void *)gd->fdt_blob; -int node =dev_of_offset (dev);void *bd_space; -int fl_node;/* * Allocate buffer area for descs and rx_buffers. This is only @@ -1600,15 +1585,6 @@ static int mvneta_probe(struct udevice *dev)else mvneta_conf_mbus_windows (pp); -/* fetch 'fixed-link' property from 'neta' node */ - fl_node =fdt_subnode_offset (blob, node,"fixed-link" );
drivers/net/mvneta.c static int mvneta_probe(struct udevice *dev) · line 1590
Quoted 10 lines
drivers/net/mvneta.c +0
-7-if (fl_node != -FDT_ERR_NOTFOUND ) { -/* set phy_addr to invalid value for fixed link */ - pp->duplex =fdtdec_get_bool (blob, fl_node,"full-duplex" ); - pp->speed =fdtdec_get_int (blob, fl_node,"speed" ,0 ); - pp->fixed_link = true; - } -#if CONFIG_IS_ENABLED (DM_GPIO )if (!dev_read_phandle_with_args (dev,"sfp" ,NULL ,0 ,0 , &sfp_args) &&ofnode_is_enabled (sfp_args.node))
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 16/19 net: mvneta: Write PHY address just before enabling HW polling
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Write PHY address just before enabling HW polling of the PHY.
--- drivers/net/mvneta.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/mvneta.c +2 -4
@@ -814,6 +814,8 @@ static void mvneta_defaults_set(struct mvneta_port *pp)/* Enable PHY polling in hardware if not in fixed-link mode */ if (!pp->fixed_link) { +mvreg_write (pp,MVNETA_PHY_ADDR , pp->phydev->addr); + val =mvreg_read (pp,MVNETA_UNIT_CONTROL ); val |=MVNETA_PHY_POLLING_ENABLE ;mvreg_write (pp,MVNETA_UNIT_CONTROL , val);
@@ -1431,10 +1433,6 @@ static int mvneta_start(struct udevice *dev) pp->fixed_link = phydev->phy_id ==PHY_FIXED_ID ; -/* Set PHY address in case we will enable HW polling */ -if (!pp->fixed_link) -mvreg_write (pp,MVNETA_PHY_ADDR , phydev->addr); - pp->phydev = phydev;phy_config (phydev);phy_startup (phydev);
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 16/19] net: mvneta: Write PHY address just before enabling HW polling
Quoted 35 lines · Marek Behún
From: Marek Behún <[email protected]>
Write PHY address just before enabling HW polling of the PHY.
Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/net/mvneta.c +2
-5@@ -814,6 +814,8 @@ static void mvneta_defaults_set(struct mvneta_port *pp)/* Enable PHY polling in hardware if not in fixed-link mode */ if (!pp->fixed_link) { +mvreg_write (pp,MVNETA_PHY_ADDR , pp->phydev->addr); + val =mvreg_read (pp,MVNETA_UNIT_CONTROL ); val |=MVNETA_PHY_POLLING_ENABLE ;mvreg_write (pp,MVNETA_UNIT_CONTROL , val);@@ -1431,10 +1433,6 @@ static int mvneta_start(struct udevice *dev) pp->fixed_link = phydev->phy_id ==PHY_FIXED_ID ; -/* Set PHY address in case we will enable HW polling */ -if (!pp->fixed_link) -mvreg_write (pp,MVNETA_PHY_ADDR , phydev->addr); - pp->phydev = phydev;phy_config (phydev);phy_startup (phydev); --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 16/19] net: mvneta: Write PHY address just before enabling HW polling
In reply to Marek BehúnQuoted 5 lines · Marek Behún
From: Marek Behún <[email protected]>
Write PHY address just before enabling HW polling of the PHY.
Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 18 lines
--- drivers/net/mvneta.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/net/mvneta.c +2
-0@@ -814,6 +814,8 @@ static void mvneta_defaults_set(struct mvneta_port *pp)/* Enable PHY polling in hardware if not in fixed-link mode */ if (!pp->fixed_link) { +mvreg_write (pp,MVNETA_PHY_ADDR , pp->phydev->addr); + val =mvreg_read (pp,MVNETA_UNIT_CONTROL ); val |=MVNETA_PHY_POLLING_ENABLE ;mvreg_write (pp,MVNETA_UNIT_CONTROL , val);
drivers/net/mvneta.c static int mvneta_start(struct udevice *dev) · line 1438
Quoted 10 lines
drivers/net/mvneta.c +0
-4@@ -1431,10 +1433,6 @@ static int mvneta_start(struct udevice *dev) pp->fixed_link = phydev->phy_id ==PHY_FIXED_ID ; -/* Set PHY address in case we will enable HW polling */ -if (!pp->fixed_link) -mvreg_write (pp,MVNETA_PHY_ADDR , phydev->addr); - pp->phydev = phydev;phy_config (phydev);phy_startup (phydev);
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 17/19 net: mvneta: Drop fixed_link member from private struct
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Since this member is checked only at two places drop it and inline it's usage.
--- drivers/net/mvneta.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/net/mvneta.c +2 -5
@@ -273,7 +273,6 @@ struct mvneta_port {u16 rx_ring_size;phy_interface_t phy_interface; -bool fixed_link;unsigned int link;unsigned int duplex;unsigned int speed;
@@ -813,7 +812,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)mvreg_write (pp,MVNETA_SDMA_CONFIG , val);/* Enable PHY polling in hardware if not in fixed-link mode */ -if (!pp->fixed_link) { +if (pp->phydev->phy_id !=PHY_FIXED_ID ) {mvreg_write (pp,MVNETA_PHY_ADDR , pp->phydev->addr); val =mvreg_read (pp,MVNETA_UNIT_CONTROL );
@@ -1173,7 +1172,7 @@ static void mvneta_adjust_link(struct udevice *dev)* be added). Also, why is ADVERT_FC enabled if we don't enable * inband AN at all? */ -if (pp->fixed_link) +if (pp->phydev->phy_id ==PHY_FIXED_ID ) val =MVNETA_GMAC_FORCE_LINK_UP |MVNETA_GMAC_IB_BYPASS_AN_EN | MVNETA_GMAC_SET_FC_EN |
@@ -1431,8 +1430,6 @@ static int mvneta_start(struct udevice *dev)return -ENODEV ; } - pp->fixed_link = phydev->phy_id ==PHY_FIXED_ID ; - pp->phydev = phydev;phy_config (phydev);phy_startup (phydev);
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 17/19] net: mvneta: Drop fixed_link member from private struct
Quoted 51 lines · Marek Behún
From: Marek Behún <[email protected]>
Since this member is checked only at two places drop it and inline it's usage.
Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/net/mvneta.c +2
-6@@ -273,7 +273,6 @@ struct mvneta_port {u16 rx_ring_size;phy_interface_t phy_interface; -bool fixed_link;unsigned int link;unsigned int duplex;unsigned int speed;@@ -813,7 +812,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)mvreg_write (pp,MVNETA_SDMA_CONFIG , val);/* Enable PHY polling in hardware if not in fixed-link mode */ -if (!pp->fixed_link) { +if (pp->phydev->phy_id !=PHY_FIXED_ID ) {mvreg_write (pp,MVNETA_PHY_ADDR , pp->phydev->addr); val =mvreg_read (pp,MVNETA_UNIT_CONTROL );@@ -1173,7 +1172,7 @@ static void mvneta_adjust_link(struct udevice *dev)* be added). Also, why is ADVERT_FC enabled if we don't enable * inband AN at all? */ -if (pp->fixed_link) +if (pp->phydev->phy_id ==PHY_FIXED_ID ) val =MVNETA_GMAC_FORCE_LINK_UP |MVNETA_GMAC_IB_BYPASS_AN_EN | MVNETA_GMAC_SET_FC_EN |@@ -1431,8 +1430,6 @@ static int mvneta_start(struct udevice *dev)return -ENODEV ; } - pp->fixed_link = phydev->phy_id ==PHY_FIXED_ID ; - pp->phydev = phydev;phy_config (phydev);phy_startup (phydev); --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 17/19] net: mvneta: Drop fixed_link member from private struct
In reply to Marek BehúnQuoted 6 lines · Marek Behún
From: Marek Behún <[email protected]>
Since this member is checked only at two places drop it and inline it's usage.
Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 35 lines
--- drivers/net/mvneta.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/net/mvneta.c +2
-3@@ -273,7 +273,6 @@ struct mvneta_port {u16 rx_ring_size;phy_interface_t phy_interface; -bool fixed_link;unsigned int link;unsigned int duplex;unsigned int speed;@@ -813,7 +812,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp)mvreg_write (pp,MVNETA_SDMA_CONFIG , val);/* Enable PHY polling in hardware if not in fixed-link mode */ -if (!pp->fixed_link) { +if (pp->phydev->phy_id !=PHY_FIXED_ID ) {mvreg_write (pp,MVNETA_PHY_ADDR , pp->phydev->addr); val =mvreg_read (pp,MVNETA_UNIT_CONTROL );@@ -1173,7 +1172,7 @@ static void mvneta_adjust_link(struct udevice *dev)* be added). Also, why is ADVERT_FC enabled if we don't enable * inband AN at all? */ -if (pp->fixed_link) +if (pp->phydev->phy_id ==PHY_FIXED_ID ) val =MVNETA_GMAC_FORCE_LINK_UP |MVNETA_GMAC_IB_BYPASS_AN_EN | MVNETA_GMAC_SET_FC_EN |
drivers/net/mvneta.c static int mvneta_start(struct udevice *dev) · line 1435
Quoted 8 lines
drivers/net/mvneta.c +0
-2@@ -1431,8 +1430,6 @@ static int mvneta_start(struct udevice *dev)return -ENODEV ; } - pp->fixed_link = phydev->phy_id ==PHY_FIXED_ID ; - pp->phydev = phydev;phy_config (phydev);phy_startup (phydev);
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 18/19 net: mvneta: Disable fixed PHY code if PHY_FIXED is not compiled in
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Guard the code handling the fixed PHY case byCONFIG_IS_ENABLED(PHY_FIXED).
--- drivers/net/mvneta.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/mvneta.c +4 -2
@@ -812,7 +812,8 @@ static void mvneta_defaults_set(struct mvneta_port *pp)mvreg_write (pp,MVNETA_SDMA_CONFIG , val);/* Enable PHY polling in hardware if not in fixed-link mode */ -if (pp->phydev->phy_id !=PHY_FIXED_ID ) { +if (!CONFIG_IS_ENABLED (PHY_FIXED ) || + pp->phydev->phy_id !=PHY_FIXED_ID ) {mvreg_write (pp,MVNETA_PHY_ADDR , pp->phydev->addr); val =mvreg_read (pp,MVNETA_UNIT_CONTROL );
@@ -1172,7 +1173,8 @@ static void mvneta_adjust_link(struct udevice *dev)* be added). Also, why is ADVERT_FC enabled if we don't enable * inband AN at all? */ -if (pp->phydev->phy_id ==PHY_FIXED_ID ) +if (CONFIG_IS_ENABLED (PHY_FIXED ) && + pp->phydev->phy_id ==PHY_FIXED_ID ) val =MVNETA_GMAC_FORCE_LINK_UP |MVNETA_GMAC_IB_BYPASS_AN_EN | MVNETA_GMAC_SET_FC_EN |
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 18/19] net: mvneta: Disable fixed PHY code if PHY_FIXED is not compiled in
Quoted 36 lines · Marek Behún
From: Marek Behún <[email protected]>
Guard the code handling the fixed PHY case by
CONFIG_IS_ENABLED(PHY_FIXED).Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/net/mvneta.c +4
-3@@ -812,7 +812,8 @@ static void mvneta_defaults_set(struct mvneta_port *pp)mvreg_write (pp,MVNETA_SDMA_CONFIG , val);/* Enable PHY polling in hardware if not in fixed-link mode */ -if (pp->phydev->phy_id !=PHY_FIXED_ID ) { +if (!CONFIG_IS_ENABLED (PHY_FIXED ) || + pp->phydev->phy_id !=PHY_FIXED_ID ) {mvreg_write (pp,MVNETA_PHY_ADDR , pp->phydev->addr); val =mvreg_read (pp,MVNETA_UNIT_CONTROL );@@ -1172,7 +1173,8 @@ static void mvneta_adjust_link(struct udevice *dev)* be added). Also, why is ADVERT_FC enabled if we don't enable * inband AN at all? */ -if (pp->phydev->phy_id ==PHY_FIXED_ID ) +if (CONFIG_IS_ENABLED (PHY_FIXED ) && + pp->phydev->phy_id ==PHY_FIXED_ID ) val =MVNETA_GMAC_FORCE_LINK_UP |MVNETA_GMAC_IB_BYPASS_AN_EN | MVNETA_GMAC_SET_FC_EN | --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 18/19] net: mvneta: Disable fixed PHY code if PHY_FIXED is not compiled in
In reply to Marek BehúnQuoted 6 lines · Marek Behún
From: Marek Behún <[email protected]>
Guard the code handling the fixed PHY case by
CONFIG_IS_ENABLED(PHY_FIXED).Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 19 lines
--- drivers/net/mvneta.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/net/mvneta.c +2
-1@@ -812,7 +812,8 @@ static void mvneta_defaults_set(struct mvneta_port *pp)mvreg_write (pp,MVNETA_SDMA_CONFIG , val);/* Enable PHY polling in hardware if not in fixed-link mode */ -if (pp->phydev->phy_id !=PHY_FIXED_ID ) { +if (!CONFIG_IS_ENABLED (PHY_FIXED ) || + pp->phydev->phy_id !=PHY_FIXED_ID ) {mvreg_write (pp,MVNETA_PHY_ADDR , pp->phydev->addr); val =mvreg_read (pp,MVNETA_UNIT_CONTROL );
drivers/net/mvneta.c static void mvneta_adjust_link(struct udevice *dev) · line 1180
Quoted 9 lines
drivers/net/mvneta.c +2
-1@@ -1172,7 +1173,8 @@ static void mvneta_adjust_link(struct udevice *dev)* be added). Also, why is ADVERT_FC enabled if we don't enable * inband AN at all? */ -if (pp->phydev->phy_id ==PHY_FIXED_ID ) +if (CONFIG_IS_ENABLED (PHY_FIXED ) && + pp->phydev->phy_id ==PHY_FIXED_ID ) val =MVNETA_GMAC_FORCE_LINK_UP |MVNETA_GMAC_IB_BYPASS_AN_EN | MVNETA_GMAC_SET_FC_EN |
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 19/19 net: mvneta: Drop unneeded macro
In reply to Marek BehúnFrom: Marek Behún <[email protected]>
Macro MVNETA_GMAC_FORCE_LINK_UP can be dropped from value assignment in fixed link case, since it's value is written into the register later in the function for link-down-to-link-up case. The value is written as MVNETA_GMAC_FORCE_LINK_DOWN | MVNETA_GMAC_FORCE_LINK_PASS, and so the macro definition can also be dropped.
--- drivers/net/mvneta.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/mvneta.c +1 -3
@@ -188,7 +188,6 @@ DECLARE_GLOBAL_DATA_PTR;#define MVNETA_GMAC_AUTONEG_CONFIG 0x2c0c#define MVNETA_GMAC_FORCE_LINK_DOWN BIT(0)#define MVNETA_GMAC_FORCE_LINK_PASS BIT(1) -#define MVNETA_GMAC_FORCE_LINK_UP (BIT(0) | BIT(1))#define MVNETA_GMAC_IB_BYPASS_AN_EN BIT(3)#define MVNETA_GMAC_CONFIG_MII_SPEED BIT(5)#define MVNETA_GMAC_CONFIG_GMII_SPEED BIT(6)
@@ -1175,8 +1174,7 @@ static void mvneta_adjust_link(struct udevice *dev)*/ if (CONFIG_IS_ENABLED (PHY_FIXED ) && pp->phydev->phy_id ==PHY_FIXED_ID ) - val =MVNETA_GMAC_FORCE_LINK_UP | -MVNETA_GMAC_IB_BYPASS_AN_EN | + val =MVNETA_GMAC_IB_BYPASS_AN_EN |MVNETA_GMAC_SET_FC_EN |MVNETA_GMAC_ADVERT_FC_EN |MVNETA_GMAC_SAMPLE_TX_CFG_EN ;
Signature · 1 line
2.35.1
Re: [PATCH u-boot-marvell 19/19] net: mvneta: Drop unneeded macro
Quoted 37 lines · Marek Behún
From: Marek Behún <[email protected]>
Macro
MVNETA_GMAC_FORCE_LINK_UPcan be dropped from value assignment in fixed link case, since it's value is written into the register later in the function for link-down-to-link-up case. The value is written asMVNETA_GMAC_FORCE_LINK_DOWN|MVNETA_GMAC_FORCE_LINK_PASS, and so the macro definition can also be dropped.Signed-off-by Marek Behún <[email protected]>--- drivers/net/mvneta.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/net/mvneta.c +1
-4@@ -188,7 +188,6 @@ DECLARE_GLOBAL_DATA_PTR;#define MVNETA_GMAC_AUTONEG_CONFIG 0x2c0c#define MVNETA_GMAC_FORCE_LINK_DOWN BIT(0)#define MVNETA_GMAC_FORCE_LINK_PASS BIT(1) -#define MVNETA_GMAC_FORCE_LINK_UP (BIT(0) | BIT(1))#define MVNETA_GMAC_IB_BYPASS_AN_EN BIT(3)#define MVNETA_GMAC_CONFIG_MII_SPEED BIT(5)#define MVNETA_GMAC_CONFIG_GMII_SPEED BIT(6)@@ -1175,8 +1174,7 @@ static void mvneta_adjust_link(struct udevice *dev)*/ if (CONFIG_IS_ENABLED (PHY_FIXED ) && pp->phydev->phy_id ==PHY_FIXED_ID ) - val =MVNETA_GMAC_FORCE_LINK_UP | -MVNETA_GMAC_IB_BYPASS_AN_EN | + val =MVNETA_GMAC_IB_BYPASS_AN_EN |MVNETA_GMAC_SET_FC_EN |MVNETA_GMAC_ADVERT_FC_EN |MVNETA_GMAC_SAMPLE_TX_CFG_EN ; --
Quoted 2 lines
2.35.1
Re: [PATCH u-boot-marvell 19/19] net: mvneta: Drop unneeded macro
In reply to Marek BehúnQuoted 9 lines · Marek Behún
From: Marek Behún <[email protected]>
Macro
MVNETA_GMAC_FORCE_LINK_UPcan be dropped from value assignment in fixed link case, since it's value is written into the register later in the function for link-down-to-link-up case. The value is written asMVNETA_GMAC_FORCE_LINK_DOWN|MVNETA_GMAC_FORCE_LINK_PASS, and so the macro definition can also be dropped.Signed-off-by Marek Behún <[email protected]>
Thanks,
Stefan
Quoted 17 lines
--- drivers/net/mvneta.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/net/mvneta.c +0
-1@@ -188,7 +188,6 @@ DECLARE_GLOBAL_DATA_PTR;#define MVNETA_GMAC_AUTONEG_CONFIG 0x2c0c#define MVNETA_GMAC_FORCE_LINK_DOWN BIT(0)#define MVNETA_GMAC_FORCE_LINK_PASS BIT(1) -#define MVNETA_GMAC_FORCE_LINK_UP (BIT(0) | BIT(1))#define MVNETA_GMAC_IB_BYPASS_AN_EN BIT(3)#define MVNETA_GMAC_CONFIG_MII_SPEED BIT(5)#define MVNETA_GMAC_CONFIG_GMII_SPEED BIT(6)
drivers/net/mvneta.c static void mvneta_adjust_link(struct udevice *dev) · line 1180
Quoted 9 lines
drivers/net/mvneta.c +1
-2@@ -1175,8 +1174,7 @@ static void mvneta_adjust_link(struct udevice *dev)*/ if (CONFIG_IS_ENABLED (PHY_FIXED ) && pp->phydev->phy_id ==PHY_FIXED_ID ) - val =MVNETA_GMAC_FORCE_LINK_UP | -MVNETA_GMAC_IB_BYPASS_AN_EN | + val =MVNETA_GMAC_IB_BYPASS_AN_EN |MVNETA_GMAC_SET_FC_EN |MVNETA_GMAC_ADVERT_FC_EN |MVNETA_GMAC_SAMPLE_TX_CFG_EN ;
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Hi Ramon,
Quoted 5 lines · Marek Behún
From: Marek Behún <[email protected]>
Hello Stefan,
here come some refactors, cleanups and fixed for the mvneta driver.
Ramon, you've already reviewed those patches. Thanks for this. The patches are assigned to me in patchwork, which makes perhaps sense, as some touch the ARM related files. Are you okay with me pulling these patches via the marvell tree?
Thanks,
Stefan
Quoted 34 lines
Marek Behún (19):
net: mvneta: Get rid of platdata
net: mvneta: Fix 10Mbps speed
net: mvneta: Use DM MDIO API for connecting PHY
net: mvneta: Remember fixed link instead of PHY address in priv data
arm: mvebu: Espressobin: Use DM registered MDIO to configure switch
net: mdio-uclass: adddm_phy_find_by_ofnode()helper
arm: mvebu:turris_mox: Use DM registered MDIO
net: mvneta: Don't register MDIO bus
net: mvneta: Fix unused variable warning ifDM_GPIOis disabled
net: mvneta: Drop one indentation level inmvneta_adjust_link()
net: mvneta: Use bool instead of int for boolean variable
net: mvneta: Drop unnecessary space
net: mventa: Don't check forCONFIG_PHYLIB
net: mvneta: RenameCONFIG_NR_CPUStoMVNETA_NR_CPUS
net: mvneta: Convert to usePHY_FIXEDfor fixed-link
net: mvneta: Write PHY address just before enabling HW polling
net: mvneta: Dropfixed_linkmember from private struct
net: mvneta: Disable fixed PHY code ifPHY_FIXEDis not compiled in
net: mvneta: Drop unneeded macro.../dts/armada-3720-turris-mox-u-boot.dtsi | 19 - board/CZ.NIC/turris_mox/turris_mox.c | 88 ++--- board/Marvell/mvebu_armada-37xx/board.c | 26 +- configs/clearfog_defconfig | 1 + configs/controlcenterdc_defconfig | 1 + configs/db-88f6820-amc_defconfig | 1 + configs/db-88f6820-gp_defconfig | 1 + configs/db-mv784mp-gp_defconfig | 1 + configs/ds414_defconfig | 1 + configs/helios4_defconfig | 1 + configs/maxbcm_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 3 + configs/theadorable_debug_defconfig | 1 +
Quoted 9 lines
configs/turris_mox_defconfig | 1 + configs/turris_omnia_defconfig | 2 + configs/uDPU_defconfig | 1 + drivers/net/Kconfig | 1 + drivers/net/mvneta.c | 343 ++++-------------- include/miiphy.h | 9 + net/mdio-uclass.c | 22 ++ 20 files changed, 181 insertions(+), 343 deletions(-)
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Quoted 40 lines · Marek Behún
From: Marek Behún <[email protected]>
Hello Stefan,
here come some refactors, cleanups and fixed for the mvneta driver.
Marek Behún (19):
net: mvneta: Get rid of platdata
net: mvneta: Fix 10Mbps speed
net: mvneta: Use DM MDIO API for connecting PHY
net: mvneta: Remember fixed link instead of PHY address in priv data
arm: mvebu: Espressobin: Use DM registered MDIO to configure switch
net: mdio-uclass: adddm_phy_find_by_ofnode()helper
arm: mvebu:turris_mox: Use DM registered MDIO
net: mvneta: Don't register MDIO bus
net: mvneta: Fix unused variable warning ifDM_GPIOis disabled
net: mvneta: Drop one indentation level inmvneta_adjust_link()
net: mvneta: Use bool instead of int for boolean variable
net: mvneta: Drop unnecessary space
net: mventa: Don't check forCONFIG_PHYLIB
net: mvneta: RenameCONFIG_NR_CPUStoMVNETA_NR_CPUS
net: mvneta: Convert to usePHY_FIXEDfor fixed-link
net: mvneta: Write PHY address just before enabling HW polling
net: mvneta: Dropfixed_linkmember from private struct
net: mvneta: Disable fixed PHY code ifPHY_FIXEDis not compiled in
net: mvneta: Drop unneeded macro.../dts/armada-3720-turris-mox-u-boot.dtsi | 19 - board/CZ.NIC/turris_mox/turris_mox.c | 88 ++--- board/Marvell/mvebu_armada-37xx/board.c | 26 +- configs/clearfog_defconfig | 1 + configs/controlcenterdc_defconfig | 1 + configs/db-88f6820-amc_defconfig | 1 + configs/db-88f6820-gp_defconfig | 1 + configs/db-mv784mp-gp_defconfig | 1 + configs/ds414_defconfig | 1 + configs/helios4_defconfig | 1 + configs/maxbcm_defconfig | 1 + configs/mvebu_espressobin-88f3720_defconfig | 3 + configs/theadorable_debug_defconfig | 1 +
Quoted 9 lines
configs/turris_mox_defconfig | 1 + configs/turris_omnia_defconfig | 2 + configs/uDPU_defconfig | 1 + drivers/net/Kconfig | 1 + drivers/net/mvneta.c | 343 ++++-------------- include/miiphy.h | 9 + net/mdio-uclass.c | 22 ++ 20 files changed, 181 insertions(+), 343 deletions(-)
Applied to u-boot-marvell/master
Thanks,
Stefan