ARM: imx: udoo: convert to DM_ETH
authorPeter Robinson <pbrobinson@gmail.com>
Fri, 2 Apr 2021 16:52:51 +0000 (17:52 +0100)
committerStefano Babic <sbabic@denx.de>
Thu, 8 Apr 2021 18:29:54 +0000 (20:29 +0200)
Convert the UDOO board to use DM_ETH.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
board/udoo/udoo.c
configs/udoo_defconfig
include/configs/udoo.h

index c1acc25a9d883f72ef510021df820d5a5f40fedb..5c49388cbfbe94db1b11eb314a768c1aae4abb37 100644 (file)
@@ -88,45 +88,8 @@ int mx6_rgmii_rework(struct phy_device *phydev)
        return 0;
 }
 
-static iomux_v3_cfg_t const enet_pads1[] = {
-       IOMUX_PADS(PAD_ENET_MDIO__ENET_MDIO             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_ENET_MDC__ENET_MDC               | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TXC__RGMII_TXC     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD0__RGMII_TD0     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD1__RGMII_TD1     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD2__RGMII_TD2     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD3__RGMII_TD3     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TX_CTL__RGMII_TX_CTL       | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_ENET_REF_CLK__ENET_TX_CLK        | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RXC__RGMII_RXC     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       /* RGMII reset */
-       IOMUX_PADS(PAD_EIM_D23__GPIO3_IO23              | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* Ethernet power supply */
-       IOMUX_PADS(PAD_EIM_EB3__GPIO2_IO31              | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* pin 32 - 1 - (MODE0) all */
-       IOMUX_PADS(PAD_RGMII_RD0__GPIO6_IO25            | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* pin 31 - 1 - (MODE1) all */
-       IOMUX_PADS(PAD_RGMII_RD1__GPIO6_IO27            | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* pin 28 - 1 - (MODE2) all */
-       IOMUX_PADS(PAD_RGMII_RD2__GPIO6_IO28            | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* pin 27 - 1 - (MODE3) all */
-       IOMUX_PADS(PAD_RGMII_RD3__GPIO6_IO29            | MUX_PAD_CTRL(NO_PAD_CTRL)),
-       /* pin 33 - 1 - (CLK125_EN) 125Mhz clockout enabled */
-       IOMUX_PADS(PAD_RGMII_RX_CTL__GPIO6_IO24 | MUX_PAD_CTRL(NO_PAD_CTRL)),
-};
-
-static iomux_v3_cfg_t const enet_pads2[] = {
-       IOMUX_PADS(PAD_RGMII_RD0__RGMII_RD0     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RD1__RGMII_RD1     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RD2__RGMII_RD2     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RD3__RGMII_RD3     | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RX_CTL__RGMII_RX_CTL       | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-};
-
 static void setup_iomux_enet(void)
 {
-       SETUP_IOMUX_PADS(enet_pads1);
-       udelay(20);
        gpio_direction_output(IMX_GPIO_NR(2, 31), 1); /* Power supply on */
 
        gpio_direction_output(IMX_GPIO_NR(3, 23), 0); /* assert PHY rst */
@@ -148,8 +111,6 @@ static void setup_iomux_enet(void)
        gpio_free(IMX_GPIO_NR(6, 27));
        gpio_free(IMX_GPIO_NR(6, 28));
        gpio_free(IMX_GPIO_NR(6, 29));
-
-       SETUP_IOMUX_PADS(enet_pads2);
 }
 
 static void setup_iomux_uart(void)
@@ -165,40 +126,6 @@ static void setup_iomux_wdog(void)
        gpio_direction_input(WDT_TRG);
 }
 
-int board_eth_init(struct bd_info *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 -EINVAL;
-       /* scan phy 4,5,6,7 */
-       phydev = phy_find_by_mask(bus, (0xf << 4), PHY_INTERFACE_MODE_RGMII);
-
-       if (!phydev) {
-               ret = -EINVAL;
-               goto free_bus;
-       }
-       printf("using phy at %d\n", phydev->addr);
-       ret  = fec_probe(bis, -1, base, bus, phydev);
-       if (ret)
-               goto free_phydev;
-#endif
-       return 0;
-
-free_phydev:
-       free(phydev);
-free_bus:
-       free(bus);
-       return ret;
-}
-
 int board_early_init_f(void)
 {
        setup_iomux_wdog();
@@ -232,6 +159,8 @@ int board_late_init(void)
        else
                env_set("board_rev", "MX6DL");
 #endif
+       setup_iomux_enet();
+
        return 0;
 }
 
index 2735f02af343a10b49928cf0150d5c17b87099ab..064d545e34a539c6b8f1d59c492b57918a2de93d 100644 (file)
@@ -48,6 +48,8 @@ CONFIG_PINCTRL_IMX6=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
+CONFIG_DM_ETH=y
+CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_MXC_UART=y
 CONFIG_DM_THERMAL=y
index 25f40074c5b617e0c4635c1035f626d8d7689a0a..298369373ab3efd532bcb28ae97baef9ffaf4454 100644 (file)
 /* SATA Configs */
 #define CONFIG_LBA48
 
-/* Network support */
-
-#define CONFIG_FEC_MXC
-#define IMX_FEC_BASE                    ENET_BASE_ADDR
-#define CONFIG_FEC_XCV_TYPE             RGMII
-#define CONFIG_ETHPRIME                 "FEC"
-#define CONFIG_FEC_MXC_PHYADDR          6
-
 /* MMC Configuration */
 #define CONFIG_SYS_FSL_ESDHC_ADDR      0