Re: [PATCH v3 8/8] i2c: riic: Add `riic_bus_barrier()` to check bus availability

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

 



Fri, Dec 27, 2024 at 11:51:54AM +0000, Prabhakar kirjoitti:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
> 
> Introduce a new `riic_bus_barrier()` function to verify bus availability
> before initiating an I2C transfer. This function enhances the bus
> arbitration check by ensuring that the SDA and SCL lines are not held low,
> in addition to checking the BBSY flag using `readb_poll_timeout()`.
> 
> Previously, only the BBSY flag was checked to determine bus availability.
> However, it is possible for the SDA line to remain low even when BBSY = 0.
> This new implementation performs an additional check on the SDA and SCL
> lines to avoid potential bus contention issues.

...

> +	/*
> +	 * The SDA line can still be low even when BBSY = 0. Therefore, after checking
> +	 * the BBSY flag, also verify that the SDA and SCL lines are not being held low.
> +	 */
> +	ret = readb_poll_timeout(riic->base + riic->info->regs[RIIC_ICCR2], val,
> +				 !(val & ICCR2_BBSY), 10, riic->adapter.timeout);
> +	if (ret)
> +		return -EBUSY;

Why the return code is shadowed? Is it requirement by ABI?

> +	if ((riic_readb(riic, RIIC_ICCR1) & (ICCR1_SDAI | ICCR1_SCLI)) !=
> +	     (ICCR1_SDAI | ICCR1_SCLI))
> +		return -EBUSY;
> +
> +	return 0;
> +}

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux