lcd: Let the board code show board-specific info
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Mon, 1 Sep 2008 14:21:22 +0000 (16:21 +0200)
committerAnatolij Gustschin <agust@denx.de>
Mon, 27 Oct 2008 08:53:58 +0000 (09:53 +0100)
The information displayed when CONFIG_LCD_INFO is set is inherently
board-specific, so it should be done by the board code. The current code
dealing with this only handles two cases, and is already a horrible mess
of #ifdeffery.

Yes, this duplicates some code, but it also allows boards to print more
board-specific information; this used to be very difficult.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
board/atmel/at91cap9adk/at91cap9adk.c
board/atmel/at91sam9261ek/at91sam9261ek.c
board/atmel/at91sam9263ek/at91sam9263ek.c
board/atmel/at91sam9rlek/at91sam9rlek.c
board/lwmon/lwmon.c
board/tqc/tqm8xx/tqm8xx.c
common/lcd.c
include/lcd.h

index 544c932f2673a85f023e6b53f4026118670648f2..a1a9238f6ec2aa1c5cbb18d39754ee2f5483d7bf 100644 (file)
@@ -326,6 +326,35 @@ static void at91cap9_lcd_hw_init(void)
 
        gd->fb_base = 0;
 }
+
+#ifdef CONFIG_LCD_INFO
+#include <nand.h>
+#include <version.h>
+
+void lcd_show_board_info(void)
+{
+       ulong dram_size, nand_size;
+       int i;
+       char temp[32];
+
+       lcd_printf ("%s\n", U_BOOT_VERSION);
+       lcd_printf ("(C) 2008 ATMEL Corp\n");
+       lcd_printf ("at91support@atmel.com\n");
+       lcd_printf ("%s CPU at %s MHz\n",
+               AT91_CPU_NAME,
+               strmhz(temp, AT91_MAIN_CLOCK));
+
+       dram_size = 0;
+       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
+               dram_size += gd->bd->bi_dram[i].size;
+       nand_size = 0;
+       for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
+               nand_size += nand_info[i].size;
+       lcd_printf ("  %ld MB SDRAM, %ld MB NAND\n",
+               dram_size >> 20,
+               nand_size >> 20 );
+}
+#endif /* CONFIG_LCD_INFO */
 #endif
 
 int board_init(void)
index 76f56d6ae75d531f9fc6a3d0f54632a9721c0847..70f1db93f6f162506d49bdc7a0e5004a045e76ca 100644 (file)
@@ -209,6 +209,35 @@ static void at91sam9261ek_lcd_hw_init(void)
 
        gd->fb_base = AT91SAM9261_SRAM_BASE;
 }
+
+#ifdef CONFIG_LCD_INFO
+#include <nand.h>
+#include <version.h>
+
+void lcd_show_board_info(void)
+{
+       ulong dram_size, nand_size;
+       int i;
+       char temp[32];
+
+       lcd_printf ("%s\n", U_BOOT_VERSION);
+       lcd_printf ("(C) 2008 ATMEL Corp\n");
+       lcd_printf ("at91support@atmel.com\n");
+       lcd_printf ("%s CPU at %s MHz\n",
+               AT91_CPU_NAME,
+               strmhz(temp, AT91_MAIN_CLOCK));
+
+       dram_size = 0;
+       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
+               dram_size += gd->bd->bi_dram[i].size;
+       nand_size = 0;
+       for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
+               nand_size += nand_info[i].size;
+       lcd_printf ("  %ld MB SDRAM, %ld MB NAND\n",
+               dram_size >> 20,
+               nand_size >> 20 );
+}
+#endif /* CONFIG_LCD_INFO */
 #endif
 
 int board_init(void)
index dd513b9e12f3c2271668ef88ddf939cea3c50c5a..63f95e718fec3a9c20edc867a8c3eaa61bef342e 100644 (file)
@@ -260,6 +260,35 @@ static void at91sam9263ek_lcd_hw_init(void)
 
        gd->fb_base = AT91SAM9263_SRAM0_BASE;
 }
+
+#ifdef CONFIG_LCD_INFO
+#include <nand.h>
+#include <version.h>
+
+void lcd_show_board_info(void)
+{
+       ulong dram_size, nand_size;
+       int i;
+       char temp[32];
+
+       lcd_printf ("%s\n", U_BOOT_VERSION);
+       lcd_printf ("(C) 2008 ATMEL Corp\n");
+       lcd_printf ("at91support@atmel.com\n");
+       lcd_printf ("%s CPU at %s MHz\n",
+               AT91_CPU_NAME,
+               strmhz(temp, AT91_MAIN_CLOCK));
+
+       dram_size = 0;
+       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
+               dram_size += gd->bd->bi_dram[i].size;
+       nand_size = 0;
+       for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
+               nand_size += nand_info[i].size;
+       lcd_printf ("  %ld MB SDRAM, %ld MB NAND\n",
+               dram_size >> 20,
+               nand_size >> 20 );
+}
+#endif /* CONFIG_LCD_INFO */
 #endif
 
 int board_init(void)
