Received: by 10.223.176.46 with SMTP id f43csp1362239wra; Wed, 24 Jan 2018 15:23:34 -0800 (PST) X-Google-Smtp-Source: AH8x224b/Tknwgmd3y5h9xzLfcsU2Ls3rUxkr68o2oqXcfyT7Ija0j0ftIU1t8Qkor9o3HZfZ1W6 X-Received: by 10.101.68.199 with SMTP id g7mr11764737pgs.21.1516836214163; Wed, 24 Jan 2018 15:23:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516836214; cv=none; d=google.com; s=arc-20160816; b=blIq1VIic6mkdt0XQS1uvgU5ThDflFAz7WuN1yGSZABR2Tq6+pq//r/729a7YZaKgl 6fCCltd2eOkyY7V1ZBdGRl75y9vrGT9BTWTyHujh3WgY2S8/wWu4W06V/GBYJEs5Cswq byQ48fr838deGRYjN2ODtvVT8rpud3ToQSrMicjgnYfS6nHR5T/4GcrfQCJ+wP8GOR3E 9+AqRGR+lO02sXZLOxeOxfOX8/IbEs71xCcYJSG21TKfYD42jqby8XrN1aGLcK1ynHG7 ARCF6TQ/gEtb5hTYgOedM0Us54NkjrzIXUfkDXcGfKxvFwYK7Lr9ggVCopb1s1iQCSLN T4mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=2kbSlfr64I06xGHRQdN/vcmst19AzJKsGgC5zFLbcos=; b=Ag0TtIZhdWJ5gtO2+40w/4xkL+iUf5t3tQHy1Oof9rCpzUh+HK6xnYtAAb4bH+miAG CTA6KAuYZYedYN5HFDtlbWO7EDe6Un3uik5EVHleeU0TkdwBVPgaIJ6JP62rxAC15aip A6xm3RL6jOgLKHZanmXeSA1hpWDbGnAOjgENHilqKljBtjxDUlA/bdbgJMT/oiXBb1cj H5scKeaKytqXLhosv56mgvzljlnYDCFoKLssKvB5nJP79Nl8QFxosSTS2FNKPSe+wxkS 7tRfBthHnfn2fh5ThiB8BLjrUTYAKqa2XJYHnn9qqZvhiTwPruU1rRySKqa7dvuIh4ke kD+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=rbaz5EkL; 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 g12-v6si892244pla.643.2018.01.24.15.23.20; Wed, 24 Jan 2018 15:23:34 -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=selector1-xilinx-com header.b=rbaz5EkL; 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 S933293AbeAXXWc (ORCPT + 99 others); Wed, 24 Jan 2018 18:22:32 -0500 Received: from mail-sn1nam02on0049.outbound.protection.outlook.com ([104.47.36.49]:57037 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932902AbeAXXVx (ORCPT ); Wed, 24 Jan 2018 18:21:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=2kbSlfr64I06xGHRQdN/vcmst19AzJKsGgC5zFLbcos=; b=rbaz5EkLpDThoOMRpzla/Acu0MUR8OSmdgXGk8d8sUE6FHirHUlqHEHWs9eux8vkwfObgjzLgCZOKe8btOezVGuNqKM9CTX9eoYpbjVMqDlPevKkTLkritxCqjTGuXt1ha5Zh8EaMNc+EwlWMz7haTbMI58Qb+nFtzOdrHvCGEA= Received: from CY4PR02CA0025.namprd02.prod.outlook.com (10.175.57.139) by SN1PR02MB1343.namprd02.prod.outlook.com (10.162.0.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Wed, 24 Jan 2018 23:21:49 +0000 Received: from SN1NAM02FT011.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::202) by CY4PR02CA0025.outlook.office365.com (2603:10b6:903:117::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.444.14 via Frontend Transport; Wed, 24 Jan 2018 23:21:49 +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 SN1NAM02FT011.mail.protection.outlook.com (10.152.72.82) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.444.13 via Frontend Transport; Wed, 24 Jan 2018 23:21:43 +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 1eeUMQ-0001tY-T7; Wed, 24 Jan 2018 15:21:42 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1eeUMQ-0001C0-QW; Wed, 24 Jan 2018 15:21:42 -0800 Received: from xsj-pvapsmtp01 (xsj-mail.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w0ONLbFY020798; Wed, 24 Jan 2018 15:21:37 -0800 Received: from [172.19.2.91] (helo=xsjjollys50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eeUML-0001B7-4F; Wed, 24 Jan 2018 15:21:37 -0800 From: Jolly Shah To: , , , , , , , , , , CC: , , , Jolly Shah , Rajan Vaja Subject: [PATCH v3 3/4] drivers: firmware: xilinx: Add sysfs interface Date: Wed, 24 Jan 2018 15:21:13 -0800 Message-ID: <1516836074-4149-4-git-send-email-jollys@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516836074-4149-1-git-send-email-jollys@xilinx.com> References: <1516836074-4149-1-git-send-email-jollys@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23616.006 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:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(346002)(376002)(39380400002)(396003)(2980300002)(438002)(50944005)(189003)(199004)(81156014)(50226002)(107886003)(106466001)(8936002)(356003)(4326008)(39060400002)(478600001)(305945005)(72206003)(9786002)(81166006)(8676002)(186003)(7416002)(47776003)(63266004)(48376002)(26005)(50466002)(2950100002)(59450400001)(336011)(36386004)(77096007)(2906002)(76176011)(7696005)(51416003)(6666003)(106002)(2201001)(16586007)(54906003)(110136005)(5660300001)(316002)(36756003)(921003)(107986001)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR02MB1343;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;SN1NAM02FT011;1:2h7QfIzKv4GD/YXTVZ++THxF1dC4SwDZfTlbYcNgXXfawTQO0K6c7Sya8pKho6TsUKCdCh0M7LB8YjEwykDhw1XmB4tu6eKfjO+qNkvj892mog55wX7RgIqSahzi3PFh MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c555f81-3be5-44f4-e6b6-08d563813e00 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060);SRVR:SN1PR02MB1343; X-Microsoft-Exchange-Diagnostics: 1;SN1PR02MB1343;3:6Uqa/nhlH0cnGeTQ6KpsZRdPc0hIFyb93pJaR92JUUm0RdqrMi3Be2PF2pCt7UzY0jlrJ3U6k6wedzQQRpc0WaUEzNrLe+sYy80D6SajD0+Md7v3UUGgMEfdwOruSTdm9uJxHHIah1HZHq/S1Y7Ft6XLgCtpp/p/JaN1wV2EEmIfLMOH60yStPGd1CFkf2vRZ/oRGGvmMNoV+1jS7t/4PcU0Fnwb45VK7no4PJe103Gh+S/bX1LkNGyE+MVokWhdeAiy8VSh6MwDzb1I1+ZZA+nl75pWs8QTNKRrQw4vhlhJDjMBUi162/W0Kj/8z0hYdi06+iL+Y/3ivFvJMkZ0aAEYorNnPJOfkKieTFnIFFo=;25:buK/pp2nLwogDDKRJk7GmwK3aWsf43MGfSI6VSk08Vwkh2D3IGa2mXYYf6xC9ULPFUYM9uR5OUJ/XZZnPsUQx39GBbCXMoNGAmV0411XQZpdumh26UwRkZPcc+N7vMeZH5e8agZTiymdxYBX1SEWBEQ+xU/60qyeZI3wUw0LYeDexZPbPTYpmorTRS6M5ZYL02K5dhHLhH5/cIxT9TRQl6drELd54gXkxtxsxQmGSz+kwYgOsCTRpfxIA4GAcUykr8D8fS2p7rUDxiPd2eEjBMQxFypQK/kjztc0q2lZ17dAJS7n4gEqsU+OHCTcQ+gKFMj6qv0jfbP3E/fIXAvXMonNyb2NqzTjXamHHnX7YLI= X-MS-TrafficTypeDiagnostic: SN1PR02MB1343: X-Microsoft-Exchange-Diagnostics: 1;SN1PR02MB1343;31:u2+c5JoeZS5XPjPfbikTnT3gwUzkajhg/CuD/NeauCGOV13kLuIRqW/eql9Wzcj/4l1hijhoucw5bSDr8WSFkXBPKv9rJp3hyVxRE3eMNxeOo4ZKHOXgcOLOg6ZA6abrcCmryZsmvtb3mRYks33pQK4CBp6BXupzzUJDxUW0puFNysfcKy8eAVP0xRDoRBzZJcMwHIiBAyYQk9C1v7hn6MdfY6M19MvcKiFr7jU6VOA=;20:FW/Y2P8k6LxTVMg3rz5neTjX4KdS5U4upMIbCw7lqc9C9DyHWkmyW5piDgHtP9YD9nebtQSk8Of1+E7vo4ExRy+GqVcKIFDbL1eZd73ZBft2xYsfuo+g6YwsjGTe3WOtxDjA1xibGbFbjkXcMYXrQc2t1FeKo7UxRUFKLOY30r01wQlGZsv75ZIT+eCLhrXjCgtl/p4sHQWwc2XbLdvpogJu47EVv6zFXEtKymWQ6LoPmy1st6BXcoWlgpfU5biwQOaWmMDcLqFmT8BvCa9GTdiFmx0X3ffDPJdncOirmCN4mWWXuikfGmiaPd++F7NXoLzoN8UIn03nIHRcYPO+AhHyLUaozfc1r+dGYApD64adhsZ9wv0K3kWtOr2sWxBbGkV8I+qCNDRUSilRMgfAYFFn0ozdB0CnMhWzJMN+zy2aSD7hrj6k7NZ/Gh/Y3bZGRTcb8QvRENTG9seYH0/BAp0hwFBrtey6Nkna0H/l7ErBJ9XboBwJAMVjdEO7Cgs+ X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(3231023)(2400081)(944501161)(93006095)(93004095)(3002001)(6055026)(6041288)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123564045)(6072148)(201708071742011);SRVR:SN1PR02MB1343;BCL:0;PCL:0;RULEID:;SRVR:SN1PR02MB1343; X-Microsoft-Exchange-Diagnostics: 1;SN1PR02MB1343;4:cv70uDJH9a/i5UfTTg5wzUViP2yOnEVH8qvGPxEW392ldjDzmtp63RVbC/WM7TtP4zKlCncam0UhZOsuESlXzVAynSbYZY60plxkktmWB7/VDuViLIslTi2wLioU5QOof8XmgeObaFIcaPRzM/1cfLS1RSfjXSlYDhsYVBzWoqrnZcTpRqBqsJn5N6eVAKHtKv/oBsqxFJVmDRWNlIbp8iPfqrnPM0bc45x6Oi9JcyehyURoY+/QxUIG9lyVcKDmdivfO65gdaAsDgnk5dli45hciHm+bT7LMsz8ATRnAcMwcyy9ysETEJJfY7oUgWGW X-Forefront-PRVS: 056297E276 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR02MB1343;23:WOWvEQlbEXB4QOTURunOYTbLgfgxSrK/JSzIuSKR5?= =?us-ascii?Q?DF9b/7hyJRb6t2392hMwa6JBBeyV4REzdUAT45wLSa6PmI5CncYNe3F/1CND?= =?us-ascii?Q?M9LnxHUI6XsYu8FJ0lPV2cEywaH4aytR5r7YuU/ihBjvA8I70wbdC12KSflL?= =?us-ascii?Q?a7mS+X2/ZVO9p70l7kSaRkQrM26u4HZCr9Qy1PrpgbJUI0Q5DmO668uLSycE?= =?us-ascii?Q?ylhAohDBYwXakUEid7cM+G0jFzzL1L1IfFVw6YpH/uULoQYfXi2Nr0ccb1rI?= =?us-ascii?Q?L/q/B//ylC7a+Wax32bnP9kk3i/NNVnDXpnzct6rfs7TcFfFlKvYlLQ2JaYV?= =?us-ascii?Q?3vWGk5upIQ9CzwHnzFV8rKu3bJeeQu5JBxQRH5BdG4u0eY9ZG7F5AfnQoQ6g?= =?us-ascii?Q?+FEniCp2Ve+42rdlrDCGMnDcs8kKAGsX1P6/zsoXNJS8IINElylJqZr/ava0?= =?us-ascii?Q?60uTZPHN6G5NqHii9KNQ691cWtpbtKoZeL1gBS+hjbA6GxJR7nuCWS7PzDl0?= =?us-ascii?Q?p/V/h/manTniGuTwFxfsN2EazRrwILx+C4A5682MGidf2icY8bI+U0iffpb0?= =?us-ascii?Q?LNd3QKZ0V25vzwOGBhtyeJJrG74rtmlgazERKsSgz/9Hcr4EIEw0/tZ28tv7?= =?us-ascii?Q?vuOcySqGPLcXqgWIy149eUVlkj8mQIRciB8GQsw8UFrwTIVFjk3RAffYpKAG?= =?us-ascii?Q?zXxLd2l5nWWL9kct7MX/JSo/6i2cIXPWX17fLmfoX56yJfL/YbG4NvZ/ND3h?= =?us-ascii?Q?FOHAgTqUEykxbUYNCchu2DA98ybVVtTa74uZYL82OpykaqHgF9v+x2rGjlBO?= =?us-ascii?Q?HQX2BjQF5Kgi3GKHnVSUwj92EY7Bi4lGxv5RPQ35X9BuGc8wceSdDXCfzWaA?= =?us-ascii?Q?JPGRQfCXEbu3Gy4iRAik3jxs8y0j+pLuPmSxpkl13DivL+mCvwl5y7N7XqbM?= =?us-ascii?Q?QLJqBpoBlJ+GefrtFS9qU2gRMprUTRsuPHNFMzCwhsXViKNN3zRVdwIZcEcq?= =?us-ascii?Q?p64P2on+8pue1Mx3fTwCB+RAjOfPnJMZmVVwLVaXueAzRh8/z0rwOy9VciWx?= =?us-ascii?Q?VtVeagdXunpAHe6XZVopWR0zLNQVnyYtjTffjN0eVHB8Jf2BnZoudR/3gKJV?= =?us-ascii?Q?Hzoe7yiEPX/mpxn/umo8e8PiGNXlzksw9IRMeX0JUV0HOvs26RMgsrt4ZeKz?= =?us-ascii?Q?Xqo1ztYAjiTCco=3D?= X-Microsoft-Exchange-Diagnostics: 1;SN1PR02MB1343;6:FSdplqm66pJsn1oBhYF5P/qIS8Tkdwla3ZRZBN7MdXRHer9pIrkbELj+pk2/sckUA6mEBJK4Cfa2CWsDjlQ9/Emy2TX5lnIOiXZX4T7hDSm1Q3Y3N//caaSPRCf5AXhw6/m4zn9plVjDXXbRdP2CACD/uOrunby5PTwSpiCkoV4TPfNpo3aAmfT5hP8tZ5POj0Mn4LNsVmKjffAyDdofqXSzSDReVgIy0IGnAu8zx4Ea8UurQA9MNGnyXatmfmN5W2KM0svWdtgOHb7DAxar7OzTNaWFlcUgDjxJ/OSZUOYKtcSd7LM8nBKFNaEesqiYHczEte1oIk6MIDa4ZMX8AR3Esa+59Wo4YBLKIXM8QeE=;5:gSad/tztz/H+EmwlBumuoqeYzeWvhjPVShzOlWCFrVm7+JtLCD9xhnKKVozOyrtkMdRZMiV5Gd7YoVtJPB2bweL60tI00ndctel62YFG2AD3Zxzgr0fCaGf+hwHvBeqdkXgc8ze7bSpf9HDb3RsOp5nctY7cIgwjJQFLs0GjEio=;24:gj8e1nQQX4X1sfCcwPAjNbJJlvapkV1Whx0usLzUliJVLEBryC2EN+9WZ6T0EcOctNDTR9+t4blVKuUZgD0ngxc4BkX6xq0s6aIaRps6Y0M=;7:uIOAcuOgEe9N1Qcqmhkzrd7Lor7Y0fktsKw2R+74zfKdO6a2JLpDhMztry1YPIzySzhKfjpAaJSyM5MGqFXOP0tGJnHtzStvvqDxONUhniilay5yEFuyi8oKSaJYqRzrDlOmv/ZobVMrvth1QwvcuHTTFqahspkZl7sCV1V3HgWWqBvew6xFnxh6hwla2v4R20DWW8d3esuCooDmdTBQBuMZk4K5VPpOZ6x5PjYyWsLhSnv8GR92HUv8dYhPPmME SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2018 23:21:43.6532 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c555f81-3be5-44f4-e6b6-08d563813e00 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: SN1PR02MB1343 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add Firmware-ggs sysfs interface which provides read/write interface to global storage registers. Signed-off-by: Jolly Shah Signed-off-by: Rajan Vaja --- .../ABI/stable/sysfs-driver-zynqmp-firmware | 50 ++++ drivers/firmware/xilinx/zynqmp/Makefile | 2 +- drivers/firmware/xilinx/zynqmp/firmware-ggs.c | 297 +++++++++++++++++++++ drivers/firmware/xilinx/zynqmp/firmware.c | 31 +++ include/linux/firmware/xilinx/zynqmp/firmware.h | 2 + 5 files changed, 381 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/stable/sysfs-driver-zynqmp-firmware create mode 100644 drivers/firmware/xilinx/zynqmp/firmware-ggs.c diff --git a/Documentation/ABI/stable/sysfs-driver-zynqmp-firmware b/Documentation/ABI/stable/sysfs-driver-zynqmp-firmware new file mode 100644 index 0000000..b04727a --- /dev/null +++ b/Documentation/ABI/stable/sysfs-driver-zynqmp-firmware @@ -0,0 +1,50 @@ +What: /sys/devices/platform/zynqmp-firmware/ggs* +Date: January 2018 +KernelVersion: 4.15.0 +Contact: "Jolly Shah" +Description: + Read/Write PMU global general storage register value, + GLOBAL_GEN_STORAGE{0:3}. + Global general storage register that can be used + by system to pass information between masters. + + The register is reset during system or power-on + resets. Three registers are used by the FSBL and + other Xilinx software products: GLOBAL_GEN_STORAGE{4:6}. + + Usage: + # cat /sys/.../zynqmp-firmware/ggs0 + # echo > /sys/.../zynqmp-firmware/ggs0 + + Example: + # cat /sys/.../zynqmp-firmware/ggs0 + # echo 0xFFFFFFFF 0x1234ABCD > /sys/.../zynqmp-firmware/ggs0 + +Users: Xilinx + +What: /sys/devices/platform/zynqmp-firmware/pggs* +Date: January 2018 +KernelVersion: 4.15.0 +Contact: "Jolly Shah" +Description: + Read/Write PMU persistent global general storage register + value, PERS_GLOB_GEN_STORAGE{0:3}. + Persistent global general storage register that + can be used by system to pass information between + masters. + + This register is only reset by the power-on reset + and maintains its value through a system reset. + Four registers are used by the FSBL and other Xilinx + software products: PERS_GLOB_GEN_STORAGE{4:7}. + Register is reset only by a POR reset. + + Usage: + # cat /sys/.../zynqmp-firmware/pggs0 + # echo > /sys/.../zynqmp-firmware/pggs0 + + Example: + # cat /sys/.../zynqmp-firmware/pggs0 + # echo 0xFFFFFFFF 0x1234ABCD > /sys/.../zynqmp-firmware/pggs0 + +Users: Xilinx diff --git a/drivers/firmware/xilinx/zynqmp/Makefile b/drivers/firmware/xilinx/zynqmp/Makefile index c3ec669..6629781 100644 --- a/drivers/firmware/xilinx/zynqmp/Makefile +++ b/drivers/firmware/xilinx/zynqmp/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0+ # Makefile for Xilinx firmwares -obj-$(CONFIG_ZYNQMP_FIRMWARE) += firmware.o +obj-$(CONFIG_ZYNQMP_FIRMWARE) += firmware.o firmware-ggs.o diff --git a/drivers/firmware/xilinx/zynqmp/firmware-ggs.c b/drivers/firmware/xilinx/zynqmp/firmware-ggs.c new file mode 100644 index 0000000..79661f5 --- /dev/null +++ b/drivers/firmware/xilinx/zynqmp/firmware-ggs.c @@ -0,0 +1,297 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Xilinx Zynq MPSoC Firmware layer + * + * Copyright (C) 2014-2018 Xilinx, Inc. + * + * Jolly Shah + * Rajan Vaja + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +static ssize_t read_register(char *buf, u32 ioctl_id, u32 reg) +{ + int ret; + u32 ret_payload[PAYLOAD_ARG_CNT]; + const struct zynqmp_eemi_ops *eemi_ops = get_eemi_ops(); + + if (!eemi_ops || !eemi_ops->ioctl) + return -EFAULT; + + ret = eemi_ops->ioctl(0, ioctl_id, reg, 0, ret_payload); + if (ret) + return ret; + + return sprintf(buf, "0x%x\n", ret_payload[1]); +} + +static ssize_t write_register(const char *buf, size_t count, u32 read_ioctl, + u32 write_ioctl, u32 reg) +{ + char *kern_buff, *inbuf, *tok; + long mask, value; + int ret; + u32 ret_payload[PAYLOAD_ARG_CNT]; + const struct zynqmp_eemi_ops *eemi_ops = get_eemi_ops(); + + if (!eemi_ops || !eemi_ops->ioctl) + return -EFAULT; + + kern_buff = kzalloc(count, GFP_KERNEL); + if (!kern_buff) + return -ENOMEM; + + ret = strlcpy(kern_buff, buf, count); + if (ret < 0) { + ret = -EFAULT; + goto err; + } + + inbuf = kern_buff; + + /* Read the write mask */ + tok = strsep(&inbuf, " "); + if (!tok) { + ret = -EFAULT; + goto err; + } + + ret = kstrtol(tok, 16, &mask); + if (ret) { + ret = -EFAULT; + goto err; + } + + /* Read the write value */ + tok = strsep(&inbuf, " "); + if (!tok) { + ret = -EFAULT; + goto err; + } + + ret = kstrtol(tok, 16, &value); + if (ret) { + ret = -EFAULT; + goto err; + } + + ret = eemi_ops->ioctl(0, read_ioctl, reg, 0, ret_payload); + if (ret) { + ret = -EFAULT; + goto err; + } + ret_payload[1] &= ~mask; + value &= mask; + value |= ret_payload[1]; + + ret = eemi_ops->ioctl(0, write_ioctl, reg, value, NULL); + if (ret) + ret = -EFAULT; + +err: + kfree(kern_buff); + if (ret) + return ret; + + return count; +} + +/** + * ggs_show - Show global general storage (ggs) sysfs attribute + * @dev: Device structure + * @attr: Device attribute structure + * @buf: Requested available shutdown_scope attributes string + * @reg: Register number + * + * Return:Number of bytes printed into the buffer. + * + * Helper function for viewing a ggs register value. + * + * User-space interface for viewing the content of the ggs0 register. + * cat /sys/devices/platform/firmware/ggs0 + */ +static ssize_t ggs_show(struct device *dev, + struct device_attribute *attr, + char *buf, + u32 reg) +{ + return read_register(buf, IOCTL_READ_GGS, reg); +} + +/** + * ggs_store - Store global general storage (ggs) sysfs attribute + * @dev: Device structure + * @attr: Device attribute structure + * @buf: User entered shutdown_scope attribute string + * @count: Size of buf + * @reg: Register number + * + * Return: count argument if request succeeds, the corresponding + * error code otherwise + * + * Helper function for storing a ggs register value. + * + * For example, the user-space interface for storing a value to the + * ggs0 register: + * echo 0xFFFFFFFF 0x1234ABCD > /sys/devices/platform/firmware/ggs0 + */ +static ssize_t ggs_store(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t count, + u32 reg) +{ + if (!dev || !attr || !buf || !count || reg >= GSS_NUM_REGS) + return -EINVAL; + + return write_register(buf, count, IOCTL_READ_GGS, IOCTL_WRITE_GGS, reg); +} + +/* GGS register show functions */ +#define GGS0_SHOW(N) \ + ssize_t ggs##N##_show(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ + { \ + return ggs_show(dev, attr, buf, N); \ + } + +static GGS0_SHOW(0); +static GGS0_SHOW(1); +static GGS0_SHOW(2); +static GGS0_SHOW(3); + +/* GGS register store function */ +#define GGS0_STORE(N) \ + ssize_t ggs##N##_store(struct device *dev, \ + struct device_attribute *attr, \ + const char *buf, \ + size_t count) \ + { \ + return ggs_store(dev, attr, buf, count, N); \ + } + +#define CREATE_GGS_DEVICE(dev, N) \ +do { \ + if (device_create_file(dev, &dev_attr_ggs##N)) \ + dev_err(dev, "unable to create ggs%d attribute\n", N); \ +} while (0) + +static GGS0_STORE(0); +static GGS0_STORE(1); +static GGS0_STORE(2); +static GGS0_STORE(3); + +/** + * pggs_show - Show persistent global general storage (pggs) sysfs attribute + * @dev: Device structure + * @attr: Device attribute structure + * @buf: Requested available shutdown_scope attributes string + * @reg: Register number + * + * Return:Number of bytes printed into the buffer. + * + * Helper function for viewing a pggs register value. + */ +static ssize_t pggs_show(struct device *dev, + struct device_attribute *attr, + char *buf, + u32 reg) +{ + return read_register(buf, IOCTL_READ_PGGS, reg); +} + +/** + * pggs_store - Store persistent global general storage (pggs) sysfs attribute + * @dev: Device structure + * @attr: Device attribute structure + * @buf: User entered shutdown_scope attribute string + * @count: Size of buf + * @reg: Register number + * + * Return: count argument if request succeeds, the corresponding + * error code otherwise + * + * Helper function for storing a pggs register value. + */ +static ssize_t pggs_store(struct device *dev, + struct device_attribute *attr, + const char *buf, + size_t count, + u32 reg) +{ + return write_register(buf, count, IOCTL_READ_PGGS, + IOCTL_WRITE_PGGS, reg); +} + +#define PGGS0_SHOW(N) \ + ssize_t pggs##N##_show(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ + { \ + return pggs_show(dev, attr, buf, N); \ + } + +#define PGGS0_STORE(N) \ + ssize_t pggs##N##_store(struct device *dev, \ + struct device_attribute *attr, \ + const char *buf, \ + size_t count) \ + { \ + return pggs_store(dev, attr, buf, count, N); \ + } + +/* PGGS register show functions */ +static PGGS0_SHOW(0); +static PGGS0_SHOW(1); +static PGGS0_SHOW(2); +static PGGS0_SHOW(3); + +/* PGGS register store functions */ +static PGGS0_STORE(0); +static PGGS0_STORE(1); +static PGGS0_STORE(2); +static PGGS0_STORE(3); + +/* GGS register device attributes */ +static DEVICE_ATTR_RW(ggs0); +static DEVICE_ATTR_RW(ggs1); +static DEVICE_ATTR_RW(ggs2); +static DEVICE_ATTR_RW(ggs3); + +/* PGGS register device attributes */ +static DEVICE_ATTR_RW(pggs0); +static DEVICE_ATTR_RW(pggs1); +static DEVICE_ATTR_RW(pggs2); +static DEVICE_ATTR_RW(pggs3); + +static struct attribute *attrs[] = { + &dev_attr_ggs0.attr, + &dev_attr_ggs1.attr, + &dev_attr_ggs2.attr, + &dev_attr_ggs3.attr, + &dev_attr_pggs0.attr, + &dev_attr_pggs1.attr, + &dev_attr_pggs2.attr, + &dev_attr_pggs3.attr, + NULL, +}; + +static const struct attribute_group attr_group = { + .attrs = attrs, + NULL, +}; + +int zynqmp_pm_ggs_init(struct device *dev) +{ + return sysfs_create_group(&dev->kobj, &attr_group); +} diff --git a/drivers/firmware/xilinx/zynqmp/firmware.c b/drivers/firmware/xilinx/zynqmp/firmware.c index 2313ae7..fe7b044 100644 --- a/drivers/firmware/xilinx/zynqmp/firmware.c +++ b/drivers/firmware/xilinx/zynqmp/firmware.c @@ -15,11 +15,14 @@ #include #include #include +#include #include #include #include +#define DRIVER_NAME "zynqmp_firmware" + /** * zynqmp_pm_ret_code - Convert PMU-FW error codes to Linux error codes * @ret_status: PMUFW return code @@ -996,4 +999,32 @@ static int __init zynqmp_plat_init(void) return ret; } +static const struct of_device_id firmware_of_match[] = { + { .compatible = "xlnx,zynqmp-firmware", }, + { /* end of table */ }, +}; + +MODULE_DEVICE_TABLE(of, firmware_of_match); + +static int zynqmp_firmware_probe(struct platform_device *pdev) +{ + int ret; + + ret = zynqmp_pm_ggs_init(&pdev->dev); + if (ret) + dev_err(&pdev->dev, "%s() GGS init fail with error %d\n", + __func__, ret); + + return ret; +} + +static struct platform_driver zynqmp_firmware_platform_driver = { + .probe = zynqmp_firmware_probe, + .driver = { + .name = DRIVER_NAME, + .of_match_table = firmware_of_match, + }, +}; +builtin_platform_driver(zynqmp_firmware_platform_driver); + early_initcall(zynqmp_plat_init); diff --git a/include/linux/firmware/xilinx/zynqmp/firmware.h b/include/linux/firmware/xilinx/zynqmp/firmware.h index 3c323b6..35bb8c5 100644 --- a/include/linux/firmware/xilinx/zynqmp/firmware.h +++ b/include/linux/firmware/xilinx/zynqmp/firmware.h @@ -567,6 +567,8 @@ int invoke_pm_fn(u32 pm_api_id, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 *ret_payload); int zynqmp_pm_ret_code(u32 ret_status); +int zynqmp_pm_ggs_init(struct device *dev); + #if IS_REACHABLE(CONFIG_ARCH_ZYNQMP) const struct zynqmp_eemi_ops *get_eemi_ops(void); #else -- 2.7.4