From patchwork Tue Jul 31 10:42:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 10377 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 DBB0A23E02 for ; Tue, 31 Jul 2012 10:36:29 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 9631CA18836 for ; Tue, 31 Jul 2012 10:36:29 +0000 (UTC) Received: by yhpp61 with SMTP id p61so5759809yhp.11 for ; Tue, 31 Jul 2012 03:36:29 -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-tm-as-mml:x-gm-message-state; bh=xnOr6ub/dUIMs2tNLDmuKelzz8uOpa8pSqnIGKtZOkE=; b=kWMvUMZZKZJIRps3BiV1L8AfqtBIkjZRxLUc8+hhhHq/2OhanCBZFBDT2EmmHGOX0A uP06bkDl5kGa4Gn6zzoOEvOxvFtCSY3M2t4y4tRFE35/JdK2CDACXjGLBTA9NVWFdqZs tOEumVOEoC8qug28uOryY41CMkNAKv1VVQegArqN1spUE4k7/rz6HPVQg8CcI6eEVQ0e GNjiAP9b0ZkUNVkEIkIOgf8Jrnidy92GnciEV4C4JqS1raC1tH5Z1uRsdCx3TBLwt4aM /h6DxpWmHmdVksjadsEkgddBKlpGujymZpDAUk+6PJ2uQKGy0FiRxOKmea2iTXToZR/K Rfng== Received: by 10.50.46.132 with SMTP id v4mr1552367igm.25.1343730988658; Tue, 31 Jul 2012 03:36:28 -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.50.87.40 with SMTP id u8csp135203igz; Tue, 31 Jul 2012 03:36:28 -0700 (PDT) Received: by 10.68.130.67 with SMTP id oc3mr42803740pbb.18.1343730987649; Tue, 31 Jul 2012 03:36:27 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id ud7si20075pbc.282.2012.07.31.03.36.27; Tue, 31 Jul 2012 03:36:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.24 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm1.samsung.com (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M8000A56TGJRRX0@mailout1.samsung.com>; Tue, 31 Jul 2012 19:36:26 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-ce-5017b52a2bd6 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id A4.B6.19326.A25B7105; Tue, 31 Jul 2012 19:36:26 +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 <0M800037ATGJHE20@mmp1.samsung.com>; Tue, 31 Jul 2012 19:36:26 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, alim.akhtar@samsung.com, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org Subject: [PATCH 1/8] EXYNOS5: Add pinmux support for SPI Date: Tue, 31 Jul 2012 16:12:33 +0530 Message-id: <1343731360-31691-2-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1343731360-31691-1-git-send-email-rajeshwari.s@samsung.com> References: <1343731360-31691-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKJMWRmVeSWpSXmKPExsVy+t9jAV2treIBBh9vKVk8XH+TxWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DKePAgt+C/ZMX8pqtsDYzNol2MHBwSAiYSfVe8uhg5 gUwxiQv31rN1MXJxCAksYpTYsvIbM4QzkUni4KTT7CBVbAJGEltPTmMEsUUEJCR+9V9lBBnE LFAqMWViHkhYWMBCor2xlw3EZhFQlVg6cTZYK6+Ah8TblS9YIZYpSByb+hXM5hTwlGia8okF xBYCqmnv72KawMi7gJFhFaNoakFyQXFSeq6hXnFibnFpXrpecn7uJkaw559J7WBc2WBxiFGA g1GJh9fjpFiAEGtiWXFl7iFGCQ5mJRFe1hXiAUK8KYmVValF+fFFpTmpxYcYpTlYlMR5jb2/ +gsJpCeWpGanphakFsFkmTg4pRoYk1REMn1dfld/z3QVyBGIUv82K/jOs9Mhm+8KNP4wiCtn kjivOEHc8K+DMOOrxeks3vMdZqlqHvH1iNp30j7cTuWvnu78nImVtVO8WhcenDzxiGbsswOP +tXS7rzuYS/n+D/pf+HSHJ2ULddvFphf+fltwQH5ZfweBp5a+zjm1Ddv+F388eZlJZbijERD Leai4kQAujQfYPgBAAA= X-TM-AS-MML: No X-Gm-Message-State: ALoCoQlIfyHyW/AW6c2qUvHMRdc0zG2g4ftgifj6Fc+abBsfLUmNhYvoa7xRtNaEYakU9POCyRA8 This patch adds pinmux support for SPI channels Signed-off-by: Rajeshwari Shinde --- arch/arm/cpu/armv7/exynos/pinmux.c | 51 ++++++++++++++++++++++++++++- arch/arm/include/asm/arch-exynos/periph.h | 5 +++ arch/arm/include/asm/arch-exynos/pinmux.h | 3 ++ 3 files changed, 58 insertions(+), 1 deletions(-) diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c b/arch/arm/cpu/armv7/exynos/pinmux.c index 7776add..13f75e0 100644 --- a/arch/arm/cpu/armv7/exynos/pinmux.c +++ b/arch/arm/cpu/armv7/exynos/pinmux.c @@ -230,6 +230,49 @@ static void exynos5_i2c_config(int peripheral, int flags) } } +void exynos5_spi_config(int peripheral) +{ + int cfg = 0, pin = 0, i; + struct s5p_gpio_bank *bank = NULL; + struct exynos5_gpio_part1 *gpio1 = + (struct exynos5_gpio_part1 *) samsung_get_base_gpio_part1(); + struct exynos5_gpio_part2 *gpio2 = + (struct exynos5_gpio_part2 *) samsung_get_base_gpio_part2(); + + switch (peripheral) { + case PERIPH_ID_SPI0: + bank = &gpio1->a2; + cfg = GPIO_FUNC(0x2); + pin = 0; + break; + case PERIPH_ID_SPI1: + bank = &gpio1->a2; + cfg = GPIO_FUNC(0x2); + pin = 4; + break; + case PERIPH_ID_SPI2: + bank = &gpio1->b1; + cfg = GPIO_FUNC(0x5); + pin = 1; + break; + case PERIPH_ID_SPI3: + bank = &gpio2->f1; + cfg = GPIO_FUNC(0x2); + pin = 0; + break; + case PERIPH_ID_SPI4: + for (i = 2; i < 4; i++) + s5p_gpio_cfg_pin(&gpio2->f0, i, GPIO_FUNC(0x4)); + for (i = 4; i < 6; i++) + s5p_gpio_cfg_pin(&gpio2->e0, i, GPIO_FUNC(0x4)); + break; + } + if (peripheral != PERIPH_ID_SPI4) { + for (i = pin; i < pin + 4; i++) + s5p_gpio_cfg_pin(bank, i, cfg); + } +} + static int exynos5_pinmux_config(int peripheral, int flags) { switch (peripheral) { @@ -257,11 +300,17 @@ static int exynos5_pinmux_config(int peripheral, int flags) case PERIPH_ID_I2C7: exynos5_i2c_config(peripheral, flags); break; + case PERIPH_ID_SPI0: + case PERIPH_ID_SPI1: + case PERIPH_ID_SPI2: + case PERIPH_ID_SPI3: + case PERIPH_ID_SPI4: + exynos5_spi_config(peripheral); + break; default: debug("%s: invalid peripheral %d", __func__, peripheral); return -1; } - return 0; } diff --git a/arch/arm/include/asm/arch-exynos/periph.h b/arch/arm/include/asm/arch-exynos/periph.h index b861d7d..dafc3f3 100644 --- a/arch/arm/include/asm/arch-exynos/periph.h +++ b/arch/arm/include/asm/arch-exynos/periph.h @@ -43,6 +43,11 @@ enum periph_id { PERIPH_ID_SDMMC2, PERIPH_ID_SDMMC3, PERIPH_ID_SROMC, + PERIPH_ID_SPI0, + PERIPH_ID_SPI1, + PERIPH_ID_SPI2, + PERIPH_ID_SPI3, + PERIPH_ID_SPI4, PERIPH_ID_UART0, PERIPH_ID_UART1, PERIPH_ID_UART2, diff --git a/arch/arm/include/asm/arch-exynos/pinmux.h b/arch/arm/include/asm/arch-exynos/pinmux.h index 10ea736..57c80be 100644 --- a/arch/arm/include/asm/arch-exynos/pinmux.h +++ b/arch/arm/include/asm/arch-exynos/pinmux.h @@ -36,6 +36,9 @@ enum { /* Flags for eMMC */ PINMUX_FLAG_8BIT_MODE = 1 << 0, /* SDMMC 8-bit mode */ + /* Flag for SPI */ + PINMUX_FLAG_SLAVE_MODE = 1 << 0, /* Slave mode */ + /* Flags for SROM controller */ PINMUX_FLAG_BANK = 3 << 0, /* bank number (0-3) */ PINMUX_FLAG_16BIT = 1 << 2, /* 16-bit width */