Skip to contentSkip to conversation

DM: display5: Convert display5 board to DM/DTS (including 'factory' setup)

PATCH New Lukasz Majewski 1 participant 15 messages Sep 3, 2019

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

v2 cover DM: display5: Convert display5 board to DM/DTS (including 'factory' setup)

This patch series converts display5 to use DM/DTS. The SPL conversion to DM/DTS has been omitted.

The previous series due to some Kconfig issues was applied partially. Following patches were NOT applied:
https://patchwork.ozlabs.org/patch/1112757/
https://patchwork.ozlabs.org/patch/1112755/
https://patchwork.ozlabs.org/patch/1112756/

This series supersedes conversion from above patches by:
- Fixing issues after porting to newest mainline (FSL_MMC_IMX conversion)
- Converts usage of gpio* legacy API to dm_gpio*
- Cleans up the display5_{factory_}defconfig

Travis-CI:
https://travis-ci.org/lmajewski/u-boot-dfu/builds/580153865

Applied on top of u-boot/master branch
SHA1: 877294b56a52f1cb60bbfa7e4722fcc33451f7b2

Buildman:
./tools/buildman/buildman.py --branch=HEAD mx6 --show_errors --force-build --count=14 --output-dir=../BUILD/

Changes in v2:
- Use dm_gpio* functions instead of gpio_* ones
- Use dm_gpio_* instead of legacy gpio_* functions

Lukasz Majewski (14):
fix: defconfig: Enable OF_CONTROL for display5_factory
ARM: imx: defconfig: Enable CONFIG_PINCTRL{_IMX6} on display5's
defconfig
DM: I2C: Switch display5 board to use DM_I2C
ARM: imx: defconfig: Enable 'regulator' and 'pmic' commands on
display5
DM: mmc: Switch display5 board to use DM_MMC and BLK (USDHC)
DM: eth: Switch display5 board to use DM_ETH
DM: SPI: Convert display5 to use SPI with DM/DTS (but no in SPL)
ARM: display5: Remove UART initialization code after DM/DTS conversion
(non-console)
DM: WDT: Convert WDT driver to use DM/DTS (including SYSRESET)
ARM: display5: Remove common.c file (after DM/DTS U-Boot proper
conversion)
ARM: Update display5_factory_defconfig after switch to DM/DTS and uuu
utility
cosmetic: Cleanup display5_defconfig with make savedefconfig
imx: Convert emergency pad of display5 to use dm_gpio* functions
imx: Rewrite display5 get_board_id() function to use dm_gpio_* API

 arch/arm/dts/imx6q-display5-u-boot.dtsi |   5 +
 arch/arm/mach-imx/mx6/Kconfig           |   5 +
 board/liebherr/display5/Makefile        |   4 +-
 board/liebherr/display5/common.c        | 120 -------------
 board/liebherr/display5/common.h        |   8 -
 board/liebherr/display5/display5.c      | 302 +++++++-------------------------
 board/liebherr/display5/spl.c           |  74 ++++++++
 configs/display5_defconfig              |  31 +++-
 configs/display5_factory_defconfig      |  44 ++++-
 include/configs/display5.h              |  29 ++-
 10 files changed, 232 insertions(+), 390 deletions(-)
 delete mode 100644 board/liebherr/display5/common.c
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/14 fix: defconfig: Enable OF_CONTROL for display5_factory

This change fixes issue with building display5 "factory" U-Boot variant when the display5 board gains DM/DTS support.

---

Changes in v2: None

 configs/display5_factory_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
configs/display5_factory_defconfig +2 -1
index 70c64260d87b..c467e8c92890 100644
@@ -62,6 +62,8 @@ CONFIG_MTDIDS_DEFAULT="nor0=02008000.spi.1"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=02008000.spi.1:128k(SPL),1m(u-boot),64k(env1),64k(env2),4m(swu-kernel),16m(swu-initramfs),1m(factory),-(reserved)"
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_PARTITION_TYPE_GUID=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="imx6q-display5"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_SF=y
@@ -88,4 +90,3 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x4000
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_IMX_WATCHDOG=y
-CONFIG_OF_LIBFDT=y
Signature · 1 line
2.11.0
#2 lore raw

PATCH v2 2/14 ARM: imx: defconfig: Enable CONFIG_PINCTRL{_IMX6} on display5's defconfig

In reply to Lukasz Majewski

Enable PINCTRL for i.MX6 soc based display5 after DM/DTS conversion.

---

Changes in v2: None

 configs/display5_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/display5_defconfig +3 -0
index 8609cd5a8cf6..69f3ceee098b 100644
@@ -46,6 +46,7 @@ CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
+# CONFIG_CMD_PINMUX is not set
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_DHCP=y
@@ -79,6 +80,8 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_MARVELL=y
 CONFIG_FEC_MXC=y
 CONFIG_MII=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
 CONFIG_MXC_UART=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
