Skip to contentSkip to conversation

imx: Fully convert HSC|DDC K+P i.MX53 based boards to use DM/DTS

PATCH New Lukasz Majewski 2 participants 29 messages Apr 4, 2019 – Apr 26, 2019

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

cover imx: Fully convert HSC|DDC K+P i.MX53 based boards to use DM/DTS

This patch series converts HSC and DDC to solely use Driver Model and Device Tree.
(As a side effect the "removal warnings" are not present anymore).

Some notable changes:
- Converting ehci-mx5 to DM
- CONFIG_USB_EHCI_MX5 to Kconfig
- Use of esdhc with DM
- Cleanup of config

This patch series applies on top of u-boot-imx -next branch
SHA1: 9648463488735e13328f8738c56251e1fb941e51

Lukasz Majewski (14):
ARM: Remove HSC|DDC ETH PHY reset code after switching to DM/DTS
DTS: Add esdhc3 device tree description tuning for HSC|DDC boards
ARM: Enable CONFIG_DM_MMC and CONFIG_DM_BLK on HSC and DDC boards
ARM: defconfig: Move CONFIG_FSL_ESDHC to Kconfig
ARM: Remove non DM/DTS esdhc3 code from HSC|DDC board related files
ARM: kp_imx53: config: Do not use ${boardtype} to setup update wic
file
DTS: Provide USB host DTS description for i.MX53 devices
DTS: Enable USB host support (including regulators) on HSC|DDC boards
ARM: Remove EHCI specific code from HSC|DDC board file
USB: DM: Convert i.MX5 ehci code to driver model
ARM: defconfig: kp_imx53: Enable DM_USB support on HSC|DDC boards
ARM: config: Remove not needed CONFIG_MXC_USB_PORT define Convert CONFIG_USB_EHCI_MX5 to Kconfig
boot.src: Provide dsa_core.blacklist bootarg when booting via NFS

 arch/arm/dts/imx53-kp.dts         |  59 +++++++++++++++++++++-
 arch/arm/dts/imx53.dtsi           |  10 ++++
 arch/arm/mach-imx/mx5/Kconfig     |   4 ++
 board/k+p/bootscripts/tpcboot.cmd |   7 +++
 board/k+p/kp_imx53/kp_imx53.c     |  70 --------------------------
 configs/kp_imx53_defconfig        |   3 ++
 configs/m53menlo_defconfig        |   1 +
 configs/mx51evk_defconfig         |   1 +
 configs/mx53loco_defconfig        |   1 +
 configs/mx53ppd_defconfig         |   1 +
 configs/usbarmory_defconfig       |   1 +
 drivers/usb/host/Kconfig          |   7 +++
 drivers/usb/host/ehci-mx5.c       | 103 ++++++++++++++++++++++++++++++++++++++
 include/configs/kp_imx53.h        |   9 +---
 include/configs/m53menlo.h        |   1 -
 include/configs/mx51evk.h         |   1 -
 include/configs/mx53cx9020.h      |   1 -
 include/configs/mx53loco.h        |   1 -
 include/configs/mx53ppd.h         |   1 -
 include/configs/usbarmory.h       |   1 -
 scripts/config_whitelist.txt      |   1 -
 21 files changed, 197 insertions(+), 87 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/14 ARM: Remove HSC|DDC ETH PHY reset code after switching to DM/DTS

After commit efd0b791069a ("eth: dm: fec: Add gpio phy reset binding") the in-board file definition of ETH PHY reset can be removed.

---

 board/k+p/kp_imx53/kp_imx53.c | 14 --------------
 1 file changed, 14 deletions(-)
board/k+p/kp_imx53/kp_imx53.c +0 -14
index a12ab9107f..3f21d0b4af 100644
@@ -20,7 +20,6 @@
 #include "kp_id_rev.h"
 
 #define VBUS_PWR_EN IMX_GPIO_NR(7, 8)
-#define PHY_nRST IMX_GPIO_NR(7, 6)
 #define BOOSTER_OFF IMX_GPIO_NR(2, 23)
 #define LCD_BACKLIGHT IMX_GPIO_NR(1, 1)
 #define KEY1 IMX_GPIO_NR(2, 26)
@@ -211,17 +210,6 @@ int board_init(void)
 	return 0;
 }
 
