From patchwork Thu Apr 8 13:43:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rabin Vincent X-Patchwork-Id: 71743 X-Patchwork-Delegate: albert.aribaud@free.fr Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id A38331051E73 for ; Thu, 8 Apr 2010 15:48:12 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id B8830C913116 for ; Thu, 8 Apr 2010 15:48:11 +0200 (CEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.9) for (single-drop); Thu, 08 Apr 2010 15:48:11 +0200 (CEST) Received: from murder (svr19.m-online.net [192.168.3.147]) by backend2 (Cyrus v2.2.12) with LMTPA; Thu, 08 Apr 2010 15:44:58 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend3.pop.m-online.net (Cyrus v2.2.13) with LMTPA; Thu, 08 Apr 2010 15:44:57 +0200 Received: from scanner-3.m-online.net (scanner-3.m-online.net [192.168.1.20]) by mail.m-online.net (Postfix) with ESMTP id A1CAA200122; Thu, 8 Apr 2010 15:44:57 +0200 (CEST) Received: from mxin-2.m-online.net ([192.168.1.21]) by scanner-3.m-online.net (scanner-3.m-online.net [192.168.1.20]) (amavisd-new, port 10026) with ESMTP id 13503-02-12; Thu, 8 Apr 2010 15:44:52 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-2.m-online.net (Postfix) with ESMTP id 7CBC246C0A0; Thu, 8 Apr 2010 15:44:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8872828188; Thu, 8 Apr 2010 15:44:22 +0200 (CEST) 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 nRwPLHnqO-Bh; Thu, 8 Apr 2010 15:44:22 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D3B0E2818A; Thu, 8 Apr 2010 15:44:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 40DB828180 for ; Thu, 8 Apr 2010 15:44:00 +0200 (CEST) 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 D-DZQj-ch9e4 for ; Thu, 8 Apr 2010 15:43:58 +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 eu1sys200aog109.obsmtp.com (eu1sys200aog109.obsmtp.com [207.126.144.127]) by theia.denx.de (Postfix) with ESMTPS id 0B1A32812E for ; Thu, 8 Apr 2010 15:43:54 +0200 (CEST) Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob109.postini.com ([207.126.147.11]) with SMTP ID DSNKS73dmcCo8spa8vld6RXmcj+2YVoKZ8Xi@postini.com; Thu, 08 Apr 2010 13:43:57 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 68740119; Thu, 8 Apr 2010 13:43:53 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2EC6A15D1; Thu, 8 Apr 2010 13:43:53 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 7F333A8095; Thu, 8 Apr 2010 15:43:46 +0200 (CEST) Received: from localhost (10.201.54.39) by exdcvycastm022.EQ1STM.local (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.1.393.1; Thu, 8 Apr 2010 15:43:52 +0200 From: Rabin Vincent To: Date: Thu, 8 Apr 2010 19:13:14 +0530 Message-ID: <1270734200-17762-8-git-send-email-rabin.vincent@stericsson.com> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1270734200-17762-7-git-send-email-rabin.vincent@stericsson.com> References: <1270734200-17762-1-git-send-email-rabin.vincent@stericsson.com> <1270734200-17762-2-git-send-email-rabin.vincent@stericsson.com> <1270734200-17762-3-git-send-email-rabin.vincent@stericsson.com> <1270734200-17762-4-git-send-email-rabin.vincent@stericsson.com> <1270734200-17762-5-git-send-email-rabin.vincent@stericsson.com> <1270734200-17762-6-git-send-email-rabin.vincent@stericsson.com> <1270734200-17762-7-git-send-email-rabin.vincent@stericsson.com> MIME-Version: 1.0 Cc: STEricsson_nomadik_linux@list.st.com, Michael Brandt , Alessandro Rubini Subject: [U-Boot] [PATCHv2 07/13] nomadik-gpio: get base address from platform code X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 X-Virus-Scanned: by amavisd-new at m-online.net Change the Nomadik GPIO driver to get the base addresses from platform specific code, since it will be used on multiple platforms with different base addresses. Acked-by: Alessandro Rubini Acked-by: Michael Brandt Signed-off-by: Rabin Vincent --- board/st/nhk8815/nhk8815.c | 9 +++++++++ drivers/gpio/nomadik_gpio.c | 11 ++--------- include/configs/nhk8815.h | 1 + include/nomadik.h | 2 ++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/board/st/nhk8815/nhk8815.c b/board/st/nhk8815/nhk8815.c index fc5d3b8..08fb332 100644 --- a/board/st/nhk8815/nhk8815.c +++ b/board/st/nhk8815/nhk8815.c @@ -32,6 +32,15 @@ DECLARE_GLOBAL_DATA_PTR; +#ifdef CONFIG_NOMADIK_GPIO +unsigned long nmk_gpio_base[CONFIG_NOMADIK_GPIO_NUM_BANKS] = { + NOMADIK_GPIO0_BASE, + NOMADIK_GPIO1_BASE, + NOMADIK_GPIO2_BASE, + NOMADIK_GPIO3_BASE +}; +#endif + #ifdef CONFIG_SHOW_BOOT_PROGRESS void show_boot_progress(int progress) { diff --git a/drivers/gpio/nomadik_gpio.c b/drivers/gpio/nomadik_gpio.c index d084235..721c167 100644 --- a/drivers/gpio/nomadik_gpio.c +++ b/drivers/gpio/nomadik_gpio.c @@ -24,13 +24,6 @@ #include #include -static unsigned long gpio_base[4] = { - NOMADIK_GPIO0_BASE, - NOMADIK_GPIO1_BASE, - NOMADIK_GPIO2_BASE, - NOMADIK_GPIO3_BASE -}; - enum gpio_registers { GPIO_DAT = 0x00, /* data register */ GPIO_DATS = 0x04, /* data set */ @@ -45,12 +38,12 @@ enum gpio_registers { static inline unsigned long gpio_to_base(int gpio) { - if ((gpio / 32) >= ARRAY_SIZE(gpio_base)) { + if ((gpio / 32) >= ARRAY_SIZE(nmk_gpio_base)) { printf("nomadik-gpio: invalid gpio %d\n", gpio); return 0; } - return gpio_base[gpio / 32]; + return nmk_gpio_base[gpio / 32]; } static inline u32 gpio_to_bit(int gpio) diff --git a/include/configs/nhk8815.h b/include/configs/nhk8815.h index f882715..c7700b3 100644 --- a/include/configs/nhk8815.h +++ b/include/configs/nhk8815.h @@ -101,6 +101,7 @@ /* GPIO */ #define CONFIG_NOMADIK_GPIO +#define CONFIG_NOMADIK_GPIO_NUM_BANKS 4 /* serial port (PL011) configuration */ #define CONFIG_PL011_SERIAL diff --git a/include/nomadik.h b/include/nomadik.h index 1d3c9ce..72f7e88 100644 --- a/include/nomadik.h +++ b/include/nomadik.h @@ -34,6 +34,8 @@ enum nmk_af { /* alternate function settings */ GPIO_ALT_C }; +extern unsigned long nmk_gpio_base[CONFIG_NOMADIK_GPIO_NUM_BANKS]; + extern void nmk_gpio_af(int gpio, int alternate_function); extern void nmk_gpio_dir(int gpio, int dir); extern void nmk_gpio_set(int gpio, int val);