[PATCH 2/2] am335x, guardian: Enable panel driver Himax HX8238D

Lokesh Vutla lokeshvutla at ti.com
Sun Jan 17 11:49:02 CET 2021



On 06/01/21 9:01 pm, Gireesh.Hiremath at in.bosch.com wrote:
> From: Gireesh Hiremath <Gireesh.Hiremath at in.bosch.com>
> 
> Enable lcd controller related clocks, pinmux, config,
> interface and port
> 
> Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath at in.bosch.com>
> ---
>  arch/arm/dts/am335x-guardian-u-boot.dtsi | 15 +++++++++++++++
>  arch/arm/dts/am335x-guardian.dts         |  8 +++++++-
>  arch/arm/mach-omap2/am33xx/Kconfig       |  2 ++
>  board/bosch/guardian/board.c             | 22 ++++++++++++++++++++++
>  board/bosch/guardian/mux.c               |  3 ++-
>  configs/am335x_guardian_defconfig        |  7 +++++--
>  drivers/video/Makefile                   |  1 +
>  7 files changed, 54 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/dts/am335x-guardian-u-boot.dtsi b/arch/arm/dts/am335x-guardian-u-boot.dtsi
> index 705ef335bf..2c355e583c 100644
> --- a/arch/arm/dts/am335x-guardian-u-boot.dtsi
> +++ b/arch/arm/dts/am335x-guardian-u-boot.dtsi
> @@ -18,6 +18,10 @@
>  	u-boot,dm-pre-reloc;
>  };
>  
> +&lcdc {
> +	u-boot,dm-pre-reloc;
> +};
> +
>  &mmc1 {
>  	u-boot,dm-pre-reloc;
>  };
> @@ -35,6 +39,17 @@
>  	u-boot,dm-pre-reloc;
>  };
>  
> +&spi0 {
> +	lcd0: display at 0 {
> +		compatible = "himax,hx8238d";
> +		pinctrl-names = "default";
> +		pinctrl-0 = <&lcd0_pins>;
> +		reg = <0>;
> +		label = "lcd";
> +		spi-max-frequency = <100000>;
> +	};
> +};
> +
>  &uart0 {
>  	u-boot,dm-pre-reloc;
>  };
> diff --git a/arch/arm/dts/am335x-guardian.dts b/arch/arm/dts/am335x-guardian.dts
> index 7e70a96d25..93ee2e6c09 100644
> --- a/arch/arm/dts/am335x-guardian.dts
> +++ b/arch/arm/dts/am335x-guardian.dts
> @@ -87,7 +87,7 @@
>  			ac-bias           = <255>;
>  			ac-bias-intrpt    = <0>;
>  			dma-burst-sz      = <16>;
> -			bpp               = <24>;
> +			bpp               = <16>;
>  			bus-width         = <16>;
>  			fdd               = <0x80>;
>  			sync-edge         = <0>;
> @@ -247,6 +247,12 @@
>  &lcdc {
>  	blue-and-red-wiring = "crossed";
>  	status = "okay";
> +
> +	port {
> +		lcdc_0: endpoint at 0 {
> +			remote-endpoint = <0>;
> +		};
> +	};
>  };
>  
>  &mmc1 {
> diff --git a/arch/arm/mach-omap2/am33xx/Kconfig b/arch/arm/mach-omap2/am33xx/Kconfig
> index 9a98e8a0a9..204975092a 100644
> --- a/arch/arm/mach-omap2/am33xx/Kconfig
> +++ b/arch/arm/mach-omap2/am33xx/Kconfig
> @@ -94,6 +94,8 @@ config TARGET_AM335X_GUARDIAN
>  	select DM_SERIAL
>  	select DM_GPIO
>  	select DM_USB
> +	select DM_VIDEO
> +	select DM_PANEL_HX8238D
>  
>  config TARGET_AM335X_SL50
>  	bool "Support am335x_sl50"
> diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c
> index 8b3c82cafd..f3e616d21c 100644
> --- a/board/bosch/guardian/board.c
> +++ b/board/bosch/guardian/board.c
> @@ -79,6 +79,18 @@ void am33xx_spl_board_init(void)
>  	int mpu_vdd;
>  	int usb_cur_lim;
>  
> +	struct cm_perpll *const cmper = (struct cm_perpll *)CM_PER;
> +
> +	/*enable lcd controller related clocks*/
> +	u32 *const clk_domains[] = { 0 };
> +
> +	u32 *const clk_modules_xre1specific[] = {
> +		&cmper->lcdclkctrl,
> +		&cmper->lcdcclkstctrl,
> +		0
> +	};
> +	do_enable_clocks(clk_domains, clk_modules_xre1specific, 1);

I am worried this is going to effect other platforms. Recently CLK support is
introduced for am33 platforms. Can you use that and get clocks info from DT.

Thanks and regards,
Lokesh

> +
>  	/* Get the frequency */
>  	dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev);
>  
> @@ -235,10 +247,20 @@ err:
>  
>  int board_late_init(void)
>  {
> +	int ret;
> +	struct udevice *cdev;
> +
>  #ifdef CONFIG_LED_GPIO
>  	led_default_state();
>  #endif
>  	set_bootmode_env();
> +
> +	ret = uclass_get_device(UCLASS_PANEL, 0, &cdev);
> +	if (ret) {
> +		debug("video panel not found: %d\n", ret);
> +		return ret;
> +	}
> +
>  	return 0;
>  }
>  #endif /* CONFIG_BOARD_LATE_INIT */
> diff --git a/board/bosch/guardian/mux.c b/board/bosch/guardian/mux.c
> index 9c81f29f9f..12c3eb666f 100644
> --- a/board/bosch/guardian/mux.c
> +++ b/board/bosch/guardian/mux.c
> @@ -28,8 +28,9 @@ static struct module_pin_mux i2c0_pin_mux[] = {
>  
>  static struct module_pin_mux guardian_interfaces_pin_mux[] = {
>  	{OFFSET(mcasp0_ahclkx), (MODE(7) | PULLDOWN_EN)},
> +	{OFFSET(mii1_txen),     (MODE(7) | PULLDOWN_EN)},
>  	{OFFSET(mcasp0_aclkx),  (MODE(7) | PULLUP_EN)},
> -	{OFFSET(mii1_txd0),     (MODE(7) | PULLUP_EN)},
> +	{OFFSET(mdio_clk),      (MODE(7) | PULLUP_EN)},
>  	{OFFSET(uart1_rxd),     (MODE(7) | RXACTIVE | PULLUDDIS)},
>  	{OFFSET(uart1_txd),     (MODE(7) | PULLUDDIS)},
>  	{OFFSET(mii1_crs),      (MODE(7) | PULLDOWN_EN)},
> diff --git a/configs/am335x_guardian_defconfig b/configs/am335x_guardian_defconfig
> index d412311cec..b7170cd79e 100644
> --- a/configs/am335x_guardian_defconfig
> +++ b/configs/am335x_guardian_defconfig
> @@ -50,8 +50,6 @@ CONFIG_CMD_MTD=y
>  CONFIG_CMD_NAND=y
>  CONFIG_CMD_USB=y
>  # CONFIG_CMD_SETEXPR is not set
> -CONFIG_BOOTP_DNS2=y
> -# CONFIG_CMD_LED is not set
>  CONFIG_CMD_EXT4_WRITE=y
>  CONFIG_CMD_MTDPARTS=y
>  CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:256k(SPL),256k(SPL.backup1),256k(SPL.backup2),256k(SPL.backup3),1m(u-boot),1m(u-boot.backup1),1m(u-boot-2),1m(u-boot-2.backup1),256k(u-boot-env),256k(u-boot-env.backup1),256k(splash-screen),-(UBI)"
> @@ -86,6 +84,10 @@ CONFIG_PHY=y
>  CONFIG_NOP_PHY=y
>  CONFIG_PINCTRL=y
>  CONFIG_PINCTRL_SINGLE=y
> +# CONFIG_RAM_ROCKCHIP_DEBUG is not set
> +CONFIG_SPI=y
> +CONFIG_DM_SPI=y
> +CONFIG_OMAP3_SPI=y
>  CONFIG_USB=y
>  CONFIG_DM_USB_GADGET=y
>  CONFIG_SPL_DM_USB_GADGET=y
> @@ -98,6 +100,7 @@ CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
>  CONFIG_USB_GADGET_VENDOR_NUM=0x0451
>  CONFIG_USB_GADGET_PRODUCT_NUM=0xd022
>  CONFIG_USB_ETHER=y
> +CONFIG_AM335X_LCD=y
>  CONFIG_SPL_WDT=y
>  # CONFIG_SPL_USE_TINY_PRINTF is not set
>  CONFIG_SPL_OF_LIBFDT=y
> diff --git a/drivers/video/Makefile b/drivers/video/Makefile
> index e670d8f862..b13c8c7296 100644
> --- a/drivers/video/Makefile
> +++ b/drivers/video/Makefile
> @@ -16,6 +16,7 @@ obj-$(CONFIG_DM_VIDEO) += video-uclass.o vidconsole-uclass.o
>  obj-$(CONFIG_DM_VIDEO) += video_bmp.o
>  obj-$(CONFIG_PANEL) += panel-uclass.o
>  obj-$(CONFIG_SIMPLE_PANEL) += simple_panel.o
> +obj-$(CONFIG_DM_PANEL_HX8238D) += hx8238d.o
>  endif
>  
>  obj-${CONFIG_EXYNOS_FB} += exynos/
> 


More information about the U-Boot mailing list