From patchwork Fri Jun 3 17:04:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 12869235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E32F1C433EF for ; Fri, 3 Jun 2022 17:06:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=x3PNy5fxXVxp2dXC6n7SCZd1Mztqi228KYYJ9iYQC8I=; b=NtZ0NYtWoM59pb jgfuzzQnTB+/30F8Q26r8GmDsCFuq2ehWLEWWEjgRa5d3vvXblumYU52nPvPsXjCgaJFY6RTTHAcr p3GGzmIEU/co0wZwgwtMDXnV0sf7YvmO97AVd2WzIxKI+pkpBVtyvmZYzbA3VbjKoeNL3ka0okiMz l1+NnOkCM5DGAgpmR2i1S0uV1nOxDM9JSVjKmFjTB8WKUM87iH/bTPJRAfK8HeehGlnBUscEKteZS w9HjcDfibXEPkXiU201zmz194NZX1clUJ6Lg5Z8pmuy4OEPClmYOYcYx2lyinkaOIs116t6pLRHpy 6QxWV9eUXjTaDoXL1IOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxAjf-008Fa8-LU; Fri, 03 Jun 2022 17:05:19 +0000 Received: from mail-bn8nam04on20617.outbound.protection.outlook.com ([2a01:111:f400:7e8d::617] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxAjc-008FYd-PM for linux-arm-kernel@lists.infradead.org; Fri, 03 Jun 2022 17:05:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DoaT4S2XxktNdg4avSqRF/8Z35Yw4NEUEsD1fMgQ2D67XqpSbtBlD7NliZia+Qo7/oduRFq7IWTuZoFpoFhrcIe+j+qf7MXImXLwLZfsCAKeaTZQo2eX1vsNPCrw7FysdxJQWSYtbvCAqbSnDxs2FDFGmpUNxWBny16kaEIWihH5+QITUIrkZv6ksxY19Kk2pwibZxlib1W3JM4g9m6RxkGywEnPyXR8Dga7nqdJnNmyR2v89ONkmoMpx2tQDLlnlhVv88cMzIZrKDVXKwgLVfa+E/ZVW5johMNPgnsz0s0fd9Yt9hS8N+XLW/ROADjk42I91RuGATOhfbTp+9zCbw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/Cx9kVe35ogRH9oo8yLpM9TcHba9nJQ/gkniXEujeRw=; b=c/XdLbdKbEKdhoUhPD+gUfVG6dXE7z7nx33ZGcmzisTMpkVe93HXg1wgD4EgoXuzOXKp1zNApGhLUYoDFRbSh/ftYVfrrshd3fRWN9QXEAixZMgrH/MetuLWz1OHjj2q9a+c7t3iDb1FENQvijJ54zFjs50YRhqjIWYKKZ36NSfiIKCVnOn96dZV9NyXbWUhev+YbAooZBQGFWguaPrS7XnhbhAP3rQ5UShcIOODWjhi6nphaqDHaufbvDcYmBfAbbEwdTpd6GCO7BA640EYjpeP8ktfBjW8K/BhFu/MixW4AV4CwUt+Jf+eFkp55yCVHaQGNg+yIoc0KAM9Ac+svQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=towertech.it smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=/Cx9kVe35ogRH9oo8yLpM9TcHba9nJQ/gkniXEujeRw=; b=sMyMq0CbjTp164JxbEPirKLIsZhMUIIuNOT+yLSzRALr9fEycg7atPhViNKvaPECtICcZZ0eAb+X/1RAPsNRW3+PKMrgbUbEYgNoSUrpAG6WZCTcwAwpdPoyr9c4QilKhfyJIvE4J4Aakm0SGmKhQlFhDbF4Q68dkRjthK794rI= Received: from DM5PR13CA0029.namprd13.prod.outlook.com (2603:10b6:3:7b::15) by SA1PR02MB8621.namprd02.prod.outlook.com (2603:10b6:806:1fc::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Fri, 3 Jun 2022 17:05:09 +0000 Received: from DM3NAM02FT036.eop-nam02.prod.protection.outlook.com (2603:10b6:3:7b:cafe::48) by DM5PR13CA0029.outlook.office365.com (2603:10b6:3:7b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.6 via Frontend Transport; Fri, 3 Jun 2022 17:05:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass 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; pr=C Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT036.mail.protection.outlook.com (10.13.5.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5314.12 via Frontend Transport; Fri, 3 Jun 2022 17:05:09 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) 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.2176.14; Fri, 3 Jun 2022 10:05:06 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 3 Jun 2022 10:05:06 -0700 Received: from [172.23.66.193] (port=44716 helo=xhdsneeli40u.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nxAjQ-000GsV-Fm; Fri, 03 Jun 2022 10:05:05 -0700 From: Srinivas Neeli To: , , , , , , CC: , , , , , Srinivas Neeli Subject: [PATCH V5 1/2] dt-bindings: rtc: zynqmp: Add clock information Date: Fri, 3 Jun 2022 22:34:31 +0530 Message-ID: <20220603170432.26605-1-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: be4f516f-d42f-4099-c79e-08da458336f9 X-MS-TrafficTypeDiagnostic: SA1PR02MB8621:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 87IFXHTHQs31/UZHwITGbiE2PE0Kwn0U5me0UOraQGbEcbQEpwI1ITmGdTt41ydtavA5lorNdDfKmGDk4IRl7O/Kem/hxCD5cOQdEnITEAgYM79ROQ2ooYsBIFZzkyQkxtVhm20x7lqqrF9Qg7eY48cP3XBv0/BKP/YC7dbjaBaaT9Qt9j8RkAdnJJ8CqPc5kuDOvyTt36Nv+RICoZN6ZbAcCHlZr28IrVUO7ev+WYe+HPWhrWIQ3C0gPxiYzdQqyLtES96+QHCXTroXF7E+bgp3UU7niiJ101hkRV3aDClg4jJlhGDS70RfV+AgbDwRdvTTOSPMuEgCETiLAeM6VDIUcbZ03phZD/zln4cvphZM5X6CH8zZ6+wulyfR3hPyEGgskRnw5tLfeYuys6EC7upmWMogVjhuklQhI5p6zftRPtoPOp8LCpchtV6rGynIgTQPQuoI6rNi7qMDtb39b0myl6GHycodYgZooDLkSmSPYJi91Iad1tou+xiOWW7ZWnJYSUISRPCteUc1aAFWbZLEkOoccCIlIy1la3oxWAw11T0YmG67mRmiZZMkIO5CHV794t8vJmADj4q2XrNt3KzEkXNDF8guF5DCfGk2xwXpXl3yQ2aXZwazzr6lp+RXmRMcbjoeqHLuleAn75RticxkbYWNYBvGCTLJcsql/wqKW8x9OB0PdBAJuZ6oo5wwBBs4zxZFKrXjc7qOaTBGvnBMzC3zdVbhYiSVXWtBNnY= 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:(13230001)(4636009)(40470700004)(46966006)(36840700001)(336012)(186003)(2906002)(44832011)(426003)(4326008)(40460700003)(1076003)(107886003)(9786002)(47076005)(8936002)(356005)(7636003)(6666004)(83380400001)(508600001)(7696005)(5660300002)(8676002)(316002)(36756003)(6636002)(36860700001)(26005)(54906003)(110136005)(70206006)(70586007)(2616005)(82310400005)(102446001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2022 17:05:09.0780 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be4f516f-d42f-4099-c79e-08da458336f9 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: DM3NAM02FT036.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR02MB8621 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220603_100516_866143_B37C288E X-CRM114-Status: UNSURE ( 7.73 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Added clock information and deprecated calibration support. Signed-off-by: Srinivas Neeli --- Changes in V5: -Removed quotes and _clk suffix from clocknames. Changes in V4: - Deprecated calibrtion support Changes in V3: - New patch --- .../devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml b/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml index bdb72d3ddf2a..bf2a0c3d5244 100644 --- a/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml +++ b/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml @@ -23,6 +23,14 @@ properties: reg: maxItems: 1 + clocks: + items: + - description: rtc_clk is the operating frequency of crystal. + + clock-names: + items: + - const: rtc + interrupts: minItems: 2 @@ -39,6 +47,7 @@ properties: minimum: 0x1 maximum: 0x1FFFFF default: 0x198233 + deprecated: true required: - compatible @@ -61,5 +70,7 @@ examples: interrupts = <0 26 4>, <0 27 4>; interrupt-names = "alarm", "sec"; calibration = <0x198233>; + clock-names = "rtc_clk"; + clocks = <&rtc_clk>; }; }; From patchwork Fri Jun 3 17:04:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 12869236 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8ED94C43334 for ; Fri, 3 Jun 2022 17:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vL/qT7GJvnZogv9YYM+eqFPBAArAbTo8z7pCLUmgDSY=; b=oQ8edobghWlagZ FbD9DBOapH7JdWoq1sfkWo5e5LSbHX5lY6AyG3zQDglUMN8AbMREKAi4lsJxfn6Q8WP1h0A2fOxbr /N3lchdq+BRTBwlWwYJ/Sqhoc17da2KCe1gTDtyZ+WW+SXM6OVAkv9UMi7+0QmXZH+2ZqKDUpVyj3 WZoXfeTwI7JOP4p1dCtdCRqX7gtu+aY9EyZqRffe+T6hi3gyLiCDB4saM42WYNOy2041mzC7OCkJO Pm9cGhIrE8oyl+U6dDK1OMl4D6G89PdrwfPONvwJUc5UaTyRRlJ7bhn9bT1MSOFPmVAgiQ8tnzDQE daAkC56HVSHP5hcx+Txw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxAjo-008FbW-Rj; Fri, 03 Jun 2022 17:05:29 +0000 Received: from mail-mw2nam12on20619.outbound.protection.outlook.com ([2a01:111:f400:fe5a::619] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxAje-008FZB-Ak for linux-arm-kernel@lists.infradead.org; Fri, 03 Jun 2022 17:05:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sx/Vc79cnkipt64KdwIesYo9Z4aEXqpLzyQFcyvKUYB/iYDiIaclrF3i5TrV5aZWoURtfixaRlJEMLzjIcnbzt8x4aq2O6x4gTg2T8PhpP/JmN8SfSEDF6OW+89JG9yf51RTzdMJqn4JYXPTXM+T1OsTzroqkC2I89y/AVyWRQtVO1LftEQgj8gzexvKdU6c5GjPmVHmSXazPLJVRRTXWiK1FmlQnvdx9Cnqdm2yVMehXE2/WGvzWJeAB/Uaz4TNrnZHPlm0C6vjNI2v8ptNAlR5SJb/yTrH9sofnuamdtVueyc4VwiioMLACUrJER1qjeUUsnRryjhT2el0+qllog== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=K6Oml0FJb5+VW0xLS2mmQzq4cSJEjCzGnMeV/azn9rM=; b=Mvds3oU55sJjVuePRJ/jrGTqnver8eURTG0kMiSlid6pQsJg55u0/W3ao99Ma+zRlr7UrxV1M3Ko4Wo3p9w11E9JhcX53Pt713YlhYKkloXUtK7qbbG5eVB44o/Bx9qoUxTG/GnYmVuUBsjtdt1YSyKzGBAtXw0Td0Vu0E1FiTge6mzOsBqCE4bkdSwsyzsx7p/5QRoEN64VemWblVNvcsRivC734AcBkKWAVW6jV3YDPIOxoGF3lVCYE2dccWI51jevixHVf5HJh9c2lPAKM8waJB1lwYR6OkHqxjUqsopoxzF2831kp7veN1svOIP2LQDg7xrX6+AkdLQyCtP0pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=towertech.it smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) 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=K6Oml0FJb5+VW0xLS2mmQzq4cSJEjCzGnMeV/azn9rM=; b=UHh7wz6Y96W8fZ94eWAHvwfX8OSBZksytqKNgxamFE/eV2vczQ5FMMLOV3zj5hwXXb8OSexsHOUeCCXayS+0526RHsO2F8dwox6rVIE+OWJ9E1uEdeZ6nnRi2foZAeoGQqI6iMXhcHLH+I1wLQZbfW2gfQbeXf6zJyUFTSWMMLs= Received: from DM5PR13CA0037.namprd13.prod.outlook.com (2603:10b6:3:7b::23) by MWHPR02MB3342.namprd02.prod.outlook.com (2603:10b6:301:62::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Fri, 3 Jun 2022 17:05:13 +0000 Received: from DM3NAM02FT036.eop-nam02.prod.protection.outlook.com (2603:10b6:3:7b:cafe::e0) by DM5PR13CA0037.outlook.office365.com (2603:10b6:3:7b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.5 via Frontend Transport; Fri, 3 Jun 2022 17:05:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass 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; pr=C Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT036.mail.protection.outlook.com (10.13.5.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5314.12 via Frontend Transport; Fri, 3 Jun 2022 17:05:12 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) 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.2176.14; Fri, 3 Jun 2022 10:05:09 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 3 Jun 2022 10:05:09 -0700 Received: from [172.23.66.193] (port=44716 helo=xhdsneeli40u.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nxAjV-000GsV-3m; Fri, 03 Jun 2022 10:05:09 -0700 From: Srinivas Neeli To: , , , , , , CC: , , , , , Srinivas Neeli Subject: [PATCH V5 2/2] rtc: zynqmp: Add calibration set and get support Date: Fri, 3 Jun 2022 22:34:32 +0530 Message-ID: <20220603170432.26605-2-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220603170432.26605-1-srinivas.neeli@xilinx.com> References: <20220603170432.26605-1-srinivas.neeli@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 32253e09-c279-4782-6bc8-08da4583390d X-MS-TrafficTypeDiagnostic: MWHPR02MB3342:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zQihXam/Ggq13T96D4+2K38XaLr0OkyMoA5sTVY79+53reD0JLfXrl3ZGS+cvdqn4hcPfXfUW9Uu66GtRpL0By9Dr8fRdikaeUra0TMnGWdchKrl1Sky0UWn06LnU5i81nwBDbSvQyTx5AtXI2hOJXSLius60YvvqIsroNtZ70gEAfJlGs+nCcZ3ukIZJZ/bK1BhSQSey2ejOkWHDImWxxzj9nWzrDiOBwIl605Ar3xhL4B/Yf/njQfCuhYeBGosn8C8qVuFDqYTmudQijSCfD3eK97jCgAbZsHXb2/w3RZe2z/jMDZz37peNZUk8UXTktg28d1z8gZ0DvWapitIyg+4h09O9EPl9z62V9r/V+ICKrgcVm4YAKqMwjw5LkE7K35DXjcR6gTnHwrn06ZQfblFxmO2t82a8Hm8rU6+Q3wzuXHCgM0EgC375Zv2K2Fl7V0DtlZQBTZdITNbf53KCj0h0vO8+OGAMq5UnJommULR/f0gzxDu16eg1BmjTBv0Fih9Vcv0Rj1KZVDHEFXlMxtqBPb/zBLYQs8o71+N1vPwODtRri9Ak4BfQUdkFkYi6Fi2D/e2mEgZ846NrEOJCwd/B3bKweA3OxJqu9SYwVMTAQ3iE57Jh86B9xNbRiiSEuTOSoDjhnrU40n9DXs7zLj0yl1owQUdBrsrrVfOTpsTuTBG3ZioJ+EvPpCWcAyvriDj2kl4t00Fbr+zmgLOCJhbo7q1taPxyuQP0vh7tZM= 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:(13230001)(4636009)(46966006)(40470700004)(36840700001)(70206006)(36756003)(70586007)(508600001)(110136005)(6666004)(316002)(8936002)(1076003)(336012)(186003)(426003)(5660300002)(6636002)(9786002)(2616005)(7696005)(107886003)(2906002)(40460700003)(8676002)(83380400001)(4326008)(36860700001)(54906003)(7636003)(47076005)(356005)(82310400005)(44832011)(26005)(102446001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2022 17:05:12.5622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32253e09-c279-4782-6bc8-08da4583390d 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: DM3NAM02FT036.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB3342 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220603_100518_412310_82844D27 X-CRM114-Status: GOOD ( 21.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Zynqmp RTC controller has a calibration feature to compensate time deviation due to input clock inaccuracy. Set and get calibration API's are used for setting and getting calibration value from the controller calibration register. As per RTC spec default calibration value is 0x7FFF. Signed-off-by: Srinivas Neeli --- Changes in V5: -None Changes in V4: -Updated MIN and MAX calibration values. Changes in V3: -Calculated tick_mult using crystal frequency. -Calibration register updating based on crystal frequency in probe. -Supressed MIN an MAX calibration values,Will send separate patch in future. Changes in V2: -Removed unused macro. -Updated code with review comments. --- drivers/rtc/rtc-zynqmp.c | 115 ++++++++++++++++++++++++++++++++------- 1 file changed, 95 insertions(+), 20 deletions(-) diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index f440bb52be92..1dd389b891fe 100644 --- a/drivers/rtc/rtc-zynqmp.c +++ b/drivers/rtc/rtc-zynqmp.c @@ -6,6 +6,7 @@ * */ +#include #include #include #include @@ -36,17 +37,23 @@ #define RTC_OSC_EN BIT(24) #define RTC_BATT_EN BIT(31) -#define RTC_CALIB_DEF 0x198233 +#define RTC_CALIB_DEF 0x7FFF #define RTC_CALIB_MASK 0x1FFFFF #define RTC_ALRM_MASK BIT(1) #define RTC_MSEC 1000 +#define RTC_FR_MASK 0xF0000 +#define RTC_FR_MAX_TICKS 16 +#define RTC_PPB 1000000000LL +#define RTC_MIN_OFFSET -32768000 +#define RTC_MAX_OFFSET 32767000 struct xlnx_rtc_dev { struct rtc_device *rtc; void __iomem *reg_base; int alarm_irq; int sec_irq; - unsigned int calibval; + struct clk *rtc_clk; + unsigned int freq; }; static int xlnx_rtc_set_time(struct device *dev, struct rtc_time *tm) @@ -61,13 +68,6 @@ static int xlnx_rtc_set_time(struct device *dev, struct rtc_time *tm) */ new_time = rtc_tm_to_time64(tm) + 1; - /* - * Writing into calibration register will clear the Tick Counter and - * force the next second to be signaled exactly in 1 second period - */ - xrtcdev->calibval &= RTC_CALIB_MASK; - writel(xrtcdev->calibval, (xrtcdev->reg_base + RTC_CALIB_WR)); - writel(new_time, xrtcdev->reg_base + RTC_SET_TM_WR); /* @@ -173,15 +173,76 @@ static void xlnx_init_rtc(struct xlnx_rtc_dev *xrtcdev) rtc_ctrl = readl(xrtcdev->reg_base + RTC_CTRL); rtc_ctrl |= RTC_BATT_EN; writel(rtc_ctrl, xrtcdev->reg_base + RTC_CTRL); +} - /* - * Based on crystal freq of 33.330 KHz - * set the seconds counter and enable, set fractions counter - * to default value suggested as per design spec - * to correct RTC delay in frequency over period of time. +static int xlnx_rtc_read_offset(struct device *dev, long *offset) +{ + struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev); + unsigned long long rtc_ppb = RTC_PPB; + unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq); + unsigned int calibval; + long offset_val; + + calibval = readl(xrtcdev->reg_base + RTC_CALIB_RD); + /* Offset with seconds ticks */ + offset_val = calibval & RTC_TICK_MASK; + offset_val = offset_val - RTC_CALIB_DEF; + offset_val = offset_val * tick_mult; + + /* Offset with fractional ticks */ + if (calibval & RTC_FR_EN) + offset_val += ((calibval & RTC_FR_MASK) >> RTC_FR_DATSHIFT) + * (tick_mult / RTC_FR_MAX_TICKS); + *offset = offset_val; + + return 0; +} + +static int xlnx_rtc_set_offset(struct device *dev, long offset) +{ + struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev); + unsigned long long rtc_ppb = RTC_PPB; + unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq); + unsigned char fract_tick; + unsigned int calibval; + short int max_tick; + int fract_offset; + + if (offset < RTC_MIN_OFFSET || offset > RTC_MAX_OFFSET) + return -ERANGE; + + /* Number ticks for given offset */ + max_tick = div_s64_rem(offset, tick_mult, &fract_offset); + + /* Number fractional ticks for given offset */ + if (fract_offset) { + if (fract_offset < 0) { + fract_offset = fract_offset + tick_mult; + max_tick--; + } + if (fract_offset > (tick_mult / RTC_FR_MAX_TICKS)) { + for (fract_tick = 1; fract_tick < 16; fract_tick++) { + if (fract_offset <= + (fract_tick * + (tick_mult / RTC_FR_MAX_TICKS))) + break; + } + } + } + + /* Zynqmp RTC uses second and fractional tick + * counters for compensation */ - xrtcdev->calibval &= RTC_CALIB_MASK; - writel(xrtcdev->calibval, (xrtcdev->reg_base + RTC_CALIB_WR)); + calibval = max_tick + RTC_CALIB_DEF; + + if (fract_tick) + calibval |= RTC_FR_EN; + + calibval |= (fract_tick << RTC_FR_DATSHIFT); + + writel(calibval, (xrtcdev->reg_base + RTC_CALIB_WR)); + + return 0; } static const struct rtc_class_ops xlnx_rtc_ops = { @@ -190,6 +251,8 @@ static const struct rtc_class_ops xlnx_rtc_ops = { .read_alarm = xlnx_rtc_read_alarm, .set_alarm = xlnx_rtc_set_alarm, .alarm_irq_enable = xlnx_rtc_alarm_irq_enable, + .read_offset = xlnx_rtc_read_offset, + .set_offset = xlnx_rtc_set_offset, }; static irqreturn_t xlnx_rtc_interrupt(int irq, void *id) @@ -255,10 +318,22 @@ static int xlnx_rtc_probe(struct platform_device *pdev) return ret; } - ret = of_property_read_u32(pdev->dev.of_node, "calibration", - &xrtcdev->calibval); - if (ret) - xrtcdev->calibval = RTC_CALIB_DEF; + /* Getting the rtc_clk info */ + xrtcdev->rtc_clk = devm_clk_get_optional(&pdev->dev, "rtc_clk"); + if (IS_ERR(xrtcdev->rtc_clk)) { + if (PTR_ERR(xrtcdev->rtc_clk) != -EPROBE_DEFER) + dev_warn(&pdev->dev, "Device clock not found.\n"); + } + xrtcdev->freq = clk_get_rate(xrtcdev->rtc_clk); + if (!xrtcdev->freq) { + ret = of_property_read_u32(pdev->dev.of_node, "calibration", + &xrtcdev->freq); + if (ret) + xrtcdev->freq = RTC_CALIB_DEF; + } + ret = readl(xrtcdev->reg_base + RTC_CALIB_RD); + if (!ret) + writel(xrtcdev->freq, (xrtcdev->reg_base + RTC_CALIB_WR)); xlnx_init_rtc(xrtcdev);