-void eth_phy_reset(void)
-{
-	gpio_request(PHY_nRST, "PHY_nRST");
-	gpio_direction_output(PHY_nRST, 1);
-	udelay(50);
-	gpio_set_value(PHY_nRST, 0);
-	udelay(400);
-	gpio_set_value(PHY_nRST, 1);
-	udelay(50);
-}
-
 void board_disable_display(void)
 {
 	gpio_request(LCD_BACKLIGHT, "LCD_BACKLIGHT");
@@ -258,8 +246,6 @@ int board_late_init(void)
 	if (ret)
 		printf("Error %d reading EEPROM content!\n", ret);
 
-	eth_phy_reset();
-
 	show_eeprom();
 	read_board_id();
 
Signature · 1 line
2.11.0
#2 lore raw

PATCH 1/14 ARM: Remove HSC|DDC ETH PHY reset code after switching to DM/DTS

Quoted 3 lines

After commit efd0b791069a ("eth: dm: fec: Add gpio phy reset binding") the in-board file definition of ETH PHY reset can be removed.

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
=====================================================================
#3 lore raw

PATCH 2/14 DTS: Add esdhc3 device tree description tuning for HSC|DDC boards

In reply to Lukasz Majewski

In this commit the esdhc3 controller is enabled as well as it is remaped to mmc0 to not break legacy code.

The pinctrl setup (e.g. 0x1e4) is the same as one from in-board file definition.

---

 arch/arm/dts/imx53-kp.dts | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
arch/arm/dts/imx53-kp.dts +27 -0
index 3ce4445c18..a551fc945b 100644
@@ -17,6 +17,18 @@
 	chosen {
 		stdout-path = &uart2;
 	};
+
+	aliases {
+		mmc0 = &esdhc3;
+	};
+};
+
+&esdhc3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_esdhc3>;
+	bus-width = <8>;
+	non-removable;
+	status = "okay";
 };
 
 &fec {
@@ -61,6 +73,21 @@
 	pinctrl-0 = <&pinctrl_hog>;
 
 	imx53-kp {
+		pinctrl_esdhc3: esdhc3grp {
+			fsl,pins = <
+				MX53_PAD_PATA_DATA8__ESDHC3_DAT0        0x1d4
+				MX53_PAD_PATA_DATA9__ESDHC3_DAT1        0x1d4
+				MX53_PAD_PATA_DATA10__ESDHC3_DAT2       0x1d4
+				MX53_PAD_PATA_DATA11__ESDHC3_DAT3       0x1d4
+				MX53_PAD_PATA_DATA0__ESDHC3_DAT4        0x1d4
+				MX53_PAD_PATA_DATA1__ESDHC3_DAT5        0x1d4
+				MX53_PAD_PATA_DATA2__ESDHC3_DAT6        0x1d4
+				MX53_PAD_PATA_DATA3__ESDHC3_DAT7        0x1d4
+				MX53_PAD_PATA_RESET_B__ESDHC3_CMD       0x1e4
+				MX53_PAD_PATA_IORDY__ESDHC3_CLK         0x1d4
+			>;
+		};
+
 		pinctrl_eth: ethgrp {
 			fsl,pins = <
 				MX53_PAD_FEC_MDIO__FEC_MDIO 0x1fc
Signature · 1 line
2.11.0
#4 lore raw

PATCH 2/14 DTS: Add esdhc3 device tree description tuning for HSC|DDC boards

Quoted 5 lines

In this commit the esdhc3 controller is enabled as well as it is remaped to mmc0 to not break legacy code.
The pinctrl setup (e.g. 0x1e4) is the same as one from in-board file definition.

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
=====================================================================
#5 lore raw

PATCH 3/14 ARM: Enable CONFIG_DM_MMC and CONFIG_DM_BLK on HSC and DDC boards

In reply to Lukasz Majewski

This commit enables DM_MMC and DM_BLK on imx53 based HSC and DDC boards.

---

 arch/arm/mach-imx/mx5/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-imx/mx5/Kconfig +2 -0
index 29051c40f3..cbffdaeed1 100644
@@ -27,6 +27,8 @@ config TARGET_KP_IMX53
 	select DM_I2C
 	select DM_PMIC
 	select DM_SERIAL
+	select DM_MMC
+	select BLK
 	select MX53
 	imply CMD_DM
 
Signature · 1 line
2.11.0
#6 lore raw

PATCH 3/14 ARM: Enable CONFIG_DM_MMC and CONFIG_DM_BLK on HSC and DDC boards

Quoted 2 lines

This commit enables DM_MMC and DM_BLK on imx53 based HSC and DDC boards.

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
=====================================================================
#7 lore raw

PATCH 4/14 ARM: defconfig: Move CONFIG_FSL_ESDHC to Kconfig

In reply to Lukasz Majewski

The CONFIG_FSL_ESDHC is now enabled and defined in Kconfig, not in include/configs/kp_imx53.h

---

 configs/kp_imx53_defconfig | 1 +
 include/configs/kp_imx53.h | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
configs/kp_imx53_defconfig +1 -0
index cfe96fcce5..4be67d1736 100644
@@ -31,6 +31,7 @@ CONFIG_DEFAULT_DEVICE_TREE="imx53-kp"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
 CONFIG_I2C_DEFAULT_BUS_NUMBER=0x1
+CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_SMSC=y
 CONFIG_FEC_MXC=y
include/configs/kp_imx53.h +0 -1
index 3ea75fa120..f82dcd8426 100644
@@ -16,7 +16,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(32 * SZ_1M)
 
 /* MMC Configs */
-#define CONFIG_FSL_ESDHC
 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
 #define CONFIG_SYS_FSL_ESDHC_NUM	1
 
Signature · 1 line
2.11.0
#8 lore raw

PATCH 4/14 ARM: defconfig: Move CONFIG_FSL_ESDHC to Kconfig

Quoted 3 lines

The CONFIG_FSL_ESDHC is now enabled and defined in Kconfig, not in include/configs/kp_imx53.h

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
=====================================================================
#9 lore raw

PATCH 5/14 ARM: Remove non DM/DTS esdhc3 code from HSC|DDC board related files

In reply to Lukasz Majewski

After switching to DM/DTS support of esdhc3 - the code in this patch can be removed.

---

 board/k+p/kp_imx53/kp_imx53.c | 46 -------------------------------------------
 include/configs/kp_imx53.h    |  4 ----
 2 files changed, 50 deletions(-)
board/k+p/kp_imx53/kp_imx53.c +0 -46
index 3f21d0b4af..f4d0ad0ef6 100644
@@ -13,8 +13,6 @@
 #include <asm/arch/iomux-mx53.h>
 #include <asm/arch/clock.h>
 #include <asm/gpio.h>
-#include <mmc.h>
-#include <fsl_esdhc.h>
 #include <power/pmic.h>
 #include <fsl_pmic.h>
 #include "kp_id_rev.h"
@@ -53,50 +51,6 @@ int board_ehci_hcd_init(int port)
 }
 #endif
 
-#ifdef CONFIG_FSL_ESDHC
-struct fsl_esdhc_cfg esdhc_cfg[] = {
-	{MMC_SDHC3_BASE_ADDR},
-};
-
-int board_mmc_getcd(struct mmc *mmc)
-{
-	return 1; /* eMMC is always present */
-}
-
-#define SD_CMD_PAD_CTRL		(PAD_CTL_HYS | PAD_CTL_DSE_HIGH | \
-				 PAD_CTL_PUS_100K_UP)
-#define SD_PAD_CTRL		(PAD_CTL_HYS | PAD_CTL_PUS_47K_UP | \
-				 PAD_CTL_DSE_HIGH)
-
-int board_mmc_init(bd_t *bis)
-{
-	int ret;
-
-	static const iomux_v3_cfg_t sd3_pads[] = {
-		NEW_PAD_CTRL(MX53_PAD_PATA_RESET_B__ESDHC3_CMD,
-			     SD_CMD_PAD_CTRL),
-		NEW_PAD_CTRL(MX53_PAD_PATA_IORDY__ESDHC3_CLK, SD_PAD_CTRL),
-		NEW_PAD_CTRL(MX53_PAD_PATA_DATA8__ESDHC3_DAT0, SD_PAD_CTRL),
-		NEW_PAD_CTRL(MX53_PAD_PATA_DATA9__ESDHC3_DAT1, SD_PAD_CTRL),
-		NEW_PAD_CTRL(MX53_PAD_PATA_DATA10__ESDHC3_DAT2, SD_PAD_CTRL),
-		NEW_PAD_CTRL(MX53_PAD_PATA_DATA11__ESDHC3_DAT3, SD_PAD_CTRL),
-		NEW_PAD_CTRL(MX53_PAD_PATA_DATA0__ESDHC3_DAT4, SD_PAD_CTRL),
-		NEW_PAD_CTRL(MX53_PAD_PATA_DATA1__ESDHC3_DAT5, SD_PAD_CTRL),
-		NEW_PAD_CTRL(MX53_PAD_PATA_DATA2__ESDHC3_DAT6, SD_PAD_CTRL),
-		NEW_PAD_CTRL(MX53_PAD_PATA_DATA3__ESDHC3_DAT7, SD_PAD_CTRL),
-	};
-
-	esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
-	imx_iomux_v3_setup_multiple_pads(sd3_pads, ARRAY_SIZE(sd3_pads));
-
-	ret = fsl_esdhc_initialize(bis, &esdhc_cfg[0]);
-	if (ret)
-		return ret;
-
-	return 0;
-}
-#endif
-
 static int power_init(void)
 {
 	struct udevice *dev;
include/configs/kp_imx53.h +0 -4
index f82dcd8426..ca6ab0fabc 100644
@@ -15,10 +15,6 @@
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(32 * SZ_1M)
 
-/* MMC Configs */
-#define CONFIG_SYS_FSL_ESDHC_ADDR	0
-#define CONFIG_SYS_FSL_ESDHC_NUM	1
-
 /* USB Configs */
 #define CONFIG_USB_EHCI_MX5
 #define CONFIG_MXC_USB_PORT	1
Signature · 1 line
2.11.0
#10 lore raw

PATCH 5/14 ARM: Remove non DM/DTS esdhc3 code from HSC|DDC board related files

Quoted 3 lines

After switching to DM/DTS support of esdhc3 - the code in this patch can be removed.

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
=====================================================================
#11 lore raw

PATCH 6/14 ARM: kp_imx53: config: Do not use ${boardtype} to setup update wic file

In reply to Lukasz Majewski

After unification of the rootfs for both HSC and DDC devices, only one, common wic file is necessary - without the distinction of specific board.

---

 include/configs/kp_imx53.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/kp_imx53.h +1 -1
index ca6ab0fabc..9bbf590b72 100644
@@ -52,7 +52,7 @@
 	       "setexpr blkc ${blkc} + 1; " \
 	       "mmc write ${loadaddr} 0x2 ${blkc}" \
 	"; fi\0"	  \
-	"upwic=setenv wic_file kp-image-kp${boardsoc}${boardtype}.wic; "\
+	"upwic=setenv wic_file kp-image-kp${boardsoc}.wic; "\
 	       "if tftp ${loadaddr} ${wic_file}; then " \
 	       "setexpr blkc ${filesize} / 0x200; " \
 	       "setexpr blkc ${blkc} + 1; " \
Signature · 1 line
2.11.0
#12 lore raw

PATCH 6/14 ARM: kp_imx53: config: Do not use ${boardtype} to setup update wic file

Quoted 3 lines

After unification of the rootfs for both HSC and DDC devices, only one, common wic file is necessary - without the distinction of specific board.

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
=====================================================================
#13 lore raw

PATCH 7/14 DTS: Provide USB host DTS description for i.MX53 devices

In reply to Lukasz Majewski

This code has been ported from Linux kernel - tag v5.1-rc2. The difference from the kernel is the removal of:
fsl,usbmisc = <&usbmisc 1>;
fsl,usbphy = <&usbphy1>;

properties, which are not needed for correct u-boot operation (as PHY setup is done in ehci-mx5.c file itself).

---

 arch/arm/dts/imx53.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/dts/imx53.dtsi +10 -0
index 0fd4acc6f5..5ba6174789 100644
@@ -35,6 +35,7 @@
 		mmc1 = &esdhc2;
 		mmc2 = &esdhc3;
 		mmc3 = &esdhc4;
+		usb1 = &usbh1;
 	};
 
 	tzic: tz-interrupt-controller at fffc000 {
@@ -136,6 +137,15 @@
 				status = "disabled";
 			};
 
