[U-Boot] [PATCH v1 0/6] arm: imx: cx9020: Migrate to DM_VIDEO and DM_GPIO

From: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com
This series migrates mx53cx9020 to DM_VIDEO and DM_GPIO. The first patch allows the board to boot again by enabling DM_GPIO. This was broken due to card detect not working with a combination of previous commits. Patches 2-4 add ipu device tree nodes for mx53, enable them in the video driver and migrate the board to using DM_VIDEO. The last patches remove functions which were used before DM_MMC and uneccessary includes.
Steffen Dirkwinkel (6): dm: arm: imx: cx9020: enable DM_GPIO dm: arm: imx: video: add compatible for imx53-ipu arm: imx: add ipu to imx53.dts and set dm-pre-reloc dm: arm: imx: cx9020: migrate to dm_video dm: arm: imx: cx9020: remove unused mmc functions arm: imx: cx9020: remove unnecessary includes
arch/arm/dts/imx53.dtsi | 137 +++++++++++++++++++ board/beckhoff/mx53cx9020/Makefile | 2 +- board/beckhoff/mx53cx9020/mx53cx9020.c | 95 +++---------- board/beckhoff/mx53cx9020/mx53cx9020_video.c | 52 ++++--- configs/mx53cx9020_defconfig | 7 +- drivers/video/imx/mxc_ipuv3_fb.c | 1 + include/configs/mx53cx9020.h | 6 +- 7 files changed, 188 insertions(+), 112 deletions(-)

From: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com
Switch to DM_GPIO and add gpio_request where necessary. This is needed for DM_VIDEO and fixes an issue with sd card detection which was introduced by the combination of these commits:
commit 7a0425dd969c ("mmc: fsl_esdhc: make get_cd work well in dm_mmc_ops") commit 7e04b4c751a1 ("dm: arm: imx: migrate cx9020 to CONFIG_DM_MMC")
Acked-by: Patrick Bruenn p.bruenn@beckhoff.com Signed-off-by: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com ---
board/beckhoff/mx53cx9020/mx53cx9020.c | 25 ++++++++++++++++---- board/beckhoff/mx53cx9020/mx53cx9020_video.c | 1 + configs/mx53cx9020_defconfig | 2 ++ 3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/board/beckhoff/mx53cx9020/mx53cx9020.c b/board/beckhoff/mx53cx9020/mx53cx9020.c index 79d8a62cf1b..79ea4560283 100644 --- a/board/beckhoff/mx53cx9020/mx53cx9020.c +++ b/board/beckhoff/mx53cx9020/mx53cx9020.c @@ -91,6 +91,9 @@ void weim_cs0_settings(u32 mode)
static void setup_gpio_eim(void) { + gpio_request(GPIO_C3_STATUS, "GPIO_C3_STATUS"); + gpio_request(GPIO_C3_DONE, "GPIO_C3_DONE"); + gpio_request(GPIO_C3_CONFIG, "GPIO_C3_CONFIG"); gpio_direction_input(GPIO_C3_STATUS); gpio_direction_input(GPIO_C3_DONE); gpio_direction_output(GPIO_C3_CONFIG, 1); @@ -100,6 +103,7 @@ static void setup_gpio_eim(void)
static void setup_gpio_sups(void) { + gpio_request(GPIO_SUPS_INT, "GPIO_SUPS_INT"); gpio_direction_input(GPIO_SUPS_INT);
static const int BLINK_INTERVALL = 50000; @@ -116,6 +120,16 @@ static void setup_gpio_sups(void)
static void setup_gpio_leds(void) { + gpio_request(GPIO_LED_SD2_R, "GPIO_LED_SD2_R"); + gpio_request(GPIO_LED_SD2_B, "GPIO_LED_SD2_B"); + gpio_request(GPIO_LED_SD2_G, "GPIO_LED_SD2_G"); + gpio_request(GPIO_LED_SD1_R, "GPIO_LED_SD1_R"); + gpio_request(GPIO_LED_SD1_B, "GPIO_LED_SD1_B"); + gpio_request(GPIO_LED_SD1_G, "GPIO_LED_SD1_G"); + gpio_request(GPIO_LED_PWR_R, "GPIO_LED_PWR_R"); + gpio_request(GPIO_LED_PWR_B, "GPIO_LED_PWR_B"); + gpio_request(GPIO_LED_PWR_G, "GPIO_LED_PWR_G"); + gpio_direction_output(GPIO_LED_SD2_R, 0); gpio_direction_output(GPIO_LED_SD2_B, 0); gpio_direction_output(GPIO_LED_SD2_G, 0); @@ -147,6 +161,8 @@ int board_mmc_getcd(struct mmc *mmc) struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; int ret;
+ gpio_request(GPIO_SD1_CD, "GPIO_SD1_CD"); + gpio_request(GPIO_SD2_CD, "GPIO_SD2_CD"); gpio_direction_input(GPIO_SD1_CD); gpio_direction_input(GPIO_SD2_CD);
@@ -212,10 +228,6 @@ static void clock_1GHz(void)
int board_early_init_f(void) { - setup_gpio_leds(); - setup_gpio_sups(); - setup_gpio_eim(); - setup_iomux_lcd();
return 0; } @@ -235,6 +247,11 @@ int board_init(void)
mxc_set_sata_internal_clock();
+ setup_gpio_leds(); + setup_gpio_sups(); + setup_gpio_eim(); + setup_iomux_lcd(); + return 0; }
diff --git a/board/beckhoff/mx53cx9020/mx53cx9020_video.c b/board/beckhoff/mx53cx9020/mx53cx9020_video.c index 4055bccc2b7..85f1cdae8af 100644 --- a/board/beckhoff/mx53cx9020/mx53cx9020_video.c +++ b/board/beckhoff/mx53cx9020/mx53cx9020_video.c @@ -36,6 +36,7 @@ void setup_iomux_lcd(void) { /* Turn on DVI_PWD */ imx_iomux_v3_setup_pad(MX53_PAD_CSI0_DAT15__GPIO6_1); + gpio_request(CX9020_DVI_PWD, "CX9020_DVI_PWD"); gpio_direction_output(CX9020_DVI_PWD, 1); }
diff --git a/configs/mx53cx9020_defconfig b/configs/mx53cx9020_defconfig index 831d50925f3..93c113aba73 100644 --- a/configs/mx53cx9020_defconfig +++ b/configs/mx53cx9020_defconfig @@ -24,7 +24,9 @@ CONFIG_DEFAULT_DEVICE_TREE="imx53-cx9020" CONFIG_ENV_IS_IN_MMC=y CONFIG_FPGA_ALTERA=y CONFIG_FPGA_CYCLON2=y +CONFIG_DM=y CONFIG_DM_MMC=y +CONFIG_DM_GPIO=y CONFIG_FSL_ESDHC=y CONFIG_FEC_MXC=y CONFIG_MII=y

From: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com
This code also works with imx53 ipus so we can enable it for them.
Signed-off-by: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com ---
drivers/video/imx/mxc_ipuv3_fb.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/video/imx/mxc_ipuv3_fb.c b/drivers/video/imx/mxc_ipuv3_fb.c index 3e38d4bdcc3..1aca9eba228 100644 --- a/drivers/video/imx/mxc_ipuv3_fb.c +++ b/drivers/video/imx/mxc_ipuv3_fb.c @@ -685,6 +685,7 @@ static int ipuv3_video_bind(struct udevice *dev)
static const struct udevice_id ipuv3_video_ids[] = { { .compatible = "fsl,imx6q-ipu" }, + { .compatible = "fsl,imx53-ipu" }, { } };

From: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com
The ipu node in imx53 is needed for DM_VIDEO. We also need to set u-boot,dm-pre-reloc to initialize before relocation.
Signed-off-by: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com ---
arch/arm/dts/imx53.dtsi | 137 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+)
diff --git a/arch/arm/dts/imx53.dtsi b/arch/arm/dts/imx53.dtsi index 0fd4acc6f53..7a47602b53d 100644 --- a/arch/arm/dts/imx53.dtsi +++ b/arch/arm/dts/imx53.dtsi @@ -31,6 +31,7 @@ i2c0 = &i2c1; i2c1 = &i2c2; i2c2 = &i2c3; + ipu0 = &ipu; mmc0 = &esdhc1; mmc1 = &esdhc2; mmc2 = &esdhc3; @@ -50,6 +51,7 @@ compatible = "simple-bus"; interrupt-parent = <&tzic>; ranges; + u-boot,dm-pre-reloc;
aips@50000000 { /* AIPS1 */ compatible = "fsl,aips-bus", "simple-bus"; @@ -273,5 +275,140 @@ status = "disabled"; }; }; + + ipu: ipu@18000000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,imx53-ipu"; + reg = <0x18000000 0x08000000>; + interrupts = <11 10>; + clocks = <&clks IMX5_CLK_IPU_GATE>, + <&clks IMX5_CLK_IPU_DI0_GATE>, + <&clks IMX5_CLK_IPU_DI1_GATE>; + clock-names = "bus", "di0", "di1"; + resets = <&src 2>; + u-boot,dm-pre-reloc; + + ipu_csi0: port@0 { + reg = <0>; + }; + + ipu_csi1: port@1 { + reg = <1>; + }; + + ipu_di0: port@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + + ipu_di0_disp0: endpoint@0 { + reg = <0>; + }; + + ipu_di0_lvds0: endpoint@1 { + reg = <1>; + remote-endpoint = <&lvds0_in>; + }; + }; + + ipu_di1: port@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + ipu_di1_disp1: endpoint@0 { + reg = <0>; + }; + + ipu_di1_lvds1: endpoint@1 { + reg = <1>; + remote-endpoint = <&lvds1_in>; + }; + + ipu_di1_tve: endpoint@2 { + reg = <2>; + remote-endpoint = <&tve_in>; + }; + }; + }; + + tve: tve@63ff0000 { + compatible = "fsl,imx53-tve"; + reg = <0x63ff0000 0x1000>; + interrupts = <92>; + clocks = <&clks IMX5_CLK_TVE_GATE>, + <&clks IMX5_CLK_IPU_DI1_SEL>; + clock-names = "tve", "di_sel"; + status = "disabled"; + + port { + tve_in: endpoint { + remote-endpoint = <&ipu_di1_tve>; + }; + }; + }; + + src: src@53fd0000 { + compatible = "fsl,imx53-src", "fsl,imx51-src"; + reg = <0x53fd0000 0x4000>; + #reset-cells = <1>; + }; + + ldb: ldb@53fa8008 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,imx53-ldb"; + reg = <0x53fa8008 0x4>; + gpr = <&gpr>; + clocks = <&clks IMX5_CLK_LDB_DI0_SEL>, + <&clks IMX5_CLK_LDB_DI1_SEL>, + <&clks IMX5_CLK_IPU_DI0_SEL>, + <&clks IMX5_CLK_IPU_DI1_SEL>, + <&clks IMX5_CLK_LDB_DI0_GATE>, + <&clks IMX5_CLK_LDB_DI1_GATE>; + clock-names = "di0_pll", "di1_pll", + "di0_sel", "di1_sel", + "di0", "di1"; + status = "disabled"; + + lvds-channel@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + status = "disabled"; + + port@0 { + reg = <0>; + + lvds0_in: endpoint { + remote-endpoint = <&ipu_di0_lvds0>; + }; + }; + + port@2 { + reg = <2>; + }; + }; + + lvds-channel@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + status = "disabled"; + + port@1 { + reg = <1>; + + lvds1_in: endpoint { + remote-endpoint = <&ipu_di1_lvds1>; + }; + }; + + port@2 { + reg = <2>; + }; + }; + }; }; };

