synchronizition with mainline
[oweals/u-boot.git] / drivers / i8042.c
index ce24fc93014268d698ad9ead56896377c1f726b0..22c2a4e3a02da185783e0a1064ceca2f54f0866d 100644 (file)
@@ -12,7 +12,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
 
 #ifdef CONFIG_I8042_KBD
 
+#ifdef CONFIG_USE_CPCIDVI
+extern u8  gt_cpcidvi_in8(u32 offset);
+extern void gt_cpcidvi_out8(u32 offset, u8 data);
+
+#define in8(a)    gt_cpcidvi_in8(a)
+#define out8(a, b) gt_cpcidvi_out8(a,b)
+#endif
+
 #include <i8042.h>
 
 /* defines */
@@ -41,10 +49,10 @@ static int cursor_state = 0;
 
 /* locals */
 
-static int  kbd_input    = -1;          /* no input yet */
-static int  kbd_mapping  = KBD_US;      /* default US keyboard */
-static int  kbd_flags    = NORMAL;      /* after reset */
-static int  kbd_state    = 0;           /* unshift code */
+static int  kbd_input   = -1;          /* no input yet */
+static int  kbd_mapping         = KBD_US;      /* default US keyboard */
+static int  kbd_flags   = NORMAL;      /* after reset */
+static int  kbd_state   = 0;           /* unshift code */
 
 static void kbd_conv_char (unsigned char scan_code);
 static void kbd_led_set (void);
