Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbd60a7e authored by Arnaud Patard's avatar Arnaud Patard Committed by Sascha Hauer
Browse files

efika: Fix board id detection



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: default avatarArnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent f7db3d5f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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:
+2 −2
Original line number Diff line number Diff line
@@ -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: