linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Dan.Sneddon@microchip.com>
To: <broonie@kernel.org>, <Dan.Sneddon@microchip.com>
Cc: <linux-spi@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <Tudor.Ambarus@microchip.com>,
	<Nicolas.Ferre@microchip.com>, <alexandre.belloni@bootlin.com>,
	<Ludovic.Desroches@microchip.com>
Subject: Re: Re: [PATCH] spi: atmel: Fix CS and initialization bug
Date: Tue, 29 Jun 2021 17:50:45 +0000	[thread overview]
Message-ID: <cb709000-7816-3817-b734-e03735788723@microchip.com> (raw)
In-Reply-To: <20210629170741.GF4613@sirena.org.uk>

On 6/29/21 10:07 AM, Mark Brown wrote:
> On Tue, Jun 29, 2021 at 05:01:57PM +0000, Dan.Sneddon@microchip.com wrote:
>> On 6/29/21 9:47 AM, Mark Brown wrote:
> 
>>   >In what way does it do that?  I can't tell what the patch is supposed >to
>>   >do.
> 
>> The SPI_MASTER_GPIO_SS flag has to be set so that the set_cs function
>> gets called even when using gpio cs pins.
> 
> This all needs to be clear in the changelog.

I'll update the commit message.

> 
>>   >> -	enable =3D (!!(spi->mode & SPI_CS_HIGH) =3D=3D enable);
>>   >> =20
>>   >> -	if (enable) {
>>   >> +	if ((enable && (spi->mode & SPI_CS_HIGH))
>>   >> +			|| (!enable && !(spi->mode & SPI_CS_HIGH))) {
> 
>>   >This looks especially suspicious.
> 
>> It's due to the fact that the spi core tells set_cs if the cs should be
>> high or low, not active or disabled.  This logic is to convert from
>> high/low to active/disabled.
> 
> spi_set_cs() handles SPI_CS_HIGH...  this looks like a separate existing
> driver bug, it should just be ignoring SPI_CS_HIGH if it's providing a
> set_cs() operation and letting the core implement SPI_CS_HIGH for it.  I
> only checked breifly but it looks like spi-atmel is trying to use the
> core support for chipselect handling here.
> 




      reply	other threads:[~2021-06-29 17:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 16:29 [PATCH] spi: atmel: Fix CS and initialization bug Dan Sneddon
2021-06-29 16:47 ` Mark Brown
2021-06-29 17:01   ` Dan.Sneddon
2021-06-29 17:07     ` Mark Brown
2021-06-29 17:50       ` Dan.Sneddon [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=cb709000-7816-3817-b734-e03735788723@microchip.com \
    --to=dan.sneddon@microchip.com \
    --cc=Ludovic.Desroches@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.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).