All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 18/19] dm: video: arm: rpi: Convert to use driver model for video
Date: Sat,  1 Apr 2017 12:05:55 -0600	[thread overview]
Message-ID: <20170401180556.2416-19-sjg@chromium.org> (raw)
In-Reply-To: <20170401180556.2416-1-sjg@chromium.org>

Adjust the video driver to work with driver model and move over existing
baords. There is no need to keep the old code.

We can also drop setting of CONFIG_FB_ADDR since driver model doesn't have
this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
---

Changes in v5: None
Changes in v4: None
Changes in v3: None

 configs/rpi_2_defconfig     |  2 +-
 configs/rpi_3_32b_defconfig |  2 +-
 configs/rpi_3_defconfig     |  2 +-
 configs/rpi_defconfig       |  2 +-
 drivers/video/bcm2835.c     | 62 ++++++++++++++++++++-------------------------
 include/configs/rpi.h       | 11 ++------
 6 files changed, 34 insertions(+), 47 deletions(-)

diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig
index f8f123c4a6..e492468a84 100644
--- a/configs/rpi_2_defconfig
+++ b/configs/rpi_2_defconfig
@@ -21,6 +21,6 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
+CONFIG_DM_VIDEO=y
 CONFIG_CONSOLE_SCROLL_LINES=10
-CONFIG_LCD=y
 CONFIG_PHYS_TO_BUS=y
diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig
index 3ff932c361..efcc23e5f4 100644
--- a/configs/rpi_3_32b_defconfig
+++ b/configs/rpi_3_32b_defconfig
@@ -23,6 +23,6 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
+CONFIG_DM_VIDEO=y
 CONFIG_CONSOLE_SCROLL_LINES=10
-CONFIG_LCD=y
 CONFIG_PHYS_TO_BUS=y
diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig
index 98d7bd2c50..8f39d32cd6 100644
--- a/configs/rpi_3_defconfig
+++ b/configs/rpi_3_defconfig
@@ -23,6 +23,6 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
+CONFIG_DM_VIDEO=y
 CONFIG_CONSOLE_SCROLL_LINES=10
-CONFIG_LCD=y
 CONFIG_PHYS_TO_BUS=y
diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig
index 23d540d129..62a1d981e9 100644
--- a/configs/rpi_defconfig
+++ b/configs/rpi_defconfig
@@ -21,6 +21,6 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
+CONFIG_DM_VIDEO=y
 CONFIG_CONSOLE_SCROLL_LINES=10
-CONFIG_LCD=y
 CONFIG_PHYS_TO_BUS=y
diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c
index cd15f7f32a..952ef59661 100644
--- a/drivers/video/bcm2835.c
+++ b/drivers/video/bcm2835.c
@@ -5,62 +5,56 @@
  */
 
 #include <common.h>
-#include <lcd.h>
-#include <memalign.h>
-#include <phys2bus.h>
+#include <dm.h>
+#include <video.h>
 #include <asm/arch/mbox.h>
 #include <asm/arch/msg.h>
-#include <asm/global_data.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
-/* Global variables that lcd.c expects to exist */
-vidinfo_t panel_info;
-
-static int bcm2835_pitch;
-
-void lcd_ctrl_init(void *lcdbase)
+static int bcm2835_video_probe(struct udevice *dev)
 {
+	struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
+	struct video_priv *uc_priv = dev_get_uclass_priv(dev);
 	int ret;
-	int w, h;
+	int w, h, pitch;
 	ulong fb_base, fb_size, fb_start, fb_end;
 
 	debug("bcm2835: Query resolution...\n");
 	ret = bcm2835_get_video_size(&w, &h);
-	if (ret) {
-		/* FIXME: How to disable the LCD to prevent errors? hang()? */
-		return;
-	}
+	if (ret)
+		return -EIO;
 
 	debug("bcm2835: Setting up display for %d x %d\n", w, h);
 	ret = bcm2835_set_video_params(&w, &h, 32, BCM2835_MBOX_PIXEL_ORDER_RGB,
 				       BCM2835_MBOX_ALPHA_MODE_IGNORED,
-				       &fb_base, &fb_size, &bcm2835_pitch);
+				       &fb_base, &fb_size, &pitch);
 
 	debug("bcm2835: Final resolution is %d x %d\n", w, h);
 
-	panel_info.vl_col = w;
-	panel_info.vl_row = h;
-	panel_info.vl_bpix = LCD_COLOR32;
-
-	gd->fb_base = fb_base;
-
 	/* Enable dcache for the frame buffer */
 	fb_start = fb_base & ~(MMU_SECTION_SIZE - 1);
 	fb_end = fb_base + fb_size;
 	fb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT);
 	mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start,
 					DCACHE_WRITEBACK);
-	lcd_set_flush_dcache(1);
-}
+	video_set_flush_dcache(dev, true);
 
