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
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index b41dc60..e32ce13 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -64,8 +64,9 @@
 
 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 @@
 	  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 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_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 @@
 	  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 2136b51..022ea38 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 @@
 	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 @@
 	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 @@
 {
 	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 4c8ec83..3facf69 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 @@
 #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 078e3e8..e285f25 100644
--- a/drivers/video/tidss/tidss_drv.c
+++ b/drivers/video/tidss/tidss_drv.c
@@ -901,18 +901,10 @@
 
 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 @@
 	.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 949595f..8f268fc 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -626,10 +626,12 @@
 	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;
 	}