From: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com
Enable DM_VIDEO in config and don't overwrite console so it can be set from environment
Acked-by: Patrick Bruenn p.bruenn@beckhoff.com Signed-off-by: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com ---
board/beckhoff/mx53cx9020/Makefile | 2 +- board/beckhoff/mx53cx9020/mx53cx9020.c | 11 ----- board/beckhoff/mx53cx9020/mx53cx9020_video.c | 51 +++++++++----------- configs/mx53cx9020_defconfig | 5 +- include/configs/mx53cx9020.h | 6 +-- 5 files changed, 28 insertions(+), 47 deletions(-)
diff --git a/board/beckhoff/mx53cx9020/Makefile b/board/beckhoff/mx53cx9020/Makefile index 423a5532ca6..7f15fc5746d 100644 --- a/board/beckhoff/mx53cx9020/Makefile +++ b/board/beckhoff/mx53cx9020/Makefile @@ -4,4 +4,4 @@ # Patrick Bruenn p.bruenn@beckhoff.com
obj-y += mx53cx9020.o -obj-$(CONFIG_VIDEO) += mx53cx9020_video.o +obj-$(CONFIG_DM_VIDEO) += mx53cx9020_video.o diff --git a/board/beckhoff/mx53cx9020/mx53cx9020.c b/board/beckhoff/mx53cx9020/mx53cx9020.c index 79ea4560283..fdef4477d9a 100644 --- a/board/beckhoff/mx53cx9020/mx53cx9020.c +++ b/board/beckhoff/mx53cx9020/mx53cx9020.c @@ -23,8 +23,6 @@ #include <mmc.h> #include <fsl_esdhc.h> #include <asm/gpio.h> -#include <linux/fb.h> -#include <ipu_pixfmt.h> #include <input.h> #include <fs.h> #include <dm/platform_data/serial_mxc.h> @@ -232,15 +230,6 @@ int board_early_init_f(void) return 0; }
-/* - * Do not overwrite the console - * Use always serial for U-Boot console - */ -int overwrite_console(void) -{ - return 1; -} - int board_init(void) { gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; diff --git a/board/beckhoff/mx53cx9020/mx53cx9020_video.c b/board/beckhoff/mx53cx9020/mx53cx9020_video.c index 85f1cdae8af..bf472902562 100644 --- a/board/beckhoff/mx53cx9020/mx53cx9020_video.c +++ b/board/beckhoff/mx53cx9020/mx53cx9020_video.c @@ -8,29 +8,34 @@ */
#include <common.h> -#include <linux/list.h> -#include <asm/gpio.h> #include <asm/arch/iomux-mx53.h> -#include <linux/fb.h> -#include <ipu_pixfmt.h> +#include <asm/gpio.h> +#include <asm/mach-imx/video.h>
#define CX9020_DVI_PWD IMX_GPIO_NR(6, 1)
-static struct fb_videomode const vga_640x480 = { - .name = "VESA_VGA_640x480", - .refresh = 60, - .xres = 640, - .yres = 480, - .pixclock = 39721, /* picosecond (25.175 MHz) */ - .left_margin = 40, - .right_margin = 60, - .upper_margin = 10, - .lower_margin = 10, - .hsync_len = 20, - .vsync_len = 10, - .sync = 0, - .vmode = FB_VMODE_NONINTERLACED -}; +struct display_info_t const displays[] = {{ + .bus = -1, + .addr = 0, + .pixfmt = IPU_PIX_FMT_RGB24, + .detect = NULL, + .enable = NULL, + .mode = { + .name = "DVI", + .refresh = 60, + .xres = 640, + .yres = 480, + .pixclock = 39721, /* picosecond (25.175 MHz) */ + .left_margin = 40, + .right_margin = 60, + .upper_margin = 10, + .lower_margin = 10, + .hsync_len = 20, + .vsync_len = 10, + .sync = 0, + .vmode = FB_VMODE_NONINTERLACED +} } }; +size_t display_count = ARRAY_SIZE(displays);
void setup_iomux_lcd(void) { @@ -39,11 +44,3 @@ void setup_iomux_lcd(void) gpio_request(CX9020_DVI_PWD, "CX9020_DVI_PWD"); gpio_direction_output(CX9020_DVI_PWD, 1); } - -int board_video_skip(void) -{ - const int ret = ipuv3_fb_init(&vga_640x480, 0, IPU_PIX_FMT_RGB24); - if (ret) - printf("VESA VG 640x480 cannot be configured: %d\n", ret); - return ret; -} diff --git a/configs/mx53cx9020_defconfig b/configs/mx53cx9020_defconfig index 93c113aba73..11b414f790e 100644 --- a/configs/mx53cx9020_defconfig +++ b/configs/mx53cx9020_defconfig @@ -33,6 +33,5 @@ CONFIG_MII=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX5=y CONFIG_MXC_UART=y -CONFIG_VIDEO=y -CONFIG_VIDEO_IPUV3=y -# CONFIG_VIDEO_SW_CURSOR is not set +CONFIG_DM_VIDEO=y +CONFIG_VIDEO_IPUV3=y \ No newline at end of file diff --git a/include/configs/mx53cx9020.h b/include/configs/mx53cx9020.h index 1e3ea88b77a..66a0f319c45 100644 --- a/include/configs/mx53cx9020.h +++ b/include/configs/mx53cx9020.h @@ -160,11 +160,7 @@ #define CONFIG_SYS_MMC_ENV_DEV 0
/* Framebuffer and LCD */ +#define CONFIG_IMX_VIDEO_SKIP #define CONFIG_PREBOOT -#define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE -#define CONFIG_VIDEO_BMP_RLE8 -#define CONFIG_SPLASH_SCREEN -#define CONFIG_BMP_16BPP -#define CONFIG_VIDEO_LOGO
#endif /* __CONFIG_H */

From: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com
These mmc functions were not used anymore since DM_MMC was introduced.
Acked-by: Patrick Bruenn p.bruenn@beckhoff.com Signed-off-by: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com ---
board/beckhoff/mx53cx9020/mx53cx9020.c | 55 -------------------------- 1 file changed, 55 deletions(-)
diff --git a/board/beckhoff/mx53cx9020/mx53cx9020.c b/board/beckhoff/mx53cx9020/mx53cx9020.c index fdef4477d9a..de1d85f1518 100644 --- a/board/beckhoff/mx53cx9020/mx53cx9020.c +++ b/board/beckhoff/mx53cx9020/mx53cx9020.c @@ -9,7 +9,6 @@
#include <common.h> #include <dm.h> -#include <asm/io.h> #include <asm/arch/imx-regs.h> #include <asm/arch/sys_proto.h> #include <asm/arch/crm_regs.h> @@ -20,11 +19,8 @@ #include <ACEX1K.h> #include <netdev.h> #include <i2c.h> -#include <mmc.h> -#include <fsl_esdhc.h> #include <asm/gpio.h> #include <input.h> -#include <fs.h> #include <dm/platform_data/serial_mxc.h>
enum LED_GPIOS { @@ -148,57 +144,6 @@ int board_ehci_hcd_init(int port) } #endif
-#ifdef CONFIG_FSL_ESDHC -struct fsl_esdhc_cfg esdhc_cfg[2] = { - {MMC_SDHC1_BASE_ADDR}, - {MMC_SDHC2_BASE_ADDR}, -}; - -int board_mmc_getcd(struct mmc *mmc) -{ - struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; - int ret; - - gpio_request(GPIO_SD1_CD, "GPIO_SD1_CD"); - gpio_request(GPIO_SD2_CD, "GPIO_SD2_CD"); - gpio_direction_input(GPIO_SD1_CD); - gpio_direction_input(GPIO_SD2_CD); - - if (cfg->esdhc_base == MMC_SDHC1_BASE_ADDR) - ret = !gpio_get_value(GPIO_SD1_CD); - else - ret = !gpio_get_value(GPIO_SD2_CD); - - return ret; -} - -int board_mmc_init(bd_t *bis) -{ - u32 index; - int ret; - - esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK); - esdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); - - for (index = 0; index < CONFIG_SYS_FSL_ESDHC_NUM; index++) { - switch (index) { - case 0: - break; - case 1: - break; - default: - printf("Warning: you configured more ESDHC controller(%d) as supported by the board(2)\n", - CONFIG_SYS_FSL_ESDHC_NUM); - return -EINVAL; - } - ret = fsl_esdhc_initialize(bis, &esdhc_cfg[index]); - if (ret) - return ret; - } - - return 0; -} -#endif
static int power_init(void) {

From: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com
There are several includes in mx53cx9020.c which are not required anymore.
Acked-by: Patrick Bruenn p.bruenn@beckhoff.com Signed-off-by: Steffen Dirkwinkel s.dirkwinkel@beckhoff.com ---
board/beckhoff/mx53cx9020/mx53cx9020.c | 8 -------- 1 file changed, 8 deletions(-)
diff --git a/board/beckhoff/mx53cx9020/mx53cx9020.c b/board/beckhoff/mx53cx9020/mx53cx9020.c index de1d85f1518..9450d925f6f 100644 --- a/board/beckhoff/mx53cx9020/mx53cx9020.c +++ b/board/beckhoff/mx53cx9020/mx53cx9020.c @@ -8,20 +8,12 @@ */
#include <common.h> -#include <dm.h> -#include <asm/arch/imx-regs.h> #include <asm/arch/sys_proto.h> -#include <asm/arch/crm_regs.h> #include <asm/arch/clock.h> #include <asm/arch/iomux-mx53.h> -#include <asm/arch/clock.h> #include <asm/mach-imx/mx5_video.h> #include <ACEX1K.h> -#include <netdev.h> -#include <i2c.h> #include <asm/gpio.h> -#include <input.h> -#include <dm/platform_data/serial_mxc.h>
enum LED_GPIOS { GPIO_SD1_CD = IMX_GPIO_NR(1, 1),

On Wed, 17 Apr 2019 13:57:13 +0200 linux-kernel-dev@beckhoff.com linux-kernel-dev@beckhoff.com wrote: ...
Steffen Dirkwinkel (6): dm: arm: imx: cx9020: enable DM_GPIO dm: arm: imx: video: add compatible for imx53-ipu arm: imx: add ipu to imx53.dts and set dm-pre-reloc dm: arm: imx: cx9020: migrate to dm_video dm: arm: imx: cx9020: remove unused mmc functions arm: imx: cx9020: remove unnecessary includes
arch/arm/dts/imx53.dtsi | 137 +++++++++++++++++++ board/beckhoff/mx53cx9020/Makefile | 2 +- board/beckhoff/mx53cx9020/mx53cx9020.c | 95 +++---------- board/beckhoff/mx53cx9020/mx53cx9020_video.c | 52 ++++--- configs/mx53cx9020_defconfig | 7 +- drivers/video/imx/mxc_ipuv3_fb.c | 1 + include/configs/mx53cx9020.h | 6 +- 7 files changed, 188 insertions(+), 112 deletions(-)
Applied to u-boot-video/master, thanks!
-- Anatolij
participants (2)
-
Anatolij Gustschin
-
linux-kernel-dev@beckhoff.com