]> git.sur5r.net Git - u-boot/blobdiff - drivers/video/cfb_console.c
video: cfb_console: fix 32-bit display on 64-bit architectures
[u-boot] / drivers / video / cfb_console.c
index 949187c8226c55353b58be37e43768a75ab818d8..d75abb660f4f8e666c5c161c8c03f340b1dcad0d 100644 (file)
@@ -27,7 +27,6 @@
  *
  * (for SMI LynxE graphic chip)
  *
- * CONFIG_VIDEO_SMI_LYNXEM    - use graphic driver for SMI 710,712,810
  * VIDEO_FB_LITTLE_ENDIAN     - framebuffer organisation default: big endian
  * VIDEO_HW_RECTFILL         - graphic driver supports hardware rectangle fill
  * VIDEO_HW_BITBLT           - graphic driver supports hardware bit blt
  *                                     info);
  *                             that fills a info buffer at i=row.
  *                             s.a: board/eltec/bab7xx.
- * CONFIG_VGA_AS_SINGLE_DEVICE - If set the framebuffer device will be
- *                             initialized as an output only device.
- *                             The Keyboard driver will not be
- *                             set-up.  This may be used, if you have
- *                             no or more than one Keyboard devices
- *                             (USB Keyboard, AT Keyboard).
  *
  * CONFIG_VIDEO_SW_CURSOR:    - Draws a cursor after the last
  *                             character. No blinking is provided.
  *                             Uses the macros CURSOR_SET and
  *                             CURSOR_OFF.
- *
- * CONFIG_VIDEO_HW_CURSOR:    - Uses the hardware cursor capability
- *                             of the graphic chip. Uses the macro
- *                             CURSOR_SET. ATTENTION: If booting an
- *                             OS, the display driver must disable
- *                             the hardware register of the graphic
- *                             chip. Otherwise a blinking field is
- *                             displayed.
  */
 
 #include <common.h>
 #include <fdtdec.h>
 #include <version.h>
 #include <malloc.h>
+#include <video.h>
 #include <linux/compiler.h>
 
-/*
- * Console device defines with SMI graphic
- * Any other graphic must change this section
- */
-
-#ifdef CONFIG_VIDEO_SMI_LYNXEM
-
-#define VIDEO_FB_LITTLE_ENDIAN
-#define VIDEO_HW_RECTFILL
-#define VIDEO_HW_BITBLT
-#endif
-
 /*
  * Defines for the CT69000 driver
  */
 #define VIDEO_HW_BITBLT
 #endif
 
-/*
- * Defines for the SED13806 driver
- */
-#ifdef CONFIG_VIDEO_SED13806
-#define VIDEO_FB_LITTLE_ENDIAN
-#define VIDEO_HW_RECTFILL
-#define VIDEO_HW_BITBLT
-#endif
-
-#if defined(CONFIG_VIDEO_MXS) || defined(CONFIG_VIDEO_S3C)
+#if defined(CONFIG_VIDEO_MXS)
 #define VIDEO_FB_16BPP_WORD_SWAP
 #endif
 
 #include <splash.h>
 #endif
 
-/*
- * Cursor definition:
- * CONFIG_VIDEO_SW_CURSOR: Draws a cursor after the last character. No
- *                        blinking is provided. Uses the macros CURSOR_SET
- *                        and CURSOR_OFF.
- * CONFIG_VIDEO_HW_CURSOR: Uses the hardware cursor capability of the
- *                        graphic chip. Uses the macro CURSOR_SET.
- *                        ATTENTION: If booting an OS, the display driver
- *                        must disable the hardware register of the graphic
- *                        chip. Otherwise a blinking field is displayed
- */
-#if !defined(CONFIG_VIDEO_SW_CURSOR) && !defined(CONFIG_VIDEO_HW_CURSOR)
+#if !defined(CONFIG_VIDEO_SW_CURSOR)
 /* no Cursor defined */
 #define CURSOR_ON
 #define CURSOR_OFF
 #endif
 
 #if defined(CONFIG_VIDEO_SW_CURSOR)
-#if defined(CONFIG_VIDEO_HW_CURSOR)
-#error only one of CONFIG_VIDEO_SW_CURSOR or CONFIG_VIDEO_HW_CURSOR can be \
-       defined
-#endif
 void console_cursor(int state);
 
 #define CURSOR_ON  console_cursor(1)
@@ -207,17 +157,6 @@ void console_cursor(int state);
 #define CURSOR_SET video_set_cursor()
 #endif /* CONFIG_VIDEO_SW_CURSOR */
 
-#ifdef CONFIG_VIDEO_HW_CURSOR
-#ifdef CURSOR_ON
-#error only one of CONFIG_VIDEO_SW_CURSOR or CONFIG_VIDEO_HW_CURSOR can be \
-       defined
-#endif
-#define CURSOR_ON
-#define CURSOR_OFF
-#define CURSOR_SET video_set_hw_cursor(console_col * VIDEO_FONT_WIDTH, \
-                 (console_row * VIDEO_FONT_HEIGHT) + video_logo_height)
-#endif /* CONFIG_VIDEO_HW_CURSOR */
-
 #ifdef CONFIG_VIDEO_LOGO
 #ifdef CONFIG_VIDEO_BMP_LOGO
 #include <bmp_logo.h>
@@ -297,16 +236,6 @@ void console_cursor(int state);
 #endif
 #endif
 
