* [PATCH 0/3] Using SPI NOR flah on sunxi. @ 2015-04-30 14:22 Michal Suchanek [not found] ` <cover.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ` (4 more replies) 0 siblings, 5 replies; 21+ messages in thread From: Michal Suchanek @ 2015-04-30 14:22 UTC (permalink / raw) To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Brian Norris, Marek Vasut, Huang Shijie, Michal Suchanek, Ben Hutchings, Alison Chaiken, Mika Westerberg, grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Hello, I tried to connect a SPI NOR flash to my sunxi board and due to the current sunxi SPI driver limitations it does not work. The SPI driver returns an error when more than 64 bytes are transferred at once due to lack of DMA support. I tried to hack in an option to limit the transfer size and discovered that the return value of write in m25p80 driver is wrong and never checked. This might be useful while working with other devices with limited driver support. Thanks Michal Michal Suchanek (3): MTD: m25p80: fix write return value. MTD: spi-nor: check for short writes in spi_nor_write. MTD: m25p80: Add option to limit SPI transfer size. Documentation/devicetree/bindings/mtd/m25p80.txt | 5 +++ drivers/mtd/devices/m25p80.c | 21 ++++++++++-- drivers/mtd/spi-nor/spi-nor.c | 42 ++++++++++-------------- 3 files changed, 40 insertions(+), 28 deletions(-) -- 2.1.4 ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <cover.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* [PATCH 1/3] MTD: m25p80: fix write return value. [not found] ` <cover.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-04-30 13:33 ` Michal Suchanek [not found] ` <55132b4496e7fe73f949186c0f140f3e4fd4e2c7.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-04-30 13:38 ` [PATCH 2/3] MTD: spi-nor: check for short writes in spi_nor_write Michal Suchanek ` (2 subsequent siblings) 3 siblings, 1 reply; 21+ messages in thread From: Michal Suchanek @ 2015-04-30 13:33 UTC (permalink / raw) To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Brian Norris, Marek Vasut, Huang Shijie, Michal Suchanek, Ben Hutchings, Alison Chaiken, Mika Westerberg, grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r The size of written data was added to user supplied value rather than written at the provided address. Signed-off-by: Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- drivers/mtd/devices/m25p80.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 7c8b169..0b2bc21 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -102,7 +102,7 @@ static void m25p80_write(struct spi_nor *nor, loff_t to, size_t len, spi_sync(spi, &m); - *retlen += m.actual_length - cmd_sz; + *retlen = m.actual_length - cmd_sz; } static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor) -- 2.1.4 ^ permalink raw reply related [flat|nested] 21+ messages in thread
[parent not found: <55132b4496e7fe73f949186c0f140f3e4fd4e2c7.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 1/3] MTD: m25p80: fix write return value. [not found] ` <55132b4496e7fe73f949186c0f140f3e4fd4e2c7.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-04-30 18:43 ` Marek Vasut [not found] ` <201504302043.11118.marex-ynQEQJNshbs@public.gmane.org> 0 siblings, 1 reply; 21+ messages in thread From: Marek Vasut @ 2015-04-30 18:43 UTC (permalink / raw) To: Michal Suchanek Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Brian Norris, Huang Shijie, Rafał Miłecki, Ben Hutchings, Alison Chaiken, Mika Westerberg, Bean Huo 霍斌斌 (beanhuo), grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Thursday, April 30, 2015 at 03:33:47 PM, Michal Suchanek wrote: > The size of written data was added to user supplied value rather than > written at the provided address. You might want to work on the commit message a little, something like the following, but feel free to reword as seen fit. The 'retlen' points to a variable representing the number of data bytes written/read (see include/linux/mtd/mtd.h) by the current invocation of the function. This variable must be set, not incremented. Otherwise, the patch is correct I believe: Acked-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org> > Signed-off-by: Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > --- > drivers/mtd/devices/m25p80.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c > index 7c8b169..0b2bc21 100644 > --- a/drivers/mtd/devices/m25p80.c > +++ b/drivers/mtd/devices/m25p80.c > @@ -102,7 +102,7 @@ static void m25p80_write(struct spi_nor *nor, loff_t > to, size_t len, > > spi_sync(spi, &m); > > - *retlen += m.actual_length - cmd_sz; > + *retlen = m.actual_length - cmd_sz; > } > > static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor) Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <201504302043.11118.marex-ynQEQJNshbs@public.gmane.org>]
* Re: [PATCH 1/3] MTD: m25p80: fix write return value. [not found] ` <201504302043.11118.marex-ynQEQJNshbs@public.gmane.org> @ 2015-04-30 21:37 ` Michal Suchanek 0 siblings, 0 replies; 21+ messages in thread From: Michal Suchanek @ 2015-04-30 21:37 UTC (permalink / raw) To: Marek Vasut Cc: linux-sunxi, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Brian Norris, Huang Shijie, Rafał Miłecki, Ben Hutchings, Alison Chaiken, Mika Westerberg, Bean Huo 霍斌斌 (beanhuo), grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree, Linux Kernel Mailing List, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On 30 April 2015 at 20:43, Marek Vasut <marex-ynQEQJNshbs@public.gmane.org> wrote: > On Thursday, April 30, 2015 at 03:33:47 PM, Michal Suchanek wrote: >> The size of written data was added to user supplied value rather than >> written at the provided address. > > You might want to work on the commit message a little, something like > the following, but feel free to reword as seen fit. > > The 'retlen' points to a variable representing the number of data bytes > written/read (see include/linux/mtd/mtd.h) by the current invocation of > the function. This variable must be set, not incremented. > > Otherwise, the patch is correct I believe: > > Acked-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org> > ok, I will send an updated version. Thanks Michal ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/3] MTD: spi-nor: check for short writes in spi_nor_write. [not found] ` <cover.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-04-30 13:33 ` [PATCH 1/3] MTD: m25p80: fix write return value Michal Suchanek @ 2015-04-30 13:38 ` Michal Suchanek [not found] ` <50c40ef17ab6566f35ef5a4426bf23567f896db7.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-04-30 13:46 ` [PATCH 3/3] MTD: m25p80: Add option to limit SPI transfer size Michal Suchanek 2015-04-30 16:30 ` [PATCH 0/3] Using SPI NOR flah on sunxi Thomas.Betker-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf 3 siblings, 1 reply; 21+ messages in thread From: Michal Suchanek @ 2015-04-30 13:38 UTC (permalink / raw) To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Brian Norris, Marek Vasut, Huang Shijie, Michal Suchanek, Ben Hutchings, Alison Chaiken, Mika Westerberg, grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r My SPI controller driver does not support DMA so writes are truncated to FIFO size. Check the amount of data actually written by the driver. Signed-off-by: Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- drivers/mtd/spi-nor/spi-nor.c | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 14a5d23..75904b5 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -807,7 +807,7 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) { struct spi_nor *nor = mtd_to_spi_nor(mtd); - u32 page_offset, page_size, i; + u32 page_offset, page_remainder, page_size, i; int ret; dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len); @@ -816,36 +816,28 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, if (ret) return ret; - write_enable(nor); - - page_offset = to & (nor->page_size - 1); - - /* do all the bytes fit onto one page? */ - if (page_offset + len <= nor->page_size) { - nor->write(nor, to, len, retlen, buf); - } else { - /* the size of data remaining on the first page */ - page_size = nor->page_size - page_offset; - nor->write(nor, to, page_size, retlen, buf); + /* write everything in nor->page_size chunks */ + /* check the size of data actually written */ + for (i = 0; i < len; i += *retlen) { + page_size = len - i; + page_offset = (to + i) & (nor->page_size - 1); + page_remainder = nor->page_size - page_offset; + if (page_size > nor->page_size) + page_size = nor->page_size; + if (page_remainder && (page_size > page_remainder)) + page_size = page_remainder; - /* write everything in nor->page_size chunks */ - for (i = page_size; i < len; i += page_size) { - page_size = len - i; - if (page_size > nor->page_size) - page_size = nor->page_size; - - ret = spi_nor_wait_till_ready(nor); - if (ret) - goto write_err; + write_enable(nor); - write_enable(nor); + nor->write(nor, to + i, page_size, retlen, buf + i); - nor->write(nor, to + i, page_size, retlen, buf + i); - } + ret = spi_nor_wait_till_ready(nor); + if (ret) + goto write_err; } - ret = spi_nor_wait_till_ready(nor); write_err: + *retlen = i; spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); return ret; } -- 2.1.4 ^ permalink raw reply related [flat|nested] 21+ messages in thread
[parent not found: <50c40ef17ab6566f35ef5a4426bf23567f896db7.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 2/3] MTD: spi-nor: check for short writes in spi_nor_write. [not found] ` <50c40ef17ab6566f35ef5a4426bf23567f896db7.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-05-20 23:38 ` Brian Norris 2015-05-21 8:39 ` Michal Suchanek 0 siblings, 1 reply; 21+ messages in thread From: Brian Norris @ 2015-05-20 23:38 UTC (permalink / raw) To: Michal Suchanek Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Marek Vasut, Huang Shijie, Rafał Miłecki, Ben Hutchings, Alison Chaiken, Mika Westerberg, Bean Huo 霍斌斌 (beanhuo), grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-spi-u79uwXL29TY76Z2rM5mHXA, Mark Brown + linux-spi, Mark On Thu, Apr 30, 2015 at 03:38:50PM +0200, Michal Suchanek wrote: > My SPI controller driver does not support DMA so writes are truncated to > FIFO size. Which SPI master driver? > Check the amount of data actually written by the driver. I'm not sure if we should just reactively use the retlen, or if we should be communicating such a limitation via the SPI API. Thoughts? Brian > Signed-off-by: Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > --- > drivers/mtd/spi-nor/spi-nor.c | 42 +++++++++++++++++------------------------- > 1 file changed, 17 insertions(+), 25 deletions(-) > > diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c > index 14a5d23..75904b5 100644 > --- a/drivers/mtd/spi-nor/spi-nor.c > +++ b/drivers/mtd/spi-nor/spi-nor.c > @@ -807,7 +807,7 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, > size_t *retlen, const u_char *buf) > { > struct spi_nor *nor = mtd_to_spi_nor(mtd); > - u32 page_offset, page_size, i; > + u32 page_offset, page_remainder, page_size, i; > int ret; > > dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len); > @@ -816,36 +816,28 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, > if (ret) > return ret; > > - write_enable(nor); > - > - page_offset = to & (nor->page_size - 1); > - > - /* do all the bytes fit onto one page? */ > - if (page_offset + len <= nor->page_size) { > - nor->write(nor, to, len, retlen, buf); > - } else { > - /* the size of data remaining on the first page */ > - page_size = nor->page_size - page_offset; > - nor->write(nor, to, page_size, retlen, buf); > + /* write everything in nor->page_size chunks */ > + /* check the size of data actually written */ > + for (i = 0; i < len; i += *retlen) { > + page_size = len - i; > + page_offset = (to + i) & (nor->page_size - 1); > + page_remainder = nor->page_size - page_offset; > + if (page_size > nor->page_size) > + page_size = nor->page_size; > + if (page_remainder && (page_size > page_remainder)) > + page_size = page_remainder; > > - /* write everything in nor->page_size chunks */ > - for (i = page_size; i < len; i += page_size) { > - page_size = len - i; > - if (page_size > nor->page_size) > - page_size = nor->page_size; > - > - ret = spi_nor_wait_till_ready(nor); > - if (ret) > - goto write_err; > + write_enable(nor); > > - write_enable(nor); > + nor->write(nor, to + i, page_size, retlen, buf + i); > > - nor->write(nor, to + i, page_size, retlen, buf + i); > - } > + ret = spi_nor_wait_till_ready(nor); > + if (ret) > + goto write_err; > } > > - ret = spi_nor_wait_till_ready(nor); > write_err: > + *retlen = i; > spi_nor_unlock_and_unprep(nor, SPI_NOR_OPS_WRITE); > return ret; > } ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] MTD: spi-nor: check for short writes in spi_nor_write. 2015-05-20 23:38 ` Brian Norris @ 2015-05-21 8:39 ` Michal Suchanek [not found] ` <CAOMqctTYqDWL51twOuGi+oXONXQ4B2-2BkdJNSpzZAXshZUN6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 21+ messages in thread From: Michal Suchanek @ 2015-05-21 8:39 UTC (permalink / raw) To: Brian Norris Cc: linux-sunxi, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Marek Vasut, Huang Shijie, Rafał Miłecki, Ben Hutchings, Alison Chaiken, Mika Westerberg, Bean Huo 霍斌斌 (beanhuo), grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree, Linux Kernel Mailing List, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-spi, Mark Brown On 21 May 2015 at 01:38, Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > + linux-spi, Mark > > On Thu, Apr 30, 2015 at 03:38:50PM +0200, Michal Suchanek wrote: >> My SPI controller driver does not support DMA so writes are truncated to >> FIFO size. > > Which SPI master driver? I am using sunxi SPI driver. The dmaengine support for sunxi is not yet in mainline kernel so the SPI master functionality is limited. > >> Check the amount of data actually written by the driver. > > I'm not sure if we should just reactively use the retlen, or if we > should be communicating such a limitation via the SPI API. Thoughts? > Is there any driver that would break if the SPI master truncated writes when the message is too long rather than returning an error an refusing the transfer? m25p80 as is would because it assumes all data is always written. Some display driver I tried earlier has an option to limit transfer size actively in the driver. Thanks Michal ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <CAOMqctTYqDWL51twOuGi+oXONXQ4B2-2BkdJNSpzZAXshZUN6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH 2/3] MTD: spi-nor: check for short writes in spi_nor_write. [not found] ` <CAOMqctTYqDWL51twOuGi+oXONXQ4B2-2BkdJNSpzZAXshZUN6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2015-05-21 10:28 ` Mark Brown [not found] ` <20150521102802.GS21577-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 0 siblings, 1 reply; 21+ messages in thread From: Mark Brown @ 2015-05-21 10:28 UTC (permalink / raw) To: Michal Suchanek Cc: Brian Norris, linux-sunxi, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Marek Vasut, Huang Shijie, Rafał Miłecki, Ben Hutchings, Alison Chaiken, Mika Westerberg, Bean Huo 霍斌斌 (beanhuo), grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree, Linux Kernel Mailing List, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-spi [-- Attachment #1: Type: text/plain, Size: 1315 bytes --] On Thu, May 21, 2015 at 10:39:13AM +0200, Michal Suchanek wrote: > On 21 May 2015 at 01:38, Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: Why is this thread about SPI error handling CCed to quite so many people? > >> Check the amount of data actually written by the driver. > > I'm not sure if we should just reactively use the retlen, or if we > > should be communicating such a limitation via the SPI API. Thoughts? > Is there any driver that would break if the SPI master truncated > writes when the message is too long rather than returning an error an > refusing the transfer? Any such driver is buggy, the actual length transferred has always been a part of the SPI API. We should probably expose limitations so clients can query in advance (we don't at the minute) but it'd be a while before clients could rely on that information being useful and it's still possible things can be truncated by error. With modern drivers using transfer_one() where we have control of the chip select we do also have the ability to add support to the core for chopping large transfers up into smaller ones that the hardware can handle transparently. That won't for everything though since it depends on us being able to manually control the chip select which not all hardware can do. ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <20150521102802.GS21577-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>]
* Re: [PATCH 2/3] MTD: spi-nor: check for short writes in spi_nor_write. [not found] ` <20150521102802.GS21577-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> @ 2015-05-22 7:17 ` Brian Norris 0 siblings, 0 replies; 21+ messages in thread From: Brian Norris @ 2015-05-22 7:17 UTC (permalink / raw) To: Mark Brown Cc: Michal Suchanek, linux-sunxi, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Marek Vasut, Huang Shijie, Rafał Miłecki, Ben Hutchings, Alison Chaiken, Mika Westerberg, Bean Huo 霍斌斌 (beanhuo), grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree, Linux Kernel Mailing List, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-spi On Thu, May 21, 2015 at 11:28:02AM +0100, Mark Brown wrote: > On Thu, May 21, 2015 at 10:39:13AM +0200, Michal Suchanek wrote: > > On 21 May 2015 at 01:38, Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Why is this thread about SPI error handling CCed to quite so many > people? I can't really speak for the original patch author, who created the CC list. I added you for comment on the SPI API (thanks BTW). This is part of a series that included an ill-conceived DT binding for recording a "max transfer length" property in the flash node. That's one step that easily blows up the CC list for the series, as there are 5 DT maintainers and a mailing list. Others are contributors to the m25p80 / spi-nor drivers. (All in all, you can probably trace this back to scripts/get_maintainer.pl.) > > >> Check the amount of data actually written by the driver. > > > > I'm not sure if we should just reactively use the retlen, or if we > > > should be communicating such a limitation via the SPI API. Thoughts? > > > Is there any driver that would break if the SPI master truncated > > writes when the message is too long rather than returning an error an > > refusing the transfer? > > Any such driver is buggy, the actual length transferred has always been > a part of the SPI API. OK, so m25p80.c currently checks the retlen (spi_message::actual_length), but it doesn't actually handle it well if the SPI master can't write a full page-size chunk in one go. It looks like we'd leave holes in the programmed data right now. So that qualifies as buggy, and that's part of what Michal is trying to fix, I think. Admittedly, as he's using an out-of-tree driver, I'm not sure I know exactly what failure modes he is hitting yet. > We should probably expose limitations so clients > can query in advance (we don't at the minute) but it'd be a while before > clients could rely on that information being useful and it's still > possible things can be truncated by error. That might help in the long run. In this case, I think we might be able to get by (for a properly-functioning SPI driver with a limited transfer size) with the current API, and handling the 'return length < message length' case better. BTW, one extra note for Michal regarding your SPI controller/driver transfer length limitation: you would do well to try as much as possible to allow full NOR pages to be programmed in one SPINOR_OP_PP sequence. I know of some SPI NOR that, though they are byte addressable, actually have opaque internal ECC which is encoded on page boundaries, so you get better flash lifetime if you program on page boundaries, rather than on whatever smaller chunk size your SPI driver supports. So that might require a little more work on your SPI driver. Brian -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 3/3] MTD: m25p80: Add option to limit SPI transfer size. [not found] ` <cover.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-04-30 13:33 ` [PATCH 1/3] MTD: m25p80: fix write return value Michal Suchanek 2015-04-30 13:38 ` [PATCH 2/3] MTD: spi-nor: check for short writes in spi_nor_write Michal Suchanek @ 2015-04-30 13:46 ` Michal Suchanek [not found] ` <3b0c112672f364452e80c333048161eaffb655db.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-04-30 16:30 ` [PATCH 0/3] Using SPI NOR flah on sunxi Thomas.Betker-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf 3 siblings, 1 reply; 21+ messages in thread From: Michal Suchanek @ 2015-04-30 13:46 UTC (permalink / raw) To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Brian Norris, Marek Vasut, Huang Shijie, Michal Suchanek, Ben Hutchings, Alison Chaiken, Mika Westerberg, grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r My SPI driver does not support DMA so sizes larger than 64 bytes return an error. Add an option to limit transfer size so m25p80 can be used with reduced speed with such controller. Signed-off-by: Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- Documentation/devicetree/bindings/mtd/m25p80.txt | 5 +++++ drivers/mtd/devices/m25p80.c | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/mtd/m25p80.txt b/Documentation/devicetree/bindings/mtd/m25p80.txt index f20b111..2bda5be 100644 --- a/Documentation/devicetree/bindings/mtd/m25p80.txt +++ b/Documentation/devicetree/bindings/mtd/m25p80.txt @@ -19,6 +19,11 @@ Optional properties: all chips and support for it can not be detected at runtime. Refer to your chips' datasheet to check if this is supported by your chip. +- linux,max_tx_len : With some SPI controller drivers transfer size is + limited.s + Transfer data in chunks no larger than this value. + Using this option will degrade performance when + max_tx_len is smaller than flash page size. Example: diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 0b2bc21..dfdb750 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -26,12 +26,14 @@ #include <linux/spi/spi.h> #include <linux/spi/flash.h> #include <linux/mtd/spi-nor.h> +#include <linux/of_platform.h> #define MAX_CMD_SIZE 6 struct m25p { struct spi_device *spi; struct spi_nor spi_nor; struct mtd_info mtd; + size_t max_tx_len; u8 command[MAX_CMD_SIZE]; }; @@ -97,7 +99,10 @@ static void m25p80_write(struct spi_nor *nor, loff_t to, size_t len, spi_message_add_tail(&t[0], &m); t[1].tx_buf = buf; - t[1].len = len; + if (flash->max_tx_len) + t[1].len = min(len,flash->max_tx_len); + else + t[1].len = len; spi_message_add_tail(&t[1], &m); spi_sync(spi, &m); @@ -145,7 +150,10 @@ static int m25p80_read(struct spi_nor *nor, loff_t from, size_t len, t[1].rx_buf = buf; t[1].rx_nbits = m25p80_rx_nbits(nor); - t[1].len = len; + if (flash->max_tx_len) + t[1].len = min(len,flash->max_tx_len); + else + t[1].len = len; spi_message_add_tail(&t[1], &m); spi_sync(spi, &m); @@ -233,6 +241,13 @@ static int m25p_probe(struct spi_device *spi) return ret; ppdata.of_node = spi->dev.of_node; + if (spi->dev.of_node){ + int result = of_property_read_u32(spi->dev.of_node, "linux,max_tx_len", &flash->max_tx_len); + if (result) + flash->max_tx_len = 0; + else + dev_info(&spi->dev, "Using maximum transfer length %u\n", flash->max_tx_len); + } return mtd_device_parse_register(&flash->mtd, NULL, &ppdata, data ? data->parts : NULL, -- 2.1.4 ^ permalink raw reply related [flat|nested] 21+ messages in thread
[parent not found: <3b0c112672f364452e80c333048161eaffb655db.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 3/3] MTD: m25p80: Add option to limit SPI transfer size. [not found] ` <3b0c112672f364452e80c333048161eaffb655db.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-04-30 14:58 ` Julian Calaby [not found] ` <CAGRGNgXKrpJ8rc4h4BykgHsn3kfT5fuAssMK1bQJtxhVL=s2BA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 21+ messages in thread From: Julian Calaby @ 2015-04-30 14:58 UTC (permalink / raw) To: Michal Suchanek Cc: linux-sunxi, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Brian Norris, Marek Vasut, Huang Shijie, Rafał Miłecki, Ben Hutchings, Alison Chaiken, Mika Westerberg, Bean Huo 霍斌斌 (beanhuo), grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Hi Michal, On Thu, Apr 30, 2015 at 11:46 PM, Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > My SPI driver does not support DMA so sizes larger than 64 bytes return > an error. Add an option to limit transfer size so m25p80 can be used > with reduced speed with such controller. I suspect that this will be rejected as the maximum transfer size is a property of the SPI controller, not the device and should be exported to the device driver from the controller, not specified in the device's binding. Thanks, -- Julian Calaby Email: julian.calaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Profile: http://www.google.com/profiles/julian.calaby/ ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <CAGRGNgXKrpJ8rc4h4BykgHsn3kfT5fuAssMK1bQJtxhVL=s2BA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH 3/3] MTD: m25p80: Add option to limit SPI transfer size. [not found] ` <CAGRGNgXKrpJ8rc4h4BykgHsn3kfT5fuAssMK1bQJtxhVL=s2BA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2015-05-20 23:27 ` Brian Norris 0 siblings, 0 replies; 21+ messages in thread From: Brian Norris @ 2015-05-20 23:27 UTC (permalink / raw) To: Julian Calaby Cc: Michal Suchanek, linux-sunxi, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala, David Woodhouse, Marek Vasut, Huang Shijie, Rafał Miłecki, Ben Hutchings, Alison Chaiken, Mika Westerberg, Bean Huo 霍斌斌 (beanhuo), grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, devicetree, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Fri, May 01, 2015 at 12:58:52AM +1000, Julian Calaby wrote: > On Thu, Apr 30, 2015 at 11:46 PM, Michal Suchanek <hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > My SPI driver does not support DMA so sizes larger than 64 bytes return > > an error. Add an option to limit transfer size so m25p80 can be used > > with reduced speed with such controller. > > I suspect that this will be rejected as the maximum transfer size is a > property of the SPI controller, not the device and should be exported > to the device driver from the controller, not specified in the > device's binding. Absolutely correct. This does not belong in the device tree. Brian ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] Using SPI NOR flah on sunxi. [not found] ` <cover.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ` (2 preceding siblings ...) 2015-04-30 13:46 ` [PATCH 3/3] MTD: m25p80: Add option to limit SPI transfer size Michal Suchanek @ 2015-04-30 16:30 ` Thomas.Betker-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf 3 siblings, 0 replies; 21+ messages in thread From: Thomas.Betker-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf @ 2015-04-30 16:30 UTC (permalink / raw) To: Michal Suchanek Cc: Alison Chaiken, Huang Shijie, Bean Huo ????????? (beanhuo), Ben Hutchings, Brian Norris, devicetree-u79uwXL29TY76Z2rM5mHXA, David Woodhouse, Kumar Gala, grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, Ian Campbell, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-mtd, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Marek Vasut, Mark Rutland, Mika Westerberg, Pawel Moll, Rob Herring, Rafa?? Mi??ecki Hello Michal: > I tried to connect a SPI NOR flash to my sunxi board and due to the current > sunxi SPI driver limitations it does not work. > > The SPI driver returns an error when more than 64 bytes are > transferred at once > due to lack of DMA support. Wouldn't it be easier to fix the SPI driver to handle transfers larger than 64 bytes, filling and draining the FIFO multiple times if neccessary? (As far as I can tell, most SPI drivers do this.) Just asking, Thomas -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] Using SPI NOR flah on sunxi. 2015-04-30 14:22 [PATCH 0/3] Using SPI NOR flah on sunxi Michal Suchanek [not found] ` <cover.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2015-04-30 16:30 ` Thomas.Betker 2015-04-30 16:30 ` Thomas.Betker ` (2 subsequent siblings) 4 siblings, 0 replies; 21+ messages in thread From: Thomas.Betker @ 2015-04-30 16:30 UTC (permalink / raw) To: Michal Suchanek Cc: Alison Chaiken, Huang Shijie, Bean Huo ????????? (beanhuo), Ben Hutchings, Brian Norris, devicetree, David Woodhouse, Kumar Gala, grmoore@altera.com, Ian Campbell, linux-kernel, linux-mtd, linux-mtd, linux-sunxi, Marek Vasut, Mark Rutland, Mika Westerberg, Pawel Moll, Rob Herring, Rafa?? Mi??ecki Hello Michal: > I tried to connect a SPI NOR flash to my sunxi board and due to the current > sunxi SPI driver limitations it does not work. > > The SPI driver returns an error when more than 64 bytes are > transferred at once > due to lack of DMA support. Wouldn't it be easier to fix the SPI driver to handle transfers larger than 64 bytes, filling and draining the FIFO multiple times if neccessary? (As far as I can tell, most SPI drivers do this.) Just asking, Thomas ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] Using SPI NOR flah on sunxi. 2015-04-30 14:22 [PATCH 0/3] Using SPI NOR flah on sunxi Michal Suchanek [not found] ` <cover.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-04-30 16:30 ` Thomas.Betker @ 2015-04-30 16:30 ` Thomas.Betker 2015-04-30 16:30 ` Thomas.Betker 2015-05-01 12:27 ` Stefan Monnier 4 siblings, 0 replies; 21+ messages in thread From: Thomas.Betker @ 2015-04-30 16:30 UTC (permalink / raw) To: Michal Suchanek Cc: linux-mtd, devicetree, Marek Vasut, grmoore@altera.com, Mika Westerberg, Pawel Moll, Ian Campbell, David Woodhouse, Rafa?? Mi??ecki, linux-kernel, Huang Shijie, linux-sunxi, Rob Herring, linux-mtd, Kumar Gala, Mark Rutland, Brian Norris, Ben Hutchings, Alison Chaiken, Bean Huo ????????? (beanhuo) Hello Michal: > I tried to connect a SPI NOR flash to my sunxi board and due to the current > sunxi SPI driver limitations it does not work. > > The SPI driver returns an error when more than 64 bytes are > transferred at once > due to lack of DMA support. Wouldn't it be easier to fix the SPI driver to handle transfers larger than 64 bytes, filling and draining the FIFO multiple times if neccessary? (As far as I can tell, most SPI drivers do this.) Just asking, Thomas ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] Using SPI NOR flah on sunxi. 2015-04-30 14:22 [PATCH 0/3] Using SPI NOR flah on sunxi Michal Suchanek ` (2 preceding siblings ...) 2015-04-30 16:30 ` Thomas.Betker @ 2015-04-30 16:30 ` Thomas.Betker [not found] ` <OF23B05612.4290AF80-ONC1257E37.00589292-C1257E37.005AB106-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf@public.gmane.org> 2015-05-01 12:27 ` Stefan Monnier 4 siblings, 1 reply; 21+ messages in thread From: Thomas.Betker @ 2015-04-30 16:30 UTC (permalink / raw) To: Michal Suchanek Cc: Alison Chaiken, Huang Shijie, Bean Huo ????????? (beanhuo), Ben Hutchings, Brian Norris, devicetree, David Woodhouse, Kumar Gala, grmoore@altera.com, Ian Campbell, linux-kernel, linux-mtd, linux-mtd, linux-sunxi, Marek Vasut, Mark Rutland, Mika Westerberg, Pawel Moll, Rob Herring, Rafa?? Mi??ecki Hello Michal: > I tried to connect a SPI NOR flash to my sunxi board and due to the current > sunxi SPI driver limitations it does not work. > > The SPI driver returns an error when more than 64 bytes are > transferred at once > due to lack of DMA support. Wouldn't it be easier to fix the SPI driver to handle transfers larger than 64 bytes, filling and draining the FIFO multiple times if neccessary? (As far as I can tell, most SPI drivers do this.) Just asking, Thomas ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <OF23B05612.4290AF80-ONC1257E37.00589292-C1257E37.005AB106-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf@public.gmane.org>]
* Re: [PATCH 0/3] Using SPI NOR flah on sunxi. [not found] ` <OF23B05612.4290AF80-ONC1257E37.00589292-C1257E37.005AB106-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf@public.gmane.org> @ 2015-04-30 16:56 ` Michal Suchanek [not found] ` <CAOMqctRLnCJfVCYGjsmhORYNk+HCf07wwSXnZv4oqDxbaQqKGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 21+ messages in thread From: Michal Suchanek @ 2015-04-30 16:56 UTC (permalink / raw) To: Thomas.Betker-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf Cc: Alison Chaiken, Huang Shijie, Bean Huo ????????? (beanhuo), Ben Hutchings, Brian Norris, devicetree, David Woodhouse, Kumar Gala, grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, Ian Campbell, Linux Kernel Mailing List, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-mtd, linux-sunxi, Marek Vasut, Mark Rutland, Mika Westerberg, Pawel Moll, Rob Herring, Rafa?? Mi??ecki On 30 April 2015 at 18:30, <Thomas.Betker-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf@public.gmane.org> wrote: > Hello Michal: > >> I tried to connect a SPI NOR flash to my sunxi board and due to the > current >> sunxi SPI driver limitations it does not work. >> >> The SPI driver returns an error when more than 64 bytes are >> transferred at once >> due to lack of DMA support. > > Wouldn't it be easier to fix the SPI driver to handle transfers larger > than 64 bytes, filling and draining the FIFO multiple times if neccessary? > (As far as I can tell, most SPI drivers do this.) > Yes, the intent is to fix this by adding dma support to the driver, eventually. The patch might be still useful for other hardware with developing SPI support. Thanks Michal -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <CAOMqctRLnCJfVCYGjsmhORYNk+HCf07wwSXnZv4oqDxbaQqKGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH 0/3] Using SPI NOR flah on sunxi. [not found] ` <CAOMqctRLnCJfVCYGjsmhORYNk+HCf07wwSXnZv4oqDxbaQqKGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2015-04-30 18:34 ` Marek Vasut 2015-05-20 23:54 ` Brian Norris 0 siblings, 1 reply; 21+ messages in thread From: Marek Vasut @ 2015-04-30 18:34 UTC (permalink / raw) To: Michal Suchanek Cc: Thomas.Betker-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf, Alison Chaiken, Huang Shijie, Bean Huo ????????? (beanhuo), Ben Hutchings, Brian Norris, devicetree, David Woodhouse, Kumar Gala, grmoore-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org, Ian Campbell, Linux Kernel Mailing List, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-mtd, linux-sunxi, Mark Rutland, Mika Westerberg, Pawel Moll, Rob Herring, Rafa?? Mi??ecki On Thursday, April 30, 2015 at 06:56:18 PM, Michal Suchanek wrote: > On 30 April 2015 at 18:30, <Thomas.Betker-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf@public.gmane.org> wrote: > > Hello Michal: > >> I tried to connect a SPI NOR flash to my sunxi board and due to the > > > > current > > > >> sunxi SPI driver limitations it does not work. > >> > >> The SPI driver returns an error when more than 64 bytes are > >> transferred at once > >> due to lack of DMA support. > > > > Wouldn't it be easier to fix the SPI driver to handle transfers larger > > than 64 bytes, filling and draining the FIFO multiple times if > > neccessary? (As far as I can tell, most SPI drivers do this.) > > Yes, the intent is to fix this by adding dma support to the driver, > eventually. > > The patch might be still useful for other hardware with developing SPI > support. Please just fix the controller driver to correctly handle arbitrary transfer lengths. Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] Using SPI NOR flah on sunxi. 2015-04-30 18:34 ` Marek Vasut @ 2015-05-20 23:54 ` Brian Norris 0 siblings, 0 replies; 21+ messages in thread From: Brian Norris @ 2015-05-20 23:54 UTC (permalink / raw) To: Marek Vasut Cc: Michal Suchanek, Thomas.Betker, Alison Chaiken, Huang Shijie, Bean Huo ????????? (beanhuo), Ben Hutchings, devicetree, David Woodhouse, Kumar Gala, grmoore@altera.com, Ian Campbell, Linux Kernel Mailing List, linux-mtd, linux-mtd, linux-sunxi, Mark Rutland, Mika Westerberg, Pawel Moll, Rob Herring, Rafa?? Mi??ecki, linux-spi, Mark Brown On Thu, Apr 30, 2015 at 08:34:36PM +0200, Marek Vasut wrote: > On Thursday, April 30, 2015 at 06:56:18 PM, Michal Suchanek wrote: > > On 30 April 2015 at 18:30, <Thomas.Betker@rohde-schwarz.com> wrote: > > > Hello Michal: > > >> I tried to connect a SPI NOR flash to my sunxi board and due to the > > > > > > current > > > > > >> sunxi SPI driver limitations it does not work. > > >> > > >> The SPI driver returns an error when more than 64 bytes are > > >> transferred at once > > >> due to lack of DMA support. > > > > > > Wouldn't it be easier to fix the SPI driver to handle transfers larger > > > than 64 bytes, filling and draining the FIFO multiple times if > > > neccessary? (As far as I can tell, most SPI drivers do this.) > > > > Yes, the intent is to fix this by adding dma support to the driver, > > eventually. > > > > The patch might be still useful for other hardware with developing SPI > > support. > > Please just fix the controller driver to correctly handle arbitrary transfer > lengths. Just noticed this. Yes, that would definitely be a better option! Brian ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] Using SPI NOR flah on sunxi. 2015-04-30 14:22 [PATCH 0/3] Using SPI NOR flah on sunxi Michal Suchanek ` (3 preceding siblings ...) 2015-04-30 16:30 ` Thomas.Betker @ 2015-05-01 12:27 ` Stefan Monnier [not found] ` <jwv4mnwfppf.fsf-monnier+gmane.comp.hardware.netbook.arm.sunxi-mXXj517/zsQ@public.gmane.org> 4 siblings, 1 reply; 21+ messages in thread From: Stefan Monnier @ 2015-05-01 12:27 UTC (permalink / raw) To: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r > The SPI driver returns an error when more than 64 bytes are > transferred at once due to lack of DMA support. Have you tried the dmaengine patch and make the SPI driver use it? Stefan ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <jwv4mnwfppf.fsf-monnier+gmane.comp.hardware.netbook.arm.sunxi-mXXj517/zsQ@public.gmane.org>]
* Re: [linux-sunxi] Re: [PATCH 0/3] Using SPI NOR flah on sunxi. [not found] ` <jwv4mnwfppf.fsf-monnier+gmane.comp.hardware.netbook.arm.sunxi-mXXj517/zsQ@public.gmane.org> @ 2015-05-04 10:32 ` Michal Suchanek 0 siblings, 0 replies; 21+ messages in thread From: Michal Suchanek @ 2015-05-04 10:32 UTC (permalink / raw) To: monnier-CRDzTM1onBSWkKpYnGOUKg Cc: linux-sunxi, devicetree, Linux Kernel Mailing List, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Hello, On 1 May 2015 at 14:27, Stefan Monnier <monnier-CRDzTM1onBSWkKpYnGOUKg@public.gmane.org> wrote: >> The SPI driver returns an error when more than 64 bytes are >> transferred at once due to lack of DMA support. > > Have you tried the dmaengine patch and make the SPI driver use it? > The dmaengine is already merged or queued in sunxi-wip but the SPI glue fell through the cracks. I found it after digging through the archives so I will see if it works for me. Thanks Michal -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2015-05-22 7:17 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-04-30 14:22 [PATCH 0/3] Using SPI NOR flah on sunxi Michal Suchanek [not found] ` <cover.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-04-30 13:33 ` [PATCH 1/3] MTD: m25p80: fix write return value Michal Suchanek [not found] ` <55132b4496e7fe73f949186c0f140f3e4fd4e2c7.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-04-30 18:43 ` Marek Vasut [not found] ` <201504302043.11118.marex-ynQEQJNshbs@public.gmane.org> 2015-04-30 21:37 ` Michal Suchanek 2015-04-30 13:38 ` [PATCH 2/3] MTD: spi-nor: check for short writes in spi_nor_write Michal Suchanek [not found] ` <50c40ef17ab6566f35ef5a4426bf23567f896db7.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-05-20 23:38 ` Brian Norris 2015-05-21 8:39 ` Michal Suchanek [not found] ` <CAOMqctTYqDWL51twOuGi+oXONXQ4B2-2BkdJNSpzZAXshZUN6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2015-05-21 10:28 ` Mark Brown [not found] ` <20150521102802.GS21577-GFdadSzt00ze9xe1eoZjHA@public.gmane.org> 2015-05-22 7:17 ` Brian Norris 2015-04-30 13:46 ` [PATCH 3/3] MTD: m25p80: Add option to limit SPI transfer size Michal Suchanek [not found] ` <3b0c112672f364452e80c333048161eaffb655db.1430403750.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2015-04-30 14:58 ` Julian Calaby [not found] ` <CAGRGNgXKrpJ8rc4h4BykgHsn3kfT5fuAssMK1bQJtxhVL=s2BA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2015-05-20 23:27 ` Brian Norris 2015-04-30 16:30 ` [PATCH 0/3] Using SPI NOR flah on sunxi Thomas.Betker-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf 2015-04-30 16:30 ` Thomas.Betker 2015-04-30 16:30 ` Thomas.Betker 2015-04-30 16:30 ` Thomas.Betker [not found] ` <OF23B05612.4290AF80-ONC1257E37.00589292-C1257E37.005AB106-Bf/A/FSCP0w3s4ca2cGeAgC/G2K4zDHf@public.gmane.org> 2015-04-30 16:56 ` Michal Suchanek [not found] ` <CAOMqctRLnCJfVCYGjsmhORYNk+HCf07wwSXnZv4oqDxbaQqKGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2015-04-30 18:34 ` Marek Vasut 2015-05-20 23:54 ` Brian Norris 2015-05-01 12:27 ` Stefan Monnier [not found] ` <jwv4mnwfppf.fsf-monnier+gmane.comp.hardware.netbook.arm.sunxi-mXXj517/zsQ@public.gmane.org> 2015-05-04 10:32 ` [linux-sunxi] " Michal Suchanek
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).