[PATCH 1/3] rtc: Add support for the SSD20xD RTC

Alexandre Belloni alexandre.belloni at bootlin.com
Mon May 29 15:40:39 PDT 2023


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



More information about the linux-arm-kernel mailing list