Received: by 10.192.165.148 with SMTP id m20csp4402217imm; Tue, 8 May 2018 07:57:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrhEKDSHYjO7yHR1jx7rNHI0D2TpT1sFeGvQEQNeQ/cxmutxk10uP22hqkhsxOqDC1O2i4d X-Received: by 10.98.20.195 with SMTP id 186mr22783325pfu.92.1525791433228; Tue, 08 May 2018 07:57:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525791433; cv=none; d=google.com; s=arc-20160816; b=EvtzY+cUTd89PprpLU89vP/YohydI/RISBjrpweDshl2y6+pbEwhik5aAuTU168MJl 0wJkq+TH361e6tG2dpW9tL014aLeGAijGZgUCN0SxBn4cg69/sBlfV9XNB1LJf3hV4Vg LDuF/xtZ39joX0u8Nzi7GMtBSLbk6y2aqAyZ8YiY4lktgiRHBE58M+l7Lbw+K/ln3iMH AUVNjFQxxVPFG7fBDGdAslJzfJ1dUr+N5L7TwtsmscxzBh0u345f/XKHpOzEr2z78Jdi uZidwtNJtD4Z7Wqakz3BgJpG9Owa5ssfCYvuPs6oWkr0EqvDQB7ZDqXnOjMYpBZlthgh spWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=NPtjZ9lpw7daYPY6hsbYnIxQqz+7zi07fjfk7+DuZUw=; b=ULnF5d8vxStV2+N9WgGhAZTxTXXPYmraOlJBW699WMTk8kQqYpbhBDTQL5/Ygz7lzM 6Od/7sNOca84V6RPDaKi37fWMi1zVDAV312KgFGOYnUaWLJ73bGKKSMtjPJaa6CvmT+g seALtSq0zF96CFK+U58gvSg/dVpJ/JnQoXXmQRoxuoT7y9BXkE6ekBT0L03o1aVR1i3h m6tY6cwrF49pULGqCMC8A+pSgPXXg4pi4HmnouekCt9PeqfkWKPNbmiGG6fbZWHdccNF risIWbW2ya8nXlvKlji2+hHXnxv4hB8aeawjlOK2KFhhn2Qra2DXy8vdr620YVkqV+C5 Bbhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=FYbZTEXC; 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 n34-v6si24170581pld.91.2018.05.08.07.56.58; Tue, 08 May 2018 07:57:13 -0700 (PDT) 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=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=FYbZTEXC; 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 S932879AbeEHO4g (ORCPT + 99 others); Tue, 8 May 2018 10:56:36 -0400 Received: from mail.micronovasrl.com ([212.103.203.10]:38028 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932784AbeEHO40 (ORCPT ); Tue, 8 May 2018 10:56:26 -0400 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 47C86B00BB2 for ; Tue, 8 May 2018 16:56:25 +0200 (CEST) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=references:in-reply-to:x-mailer:message-id:date:date:subject :subject:to:from:from; s=dkim; t=1525791384; x=1526655385; bh=kd zD8vRwslVks8358P8Y4jFLYxwai9SQbmoyaMxlVAM=; b=FYbZTEXC6Cx9X4ma60 uOnylULWU4TwFa4qBLMiJHu0QXAkhSk3dYFlSNA8TBamSKC0KbQQ/oFswywMDm0M sRS76aoFIT3xoBbtQO39ytDZfA1w7MobIDAjhMKUmPp03vjp5dK52gSfVQ9MjAtV v1YTihFD1DrvETQdVHxoO3R6w= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.899 X-Spam-Level: X-Spam-Status: No, score=-2.899 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9l6i1pbye73I for ; Tue, 8 May 2018 16:56:24 +0200 (CEST) Received: from localhost.localdomain (unknown [192.168.123.85]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 1E7F4B0097C; Tue, 8 May 2018 16:56:17 +0200 (CEST) From: Giulio Benetti To: a.zummo@towertech.it Cc: alexandre.belloni@bootlin.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Giulio Benetti Subject: [PATCH 4/4] rtc: ds1307: add frequency-test property to check calibration on m41txx Date: Tue, 8 May 2018 16:56:11 +0200 Message-Id: <20180508145611.49072-4-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180508145611.49072-1-giulio.benetti@micronovasrl.com> References: <20180508145611.49072-1-giulio.benetti@micronovasrl.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On m41txx you can enable open-drain OUT pin to check if calibration is ok. Enabling OUT pin with frequency-test bool property, OUT pin will tick 512 times faster than 1s tick base. Enable FT bit on CONTROL register if calibration is active. Signed-off-by: Giulio Benetti --- Documentation/devicetree/bindings/rtc/rtc-ds1307.txt | 3 +++ drivers/rtc/rtc-ds1307.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/rtc/rtc-ds1307.txt b/Documentation/devicetree/bindings/rtc/rtc-ds1307.txt index d3d70a5495c5..72a5f8cdc306 100644 --- a/Documentation/devicetree/bindings/rtc/rtc-ds1307.txt +++ b/Documentation/devicetree/bindings/rtc/rtc-ds1307.txt @@ -36,6 +36,9 @@ Optional properties: Should be given if internal trickle charger diode should be disabled - calibration: m41t0, m41t00, m41t11 only Set calibration value to correct external bias, ranging between (-31) and 31. +- frequency-test: m41t0, m41t00, m41t11 only + Enable open-drain OUT pin 512 times faster than 1 second tick. + This allows to check calibration value. Example: rtc1: ds1339@68 { diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 9cda52589c0f..a727ced157df 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -1485,6 +1485,10 @@ static int ds1307_probe(struct i2c_client *client, if (calib >= 0) out_byte |= M41TXX_BIT_CALIB_SIGN; + if (of_property_read_bool(client->dev.of_node, + "frequency-test")) + out_byte |= M41TXX_BIT_FT; + regmap_write(ds1307->regmap, M41TXX_REG_CONTROL, out_byte); } -- 2.17.0