Re: [PATCH v8] i2c: riic: Implement bus recovery

From: Wolfram Sang
Date: Thu Apr 17 2025 - 16:14:01 EST



> As suggested I have the below now, (are there any changes Ive missed?)

Well, get_sda should really only get SDA :)
>
> +static int riic_get_sda(struct i2c_adapter *adap)
> +{
> + struct riic_dev *riic = i2c_get_adapdata(adap);
> +
> + /* Check if the bus is busy or SDA is not high */
> + if ((riic_readb(riic, RIIC_ICCR2) & ICCR2_BBSY) ||
> + !(riic_readb(riic, RIIC_ICCR1) & ICCR1_SDAI))
> + return -EBUSY;
> +
> + return 1;
> +}

I have

+static int riic_get_sda(struct i2c_adapter *adap)
+{
+ struct riic_dev *riic = i2c_get_adapdata(adap);
+
+ return !!(riic_readb(riic, RIIC_ICCR1) & ICCR1_SDAI);
+}

I believe the BBSY handling could be why it does not work.

Attachment: signature.asc
Description: PGP signature