Signature · 1 line
2.11.0
#3 lore raw

PATCH v2 3/14 DM: I2C: Switch display5 board to use DM_I2C

In reply to Lukasz Majewski

After this commit the display5 device would use I2C driver supporting driver model (DM_I2C).

The 'i2c' and 'eeprom' commands now use DM I2C drivers and initialize on-bus devices according to device tree description.

---

Changes in v2: None

 arch/arm/mach-imx/mx6/Kconfig      |  2 ++
 board/liebherr/display5/display5.c | 48 --------------------------------------
 configs/display5_defconfig         | 14 +++++++++++
 include/configs/display5.h         |  8 -------
 4 files changed, 16 insertions(+), 56 deletions(-)
arch/arm/mach-imx/mx6/Kconfig +2 -0
index fe5991e7c6db..39f0e548f5f1 100644
@@ -187,6 +187,8 @@ config TARGET_DHCOMIMX6
 config TARGET_DISPLAY5
 	bool "LWN DISPLAY5 board"
 	select DM
+	select DM_I2C
+	select DM_GPIO
 	select DM_SERIAL
 	select SUPPORT_SPL
 	imply CMD_DM
board/liebherr/display5/display5.c +0 -48

66 lines not on this page · raw message

configs/display5_defconfig +14 -0
index 69f3ceee098b..9ab055ac5587 100644
@@ -67,6 +67,19 @@ CONFIG_DEFAULT_DEVICE_TREE="imx6q-display5"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
+CONFIG_I2C_DEFAULT_BUS_NUMBER=0x2
+CONFIG_SYS_I2C_MXC=y
+CONFIG_SYS_I2C_MXC_I2C1=y
+CONFIG_SYS_I2C_MXC_I2C2=y
+CONFIG_SYS_I2C_MXC_I2C3=y
+CONFIG_MISC=y
+CONFIG_I2C_EEPROM=y
+CONFIG_SYS_I2C_EEPROM_ADDR=0x50
+CONFIG_SYS_I2C_EEPROM_BUS=2
+CONFIG_SYS_EEPROM_SIZE=32768
+CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS=5
+CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD_DEVICE=y
@@ -85,4 +98,5 @@ CONFIG_PINCTRL_IMX6=y
 CONFIG_MXC_UART=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
+CONFIG_I2C_EDID=y
 CONFIG_IMX_WATCHDOG=y
include/configs/display5.h +0 -8
index 550b7c09f4f6..2a039c24288f 100644
@@ -57,15 +57,7 @@
 #define CONFIG_MXC_UART_BASE		UART5_BASE
 
 /* I2C Configs */
-#define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_MXC
-#define CONFIG_SYS_I2C_MXC_I2C1
-#define CONFIG_SYS_I2C_MXC_I2C2
-#define CONFIG_SYS_I2C_MXC_I2C3
 #define CONFIG_I2C_MULTI_BUS
-#define CONFIG_SYS_I2C_SPEED		100000
-#define CONFIG_I2C_EDID
-#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN  2
 
 /* Ethernet */
 #ifdef CONFIG_FEC_MXC
Signature · 1 line
2.11.0
#4 lore raw

PATCH v2 4/14 ARM: imx: defconfig: Enable 'regulator' and 'pmic' commands on display5

In reply to Lukasz Majewski

---

Changes in v2: None

 configs/display5_defconfig | 6 ++++++
 1 file changed, 6 insertions(+)
configs/display5_defconfig +6 -0
index 9ab055ac5587..6c80a4d46678 100644
@@ -54,6 +54,8 @@ CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_FAT=y
@@ -95,6 +97,10 @@ CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_PFUZE100=y
 CONFIG_MXC_UART=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
Signature · 1 line
2.11.0
#5 lore raw

PATCH v2 5/14 DM: mmc: Switch display5 board to use DM_MMC and BLK (USDHC)

In reply to Lukasz Majewski

After this commit the display5 device would use eMMC driver supporting driver model (DM_MMC and BLK).

---

Changes in v2: None

 arch/arm/mach-imx/mx6/Kconfig      |  1 +
 board/liebherr/display5/common.c   |  6 ------
 board/liebherr/display5/common.h   |  1 -
 board/liebherr/display5/display5.c | 22 ----------------------
 4 files changed, 1 insertion(+), 29 deletions(-)
arch/arm/mach-imx/mx6/Kconfig +1 -0
index 39f0e548f5f1..2496ecacb104 100644
@@ -188,6 +188,7 @@ config TARGET_DISPLAY5
 	bool "LWN DISPLAY5 board"
 	select DM
 	select DM_I2C
+	select DM_MMC
 	select DM_GPIO
 	select DM_SERIAL
 	select SUPPORT_SPL
