aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig2
-rw-r--r--common/Makefile4
-rw-r--r--common/board_f.c27
-rw-r--r--common/fdt_simplefb.c10
-rw-r--r--common/fdt_support.c29
-rw-r--r--common/lcd.c578
-rw-r--r--common/lcd_console.c260
-rw-r--r--common/lcd_console_rotation.c194
-rw-r--r--common/splash.c17
-rw-r--r--common/splash_source.c31
-rw-r--r--common/stdio.c9
11 files changed, 57 insertions, 1104 deletions
diff --git a/common/Kconfig b/common/Kconfig
index 6608a4f0fc..62e7fb5d0e 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -194,7 +194,7 @@ config CONSOLE_FLUSH_SUPPORT
config CONSOLE_MUX
bool "Enable console multiplexing"
- default y if DM_VIDEO || VIDEO || LCD
+ default y if VIDEO || VIDEO || LCD
help
This allows multiple devices to be used for each console 'file'.
For example, stdout can be set to go to serial and video.
diff --git a/common/Makefile b/common/Makefile
index 1d56c9f289..20addfb244 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -35,10 +35,6 @@ obj-$(CONFIG_I2C_EDID) += edid.o
obj-$(CONFIG_KALLSYMS) += kallsyms.o
obj-y += splash.o
obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o
-ifndef CONFIG_DM_VIDEO
-obj-$(CONFIG_LCD) += lcd.o lcd_console.o
-endif
-obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o
obj-$(CONFIG_MENU) += menu.o
obj-$(CONFIG_UPDATE_COMMON) += update.o
obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
diff --git a/common/board_f.c b/common/board_f.c
index 4355d1c82d..51ba593189 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -28,7 +28,6 @@
#include <i2c.h>
#include <init.h>
#include <initcall.h>
-#include <lcd.h>
#include <log.h>
#include <malloc.h>
#include <mapmem.h>
@@ -409,22 +408,18 @@ __weak int arch_reserve_mmu(void)
static int reserve_video(void)
{
-#ifdef CONFIG_DM_VIDEO
- ulong addr;
- int ret;
+ if (IS_ENABLED(CONFIG_VIDEO)) {
+ ulong addr;
+ int ret;
- addr = gd->relocaddr;
- ret = video_reserve(&addr);
- if (ret)
- return ret;
- debug("Reserving %luk for video at: %08lx\n",
- ((unsigned long)gd->relocaddr - addr) >> 10, addr);
- gd->relocaddr = addr;
-#elif defined(CONFIG_LCD)
- /* reserve memory for LCD display (always full pages) */
- gd->relocaddr = lcd_setmem(gd->relocaddr);
- gd->fb_base = gd->relocaddr;
-#endif
+ addr = gd->relocaddr;
+ ret = video_reserve(&addr);
+ if (ret)
+ return ret;
+ debug("Reserving %luk for video at: %08lx\n",
+ ((unsigned long)gd->relocaddr - addr) >> 10, addr);
+ gd->relocaddr = addr;
+ }
return 0;
}
diff --git a/common/fdt_simplefb.c b/common/fdt_simplefb.c
index c52846f4bc..71d4c8fde9 100644
--- a/common/fdt_simplefb.c
+++ b/common/fdt_simplefb.c
@@ -8,7 +8,6 @@
#include <common.h>
#include <dm.h>
-#include <lcd.h>
#include <fdt_support.h>
#include <asm/global_data.h>
#include <linux/libfdt.h>
@@ -22,7 +21,6 @@ static int fdt_simplefb_configure_node(void *blob, int off)
int bpix; /* log2 of bits per pixel */
const char *name;
ulong fb_base;
-#ifdef CONFIG_DM_VIDEO
struct video_uc_plat *plat;
struct video_priv *uc_priv;
struct udevice *dev;
@@ -37,12 +35,6 @@ static int fdt_simplefb_configure_node(void *blob, int off)
ysize = uc_priv->ysize;
bpix = uc_priv->bpix;
fb_base = plat->base;
-#else
- xsize = lcd_get_pixel_width();
- ysize = lcd_get_pixel_height();
- bpix = LCD_BPP;
- fb_base = gd->fb_base;
-#endif
switch (bpix) {
case 4: /* VIDEO_BPP16 */
name = "r5g6b5";
@@ -90,7 +82,7 @@ int fdt_simplefb_enable_existing_node(void *blob)
return fdt_simplefb_configure_node(blob, off);
}
-#if CONFIG_IS_ENABLED(DM_VIDEO)
+#if CONFIG_IS_ENABLED(VIDEO)
int fdt_simplefb_enable_and_mem_rsv(void *blob)
{
struct fdt_memory mem;
diff --git a/common/fdt_support.c b/common/fdt_support.c
index baf7fb7065..ebebffc789 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -1740,35 +1740,6 @@ int fdt_set_status_by_pathf(void *fdt, enum fdt_status status, const char *fmt,
return fdt_set_node_status(fdt, offset, status);
}
-#if defined(CONFIG_LCD)
-int fdt_add_edid(void *blob, const char *compat, unsigned char *edid_buf)
-{
- int noff;
- int ret;
-
- noff = fdt_node_offset_by_compatible(blob, -1, compat);
- if (noff != -FDT_ERR_NOTFOUND) {
- debug("%s: %s\n", fdt_get_name(blob, noff, 0), compat);
-add_edid:
- ret = fdt_setprop(blob, noff, "edid", edid_buf, 128);
- if (ret == -FDT_ERR_NOSPACE) {
- ret = fdt_increase_size(blob, 512);
- if (!ret)
- goto add_edid;
- else
- goto err_size;
- } else if (ret < 0) {
- printf("Can't add property: %s\n", fdt_strerror(ret));
- return ret;
- }
- }
- return 0;
-err_size:
- printf("Can't increase blob size: %s\n", fdt_strerror(ret));
- return ret;
-}
-#endif
-
/*
* Verify the physical address of device tree node for a given alias
*
diff --git a/common/lcd.c b/common/lcd.c
deleted file mode 100644
index a462b22a47..0000000000
--- a/common/lcd.c
+++ /dev/null
@@ -1,578 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Common LCD routines
- *
- * (C) Copyright 2001-2002
- * Wolfgang Denk, DENX Software Engineering -- wd@denx.de
- */
-
-/* #define DEBUG */
-#include <config.h>
-#include <common.h>
-#include <command.h>
-#include <cpu_func.h>
-#include <env_callback.h>
-#include <log.h>
-#include <asm/cache.h>
-#include <init.h>
-#include <asm/global_data.h>
-#include <linux/types.h>
-#include <stdio_dev.h>
-#include <lcd.h>
-#include <mapmem.h>
-#include <watchdog.h>
-#include <asm/unaligned.h>
-#include <splash.h>
-#include <asm/io.h>
-#include <asm/unaligned.h>
-#include <video_font.h>
-
-#ifdef CONFIG_LCD_LOGO
-#include <bmp_logo.h>
-#include <bmp_logo_data.h>
-#if (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET) && (LCD_BPP != LCD_COLOR16)
-#error Default Color Map overlaps with Logo Color Map
-#endif
-#endif
-
-#ifndef CONFIG_LCD_ALIGNMENT
-#define CONFIG_LCD_ALIGNMENT PAGE_SIZE
-#endif
-
-#if (LCD_BPP != LCD_COLOR8) && (LCD_BPP != LCD_COLOR16) && \
- (LCD_BPP != LCD_COLOR32)
-#error Unsupported LCD BPP.
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static int lcd_init(void *lcdbase);
-static void lcd_logo(void);
-static void lcd_setfgcolor(int color);
-static void lcd_setbgcolor(int color);
-
-static int lcd_color_fg;
-static int lcd_color_bg;
-int lcd_line_length;
-char lcd_is_enabled = 0;
-static void *lcd_base; /* Start of framebuffer memory */
-static char lcd_flush_dcache; /* 1 to flush dcache after each lcd update */
-
-/* Flush LCD activity to the caches */
-void lcd_sync(void)
-{
- /*
- * flush_dcache_range() is declared in common.h but it seems that some
- * architectures do not actually implement it. Is there a way to find
- * out whether it exists? For now, ARM is safe.
- */
-#if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
- int line_length;
-
- if (lcd_flush_dcache)
- flush_dcache_range((ulong)lcd_base,
- (ulong)(lcd_base + lcd_get_size(&line_length)));
-#endif
-}
-
-void lcd_set_flush_dcache(int flush)
-{
- lcd_flush_dcache = (flush != 0);
-}
-
-static void lcd_stub_putc(struct stdio_dev *dev, const char c)
-{
- lcd_putc(c);
-}
-
-static void lcd_stub_puts(struct stdio_dev *dev, const char *s)
-{
- lcd_puts(s);
-}
-
-/*
- * With most lcd drivers the line length is set up
- * by calculating it from panel_info parameters. Some
- * drivers need to calculate the line length differently,
- * so make the function weak to allow overriding it.
- */
-__weak int lcd_get_size(int *line_length)
-{
- *line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
- return *line_length * panel_info.vl_row;
-}
-
-int drv_lcd_init(void)
-{
- struct stdio_dev lcddev;
- int rc;
-
- lcd_base = map_sysmem(gd->fb_base, 0);
-
- lcd_init(lcd_base);
-
- /* Device initialization */
- memset(&lcddev, 0, sizeof(lcddev));
-
- strcpy(lcddev.name, "lcd");
- lcddev.ext = 0; /* No extensions */
- lcddev.flags = DEV_FLAGS_OUTPUT; /* Output only */
- lcddev.putc = lcd_stub_putc; /* 'putc' function */
- lcddev.puts = lcd_stub_puts; /* 'puts' function */
-
- rc = stdio_register(&lcddev);
-
- return (rc == 0) ? 1 : rc;
-}
-
-void lcd_clear(void)
-{
- int bg_color;
- __maybe_unused ulong addr;
- static int do_splash = 1;
-#if LCD_BPP == LCD_COLOR8
- /* Setting the palette */
- lcd_setcolreg(CONSOLE_COLOR_BLACK, 0, 0, 0);
- lcd_setcolreg(CONSOLE_COLOR_RED, 0xFF, 0, 0);
- lcd_setcolreg(CONSOLE_COLOR_GREEN, 0, 0xFF, 0);
- lcd_setcolreg(CONSOLE_COLOR_YELLOW, 0xFF, 0xFF, 0);
- lcd_setcolreg(CONSOLE_COLOR_BLUE, 0, 0, 0xFF);
- lcd_setcolreg(CONSOLE_COLOR_MAGENTA, 0xFF, 0, 0xFF);
- lcd_setcolreg(CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF);
- lcd_setcolreg(CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA);
- lcd_setcolreg(CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF);
-#endif
-
-#ifndef CONFIG_SYS_WHITE_ON_BLACK
- lcd_setfgcolor(CONSOLE_COLOR_BLACK);
- lcd_setbgcolor(CONSOLE_COLOR_WHITE);
- bg_color = CONSOLE_COLOR_WHITE;
-#else
- lcd_setfgcolor(CONSOLE_COLOR_WHITE);
- lcd_setbgcolor(CONSOLE_COLOR_BLACK);
- bg_color = CONSOLE_COLOR_BLACK;
-#endif /* CONFIG_SYS_WHITE_ON_BLACK */
-
- /* set framebuffer to background color */
-#if (LCD_BPP != LCD_COLOR32)
- memset((char *)lcd_base, bg_color, lcd_line_length * panel_info.vl_row);
-#else
- u32 *ppix = lcd_base;
- u32 i;
- for (i = 0;
- i < (lcd_line_length * panel_info.vl_row)/NBYTES(panel_info.vl_bpix);
- i++) {
- *ppix++ = bg_color;
- }
-#endif
- /* setup text-console */
- debug("[LCD] setting up console...\n");
- lcd_init_console(lcd_base,
- panel_info.vl_col,
- panel_info.vl_row,
- panel_info.vl_rot);
- /* Paint the logo and retrieve LCD base address */
- debug("[LCD] Drawing the logo...\n");
- if (do_splash) {
- if (splash_display() == 0) {
- do_splash = 0;
- lcd_sync();
- return;
- }
- }
-
- lcd_logo();
-#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
- addr = (ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length;
- lcd_init_console((void *)addr, panel_info.vl_col,
- panel_info.vl_row, panel_info.vl_rot);
-#endif
- lcd_sync();
-}
-
-static int lcd_init(void *lcdbase)
-{
- debug("[LCD] Initializing LCD frambuffer at %p\n", lcdbase);
- lcd_ctrl_init(lcdbase);
-
- /*
- * lcd_ctrl_init() of some drivers (i.e. bcm2835 on rpi) ignores
- * the 'lcdbase' argument and uses custom lcd base address
- * by setting up gd->fb_base. Check for this condition and fixup
- * 'lcd_base' address.
- */
- if (map_to_sysmem(lcdbase) != gd->fb_base)
- lcd_base = map_sysmem(gd->fb_base, 0);
-
- debug("[LCD] Using LCD frambuffer at %p\n", lcd_base);
-
- lcd_get_size(&lcd_line_length);
- lcd_is_enabled = 1;
- lcd_clear();
- lcd_enable();
-
- /* Initialize the console */
- lcd_set_col(0);
-#ifdef CONFIG_LCD_INFO_BELOW_LOGO
- lcd_set_row(7 + BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT);
-#else
- lcd_set_row(1); /* leave 1 blank line below logo */
-#endif
-
- return 0;
-}
-
-/*
- * This is called early in the system initialization to grab memory
- * for the LCD controller.
- * Returns new address for monitor, after reserving LCD buffer memory
- *
- * Note that this is running from ROM, so no write access to global data.
- */
-ulong lcd_setmem(ulong addr)
-{
- ulong size;
- int line_length;
-
- debug("LCD panel info: %d x %d, %d bit/pix\n", panel_info.vl_col,
- panel_info.vl_row, NBITS(panel_info.vl_bpix));
-
- size = lcd_get_size(&line_length);
-
- /* Round up to nearest full page, or MMU section if defined */
- size = ALIGN(size, CONFIG_LCD_ALIGNMENT);
- addr = ALIGN(addr - CONFIG_LCD_ALIGNMENT + 1, CONFIG_LCD_ALIGNMENT);
-
- /* Allocate pages for the frame buffer. */
- addr -= size;
-
- debug("Reserving %ldk for LCD Framebuffer at: %08lx\n",
- size >> 10, addr);
-
- return addr;
-}
-
-static void lcd_setfgcolor(int color)
-{
- lcd_color_fg = color;
-}
-
-int lcd_getfgcolor(void)
-{
- return lcd_color_fg;
-}
-
-static void lcd_setbgcolor(int color)
-{
- lcd_color_bg = color;
-}
-
-int lcd_getbgcolor(void)
-{
- return lcd_color_bg;
-}
-
-#ifdef CONFIG_LCD_LOGO
-__weak void lcd_logo_set_cmap(void)
-{
- int i;
- ushort *cmap = configuration_get_cmap();
-
- for (i = 0; i < ARRAY_SIZE(bmp_logo_palette); ++i)
- *cmap++ = bmp_logo_palette[i];
-}
-
-void lcd_logo_plot(int x, int y)
-{
- ushort i, j;
- uchar *bmap = &bmp_logo_bitmap[0];
- unsigned bpix = NBITS(panel_info.vl_bpix);
- uchar *fb = (uchar *)(lcd_base + y * lcd_line_length + x * bpix / 8);
- ushort *fb16;
-
- debug("Logo: width %d height %d colors %d\n",
- BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS);
-
- if (bpix < 12) {
- schedule();
- lcd_logo_set_cmap();
- schedule();
-
- for (i = 0; i < BMP_LOGO_HEIGHT; ++i) {
- memcpy(fb, bmap, BMP_LOGO_WIDTH);
- bmap += BMP_LOGO_WIDTH;
- fb += panel_info.vl_col;
- }
- }
- else { /* true color mode */
- u16 col16;
- fb16 = (ushort *)fb;
- for (i = 0; i < BMP_LOGO_HEIGHT; ++i) {
- for (j = 0; j < BMP_LOGO_WIDTH; j++) {
- col16 = bmp_logo_palette[(bmap[j]-16)];
- fb16[j] =
- ((col16 & 0x000F) << 1) |
- ((col16 & 0x00F0) << 3) |
- ((col16 & 0x0F00) << 4);
- }
- bmap += BMP_LOGO_WIDTH;
- fb16 += panel_info.vl_col;
- }
- }
-
- schedule();
- lcd_sync();
-}
-#else
-static inline void lcd_logo_plot(int x, int y) {}
-#endif /* CONFIG_LCD_LOGO */
-
-#if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
-#ifdef CONFIG_SPLASH_SCREEN_ALIGN
-
-static void splash_align_axis(int *axis, unsigned long panel_size,
- unsigned long picture_size)
-{
- unsigned long panel_picture_delta = panel_size - picture_size;
- unsigned long axis_alignment;
-
- if (*axis == BMP_ALIGN_CENTER)
- axis_alignment = panel_picture_delta / 2;
- else if (*axis < 0)
- axis_alignment = panel_picture_delta + *axis + 1;
- else
- return;
-
- *axis = max(0, (int)axis_alignment);
-}
-#endif
-
-__weak void fb_put_byte(uchar **fb, uchar **from)
-{
- *(*fb)++ = *(*from)++;
-}
-
-#if defined(CONFIG_BMP_16BPP)
-__weak void fb_put_word(uchar **fb, uchar **from)
-{
- *(*fb)++ = *(*from)++;
- *(*fb)++ = *(*from)++;
-}
-#endif /* CONFIG_BMP_16BPP */
-
-__weak void lcd_set_cmap(struct bmp_image *bmp, unsigned colors)
-{
- int i;
- struct bmp_color_table_entry cte;
- ushort *cmap = configuration_get_cmap();
-
- for (i = 0; i < colors; ++i) {
- cte = bmp->color_table[i];
- *cmap = (((cte.red) << 8) & 0xf800) |
- (((cte.green) << 3) & 0x07e0) |
- (((cte.blue) >> 3) & 0x001f);
- cmap++;
- }
-}
-
-int lcd_display_bitmap(ulong bmp_image, int x, int y)
-{
- ushort *cmap_base = NULL;
- ushort i, j;
- uchar *fb;
- struct bmp_image *bmp = (struct bmp_image *)map_sysmem(bmp_image, 0);
- uchar *bmap;
- ushort padded_width;
- unsigned long width, height, byte_width;
- unsigned long pwidth = panel_info.vl_col;
- unsigned colors, bpix, bmp_bpix;
- int hdr_size;
- struct bmp_color_table_entry *palette;
-
- if (!bmp || !(bmp->header.signature[0] == 'B' &&
- bmp->header.signature[1] == 'M')) {
- printf("Error: no valid bmp image at %lx\n", bmp_image);
-
- return 1;
- }
-
- palette = bmp->color_table;
- width = get_unaligned_le32(&bmp->header.width);
- height = get_unaligned_le32(&bmp->header.height);
- bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
- hdr_size = get_unaligned_le16(&bmp->header.size);
- debug("hdr_size=%d, bmp_bpix=%d\n", hdr_size, bmp_bpix);
-
- colors = 1 << bmp_bpix;
-
- bpix = NBITS(panel_info.vl_bpix);
-
- if (bpix != 1 && bpix != 8 && bpix != 16 && bpix != 32) {
- printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
- bpix, bmp_bpix);
-
- return 1;
- }
-
- /*
- * We support displaying 8bpp BMPs on 16bpp LCDs
- * and displaying 24bpp BMPs on 32bpp LCDs
- * */
- if (bpix != bmp_bpix &&
- !(bmp_bpix == 8 && bpix == 16) &&
- !(bmp_bpix == 24 && bpix == 32)) {
- printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
- bpix, get_unaligned_le16(&bmp->header.bit_count));
- return 1;
- }
-
- debug("Display-bmp: %d x %d with %d colors, display %d\n",
- (int)width, (int)height, (int)colors, 1 << bpix);
-
- if (bmp_bpix == 8)
- lcd_set_cmap(bmp, colors);
-
- padded_width = (width & 0x3 ? (width & ~0x3) + 4 : width);
-
-#ifdef CONFIG_SPLASH_SCREEN_ALIGN
- splash_align_axis(&x, pwidth, width);
- splash_align_axis(&y, panel_info.vl_row, height);
-#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
-
- if ((x + width) > pwidth)
- width = pwidth - x;
- if ((y + height) > panel_info.vl_row)
- height = panel_info.vl_row - y;
-
- bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
- fb = (uchar *)(lcd_base +
- (y + height - 1) * lcd_line_length + x * bpix / 8);
-
- switch (bmp_bpix) {
- case 1:
- case 8: {
- cmap_base = configuration_get_cmap();
-
- if (bpix != 16)
- byte_width = width;
- else
- byte_width = width * 2;
-
- for (i = 0; i < height; ++i) {
- schedule();
- for (j = 0; j < width; j++) {
- if (bpix != 16) {
- fb_put_byte(&fb, &bmap);
- } else {
- struct bmp_color_table_entry *entry;
- uint val;
-
- if (cmap_base) {
- val = cmap_base[*bmap];
- } else {
- entry = &palette[*bmap];
- val = entry->blue >> 3 |
- entry->green >> 2 << 5 |
- entry->red >> 3 << 11;
- }
- *(uint16_t *)fb = val;
- bmap++;
- fb += sizeof(uint16_t) / sizeof(*fb);
- }
- }
- bmap += (padded_width - width);
- fb -= byte_width + lcd_line_length;
- }
- break;
- }
-#if defined(CONFIG_BMP_16BPP)
- case 16:
- for (i = 0; i < height; ++i) {
- schedule();
- for (j = 0; j < width; j++)
- fb_put_word(&fb, &bmap);
-
- bmap += (padded_width - width) * 2;
- fb -= width * 2 + lcd_line_length;
- }
- break;
-#endif /* CONFIG_BMP_16BPP */
-#if defined(CONFIG_BMP_24BPP)
- case 24:
- for (i = 0; i < height; ++i) {
- for (j = 0; j < width; j++) {
- *(fb++) = *(bmap++);
- *(fb++) = *(bmap++);
- *(fb++) = *(bmap++);
- *(fb++) = 0;
- }
- fb -= lcd_line_length + width * (bpix / 8);
- }
- break;
-#endif /* CONFIG_BMP_24BPP */
-#if defined(CONFIG_BMP_32BPP)
- case 32:
- for (i = 0; i < height; ++i) {
- for (j = 0; j < width; j++) {
- *(fb++) = *(bmap++);
- *(fb++) = *(bmap++);
- *(fb++) = *(bmap++);
- *(fb++) = *(bmap++);
- }
- fb -= lcd_line_length + width * (bpix / 8);
- }
- break;
-#endif /* CONFIG_BMP_32BPP */
- default:
- break;
- };
-
- lcd_sync();
- return 0;
-}
-#endif
-
-static void lcd_logo(void)
-{
- lcd_logo_plot(0, 0);
-
-#ifdef CONFIG_LCD_INFO
- lcd_set_col(LCD_INFO_X / VIDEO_FONT_WIDTH);
- lcd_set_row(LCD_INFO_Y / VIDEO_FONT_HEIGHT);
- lcd_show_board_info();
-#endif /* CONFIG_LCD_INFO */
-}
-
-#ifdef CONFIG_SPLASHIMAGE_GUARD
-static int on_splashimage(const char *name, const char *value, enum env_op op,
- int flags)
-{
- ulong addr;
- int aligned;
-
- if (op == env_op_delete)
- return 0;
-
- addr = hextoul(value, NULL);
- /* See README.displaying-bmps */
- aligned = (addr % 4 == 2);
- if (!aligned) {
- printf("Invalid splashimage value. Value must be 16 bit aligned, but not 32 bit aligned\n");
- return -1;
- }
-
- return 0;
-}
-
-U_BOOT_ENV_CALLBACK(splashimage, on_splashimage);
-#endif
-
-int lcd_get_pixel_width(void)
-{
- return panel_info.vl_col;
-}
-
-int lcd_get_pixel_height(void)
-{
- return panel_info.vl_row;
-}
diff --git a/common/lcd_console.c b/common/lcd_console.c
deleted file mode 100644
index ed36c78440..0000000000
--- a/common/lcd_console.c
+++ /dev/null
@@ -1,260 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2001-2015
- * DENX Software Engineering -- wd@denx.de
- * Compulab Ltd - http://compulab.co.il/
- * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
- */
-
-#include <common.h>
-#include <command.h>
-#include <lcd.h>
-#include <log.h>
-#include <serial.h>
-#include <video_font.h> /* Get font data, width and height */
-#if defined(CONFIG_LCD_LOGO)
-#include <bmp_logo.h>
-#endif
-
-static struct console_t cons;
-
-void lcd_set_col(short col)
-{
- cons.curr_col = col;
-}
-
-void lcd_set_row(short row)
-{
- cons.curr_row = row;
-}
-
-void lcd_position_cursor(unsigned col, unsigned row)
-{
- cons.curr_col = min_t(short, col, cons.cols - 1);
- cons.curr_row = min_t(short, row, cons.rows - 1);
-}
-
-int lcd_get_screen_rows(void)
-{
- return cons.rows;
-}
-
-int lcd_get_screen_columns(void)
-{
- return cons.cols;
-}
-
-static void lcd_putc_xy0(struct console_t *pcons, ushort x, ushort y, char c)
-{
- int fg_color = lcd_getfgcolor();
- int bg_color = lcd_getbgcolor();
- int i, row;
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- y * pcons->lcdsizex +
- x;
-
- for (row = 0; row < VIDEO_FONT_HEIGHT; row++) {
- uchar bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
- for (i = 0; i < VIDEO_FONT_WIDTH; ++i) {
- *dst++ = (bits & 0x80) ? fg_color : bg_color;
- bits <<= 1;
- }
- dst += (pcons->lcdsizex - VIDEO_FONT_WIDTH);
- }
-}
-
-static inline void console_setrow0(struct console_t *pcons, u32 row, int clr)
-{
- int i;
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- row * VIDEO_FONT_HEIGHT *
- pcons->lcdsizex;
-
- for (i = 0; i < (VIDEO_FONT_HEIGHT * pcons->lcdsizex); i++)
- *dst++ = clr;
-}
-
-static inline void console_moverow0(struct console_t *pcons,
- u32 rowdst, u32 rowsrc)
-{
- int i;
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- rowdst * VIDEO_FONT_HEIGHT *
- pcons->lcdsizex;
-
- fbptr_t *src = (fbptr_t *)pcons->fbbase +
- rowsrc * VIDEO_FONT_HEIGHT *
- pcons->lcdsizex;
-
- for (i = 0; i < (VIDEO_FONT_HEIGHT * pcons->lcdsizex); i++)
- *dst++ = *src++;
-}
-
-static inline void console_back(void)
-{
- if (--cons.curr_col < 0) {
- cons.curr_col = cons.cols - 1;
- if (--cons.curr_row < 0)
- cons.curr_row = 0;
- }
-
- cons.fp_putc_xy(&cons,
- cons.curr_col * VIDEO_FONT_WIDTH,
- cons.curr_row * VIDEO_FONT_HEIGHT, ' ');
-}
-
-static inline void console_newline(void)
-{
- const int rows = CONFIG_CONSOLE_SCROLL_LINES;
- int bg_color = lcd_getbgcolor();
- int i;
-
- cons.curr_col = 0;
-
- /* Check if we need to scroll the terminal */
- if (++cons.curr_row >= cons.rows) {
- for (i = 0; i < cons.rows-rows; i++)
- cons.fp_console_moverow(&cons, i, i+rows);
- for (i = 0; i < rows; i++)
- cons.fp_console_setrow(&cons, cons.rows-i-1, bg_color);
- cons.curr_row -= rows;
- }
- lcd_sync();
-}
-
-void console_calc_rowcol(struct console_t *pcons, u32 sizex, u32 sizey)
-{
- pcons->cols = sizex / VIDEO_FONT_WIDTH;
-#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
- pcons->rows = (pcons->lcdsizey - BMP_LOGO_HEIGHT);
- pcons->rows /= VIDEO_FONT_HEIGHT;
-#else
- pcons->rows = sizey / VIDEO_FONT_HEIGHT;
-#endif
-}
-
-void __weak lcd_init_console_rot(struct console_t *pcons)
-{
- return;
-}
-
-void lcd_init_console(void *address, int vl_cols, int vl_rows, int vl_rot)
-{
- memset(&cons, 0, sizeof(cons));
- cons.fbbase = address;
-
- cons.lcdsizex = vl_cols;
- cons.lcdsizey = vl_rows;
- cons.lcdrot = vl_rot;
-
- cons.fp_putc_xy = &lcd_putc_xy0;
- cons.fp_console_moverow = &console_moverow0;
- cons.fp_console_setrow = &console_setrow0;
- console_calc_rowcol(&cons, cons.lcdsizex, cons.lcdsizey);
-
- lcd_init_console_rot(&cons);
-
- debug("lcd_console: have %d/%d col/rws on scr %dx%d (%d deg rotated)\n",
- cons.cols, cons.rows, cons.lcdsizex, cons.lcdsizey, vl_rot);
-}
-
-void lcd_putc(const char c)
-{
- if (!lcd_is_enabled) {
- serial_putc(c);
-
- return;
- }
-
- switch (c) {
- case '\r':
- cons.curr_col = 0;
- return;
- case '\n':
- console_newline();
-
- return;
- case '\t': /* Tab (8 chars alignment) */
- cons.curr_col += 8;
- cons.curr_col &= ~7;
-
- if (cons.curr_col >= cons.cols)
- console_newline();
-
- return;
- case '\b':
- console_back();
-
- return;
- default:
- cons.fp_putc_xy(&cons,
- cons.curr_col * VIDEO_FONT_WIDTH,
- cons.curr_row * VIDEO_FONT_HEIGHT, c);
- if (++cons.curr_col >= cons.cols)
- console_newline();
- }
-}
-
-void lcd_puts(const char *s)
-{
- if (!lcd_is_enabled) {
- serial_puts(s);
-
- return;
- }
-
- while (*s)
- lcd_putc(*s++);
-
- lcd_sync();
-}
-
-void lcd_printf(const char *fmt, ...)
-{
- va_list args;
- char buf[CONFIG_SYS_PBSIZE];
-
- va_start(args, fmt);
- vsprintf(buf, fmt, args);
- va_end(args);
-
- lcd_puts(buf);
-}
-
-static int do_lcd_setcursor(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[])
-{
- unsigned int col, row;
-
- if (argc != 3)
- return CMD_RET_USAGE;
-
- col = dectoul(argv[1], NULL);
- row = dectoul(argv[2], NULL);
- lcd_position_cursor(col, row);
-
- return 0;
-}
-
-static int do_lcd_puts(struct cmd_tbl *cmdtp, int flag, int argc,
- char *const argv[])
-{
- if (argc != 2)
- return CMD_RET_USAGE;
-
- lcd_puts(argv[1]);
-
- return 0;
-}
-
-U_BOOT_CMD(
- setcurs, 3, 1, do_lcd_setcursor,
- "set cursor position within screen",
- " <col> <row> in character"
-);
-
-U_BOOT_CMD(
- lcdputs, 2, 1, do_lcd_puts,
- "print string on lcd-framebuffer",
- " <string>"
-);
diff --git a/common/lcd_console_rotation.c b/common/lcd_console_rotation.c
deleted file mode 100644
index a5f5c6da7b..0000000000
--- a/common/lcd_console_rotation.c
+++ /dev/null
@@ -1,194 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2015
- * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
- */
-
-#include <common.h>
-#include <lcd.h>
-#include <video_font.h> /* Get font data, width and height */
-
-static void lcd_putc_xy90(struct console_t *pcons, ushort x, ushort y, char c)
-{
- int fg_color = lcd_getfgcolor();
- int bg_color = lcd_getbgcolor();
- int col, i;
-
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- (x+1) * pcons->lcdsizex -
- y;
-
- uchar msk = 0x80;
- uchar *pfont = video_fontdata + c * VIDEO_FONT_HEIGHT;
- for (col = 0; col < VIDEO_FONT_WIDTH; ++col) {
- for (i = 0; i < VIDEO_FONT_HEIGHT; ++i)
- *dst-- = (*(pfont + i) & msk) ? fg_color : bg_color;
- msk >>= 1;
- dst += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
- }
-}
-
-static inline void console_setrow90(struct console_t *pcons, u32 row, int clr)
-{
- int i, j;
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- pcons->lcdsizex -
- row*VIDEO_FONT_HEIGHT+1;
-
- for (j = 0; j < pcons->lcdsizey; j++) {
- for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
- *dst-- = clr;
- dst += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
- }
-}
-
-static inline void console_moverow90(struct console_t *pcons,
- u32 rowdst, u32 rowsrc)
-{
- int i, j;
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- pcons->lcdsizex -
- (rowdst*VIDEO_FONT_HEIGHT+1);
-
- fbptr_t *src = (fbptr_t *)pcons->fbbase +
- pcons->lcdsizex -
- (rowsrc*VIDEO_FONT_HEIGHT+1);
-
- for (j = 0; j < pcons->lcdsizey; j++) {
- for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
- *dst-- = *src--;
- src += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
- dst += (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
- }
-}
-static void lcd_putc_xy180(struct console_t *pcons, ushort x, ushort y, char c)
-{
- int fg_color = lcd_getfgcolor();
- int bg_color = lcd_getbgcolor();
- int i, row;
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- pcons->lcdsizex +
- pcons->lcdsizey * pcons->lcdsizex -
- y * pcons->lcdsizex -
- (x+1);
-
- for (row = 0; row < VIDEO_FONT_HEIGHT; row++) {
- uchar bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
-
- for (i = 0; i < VIDEO_FONT_WIDTH; ++i) {
- *dst-- = (bits & 0x80) ? fg_color : bg_color;
- bits <<= 1;
- }
- dst -= (pcons->lcdsizex - VIDEO_FONT_WIDTH);
- }
-}
-
-static inline void console_setrow180(struct console_t *pcons, u32 row, int clr)
-{
- int i;
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- (pcons->rows-row-1) * VIDEO_FONT_HEIGHT *
- pcons->lcdsizex;
-
- for (i = 0; i < (VIDEO_FONT_HEIGHT * pcons->lcdsizex); i++)
- *dst++ = clr;
-}
-
-static inline void console_moverow180(struct console_t *pcons,
- u32 rowdst, u32 rowsrc)
-{
- int i;
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- (pcons->rows-rowdst-1) * VIDEO_FONT_HEIGHT *
- pcons->lcdsizex;
-
- fbptr_t *src = (fbptr_t *)pcons->fbbase +
- (pcons->rows-rowsrc-1) * VIDEO_FONT_HEIGHT *
- pcons->lcdsizex;
-
- for (i = 0; i < (VIDEO_FONT_HEIGHT * pcons->lcdsizex); i++)
- *dst++ = *src++;
-}
-
-static void lcd_putc_xy270(struct console_t *pcons, ushort x, ushort y, char c)
-{
- int fg_color = lcd_getfgcolor();
- int bg_color = lcd_getbgcolor();
- int i, col;
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- pcons->lcdsizey * pcons->lcdsizex -
- (x+1) * pcons->lcdsizex +
- y;
-
- uchar msk = 0x80;
- uchar *pfont = video_fontdata + c * VIDEO_FONT_HEIGHT;
- for (col = 0; col < VIDEO_FONT_WIDTH; ++col) {
- for (i = 0; i < VIDEO_FONT_HEIGHT; ++i)
- *dst++ = (*(pfont + i) & msk) ? fg_color : bg_color;
- msk >>= 1;
- dst -= (pcons->lcdsizex + VIDEO_FONT_HEIGHT);
- }
-}
-
-static inline void console_setrow270(struct console_t *pcons, u32 row, int clr)
-{
- int i, j;
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- row*VIDEO_FONT_HEIGHT;
-
- for (j = 0; j < pcons->lcdsizey; j++) {
- for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
- *dst++ = clr;
- dst += (pcons->lcdsizex - VIDEO_FONT_HEIGHT);
- }
-}
-
-static inline void console_moverow270(struct console_t *pcons,
- u32 rowdst, u32 rowsrc)
-{
- int i, j;
- fbptr_t *dst = (fbptr_t *)pcons->fbbase +
- rowdst*VIDEO_FONT_HEIGHT;
-
- fbptr_t *src = (fbptr_t *)pcons->fbbase +
- rowsrc*VIDEO_FONT_HEIGHT;
-
- for (j = 0; j < pcons->lcdsizey; j++) {
- for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
- *dst++ = *src++;
- src += (pcons->lcdsizex - VIDEO_FONT_HEIGHT);
- dst += (pcons->lcdsizex - VIDEO_FONT_HEIGHT);
- }
-}
-
-static void console_calc_rowcol_rot(struct console_t *pcons)
-{
- if (pcons->lcdrot == 1 || pcons->lcdrot == 3)
- console_calc_rowcol(pcons, pcons->lcdsizey, pcons->lcdsizex);
- else
- console_calc_rowcol(pcons, pcons->lcdsizex, pcons->lcdsizey);
-}
-
-void lcd_init_console_rot(struct console_t *pcons)
-{
- if (pcons->lcdrot == 0) {
- return;
- } else if (pcons->lcdrot == 1) {
- pcons->fp_putc_xy = &lcd_putc_xy90;
- pcons->fp_console_moverow = &console_moverow90;
- pcons->fp_console_setrow = &console_setrow90;
- } else if (pcons->lcdrot == 2) {
- pcons->fp_putc_xy = &lcd_putc_xy180;
- pcons->fp_console_moverow = &console_moverow180;
- pcons->fp_console_setrow = &console_setrow180;
- } else if (pcons->lcdrot == 3) {
- pcons->fp_putc_xy = &lcd_putc_xy270;
- pcons->fp_console_moverow = &console_moverow270;
- pcons->fp_console_setrow = &console_setrow270;
- } else {
- printf("%s: invalid framebuffer rotation (%d)!\n",
- __func__, pcons->lcdrot);
- return;
- }
- console_calc_rowcol_rot(pcons);
-}
diff --git a/common/splash.c b/common/splash.c
index 0e520cc103..2e466a8a0f 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -24,7 +24,7 @@
#include <display_options.h>
#include <env.h>
#include <splash.h>
-#include <lcd.h>
+#include <video.h>
static struct splash_location default_splash_locations[] = {
{
@@ -40,6 +40,12 @@ static struct splash_location default_splash_locations[] = {
.devpart = "0:1",
},
{
+ .name = "mmc_raw",
+ .storage = SPLASH_STORAGE_MMC,
+ .flags = SPLASH_STORAGE_RAW,
+ .devpart = "0:1",
+ },
+ {
.name = "usb_fs",
.storage = SPLASH_STORAGE_USB,
.flags = SPLASH_STORAGE_FS,
@@ -113,7 +119,7 @@ void splash_get_pos(int *x, int *y)
}
#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
-#if defined(CONFIG_DM_VIDEO) && !defined(CONFIG_HIDE_LOGO_VERSION)
+#if defined(CONFIG_VIDEO) && !defined(CONFIG_HIDE_LOGO_VERSION)
#ifdef CONFIG_VIDEO_LOGO
#include <bmp_logo.h>
@@ -145,12 +151,11 @@ void splash_display_banner(void)
vidconsole_put_string(dev, buf);
vidconsole_position_cursor(dev, 0, row);
}
-#endif /* CONFIG_DM_VIDEO && !CONFIG_HIDE_LOGO_VERSION */
+#endif /* CONFIG_VIDEO && !CONFIG_HIDE_LOGO_VERSION */
/*
* Common function to show a splash image if env("splashimage") is set.
- * Is used for both dm_video and lcd video stacks. For additional
- * details please refer to doc/README.splashprepare.
+ * For additional details please refer to doc/README.splashprepare.
*/
#if defined(CONFIG_SPLASH_SCREEN) && defined(CONFIG_CMD_BMP)
int splash_display(void)
@@ -176,7 +181,7 @@ int splash_display(void)
if (x || y)
goto end;
-#if defined(CONFIG_DM_VIDEO) && !defined(CONFIG_HIDE_LOGO_VERSION)
+#if defined(CONFIG_VIDEO) && !defined(CONFIG_HIDE_LOGO_VERSION)
splash_display_banner();
#endif
end:
diff --git a/common/splash_source.c b/common/splash_source.c
index 87e55a54f8..a260137619 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -65,6 +65,30 @@ static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size)
}
#endif
+static int splash_mmc_read_raw(u32 bmp_load_addr, struct splash_location *location,
+ size_t read_size)
+{
+ struct disk_partition partition;
+ struct blk_desc *desc;
+ lbaint_t blkcnt;
+ int ret, n;
+
+ if (!IS_ENABLED(CONFIG_CMD_MMC)) {
+ debug("%s: mmc support not available\n", __func__);
+ return -ENOSYS;
+ }
+
+ ret = part_get_info_by_dev_and_name_or_num("mmc", location->devpart, &desc,
+ &partition, 1);
+ if (ret < 0)
+ return ret;
+
+ blkcnt = DIV_ROUND_UP(read_size, partition.blksz);
+ n = blk_dread(desc, partition.start, blkcnt, (void *)(uintptr_t)bmp_load_addr);
+
+ return (n == blkcnt) ? 0 : -EIO;
+}
+
static int splash_storage_read_raw(struct splash_location *location,
u32 bmp_load_addr, size_t read_size)
{
@@ -75,6 +99,8 @@ static int splash_storage_read_raw(struct splash_location *location,
offset = location->offset;
switch (location->storage) {
+ case SPLASH_STORAGE_MMC:
+ return splash_mmc_read_raw(bmp_load_addr, location, read_size);
case SPLASH_STORAGE_NAND:
return splash_nand_read_raw(bmp_load_addr, offset, read_size);
case SPLASH_STORAGE_SF:
@@ -422,6 +448,7 @@ int splash_source_load(struct splash_location *locations, uint size)
{
struct splash_location *splash_location;
char *env_splashimage_value;
+ char *devpart;
u32 bmp_load_addr;
env_splashimage_value = env_get("splashimage");
@@ -438,6 +465,10 @@ int splash_source_load(struct splash_location *locations, uint size)
if (!splash_location)
return -EINVAL;
+ devpart = env_get("splashdevpart");
+ if (devpart)
+ splash_location->devpart = devpart;
+
if (splash_location->flags == SPLASH_STORAGE_RAW)
return splash_load_raw(splash_location, bmp_load_addr);
else if (splash_location->flags == SPLASH_STORAGE_FS)
diff --git a/common/stdio.c b/common/stdio.c
index 92811badb8..cbedfdda53 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -200,7 +200,7 @@ struct stdio_dev *stdio_get_by_name(const char *name)
if (strcmp(sdev->name, name) == 0)
return sdev;
}
- if (IS_ENABLED(CONFIG_DM_VIDEO)) {
+ if (IS_ENABLED(CONFIG_VIDEO)) {
/*
* We did not find a suitable stdio device. If there is a video
* driver with a name starting with 'vidconsole', we can try
@@ -340,7 +340,7 @@ int stdio_add_devices(void)
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
i2c_init_all();
#endif
- if (IS_ENABLED(CONFIG_DM_VIDEO)) {
+ if (IS_ENABLED(CONFIG_VIDEO)) {
/*
* If the console setting is not in environment variables then
* console_init_r() will not be calling iomux_doenv() (which
@@ -366,11 +366,6 @@ int stdio_add_devices(void)
if (IS_ENABLED(CONFIG_SPLASH_SCREEN) &&
IS_ENABLED(CONFIG_CMD_BMP))
splash_display();
- } else {
- if (IS_ENABLED(CONFIG_LCD))
- drv_lcd_init();
- if (IS_ENABLED(CONFIG_VIDEO_VCXK))
- drv_video_init();
}
drv_system_init();