+			usbh1: usb at 53f80200 {
+				compatible = "fsl,imx53-usb", "fsl,imx27-usb";
+				reg = <0x53f80200 0x0200>;
+				interrupts = <14>;
+				clocks = <&clks IMX5_CLK_USBOH3_GATE>;
+				dr_mode = "host";
+				status = "disabled";
+			};
+
 			clks: ccm at 53fd4000{
 				compatible = "fsl,imx53-ccm";
 				reg = <0x53fd4000 0x4000>;
Signature · 1 line
2.11.0
#14 lore raw

PATCH 7/14 DTS: Provide USB host DTS description for i.MX53 devices

Quoted 7 lines

This code has been ported from Linux kernel - tag v5.1-rc2. The difference from the kernel is the removal of:
fsl,usbmisc = <&usbmisc 1>;
fsl,usbphy = <&usbphy1>;
properties, which are not needed for correct u-boot operation (as PHY setup is done in ehci-mx5.c file itself).

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
=====================================================================
#15 lore raw

PATCH 8/14 DTS: Enable USB host support (including regulators) on HSC|DDC boards

In reply to Lukasz Majewski

This commit enables the support for K&P's HSC|DDC imx53 based boards. It was also necessary to provide device tree description for regulators to avoid board specific code definition.

The GPIO pin description responsible for VBUS control has been moved from "hog" group to usbh1 dedicated one.

---

 arch/arm/dts/imx53-kp.dts | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)
