[U-Boot] [PATCH v1 4/6] apalis_imx6: migrate to DM_ETH

Oleksandr Suvorov oleksandr.suvorov at toradex.com
Tue Dec 3 15:47:16 CET 2019


On Mon, Nov 4, 2019 at 12:13 PM Igor Opaniuk <igor.opaniuk at gmail.com> wrote:
>
> From: Igor Opaniuk <igor.opaniuk at toradex.com>
>
> Migrate to DM_ETH and remove hardcoded pinmux configuration.
>
> Signed-off-by: Igor Opaniuk <igor.opaniuk at toradex.com>

Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov at toradex.com>

> ---
>
>  board/toradex/apalis_imx6/apalis_imx6.c | 51 -------------------------
>  configs/apalis_imx6_defconfig           |  3 ++
>  include/configs/apalis_imx6.h           |  6 ---
>  3 files changed, 3 insertions(+), 57 deletions(-)
>
> diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c
> index 51505b63e1..ec6a28104f 100644
> --- a/board/toradex/apalis_imx6/apalis_imx6.c
> +++ b/board/toradex/apalis_imx6/apalis_imx6.c
> @@ -176,22 +176,6 @@ iomux_v3_cfg_t const enet_pads[] = {
>  #      define GPIO_ENET_PHY_RESET IMX_GPIO_NR(1, 25)
>  };
>
> -static void setup_iomux_enet(void)
> -{
> -       imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
> -}
> -
> -static int reset_enet_phy(struct mii_dev *bus)
> -{
> -       /* Reset KSZ9031 PHY */
> -       gpio_request(GPIO_ENET_PHY_RESET, "ETH_RESET#");
> -       gpio_direction_output(GPIO_ENET_PHY_RESET, 0);
> -       mdelay(10);
> -       gpio_set_value(GPIO_ENET_PHY_RESET, 1);
> -
> -       return 0;
> -}
> -
>  /* mux the Apalis GPIO pins, so they can be used from the U-Boot cmdline */
>  iomux_v3_cfg_t const gpio_pads[] = {
>         /* Apalis GPIO1 - GPIO8 */
> @@ -366,41 +350,6 @@ int board_phy_config(struct phy_device *phydev)
>         return 0;
>  }
>
> -int board_eth_init(bd_t *bis)
> -{
> -       uint32_t base = IMX_FEC_BASE;
> -       struct mii_dev *bus = NULL;
> -       struct phy_device *phydev = NULL;
> -       int ret;
> -
> -       setup_iomux_enet();
> -
> -#ifdef CONFIG_FEC_MXC
> -       bus = fec_get_miibus(base, -1);
> -       if (!bus)
> -               return 0;
> -
> -       bus->reset = reset_enet_phy;
> -       /* scan PHY 4,5,6,7 */
> -       phydev = phy_find_by_mask(bus, (0xf << 4), PHY_INTERFACE_MODE_RGMII);
> -       if (!phydev) {
> -               free(bus);
> -               puts("no PHY found\n");
> -               return 0;
> -       }
> -
> -       printf("using PHY at %d\n", phydev->addr);
> -       ret = fec_probe(bis, -1, base, bus, phydev);
> -       if (ret) {
> -               printf("FEC MXC: %s:failed\n", __func__);
> -               free(phydev);
> -               free(bus);
> -       }
> -#endif /* CONFIG_FEC_MXC */
> -
> -       return 0;
> -}
> -
>  static iomux_v3_cfg_t const pwr_intb_pads[] = {
>         /*
>          * the bootrom sets the iomux to vselect, potentially connecting
> diff --git a/configs/apalis_imx6_defconfig b/configs/apalis_imx6_defconfig
> index 797bbb0ed0..7c91ab9c58 100644
> --- a/configs/apalis_imx6_defconfig
> +++ b/configs/apalis_imx6_defconfig
> @@ -63,6 +63,9 @@ CONFIG_FSL_USDHC=y
>  CONFIG_PHYLIB=y
>  CONFIG_PHY_MICREL=y
>  CONFIG_PHY_MICREL_KSZ90X1=y
> +CONFIG_DM_ETH=y
> +CONFIG_DM_MDIO=y
> +CONFIG_FEC_MXC=y
>  CONFIG_MII=y
>  CONFIG_PINCTRL=y
>  CONFIG_PINCTRL_IMX6=y
> diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
> index a5f9a96732..a346b987a0 100644
> --- a/include/configs/apalis_imx6.h
> +++ b/include/configs/apalis_imx6.h
> @@ -53,13 +53,7 @@
>  #endif
>
>  /* Network */
> -#define CONFIG_FEC_MXC
> -#define IMX_FEC_BASE                   ENET_BASE_ADDR
> -#define CONFIG_FEC_XCV_TYPE            RGMII
> -#define CONFIG_ETHPRIME                        "FEC"
>  #define PHY_ANEG_TIMEOUT               15000 /* PHY needs longer aneg time */
> -#define CONFIG_FEC_MXC_PHYADDR         6
> -#define CONFIG_TFTP_TSIZE
>
>  /* USB Configs */
>  /* Host */
> --
> 2.17.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot



-- 
Best regards
Oleksandr Suvorov

Toradex AG
Altsagenstrasse 5 | 6048 Horw/Luzern | Switzerland | T: +41 41 500
4800 (main line)


More information about the U-Boot mailing list