summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-08-01 17:17:49 +0300
committerTom Rini <trini@konsulko.com>2023-08-01 17:17:49 +0300
commite5b082a3c594cc332ccb5db0296bad7a4c070bf0 (patch)
tree3a62cd3a9540c8839a3217da50608be0c7871374 /drivers
parentaaeaef253619d06bfac32ff7faabaf16728f55e8 (diff)
parentb8d3a6c7d12fc6101f99cde0acedb4a799fdb5f3 (diff)
downloadu-boot-e5b082a3c594cc332ccb5db0296bad7a4c070bf0.tar.xz
Merge tag 'video-20230801' of https://source.denx.de/u-boot/custodians/u-boot-video
- dm video cosmetic style fix - bochs: remove the x86 limitation - correct kconfig text for PCI default FB size - kconfig: drop the superfluous PCI dependency - set up default FB size for Bochs
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/Kconfig15
-rw-r--r--drivers/video/bochs.c12
-rw-r--r--drivers/video/bochs.h7
-rw-r--r--drivers/video/tidss/tidss_drv.c18
-rw-r--r--drivers/video/video-uclass.c6
5 files changed, 29 insertions, 29 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index b41dc60cec..e32ce13fb6 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -64,8 +64,9 @@ config BACKLIGHT
config VIDEO_PCI_DEFAULT_FB_SIZE
hex "Default framebuffer size to use if no drivers request it"
- default 0x1000000 if X86 && PCI
- default 0 if !(X86 && PCI)
+ default 0x1000000 if X86
+ default 0x800000 if !X86 && VIDEO_BOCHS
+ default 0 if !X86 && !VIDEO_BOCHS
help
Generally, video drivers request the amount of memory they need for
the frame buffer when they are bound, by setting the size field in
@@ -77,7 +78,7 @@ config VIDEO_PCI_DEFAULT_FB_SIZE
devices to have a framebuffer allocated by U-Boot.
Note: the framebuffer needs to be large enough to store all pixels at
- maximum resolution. For example, at 1920 x 1200 with 32 bits per
+ maximum resolution. For example, at 2560 x 1600 with 32 bits per
pixel, 2560 * 1600 * 32 / 8 = 0xfa0000 bytes are needed.
config VIDEO_COPY
@@ -280,7 +281,6 @@ config VIDCONSOLE_AS_NAME
config VIDEO_BOCHS
bool "Enable Bochs video emulation for QEMU"
- depends on X86
help
Enable this to use the Bochs video support provided in the QEMU
emulator. This appears as a PCI device which U-Boot can set up to
@@ -1037,8 +1037,9 @@ config SPL_SYS_WHITE_ON_BLACK
config SPL_VIDEO_PCI_DEFAULT_FB_SIZE
hex "Default framebuffer size to use if no drivers request it at SPL"
- default 0x1000000 if X86 && PCI
- default 0 if !(X86 && PCI)
+ default 0x1000000 if X86
+ default 0x800000 if !X86 && VIDEO_BOCHS
+ default 0 if !X86 && !VIDEO_BOCHS
help
Generally, video drivers request the amount of memory they need for
the frame buffer when they are bound, by setting the size field in
@@ -1050,7 +1051,7 @@ config SPL_VIDEO_PCI_DEFAULT_FB_SIZE
devices to have a framebuffer allocated by U-Boot.
Note: the framebuffer needs to be large enough to store all pixels at
- maximum resolution. For example, at 1920 x 1200 with 32 bits per
+ maximum resolution. For example, at 2560 x 1600 with 32 bits per
pixel, 2560 * 1600 * 32 / 8 = 0xfa0000 bytes are needed.
config SPL_CONSOLE_SCROLL_LINES
diff --git a/drivers/video/bochs.c b/drivers/video/bochs.c
index 2136b51193..022ea38d4c 100644
--- a/drivers/video/bochs.c
+++ b/drivers/video/bochs.c
@@ -11,7 +11,6 @@
#include <pci.h>
#include <video.h>
#include <asm/io.h>
-#include <asm/mtrr.h>
#include <linux/sizes.h>
#include "bochs.h"
@@ -28,9 +27,9 @@ static int bochs_read(void *mmio, int index)
return readw(mmio + MMIO_BASE + index * 2);
}
-static void bochs_vga_write(int index, uint8_t val)
+static void bochs_vga_write(void *mmio, int index, uint8_t val)
{
- outb(val, VGA_INDEX);
+ writeb(val, mmio + VGA_BASE + index);
}
static int bochs_init_fb(struct udevice *dev)
@@ -79,7 +78,8 @@ static int bochs_init_fb(struct udevice *dev)
bochs_write(mmio, INDEX_Y_OFFSET, 0);
bochs_write(mmio, INDEX_ENABLE, ENABLED | LFB_ENABLED);
- bochs_vga_write(0, 0x20); /* disable blanking */
+ /* disable blanking */
+ bochs_vga_write(mmio, VGA_ATT_W - VGA_INDEX, VGA_AR_ENABLE_DISPLAY);
plat->base = fb;
@@ -101,8 +101,8 @@ static int bochs_video_bind(struct udevice *dev)
{
struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev);
- /* Set the maximum supported resolution */
- uc_plat->size = 2560 * 1600 * 4;
+ /* Set the frame buffer size per configuration */
+ uc_plat->size = xsize * ysize * 32 / 8;
log_debug("%s: Frame buffer size %x\n", __func__, uc_plat->size);
return 0;
diff --git a/drivers/video/bochs.h b/drivers/video/bochs.h
index 4c8ec83a55..3facf690e5 100644
--- a/drivers/video/bochs.h
+++ b/drivers/video/bochs.h
@@ -6,10 +6,10 @@
#ifndef __BOCHS_H
#define __BOCHS_H
-#define VGA_INDEX 0x3c0
+#define VGA_INDEX 0x3c0
-#define IOPORT_INDEX 0x01ce
-#define IOPORT_DATA 0x01cf
+#define VGA_ATT_W 0x3c0
+#define VGA_AR_ENABLE_DISPLAY 0x20
enum {
INDEX_ID,
@@ -31,6 +31,7 @@ enum {
#define LFB_ENABLED BIT(6)
#define NOCLEARMEM BIT(7)
+#define VGA_BASE 0x400
#define MMIO_BASE 0x500
#endif
diff --git a/drivers/video/tidss/tidss_drv.c b/drivers/video/tidss/tidss_drv.c
index 078e3e82e3..e285f255d7 100644
--- a/drivers/video/tidss/tidss_drv.c
+++ b/drivers/video/tidss/tidss_drv.c
@@ -901,18 +901,10 @@ static int tidss_drv_probe(struct udevice *dev)
static int tidss_drv_remove(struct udevice *dev)
{
- u32 val;
- int ret;
- struct tidss_drv_priv *priv = dev_get_priv(dev);
+ if (CONFIG_IS_ENABLED(VIDEO_REMOVE)) {
+ struct tidss_drv_priv *priv = dev_get_priv(dev);
- priv->base_common = dev_remap_addr_index(dev, 0);
- REG_FLD_MOD(priv, DSS_SYSCONFIG, 1, 1, 1);
- /* Wait for reset to complete */
- ret = readl_poll_timeout(priv->base_common + DSS_SYSSTATUS,
- val, val & 1, 5000);
- if (ret) {
- dev_warn(priv->dev, "failed to reset priv\n");
- return ret;
+ VP_REG_FLD_MOD(priv, 0, DSS_VP_CONTROL, 0, 0, 0);
}
return 0;
}
@@ -939,5 +931,9 @@ U_BOOT_DRIVER(tidss_drv) = {
.probe = tidss_drv_probe,
.remove = tidss_drv_remove,
.priv_auto = sizeof(struct tidss_drv_priv),
+#if CONFIG_IS_ENABLED(VIDEO_REMOVE)
.flags = DM_FLAG_OS_PREPARE,
+#else
+ .flags = DM_FLAG_OS_PREPARE | DM_FLAG_LEAVE_PD_ON,
+#endif
};
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 949595f1bc..8f268fc406 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -626,10 +626,12 @@ static int video_post_bind(struct udevice *dev)
addr = uc_priv->video_ptr;
size = alloc_fb(dev, &addr);
if (addr < gd->video_bottom) {
- /* Device tree node may need the 'bootph-all' or
+ /*
+ * Device tree node may need the 'bootph-all' or
* 'bootph-some-ram' tag
*/
- printf("Video device '%s' cannot allocate frame buffer memory -ensure the device is set up before relocation\n",
+ printf("Video device '%s' cannot allocate frame buffer memory "
+ "- ensure the device is set up before relocation\n",
dev->name);
return -ENOSPC;
}