[PATCH 2/3] GTA02: use POWER button to append debug parameters to the kernel command line

Paul Fertser fercerpav at gmail.com
Sat Jan 17 13:24:38 CET 2009


---
 src/cpu/s3c2442/gta02.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/cpu/s3c2442/gta02.c b/src/cpu/s3c2442/gta02.c
index d0dafd0..ac18338 100644
--- a/src/cpu/s3c2442/gta02.c
+++ b/src/cpu/s3c2442/gta02.c
@@ -378,31 +378,35 @@ static void close_gta02(void)
 
 }
 
+/* Here we will care only about AUX button as polling for PWR button
+ * through i2c slows down the boot */
+
 static u8 get_ui_keys_gta02(void)
 {
 	u8 keys;
-	u8 ret;
+	u8 ret = 0;
 	static u8 old_keys = 0; /* previous state for debounce */
-	static u8 old_ret = 0; /* previous debounced output for edge detect */
+	static u8 older_keys = 0; /* previous debounced output for edge detect */
 
-	/* GPF6 is AUX on GTA02, map to UI_ACTION_ADD_DEBUG, down = 1 */
+	/* GPF6 is AUX on GTA02, map to UI_ACTION_SKIPKERNEL, down = 1 */
 	keys = !!(rGPFDAT & (1 << 6));
 
-	if (keys == old_keys)
-		ret = keys;
-	else
-		ret = old_keys;
-
 	/* edge action */
-	if ((ret & 1) && !(old_ret & 1))
+	if ((old_keys & 1) && !(older_keys & 1))
 		ret |= UI_ACTION_SKIPKERNEL;
 
+	older_keys = old_keys;
 	old_keys = keys;
-	old_ret = ret;
 	
 	return ret;
 }
 
+static u8 get_ui_debug_gta02(void)
+{
+	/* PWR button state can be seen in OOCSTAT b0, down = 0, map to UI_ACTION_ADD_DEBUG */
+	return !(i2c_read_sync(&bb_s3c24xx, PCF50633_I2C_ADS, PCF50633_REG_OOCSTAT) & 1);
+}
+
 static void set_ui_indication_gta02(enum ui_indication ui_indication)
 {
 
@@ -456,6 +460,7 @@ const struct board_api board_api_gta02 = {
 	.putc = putc_gta02,
 	.close = close_gta02,
 	.get_ui_keys = get_ui_keys_gta02,
+	.get_ui_debug = get_ui_debug_gta02,
 	.set_ui_indication = set_ui_indication_gta02,
 	.commandline_board = "mtdparts=physmap-flash:-(nor);" \
 				       "neo1973-nand:" \
-- 
1.5.2.2




More information about the openmoko-kernel mailing list