Skip to content

Commit

Permalink
efika: Fix board id detection
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
  • Loading branch information
Arnaud Patard (Rtp) authored and Sascha Hauer committed Jul 26, 2011
1 parent f7db3d5 commit fbd60a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions arch/arm/mach-mx5/board-mx51_efikamx.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ static void __init mx51_efikamx_board_id(void)
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:
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-mx5/board-mx51_efikasb.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ static void __init mx51_efikasb_board_id(void)
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:
Expand Down

0 comments on commit fbd60a7

Please sign in to comment.