Received: by 10.223.148.5 with SMTP id 5csp6334584wrq; Wed, 17 Jan 2018 12:22:39 -0800 (PST) X-Google-Smtp-Source: ACJfBotnvZ/U1YQuchMmWLfwJa2hi25IeW0d9Fi1taNFA7NxCFAJfc4Z0MtYJjjRQTlkXVsOJHQj X-Received: by 10.99.157.207 with SMTP id i198mr34116611pgd.353.1516220559306; Wed, 17 Jan 2018 12:22:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516220559; cv=none; d=google.com; s=arc-20160816; b=ZrP8JsvXe93zIbNFBFg55AGxCLDJZsK7/zI2equy51wP1Jc8VKXrpOqbIRNsNsIHkR e8ECavmmYbhP+K5qFCH3AcQAkuMQmyhoyFUlQXTvnXgombvBzuHno0vyrGQirNzDghNS e6qUl3ew7QogpUwcfpve5fhMd011Vs/WPj355uWljCi2o9m9u0UvmjuzLjeaZIp4KfF/ OJl+NDWXxuidYOUpzw8wsAMGVI7GnMQdt29RpGrxQXAoVhsoLsO1w/CIQQJ+TShDD8nu AUb8kuRkygISPata4DReGfchkgYG6ZVLIta7U1xzOQK5WkDE9zwAp+F9i/RJjpGem6fX iarA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=PDeUqHsWx367PXx1mz83C2QPP/dEKYvvY+IiIHOfNXs=; b=CgMMtTXOiC3xWp6HHs5+eWC70zc/+y2NXPjT4EoYN4GtP/4+3vtQYRTC9OQ/tw1Aam 8PMiBKDwTkPyBY29zLFiRtWnp78UCKz/nNsOh9JP2Xf398EPN4ar26cstVU9VS4SLaIu xQejEVqsq8PXhvdM+Oeb3/VALS0WnGPDiWvbJhH+E0Sno8ObrdPTAsV5BTo7b0KxBPbb Jz4FRCmRESOD9vqP9C5s7Qm+AV9H+ScLk60NfTX2DP5LC3bNapTDXf+n5vWA9OfDGcoL eGGG/VUrS9e4rrbBkzBSq179ZhkgRPDdY0lEFMBClX6iugJvMtBfjW9A0/o8jxvrTW3S wCRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=Tb0NTs6V; 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 a6si4944293pfl.299.2018.01.17.12.22.24; Wed, 17 Jan 2018 12:22:39 -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=Tb0NTs6V; 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 S1753015AbeAQUVP (ORCPT + 99 others); Wed, 17 Jan 2018 15:21:15 -0500 Received: from mail-by2nam03on0060.outbound.protection.outlook.com ([104.47.42.60]:51613 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752891AbeAQUVK (ORCPT ); Wed, 17 Jan 2018 15:21:10 -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=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: , , , , , , , , , , CC: , , , , Jolly Shah 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 Content-Type: text/plain 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 Content-Transfer-Encoding: quoted-printable 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 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 | 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 diff --git a/Documentation/ABI/stable/sysfs-driver-zynqmp-firmware b/Docume= ntation/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/xil= inx/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) +=3D firmware.o +obj-$(CONFIG_ZYNQMP_FIRMWARE) +=3D firmware.o firmware-ggs.o diff --git a/drivers/firmware/xilinx/zynqmp/firmware-ggs.c b/drivers/firmwa= re/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 =3D get_eemi_ops(); + + if (!eemi_ops || !eemi_ops->ioctl) + return 0; + + ret =3D 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 =3D get_eemi_ops(); + + if (!eemi_ops || !eemi_ops->ioctl) + return -EFAULT; + + kern_buff =3D kzalloc(count, GFP_KERNEL); + if (!kern_buff) + return -ENOMEM; + + ret =3D strlcpy(kern_buff, buf, count); + if (ret < 0) { + ret =3D -EFAULT; + goto err; + } + + inbuf =3D kern_buff; + + /* Read the write mask */ + tok =3D strsep(&inbuf, " "); + if (!tok) { + ret =3D -EFAULT; + goto err; + } + + ret =3D kstrtol(tok, 16, &mask); + if (ret) { + ret =3D -EFAULT; + goto err; + } + + /* Read the write value */ + tok =3D strsep(&inbuf, " "); + if (!tok) { + ret =3D -EFAULT; + goto err; + } + + ret =3D kstrtol(tok, 16, &value); + if (ret) { + ret =3D -EFAULT; + goto err; + } + + ret =3D eemi_ops->ioctl(0, ioctl_id, reg, 0, ret_payload); + if (ret) { + ret =3D -EFAULT; + goto err; + } + ret_payload[1] &=3D ~mask; + value &=3D mask; + value |=3D ret_payload[1]; + + ret =3D eemi_ops->ioctl(0, ioctl_id, reg, value, NULL); + if (ret) + ret =3D -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 >=3D 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 attribu= te + * @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 attri= bute + * @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/x= ilinx/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[] =3D { + { .compatible =3D "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 =3D { + .probe =3D zynqmp_firmware_probe, + .driver =3D { + .name =3D DRIVER_NAME, + .of_match_table =3D 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/linu= x/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 -- 2.7.4 This email and any attachments are intended for the sole use of the named r= ecipient(s) and contain(s) confidential information that may be proprietary= , privileged or copyrighted under applicable law. If you are not the intend= ed recipient, do not read, copy, or forward this email message or any attac= hments. Delete this email message and any attachments immediately.