[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+V-a8tmTqFi4iqGhR3cfUgKw7mxJrm6ixGAHq747ptrL3t2jA@mail.gmail.com>
Date: Fri, 18 Apr 2025 09:13:32 +0100
From: "Lad, Prabhakar" <prabhakar.csengg@...il.com>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>,
"Lad, Prabhakar" <prabhakar.csengg@...il.com>, Chris Brandt <chris.brandt@...esas.com>,
Andi Shyti <andi.shyti@...nel.org>, Geert Uytterhoeven <geert+renesas@...der.be>,
linux-renesas-soc@...r.kernel.org, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org, Biju Das <biju.das.jz@...renesas.com>,
Fabrizio Castro <fabrizio.castro.jz@...esas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
Claudiu Beznea <claudiu.beznea.uj@...renesas.com>, Andy Shevchenko <andy@...nel.org>
Subject: Re: [PATCH v8] i2c: riic: Implement bus recovery
Hi Wolfram,
On Thu, Apr 17, 2025 at 9:12 PM Wolfram Sang
<wsa+renesas@...g-engineering.com> wrote:
>
>
> > 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.
>
Thanks, that did the trick. The incomplete_write_byte test case is
passing for me. Now moving onto the incomplete_address_phase case this
seems to be failing on my side. Did you test this on your side?
root@...rc-rzg2l:~/i2c# cat incomplete_address_phase.sh
cd /sys/kernel/debug/i2c/i2c-4/
for i in {1..1}; do
echo 0x68 > incomplete_address_phase;
val=$(i2cget -y -f 3 0x68 8)
if [ "$?" != "0" ] || [ "${val}" != "0x83" ]; then
echo "I2C Read error (ret:$?) ${val}!!"
exit 1
fi
echo "Read val:${val}"
done
root@...rc-rzg2l:~/i2c# ./incomplete_address_phase.sh
Error: Read failed
I2C Read error (ret:0) !!
root@...rc-rzg2l:~/i2c# ./incomplete_address_phase.sh
Read val:0x83
root@...rc-rzg2l:~/i2c# ./incomplete_address_phase.sh
Error: Read failed
I2C Read error (ret:0) !!
root@...rc-rzg2l:~/i2c# ./incomplete_address_phase.sh
Read val:0x83
root@...rc-rzg2l:~/i2c# ./incomplete_address_phase.sh
Error: Read failed
I2C Read error (ret:0) !!
root@...rc-rzg2l:~/i2c#
root@...rc-rzg2l:~/i2c#
Cheers,
Prabhakar
Powered by blists - more mailing lists