[PATCH 1/7] ARM: boards: make use of MDIO_MMD register defines
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Jul 10 02:55:05 PDT 2023
On 10.07.23 08:36, Marco Felsch wrote:
> Make use of the register definition instead of having magic numbers. No
> functional change.
>
> Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> arch/arm/boards/datamodul-edm-qmx6/board.c | 7 ++++---
> arch/arm/boards/embest-marsboard/board.c | 7 ++++---
> arch/arm/boards/terasic-de0-nano-soc/board.c | 7 ++++---
> arch/arm/boards/terasic-de10-nano/board.c | 7 ++++---
> arch/arm/boards/tqma6x/board.c | 7 ++++---
> 5 files changed, 20 insertions(+), 15 deletions(-)
>
> diff --git a/arch/arm/boards/datamodul-edm-qmx6/board.c b/arch/arm/boards/datamodul-edm-qmx6/board.c
> index 9adb3ee0f8..366b64d35a 100644
> --- a/arch/arm/boards/datamodul-edm-qmx6/board.c
> +++ b/arch/arm/boards/datamodul-edm-qmx6/board.c
> @@ -11,6 +11,7 @@
> #include <gpio.h>
> #include <of.h>
>
> +#include <linux/mdio.h>
> #include <linux/micrel_phy.h>
> #include <mfd/stmpe-i2c.h>
>
> @@ -48,9 +49,9 @@ static int ksz9031rn_phy_fixup(struct phy_device *dev)
> * min rx data delay, max rx/tx clock delay,
> * min rx/tx control delay
> */
> - phy_write_mmd_indirect(dev, 4, 2, 0);
> - phy_write_mmd_indirect(dev, 5, 2, 0);
> - phy_write_mmd_indirect(dev, 8, 2, 0x03ff);
> + phy_write_mmd_indirect(dev, 4, MDIO_MMD_WIS, 0);
> + phy_write_mmd_indirect(dev, 5, MDIO_MMD_WIS, 0);
> + phy_write_mmd_indirect(dev, 8, MDIO_MMD_WIS, 0x03ff);
>
> return 0;
> }
> diff --git a/arch/arm/boards/embest-marsboard/board.c b/arch/arm/boards/embest-marsboard/board.c
> index 7835a9265a..7274595e2a 100644
> --- a/arch/arm/boards/embest-marsboard/board.c
> +++ b/arch/arm/boards/embest-marsboard/board.c
> @@ -9,6 +9,7 @@
> #include <init.h>
> #include <envfs.h>
> #include <mach/imx/bbu.h>
> +#include <linux/mdio.h>
> #include <linux/phy.h>
> #include <deep-probe.h>
>
> @@ -19,13 +20,13 @@ static int ar8035_phy_fixup(struct phy_device *dev)
> /* Ar803x phy SmartEEE feature cause link status generates glitch,
> * which cause ethernet link down/up issue, so disable SmartEEE
> */
> - val = phy_read_mmd_indirect(dev, 0x805d, 0x3);
> + val = phy_read_mmd_indirect(dev, 0x805d, MDIO_MMD_PCS);
> phy_write(dev, MII_MMD_DATA, val & ~(1 << 8));
>
> - val = phy_read_mmd_indirect(dev, 0x4003, 0x3);
> + val = phy_read_mmd_indirect(dev, 0x4003, MDIO_MMD_PCS);
> phy_write(dev, MII_MMD_DATA, val & ~(1 << 8));
>
> - val = phy_read_mmd_indirect(dev, 0x4007, 0x3);
> + val = phy_read_mmd_indirect(dev, 0x4007, MDIO_MMD_PCS);
> val &= 0xffe3;
> val |= 0x18;
> phy_write(dev, MII_MMD_DATA, val);
> diff --git a/arch/arm/boards/terasic-de0-nano-soc/board.c b/arch/arm/boards/terasic-de0-nano-soc/board.c
> index 19f74b784c..832160c595 100644
> --- a/arch/arm/boards/terasic-de0-nano-soc/board.c
> +++ b/arch/arm/boards/terasic-de0-nano-soc/board.c
> @@ -5,6 +5,7 @@
> #include <driver.h>
> #include <init.h>
> #include <asm/armlinux.h>
> +#include <linux/mdio.h>
> #include <linux/micrel_phy.h>
> #include <linux/phy.h>
> #include <linux/sizes.h>
> @@ -18,9 +19,9 @@ static int phy_fixup(struct phy_device *dev)
> * min rx data delay, max rx/tx clock delay,
> * min rx/tx control delay
> */
> - phy_write_mmd_indirect(dev, 4, 2, 0);
> - phy_write_mmd_indirect(dev, 5, 2, 0);
> - phy_write_mmd_indirect(dev, 8, 2, 0x003ff);
> + phy_write_mmd_indirect(dev, 4, MDIO_MMD_WIS, 0);
> + phy_write_mmd_indirect(dev, 5, MDIO_MMD_WIS, 0);
> + phy_write_mmd_indirect(dev, 8, MDIO_MMD_WIS, 0x003ff);
> return 0;
> }
>
> diff --git a/arch/arm/boards/terasic-de10-nano/board.c b/arch/arm/boards/terasic-de10-nano/board.c
> index 580c898012..e47d9ac841 100644
> --- a/arch/arm/boards/terasic-de10-nano/board.c
> +++ b/arch/arm/boards/terasic-de10-nano/board.c
> @@ -5,6 +5,7 @@
> #include <driver.h>
> #include <init.h>
> #include <asm/armlinux.h>
> +#include <linux/mdio.h>
> #include <linux/micrel_phy.h>
> #include <linux/phy.h>
> #include <linux/sizes.h>
> @@ -18,9 +19,9 @@ static int phy_fixup(struct phy_device *dev)
> * min rx data delay, max rx/tx clock delay,
> * min rx/tx control delay
> */
> - phy_write_mmd_indirect(dev, 4, 2, 0);
> - phy_write_mmd_indirect(dev, 5, 2, 0);
> - phy_write_mmd_indirect(dev, 8, 2, 0x003ff);
> + phy_write_mmd_indirect(dev, 4, MDIO_MMD_WIS, 0);
> + phy_write_mmd_indirect(dev, 5, MDIO_MMD_WIS, 0);
> + phy_write_mmd_indirect(dev, 8, MDIO_MMD_WIS, 0x003ff);
> return 0;
> }
>
> diff --git a/arch/arm/boards/tqma6x/board.c b/arch/arm/boards/tqma6x/board.c
> index 4bb7223a6e..8a91ad652a 100644
> --- a/arch/arm/boards/tqma6x/board.c
> +++ b/arch/arm/boards/tqma6x/board.c
> @@ -11,6 +11,7 @@
> #include <gpio.h>
> #include <of.h>
>
> +#include <linux/mdio.h>
> #include <linux/micrel_phy.h>
> #include <mfd/stmpe-i2c.h>
>
> @@ -46,9 +47,9 @@ static int ksz9031rn_phy_fixup(struct phy_device *dev)
> * min rx data delay, max rx/tx clock delay,
> * min rx/tx control delay
> */
> - phy_write_mmd_indirect(dev, 4, 2, 0);
> - phy_write_mmd_indirect(dev, 5, 2, 0);
> - phy_write_mmd_indirect(dev, 8, 2, 0x003ff);
> + phy_write_mmd_indirect(dev, 4, MDIO_MMD_WIS, 0);
> + phy_write_mmd_indirect(dev, 5, MDIO_MMD_WIS, 0);
> + phy_write_mmd_indirect(dev, 8, MDIO_MMD_WIS, 0x003ff);
>
> return 0;
> }
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list