arch/arm/dts/imx53-kp.dts +30 -2
index a551fc945b..af4ab5d9f8 100644
@@ -21,6 +21,22 @@
 	aliases {
 		mmc0 = &esdhc3;
 	};
+
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		reg_usbh1_vbus: regulator-usbh1-vbus {
+			compatible = "regulator-fixed";
+			regulator-name = "usbh1_vbus";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			gpio = <&gpio7 8 GPIO_ACTIVE_HIGH>;
+			enable-active-high;
+		};
+	};
+
 };
 
 &esdhc3 {
@@ -109,8 +125,6 @@
 			fsl,pins = <
 				/* PHY RESET */
 				MX53_PAD_PATA_DA_0__GPIO7_6 0x182
-				/* VBUS_PWR_EN */
-				MX53_PAD_PATA_DA_2__GPIO7_8 0x1e4
 				/* BOOSTER_OFF */
 				MX53_PAD_EIM_CS0__GPIO2_23 0x1e4
 				/* LCD BACKLIGHT */
@@ -158,6 +172,13 @@
 				MX53_PAD_PATA_DMARQ__UART2_TXD_MUX 0x1e4
 			>;
 		};
+
+		pinctrl_usbh1: usbh1grp {
+			fsl,pins = <
+				/* VBUS_PWR_EN */
+				MX53_PAD_PATA_DA_2__GPIO7_8 0x1e4
+			>;
+		};
 	};
 };
 
