From: Florian Achleitner <achleitner.florian-JpyZg0bqyNJBDgjK7y7TUQ@public.gmane.org>
To: "Jakub Kiciński" <moorray3-5tc4TXWwyLM@public.gmane.org>
Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Jon Ringle <jringle-gkqdKIIuv0Hby3iVrkZq2A@public.gmane.org>,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 1/2] sc16is7xx: Prevent TX buffer overrun, prevent crash
Date: Tue, 6 Oct 2015 10:41:46 +0200 [thread overview]
Message-ID: <2151687.RJUYUNn8g7@r90b40zn> (raw)
In-Reply-To: <1553770.pceUAxXUCu@r90b40zn>
Hi,
some news.
On Monday 05 October 2015 14:34:01 Florian Achleitner wrote:
> I digged a little deeper and did some measurements to support my idea.
> I think the reason for the 255 read is that the chip does not support the
> zero length write.
>
> The chip's SPI interface defines two sorts of frames. One for normal
> register access, which is essentially an address followed by one byte of
> data, either read or written.
>
> The second type is for accessing the fifo. It has an address and two bytes
> of data, by definition.
>
> If the master now issues a zero length write, it sends only the address
> byte, but the chip will expect two following data bytes, which do not
> arrive. Instead it will consume the following frame. When this frame is the
> tx fifo level read, the chip will not drive its SO line (still expecting a
> fifo write), and the master reads 255. Now two bytes were clocked, and they
> are back in sync. However, the value is crap.
>
> If my theorie is true, we would also have to make sure, that fifo access is
> always two bytes to keep it synced. I will check this, and craft another
> patch, if neccessary.
My theorie is wrong with fifo frame lengths. Actually, they can be be of
arbitrary length and the SPI chip select (CS) terminates a frame. Thus, the
complete fifo can be filled at once, and single bytes can be written, as well.
However, a zero-length write seems to confuse the chip. If I prevent it,
everything works.
As already mentioned, all regmap operations return success.
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2015-10-06 8:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <53467079.FOLVyveiGt@r90b40zn>
[not found] ` <8914018.PpSVth2cIK@r90b40zn>
2015-10-03 18:52 ` [PATCH v2 1/2] sc16is7xx: Prevent TX buffer overrun, prevent crash Jakub Kiciński
2015-10-05 12:34 ` Florian Achleitner
2015-10-06 8:41 ` Florian Achleitner [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=2151687.RJUYUNn8g7@r90b40zn \
--to=achleitner.florian-jpyzg0bqynjbdgjk7y7tuq@public.gmane.org \
--cc=jringle-gkqdKIIuv0Hby3iVrkZq2A@public.gmane.org \
--cc=linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=moorray3-5tc4TXWwyLM@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