[PATCH u-boot-marvell 03/19] net: mvneta: Use DM MDIO API for connecting PHY
Ramon Fried
rfried.dev at gmail.com
Sun May 1 01:28:31 CEST 2022
On Wed, Apr 27, 2022 at 1:42 PM Marek Behún <kabel at kernel.org> wrote:
>
> From: Marek Behún <marek.behun at nic.cz>
>
> 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 <marek.behun at nic.cz>
> ---
> 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 880f16a6e0..b8f59d2962 100644
> --- a/configs/clearfog_defconfig
> +++ b/configs/clearfog_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/controlcenterdc_defconfig b/configs/controlcenterdc_defconfig
> index d4b966b93f..df38b2c54f 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 46c822fccd..9b77b4a5f0 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 2dcbc2f29a..f56d1fbf25 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 f19cc54975..5683f11836 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 a3279c15c5..a83fe079b3 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 7d812e8fab..c2130bacb4 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 8dd6adf247..40f79d47ea 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 ff05630d20..af30f1b363 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 86129e7d2d..9a03a0a7a3 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 9a76a118c2..bcd3699a4f 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 ad56d3824b..6b218bd7a7 100644
> --- a/configs/turris_omnia_defconfig
> +++ b/configs/turris_omnia_defconfig
> @@ -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
> diff --git a/configs/uDPU_defconfig b/configs/uDPU_defconfig
> index c07bad5076..f2852ad29b 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 347fe8aa42..47f7a262f2 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 79cdb93341..24a491dcde 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.35.1
>
Reviewed-by: Ramon Fried <rfried.dev at gmail.com>
More information about the U-Boot
mailing list