From patchwork Tue Nov 3 18:23:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Levinsky X-Patchwork-Id: 11878767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 80EFF15E6 for ; Tue, 3 Nov 2020 18:23:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 58846223AC for ; Tue, 3 Nov 2020 18:23:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="cT0XDisR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729303AbgKCSXr (ORCPT ); Tue, 3 Nov 2020 13:23:47 -0500 Received: from mail-dm6nam11on2048.outbound.protection.outlook.com ([40.107.223.48]:1729 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729242AbgKCSXp (ORCPT ); Tue, 3 Nov 2020 13:23:45 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nP4sakV2ad8h4833mhS7YwxLtCVMZhH1X/ZrbMLFiRfsvmm3h9590tdaUsxTDsts4eUr8GWGFrC/fyGhTqbgLZFU4XXVFl7HR4E/p3NYDOum8H2rN8apXmewpTFPPrIzfsXUNUqnq+7we8HYt2FBcHuq3gdpVU3+jKIjjMRP+1JQTnH9e+/pyiW7ND3U0Vyt8dA4OvSzhJXEhR5RgivOpipODbHlR/mik+8VXYcMNYWo6XbmVjOai1RtVrbgM/sFNbB+MJVdXnVhQeVofoAs2WwL3JBdwUTv+MV0b9vvPscM3t8tRHYxQWUNfUw9OeZiBOpsrCkOS126TkVP0OLEfQ== 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=yvj/lkr1NeFpW96h7I8rBBF1Fco7AUaEqsAkifx19DA=; b=GH7Jw+ova6gMDci519DP3Ya13C7vQptMHHp9VsGLJWv+xMvBx84vF9C85LU1BMPvUV+gtXr3A41nee0Y9/BolpPANILaOwqes7ox8Eby60pHZAOAaJkxB5RytLZ5aVcR/WWFmfFgXYORkOsouDy+VBYGyQUBeXJN2u0k6YWHrWlhQKV0jB2Nr9lPBhxmjFBzyQ3orkjB5ocBEqop2Y/+avFkXfyWEl1W+jxNAo51UCZ6v8DrNm6HEug/R1IPhmqSc+FGvppOTwRlukMcnYdaCnAp5OWO1Cj3xkWT6AbYQ3b2JEAfpLT7A1wmH0p9eMTKGm8lIX4zhu9rfsEfuSZNEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=ni.com 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=yvj/lkr1NeFpW96h7I8rBBF1Fco7AUaEqsAkifx19DA=; b=cT0XDisR/r++uyH1dZirS9X6fLbaHkGGWVgTiYDhP8/5VEJrA+i+XEcpwTjbdYLgY3008gengfESrve1gOix19guWYB6pp98TkAlE/ODBuIxBrLKcSnAdbfuH0BH68PtGJ0jeNu9NOCYscp7lwWuYzYLMDtOn4x/xUMSXrz5IMI= Received: from BL1PR13CA0053.namprd13.prod.outlook.com (2603:10b6:208:257::28) by MN2PR02MB5934.namprd02.prod.outlook.com (2603:10b6:208:10f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Tue, 3 Nov 2020 18:23:40 +0000 Received: from BL2NAM02FT026.eop-nam02.prod.protection.outlook.com (2603:10b6:208:257:cafe::b8) by BL1PR13CA0053.outlook.office365.com (2603:10b6:208:257::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.10 via Frontend Transport; Tue, 3 Nov 2020 18:23:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; ni.com; dkim=none (message not signed) header.d=none;ni.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by BL2NAM02FT026.mail.protection.outlook.com (10.152.77.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3520.15 via Frontend Transport; Tue, 3 Nov 2020 18:23:40 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Tue, 3 Nov 2020 10:23:40 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Tue, 3 Nov 2020 10:23:40 -0800 Envelope-to: stefanos@xilinx.com, michael.auchter@ni.com, mathieu.poirier@linaro.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Received: from [172.19.2.206] (port=58698 helo=xsjblevinsk50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1ka0y4-0002gB-0p; Tue, 03 Nov 2020 10:23:40 -0800 From: Ben Levinsky To: , , CC: , , , Subject: [PATCH v22 2/5] firmware: xilinx: Add shutdown/wakeup APIs Date: Tue, 3 Nov 2020 10:23:36 -0800 Message-ID: <20201103182339.14286-3-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201103182339.14286-1-ben.levinsky@xilinx.com> References: <20201103182339.14286-1-ben.levinsky@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84b06da6-bad2-421a-7ccc-08d8802596d4 X-MS-TrafficTypeDiagnostic: MN2PR02MB5934: 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: 6fB5sRAUx3dUHqg47a8BnmQO4qoxBqmjvMme8ht3RdpUs1LsGUujZm0SseYvH9Khrpi2KJc3qEgKGOZ31a8IlUlToVuE3M2bl662EnXBrzL26qe7OQ4KvFmKDR5GJaM94qgWLHp7dnP12KpTeZHF8YvVVw+UqKjWvS1XxR6BgQ2lkX54BMz4GCHlJaaZN7lAUms+b3EbakMdjLd4r5xjZda/Pm7VSU3tGA3H4G1cli4GeBAcVt5k7vXAHN4KbnAkMEVxkX61dapmBNNDrQIa/JW5fpbidupHamifDzq8gJwz1H+9fK6Rv4PdvyQ9AMzDGR/BQMK2QT9OhyuYa8i389h3KxpmY4LilmVZiAwa4TfP34LQ/KTEhF2TXlMSoksm4+lFtMzWuMsaUlvLLUwL1lJpSrcFqVyaiknsPmiJRek= X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(39860400002)(136003)(346002)(396003)(376002)(46966005)(2906002)(4326008)(26005)(336012)(47076004)(70206006)(36756003)(7696005)(70586007)(82740400003)(186003)(110136005)(36906005)(316002)(5660300002)(1076003)(356005)(478600001)(54906003)(7636003)(82310400003)(83380400001)(6666004)(8676002)(2616005)(8936002)(44832011)(9786002)(426003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2020 18:23:40.4179 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84b06da6-bad2-421a-7ccc-08d8802596d4 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BL2NAM02FT026.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB5934 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@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 --- 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__ */