From patchwork Fri Jun 21 07:54:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 253157 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 03A522C02E8 for ; Fri, 21 Jun 2013 17:55:32 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 149A74A208; Fri, 21 Jun 2013 09:55:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L444M91gyknj; Fri, 21 Jun 2013 09:55:29 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A4B024A1F3; Fri, 21 Jun 2013 09:55:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A68504A1F3 for ; Fri, 21 Jun 2013 09:55:20 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LTJ0WpQ8lmtP for ; Fri, 21 Jun 2013 09:55:14 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by theia.denx.de (Postfix) with ESMTPS id 920C64A1F2 for ; Fri, 21 Jun 2013 09:55:07 +0200 (CEST) Received: by mail-pa0-f48.google.com with SMTP id kp12so7403552pab.21 for ; Fri, 21 Jun 2013 00:55:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:subject:from:to:cc:date:content-type:x-mailer :mime-version:content-transfer-encoding:x-gm-message-state; bh=INUKGmWm8I100fFbL8oVcy3vfHOg9ZjnPAAnF5UxdLc=; b=KF4/0GLNSv4BWAgZS/9FoIJDRppkhHF0bplP8yl/nMQiKgPqBkASF+WcesmgL8JVrd 2sUn2+0JelRlFNYtL1L7kyBpXTJXlGK7QwEX1NyC5IyIasuLRJw8AUsznW0VWeBNIPcp RI+tffc+aMqdZY/d5zIRhkWMqecidRWDRA0Brj5wiLM3AP/nNVSXrztaUJUGh3DmpXGP LouSHZH9y8C6h+0xKC/Ls00zCWaDjWjOHGZLtfOkRAZu2CGTTLEfymmwEnaVXztTKFBG 8v7im9Pi4Rf+Gi89dI99fhcrT3aV3MusGtndWrcQCI0ynzcfZIG5OQXC2dQ4Yp5ocN4z xH7A== X-Received: by 10.68.224.161 with SMTP id rd1mr11143564pbc.121.1371801306134; Fri, 21 Jun 2013 00:55:06 -0700 (PDT) Received: from [192.168.0.100] (114-39-103-89.dynamic.hinet.net. [114.39.103.89]) by mx.google.com with ESMTPSA id pq5sm3864656pbc.7.2013.06.21.00.55.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Jun 2013 00:55:05 -0700 (PDT) Message-ID: <1371801294.12179.1.camel@phoenix> From: Axel Lin To: Steve Sakoman , Stefan Roese , Lubomir Popov Date: Fri, 21 Jun 2013 15:54:54 +0800 X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 X-Gm-Message-State: ALoCoQkxiU+6TOOl9bti2J9bWro+N7DdMt356xvJB9tpqiBQOsgRVHyPb2O+w4+r7aLrRacvPMSX Cc: Marek Vasut , Igor@theia.denx.de, Albert@theia.denx.de, u-boot@lists.denx.de, Tom Rini Subject: [U-Boot] [PATCH v3 1/2] gpio: omap_gpio: Fix valid gpio range for AM33XX X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de AM33XX has 4 gpio banks, thus the valid gpio range should be 0 ... 127. Signed-off-by: Axel Lin Acked-by: Stefan Roese --- v2: define OMAP_MAX_GPIO and use it. v3: no change, just for adding patch 2/2. drivers/gpio/omap_gpio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c index a30d7f0..6fa57c9 100644 --- a/drivers/gpio/omap_gpio.c +++ b/drivers/gpio/omap_gpio.c @@ -40,6 +40,12 @@ #include #include +#if defined(CONFIG_AM33XX) +#define OMAP_MAX_GPIO 128 +#else +#define OMAP_MAX_GPIO 192 +#endif + #define OMAP_GPIO_DIR_OUT 0 #define OMAP_GPIO_DIR_IN 1 @@ -55,7 +61,7 @@ static inline int get_gpio_index(int gpio) int gpio_is_valid(int gpio) { - return (gpio >= 0) && (gpio < 192); + return (gpio >= 0) && (gpio < OMAP_MAX_GPIO); } static int check_gpio(int gpio)