From patchwork Mon Oct 5 16:06:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Levinsky X-Patchwork-Id: 11816957 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 8396F6CB for ; Mon, 5 Oct 2020 16:06:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64B76206DD for ; Mon, 5 Oct 2020 16:06:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="kgs8Y58A" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728048AbgJEQGY (ORCPT ); Mon, 5 Oct 2020 12:06:24 -0400 Received: from mail-bn8nam12on2051.outbound.protection.outlook.com ([40.107.237.51]:25312 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727006AbgJEQGU (ORCPT ); Mon, 5 Oct 2020 12:06:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cLWJbWLtYgXewE2w5ERUkLhx4G3Kh/EyIfef0sGjECxi0IC1uu/6LrjE8GgtZg02N5wIDerkvskrxeCip90iKt7Nc/M21jTu5Z5Vl8M5+D5a/m2dGfH63nnT6ilhfd0tqzoEVvkMCowDjQ1vPY/SLjG872Tux6f0fe4Pbs8Fm4lrfl12Ag8FUkfuS2aA3JH9UpOFNRsH/zTG7ppU9QTNne//IMUCMhSJP1kilg+RxewYQl9kt9lrN13fX0hqOtBfr7kcbAMrLj46Mq/UAbPCmMCU96qKJ4HnKxsX5GNDtFr8NC8r2QQqB3hY34n4YX+1obgAl8hpjX1hayJ3WhU1JQ== 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=Cfi3Kfpf+LTULEWQkrI36mlTGa/hMLOLWTBImsT80ULO3y3kkXEZObLg4qUlFMU86207iCWfktCA2VRUgY+lwH3Mx2PLH5EcspD2G9yUJ0yyUz0dxYu8y3fJIgJuyEhmB7NYdAWZVxG5nafsmUsNPooM2p1oVppM0zlJIUkKsg0t5KYiG37KlCrD1Z9PAQNcropunRkIfHS/ITNaeutqVv1Wqx0YirBzcrAkudFqIMNKZaQRn28D8dEJi9fMF/xE5CsVIP5LumkD6o0bxcvinp/wYzy3rnifKAZkovh+FXITqr+sVbLbnK9u8F5J6smSum7h0/8DWqZc0uPPFUcgYQ== 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=yvj/lkr1NeFpW96h7I8rBBF1Fco7AUaEqsAkifx19DA=; b=kgs8Y58A8nv7FeigiJmecs1uZPaNzUjizFRUxnVg30KPLB4C0fxXbJ5AzQoMjcV7sXF4o2FioGICdOGozV1qB2vk7S5TqyUX0heRUMv+qqBkvjKxFXQPzT6Sa92OUkRRQPtzJNX6zRneIreSk63ky9LY1bGNpNp+DvTwGxaLfFs= Received: from CY4PR18CA0059.namprd18.prod.outlook.com (2603:10b6:903:13f::21) by BYAPR02MB5175.namprd02.prod.outlook.com (2603:10b6:a03:6f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.38; Mon, 5 Oct 2020 16:06:16 +0000 Received: from CY1NAM02FT056.eop-nam02.prod.protection.outlook.com (2603:10b6:903:13f:cafe::d2) by CY4PR18CA0059.outlook.office365.com (2603:10b6:903:13f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.34 via Frontend Transport; Mon, 5 Oct 2020 16:06:16 +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 CY1NAM02FT056.mail.protection.outlook.com (10.152.74.160) with Microsoft SMTP Server id 15.20.3433.39 via Frontend Transport; Mon, 5 Oct 2020 16:06:16 +0000 Received: from [149.199.38.66] (port=36662 helo=smtp.xilinx.com) by xsj-pvapsmtpgw01 with esmtp (Exim 4.90) (envelope-from ) id 1kPSze-0001tc-O4; Mon, 05 Oct 2020 09:05:42 -0700 Received: from [127.0.0.1] (helo=localhost) by smtp.xilinx.com with smtp (Exim 4.63) (envelope-from ) id 1kPT0C-00026i-1Y; Mon, 05 Oct 2020 09:06:16 -0700 Received: from xsj-pvapsmtp01 (xsj-smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 095G6EMc027461; Mon, 5 Oct 2020 09:06:14 -0700 Received: from [172.19.2.206] (helo=xsjblevinsk50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1kPT0A-000260-DJ; Mon, 05 Oct 2020 09:06:14 -0700 From: Ben Levinsky To: ed.mooring@xilinx.com, 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 v18 2/5] firmware: xilinx: Add shutdown/wakeup APIs Date: Mon, 5 Oct 2020 09:06:11 -0700 Message-Id: <20201005160614.3749-3-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201005160614.3749-1-ben.levinsky@xilinx.com> References: <20201005160614.3749-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 X-MS-Office365-Filtering-Correlation-Id: 8d4263a5-51d9-48e8-3b10-08d8694896e9 X-MS-TrafficTypeDiagnostic: BYAPR02MB5175: 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: RZTWC4rKuZfFDaqBuXabNBu9seit0ccVwAns66dCXzr98AteMGMUbJtt699OHkMlmZWiri6LbU066nbQqwHVtGjF4cp8Lfo7Kz+zFMimmXHRaETGsZESCFW+7T2qh9UuxF/aRSwf3xGumz0MMWYWuHI92TSGUzyBV0d/67CaKz+aM7jOsnYzSrPlMoFow+tMh0pC/Yql4R48Xc+cvDHfN3B9JmAkd9wKeQ1Gq/0I5SpFd8srw0FY02m7OwjsPcjwBM6dhrcqTcmvfCcV/8w1Gz89EJMC7fHJoEukO2zn5SConeRiCipt+8mj2yl9P6gQ3jBsKsx/DPjOk7sWCKJdEGUShFBLSwpCwUhhMs5aYfeZ71fWyka7VD6+dfSxVeL5xcdlsCi85XiVc/saB45Xfg== 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:(396003)(346002)(39860400002)(376002)(136003)(46966005)(9786002)(7696005)(2906002)(2616005)(356005)(82740400003)(82310400003)(47076004)(81166007)(83380400001)(44832011)(70586007)(6666004)(5660300002)(70206006)(8676002)(316002)(8936002)(36756003)(4326008)(26005)(336012)(478600001)(1076003)(426003)(186003);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2020 16:06:16.3244 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8d4263a5-51d9-48e8-3b10-08d8694896e9 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: CY1NAM02FT056.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5175 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__ */