From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754640AbbCRPSb (ORCPT ); Wed, 18 Mar 2015 11:18:31 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:34762 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750729AbbCRPS3 (ORCPT ); Wed, 18 Mar 2015 11:18:29 -0400 X-AuditID: cbfee61b-f79d76d0000024d6-2e-55099743b07a From: Bartlomiej Zolnierkiewicz To: Krzysztof Kozlowski Cc: Kukjin Kim , Kukjin Kim , Daniel Lezcano , Tomasz Figa , Colin Cross , Kyungmin Park , Marek Szyprowski , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Russell King Subject: Re: [PATCH v2 4/5] ARM: EXYNOS: add exynos_get_boot_addr() helper Date: Wed, 18 Mar 2015 16:18:23 +0100 Message-id: <1554212.H7UVZkpb2L@amdc1032> User-Agent: KMail/4.8.4 (Linux/3.2.0-70-generic-pae; KDE/4.8.5; i686; ; ) In-reply-to: References: <1426684197-22281-1-git-send-email-b.zolnierkie@samsung.com> <1426684197-22281-5-git-send-email-b.zolnierkie@samsung.com> MIME-version: 1.0 Content-transfer-encoding: 7Bit Content-type: text/plain; charset=UTF-8 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRmVeSWpSXmKPExsVy+t9jQV3n6ZyhBlM3CFosmNHObDHvs6zF 6xeGFr0LrrJZ9D9+zWxxtukNu8XlXXPYLD73HmG0mHF+H5PF2iN32S02f3jJZrFq1x9GBx6P luYeNo+ds+6yeyzYVOqxaVUnm8eda3vYPPq2rGL0+LxJLoA9issmJTUnsyy1SN8ugStj7ZWC ghOKFbfmX2dpYDws0cXIySEhYCKxff98RghbTOLCvfVsXYxcHEIC0xklbvb8YIZwWpgknt88 ygJSxSZgJTGxfRVYh4iAocTB3duZQIqYBRYxS2x+dY8NJCEs4CXx5eEboAYODhYBVYmva6JA wrwCmhLT1q0AKxEV8JTYOf0AI0gJp0CwxNTd5RC7zjFKHN7zkhWiXlDix+R7YHuZBeQl9u2f ygphq0tMmreIeQKjwCwkZbOQlM1CUraAkXkVo2hqQXJBcVJ6rpFecWJucWleul5yfu4mRnCU PJPewbiqweIQowAHoxIPr8RVjlAh1sSy4srcQ4wSHMxKIrzVjZyhQrwpiZVVqUX58UWlOanF hxilOViUxHmV7NtChATSE0tSs1NTC1KLYLJMHJxSDYwiL18aps2p4zgx/fJEfefqE9+LxI5d mDA/zmn+uu1zbt+fxK2awNET6KExz3Nro22U8GH34y38XqYqclqeexdVLptbEJdxd+6670vK w+W/2B8RXbnFui9QPDwoX16twu/1uSC7DbNCmN8G7uuJyiq6tthlJ4P3i6wcx5frMx1Ea972 Zz1ftl+JpTgj0VCLuag4EQA2i8POjgIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday, March 18, 2015 02:43:49 PM Krzysztof Kozlowski wrote: > 2015-03-18 14:09 GMT+01:00 Bartlomiej Zolnierkiewicz : > > Add get_cpu_boot_addr() firmware operation and then > > exynos_get_boot_addr() helper. > > > > This is a preparation for adding coupled cpuidle support > > for Exynos3250 SoC. > > > > There should be no functional changes caused by this patch. > > > > Cc: Daniel Lezcano > > Cc: Russell King > > Signed-off-by: Bartlomiej Zolnierkiewicz > > --- > > arch/arm/include/asm/firmware.h | 4 ++++ > > arch/arm/mach-exynos/firmware.c | 17 +++++++++++++++++ > > arch/arm/mach-exynos/platsmp.c | 25 +++++++++++++++++++++++++ > > 3 files changed, 46 insertions(+) > > > > diff --git a/arch/arm/include/asm/firmware.h b/arch/arm/include/asm/firmware.h > > index 89aefe1..34c1d96 100644 > > --- a/arch/arm/include/asm/firmware.h > > +++ b/arch/arm/include/asm/firmware.h > > @@ -34,6 +34,10 @@ struct firmware_ops { > > */ > > int (*set_cpu_boot_addr)(int cpu, unsigned long boot_addr); > > /* > > + * Gets boot address of specified physical CPU > > + */ > > + int (*get_cpu_boot_addr)(int cpu, unsigned long *boot_addr); > > + /* > > * Boots specified physical CPU > > */ > > int (*cpu_boot)(int cpu); > > diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c > > index f236877..c9e4481 100644 > > --- a/arch/arm/mach-exynos/firmware.c > > +++ b/arch/arm/mach-exynos/firmware.c > > @@ -104,6 +104,22 @@ static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr) > > return 0; > > } > > > > +static int exynos_get_cpu_boot_addr(int cpu, unsigned long *boot_addr) > > +{ > > + void __iomem *boot_reg; > > + > > + if (!sysram_ns_base_addr) > > + return -ENODEV; > > + > > + boot_reg = sysram_ns_base_addr + 0x1c; > > + > > + if (soc_is_exynos4412()) > > + boot_reg += 4 * cpu; > > + > > + *boot_addr = __raw_readl(boot_reg); > > + return 0; > > +} > > + > > static int exynos_cpu_suspend(unsigned long arg) > > { > > flush_cache_all(); > > @@ -138,6 +154,7 @@ static int exynos_resume(void) > > static const struct firmware_ops exynos_firmware_ops = { > > .do_idle = IS_ENABLED(CONFIG_EXYNOS_CPU_SUSPEND) ? exynos_do_idle : NULL, > > .set_cpu_boot_addr = exynos_set_cpu_boot_addr, > > + .get_cpu_boot_addr = exynos_get_cpu_boot_addr, > > .cpu_boot = exynos_cpu_boot, > > .suspend = IS_ENABLED(CONFIG_PM_SLEEP) ? exynos_suspend : NULL, > > .resume = IS_ENABLED(CONFIG_EXYNOS_CPU_SUSPEND) ? exynos_resume : NULL, > > diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c > > index b7cfcdc..449edd1 100644 > > --- a/arch/arm/mach-exynos/platsmp.c > > +++ b/arch/arm/mach-exynos/platsmp.c > > @@ -272,6 +272,31 @@ fail: > > return ret; > > } > > > > +static int exynos_get_boot_addr(u32 core_id, unsigned long *boot_addr) > > +{ > > + int ret; > > + > > + /* > > + * Try to get boot address using firmware first > > + * and fall back to boot register if it fails. > > + */ > > + ret = call_firmware_op(get_cpu_boot_addr, core_id, boot_addr); > > + if (ret && ret != -ENOSYS) > > + goto fail; > > The exynos_get_cpu_boot_addr() returns ENODEV. Do you really want to > check for ENOSYS here? Yes. When secure firmware is not present on the board the call_firmware_op() itself returns -ENOSYS (exynos_get_cpu_boot_addr() is not called in this case) and it needs to be handled in a special way. > > + if (ret == -ENOSYS) { > > + void __iomem *boot_reg = cpu_boot_reg(core_id); > > + > > + if (IS_ERR(boot_reg)) { > > + ret = PTR_ERR(boot_reg); > > + goto fail; > > + } Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics