]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/drivers/lcd/src/lcd-amba.c
update
[l4.git] / l4 / pkg / drivers / lcd / src / lcd-amba.c
index 09cc6fe145ce5717ad5d25bc8ef097bcbef2208b..5c87a30d698d7f378473c4e491514a449302d083 100644 (file)
@@ -4,7 +4,6 @@
 
 #include <l4/drivers/lcd.h>
 #include <l4/drivers/amba.h>
-#include <l4/drivers/io.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -108,12 +107,15 @@ static void setup_type(void)
 
   amba_read_id(amba_pl110_lcd_control_virt_base + 0xfe0, &periphid, &cellid);
 
-  if (periphid == 0x00041111 && cellid == 0xb105f00d)
+  if ((periphid & 0xff0fffff) == 0x00041111 && cellid == 0xb105f00d)
     type = PL111;
   else if (periphid == 0x00041110 && cellid == 0xb105f00d)
     type = PL110;
   else
-    type = PL_UNKNOWN;
+    {
+      printf("Unknown LCD: periphid = %08x, cellid = %08x\n", periphid, cellid);
+      type = PL_UNKNOWN;
+    }
 }
 
 static const char *arm_lcd_get_info(void)
@@ -122,15 +124,15 @@ static const char *arm_lcd_get_info(void)
 }
 
 static
-l4_umword_t read_sys_reg(unsigned reg)
+l4_uint32_t read_sys_reg(unsigned reg)
 {
-  return io_read_mword(amba_pl110_sys_base_virt + reg);
+  return *((volatile l4_uint32_t *)(amba_pl110_sys_base_virt + reg));
 }
 
 static
-void write_sys_reg(unsigned reg, l4_umword_t val)
+void write_sys_reg(unsigned reg, l4_uint32_t val)
 {
-  io_write_mword(amba_pl110_sys_base_virt + reg, val);
+  *((volatile l4_uint32_t *)(amba_pl110_sys_base_virt + reg)) = val;
 }
 
 static
@@ -142,15 +144,21 @@ void set_clcd_clock(l4_umword_t val)
 }
 
 static
-l4_umword_t read_clcd_reg(unsigned reg)
+l4_uint32_t read_clcd_reg(unsigned reg)
 {
-  return *((volatile l4_umword_t *)(amba_pl110_lcd_control_virt_base + reg));
+  return *((volatile l4_uint32_t *)(amba_pl110_lcd_control_virt_base + reg));
 }
 
 static
 void write_clcd_reg(unsigned reg, l4_umword_t val)
 {
-  *((volatile l4_umword_t *)(amba_pl110_lcd_control_virt_base + reg)) = val;
+  *((volatile l4_uint32_t *)(amba_pl110_lcd_control_virt_base + reg)) = val;
+}
+
+static
+unsigned is_vexpress(void)
+{
+  return (read_sys_reg(Reg_sys_id) & 0xfff0000) == 0x1900000;
 }
 
 static
@@ -159,11 +167,12 @@ int init(unsigned long fb_phys_addr)
   l4_umword_t id;
 
   id = read_sys_reg(Reg_sys_clcd) & Sys_clcd_idmask;
+  if (is_vexpress())
+    id = Sys_clcd_id84;
   switch (id)
     {
     case Sys_clcd_id84:
     case Sys_clcd_idmask:
-    case 0x1000: // (strange?) qemu value, should be 0x100, or did they think BE?
       printf("Configure 8.4 CLCD\n");
       if (use_xga)
         {