r1791 - trunk/src/target/u-boot/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Wed Apr 18 07:43:19 CEST 2007


Author: werner
Date: 2007-04-18 07:43:06 +0200 (Wed, 18 Apr 2007)
New Revision: 1791

Added:
   trunk/src/target/u-boot/patches/unbusy-i2c.patch
Log:
board/neo1973/neo1973.c: added logic to detect pending PMU interrupts
board/neo1973/neo1973.c (neo1973_new_second, neo1973_on_key_pressed): only poll
  PMU if there is a pending interrupt
board/neo1973/pcf50606.c (pcf50606_initial_regs): cleared (unmasked) SECONDM in
  INT1M



Added: trunk/src/target/u-boot/patches/unbusy-i2c.patch
===================================================================
--- trunk/src/target/u-boot/patches/unbusy-i2c.patch	2007-04-18 03:37:33 UTC (rev 1790)
+++ trunk/src/target/u-boot/patches/unbusy-i2c.patch	2007-04-18 05:43:06 UTC (rev 1791)
@@ -0,0 +1,92 @@
+board/neo1973/neo1973.c: added logic to detect pending PMU interrupts
+board/neo1973/neo1973.c (neo1973_new_second, neo1973_on_key_pressed): only poll
+  PMU if there is a pending interrupt
+board/neo1973/pcf50606.c (pcf50606_initial_regs): cleared (unmasked) SECONDM in
+  INT1M
+
+- Werner Almesberger <werner at openmoko.org>
+
+Index: u-boot/board/neo1973/neo1973.c
+===================================================================
+--- u-boot.orig/board/neo1973/neo1973.c
++++ u-boot/board/neo1973/neo1973.c
+@@ -374,19 +374,64 @@ void neo1973_vibrator(int on)
+ #endif
+ }
+ 
++static int pwr_int_pending(void)
++{
++	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
++
++#if defined(CONFIG_ARCH_GTA01B_v4)
++	/*
++	 * @@@FIXME: Untested and probably doesn't work. We have to check for
++	 * the presence of EINT9 instead.
++	 */
++	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/pcf50606.c
+===================================================================
+--- u-boot.orig/board/neo1973/pcf50606.c
++++ u-boot/board/neo1973/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 |





More information about the commitlog mailing list