From 3d92f31762d8744e9b905b631dc267276adc50d4 Mon Sep 17 00:00:00 2001 From: Leo Ruan Date: Fri, 8 Feb 2019 10:51:35 +0100 Subject: [PATCH 01/11] splash: Use splashfile instead of location->name The splash image could be loaded from different sources (e.g. sf, mmc) with different formats (e.g. raw, file-system). These sources are structured by a board dependent object 'splash_location'. To decide where is the splash image loaded, following environment variables are used to select the splash source and file: - 'splashsource' is used to select the splash source by setting its value to specified name of splash location. - 'splashfile' specify the name of splash image file But, when loads the splash image from FIT, the name of splash image within FIT is specified by splash location name. Due to the splash location name is already used for the splash source, its name may conflicts with the name of splash image. To solve the conflict, the environment variable 'splashfile' is used to specify the splash image in FIT, and keeps the splash location name for the splash source. Signed-off-by: Leo Ruan Signed-off-by: Mark Jonas Reviewed-by: Simon Glass Reviewed-by: Stefano Babic Reviewed-by: Tomas Melin --- common/splash_source.c | 10 ++++++++-- doc/README.splashprepare | 9 ++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/common/splash_source.c b/common/splash_source.c index 62763b9ebd5..e1e73dbdc57 100644 --- a/common/splash_source.c +++ b/common/splash_source.c @@ -303,6 +303,7 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr) { int res; int node_offset; + const char *splash_file; int splash_offset; int splash_size; struct image_header *img_header; @@ -335,10 +336,15 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr) return -EINVAL; } - node_offset = fit_image_get_node(fit_header, location->name); + /* Get the splash image node */ + splash_file = env_get("splashfile"); + if (!splash_file) + splash_file = SPLASH_SOURCE_DEFAULT_FILE_NAME; + + node_offset = fit_image_get_node(fit_header, splash_file); if (node_offset < 0) { debug("Could not find splash image '%s' in FIT\n", - location->name); + splash_file); return -ENOENT; } diff --git a/doc/README.splashprepare b/doc/README.splashprepare index f1418de18b0..3cb5b5aeb48 100644 --- a/doc/README.splashprepare +++ b/doc/README.splashprepare @@ -26,6 +26,9 @@ screen data is loaded as a file. The name of the splash screen file can be controlled with the environment variable "splashfile". To enable loading the splash image from a FIT image, CONFIG_FIT must be -enabled. Struct splash_location field 'name' should match the splash image -name within the FIT and the FIT should start at the 'offset' field address in -the specified storage. +enabled. The FIT image has to start at the 'offset' field address in the +selected splash location. The name of splash image within the FIT shall be +specified by the environment variable "splashfile". + +In case the environment variable "splashfile" is not defined the default name +'splash.bmp' will be used. From d5006836912e69ef2a0620ecdf1311dcd113a7d2 Mon Sep 17 00:00:00 2001 From: Leo Ruan Date: Fri, 8 Feb 2019 10:51:36 +0100 Subject: [PATCH 02/11] splash: Load internal and external data from FIT The FIT image could contain the splash data in 3 different structure: - The splash data is embedded in FIT image (internal) In this case, the property 'data' presents in FIT image header. And internal information 'start' and 'end' represent the location and size of splash data inside of FIT image. - The splash data is external with absolute position in FIT image This case is made by 'mkimage -p [pos]'. The splash data is stored at the absolute position. Instead the property 'data', the properties 'data-position' and 'data-size' are used to specify the location and size of the splash data. - the splash data is external with relative offset in FIT image This case is made by 'mkimage -E'. The splash data is placed after the FIT image header with 4 byte alignment. Instead the property 'data', the properties 'data-offset' and 'data-size' are used to specify the location and size of the splash data. Currently, the splash only support to load external data with relative offset from FIT image. This commit make it possible to load the splash data embedded in FIT image or the external data with absolute position This inspiration comes from Simon Glass , see common/spl_fit.c Signed-off-by: Leo Ruan Signed-off-by: Mark Jonas Reviewed-by: Simon Glass Reviewed-by: Stefano Babic --- common/splash_source.c | 55 ++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/common/splash_source.c b/common/splash_source.c index e1e73dbdc57..8f276a34ca5 100644 --- a/common/splash_source.c +++ b/common/splash_source.c @@ -304,8 +304,11 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr) int res; int node_offset; const char *splash_file; - int splash_offset; - int splash_size; + const void *internal_splash_data; + size_t internal_splash_size; + int external_splash_addr; + int external_splash_size; + bool is_splash_external = false; struct image_header *img_header; const u32 *fit_header; u32 fit_size; @@ -348,29 +351,39 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr) return -ENOENT; } - res = fit_image_get_data_offset(fit_header, node_offset, - &splash_offset); - if (res < 0) { - printf("Failed to load splash image (err=%d)\n", res); - return res; + /* Extract the splash data from FIT */ + /* 1. Test if splash is in FIT internal data. */ + if (!fit_image_get_data(fit_header, node_offset, &internal_splash_data, &internal_splash_size)) + memmove((void *)bmp_load_addr, internal_splash_data, internal_splash_size); + /* 2. Test if splash is in FIT external data with fixed position. */ + else if (!fit_image_get_data_position(fit_header, node_offset, &external_splash_addr)) + is_splash_external = true; + /* 3. Test if splash is in FIT external data with offset. */ + else if (!fit_image_get_data_offset(fit_header, node_offset, &external_splash_addr)) { + /* Align data offset to 4-byte boundary */ + fit_size = ALIGN(fdt_totalsize(fit_header), 4); + /* External splash offset means the offset by end of FIT header */ + external_splash_addr += location->offset + fit_size; + is_splash_external = true; + } else { + printf("Failed to get splash image from FIT\n"); + return -ENODATA; } - res = fit_image_get_data_size(fit_header, node_offset, &splash_size); - if (res < 0) { - printf("Failed to load splash image (err=%d)\n", res); - return res; + if (is_splash_external) { + res = fit_image_get_data_size(fit_header, node_offset, &external_splash_size); + if (res < 0) { + printf("Failed to get size of splash image (err=%d)\n", res); + return res; + } + + /* Read in the splash data */ + location->offset = external_splash_addr; + res = splash_storage_read_raw(location, bmp_load_addr, external_splash_size); + if (res < 0) + return res; } - /* Align data offset to 4-byte boundrary */ - fit_size = fdt_totalsize(fit_header); - fit_size = (fit_size + 3) & ~3; - - /* Read in the splash data */ - location->offset = (location->offset + fit_size + splash_offset); - res = splash_storage_read_raw(location, bmp_load_addr , splash_size); - if (res < 0) - return res; - return 0; } #endif /* CONFIG_FIT */ From 08cc54f0719cccb27e18d4a09a64c52c84e1a72d Mon Sep 17 00:00:00 2001 From: Steffen Dirkwinkel Date: Wed, 17 Apr 2019 13:57:14 +0200 Subject: [PATCH 03/11] dm: arm: imx: cx9020: enable DM_GPIO 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 Signed-off-by: Steffen Dirkwinkel --- 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 90ea9a6b045..4f49fd20a28 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 01c9dd2127540f39ea9989b7cd7b0387cf40205c Mon Sep 17 00:00:00 2001 From: Steffen Dirkwinkel Date: Wed, 17 Apr 2019 13:57:15 +0200 Subject: [PATCH 04/11] dm: arm: imx: video: add compatible for imx53-ipu This code also works with imx53 ipus so we can enable it for them. Signed-off-by: Steffen Dirkwinkel --- 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 c11599b473e6d1debd591c631cf0c33bc7b73ed2 Mon Sep 17 00:00:00 2001 From: Steffen Dirkwinkel Date: Wed, 17 Apr 2019 13:57:16 +0200 Subject: [PATCH 05/11] arm: imx: add ipu to imx53.dts and set dm-pre-reloc 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 --- 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 5ba61747897..211ff5f69ef 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; @@ -51,6 +52,7 @@ compatible = "simple-bus"; interrupt-parent = <&tzic>; ranges; + u-boot,dm-pre-reloc; aips@50000000 { /* AIPS1 */ compatible = "fsl,aips-bus", "simple-bus"; @@ -283,5 +285,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 29771c2c396ec014ad43fe85dd21a0d39eda6776 Mon Sep 17 00:00:00 2001 From: Steffen Dirkwinkel Date: Wed, 17 Apr 2019 13:57:17 +0200 Subject: [PATCH 06/11] dm: arm: imx: cx9020: migrate to dm_video Enable DM_VIDEO in config and don't overwrite console so it can be set from environment Acked-by: Patrick Bruenn Signed-off-by: Steffen Dirkwinkel --- board/beckhoff/mx53cx9020/Makefile | 2 +- board/beckhoff/mx53cx9020/mx53cx9020.c | 11 ----- board/beckhoff/mx53cx9020/mx53cx9020_video.c | 51 +++++++++----------- configs/mx53cx9020_defconfig | 3 +- include/configs/mx53cx9020.h | 6 +-- 5 files changed, 27 insertions(+), 46 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 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 #include #include -#include -#include #include #include #include @@ -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 -#include -#include #include -#include -#include +#include +#include #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 4f49fd20a28..b809066fd08 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_DM_VIDEO=y CONFIG_VIDEO_IPUV3=y -CONFIG_VIDEO=y -# CONFIG_VIDEO_SW_CURSOR is not set diff --git a/include/configs/mx53cx9020.h b/include/configs/mx53cx9020.h index 9bf5d9169b4..ab61a07f963 100644 --- a/include/configs/mx53cx9020.h +++ b/include/configs/mx53cx9020.h @@ -159,11 +159,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 3a3eaa817e5748f2e7a944261a1872994ef0299e Mon Sep 17 00:00:00 2001 From: Steffen Dirkwinkel Date: Wed, 17 Apr 2019 13:57:18 +0200 Subject: [PATCH 07/11] dm: arm: imx: cx9020: remove unused mmc functions These mmc functions were not used anymore since DM_MMC was introduced. Acked-by: Patrick Bruenn Signed-off-by: Steffen Dirkwinkel --- 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 #include -#include #include #include #include @@ -20,11 +19,8 @@ #include #include #include -#include -#include #include #include -#include #include 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 e57eb2056577191879e31a5c6394594b6b59a8ec Mon Sep 17 00:00:00 2001 From: Steffen Dirkwinkel Date: Wed, 17 Apr 2019 13:57:19 +0200 Subject: [PATCH 08/11] arm: imx: cx9020: remove unnecessary includes There are several includes in mx53cx9020.c which are not required anymore. Acked-by: Patrick Bruenn Signed-off-by: Steffen Dirkwinkel --- 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 -#include -#include #include -#include #include #include -#include #include #include -#include -#include #include -#include -#include enum LED_GPIOS { GPIO_SD1_CD = IMX_GPIO_NR(1, 1), From 9002e735e71754a90adbb9676c0ffb1964dbc288 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 25 Apr 2019 02:36:22 +0000 Subject: [PATCH 09/11] imx: mx6sabresd: fix boot hang with video Meet the following boot hang. " U-Boot SPL 2019.04-00661-gdc80a012e4 (Apr 25 2019 - 10:31:57 +0800) Trying to boot from MMC1 U-Boot 2019.04-00661-gdc80a012e4 (Apr 25 2019 - 10:31:57 +0800) CPU: Freescale i.MX6Q rev1.5 996 MHz (running at 792 MHz) CPU: Automotive temperature grade (-40C to 125C)Reset cause: POR Model: Freescale i.MX6 Quad SABRE Smart Device Board Board: MX6-SabreSD I2C: ready DRAM: 1 GiB Video device 'ipu@2400000' cannot allocate frame buffer memory -ensure the device is set up before relocation Error binding driver 'ipuv3_video': -28 Video device 'ipu@2800000' cannot allocate frame buffer memory -ensure the device is set up before relocation Error binding driver 'ipuv3_video': -28 Some drivers failed to bind Error binding driver 'generic_simple_bus': -28 Some drivers failed to bind initcall sequence 4ffe4500 failed at call 1780dfb7 (err=-28) " 1. fdtdec_get_alias_seq will use "video" as base, however in alias node, we use ipux, so add new alias for U-Boot dts. 2. DM_VIDEO is enabled, however reserve_video is called before relocation, so to make DM_VIDEO work before relocation, need to set SYS_MALLOC_F_LEN 3. defconfig is updated with savedefconfig Note: I do not have a video panel to test, but with this patch, U-Boot boots up again, below log. " U-Boot SPL 2019.04-00662-g0b62453bff (Apr 25 2019 - 10:36:31 +0800) Trying to boot from MMC1 U-Boot 2019.04-00662-g0b62453bff (Apr 25 2019 - 10:36:31 +0800) CPU: Freescale i.MX6Q rev1.5 996 MHz (running at 792 MHz) CPU: Automotive temperature grade (-40C to 125C) at 34C Reset cause: POR Model: Freescale i.MX6 Quad SABRE Smart Device Board Board: MX6-SabreSD I2C: ready DRAM: 1 GiB PMIC: PFUZE100 ID=0x10 MMC: FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 3 Loading Environment from MMC... *** Warning - bad CRC, using default environment PCI: pcie phy link never came up In: serial Out: serial Err: serial Net: FEC [PRIME] Hit any key to stop autoboot: 0 " Signed-off-by: Peng Fan Reviewed-by: Anatolij Gustschin --- arch/arm/dts/imx6q.dtsi | 1 + arch/arm/dts/imx6qdl.dtsi | 1 + configs/mx6sabresd_defconfig | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/dts/imx6q.dtsi b/arch/arm/dts/imx6q.dtsi index d038f411702..71543a4a684 100644 --- a/arch/arm/dts/imx6q.dtsi +++ b/arch/arm/dts/imx6q.dtsi @@ -9,6 +9,7 @@ / { aliases { ipu1 = &ipu2; + video1 = &ipu2; spi4 = &ecspi5; }; diff --git a/arch/arm/dts/imx6qdl.dtsi b/arch/arm/dts/imx6qdl.dtsi index c0a94780087..83eeb5cc591 100644 --- a/arch/arm/dts/imx6qdl.dtsi +++ b/arch/arm/dts/imx6qdl.dtsi @@ -33,6 +33,7 @@ i2c1 = &i2c2; i2c2 = &i2c3; ipu0 = &ipu1; + video0 = &ipu1; mmc0 = &usdhc1; mmc1 = &usdhc2; mmc2 = &usdhc3; diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig index d3ed3c45430..0fda6fc3946 100644 --- a/configs/mx6sabresd_defconfig +++ b/configs/mx6sabresd_defconfig @@ -4,13 +4,13 @@ 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=0x4000 CONFIG_TARGET_MX6SABRESD=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_NR_DRAM_BANKS=1 CONFIG_SPL=y CONFIG_SPL_LIBDISK_SUPPORT=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT=y CONFIG_SPL_FIT_PRINT=y CONFIG_SPL_LOAD_FIT=y @@ -63,6 +63,7 @@ CONFIG_OF_LIST="imx6q-sabresd imx6qp-sabresd imx6dl-sabresd" CONFIG_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_SPL_OF_LIST="imx6dl-sabresd imx6q-sabresd imx6qp-sabresd" +CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_SPL_DM=y From b5e1a82e924d18d4134757e39a1f26e473f80e0b Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 6 May 2019 01:11:32 +0200 Subject: [PATCH 10/11] video: ipuv3: Set max display bpp to 32 The IPUv3 can handle 1920x1080x32bpp displays , set the max preallocated framebuffer BPP to 32 to cater for all eventualities. Signed-off-by: Marek Vasut Cc: Anatolij Gustschin --- drivers/video/imx/mxc_ipuv3_fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/imx/mxc_ipuv3_fb.c b/drivers/video/imx/mxc_ipuv3_fb.c index 1aca9eba228..29ecac40a29 100644 --- a/drivers/video/imx/mxc_ipuv3_fb.c +++ b/drivers/video/imx/mxc_ipuv3_fb.c @@ -678,7 +678,7 @@ static int ipuv3_video_bind(struct udevice *dev) struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT * - (1 << LCD_MAX_LOG2_BPP) / 8; + (1 << VIDEO_BPP32) / 8; return 0; } From e63168a9ffae18f807f59925bb5d9d4623633e46 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 17 May 2019 20:22:31 +0200 Subject: [PATCH 11/11] video: Factor out vidconsole_put_string() Pull the vidconsole_put_string() function from DM tests, make it available to e.g. boards that want to display information on the LCD on boot. Signed-off-by: Marek Vasut Cc: Anatolij Gustschin Reviewed-by: Anatolij Gustschin --- drivers/video/vidconsole-uclass.c | 17 +++++++++++++++-- include/video_console.h | 16 ++++++++++++++++ test/dm/video.c | 8 -------- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index c31303b56ed..af885889044 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -529,6 +529,20 @@ int vidconsole_put_char(struct udevice *dev, char ch) return 0; } +int vidconsole_put_string(struct udevice *dev, const char *str) +{ + const char *s; + int ret; + + for (s = str; *s; s++) { + ret = vidconsole_put_char(dev, *s); + if (ret) + return ret; + } + + return 0; +} + static void vidconsole_putc(struct stdio_dev *sdev, const char ch) { struct udevice *dev = sdev->priv; @@ -541,8 +555,7 @@ static void vidconsole_puts(struct stdio_dev *sdev, const char *s) { struct udevice *dev = sdev->priv; - while (*s) - vidconsole_put_char(dev, *s++); + vidconsole_put_string(dev, s); video_sync(dev->parent, false); } diff --git a/include/video_console.h b/include/video_console.h index 52a41ac2007..0936ceaaf1c 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -214,6 +214,22 @@ int vidconsole_set_row(struct udevice *dev, uint row, int clr); */ int vidconsole_put_char(struct udevice *dev, char ch); +/** + * vidconsole_put_string() - Output a string to the current console position + * + * Outputs a string to the console and advances the cursor. This function + * handles wrapping to new lines and scrolling the console. Special + * characters are handled also: \n, \r, \b and \t. + * + * The device always starts with the cursor at position 0,0 (top left). It + * can be adjusted manually using vidconsole_position_cursor(). + * + * @dev: Device to adjust + * @str: String to write + * @return 0 if OK, -ve on error + */ +int vidconsole_put_string(struct udevice *dev, const char *str); + /** * vidconsole_position_cursor() - Move the text cursor * diff --git a/test/dm/video.c b/test/dm/video.c index 6be5defc53c..3151ebb73fc 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -97,14 +97,6 @@ static int select_vidconsole(struct unit_test_state *uts, const char *drv_name) return 0; } -static void vidconsole_put_string(struct udevice *dev, const char *str) -{ - const char *s; - - for (s = str; *s; s++) - vidconsole_put_char(dev, *s); -} - /* Test text output works on the video console */ static int dm_test_video_text(struct unit_test_state *uts) {