Skip to contentSkip to conversation

imx: colibri imx6/imx7: apalis imx6: migrate to DM_ETH

PATCH New Igor Opaniuk 4 participants 19 messages Nov 4, 2019 – Dec 29, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover imx: colibri imx6/imx7: apalis imx6: migrate to DM_ETH

Migrate to DM_ETH and remove hardcoded pinmux configuration.

Igor Opaniuk (6):
ARM: dts: imx6_colibri: introduce fec node
colibri_imx6: migrate to DM_ETH
ARM: dts: imx6_apalis: introduce fec node
apalis_imx6: migrate to DM_ETH
ARM: dts: imx7: imx7_colibri: introduce fec node
colibri_imx7: migrate to DM_ETH

 arch/arm/dts/imx6-apalis.dts              |  22 ++++
 arch/arm/dts/imx6-colibri.dts             |  20 ++++
 arch/arm/dts/imx7-colibri.dtsi            | 116 ++++++++++++++++++++++
 arch/arm/dts/imx7d.dtsi                   |   3 +
 arch/arm/dts/imx7s.dtsi                   |   1 +
 board/toradex/apalis_imx6/apalis_imx6.c   |  51 ----------
 board/toradex/colibri_imx6/colibri_imx6.c |  59 +----------
 board/toradex/colibri_imx7/colibri_imx7.c |  44 --------
 configs/apalis_imx6_defconfig             |   3 +
 configs/colibri_imx6_defconfig            |   3 +
 configs/colibri_imx7_defconfig            |   5 +-
 configs/colibri_imx7_emmc_defconfig       |   5 +-
 include/configs/apalis_imx6.h             |   6 --
 include/configs/colibri_imx6.h            |   8 --
 include/configs/colibri_imx7.h            |  11 --
 15 files changed, 180 insertions(+), 177 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/6 ARM: dts: imx6_colibri: introduce fec node

From: Igor Opaniuk <[email protected]>

Sync DTS with the mainline Linux and introduce fec node.

---

 arch/arm/dts/imx6-colibri.dts | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/dts/imx6-colibri.dts +20 -0
index 5c9f1f0d2b..387d6d5ca7 100644
@@ -21,6 +21,7 @@
 		mmc0 = &usdhc3;
 		mmc1 = &usdhc1;
 		usb0 = &usbotg; /* required for ums */
+		ethernet0 = &fec;
 	};
 
 	chosen {
@@ -46,6 +47,25 @@
 	};
 };
 
+&fec {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_enet>;
+	phy-mode = "rmii";
+	phy-handle = <&ethphy>;
+	status = "okay";
+
+	mdio {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		ethphy: ethernet-phy at 0 {
+			reg = <0>;
+			micrel,led-mode = <0>;
+			status = "okay";
+		};
+	};
+};
+
 /*
  * PWR_I2C: power I2C to audio codec, PMIC, temperature sensor and
  * touch screen controller
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/6 ARM: dts: imx6_colibri: introduce fec node

Quoted 6 lines · Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Sync DTS with the mainline Linux and introduce fec node.

Quoted 50 lines

---

 arch/arm/dts/imx6-colibri.dts | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/dts/imx6-colibri.dts +20 -1
index 5c9f1f0d2b..387d6d5ca7 100644
@@ -21,6 +21,7 @@
                mmc0 = &usdhc3;
                mmc1 = &usdhc1;
                usb0 = &usbotg; /* required for ums */
+               ethernet0 = &fec;
        };
 
        chosen {
@@ -46,6 +47,25 @@
        };
 };
 
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rmii";
+       phy-handle = <&ethphy>;
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ethphy: ethernet-phy at 0 {
+                       reg = <0>;
+                       micrel,led-mode = <0>;
+                       status = "okay";
+               };
+       };
+};
+
 /*
  * PWR_I2C: power I2C to audio codec, PMIC, temperature sensor and
  * touch screen controller
--

2.17.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 6 lines
Best regards
Oleksandr Suvorov

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

PATCH 1/6 ARM: dts: imx6_colibri: introduce fec node

In reply to Igor Opaniuk
Quoted 4 lines

From: Igor Opaniuk <[email protected]> Sync DTS with the mainline Linux and introduce fec node.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#4 lore raw

PATCH 2/6 colibri_imx6: migrate to DM_ETH

In reply to Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Migrate to DM_ETH and remove hardcoded pinmux configuration.

---

 board/toradex/colibri_imx6/colibri_imx6.c | 59 ++---------------------
 configs/colibri_imx6_defconfig            |  3 ++
 include/configs/colibri_imx6.h            |  8 ---
 3 files changed, 7 insertions(+), 63 deletions(-)
board/toradex/colibri_imx6/colibri_imx6.c +4 -55
index ad40b589c1..64295a42e5 100644
@@ -51,9 +51,6 @@ DECLARE_GLOBAL_DATA_PTR;
 	PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm |			\
 	PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
 
-#define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP |			\
-	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
-
 #define WEAK_PULLUP	(PAD_CTL_PUS_100K_UP |			\
 	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS |	\
 	PAD_CTL_SRE_SLOW)
@@ -112,24 +109,6 @@ iomux_v3_cfg_t const usdhc3_pads[] = {
 };
 #endif /* CONFIG_FSL_ESDHC_IMX & CONFIG_SPL_BUILD */
 
