Skip to contentSkip to conversation

arm: dart6ul: enable DM_ETH for the dart6ul

PATCH New ferlandm at amotus.ca 2 participants 2 messages Jan 4, 2021 – Jan 23, 2021

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

PATCH 1/1 arm: dart6ul: enable DM_ETH for the dart6ul

From: Marc Ferland <[email protected]>

This patch converts the dart6ul ethernet support to DM_ETH and cleans up the legacy ethernet code. The clean up, more specifically:

* moves the fec2 node and pin definition to the carrier board DTS since the phy associated with it is on the carrier board and not on the SoM;
* add the reset pin associated to each phy;
* separate the ethernet, mdio and reset pins of each fec so that they are easier to reference;
* add clock properties to the phy nodes since they are connected to the 50Mhz ENET[12]_TX_CLK clock of the SoC;
* remove CONFIG_BOARD_EARLY_INIT_F since the function is now empty.

---
 arch/arm/dts/imx6ull-dart-6ul.dts   | 48 +++++++++++++++++++
 arch/arm/dts/imx6ull-dart-6ul.dtsi  | 57 +++++++++--------------
 board/variscite/dart_6ul/dart_6ul.c | 72 +----------------------------
 board/variscite/dart_6ul/spl.c      |  3 --
 configs/variscite_dart6ul_defconfig |  2 +-
 include/configs/dart_6ul.h          |  7 ---
 6 files changed, 73 insertions(+), 116 deletions(-)
arch/arm/dts/imx6ull-dart-6ul.dts +48 -0
index 4cab1a048b..9e217ba09f 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2019 Parthiban Nallathambi <[email protected]>
+ * Copyright (C) 2021 Marc Ferland, Amotus Solutions Inc., <[email protected]>
  */
 
 /dts-v1/;
@@ -13,6 +14,28 @@
 	compatible = "variscite,imx6ull-dart-6ul", "fsl,imx6ull";
 };
 
+&mdio1 {
+	/* KSZ8081RNB (carrier-board) */
+	ethphy1: ethernet-phy at 3 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		clocks = <&clks IMX6UL_CLK_ENET2_REF>;
+		clock-names = "rmii-ref";
+		micrel,led-mode = <1>;
+		max-speed = <100>;
+		reg = <3>;
+	};
+};
+
+&fec2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_enet2 &pinctrl_enet2_rst>;
+	phy-mode = "rmii";
+	phy-handle = <&ethphy1>;
+	phy-reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+	phy-reset-duration = <100>;
+	status = "okay";
+};
+
 &usdhc2 {
 	status = "okay";
 };
@@ -36,4 +59,29 @@
 		>;
 	};
 
+	pinctrl_enet2: enet2grp {
+		fsl,pins = <
+			MX6UL_PAD_ENET2_RX_EN__ENET2_RX_EN	0x1b0b0
+			MX6UL_PAD_ENET2_RX_ER__ENET2_RX_ER	0x1b0b0
+			MX6UL_PAD_ENET2_RX_DATA0__ENET2_RDATA00	0x1b0b0
+			MX6UL_PAD_ENET2_RX_DATA1__ENET2_RDATA01	0x1b0b0
+			MX6UL_PAD_ENET2_TX_EN__ENET2_TX_EN	0x1b0b0
+			MX6UL_PAD_ENET2_TX_DATA0__ENET2_TDATA00	0x1b0b0
+			MX6UL_PAD_ENET2_TX_DATA1__ENET2_TDATA01	0x1b0b0
+			MX6UL_PAD_ENET2_TX_CLK__ENET2_REF_CLK2	0x4001b031
+		>;
+	};
+
+	pinctrl_enet2_mdio: mdio_enet2_grp {
+		fsl,pins = <
+			MX6UL_PAD_GPIO1_IO07__ENET2_MDC		0x1b0b0
+			MX6UL_PAD_GPIO1_IO06__ENET2_MDIO	0x1b0b0
+		>;
+	};
+
+	pinctrl_enet2_rst: enet2-rst-grp {
+		fsl,pins = <
+			MX6UL_PAD_JTAG_MOD__GPIO1_IO10		0x1b0b0
+		>;
+	};
 };
arch/arm/dts/imx6ull-dart-6ul.dtsi +23 -34

96 lines not on this page · raw message

board/variscite/dart_6ul/dart_6ul.c +1 -71

96 lines not on this page · raw message

board/variscite/dart_6ul/spl.c +0 -3
index 071f049caf..91d470f6e5 100644
@@ -199,9 +199,6 @@ void board_init_f(ulong dummy)
 
 	setup_iomux_uart();
 
-	/* iomux and setup of i2c */
-	board_early_init_f();
-
 	/* UART clocks enabled and gd valid - init serial console */
 	preloader_console_init();
 
configs/variscite_dart6ul_defconfig +1 -1
index 721882567d..b1afcf1a30 100644
@@ -18,7 +18,6 @@ CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
 CONFIG_BOOTDELAY=3
 # CONFIG_USE_BOOTCOMMAND is not set
-CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL_USB_HOST_SUPPORT=y
 CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_CMD_DM=y
@@ -42,6 +41,7 @@ CONFIG_FSL_USDHC=y
 CONFIG_MTD=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
+CONFIG_DM_ETH_PHY=y
 CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
include/configs/dart_6ul.h +0 -7
index 4eb50f841e..dccfa034a4 100644
@@ -22,16 +22,9 @@
 
 #ifdef CONFIG_CMD_NET
 #define CONFIG_FEC_ENET_DEV		0
-
 #if (CONFIG_FEC_ENET_DEV == 0)
-#define IMX_FEC_BASE			ENET_BASE_ADDR
-#define CONFIG_FEC_MXC_PHYADDR		0x1
-#define CONFIG_FEC_XCV_TYPE		RMII
 #define CONFIG_ETHPRIME			"eth0"
 #elif (CONFIG_FEC_ENET_DEV == 1)
-#define IMX_FEC_BASE			ENET2_BASE_ADDR
-#define CONFIG_FEC_MXC_PHYADDR		0x3
-#define CONFIG_FEC_XCV_TYPE		RMII
 #define CONFIG_ETHPRIME			"eth1"
 #endif
 #endif
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 arm: dart6ul: enable DM_ETH for the dart6ul

Quoted 12 lines

From: Marc Ferland <[email protected]>
This patch converts the dart6ul ethernet support to DM_ETH and cleans up the legacy ethernet code. The clean up, more specifically:
* moves the fec2 node and pin definition to the carrier board DTS since the phy associated with it is on the carrier board and not on the SoM;
* add the reset pin associated to each phy;
* separate the ethernet, mdio and reset pins of each fec so that they are easier to reference;
* add clock properties to the phy nodes since they are connected to the 50Mhz ENET[12]_TX_CLK clock of the SoC;
* remove CONFIG_BOARD_EARLY_INIT_F since the function is now empty.

Quoted 1 line

Applied to u-boot-imx, master, 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
=====================================================================