linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Romain Perier <romain.perier@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	Daniel Palmer <daniel@0x0f.com>, Rob Herring <robh+dt@kernel.org>,
	linux-rtc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] rtc: Add support for the SSD20xD RTC
Date: Tue, 30 May 2023 00:40:39 +0200	[thread overview]
Message-ID: <20230529224039a7f270b9@mail.local> (raw)
In-Reply-To: <20230517144144.365631-2-romain.perier@gmail.com>

Hello,

On 17/05/2023 16:41:42+0200, Romain Perier wrote:
> Newer SigmaStar SSD20xD SoCs contain a really low power RTC (300uA claimed),

The low power RTCs are more on the side of a few tenth of nA. RV3028
consumes 40nA, including the crystal. AB1805 consumes 14nA with an RC
oscillator. It is funny how SoC vendors think they are low power ;)

> +static int ssd20xd_rtc_isoctrl(struct ssd20xd_rtc *priv)
> +{
> +	static const unsigned int sequence[] = { 0x0, 0x1, 0x3, 0x7, 0x5, 0x1, 0x0 };
> +	unsigned int val;
> +	struct device *dev = &priv->rtc_dev->dev;
> +	int i, ret;
> +
> +	/*
> +	 * This gates iso_en by writing a special sequence of bytes to iso_ctrl
> +	 * and ensuring that it has been correctly applied by reading iso_ctrl_ack
> +	 */
> +	for (i = 0; i < ARRAY_SIZE(sequence); i++) {
> +		writeb(sequence[i] & ISO_CTRL_MASK, priv->base +  REG_ISO_CTRL);
> +
> +		ret = read_poll_timeout(read_iso_ctrl_ack, val, val == (i % 2), 100,
> +					20 * 100, true, priv->base);
> +		if (ret) {
> +			dev_err(dev, "Timeout waiting for ack byte %i (%x) of sequence\n", i,
> +				sequence[i]);

This is a user visible message but there is no action for the user to
take apart from retrying. You should drop this.

> +			return ret;
> +		}
> +	}
> +
> +	/*
> +	 * At this point iso_en should be raised for 1ms
> +	 */
> +	ret = read_poll_timeout(read_iso_en, val, val, 100, 22 * 100, true, priv->base);
> +	if (ret)
> +		dev_err(dev, "Timeout waiting for iso_en\n");

Ditto.

> +	mdelay(2);
> +	return 0;
> +}
> +

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-05-29 22:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 14:41 [PATCH 0/3] Add RTC for MStar SSD20xD SoCs Romain Perier
2023-05-17 14:41 ` [PATCH 1/3] rtc: Add support for the SSD20xD RTC Romain Perier
2023-05-29 22:40   ` Alexandre Belloni [this message]
2023-05-29 23:06     ` Daniel Palmer
2023-05-17 14:41 ` [PATCH 2/3] dt-bindings: rtc: Add Mstar SSD20xD RTC devicetree bindings documentation Romain Perier
2023-05-17 17:44   ` Conor Dooley
2023-05-22  6:47     ` Romain Perier
2023-05-22  7:16       ` Conor Dooley
2023-05-18  8:24   ` Krzysztof Kozlowski
2023-05-22 11:27     ` Romain Perier
2023-05-30  8:01       ` Krzysztof Kozlowski
2023-05-30 23:12         ` Daniel Palmer
2023-05-31  6:49           ` Krzysztof Kozlowski
2023-05-31 22:26             ` Daniel Palmer
2023-05-17 14:41 ` [PATCH 3/3] ARM: dts: mstar: Enable rtc for SSD20xD Romain Perier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230529224039a7f270b9@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=daniel@0x0f.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=romain.perier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).