linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Brandt <Chris.Brandt-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
To: Sergei Shtylyov
	<sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>,
	"linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Mason Yang <masonccyang-I/i+R0kf0WFNUHwG+Fw1Kw@public.gmane.org>
Subject: RE: [PATCH v2] spi: add Renesas RPC-IF driver
Date: Mon, 10 Feb 2020 18:06:37 +0000	[thread overview]
Message-ID: <TYXPR01MB1568E8BCB6B80A77C91D98998A190@TYXPR01MB1568.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <6515c5ec-8432-0b20-426d-0428bbdf3712-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>

Hi Sergei,

As I mentioned, when testing on RZ/A1, some commands are not transmitted.

Basically and SPI command that did not have 'data' payload:
	0x06: Write Enable
	0xDC: Erase 256 kB (4-byte address)
	0x04: Write Disable

The reason seems to be there is no case to set rpc->dir when there is no data.
So, it just gets left at whatever the last transfer was.

I added this fix and now it seems to work fine.

diff --git a/drivers/spi/spi-rpc-if.c b/drivers/spi/spi-rpc-if.c
index 0ff1a538bbd5..2165a0761844 100644
--- a/drivers/spi/spi-rpc-if.c
+++ b/drivers/spi/spi-rpc-if.c
@@ -53,6 +54,9 @@ static void rpcif_spi_mem_prepare(struct spi_device *spi_dev,
                default:
                        break;
                }
+       } else {
+               rpc_op.data.dir = RPCIF_NO_DATA;
+               rpc->dir = RPCIF_NO_DATA;
        }
 
        rpcif_prepare(rpc, &rpc_op, offs, len);


This seems like a bug that would effect add devices, not just the RZ/A1.



Side note, erase seems OK...but writing data seems to get messed up.
As you can see below, it's adding 2 bytes of 00 into the write stream.

$ flash_eraseall /dev/mtd3
Erasing 256 Kibyte @ 1000000 - 100% complete.
$ hexdump -C -n100 /dev/mtd3
00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000060
$ hexdump -C -n100 /dev/mtd3
00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000060
$ echo "hello" > /dev/mtd3
$ hexdump -C -n100 /dev/mtd3
00000000  68 65 6c 6c 00 00 6f 0a  ff ff ff ff ff ff ff ff  |hell..o.........|
00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000060


Chris

  parent reply	other threads:[~2020-02-10 18:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ad503d6e-4739-9744-64b4-fd13f44ea6fe@cogentembedded.com>
     [not found] ` <ad503d6e-4739-9744-64b4-fd13f44ea6fe-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2020-01-15 20:46   ` [PATCH v2] spi: add Renesas RPC-IF driver Sergei Shtylyov
     [not found]     ` <6515c5ec-8432-0b20-426d-0428bbdf3712-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2020-02-07 22:36       ` Chris Brandt
     [not found]         ` <TY1PR01MB1562509AEBD0B4460D3FEC798A1C0-5SGCI54O2uKy/kJTUOSl63colHNk5qUtvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2020-02-10 18:43           ` Sergei Shtylyov
2020-02-10 18:06       ` Chris Brandt [this message]
     [not found]         ` <TYXPR01MB1568E8BCB6B80A77C91D98998A190-enDngAEzY3rnUoU5SHyUhXcolHNk5qUtvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2020-02-10 19:34           ` Chris Brandt
2020-05-08 19:54 ` [PATCH v3] " Sergei Shtylyov
2020-06-13 19:18 ` [PATCH v4] " Sergei Shtylyov
2020-06-15 23:41   ` Mark Brown
2020-06-16  8:24     ` Sergei Shtylyov
2020-06-16  8:38       ` Mark Brown
2020-06-16  8:48         ` Sergei Shtylyov
2020-06-16  9:34           ` Mark Brown
2020-06-16 12:55             ` Sergei Shtylyov
2020-06-16 14:32               ` Mark Brown
2020-06-16  9:26         ` Sergei Shtylyov
2020-06-16  9:34           ` Mark Brown

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=TYXPR01MB1568E8BCB6B80A77C91D98998A190@TYXPR01MB1568.jpnprd01.prod.outlook.com \
    --to=chris.brandt-zm6kxycvzfbbdgjk7y7tuq@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=masonccyang-I/i+R0kf0WFNUHwG+Fw1Kw@public.gmane.org \
    --cc=sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org \
    /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).