[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230529224039a7f270b9@mail.local>
Date: Tue, 30 May 2023 00:40:39 +0200
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Romain Perier <romain.perier@...il.com>
Cc: Alessandro Zummo <a.zummo@...ertech.it>,
Daniel Palmer <daniel@...f.com>,
Rob Herring <robh+dt@...nel.org>, linux-rtc@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 1/3] rtc: Add support for the SSD20xD RTC
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
Powered by blists - more mailing lists