From patchwork Fri Jun 24 12:02:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 12894435 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 9AF28C433EF for ; Fri, 24 Jun 2022 12:03:50 +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=twOaqoVei7Lg/v85iL3yMkjA3/LmpGlN01HXbv2R90U=; b=aaVJ7ZA9mM54UT H5bcoNJlKn/CA4I+RbVXanEPHH7zqY1SV17uqJ6u2lKU0Zw0unqaenKfki2sa0Vazh392pkj6QDid ZusElxkTa11AuXHeq59umWid4fmAg29fKizus2F+Y7ZzyC0M29J0ErmMPi4qnMAxcvWboQnZIi8HZ 0BMWIZB/jqZArc8wFD8yYhJIayhncP3cAcBu11cwG5bY2Zzs+GuGGMbOK9hzSipsAg/BA4mRQJCzp R+TvL5r/pKccZsbkqhlgOWlHm9dY4iYzfIdV4ExWl8l3Xakwa7ttWoXehjRzLKBMQRD2zvIMmVGZ8 hEIByokx6c+575oE6ltA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4i1J-0023Ep-R0; Fri, 24 Jun 2022 12:02:42 +0000 Received: from mail-bn7nam10on2079.outbound.protection.outlook.com ([40.107.92.79] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4i0x-00233J-78 for linux-arm-kernel@lists.infradead.org; Fri, 24 Jun 2022 12:02:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eoX6/v3y0Yztswql2GXtnl8OJ4FsYbq5J0ayqwo6TPgyTPey+cOHUTeVM/k0KN8Mj2tzpBAe1EoTucGqgIVJ4GOm3eK5yMtJTNFhEMw0d6Yn0IByjp9XE+MYapp6qDbP7s259fFxaV01/AjOqPpinnWGtJkSEwbWQGZ3IHUMVepcrAdj+OWCjj9AW7py1L3/isTpxaGrhYlrNZnBUN6bsdPkQ2ViC4IlQOcmLKVL5RiqUN//YlvjnHsYHPA1Wc9l0kEIWRys4O/vO8ZmFYS4CJMRi+PYK3v4wUnBOnhSOQmgJZ/UukAp+/fjRUw/acaTRGH8AVQwrKS7gMleVUtauQ== 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=SH/guYvs0GAdp6XiHJbifz6fjAZGiA/KfdD748KwUwY=; b=fGOq6QWsCgARPMpcR/7Mr9Cvtm/BCsaEAis4mcwm6doexG43sILeCihcrXUe1IKma1D5OcsncA7BFRs572J6C2rLqKSyLdLTnmVtZwaqJrhY2eAARWdCw2fzZd24EbMP68TYT3R7OcLVZr/8zJXOQyYUg6SK02/kzmCQKSlD6FKbWtQ/FmOZ+kIlwOKBlZGcSyHNYGwLxrcPMgfN08Ikq8lImDsMS1vCkD9/8005AJ1teY6vGOW/E2iNF/fDSMJnlTySZNo03McG/iK6abRK1k22c7zuxU+sx6ev1prWAjcsa9Q5cBSsZ0FLWmU0JlXDPOm8xNeb/siW5dOb3b87Qg== 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=SH/guYvs0GAdp6XiHJbifz6fjAZGiA/KfdD748KwUwY=; b=Hrg5tgfKIguv/MiKYhXahqVv+86tLl1A4UmyevWgUMVyl5hw985eycSMjGHkfVARaFo2vOmvM/H3gsPjFLNUeoOrNZSVgK5gWez/yx8wdbC8vsMC2C2+Mag2aKyiOw2fW4D2RYGum3TCjjPMIcUnI1nTZ33eVAeDBCU3U7gLIWE= Received: from SN7PR04CA0171.namprd04.prod.outlook.com (2603:10b6:806:125::26) by BL0PR02MB4292.namprd02.prod.outlook.com (2603:10b6:208:4b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.18; Fri, 24 Jun 2022 12:02:14 +0000 Received: from SN1NAM02FT0034.eop-nam02.prod.protection.outlook.com (2603:10b6:806:125:cafe::2f) by SN7PR04CA0171.outlook.office365.com (2603:10b6:806:125::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.17 via Frontend Transport; Fri, 24 Jun 2022 12:02:13 +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-pvapexch01.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0034.mail.protection.outlook.com (10.97.5.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5373.15 via Frontend Transport; Fri, 24 Jun 2022 12:02:13 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 24 Jun 2022 05:02:11 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 24 Jun 2022 05:02:11 -0700 Received: from [10.140.6.39] (port=57958 helo=xhdsgoud40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1o4i0p-0009E0-8b; Fri, 24 Jun 2022 05:02:11 -0700 From: Srinivas Neeli To: , , , , , , , , CC: , , , , , , Srinivas Neeli , Rob Herring Subject: [PATCH V9 1/3] dt-bindings: rtc: zynqmp: Add clock information Date: Fri, 24 Jun 2022 17:32:01 +0530 Message-ID: <20220624120203.2817457-1-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8478f60c-230f-4b07-f24f-08da55d96045 X-MS-TrafficTypeDiagnostic: BL0PR02MB4292:EE_ 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: eGYCInTfyG9h5yuqGuP7CUWIWJdb+34Whn3nurlfCsLa6hM+HjfQGBoiRj4IgNJNR9UoW6jQDZv8U3+LUGSm5VLO8g8vP24ZKZhf7iDwgQi0CGGS1FdG7Ko6/8g5qhHU46NDJUlqB0kB0RbxV5n8Brt+i1o2Seqr3NR9D7r9GkhhngT2eaHpeQO35ANgp3F6Z/V/4rX6MqujjZeEAJHOwD8itn5F9SNjYKyxhHxYCe3uCAH+p5i4vVQUJLau7ueucBuU++N6L+hCQe5IUu15wtuJoQN4VzAKQFhOYw9DOWEX+VOdFh6pFDVIwcPnh7BwFWRLR2aN7LpalVaEjuCrxH83RNpHYDkWXp6nDYOnhNVSyfW/UwP2928zw5cRCoM/I92RAHfHSx7wulUpKpTzp6kpHC/9zRZCYthKr1IipV9yGSVC4HB64ku/4WwaH/2SOLKicdCL+IzZyJSQ+cP/Yc8yUMv5oKsppn9U0t4kkfa0xnA/nPUNg0Jh+myPamniHbQUbuvpfvIj8U9Hz5zRwyeB95p7G+Lcts+2vx3O9hRJbar/XigRpqb9vFVjossGMXqLv3CfulmqhKiCr7+qod0Nyeuam/J/TggYvgFtnVSU7Zzy/RmxQf4uuX9KJhRIqz3j0O6PY3hFFM5LH1cNWHoTpQdPOoSEzsLVvK26xWntx4jx2kaNjbZeDgh3sizyMytySXykq8Y3NDwVZyHvpvZLM7zv4lZNq+r/4H0DLI/NyOEZP5ZQsoX/6vKR2CQz9XiqNSNP5pgVOzZS2Fk/tz1nOU4FhDr8IA0ivXKq4BbRZygVo7nxzaT7FXmMOVIE1SHf/wGiEd8IrV2Ifi1qoEnH/16HTTkOSVQlgoPPZr8= X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(136003)(346002)(376002)(396003)(36840700001)(40470700004)(46966006)(9786002)(2616005)(2906002)(8936002)(47076005)(6666004)(7416002)(26005)(44832011)(70206006)(7696005)(4326008)(54906003)(36756003)(70586007)(40460700003)(6636002)(8676002)(5660300002)(110136005)(316002)(356005)(40480700001)(336012)(478600001)(186003)(426003)(1076003)(83380400001)(82740400003)(82310400005)(41300700001)(36860700001)(7636003)(102446001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2022 12:02:13.6870 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8478f60c-230f-4b07-f24f-08da55d96045 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-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0034.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4292 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220624_050219_306909_2962088C X-CRM114-Status: UNSURE ( 8.26 ) 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 Reviewed-by: Rob Herring --- Changes in V9: -Updated clock information in clock-names. Changes in V8: -None Changes in V7: -None Changes in V6: -Removed dtc warnings. 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml b/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml index bdb72d3ddf2a..9dfe2cc5966a 100644 --- a/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml +++ b/Documentation/devicetree/bindings/rtc/xlnx,zynqmp-rtc.yaml @@ -23,8 +23,15 @@ properties: reg: maxItems: 1 + clocks: + maxItems: 1 + + clock-names: + items: + - const: rtc + interrupts: - minItems: 2 + maxItems: 2 interrupt-names: items: @@ -39,6 +46,7 @@ properties: minimum: 0x1 maximum: 0x1FFFFF default: 0x198233 + deprecated: true required: - compatible @@ -61,5 +69,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 24 12:02:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 12894437 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 7DDD6C43334 for ; Fri, 24 Jun 2022 12:04:25 +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=Ob0dUUYj+0cSEkjuZKymXGMmDC3OlneXFJ1HAWR20tM=; b=hZmNi0Bv1oT1Vy h9ePq8MowKEQhMdjtli69vZPbbgD2h9dmJwNNhsDctmVoZEWBM/AuFVMUhsxMk6Lw+CXlKP+oc3Mh lQO0D/Hl1i9uzeh9olSmY6ThRUTjztrbAjuh8hFNMUd+1zJqP2sKkXs/4bzdXTvUlgGoqZr0Wcg1G K8qLM/3/R4N1nz0v6T1jPI4ZFneyK7BcMpMle71eSYHdCa1QhbLrBq+rncAbAXdhFVc97zjssDRDn 817xFr6E3Xv5NsIo89oqDn5nKumz7UH1LzEUDRjv/9WtDoVd3+mmrThQdu+0Di4rUdmNmsunUj0GC D3vyrxmQIjk5c75aMLoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4i1t-0023Zt-14; Fri, 24 Jun 2022 12:03:17 +0000 Received: from mail-mw2nam10on2056.outbound.protection.outlook.com ([40.107.94.56] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4i19-00238m-PY for linux-arm-kernel@lists.infradead.org; Fri, 24 Jun 2022 12:02:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ODbcioiebyEn+GMyFpapdEyy6DllJQN0JOY0TUPZXWm60QWcmg4IrbXYH4Rf2qjCVFUd9yHfQEIoEjtds6OV4NmouhCsUgwOZKheVtsX6pihX84/DuAkO6YeXxi5Op9l6zysv0UqJ68TMCYweetrAFnjwlq/beZLu9eyr2P3ZewXY+8cN+MiwnQq/mHrPCLJOVGKe2PnjpRINzOMI/Pu74o0dZ9ZevPXlGvox1TzGiNQG8qQBDU/ZeYtUDRF4QvuNTTJ/cELBxg+YDYvkyEVUkDSjrF+D6WizZqOuBo5wb9XFtIR4pLeOecbHPTQVDqnGBZVlx0N7o+UKshnRTPa5g== 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=JNZTBIlAlxyvmLWOk8lZ1AWMoKlmlvRx+3WHKUZu0Vg=; b=jp0sypzJCDyxu3AtjWPFEpAeoMXyXlq5zBr4bOHb/xGauPKRIhkIIQul7fySPW0Lpuw/QqzeDsZEMUoGwEMTQvk97FVhW0PCxeCy/KUNGLkRhX3XIbjq3RtR/t9EOGXApu37tfdBiyzGqTFad/eT7M/KnLw3XvixyeHrP0PEOBktxJlpSQg5SR7LC49P1BQzKhb5PHanuo5yOlFMFHB5iExY4/ZF63Uts7FsHQWc3B95iiPnbtPKF5CHYZ7SAR6Mfebgn/dCZLea9Az3/sHOx2kpLOCBm3+Kht7C7Va9SKE9m/eycxtHoO7rujkS6NQMp6V6ya2oB1UV9POuZ1uCPA== 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=JNZTBIlAlxyvmLWOk8lZ1AWMoKlmlvRx+3WHKUZu0Vg=; b=KoIXvGHEKEkY8dyK9EMfsDIAvs6dQtPTYl++ECo9l0RT6nkg9IpacDP71gpPIMVAftJqxAsemgIAOszOkMBs4zVsvyA71bznfkjMXJbfUhVXYgpM3zK1eXjLN6tegzBzcu7TwbjoN+uiwZyQpCag9zqn34ibSqNZsxH/XJ+yFJc= Received: from SA0PR11CA0005.namprd11.prod.outlook.com (2603:10b6:806:d3::10) by CH0PR02MB8211.namprd02.prod.outlook.com (2603:10b6:610:ea::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.16; Fri, 24 Jun 2022 12:02:26 +0000 Received: from SN1NAM02FT0060.eop-nam02.prod.protection.outlook.com (2603:10b6:806:d3:cafe::f) by SA0PR11CA0005.outlook.office365.com (2603:10b6:806:d3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.17 via Frontend Transport; Fri, 24 Jun 2022 12:02:26 +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-pvapexch01.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0060.mail.protection.outlook.com (10.97.4.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5373.15 via Frontend Transport; Fri, 24 Jun 2022 12:02:26 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 24 Jun 2022 05:02:16 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 24 Jun 2022 05:02:16 -0700 Received: from [10.140.6.39] (port=57958 helo=xhdsgoud40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1o4i0t-0009E0-Mo; Fri, 24 Jun 2022 05:02:16 -0700 From: Srinivas Neeli To: , , , , , , , , CC: , , , , , , Srinivas Neeli , Peter Korsgaard Subject: [PATCH V9 2/3] rtc: zynqmp: Updated calibration value Date: Fri, 24 Jun 2022 17:32:02 +0530 Message-ID: <20220624120203.2817457-2-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624120203.2817457-1-srinivas.neeli@xilinx.com> References: <20220624120203.2817457-1-srinivas.neeli@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 339c6eb6-6c37-461c-c14c-08da55d967ad X-MS-TrafficTypeDiagnostic: CH0PR02MB8211:EE_ 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: T8TKQ78M8BEk4GgG6qmxy1Lt93haLIa5FGBFCqhV35vnutn4CP7F742wAPqwpXXg0DPKbtZfFNDVtudVMDZIQaqIBmXqaz8lAshftf2FILLyhd7DH0J7KwGblR1IkdAkh6YpqCjFdLG9/cZFkV4gOb7jSTpbxlhLGfr7RX7zl/FRb7UNJ2sI/9FL0XFVdHQY71pVIBXPwHhHabXKezuFLAl6AJZ5N6SxWTeBh5oibh+mcCXES4WhpgWvssckRSTzV7uKa5RGZX030P5MmraEJWW2fot8aBDYZ/OTbxcaJNwdfr9XzR1s0gaqOHJSbz3u/ZKskzcVDGlQTYnSp+NMGex/pu9x19Ny3QU6vKuLrZWqIpf83yp/T6rsNa/42rOBi/+QnPciRfy/sE0nOozNLNn0ikgDruA9fhEPJHrCxvqBHXvUXiltZ/6zGPlpIrrhfp8xq32kjsvzWgYlzvO+WHTguQuXeaWhBNd1QuL+AuudyBPjiY8SskVzjrpucHEqwJvMd57hA3LrOig4NlzD8SE2Wt1PM58yzOEVbf6qEYEvfZQeF29L5fkrJH2OVyF22Jsg/cikW/KmvCva0xkU6jdUUabjRpU3rNYB8fmat4+wiP5V6bL7bV+mIfNre3/mP1dPVNfJ0RzEW2d4UpFFDq1nLWdT3ehvxVJXk2b2Rr7mp9KHVUByrUbqNZNjUqqj96t7DnBvHIfYijDroDsBpdo69q5W5h5fKaWE9otVb+skaNIVJsSyhBf9Aur8AxMI23dznXpm4L2sXq6L7Xl8GsX2TVft4k4PM4aKwh/xacOzrkj1SU9cAJ3KcaiQTVFYmOMRrqapyYoYx/CN2OqmPWkon/YoNGTo7GDSikwk6eM= X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230016)(4636009)(376002)(39860400002)(136003)(396003)(346002)(40470700004)(46966006)(36840700001)(40460700003)(36860700001)(82740400003)(7636003)(8676002)(356005)(4326008)(6636002)(316002)(54906003)(110136005)(40480700001)(336012)(186003)(70586007)(2906002)(7416002)(8936002)(47076005)(15650500001)(70206006)(44832011)(5660300002)(4744005)(2616005)(1076003)(426003)(9786002)(83380400001)(82310400005)(478600001)(6666004)(41300700001)(26005)(36756003)(7696005)(102446001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2022 12:02:26.1113 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 339c6eb6-6c37-461c-c14c-08da55d967ad 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-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0060.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB8211 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220624_050231_874183_1ED9539F X-CRM114-Status: UNSURE ( 9.78 ) 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 As per RTC spec default calibration value is 0x7FFF. We are in process to update the 0x7FFF as default value in the next version of TRM. Signed-off-by: Srinivas Neeli Acked-by: Peter Korsgaard --- Changes in V8 -None, just swapped 2/3 and 3/3 patches from V7. Changes in V7: -New patch -TRM not updated yet, Internal design document contains 0x7FFF as default value. TRM Will update in next release. --- drivers/rtc/rtc-zynqmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index f440bb52be92..5da33d760419 100644 --- a/drivers/rtc/rtc-zynqmp.c +++ b/drivers/rtc/rtc-zynqmp.c @@ -36,7 +36,7 @@ #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 From patchwork Fri Jun 24 12:02:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 12894436 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 7295FC433EF for ; Fri, 24 Jun 2022 12:04:21 +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=yB/Y1I3wAqq/3a2nBGR+NjT/NTXnKm9zxRVJ6JH1HPU=; b=Jig1yVcKpijHWg fP6Mrbm8yVcfVwjt2pJqvOQDJSUiCm6ttuTICgDm3CrRe2EqSopFrmdAyvO92siHzzEA/y0GK2kNW rtbthopszaN0KHoAY+6Ky+niyJh3pABBOyMCcsP4J/5elI6NfWRjeBI4n1kVYb4dt8HZycgQ/TDdd LQIXvKQ0FApBF2g7JGciR9uuacHVXgvPld7alPL0MzlcDl7N/HBp3lt8lbTiYA+GXKe9Td+mOoIZG qt7iz4nYmYQQmX8TVw/6HC1nyP7uloxkDh49hoTvdWY+4aekS6JVxDWuw16d03aaE1c1BH7Otu9zd 2Z1VtPz8IwzpOvqVQtbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4i1e-0023Ph-33; Fri, 24 Jun 2022 12:03:02 +0000 Received: from mail-bn7nam10on2058.outbound.protection.outlook.com ([40.107.92.58] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4i19-00238X-Ez for linux-arm-kernel@lists.infradead.org; Fri, 24 Jun 2022 12:02:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BVJfDK4NOmKV0/UMQxXs9YKeqcjl3Elmfh82eljnu42eAEOxlUw8RV6Dl1jmfwBH0h++YjCiIT/7K7t/ZDvb30GBdMJAl/av+zzMW/e6g0xw7Me3twOmVDOgwTXuwdUiUJew5VB7JQCbPvG3EOoz6IvlCPv4yTsqPjb2vgw39H/jwMaZ1ayTkjM3WFp+Gq7o2a7ihGA9q7YtAcf03S/nJdxEI3rc6xoCur5GIGFbuVa58Z0J/iU/IQ65Aw9A7DaCMi8yLaVlsvha8lgHtg1gCPHNWN31B8bbyP/OG+PtwffOvJH6qUqH/hcpBbNzEAVDQZTzu3kCiW1A2EYSyxPfvg== 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=a4/bCQN3O7eZp/wltAreVBuLZkQ6lrXALa+pW/PfpyI=; b=bc3c0WLLxWukymhKqL0wQ/HTHVSi7y8BRJhoe4qUWnQ9QAvezRvvJDfv7cZz/J4CGl9LMvD489v3Sed6bL2X/vToAPKMivKFg+ili0J3NFAtblWXVdef7w68JkujPiEaiGo7Zc/+63LZXHXGh6/+h/9+VOVqQl6FZDjQ8fjHxICl3jtmlmYw7hEcd8QCqHlQ1xB2qhgSBXE8/NK0lsrZgiivTaLWG8YBSkTcRVAbfGBxTousaVz2zVONDZnIb8whVL9kGMKqOTi3pNp3EtMTpG+Y1tpYgXM70t9nTSiuGS8oCWPO8CSEd6QpRuXRyb5cVo2AZswaRoseCc+1pE6zNQ== 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=a4/bCQN3O7eZp/wltAreVBuLZkQ6lrXALa+pW/PfpyI=; b=WRnGInPn9KVu1bsVcA+ZcF22ogJ7m9c6L8c9IN87bSkx0HRzVpr7BBirtzmg+lkMsc+gIauzglRkDEcrgGvE8IPg7jF+Ur0GJI5PvZgzhWziR+vk8fJ6Z9HoW+lZBgi1/zlZjHElQbjegXmGtgVoscdP3vLomo+3LmIc8krnD60= Received: from BN9PR03CA0270.namprd03.prod.outlook.com (2603:10b6:408:ff::35) by SA0PR02MB7369.namprd02.prod.outlook.com (2603:10b6:806:e3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.17; Fri, 24 Jun 2022 12:02:26 +0000 Received: from BN1NAM02FT051.eop-nam02.prod.protection.outlook.com (2603:10b6:408:ff:cafe::c7) by BN9PR03CA0270.outlook.office365.com (2603:10b6:408:ff::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15 via Frontend Transport; Fri, 24 Jun 2022 12:02:26 +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 BN1NAM02FT051.mail.protection.outlook.com (10.13.2.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5373.15 via Frontend Transport; Fri, 24 Jun 2022 12:02:25 +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, 24 Jun 2022 05:02:20 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 24 Jun 2022 05:02:20 -0700 Received: from [10.140.6.39] (port=57958 helo=xhdsgoud40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1o4i0x-0009E0-Uh; Fri, 24 Jun 2022 05:02:20 -0700 From: Srinivas Neeli To: , , , , , , , , CC: , , , , , , Srinivas Neeli Subject: [PATCH V9 3/3] rtc: zynqmp: Add calibration set and get support Date: Fri, 24 Jun 2022 17:32:03 +0530 Message-ID: <20220624120203.2817457-3-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624120203.2817457-1-srinivas.neeli@xilinx.com> References: <20220624120203.2817457-1-srinivas.neeli@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1daea13d-a58f-4236-8dfa-08da55d9676a X-MS-TrafficTypeDiagnostic: SA0PR02MB7369:EE_ 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: /27y6/3DPaxit2/gdeSa6x9QDDEXZGdJ2MCCtqKd2FWmQGg1gHHwKBSIDa9eUW94HR6u0VR7CilgpKPpN6jtDW7vOd0IBKQaNOdlFQoSfWtcWQHwfYTdt7duih15ttz37gHT1CwA86Q11dfW7isDP8SJK/WrH75Jfl2iVw5zcjkunMIT+xBMKFag2tXc+dQBJoxxCFhdS2IGMKmwrRygRA1xw+8dfpwCoCA7yM0mbvoFHwvdSn/4dbw5giY9fNA+3sN8wuJpt7HDB+Ip7dAFnpNONDC5Le58bxPSjxfOSTqoV068WjqqG7d7uYNwW2M1nerLCE1siVFF92Y445w3TOCbct09EalifFa2f6T7RBaHlFKHH5kpOFV5Q4Q641DiqQURe4w7a3KSfmULAIvy1oMgeRJK8CC7NdSxlVw5biHLVJhWoUXVUB6X+4+/0L39JHk8asCpL2Ok/CHmD42tmz0WxcTMIqnJF1EejouCzpfDrpCAz2xCCGpE4ZdFmaIjW6vjo4kVcwmFUwId/h2eUUgoWvoKCNjx3RUG7cCWizLU9f4TNa6bfZnpxpdz9HsQ64slO5Z6isOh0r5loH5w1HczXrk00ZuimcA8d1OA1fBjAiOwRH4r6xHSg9ppuvSyu5VB8RiA//LWbXxvr7F7Y7+VH4qzg9DMzOKd+eamu+NkoARXkLiv+/VonW1lOPaUxuS1wWiM08juxG3KKV/WFLF22usXxp2aRp9d1Asw+0MdTaxlyN0aB49yEPIeeefCj+O5iH6XG2mVRrBUJK182DV8z+NBazbyXd98egYuBXZmmIFAW/HFfHdFOoEHHOC0xu/M3G/3if/lJxqkVKVVFKCjG5xiINGlSNFSWA34uyo= 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:(13230016)(4636009)(39860400002)(396003)(346002)(376002)(136003)(40470700004)(46966006)(36840700001)(7636003)(70586007)(44832011)(70206006)(2616005)(8676002)(54906003)(4326008)(36860700001)(40480700001)(110136005)(186003)(5660300002)(82740400003)(1076003)(107886003)(7416002)(7696005)(356005)(9786002)(8936002)(6636002)(83380400001)(41300700001)(6666004)(47076005)(36756003)(336012)(316002)(26005)(426003)(2906002)(82310400005)(478600001)(40460700003)(102446001)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2022 12:02:25.6240 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1daea13d-a58f-4236-8dfa-08da55d9676a 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: BN1NAM02FT051.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR02MB7369 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220624_050231_618604_4973C9DC X-CRM114-Status: GOOD ( 21.84 ) 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. Signed-off-by: Srinivas Neeli --- Changes in V9: -None Changes in V8: -None Changes in V7: -Removed calibration default value update from this patch. Changes in V6: -None 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 | 113 ++++++++++++++++++++++++++++++++------- 1 file changed, 94 insertions(+), 19 deletions(-) diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index 5da33d760419..1dd389b891fe 100644 --- a/drivers/rtc/rtc-zynqmp.c +++ b/drivers/rtc/rtc-zynqmp.c @@ -6,6 +6,7 @@ * */ +#include #include #include #include @@ -40,13 +41,19 @@ #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);