Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp1956927pxb; Sun, 10 Jan 2021 18:06:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJw54d+nDnEp1kLctrOf3oDkfhOVa8WsCko9dDh/ghNyMoUvACZYVE2gVzRKA6qNyBAYTRN+ X-Received: by 2002:a17:906:8617:: with SMTP id o23mr9398841ejx.274.1610330777955; Sun, 10 Jan 2021 18:06:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1610330777; cv=pass; d=google.com; s=arc-20160816; b=GNDL6Rrka9m3ko5NGWx1p9ZwM2GVnV5hm3XqNfGcRkZf/WNnf+k70Ymg/xJN7ET4Bc ZqjOCRHC/j+ruEez7uU1RuponOStUBOjB44uyj2kTIoq7iTqC5ZAWF/FLaZjSR/Lrbg5 EgBBYEQzaXyEr2l1wbgTg4xe6v1cJlqwZRzoKY3tbwT3us4cP+F6zhkju3giDsDur4Tg ODs/IW8/Ih+HTOp9EJjvdhsLL3aU/hnPypYpP6PTPFBF6pxTZJ6OyHHLY3Lptps0m8ll 7CD9eqZ8Ir1+PKTBP3xmNzkfOmszHZuE6TXmOR0qwrkZf4Sfc/qHHq34/WwgVuNAinWb 1txQ== 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:envelope-to:dkim-signature; bh=ZVq+KxjJEsXef+sDqwPauM4zzi4N7IP5rV+SMkxOv0A=; b=mFrRRWoKqElHXEt25DNyRIWVriAXdWFqa0y16FJLSEjJiuhQkku0PNHcXs5Qur7KTt JMBJlnge6N3ddD7TLegG+C4Rpsf3DZqJnxBWnpVotrXmq4KeOnIk251HCf+ETqgcMKzl XWjC1EaXU1gKNEWlkICkdiRUWzOC0h29WfDf5obWwk4VFsqG4DizJlutFyQa6uSS1hCz 1SHRYtXkbSmWr1TfgfIZOrxz/JdnFdxAL+jewNGLoWshbMzHoKX0mp5BohxRDzSCehna sGAIjn4CqPGBTgf06RKdqh6KGtG+frtEu/oiafX81PpWikGZqMgzFiQ2wcSFIz9N9kZY GrIQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=rhZBMLMn; 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 y17si6231993ejr.308.2021.01.10.18.05.54; Sun, 10 Jan 2021 18:06:17 -0800 (PST) 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=rhZBMLMn; 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 S1727168AbhAKCDz (ORCPT + 99 others); Sun, 10 Jan 2021 21:03:55 -0500 Received: from mail-dm6nam11on2054.outbound.protection.outlook.com ([40.107.223.54]:1974 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726915AbhAKCDq (ORCPT ); Sun, 10 Jan 2021 21:03:46 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BeGvPM73dc8RWNrQ/RVFKsAHXrtCLYS6xMsavPqVFIMkk/hZfll4U3jRrpDP6QRXv+ploweY2utQR14w6EmdaJgXFPDw0XSkrnJP+DcpOG4TORNxH38ZiUS/7rEWXQfEznNZKjE8IAfmtgQuWKNSEt8DOSlpWiCDode3UyN9cgdqMSc4PIY/l1Sx5UUm4fmlCtv9n/WV70hxvInbY7bZK/XY1JKWm08u07h/9MGeSooJdkt2svRpJXDE0tUD6643DLshUiEtcIvZHs7Lc7wlz9P+KgEBeRnE9qSeM33XGjfarnHyCEplN3UEidLllAKlfYtrH1PcmROOiSJ9X6n0gw== 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=ZVq+KxjJEsXef+sDqwPauM4zzi4N7IP5rV+SMkxOv0A=; b=cqAqa1K6yG5hxZqrZx5mSK/dQX5L9Jdqm9W5Ras2aZXKT486lsxZd/Y3xkHlBGnGEcr/0Xi5Lue3vmcZIiKJEW/Z0MmvOip5iinF06iqP2DlRfxvMgfFDeFerZk72H90yc/7cBZIYgD6qtbtbTF6FdJXwu8S9jrQwlLerjCEvmJeDdBLpI4S7N58SWnc4J8eEb+Xzb1TdhgZMS/gHf0suEtpU3Z5Hcfr6YlZEguJKV7p69l+1ugSerN9rMagtj/5JUCz+rIsdl/iVdIw8GueJX2ckdLLS4Lb7a0ZNS9sXMVA0QyEa+gWpMmmxBoqQDnl9qYj47yvVjfyhhRXzOBGLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=linaro.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=ZVq+KxjJEsXef+sDqwPauM4zzi4N7IP5rV+SMkxOv0A=; b=rhZBMLMnm8JM/RQmuM4W8aSMg+WBprd3a7jVnDvmaaSPPqybje/zgovIdnF2ky9gMyuKy3d7Pg42XSuum/JzlcJfk3r8PgvUYbxJA+1iVCSPWiNmRJgSBt2eDz+pjer4ETdJz7h8eCE6zjyKNjFxKneWCJ+WRi11cPETfsLdJco= Received: from SN4PR0501CA0151.namprd05.prod.outlook.com (2603:10b6:803:2c::29) by DM5PR02MB3290.namprd02.prod.outlook.com (2603:10b6:4:61::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.6; Mon, 11 Jan 2021 02:02:53 +0000 Received: from SN1NAM02FT015.eop-nam02.prod.protection.outlook.com (2603:10b6:803:2c:cafe::22) by SN4PR0501CA0151.outlook.office365.com (2603:10b6:803:2c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.2 via Frontend Transport; Mon, 11 Jan 2021 02:02:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; linaro.org; dkim=none (message not signed) header.d=none;linaro.org; 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 SN1NAM02FT015.mail.protection.outlook.com (10.152.72.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3742.6 via Frontend Transport; Mon, 11 Jan 2021 02:02:52 +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; Sun, 10 Jan 2021 18:02:50 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Sun, 10 Jan 2021 18:02:50 -0800 Envelope-to: michal.simek@xilinx.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=48226 helo=xsjblevinsk50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1kymXi-00008K-Il; Sun, 10 Jan 2021 18:02:50 -0800 From: Ben Levinsky To: CC: , , , , Subject: [PATCH v25 2/5] firmware: xilinx: Add shutdown/wakeup APIs Date: Sun, 10 Jan 2021 18:02:47 -0800 Message-ID: <20210111020250.6846-3-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210111020250.6846-1-ben.levinsky@xilinx.com> References: <20210111020250.6846-1-ben.levinsky@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1fe74d26-7154-441d-5692-08d8b5d50169 X-MS-TrafficTypeDiagnostic: DM5PR02MB3290: 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: IP/HWR4lAXVOFmb+rAVSmWuky6ekm90ixkHBlUBHf+C4IlaVfxMuQ8enNwHPom7qZhrPUi2E2JVK0WPIV4qMH6XH/mgWPh0/BrFCT30dJTTHafr+JuFCpNCTpVQroDjTXds0uy8oK5vBRlY2S4FnB2OHoaKwVBKOqdUJZL1eLqgUN/On+VxleOyqq2ypZRapwiHFQvcDMYCNWSZcaUziyfVwqCFlOAfXQXuqmK+ByKZ6vappVEUmUEj8mrnjazyLtrdrtdgYmAxNB7Cs4bdbXyBJ1ew/qyen3wbHMMV8CLSyUHo2jWNGGy7PTep2yUgk2ApnWUPwVoswEojS5vEWUxhHkUk8MZE3/NESrMu7rj2UUxYQyeawgcyOhLL/CoOmZxMxDaWUF5w+Pn2K99HtgIXZXiEVWB0u8J4Tj3truHXEt2BBY6kUmiOSG8T240cW2XlkN6o0Z5nz6Mp/rPTvdnvKD665BqxqTD7yB+whl4XOGPFn5Wry9ZIImhEaKnZNsbzmyR/sDMNLDUA4hLAsFw== 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)(376002)(346002)(396003)(136003)(39850400004)(46966006)(426003)(4326008)(2616005)(5660300002)(336012)(9786002)(6916009)(1076003)(26005)(8676002)(478600001)(54906003)(316002)(186003)(70586007)(70206006)(2906002)(47076005)(83380400001)(82740400003)(7636003)(6666004)(356005)(107886003)(82310400003)(36756003)(34020700004)(36906005)(44832011)(8936002)(7696005)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2021 02:02:52.8467 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fe74d26-7154-441d-5692-08d8b5d50169 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: SN1NAM02FT015.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB3290 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 --- 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 dc43f005191c..baa3d84fdcce 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, @@ -380,6 +383,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) { @@ -530,6 +539,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