Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756128AbeAIMpT (ORCPT + 1 other); Tue, 9 Jan 2018 07:45:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:33470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752301AbeAIMpS (ORCPT ); Tue, 9 Jan 2018 07:45:18 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 461872173C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=krzk@kernel.org X-Google-Smtp-Source: ACJfBov2qK8YqXqJZZSzDO95fbjIpiKPB/H/8cZ7oXUiqgcndvtCHf/zU7S8jc4F9sEBGaRu5jgPS58dGEtJDcdoyqA= MIME-Version: 1.0 In-Reply-To: <1515484746-10656-6-git-send-email-cw00.choi@samsung.com> References: <1515484746-10656-1-git-send-email-cw00.choi@samsung.com> <1515484746-10656-6-git-send-email-cw00.choi@samsung.com> From: Krzysztof Kozlowski Date: Tue, 9 Jan 2018 13:45:15 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 5/9] soc: samsung: pm: Add support for suspend-to-ram of Exynos5433 To: Chanwoo Choi Cc: Marek Szyprowski , Sylwester Nawrocki , kgene@kernel.org, Tomasz Figa , chanwoo@kernel.org, Jaehoon Chung , Inki Dae , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Jonghwa Lee Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tue, Jan 9, 2018 at 8:59 AM, Chanwoo Choi wrote: > This patch adds the specific exynos_pm_data instance for Exynos5433 > in order to support the suspend-to-ram. Exynos5433 SoC need to write > the 'cpu_resume' poiter address and the specific magic number > for suspend mode. > > Signed-off-by: Jonghwa Lee > Signed-off-by: Chanwoo Choi > --- > drivers/soc/samsung/exynos-pm.c | 38 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/drivers/soc/samsung/exynos-pm.c b/drivers/soc/samsung/exynos-pm.c > index 45d84bbe5e61..70d949ba5cab 100644 > --- a/drivers/soc/samsung/exynos-pm.c > +++ b/drivers/soc/samsung/exynos-pm.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -123,7 +124,44 @@ static void exynos_pm_finish(void) > #define exynos_pm_data_arm_ptr(data) NULL > #endif > > +static int exynos5433_pm_suspend(unsigned long unused) > +{ > + /* > + * Exynos5433 uses PSCI v0.1 which provides the only one > + * entry point (psci_ops.cpu_suspend) for both cpuidle and > + * suspend-to-RAM. Also, PSCI v0.1 needs the specific 'power_state' > + * parameter for the suspend mode. In order to enter suspend mode, > + * Exynos5433 calls the 'psci_ops.cpu_suspend' with '0x3010000' > + * power_state parameter. > + * > + * '0x3010000' means that both cluster and system are going to enter > + * the power-down state as following: > + * - [25:24] 0x3 : Indicate the cluster and system. > + * - [16] 0x1 : Indicate power-down state. Define them, it will be more readable (name of define given just as an example): EXYNOS5433_PCSI_SUSPEND_SYSTEM (0x3 << 24) (or even split per system and cluser and use BIT() if this is real meaning) and probably reuse existing S5P_CENTRAL_LOWPWR_CFG > + */ > + return psci_ops.cpu_suspend(0x3010000, __pa_symbol(cpu_resume)); > +} > + > +static int exynos5433_pm_suspend_enter(suspend_state_t state) > +{ > + if (!sysram_ns_base_addr) > + return -EINVAL; > + > + __raw_writel(virt_to_phys(cpu_resume), sysram_ns_base_addr + 0x8); > + __raw_writel(EXYNOS_SLEEP_MAGIC, sysram_ns_base_addr + 0xc); Document them in Documentation/arm/Samsung/Bootloader-interface.txt. Best regards, Krzysztof > + > + return cpu_suspend(0, exynos5433_pm_suspend); > +} > + > +const struct exynos_pm_data exynos5433_pm_data = { > + .enter = exynos5433_pm_suspend_enter, > +}; > + > static const struct of_device_id exynos_pm_of_device_ids[] = { > + { > + .compatible = "samsung,exynos5433-pmu", > + .data = exynos_pm_data_arm_ptr(exynos5433_pm_data), > + }, > { /*sentinel*/ }, > }; > > -- > 1.9.1 >