From patchwork Thu Apr 12 11:14:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 133258 Delivered-To: patches@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1573906ljb; Thu, 12 Apr 2018 04:15:13 -0700 (PDT) X-Received: by 10.46.152.18 with SMTP id a18mr391665ljj.34.1523531713702; Thu, 12 Apr 2018 04:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523531713; cv=none; d=google.com; s=arc-20160816; b=GtRF8/Gzx2r8zxEsIXdOpCDKAVVA+yyg5HBrDkSJPMiuNVTQS1Kaxj348TOcQwg2tw rAkmz+/gfESkVLcF4F1wcC09n+IFg54LhR/vQUFX066FVWpOvbloe5pZrq9BTLvIaN56 QxxbV+ta5UtYYt/JZtNCdJuvscakGl30KHJKsg1Rqz6bXwc7BCLh1tdHxq6lA3/9D3UP iEzhhbe0cnI3+uN8My34Og7W/RZ9ECOqSnKD1Jk98kd0gFYpFvH1UwtJg1IalrMNmQxe dcXQ76YSyvcM3QxNhfhQ1aSiLFjq2epZm2JEji/l2b0h/nLPO6/EbTYanAvR628P6Ai2 +fPw== 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=hseTtS2KhZHQ1K7w2clWbOmk4nomnwkr9RlA+X+mFa0=; b=oSnEL2Zc0vt4RmtuuxQm3XkxkNgsX+PFU0WoZsDIu5t4vE3apnDziPZtn316CtPvOd YzfViJeOxxSVtVpB5GiPrc1X5voJlOv81dcaqqgYeLTrwG7WFBOICp93vXKXL+dG3jIS eEQM0UAqMNWqCfqEMqauO1RHTqU8/6yHsYEo79eyC9+444KvV2H5bjaToryL2m00abut fSNEzgd1J70RVnJoCGbVPFbci3W69I4J++MXPlnym9jQywm3zQMaEqtc/EWO8Rity8mC DzsNb0I/GIYrgriltMF22gqWuzCl3eYH06IztStKsIwHSgEOB1+ckEHfP0WVG9v3wTQj uoWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ba+amFVy; 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 f17sor394217ljf.76.2018.04.12.04.15.13 for (Google Transport Security); Thu, 12 Apr 2018 04:15:13 -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=Ba+amFVy; 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=hseTtS2KhZHQ1K7w2clWbOmk4nomnwkr9RlA+X+mFa0=; b=Ba+amFVyj1BjfIC/JrvwvMCgEZ3dH2j6k5u4kCYiXFSRYSoY8Lbmcsa3AOwTUvUCiS Z+CTcbdp3asiIu86iuIsLb4slrOTVBNedTtfVUzPOSNGNFIDV/w5MVbaQhe2nL+6+RqJ NO37I4NmPHBMFUXOgxrDS6zn4IreMg44M+RBc= 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=hseTtS2KhZHQ1K7w2clWbOmk4nomnwkr9RlA+X+mFa0=; b=ZTL6Zee2jny++hBH07lKsGbx5n9jxrIdmuLGli/jXkD+6i5SSpgaX5BqGEZhvxgelZ h1g210tomv5WrS/2XhbirPgneNvAAEfb0doMvfKenSCjhk7jzA8rzQqdW/8BQGE5cQmp 8boQoLdXC2PMLxjlj8WVXOv8mdGj/gd/tkln5M2Hp/oOrWqQJZuC+BnPLx/Mz/yKwF/E DyMfZXpZ67AU9Ke4Y62FoVdAhn0WNODygVwY6o8KmXFC0Go6IiSEJPbkk2au60W0DZPR XW87mSIGDV1oz3Kp2Sp50xpVhUeNQLv2ln/rffimCqygCqJkeIoRJbEYt02kFKTOnXu1 rR/Q== X-Gm-Message-State: ALQs6tAxIDZ5u54a//t4K21dZnUwhwyrG42u/CDEG7bOU0l6YnwqY7X9 e12c0S29PpIJ4zy1XVOqrjSK1vxh X-Google-Smtp-Source: AIpwx4929jwOgOcZ9uB9kCN5AUTbzC9jMcjlBRjqKXfP5bbtB6BTeE9gFg9uAdDhCxZT0LHETDHqAg== X-Received: by 10.46.115.8 with SMTP id o8mr386413ljc.99.1523531713483; Thu, 12 Apr 2018 04:15:13 -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 r29sm543187lje.72.2018.04.12.04.15.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Apr 2018 04:15:12 -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 v7 20/26] drivers: firmware: psci: Share a few internal PSCI functions Date: Thu, 12 Apr 2018 13:14:25 +0200 Message-Id: <1523531671-27491-21-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523531671-27491-1-git-send-email-ulf.hansson@linaro.org> References: <1523531671-27491-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/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.7.4 diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 40b2b89..463f78c 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 0000000..a2b4be5 --- /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 */