index 7bf1f439b2ee158ef7eb5e05db4663f60f07ed61..37e371ff2df8467175a4edf8b2f778038aa14e66 100644 (file)
@@ -181,6 +181,35 @@ static void at91sam9rlek_lcd_hw_init(void)
 
        gd->fb_base = 0;
 }
+
+#ifdef CONFIG_LCD_INFO
+#include <nand.h>
+#include <version.h>
+
+void lcd_show_board_info(void)
+{
+       ulong dram_size, nand_size;
+       int i;
+       char temp[32];
+
+       lcd_printf ("%s\n", U_BOOT_VERSION);
+       lcd_printf ("(C) 2008 ATMEL Corp\n");
+       lcd_printf ("at91support@atmel.com\n");
+       lcd_printf ("%s CPU at %s MHz\n",
+               AT91_CPU_NAME,
+               strmhz(temp, AT91_MAIN_CLOCK));
+
+       dram_size = 0;
+       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
+               dram_size += gd->bd->bi_dram[i].size;
+       nand_size = 0;
+       for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
+               nand_size += nand_info[i].size;
+       lcd_printf ("  %ld MB SDRAM, %ld MB NAND\n",
+               dram_size >> 20,
+               nand_size >> 20 );
+}
+#endif /* CONFIG_LCD_INFO */
 #endif
 
 
index aadd2540e84b186c563201f4fc4d16a0a1de7901..9e572463d3fd48ab70c5ee4c64195a3ce055ba66 100644 (file)
@@ -759,6 +759,35 @@ static uchar *key_match (uchar *kbd_data)
 }
 #endif /* CONFIG_PREBOOT */
 
+#ifdef CONFIG_LCD_INFO
+#include <lcd.h>
+#include <version.h>
+
+void lcd_show_board_info(void)
+{
+       char temp[32];
+
+       lcd_printf ("%s (%s - %s)\n", U_BOOT_VERSION, __DATE__, __TIME__);
+       lcd_printf ("(C) 2008 DENX Software Engineering GmbH\n");
+       lcd_printf ("    Wolfgang DENK, wd@denx.de\n");
+#ifdef CONFIG_LCD_INFO_BELOW_LOGO
+       lcd_printf ("MPC823 CPU at %s MHz\n",
+               strmhz(temp, gd->cpu_clk));
+       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 3,
+                                       info, strlen(info));
+       lcd_printf ("  %ld MB RAM, %ld MB Flash\n",
+               gd->ram_size >> 20,
+               gd->bd->bi_flashsize >> 20 );
+#else
+       /* leave one blank line */
+       lcd_printf ("\nMPC823 CPU at %s MHz, %ld MB RAM, %ld MB Flash\n",
+               strmhz(temp, gd->cpu_clk),
+               gd->ram_size >> 20,
+               gd->bd->bi_flashsize >> 20 );
+#endif /* CONFIG_LCD_INFO_BELOW_LOGO */
+}
+#endif /* CONFIG_LCD_INFO */
+
 /*---------------Board Special Commands: PIC read/write ---------------*/
 
 #if defined(CONFIG_CMD_BSP)
index 9a0f3a0ff26bc2dc4aab267afb61396a0497c0af..928afed661f635db473ab435a083e8887c9a9596 100644 (file)
@@ -568,6 +568,32 @@ void ide_led (uchar led, uchar status)
 }
 # endif
 
+#ifdef CONFIG_LCD_INFO
+#include <lcd.h>
+
+void lcd_show_board_info(void)
+{
+       lcd_printf ("%s (%s - %s)\n", U_BOOT_VERSION, __DATE__, __TIME__);
+       lcd_printf ("(C) 2008 DENX Software Engineering GmbH\n");
+       lcd_printf ("    Wolfgang DENK, wd@denx.de\n");
+#ifdef CONFIG_LCD_INFO_BELOW_LOGO
+       lcd_printf ("MPC823 CPU at %s MHz\n",
+               strmhz(temp, gd->cpu_clk));
+       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 3,
+                                       info, strlen(info));
+       lcd_printf ("  %ld MB RAM, %ld MB Flash\n",
+               gd->ram_size >> 20,
+               gd->bd->bi_flashsize >> 20 );
+#else
+       /* leave one blank line */
+       lcd_printf ("\nMPC823 CPU at %s MHz, %ld MB RAM, %ld MB Flash\n",
+               strmhz(temp, gd->cpu_clk),
+               gd->ram_size >> 20,
+               gd->bd->bi_flashsize >> 20 );
+#endif /* CONFIG_LCD_INFO_BELOW_LOGO */
+}
+#endif /* CONFIG_LCD_INFO */
+
 /* ---------------------------------------------------------------------------- */
 /* TK885D specific initializaion                                               */
 /* ---------------------------------------------------------------------------- */
