lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 26 Apr 2018 14:30:09 +0200
From:   Ludovic Desroches <ludovic.desroches@...rochip.com>
To:     David Engraf <david.engraf@...go.com>
CC:     <ludovic.desroches@...rochip.com>, <nicolas.ferre@...rochip.com>,
        <alexandre.belloni@...tlin.com>, <linux-i2c@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] i2c: at91: Read all available bytes at once

On Thu, Apr 26, 2018 at 11:53:14AM +0200, David Engraf wrote:
> With FIFO enabled it is possible to read multiple bytes
> at once in the interrupt handler as long as RXRDY is
> set. This may also reduce the number of interrupts.
> 
> This patch polls RXRDY and reads all available bytes at
> once.
> 
> Signed-off-by: David Engraf <david.engraf@...go.com>
Acked-by: Ludovic Desroches <ludovic.desroches@...rochip.com>

Thanks a lot David.

Regards

Ludovic

> ---
>  drivers/i2c/busses/i2c-at91.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index bfd1fdff64a9..9caee5b79eac 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -518,8 +518,16 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id)
>  	 * the RXRDY interrupt first in order to not keep garbage data in the
>  	 * Receive Holding Register for the next transfer.
>  	 */
> -	if (irqstatus & AT91_TWI_RXRDY)
> -		at91_twi_read_next_byte(dev);
> +	if (irqstatus & AT91_TWI_RXRDY) {
> +		/*
> +		 * Read all available bytes at once by polling RXRDY usable w/ and w/o
> +		 * FIFO. With FIFO enabled we could also read RXFL and avoid polling
> +		 * RXRDY.
> +		 */
> +		do {
> +			at91_twi_read_next_byte(dev);
> +		} while (at91_twi_read(dev, AT91_TWI_SR) & AT91_TWI_RXRDY);
> +	}
>  
>  	/*
>  	 * When a NACK condition is detected, the I2C controller sets the NACK,
> -- 
> 2.14.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