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: 9414509 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 065646048F for ; Mon, 7 Nov 2016 08:58:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC9FD28AE1 for ; Mon, 7 Nov 2016 08:58:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0B7328AEB; Mon, 7 Nov 2016 08:58:19 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 74DB128AE1 for ; Mon, 7 Nov 2016 08:58:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c3fjb-0005Uq-Ei; Mon, 07 Nov 2016 08:56:55 +0000 Received: from mout.kundenserver.de ([217.72.192.75]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c3fjV-0005C4-Dx for linux-arm-kernel@lists.infradead.org; Mon, 07 Nov 2016 08:56:52 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161107_005649_865965_C488F48D X-CRM114-Status: GOOD ( 21.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, geert+renesas@glider.be, Pankaj Dubey , krzk@kernel.org, javier@osg.samsung.com, kgene@kernel.org, thomas.ab@samsung.com, m.szyprowski@samsung.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 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,