board/liebherr/display5/common.c +0 -6
index 8390d9a0f31c..754c442427f8 100644
@@ -109,12 +109,6 @@ void displ5_set_iomux_usdhc_spl(void)
 	SETUP_IOMUX_PADS(usdhc4_pads);
 }
 
-void displ5_set_iomux_usdhc(void)
-{
-	SETUP_IOMUX_PADS(usdhc4_pads);
-}
-
 #else
 void displ5_set_iomux_usdhc_spl(void) {}
-void displ5_set_iomux_usdhc(void) {}
 #endif
board/liebherr/display5/common.h +0 -1
index 78c64b02e280..231cefc96009 100644
@@ -36,7 +36,6 @@ void displ5_set_iomux_uart(void);
 void displ5_set_iomux_ecspi_spl(void);
 void displ5_set_iomux_ecspi(void);
 void displ5_set_iomux_usdhc_spl(void);
-void displ5_set_iomux_usdhc(void);
 void displ5_set_iomux_misc_spl(void);
 
 #endif /* __DISPL5_COMMON_H_ */
board/liebherr/display5/display5.c +0 -22
index 5ebc8529e9c7..0cc77dac0fa1 100644
@@ -20,8 +20,6 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/spi.h>
-#include <mmc.h>
-#include <fsl_esdhc_imx.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <i2c.h>
@@ -142,26 +140,6 @@ iomux_v3_cfg_t const misc_pads[] = {
 	MX6_PAD_EIM_D29__GPIO3_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL),
 };
 
-#ifdef CONFIG_FSL_ESDHC_IMX
-struct fsl_esdhc_cfg usdhc_cfg[1] = {
-	{ USDHC4_BASE_ADDR, 0, 8, },
-};
-
-int board_mmc_getcd(struct mmc *mmc)
-{
-	return 1;
-}
-
-int board_mmc_init(bd_t *bis)
-{
-	displ5_set_iomux_usdhc();
-
-	usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
-
-	return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
-}
-#endif /* CONFIG_FSL_ESDHC_IMX */
-
 static void displ5_setup_ecspi(void)
 {
 	int ret;
Signature · 1 line
2.11.0
#6 lore raw

PATCH v2 6/14 DM: eth: Switch display5 board to use DM_ETH

In reply to Lukasz Majewski

After this commit the display5 device would use FEC driver supporting driver model (DM_ETH).

---

Changes in v2:
- Use dm_gpio* functions instead of gpio_* ones

 arch/arm/mach-imx/mx6/Kconfig      |   1 +
 board/liebherr/display5/display5.c | 134 +++++++++----------------------------
 include/configs/display5.h         |   8 ---
 3 files changed, 31 insertions(+), 112 deletions(-)
arch/arm/mach-imx/mx6/Kconfig +1 -0
index 2496ecacb104..aef18726702b 100644
@@ -187,6 +187,7 @@ config TARGET_DHCOMIMX6
 config TARGET_DISPLAY5
 	bool "LWN DISPLAY5 board"
 	select DM
+	select DM_ETH
 	select DM_I2C
 	select DM_MMC
 	select DM_GPIO
board/liebherr/display5/display5.c +30 -104

172 lines not on this page · raw message

include/configs/display5.h +0 -8
index 2a039c24288f..15027f153341 100644
@@ -59,14 +59,6 @@
 /* I2C Configs */
 #define CONFIG_I2C_MULTI_BUS
 
-/* Ethernet */
-#ifdef 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		0
-#endif
-
 /* MMC Configs */
 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
 #define CONFIG_SYS_FSL_USDHC_NUM	2
Signature · 1 line
2.11.0
#7 lore raw

PATCH v2 7/14 DM: SPI: Convert display5 to use SPI with DM/DTS (but no in SPL)

In reply to Lukasz Majewski

The DM/DTS support for SPI is disabled on purpose for SPL, as it is not supported as of time of this conversion.

---

Changes in v2:
- Use dm_gpio_* instead of legacy gpio_* functions

 arch/arm/mach-imx/mx6/Kconfig      |  1 +
 board/liebherr/display5/common.c   | 18 ------------------
 board/liebherr/display5/common.h   |  1 -
 board/liebherr/display5/display5.c | 37 ++++++++++++-------------------------
 configs/display5_defconfig         |  3 +++
 include/configs/display5.h         |  7 +++++--
 6 files changed, 21 insertions(+), 46 deletions(-)
arch/arm/mach-imx/mx6/Kconfig +1 -0
index aef18726702b..f0786b5ffb40 100644
@@ -190,6 +190,7 @@ config TARGET_DISPLAY5
 	select DM_ETH
 	select DM_I2C
 	select DM_MMC
+	select DM_SPI
 	select DM_GPIO
 	select DM_SERIAL
 	select SUPPORT_SPL
board/liebherr/display5/common.c +0 -18
index 754c442427f8..d2d174beaa0d 100644
@@ -45,18 +45,6 @@ void displ5_set_iomux_misc_spl(void)
 }
 
 #ifdef CONFIG_MXC_SPI