-iomux_v3_cfg_t const enet_pads[] = {
-	MX6_PAD_ENET_MDC__ENET_MDC		| MUX_PAD_CTRL(ENET_PAD_CTRL),
-	MX6_PAD_ENET_MDIO__ENET_MDIO		| MUX_PAD_CTRL(ENET_PAD_CTRL),
-	MX6_PAD_ENET_RXD0__ENET_RX_DATA0	| MUX_PAD_CTRL(ENET_PAD_CTRL),
-	MX6_PAD_ENET_RXD1__ENET_RX_DATA1	| MUX_PAD_CTRL(ENET_PAD_CTRL),
-	MX6_PAD_ENET_RX_ER__ENET_RX_ER		| MUX_PAD_CTRL(ENET_PAD_CTRL),
-	MX6_PAD_ENET_TX_EN__ENET_TX_EN		| MUX_PAD_CTRL(ENET_PAD_CTRL),
-	MX6_PAD_ENET_TXD0__ENET_TX_DATA0	| MUX_PAD_CTRL(ENET_PAD_CTRL),
-	MX6_PAD_ENET_TXD1__ENET_TX_DATA1	| MUX_PAD_CTRL(ENET_PAD_CTRL),
-	MX6_PAD_ENET_CRS_DV__ENET_RX_EN		| MUX_PAD_CTRL(ENET_PAD_CTRL),
-	MX6_PAD_GPIO_16__ENET_REF_CLK		| MUX_PAD_CTRL(ENET_PAD_CTRL),
-};
-
-static void setup_iomux_enet(void)
-{
-	imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
-}
-
 /* mux auxiliary pins to GPIO, so they can be used from the U-Boot cmdline */
 iomux_v3_cfg_t const gpio_pads[] = {
 	/* ADDRESS[17:18] [25] used as GPIO */
@@ -371,12 +350,8 @@ int board_phy_config(struct phy_device *phydev)
 	return 0;
 }
 
-int board_eth_init(bd_t *bis)
+int setup_fec(void)
 {
-	struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
-	uint32_t base = IMX_FEC_BASE;
-	struct mii_dev *bus = NULL;
-	struct phy_device *phydev = NULL;
 	int ret;
 
 	/* provide the PHY clock from the i.MX 6 */
@@ -384,34 +359,6 @@ int board_eth_init(bd_t *bis)
 	if (ret)
 		return ret;
 
-	/* set gpr1[ENET_CLK_SEL] */
-	setbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_ENET_CLK_SEL_MASK);
-
-	setup_iomux_enet();
-
-#ifdef CONFIG_FEC_MXC
-	bus = fec_get_miibus(base, -1);
-	if (!bus)
-		return 0;
-
-	/* scan PHY 1..7 */
-	phydev = phy_find_by_mask(bus, 0xff, PHY_INTERFACE_MODE_RMII);
-	if (!phydev) {
-		free(bus);
-		puts("no PHY found\n");
-		return 0;
-	}
-
-	phy_reset(phydev);
-	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;
 }
 
@@ -633,7 +580,9 @@ int board_init(void)
 {
 	/* address of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
-
+#if defined(CONFIG_FEC_MXC)
+	setup_fec();
+#endif
 #if defined(CONFIG_VIDEO_IPUV3)
 	setup_display();
 #endif
configs/colibri_imx6_defconfig +3 -0
index 4f7ca7b91d..647564a03a 100644
@@ -62,6 +62,9 @@ CONFIG_FSL_USDHC=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ8XXX=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
include/configs/colibri_imx6.h +0 -8
index 1f2b89e722..390052362b 100644
@@ -43,14 +43,6 @@
 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
 #define CONFIG_SYS_FSL_USDHC_NUM	2
 
-/* Network */
-#define CONFIG_FEC_MXC
-#define IMX_FEC_BASE			ENET_BASE_ADDR
-#define CONFIG_FEC_XCV_TYPE		RMII
-#define CONFIG_ETHPRIME			"FEC"
-#define CONFIG_FEC_MXC_PHYADDR		1
-#define CONFIG_TFTP_TSIZE
-
 /* USB Configs */
 /* Host */
 #define CONFIG_USB_MAX_CONTROLLER_COUNT		2
Signature · 1 line
2.17.1
#5 lore raw

PATCH 2/6 colibri_imx6: migrate to DM_ETH

Quoted 6 lines · Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Migrate to DM_ETH and remove hardcoded pinmux configuration.

Quoted 146 lines

---

 board/toradex/colibri_imx6/colibri_imx6.c | 59 ++---------------------
 configs/colibri_imx6_defconfig            |  3 ++
 include/configs/colibri_imx6.h            |  8 ---
 3 files changed, 7 insertions(+), 63 deletions(-)
board/toradex/colibri_imx6/colibri_imx6.c +4 -55
index ad40b589c1..64295a42e5 100644
@@ -51,9 +51,6 @@ DECLARE_GLOBAL_DATA_PTR;
        PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm |                 \
        PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
 
-#define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP |                  \
-       PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
-
 #define WEAK_PULLUP    (PAD_CTL_PUS_100K_UP |                  \
        PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
        PAD_CTL_SRE_SLOW)
