From patchwork Wed Jan 17 20:20:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jolly Shah X-Patchwork-Id: 10170727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D631160386 for ; Wed, 17 Jan 2018 20:23:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2505223B3 for ; Wed, 17 Jan 2018 20:23:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B08F826538; Wed, 17 Jan 2018 20:23:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5873A223B3 for ; Wed, 17 Jan 2018 20:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=Jl8Hx2u3hhKBYFfptPodbgrSsbWQseo5rRqfem5DWao=; b=howfqw7cAK3+wV oUNQ6K12MSTbm6EjWmE0UcFmGGwRRwVV4lclYTEI69h9DIE5DFI7qIhPyX5Ko0XCTcqwWsSFUNPQZ bikC98UIz/7lk/btEjLgdpHeWf5/bd6iHLCS5tcHALWK82Na8Bh6EGGQr33EuiSmS20IxU0TOsNVl 4ezGpibbv+Z0knf680XgmgInfV7ZepwnvqLKk/2VhbHnU2Qsb6PhJK2xAPpLJAK5DA0mpaFXwa8IS czXYt/h9Gf1dLb0iUrdS0O30T6LdCfBAkY/01W0F5B9V6QxNAoyQI7fxxlnbqvVoXBvaQcUJwBShr r6SfKYEG69n0IPqnFubw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ebuDU-0004vj-C0; Wed, 17 Jan 2018 20:21:48 +0000 Received: from mail-co1nam03on0044.outbound.protection.outlook.com ([104.47.40.44] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ebuD2-0004Pi-EF for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2018 20:21:24 +0000 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=PDeUqHsWx367PXx1mz83C2QPP/dEKYvvY+IiIHOfNXs=; b=Tb0NTs6VpoHD66CvbrrwBik5YuFlG6RjIDkEAdQjZ2VY18+deL9LEqzSRjfXibaAgFGGENXT8RUvZnKam2jPq6xDsDXSxNhRZS2Fzxm/EeuNHkQ//2h/3RPauDwtSyCf1acb2Mfpy4pEwL0LiY8UXsLJU/nXKJYfMJEpVhaIa1g= Received: from MWHPR0201CA0001.namprd02.prod.outlook.com (10.167.160.142) by MWHPR02MB3278.namprd02.prod.outlook.com (10.164.187.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Wed, 17 Jan 2018 20:21:05 +0000 Received: from BL2NAM02FT024.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::202) by MWHPR0201CA0001.outlook.office365.com (2603:10b6:301:74::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.428.17 via Frontend Transport; Wed, 17 Jan 2018 20:20:59 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) 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.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by BL2NAM02FT024.mail.protection.outlook.com (10.152.77.62) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Wed, 17 Jan 2018 20:20:58 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:47194 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1ebuCf-0006PA-QF; Wed, 17 Jan 2018 12:20:57 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1ebuCf-0000oP-O1; Wed, 17 Jan 2018 12:20:57 -0800 Received: from xsj-pvapsmtp01 (smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w0HKKskB017763; Wed, 17 Jan 2018 12:20:54 -0800 Received: from [172.19.2.91] (helo=xsjjollys50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1ebuCc-0000nS-Ac; Wed, 17 Jan 2018 12:20:54 -0800 From: Jolly Shah To: , , , , , , , , , , Subject: [PATCH v2 3/4] drivers: firmware: xilinx: Add sysfs interface Date: Wed, 17 Jan 2018 12:20:33 -0800 Message-ID: <1516220434-22204-4-git-send-email-jollys@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516220434-22204-1-git-send-email-jollys@xilinx.com> References: <1516220434-22204-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-23600.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.100; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(376002)(346002)(39380400002)(39860400002)(2980300002)(438002)(50944005)(199004)(189003)(47776003)(2201001)(48376002)(2906002)(7696005)(51416003)(356003)(5890100001)(305945005)(72206003)(5660300001)(39060400002)(8936002)(50466002)(81156014)(81166006)(4326008)(26005)(8676002)(107886003)(76176011)(8746002)(50226002)(59450400001)(6666003)(9786002)(63266004)(106002)(316002)(2950100002)(36386004)(478600001)(36756003)(7416002)(106466001)(54906003)(110136005)(77096007)(921003)(107986001)(5001870100001)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR02MB3278; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT024; 1:MHfZW7weiLcpCYmjbUgzsAvxFYlEMLhqnwh14OSJB9WwajOseAe8smJeqPjkRj6a10vsjEb2mOIkhbvwuJW2Atkbw+bYQ+O4p9A9hLzbup9bQo4M1bo8dlrEoaiQwzkI MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3b96165b-1d34-4499-0dca-08d55de7d224 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:MWHPR02MB3278; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3278; 3:viBxuNVObrWrOqnFzAuQcAlY79V88vbdVY5wX63OCdlPCI55RQwtmJ9Y2ylczcuMq2vPGi7oap1vxqsqBOHWteiy0i75rjIVXUGAablXOxFZxWcUEHr/JuLjZvXLx6ykcBcwvBEHDd8GVkZEkiRBzJ49lAVm99TW/ptQWzCYFAFdRROV9GDv4VZgyvh7XBX9uxoSPL7qs3197A90aVFW19GkZZe6jA0K0sxN9m1bFrEZP2lKV+V+cCT72O4R33hrE7z9LUQFW/1G5QNgI1h2RcRSt/jnRvjqogBNVFhuyrvwXcnrwQjeun14ykKXoZzNSwub+yucojF9lj6rFiRwk3+I3JmoIyg2FlEwsfQ4cTg=; 25:cQRm59peQbStcqWdSn45PsnskrX+6dfZ8UerWmiU1Nb22Kv6Q+X1gEQAHDVbKjeZaw5dUjRcpWo9by+av8zbpiHwJODd43Wq4n2qPs/ek+GuiQUKadv3WquCfJBniCpsixQ0MAjuiK1Piv5hFHm4l/HCkWK1uFXAz+1z8hJXaEhMdOtBPV7ZsQ/WofRZBcqO2kVm5zLXJh/tEmn3KdcQUFHjHUAX09E4QbFB5F+xJM/JfQ18emwUAUCV5xQKaN1K/HY8tcUjh7ehojRWlzMIiBUhHtY/2rQU0xOysGneeAOiQqWA3uFuqeDrzF2cRc6GquMQk3zLGGS05fQC6T7tbA== X-MS-TrafficTypeDiagnostic: MWHPR02MB3278: X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3278; 31:oT1XC+bGoOLodZQYsCpLsFImhDw+igfx0k1fG/kaXBtVEn7cKiwGaaui07u3mrO4eu5QH+hfjUl16ROdupi4rAsTAkglVGqqDgos3XMBfJzREHEIORMEtBM1lLcAUX/O63mmLOFfhTf8Vbgt0qv+/EauBbt/DbJyT5FQtb0w5vKcTSM4bDf2GpjC7+r8P6VGEOgWlsUtJ8FPNH/tHllGP7+C4bX4qPMwUSEQz4MYlL0=; 20:vV+mM2MtkG8WYJ3+6CILniCvu2uW+z67L01fS1vVXANeVr8DZ1nsTBsypnxuBJEOy4+0DNdqtcZdhSsy1/C4WWT08YQABG1FWTleKNKLbI9ZzWHFXXi8dKW6aOc2xtsjZG8pxsnJaTDHsevOydgZ02/WNqJGL3/rwQIa4WaYFzdjH8MSup0fiJg030cOFa8OFK3t2MPs+AO54lkS3CydBF5P4N3tvpIPpMKe/sGkfsUjoLX2c75ErKviS/gTGOCWSlRj/tsXqFkXS8rPTJ15yCBrDN7pcIgT7UbkOhjTVbJT4+FP0GHI+ITMZS3s6VPdAn/2aeYRtxgUTzxdMlXcuZ0jEDgpGjpMhMCtqPkeFgQ7QEe/uIbyX5YnD91Q/ftSseT9c2Z67FcGj7+dD2nuuGzPhwa66MbqKgH5BLHAkm4uodmENKp0zRjDWKpeffs3nZ8mFqPcAuhfcnaNZ44mg0INd3vMGC1YYcPDaiezJNOqRZ2BG1Pt6igkDAHlSX+f 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:(6040470)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93004095)(3231023)(944501161)(3002001)(6055026)(6041268)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:MWHPR02MB3278; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR02MB3278; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3278; 4:8OXjVCkNYvRWZMa/PQcZMdGMQSMAoFu0LCAMhlz58DoHZu3lvAIK/owrcoHWFLgIEOGC71JyHrfTC35SD/C9Npi3rbL+dtl+ofVMgbkK867187j5M77APyz3prSzVDOwrJNMjX4TFGNx6dz4EjvMn7T1h51iyEItFmjPB6i4OTwtme55E80tAYWcch7IsEzoh7sSI1WpYWh3P3BIfDIVV2rHMbMyULRNK2jTvxqLJOH+eKmPKETw8wLyv9cno3NTvf9+jkUtRBK5xlZWbJHgSs5oSV7jnYGB7hFvP9qPmfFGNdi6ISo6aQ5+swu34ExM X-Forefront-PRVS: 0555EC8317 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR02MB3278; 23:fOWCAOOh6ZZ7soFXOnhiWa9r2RoSu67gCOOUGu9n3?= =?us-ascii?Q?kMJAutQ3hoy+GJaH1PRftxEac5ZRuKCA+chZmjjCtTQ4y+ZhfVMTX574xLHf?= =?us-ascii?Q?10KxMvqfGQ6g3qZxu2oLKJun0QYyOchAkG3roAp2rHVFq4hEmKU+jZEv7DKU?= =?us-ascii?Q?MaySSaeYtTy+axVYSAgPMsQPPA/V88etp+gQyBAXA6YbhlNmRJXLfe5iV5SW?= =?us-ascii?Q?NokGiDkcp3AGaIX56CE6Gi7h03ODdmUeIIMs0od70VmAoUJvbTSbU/0jvVuw?= =?us-ascii?Q?Rx6tI0WME/c18yO97BfboYTwXx+p4HGcYLLyiN+BmLKmrY5fr2n06VUgjUQq?= =?us-ascii?Q?OOsIx+KFjsXJchbSqdq7sKOO4IkZmmXJFO7JBdeb1e+uR3MhDK8vGgfLJaJI?= =?us-ascii?Q?bccQIgSWkkSNp8gXtKYFRAge2fuO/bTL0YZ1oDBYQKoQGzOUDrE76lJEh3g9?= =?us-ascii?Q?GpPUAGOQWgxigXfcKbHV/+8xXnyiiC/YWJgvOkOqpot+0q+K5/9jNHdxKIeO?= =?us-ascii?Q?vN4b22EPCcFbP88MMp4D9LSKb65zPkNQE4J4/87FemIoniInB+Xz4Tlsp37+?= =?us-ascii?Q?bnNzqrZvA5aONm8EfeCtId0kWe2wyBwj+y7ZvehHAK6WebM+HIvYhOQpI0N8?= =?us-ascii?Q?qj8T2jEX+2LtaafmDK/zOSTqpn/RaYOYWpk7Uy1JbN82YLm3vZmWuhoWKIL0?= =?us-ascii?Q?T6bax5Yr7K3eLlq6xykwinzxRf6TKA7e8SqGfI+QSC/EM9/MjPnrZQvTFz1i?= =?us-ascii?Q?qJcplh+5uuN+KwzVw4ghzhkRpE++aPoYwddjfCOaPqg9C9jByWseLjgusNZ6?= =?us-ascii?Q?dmKKmv86IzeYM026V2E5EzF6u84/KJlmS3uekEvYGU5UFee5dwB+sA+bPJf/?= =?us-ascii?Q?MwenFgPQ6jvZbZh4ScZAk8hmKc6AOZshZmxtexKijSbjTxFCaN1Q7ofcsTmY?= =?us-ascii?Q?LeGxnqFiRx7InajVk66O20MYq8zpmDBosEkf2bMCPy6nv+EvPCPqb9u1LaA6?= =?us-ascii?Q?U5K5hOBT7D7njLljhoRGPuqgm3fo+dYZnRELpGdxtA3P8nOuVkyxAUas+P/r?= =?us-ascii?Q?HDu1q0iU0RVAItAHLGh0Dp7yRhswrA4H9th1EmdhFNdYFJGJQWMLUiHglFKE?= =?us-ascii?Q?ibfGRqU/3fw+9RhZCkgqYPaQ82TxVg7twJXaBVbVhTr5NzkIy35z4h+xi8Xo?= =?us-ascii?Q?Rf77hkhi0mfi6xSk/oEw4OA2uQvwVUu9NGmXW1AliZxcKytFekm6wbmTA=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3278; 6:mrdCZO24PZons7oLBzs/9o4pnTjhdQuFBHN9LJWSw1GsiFPWGdHQ3dw8qiPWqxMzMyCdMR1GEnoEM9LH80228M3RrAS2TpFKadQQhHrbJhNMbB7hpMvQnNDD/bIt8gUnpL/um+jHhumsvsYAsuwRJfcRlKZsBrcrVDxSEVbQAvUxUSIkzNCJ1YLs838mNRHeLBjLzqJZKX1KRFl/zPCvt+vp2TdzH3EC2dFywavMy5/KYDlZTDR115rlunxnaeJl8mPjPMCZRt8EqjMtKajBxVCZKXa14Hx57SoeUJo4yr0uWB93I5pAb0BGrm+KBLxTosFfJo5UOUaY1FBq5ovt/taRv+2Bj2eejJEemQm+9IQ=; 5:BnQb6RMNDINWAYUa8cxGCXr2fqtp4zyQtIo+ch2gNu/k4gzJSlPAQIoZUMYTefdchxQaaGd3fzwB+rW3sh7fUCQnl6phtMs59d2xvyRgt658tDqYM8X//8oyv5/XlhThPaPlPelFkEypK7RcUiBXfOuVJ+5qCNeBxFsRz7FjAw0=; 24:dgJisrHKQYMSd+S8D/pKpsym1etzntxyJIHgw9rj6c0RLC5TLOb/Q5MDVuHS1QFeWj2/I/TT1sQcSv4h1OoviiXQeNB2lT3nGcFK4D+frVo=; 7:BzWPas9GYof+TwOAUaJJjnlryndRSfsI8RB14MTXCXbDIR5WC9sMnS6DcJ9YedjiFxZIoTePbfbxIdNtlV2MfuqlEVBqYzR2Q9TKx3ezZqO2imR1a9zhGsS+k2V4wrNN4+INwCXeuEkVwdkMqb01fQZBAdgowfmhxZsctOBlVHxG71nZVtIcY2U3xuhmS5SE7PZFiSumLt+hRv+hmj3aQFNfHWpxBnYVdqthWQbL+Olxx4uh/H75vMxAN0aQC4dg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2018 20:20:58.4231 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b96165b-1d34-4499-0dca-08d55de7d224 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.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB3278 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, rajanv@xilinx.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jolly Shah Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 | 33 +++ drivers/firmware/xilinx/zynqmp/Makefile | 2 +- drivers/firmware/xilinx/zynqmp/firmware-ggs.c | 298 +++++++++++++++++++++ drivers/firmware/xilinx/zynqmp/firmware.c | 26 ++ include/linux/firmware/xilinx/zynqmp/firmware.h | 2 + 5 files changed, 360 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/stable/sysfs-driver-zynqmp-firmware create mode 100644 drivers/firmware/xilinx/zynqmp/firmware-ggs.c -- 2.7.4 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. diff --git a/Documentation/ABI/stable/sysfs-driver-zynqmp-firmware b/Documentation/ABI/stable/sysfs-driver-zynqmp-firmware new file mode 100644 index 0000000..2483215 --- /dev/null +++ b/Documentation/ABI/stable/sysfs-driver-zynqmp-firmware @@ -0,0 +1,33 @@ +What: /sys/devices/platform/zynqmp-firmware/ggs* +Date: January 2018 +KernelVersion: 4.15.0 +Contact: "Jolly Shah" +Description: + Shows 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}. + +Users: Xilinx + +What: /sys/devices/platform/zynqmp-firmware/pggs* +Date: January 2018 +KernelVersion: 4.15.0 +Contact: "Jolly Shah" +Description: + Shows 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. +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..be47ca2 --- /dev/null +++ b/drivers/firmware/xilinx/zynqmp/firmware-ggs.c @@ -0,0 +1,298 @@ +// 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 0; + + ret = eemi_ops->ioctl(0, ioctl_id, reg, 0, ret_payload); + if (ret) + return ret; + + return snprintf(buf, PAGE_SIZE, "0x%x\n", ret_payload[1]); +} + +static ssize_t write_register(const char *buf, size_t count, + u32 ioctl_id, u32 reg) +{ + char *kern_buff; + char *inbuf; + char *tok; + long mask; + long 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, ioctl_id, 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, ioctl_id, 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_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); \ + } + +static GGS0_STORE(0); +static GGS0_STORE(1); +static GGS0_STORE(2); +static GGS0_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); + +#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) + +/** + * 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_GGS, 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_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); \ + } + +/* PGGS register show functions */ +static PGGS0_SHOW(0); +static PGGS0_SHOW(1); +static PGGS0_SHOW(2); +static PGGS0_SHOW(3); + +#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 store functions */ +static PGGS0_STORE(0); +static PGGS0_STORE(1); +static PGGS0_STORE(2); +static PGGS0_STORE(3); + +/* PGGS register device attributes */ +static DEVICE_ATTR_RW(pggs0); +static DEVICE_ATTR_RW(pggs1); +static DEVICE_ATTR_RW(pggs2); +static DEVICE_ATTR_RW(pggs3); + +#define CREATE_PGGS_DEVICE(dev, N) \ +do { \ + if (device_create_file(dev, &dev_attr_pggs##N)) \ + dev_err(dev, "unable to create pggs%d attribute\n", N); \ +} while (0) + +void zynqmp_pm_ggs_init(struct device *dev) +{ + /* Create Global General Storage register. */ + CREATE_GGS_DEVICE(dev, 0); + CREATE_GGS_DEVICE(dev, 1); + CREATE_GGS_DEVICE(dev, 2); + CREATE_GGS_DEVICE(dev, 3); + + /* Create Persistent Global General Storage register. */ + CREATE_PGGS_DEVICE(dev, 0); + CREATE_PGGS_DEVICE(dev, 1); + CREATE_PGGS_DEVICE(dev, 2); + CREATE_PGGS_DEVICE(dev, 3); +} diff --git a/drivers/firmware/xilinx/zynqmp/firmware.c b/drivers/firmware/xilinx/zynqmp/firmware.c index 8ebacb6..c42cf9f 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 @@ -984,4 +987,27 @@ 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) +{ + zynqmp_pm_ggs_init(&pdev->dev); + + return 0; +} + +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 42d6e74..97b3b7b 100644 --- a/include/linux/firmware/xilinx/zynqmp/firmware.h +++ b/include/linux/firmware/xilinx/zynqmp/firmware.h @@ -561,6 +561,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); +void zynqmp_pm_ggs_init(struct device *dev); + #if IS_REACHABLE(CONFIG_ARCH_ZYNQMP) const struct zynqmp_eemi_ops *get_eemi_ops(void); #else