Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1507785

Re: [PATCH v3 5/9] mtd: m25p80: add support of dual and quad spi protocols to all commands

From Marek Vasut <marex@denx.de>
Newsgroups linux.kernel
Subject Re: [PATCH v3 5/9] mtd: m25p80: add support of dual and quad spi protocols to all commands
Date 2016-10-25 00:20 +0200
Message-ID <svVL4-5iq-25@gated-at.bofh.it> (permalink)
References <svQs1-1GJ-15@gated-at.bofh.it> <svQs2-1GJ-53@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 10/24/2016 06:34 PM, Cyrille Pitchen wrote:
> Before this patch, m25p80_read() supported few SPI protocols:
> - regular SPI 1-1-1
> - SPI Dual Output 1-1-2
> - SPI Quad Output 1-1-4
> On the other hand, all other m25p80_*() hooks only supported SPI 1-1-1.
> 
> This patch adds support to all currently existing SPI protocols to
> cover as many protocols as possible.
> 
> Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
> ---
>  drivers/mtd/devices/m25p80.c | 193 +++++++++++++++++++++++++++++++++----------
>  1 file changed, 149 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index f0a55c01406b..38778eac6c21 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -27,22 +27,64 @@
>  #include <linux/spi/flash.h>
>  #include <linux/mtd/spi-nor.h>
>  
> -#define	MAX_CMD_SIZE		6
> +#define	MAX_CMD_SIZE		16
>  struct m25p {
>  	struct spi_device	*spi;
>  	struct spi_nor		spi_nor;
>  	u8			command[MAX_CMD_SIZE];
>  };
>  
> +static inline int m25p80_proto2nbits(enum spi_nor_protocol proto,

This can be void , since it's always returning zero.

> +				     unsigned *code_nbits,
> +				     unsigned *addr_nbits,
> +				     unsigned *data_nbits)
> +{
> +	if (code_nbits)
> +		*code_nbits = SNOR_PROTO_CODE_FROM_PROTO(proto);
> +	if (addr_nbits)
> +		*addr_nbits = SNOR_PROTO_ADDR_FROM_PROTO(proto);
> +	if (data_nbits)
> +		*data_nbits = SNOR_PROTO_DATA_FROM_PROTO(proto);
> +
> +	return 0;
> +}
> +
[...]


-- 
Best regards,
Marek Vasut

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v3 5/9] mtd: m25p80: add support of dual and quad spi protocols to all commands Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-10-24 18:40 +0200
  Re: [PATCH v3 5/9] mtd: m25p80: add support of dual and quad spi  protocols to all commands Marek Vasut <marex@denx.de> - 2016-10-25 00:20 +0200

csiph-web