From patchwork Wed Apr 3 11:54:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 15852 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5F64423E2E for ; Wed, 3 Apr 2013 11:50:10 +0000 (UTC) Received: from mail-gg0-f197.google.com (mail-gg0-f197.google.com [209.85.161.197]) by fiordland.canonical.com (Postfix) with ESMTP id AC464A1865F for ; Wed, 3 Apr 2013 11:50:09 +0000 (UTC) Received: by mail-gg0-f197.google.com with SMTP id k5sf1901001ggn.0 for ; Wed, 03 Apr 2013 04:50:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-auditid:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-brightmail-tracker:x-brightmail-tracker :dlp-filter:x-mtr:x-cfilter-loop:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe; bh=rwj4ciqwWXLAL88/B07lhl4Xo59NVO099vHg48KQwqc=; b=Lz/AlA9tITCsAwWmkm3Q4M3iyXr+CPteGtDZeK7H8X2XQyAdYdaRgYPuvKH4U7tmoB 0dkvVItKjFRFQ8Ux12RMvw9sC9IyTTL5sw46HiNcltYOT35o0NjUME98GlrtXd3MRkVx uVPJQl9GwKGSWtZzlo8JFr9MvZ9Bxm1Gp6XQy+qKTAtc6aWKcPEUEjsTUKzC2qE3bmnL idqqu1JJhmIsI8GwVL0EY+U2H8f6rOi1Fn1K8VJGA0IVWdfCUzp5pedWPSFBQtjahbKy pYYAs7OvRpwGfYazO44VnzQ1JHJhrmtbwKIaQ2CC3HbIhAPjWIO+JqGr11lCPTt01Ob6 kcXQ== X-Received: by 10.224.110.68 with SMTP id m4mr972460qap.2.1364989808828; Wed, 03 Apr 2013 04:50:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.58.179 with SMTP id s19ls878127qeq.53.gmail; Wed, 03 Apr 2013 04:50:08 -0700 (PDT) X-Received: by 10.52.109.5 with SMTP id ho5mr756034vdb.75.1364989808591; Wed, 03 Apr 2013 04:50:08 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id wz3si4579894vdc.143.2013.04.03.04.50.08 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 04:50:08 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id db10so1581501veb.37 for ; Wed, 03 Apr 2013 04:50:08 -0700 (PDT) X-Received: by 10.58.29.101 with SMTP id j5mr914536veh.26.1364989808414; Wed, 03 Apr 2013 04:50:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.4.204 with SMTP id cg12csp166681ved; Wed, 3 Apr 2013 04:50:07 -0700 (PDT) X-Received: by 10.68.234.42 with SMTP id ub10mr2116997pbc.1.1364989807509; Wed, 03 Apr 2013 04:50:07 -0700 (PDT) Received: from mailout3.samsung.com (mailout3.samsung.com. [203.254.224.33]) by mx.google.com with ESMTP id kb5si5986058pbc.47.2013.04.03.04.50.07; Wed, 03 Apr 2013 04:50:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.33 as permitted sender) client-ip=203.254.224.33; Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MKO00J5DGV95KB0@mailout3.samsung.com>; Wed, 03 Apr 2013 20:50:06 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 3F.C6.05174.E671C515; Wed, 03 Apr 2013 20:50:06 +0900 (KST) X-AuditID: cbfee68f-b7f4a6d000001436-fc-515c176ecbdc Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 4A.09.17838.D671C515; Wed, 03 Apr 2013 20:50:06 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MKO009TKGQZAL50@mmp1.samsung.com>; Wed, 03 Apr 2013 20:50:05 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org Subject: [PATCH 3/3 V5] EXYNOS5: GPIO: Enable GPIO Command for EXYNOS5 Date: Wed, 03 Apr 2013 17:24:24 +0530 Message-id: <1364990064-30688-4-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1364990064-30688-1-git-send-email-rajeshwari.s@samsung.com> References: <1364990064-30688-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGLMWRmVeSWpSXmKPExsWyRsSkTjdPPCbQYOY0AYuH62+yWHQcaWG0 mHL4C4vFty3bGC3e7u1kd2D1mN1wkcXjzrU9bB5n7+xg9OjbsooxgCWKyyYlNSezLLVI3y6B K+PAqynMBfukKh68ecPcwDhJtIuRk0NCwETi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vNzNzGCo+SZ1A7GlQ0WhxgF OBiVeHhPfIkKFGJNLCuuzD3EKMHBrCTCy3k8OlCINyWxsiq1KD++qDQntfgQYzLQTROZpUST 84ERnFcSb2hsYm5qbGppYmFiZkmasJI474FW60AhgfTEktTs1NSC1CKYLUwcnFINjC33A85n Psgp3PEx98Krpl380r1rLp71Flq8sc4sxOJf3aHZ+wLvdZTzdEQbBf6zCJhx1cynM/fY/uaE iMADod3ihxLyyvcxm222fnR0hfjDwLart1+8shNaf0BgedWvmLxiDsXvk6VFJubea/tTEe7C vNCs6e7VZUYRatn73e45/d4pkhT1WImlOCPRUIu5qDgRAJMY4nHWAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQknY6Ov6bkZ/o7Zu+HnDJdDi77ZeQj8XHhdf0+4j+tcB84Id4XrjZSroEIqBniN35W1yIoT X-Original-Sender: rajeshwari.s@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch enables GPIO Command for EXYNOS5. Function has been added to asm/gpio.h to decode the input gpio name to gpio number. example: gpio set gpa00 Signed-off-by: Rajeshwari Shinde Acked-by: Simon Glass --- Changes in V2: - New patch Changes in V3: - Created a table to know the base address of input bank. Changes in V4: - Moved the function name_to_gpio to s5p gpio driver and renamed to s5p_name_to_gpio. Changes in V5: - Rebased on latest u-boot-samsung tree arch/arm/include/asm/arch-exynos/gpio.h | 8 +++++ drivers/gpio/s5p_gpio.c | 49 +++++++++++++++++++++++++++++++ include/configs/exynos5250-dt.h | 1 + 3 files changed, 58 insertions(+), 0 deletions(-) diff --git a/arch/arm/include/asm/arch-exynos/gpio.h b/arch/arm/include/asm/arch-exynos/gpio.h index d8000af..9b31dc2 100644 --- a/arch/arm/include/asm/arch-exynos/gpio.h +++ b/arch/arm/include/asm/arch-exynos/gpio.h @@ -660,6 +660,14 @@ static inline unsigned int get_bank_num(void) return 0; } +struct gpio_name_num_table { + char bank; + unsigned int base; +}; + +int s5p_name_to_gpio(const char *name); +#define name_to_gpio(n) s5p_name_to_gpio(n) + void gpio_cfg_pin(int gpio, int cfg); void gpio_set_pull(int gpio, int mode); void gpio_set_drv(int gpio, int mode); diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c index d6650c3..824977b 100644 --- a/drivers/gpio/s5p_gpio.c +++ b/drivers/gpio/s5p_gpio.c @@ -36,6 +36,21 @@ #define RATE_MASK(x) (0x1 << (x + 16)) #define RATE_SET(x) (0x1 << (x + 16)) +struct gpio_name_num_table exynos5_gpio_table[] = { + { 'a', EXYNOS5_GPIO_A00 }, + { 'b', EXYNOS5_GPIO_B00 }, + { 'c', EXYNOS5_GPIO_C00 }, + { 'd', EXYNOS5_GPIO_D00 }, + { 'y', EXYNOS5_GPIO_Y00 }, + { 'x', EXYNOS5_GPIO_X00 }, + { 'e', EXYNOS5_GPIO_E00 }, + { 'f', EXYNOS5_GPIO_F00 }, + { 'g', EXYNOS5_GPIO_G00 }, + { 'h', EXYNOS5_GPIO_H00 }, + { 'v', EXYNOS5_GPIO_V00 }, + { 'z', EXYNOS5_GPIO_Z0 }, +}; + void s5p_gpio_cfg_pin(struct s5p_gpio_bank *bank, int gpio, int cfg) { unsigned int value; @@ -238,3 +253,37 @@ void gpio_cfg_pin(int gpio, int cfg) s5p_gpio_cfg_pin(s5p_gpio_get_bank(gpio), s5p_gpio_get_pin(gpio), cfg); } + +int s5p_name_to_gpio(const char *name) +{ + unsigned int num, i; + + name++; + + if (*name == 'p') + ++name; + + for (i = 0; i < ARRAY_SIZE(exynos5_gpio_table); i++) { + if (*name == exynos5_gpio_table[i].bank) { + if (*name == 'c') { + name++; + num = simple_strtoul(name, NULL, 10); + if (num >= 40) { + num = EXYNOS5_GPIO_C40 + (num - 40); + } else { + num = simple_strtoul(name, NULL, 8); + num = exynos5_gpio_table[i].base + num; + } + } else { + name++; + num = simple_strtoul(name, NULL, 8); + num = exynos5_gpio_table[i].base + num; + } + break; + } + } + + if (i == ARRAY_SIZE(exynos5_gpio_table)) + return -1; + return num; +} diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h index cbd1c4e..46a4e75 100644 --- a/include/configs/exynos5250-dt.h +++ b/include/configs/exynos5250-dt.h @@ -122,6 +122,7 @@ #define CONFIG_CMD_FAT #define CONFIG_CMD_NET #define CONFIG_CMD_HASH +#define CONFIG_CMD_GPIO #define CONFIG_BOOTDELAY 3 #define CONFIG_ZERO_BOOTDELAY_CHECK