diff src/cs/drivers/drv_core/armio/armio.c @ 117:e67bbb9b1fb9

src/cs sync with Magnetite: C155 support
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 07 Nov 2018 06:03:02 +0000
parents b6a5e36de839
children b0a18d9f99f4
line wrap: on
line diff
--- a/src/cs/drivers/drv_core/armio/armio.c	Wed Nov 07 05:42:51 2018 +0000
+++ b/src/cs/drivers/drv_core/armio/armio.c	Wed Nov 07 06:03:02 2018 +0000
@@ -207,20 +207,44 @@
   // set IOs 8,9,10,11,12 and 13 as high
   // set IOs 0 to 7 as low
 
-  #if defined(CONFIG_TARGET_C139) || defined(CONFIG_TARGET_C11X)
+  #ifdef CONFIG_TARGET_C11X
+    /* C11x GPIO configuration mimics what the original fw sets */
+
+    /* GPIO out all zeros */
+    *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000;
+
+    /* setting of GPIOs as outputs: register setting from the original fw */
+    *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) = 0x2209;
+
+  #elif defined(CONFIG_TARGET_C139)
     /* C139 GPIO configuration mimics what the original fw sets */
 
     /* GPIO out all zeros - the LCD backlight is OFF */
     *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000;
 
-    /* setting of GPIOs as outputs also mimics what the original fw sets */
+    /* setting of GPIOs as outputs: register setting from the original fw */
     *((volatile SYS_UWORD16 *) ARMIO_IO_CNTL) = 0x2A09;
-  #elif defined(CONFIG_TARGET_PIRELLI)
+
+  #elif defined(CONFIG_TARGET_C155)
+    /* C155 GPIO config based on the available schematics */
+
+    /* GPIO out all zeros - the LCD backlight is OFF */
     *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000;
 
-    AI_ConfigBitAsOutput(1);	
+    AI_ConfigBitAsOutput(1);	/* LCD backlight control */
+    AI_ConfigBitAsOutput(2);	/* headset jack switch */
+    AI_ConfigBitAsOutput(3);	/* LCDA0 (?) */
+    AI_ConfigBitAsOutput(8);	/* MUSIC_A0 */
+    AI_ConfigBitAsOutput(12);	/* MUSIC_ON */
+
+  #elif defined(CONFIG_TARGET_PIRELLI)
+
+    *((volatile SYS_UWORD16 *) ARMIO_OUT) = 0x0000;
+
+    AI_ConfigBitAsOutput(1);
     AI_ConfigBitAsOutput(4);
     AI_ConfigBitAsOutput(7);
+
   #else	/* classic TI/Openmoko/FreeCalypso targets */
     // set IOs 1 and 8 to 13 as high
     // set IOs 0 and 2 to 7 as low
@@ -236,24 +260,26 @@
 
     // ARMIO_CNTL_REG register configuration :
     // set IOs 1,2,5,7,9,14 and 15 as ouputs.
-    #ifndef CONFIG_TARGET_DSAMPLE
-      AI_ConfigBitAsOutput(0);	/* FreeCalypso addition */
+    // bits conditionalized on CONFIG_TARGET_GTAMODEM or CONFIG_TARGET_FCDEV3B
+    // are FreeCalypso additions
+    #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCDEV3B)
+      AI_ConfigBitAsOutput(0);
     #endif
-    AI_ConfigBitAsOutput(1);	
+    AI_ConfigBitAsOutput(1);
     AI_ConfigBitAsOutput(2);
     #ifdef CONFIG_TARGET_GTAMODEM
       AI_ConfigBitAsOutput(3);
     #endif
-    #ifndef CONFIG_TARGET_DSAMPLE
-      AI_ConfigBitAsOutput(4);	/* FreeCalypso addition */
+    #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCDEV3B)
+      AI_ConfigBitAsOutput(4);
     #endif
     AI_ConfigBitAsOutput(5);
-    #ifndef CONFIG_TARGET_DSAMPLE
-      AI_ConfigBitAsOutput(6);	/* FreeCalypso addition */
+    #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCDEV3B)
+      AI_ConfigBitAsOutput(6);
     #endif
     AI_ConfigBitAsOutput(7);
-    #ifndef CONFIG_TARGET_DSAMPLE
-      AI_ConfigBitAsOutput(8);	/* FreeCalypso addition */
+    #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCDEV3B)
+      AI_ConfigBitAsOutput(8);
     #endif
     AI_ConfigBitAsOutput(9);
     #ifdef CONFIG_TARGET_GTAMODEM
@@ -261,8 +287,8 @@
       AI_ConfigBitAsOutput(11);
       AI_ConfigBitAsOutput(12);
     #endif
-    #ifndef CONFIG_TARGET_DSAMPLE
-      AI_ConfigBitAsOutput(13);	/* FreeCalypso addition */
+    #if defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCDEV3B)
+      AI_ConfigBitAsOutput(13);
     #endif
     AI_ConfigBitAsOutput(14);
     AI_ConfigBitAsOutput(15);