From da84e409df150fa366609d5f5bede6f65326c405 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Beh=C3=BAn?= Date: Wed, 27 Apr 2022 12:41:46 +0200 Subject: [PATCH] net: mvneta: Use DM MDIO API for connecting PHY MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ramon Fried Reviewed-by: Stefan Roese --- 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(-) diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig index 1e9c389..a7b6508 100644 --- a/configs/clearfog_defconfig +++ b/configs/clearfog_defconfig @@ -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 diff --git a/configs/controlcenterdc_defconfig b/configs/controlcenterdc_defconfig index d4b966b..df38b2c 100644 --- a/configs/controlcenterdc_defconfig +++ b/configs/controlcenterdc_defconfig @@ -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 diff --git a/configs/db-88f6820-amc_defconfig b/configs/db-88f6820-amc_defconfig index 46c822f..9b77b4a 100644 --- a/configs/db-88f6820-amc_defconfig +++ b/configs/db-88f6820-amc_defconfig @@ -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 diff --git a/configs/db-88f6820-gp_defconfig b/configs/db-88f6820-gp_defconfig index 2dcbc2f..f56d1fb 100644 --- a/configs/db-88f6820-gp_defconfig +++ b/configs/db-88f6820-gp_defconfig @@ -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 diff --git a/configs/db-mv784mp-gp_defconfig b/configs/db-mv784mp-gp_defconfig index f19cc54..5683f11 100644 --- a/configs/db-mv784mp-gp_defconfig +++ b/configs/db-mv784mp-gp_defconfig @@ -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 diff --git a/configs/ds414_defconfig b/configs/ds414_defconfig index a3279c1..a83fe07 100644 --- a/configs/ds414_defconfig +++ b/configs/ds414_defconfig @@ -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 diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig index 7d812e8..c2130ba 100644 --- a/configs/helios4_defconfig +++ b/configs/helios4_defconfig @@ -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 diff --git a/configs/maxbcm_defconfig b/configs/maxbcm_defconfig index 8dd6adf..40f79d4 100644 --- a/configs/maxbcm_defconfig +++ b/configs/maxbcm_defconfig @@ -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 diff --git a/configs/mvebu_espressobin-88f3720_defconfig b/configs/mvebu_espressobin-88f3720_defconfig index ff05630..af30f1b 100644 --- a/configs/mvebu_espressobin-88f3720_defconfig +++ b/configs/mvebu_espressobin-88f3720_defconfig @@ -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 diff --git a/configs/theadorable_debug_defconfig b/configs/theadorable_debug_defconfig index 86129e7..9a03a0a 100644 --- a/configs/theadorable_debug_defconfig +++ b/configs/theadorable_debug_defconfig @@ -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 diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig index 9a76a11..bcd3699 100644 --- a/configs/turris_mox_defconfig +++ b/configs/turris_mox_defconfig @@ -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 diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index 5591c97..5e4f094 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -85,6 +85,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 diff --git a/configs/uDPU_defconfig b/configs/uDPU_defconfig index c07bad5..f2852ad 100644 --- a/configs/uDPU_defconfig +++ b/configs/uDPU_defconfig @@ -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 diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index da56326..7fe0e00 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -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 diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c index 79cdb93..24a491d 100644 --- a/drivers/net/mvneta.c +++ b/drivers/net/mvneta.c @@ -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); -- 2.7.4