Changeset 4138


Ignore:
Timestamp:
02/29/08 13:26:57 (5 years ago)
Author:
werner
Message:

Extended unbusying also to the GTA02.

unbusy-i2c.patch:

  • board/neo1973/gta02/gta02.c (neo1973_new_second, neo1973_on_key_pressed): do not poll incessantly but only when the PMU has posted an interrupt
  • board/neo1973/gta02/gta02.c (have_int, pwr_int_pending): detect when one of the interrupts we're looking for has occurred
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/u-boot/patches/unbusy-i2c.patch

    r2053 r4138  
    1111--- u-boot.orig/board/neo1973/gta01/gta01.c 
    1212+++ u-boot/board/neo1973/gta01/gta01.c 
    13 @@ -375,19 +375,60 @@ 
    14  #endif 
     13@@ -439,19 +439,60 @@ void neo1973_gps(int on) 
     14        printf("not implemented yet!\n"); 
    1515 } 
    1616  
     
    8787        [PCF50606_REG_INT3M]    = PCF50606_INT3_TSCPRES, 
    8888        [PCF50606_REG_OOCC1]    = PCF50606_OOCC1_RTCWAK | 
     89Index: u-boot/board/neo1973/gta02/gta02.c 
     90=================================================================== 
     91--- u-boot.orig/board/neo1973/gta02/gta02.c 
     92+++ u-boot/board/neo1973/gta02/gta02.c 
     93@@ -396,15 +396,55 @@ void neo1973_gps(int on) 
     94                pcf50633_reg_write(PCF50633_REG_LDO5ENA, 0x00); 
     95 } 
     96  
     97+static int pwr_int_pending(void) 
     98+{ 
     99+       S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO(); 
     100+ 
     101+       return !(gpio->GPGDAT & (1 << 1));      /* EINT9/GPG1 */ 
     102+} 
     103+ 
     104+static int have_int(uint8_t mask1, uint8_t mask2) 
     105+{ 
     106+       static uint8_t pending1 = 0, pending2 = 0; 
     107+ 
     108+       if (pwr_int_pending()) { 
     109+               /* 
     110+                * We retrieve all interupts, so that we clear any stray ones 
     111+                * in INT2 and INT3. 
     112+                */ 
     113+               uint8_t ints[5]; 
     114+               int i; 
     115+ 
     116+               for (i = 0; i != 5; i++) 
     117+                       ints[i] = pcf50633_reg_read(PCF50633_REG_INT1+i); 
     118+               pending1 |= ints[0]; 
     119+               pending2 |= ints[1]; 
     120+       } 
     121+       if (pending1 & mask1) { 
     122+               pending1 &= ~mask1; 
     123+               return 1; 
     124+       } 
     125+       if (pending2 & mask2) { 
     126+               pending1 &= ~mask2; 
     127+               return 1; 
     128+       } 
     129+       return 0; 
     130+} 
     131+ 
     132 int neo1973_new_second(void) 
     133 { 
     134-       return pcf50633_reg_read(PCF50633_REG_INT1) & PCF50633_INT1_SECOND; 
     135+       return have_int(PCF50633_INT1_SECOND, 0); 
     136 } 
     137  
     138 int neo1973_on_key_pressed(void) 
     139 { 
     140-       return !(pcf50633_reg_read(PCF50633_REG_OOCSTAT) 
     141-                                               & PCF50633_OOCSTAT_ONKEY); 
     142+       static int pressed = -1; 
     143+ 
     144+       if (pressed == -1 || 
     145+           have_int(0, PCF50633_INT2_ONKEYF | PCF50633_INT2_ONKEYR)) 
     146+               pressed = !(pcf50633_reg_read(PCF50633_REG_OOCSTAT) & 
     147+                   PCF50633_OOCSTAT_ONKEY); 
     148+       return pressed; 
     149 } 
     150  
     151 int neo1973_aux_key_pressed(void) 
     152Index: u-boot/board/neo1973/gta02/pcf50633.c 
     153=================================================================== 
     154--- u-boot.orig/board/neo1973/gta02/pcf50633.c 
     155+++ u-boot/board/neo1973/gta02/pcf50633.c 
     156@@ -5,13 +5,11 @@ 
     157 /* initial register set for PCF50633 in Neo1973 GTA02 devices */ 
     158 const u_int8_t pcf50633_initial_regs[__NUM_PCF50633_REGS] = { 
     159        /* gap */ 
     160-       [PCF50633_REG_INT1M]    = PCF50633_INT1_SECOND, 
     161+       [PCF50633_REG_INT1M]    = 0x00, 
     162        [PCF50633_REG_INT2M]    = PCF50633_INT2_EXTON3F | 
     163                                  PCF50633_INT2_EXTON3R | 
     164                                  PCF50633_INT2_EXTON2F | 
     165-                                 PCF50633_INT2_EXTON2R | 
     166-                                 PCF50633_INT2_EXTON1R | 
     167-                                 PCF50633_INT2_EXTON1F, 
     168+                                 PCF50633_INT2_EXTON2R, 
     169        [PCF50633_REG_INT3M]    = PCF50633_INT3_ADCRDY, 
     170        [PCF50633_REG_INT4M]    = 0x00, 
     171        [PCF50633_REG_INT5M]    = 0x00, 
Note: See TracChangeset for help on using the changeset viewer.