From patchwork Wed Jun 20 17:22:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 139388 Delivered-To: patches@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1050988lji; Wed, 20 Jun 2018 10:23:11 -0700 (PDT) X-Received: by 2002:a19:7707:: with SMTP id s7-v6mr7166666lfc.8.1529515391939; Wed, 20 Jun 2018 10:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529515391; cv=none; d=google.com; s=arc-20160816; b=EcJ7EdjglpfRLEr1HLyMt0qdT/IaztTI7qLNwliMPzE301lfxJQAM/J+lU0EB1bioc fWjHOJ2Z/6ide04lV+HJKuVPEeLcVfRICvMl7lMjR1npyXP8iycxmlN303oiK7Q0QEOF wTugaHdsXGOXt/+7HoSOi0iT6VFsHvjSC7won0Vwvmiu4kuilE/P99nTh+n7+qFbYQDw f3//KZwPfGDDSy4aQXyQQYrE7kplN5buVMlSO+COJF5SKXEH/GN50YeSShGvaAxbme9u COhl35Ip1BHWxUGPc/6Ffsx1vX8GnxsXQYAU0qqaKD0eZ1SR3ZAnj6mwqL1ATyG7sAqp IehA== 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=cV7qOWslovasm3reIVu1jS3ltOLzaMhL00jKgYh6Nhw=; b=Ty6ZlEgsU0V5hCBl8VrXVZZfXj66WKNCYI83mu6bQu6seMq7cDKwCbzCHwRxS4irTR 3kUNxw3FBT7ANTMsbEH9inXCW3rSGGMXTfgzq3wIxVGjrbXx81Bb3VxmhvBCzlh4Gj8t +sTs2kd/wpDR4Q31FL2E7KZvei9Hm8eKa1mfxTwMUzu9OWtf6YFmsMPGY9jxSb9cJgwl nqRxWX9XY05jrLE7fMJgfUCErZf0+oXsuu1KsXZ2HY3Q6TXA+UvCSEwwKyA3+gqwiIVS CQVn18U1n6uy8ZUAK1uwEzZnY7gFfcrYJ2Od7fEvxYvcqUMe5Jpcy1lPEPyNRvJzjWpN arVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U8pYcg45; 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 w4-v6sor687660ljw.103.2018.06.20.10.23.11 for (Google Transport Security); Wed, 20 Jun 2018 10:23:11 -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=U8pYcg45; 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=cV7qOWslovasm3reIVu1jS3ltOLzaMhL00jKgYh6Nhw=; b=U8pYcg45t8FOmO1McVT3H9JZ/G4uT7s9zkL4ps+KG/97JI/6Ql0hgjW9pAV01OKjUi lyeaNcYRIuTt8+8veRE0Bzw6OJ9lpOrym7fbVoRr6D+0rpM6K+6snow/l8smcLBEdb5h uXLrPEAmJMZ8jeGhQipkGtVEEJwGc4BPpQO+I= 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=cV7qOWslovasm3reIVu1jS3ltOLzaMhL00jKgYh6Nhw=; b=klJFS4zp1bOx+A8XQLfiMp3fHqKv6WkiZJChD1Yii9f7lUJPEkJHFUBk6F/wqophAY MChQ20NPN6OCDuaATe4dxi77RuWjsOdyGEUE74MQto0o0qMLxbuP4cWIcuiqItNCIIiv XdQiXiJVsZCyhwFdCnj/zVLsL27bqMS2XTvFUnWrgcUbZ+PJuRBpcsa8cmEaOV6Bf1UR 9hjugZicYdNU6ZdpPbEpO2kmYQpMWhM9DPJVbb9zeRj83U3DuNNgLfKYiTaQMy+7kE+Z +intjoiSVsvmd/j8EeYxEYwt25bjQxp5qQdZEboTSNT/gyyF4nKPcyC9S/FCumZfdRKl 7QOA== X-Gm-Message-State: APt69E2jBi7LDz82Ge7/P4d1S1txwNYHlVmv3Z+r+p2IcFf4LOg+CvC0 LmFc/AH/Vk64VgQeKppLtLuuxnW3 X-Google-Smtp-Source: ADUXVKJJVNGM+2m2TzrlaYwXiNDTFLn50Pzw7JzQr2AX+vT+UeroiBIEV4hh+8y1pNT5a7XW22BNMQ== X-Received: by 2002:a2e:5d5d:: with SMTP id r90-v6mr14518777ljb.125.1529515391711; Wed, 20 Jun 2018 10:23:11 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b2-v6sm514441lji.85.2018.06.20.10.23.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 10:23:11 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , 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 v8 20/26] drivers: firmware: psci: Share a few internal PSCI functions Date: Wed, 20 Jun 2018 19:22:20 +0200 Message-Id: <20180620172226.15012-21-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620172226.15012-1-ulf.hansson@linaro.org> References: <20180620172226.15012-1-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/psci.c | 14 ++++++++------ drivers/firmware/psci/psci.h | 13 +++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 drivers/firmware/psci/psci.h -- 2.17.1 diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 40b2b8945018..463f78cda3be 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/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/psci.h b/drivers/firmware/psci/psci.h new file mode 100644 index 000000000000..dc7b596daa2b --- /dev/null +++ b/drivers/firmware/psci/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 */