diff mbox

[3/3] efika: Fix board id detection

Message ID 20110627204119.019436244@rtp-net.org (mailing list archive)
State New, archived
Headers show

Commit Message

Arnaud Patard (Rtp) June 27, 2011, 8:41 p.m. UTC
Current code is assuming that gpio_get_value() is returning 0 or 1 but it
should be checking if the value is 0 or not. Not doing it properly is breaking
the detection of the board (and thus the reboot of efika mx to2) when using
the new mxc gpio driver, which relies on basic mmio gpio.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
diff mbox

Patch

Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c
===================================================================
--- linux-2.6-submit.orig/arch/arm/mach-mx5/board-mx51_efikamx.c	2011-06-20 20:23:07.000000000 +0200
+++ linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikamx.c	2011-06-20 20:37:40.000000000 +0200
@@ -108,9 +108,9 @@  static void __init mx51_efikamx_board_id
 	gpio_request(EFIKAMX_PCBID2, "pcbid2");
 	gpio_direction_input(EFIKAMX_PCBID2);
 
-	id = gpio_get_value(EFIKAMX_PCBID0);
-	id |= gpio_get_value(EFIKAMX_PCBID1) << 1;
-	id |= gpio_get_value(EFIKAMX_PCBID2) << 2;
+	id = gpio_get_value(EFIKAMX_PCBID0) ? 1 : 0;
+	id |= (gpio_get_value(EFIKAMX_PCBID1) ? 1 : 0) << 1;
+	id |= (gpio_get_value(EFIKAMX_PCBID2) ? 1 : 0) << 2;
 
 	switch (id) {
 	case 7:
Index: linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikasb.c
===================================================================
--- linux-2.6-submit.orig/arch/arm/mach-mx5/board-mx51_efikasb.c	2011-06-20 20:37:09.000000000 +0200
+++ linux-2.6-submit/arch/arm/mach-mx5/board-mx51_efikasb.c	2011-06-20 20:38:20.000000000 +0200
@@ -360,8 +360,8 @@  static void __init mx51_efikasb_board_id
 	gpio_request(EFIKASB_PCBID1, "pcb id1");
 	gpio_direction_input(EFIKASB_PCBID1);
 
-	id = gpio_get_value(EFIKASB_PCBID0);
-	id |= gpio_get_value(EFIKASB_PCBID1) << 1;
+	id = gpio_get_value(EFIKASB_PCBID0) ? 1 : 0;
+	id |= (gpio_get_value(EFIKASB_PCBID1) ? 1 : 0) << 1;
 
 	switch (id) {
 	default: