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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Wolfram,

On Thu, Apr 17, 2025 at 9:12 PM Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> 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@smarc-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@smarc-rzg2l:~/i2c# ./incomplete_address_phase.sh
Error: Read failed
I2C Read error (ret:0) !!
root@smarc-rzg2l:~/i2c# ./incomplete_address_phase.sh
Read val:0x83
root@smarc-rzg2l:~/i2c# ./incomplete_address_phase.sh
Error: Read failed
I2C Read error (ret:0) !!
root@smarc-rzg2l:~/i2c# ./incomplete_address_phase.sh
Read val:0x83
root@smarc-rzg2l:~/i2c# ./incomplete_address_phase.sh
Error: Read failed
I2C Read error (ret:0) !!
root@smarc-rzg2l:~/i2c#
root@smarc-rzg2l:~/i2c#

Cheers,
Prabhakar





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux