linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Tomer Maimon <tmaimon77@gmail.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Richard Weinberger <richard@nod.at>,
	Boris Brezillon <bbrezillon@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Marek Vasut <marek.vasut@gmail.com>,
	linux-mtd@lists.infradead.org,
	Miquel Raynal <miquel.raynal@bootlin.com>
Subject: Re: [PATCH v5 2/3] mtd: spi-nor: Move m25p80 code in spi-nor.c
Date: Thu, 8 Aug 2019 16:04:52 +0200	[thread overview]
Message-ID: <20190808160452.1da76beb@collabora.com> (raw)
In-Reply-To: <CAP6Zq1h9Xe9ptGxQpjYwoFaS1sTyd-3EsMTAYwp9e70Cm1czLg@mail.gmail.com>

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);
> }

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2019-08-08 14:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06  5:10 [PATCH v5 0/3] Merge m25p80 into spi-nor Vignesh Raghavendra
2019-08-06  5:10 ` [PATCH v5 1/3] mtd: spi-nor: always use bounce buffer for register read/writes Vignesh Raghavendra
2019-08-06  5:10 ` [PATCH v5 2/3] mtd: spi-nor: Move m25p80 code in spi-nor.c Vignesh Raghavendra
     [not found]   ` <CAP6Zq1h9Xe9ptGxQpjYwoFaS1sTyd-3EsMTAYwp9e70Cm1czLg@mail.gmail.com>
2019-08-08 14:04     ` Boris Brezillon [this message]
     [not found]       ` <CAP6Zq1g6Z=o7FnX4UpZ-dq_9Ui-yv9E5OEJGirK49RqFUPoP_g@mail.gmail.com>
2019-08-08 15:19         ` Boris Brezillon
2019-08-09 11:47     ` Vignesh Raghavendra
2019-08-06  5:10 ` [PATCH v5 3/3] mtd: spi-nor: Rework hwcaps selection for the spi-mem case Vignesh Raghavendra
2019-08-07  5:48   ` Tudor.Ambarus
2019-08-07  5:54 ` [PATCH v5 0/3] Merge m25p80 into spi-nor Tudor.Ambarus
2019-08-12 10:33 ` Tudor.Ambarus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190808160452.1da76beb@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=bbrezillon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=tmaimon77@gmail.com \
    --cc=tudor.ambarus@microchip.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).