-void lcd_enable(void)
-{
-}
+	uc_priv->xsize = w;
+	uc_priv->ysize = h;
+	uc_priv->bpix = VIDEO_BPP32;
+	plat->base = fb_base;
+	plat->size = fb_size;
 
-int lcd_get_size(int *line_length)
-{
-	*line_length = bcm2835_pitch;
-
-	return *line_length * panel_info.vl_row;
+	return 0;
 }
+
+static const struct udevice_id bcm2835_video_ids[] = {
+	{ .compatible = "brcm,bcm2835-hdmi" },
+	{ }
+};
+
+U_BOOT_DRIVER(bcm2835_video) = {
+	.name	= "bcm2835_video",
+	.id	= UCLASS_VIDEO,
+	.of_match = bcm2835_video_ids,
+	.probe	= bcm2835_video_probe,
+};
diff --git a/include/configs/rpi.h b/include/configs/rpi.h
index f96ee46794..bebb79897b 100644
--- a/include/configs/rpi.h
+++ b/include/configs/rpi.h
@@ -68,13 +68,6 @@
 #define CONFIG_BCM2835_GPIO
 /* LCD */
 #define CONFIG_LCD_DT_SIMPLEFB
-#define LCD_BPP				LCD_COLOR32
-/*
- * Prevent allocation of RAM for FB; the real FB address is queried
- * dynamically from the VideoCore co-processor, and comes from RAM
- * not owned by the ARM CPU.
- */
-#define CONFIG_FB_ADDR			0
 #define CONFIG_VIDEO_BCM2835
 #define CONFIG_SYS_WHITE_ON_BLACK
 
@@ -125,8 +118,8 @@
 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 #define ENV_DEVICE_SETTINGS \
 	"stdin=serial,usbkbd\0" \
-	"stdout=serial,lcd\0" \
-	"stderr=serial,lcd\0"
+	"stdout=serial,vidconsole\0" \
+	"stderr=serial,vidconsole\0"
 
 /*
  * Memory layout for where various images get loaded by boot scripts:
-- 
2.12.2.564.g063fe858b8-goog

  parent reply	other threads:[~2017-04-01 18:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-01 18:05 [U-Boot] [PATCH v5 00/19] arm: rpi: Enable USB, Ethernet, MMC, Video driver model on Raspberry Pi Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 01/19] net: smsc95xx: Correct free_pkt() implementation Simon Glass
2017-04-02 17:46   ` Joe Hershberger
2017-04-01 18:05 ` [U-Boot] [PATCH v5 02/19] usb: dwc2: Use separate input and output buffers Simon Glass
2017-04-01 20:15   ` Marek Vasut
2017-04-01 23:40     ` Simon Glass
2017-04-02  3:01       ` Marek Vasut
2017-04-02 13:10         ` Stefan Bruens
2017-04-02 15:43           ` Simon Glass
2017-04-02 21:34             ` Stefan Bruens
2017-04-02 23:23               ` Simon Glass
2017-04-03 14:26                 ` Brüns, Stefan
2017-04-03 15:38                   ` Simon Glass
2017-04-03 18:18                     ` Brüns, Stefan
2017-04-03 18:24                       ` Brüns, Stefan
2017-04-03 20:10                         ` Simon Glass
2017-04-03 20:10                       ` Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 03/19] dm: mmc: Set up the MMC device when controller is probed Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 04/19] dm: video: Correct line clearing code Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 05/19] string: Use memcpy() within memmove() when we can Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 06/19] arm: rpi: Drop the GPIO device addresses Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 07/19] arm: rpi: Drop CONFIG_CONS_INDEX Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 08/19] dm: arm: rpi: Move to driver model for USB Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 09/19] dm: arm: rpi: Use driver model for Ethernet Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 10/19] arm: rpi: Add a file to handle messages Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 11/19] arm: rpi: Add a function to obtain the MMC clock Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 12/19] dm: mmc: rpi: Convert Raspberry Pi to driver model for MMC Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 13/19] dm: arm: rpi: Drop CONFIG_OF_EMBED Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 14/19] video: arm: rpi: Move the video query out of the driver Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 15/19] video: arm: rpi: Move the video settings " Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 16/19] dm: video: Refactor lcd_simplefb to prepare for driver model Simon Glass
2017-04-01 18:05 ` [U-Boot] [PATCH v5 17/19] dm: video: Add driver-model support to lcd_simplefb Simon Glass
2017-04-01 18:05 ` Simon Glass [this message]
2017-04-01 18:05 ` [U-Boot] [PATCH v5 19/19] arm: rpi: Add a TODO to move all messages into the msg handler Simon Glass
2017-04-01 19:05 ` [U-Boot] [PATCH v5 00/19] arm: rpi: Enable USB, Ethernet, MMC, Video driver model on Raspberry Pi Stefan Bruens

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=20170401180556.2416-19-sjg@chromium.org \
    --to=sjg@chromium.org \
    --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.