[PATCH] ARM: imx6: DHCOM i.MX6 PDK: Convert to DM_ETH

Marek Vasut marex at denx.de
Wed Apr 15 16:06:20 CEST 2020


On 4/15/20 4:01 PM, Harald Seiler wrote:
> Use DM_ETH instead of legacy networking.
> 
> Signed-off-by: Harald Seiler <hws at denx.de>
> ---
> 
> Notes:
>     I am unsure whether I converted 'enough' of the board_eth_init()
>     function to DM.  I think the reset GPIO in particular could be handled
>     by the DM driver if I add the following to the device-tree (did not try
>     it yet):
>     
>     	phy-reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
>     	phy-reset-duration = <1>;
>     	phy-reset-post-delay = <10>;

That's how PHY reset should be done, yes.

>     Is it preferred to change the device-tree here or should I keep the reset
>     from board_init() like I have it now?  If I should use the dt, is there
>     a similar way for dealing with VIO?

VIO is likely a fixed regulator-always-on regulator for now.

>  board/dhelectronics/dh_imx6/dh_imx6.c | 26 +++++---------------------
>  configs/dh_imx6_defconfig             |  2 ++
>  2 files changed, 7 insertions(+), 21 deletions(-)
> 
> diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c b/board/dhelectronics/dh_imx6/dh_imx6.c
> index 33ce7e8ff115..aafb9f1b341f 100644
> --- a/board/dhelectronics/dh_imx6/dh_imx6.c
> +++ b/board/dhelectronics/dh_imx6/dh_imx6.c
> @@ -28,10 +28,7 @@
>  #include <fsl_esdhc_imx.h>
>  #include <fuse.h>
>  #include <i2c_eeprom.h>
> -#include <miiphy.h>
>  #include <mmc.h>
> -#include <net.h>
> -#include <netdev.h>
>  #include <usb.h>
>  #include <usb/ehci-ci.h>
>  
> @@ -80,31 +77,14 @@ static int setup_fec_clock(void)
>  	return enable_fec_anatop_clock(0, ENET_50MHZ);
>  }
>  
> -int board_eth_init(bd_t *bis)
> +static void setup_fec(void)
>  {
> -	uint32_t base = IMX_FEC_BASE;
> -	struct mii_dev *bus = NULL;
> -	struct phy_device *phydev = NULL;
> -
>  	gpio_request(IMX_GPIO_NR(5, 0), "PHY-reset");
>  	gpio_request(IMX_GPIO_NR(1, 7), "VIO");
>  
>  	setup_fec_clock();
>  
>  	eth_phy_reset();
> -
> -	bus = fec_get_miibus(base, -1);
> -	if (!bus)
> -		return -EINVAL;
> -
> -	/* Scan PHY 0 */
> -	phydev = phy_find_by_mask(bus, 0xf, PHY_INTERFACE_MODE_RGMII);
> -	if (!phydev) {
> -		printf("Ethernet PHY not found!\n");
> -		return -EINVAL;
> -	}
> -
> -	return fec_probe(bis, -1, base, bus, phydev);
>  }
>  #endif
>  
> @@ -190,6 +170,10 @@ int board_init(void)
>  
>  	setup_dhcom_mac_from_fuse();
>  
> +#ifdef CONFIG_FEC_MXC

You probably want to init the clock either way, not only if the FEC is
enabled, so drop the ifdef.

> +	setup_fec();
> +#endif

[...]


More information about the U-Boot mailing list