@@ -60,230 +68,230 @@ static int  kbd_reset (void);
 
 static unsigned char kbd_fct_map [144] =
     { /* kbd_fct_map table for scan code */
-    0,   AS,   AS,   AS,   AS,   AS,   AS,   AS, /* scan  0- 7 */
-   AS,   AS,   AS,   AS,   AS,   AS,   AS,   AS, /* scan  8- F */
-   AS,   AS,   AS,   AS,   AS,   AS,   AS,   AS, /* scan 10-17 */
-   AS,   AS,   AS,   AS,   AS,   CN,   AS,   AS, /* scan 18-1F */
-   AS,   AS,   AS,   AS,   AS,   AS,   AS,   AS, /* scan 20-27 */
-   AS,   AS,   SH,   AS,   AS,   AS,   AS,   AS, /* scan 28-2F */
-   AS,   AS,   AS,   AS,   AS,   AS,   SH,   AS, /* scan 30-37 */
-   AS,   AS,   CP,   0,    0,    0,    0,     0, /* scan 38-3F */
-    0,   0,    0,    0,    0,    NM,   ST,   ES, /* scan 40-47 */
-   ES,   ES,   ES,   ES,   ES,   ES,   ES,   ES, /* scan 48-4F */
-   ES,   ES,   ES,   ES,   0,    0,    AS,    0, /* scan 50-57 */
-    0,   0,    0,    0,    0,    0,    0,     0, /* scan 58-5F */
-    0,   0,    0,    0,    0,    0,    0,     0, /* scan 60-67 */
-    0,   0,    0,    0,    0,    0,    0,     0, /* scan 68-6F */
-   AS,   0,    0,    AS,   0,    0,    AS,    0, /* scan 70-77 */
-    0,   AS,   0,    0,    0,    AS,   0,     0, /* scan 78-7F */
-   AS,   CN,   AS,   AS,   AK,   ST,   EX,   EX, /* enhanced   */
-   AS,   EX,   EX,   AS,   EX,   AS,   EX,   EX  /* enhanced   */
+    0,  AS,   AS,   AS,   AS,   AS,   AS,   AS, /* scan  0- 7 */
+   AS,  AS,   AS,   AS,   AS,   AS,   AS,   AS, /* scan  8- F */
+   AS,  AS,   AS,   AS,   AS,   AS,   AS,   AS, /* scan 10-17 */
+   AS,  AS,   AS,   AS,   AS,   CN,   AS,   AS, /* scan 18-1F */
+   AS,  AS,   AS,   AS,   AS,   AS,   AS,   AS, /* scan 20-27 */
+   AS,  AS,   SH,   AS,   AS,   AS,   AS,   AS, /* scan 28-2F */
+   AS,  AS,   AS,   AS,   AS,   AS,   SH,   AS, /* scan 30-37 */
+   AS,  AS,   CP,   0,    0,    0,    0,     0, /* scan 38-3F */
+    0,  0,    0,    0,    0,    NM,   ST,   ES, /* scan 40-47 */
+   ES,  ES,   ES,   ES,   ES,   ES,   ES,   ES, /* scan 48-4F */
+   ES,  ES,   ES,   ES,   0,    0,    AS,    0, /* scan 50-57 */
+    0,  0,    0,    0,    0,    0,    0,     0, /* scan 58-5F */
+    0,  0,    0,    0,    0,    0,    0,     0, /* scan 60-67 */
+    0,  0,    0,    0,    0,    0,    0,     0, /* scan 68-6F */
+   AS,  0,    0,    AS,   0,    0,    AS,    0, /* scan 70-77 */
+    0,  AS,   0,    0,    0,    AS,   0,     0, /* scan 78-7F */
+   AS,  CN,   AS,   AS,   AK,   ST,   EX,   EX, /* enhanced   */
+   AS,  EX,   EX,   AS,   EX,   AS,   EX,   EX  /* enhanced   */
     };
 
 static unsigned char kbd_key_map [2][5][144] =
     {
     { /* US keyboard */
     { /* unshift code */
-    0,  0x1b,   '1',   '2',   '3',   '4',   '5',   '6',    /* scan  0- 7 */
-  '7',   '8',   '9',   '0',   '-',   '=',  0x08,  '\t',    /* scan  8- F */
-  'q',   'w',   'e',   'r',   't',   'y',   'u',   'i',    /* scan 10-17 */
-  'o',   'p',   '[',   ']',  '\r',   CN,    'a',   's',    /* scan 18-1F */
-  'd',   'f',   'g',   'h',   'j',   'k',   'l',   ';',    /* scan 20-27 */
- '\'',   '`',   SH,   '\\',   'z',   'x',   'c',   'v',    /* scan 28-2F */
-  'b',   'n',   'm',   ',',   '.',   '/',   SH,    '*',    /* scan 30-37 */
-  ' ',   ' ',   CP,      0,     0,     0,     0,     0,    /* scan 38-3F */
-    0,     0,     0,     0,     0,   NM,    ST,    '7',    /* scan 40-47 */
-  '8',   '9',   '-',   '4',   '5',   '6',   '+',   '1',    /* scan 48-4F */
-  '2',   '3',   '0',   '.',     0,     0,     0,     0,    /* scan 50-57 */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 58-5F */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 60-67 */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 68-6F */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 70-77 */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 78-7F */
-  '\r',   CN,   '/',   '*',   ' ',    ST,   'F',   'A',    /* extended */
-    0,   'D',   'C',     0,   'B',     0,    '@',  'P'     /* extended */
+    0, 0x1b,   '1',   '2',   '3',   '4',   '5',   '6',    /* scan  0- 7 */
+  '7',  '8',   '9',   '0',   '-',   '=',  0x08,  '\t',    /* scan  8- F */
+  'q',  'w',   'e',   'r',   't',   'y',   'u',   'i',    /* scan 10-17 */
+  'o',  'p',   '[',   ']',  '\r',   CN,    'a',   's',    /* scan 18-1F */
+  'd',  'f',   'g',   'h',   'j',   'k',   'l',   ';',    /* scan 20-27 */
+ '\'',  '`',   SH,   '\\',   'z',   'x',   'c',   'v',    /* scan 28-2F */
+  'b',  'n',   'm',   ',',   '.',   '/',   SH,    '*',    /* scan 30-37 */
+  ' ',  ' ',   CP,      0,     0,     0,     0,     0,    /* scan 38-3F */
+    0,    0,     0,     0,     0,   NM,    ST,    '7',    /* scan 40-47 */
+  '8',  '9',   '-',   '4',   '5',   '6',   '+',   '1',    /* scan 48-4F */
+  '2',  '3',   '0',   '.',     0,     0,     0,     0,    /* scan 50-57 */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 58-5F */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 60-67 */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 68-6F */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 70-77 */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 78-7F */
+  '\r',          CN,   '/',   '*',   ' ',    ST,   'F',   'A',    /* extended */
+    0,  'D',   'C',     0,   'B',     0,    '@',  'P'     /* extended */
     },
     { /* shift code */
-    0,  0x1b,   '!',   '@',   '#',   '$',   '%',   '^',    /* scan  0- 7 */
-  '&',   '*',   '(',   ')',   '_',   '+',  0x08,  '\t',    /* scan  8- F */
-  'Q',   'W',   'E',   'R',   'T',   'Y',   'U',   'I',    /* scan 10-17 */
-  'O',   'P',   '{',   '}',  '\r',   CN,    'A',   'S',    /* scan 18-1F */
-  'D',   'F',   'G',   'H',   'J',   'K',   'L',   ':',    /* scan 20-27 */
-  '"',   '~',   SH,    '|',   'Z',   'X',   'C',   'V',    /* scan 28-2F */
-  'B',   'N',   'M',   '<',   '>',   '?',   SH,    '*',    /* scan 30-37 */
-  ' ',   ' ',   CP,      0,     0,     0,     0,     0,    /* scan 38-3F */
-    0,     0,     0,     0,     0,   NM,    ST,    '7',    /* scan 40-47 */
-  '8',   '9',   '-',   '4',   '5',   '6',   '+',   '1',    /* scan 48-4F */
-  '2',   '3',   '0',   '.',     0,     0,     0,     0,    /* scan 50-57 */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 58-5F */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 60-67 */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 68-6F */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 70-77 */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 78-7F */
-  '\r',   CN,   '/',   '*',   ' ',    ST,   'F',   'A',    /* extended */
-    0,   'D',   'C',     0,   'B',     0,   '@',   'P'     /* extended */
+    0, 0x1b,   '!',   '@',   '#',   '$',   '%',   '^',    /* scan  0- 7 */
+  '&',  '*',   '(',   ')',   '_',   '+',  0x08,  '\t',    /* scan  8- F */
+  'Q',  'W',   'E',   'R',   'T',   'Y',   'U',   'I',    /* scan 10-17 */
+  'O',  'P',   '{',   '}',  '\r',   CN,    'A',   'S',    /* scan 18-1F */
+  'D',  'F',   'G',   'H',   'J',   'K',   'L',   ':',    /* scan 20-27 */
+  '"',  '~',   SH,    '|',   'Z',   'X',   'C',   'V',    /* scan 28-2F */
+  'B',  'N',   'M',   '<',   '>',   '?',   SH,    '*',    /* scan 30-37 */
+  ' ',  ' ',   CP,      0,     0,     0,     0,     0,    /* scan 38-3F */
+    0,    0,     0,     0,     0,   NM,    ST,    '7',    /* scan 40-47 */
+  '8',  '9',   '-',   '4',   '5',   '6',   '+',   '1',    /* scan 48-4F */
+  '2',  '3',   '0',   '.',     0,     0,     0,     0,    /* scan 50-57 */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 58-5F */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 60-67 */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 68-6F */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 70-77 */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 78-7F */
+  '\r',          CN,   '/',   '*',   ' ',    ST,   'F',   'A',    /* extended */
+    0,  'D',   'C',     0,   'B',     0,   '@',   'P'     /* extended */
     },
     { /* control code */
- 0xff,  0x1b,  0xff,  0x00,  0xff,  0xff,  0xff,  0xff,    /* scan  0- 7 */
- 0x1e,  0xff,  0xff,  0xff,  0x1f,  0xff,  0xff,  '\t',    /* scan  8- F */
- 0x11,  0x17,  0x05,  0x12,  0x14,  0x19,  0x15,  0x09,    /* scan 10-17 */
- 0x0f,  0x10,  0x1b,  0x1d,  '\r',   CN,   0x01,  0x13,    /* scan 18-1F */
- 0x04,  0x06,  0x07,  0x08,  0x0a,  0x0b,  0x0c,  0xff,    /* scan 20-27 */
- 0xff,  0x1c,   SH,   0xff,  0x1a,  0x18,  0x03,  0x16,    /* scan 28-2F */
- 0x02,  0x0e,  0x0d,  0xff,  0xff,  0xff,   SH,   0xff,    /* scan 30-37 */
- 0xff,  0xff,   CP,   0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 38-3F */
- 0xff,  0xff,  0xff,  0xff,  0xff,   NM,    ST,   0xff,    /* scan 40-47 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 48-4F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 50-57 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 58-5F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 60-67 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 68-6F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 70-77 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 78-7F */
-  '\r',   CN,   '/',   '*',   ' ',    ST,  0xff,  0xff,    /* extended */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff     /* extended */
+ 0xff, 0x1b,  0xff,  0x00,  0xff,  0xff,  0xff,  0xff,    /* scan  0- 7 */
+ 0x1e, 0xff,  0xff,  0xff,  0x1f,  0xff,  0xff,  '\t',    /* scan  8- F */
+ 0x11, 0x17,  0x05,  0x12,  0x14,  0x19,  0x15,  0x09,    /* scan 10-17 */
+ 0x0f, 0x10,  0x1b,  0x1d,  '\r',   CN,   0x01,  0x13,    /* scan 18-1F */
+ 0x04, 0x06,  0x07,  0x08,  0x0a,  0x0b,  0x0c,  0xff,    /* scan 20-27 */
+ 0xff, 0x1c,   SH,   0xff,  0x1a,  0x18,  0x03,  0x16,    /* scan 28-2F */
+ 0x02, 0x0e,  0x0d,  0xff,  0xff,  0xff,   SH,   0xff,    /* scan 30-37 */
+ 0xff, 0xff,   CP,   0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 38-3F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,   NM,    ST,   0xff,    /* scan 40-47 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 48-4F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 50-57 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 58-5F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 60-67 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 68-6F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 70-77 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,    /* scan 78-7F */
+  '\r',          CN,   '/',   '*',   ' ',    ST,  0xff,  0xff,    /* extended */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff     /* extended */
     },
     { /* non numeric code */
-    0,  0x1b,   '1',   '2',   '3',   '4',   '5',   '6',    /* scan  0- 7 */
-  '7',   '8',   '9',   '0',   '-',   '=',  0x08,  '\t',    /* scan  8- F */
-  'q',   'w',   'e',   'r',   't',   'y',   'u',   'i',    /* scan 10-17 */
-  'o',   'p',   '[',   ']',  '\r',   CN,    'a',   's',    /* scan 18-1F */
-  'd',   'f',   'g',   'h',   'j',   'k',   'l',   ';',    /* scan 20-27 */
- '\'',   '`',   SH,   '\\',   'z',   'x',   'c',   'v',    /* scan 28-2F */
-  'b',   'n',   'm',   ',',   '.',   '/',   SH,    '*',    /* scan 30-37 */
-  ' ',   ' ',   CP,      0,     0,     0,     0,     0,    /* scan 38-3F */
-    0,     0,     0,     0,     0,   NM,    ST,    'w',    /* scan 40-47 */
-  'x',   'y',   'l',   't',   'u',   'v',   'm',   'q',    /* scan 48-4F */
-  'r',   's',   'p',   'n',     0,     0,     0,     0,    /* scan 50-57 */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 58-5F */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 60-67 */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 68-6F */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 70-77 */
-    0,     0,     0,     0,     0,     0,     0,     0,    /* scan 78-7F */
-  '\r',   CN,   '/',   '*',   ' ',    ST,   'F',   'A',    /* extended */
-    0,   'D',   'C',     0,   'B',     0,    '@',  'P'     /* extended */
+    0, 0x1b,   '1',   '2',   '3',   '4',   '5',   '6',    /* scan  0- 7 */
+  '7',  '8',   '9',   '0',   '-',   '=',  0x08,  '\t',    /* scan  8- F */
+  'q',  'w',   'e',   'r',   't',   'y',   'u',   'i',    /* scan 10-17 */
+  'o',  'p',   '[',   ']',  '\r',   CN,    'a',   's',    /* scan 18-1F */
+  'd',  'f',   'g',   'h',   'j',   'k',   'l',   ';',    /* scan 20-27 */
+ '\'',  '`',   SH,   '\\',   'z',   'x',   'c',   'v',    /* scan 28-2F */
+  'b',  'n',   'm',   ',',   '.',   '/',   SH,    '*',    /* scan 30-37 */
+  ' ',  ' ',   CP,      0,     0,     0,     0,     0,    /* scan 38-3F */
+    0,    0,     0,     0,     0,   NM,    ST,    'w',    /* scan 40-47 */
+  'x',  'y',   'l',   't',   'u',   'v',   'm',   'q',    /* scan 48-4F */
+  'r',  's',   'p',   'n',     0,     0,     0,     0,    /* scan 50-57 */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 58-5F */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 60-67 */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 68-6F */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 70-77 */
+    0,    0,     0,     0,     0,     0,     0,     0,    /* scan 78-7F */
+  '\r',          CN,   '/',   '*',   ' ',    ST,   'F',   'A',    /* extended */
+    0,  'D',   'C',     0,   'B',     0,    '@',  'P'     /* extended */
     },
     { /* right alt mode - not used in US keyboard */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan  0 - 7 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan  8 - F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 10 -17 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 18 -1F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 20 -27 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 28 -2F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 30 -37 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 38 -3F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 40 -47 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 48 -4F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 50 -57 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 58 -5F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 60 -67 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 68 -6F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 70 -77 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 78 -7F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* extended    */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff  /* extended    */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan  0 - 7 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan  8 - F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 10 -17 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 18 -1F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 20 -27 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 28 -2F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 30 -37 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 38 -3F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 40 -47 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 48 -4F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 50 -57 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 58 -5F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 60 -67 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 68 -6F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 70 -77 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 78 -7F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* extended    */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff  /* extended    */
     }
     },
     { /* german keyboard */
     { /* unshift code */
-    0,  0x1b,   '1',   '2',   '3',   '4',   '5',   '6', /* scan  0- 7 */
-  '7',   '8',   '9',   '0',  0xe1,  '\'',  0x08,  '\t', /* scan  8- F */
-  'q',   'w',   'e',   'r',   't',   'z',   'u',   'i', /* scan 10-17 */
-  'o',   'p',  0x81,   '+',  '\r',   CN,    'a',   's', /* scan 18-1F */
-  'd',   'f',   'g',   'h',   'j',   'k',   'l',  0x94, /* scan 20-27 */
- 0x84,   '^',   SH,    '#',   'y',   'x',   'c',   'v', /* scan 28-2F */
-  'b',   'n',   'm',   ',',   '.',   '-',   SH,    '*', /* scan 30-37 */
-  ' ',   ' ',   CP,      0,     0,     0,     0,     0, /* scan 38-3F */
-    0,     0,     0,     0,     0,   NM,    ST,    '7', /* scan 40-47 */
-  '8',   '9',   '-',   '4',   '5',   '6',   '+',   '1', /* scan 48-4F */
-  '2',   '3',   '0',   ',',     0,     0,   '<',     0, /* scan 50-57 */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 58-5F */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 60-67 */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 68-6F */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 70-77 */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 78-7F */
-  '\r',   CN,   '/',   '*',   ' ',    ST,   'F',   'A', /* extended */
-    0,   'D',   'C',     0,   'B',     0,    '@',  'P'  /* extended */
+    0, 0x1b,   '1',   '2',   '3',   '4',   '5',   '6', /* scan  0- 7 */
+  '7',  '8',   '9',   '0',  0xe1,  '\'',  0x08,  '\t', /* scan  8- F */
+  'q',  'w',   'e',   'r',   't',   'z',   'u',   'i', /* scan 10-17 */
+  'o',  'p',  0x81,   '+',  '\r',   CN,    'a',   's', /* scan 18-1F */
+  'd',  'f',   'g',   'h',   'j',   'k',   'l',  0x94, /* scan 20-27 */
+ 0x84,  '^',   SH,    '#',   'y',   'x',   'c',   'v', /* scan 28-2F */
+  'b',  'n',   'm',   ',',   '.',   '-',   SH,    '*', /* scan 30-37 */
+  ' ',  ' ',   CP,      0,     0,     0,     0,     0, /* scan 38-3F */
+    0,    0,     0,     0,     0,   NM,    ST,    '7', /* scan 40-47 */
+  '8',  '9',   '-',   '4',   '5',   '6',   '+',   '1', /* scan 48-4F */
+  '2',  '3',   '0',   ',',     0,     0,   '<',     0, /* scan 50-57 */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 58-5F */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 60-67 */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 68-6F */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 70-77 */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 78-7F */
+  '\r',          CN,   '/',   '*',   ' ',    ST,   'F',   'A', /* extended */
+    0,  'D',   'C',     0,   'B',     0,    '@',  'P'  /* extended */
     },
     { /* shift code */
-    0,  0x1b,   '!',   '"',  0x15,   '$',   '%',   '&', /* scan  0- 7 */
-  '/',   '(',   ')',   '=',   '?',   '`',  0x08,  '\t', /* scan  8- F */
-  'Q',   'W',   'E',   'R',   'T',   'Z',   'U',   'I', /* scan 10-17 */
-  'O',   'P',  0x9a,   '*',  '\r',   CN,    'A',   'S', /* scan 18-1F */
-  'D',   'F',   'G',   'H',   'J',   'K',   'L',  0x99, /* scan 20-27 */
- 0x8e,  0xf8,   SH,   '\'',   'Y',   'X',   'C',   'V', /* scan 28-2F */
-  'B',   'N',   'M',   ';',   ':',   '_',   SH,    '*', /* scan 30-37 */
-  ' ',   ' ',   CP,      0,     0,     0,     0,     0, /* scan 38-3F */
-    0,     0,     0,     0,     0,   NM,    ST,    '7', /* scan 40-47 */
-  '8',   '9',   '-',   '4',   '5',   '6',   '+',   '1', /* scan 48-4F */
-  '2',   '3',   '0',   ',',     0,     0,   '>',     0, /* scan 50-57 */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 58-5F */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 60-67 */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 68-6F */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 70-77 */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 78-7F */
-  '\r',   CN,   '/',   '*',   ' ',    ST,   'F',   'A', /* extended */
-    0,   'D',   'C',     0,   'B',     0,   '@',   'P'  /* extended */
+    0, 0x1b,   '!',   '"',  0x15,   '$',   '%',   '&', /* scan  0- 7 */
+  '/',  '(',   ')',   '=',   '?',   '`',  0x08,  '\t', /* scan  8- F */
+  'Q',  'W',   'E',   'R',   'T',   'Z',   'U',   'I', /* scan 10-17 */
+  'O',  'P',  0x9a,   '*',  '\r',   CN,    'A',   'S', /* scan 18-1F */
+  'D',  'F',   'G',   'H',   'J',   'K',   'L',  0x99, /* scan 20-27 */
+ 0x8e, 0xf8,   SH,   '\'',   'Y',   'X',   'C',   'V', /* scan 28-2F */
+  'B',  'N',   'M',   ';',   ':',   '_',   SH,    '*', /* scan 30-37 */
+  ' ',  ' ',   CP,      0,     0,     0,     0,     0, /* scan 38-3F */
+    0,    0,     0,     0,     0,   NM,    ST,    '7', /* scan 40-47 */
+  '8',  '9',   '-',   '4',   '5',   '6',   '+',   '1', /* scan 48-4F */
+  '2',  '3',   '0',   ',',     0,     0,   '>',     0, /* scan 50-57 */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 58-5F */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 60-67 */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 68-6F */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 70-77 */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 78-7F */
+  '\r',          CN,   '/',   '*',   ' ',    ST,   'F',   'A', /* extended */
+    0,  'D',   'C',     0,   'B',     0,   '@',   'P'  /* extended */
     },
     { /* control code */
- 0xff,  0x1b,  0xff,  0x00,  0xff,  0xff,  0xff,  0xff, /* scan  0- 7 */
- 0x1e,  0xff,  0xff,  0xff,  0x1f,  0xff,  0xff,  '\t', /* scan  8- F */
- 0x11,  0x17,  0x05,  0x12,  0x14,  0x19,  0x15,  0x09, /* scan 10-17 */
- 0x0f,  0x10,  0x1b,  0x1d,  '\r',   CN,   0x01,  0x13, /* scan 18-1F */
- 0x04,  0x06,  0x07,  0x08,  0x0a,  0x0b,  0x0c,  0xff, /* scan 20-27 */
- 0xff,  0x1c,   SH,   0xff,  0x1a,  0x18,  0x03,  0x16, /* scan 28-2F */
- 0x02,  0x0e,  0x0d,  0xff,  0xff,  0xff,   SH,   0xff, /* scan 30-37 */
- 0xff,  0xff,   CP,   0xff,  0xff,  0xff,  0xff,  0xff, /* scan 38-3F */
- 0xff,  0xff,  0xff,  0xff,  0xff,   NM,    ST,   0xff, /* scan 40-47 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 48-4F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 50-57 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 58-5F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 60-67 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 68-6F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 70-77 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 78-7F */
-  '\r',   CN,   '/',   '*',   ' ',    ST,  0xff,  0xff, /* extended */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff  /* extended */
+ 0xff, 0x1b,  0xff,  0x00,  0xff,  0xff,  0xff,  0xff, /* scan  0- 7 */
+ 0x1e, 0xff,  0xff,  0xff,  0x1f,  0xff,  0xff,  '\t', /* scan  8- F */
+ 0x11, 0x17,  0x05,  0x12,  0x14,  0x19,  0x15,  0x09, /* scan 10-17 */
+ 0x0f, 0x10,  0x1b,  0x1d,  '\r',   CN,   0x01,  0x13, /* scan 18-1F */
+ 0x04, 0x06,  0x07,  0x08,  0x0a,  0x0b,  0x0c,  0xff, /* scan 20-27 */
+ 0xff, 0x1c,   SH,   0xff,  0x1a,  0x18,  0x03,  0x16, /* scan 28-2F */
+ 0x02, 0x0e,  0x0d,  0xff,  0xff,  0xff,   SH,   0xff, /* scan 30-37 */
+ 0xff, 0xff,   CP,   0xff,  0xff,  0xff,  0xff,  0xff, /* scan 38-3F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,   NM,    ST,   0xff, /* scan 40-47 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 48-4F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 50-57 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 58-5F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 60-67 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 68-6F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 70-77 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 78-7F */
+  '\r',          CN,   '/',   '*',   ' ',    ST,  0xff,  0xff, /* extended */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff  /* extended */
     },
     { /* non numeric code */
-    0,  0x1b,   '1',   '2',   '3',   '4',   '5',   '6', /* scan  0- 7 */
-  '7',   '8',   '9',   '0',  0xe1,  '\'',  0x08,  '\t', /* scan  8- F */
-  'q',   'w',   'e',   'r',   't',   'z',   'u',   'i', /* scan 10-17 */
-  'o',   'p',  0x81,   '+',  '\r',   CN,    'a',   's', /* scan 18-1F */
-  'd',   'f',   'g',   'h',   'j',   'k',   'l',  0x94, /* scan 20-27 */
- 0x84,   '^',   SH,      0,   'y',   'x',   'c',   'v', /* scan 28-2F */
-  'b',   'n',   'm',   ',',   '.',   '-',   SH,    '*', /* scan 30-37 */
-  ' ',   ' ',   CP,      0,     0,     0,     0,     0, /* scan 38-3F */
-    0,     0,     0,     0,     0,   NM,    ST,    'w', /* scan 40-47 */
-  'x',   'y',   'l',   't',   'u',   'v',   'm',   'q', /* scan 48-4F */
-  'r',   's',   'p',   'n',     0,     0,   '<',     0, /* scan 50-57 */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 58-5F */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 60-67 */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 68-6F */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 70-77 */
-    0,     0,     0,     0,     0,     0,     0,     0, /* scan 78-7F */
-  '\r',   CN,   '/',   '*',   ' ',    ST,   'F',   'A', /* extended */
-    0,   'D',   'C',     0,   'B',     0,    '@',  'P'  /* extended */
+    0, 0x1b,   '1',   '2',   '3',   '4',   '5',   '6', /* scan  0- 7 */
+  '7',  '8',   '9',   '0',  0xe1,  '\'',  0x08,  '\t', /* scan  8- F */
+  'q',  'w',   'e',   'r',   't',   'z',   'u',   'i', /* scan 10-17 */
+  'o',  'p',  0x81,   '+',  '\r',   CN,    'a',   's', /* scan 18-1F */
+  'd',  'f',   'g',   'h',   'j',   'k',   'l',  0x94, /* scan 20-27 */
+ 0x84,  '^',   SH,      0,   'y',   'x',   'c',   'v', /* scan 28-2F */
+  'b',  'n',   'm',   ',',   '.',   '-',   SH,    '*', /* scan 30-37 */
+  ' ',  ' ',   CP,      0,     0,     0,     0,     0, /* scan 38-3F */
+    0,    0,     0,     0,     0,   NM,    ST,    'w', /* scan 40-47 */
+  'x',  'y',   'l',   't',   'u',   'v',   'm',   'q', /* scan 48-4F */
+  'r',  's',   'p',   'n',     0,     0,   '<',     0, /* scan 50-57 */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 58-5F */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 60-67 */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 68-6F */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 70-77 */
+    0,    0,     0,     0,     0,     0,     0,     0, /* scan 78-7F */
+  '\r',          CN,   '/',   '*',   ' ',    ST,   'F',   'A', /* extended */
+    0,  'D',   'C',     0,   'B',     0,    '@',  'P'  /* extended */
     },
     { /* Right alt mode - is used in German keyboard */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan  0 - 7 */
-  '{',   '[',   ']',   '}',  '\\',  0xff,  0xff,  0xff, /* scan  8 - F */
-  '@',  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 10 -17 */
- 0xff,  0xff,  0xff,   '~',  0xff,  0xff,  0xff,  0xff, /* scan 18 -1F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 20 -27 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 28 -2F */
- 0xff,  0xff,  0xe6,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 30 -37 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 38 -3F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 40 -47 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 48 -4F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,   '|',  0xff, /* scan 50 -57 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 58 -5F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 60 -67 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 68 -6F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 70 -77 */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 78 -7F */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* extended    */
- 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff  /* extended    */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan  0 - 7 */
+  '{',  '[',   ']',   '}',  '\\',  0xff,  0xff,  0xff, /* scan  8 - F */
+  '@', 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 10 -17 */
+ 0xff, 0xff,  0xff,   '~',  0xff,  0xff,  0xff,  0xff, /* scan 18 -1F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 20 -27 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 28 -2F */
+ 0xff, 0xff,  0xe6,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 30 -37 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 38 -3F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 40 -47 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 48 -4F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,   '|',  0xff, /* scan 50 -57 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 58 -5F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 60 -67 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 68 -6F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 70 -77 */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* scan 78 -7F */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff, /* extended    */
+ 0xff, 0xff,  0xff,  0xff,  0xff,  0xff,  0xff,  0xff  /* extended    */
     }
     }
     };
