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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 05 Jun 2024 11:30:35 +0200
From: Nuno Sá <noname.nuno@...il.com>
To: Marcelo Schmitt <marcelo.schmitt@...log.com>, broonie@...nel.org, 
 lars@...afoo.de, Michael.Hennerich@...log.com, jic23@...nel.org, 
 robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
  nuno.sa@...log.com, dlechner@...libre.com, marcelo.schmitt1@...il.com
Cc: linux-iio@...r.kernel.org, devicetree@...r.kernel.org, 
	linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/6] spi: bitbang: Implement support for MOSI idle
 state configuration

On Tue, 2024-06-04 at 19:42 -0300, Marcelo Schmitt wrote:
> Some SPI peripherals may require strict MOSI line state when the controller
> is not clocking out data.
> Implement support for MOSI idle state configuration (low or high) by
> setting the data output line level on controller setup and after transfers.
> Bitbang operations now call controller specific set_mosi_idle() call back
> to set MOSI to its idle state.
> The MOSI line is kept at its idle state if no tx buffer is provided.
> 
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@...log.com>
> ---

Some minor nit below in case a re-spin is needed. Anyways,

Acked-by: Nuno Sa <nuno.sa@...log.com>

>  drivers/spi/spi-bitbang.c       | 24 ++++++++++++++++++++++++
>  include/linux/spi/spi_bitbang.h |  1 +
>  2 files changed, 25 insertions(+)
> 
> diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c
> index ca5cc67555c5..3dee085d3570 100644
> --- a/drivers/spi/spi-bitbang.c
> +++ b/drivers/spi/spi-bitbang.c
> @@ -63,21 +63,28 @@ static unsigned bitbang_txrx_8(
>  	unsigned flags
>  )
>  {
> +	struct spi_bitbang	*bitbang;
>  	unsigned		bits = t->bits_per_word;
>  	unsigned		count = t->len;
>  	const u8		*tx = t->tx_buf;
>  	u8			*rx = t->rx_buf;
>  
> +	bitbang = spi_controller_get_devdata(spi->controller);
>  	while (likely(count > 0)) {
>  		u8		word = 0;
>  
>  		if (tx)
>  			word = *tx++;
> +		else
> +			word = (spi->mode & SPI_MOSI_IDLE_HIGH) ? 0xFF : 0;

no need for ()

>  		word = txrx_word(spi, ns, word, bits, flags);
>  		if (rx)
>  			*rx++ = word;
>  		count -= 1;
>  	}
> +	if (bitbang->set_mosi_idle)
> +		bitbang->set_mosi_idle(spi);
> +
>  	return t->len - count;
>  }
>  
> @@ -92,21 +99,28 @@ static unsigned bitbang_txrx_16(
>  	unsigned flags
>  )
>  {
> +	struct spi_bitbang	*bitbang;
>  	unsigned		bits = t->bits_per_word;
>  	unsigned		count = t->len;
>  	const u16		*tx = t->tx_buf;
>  	u16			*rx = t->rx_buf;
>  
> +	bitbang = spi_controller_get_devdata(spi->controller);
>  	while (likely(count > 1)) {
>  		u16		word = 0;
>  
>  		if (tx)
>  			word = *tx++;
> +		else
> +			word = (spi->mode & SPI_MOSI_IDLE_HIGH) ? 0xFFFF : 0;

ditto (and for the txrx8 function)


- Nuno Sá

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