More PMU madness for x5-- a better, more paranoid sequence for enabling GPI0 IMHO
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10913 a1c6a512-1295-4272-9138-f99709370657
diff --git a/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c b/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c
index 79d98ac..f0e11f0 100644
--- a/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c
@@ -166,19 +166,20 @@
i2c_add_node(&pcf50606_i2c);
+ /* make sure GPI0 interrupt is off before unmasking anything */
+ and_l(~0xF, &INTPRI5); /* INT32 - Priority 0 (Off) */
+
/* unmask ONKEY1S - ONKEY held low for 1 second */
pcf50606_write(0x05, ~0x04);
/* clear INT1-3 as these are left set after standby */
pcf50606_read_multiple(0x02, read, 3);
- set_voltages();
-
- /* enable GPI0 interrupts (pcf50606 IRQ) */
+ /* Set to read pcf50606 INT but keep GPI0 off until init completes */
and_l(~0x00000001, &GPIO_ENABLE);
or_l(0x00000001, &GPIO_FUNCTION);
or_l(0x00000100, &GPIO_INT_EN); /* GPI0 H-L */
- and_l(~0xF, &INTPRI5); /* INT32 - Priority 6 */
- or_l(0x6, &INTPRI5);
+
+ set_voltages();
pcf50606_write(0x39, 0x00); /* GPOOD0 = green led OFF */
pcf50606_write(0x3a, 0x00); /* GPOOD1 = red led OFF */
@@ -196,6 +197,9 @@
/* Keep backlight on when changing to firmware */
pcf50606_write(0x38, 0xb0); /* Backlight ON, GPO1INV=1, GPO1ACT=011 */
#endif
+
+ /* allow GPI0 interrupts from PMU now */
+ or_l(0x6, &INTPRI5); /* INT32 - Priority 6 */
}
/* Handles interrupts generated by the pcf50606 */