@@ -318,24 +326,31 @@ int i8042_kbd_init (void)
     int keymap, try;
     char *penv;
 
+#ifdef CONFIG_USE_CPCIDVI
+    if ((penv = getenv ("console")) != NULL) {
+           if (strncmp (penv, "serial", 7) == 0) {
+                   return -1;
+           }
+    }
+#endif
     /* Init keyboard device (default US layout) */
     keymap = KBD_US;
     if ((penv = getenv ("keymap")) != NULL)
     {
-        if (strncmp (penv, "de", 3) == 0)
-        keymap = KBD_GER;
+       if (strncmp (penv, "de", 3) == 0)
+       keymap = KBD_GER;
     }
 
     for (try = 0; try < KBD_RESET_TRIES; try++)
     {
-        if (kbd_reset() == 0)
-        {
-            kbd_mapping   = keymap;
-            kbd_flags     = NORMAL;
-            kbd_state     = 0;
-            kbd_led_set();
-            return 0;
-            }
+       if (kbd_reset() == 0)
+       {
+           kbd_mapping   = keymap;
+           kbd_flags     = NORMAL;
+           kbd_state     = 0;
+           kbd_led_set();
+           return 0;
+           }
     }
     return -1;
 }
@@ -344,7 +359,7 @@ int i8042_kbd_init (void)
 /*******************************************************************************
  *
  * i8042_tstc - test if keyboard input is available
- *              option: cursor blinking if called in a loop
+ *             option: cursor blinking if called in a loop
  */
 int i8042_tstc (void)
 {
@@ -353,25 +368,25 @@ int i8042_tstc (void)
 #ifdef CONFIG_CONSOLE_CURSOR
     if (--blinkCount == 0)
     {
-        cursor_state ^= 1;
-        console_cursor (cursor_state);
-        blinkCount = CFG_CONSOLE_BLINK_COUNT;
-        udelay (10);
+       cursor_state ^= 1;
+       console_cursor (cursor_state);
+       blinkCount = CFG_CONSOLE_BLINK_COUNT;
+       udelay (10);
     }
 #endif
 
     if ((in8 (I8042_STATUS_REG) & 0x01) == 0)
-        return 0;
+       return 0;
     else
     {
-        scan_code = in8 (I8042_DATA_REG);
-        if (scan_code == 0xfa)
-            return 0;
+       scan_code = in8 (I8042_DATA_REG);
+       if (scan_code == 0xfa)
+           return 0;
 
-        kbd_conv_char(scan_code);
+       kbd_conv_char(scan_code);
 
-        if (kbd_input != -1)
-            return 1;
+       if (kbd_input != -1)
+           return 1;
     }
     return 0;
 }