@@ -166,3 +187,10 @@
 	pinctrl-0 = <&pinctrl_uart2>;
 	status = "okay";
 };
+
+&usbh1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usbh1>;
+	vbus-supply = <&reg_usbh1_vbus>;
+	status = "okay";
+};
Signature · 1 line
2.11.0
#16 lore raw

PATCH 8/14 DTS: Enable USB host support (including regulators) on HSC|DDC boards

Quoted 6 lines

This commit enables the support for K&P's HSC|DDC imx53 based boards. It was also necessary to provide device tree description for regulators to avoid board specific code definition.
The GPIO pin description responsible for VBUS control has been moved from "hog" group to usbh1 dedicated one.

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
=====================================================================
#17 lore raw

PATCH 9/14 ARM: Remove EHCI specific code from HSC|DDC board file

In reply to Lukasz Majewski

As EHCI on i.MX5 has been converted to driver model, the board specific code, necessary for VBUS USB power supply setup is not needed anymore.

---

 board/k+p/kp_imx53/kp_imx53.c | 10 ----------
 1 file changed, 10 deletions(-)
board/k+p/kp_imx53/kp_imx53.c +0 -10
index f4d0ad0ef6..57d97153dd 100644
@@ -17,7 +17,6 @@
 #include <fsl_pmic.h>
 #include "kp_id_rev.h"
 
-#define VBUS_PWR_EN IMX_GPIO_NR(7, 8)
 #define BOOSTER_OFF IMX_GPIO_NR(2, 23)
 #define LCD_BACKLIGHT IMX_GPIO_NR(1, 1)
 #define KEY1 IMX_GPIO_NR(2, 26)
@@ -42,15 +41,6 @@ int dram_init_banksize(void)
 	return 0;
 }
 
-#ifdef CONFIG_USB_EHCI_MX5
-int board_ehci_hcd_init(int port)
-{
-	gpio_request(VBUS_PWR_EN, "VBUS_PWR_EN");
-	gpio_direction_output(VBUS_PWR_EN, 1);
-	return 0;
-}
-#endif
-
 static int power_init(void)
 {
 	struct udevice *dev;
Signature · 1 line
2.11.0
#18 lore raw

PATCH 9/14 ARM: Remove EHCI specific code from HSC|DDC board file

Quoted 3 lines

As EHCI on i.MX5 has been converted to driver model, the board specific code, necessary for VBUS USB power supply setup is not needed anymore.

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
=====================================================================
#19 lore raw

PATCH 10/14 USB: DM: Convert i.MX5 ehci code to driver model

In reply to Lukasz Majewski

This commit converts i.MX5's EHCI USB host driver to driver model (DM_USB). It is a straightforward conversion (to reuse as much code as possible), based on ehci-mx6.c code.

---

 drivers/usb/host/ehci-mx5.c | 103 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)
drivers/usb/host/ehci-mx5.c +103 -0
index 60f1470860..0b32728c57 100644
@@ -12,6 +12,8 @@
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
+#include <dm.h>
+#include <power/regulator.h>
 
 #include "ehci.h"
 
@@ -223,6 +225,7 @@ __weak void mx5_ehci_powerup_fixup(struct ehci_ctrl *ctrl, uint32_t *status_reg,
 	mdelay(50);
 }
 
+#if !CONFIG_IS_ENABLED(DM_USB)
 static const struct ehci_ops mx5_ehci_ops = {
 	.powerup_fixup		= mx5_ehci_powerup_fixup,
 };
@@ -267,3 +270,103 @@ int ehci_hcd_stop(int index)
 {
 	return 0;
 }
