]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
lcd: mpc823: move mpc823-specific lcd_logo_set_cmap code to mpc8xx_lcd.c
authorNikita Kiryanov <nikita@compulab.co.il>
Tue, 3 Feb 2015 11:32:25 +0000 (13:32 +0200)
committerAnatolij Gustschin <agust@denx.de>
Tue, 10 Feb 2015 12:27:58 +0000 (13:27 +0100)
Reduce the bitmap_plot #ifdef complexity by extracting MPC823-specific code for
setting cmap into its own implementation of lcd_logo_set_cmap(), implemented in
mpc8xx_lcd.c. In the MPC823 implementation, ARRAY_SIZE(bmp_logo_palette) is
switched for BMP_LOGO_COLORS to avoid having to include bmp_logo_data.h, which
would cause a compilation error because the logo data and palette arrays would
be defined twice.

This is a step towards cleaning bitmap_plot() of platform-specific code.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Bo Shen <voice.shen@atmel.com>
Tested-by: Josh Wu <josh.wu@atmel.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Anatolij Gustschin <agust@denx.de>
common/lcd.c
drivers/video/mpc8xx_lcd.c

index 7fcac1d9fb6975e3ee7efa68ee9712608e1497d3..355c1442fdafd91ee419db896bb3688741b5a369 100644 (file)
@@ -396,10 +396,6 @@ void bitmap_plot(int x, int y)
        uchar *bmap;
        uchar *fb;
        ushort *fb16;
-#if defined(CONFIG_MPC823)
-       immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
-       cpm8xx_t *cp = &(immr->im_cpm);
-#endif
        unsigned bpix = NBITS(panel_info.vl_bpix);
 
        debug("Logo: width %d  height %d  colors %d  cmap %d\n",
@@ -415,16 +411,12 @@ void bitmap_plot(int x, int y)
                 * cmap was set to the source palette, so no change is done.
                 * This avoids even more ifdefs in the next stanza
                 */
-#if defined(CONFIG_MPC823)
-               cmap = (ushort *) &(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]);
-#else
                cmap = configuration_get_cmap();
-#endif
 
                WATCHDOG_RESET();
 
                /* Set color map */
-#ifdef CONFIG_ATMEL_LCD
+#if defined(CONFIG_ATMEL_LCD) || defined(CONFIG_MPC823)
                lcd_logo_set_cmap();
 #else
                for (i = 0; i < ARRAY_SIZE(bmp_logo_palette); ++i) {
index 190c05a5980520623e82372a05f18b93e6082431..faa58c020beb93f4e61039aef4b40dc01c365c75 100644 (file)
@@ -371,6 +371,21 @@ void fb_put_byte(uchar **fb, uchar **from)
 }
 #endif
 
+#ifdef CONFIG_LCD_LOGO
+#include <bmp_logo.h>
+void lcd_logo_set_cmap(void)
+{
+       int i;
+       ushort *cmap;
+       immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+       cpm8xx_t *cp = &(immr->im_cpm);
+       cmap = (ushort *)&(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]);
+
+       for (i = 0; i < BMP_LOGO_COLORS; ++i)
+               *cmap++ = bmp_logo_palette[i];
+}
+#endif
+
 void lcd_enable (void)
 {
        volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;