index 813c8d827d6c6778b8654f075bbf58581a018002..31bb190ddda14ce37aa20f9f277f7202b1649c28 100644 (file)
@@ -52,7 +52,6 @@
 
 #if defined(CONFIG_ATMEL_LCD)
 #include <atmel_lcdc.h>
-#include <nand.h>
 #endif
 
 /************************************************************************/
@@ -762,15 +761,6 @@ extern bmp_image_t *gunzip_bmp(unsigned long addr, unsigned long *lenp);
 
 static void *lcd_logo (void)
 {
-#ifdef CONFIG_LCD_INFO
-       char info[80];
-       char temp[32];
-#ifdef CONFIG_ATMEL_LCD
-       int i;
-       ulong dram_size, nand_size;
-#endif
-#endif /* CONFIG_LCD_INFO */
-
 #ifdef CONFIG_SPLASH_SCREEN
        char *s;
        ulong addr;
@@ -800,75 +790,11 @@ static void *lcd_logo (void)
        bitmap_plot (0, 0);
 #endif /* CONFIG_LCD_LOGO */
 
-#ifdef CONFIG_MPC823
-# ifdef CONFIG_LCD_INFO
-       sprintf (info, "%s (%s - %s) ", U_BOOT_VERSION, __DATE__, __TIME__);
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, (uchar *)info, strlen(info));
-
-       sprintf (info, "(C) 2008 DENX Software Engineering GmbH");
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT,
-                                       (uchar *)info, strlen(info));
-
-       sprintf (info, "    Wolfgang DENK, wd@denx.de");
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 2,
-                                       (uchar *)info, strlen(info));
-#  ifdef CONFIG_LCD_INFO_BELOW_LOGO
-       sprintf (info, "MPC823 CPU at %s MHz",
-               strmhz(temp, gd->cpu_clk));
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 3,
-                                       info, strlen(info));
-       sprintf (info, "  %ld MB RAM, %ld MB Flash",
-               gd->ram_size >> 20,
-               gd->bd->bi_flashsize >> 20 );
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
-                                       info, strlen(info));
-#  else
-       /* leave one blank line */
-
-       sprintf (info, "MPC823 CPU at %s MHz, %ld MB RAM, %ld MB Flash",
-               strmhz(temp, gd->cpu_clk),
-               gd->ram_size >> 20,
-               gd->bd->bi_flashsize >> 20 );
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
-                                       (uchar *)info, strlen(info));
-
-#  endif /* CONFIG_LCD_INFO_BELOW_LOGO */
-# endif /* CONFIG_LCD_INFO */
-#endif /* CONFIG_MPC823 */
-
-#ifdef CONFIG_ATMEL_LCD
-# ifdef CONFIG_LCD_INFO
-       sprintf (info, "%s", U_BOOT_VERSION);
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, (uchar *)info, strlen(info));
-
-       sprintf (info, "(C) 2008 ATMEL Corp");
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT,
-                                       (uchar *)info, strlen(info));
-
-       sprintf (info, "at91support@atmel.com");
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 2,
-                                       (uchar *)info, strlen(info));
-
-       sprintf (info, "%s CPU at %s MHz",
-               AT91_CPU_NAME,
-               strmhz(temp, AT91_MAIN_CLOCK));
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 3,
-                                       (uchar *)info, strlen(info));
-
-       dram_size = 0;
-       for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
-               dram_size += gd->bd->bi_dram[i].size;
-       nand_size = 0;
-       for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
-               nand_size += nand_info[i].size;
-       sprintf (info, "  %ld MB SDRAM, %ld MB NAND",
-               dram_size >> 20,
-               nand_size >> 20 );
-       lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
-                                       (uchar *)info, strlen(info));
-# endif /* CONFIG_LCD_INFO */
-#endif /* CONFIG_ATMEL_LCD */
-
+#ifdef CONFIG_LCD_INFO
+       console_col = LCD_INFO_X / VIDEO_FONT_WIDTH;
+       console_row = LCD_INFO_Y / VIDEO_FONT_HEIGHT;
+       lcd_show_board_info();
+#endif /* CONFIG_LCD_INFO */
 
 #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
        return ((void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length));
index 15affb85cbed89d2b7e3cbf7518e8ebcb848fdfe..512221e9c46869d3fbe7b8909bfb15e0ab75ffec 100644 (file)
@@ -197,6 +197,8 @@ void        lcd_putc        (const char c);
 void   lcd_puts        (const char *s);
 void   lcd_printf      (const char *fmt, ...);
 
+/* Allow boards to customize the information displayed */
+void lcd_show_board_info(void);
 
 /************************************************************************/
 /* ** BITMAP DISPLAY SUPPORT                                           */