lkml.org 
[lkml]   [2016]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 5/9] mtd: m25p80: add support of dual and quad spi protocols to all commands
From
Date
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

\
 
 \ /
  Last update: 2016-10-25 00:18    [W:0.213 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site