arm: imx: cx9020: Migrate to DM_VIDEO and DM_GPIO
Subsystems (3)
cover arm: imx: cx9020: Migrate to DM_VIDEO and DM_GPIO
From: Steffen Dirkwinkel <[email protected]>
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(-)
Signature · 1 line
2.21.0
PATCH 1/6 dm: arm: imx: cx9020: enable DM_GPIO
From: Steffen Dirkwinkel <[email protected]>
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")
---
board/beckhoff/mx53cx9020/mx53cx9020.c | 25 ++++++++++++++++---- board/beckhoff/mx53cx9020/mx53cx9020_video.c | 1 + configs/mx53cx9020_defconfig | 2 ++ 3 files changed, 24 insertions(+), 4 deletions(-)
board/beckhoff/mx53cx9020/mx53cx9020.c +21 -4
@@ -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 ; }
board/beckhoff/mx53cx9020/mx53cx9020_video.c +1 -0
@@ -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 ); }
configs/mx53cx9020_defconfig +2 -0
@@ -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
Signature · 1 line
2.21.0
PATCH 2/6 dm: arm: imx: video: add compatible for imx53-ipu
In reply to linux-kernel-dev at beckhoff.comFrom: Steffen Dirkwinkel <[email protected]>
This code also works with imx53 ipus so we can enable it for them.
---
drivers/video/imx/mxc_ipuv3_fb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/imx/mxc_ipuv3_fb.c +1 -0
@@ -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" }, { } };
Signature · 1 line
2.21.0
PATCH 3/6 arm: imx: add ipu to imx53.dts and set dm-pre-reloc
In reply to linux-kernel-dev at beckhoff.comFrom: Steffen Dirkwinkel <[email protected]>
The ipu node in imx53 is needed for DM_VIDEO. We also need to set u-boot,dm-pre-reloc to initialize before relocation.
---
arch/arm/dts/imx53.dtsi | 137 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+)
arch/arm/dts/imx53.dtsi +137 -0
@@ -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 at 50000000 { /* AIPS1 */ compatible = "fsl,aips-bus", "simple-bus";
@@ -273,5 +275,140 @@ status = "disabled"; }; }; + + ipu: ipu at 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 at 0 { + reg = <0>; + }; + + ipu_csi1: port at 1 { + reg = <1>; + }; + + ipu_di0: port at 2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + + ipu_di0_disp0: endpoint at 0 { + reg = <0>; + }; + + ipu_di0_lvds0: endpoint at 1 { + reg = <1>; + remote-endpoint = <&lvds0_in>; + }; + }; + + ipu_di1: port at 3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + ipu_di1_disp1: endpoint at 0 { + reg = <0>; + }; + + ipu_di1_lvds1: endpoint at 1 { + reg = <1>; + remote-endpoint = <&lvds1_in>; + }; + + ipu_di1_tve: endpoint at 2 { + reg = <2>; + remote-endpoint = <&tve_in>; + }; + }; + }; + + tve: tve at 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 at 53fd0000 { + compatible = "fsl,imx53-src", "fsl,imx51-src"; + reg = <0x53fd0000 0x4000>; + #reset-cells = <1>; + }; + + ldb: ldb at 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 at 0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + status = "disabled"; + + port at 0 { + reg = <0>; + + lvds0_in: endpoint { + remote-endpoint = <&ipu_di0_lvds0>; + }; + }; + + port at 2 { + reg = <2>; + }; + }; + + lvds-channel at 1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + status = "disabled"; + + port at 1 { + reg = <1>; + + lvds1_in: endpoint { + remote-endpoint = <&ipu_di1_lvds1>; + }; + }; + + port at 2 { + reg = <2>; + }; + }; + }; }; };
Signature · 1 line
2.21.0
PATCH 4/6 dm: arm: imx: cx9020: migrate to dm_video
In reply to linux-kernel-dev at beckhoff.comFrom: Steffen Dirkwinkel <[email protected]>
Enable DM_VIDEO in config and don't overwrite console so it can be set from environment
---
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(-)
board/beckhoff/mx53cx9020/Makefile +1 -1
@@ -4,4 +4,4 @@ # Patrick Bruenn <[email protected]> obj-y += mx53cx9020.o -obj-$(CONFIG_VIDEO) += mx53cx9020_video.o +obj-$(CONFIG_DM_VIDEO) += mx53cx9020_video.o
board/beckhoff/mx53cx9020/mx53cx9020.c +0 -11
@@ -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 ;
board/beckhoff/mx53cx9020/mx53cx9020_video.c +24 -27
64 lines not on this page · raw message
configs/mx53cx9020_defconfig +2 -3
@@ -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
include/configs/mx53cx9020.h +1 -5
@@ -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 */
Signature · 1 line
2.21.0
PATCH 5/6 dm: arm: imx: cx9020: remove unused mmc functions
In reply to linux-kernel-dev at beckhoff.comFrom: Steffen Dirkwinkel <[email protected]>
These mmc functions were not used anymore since DM_MMC was introduced.
---
board/beckhoff/mx53cx9020/mx53cx9020.c | 55 -------------------------- 1 file changed, 55 deletions(-)
board/beckhoff/mx53cx9020/mx53cx9020.c +0 -55
@@ -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 ) {
Signature · 1 line
2.21.0
PATCH 6/6 arm: imx: cx9020: remove unnecessary includes
In reply to linux-kernel-dev at beckhoff.comFrom: Steffen Dirkwinkel <[email protected]>
There are several includes in mx53cx9020.c which are not required anymore.
---
board/beckhoff/mx53cx9020/mx53cx9020.c | 8 -------- 1 file changed, 8 deletions(-)
board/beckhoff/mx53cx9020/mx53cx9020.c +0 -8
@@ -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 ),
Signature · 1 line
2.21.0
cover arm: imx: cx9020: Migrate to DM_VIDEO and DM_GPIO
In reply to linux-kernel-dev at beckhoff.comOn Wed, 17 Apr 2019 13:57:13 +0200
linux-kernel-dev at beckhoff.com linux-kernel-dev at beckhoff.com wrote:
...
Quoted 8 lines
Steffen Dirkwinkel (6):
dm: arm: imx: cx9020: enableDM_GPIO
dm: arm: imx: video: add compatible for imx53-ipu
arm: imx: add ipu toimx53.dtsand set dm-pre-reloc
dm: arm: imx: cx9020: migrate todm_video
dm: arm: imx: cx9020: remove unused mmc functions
arm: imx: cx9020: remove unnecessary includes
Quoted 8 lines
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