u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: <Gireesh.Hiremath@in.bosch.com>
To: <u-boot@lists.denx.de>, <Gireesh.Hiremath@in.bosch.com>,
	<trini@konsulko.com>
Cc: <sjoerd.simons@collabora.co.uk>,
	<VinayKumar.Shettar@in.bosch.com>,
	<Govindaraji.Sivanantham@in.bosch.com>
Subject: [PATCH v4 15/18] am335x, guardian: Enable panel driver Himax HX8238D
Date: Fri, 11 Jun 2021 16:13:47 +0000	[thread overview]
Message-ID: <20210611161350.2141-16-Gireesh.Hiremath@in.bosch.com> (raw)
In-Reply-To: <20210611161350.2141-1-Gireesh.Hiremath@in.bosch.com>

From: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>

- Enable lcd controller
- Display splash screen

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>
---
 arch/arm/dts/am335x-guardian-u-boot.dtsi | 11 +++
 arch/arm/dts/am335x-guardian.dts         |  8 ++-
 arch/arm/mach-omap2/am33xx/Kconfig       |  2 +
 board/bosch/guardian/board.c             | 87 +++++++++++++++++++++++-
 board/bosch/guardian/mux.c               |  3 +-
 include/configs/am335x_guardian.h        | 11 +++
 6 files changed, 119 insertions(+), 3 deletions(-)

diff --git a/arch/arm/dts/am335x-guardian-u-boot.dtsi b/arch/arm/dts/am335x-guardian-u-boot.dtsi
index 986f58e664..a1a7913de8 100644
--- a/arch/arm/dts/am335x-guardian-u-boot.dtsi
+++ b/arch/arm/dts/am335x-guardian-u-boot.dtsi
@@ -42,6 +42,17 @@
 	u-boot,dm-pre-reloc;
 };
 
+&spi0 {
+	lcd0: display@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 207246b4e0..69bee45848 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@0 {
+			remote-endpoint = <0>;
+		};
+	};
 };
 
 &mmc1 {
diff --git a/arch/arm/mach-omap2/am33xx/Kconfig b/arch/arm/mach-omap2/am33xx/Kconfig
index 11e54cd293..65f43944fe 100644
--- a/arch/arm/mach-omap2/am33xx/Kconfig
+++ b/arch/arm/mach-omap2/am33xx/Kconfig
@@ -95,6 +95,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 4388ef70d2..179511a670 100644
--- a/board/bosch/guardian/board.c
+++ b/board/bosch/guardian/board.c
@@ -26,12 +26,16 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/mem-guardian.h>
-#include <asm/arch/mmc_host_def.h>
 #include <asm/arch/omap.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/emif.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <jffs2/load_kernel.h>
+#include <mtd.h>
+#include <nand.h>
+#include <video.h>
+#include <video_console.h>
 #include "board.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -250,13 +254,94 @@ void lcdbacklight_en(void)
 			   brightness != 0 ? 0x0A : 0x02, 0xFF);
 }
 
+#if IS_ENABLED(CONFIG_AM335X_LCD)
+static void splash_screen(void)
+{
+	struct udevice *video_dev;
+	struct udevice *console_dev;
+	struct video_priv *vid_priv;
+	struct mtd_info *mtd;
+	size_t len;
+	int ret;
+
+	struct mtd_device *mtd_dev;
+	struct part_info  *part;
+	u8 pnum;
+
+	ret = uclass_get_device(UCLASS_VIDEO, 0, &video_dev);
+	if (ret != 0) {
+		debug("video device not found\n");
+		goto exit;
+	}
+
+	vid_priv = dev_get_uclass_priv(video_dev);
+	mtdparts_init();
+
+	if (find_dev_and_part(SPLASH_SCREEN_NAND_PART, &mtd_dev, &pnum, &part))	{
+		debug("Could not find nand partition\n");
+		goto splash_screen_text;
+	}
+
+	mtd = get_nand_dev_by_index(mtd_dev->id->num);
+	if (!mtd) {
+		debug("MTD partition is not valid\n");
+		goto splash_screen_text;
+	}
+
+	len = SPLASH_SCREEN_BMP_FILE_SIZE;
+	ret = nand_read_skip_bad(mtd, part->offset, &len, NULL,
+				 SPLASH_SCREEN_BMP_FILE_SIZE,
+				 (u_char *)SPLASH_SCREEN_BMP_LOAD_ADDR);
+	if (ret != 0) {
+		debug("Reading NAND partition failed\n");
+		goto splash_screen_text;
+	}
+
+	ret = video_bmp_display(video_dev, SPLASH_SCREEN_BMP_LOAD_ADDR, 0, 0, false);
+	if (ret != 0) {
+		debug("No valid bmp image found!!\n");
+		goto splash_screen_text;
+	} else {
+		goto exit;
+	}
+
+splash_screen_text:
+	vid_priv->colour_fg = CONSOLE_COLOR_RED;
+	vid_priv->colour_bg = CONSOLE_COLOR_BLACK;
+
+	if (!uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &console_dev)) {
+		debug("Found console\n");
+		vidconsole_position_cursor(console_dev, 17, 7);
+		vidconsole_put_string(console_dev, SPLASH_SCREEN_TEXT);
+	} else {
+		debug("No console device found\n");
+	}
+
+exit:
+	return;
+}
+#endif /* CONFIG_AM335X_LCD */
+
 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;
