[U-Boot] [PATCH v4 31/36] sf: Add extended read commands support

thomas.langer at lantiq.com thomas.langer at lantiq.com
Tue Sep 24 22:10:55 CEST 2013


Hello Jagan,

Am 24.09.2013 20:36, schrieb Jagannadha Sutradharudu Teki:
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index ea39d1a..0ac9fab 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -7,6 +7,7 @@
>  #include <common.h>
>  #include <malloc.h>
>  #include <spi.h>
> +#include <spi_flash.h>
>  
>  void *spi_do_alloc_slave(int offset, int size, unsigned int bus,
>  			 unsigned int cs)
> @@ -20,6 +21,7 @@ void *spi_do_alloc_slave(int offset, int size, unsigned int bus,
>  		slave = (struct spi_slave *)(ptr + offset);
>  		slave->bus = bus;
>  		slave->cs = cs;
> +		slave->rd_cmd = CMD_READ_ARRAY_FAST;

This is SPI code, not SF! The spi layer should not know such details of
the slave!
What about EEPROMs or other SPI slaves, which are NOT spi_flash???
Examples (just searched for includes of "spi.h"):
board/bf527-ezkit/video.c
drivers/net/enc28j60.c

Please ensure that the layers are not mixed up!
SPI is an interface type and SF is ONLY ONE user of this interface!

>  	}
>  
>  	return ptr;
> diff --git a/include/spi.h b/include/spi.h
> index c0dab57..093847e 100644
> --- a/include/spi.h
> +++ b/include/spi.h
> @@ -40,11 +40,13 @@
>   *   cs:	ID of the chip select connected to the slave.
>   *   max_write_size:	If non-zero, the maximum number of bytes which can
>   *		be written at once, excluding command bytes.
> + *   rd_cmd:	Read command.
>   */
>  struct spi_slave {
>  	unsigned int	bus;
>  	unsigned int	cs;
>  	unsigned int max_write_size;
> +	u8 rd_cmd;
>  };
>  
>  /*-----------------------------------------------------------------------

Best Regards,
Thomas



More information about the U-Boot mailing list