lkml.org 
[lkml]   [2019]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 2/3] mtd: spi-nor: Move m25p80 code in spi-nor.c
Hi Tomer,

On Thu, 8 Aug 2019 13:05:14 +0300
Tomer Maimon <tmaimon77@gmail.com> wrote:

> @@ -688,6 +1003,16 @@ static int spi_nor_erase_sector(struct spi_nor *nor,
> > u32 addr)
> > if (nor->erase)
> > return nor->erase(nor, addr);
> >
> > + if (nor->spimem) {
> > + struct spi_mem_op op =
> > + SPI_MEM_OP(SPI_MEM_OP_CMD(nor->erase_opcode, 1),
> > + SPI_MEM_OP_ADDR(nor->addr_width, addr,
> > 1),
> > + SPI_MEM_OP_NO_DUMMY,
> > + SPI_MEM_OP_NO_DATA);
> > +
> > + return spi_mem_exec_op(nor->spimem, &op);
> > + }
> > +
> >
>
> static int spi_nor_erase_sector(struct spi_nor *nor, u32 addr)
> {
>
> int i;
>
> if (nor->flags & SNOR_F_S3AN_ADDR_DEFAULT)
> addr = spi_nor_s3an_addr_convert(nor, addr);
>
> if (nor->erase)
> return nor->erase(nor, addr);
>
> /*
> * Default implementation, if driver doesn't have a specialized HW
> * control
> */
> for (i = nor->addr_width - 1; i >= 0; i--) {
> nor->bouncebuf[i] = addr & 0xff;
> addr >>= 8;
> }
>
> if (nor->spimem) {
> struct spi_mem_op op =
> SPI_MEM_OP(SPI_MEM_OP_CMD(nor->erase_opcode, 1),
> SPI_MEM_OP_NO_ADDR,
> SPI_MEM_OP_NO_DUMMY,
> SPI_MEM_OP_DATA_OUT(nor->addr_width, nor->bouncebuf, 1));

That's wrong. If you need that, that's probably a spi-mem controller
driver issue. Address cycles should be passed through the
spi_mem_op->addr field, not packed with the data cycles.

>
> return spi_mem_exec_op(nor->spimem, &op);
> }
>
> return nor->write_reg(nor, nor->erase_opcode, nor->bouncebuf,
> nor->addr_width);
> }

\
 
 \ /
  Last update: 2019-08-08 16:05    [W:0.100 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site