-iomux_v3_cfg_t const ecspi_pads[] = {
-	/* SPI3 */
-	MX6_PAD_DISP0_DAT2__ECSPI3_MISO	| MUX_PAD_CTRL(SPI_PAD_CTRL),
-	MX6_PAD_DISP0_DAT1__ECSPI3_MOSI	| MUX_PAD_CTRL(SPI_PAD_CTRL),
-	MX6_PAD_DISP0_DAT0__ECSPI3_SCLK	| MUX_PAD_CTRL(SPI_PAD_CTRL),
-	MX6_PAD_DISP0_DAT3__ECSPI3_SS0	| MUX_PAD_CTRL(NO_PAD_CTRL),
-	MX6_PAD_DISP0_DAT4__ECSPI3_SS1	| MUX_PAD_CTRL(NO_PAD_CTRL),
-	MX6_PAD_DISP0_DAT5__ECSPI3_SS2	| MUX_PAD_CTRL(NO_PAD_CTRL),
-	MX6_PAD_DISP0_DAT6__ECSPI3_SS3	| MUX_PAD_CTRL(NO_PAD_CTRL),
-	MX6_PAD_DISP0_DAT7__ECSPI3_RDY	| MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
 iomux_v3_cfg_t const ecspi2_pads[] = {
 	/* SPI2, NOR Flash nWP, CS0 */
 	MX6_PAD_CSI0_DAT10__ECSPI2_MISO	| MUX_PAD_CTRL(SPI_PAD_CTRL),
@@ -79,14 +67,8 @@ void displ5_set_iomux_ecspi_spl(void)
 	SETUP_IOMUX_PADS(ecspi2_pads);
 }
 
-void displ5_set_iomux_ecspi(void)
-{
-	SETUP_IOMUX_PADS(ecspi_pads);
-}
-
 #else
 void displ5_set_iomux_ecspi_spl(void) {}
-void displ5_set_iomux_ecspi(void) {}
 #endif
 
 #ifdef CONFIG_FSL_ESDHC_IMX
board/liebherr/display5/common.h +0 -1
index 231cefc96009..2bbd934e7a70 100644
@@ -34,7 +34,6 @@
 void displ5_set_iomux_uart_spl(void);
 void displ5_set_iomux_uart(void);
 void displ5_set_iomux_ecspi_spl(void);
-void displ5_set_iomux_ecspi(void);
 void displ5_set_iomux_usdhc_spl(void);
 void displ5_set_iomux_misc_spl(void);
 
board/liebherr/display5/display5.c +12 -25
index e008ea9a3fb8..541e3e94a5eb 100644
@@ -19,7 +19,6 @@
 #include <malloc.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/boot_mode.h>
-#include <asm/mach-imx/spi.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <i2c.h>
@@ -28,11 +27,6 @@
 #include <dm/platform_data/serial_mxc.h>
 #include <dm/platdata.h>
 
-#ifndef CONFIG_MXC_SPI
-#error "CONFIG_SPI must be set for this board"
-#error "Please check your config file"
-#endif
-
 #include "common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -140,21 +134,6 @@ iomux_v3_cfg_t const misc_pads[] = {
 	MX6_PAD_EIM_D29__GPIO3_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL),
 };
 
-static void displ5_setup_ecspi(void)
-{
-	int ret;
-
-	displ5_set_iomux_ecspi();
-
-	ret = gpio_request(IMX_GPIO_NR(5, 29), "spi2_cs0");
-	if (!ret)
-		gpio_direction_output(IMX_GPIO_NR(5, 29), 1);
-
-	ret = gpio_request(IMX_GPIO_NR(7, 0), "spi2_#wp");
-	if (!ret)
-		gpio_direction_output(IMX_GPIO_NR(7, 0), 1);
-}
-
 /*
  * Do not overwrite the console
  * Always use serial for U-Boot console
@@ -188,7 +167,7 @@ int board_phy_config(struct phy_device *phydev)
 
 int board_init(void)
 {
-	struct gpio_desc phy_int_gbe;
+	struct gpio_desc phy_int_gbe, spi2_wp;
 	int ret;
 
 	debug("board init\n");
@@ -197,9 +176,6 @@ int board_init(void)
 
 	/* Setup iomux for non console UARTS */
 	displ5_set_iomux_uart();
-
-	displ5_setup_ecspi();
-
 	/* Setup misc (application specific) stuff */
 	SETUP_IOMUX_PADS(misc_pads);
 
@@ -229,6 +205,17 @@ int board_init(void)
 	iomuxc_set_rgmii_io_voltage(DDR_SEL_1P5V_IO);
 	enable_fec_anatop_clock(0, ENET_125MHZ);
 
