All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vignesh Raghavendra <vigneshr@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [EXT] Re: [PATCH v2] mtd: spi: Improve spi_nor_write_data() implementation
Date: Fri, 17 May 2019 09:34:39 -0500	[thread overview]
Message-ID: <158da37d-09d1-7238-2e02-1b1d67feb38b@ti.com> (raw)
In-Reply-To: <VI1PR04MB4015DDD30F288C868EF1F13E950B0@VI1PR04MB4015.eurprd04.prod.outlook.com>

Hi Ashish,

> Hi Vignesh
> 

> Is this taken care now, plain text version was posted here
> http://patchwork.ozlabs.org/patch/1090121/
> 

A similar patch[1] was proposed in meantime which has been merged to
mainline U-Boot. So this issue must now be resolved. Let me know if the
issue still persists.


[1]
commit 60e2bf46784ebbd30ff29b3d3c7c97e56b11e86a
Author: Weijie Gao <weijie.gao@mediatek.com>
Date:   Fri Apr 26 17:22:19 2019 +0800

    mtd: spi-nor: fix page program issue when using spi-mem driver



> Regards
> Ashish 
> 
>>
>>>
>>>   drivers/mtd/spi/spi-nor-core.c | 28 ++++++++++------------------
>>>   1 file changed, 10 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/drivers/mtd/spi/spi-nor-core.c
>>> b/drivers/mtd/spi/spi-nor-core.c index c4e2f6a08f..8e754d445d 100644
>>> --- a/drivers/mtd/spi/spi-nor-core.c
>>> +++ b/drivers/mtd/spi/spi-nor-core.c
>>> @@ -116,7 +116,6 @@ static ssize_t spi_nor_write_data(struct spi_nor
>> *nor, loff_t to, size_t len,
>>>                                  SPI_MEM_OP_ADDR(nor->addr_width, to, 1),
>>>                                  SPI_MEM_OP_NO_DUMMY,
>>>                                  SPI_MEM_OP_DATA_OUT(len, buf, 1));
>>> -     size_t remaining = len;
>>>       int ret;
>>>
>>>       /* get transfer protocols. */
>>> @@ -127,22 +126,19 @@ static ssize_t spi_nor_write_data(struct spi_nor
>> *nor, loff_t to, size_t len,
>>>       if (nor->program_opcode == SPINOR_OP_AAI_WP && nor-
>>> sst_write_second)
>>>               op.addr.nbytes = 0;
>>>
>>> -     while (remaining) {
>>> -             op.data.nbytes = remaining < UINT_MAX ? remaining : UINT_MAX;
>>> -             ret = spi_mem_adjust_op_size(nor->spi, &op);
>>> -             if (ret)
>>> -                     return ret;
>>> +     op.data.nbytes = len < UINT_MAX ? len : UINT_MAX;
>>> +     ret = spi_mem_adjust_op_size(nor->spi, &op);
>>> +     if (ret)
>>> +             return ret;
>>>
>>> -             ret = spi_mem_exec_op(nor->spi, &op);
>>> -             if (ret)
>>> -                     return ret;
>>> +     ret = spi_mem_exec_op(nor->spi, &op);
>>> +     if (ret)
>>> +             return ret;
>>>
>>> -             op.addr.val += op.data.nbytes;
>>> -             remaining -= op.data.nbytes;
>>> -             op.data.buf.out += op.data.nbytes;
>>> -     }
>>> +     op.addr.val += op.data.nbytes;
>>> +     op.data.buf.out += op.data.nbytes;
>>>
>>> -     return len;
>>> +     return op.data.nbytes;
>>>   }
>>>
>>>   /*
>>> @@ -1101,10 +1097,6 @@ static int spi_nor_write(struct mtd_info *mtd,
>> loff_t to, size_t len,
>>>                       goto write_err;
>>>               *retlen += written;
>>>               i += written;
>>> -             if (written != page_remain) {
>>> -                     ret = -EIO;
>>> -                     goto write_err;
>>> -             }
>>>       }
>>>
>>>   write_err:
>>>

      reply	other threads:[~2019-05-17 14:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 11:59 [U-Boot] [PATCH v2] mtd: spi: Improve spi_nor_write_data() implementation Rajat Srivastava
2019-04-17 12:47 ` Vignesh Raghavendra
2019-04-18 11:53   ` [U-Boot] [EXT] " Rajat Srivastava
2019-05-17  7:49   ` Ashish Kumar
2019-05-17 14:34     ` Vignesh Raghavendra [this message]

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=158da37d-09d1-7238-2e02-1b1d67feb38b@ti.com \
    --to=vigneshr@ti.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.