Merge branch 'next' of ../next
[platform/kernel/u-boot.git] / board / trab / vfd.c
index cea8b0b..b7eb8cc 100644 (file)
@@ -36,8 +36,8 @@
 #include <version.h>
 #include <stdarg.h>
 #include <linux/types.h>
-#include <devices.h>
-#include <s3c2400.h>
+#include <stdio_dev.h>
+#include <asm/arch/s3c24x0_cpu.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -104,7 +104,7 @@ void init_grid_ctrl(void)
                        bit = grid_cycle * 256  * 4 +
                             (grid_cycle + 200) * 4 +
                             frame_buf_offs + display;
-                       /* wrap arround if offset (see manual S3C2400) */
+                       /* wrap arround if offset (see manual S3C2400) */
                        if (bit>=FRAME_BUF_SIZE*8)
                                bit = bit - (FRAME_BUF_SIZE * 8);
                        adr = gd->fb_base + (bit/32) * 4 + (3 - (bit%32) / 8);
@@ -117,7 +117,7 @@ void init_grid_ctrl(void)
                        if(grid_cycle<55)
                                bit = grid_cycle*256*4+(grid_cycle+201)*4+frame_buf_offs+display;
                        else
-                               bit = grid_cycle*256*4+200*4+frame_buf_offs+display-4;  /* grid nr. 0 */
+                               bit = grid_cycle*256*4+200*4+frame_buf_offs+display-4;  /* grid nr. 0 */
                        /* wrap arround if offset (see manual S3C2400) */
                        if (bit>=FRAME_BUF_SIZE*8)
                                bit = bit-(FRAME_BUF_SIZE*8);
@@ -190,7 +190,7 @@ void create_vfd_table(void)
                            /* Display 0 red pixels */
                            vfd_table[x][y][1][display][0] =
                                (x==0) ? y*16+512+display
-                                      : (x%4)*4+y*16+((x-1)/2)*1024+512+display;
+                                      : (x%4)*4+y*16+((x-1)/2)*1024+512+display;
                    }
                }
            }
@@ -251,19 +251,17 @@ void create_vfd_table(void)
                            unsigned long adr  = gd->fb_base;
                            unsigned int bit_nr = 0;
 
-                           if (vfd_table[x][y][color][display][entry]) {
-
-                               pixel  = vfd_table[x][y][color][display][entry] + frame_buf_offs;
-                                /*
-                                 * wrap arround if offset
-                                 * (see manual S3C2400)
-                                 */
-                               if (pixel>=FRAME_BUF_SIZE*8)
-                                       pixel = pixel-(FRAME_BUF_SIZE*8);
-                               adr    = gd->fb_base+(pixel/32)*4+(3-(pixel%32)/8);
-                               bit_nr = pixel%8;
-                               bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4;
-                           }
+                           pixel  = vfd_table[x][y][color][display][entry] + frame_buf_offs;
+                           /*
+                            * wrap arround if offset
+                            * (see manual S3C2400)
+                            */
+                           if (pixel>=FRAME_BUF_SIZE*8)
+                                   pixel = pixel-(FRAME_BUF_SIZE*8);
+                           adr    = gd->fb_base+(pixel/32)*4+(3-(pixel%32)/8);
+                           bit_nr = pixel%8;
+                           bit_nr = (bit_nr>3)?bit_nr-4:bit_nr+4;
+
                            adr_vfd_table[x][y][color][display][entry] = adr;
                            bit_vfd_table[x][y][color][display][entry] = bit_nr;
                        }
@@ -358,16 +356,20 @@ void transfer_pic(int display, unsigned char *adr, int height, int width)
  */
 int vfd_init_clocks (void)
 {
-       S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
-       S3C24X0_TIMERS * const timers = S3C24X0_GetBase_TIMERS();
-       S3C24X0_LCD * const lcd = S3C24X0_GetBase_LCD();
+       int i;
+
+       struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
+       struct s3c24x0_timers * const timers = s3c24x0_get_base_timers();
+       struct s3c24x0_lcd * const lcd = s3c24x0_get_base_lcd();
 
        /* try to determine display type from the value
         * defined by pull-ups
         */
        gpio->PCUP = (gpio->PCUP & 0xFFF0);     /* activate  GPC0...GPC3 pullups */
        gpio->PCCON = (gpio->PCCON & 0xFFFFFF00);       /* configure GPC0...GPC3 as inputs */
-       udelay (10);                            /* allow signals to settle */
+       /* allow signals to settle */
+       for (i=0; i<10000; i++) /* udelay isn't working yet at this point! */
+               __asm__("NOP");
        vfd_board_id = (~gpio->PCDAT) & 0x000F; /* read GPC0...GPC3 port pins */
 
        VFD_DISABLE;                            /* activate blank for the vfd */
@@ -427,8 +429,8 @@ int vfd_init_clocks (void)
  */
 int drv_vfd_init(void)
 {
-       S3C24X0_LCD * const lcd = S3C24X0_GetBase_LCD();
-       S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
+       struct s3c24x0_lcd * const lcd = s3c24x0_get_base_lcd();
+       struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
        char *tmp;
        ulong palette;
        static int vfd_init_done = 0;
@@ -486,7 +488,7 @@ int drv_vfd_init(void)
        lcd->LCDCON1 = 0x00000000;
        /* frame buffer startadr */
        lcd->LCDSADDR1 = gd->fb_base >> 1;
-       /* frame buffer endadr */
+       /* frame buffer endadr */
        lcd->LCDSADDR2 = (gd->fb_base + FRAME_BUF_SIZE) >> 1;
        lcd->LCDSADDR3 = ((256/4));
        lcd->LCDCON2 = 0x000DC000;
@@ -527,7 +529,7 @@ int drv_vfd_init(void)
  */
 void disable_vfd (void)
 {
-       S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
+       struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
 
        VFD_DISABLE;
        gpio->PDCON &= ~0xC;