+	/* Setup #WP for SPI-NOR memory */
+	ret = dm_gpio_lookup_name("GPIO7_0", &spi2_wp);
+	if (ret) {
+		printf("Cannot get GPIO7_0\n");
+	} else {
+		ret = dm_gpio_request(&spi2_wp, "spi2_#wp");
+		if (!ret)
+			dm_gpio_set_dir_flags(&spi2_wp, GPIOD_IS_OUT |
+					      GPIOD_IS_OUT_ACTIVE);
+	}
+
 	return 0;
 }
 
configs/display5_defconfig +3 -0
index 6c80a4d46678..3719eb40d5ea 100644
@@ -85,12 +85,15 @@ CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD_DEVICE=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_BUS=1
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=50000000
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MARVELL=y
 CONFIG_FEC_MXC=y
include/configs/display5.h +5 -2
index 15027f153341..a3cb62367c4c 100644
@@ -35,8 +35,11 @@
  * 0x1540000 - 0x1640000 : SPI.factory  (1MiB)
  */
 
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_SPI_FLASH_MTD
+/* SPI Flash Configs */
+#if defined(CONFIG_SPL_BUILD)
+#undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
+#undef CONFIG_SPI_FLASH_MTD
 #endif
 
 /* Below values are "dummy" - only to avoid build break */
Signature · 1 line
2.11.0
#8 lore raw

PATCH v2 8/14 ARM: display5: Remove UART initialization code after DM/DTS conversion (non-console)

In reply to Lukasz Majewski

This UART is not used in U-Boot, so there is no need to initialize it.

---

Changes in v2: None

 board/liebherr/display5/common.c   | 13 -------------
 board/liebherr/display5/common.h   |  1 -
 board/liebherr/display5/display5.c |  2 --
 3 files changed, 16 deletions(-)
board/liebherr/display5/common.c +0 -13
index d2d174beaa0d..5e714076a49c 100644
@@ -8,14 +8,6 @@
 #include <asm/arch/mx6-pins.h>
 #include "common.h"
 
-iomux_v3_cfg_t const uart_pads[] = {
-	/* UART4 */
-	MX6_PAD_CSI0_DAT12__UART4_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
-	MX6_PAD_CSI0_DAT13__UART4_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
-	MX6_PAD_CSI0_DAT16__UART4_RTS_B | MUX_PAD_CTRL(UART_PAD_CTRL),
-	MX6_PAD_CSI0_DAT17__UART4_CTS_B | MUX_PAD_CTRL(UART_PAD_CTRL),
-};
-
 iomux_v3_cfg_t const uart_console_pads[] = {
 	/* UART5 */
 	MX6_PAD_CSI0_DAT14__UART5_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
@@ -29,11 +21,6 @@ void displ5_set_iomux_uart_spl(void)
 	SETUP_IOMUX_PADS(uart_console_pads);
 }
 
-void displ5_set_iomux_uart(void)
-{
-	SETUP_IOMUX_PADS(uart_pads);
-}
-
 iomux_v3_cfg_t const misc_pads_spl[] = {
 	/* Emergency recovery pin */
 	MX6_PAD_EIM_D29__GPIO3_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL),
board/liebherr/display5/common.h +0 -1
index 2bbd934e7a70..4eb70dc42fb6 100644
@@ -32,7 +32,6 @@
 	PAD_CTL_SPEED_HIGH | PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
 
 void displ5_set_iomux_uart_spl(void);
-void displ5_set_iomux_uart(void);
 void displ5_set_iomux_ecspi_spl(void);
 void displ5_set_iomux_usdhc_spl(void);
 void displ5_set_iomux_misc_spl(void);
board/liebherr/display5/display5.c +0 -2
index 541e3e94a5eb..5713401ed954 100644
@@ -174,8 +174,6 @@ int board_init(void)
 	/* address of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-	/* Setup iomux for non console UARTS */
-	displ5_set_iomux_uart();
 	/* Setup misc (application specific) stuff */
 	SETUP_IOMUX_PADS(misc_pads);
 
Signature · 1 line
2.11.0
#9 lore raw

PATCH v2 9/14 DM: WDT: Convert WDT driver to use DM/DTS (including SYSRESET)

In reply to Lukasz Majewski

This commit enables support for CONFIG_WDT in the U-Boot proper. Moreover, the SYSRESET_WATCHDOG driver is used to support 'reset' command.

As SPL is not yet ready for DM conversion, the CONFIG_HW_WATCHDOG is enabled for it. This allows the legacy SPL code to work properly.

---

Changes in v2: None

 arch/arm/dts/imx6q-display5-u-boot.dtsi | 5 +++++
 configs/display5_defconfig              | 3 +++
 include/configs/display5.h              | 6 +++++-
 3 files changed, 13 insertions(+), 1 deletion(-)
arch/arm/dts/imx6q-display5-u-boot.dtsi +5 -0
index b942218b7ab8..aa660b5aeb65 100644
@@ -31,6 +31,11 @@
 	chosen {
 		stdout-path = &uart5;
 	};