+#else /* CONFIG_IS_ENABLED(DM_USB) */
+struct ehci_mx5_priv_data {
+	struct ehci_ctrl ctrl;
+	struct usb_ehci *ehci;
+	struct udevice *vbus_supply;
+	enum usb_init_type init_type;
+	int portnr;
+};
+
+static const struct ehci_ops mx5_ehci_ops = {
+	.powerup_fixup		= mx5_ehci_powerup_fixup,
+};
+
+static int ehci_usb_ofdata_to_platdata(struct udevice *dev)
+{
+	struct usb_platdata *plat = dev_get_platdata(dev);
+	const char *mode;
+
+	mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "dr_mode", NULL);
+	if (mode) {
+		if (strcmp(mode, "peripheral") == 0)
+			plat->init_type = USB_INIT_DEVICE;
+		else if (strcmp(mode, "host") == 0)
+			plat->init_type = USB_INIT_HOST;
+		else
+			return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int ehci_usb_probe(struct udevice *dev)
+{
+	struct usb_platdata *plat = dev_get_platdata(dev);
+	struct usb_ehci *ehci = (struct usb_ehci *)devfdt_get_addr(dev);
+	struct ehci_mx5_priv_data *priv = dev_get_priv(dev);
+	enum usb_init_type type = plat->init_type;
+	struct ehci_hccr *hccr;
+	struct ehci_hcor *hcor;
+	int ret;
+
+	set_usboh3_clk();
+	enable_usboh3_clk(true);
+	set_usb_phy_clk();
+	enable_usb_phy1_clk(true);
+	enable_usb_phy2_clk(true);
+	mdelay(1);
+
+	priv->ehci = ehci;
+	priv->portnr = dev->seq;
+	priv->init_type = type;
+
+	ret = device_get_supply_regulator(dev, "vbus-supply",
+					  &priv->vbus_supply);
+	if (ret)
+		debug("%s: No vbus supply\n", dev->name);
+
+	if (!ret && priv->vbus_supply) {
+		ret = regulator_set_enable(priv->vbus_supply,
+					   (type == USB_INIT_DEVICE) ?
+					   false : true);
+		if (ret) {
+			puts("Error enabling VBUS supply\n");
+			return ret;
+		}
+	}
+
+	hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength);
+	hcor = (struct ehci_hcor *)((uint32_t)hccr +
+			HC_LENGTH(ehci_readl(&(hccr)->cr_capbase)));
+	setbits_le32(&ehci->usbmode, CM_HOST);
+
+	__raw_writel(CONFIG_MXC_USB_PORTSC, &ehci->portsc);
+	setbits_le32(&ehci->portsc, USB_EN);
+
+	mxc_set_usbcontrol(priv->portnr, CONFIG_MXC_USB_FLAGS);
+	mdelay(10);
+
+	return ehci_register(dev, hccr, hcor, &mx5_ehci_ops, 0,
+			     priv->init_type);
+}
+
+static const struct udevice_id mx5_usb_ids[] = {
+	{ .compatible = "fsl,imx53-usb" },
+	{ }
+};
+
+U_BOOT_DRIVER(usb_mx5) = {
+	.name	= "ehci_mx5",
+	.id	= UCLASS_USB,
+	.of_match = mx5_usb_ids,
+	.ofdata_to_platdata = ehci_usb_ofdata_to_platdata,
+	.probe	= ehci_usb_probe,
+	.remove = ehci_deregister,
+	.ops	= &ehci_usb_ops,
+	.platdata_auto_alloc_size = sizeof(struct usb_platdata),
+	.priv_auto_alloc_size = sizeof(struct ehci_mx5_priv_data),
+	.flags	= DM_FLAG_ALLOC_PRIV_DMA,
+};
+#endif /* !CONFIG_IS_ENABLED(DM_USB) */
Signature · 1 line
2.11.0
#20 lore raw

PATCH 10/14 USB: DM: Convert i.MX5 ehci code to driver model

Quoted 4 lines

This commit converts i.MX5's EHCI USB host driver to driver model (DM_USB). It is a straightforward conversion (to reuse as much code as possible), based on ehci-mx6.c code.

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
=====================================================================
#21 lore raw

PATCH 11/14 ARM: defconfig: kp_imx53: Enable DM_USB support on HSC|DDC boards

In reply to Lukasz Majewski

This commit enables the DM_USB on HSC|DDC i.MX53 based boards.

---

 arch/arm/mach-imx/mx5/Kconfig | 2 ++
 configs/kp_imx53_defconfig    | 1 +
 2 files changed, 3 insertions(+)
arch/arm/mach-imx/mx5/Kconfig +2 -0
index cbffdaeed1..bde37bb97e 100644
@@ -29,6 +29,8 @@ config TARGET_KP_IMX53
 	select DM_SERIAL
 	select DM_MMC
 	select BLK
+	select DM_USB
+	select DM_REGULATOR
 	select MX53
 	imply CMD_DM
 
configs/kp_imx53_defconfig +1 -0
index 4be67d1736..45227c26d2 100644
@@ -40,6 +40,7 @@ CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX5=y
 # CONFIG_SPL_PMIC_CHILDREN is not set
 CONFIG_DM_PMIC_MC34708=y
+CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_CONS_INDEX=2
 CONFIG_MXC_UART=y
Signature · 1 line
2.11.0
#22 lore raw

PATCH 11/14 ARM: defconfig: kp_imx53: Enable DM_USB support on HSC|DDC boards

Quoted 2 lines

This commit enables the DM_USB on HSC|DDC i.MX53 based boards.

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
=====================================================================
#23 lore raw

PATCH 12/14 ARM: config: Remove not needed CONFIG_MXC_USB_PORT define

In reply to Lukasz Majewski

After i.MX5's EHCI conversion to DM, the CONFIG_MXC_USB_PORT is not needed anymore and should be removed.

---

 include/configs/kp_imx53.h | 1 -
 1 file changed, 1 deletion(-)
