From patchwork Mon Nov 7 08:56:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9414507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 83BF56048F for ; Mon, 7 Nov 2016 08:57:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7563C289E1 for ; Mon, 7 Nov 2016 08:57:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A2F728A35; Mon, 7 Nov 2016 08:57:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92AEE28A23 for ; Mon, 7 Nov 2016 08:57:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752112AbcKGI46 (ORCPT ); Mon, 7 Nov 2016 03:56:58 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:63540 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751597AbcKGI46 (ORCPT ); Mon, 7 Nov 2016 03:56:58 -0500 Received: from wuerfel.localnet ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0LhNIm-1cYesw2lfM-00mf0Z; Mon, 07 Nov 2016 09:56:14 +0100 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Pankaj Dubey , linux-samsung-soc@vger.kernel.org, geert+renesas@glider.be, krzk@kernel.org, javier@osg.samsung.com, kgene@kernel.org, thomas.ab@samsung.com, m.szyprowski@samsung.com Subject: Re: [PATCH v7 2/2] ARM: EXYNOS: refactoring of mach-exynos to enable chipid driver Date: Mon, 07 Nov 2016 09:56:09 +0100 Message-ID: <8265239.AocGIQzL5f@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <1478347427-28409-3-git-send-email-pankaj.dubey@samsung.com> References: <1478347427-28409-1-git-send-email-pankaj.dubey@samsung.com> <1478347427-28409-3-git-send-email-pankaj.dubey@samsung.com> MIME-Version: 1.0 X-Provags-ID: V03:K0:JdyVF1Pi0Pw51O/sfygNtHiGViSekI7SMhTWrUqee/kPF/52gF3 ZCtvBtDqu0/jfE80veqklylmQM9PoYD3/bFCdI64y2NHAG7qXCjXg6lsegNvY2lsTzpqYfC WU/h9HAX1uPApah7XPdX2lYQ9CwVw7yVPZGs8CBjc4No6KPXvTKqEskKh19U4Aoh9fxc5d8 0cg6JQPc7wwORvjrhkpwA== X-UI-Out-Filterresults: notjunk:1; V01:K0:Ncmmpz8DIlg=:W1Ue+vEw8KssFwwHzhTZXu 8BX5WxcnzYlwwCxeY0eh13gYwH9WA0AdzvuHj/aqQaE4JRakItCSsC80SDQj5gawhkyItsIOM EJq2+NduSIcBytNkLvVo5npnDbMH8BtpSJcK159n5ZIv+u9+v7duDRYjUlK4Gv3AV6bw5RPVa GM0eNHyPPBqTZZU3mKjBnXpPVQS1OLzVtTljNNOI2xmBkYf/PNsi+SeUNM7fS9mkJdTmYTg9j WDslFchoJ5fXsjq5RBOgchsarpYYcVUauumcHt09wvSHgPozE/rkoAUh7Ud2VqGnTANH8SgaU 8Wm/WRwCkuHmDnJaLRPxhbBasOK1nGPfuH16/Xg8UDfzkcti3MM0385DucD7mgayS2+kii5FB Zfh8ZLE6Lh1WgGMRTkkH7v8AKiKvi8HPHIAhjhb9NCm4K6Yx8DFiY5qktvwbgWg4NPTDcs2dc awVso8iwmHvw08MeMBAWXvR696uMPUN4RuE7iQ73a6H8rARzZt0U+CXIpM3xmign4dpcjxeZb FHeo4P3yc/ozHeTwAB9VLsRKj5z5Qksck3uSutkuujjOgAlxp7174yMGJF42Z84qzra8J9xgH aJtQ8QktxSMj2+oORqkt4q8eq9r72z2Z4DHJtpsA3ZzWiZiP4KXJpOwW8FOZqUUbpshP5wKlH 3xO5s8IjFGie5Qhcz0dKgwk+gK8ABztnSBV/ZiPv0atLM8QDbDVVqbTGifmvmc3pVV9gUvpgi Pu1mrLcvgK7xee56 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Saturday, November 5, 2016 5:33:47 PM CET Pankaj Dubey wrote: > This patch enables chipid driver for ARCH_EXYNOS and refactors > machine code for using chipid driver for identification of > SoC ID and SoC rev. > > Signed-off-by: Pankaj Dubey > --- > arch/arm/mach-exynos/Kconfig | 1 + > arch/arm/mach-exynos/common.h | 92 ---------------------------- > arch/arm/mach-exynos/exynos.c | 31 ---------- > arch/arm/mach-exynos/firmware.c | 10 +-- > arch/arm/mach-exynos/include/mach/map.h | 21 ------- > arch/arm/mach-exynos/platsmp.c | 22 ++++--- > arch/arm/mach-exynos/pm.c | 41 ++++++++----- > arch/arm/plat-samsung/cpu.c | 14 ----- > arch/arm/plat-samsung/include/plat/cpu.h | 2 - > arch/arm/plat-samsung/include/plat/map-s5p.h | 2 - > 10 files changed, 47 insertions(+), 189 deletions(-) > delete mode 100644 arch/arm/mach-exynos/include/mach/map.h Nice code removal! > - > static void __init exynos_init_io(void) > { > debug_ll_io_init(); > - > - of_scan_flat_dt(exynos_fdt_map_chipid, NULL); > - > - /* detect cpu id and rev. */ > - s5p_init_cpu(S5P_VA_CHIPID); > } This is now the default for .map_io, so you can remove the rest of the function as well and do > diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c > index fd6da54..a9f8504e 100644 > --- a/arch/arm/mach-exynos/firmware.c > +++ b/arch/arm/mach-exynos/firmware.c > @@ -44,7 +44,7 @@ static int exynos_do_idle(unsigned long mode) > writel_relaxed(virt_to_phys(exynos_cpu_resume_ns), > sysram_ns_base_addr + 0x24); > writel_relaxed(EXYNOS_AFTR_MAGIC, sysram_ns_base_addr + 0x20); > - if (soc_is_exynos3250()) { > + if (of_machine_is_compatible("samsung,exynos3250")) { > flush_cache_all(); > exynos_smc(SMC_CMD_SAVE, OP_TYPE_CORE, > SMC_POWERSTATE_IDLE, 0); I'd rather not see a proliferation of many such checks. Please try to rework it to have fewer checks, e.g. by having a separate instance of "struct firmware_ops" for each incompatible variant and making the decision once. > > +static struct soc_device_attribute exynos4210_rev11[] = { > + { .soc_id = "EXYNOS4210", .revision = "11", }, > + { }, > +}; > + > static void __iomem *cpu_boot_reg_base(void) > { > - if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1) > + if (soc_device_match(exynos4210_rev11)) > return pmu_base_addr + S5P_INFORM5; > return sysram_base_addr; > } > @@ -182,9 +187,10 @@ static inline void __iomem *cpu_boot_reg(int cpu) > boot_reg = cpu_boot_reg_base(); > if (!boot_reg) > return IOMEM_ERR_PTR(-ENODEV); > - if (soc_is_exynos4412()) > + if (of_machine_is_compatible("samsung,exynos4412")) > boot_reg += 4*cpu; > - else if (soc_is_exynos5420() || soc_is_exynos5800()) > + else if (of_machine_is_compatible("samsung,exynos5420") || > + of_machine_is_compatible("samsung,exynos5800")) > boot_reg += 4; > return boot_reg; > } Same here, it would be nicer to rework the code to compute the address once while called from a place where you already know this information and then store the register address. > > +static struct soc_device_attribute exynos4210_rev11[] = { > + { .soc_id = "EXYNOS4210", .revision = "11", }, > + { }, > +}; > + > +static struct soc_device_attribute exynos4210_rev10[] = { > + { .soc_id = "EXYNOS4210", .revision = "10", }, > + { }, > +}; Please use a single 'soc_device_attribute' table and make use of the .data field to encode the difference. Arnd --- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 757fc11de30d..808872981f45 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -234,7 +234,6 @@ DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)") .l2c_aux_val = 0x3c400001, .l2c_aux_mask = 0xc20fffff, .smp = smp_ops(exynos_smp_ops), - .map_io = exynos_init_io, .init_early = exynos_firmware_init, .init_irq = exynos_init_irq, .init_machine = exynos_dt_machine_init,