diff options
Diffstat (limited to 'packages/u-boot/u-boot-mkimage-openmoko-native/unbusy-i2c.patch')
-rw-r--r-- | packages/u-boot/u-boot-mkimage-openmoko-native/unbusy-i2c.patch | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/packages/u-boot/u-boot-mkimage-openmoko-native/unbusy-i2c.patch b/packages/u-boot/u-boot-mkimage-openmoko-native/unbusy-i2c.patch new file mode 100644 index 0000000000..680b301620 --- /dev/null +++ b/packages/u-boot/u-boot-mkimage-openmoko-native/unbusy-i2c.patch @@ -0,0 +1,88 @@ +board/neo1973/gta01/gta01.c: added logic to detect pending PMU interrupts +board/neo1973/gta01/gta01.c (neo1973_new_second, neo1973_on_key_pressed): only + poll PMU if there is a pending interrupt +board/neo1973/gta01/pcf50606.c (pcf50606_initial_regs): cleared (unmasked) + SECONDM in INT1M + +- Werner Almesberger <werner@openmoko.org> + +Index: u-boot/board/neo1973/gta01/gta01.c +=================================================================== +--- u-boot.orig/board/neo1973/gta01/gta01.c ++++ u-boot/board/neo1973/gta01/gta01.c +@@ -375,19 +375,60 @@ + #endif + } + ++static int pwr_int_pending(void) ++{ ++ S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO(); ++ ++#if defined(CONFIG_ARCH_GTA01B_v4) ++ return !(gpio->GPGDAT & (1 << 1)); /* EINT9/GPG1 */ ++#else ++ return !(gpio->GPGDAT & (1 << 8)); /* EINT16/GPG8 */ ++#endif /* !CONFIG_ARCH_GTA01B_v4 */ ++} ++ ++static int have_int1(uint8_t mask) ++{ ++ static uint8_t pending = 0; ++ ++ if (pwr_int_pending()) { ++ /* ++ * We retrieve all interupts, so that we clear any stray ones ++ * in INT2 and INT3. ++ */ ++ uint8_t int1,int2,int3; ++ ++ int1 = pcf50606_reg_read(PCF50606_REG_INT1); ++ int2 = pcf50606_reg_read(PCF50606_REG_INT2); ++ int3 = pcf50606_reg_read(PCF50606_REG_INT3); ++ pending |= int1; ++ } ++ if (!(pending & mask)) ++ return 0; ++ pending &= ~mask; ++ return 1; ++} ++ + int neo1973_new_second(void) + { +- return pcf50606_reg_read(PCF50606_REG_INT1) & PCF50606_INT1_SECOND; ++ return have_int1(PCF50606_INT1_SECOND); + } + + int neo1973_on_key_pressed(void) + { +- return !(pcf50606_reg_read(PCF50606_REG_OOCS) & PFC50606_OOCS_ONKEY); ++ static int pressed = -1; ++ ++ if (pressed == -1 || ++ have_int1(PCF50606_INT1_ONKEYF | PCF50606_INT1_ONKEYR)) { ++ pressed = !(pcf50606_reg_read(PCF50606_REG_OOCS) & ++ PFC50606_OOCS_ONKEY); ++} ++ return pressed; + } + + int neo1973_aux_key_pressed(void) + { + S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO(); ++ + if (gpio->GPFDAT & (1 << 6)) + return 0; + return 1; +Index: u-boot/board/neo1973/gta01/pcf50606.c +=================================================================== +--- u-boot.orig/board/neo1973/gta01/pcf50606.c ++++ u-boot/board/neo1973/gta01/pcf50606.c +@@ -6,7 +6,7 @@ + const u_int8_t pcf50606_initial_regs[__NUM_PCF50606_REGS] = { + [PCF50606_REG_OOCS] = 0x00, + /* gap */ +- [PCF50606_REG_INT1M] = PCF50606_INT1_SECOND, ++ [PCF50606_REG_INT1M] = 0x00, + [PCF50606_REG_INT2M] = 0x00, + [PCF50606_REG_INT3M] = PCF50606_INT3_TSCPRES, + [PCF50606_REG_OOCC1] = PCF50606_OOCC1_RTCWAK | |