Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp610608pxk; Wed, 2 Sep 2020 10:01:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0T9sLroWaLI+G/BgtvwOhBLsfd+xPs4ryU3csx11JGwhNfZvufJLnIctoRskTl45e8vSF X-Received: by 2002:a50:c089:: with SMTP id k9mr998694edf.110.1599066113648; Wed, 02 Sep 2020 10:01:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1599066113; cv=pass; d=google.com; s=arc-20160816; b=lmd8Ut5zMKYX0SnoELVY0qRTiyG8pdSIIg16EBXaU/opE/RiTtfScDQynTUoR40m98 LdV7STZ8IhsdbTeDFp+24+cjQZgsaJc/0tZMJ9FHGM7JwxfT5ZF/cF9/kl2C8+pVa8+Q TKcCEfeOIMtLOC9DRxfNHiiaQ1f+aSbbxlGhKQdVerxLXP4mlsk20rqsGUs0xjMhQc31 k0wHNTbbyGVvZzi+0Q6cxSVxBRWNqansxsq5S4KHEvtIMl4GVCrsgY1IJE1pvPtAY+1H P4GXsuz3RtISv27rcSelRfT3xBiQsQUqMtqQd6zozYqKag5kvIpQYNkKzZvV7w2GroVw vi8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=RXlvvgkgk5NVtQWRNRs7Ng0J70lamUAT04M4qSPl4yk=; b=Qy5Rh0nkFqY8D3G/Hiss49aXjrzkIY+REoHWTIi9O/iEckOxN/reHkW+3l21v3YroZ jZtquvXWMjwOFIkMc7T+RmtVZshznE7Lk4XaZeZZxube1BtrF2GGXvXurMJxW5LZH42q EkPfyKPjyqmsO6Gtgfz31JERYccqu+xavoFN7n8HsKDnyXbYsOIxOF2pEDhdbFZVTugT N+w/OUeS0Wr7m13rXoACKCs6GvkmlKloNlBYbcUVWzu/vvIans20jX58XlxnmoqZL8bD WrFZxHKd3N4iJqcfV67QMBolonPPeTNJrF85XV2HER3YkOBdO29ctVHf+D3T87zSl9K7 SrSA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=k+sqkDwl; arc=pass (i=1 spf=pass spfdomain=xilinx.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y15si2788281edu.119.2020.09.02.10.01.30; Wed, 02 Sep 2020 10:01:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=k+sqkDwl; arc=pass (i=1 spf=pass spfdomain=xilinx.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728685AbgIBQ74 (ORCPT + 99 others); Wed, 2 Sep 2020 12:59:56 -0400 Received: from mail-dm6nam12on2086.outbound.protection.outlook.com ([40.107.243.86]:11424 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728508AbgIBQ6z (ORCPT ); Wed, 2 Sep 2020 12:58:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZeLazpzPO+kZepSWmpDLMpAoO65zl86PCehsZ81RCVbdM2fgZ48xN5KN+PQoIWqG7g4rx33JlJEhJccbg1bEcagsxGjfi7kIdtYeXMeJSQkdZEEjC1x4MxFDCgcPyztF4yU34WXuzkiWdorT4UHFDbTvgfFthDmD2GQzVsvv8Qguf3Aa6T3QB7DWyhmuLR7xVlJtnDlL3+UZSKNVt9KTDTt6cqTCSNJibhwrGj7BkKpp46AjgY3Y2mT5yXp4JAc5iEzr9flZOEyUChs5itRNT3u6/bTzmHnYh2SCAUGozOUCQHIiIDB0pND7mLUJX5VqTRbNBWkuNji3tuI5QeCn4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RXlvvgkgk5NVtQWRNRs7Ng0J70lamUAT04M4qSPl4yk=; b=iIxM96Ebw4jFMHCvNbhonju22iQ9lHxV0q0DMl90aCbFjvTp7xCl1rW5GEHSxsUVG48YdqSFB0/akOhLMSNr4wey1hNAkZboJ1s+3BIG67nHMXWPXfNNYAuXfYGyoWQ+YU5ljwO3bkp+h6Rogun0C7Mkd8aMhkaPoQDDmw0Y9lZulC1tPWzimiQEA+xNI4Mb8AeqBdSe8UBGvkiL1vtssU/la09QwJneMhS/TUOMMHGLepzDZMtM1CXYS0M2Bo/B86NGl6pE2LyrPIm4FrJxvvGud1U3lGhb2ajxMluqRmKZyRJY0Vi9fy3VWjU3TmqMpVVo/ubLDhrAYKtDRkKqgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RXlvvgkgk5NVtQWRNRs7Ng0J70lamUAT04M4qSPl4yk=; b=k+sqkDwlmVz+tM7jsV5Qx/STGlvHglr+hgno1Da3tEQm5ohpKCuCX9aqcLxzJbCFhKqEAgyCcas/En62e9AT4MPEINEJXHIR+ovcbqI7GfA3kmlcmwr+XQGAdTysFOJMjoHly+Z4XNamto0PsLTu6vIxgfW5InoqDOmPK758/eA= Received: from SN1PR12CA0084.namprd12.prod.outlook.com (2603:10b6:802:21::19) by MWHPR0201MB3467.namprd02.prod.outlook.com (2603:10b6:301:7d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.25; Wed, 2 Sep 2020 16:58:50 +0000 Received: from SN1NAM02FT024.eop-nam02.prod.protection.outlook.com (2603:10b6:802:21:cafe::ec) by SN1PR12CA0084.outlook.office365.com (2603:10b6:802:21::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15 via Frontend Transport; Wed, 2 Sep 2020 16:58:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT024.mail.protection.outlook.com (10.152.72.127) with Microsoft SMTP Server id 15.20.3326.19 via Frontend Transport; Wed, 2 Sep 2020 16:58:50 +0000 Received: from [149.199.38.66] (port=52887 helo=smtp.xilinx.com) by xsj-pvapsmtpgw01 with esmtp (Exim 4.90) (envelope-from ) id 1kDW5t-0004kQ-Im; Wed, 02 Sep 2020 09:58:45 -0700 Received: from [127.0.0.1] (helo=localhost) by smtp.xilinx.com with smtp (Exim 4.63) (envelope-from ) id 1kDW5y-0004Hg-5V; Wed, 02 Sep 2020 09:58:50 -0700 Received: from xsj-pvapsmtp01 (smtp-fallback.xilinx.com [149.199.38.66] (may be forged)) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 082GwkfQ003911; Wed, 2 Sep 2020 09:58:46 -0700 Received: from [172.19.2.206] (helo=xsjblevinsk50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1kDW5u-0004H9-Bg; Wed, 02 Sep 2020 09:58:46 -0700 From: Ben Levinsky To: stefanos@xilinx.com, michals@xilinx.com, michael.auchter@ni.com Cc: devicetree@vger.kernel.org, mathieu.poirier@linaro.org, emooring@xilinx.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, jliang@xilinx.com, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v11 2/5] firmware: xilinx: Add shutdown/wakeup APIs Date: Wed, 2 Sep 2020 09:58:43 -0700 Message-Id: <20200902165846.3366-3-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200902165846.3366-1-ben.levinsky@xilinx.com> References: <20200902165846.3366-1-ben.levinsky@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 6e8f16c2-4008-41c6-cb8c-08d84f617748 X-MS-TrafficTypeDiagnostic: MWHPR0201MB3467: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cf+yaYcXByqctNUbXwAqd8Vq5aVgNquVnlDyVBOzl12RhD+c/kldsS/bJgu4xlPmILr+1//SzZl5iy31cV2+c/IGbX07jg+6C44eizGME5fPprTTNKAg/WUdvaxEb0lVLjAsIGVXE8Rc+AegGrCSeV8jo1+8tXorvaIwE/Qa9xU50Cx+L7Lhlc8E/Or8aA2zUDL/o/lp3+gjuX8H9uOpXhffMn54eDVDnDEcEWyg7p+90q6Jm8TbA3lT1PO4SFEfNSJv22eaTPqqoCWhpdvoYvWUAF5L5tLXkUTBDWk5NAiXZ4EW2pQt+3jnIk4xi3KC4Ay4RhRt3q4OqrN8sJjQ5UDT2Dd+ZT+lHX/iBCgMLeLV/XKyLCgwmfcoIUBNsizsOnXBRE42dIqyYwwyMd1QpfUSXD9pIZh3r2kDMHeFQ6U= X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapsmtpgw01;PTR:unknown-60-83.xilinx.com;CAT:NONE;SFS:(136003)(39860400002)(396003)(376002)(346002)(46966005)(186003)(82740400003)(8676002)(7696005)(426003)(2616005)(26005)(316002)(336012)(478600001)(2906002)(44832011)(6666004)(9786002)(4326008)(8936002)(82310400003)(356005)(83380400001)(47076004)(1076003)(5660300002)(36756003)(70206006)(81166007)(70586007)(42866002);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2020 16:58:50.4516 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e8f16c2-4008-41c6-cb8c-08d84f617748 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT024.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0201MB3467 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add shutdown/wakeup a resource eemi operations to shutdown or bringup a resource. Note alignment of args matches convention of other fn's in this file. The reason being that the long fn name results in aligned args that otherwise go over 80 chars so shift right to avoid this Signed-off-by: Ben Levinsky --- v3: - add xilinx-related platform mgmt fn's instead of wrapping around function pointer in xilinx eemi ops struct - fix formatting v4: - add default values for enumv3: - add xilinx-related platform mgmt fn's instead of wrapping around function pointer in xilinx eemi ops struct - fix formatting v4: - add default values for enum v9: - zynqmp_pm_force_powerdown update arg 'target' to 'node' - zynqmp_pm_request_wakeup fix code style v10: - add types.h to includes for compilation --- drivers/firmware/xilinx/zynqmp.c | 35 ++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 23 ++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 8d1ff2454e2e..a966ee956573 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -846,6 +846,41 @@ int zynqmp_pm_release_node(const u32 node) } EXPORT_SYMBOL_GPL(zynqmp_pm_release_node); +/** + * zynqmp_pm_force_pwrdwn - PM call to request for another PU or subsystem to + * be powered down forcefully + * @node: Node ID of the targeted PU or subsystem + * @ack: Flag to specify whether acknowledge is requested + * + * Return: status, either success or error+reason + */ +int zynqmp_pm_force_pwrdwn(const u32 node, + const enum zynqmp_pm_request_ack ack) +{ + return zynqmp_pm_invoke_fn(PM_FORCE_POWERDOWN, node, ack, 0, 0, NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_force_pwrdwn); + +/** + * zynqmp_pm_request_wake - PM call to wake up selected master or subsystem + * @node: Node ID of the master or subsystem + * @set_addr: Specifies whether the address argument is relevant + * @address: Address from which to resume when woken up + * @ack: Flag to specify whether acknowledge requested + * + * Return: status, either success or error+reason + */ +int zynqmp_pm_request_wake(const u32 node, + const bool set_addr, + const u64 address, + const enum zynqmp_pm_request_ack ack) +{ + /* set_addr flag is encoded into 1st bit of address */ + return zynqmp_pm_invoke_fn(PM_REQUEST_WAKEUP, node, address | set_addr, + address >> 32, ack, NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_request_wake); + /** * zynqmp_pm_set_requirement() - PM call to set requirement for PM slaves * @node: Node ID of the slave diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index bb347dfe4ba4..6241c5ac51b3 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -12,6 +12,7 @@ #ifndef __FIRMWARE_ZYNQMP_H__ #define __FIRMWARE_ZYNQMP_H__ +#include #define ZYNQMP_PM_VERSION_MAJOR 1 #define ZYNQMP_PM_VERSION_MINOR 0 @@ -64,6 +65,8 @@ enum pm_api_id { PM_GET_API_VERSION = 1, + PM_FORCE_POWERDOWN = 8, + PM_REQUEST_WAKEUP = 10, PM_SYSTEM_SHUTDOWN = 12, PM_REQUEST_NODE = 13, PM_RELEASE_NODE, @@ -376,6 +379,12 @@ int zynqmp_pm_write_pggs(u32 index, u32 value); int zynqmp_pm_read_pggs(u32 index, u32 *value); int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype); int zynqmp_pm_set_boot_health_status(u32 value); +int zynqmp_pm_force_pwrdwn(const u32 target, + const enum zynqmp_pm_request_ack ack); +int zynqmp_pm_request_wake(const u32 node, + const bool set_addr, + const u64 address, + const enum zynqmp_pm_request_ack ack); #else static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void) { @@ -526,6 +535,20 @@ static inline int zynqmp_pm_set_boot_health_status(u32 value) { return -ENODEV; } + +static inline int zynqmp_pm_force_pwrdwn(const u32 target, + const enum zynqmp_pm_request_ack ack) +{ + return -ENODEV; +} + +static inline int zynqmp_pm_request_wake(const u32 node, + const bool set_addr, + const u64 address, + const enum zynqmp_pm_request_ack ack) +{ + return -ENODEV; +} #endif #endif /* __FIRMWARE_ZYNQMP_H__ */ -- 2.17.1