From patchwork Mon Nov 14 23:39:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 624631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE0FDC4332F for ; Mon, 14 Nov 2022 23:40:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237113AbiKNXkx (ORCPT ); Mon, 14 Nov 2022 18:40:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236758AbiKNXkv (ORCPT ); Mon, 14 Nov 2022 18:40:51 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2057.outbound.protection.outlook.com [40.107.93.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F398710041; Mon, 14 Nov 2022 15:40:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dNl9Hx9pIYti6EY6llqydtb4DTlLmxJVVqShfccBo/nP+gJUVbg3yfx/MzVqJXYe5ClUjEboHVcxDqFFcrJwdOR1P9xAp7QgHuaifNGVtehvtfR8OsJOSoXkx+vXNyfFeegnhY+nNe0t33aVjm99qcQ+FpDT+jEFAE4AveoIo4PEFS0zbogqFtnpGdYodgu1ZLaWvrVkaTlfykXsprloDOQlBz8uMJPV8br1KJiRm6GJ/jufUkLygZk1cM5pY4zlNNODqaYk/jaLDYvaQpiuLKiaipFAJ0HgFrZ8IJYP1EcTXkKz0Cva9qP4rAKF9UYKPcbBZ72UYTuZesjkE6mIyw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MiSH5iLBgAU5SVkkVkD+Sek7zadNSqe5Ns9L/mffe5A=; b=KvCG34DRwX2yGIiSvbMp/BDB61I8Cwrcdrooxxg8GplUSTllPyt9gXrhKKENY7IdoPCw4x5IDVEys8EGv+e2BhztwUWjnCSB3eOBTvqJbY0mC1IVhwCU6lmdaf2PpoaXv1QflnDhruq/cc/va9qhFYHZ3sbsR9GEfI75JoR50aaGy93547o0H5NyNggcqyrROyr9Mc7dU9GJEQRNVWUmnQbcPiop821f+oonkss2X7l9AMY7pAhpPDr4+t2lSzABaN/1remcVeNNFkB/uUshmLvIAQqtQUeCUlDL07YBL9XOLnActtwZJE1ULXuISK4BqTEx51ULIDcIedqmxgETng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MiSH5iLBgAU5SVkkVkD+Sek7zadNSqe5Ns9L/mffe5A=; b=TfzxgOc/g0chR6ZWh9Vz5KQrOygrzM04C/6wQwyg7r+Q5WJRjWl100foqWXeFiNznctJ2Rn1KYuJdUAcM3yRHet3TK6jbS0JI2n0itWRhVFJObDIY7nYEfUSh0T6g45SaraQ9f1rZIa2yoFTYoN2pIZ5fcOlPde2qx4/gRMtASU= Received: from DM6PR11CA0014.namprd11.prod.outlook.com (2603:10b6:5:190::27) by MN2PR12MB4157.namprd12.prod.outlook.com (2603:10b6:208:1db::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.17; Mon, 14 Nov 2022 23:40:48 +0000 Received: from DM6NAM11FT113.eop-nam11.prod.protection.outlook.com (2603:10b6:5:190:cafe::5a) by DM6PR11CA0014.outlook.office365.com (2603:10b6:5:190::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.17 via Frontend Transport; Mon, 14 Nov 2022 23:40:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT113.mail.protection.outlook.com (10.13.173.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5813.12 via Frontend Transport; Mon, 14 Nov 2022 23:40:47 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 14 Nov 2022 17:40:47 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 14 Nov 2022 17:40:47 -0600 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Mon, 14 Nov 2022 17:40:46 -0600 From: Tanmay Shah To: , , , , CC: , , , , , Ben Levinsky , "Tanmay Shah" Subject: [PATCH v11 4/6] firmware: xilinx: Add shutdown/wakeup APIs Date: Mon, 14 Nov 2022 15:39:38 -0800 Message-ID: <20221114233940.2096237-5-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221114233940.2096237-1-tanmay.shah@amd.com> References: <20221114233940.2096237-1-tanmay.shah@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT113:EE_|MN2PR12MB4157:EE_ X-MS-Office365-Filtering-Correlation-Id: 07cb2727-b87d-437a-24e7-08dac699a816 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W0mtyHTXK+uAno54RbvQi96C494M/x7MZGrje+olwf4a6wPbnz352RlgJnrXhywtEJhDMJbIo3ZkLRhX1O6K6iQn5O+D9Pz7LnbDz1ePbD+AhmIAbjCLa9q++D6tau9Dah8Q6r/1ByFsMcK6B7nFv0lsn/KfnwbWB0SA+q28HxWKbSyDQ2FjWXsj3K3+KGa1aoyAgIgW6jH1UmajZIGYYfly0MStnzda+wybFX/5/Rh0vRMl0A4O/ZwVfjn0cJHmdPtW9ISgbBakWdMvNpmYvwtS7wfSG/7pB7tte9Hiu4ZLlHa2foR2ezKvvIWN3r93bhP4hhGHflO5GWcIVUfx2MtxEHtob/cThjpEsgu7AD78GANYMUoIKHPn6ASAIt8HRUp1OU3bKRf0mR1gxjy24Gy+bfiqxu64jHC3Ni7oqXMD0w4UZyH+P5ELkKIYSomCVv/VjjAuracfBBHbFUCBqONnp6jJx0KbQKR8eSatyMxMWjG5q+VwqJy1TsJsyPPGpi+VAjbgvZyCC+H3RW9Efz6xPfmzvshSYl9t98YWFzafhR7//TdBETPlCN7eqdEOdMiWcZLofLb1cBLKBoURUjm3kM3wo5aqoRU/cGaoYkhXa2IwfwTy/c4l28FrrCEpW3/V1H4iyKp88JtcZFxnnQnS580QWDqIpGDLwIB+DBiW/3Wol7K2SsXBh8EaQNfkHKBtqx2rGoE/rj91nabJACt+nbPESY2lBQ8uQY8XJorC9Lc0k+vT6YHynjrtxHhG6JRhiVp8MsQDLRydmuFNje4WDdpiCEUF59Mx5JHqPZgk4QM1fOSzUJVAwVcRiH2B X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(346002)(136003)(396003)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(426003)(47076005)(40460700003)(83380400001)(82310400005)(36756003)(82740400003)(86362001)(81166007)(44832011)(8936002)(41300700001)(8676002)(4326008)(70586007)(70206006)(356005)(5660300002)(316002)(110136005)(54906003)(6636002)(26005)(2616005)(36860700001)(2906002)(186003)(1076003)(478600001)(6666004)(40480700001)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2022 23:40:47.7728 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07cb2727-b87d-437a-24e7-08dac699a816 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT113.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4157 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Ben Levinsky 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 Signed-off-by: Tanmay Shah --- Changes in v11: - Rebase on latest rproc-next branch and resolve merge conflicts Changes in v10: - None Changes in v9: - None Changes in v8: - None Changes in v7: - None Changes in v6: - None Changes in v5: - None Changes in v4: - None Changes in v3: - None 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 ff5cabe70a2b..1865e43ed7e7 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -1159,6 +1159,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 bdbf855b5eef..ad3f2bd0c470 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 #include @@ -87,6 +88,8 @@ enum pm_api_cb_id { enum pm_api_id { PM_GET_API_VERSION = 1, PM_REGISTER_NOTIFIER = 5, + PM_FORCE_POWERDOWN = 8, + PM_REQUEST_WAKEUP = 10, PM_SYSTEM_SHUTDOWN = 12, PM_REQUEST_NODE = 13, PM_RELEASE_NODE = 14, @@ -521,6 +524,12 @@ int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id); int zynqmp_pm_set_feature_config(enum pm_feature_config_id id, u32 value); int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, u32 *payload); int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset); +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); int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value); int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config, u32 value); @@ -795,6 +804,20 @@ static inline int zynqmp_pm_register_sgi(u32 sgi_num, u32 reset) 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; +} + static inline int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value)