From patchwork Wed Mar 14 16:58:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 131687 Delivered-To: patches@linaro.org Received: by 10.80.210.197 with SMTP id q5csp410749edg; Wed, 14 Mar 2018 09:59:35 -0700 (PDT) X-Received: by 2002:a19:d0c4:: with SMTP id h187-v6mr3797775lfg.107.1521046775427; Wed, 14 Mar 2018 09:59:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521046775; cv=none; d=google.com; s=arc-20160816; b=enEfG/zbpXF4vggZpqqzbPKgHazRCz8/R5QPGyruQCJ/7C7FUA9yX4NZm3wDdDaK1R 6oM8uprS4/uWgcHjXGvCnWvuqqiVg9DZUc016AH8V0940uodBE9V07v5c7k+V/0z6t3m YRKTYIT8sj8AQPCUlSf0FveeHkrIBh8XmLHoSNhwSBtrXve69fJ4mbtF6J1+Ri3asRZq 9TiziJx/dDW+TYGgUFmbwSakYtwaEt7/6b6Hn78FTr8WaL/4LtAAuwSqOvfj5RX+khoi L72PDVODhbKzoF2rvmDcztlvz9mdiYhsr9yfwez/rSW9jmvlEkmbMi29UpHCVZKiNS2K +nGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Yx/3Lk6vPgNgFrquTQIY9p5ijDGeAkDsNUNY9kNSe1E=; b=SyemrL9CRn9yEeYaADawqGZr7yU+liceBYCcm79W1cI7qBF2BaZHf6MsVHF1GNlk5h SQ7MquFPtcg7F+hlzP7Hw1TyMJUDvU9G+EqisNeVRmj3V3KZrirwpxweDoV5vZl0VmSP XUzIBQ55UXiSS4UcaMdp9VdeoQvwSr6B0Y0SxjECyOfFwV4BEz+IrFQO87eoHOVpnbbq hrb5/SKIZ7wViYEXRfdfkBHE6HpeC3puiBNia6Kq0xcqGoWtfFIRqcox2umT6Hy58x2G 4H7RiY3TfSDztZ93F9x9cTEaLxU7PJE2xz+uAFHd5RPzthPmmlhw6kxREGRdypyZwhMg bSLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bpnVv+vt; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m139-v6sor875074lfg.85.2018.03.14.09.59.35 for (Google Transport Security); Wed, 14 Mar 2018 09:59:35 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bpnVv+vt; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Yx/3Lk6vPgNgFrquTQIY9p5ijDGeAkDsNUNY9kNSe1E=; b=bpnVv+vtfl3PiXgaVc/v0GYbIhuUsSwwwxCc9pEgESCaP3QPxVYRhY5KBufv3ekpc/ CjxoMaf3sJkEydNdLy9xTqdqC0Y1pI+FKnrPURVT5gvqlw8hU3MyBWu6fJy6VCMAK9Rj EOyYzsVkseyM21KNxe5b4SaLKMHJ+1ch/gt8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Yx/3Lk6vPgNgFrquTQIY9p5ijDGeAkDsNUNY9kNSe1E=; b=q6ntq2E1u5HsaWnhLUeop+5ij+YVaZN74gEWC8Cefp1NYzK0zBRmxI8yNdjZrD7Bjz 44BnlTGQEJcuabC4y54IN8BGiSyLiWPVbVQs1cKC1yGtrWjk+y2Fyb4a7lI8h3Fzwpwp eU4HLJ4MWq4d43vOwoHtEnTOTt+EBb0R1e1mXAreE8+aVSvx3EQTI718XCG3uNeNWRCM purpK60bH7nbG98AJx+rEdz4lic2L7Gdn4O2i7C7yimQJeXfzTGU7lGYBPmNXGTGjqaF WYUDlwZ/aGHdbY3t0Wjb3q3gkS8oYYJtmTMLlPJsljA9g8oiTZKzzolGQrFRS3mWqdel zHKg== X-Gm-Message-State: AElRT7F2XhslmxOy+CPMCrHXCDLXarXRkD1q3gN3I2SyTQcbHrSycEHs w722gVirW1JPvakMXCnWxQAef58z X-Google-Smtp-Source: AG47ELv+z23XoPeIMmVBq1rcJr/GrUIuLDvJDmn+1dRIGmcKopQN4qeH81mb46nd4UBqVNUbG3MyEw== X-Received: by 2002:a19:f20:: with SMTP id e32-v6mr3781092lfi.69.1521046775127; Wed, 14 Mar 2018 09:59:35 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t24-v6sm724849lfi.30.2018.03.14.09.59.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 09:59:34 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org Cc: Kevin Hilman , Lina Iyer , Lina Iyer , Ulf Hansson , Rob Herring , Daniel Lezcano , Thomas Gleixner , Vincent Guittot , Stephen Boyd , Juri Lelli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 18/25] drivers: firmware: psci: Share a few internal PSCI functions Date: Wed, 14 Mar 2018 17:58:28 +0100 Message-Id: <1521046715-30683-19-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> References: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> Following changes needs to be able to call psci_get|set_domain_state() and psci_dt_parse_state_node(), but from a separate file. Let's make that possible by sharing them via a new internal PSCI header file. Cc: Lina Iyer Signed-off-by: Ulf Hansson --- drivers/firmware/psci.c | 14 ++++++++------ drivers/firmware/psci.h | 13 +++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 drivers/firmware/psci.h -- 2.7.4 diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 40b2b89..463f78c 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -34,6 +34,8 @@ #include #include +#include "psci.h" + /* * While a 64-bit OS can make calls with SMC32 calling conventions, for some * calls it is necessary to use SMC64 to pass or return 64-bit values. @@ -90,12 +92,12 @@ static u32 psci_function_id[PSCI_FN_MAX]; static DEFINE_PER_CPU(u32, domain_state); static u32 psci_cpu_suspend_feature; -static inline u32 psci_get_domain_state(void) +u32 psci_get_domain_state(void) { return this_cpu_read(domain_state); } -static inline void psci_set_domain_state(u32 state) +void psci_set_domain_state(u32 state) { this_cpu_write(domain_state, state); } @@ -285,10 +287,7 @@ static int __init psci_features(u32 psci_func_id) psci_func_id, 0, 0); } -#ifdef CONFIG_CPU_IDLE -static DEFINE_PER_CPU_READ_MOSTLY(u32 *, psci_power_state); - -static int psci_dt_parse_state_node(struct device_node *np, u32 *state) +int psci_dt_parse_state_node(struct device_node *np, u32 *state) { int err = of_property_read_u32(np, "arm,psci-suspend-param", state); @@ -305,6 +304,9 @@ static int psci_dt_parse_state_node(struct device_node *np, u32 *state) return 0; } +#ifdef CONFIG_CPU_IDLE +static DEFINE_PER_CPU_READ_MOSTLY(u32 *, psci_power_state); + static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) { int i, ret = 0, count = 0; diff --git a/drivers/firmware/psci.h b/drivers/firmware/psci.h new file mode 100644 index 0000000..a2b4be5 --- /dev/null +++ b/drivers/firmware/psci.h @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +#ifndef __PSCI_H +#define __PSCI_H + +struct device_node; + +u32 psci_get_domain_state(void); +void psci_set_domain_state(u32 state); + +int psci_dt_parse_state_node(struct device_node *np, u32 *state); + +#endif /* __PSCI_H */