From patchwork Sun Mar 11 12:46:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 7206 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 5DEC323E0E for ; Sun, 11 Mar 2012 12:41:58 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 23518A182D9 for ; Sun, 11 Mar 2012 12:41:58 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so6818970iag.11 for ; Sun, 11 Mar 2012 05:41:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-brightmail-tracker:x-gm-message-state; bh=LCBhxmts+1w68L01O4tJmbJ0Fp44im+cgfWPhYaRKGc=; b=RsbycNNhkVvIa/hxldSsSc81pwsNks14WQITdUkY4s8jO7H780wRJhF/RDyuZWarHa frv53DUoZatYmYtctfN6OITEq1p3qlaH/F6PEvp6eQQBbWjcOezic/FnhsrtsFEmSRgf Ez0VOsYMTgpoO6ybNDnj3pyT4wyfADfvCstierTeiQLu5fVVaCFg7dorJzYXalmV1IJD McRoK2haGvvdHKZVFbCuYytUplFpT3TPeqCqqI45uPUuwHVwMS8PurjqeJr2Nx+RMmhd 43FPEnLzXoGI06CI+fAG4vaEIOfn42dsVWfKeKWGK9QDl/3uC52r+Ie3j6GHAYxwTvio C0iw== Received: by 10.50.184.228 with SMTP id ex4mr12962182igc.50.1331469717905; Sun, 11 Mar 2012 05:41:57 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.53.18 with SMTP id k18csp22220ibg; Sun, 11 Mar 2012 05:41:57 -0700 (PDT) Received: by 10.68.220.7 with SMTP id ps7mr14031199pbc.160.1331469717221; Sun, 11 Mar 2012 05:41:57 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id g9si13271424pbd.341.2012.03.11.05.41.56; Sun, 11 Mar 2012 05:41:57 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.34 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.34; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.34 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm2.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0M0Q00JJH0LQK690@mailout4.samsung.com>; Sun, 11 Mar 2012 21:41:55 +0900 (KST) X-AuditID: cbfee61b-b7c62ae000000989-79-4f5c9d930341 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id 4A.FC.02441.39D9C5F4; Sun, 11 Mar 2012 21:41:55 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTPA id <0M0Q0009D0LLZ300@mmp2.samsung.com>; Sun, 11 Mar 2012 21:41:55 +0900 (KST) From: Thomas Abraham To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linus.walleij@linaro.org, kgene.kim@samsung.com, patches@linaro.org Subject: [PATCH 3/5] ARM: Exynos4: Add pinctrl devices and pin maps Date: Sun, 11 Mar 2012 18:16:03 +0530 Message-id: <1331469965-28846-4-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1331469965-28846-1-git-send-email-thomas.abraham@linaro.org> References: <1331469965-28846-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: AAAAAA== X-Gm-Message-State: ALoCoQnDB4+bSTYa6e62+U+jK7b+l3MrB0ZnDWYStNHU9T5Bqx4LbhLUL+bGqUXiDqYyYCoSjRjF Add the three pinctrl platform devices and the pin maps for Exynos4. Signed-off-by: Thomas Abraham --- arch/arm/mach-exynos/Kconfig | 1 + arch/arm/mach-exynos/Makefile | 1 + arch/arm/mach-exynos/common.h | 6 ++ arch/arm/mach-exynos/dev-pinctrl.c | 115 +++++++++++++++++++++++++++++ arch/arm/plat-samsung/include/plat/devs.h | 3 + 5 files changed, 126 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-exynos/dev-pinctrl.c diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index c49d450..3e6a1cd 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig @@ -18,6 +18,7 @@ choice config ARCH_EXYNOS4 bool "SAMSUNG EXYNOS4" select HAVE_SMP + select PINCTRL select MIGHT_HAVE_CACHE_L2X0 help Samsung EXYNOS4 SoCs based systems diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile index 6fd8dd9..dbac5f9 100644 --- a/arch/arm/mach-exynos/Makefile +++ b/arch/arm/mach-exynos/Makefile @@ -56,6 +56,7 @@ obj-$(CONFIG_EXYNOS4_DEV_SYSMMU) += dev-sysmmu.o obj-$(CONFIG_EXYNOS4_DEV_DWMCI) += dev-dwmci.o obj-$(CONFIG_EXYNOS4_DEV_DMA) += dma.o obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI) += dev-ohci.o +obj-$(CONFIG_PINCTRL_SAMSUNG) += dev-pinctrl.o obj-$(CONFIG_ARCH_EXYNOS) += setup-i2c0.o obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 677b546..64f3c57 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -52,4 +52,10 @@ void exynos4212_register_clocks(void); #define exynos4212_register_clocks() #endif +#ifdef CONFIG_PINCTRL_SAMSUNG +extern int exynos4210_pinctrl_register_def_mappings(void); +#else +#define exynos4210_pinctrl_register_def_mappings() +#endif + #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */ diff --git a/arch/arm/mach-exynos/dev-pinctrl.c b/arch/arm/mach-exynos/dev-pinctrl.c new file mode 100644 index 0000000..d909052 --- /dev/null +++ b/arch/arm/mach-exynos/dev-pinctrl.c @@ -0,0 +1,115 @@ +/* + * platform device for all the instances of pinctrl. + * + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include + +static struct resource exynos4_pinctrl_resource0[] = { + [0] = { + .start = EXYNOS4_PA_GPIO1, + .end = EXYNOS4_PA_GPIO1 + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_GPIO_XA, + .end = IRQ_GPIO_XA, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device exynos4_pinctrl0 = { + .name = "exynos4-pinctrl", + .id = 0, + .resource = exynos4_pinctrl_resource0, + .num_resources = ARRAY_SIZE(exynos4_pinctrl_resource0), +}; + +static struct resource exynos4_pinctrl_resource1[] = { + [0] = { + .start = EXYNOS4_PA_GPIO2, + .end = EXYNOS4_PA_GPIO2 + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_GPIO_XB, + .end = IRQ_GPIO_XB, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device exynos4_pinctrl1 = { + .name = "exynos4-pinctrl", + .id = 1, + .resource = exynos4_pinctrl_resource1, + .num_resources = ARRAY_SIZE(exynos4_pinctrl_resource1), +}; + +static struct resource exynos4_pinctrl_resource2[] = { + [0] = { + .start = EXYNOS4_PA_GPIO3, + .end = EXYNOS4_PA_GPIO3 + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, +}; + +struct platform_device exynos4_pinctrl2 = { + .name = "exynos4-pinctrl", + .id = 2, + .resource = exynos4_pinctrl_resource2, + .num_resources = ARRAY_SIZE(exynos4_pinctrl_resource2), +}; + +/* pin config options. todo: add other options here. */ +static unsigned long pcfg_pu_drv3[] __initdata = { + PINCTRL_CFG_PACK(PUD_UP, DRV_4X), +}; + +static unsigned long pcfg_pn_drv3[] __initdata = { + PINCTRL_CFG_PACK(PUD_NONE, DRV_4X), +}; + +/* Exynos4210 SoC default pin-maps reusable by Exynos4210 based boards*/ + +static struct pinctrl_map __initdata exynos4210_sdhci2_8bit_map[] = { + PIN_MAP_MUX_GROUP("exynos4-sdhci.2", "sdhci-pcfg8", "exynos4-pinctrl.1", "sdhci2_ctrl_grp", "sdhci2-mux"), + PIN_MAP_MUX_GROUP("exynos4-sdhci.2", "sdhci-pcfg8", "exynos4-pinctrl.1", "sdhci2_cd_grp", "sdhci2-mux"), + PIN_MAP_MUX_GROUP("exynos4-sdhci.2", "sdhci-pcfg8", "exynos4-pinctrl.1", "sdhci2_4bit_grp", "sdhci2-mux"), + PIN_MAP_MUX_GROUP("exynos4-sdhci.2", "sdhci-pcfg8", "exynos4-pinctrl.1", "sdhci2_8bit_grp", "sdhci2-mux"), + PIN_MAP_CONFIGS_GROUP("exynos4-sdhci.2", "sdhci-pcfg8", "exynos4-pinctrl.1", "sdhci2_ctrl_grp", pcfg_pn_drv3), + PIN_MAP_CONFIGS_GROUP("exynos4-sdhci.2", "sdhci-pcfg8", "exynos4-pinctrl.1", "sdhci2_cd_grp", pcfg_pu_drv3), + PIN_MAP_CONFIGS_GROUP("exynos4-sdhci.2", "sdhci-pcfg8", "exynos4-pinctrl.1", "sdhci2_4bit_grp", pcfg_pu_drv3), + PIN_MAP_CONFIGS_GROUP("exynos4-sdhci.2", "sdhci-pcfg8", "exynos4-pinctrl.1", "sdhci2_8bit_grp", pcfg_pu_drv3), +}; + +static struct pinctrl_map __initdata exynos4210_sdhci2_4bit_map[] = { + PIN_MAP_MUX_GROUP("exynos4-sdhci.2", "sdhci-pcfg4", "exynos4-pinctrl.1", "sdhci2_ctrl_grp", "sdhci2-mux"), + PIN_MAP_MUX_GROUP("exynos4-sdhci.2", "sdhci-pcfg4", "exynos4-pinctrl.1", "sdhci2_cd_grp", "sdhci2-mux"), + PIN_MAP_MUX_GROUP("exynos4-sdhci.2", "sdhci-pcfg4", "exynos4-pinctrl.1", "sdhci2_4bit_grp", "sdhci2-mux"), + PIN_MAP_CONFIGS_GROUP("exynos4-sdhci.2", "sdhci-pcfg4", "exynos4-pinctrl.1", "sdhci2_ctrl_grp", pcfg_pn_drv3), + PIN_MAP_CONFIGS_GROUP("exynos4-sdhci.2", "sdhci-pcfg4", "exynos4-pinctrl.1", "sdhci2_cd_grp", pcfg_pu_drv3), + PIN_MAP_CONFIGS_GROUP("exynos4-sdhci.2", "sdhci-pcfg4", "exynos4-pinctrl.1", "sdhci2_4bit_grp", pcfg_pu_drv3), +}; + +int __init exynos4210_pinctrl_register_def_mappings(void) +{ + pinctrl_register_mappings(exynos4210_sdhci2_8bit_map, ARRAY_SIZE(exynos4210_sdhci2_8bit_map)); + pinctrl_register_mappings(exynos4210_sdhci2_4bit_map, ARRAY_SIZE(exynos4210_sdhci2_4bit_map)); + return 0; +} diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h index 2dd5267..760445f 100644 --- a/arch/arm/plat-samsung/include/plat/devs.h +++ b/arch/arm/plat-samsung/include/plat/devs.h @@ -133,6 +133,9 @@ extern struct platform_device exynos4_device_pcm2; extern struct platform_device exynos4_device_pd[]; extern struct platform_device exynos4_device_spdif; extern struct platform_device exynos4_device_sysmmu; +extern struct platform_device exynos4_pinctrl0; +extern struct platform_device exynos4_pinctrl1; +extern struct platform_device exynos4_pinctrl2; extern struct platform_device samsung_asoc_dma; extern struct platform_device samsung_asoc_idma;