Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp795136pxk; Thu, 1 Oct 2020 14:08:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuJuEtRXKwRmRWEVGIsI2JNMipIrL59qRbR6vf3uYwNuSxrniH2tY+kdcJtK7yubaKueck X-Received: by 2002:a05:6402:3105:: with SMTP id dc5mr10443359edb.105.1601586481873; Thu, 01 Oct 2020 14:08:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1601586481; cv=pass; d=google.com; s=arc-20160816; b=s8d+c0dpFzv6+4arcvI1HlmiNuhY5tMoy9pQ3JN7RhwQE88mULLQllioSnUH+peYXK jJNrYN6O+/V6XH3DOCbWJscaUxa2n0vwzcdIa6AEsCiUNHD5NI3d300f4qhUKHAv44q+ OJvO+aesNIrT4NSMzvlndxucioSUu13DR3muwzAFkOjRMD+mL4O8Omnhv043TLmUWNQL RPgjKIO0kCisb1mNUFw9BM0DOySjLuFGH66d+AqHFIqPpRfSKkQP5EeFFbuidX6JQeUn I+s7cwycgQfNLtUZ8xOZJdZQvzvcTphTSI6ejHzarvbK1NYaiCbSTKB9dhnnDnjPNYjI al9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=RXlvvgkgk5NVtQWRNRs7Ng0J70lamUAT04M4qSPl4yk=; b=hNlZAXusfxXYrQKONd9BCfXSmWqX9+SYcWOkM8rZ2B7HNaruwKAyKF2/kyvGBV5nYc iJt4p7xh6J2vcAnAww53+dMmyXTHcZLbkcE/irjvlzu6bRTfwzZtMimd20WkVjlrTHnc EAjA7gKv6i2Fo02d4bniSe3gOU1i6+0ujKfRi4Epr8odDG1g2N/kUDO29LD/2toV+hV4 Hgz+XQy8Xcbo0LAFrKXmbzWCIq0Kuo3VFoYxcX4hXY5VDBxj62/RmK7lXHeewP2NbMNF VfcqvHmyYkYJDzEBt3iR7gCRdhmhDpLMTJArNB0cvhwwsM8y8BFJYeC60g2RBMkwjAZv 9PsQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=Gs4hHpyI; 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 dt2si4209679ejc.630.2020.10.01.14.07.38; Thu, 01 Oct 2020 14:08:01 -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=Gs4hHpyI; 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 S2387435AbgJAVGP (ORCPT + 99 others); Thu, 1 Oct 2020 17:06:15 -0400 Received: from mail-eopbgr760055.outbound.protection.outlook.com ([40.107.76.55]:2655 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733078AbgJAVF7 (ORCPT ); Thu, 1 Oct 2020 17:05:59 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b4FPN12NEwkvxilfgzQjZitgDGfI805KXrKnG9yK7NGbj0CaHGItLfkCevQbnSnjdce3IoVUVuyEEzTbsRClCfuYpL+8fLFm2baOdxBf7eB1WR1JxceqT6V4d0hu0QqA3fZ2DY6d4MRVFXzCRgdXOT9yWK2Y+cYAbMjQklJ7ntGdsq6xe0BwlqoDaRk+vvT/gDD7uRT83hx4JleO0MdLaW7SWUBPHtaRHzerQtD7k/NBcJKCKjDzBpzTX1dzpSHsc9dXmmFdU0xVx2MZZ/Msz5HrNhDWt3YirEhI/ghn8ACo6INSIHB6VrT4LNkxTGlKl4YTSM5m2mZs7CYh4FBvyg== 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=L0KEWlvT/tV7qeKQVaNjgzCNgCgbuWtCuin+lwNr7jLHmqq3UVf+xqgZCQo2OOYa04WOti/XPmdpuhoHsrpM8zQg9/R5LuYQmJO+K7tnKVSE78dOFCKBnk009KUUwzSvsRBiAmZZW8Hv5UiWrDNR2nsw9UsNa47W7pF0ziYKe4tcrBoN0F+C1h5Gny64gB69i1m5Wp2QeTrvXAkpM1CR0Cup5yxeWcsBW0M+rn/t9k9r+cMONRQI+DVaBEXGdOkuYnOTkHtNOMP06sSa2ydJsh6MPBZNo6bL4PjpAs+ovR6FHX84a0/peqW5nHsrXAU8JsOxIFzeYKxc7Th3aMV3uA== 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=Gs4hHpyIPlPRusNvR7c/Vmd/cj5CtX1VMc3Z1ZJz+4MtJoCPmjvW7Oy60Tn3kD2Wa6Jcu0h0gj/hK6en4jm4AEb79enfyC2Hj4IWpqTEcEupAw2z8ognnuvEI1Gh6/YhsZi6zaPg/DECW/K9AEvzjpdoZdECG47NEJcB+j3NYns= Received: from CY4PR21CA0042.namprd21.prod.outlook.com (2603:10b6:903:12b::28) by MN2PR02MB6319.namprd02.prod.outlook.com (2603:10b6:208:180::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.36; Thu, 1 Oct 2020 21:05:55 +0000 Received: from CY1NAM02FT010.eop-nam02.prod.protection.outlook.com (2603:10b6:903:12b:cafe::6d) by CY4PR21CA0042.outlook.office365.com (2603:10b6:903:12b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.7 via Frontend Transport; Thu, 1 Oct 2020 21:05:54 +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 CY1NAM02FT010.mail.protection.outlook.com (10.152.75.50) with Microsoft SMTP Server id 15.20.3412.21 via Frontend Transport; Thu, 1 Oct 2020 21:05:54 +0000 Received: from [149.199.38.66] (port=60937 helo=smtp.xilinx.com) by xsj-pvapsmtpgw01 with esmtp (Exim 4.90) (envelope-from ) id 1kO5lW-0005ZO-O2; Thu, 01 Oct 2020 14:05:26 -0700 Received: from [127.0.0.1] (helo=localhost) by smtp.xilinx.com with smtp (Exim 4.63) (envelope-from ) id 1kO5ly-0000KR-Ge; Thu, 01 Oct 2020 14:05:54 -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 091L5fMU030074; Thu, 1 Oct 2020 14:05:41 -0700 Received: from [172.19.2.206] (helo=xsjblevinsk50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1kO5ll-0000Id-A0; Thu, 01 Oct 2020 14:05:41 -0700 From: Ben Levinsky To: sunnyliangjy@gmail.com, punit1.agrawal@toshiba.co.jp, stefanos@xilinx.com, michals@xilinx.com, michael.auchter@ni.com Cc: devicetree@vger.kernel.org, mathieu.poirier@linaro.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v17 2/5] firmware: xilinx: Add shutdown/wakeup APIs Date: Thu, 1 Oct 2020 14:05:38 -0700 Message-Id: <20201001210541.32042-3-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201001210541.32042-1-ben.levinsky@xilinx.com> References: <20201001210541.32042-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: cc4d2e00-c16d-4878-c5a4-08d8664dc940 X-MS-TrafficTypeDiagnostic: MN2PR02MB6319: 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: idiWbp+S/3+sT/IB1iOqe9kHkCsV3p2BBybzBSq24LgTp2TuGAJ5GiDir1QcA1jf4dN4Q7e8queVFBdzfkDO5+HtzFELoCcra9egepopDn9xz9DOa6vWVtWDrYxJt+PaRvGKEqUPXn5w/NFOCYaeFlspvWH+BT2MdLwkZvCPK7dIeEWhAzH4+/42XjYUZA+dwsjfttGh627CBGxBh2ypyWDue613nqLb9U3DS+YOHBBAAb/6MH2J4Zd/iiFS4eCgxhR7eLpwmv03gFo31bMKeNe/q6oxF6qKdYet6LAKcO1oEXqo6u96u5Dxbhv8XCwMJDAskTYsmdunV9vn7sHtiFIYP4XFrhfbA6dmBGs/2GTgVT5Zcq8E6pEW7JHqmJXXIPnX5AkQ+t3MmraN+Zu0SWISZ96YEeKgg+Jj20kUvaI= 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:(346002)(136003)(396003)(376002)(39860400002)(46966005)(5660300002)(186003)(81166007)(47076004)(316002)(426003)(82740400003)(356005)(478600001)(2616005)(336012)(1076003)(36756003)(70206006)(7696005)(8936002)(83380400001)(44832011)(2906002)(82310400003)(70586007)(4326008)(6666004)(26005)(8676002)(9786002)(42866002);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2020 21:05:54.7795 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc4d2e00-c16d-4878-c5a4-08d8664dc940 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: CY1NAM02FT010.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6319 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