From patchwork Fri Nov 23 12:01:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 13151 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 CC9E423DFE for ; Fri, 23 Nov 2012 11:58:32 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 5BAC4A182C4 for ; Fri, 23 Nov 2012 11:58:32 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so3713138iag.11 for ; Fri, 23 Nov 2012 03:58:31 -0800 (PST) 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 :dlp-filter:x-mtr:x-brightmail-tracker:x-brightmail-tracker :x-cfilter-loop:x-gm-message-state; bh=dDG2aGy/v5c0191felutUYOe3Z92Jts3jKn7uC3oDSs=; b=j2KydOjlDf5vStqxTl1cmUVVsOWzDLBIvzbx1ZueWul9wRB0cu3XxpU4zeIgCeN7TS 6fT2haspCL7A7JZth1ryLy1da9WHrllfOalYqDTgSNsVZzpRUcwF4jPO3dey5E0xvFd3 rhhqQMNVDjVHUKj5wm6WYDefnOrm2OfB61J3ywgtPUEXVuxs7YmFq0WBA8AJ3g7pgiy+ 9fAJuzKFEjHQoONXNp5ySqWFALDJKCvfdJ3w+lZe6Jh2l8nixPSAAPzHZD1wN5U5NlRc K2KQwvFn3NfUeMTpKaQ9viPV/c7UcFsRkxBHj5c8GLqqVf+R1myxufNLDrTXANMHG4gf Y4Ew== Received: by 10.50.161.169 with SMTP id xt9mr5793830igb.62.1353671911733; Fri, 23 Nov 2012 03:58:31 -0800 (PST) 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.67.148 with SMTP id n20csp341427igt; Fri, 23 Nov 2012 03:58:31 -0800 (PST) Received: by 10.68.231.41 with SMTP id td9mr13450701pbc.128.1353671911129; Fri, 23 Nov 2012 03:58:31 -0800 (PST) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id zo3si8307800pbc.30.2012.11.23.03.58.30; Fri, 23 Nov 2012 03:58:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.34 as permitted sender) client-ip=203.254.224.34; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.34 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MDX007DBVXEXB00@mailout4.samsung.com> for patches@linaro.org; Fri, 23 Nov 2012 20:58:29 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 97.40.12699.5E46FA05; Fri, 23 Nov 2012 20:58:29 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-3d-50af64e541d2 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 47.40.12699.5E46FA05; Fri, 23 Nov 2012 20:58:29 +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 <0MDX00GYHVRX36B0@mmp1.samsung.com> for patches@linaro.org; Fri, 23 Nov 2012 20:58:29 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, sjg@chromium.org, mk7.kang@samsung.com, hs@denx.de Subject: [PATCH 4/6 V3] EXYNOS5: FDT : Decode peripheral id Date: Fri, 23 Nov 2012 17:31:45 +0530 Message-id: <1353672107-12904-5-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1353672107-12904-1-git-send-email-rajeshwari.s@samsung.com> References: <1353672107-12904-1-git-send-email-rajeshwari.s@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsWyRsSkVvdpyvoAg8c3jS2mHP7C4sDocefa HrYAxigum5TUnMyy1CJ9uwSujJ9brrEWTJWu6Ni/gbWBca9YFyMnh4SAicSKTf2MELaYxIV7 69m6GLk4hASWMkqcmvCbvYuRA6yo4Q8jRHwRo8TNY7tZIZwVTBI/t/9iBulmEzCS2HpyGtgk EQEJiV/9V8FsZgEviW2nvzOB2MIC1hKvjkxnB7FZBFQl7r/uZAJZwCvgIbHxgjDEEQoSx6Z+ ZQWxOQU8Je7sWAd2gxBQSfPBCohOAYlvkw+xQJwmK7HpADPINRIC19kkNu1+wgwxRlLi4Iob LBMYhRcwMqxiFE0tSC4oTkrPNdIrTswtLs1L10vOz93ECAzA0/+eSe9gXNVgcYhRgINRiYfX sGxdgBBrYllxZe4hRgkOZiUR3nK/9QFCvCmJlVWpRfnxRaU5qcWHGH2ALpnILCWanA+MjryS eENjE3NTY1NLIyMzU1McwkrivM0eKQFCAumJJanZqakFqUUw45g4OKUaGAt+vWA4eE9iWbju ricdy5c//2G6ZMY55Sfdfm3TrsXXCPiszQkw2N4geudNy/QjixrPOZ39WKqXHKPfXrzq8zJ5 6VXbtE7uDOBaytFxy4XhSeDMg/13mldsYliyyN/k4YtMv20a3/i7Qhk/XLvp+yHgpWz21I1P jNZy/zbgOj7zjP6BWeqFd44psRRnJBpqMRcVJwIAxVVrom0CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkkeLIzCtJLcpLzFFi42I5/e+xgO7TlPUBBrNnqltMOfyFxYHR4861 PWwBjFENjDYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkouPgG6bpk5 QGOVFMoSc0qBQgGJxcVK+naYJoSGuOlawDRG6PqGBMH1GBmggYQ1jBk/t1xjLZgqXdGxfwNr A+NesS5GDg4JAROJhj+MXYycQKaYxIV769m6GLk4hAQWMUrcPLabFcJZwSTxc/svZpAqNgEj ia0np4F1iAhISPzqvwpmMwt4SWw7/Z0JxBYWsJZ4dWQ6O4jNIqAqcf91JxPIMl4BD4mNF4Qh lilIHJv6lRXE5hTwlLizYx07SIkQUEnzwYoJjLwLGBlWMYqmFiQXFCel5xrpFSfmFpfmpesl 5+duYgSH9zPpHYyrGiwOMQpwMCrx8BqWrQsQYk0sK67MPcQowcGsJMJb7rc+QIg3JbGyKrUo P76oNCe1+BCjD9BNE5mlRJPzgbGXVxJvaGxibmpsamliYWJmiUNYSZy32SMlQEggPbEkNTs1 tSC1CGYcEwenVAOjGL/MJE6n/EtzvGp6W+dsXlwUtOXs71uMd5Xmup1XebU9ZU9QUNfdR3e/ 8d11YWu6/yUxJvbsXO2/ortPX13W7JjmF9zMXed+kPtgedD5S88fzKhakbDv2ow1jb8eBUou +JlyXtX5mEuV2QnTfonI071b1/lX5H57a/qqiONcUEOc62/2hNOJSizFGYmGWsxFxYkA11ql FpwCAAA= X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQnX4SuGQsVPH/ccVxdIusl+Xrzhyh9F+A7yH9kkoAZP4o6BFPAfjZt6H66ZN0NV/yYAKnNK Api is added to decode peripheral id based on the interrupt number of the peripheral. Signed-off-by: Rajeshwari Shinde --- Chnages in V3: - New patch added. arch/arm/cpu/armv7/exynos/pinmux.c | 28 ++++++++++++++++++++++++++++ arch/arm/include/asm/arch-exynos/periph.h | 28 +++++++++++++++------------- arch/arm/include/asm/arch-exynos/pinmux.h | 8 ++++++++ 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/arch/arm/cpu/armv7/exynos/pinmux.c b/arch/arm/cpu/armv7/exynos/pinmux.c index f02f441..4812c8e 100644 --- a/arch/arm/cpu/armv7/exynos/pinmux.c +++ b/arch/arm/cpu/armv7/exynos/pinmux.c @@ -22,6 +22,7 @@ */ #include +#include #include #include #include @@ -396,3 +397,30 @@ int exynos_pinmux_config(int peripheral, int flags) return -1; } } + +#ifdef CONFIG_OF_CONTROL +static int exynos5_decode_periph_id(const void *blob, int node) +{ + int err; + u32 cell[3]; + + err = fdtdec_get_int_array(blob, node, "interrupts", cell, + ARRAY_SIZE(cell)); + if (err) + return PERIPH_ID_NONE; + + if ((129 > cell[1]) || (cell[1] < 31)) + return cell[1]; + + debug(" invalid peripheral id\n"); + return PERIPH_ID_NONE; +} + +int decode_periph_id(const void *blob, int node) +{ + if (cpu_is_exynos5()) + return exynos5_decode_periph_id(blob, node); + else + return PERIPH_ID_NONE; +} +#endif diff --git a/arch/arm/include/asm/arch-exynos/periph.h b/arch/arm/include/asm/arch-exynos/periph.h index 13abd2d..1de48d5 100644 --- a/arch/arm/include/asm/arch-exynos/periph.h +++ b/arch/arm/include/asm/arch-exynos/periph.h @@ -25,12 +25,17 @@ #define __ASM_ARM_ARCH_PERIPH_H /* - * Peripherals requiring clock/pinmux configuration. List will + * Peripherals requiring pinmux configuration0. List will * grow with support for more devices getting added. + * Numbering based on interrupt table. * */ enum periph_id { - PERIPH_ID_I2C0, + PERIPH_ID_UART0 = 51, + PERIPH_ID_UART1, + PERIPH_ID_UART2, + PERIPH_ID_UART3, + PERIPH_ID_I2C0 = 56, PERIPH_ID_I2C1, PERIPH_ID_I2C2, PERIPH_ID_I2C3, @@ -38,22 +43,19 @@ enum periph_id { PERIPH_ID_I2C5, PERIPH_ID_I2C6, PERIPH_ID_I2C7, - PERIPH_ID_I2S1, - PERIPH_ID_SDMMC0, + PERIPH_ID_SPI0 = 68, + PERIPH_ID_SPI1, + PERIPH_ID_SPI2, + PERIPH_ID_SDMMC0 = 75, PERIPH_ID_SDMMC1, PERIPH_ID_SDMMC2, PERIPH_ID_SDMMC3, - PERIPH_ID_SDMMC4, - PERIPH_ID_SROMC, - PERIPH_ID_SPI0, - PERIPH_ID_SPI1, - PERIPH_ID_SPI2, + PERIPH_ID_I2S1 = 99, + + PERIPH_ID_SROMC = 128, PERIPH_ID_SPI3, PERIPH_ID_SPI4, - PERIPH_ID_UART0, - PERIPH_ID_UART1, - PERIPH_ID_UART2, - PERIPH_ID_UART3, + PERIPH_ID_SDMMC4, PERIPH_ID_COUNT, PERIPH_ID_NONE = -1, diff --git a/arch/arm/include/asm/arch-exynos/pinmux.h b/arch/arm/include/asm/arch-exynos/pinmux.h index 10ea736..1f5a48a 100644 --- a/arch/arm/include/asm/arch-exynos/pinmux.h +++ b/arch/arm/include/asm/arch-exynos/pinmux.h @@ -55,4 +55,12 @@ enum { */ int exynos_pinmux_config(int peripheral, int flags); +/** + * Decode the peripheral id using the interrpt numbers. + * + * @param blob Device tree blbo + * @param node FDT I2C node to find + * @return peripheral id if ok, -1 on error (e.g. unsupported peripheral) + */ +int decode_periph_id(const void *blob, int node); #endif