All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	Anatolij Gustschin <agust@denx.de>
Cc: u-boot@lists.denx.de
Subject: [PATCH] WIP: Nokia RX-51: Convert to CONFIG_DM_VIDEO
Date: Wed, 16 Feb 2022 21:42:19 +0100	[thread overview]
Message-ID: <20220216204219.18539-1-pali@kernel.org> (raw)

---
I had to comment "return -ENOSPC;" in video-uclass.c because without it
DM_VIDEO does not work and I do not know why. This looks like either
false-positive test or a bug in DM_VIDEO code. I have already set
PRE_RELOC flag but it has no effect on that code.

Second thing is that CONFIG_VIDEO_LOGO is broken and does not work even it
is enabled in config file. I do not know why too.

Any idea?

Othwise framebuffer works.
---
 board/nokia/rx51/rx51.c      | 41 ++++++++++++++++++++++--------------
 configs/nokia_rx51_defconfig |  7 ++++--
 drivers/video/video-uclass.c |  4 +++-
 include/configs/nokia_rx51.h | 11 ++--------
 4 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index a52691509da4..e2fe411b34be 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -30,7 +30,7 @@
 #include <malloc.h>
 #include <twl4030.h>
 #include <i2c.h>
-#include <video_fb.h>
+#include <video.h>
 #include <keyboard.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
@@ -62,8 +62,6 @@ struct emu_hal_params_rx51 {
 
 DECLARE_GLOBAL_DATA_PTR;
 
-GraphicDevice gdev;
-
 const omap3_sysinfo sysinfo = {
 	DDR_STACKED,
 	"Nokia RX-51",
@@ -342,22 +340,29 @@ void setup_board_tags(struct tag **in_params)
 	*in_params = params;
 }
 
-/*
- * Routine: video_hw_init
- * Description: Set up the GraphicDevice depending on sys_boot.
- */
-void *video_hw_init(void)
+static int rx51_video_probe(struct udevice *dev)
 {
-	/* fill in Graphic Device */
-	gdev.frameAdrs = 0x8f9c0000;
-	gdev.winSizeX = 800;
-	gdev.winSizeY = 480;
-	gdev.gdfBytesPP = 2;
-	gdev.gdfIndex = GDF_16BIT_565RGB;
-	memset((void *)gdev.frameAdrs, 0, 0xbb800);
-	return (void *) &gdev;
+	struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev);
+	struct video_priv *uc_priv = dev_get_uclass_priv(dev);
+
+	uc_plat->base = 0x8f9c0000;
+	uc_plat->size = 800 * 480 * sizeof(u16);
+	uc_priv->xsize = 800;
+	uc_priv->ysize = 480;
+	uc_priv->bpix = VIDEO_BPP16;
+
+	video_set_flush_dcache(dev, true);
+
+	return 0;
 }
 
+U_BOOT_DRIVER(rx51_video) = {
+	.name = "rx51_video",
+	.id = UCLASS_VIDEO,
+	.probe = rx51_video_probe,
+	.flags = DM_FLAG_PRE_RELOC,
+};
+
 /*
  * Routine: twl4030_regulator_set_mode
  * Description: Set twl4030 regulator mode over i2c powerbus.
@@ -777,6 +782,10 @@ U_BOOT_DRVINFOS(rx51_watchdog) = {
 	{ "rx51_watchdog" },
 };
 
+U_BOOT_DRVINFOS(rx51_video) = {
+	{ "rx51_video" },
+};
+
 U_BOOT_DRVINFOS(rx51_kp) = {
 	{ "rx51_kp" },
 };
diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig
index 47b7bc3b4f03..1d64981afc46 100644
--- a/configs/nokia_rx51_defconfig
+++ b/configs/nokia_rx51_defconfig
@@ -77,8 +77,11 @@ CONFIG_SPI=y
 CONFIG_USB=y
 CONFIG_USB_MUSB_UDC=y
 CONFIG_USB_OMAP3=y
-CONFIG_CFB_CONSOLE=y
-CONFIG_CFB_CONSOLE_ANSI=y
+CONFIG_DM_VIDEO=y
+CONFIG_VIDEO_LOGO=y
+# CONFIG_VIDEO_BPP8 is not set
+# CONFIG_VIDEO_BPP32 is not set
+CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=31000
 CONFIG_WDT=y
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 7d499bcec51d..98cc5c0b17da 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -3,6 +3,8 @@
  * Copyright (c) 2015 Google, Inc
  */
 