@@ -380,7 +395,7 @@ int i8042_tstc (void)
 /*******************************************************************************
  *
  * i8042_getc - wait till keyboard input is available
- *              option: turn on/off cursor while waiting
+ *             option: turn on/off cursor while waiting
  */
 int i8042_getc (void)
 {
@@ -389,23 +404,23 @@ int i8042_getc (void)
 
     while (kbd_input == -1)
     {
-        while ((in8 (I8042_STATUS_REG) & 0x01) == 0)
-        {
+       while ((in8 (I8042_STATUS_REG) & 0x01) == 0)
+       {
 #ifdef CONFIG_CONSOLE_CURSOR
-            if (--blinkCount==0)
-            {
-                cursor_state ^= 1;
-                console_cursor (cursor_state);
-                blinkCount = CFG_CONSOLE_BLINK_COUNT;
-            }
-            udelay (10);
+           if (--blinkCount==0)
+           {
+               cursor_state ^= 1;
+               console_cursor (cursor_state);
+               blinkCount = CFG_CONSOLE_BLINK_COUNT;
+           }
+           udelay (10);
 #endif
-        }
+       }
 
-        scan_code = in8 (I8042_DATA_REG);
+       scan_code = in8 (I8042_DATA_REG);
 
-        if (scan_code != 0xfa)
-        kbd_conv_char (scan_code);
+       if (scan_code != 0xfa)
+       kbd_conv_char (scan_code);
     }
     ret_chr = kbd_input;
     kbd_input = -1;
@@ -419,62 +434,62 @@ static void kbd_conv_char (unsigned char scan_code)
 {
     if (scan_code == 0xe0)
     {
-        kbd_flags |= EXT;
-        return;
+       kbd_flags |= EXT;
+       return;
     }
 
     /* if high bit of scan_code, set break flag */
     if (scan_code & 0x80)
-        kbd_flags |=  BRK;
+       kbd_flags |=  BRK;
     else
-        kbd_flags &= ~BRK;
+       kbd_flags &= ~BRK;
 
     if ((scan_code == 0xe1) || (kbd_flags & E1))
     {
-        if (scan_code == 0xe1)
-        {
-            kbd_flags ^= BRK;     /* reset the break flag */
-            kbd_flags ^= E1;      /* bitwise EXOR with E1 flag */
-        }
-        return;
+       if (scan_code == 0xe1)
+       {
+           kbd_flags ^= BRK;     /* reset the break flag */
+           kbd_flags ^= E1;      /* bitwise EXOR with E1 flag */
+       }
+       return;
     }
 
     scan_code &= 0x7f;
 
     if (kbd_flags & EXT)
     {
-        int i;
-
-        kbd_flags ^= EXT;
-        for (i=0; ext_key_map[i]; i++)
-        {
-            if (ext_key_map[i] == scan_code)
-            {
-                scan_code = 0x80 + i;
-                break;
-            }
-        }
-        /* not found ? */
-        if (!ext_key_map[i])
-            return;
+       int i;
+
+       kbd_flags ^= EXT;
+       for (i=0; ext_key_map[i]; i++)
+       {
+           if (ext_key_map[i] == scan_code)
+           {
+               scan_code = 0x80 + i;
+               break;
+           }
+       }
+       /* not found ? */
+       if (!ext_key_map[i])
+           return;
     }
 
     switch (kbd_fct_map [scan_code])
     {
     case AS:  kbd_normal (scan_code);
-        break;
+       break;
     case SH:  kbd_shift (scan_code);
-        break;
+       break;
     case CN:  kbd_ctrl (scan_code);
-        break;
+       break;
     case NM:  kbd_num (scan_code);
-        break;
+       break;
     case CP:  kbd_caps (scan_code);
-        break;
+       break;
     case ST:  kbd_scroll (scan_code);
-        break;
+       break;
     case AK:  kbd_alt (scan_code);
-        break;
+       break;
     }
     return;
 }
@@ -490,14 +505,14 @@ static void kbd_normal (unsigned char scan_code)
     {
        chr = kbd_key_map [kbd_mapping][kbd_state][scan_code];
        if ((chr == 0xff) || (chr == 0x00))
-        {
-            return;
-        }
+       {
+           return;
+       }
 
-        /* if caps lock convert upper to lower */
-        if (((kbd_flags & CAPS) == CAPS) && (chr >= 'a' && chr <= 'z'))
+       /* if caps lock convert upper to lower */
+       if (((kbd_flags & CAPS) == CAPS) && (chr >= 'a' && chr <= 'z'))
        {
-           chr -= 'a' - 'A';
+          chr -= 'a' - 'A';
        }
        kbd_input = chr;
     }
@@ -510,8 +525,8 @@ static void kbd_shift (unsigned char scan_code)
 {
     if ((kbd_flags & BRK) == BRK)
     {
-        kbd_state = AS;
-        kbd_flags &= (~SHIFT);
+       kbd_state = AS;
+       kbd_flags &= (~SHIFT);
     }
     else
     {
@@ -545,7 +560,7 @@ static void kbd_caps (unsigned char scan_code)
     if ((kbd_flags & BRK) == NORMAL)
     {
        kbd_flags ^= CAPS;
-       kbd_led_set ();            /* update keyboard LED */
+       kbd_led_set ();           /* update keyboard LED */
     }
 }
 
@@ -558,7 +573,7 @@ static void kbd_num (unsigned char scan_code)
     {
        kbd_flags ^= NUM;
        kbd_state = (kbd_flags & NUM) ? AS : NM;
-       kbd_led_set ();            /* update keyboard LED */
+       kbd_led_set ();           /* update keyboard LED */
     }
 }
 
@@ -569,12 +584,12 @@ static void kbd_scroll (unsigned char scan_code)
 {
     if ((kbd_flags & BRK) == NORMAL)
     {
-        kbd_flags ^= STP;
-        kbd_led_set ();            /* update keyboard LED */
-        if (kbd_flags & STP)
-            kbd_input = 0x13;
-        else
-            kbd_input = 0x11;
+       kbd_flags ^= STP;
+       kbd_led_set ();            /* update keyboard LED */
+       if (kbd_flags & STP)
+           kbd_input = 0x13;
+       else
+           kbd_input = 0x11;
     }
 }
 
@@ -584,13 +599,13 @@ static void kbd_alt (unsigned char scan_code)
 {
     if ((kbd_flags & BRK) == BRK)
     {
-        kbd_state = AS;
-        kbd_flags &= (~ALT);
+       kbd_state = AS;
+       kbd_flags &= (~ALT);
     }
     else
     {
-        kbd_state = AK;
-        kbd_flags &= ALT;
+       kbd_state = AK;
+       kbd_flags &= ALT;
     }
 }
 
@@ -600,9 +615,9 @@ static void kbd_alt (unsigned char scan_code)
 static void kbd_led_set (void)
 {
     kbd_input_empty();
-    out8 (I8042_DATA_REG, 0xed);        /* SET LED command */
+    out8 (I8042_DATA_REG, 0xed);       /* SET LED command */
     kbd_input_empty();
-    out8 (I8042_DATA_REG, (kbd_flags & 0x7));    /* LED bits only */
+    out8 (I8042_DATA_REG, (kbd_flags & 0x7));   /* LED bits only */
 }
 
 
@@ -614,7 +629,7 @@ static int kbd_input_empty (void)
 
     /* wait for input buf empty */
     while ((in8 (I8042_STATUS_REG) & 0x02) && kbdTimeout--)
-        udelay(1000);
+       udelay(1000);
 
     return kbdTimeout;
 }
@@ -624,30 +639,34 @@ static int kbd_input_empty (void)
 static int kbd_reset (void)
 {
     if (kbd_input_empty() == 0)
-        return -1;
+       return -1;
 
     out8 (I8042_DATA_REG, 0xff);
 
     udelay(250000);
 
     if (kbd_input_empty() == 0)
-        return -1;
+       return -1;
 
+#ifdef CONFIG_USE_CPCIDVI
+    out8 (I8042_COMMAND_REG, 0x60);
+#else
     out8 (I8042_DATA_REG, 0x60);
+#endif
 
     if (kbd_input_empty() == 0)
-        return -1;
+       return -1;
 
     out8 (I8042_DATA_REG, 0x45);
 
 
     if (kbd_input_empty() == 0)
-        return -1;
+       return -1;
 
     out8 (I8042_COMMAND_REG, 0xae);
 
     if (kbd_input_empty() == 0)
-        return -1;
+       return -1;
 
     return 0;
 }