Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp53788ybh; Fri, 6 Mar 2020 15:51:01 -0800 (PST) X-Google-Smtp-Source: ADFU+vvtnch5BpdKZCF5iPGf5zS2KxPkJypGHwjHKZsAKVzcE7CtXjBnZZl16I3QCN9pPA8d5OmJ X-Received: by 2002:a05:6830:22c5:: with SMTP id q5mr4544642otc.184.1583538661856; Fri, 06 Mar 2020 15:51:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1583538661; cv=pass; d=google.com; s=arc-20160816; b=ZVzYM2smJUXp6eHXsvXPF+4Kg00iTZ562MSix8MOWwMjrOQHtfasQEZV8DjB8iVZRA lwotiLhaZ2DQHKtIL7eh3UloNht5EG2lqp8r831kSiDcjVbgrtKwceh7nTxTlavqGPXX un+NJfvx4VzHj51IpeAveyXTcu1atABCbH+kFEu5nNyb9VipU9+N0Rcbe4n/RCdvY2fS xfHbqDrfWALz0JmjgJGUXz+D7yh+YBdyIBc3AyWpYh7sAmNk5+utgHZorHQPA6hgLTtm EaNDY8WFYluWP/NJsmZaoTX/AcORihg+5YOHAx3qE2IYBtViK1jJ+jTTKBpA8dGOIYFs sYuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=g0dJ8TYLdjOgrq0HqfeN6hjk+mNLBLnegGeUKLDMDrA=; b=UM/UMSmEAExq/BjzRK1MPhJEGSHyzl3/y+BOlsIKwy4i+lu4TcF+0yN1Ra5Y2UJZKU Mrxha2Q+D+w8QJuIL6jZ0XxfY4Qm+1YuHaWnH85WdCyTJ98+EyjNv4nbf/elS76eKu5Y TdrDmQIkmMfNEyT4DYuIQMsxyfQkEBEhPFjC7ZMRtG+nJ/gFbKT4qxsAY3U/C0rdPwFx rwXyIJ/PxNBkC/80ArQ6sRoqD1h2f4ZlSq3/eCflMDhY+kj7jJHTD+jw1TX58nmyk24J CzB1qowPjJohdJ1pHqdXoIbSoBqpkRIe2uKFBFI1cskdtOs3Cgon9nFESZ83KsL8AAZ/ Zy5Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=SJqHCgGM; arc=pass (i=1 spf=pass spfdomain=xilinx.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si3326765ots.280.2020.03.06.15.50.50; Fri, 06 Mar 2020 15:51:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=SJqHCgGM; arc=pass (i=1 spf=pass spfdomain=xilinx.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727575AbgCFXt2 (ORCPT + 99 others); Fri, 6 Mar 2020 18:49:28 -0500 Received: from mail-mw2nam12on2077.outbound.protection.outlook.com ([40.107.244.77]:34145 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727247AbgCFXsC (ORCPT ); Fri, 6 Mar 2020 18:48:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JCRIp0GH0BIB+/KmEvBOcEOpEByHUB4pPOPxQq25gOP0HDastXD9AgL7jGbzYwwOY8tP7cX+yLS9phqZ3XDaSnVRYKCfwXswPVUUOlKXUJzXVLfUjdXArSxPGdHFEbk6tsLjvAddlIytWLyO6cU8Lurig8D3tsAUjJXSxLHAP6X7UNq7iuKYw7SnQP/NPHT5iXBOtAVZCJ2e2bVKLIv/O9YCrq2LxO1SUC5T5qTYvKXS9x7UaY3/I28b8Lo0njqwFAfKivF1Q8m195+mQh34zmsgmufh4nWoFLr5AchbZM02FgjHlyvw3BK1GfslgWPO2oWmw7hK9mPaPqnhtAEyQg== 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=g0dJ8TYLdjOgrq0HqfeN6hjk+mNLBLnegGeUKLDMDrA=; b=ZtQnncQnQAYfq06YEli0uxMkxK59ijxraXn1xzuij1i3O4ws09rFVnA5gQk4JiId3Ebs7d54B89XIRZpXwaPRscJOgKB75MDr1tS5eawZ3ejLSWVby1Eh2OJcuu6w8HVignzATqIpOcJ+spfMO0wozHdjqHUu2Ldz7w4d+OQG2lZIQIDpSI5x3fE+wphL/JMr89bYEPK9G2cANSY6zPXcn7fQsWLUyY4JrIY6rFSaSDwPCuayMd4DlOfj9LZ83LfJMWlrJMP6fByczLU7yS0QB3h0MXcjLsx107JOe3Jgi86oKuHk3x6qDGXD+/dfPXxgerTcJz0hJ7A1ZqQSPLy8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.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=g0dJ8TYLdjOgrq0HqfeN6hjk+mNLBLnegGeUKLDMDrA=; b=SJqHCgGMe7HuBldRWO6OHlpLHiD1lmJvYa5BjUNp45AQlGIQz86Lx8X9IeliGskWV/Tx+l4z8EZ4H+BEMPdaiN4SsaNA22M5Cas0NwkpI7uCRj3oQzjftl6ObpwbtI5qv44aCsY+WqI0kiSMaxYLhM4y+3E5SNUVEdprH7xNkhY= Received: from SN6PR04CA0081.namprd04.prod.outlook.com (2603:10b6:805:f2::22) by BY5PR02MB6353.namprd02.prod.outlook.com (2603:10b6:a03:1fb::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.14; Fri, 6 Mar 2020 23:47:58 +0000 Received: from SN1NAM02FT032.eop-nam02.prod.protection.outlook.com (2603:10b6:805:f2:cafe::61) by SN6PR04CA0081.outlook.office365.com (2603:10b6:805:f2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.16 via Frontend Transport; Fri, 6 Mar 2020 23:47:58 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.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 SN1NAM02FT032.mail.protection.outlook.com (10.152.72.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2793.11 via Frontend Transport; Fri, 6 Mar 2020 23:47:57 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1jAMhB-0003Q2-3D; Fri, 06 Mar 2020 15:47:57 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1jAMh6-0002g8-05; Fri, 06 Mar 2020 15:47:52 -0800 Received: from xsj-pvapsmtp01 (smtp2.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 026Nlk8Y001017; Fri, 6 Mar 2020 15:47:47 -0800 Received: from [172.19.2.91] (helo=xsjjollys50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1jAMh0-0002eg-QA; Fri, 06 Mar 2020 15:47:46 -0800 From: Jolly Shah To: ard.biesheuvel@linaro.org, mingo@kernel.org, gregkh@linuxfoundation.org, matt@codeblueprint.co.uk, sudeep.holla@arm.com, hkallweit1@gmail.com, keescook@chromium.org, dmitry.torokhov@gmail.com, michal.simek@xilinx.com Cc: rajanv@xilinx.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rajan Vaja , Jolly Shah Subject: [PATCH v3 20/24] firmware: xilinx: Add APIs to read/write GGS/PGGS registers Date: Fri, 6 Mar 2020 15:47:28 -0800 Message-Id: <1583538452-1992-21-git-send-email-jolly.shah@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583538452-1992-1-git-send-email-jolly.shah@xilinx.com> References: <1583538452-1992-1-git-send-email-jolly.shah@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-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(376002)(136003)(396003)(346002)(39860400002)(199004)(189003)(426003)(2906002)(54906003)(26005)(81156014)(81166006)(8676002)(6636002)(7696005)(356004)(44832011)(186003)(336012)(2616005)(9786002)(8936002)(6666004)(107886003)(4326008)(70586007)(70206006)(5660300002)(316002)(36756003)(7416002)(478600001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY5PR02MB6353;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9ec6f9eb-8ee9-4c0e-c22d-08d7c228cc7a X-MS-TrafficTypeDiagnostic: BY5PR02MB6353: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:1091; X-Forefront-PRVS: 0334223192 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lEKYSlb6n4GksizgMHxqvonzDDt0KieQjmp/xczYNT7Uc/OHa7SW3aZCHVixtrwZ5Q5F1JqQ4tDZ27xkBCOclyfkJxICbdeLT/I8i4gLFfR+zkSJ39bxiSCD8t3dtTTOUxLd3OrVey8alN1ERcddwiBco0oX3lPYbwrsl/tJE78R902piMOyv3wHDxA8Q5k5aIvgC181OhVMtQLB+YdD1aMyBdEXRHWqgp7tsTF+O1dnS2IPIpqFM9lBYv0pSyUzoJw+3z2BtSC8jY612mn/CZdJMTa8nbkVDmKDxf/1WpFmAm5gr5/58AtSdsRydqpvgFlz+hUEov9kcDmkPZr9REf4cO1Oe5Eh6G6XH4Auxkvv2jWpB053tLmijHb7cb3qIkn5XfMpuaGqGig5MHGq2is95vYAUty073CIRGqV68sAi2ghjoCWUtdSY/WpB02p X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2020 23:47:57.9810 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ec6f9eb-8ee9-4c0e-c22d-08d7c228cc7a 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6353 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rajan Vaja Add APIs to read/write PGGS and GGS registers. Signed-off-by: Rajan Vaja Signed-off-by: Jolly Shah --- drivers/firmware/xilinx/zynqmp.c | 66 ++++++++++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 8 +++++ 2 files changed, 74 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 36d5a3e..de99613 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -601,6 +601,72 @@ int zynqmp_pm_set_sd_tapdelay(u32 node_id, u32 type, u32 value) EXPORT_SYMBOL_GPL(zynqmp_pm_set_sd_tapdelay); /** + * zynqmp_pm_write_ggs() - PM API for writing global general storage (ggs) + * @index GGS register index + * @value Register value to be written + * + * This function writes value to GGS register. + * + * @return Returns status, either success or error+reason + */ +int zynqmp_pm_write_ggs(u32 index, u32 value) +{ + return zynqmp_pm_invoke_fn(PM_IOCTL, 0, IOCTL_WRITE_GGS, + index, value, NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_write_ggs); + +/** + * zynqmp_pm_write_ggs() - PM API for reading global general storage (ggs) + * @index GGS register index + * @value Register value to be written + * + * This function returns GGS register value. + * + * @return Returns status, either success or error+reason + */ +int zynqmp_pm_read_ggs(u32 index, u32 *value) +{ + return zynqmp_pm_invoke_fn(PM_IOCTL, 0, IOCTL_READ_GGS, + index, 0, value); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_read_ggs); + +/** + * zynqmp_pm_write_pggs() - PM API for writing persistent global general + * storage (pggs) + * @index PGGS register index + * @value Register value to be written + * + * This function writes value to PGGS register. + * + * @return Returns status, either success or error+reason + */ +int zynqmp_pm_write_pggs(u32 index, u32 value) +{ + return zynqmp_pm_invoke_fn(PM_IOCTL, 0, IOCTL_WRITE_PGGS, index, value, + NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_write_pggs); + +/** + * zynqmp_pm_write_pggs() - PM API for reading persistent global general + * storage (pggs) + * @index PGGS register index + * @value Register value to be written + * + * This function returns PGGS register value. + * + * @return Returns status, either success or error+reason + */ +int zynqmp_pm_read_pggs(u32 index, u32 *value) +{ + return zynqmp_pm_invoke_fn(PM_IOCTL, 0, IOCTL_READ_PGGS, index, 0, + value); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_read_pggs); + +/** * zynqmp_pm_reset_assert - Request setting of reset (1 - assert, 0 - release) * @reset: Reset to be configured * @assert_flag: Flag stating should reset be asserted (1) or diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 1734d12..725dccf 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -105,6 +105,10 @@ enum pm_ioctl_id { IOCTL_GET_PLL_FRAC_MODE, IOCTL_SET_PLL_FRAC_DATA, IOCTL_GET_PLL_FRAC_DATA, + IOCTL_WRITE_GGS, + IOCTL_READ_GGS, + IOCTL_WRITE_PGGS, + IOCTL_READ_PGGS, }; enum pm_query_id { @@ -315,6 +319,10 @@ int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities, const enum zynqmp_pm_request_ack ack); int zynqmp_pm_fpga_load(const u64 address, const u32 size, const u32 flags); int zynqmp_pm_fpga_get_status(u32 *value); +int zynqmp_pm_write_ggs(u32 index, u32 value); +int zynqmp_pm_read_ggs(u32 index, u32 *value); +int zynqmp_pm_write_pggs(u32 index, u32 value); +int zynqmp_pm_read_pggs(u32 index, u32 *value); int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 *ret_payload); -- 2.7.4