[U-Boot] [PATCH] pico-imx7d: Convert to DM_VIDEO

Joris Offouga offougajoris at gmail.com
Fri Aug 30 12:51:12 UTC 2019


HI Peng,

I send v2 with your suggest

Best Regards,

Joris Offouga

Le 29/08/2019 à 11:35, Peng Fan a écrit :
>> Subject: [PATCH] pico-imx7d: Convert to DM_VIDEO
> Please write something here.
> And use x-u-boot.dtsi for uboot specific dts change.
>
> Regards,
> Peng.
>
>> Signed-off-by: Joris Offouga <offougajoris at gmail.com>
>> ---
>>   arch/arm/dts/imx7d-pico.dtsi             | 113
>> ++++++++++++++++++++++-
>>   board/technexion/pico-imx7d/pico-imx7d.c |  48 ++++------
>>   configs/pico-hobbit-imx7d_defconfig      |   2 +-
>>   configs/pico-imx7d_bl33_defconfig        |   2 +-
>>   configs/pico-imx7d_defconfig             |   2 +-
>>   configs/pico-pi-imx7d_defconfig          |   2 +-
>>   include/configs/pico-imx7d.h             |   2 +-
>>   7 files changed, 134 insertions(+), 37 deletions(-)
>>
>> diff --git a/arch/arm/dts/imx7d-pico.dtsi b/arch/arm/dts/imx7d-pico.dtsi
>> index 7cd8be24c8..ac72baf347 100644
>> --- a/arch/arm/dts/imx7d-pico.dtsi
>> +++ b/arch/arm/dts/imx7d-pico.dtsi
>> @@ -11,6 +11,7 @@
>>   	aliases {
>>   		mmc0 = &usdhc3;
>>   		usb0 = &usbotg1;
>> +		display0 = &lcdif;
>>   	};
>>
>>   	/* Will be filled by the bootloader */ @@ -75,6 +76,37 @@
>>   		clocks = <&clks IMX7D_CLKO2_ROOT_DIV>;
>>   		clock-names = "ext_clock";
>>   	};
>> +
>> +	backlight: backlight {
>> +		compatible = "pwm-backlight";
>> +		pinctrl-names = "default";
>> +		pinctrl-0 = <&pinctrl_backlight>;
>> +		pwms = <&pwm4 0 50000 0>;
>> +		brightness-levels = <0 36 72 108 144 180 216 255>;
>> +		default-brightness-level = <6>;
>> +		status = "okay";
>> +	};
>> +
>> +	reg_lcd_3v3: regulator-lcd-3v3 {
>> +		compatible = "regulator-fixed";
>> +		regulator-name = "lcd-3v3";
>> +		regulator-min-microvolt = <3300000>;
>> +		regulator-max-microvolt = <3300000>;
>> +		gpio = <&gpio1 6 GPIO_ACTIVE_HIGH>;
>> +		enable-active-high;
>> +	};
>> +
>> +	panel {
>> +		compatible = "vxt,vl050-8048nt-c01";
>> +		backlight = <&backlight>;
>> +		power-supply = <&reg_lcd_3v3>;
>> +
>> +		port {
>> +			panel_in: endpoint {
>> +				remote-endpoint = <&display_out>;
>> +			};
>> +		};
>> +	};
>>   };
>>
>>   &clks {
>> @@ -98,7 +130,7 @@
>>   			  <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
>>   	assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
>>   	assigned-clock-rates = <0>, <100000000>;
>> -	phy-mode = "rgmii";
>> +	phy-mode = "rgmii-id";
>>   	phy-handle = <&ethphy0>;
>>   	fsl,magic-packet;
>>   	phy-reset-gpios = <&gpio6 11 GPIO_ACTIVE_LOW>; @@ -236,6 +268,45
>> @@
>>   	};
>>   };
>>
>> +&lcdif {
>> +	pinctrl-names = "default";
>> +	pinctrl-0 = <&pinctrl_lcdif>;
>> +	status = "okay";
>> +	display = <&display0>;
>> +	u-boot,dm-pre-reloc;
>> +
>> +	port {
>> +		display_out: endpoint {
>> +			remote-endpoint = <&panel_in>;
>> +		};
>> +	};
>> +
>> +	display0: display {
>> +		bits-per-pixel = <16>;
>> +		bus-width = <24>;
>> +
>> +		display-timings {
>> +			native-mode = <&timing0>;
>> +			timing0: timing0 {
>> +				clock-frequency = <33260000>;
>> +				hactive = <800>;
>> +				vactive = <480>;
>> +				hback-porch = <11>;
>> +				hfront-porch = <11>;
>> +				vback-porch = <12>;
>> +				vfront-porch = <11>;
>> +				hsync-len = <46>;
>> +				vsync-len = <210>;
>> +				hsync-active = <0>;
>> +				vsync-active = <0>;
>> +				de-active = <1>;
>> +				pixelclk-active = <1>;
>> +				interlaced =  <0>;
>> +			};
>> +		};
>> +	};
>> +};
>> +
>>   &sai1 {
>>   	pinctrl-names = "default";
>>   	pinctrl-0 = <&pinctrl_sai1>;
>> @@ -356,6 +427,12 @@
>>   };
>>
>>   &iomuxc {
>> +	pinctrl_backlight: backlight {
>> +		fsl,pins = <
>> +			MX7D_PAD_GPIO1_IO11__PWM4_OUT		0x0
>> +		>;
>> +	};
>> +
>>   	pinctrl_ecspi3: ecspi3grp {
>>   		fsl,pins = <
>>   			MX7D_PAD_I2C1_SCL__ECSPI3_MISO		0x2
>> @@ -420,6 +497,40 @@
>>   		>;
>>   	};
>>
>> +	pinctrl_lcdif: lcdifgrp {
>> +		fsl,pins = <
>> +			MX7D_PAD_LCD_DATA00__LCD_DATA0		0x79
>> +			MX7D_PAD_LCD_DATA01__LCD_DATA1		0x79
>> +			MX7D_PAD_LCD_DATA02__LCD_DATA2		0x79
>> +			MX7D_PAD_LCD_DATA03__LCD_DATA3		0x79
>> +			MX7D_PAD_LCD_DATA04__LCD_DATA4		0x79
>> +			MX7D_PAD_LCD_DATA05__LCD_DATA5		0x79
>> +			MX7D_PAD_LCD_DATA06__LCD_DATA6		0x79
>> +			MX7D_PAD_LCD_DATA07__LCD_DATA7		0x79
>> +			MX7D_PAD_LCD_DATA08__LCD_DATA8		0x79
>> +			MX7D_PAD_LCD_DATA09__LCD_DATA9		0x79
>> +			MX7D_PAD_LCD_DATA10__LCD_DATA10		0x79
>> +			MX7D_PAD_LCD_DATA11__LCD_DATA11		0x79
>> +			MX7D_PAD_LCD_DATA12__LCD_DATA12		0x79
>> +			MX7D_PAD_LCD_DATA13__LCD_DATA13		0x79
>> +			MX7D_PAD_LCD_DATA14__LCD_DATA14		0x79
>> +			MX7D_PAD_LCD_DATA15__LCD_DATA15		0x79
>> +			MX7D_PAD_LCD_DATA16__LCD_DATA16		0x79
>> +			MX7D_PAD_LCD_DATA17__LCD_DATA17		0x79
>> +			MX7D_PAD_LCD_DATA18__LCD_DATA18		0x79
>> +			MX7D_PAD_LCD_DATA19__LCD_DATA19		0x79
>> +			MX7D_PAD_LCD_DATA20__LCD_DATA20		0x79
>> +			MX7D_PAD_LCD_DATA21__LCD_DATA21		0x79
>> +			MX7D_PAD_LCD_DATA22__LCD_DATA22		0x79
>> +			MX7D_PAD_LCD_DATA23__LCD_DATA23		0x79
>> +			MX7D_PAD_LCD_CLK__LCD_CLK		0x79
>> +			MX7D_PAD_LCD_ENABLE__LCD_ENABLE		0x78
>> +			MX7D_PAD_LCD_VSYNC__LCD_VSYNC		0x78
>> +			MX7D_PAD_LCD_HSYNC__LCD_HSYNC		0x78
>> +			MX7D_PAD_LCD_RESET__GPIO3_IO4		0x14
>> +		>;
>> +	};
>> +
>>   	pinctrl_pwm1: pwm1 {
>>   		fsl,pins = <
>>   			MX7D_PAD_GPIO1_IO08__PWM1_OUT   0x7f
>> diff --git a/board/technexion/pico-imx7d/pico-imx7d.c
>> b/board/technexion/pico-imx7d/pico-imx7d.c
>> index 216475c8de..916220516e 100644
>> --- a/board/technexion/pico-imx7d/pico-imx7d.c
>> +++ b/board/technexion/pico-imx7d/pico-imx7d.c
>> @@ -19,6 +19,10 @@
>>   #include <power/pmic.h>
>>   #include <power/pfuze3000_pmic.h>
>>   #include "../../freescale/common/pfuze.h"
>> +#ifdef CONFIG_DM_VIDEO
>> +#include <bmp_logo_data.h>
>> +#include <video.h>
>> +#endif
>>
>>   DECLARE_GLOBAL_DATA_PTR;
>>
>> @@ -223,37 +227,8 @@ int board_early_init_f(void)
>>   	return 0;
>>   }
>>
>> -#ifdef CONFIG_VIDEO_MXS
>> +#ifdef CONFIG_DM_VIDEO
>>   static iomux_v3_cfg_t const lcd_pads[] = {
>> -	MX7D_PAD_LCD_CLK__LCD_CLK | MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_ENABLE__LCD_ENABLE |
>> MUX_PAD_CTRL(LCD_SYNC_PAD_CTRL),
>> -	MX7D_PAD_LCD_HSYNC__LCD_HSYNC |
>> MUX_PAD_CTRL(LCD_SYNC_PAD_CTRL),
>> -	MX7D_PAD_LCD_VSYNC__LCD_VSYNC |
>> MUX_PAD_CTRL(LCD_SYNC_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA00__LCD_DATA0 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA01__LCD_DATA1 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA02__LCD_DATA2 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA03__LCD_DATA3 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA04__LCD_DATA4 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA05__LCD_DATA5 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA06__LCD_DATA6 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA07__LCD_DATA7 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA08__LCD_DATA8 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA09__LCD_DATA9 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA10__LCD_DATA10 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA11__LCD_DATA11 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA12__LCD_DATA12 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA13__LCD_DATA13 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA14__LCD_DATA14 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA15__LCD_DATA15 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA16__LCD_DATA16 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA17__LCD_DATA17 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA18__LCD_DATA18 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA19__LCD_DATA19 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA20__LCD_DATA20 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA21__LCD_DATA21 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA22__LCD_DATA22 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_LCD_DATA23__LCD_DATA23 |
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>> -	MX7D_PAD_GPIO1_IO06__GPIO1_IO6	|
>> MUX_PAD_CTRL(LCD_PAD_CTRL),
>>   	MX7D_PAD_GPIO1_IO11__GPIO1_IO11 |
>> MUX_PAD_CTRL(NO_PAD_CTRL),  };
>>
>> @@ -274,8 +249,19 @@ int board_init(void)
>>   	/* address of boot parameters */
>>   	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
>>
>> -#ifdef CONFIG_VIDEO_MXS
>> +#ifdef CONFIG_DM_VIDEO
>> +	struct udevice *dev;
>> +	int ret;
>> +
>> +	ret = uclass_get_device(UCLASS_VIDEO, 0, &dev);
>> +	if (ret)
>> +		return ret;
>> +
>>   	setup_lcd();
>> +
>> +	ret = video_bmp_display(dev, (ulong)bmp_logo_bitmap, 0, 0, true);
>> +	if (ret)
>> +		return ret;
>>   #endif
>>   #ifdef CONFIG_FEC_MXC
>>   	setup_fec();
>> diff --git a/configs/pico-hobbit-imx7d_defconfig
>> b/configs/pico-hobbit-imx7d_defconfig
>> index 3869eb70cc..873dbec52c 100644
>> --- a/configs/pico-hobbit-imx7d_defconfig
>> +++ b/configs/pico-hobbit-imx7d_defconfig
>> @@ -66,4 +66,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL"
>>   CONFIG_USB_GADGET_VENDOR_NUM=0x0525
>>   CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
>>   CONFIG_CI_UDC=y
>> -CONFIG_VIDEO=y
>> +CONFIG_DM_VIDEO=y
>> diff --git a/configs/pico-imx7d_bl33_defconfig
>> b/configs/pico-imx7d_bl33_defconfig
>> index a2cddfcf4f..ba347d2507 100644
>> --- a/configs/pico-imx7d_bl33_defconfig
>> +++ b/configs/pico-imx7d_bl33_defconfig
>> @@ -62,5 +62,5 @@ CONFIG_USB_GADGET_DOWNLOAD=y
>> CONFIG_USB_ETHER=y  CONFIG_USB_ETH_CDC=y
>> CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00"
>> -CONFIG_VIDEO=y
>> +CONFIG_DM_VIDEO=y
>>   CONFIG_OF_LIBFDT_OVERLAY=y
>> diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig index
>> 3d45872a84..bad34555fa 100644
>> --- a/configs/pico-imx7d_defconfig
>> +++ b/configs/pico-imx7d_defconfig
>> @@ -66,4 +66,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL"
>>   CONFIG_USB_GADGET_VENDOR_NUM=0x0525
>>   CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
>>   CONFIG_CI_UDC=y
>> -CONFIG_VIDEO=y
>> +CONFIG_DM_VIDEO=y
>> diff --git a/configs/pico-pi-imx7d_defconfig b/configs/pico-pi-imx7d_defconfig
>> index b864b537c3..f0f32f6445 100644
>> --- a/configs/pico-pi-imx7d_defconfig
>> +++ b/configs/pico-pi-imx7d_defconfig
>> @@ -66,4 +66,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL"
>>   CONFIG_USB_GADGET_VENDOR_NUM=0x0525
>>   CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
>>   CONFIG_CI_UDC=y
>> -CONFIG_VIDEO=y
>> +CONFIG_DM_VIDEO=y
>> diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index
>> 91015402ef..7c36f52c59 100644
>> --- a/include/configs/pico-imx7d.h
>> +++ b/include/configs/pico-imx7d.h
>> @@ -163,7 +163,7 @@
>>   #define CONFIG_POWER_PFUZE3000
>>   #define CONFIG_POWER_PFUZE3000_I2C_ADDR	0x08
>>
>> -#ifdef CONFIG_VIDEO
>> +#ifdef CONFIG_DM_VIDEO
>>   #define CONFIG_VIDEO_MXS
>>   #define CONFIG_VIDEO_LOGO
>>   #define CONFIG_SPLASH_SCREEN
>> --
>> 2.17.1


More information about the U-Boot mailing list