@@ -112,24 +109,6 @@ iomux_v3_cfg_t const usdhc3_pads[] = {
 };
 #endif /* CONFIG_FSL_ESDHC_IMX & CONFIG_SPL_BUILD */
 
-iomux_v3_cfg_t const enet_pads[] = {
-       MX6_PAD_ENET_MDC__ENET_MDC              | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_ENET_MDIO__ENET_MDIO            | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_ENET_RXD0__ENET_RX_DATA0        | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_ENET_RXD1__ENET_RX_DATA1        | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_ENET_RX_ER__ENET_RX_ER          | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_ENET_TX_EN__ENET_TX_EN          | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_ENET_TXD0__ENET_TX_DATA0        | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_ENET_TXD1__ENET_TX_DATA1        | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_ENET_CRS_DV__ENET_RX_EN         | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX6_PAD_GPIO_16__ENET_REF_CLK           | MUX_PAD_CTRL(ENET_PAD_CTRL),
-};
-
-static void setup_iomux_enet(void)
-{
-       imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
-}
-
 /* mux auxiliary pins to GPIO, so they can be used from the U-Boot cmdline */
 iomux_v3_cfg_t const gpio_pads[] = {
        /* ADDRESS[17:18] [25] used as GPIO */
@@ -371,12 +350,8 @@ int board_phy_config(struct phy_device *phydev)
        return 0;
 }
 
-int board_eth_init(bd_t *bis)
+int setup_fec(void)
 {
-       struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
-       uint32_t base = IMX_FEC_BASE;
-       struct mii_dev *bus = NULL;
-       struct phy_device *phydev = NULL;
        int ret;
 
        /* provide the PHY clock from the i.MX 6 */
@@ -384,34 +359,6 @@ int board_eth_init(bd_t *bis)
        if (ret)
                return ret;
 
-       /* set gpr1[ENET_CLK_SEL] */
-       setbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_ENET_CLK_SEL_MASK);
-
-       setup_iomux_enet();
-
-#ifdef CONFIG_FEC_MXC
-       bus = fec_get_miibus(base, -1);
-       if (!bus)
-               return 0;
-
-       /* scan PHY 1..7 */
-       phydev = phy_find_by_mask(bus, 0xff, PHY_INTERFACE_MODE_RMII);
-       if (!phydev) {
-               free(bus);
-               puts("no PHY found\n");
-               return 0;
-       }
-
-       phy_reset(phydev);
-       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;
 }
 
@@ -633,7 +580,9 @@ int board_init(void)
 {
        /* address of boot parameters */
        gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
-
+#if defined(CONFIG_FEC_MXC)
+       setup_fec();
+#endif
 #if defined(CONFIG_VIDEO_IPUV3)
        setup_display();
 #endif
configs/colibri_imx6_defconfig +3 -0
index 4f7ca7b91d..647564a03a 100644
@@ -62,6 +62,9 @@ CONFIG_FSL_USDHC=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ8XXX=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
include/configs/colibri_imx6.h +0 -9
index 1f2b89e722..390052362b 100644
@@ -43,14 +43,6 @@
 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
 #define CONFIG_SYS_FSL_USDHC_NUM       2
 
-/* Network */
-#define CONFIG_FEC_MXC
-#define IMX_FEC_BASE                   ENET_BASE_ADDR
-#define CONFIG_FEC_XCV_TYPE            RMII
-#define CONFIG_ETHPRIME                        "FEC"
-#define CONFIG_FEC_MXC_PHYADDR         1
-#define CONFIG_TFTP_TSIZE
-
 /* USB Configs */
 /* Host */
 #define CONFIG_USB_MAX_CONTROLLER_COUNT                2
--

2.17.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 4 lines
Best regards

Oleksandr Suvorov
cryosay at gmail.com
#6 lore raw

PATCH 2/6 colibri_imx6: migrate to DM_ETH

In reply to Igor Opaniuk
Quoted 4 lines

From: Igor Opaniuk <[email protected]> Migrate to DM_ETH and remove hardcoded pinmux configuration.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#7 lore raw

PATCH 3/6 ARM: dts: imx6_apalis: introduce fec node

In reply to Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Sync DTS with the mainline Linux and introduce fec node.

---

 arch/arm/dts/imx6-apalis.dts | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm/dts/imx6-apalis.dts +22 -0
index b2fdfa1af4..72f7439aed 100644
@@ -22,6 +22,7 @@
 		mmc1 = &usdhc1;
 		mmc2 = &usdhc2;
 		usb0 = &usbotg; /* required for ums */
+		ethernet0 = &fec;
 	};
 
 	chosen {
@@ -197,6 +198,27 @@
 	status = "okay";
 };
 
