Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1614373pxx; Fri, 30 Oct 2020 14:31:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkFDB9tDfQdXJOhhCuw/on9Ua9hEqpY/ua65y5GMPZsNn5y/jeBuvPQN6EPIKT7JLp9a4Y X-Received: by 2002:a17:906:7f0d:: with SMTP id d13mr4238179ejr.299.1604093489938; Fri, 30 Oct 2020 14:31:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1604093489; cv=pass; d=google.com; s=arc-20160816; b=DvSGChTcfQnvaLtDgDqG6QYYM45UjeTBREquMfoVcxjUbMLN7la09SwwosTO2oLH0O ETk87yvHGyNHLFksh+mtL1IrrK7VFlwDWyEqNVeGlNLCqif4XbdRrqYib5/kNWLL4BQF 4fZ4iIeSvCxyQ6JabLWZOh0XFiVIXEB+JlYylG0Bu15B2M45VJHsS0pZj/YCABixxerj Oz3K19iTXI6sWmgD3NdeuG8oOb68i5NINreoYTvIblJyTlq02M4+RdrfLKD/SyrbOvUT u4idXZAHfez2rzZ/Jy2FXIC6OxySDx1qxzwFeQ132qNKDxusM+DUMjvc15XR0plk6yE/ xJmQ== 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=yvj/lkr1NeFpW96h7I8rBBF1Fco7AUaEqsAkifx19DA=; b=e9JYoQE0o0day6Dfo/m3CXDT3W3oUU9Q1F5CpJGJ2fkvd1SULtIN2DQuBZnDMIT8s4 2tkLCcQKtbCOtf04ZgNwObNniuxqJgm6HwjMU7glXmD9gBa1/CEhw70HQvwky3dmJnFu O3w+59mxf/QIg2TFcE2fHlsSuT0ZoOVxwkESwQlk6iex3n216hEL/z92xpOv8x1ONHsO P7xU53wwPA88+ntwhr/+mLDSMWlNP/dvQAoxTsAn7kHmLrGhaORnCciOmoBKseLMvltX hYl45JJFRddVIVV5FKDIVia9oxAtaQ5hIu9VT5zPwi5BYboFnHVMDLJOXGpUCxEvrOwa 2oxg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=KzvlPM5r; 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 e24si5126472edv.597.2020.10.30.14.31.07; Fri, 30 Oct 2020 14:31:29 -0700 (PDT) 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=KzvlPM5r; 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 S1727865AbgJ3V2o (ORCPT + 99 others); Fri, 30 Oct 2020 17:28:44 -0400 Received: from mail-bn7nam10on2051.outbound.protection.outlook.com ([40.107.92.51]:17569 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727553AbgJ3V2k (ORCPT ); Fri, 30 Oct 2020 17:28:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R3WaUd7G0ucjoay8XbYWB/v/dao8c2KSwxXacgs2srSdXGwiXjwnyFJBuH8ZJSS3M1JJmVBu1iVdxLRl/fDPSaTTTaT4TtH6heptstis/du0ukU6KZuVY2c86TVKOJDLWUDAJDOocXgeEeCzg93HkNwWxlQDEsHOBidvnCzVkQJwHuJOxBlC8EsCvJCbm+0SG6OaFRgK3Zim7ofxnPr0wb6D0lBNqtMflBaLud3xW/23/AtwGX1QNlYz1IMyVLrYYtP4i6p3RW7jijuk3yH/GjR1Sen8T1hJtA5IoeIG80Zv2PYwdjUSOpWJmxjYpbSUSyIV69VjJ7dUFf83uClKAw== 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=HVo0WSZcCHbgO2PGEKWUr7Ehg9nOh5CTzjXlFx8mCbMduOsfQ55e5j7RieYP5ixliQRLIpTuYPZ3cNE2jnwUc3qqb52YWIADCbZG4Bwm/65my2mFRRVqcyPj2fL7vejtdnj6Jd+4XlPNSXgwxIZv7YD3rB19Ai2/9kGBlsJoNMLRWfddZh/mriENJXZDXagtXFmsY1Gt0gyZVW6xkSHkn43oJLRZEzayhx/TYTvFY+juK2qqisdvqXTppROyvCFOXCw8Q9XyLbe4NyTnBYNcZItz3oIsvy7IEXBak42OGI3jZc2uFT8Xg45EAKA9UtG91RQnfXlzhALSPcWje8VoNA== 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=yvj/lkr1NeFpW96h7I8rBBF1Fco7AUaEqsAkifx19DA=; b=KzvlPM5riiGmPRR8xFFiPTu4r7oULVGLyCOV0yLMKXwPYM27+ErMS1mn90sa083qN4wAZV7qZW6S32T4KJaDcOlGDZLeXODRNh6zSDe7GkfLUOfiDTUwDTS5n+wanJo7pWdz6yz/C6yOX0T/OJZPUe0TVKPiu/pXcAmKji5IvAU= Received: from SN4PR0701CA0032.namprd07.prod.outlook.com (2603:10b6:803:2d::12) by BL0PR02MB4915.namprd02.prod.outlook.com (2603:10b6:208:5a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Fri, 30 Oct 2020 21:28:37 +0000 Received: from SN1NAM02FT064.eop-nam02.prod.protection.outlook.com (2603:10b6:803:2d:cafe::28) by SN4PR0701CA0032.outlook.office365.com (2603:10b6:803:2d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Fri, 30 Oct 2020 21:28:36 +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-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT064.mail.protection.outlook.com (10.152.72.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3499.20 via Frontend Transport; Fri, 30 Oct 2020 21:28:36 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 30 Oct 2020 14:28:34 -0700 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; Fri, 30 Oct 2020 14:28:34 -0700 Envelope-to: stefanos@xilinx.com, mathieu.poirier@linaro.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org Received: from [172.19.2.206] (port=56470 helo=xsjblevinsk50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1kYbwo-0003JM-E3; Fri, 30 Oct 2020 14:28:34 -0700 From: Ben Levinsky To: , CC: , , , , Subject: [PATCH v20 2/5] firmware: xilinx: Add shutdown/wakeup APIs Date: Fri, 30 Oct 2020 14:28:31 -0700 Message-ID: <20201030212834.18270-3-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201030212834.18270-1-ben.levinsky@xilinx.com> References: <20201030212834.18270-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: 98818510-79e9-4011-4986-08d87d1ac302 X-MS-TrafficTypeDiagnostic: BL0PR02MB4915: 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: 8AdSURafcmMQLV/ROdqJKA9P3BQ1fPmBuaXCshQiBAsD49R+groru2TDGu+RFTKtPBg6gHERIqEITeOwWXo3JAQ85xTVL1Sazyy7aagebGLeuevcZa4j+XRnr13Ro48SapH1fKJGSN7xw8/2xjkkHCr7GlMcgX5/PvDDj2na9QqxZ42pSHSyHrShDb32oaTAsx2JiXy85KaCSTmtLXXHVGKH6D8WS1JQYivGVH37NGPSPlCZoyyE8rId7cKfz3kAe8GkpKinL87X8wmS1YgOdXlI/SJvrKXq3FHE2QGuF5JpZz2baKSfCdcvKGro1J73dZ2RZhnZLc2f4qAOWrFXllihOid2gLREg12rUMmG6jkVuh/beG0gNtchDXPcsoBpz/A/HniGAV0DXPXlcOiJj66r98iXvK5iQWaFIZ3hvrg= X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(4636009)(396003)(346002)(136003)(376002)(39860400002)(46966005)(110136005)(44832011)(336012)(426003)(478600001)(8936002)(7636003)(36906005)(186003)(82310400003)(47076004)(83380400001)(70206006)(70586007)(36756003)(2906002)(356005)(2616005)(54906003)(9786002)(1076003)(7696005)(82740400003)(316002)(4326008)(8676002)(5660300002)(26005)(6666004)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2020 21:28:36.6454 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 98818510-79e9-4011-4986-08d87d1ac302 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-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT064.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4915 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 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__ */ -- 2.17.1