From: Mark Brown <broonie@kernel.org>
To: Yun Zhou <yun.zhou@windriver.com>
Cc: "linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Xue, Ying" <Ying.Xue@windriver.com>
Subject: Re: 回复: [PATCH] spi: disable chipselect after complete transfer
Date: Thu, 10 Feb 2022 17:14:07 +0000 [thread overview]
Message-ID: <YgVH310gQ1sK6dlr@sirena.org.uk> (raw)
In-Reply-To: <19c69765-8584-2e6b-25b8-7053a5afa5d4@windriver.com>
[-- Attachment #1: Type: text/plain, Size: 2080 bytes --]
On Fri, Feb 11, 2022 at 01:01:20AM +0800, Yun Zhou wrote:
> > > If there are multiple messages, and each message only has one xfer,
> > > and the cs_change of each xfer is 1, during the transmission of the
> > > messages, the CS will keep active even until at the end. This must be
> > > unreasonable.
> > This is not something that most drivers are expected to use, cs_change
> > should only be being used at all for very unusual hardware and it should
> > be used even less frequently for the last transfer in a message. It is
> > fragile and anyone using it really needs to know what they're doing but
> > the feature is there.
> Maybe it's not normal to set "cs_change" in the last xfer. However, in
> most cases, SPI messages come from user space, and these messages may
I would question your use of "most" here...
> come from multiple different applications. We can't make the whole
> controller fail to work normally due to an inappropriate message of one
> application.
This is one of the many hazards of using spidev, it is not an especially
safe or robust interface. To the extent that there's an issue here it's
something that should be addressed at the spidev level, though I expect
that there will be some users who want this facility and would want a
way to disable any access controls. I recommend writing device drivers
in kernel.
> > The feature predates me working on the SPI stack, the obvious examples
> > would be a device that doesn't actually use chip select where you want
> > to avoid all chip select changes or if you need to do some other actions
> > in the middle of a SPI transaction for some reason (which would need a
> > bunch of system level considerations to actually be safe/sensible like
> > making sure you're not sharing the SPI bus).
> At present, if "cs_change" is not set, CS will be changed back to inactive
> after the transmission is completed. If "cs_change" is set, CS will not
> be changed. This obviously violates the definition of "cs_change".
No, it is exactly the specified behaviour of cs_change. Please see
spi.h.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-02-10 17:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <SN6PR11MB3008AF5619B0B026836FD7429F2F9@SN6PR11MB3008.namprd11.prod.outlook.com>
2022-02-10 15:57 ` 回复: [PATCH] spi: disable chipselect after complete transfer Mark Brown
2022-02-10 17:01 ` Yun Zhou
2022-02-10 17:14 ` Mark Brown [this message]
2022-02-14 12:35 ` Yun Zhou
2022-02-14 12:45 ` Mark Brown
[not found] ` <8fd9c3ef-df64-b8ad-de6e-ef86806d53b5@windriver.com>
2022-02-14 14:36 ` Mark Brown
2022-02-16 10:41 ` Yun Zhou
2022-02-16 16:23 ` 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=YgVH310gQ1sK6dlr@sirena.org.uk \
--to=broonie@kernel.org \
--cc=Ying.Xue@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=yun.zhou@windriver.com \
/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