+
+	wdt-reboot {
+		compatible = "wdt-reboot";
+		wdt = <&wdog1>;
+	};
 };
 
 &i2c3 {
configs/display5_defconfig +3 -0
index 3719eb40d5ea..a3062854d89c 100644
@@ -49,6 +49,7 @@ CONFIG_CMD_PART=y
 # CONFIG_CMD_PINMUX is not set
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
+CONFIG_CMD_WDT=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
@@ -107,5 +108,7 @@ CONFIG_DM_REGULATOR_PFUZE100=y
 CONFIG_MXC_UART=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_I2C_EDID=y
 CONFIG_IMX_WATCHDOG=y
include/configs/display5.h +5 -1
index a3cb62367c4c..e66bb65c21c6 100644
@@ -348,7 +348,11 @@
 
 /* Watchdog */
 #define CONFIG_WATCHDOG_TIMEOUT_MSECS   15000
-
+#if defined(CONFIG_SPL_BUILD)
+#undef CONFIG_WDT
+#undef CONFIG_WATCHDOG
+#define CONFIG_HW_WATCHDOG
+#endif
 /* ENV config */
 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_ENV_SIZE		(SZ_64K)
Signature · 1 line
2.11.0
#10 lore raw

PATCH v2 10/14 ARM: display5: Remove common.c file (after DM/DTS U-Boot proper conversion)

In reply to Lukasz Majewski

The common.c file content can be safely moved to spl.c file after performing the DM/DTS conversion for the U-Boot proper.

It contains the non DM/DTS setup code, which now is only used by SPL.

---

Changes in v2: None

 board/liebherr/display5/Makefile |  4 +-
 board/liebherr/display5/common.c | 83 ----------------------------------------
 board/liebherr/display5/common.h |  5 ---
 board/liebherr/display5/spl.c    | 74 +++++++++++++++++++++++++++++++++++
 4 files changed, 76 insertions(+), 90 deletions(-)
 delete mode 100644 board/liebherr/display5/common.c
board/liebherr/display5/Makefile +2 -2
index f934672428ab..ee503add75d3 100644
@@ -5,7 +5,7 @@
 # SPDX-License-Identifier:    GPL-2.0+
 #
 ifdef CONFIG_SPL_BUILD
-obj-y = common.o spl.o
+obj-y = spl.o
 else
-obj-y := common.o display5.o
+obj-y := display5.o
 endif
board/liebherr/display5/common.c deleted +0 -83

83 lines not on this page · raw message

board/liebherr/display5/common.h +0 -5
index 4eb70dc42fb6..44c7470074ce 100644
@@ -31,9 +31,4 @@
 #define ENET_PAD_CTRL_CLK  ((PAD_CTL_PUS_100K_UP & ~PAD_CTL_PKE) | \
 	PAD_CTL_SPEED_HIGH | PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
 
-void displ5_set_iomux_uart_spl(void);
-void displ5_set_iomux_ecspi_spl(void);
-void displ5_set_iomux_usdhc_spl(void);
-void displ5_set_iomux_misc_spl(void);
-
 #endif /* __DISPL5_COMMON_H_ */
board/liebherr/display5/spl.c +74 -0

80 lines not on this page · raw message

Signature · 1 line
2.11.0
#11 lore raw

PATCH v2 11/14 ARM: Update display5_factory_defconfig after switch to DM/DTS and uuu utility

In reply to Lukasz Majewski

This commit updates the display5_factory_defconfig file after the switch to DM/DTS for this board.

Moreover, the VID and PID for SPL running SDP gadget have been updated to allow seamless work with 'uuu' utility from NXP (the imx_usb doesn't work properly after embedding the u-boot proper into fitImage - problem with IVT embedding in FIT).

Example to use 'uuu' session:

cat << EOF > display5_recovery.lst
uuu_version 1.2.135
SDP: boot -f /srv/tftp/SPL
SDPU: write -f /srv/tftp/u-boot-dtb.img -addr 0x10000000
SDPU: jump -addr 0x10000000
SDPU: done
EOF

sudo ./uuu/uuu display5_recovery.lst

---

Changes in v2: None

 configs/display5_factory_defconfig | 41 ++++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)
configs/display5_factory_defconfig +37 -4
index c467e8c92890..b4b030a32b76 100644
@@ -4,13 +4,19 @@ CONFIG_SYS_TEXT_BASE=0x17800000
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x1000
+CONFIG_MX6_DDRCAL=y
 CONFIG_TARGET_DISPLAY5=y
+CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_SPL=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_SPL_TEXT_BASE=0x00908000
 CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
 CONFIG_BOOTDELAY=3
@@ -19,8 +25,6 @@ CONFIG_BOOTCOMMAND="echo SDP Display5 recovery"
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_MISC_INIT_R=y
 CONFIG_BOUNCE_BUFFER=y
-CONFIG_SPL_TEXT_BASE=0x00908000
-# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_SPL_I2C_SUPPORT=y
@@ -47,11 +51,14 @@ CONFIG_CMD_PART=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB_SDP=y
+CONFIG_CMD_WDT=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
@@ -67,26 +74,52 @@ CONFIG_DEFAULT_DEVICE_TREE="imx6q-display5"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_SF=y
+CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
+CONFIG_I2C_DEFAULT_BUS_NUMBER=0x2
+CONFIG_SYS_I2C_MXC=y
+CONFIG_SYS_I2C_MXC_I2C1=y
+CONFIG_SYS_I2C_MXC_I2C2=y
+CONFIG_SYS_I2C_MXC_I2C3=y
+CONFIG_MISC=y
+CONFIG_I2C_EEPROM=y
+CONFIG_SYS_I2C_EEPROM_ADDR=0x50
+CONFIG_SYS_I2C_EEPROM_BUS=2
+CONFIG_SYS_EEPROM_SIZE=32768
+CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS=5
+CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_FSL_USDHC=y
 CONFIG_MTD_DEVICE=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_BUS=1
 CONFIG_SF_DEFAULT_MODE=0
 CONFIG_SF_DEFAULT_SPEED=50000000
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_PHYLIB=y
+CONFIG_PHY_MARVELL=y
 CONFIG_FEC_MXC=y
 CONFIG_MII=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_PFUZE100=y
 CONFIG_MXC_UART=y
 CONFIG_SPI=y
 CONFIG_MXC_SPI=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Liebherr"
-CONFIG_USB_GADGET_VENDOR_NUM=0x1b67
-CONFIG_USB_GADGET_PRODUCT_NUM=0x4000
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
 CONFIG_CI_UDC=y
 CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_I2C_EDID=y
 CONFIG_IMX_WATCHDOG=y
+CONFIG_PANIC_HANG=y
Signature · 1 line
2.11.0
#12 lore raw

PATCH v2 12/14 cosmetic: Cleanup display5_defconfig with make savedefconfig

In reply to Lukasz Majewski

Fix the structure of configs/display5_defconfig file by using th make savedefconfig.

---

Changes in v2: None

 configs/display5_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/display5_defconfig +1 -1
index a3062854d89c..46bcdaffc835 100644
@@ -16,6 +16,7 @@ CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
 CONFIG_SYS_BOOTCOUNT_ADDR=0x020CC068
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_SPL_TEXT_BASE=0x00908000
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_OF_BOARD_SETUP=y
@@ -23,7 +24,6 @@ CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
 CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_MISC_INIT_R=y
 CONFIG_BOUNCE_BUFFER=y
-CONFIG_SPL_TEXT_BASE=0x00908000
 CONFIG_SPL_BOOTCOUNT_LIMIT=y
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_DMA_SUPPORT=y
Signature · 1 line
2.11.0
#13 lore raw

PATCH v2 13/14 imx: Convert emergency pad of display5 to use dm_gpio* functions

In reply to Lukasz Majewski

After this change the display5's emergency gpio use dm_gpio* functions instead of legacy ones (gpio*) to read its state.

---

Changes in v2: None

 board/liebherr/display5/display5.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
board/liebherr/display5/display5.c +7 -5
index 5713401ed954..b8dcd03fd9b6 100644
@@ -36,7 +36,6 @@ static bool sw_ids_valid;
 static u32 cpu_id;
 static u32 unit_id;
 
-#define EM_PAD IMX_GPIO_NR(3, 29)
 #define SW0	IMX_GPIO_NR(2, 4)
 #define SW1	IMX_GPIO_NR(2, 5)
 #define SW2	IMX_GPIO_NR(2, 6)
@@ -236,21 +235,24 @@ static inline void setup_boot_modes(void) {}
 
 int misc_init_r(void)
 {
+	struct gpio_desc em_pad;
 	int ret;
 
 	setup_boot_modes();
 
-	ret = gpio_request(EM_PAD, "Emergency_PAD");
+	ret = dm_gpio_lookup_name("GPIO3_29", &em_pad);
 	if (ret) {
-		printf("Can't request emergency PAD gpio\n");
+		printf("Can't find emergency PAD gpio\n");
 		return ret;
 	}
 
-	ret = gpio_direction_input(EM_PAD);
+	ret = dm_gpio_request(&em_pad, "Emergency_PAD");
 	if (ret) {
-		printf("Can't set emergency PAD direction\n");
+		printf("Can't request emergency PAD gpio\n");
 		return ret;
 	}
 
+	dm_gpio_set_dir_flags(&em_pad, GPIOD_IS_IN);
+
 	return 0;
 }
Signature · 1 line
2.11.0
#14 lore raw

PATCH v2 14/14 imx: Rewrite display5 get_board_id() function to use dm_gpio_* API

In reply to Lukasz Majewski

The get_board_id() function was using the old gpio_* compatibility layer to read HW and SW ID numbers encoded on the PCB board.

After this change the new dm_gpio* API is used for this purpose.

---

Changes in v2: None

 board/liebherr/display5/display5.c | 53 +++++++++++++++-----------------------
 1 file changed, 21 insertions(+), 32 deletions(-)
board/liebherr/display5/display5.c +21 -32
index b8dcd03fd9b6..85ca777c1d22 100644
@@ -36,60 +36,49 @@ static bool sw_ids_valid;
 static u32 cpu_id;
 static u32 unit_id;
 
-#define SW0	IMX_GPIO_NR(2, 4)
-#define SW1	IMX_GPIO_NR(2, 5)
-#define SW2	IMX_GPIO_NR(2, 6)
-#define SW3	IMX_GPIO_NR(2, 7)
-#define HW0	IMX_GPIO_NR(6, 7)
-#define HW1	IMX_GPIO_NR(6, 9)
-#define HW2	IMX_GPIO_NR(6, 10)
-#define HW3	IMX_GPIO_NR(6, 11)
-#define HW4	IMX_GPIO_NR(4, 7)
-#define HW5	IMX_GPIO_NR(4, 11)
-#define HW6	IMX_GPIO_NR(4, 13)
-#define HW7	IMX_GPIO_NR(4, 15)
-
-int gpio_table_sw_ids[] = {
-	SW0, SW1, SW2, SW3
+const char *gpio_table_sw_names[] = {
+	"GPIO2_4", "GPIO2_5", "GPIO2_6", "GPIO2_7"
 };
 
 const char *gpio_table_sw_ids_names[] = {
 	"sw0", "sw1", "sw2", "sw3"
 };
 
-int gpio_table_hw_ids[] = {
-	HW0, HW1, HW2, HW3, HW4, HW5, HW6, HW7
+const char *gpio_table_hw_names[] = {
+	"GPIO6_7", "GPIO6_9", "GPIO6_10", "GPIO6_11",
+	"GPIO4_7", "GPIO4_11", "GPIO4_13", "GPIO4_15"
 };
 
 const char *gpio_table_hw_ids_names[] = {
 	"hw0", "hw1", "hw2", "hw3", "hw4", "hw5", "hw6", "hw7"
 };
 
-static int get_board_id(int *ids, const char **c, int size,
-			bool *valid, u32 *id)
+static int get_board_id(const char **pin_names, const char **ids_names,
+			int size, bool *valid, u32 *id)
 {
+	struct gpio_desc desc;
 	int i, ret, val;
 
 	*valid = false;
 
 	for (i = 0; i < size; i++) {
-		ret = gpio_request(ids[i], c[i]);
+		memset(&desc, 0, sizeof(desc));
+
+		ret = dm_gpio_lookup_name(pin_names[i], &desc);
 		if (ret) {
-			printf("Can't request SWx gpios\n");
+			printf("Can't lookup request SWx gpios\n");
 			return ret;
 		}
-	}
 
-	for (i = 0; i < size; i++) {
-		ret = gpio_direction_input(ids[i]);
+		ret = dm_gpio_request(&desc, ids_names[i]);
 		if (ret) {
-			printf("Can't set SWx gpios direction\n");
+			printf("Can't lookup request SWx gpios\n");
 			return ret;
 		}
-	}
 
-	for (i = 0; i < size; i++) {
-		val = gpio_get_value(ids[i]);
+		dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN);
+
+		val = dm_gpio_get_value(&desc);
 		if (val < 0) {
 			printf("Can't get SW%d ID\n", i);
 			*id = 0;
@@ -176,12 +165,12 @@ int board_init(void)
 	/* Setup misc (application specific) stuff */
 	SETUP_IOMUX_PADS(misc_pads);
 
-	get_board_id(gpio_table_sw_ids, &gpio_table_sw_ids_names[0],
-		     ARRAY_SIZE(gpio_table_sw_ids), &sw_ids_valid, &unit_id);
+	get_board_id(gpio_table_sw_names, &gpio_table_sw_ids_names[0],
+		     ARRAY_SIZE(gpio_table_sw_names), &sw_ids_valid, &unit_id);
 	debug("SWx unit_id 0x%x\n", unit_id);
 
-	get_board_id(gpio_table_hw_ids, &gpio_table_hw_ids_names[0],
-		     ARRAY_SIZE(gpio_table_hw_ids), &hw_ids_valid, &cpu_id);
+	get_board_id(gpio_table_hw_names, &gpio_table_hw_ids_names[0],
+		     ARRAY_SIZE(gpio_table_hw_names), &hw_ids_valid, &cpu_id);
 	debug("HWx cpu_id 0x%x\n", cpu_id);
 
 	if (hw_ids_valid && sw_ids_valid)
Signature · 1 line
2.11.0