+&fec {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_enet>;
+	phy-mode = "rgmii";
+	phy-handle = <&ethphy>;
+	phy-reset-duration = <10>;
+	phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
+	status = "okay";
+
+	mdio {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		ethphy: ethernet-phy at 7 {
+			interrupt-parent = <&gpio1>;
+			interrupts = <30 IRQ_TYPE_LEVEL_LOW>;
+			reg = <7>;
+		};
+	};
+};
+
 /* Apalis Serial ATA */
 &sata {
 	status = "okay";
Signature · 1 line
2.17.1
#8 lore raw

PATCH 3/6 ARM: dts: imx6_apalis: introduce fec node

Quoted 6 lines · Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Sync DTS with the mainline Linux and introduce fec node.

Quoted 52 lines

---

 arch/arm/dts/imx6-apalis.dts | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm/dts/imx6-apalis.dts +22 -1
index b2fdfa1af4..72f7439aed 100644
@@ -22,6 +22,7 @@
                mmc1 = &usdhc1;
                mmc2 = &usdhc2;
                usb0 = &usbotg; /* required for ums */
+               ethernet0 = &fec;
        };
 
        chosen {
@@ -197,6 +198,27 @@
        status = "okay";
 };
 
+&fec {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_enet>;
+       phy-mode = "rgmii";
+       phy-handle = <&ethphy>;
+       phy-reset-duration = <10>;
+       phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
+       status = "okay";
+
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ethphy: ethernet-phy at 7 {
+                       interrupt-parent = <&gpio1>;
+                       interrupts = <30 IRQ_TYPE_LEVEL_LOW>;
+                       reg = <7>;
+               };
+       };
+};
+
 /* Apalis Serial ATA */
 &sata {
        status = "okay";
--

2.17.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 6 lines
Best regards
Oleksandr Suvorov

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

PATCH 3/6 ARM: dts: imx6_apalis: introduce fec node

In reply to Igor Opaniuk
Quoted 4 lines

From: Igor Opaniuk <[email protected]> Sync DTS with the mainline Linux and introduce fec node.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#10 lore raw

PATCH 4/6 apalis_imx6: migrate to DM_ETH

In reply to Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Migrate to DM_ETH and remove hardcoded pinmux configuration.

---

 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(-)
board/toradex/apalis_imx6/apalis_imx6.c +0 -51
index 51505b63e1..ec6a28104f 100644
@@ -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@%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
configs/apalis_imx6_defconfig +3 -0
index 797bbb0ed0..7c91ab9c58 100644
@@ -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
include/configs/apalis_imx6.h +0 -6
index a5f9a96732..a346b987a0 100644
@@ -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 */
Signature · 1 line
2.17.1
#11 lore raw

PATCH 4/6 apalis_imx6: migrate to DM_ETH

Quoted 6 lines · Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Migrate to DM_ETH and remove hardcoded pinmux configuration.

Quoted 115 lines

---

 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(-)
board/toradex/apalis_imx6/apalis_imx6.c +0 -51
index 51505b63e1..ec6a28104f 100644
@@ -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
configs/apalis_imx6_defconfig +3 -0
index 797bbb0ed0..7c91ab9c58 100644
@@ -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
include/configs/apalis_imx6.h +0 -7
index a5f9a96732..a346b987a0 100644
@@ -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

Signature · 6 lines
Best regards
Oleksandr Suvorov

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

PATCH 4/6 apalis_imx6: migrate to DM_ETH

In reply to Igor Opaniuk
Quoted 4 lines

From: Igor Opaniuk <[email protected]> Migrate to DM_ETH and remove hardcoded pinmux configuration.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#13 lore raw

PATCH 5/6 ARM: dts: imx7: imx7_colibri: introduce fec node

In reply to Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Sync DTS with the mainline Linux and introduce fec node and regulator configuration for rn5t567 PMU.

---

 arch/arm/dts/imx7-colibri.dtsi | 116 +++++++++++++++++++++++++++++++++
 arch/arm/dts/imx7d.dtsi        |   3 +
 arch/arm/dts/imx7s.dtsi        |   1 +
 3 files changed, 120 insertions(+)
arch/arm/dts/imx7-colibri.dtsi +116 -0
index 308e0b2a63..ec95f22a0c 100644
@@ -18,6 +18,70 @@
 	rn5t567 at 33 {
 		compatible = "ricoh,rn5t567";
 		reg = <0x33>;
+
+		regulators {
+			reg_DCDC1: DCDC1 {  /* V1.0_SOC */
+				regulator-min-microvolt = <1000000>;
+				regulator-max-microvolt = <1100000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			reg_DCDC2: DCDC2 { /* V1.1_ARM */
+				regulator-min-microvolt = <975000>;
+				regulator-max-microvolt = <1100000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			reg_DCDC3: DCDC3 { /* V1.8 */
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			reg_DCDC4: DCDC4 { /* V1.35_DRAM */
+				regulator-min-microvolt = <1350000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			reg_LDO1: LDO1 { /* PWR_EN_+V3.3_ETH */
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-boot-on;
+			};
+
+			reg_LDO2: LDO2 { /* +V1.8_SD */
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			reg_LDO3: LDO3 { /* PWR_EN_+V3.3_LPSR */
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			reg_LDO4: LDO4 { /* V1.8_LPSR */
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+
+			reg_LDO5: LDO5 { /* PWR_EN_+V3.3 */
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-boot-on;
+				regulator-always-on;
+			};
+		};
 	};
 };
 
@@ -30,6 +94,25 @@
 	status = "okay";
 };
 
+&fec1 {
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&pinctrl_enet1>;
+	pinctrl-1 = <&pinctrl_enet1_sleep>;
+	clocks = <&clks IMX7D_ENET_AXI_ROOT_CLK>,
+		<&clks IMX7D_ENET_AXI_ROOT_CLK>,
+		<&clks IMX7D_ENET1_TIME_ROOT_CLK>,
+		<&clks IMX7D_PLL_ENET_MAIN_50M_CLK>;
+	clock-names = "ipg", "ahb", "ptp", "enet_clk_ref";
+	assigned-clocks = <&clks IMX7D_ENET1_TIME_ROOT_SRC>,
+			  <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
+	assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
+	assigned-clock-rates = <0>, <100000000>;
+	phy-mode = "rmii";
+	phy-supply = <&reg_LDO1>;
+	fsl,magic-packet;
+	status = "okay";
+};
+
 &uart1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_uart1 &pinctrl_uart1_ctrl1>;
@@ -88,6 +171,39 @@
 			MX7D_PAD_SD1_DATA3__SD1_DATA3	0x59
 		>;
 	};
+
+	pinctrl_enet1: enet1grp {
+		fsl,pins = <
+			MX7D_PAD_ENET1_CRS__GPIO7_IO14			0x14
+			MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL	0x73
+			MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0	0x73
+			MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1	0x73
+			MX7D_PAD_ENET1_RGMII_RXC__ENET1_RX_ER		0x73
+
+			MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL	0x73
+			MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0	0x73
+			MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1	0x73
+			MX7D_PAD_GPIO1_IO12__CCM_ENET_REF_CLK1		0x73
+			MX7D_PAD_SD2_CD_B__ENET1_MDIO			0x3
+			MX7D_PAD_SD2_WP__ENET1_MDC			0x3
+		>;
+	};
+
+	pinctrl_enet1_sleep: enet1sleepgrp {
+		fsl,pins = <
+			MX7D_PAD_ENET1_RGMII_RX_CTL__GPIO7_IO4		0x0
+			MX7D_PAD_ENET1_RGMII_RD0__GPIO7_IO0		0x0
+			MX7D_PAD_ENET1_RGMII_RD1__GPIO7_IO1		0x0
+			MX7D_PAD_ENET1_RGMII_RXC__GPIO7_IO5		0x0
+
+			MX7D_PAD_ENET1_RGMII_TX_CTL__GPIO7_IO10		0x0
+			MX7D_PAD_ENET1_RGMII_TD0__GPIO7_IO6		0x0
+			MX7D_PAD_ENET1_RGMII_TD1__GPIO7_IO7		0x0
+			MX7D_PAD_GPIO1_IO12__GPIO1_IO12			0x0
+			MX7D_PAD_SD2_CD_B__GPIO5_IO9			0x0
+			MX7D_PAD_SD2_WP__GPIO5_IO10			0x0
+		>;
+	};
 };
 
 &iomuxc_lpsr {
arch/arm/dts/imx7d.dtsi +3 -0
index 30b058934b..75566c780a 100644
@@ -44,6 +44,9 @@
 #include "imx7s.dtsi"
 
 / {
+	aliases {
+		ethernet1 = &fec2;
+	};
 	cpus {
 		cpu0: cpu at 0 {
 			operating-points = <
arch/arm/dts/imx7s.dtsi +1 -0
index 5067b9f7e7..5c2e98be06 100644
@@ -87,6 +87,7 @@
 		spi2 = &ecspi2;
 		spi3 = &ecspi3;
 		spi4 = &ecspi4;
+		ethernet0 = &fec1;
 	};
 
 	cpus {
Signature · 1 line
2.17.1
#14 lore raw

PATCH 5/6 ARM: dts: imx7: imx7_colibri: introduce fec node

Quoted 7 lines · Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Sync DTS with the mainline Linux and introduce fec node and regulator configuration for rn5t567 PMU.

Quoted 181 lines

---

 arch/arm/dts/imx7-colibri.dtsi | 116 +++++++++++++++++++++++++++++++++
 arch/arm/dts/imx7d.dtsi        |   3 +
 arch/arm/dts/imx7s.dtsi        |   1 +
 3 files changed, 120 insertions(+)
arch/arm/dts/imx7-colibri.dtsi +116 -0
index 308e0b2a63..ec95f22a0c 100644
@@ -18,6 +18,70 @@
        rn5t567 at 33 {
                compatible = "ricoh,rn5t567";
                reg = <0x33>;
+
+               regulators {
+                       reg_DCDC1: DCDC1 {  /* V1.0_SOC */
+                               regulator-min-microvolt = <1000000>;
+                               regulator-max-microvolt = <1100000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       reg_DCDC2: DCDC2 { /* V1.1_ARM */
+                               regulator-min-microvolt = <975000>;
+                               regulator-max-microvolt = <1100000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       reg_DCDC3: DCDC3 { /* V1.8 */
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       reg_DCDC4: DCDC4 { /* V1.35_DRAM */
+                               regulator-min-microvolt = <1350000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       reg_LDO1: LDO1 { /* PWR_EN_+V3.3_ETH */
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                       };
+
+                       reg_LDO2: LDO2 { /* +V1.8_SD */
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       reg_LDO3: LDO3 { /* PWR_EN_+V3.3_LPSR */
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       reg_LDO4: LDO4 { /* V1.8_LPSR */
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       reg_LDO5: LDO5 { /* PWR_EN_+V3.3 */
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+               };
        };
 };
 
@@ -30,6 +94,25 @@
        status = "okay";
 };
 
+&fec1 {
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&pinctrl_enet1>;
+       pinctrl-1 = <&pinctrl_enet1_sleep>;
+       clocks = <&clks IMX7D_ENET_AXI_ROOT_CLK>,
+               <&clks IMX7D_ENET_AXI_ROOT_CLK>,
+               <&clks IMX7D_ENET1_TIME_ROOT_CLK>,
+               <&clks IMX7D_PLL_ENET_MAIN_50M_CLK>;
+       clock-names = "ipg", "ahb", "ptp", "enet_clk_ref";
+       assigned-clocks = <&clks IMX7D_ENET1_TIME_ROOT_SRC>,
+                         <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
+       assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
+       assigned-clock-rates = <0>, <100000000>;
+       phy-mode = "rmii";
+       phy-supply = <&reg_LDO1>;
+       fsl,magic-packet;
+       status = "okay";
+};
+
 &uart1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart1 &pinctrl_uart1_ctrl1>;
@@ -88,6 +171,39 @@
                        MX7D_PAD_SD1_DATA3__SD1_DATA3   0x59
                >;
        };
+
+       pinctrl_enet1: enet1grp {
+               fsl,pins = <
+                       MX7D_PAD_ENET1_CRS__GPIO7_IO14                  0x14
+                       MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL 0x73
+                       MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0       0x73
+                       MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1       0x73
+                       MX7D_PAD_ENET1_RGMII_RXC__ENET1_RX_ER           0x73
+
+                       MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL 0x73
+                       MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0       0x73
+                       MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1       0x73
+                       MX7D_PAD_GPIO1_IO12__CCM_ENET_REF_CLK1          0x73
+                       MX7D_PAD_SD2_CD_B__ENET1_MDIO                   0x3
+                       MX7D_PAD_SD2_WP__ENET1_MDC                      0x3
+               >;
+       };
+
+       pinctrl_enet1_sleep: enet1sleepgrp {
+               fsl,pins = <
+                       MX7D_PAD_ENET1_RGMII_RX_CTL__GPIO7_IO4          0x0
+                       MX7D_PAD_ENET1_RGMII_RD0__GPIO7_IO0             0x0
+                       MX7D_PAD_ENET1_RGMII_RD1__GPIO7_IO1             0x0
+                       MX7D_PAD_ENET1_RGMII_RXC__GPIO7_IO5             0x0
+
+                       MX7D_PAD_ENET1_RGMII_TX_CTL__GPIO7_IO10         0x0
+                       MX7D_PAD_ENET1_RGMII_TD0__GPIO7_IO6             0x0
+                       MX7D_PAD_ENET1_RGMII_TD1__GPIO7_IO7             0x0
+                       MX7D_PAD_GPIO1_IO12__GPIO1_IO12                 0x0
+                       MX7D_PAD_SD2_CD_B__GPIO5_IO9                    0x0
+                       MX7D_PAD_SD2_WP__GPIO5_IO10                     0x0
+               >;
+       };
 };
 
 &iomuxc_lpsr {
arch/arm/dts/imx7d.dtsi +3 -0
index 30b058934b..75566c780a 100644
@@ -44,6 +44,9 @@
 #include "imx7s.dtsi"
 
 / {
+       aliases {
+               ethernet1 = &fec2;
+       };
        cpus {
                cpu0: cpu at 0 {
                        operating-points = <
arch/arm/dts/imx7s.dtsi +1 -1
index 5067b9f7e7..5c2e98be06 100644
@@ -87,6 +87,7 @@
                spi2 = &ecspi2;
                spi3 = &ecspi3;
                spi4 = &ecspi4;
+               ethernet0 = &fec1;
        };
 
        cpus {
--

2.17.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 6 lines
Best regards
Oleksandr Suvorov

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

PATCH 5/6 ARM: dts: imx7: imx7_colibri: introduce fec node

In reply to Igor Opaniuk
Quoted 5 lines

From: Igor Opaniuk <[email protected]>
Sync DTS with the mainline Linux and introduce fec node and regulator configuration for rn5t567 PMU.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#16 lore raw

PATCH 6/6 colibri_imx7: migrate to DM_ETH

In reply to Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Migrate to DM_ETH and remove hardcoded pinmux configuration.

---

 board/toradex/colibri_imx7/colibri_imx7.c | 44 -----------------------
 configs/colibri_imx7_defconfig            |  5 ++-
 configs/colibri_imx7_emmc_defconfig       |  5 ++-
 include/configs/colibri_imx7.h            | 11 ------
 4 files changed, 8 insertions(+), 57 deletions(-)
board/toradex/colibri_imx7/colibri_imx7.c +0 -44
index c001316591..3ef381da1a 100644
@@ -159,50 +159,12 @@ void board_preboot_os(void)
 	gpio_direction_output(GPIO_BL_ON, 0);
 }
 
-#ifdef CONFIG_FEC_MXC
-static iomux_v3_cfg_t const fec1_pads[] = {
-#ifndef CONFIG_COLIBRI_IMX7_EXT_PHYCLK
-	MX7D_PAD_GPIO1_IO12__CCM_ENET_REF_CLK1 | MUX_PAD_CTRL(ENET_PAD_CTRL) | MUX_MODE_SION,
-#else
-	MX7D_PAD_GPIO1_IO12__CCM_ENET_REF_CLK1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-#endif
-	MX7D_PAD_SD2_CD_B__ENET1_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL_MII),
-	MX7D_PAD_SD2_WP__ENET1_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL_MII),
-	MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-	MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-	MX7D_PAD_ENET1_RGMII_RXC__ENET1_RX_ER | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-	MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL	  | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-	MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-	MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-	MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
-};
-
-static void setup_iomux_fec(void)
-{
-	imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));
-}
-#endif
-
 static void setup_iomux_uart(void)
 {
 	imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
 }
 
 #ifdef CONFIG_FEC_MXC
-int board_eth_init(bd_t *bis)
-{
-	int ret;
-
-	setup_iomux_fec();
-
-	ret = fecmxc_initialize_multi(bis, 0,
-		CONFIG_FEC_MXC_PHYADDR, IMX_FEC_BASE);
-	if (ret)
-		printf("FEC1 MXC: %s:failed\n", __func__);
-
-	return ret;
-}
-
 static int setup_fec(void)
 {
 	struct iomuxc_gpr_base_regs *const iomuxc_gpr_regs
@@ -226,12 +188,6 @@ static int setup_fec(void)
 	return set_clk_enet(ENET_50MHZ);
 }
 
-int board_phy_config(struct phy_device *phydev)
-{
-	if (phydev->drv->config)
-		phydev->drv->config(phydev);
-	return 0;
-}
 #endif
 
 int board_early_init_f(void)
configs/colibri_imx7_defconfig +4 -1
index a6457d5054..504af04b7b 100644
@@ -2,11 +2,11 @@ CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_MX7=y
 CONFIG_SYS_TEXT_BASE=0x87800000
-CONFIG_IMX_HAB=y
 CONFIG_TARGET_COLIBRI_IMX7=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
+CONFIG_IMX_HAB=y
 # CONFIG_CMD_DEKBLOB is not set
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/toradex/colibri_imx7/imximage.cfg,MX7D"
@@ -62,6 +62,9 @@ CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ8XXX=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX7=y
configs/colibri_imx7_emmc_defconfig +4 -1
index b4ca115f13..eee39c70d9 100644
@@ -2,12 +2,12 @@ CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_MX7=y
 CONFIG_SYS_TEXT_BASE=0x87800000
-CONFIG_IMX_HAB=y
 CONFIG_TARGET_COLIBRI_IMX7=y
 CONFIG_TARGET_COLIBRI_IMX7_EMMC=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
+CONFIG_IMX_HAB=y
 # CONFIG_CMD_DEKBLOB is not set
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
@@ -58,6 +58,9 @@ CONFIG_FSL_USDHC=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ8XXX=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX7=y
include/configs/colibri_imx7.h +0 -11
index c2d98291b0..9cb07c08f3 100644
@@ -16,17 +16,6 @@
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(32 * SZ_1M)
 
-/* Network */
-#define CONFIG_FEC_MXC
-#define CONFIG_FEC_XCV_TYPE             RMII
-#define CONFIG_ETHPRIME                 "FEC"
-#define CONFIG_FEC_MXC_PHYADDR          0
-
-#define CONFIG_TFTP_TSIZE
-
-/* ENET1 */
-#define IMX_FEC_BASE			ENET_IPS_BASE_ADDR
-
 /* MMC Config*/
 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
 #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
Signature · 1 line
2.17.1
#17 lore raw

PATCH 6/6 colibri_imx7: migrate to DM_ETH

Quoted 6 lines · Igor Opaniuk

From: Igor Opaniuk <[email protected]>

Migrate to DM_ETH and remove hardcoded pinmux configuration.

Quoted 160 lines

---

 board/toradex/colibri_imx7/colibri_imx7.c | 44 -----------------------
 configs/colibri_imx7_defconfig            |  5 ++-
 configs/colibri_imx7_emmc_defconfig       |  5 ++-
 include/configs/colibri_imx7.h            | 11 ------
 4 files changed, 8 insertions(+), 57 deletions(-)
board/toradex/colibri_imx7/colibri_imx7.c +0 -44
index c001316591..3ef381da1a 100644
@@ -159,50 +159,12 @@ void board_preboot_os(void)
        gpio_direction_output(GPIO_BL_ON, 0);
 }
 
-#ifdef CONFIG_FEC_MXC
-static iomux_v3_cfg_t const fec1_pads[] = {
-#ifndef CONFIG_COLIBRI_IMX7_EXT_PHYCLK
-       MX7D_PAD_GPIO1_IO12__CCM_ENET_REF_CLK1 | MUX_PAD_CTRL(ENET_PAD_CTRL) | MUX_MODE_SION,
-#else
-       MX7D_PAD_GPIO1_IO12__CCM_ENET_REF_CLK1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-#endif
-       MX7D_PAD_SD2_CD_B__ENET1_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL_MII),
-       MX7D_PAD_SD2_WP__ENET1_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL_MII),
-       MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-       MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-       MX7D_PAD_ENET1_RGMII_RXC__ENET1_RX_ER | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-       MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL   | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-       MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-       MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
-};
-
-static void setup_iomux_fec(void)
-{
-       imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));
-}
-#endif
-
 static void setup_iomux_uart(void)
 {
        imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
 }
 
 #ifdef CONFIG_FEC_MXC
-int board_eth_init(bd_t *bis)
-{
-       int ret;
-
-       setup_iomux_fec();
-
-       ret = fecmxc_initialize_multi(bis, 0,
-               CONFIG_FEC_MXC_PHYADDR, IMX_FEC_BASE);
-       if (ret)
-               printf("FEC1 MXC: %s:failed\n", __func__);
-
-       return ret;
-}
-
 static int setup_fec(void)
 {
        struct iomuxc_gpr_base_regs *const iomuxc_gpr_regs
@@ -226,12 +188,6 @@ static int setup_fec(void)
        return set_clk_enet(ENET_50MHZ);
 }
 
-int board_phy_config(struct phy_device *phydev)
-{
-       if (phydev->drv->config)
-               phydev->drv->config(phydev);
-       return 0;
-}
 #endif
 
 int board_early_init_f(void)
configs/colibri_imx7_defconfig +4 -1
index a6457d5054..504af04b7b 100644
@@ -2,11 +2,11 @@ CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_MX7=y
 CONFIG_SYS_TEXT_BASE=0x87800000
-CONFIG_IMX_HAB=y
 CONFIG_TARGET_COLIBRI_IMX7=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
+CONFIG_IMX_HAB=y
 # CONFIG_CMD_DEKBLOB is not set
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/toradex/colibri_imx7/imximage.cfg,MX7D"
@@ -62,6 +62,9 @@ CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ8XXX=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX7=y
configs/colibri_imx7_emmc_defconfig +4 -1
index b4ca115f13..eee39c70d9 100644
@@ -2,12 +2,12 @@ CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_MX7=y
 CONFIG_SYS_TEXT_BASE=0x87800000
-CONFIG_IMX_HAB=y
 CONFIG_TARGET_COLIBRI_IMX7=y
 CONFIG_TARGET_COLIBRI_IMX7_EMMC=y
 CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
+CONFIG_IMX_HAB=y
 # CONFIG_CMD_DEKBLOB is not set
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
@@ -58,6 +58,9 @@ CONFIG_FSL_USDHC=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ8XXX=y
+CONFIG_DM_ETH=y
+CONFIG_DM_MDIO=y
+CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX7=y
include/configs/colibri_imx7.h +0 -12
index c2d98291b0..9cb07c08f3 100644
@@ -16,17 +16,6 @@
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN          (32 * SZ_1M)
 
-/* Network */
-#define CONFIG_FEC_MXC
-#define CONFIG_FEC_XCV_TYPE             RMII
-#define CONFIG_ETHPRIME                 "FEC"
-#define CONFIG_FEC_MXC_PHYADDR          0
-
-#define CONFIG_TFTP_TSIZE
-
-/* ENET1 */
-#define IMX_FEC_BASE                   ENET_IPS_BASE_ADDR
-
 /* MMC Config*/
 #define CONFIG_SYS_FSL_ESDHC_ADDR      0
 #ifdef CONFIG_TARGET_COLIBRI_IMX7_NAND
--

2.17.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 4 lines
Best regards

Oleksandr Suvorov
cryosay at gmail.com
#18 lore raw

PATCH 6/6 colibri_imx7: migrate to DM_ETH

In reply to Igor Opaniuk
Quoted 4 lines

From: Igor Opaniuk <[email protected]> Migrate to DM_ETH and remove hardcoded pinmux configuration.

Applied to u-boot-imx, -next, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================