Linux SPI subsystem development
 help / color / mirror / Atom feed
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: Mon, 14 Feb 2022 12:45:03 +0000	[thread overview]
Message-ID: <YgpOzw2rq+vAIPBU@sirena.org.uk> (raw)
In-Reply-To: <a5aa6dcf-e3dd-e8ff-edcb-edad96f8ddfe@windriver.com>

[-- Attachment #1: Type: text/plain, Size: 2529 bytes --]

On Mon, Feb 14, 2022 at 08:35:33PM +0800, Yun Zhou wrote:

Please don't top post, reply in line with needed context.  This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.

> The focus of our differences is what the role of cs_change is.
> I think the direct effect of cs_change is to change CS to inactive.

During a message.  At the end of the message it does the opposite.

> I also investigated the role of cs_change in several drivers, the result is
> similar, e.g. spi-mpc52xx-psc.c, spi-fsl-spi.c, spi-bcm63xx.c,
> spi-mpc52xx.c, etc.

Individual drivers may not respect chip select at all, never mind in
this specific way - in general any driver actively managing chip select
is going to be unable to implement the full semnatics of cs_change,
possibly even most of the semantics of cs_change, due to hardware
limiations.  If a driver has full control over chip select it'll
normally be able to implement a set_cs() operation and just use the core
handling.

> To sum up, there is no indication and no requirement that when cs_change is
> true, we need to keep chipselect active.
> 
> I hope you can seriously consider my analysis. If what I said is wrong,
> please
> correct it.

 * All SPI transfers start with the relevant chipselect active.  Normally
 * it stays selected until after the last transfer in a message.  Drivers
 * can affect the chipselect signal using cs_change.
 *
 * (i) If the transfer isn't the last one in the message, this flag is
 * used to make the chipselect briefly go inactive in the middle of the
 * message.  Toggling chipselect in this way may be needed to terminate
 * a chip command, letting a single spi_message perform all of group of
 * chip transactions together.
 *
 * (ii) When the transfer is the last one in the message, the chip may
 * stay selected until the next transfer.  On multi-device SPI busses
 * with nothing blocking messages going to other devices, this is just
 * a performance hint; starting a message to another device deselects
 * this one.  But in other cases, this can be used to ensure correctness.
 * Some devices need protocol transactions to be built from a series of
 * spi_message submissions, where the content of one message is determined
 * by the results of previous messages and where the whole transaction
 * ends when the chipselect goes intactive.

especially (ii).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-02-14 12:45 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
2022-02-14 12:35       ` Yun Zhou
2022-02-14 12:45         ` Mark Brown [this message]
     [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=YgpOzw2rq+vAIPBU@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