+	}
+
 	lcdbacklight_en();
+	if (IS_ENABLED(CONFIG_AM335X_LCD))
+		splash_screen();
+
 	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/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h
index 73248292f2..c161b93352 100644
--- a/include/configs/am335x_guardian.h
+++ b/include/configs/am335x_guardian.h
@@ -82,6 +82,17 @@
 
 #endif /* ! CONFIG_SPL_BUILD */
 
+#define CONFIG_BMP_16BPP
+#define SPLASH_SCREEN_NAND_PART "nand0,10"
+#define SPLASH_SCREEN_BMP_FILE_SIZE 0x26000
+#define SPLASH_SCREEN_BMP_LOAD_ADDR 0x82000000
+#define SPLASH_SCREEN_TEXT "U-Boot"
+
+/* BGR 16Bit Color Definitions */
+#define CONSOLE_COLOR_BLACK 0x0000
+#define CONSOLE_COLOR_WHITE 0xFFFF
+#define CONSOLE_COLOR_RED 0x001F
+
 /* NS16550 Configuration */
 #define CONFIG_SYS_NS16550_COM1		0x44e09000	/* UART0 */
 #define CONFIG_SYS_NS16550_COM2		0x48022000	/* UART1 */
-- 
2.20.1


  parent reply	other threads:[~2021-06-11 16:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11 16:13 [PATCH v4 00/18] am335x, guardian: update board specific changes Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 01/18] configs: am335x_guardian: Enable clock driver Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 02/18] am335x, guardian: mem: Add board dependent mem values Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 03/18] configs: am335x_guardian: add ubi fastmap support Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 04/18] am335x, guardian: set tftp_load_addr in environment Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 05/18] configs: am335x_guardian: add memtest configs Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 06/18] am335x, guardian: Update pinmux configuration Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 07/18] am335x, guardian: set environment variable autoload to no Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 08/18] am335x, guardian: code cleanup and boot optimization Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 09/18] configs: am335x_guardian: set boot delay Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 10/18] configs: am335x_guardian: disable spl command Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 11/18] am335x, guardian: update swi logic Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 12/18] am335x, guardian: Enable backlight Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 13/18] configs: am335x_guardian: Enable display config Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 14/18] drivers: video: hx8238 fix build bug Gireesh.Hiremath
2021-06-11 16:13 ` Gireesh.Hiremath [this message]
2021-06-11 16:13 ` [PATCH v4 16/18] am335x, guardian: software update available status is stored in AM3352 RTC scracth register Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 17/18] configs: am335x_guardian: Enable bootcount nvmem support Gireesh.Hiremath
2021-06-11 16:13 ` [PATCH v4 18/18] configs: am335x_guardian: add register maps support Gireesh.Hiremath
2021-07-14  6:52 ` [PATCH v4 00/18] am335x, guardian: update board specific changes Lokesh Vutla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210611161350.2141-16-Gireesh.Hiremath@in.bosch.com \
    --to=gireesh.hiremath@in.bosch.com \
    --cc=Govindaraji.Sivanantham@in.bosch.com \
    --cc=VinayKumar.Shettar@in.bosch.com \
    --cc=sjoerd.simons@collabora.co.uk \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).