Message ID | 20230517144144.365631-1-romain.perier@gmail.com |
---|---|
Headers | show |
Series | Add RTC for MStar SSD20xD SoCs | expand |
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; > +} > +
Hi Alexandre, On Tue, 30 May 2023 at 07:40, Alexandre Belloni <alexandre.belloni@bootlin.com> wrote: > > 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 ;) To be fair to them I think the 300uA claim is for the whole SoC in RTC-only deep sleep. Whatever logic is powered on alongside the RTC to trigger wake up will be part of that number I guess. Cheers, Daniel