-#ifdef CONFIG_CONSOLE_EXTRA_INFO
-/*
- * setup a board string: type, speed, etc.
- *
- * line_number:        location to place info string beside logo
- * info:       buffer for info string
- */
-extern void video_get_info_str(int line_number,        char *info);
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 /* Locals */
@@ -885,7 +814,7 @@ static void parse_putc(const char c)
                CURSOR_SET;
 }
 
-static void video_putc(struct stdio_dev *dev, const char c)
+static void cfb_video_putc(struct stdio_dev *dev, const char c)
 {
 #ifdef CONFIG_CFB_CONSOLE_ANSI
        int i;
@@ -1099,7 +1028,7 @@ static void video_putc(struct stdio_dev *dev, const char c)
                flush_cache(VIDEO_FB_ADRS, VIDEO_SIZE);
 }
 
-static void video_puts(struct stdio_dev *dev, const char *s)
+static void cfb_video_puts(struct stdio_dev *dev, const char *s)
 {
        int flush = cfb_do_flush_cache;
        int count = strlen(s);
@@ -1108,7 +1037,7 @@ static void video_puts(struct stdio_dev *dev, const char *s)
        cfb_do_flush_cache = 0;
 
        while (count--)
-               video_putc(dev, *s++);
+               cfb_video_putc(dev, *s++);
 
        if (flush) {
                cfb_do_flush_cache = flush;
@@ -1150,8 +1079,8 @@ __weak void video_set_lut(unsigned int index, unsigned char r,
 }
 
 #define FILL_32BIT_X888RGB(r,g,b) {                    \
-       *(unsigned long *)fb =                          \
-               SWAP32((unsigned long)(((r<<16) |       \
+       *(u32 *)fb =                            \
+               SWAP32((unsigned int)(((r<<16) |        \
                                        (g<<8)  |       \
                                         b)));          \
        fb += 4;                                        \
@@ -1232,7 +1161,7 @@ static void draw_bitmap(uchar **fb, uchar *bm, struct palette *p,
                break;
        case GDF_32BIT_X888RGB:
                for (i = 0; i < cnt; i++) {
-                       *(unsigned long *) addr = p[bm[*off]].ce.dw;
+                       *(u32 *) addr = p[bm[*off]].ce.dw;
                        addr += 4;
                }
                break;
@@ -1896,8 +1825,8 @@ static void plot_logo_or_black(void *screen, int x, int y, int black)
                                                         (b >> 3)));
                                break;
                        case GDF_32BIT_X888RGB:
-                               *(unsigned long *) dest =
-                                       SWAP32((unsigned long) (
+                               *(u32 *) dest =
+                                       SWAP32((u32) (
                                                        (r << 16) |
                                                        (g <<  8) |
                                                         b));
@@ -1932,14 +1861,16 @@ static void *video_logo(void)
        __maybe_unused int y_off = 0;
        __maybe_unused ulong addr;
        __maybe_unused char *s;
-       __maybe_unused int len, space;
+       __maybe_unused int len, ret, space;
 
        splash_get_pos(&video_logo_xpos, &video_logo_ypos);
 
 #ifdef CONFIG_SPLASH_SCREEN
        s = getenv("splashimage");
        if (s != NULL) {
-               splash_screen_prepare();
+               ret = splash_screen_prepare();
+               if (ret < 0)
+                       return video_fb_address;
                addr = simple_strtoul(s, NULL, 16);
 
                if (video_display_bitmap(addr,
@@ -2037,7 +1968,7 @@ static void *video_logo(void)
 static int cfb_fb_is_in_dram(void)
 {
        bd_t *bd = gd->bd;
-#if defined(CONFIG_ARM) || defined(CONFIG_AVR32) || defined(COFNIG_NDS32) || \
+#if defined(CONFIG_ARM) || defined(CONFIG_AVR32) || defined(CONFIG_NDS32) || \
 defined(CONFIG_SANDBOX) || defined(CONFIG_X86)
        ulong start, end;
        int i;
@@ -2075,7 +2006,7 @@ void video_clear(void)
 #endif
 }
 
-static int video_init(void)
+static int cfg_video_init(void)
 {
        unsigned char color8;
 
@@ -2084,9 +2015,6 @@ static int video_init(void)
                return -1;
 
        video_fb_address = (void *) VIDEO_FB_ADRS;
-#ifdef CONFIG_VIDEO_HW_CURSOR
-       video_init_hw_cursor(VIDEO_FONT_WIDTH, VIDEO_FONT_HEIGHT);
-#endif
 
        cfb_do_flush_cache = cfb_fb_is_in_dram() && dcache_status();
 
@@ -2204,7 +2132,7 @@ int drv_video_init(void)
                return 0;
 
        /* Init video chip - returns with framebuffer cleared */
-       if (video_init() == -1)
+       if (cfg_video_init() == -1)
                return 0;
 
        if (board_cfb_skip())
@@ -2229,8 +2157,8 @@ int drv_video_init(void)
        memset(&console_dev, 0, sizeof(console_dev));
        strcpy(console_dev.name, "vga");
        console_dev.flags = DEV_FLAGS_OUTPUT;
-       console_dev.putc = video_putc;  /* 'putc' function */
-       console_dev.puts = video_puts;  /* 'puts' function */
+       console_dev.putc = cfb_video_putc;      /* 'putc' function */
+       console_dev.puts = cfb_video_puts;      /* 'puts' function */
 
 #if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
        if (have_keyboard && keyboard_ok) {