+#define DEBUG
+
 #define LOG_CATEGORY UCLASS_VIDEO
 
 #include <common.h>
@@ -438,7 +440,7 @@ static int video_post_bind(struct udevice *dev)
 		 */
 		printf("Video device '%s' cannot allocate frame buffer memory -ensure the device is set up before relocation\n",
 		       dev->name);
-		return -ENOSPC;
+//		return -ENOSPC;
 	}
 	debug("%s: Claiming %lx bytes at %lx for video device '%s'\n",
 	      __func__, size, addr, dev->name);
diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h
index 9be64c3d3f87..e837b12b568f 100644
--- a/include/configs/nokia_rx51.h
+++ b/include/configs/nokia_rx51.h
@@ -70,19 +70,12 @@
 
 #define CONFIG_SYS_ONENAND_BASE		ONENAND_MAP
 
-/*
- * Framebuffer
- */
-/* Video console */
-#define VIDEO_FB_16BPP_PIXEL_SWAP
-#define VIDEO_FB_16BPP_WORD_SWAP
-
 /* Environment information */
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"usbtty=cdc_acm\0" \
 	"stdin=usbtty,serial,keyboard\0" \
-	"stdout=usbtty,serial,vga\0" \
-	"stderr=usbtty,serial,vga\0" \
+	"stdout=usbtty,serial,vidconsole\0" \
+	"stderr=usbtty,serial,vidconsole\0" \
 	"slide=gpio input " __stringify(GPIO_SLIDE) "\0" \
 	"switchmmc=mmc dev ${mmcnum}\0" \
 	"kernaddr=0x82008000\0" \
-- 
2.20.1


             reply	other threads:[~2022-02-16 20:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 20:42 Pali Rohár [this message]
2022-02-17  8:53 ` [PATCH] WIP: Nokia RX-51: Convert to CONFIG_DM_VIDEO Anatolij Gustschin
2022-02-17 12:20   ` Pali Rohár
2022-03-06 11:51     ` Pali Rohár
2022-03-06 12:51       ` Simon Glass
2022-03-06 14:17         ` Pali Rohár
2022-03-06 14:42           ` Simon Glass
2022-03-06 15:25             ` Pali Rohár
2022-03-06 18:44               ` Simon Glass
2022-03-09 19:44                 ` Pali Rohár
2022-03-09 22:20                   ` Anatolij Gustschin
2022-03-11 18:58                     ` Pali Rohár
2022-03-12  5:02                       ` Simon Glass
2022-03-13 11:06                         ` Pali Rohár
2022-03-06 15:08 ` [PATCH] " Pali Rohár
2022-03-06 18:43   ` Simon Glass
2022-03-09 19:37     ` Pali Rohár
2022-03-09 19:46 ` [PATCH v2 1/2] video: Allow drivers to allocate the frame buffer themselves Pali Rohár
2022-03-09 19:46   ` [PATCH v2 2/2] Nokia RX-51: Convert to CONFIG_DM_VIDEO Pali Rohár
2022-03-14 22:42     ` Anatolij Gustschin
2022-03-12  2:43   ` [PATCH v2 1/2] video: Allow drivers to allocate the frame buffer themselves Simon Glass
2022-03-14 22:41   ` Anatolij Gustschin

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=20220216204219.18539-1-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=agust@denx.de \
    --cc=sjg@chromium.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.