include/configs/kp_imx53.h +0 -1
index 9bbf590b72..d09608df35 100644
@@ -17,7 +17,6 @@
 
 /* USB Configs */
 #define CONFIG_USB_EHCI_MX5
-#define CONFIG_MXC_USB_PORT	1
 #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS	0
 
Signature · 1 line
2.11.0
#24 lore raw

PATCH 12/14 ARM: config: Remove not needed CONFIG_MXC_USB_PORT define

Quoted 3 lines

After i.MX5's EHCI conversion to DM, the CONFIG_MXC_USB_PORT is not needed anymore and should be removed.

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
=====================================================================
#25 lore raw

PATCH 13/14 Convert CONFIG_USB_EHCI_MX5 to Kconfig

In reply to Lukasz Majewski

This converts the following to Kconfig:
CONFIG_USB_EHCI_MX5

---

 configs/kp_imx53_defconfig   | 1 +
 configs/m53menlo_defconfig   | 1 +
 configs/mx51evk_defconfig    | 1 +
 configs/mx53loco_defconfig   | 1 +
 configs/mx53ppd_defconfig    | 1 +
 configs/usbarmory_defconfig  | 1 +
 drivers/usb/host/Kconfig     | 7 +++++++
 include/configs/kp_imx53.h   | 1 -
 include/configs/m53menlo.h   | 1 -
 include/configs/mx51evk.h    | 1 -
 include/configs/mx53cx9020.h | 1 -
 include/configs/mx53loco.h   | 1 -
 include/configs/mx53ppd.h    | 1 -
 include/configs/usbarmory.h  | 1 -
 scripts/config_whitelist.txt | 1 -
 15 files changed, 13 insertions(+), 8 deletions(-)
configs/kp_imx53_defconfig +1 -0
index 45227c26d2..225be66019 100644
@@ -45,4 +45,5 @@ CONFIG_SPECIFY_CONSOLE_INDEX=y
 CONFIG_CONS_INDEX=2
 CONFIG_MXC_UART=y
 CONFIG_USB=y
+CONFIG_USB_EHCI_MX5=y
 CONFIG_USB_STORAGE=y
configs/m53menlo_defconfig +1 -0
index e830b2c92e..e10cb8ed8d 100644
@@ -58,6 +58,7 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
 CONFIG_RTC_M41T62=y
 CONFIG_USB=y
+CONFIG_USB_EHCI_MX5=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
configs/mx51evk_defconfig +1 -0
index dc0b3b3f77..78aa89d651 100644
@@ -26,6 +26,7 @@ CONFIG_MII=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
 CONFIG_USB=y
+CONFIG_USB_EHCI_MX5=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
configs/mx53loco_defconfig +1 -0
index 776fc8bab4..caf04ad894 100644
@@ -26,6 +26,7 @@ CONFIG_DWC_AHSATA=y
 CONFIG_FSL_ESDHC=y
 CONFIG_MII=y
 CONFIG_USB=y
+CONFIG_USB_EHCI_MX5=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
configs/mx53ppd_defconfig +1 -0
index 2a6183b77b..2379ab8c66 100644
@@ -37,6 +37,7 @@ CONFIG_FSL_ESDHC=y
 CONFIG_MII=y
 CONFIG_RTC_S35392A=y
 CONFIG_USB=y
+CONFIG_USB_EHCI_MX5=y
 CONFIG_USB_STORAGE=y
 CONFIG_VIDEO=y
 CONFIG_VIDEO_IPUV3=y
configs/usbarmory_defconfig +1 -0
index b1f872405b..46f9996e18 100644
@@ -15,4 +15,5 @@ CONFIG_CMD_USB=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_USB=y
+CONFIG_USB_EHCI_MX5=y
 CONFIG_OF_LIBFDT=y
drivers/usb/host/Kconfig +7 -0
index 0fbc115801..1c2212f547 100644
@@ -132,6 +132,13 @@ config USB_EHCI_MARVELL
 	---help---
 	  Enables support for the on-chip EHCI controller on MVEBU SoCs.
 
+config USB_EHCI_MX5
+	bool "Support for i.MX5 on-chip EHCI USB controller"
+	depends on ARCH_MX5
+	default n
+	help
+	  Enables support for the on-chip EHCI controller on i.MX5 SoCs.
+
 config USB_EHCI_MX6
 	bool "Support for i.MX6 on-chip EHCI USB controller"
 	depends on ARCH_MX6
include/configs/kp_imx53.h +0 -1
index d09608df35..a252e9003d 100644
@@ -16,7 +16,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(32 * SZ_1M)
 
 /* USB Configs */
-#define CONFIG_USB_EHCI_MX5
 #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS	0
 
include/configs/m53menlo.h +0 -1
index 84d061339e..82842d8426 100644
@@ -118,7 +118,6 @@
  * USB
  */
 #ifdef CONFIG_CMD_USB
-#define CONFIG_USB_EHCI_MX5
 #define CONFIG_MXC_USB_PORT		1
 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS		0
