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 Birje X-Patchwork-Id: 201299 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id C27F52C008A for ; Fri, 23 Nov 2012 22:58:36 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 63E6C4A02E; Fri, 23 Nov 2012 12:58:35 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 0jLKxDQx562D; Fri, 23 Nov 2012 12:58:35 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2EA3D4A01F; Fri, 23 Nov 2012 12:58:34 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 158474A01F for ; Fri, 23 Nov 2012 12:58:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 TgW6GAaWEZRB for ; Fri, 23 Nov 2012 12:58:32 +0100 (CET) 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 mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by theia.denx.de (Postfix) with ESMTP id 4FA614A01E for ; Fri, 23 Nov 2012 12:58:31 +0100 (CET) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MDX00E8EVXH83P0@mailout1.samsung.com> for u-boot@lists.denx.de; Fri, 23 Nov 2012 20:58:29 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.122]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 54.FC.01231.5E46FA05; Fri, 23 Nov 2012 20:58:29 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-56-50af64e5f9d9 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id E3.FC.01231.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 u-boot@lists.denx.de; Fri, 23 Nov 2012 20:58:29 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de 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+NgFrrNLMWRmVeSWpSXmKPExsWyRsSkSvdpyvoAg81PLC3e7u1kd2D0OHtn B2MAYxSXTUpqTmZZapG+XQJXxs8t11gLpkpXdOzfwNrAuFesi5GTQ0LARGLN5ZNMELaYxIV7 69m6GLk4hASWMkr8fn+SBabozqbDUIlFjBIvrq+EclYxSVz68ZcVpIpNwEhi68lpjCC2iICE xK/+q2A2s4CXxLbT38FWCAtYS7w6Mp0dxGYRUJW4/7oTKM7BwSvgIbHxgjDEMgWJY1O/go3k FPCUuLNjHTtI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1ewGyn7Cb6/p8y/9c7JQ34hm2/9STRSeh4WtWu7G/d5 54V/Vpjz2V9kFhMqO8+bULPj5qt/ayq5TGJvrCzo6uHL0GmIcfhV5PWD/caRbccL7V7MX3bp iHVfzWd37qBkn3/XfmZenL7V0XCvi8D5hM0Xpulcn6tYHxanxFKckWioxVxUnAgARFpaO50C AAA= X-CFilter-Loop: Reflected Cc: hs@denx.de, patches@linaro.org Subject: [U-Boot] [PATCH 4/6 V3] EXYNOS5: FDT : Decode peripheral id X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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