Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1402829 > unrolled thread
| Started by | Michal Suchanek <hramrach@gmail.com> |
|---|---|
| First post | 2016-05-18 11:30 +0200 |
| Last post | 2016-05-18 12:00 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RESEND][PATCH] mtd: devices: m25p80: add support for mmap read request Michal Suchanek <hramrach@gmail.com> - 2016-05-18 11:30 +0200
Re: [RESEND][PATCH] mtd: devices: m25p80: add support for mmap read request Vignesh R <vigneshr@ti.com> - 2016-05-18 11:50 +0200
Re: [RESEND][PATCH] mtd: devices: m25p80: add support for mmap read request Michal Suchanek <hramrach@gmail.com> - 2016-05-18 12:00 +0200
| From | Michal Suchanek <hramrach@gmail.com> |
|---|---|
| Date | 2016-05-18 11:30 +0200 |
| Subject | Re: [RESEND][PATCH] mtd: devices: m25p80: add support for mmap read request |
| Message-ID | <rA5XH-aM-5@gated-at.bofh.it> |
Hello,
On 29 March 2016 at 07:46, Vignesh R <vigneshr@ti.com> wrote:
> Certain SPI controllers may provide accelerated hardware interface to
> read from m25p80 type flash devices in order to provide better read
> performance. SPI core supports such devices with spi_flash_read() API.
> Call spi_flash_read(), if supported, to make use of such interface.
>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>
> Resend v5:
> Rebased on top of v4.6-rc1
> v5: http://www.spinics.net/lists/devicetree/msg106696.html
>
> drivers/mtd/devices/m25p80.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index c9c3b7fa3051..7730e633d7d3 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -131,6 +131,26 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
> /* convert the dummy cycles to the number of bytes */
> dummy /= 8;
>
> + if (spi_flash_read_supported(spi)) {
> + struct spi_flash_read_message msg;
> + int ret;
> +
> + msg.buf = buf;
> + msg.from = from;
> + msg.len = len;
> + msg.read_opcode = nor->read_opcode;
> + msg.addr_width = nor->addr_width;
> + msg.dummy_bytes = dummy;
> + /* TODO: Support other combinations */
> + msg.opcode_nbits = SPI_NBITS_SINGLE;
> + msg.addr_nbits = SPI_NBITS_SINGLE;
> + msg.data_nbits = m25p80_rx_nbits(nor);
> +
> + ret = spi_flash_read(spi, &msg);
> + *retlen = msg.retlen;
This is wrong. The previous retlen is never passed into msg so it must
be added and not assigned as is seen a few lines below:
ret = m.actual_length - m25p_cmdsz(nor) - dummy;
if (ret < 0)
return -EIO;
*retlen += ret;
This interface with odd design and poor documentation will be
hopefully weeded out with
mtd: spi-nor: stop passing around retlen
so there is probably no need to patch this separately.
Thanks
Michal
[toc] | [next] | [standalone]
| From | Vignesh R <vigneshr@ti.com> |
|---|---|
| Date | 2016-05-18 11:50 +0200 |
| Subject | Re: [RESEND][PATCH] mtd: devices: m25p80: add support for mmap read request |
| Message-ID | <rA6h3-ix-19@gated-at.bofh.it> |
| In reply to | #1402829 |
Hi,
On 05/18/2016 02:53 PM, Michal Suchanek wrote:
> Hello,
[...]
>>
>> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
>> index c9c3b7fa3051..7730e633d7d3 100644
>> --- a/drivers/mtd/devices/m25p80.c
>> +++ b/drivers/mtd/devices/m25p80.c
>> @@ -131,6 +131,26 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
>> /* convert the dummy cycles to the number of bytes */
>> dummy /= 8;
>>
>> + if (spi_flash_read_supported(spi)) {
>> + struct spi_flash_read_message msg;
>> + int ret;
>> +
>> + msg.buf = buf;
>> + msg.from = from;
>> + msg.len = len;
>> + msg.read_opcode = nor->read_opcode;
>> + msg.addr_width = nor->addr_width;
>> + msg.dummy_bytes = dummy;
>> + /* TODO: Support other combinations */
>> + msg.opcode_nbits = SPI_NBITS_SINGLE;
>> + msg.addr_nbits = SPI_NBITS_SINGLE;
>> + msg.data_nbits = m25p80_rx_nbits(nor);
>> +
>> + ret = spi_flash_read(spi, &msg);
>> + *retlen = msg.retlen;
>
> This is wrong. The previous retlen is never passed into msg so it must
> be added and not assigned as is seen a few lines below:
>
> ret = m.actual_length - m25p_cmdsz(nor) - dummy;
> if (ret < 0)
> return -EIO;
> *retlen += ret;
>
> This interface with odd design and poor documentation will be
> hopefully weeded out with
> mtd: spi-nor: stop passing around retlen
> so there is probably no need to patch this separately.
>
This patch was applied by Brian quite sometime back and the v7 of "mtd:
spi-nor: stop passing around retlen" patch takes care of removing the
offending code: https://lkml.org/lkml/2016/5/5/692
--
Regards
Vignesh
[toc] | [prev] | [next] | [standalone]
| From | Michal Suchanek <hramrach@gmail.com> |
|---|---|
| Date | 2016-05-18 12:00 +0200 |
| Message-ID | <rA6qK-mg-15@gated-at.bofh.it> |
| In reply to | #1402843 |
On 18 May 2016 at 11:39, Vignesh R <vigneshr@ti.com> wrote:
> Hi,
>
> On 05/18/2016 02:53 PM, Michal Suchanek wrote:
>> Hello,
> [...]
>>>
>>> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
>>> index c9c3b7fa3051..7730e633d7d3 100644
>>> --- a/drivers/mtd/devices/m25p80.c
>>> +++ b/drivers/mtd/devices/m25p80.c
>>> @@ -131,6 +131,26 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
>>> /* convert the dummy cycles to the number of bytes */
>>> dummy /= 8;
>>>
>>> + if (spi_flash_read_supported(spi)) {
>>> + struct spi_flash_read_message msg;
>>> + int ret;
>>> +
>>> + msg.buf = buf;
>>> + msg.from = from;
>>> + msg.len = len;
>>> + msg.read_opcode = nor->read_opcode;
>>> + msg.addr_width = nor->addr_width;
>>> + msg.dummy_bytes = dummy;
>>> + /* TODO: Support other combinations */
>>> + msg.opcode_nbits = SPI_NBITS_SINGLE;
>>> + msg.addr_nbits = SPI_NBITS_SINGLE;
>>> + msg.data_nbits = m25p80_rx_nbits(nor);
>>> +
>>> + ret = spi_flash_read(spi, &msg);
>>> + *retlen = msg.retlen;
>>
>> This is wrong. The previous retlen is never passed into msg so it must
>> be added and not assigned as is seen a few lines below:
>>
>> ret = m.actual_length - m25p_cmdsz(nor) - dummy;
>> if (ret < 0)
>> return -EIO;
>> *retlen += ret;
>>
>> This interface with odd design and poor documentation will be
>> hopefully weeded out with
>> mtd: spi-nor: stop passing around retlen
>> so there is probably no need to patch this separately.
>>
>
> This patch was applied by Brian quite sometime back and the v7 of "mtd:
> spi-nor: stop passing around retlen" patch takes care of removing the
> offending code: https://lkml.org/lkml/2016/5/5/692
>
Yes, I am looking exactly at that patchset but don't see it applied
anywhere yet.
Thanks
Michal
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web