From patchwork Mon Jun 27 20:41:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Arnaud Patard (Rtp)" X-Patchwork-Id: 102280 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4D40CB6F5D for ; Tue, 28 Jun 2011 07:14:28 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QbJ8D-0003uT-25; Mon, 27 Jun 2011 21:14:09 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QbJ8C-0002YY-Ox; Mon, 27 Jun 2011 21:14:08 +0000 Received: from lebrac.rtp-net.org ([88.191.135.105]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QbIiG-00066l-QK for linux-arm-kernel@lists.infradead.org; Mon, 27 Jun 2011 20:47:22 +0000 Received: by lebrac.rtp-net.org (Postfix, from userid 1000) id B215D29265; Mon, 27 Jun 2011 22:46:54 +0200 (CEST) Message-Id: <20110627204119.019436244@rtp-net.org> User-Agent: quilt/0.48-1 Date: Mon, 27 Jun 2011 22:41:06 +0200 From: Arnaud Patard (Rtp) To: linux-arm-kernel@lists.infradead.org Subject: [patch 3/3] efika: Fix board id detection Content-Disposition: inline; filename=board_id_gpio_fix.patch X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110627_164721_064061_148248B0 X-CRM114-Status: UNSURE ( 8.91 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: s.hauer@pengutronix.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org 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 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: