From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3ABBC63798 for ; Sat, 14 Nov 2020 16:49:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DAAE22280 for ; Sat, 14 Nov 2020 16:49:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="XZ63pnE1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726734AbgKNQtb (ORCPT ); Sat, 14 Nov 2020 11:49:31 -0500 Received: from mail-dm6nam10on2053.outbound.protection.outlook.com ([40.107.93.53]:60600 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726481AbgKNQt3 (ORCPT ); Sat, 14 Nov 2020 11:49:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lc74seY36zrngGrv4pLyQyY5squRPzLlDwhRui/UaC1aoJhoSPet3UwdnUmbvyTBnHlPCoTybzpdHsFaRprDwZtPp5y2qcwXV1wRSnsTjnm+M+wYj1S0FeqlsV4ZBYIKEavmrI0Gm8VKN9tJWyyFXR/Gh/b6BHLLCAvZPB8iT9lPH96/F0DiHNpciCV5Tz9H90vktyeJfV0Zug9UD0Ttg/Z3mZSOYvA5U9gPOY0msnodAp38DPk+VMQMg4Q9wKIURHw53SVIT8nKc2h8Jx3agQgf2FMjjoz4w9k0z7uCwpD5HbKDinquGDzXTnr/CZDN8Qo1tYKNICH4b6dhAQMsaA== 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=VJ+f26VHd7qTVop0EtmJHM9Dm0melO76w6gQnDIAoCo=; b=jTCq60OeFuOC7srfyT7zOawIkcbX80oLX6ldIVyuzue+iaVB8mMBc43WGUq47JCY9WiITe7X5LuI8ETAow737fPKcGBYhxrnsupsjQA/nuV2Nt7mSv7/Hnvc8kqNP3qeu0DOQPtTfXGRRG6w15pXDoyc41K/UGoJW9jYKYS1grzf7AeEM/IulJnB8tIv7kHyWaZjfWVuvNGD/q0r9grJZHnD80EM4msnAcgaHD8c1vh07A27nZ+KYmg76ywVuXxugBt5foo/5bNXWd8E9O7YKBpIbNtl8Clif3NFtCrDLBNhPMuBKw/64Q1QsF0jPPAY+PnRMWjx0LNqSwEynCxZnw== 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=VJ+f26VHd7qTVop0EtmJHM9Dm0melO76w6gQnDIAoCo=; b=XZ63pnE12+JbUCcOUimFlO20C72ki9FvW6FYA9Sqcch31+dTn8SqHUKfJ/T/qF/xx1vKgjCVzbd047W4W5phoCGwfXL32VLPoQoFHVAYkxtqf44dyqy14IBcCpifTrurhdL3FazCGxK6uaaerk7QUUCkGswMtKsMryXggkpT6d8= Received: from SA9PR10CA0028.namprd10.prod.outlook.com (2603:10b6:806:a7::33) by BN6PR02MB3377.namprd02.prod.outlook.com (2603:10b6:405:6c::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.25; Sat, 14 Nov 2020 16:49:24 +0000 Received: from SN1NAM02FT009.eop-nam02.prod.protection.outlook.com (2603:10b6:806:a7:cafe::56) by SA9PR10CA0028.outlook.office365.com (2603:10b6:806:a7::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.25 via Frontend Transport; Sat, 14 Nov 2020 16:49:24 +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 SN1NAM02FT009.mail.protection.outlook.com (10.152.73.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3564.22 via Frontend Transport; Sat, 14 Nov 2020 16:49:23 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) 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; Sat, 14 Nov 2020 08:49:21 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Sat, 14 Nov 2020 08:49:21 -0800 Envelope-to: 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=38914 helo=xsjblevinsk50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1kdyjp-0007Ai-H4; Sat, 14 Nov 2020 08:49:21 -0800 From: Ben Levinsky To: CC: , , , Subject: [PATCH v23 2/5] firmware: xilinx: Add shutdown/wakeup APIs Date: Sat, 14 Nov 2020 08:49:18 -0800 Message-ID: <20201114164921.14573-3-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201114164921.14573-1-ben.levinsky@xilinx.com> References: <20201114164921.14573-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: ff687229-f09a-4359-a941-08d888bd3dc6 X-MS-TrafficTypeDiagnostic: BN6PR02MB3377: 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: YNbaH3u428Et6lM9QvDMvf905Z7hYTyUcGbnYHj2xprlrZRzuBy8Qn7/fDJOyFbCZQjLrfWEyxmQQegKXqobNwZCRK2XQfquKhjrT6iZsOFbQm1nCt2Bs38UQdqPW+Y2Nd/UMsLv3C1z+dKu6s0ddcAiBUEsgs8mM421BAXHm1bfa5c/c3swd+uFlH0YXZEUPyR2udkTmeUe+ytlnTTK2eBj4limwUXjvOqVQ7VjpHM9Gj2JWIxHbNuWT1pBNwstyGDvp9H8RVyq49xrtnD3h6vSfcBMXKs3VfBs4a6F13Ypc/QqCiQcDvct79k4/TAj227g+3K3WnIXE8ak7Bm73e+TcbzLKKnWsD2V6i7XLVdFsTfkCWFFg/fnGFmDAXxhV9+AAumQbV4A2Sc9uc3mqZvU+5dHOH657iL738db2GQ= 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)(396003)(136003)(376002)(39850400004)(346002)(46966005)(9786002)(44832011)(7696005)(336012)(1076003)(478600001)(8936002)(83380400001)(36906005)(54906003)(186003)(6916009)(2906002)(26005)(8676002)(70586007)(316002)(70206006)(2616005)(426003)(6666004)(7636003)(5660300002)(4326008)(356005)(47076004)(36756003)(82740400003)(82310400003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2020 16:49:23.8731 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff687229-f09a-4359-a941-08d888bd3dc6 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: SN1NAM02FT009.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB3377 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 0dd2d188f8aa..0cc862b26263 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 078B7C5519F for ; Sat, 14 Nov 2020 16:51:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A171520719 for ; Sat, 14 Nov 2020 16:51:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oFS9V8pm"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="XZ63pnE1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A171520719 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/cenzpwnyLZSqCa3ihKucc7bnHwd9P4hnbY9GA1bqsg=; b=oFS9V8pmvHZw9VBwy9S7US+JQ zIB/DoL847ZvL1PGLurSmMgqbeSA0vq52c4scWvk4j+8ltJCwvkptqiwfsp6I8xjXndmwPaegUyNn SandCO0K70XfGPBcwJoSKPzMVOaDxHVT+f/6W9bk4HSMrx67DRePwRT6HA3tfIq3zPixLGznix/P9 bOFbVlGe0cvYDj1oAjktof/5OEXwJYbtKNAUI4U7BgMD62C/TDrO24KCQFgE/M7dgvAW5HOvLNVzm +OlCbuzjhR3f2JfYr+pSgfeSX9fj3yoJCqvBHbMY0v/onDm2D6XjxVMmlGMbcBLd8E8D5SZf4Y1u1 PLMPDXIpg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdyk9-0001Ck-KS; Sat, 14 Nov 2020 16:49:41 +0000 Received: from mail-dm6nam10on2057.outbound.protection.outlook.com ([40.107.93.57] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdyjy-0001Af-2H for linux-arm-kernel@lists.infradead.org; Sat, 14 Nov 2020 16:49:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lc74seY36zrngGrv4pLyQyY5squRPzLlDwhRui/UaC1aoJhoSPet3UwdnUmbvyTBnHlPCoTybzpdHsFaRprDwZtPp5y2qcwXV1wRSnsTjnm+M+wYj1S0FeqlsV4ZBYIKEavmrI0Gm8VKN9tJWyyFXR/Gh/b6BHLLCAvZPB8iT9lPH96/F0DiHNpciCV5Tz9H90vktyeJfV0Zug9UD0Ttg/Z3mZSOYvA5U9gPOY0msnodAp38DPk+VMQMg4Q9wKIURHw53SVIT8nKc2h8Jx3agQgf2FMjjoz4w9k0z7uCwpD5HbKDinquGDzXTnr/CZDN8Qo1tYKNICH4b6dhAQMsaA== 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=VJ+f26VHd7qTVop0EtmJHM9Dm0melO76w6gQnDIAoCo=; b=jTCq60OeFuOC7srfyT7zOawIkcbX80oLX6ldIVyuzue+iaVB8mMBc43WGUq47JCY9WiITe7X5LuI8ETAow737fPKcGBYhxrnsupsjQA/nuV2Nt7mSv7/Hnvc8kqNP3qeu0DOQPtTfXGRRG6w15pXDoyc41K/UGoJW9jYKYS1grzf7AeEM/IulJnB8tIv7kHyWaZjfWVuvNGD/q0r9grJZHnD80EM4msnAcgaHD8c1vh07A27nZ+KYmg76ywVuXxugBt5foo/5bNXWd8E9O7YKBpIbNtl8Clif3NFtCrDLBNhPMuBKw/64Q1QsF0jPPAY+PnRMWjx0LNqSwEynCxZnw== 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=VJ+f26VHd7qTVop0EtmJHM9Dm0melO76w6gQnDIAoCo=; b=XZ63pnE12+JbUCcOUimFlO20C72ki9FvW6FYA9Sqcch31+dTn8SqHUKfJ/T/qF/xx1vKgjCVzbd047W4W5phoCGwfXL32VLPoQoFHVAYkxtqf44dyqy14IBcCpifTrurhdL3FazCGxK6uaaerk7QUUCkGswMtKsMryXggkpT6d8= Received: from SA9PR10CA0028.namprd10.prod.outlook.com (2603:10b6:806:a7::33) by BN6PR02MB3377.namprd02.prod.outlook.com (2603:10b6:405:6c::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.25; Sat, 14 Nov 2020 16:49:24 +0000 Received: from SN1NAM02FT009.eop-nam02.prod.protection.outlook.com (2603:10b6:806:a7:cafe::56) by SA9PR10CA0028.outlook.office365.com (2603:10b6:806:a7::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.25 via Frontend Transport; Sat, 14 Nov 2020 16:49:24 +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 SN1NAM02FT009.mail.protection.outlook.com (10.152.73.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3564.22 via Frontend Transport; Sat, 14 Nov 2020 16:49:23 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) 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; Sat, 14 Nov 2020 08:49:21 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Sat, 14 Nov 2020 08:49:21 -0800 Received: from [172.19.2.206] (port=38914 helo=xsjblevinsk50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1kdyjp-0007Ai-H4; Sat, 14 Nov 2020 08:49:21 -0800 From: Ben Levinsky To: Subject: [PATCH v23 2/5] firmware: xilinx: Add shutdown/wakeup APIs Date: Sat, 14 Nov 2020 08:49:18 -0800 Message-ID: <20201114164921.14573-3-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201114164921.14573-1-ben.levinsky@xilinx.com> References: <20201114164921.14573-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: ff687229-f09a-4359-a941-08d888bd3dc6 X-MS-TrafficTypeDiagnostic: BN6PR02MB3377: 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: YNbaH3u428Et6lM9QvDMvf905Z7hYTyUcGbnYHj2xprlrZRzuBy8Qn7/fDJOyFbCZQjLrfWEyxmQQegKXqobNwZCRK2XQfquKhjrT6iZsOFbQm1nCt2Bs38UQdqPW+Y2Nd/UMsLv3C1z+dKu6s0ddcAiBUEsgs8mM421BAXHm1bfa5c/c3swd+uFlH0YXZEUPyR2udkTmeUe+ytlnTTK2eBj4limwUXjvOqVQ7VjpHM9Gj2JWIxHbNuWT1pBNwstyGDvp9H8RVyq49xrtnD3h6vSfcBMXKs3VfBs4a6F13Ypc/QqCiQcDvct79k4/TAj227g+3K3WnIXE8ak7Bm73e+TcbzLKKnWsD2V6i7XLVdFsTfkCWFFg/fnGFmDAXxhV9+AAumQbV4A2Sc9uc3mqZvU+5dHOH657iL738db2GQ= 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)(396003)(136003)(376002)(39850400004)(346002)(46966005)(9786002)(44832011)(7696005)(336012)(1076003)(478600001)(8936002)(83380400001)(36906005)(54906003)(186003)(6916009)(2906002)(26005)(8676002)(70586007)(316002)(70206006)(2616005)(426003)(6666004)(7636003)(5660300002)(4326008)(356005)(47076004)(36756003)(82740400003)(82310400003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2020 16:49:23.8731 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff687229-f09a-4359-a941-08d888bd3dc6 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: SN1NAM02FT009.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB3377 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201114_114930_246783_B33AA5F7 X-CRM114-Status: GOOD ( 13.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 0dd2d188f8aa..0cc862b26263 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel