From patchwork Mon Feb 18 07:54:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Abraham X-Patchwork-Id: 2156091 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id C860EDF25A for ; Mon, 18 Feb 2013 07:58:30 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U7LZe-0006fm-H5; Mon, 18 Feb 2013 07:55:42 +0000 Received: from mail-pa0-f53.google.com ([209.85.220.53]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U7LZT-0006ec-Kb for linux-arm-kernel@lists.infradead.org; Mon, 18 Feb 2013 07:55:33 +0000 Received: by mail-pa0-f53.google.com with SMTP id bg4so2661267pad.26 for ; Sun, 17 Feb 2013 23:55:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=PEg/QaOef+h84f6JNZV+V/XQ4vwlpWR0QSdLDcCOx8Y=; b=Re570XbpVQK4A6qSYmYcQ8TxGMzlRO8sqynsVRs0B8Bz3sRer2mrlZvVeifxjFsgWA iWxL0BgOnbGDLGd/Sak7j7PRHBU7K4KBPp2J28p9jILsKkb3qgt5+fqkHtYV3+67FP89 FDBPMv5fYLp4YuBP7i6nVcbEcFJ7pmp1fvFggTRf/ShEPhfdaz4UjiuYJ06meYB8ZCmF I2bJFwDKHUaITZewT4THVS1+sLj7Mk/oBRj5luU319bRFq3BP2SSYSy/Ri4FtkxpE9Vf asZVApm/HB0oL2ZedBxnNnNZAIvVNmkogJJ6I/7pGMAvyxL89nF2+IKRrEqIjvdCHF2v zhdw== X-Received: by 10.68.189.234 with SMTP id gl10mr27019305pbc.148.1361174129977; Sun, 17 Feb 2013 23:55:29 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id q4sm102956164paz.20.2013.02.17.23.55.27 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 17 Feb 2013 23:55:29 -0800 (PST) From: Thomas Abraham To: devicetree-discuss@lists.ozlabs.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 1/2] ARM: Exynos: Create virtual I/O mapping for Chip-ID controller using device tree Date: Mon, 18 Feb 2013 13:24:58 +0530 Message-Id: <1361174099-18749-2-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1361174099-18749-1-git-send-email-thomas.abraham@linaro.org> References: <1361174099-18749-1-git-send-email-thomas.abraham@linaro.org> X-Gm-Message-State: ALoCoQkrTMjLSQbyGeSFOvNIGpBjWsa7omh9k6EL9SNQpoKuuGzNn9mwTW9fOPrFo42onebzMB+K X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130218_025531_802389_965F8C5E X-CRM114-Status: GOOD ( 18.55 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.53 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: t.figa@samsung.com, kgene.kim@samsung.com, sylvester.nawrocki@gmail.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On device tree enabled exynos platforms, retrieve the physical base address of the chip-id controller from device tree and create a virtual I/O mapping for the chip-id controller. This helps to remove the chip-id controller entry from the statically defined I/O mapping tables. Cc: Kukjin Kim Signed-off-by: Thomas Abraham --- .../arm/samsung/samsung,exynos4210-chipid.txt | 15 ++++++ arch/arm/mach-exynos/common.c | 53 +++++++++++--------- arch/arm/mach-exynos/include/mach/map.h | 1 - 3 files changed, 45 insertions(+), 24 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/samsung/samsung,exynos4210-chipid.txt diff --git a/Documentation/devicetree/bindings/arm/samsung/samsung,exynos4210-chipid.txt b/Documentation/devicetree/bindings/arm/samsung/samsung,exynos4210-chipid.txt new file mode 100644 index 0000000..becb2ba --- /dev/null +++ b/Documentation/devicetree/bindings/arm/samsung/samsung,exynos4210-chipid.txt @@ -0,0 +1,15 @@ +* Samsung Exynos4/5 Chip-ID controller + +Samsung's Exynos4/5 architectures include a chipid controller which can be used +to determine the product id and revision. + +Required properties: +- compatible: should be "samsung,exynos4210-chipid". +- reg: Base address and size of the chip-id controller registers. + +Example: + + chipid@10000000 { + compatible = "samsung,exynos4210-chipid"; + reg = <0x10000000 0x100>; + }; diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 4ce342e..208dcf0 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c @@ -121,17 +121,6 @@ static struct map_desc exynos_iodesc[] __initdata = { }, }; -#ifdef CONFIG_ARCH_EXYNOS5 -static struct map_desc exynos5440_iodesc[] __initdata = { - { - .virtual = (unsigned long)S5P_VA_CHIPID, - .pfn = __phys_to_pfn(EXYNOS5440_PA_CHIPID), - .length = SZ_4K, - .type = MT_DEVICE, - }, -}; -#endif - static struct map_desc exynos4_iodesc[] __initdata = { { .virtual = (unsigned long)S3C_VA_SYS, @@ -354,6 +343,31 @@ void __init exynos_init_late(void) exynos_pm_late_initcall(); } +#ifdef CONFIG_OF +int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, + int depth, void *data) +{ + struct map_desc iodesc; + __be32 *reg; + unsigned long len; + + if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") && + !of_flat_dt_is_compatible(node, "samsung,exynos5440-clock")) + return 0; + + reg = of_get_flat_dt_prop(node, "reg", &len); + if (reg == NULL || len != (sizeof(unsigned long) * 2)) + return 0; + + iodesc.pfn = __phys_to_pfn(be32_to_cpu(reg[0])); + iodesc.length = be32_to_cpu(reg[1]) - 1; + iodesc.virtual = (unsigned long)S5P_VA_CHIPID; + iodesc.type = MT_DEVICE; + iotable_init(&iodesc, 1); + return 1; +} +#endif + /* * exynos_map_io * @@ -362,19 +376,12 @@ void __init exynos_init_late(void) void __init exynos_init_io(struct map_desc *mach_desc, int size) { - struct map_desc *iodesc = exynos_iodesc; - int iodesc_sz = ARRAY_SIZE(exynos_iodesc); -#if defined(CONFIG_OF) && defined(CONFIG_ARCH_EXYNOS5) - unsigned long root = of_get_flat_dt_root(); - - /* initialize the io descriptors we need for initialization */ - if (of_flat_dt_is_compatible(root, "samsung,exynos5440")) { - iodesc = exynos5440_iodesc; - iodesc_sz = ARRAY_SIZE(exynos5440_iodesc); - } +#ifdef CONFIG_OF + if (initial_boot_params) + of_scan_flat_dt(exynos_fdt_map_chipid, NULL); + else #endif - - iotable_init(iodesc, iodesc_sz); + iotable_init(exynos_iodesc, ARRAY_SIZE(exynos_iodesc)); if (mach_desc) iotable_init(mach_desc, size); diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h index b8ea67e..ac73b27 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h @@ -56,7 +56,6 @@ #define EXYNOS4_PA_ONENAND_DMA 0x0C600000 #define EXYNOS_PA_CHIPID 0x10000000 -#define EXYNOS5440_PA_CHIPID 0x00160000 #define EXYNOS4_PA_SYSCON 0x10010000 #define EXYNOS5_PA_SYSCON 0x10050100