Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1075441ybh; Sun, 19 Jul 2020 07:51:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv1UNmS3/W3hPWU2rKLxp28mmX2TZPY7tzPhAQsUpne79szEHjnc2Xg0/QRpdp+y0Y9q4f X-Received: by 2002:a17:906:3152:: with SMTP id e18mr17531776eje.137.1595170284208; Sun, 19 Jul 2020 07:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595170284; cv=none; d=google.com; s=arc-20160816; b=DairhyzgWloBTXyNc0d0+pMvFFk2tOX8rFJ4Ctq2tawQY6xtSwce3Z5dwkGPtJxtDh pWOrBbw4HBmhRw2nOCRXqGBK6s8A6f2rsIzdyv6JpvULg+M1EGco17HTvX768KO1vBUB /mNe5RByC6iR7w8LrB+S93qEK7HyDWKEfYUjmXH1Hk8bRL9JsSIdYJdm6G0y2CKo4NzQ CvDPD88ge65U79zJVccgkrbmIbsPr6R8NsOngAfj4t6v6rcrS5lkBo2ZpFJ8/9B6WPsC dmjNtmbaWSQxtqMEY18vzmzxPSFHL43OOx2tV3K3L0nJvXKaKs3WL/zJm3Da/pyiFHRg TJkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UUqLFtjizIDo67kZSDAuxTvDZ8v5hpCknWjlNVsJDEE=; b=xOFprctCGYRJhBrh/i+AzorTimW2ID0P5C8X3LbC3EHPXL9rSFdKnlkOHDuzCiUSiE /AKINcEjYzLJBoNTKZ8HIlsHsKERbrtfjDftrJMu4Qkm0t+TWgpvGCKw5xELoWXNbt/g 4BJqXQ+fiaLobdaRqp2mwP6/5aCvROaS8mKMXV3I5evRl72e3DjzTS1Cs18gYtp5Ibro 0dLk40O8HsmPeX0Z/b+8NJ0E8AKQ419KfvOIGtgaeLRPv8VfiDHxaB9am6pGBhkb5p8h DQ+eutsUS26LLD7xj91ktEi21FaSUMJEZbVVNXiGIk/9Ca/cE8LUO2P/W9H7ul2GdIgq cdWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G7Eq1PJQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz17si8638368ejc.222.2020.07.19.07.50.48; Sun, 19 Jul 2020 07:51:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G7Eq1PJQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726126AbgGSOuk (ORCPT + 99 others); Sun, 19 Jul 2020 10:50:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbgGSOuj (ORCPT ); Sun, 19 Jul 2020 10:50:39 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BA55C0619D2; Sun, 19 Jul 2020 07:50:39 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id o11so15429412wrv.9; Sun, 19 Jul 2020 07:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UUqLFtjizIDo67kZSDAuxTvDZ8v5hpCknWjlNVsJDEE=; b=G7Eq1PJQEyo8Takx/kaoykf4sk2/Xa1qsLGrafGiL8XQGE29sZLmx1ECnQuj/OBfHl dB3FB7qhSLBZ8EEjKI1t7h2fioIKfHRGdRFHB2Hun7yq2nkIcFaoNOAnLs0mncD2jZuZ Z+aEEPMPtmj7tPH+uyy/9jj7avxhM5DVK4WrmG/Z2+0aZM8XXBW8P7uTJlsRO/MsYO3L auqYIb/2kG0WJWuWZ5rfJ+3cYUcS9zErm28ppynDT62SlbtLzXoYIW9awCdktV+pijym /gIVw/oMoOFgp1yuIZtjWn6LWJ3A2rrQ/0Mw6wSQovG415EgsY4EsRLLNo/7GpnQH3mJ Virg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UUqLFtjizIDo67kZSDAuxTvDZ8v5hpCknWjlNVsJDEE=; b=R9nYfO4MKx6X9VCvFL2x4BF0EX2IYgqSRV1bSRtJoZ0y7nurP4A2hgXtl8YyJKTQOz XGa8Nb4eDj07ke5Xv8lBe5532TE972sWcrZO0OASQEhxmr6Fw6V2yQUN/hEJFWYN2mpz ktvKGmYt3jH0RCY2xUSqgVP/AFeAowv0KHePVwhp79wV0g38QKb23ujrbSkNXEfAvpdO moiIklfchtwEeu7zOTSqf+zrC6rFojGk05z1pTCiT3NHvqYs63FF0AHIRThvIfK7IRbS jzd5pa+1Pr+eyVAPS191maNFfDqx278/TbkESNTAP8gEtFjfCiLaQtDrvKpnDpp+4coZ KA2g== X-Gm-Message-State: AOAM532+igXbbLUKMBx/KY6m5xCGH9UhzyLLW55GoL4w+k0O1jHsKiG2 adeNUsYzB/xJIB/iS8vTC8w= X-Received: by 2002:a5d:6107:: with SMTP id v7mr18012777wrt.174.1595170237975; Sun, 19 Jul 2020 07:50:37 -0700 (PDT) Received: from localhost.localdomain (arl-84-90-179-3.netvisao.pt. [84.90.179.3]) by smtp.gmail.com with ESMTPSA id d13sm26422755wrq.89.2020.07.19.07.50.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jul 2020 07:50:37 -0700 (PDT) From: miguelborgesdefreitas@gmail.com To: a.zummo@towertech.it Cc: linux@armlinux.org.uk, alexandre.belloni@bootlin.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, miguelborgesdefreitas@gmail.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/2] rtc: pcf8523: Make DSM for battery switch-over configurable from DT and enable it for the cubox-i Date: Sun, 19 Jul 2020 15:50:26 +0100 Message-Id: <20200719145028.3370-1-miguelborgesdefreitas@gmail.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miguel Borges de Freitas The pcf8523 has two configurable modes for the battery switch-over functionality: (i) the default mode and (ii) the direct switching mode. For the default mode to work (at the moment the only driver option), a filtering circuit consisting of a series resistor of 1 kOhm and a capacitor of 3.3 microF must be added to the VDD pin input to guarantee a voltage drop of less 0.7V/ms for the oscillator operation reliability (see pp.54 of the datasheet). Some boards (e.g. the cubox-i) do not include such circuitry and are designed to work only in direct switching mode. In fact, this is the recommended mode in the datasheet for hw designs where VDD is always expected to be higher than VBAT. If DSM is not enabled, after a power cycle, the voltage drop may be too high causing the oscillator to stop working momentarily and the REG_SECONDS_OS bit to be set. This causes userspace applications such as timedatectl and hwclock to fail when obtaining the RTC time (RTC_RD_TIME: Invalid argument). Hence, this patch set makes DSM configurable for the pcf8523 RTC in the device-tree and enables it for the board where this issue was detected - the cubox-i. Note that if the RTC comes from an inconsistent state, the software reset will override any power management options set during the probe phase. Thus, pm is also enforced in pcf8523_start_rtc. Miguel Borges de Freitas (2): rtc: pcf8523: Make DSM for battery switch-over configurable from DT ARM: dts: imx6qdl-cubox-i: enable DSM for the RTC Documentation/devicetree/bindings/rtc/nxp,pcf8523.txt | 7 ++++++- Documentation/devicetree/bindings/rtc/rtc.yaml | 7 +++++++ arch/arm/boot/dts/imx6qdl-cubox-i.dtsi | 1 + drivers/rtc/rtc-pcf8523.c | 13 ++++++++++--- 4 files changed, 24 insertions(+), 4 deletions(-) -- 1.8.3.1