From 08cc54f0719cccb27e18d4a09a64c52c84e1a72d Mon Sep 17 00:00:00 2001 From: Steffen Dirkwinkel Date: Wed, 17 Apr 2019 13:57:14 +0200 Subject: 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 + 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'board/beckhoff') diff --git a/board/beckhoff/mx53cx9020/mx53cx9020.c b/board/beckhoff/mx53cx9020/mx53cx9020.c index 79d8a62cf1..79ea456028 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 4055bccc2b..85f1cdae8a 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); } -- cgit From 29771c2c396ec014ad43fe85dd21a0d39eda6776 Mon Sep 17 00:00:00 2001 From: Steffen Dirkwinkel Date: Wed, 17 Apr 2019 13:57:17 +0200 Subject: 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 +++++++++++++--------------- 3 files changed, 25 insertions(+), 39 deletions(-) (limited to 'board/beckhoff') diff --git a/board/beckhoff/mx53cx9020/Makefile b/board/beckhoff/mx53cx9020/Makefile index 423a5532ca..7f15fc5746 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 79ea456028..fdef4477d9 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 85f1cdae8a..bf47290256 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; -} -- cgit From 3a3eaa817e5748f2e7a944261a1872994ef0299e Mon Sep 17 00:00:00 2001 From: Steffen Dirkwinkel Date: Wed, 17 Apr 2019 13:57:18 +0200 Subject: 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(-) (limited to 'board/beckhoff') diff --git a/board/beckhoff/mx53cx9020/mx53cx9020.c b/board/beckhoff/mx53cx9020/mx53cx9020.c index fdef4477d9..de1d85f151 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) { -- cgit From e57eb2056577191879e31a5c6394594b6b59a8ec Mon Sep 17 00:00:00 2001 From: Steffen Dirkwinkel Date: Wed, 17 Apr 2019 13:57:19 +0200 Subject: 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(-) (limited to 'board/beckhoff') diff --git a/board/beckhoff/mx53cx9020/mx53cx9020.c b/board/beckhoff/mx53cx9020/mx53cx9020.c index de1d85f151..9450d925f6 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), -- cgit