r4138 - trunk/src/target/u-boot/patches
werner at sita.openmoko.org
werner at sita.openmoko.org
Fri Feb 29 13:27:00 CET 2008
Author: werner
Date: 2008-02-29 13:26:57 +0100 (Fri, 29 Feb 2008)
New Revision: 4138
Modified:
trunk/src/target/u-boot/patches/unbusy-i2c.patch
Log:
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
Modified: trunk/src/target/u-boot/patches/unbusy-i2c.patch
===================================================================
--- trunk/src/target/u-boot/patches/unbusy-i2c.patch 2008-02-29 09:14:50 UTC (rev 4137)
+++ trunk/src/target/u-boot/patches/unbusy-i2c.patch 2008-02-29 12:26:57 UTC (rev 4138)
@@ -10,8 +10,8 @@
===================================================================
--- u-boot.orig/board/neo1973/gta01/gta01.c
+++ u-boot/board/neo1973/gta01/gta01.c
-@@ -375,19 +375,60 @@
- #endif
+@@ -439,19 +439,60 @@ void neo1973_gps(int on)
+ printf("not implemented yet!\n");
}
+static int pwr_int_pending(void)
@@ -86,3 +86,86 @@
[PCF50606_REG_INT2M] = 0x00,
[PCF50606_REG_INT3M] = PCF50606_INT3_TSCPRES,
[PCF50606_REG_OOCC1] = PCF50606_OOCC1_RTCWAK |
+Index: u-boot/board/neo1973/gta02/gta02.c
+===================================================================
+--- u-boot.orig/board/neo1973/gta02/gta02.c
++++ u-boot/board/neo1973/gta02/gta02.c
+@@ -396,15 +396,55 @@ void neo1973_gps(int on)
+ pcf50633_reg_write(PCF50633_REG_LDO5ENA, 0x00);
+ }
+
++static int pwr_int_pending(void)
++{
++ S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
++
++ return !(gpio->GPGDAT & (1 << 1)); /* EINT9/GPG1 */
++}
++
++static int have_int(uint8_t mask1, uint8_t mask2)
++{
++ static uint8_t pending1 = 0, pending2 = 0;
++
++ if (pwr_int_pending()) {
++ /*
++ * We retrieve all interupts, so that we clear any stray ones
++ * in INT2 and INT3.
++ */
++ uint8_t ints[5];
++ int i;
++
++ for (i = 0; i != 5; i++)
++ ints[i] = pcf50633_reg_read(PCF50633_REG_INT1+i);
++ pending1 |= ints[0];
++ pending2 |= ints[1];
++ }
++ if (pending1 & mask1) {
++ pending1 &= ~mask1;
++ return 1;
++ }
++ if (pending2 & mask2) {
++ pending1 &= ~mask2;
++ return 1;
++ }
++ return 0;
++}
++
+ int neo1973_new_second(void)
+ {
+- return pcf50633_reg_read(PCF50633_REG_INT1) & PCF50633_INT1_SECOND;
++ return have_int(PCF50633_INT1_SECOND, 0);
+ }
+
+ int neo1973_on_key_pressed(void)
+ {
+- return !(pcf50633_reg_read(PCF50633_REG_OOCSTAT)
+- & PCF50633_OOCSTAT_ONKEY);
++ static int pressed = -1;
++
++ if (pressed == -1 ||
++ have_int(0, PCF50633_INT2_ONKEYF | PCF50633_INT2_ONKEYR))
++ pressed = !(pcf50633_reg_read(PCF50633_REG_OOCSTAT) &
++ PCF50633_OOCSTAT_ONKEY);
++ return pressed;
+ }
+
+ int neo1973_aux_key_pressed(void)
+Index: u-boot/board/neo1973/gta02/pcf50633.c
+===================================================================
+--- u-boot.orig/board/neo1973/gta02/pcf50633.c
++++ u-boot/board/neo1973/gta02/pcf50633.c
+@@ -5,13 +5,11 @@
+ /* initial register set for PCF50633 in Neo1973 GTA02 devices */
+ const u_int8_t pcf50633_initial_regs[__NUM_PCF50633_REGS] = {
+ /* gap */
+- [PCF50633_REG_INT1M] = PCF50633_INT1_SECOND,
++ [PCF50633_REG_INT1M] = 0x00,
+ [PCF50633_REG_INT2M] = PCF50633_INT2_EXTON3F |
+ PCF50633_INT2_EXTON3R |
+ PCF50633_INT2_EXTON2F |
+- PCF50633_INT2_EXTON2R |
+- PCF50633_INT2_EXTON1R |
+- PCF50633_INT2_EXTON1F,
++ PCF50633_INT2_EXTON2R,
+ [PCF50633_REG_INT3M] = PCF50633_INT3_ADCRDY,
+ [PCF50633_REG_INT4M] = 0x00,
+ [PCF50633_REG_INT5M] = 0x00,
More information about the commitlog
mailing list