include/configs/mx51evk.h +0 -1
index 9bf9773c69..f5fd01de22 100644
@@ -61,7 +61,6 @@
 #define CONFIG_FEC_MXC_PHYADDR	0x1F
 
 /* USB Configs */
-#define CONFIG_USB_EHCI_MX5
 #define CONFIG_MXC_USB_PORT	1
 #define CONFIG_MXC_USB_PORTSC	PORT_PTS_ULPI
 #define CONFIG_MXC_USB_FLAGS	MXC_EHCI_POWER_PINS_ENABLED
include/configs/mx53cx9020.h +0 -1
index 1e3ea88b77..9bf5d9169b 100644
@@ -41,7 +41,6 @@
 #define CONFIG_FEC_MXC_PHYADDR	0x1F
 
 /* USB Configs */
-#define CONFIG_USB_EHCI_MX5
 #define CONFIG_MXC_USB_PORT	1
 #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS	0
include/configs/mx53loco.h +0 -1
index 2d18f05423..4f179081a8 100644
@@ -38,7 +38,6 @@
 #define CONFIG_FEC_MXC_PHYADDR	0x1F
 
 /* USB Configs */
-#define CONFIG_USB_EHCI_MX5
 #define CONFIG_MXC_USB_PORT	1
 #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS	0
include/configs/mx53ppd.h +0 -1
index f002324fdd..2d6715cba2 100644
@@ -37,7 +37,6 @@
 #define CONFIG_FEC_MXC_PHYADDR	0x1F
 
 /* USB Configs */
-#define CONFIG_USB_EHCI_MX5
 #define CONFIG_USB_HOST_ETHER
 #define CONFIG_USB_ETHER_ASIX
 #define CONFIG_USB_ETHER_MCS7830
include/configs/usbarmory.h +0 -1
index 270f325a55..128f02db66 100644
@@ -31,7 +31,6 @@
 #define CONFIG_SYS_FSL_ESDHC_NUM	1
 
 /* USB */
-#define CONFIG_USB_EHCI_MX5
 #define CONFIG_MXC_USB_PORT	1
 #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS	0
scripts/config_whitelist.txt +0 -1
index f1fc131f53..5d39191027 100644
@@ -4509,7 +4509,6 @@ CONFIG_USB_EHCI_BASE_LIST
 CONFIG_USB_EHCI_EXYNOS
 CONFIG_USB_EHCI_FARADAY
 CONFIG_USB_EHCI_KIRKWOOD
-CONFIG_USB_EHCI_MX5
 CONFIG_USB_EHCI_MXC
 CONFIG_USB_EHCI_MXS
 CONFIG_USB_EHCI_SPEAR
Signature · 1 line
2.11.0
#26 lore raw

PATCH 13/14 Convert CONFIG_USB_EHCI_MX5 to Kconfig

Quoted 3 lines

This converts the following to Kconfig:
CONFIG_USB_EHCI_MX5

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
=====================================================================
#27 lore raw

PATCH 14/14 boot.src: Provide dsa_core.blacklist bootarg when booting via NFS

In reply to Lukasz Majewski

This setup is a bit special as Linux kernel (4.19) is not supporting in-kernel NFS rootfs mount and Distributed Switch Architecture (DSA) operation.

For that reason it was necessary to provide a bootarg to allow userspace enable it afterwards if needed.

---

 board/k+p/bootscripts/tpcboot.cmd | 7 +++++++
 1 file changed, 7 insertions(+)
board/k+p/bootscripts/tpcboot.cmd +7 -0
index 0576e81140..b81494dd1b 100644
@@ -27,6 +27,12 @@ setenv miscadj "
 if test '${boardsoc}' = 'imx53'; then
        setenv bootargs '${bootargs} di=${dig_in} key1=${key1}';
 fi;"
+setenv nfsadj "
+if test '${boardsoc}' = 'imx53'; then
+   if test '${boardtype}' = 'hsc'; then
+       setenv bootargs '${bootargs} dsa_core.blacklist=yes';
+   fi;
+fi;"
 setenv boot_fitImage "
 	setenv fdt_conf 'conf@${boardsoc}-${boardname}.dtb';
 	setenv itbcfg "\"#\${fdt_conf}\"";
@@ -72,6 +78,7 @@ setenv boot_nfs "
 if run download_kernel; then
 	run nfsargs;
 	run addip;
+	run nfsadj;
 	setenv bootargs '${bootargs}' console=${console};
 
 	run boot_fitImage;
Signature · 1 line
2.11.0
#28 lore raw

PATCH 14/14 boot.src: Provide dsa_core.blacklist bootarg when booting via NFS

Quoted 6 lines

This setup is a bit special as Linux kernel (4.19) is not supporting in-kernel NFS rootfs mount and Distributed Switch Architecture (DSA) operation.
For that reason it was necessary to provide a bootarg to allow userspace enable it afterwards if needed.

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
=====================================================================