summaryrefslogtreecommitdiffstats
path: root/meta/packages/uboot/u-boot-mkimage-openmoko-native/unbusy-i2c.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/uboot/u-boot-mkimage-openmoko-native/unbusy-i2c.patch')
-rw-r--r--meta/packages/uboot/u-boot-mkimage-openmoko-native/unbusy-i2c.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/unbusy-i2c.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/unbusy-i2c.patch
new file mode 100644
index 0000000000..680b301620
--- /dev/null
+++ b/meta/packages/uboot/u-boot-mkimage-openmoko-native/unbusy-i2c.patch
@@ -0,0 +1,88 @@
1board/neo1973/gta01/gta01.c: added logic to detect pending PMU interrupts
2board/neo1973/gta01/gta01.c (neo1973_new_second, neo1973_on_key_pressed): only
3 poll PMU if there is a pending interrupt
4board/neo1973/gta01/pcf50606.c (pcf50606_initial_regs): cleared (unmasked)
5 SECONDM in INT1M
6
7- Werner Almesberger <werner@openmoko.org>
8
9Index: u-boot/board/neo1973/gta01/gta01.c
10===================================================================
11--- u-boot.orig/board/neo1973/gta01/gta01.c
12+++ u-boot/board/neo1973/gta01/gta01.c
13@@ -375,19 +375,60 @@
14 #endif
15 }
16
17+static int pwr_int_pending(void)
18+{
19+ S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
20+
21+#if defined(CONFIG_ARCH_GTA01B_v4)
22+ return !(gpio->GPGDAT & (1 << 1)); /* EINT9/GPG1 */
23+#else
24+ return !(gpio->GPGDAT & (1 << 8)); /* EINT16/GPG8 */
25+#endif /* !CONFIG_ARCH_GTA01B_v4 */
26+}
27+
28+static int have_int1(uint8_t mask)
29+{
30+ static uint8_t pending = 0;
31+
32+ if (pwr_int_pending()) {
33+ /*
34+ * We retrieve all interupts, so that we clear any stray ones
35+ * in INT2 and INT3.
36+ */
37+ uint8_t int1,int2,int3;
38+
39+ int1 = pcf50606_reg_read(PCF50606_REG_INT1);
40+ int2 = pcf50606_reg_read(PCF50606_REG_INT2);
41+ int3 = pcf50606_reg_read(PCF50606_REG_INT3);
42+ pending |= int1;
43+ }
44+ if (!(pending & mask))
45+ return 0;
46+ pending &= ~mask;
47+ return 1;
48+}
49+
50 int neo1973_new_second(void)
51 {
52- return pcf50606_reg_read(PCF50606_REG_INT1) & PCF50606_INT1_SECOND;
53+ return have_int1(PCF50606_INT1_SECOND);
54 }
55
56 int neo1973_on_key_pressed(void)
57 {
58- return !(pcf50606_reg_read(PCF50606_REG_OOCS) & PFC50606_OOCS_ONKEY);
59+ static int pressed = -1;
60+
61+ if (pressed == -1 ||
62+ have_int1(PCF50606_INT1_ONKEYF | PCF50606_INT1_ONKEYR)) {
63+ pressed = !(pcf50606_reg_read(PCF50606_REG_OOCS) &
64+ PFC50606_OOCS_ONKEY);
65+}
66+ return pressed;
67 }
68
69 int neo1973_aux_key_pressed(void)
70 {
71 S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
72+
73 if (gpio->GPFDAT & (1 << 6))
74 return 0;
75 return 1;
76Index: u-boot/board/neo1973/gta01/pcf50606.c
77===================================================================
78--- u-boot.orig/board/neo1973/gta01/pcf50606.c
79+++ u-boot/board/neo1973/gta01/pcf50606.c
80@@ -6,7 +6,7 @@
81 const u_int8_t pcf50606_initial_regs[__NUM_PCF50606_REGS] = {
82 [PCF50606_REG_OOCS] = 0x00,
83 /* gap */
84- [PCF50606_REG_INT1M] = PCF50606_INT1_SECOND,
85+ [PCF50606_REG_INT1M] = 0x00,
86 [PCF50606_REG_INT2M] = 0x00,
87 [PCF50606_REG_INT3M] = PCF50606_INT3_TSCPRES,
88 [PCF50606_REG_OOCC1] = PCF50606_OOCC1_RTCWAK |