public inbox for linux-spi@vger.kernel.org
 help / color / mirror / Atom feed
From: Prajna Rajendra Kumar <prajna.rajendrakumar@microchip.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Conor Dooley <conor@kernel.org>
Cc: Jonas Gorski <jonas.gorski@gmail.com>,
	Mark Brown <broonie@kernel.org>, <linux-spi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	"Prajna Rajendra Kumar - M74368"
	<prajna.rajendrakumar@microchip.com>
Subject: Re: [PATCH v4 2/2] spi: microchip-core: use XOR instead of ANDNOT to simplify the logic
Date: Thu, 8 Jan 2026 13:00:39 +0000	[thread overview]
Message-ID: <12446fa2-570b-4882-80dc-c72a166aaf19@microchip.com> (raw)
In-Reply-To: <aS3XBW7D0vVmUTio@smile.fi.intel.com>

On 01/12/2025 17:57, Andy Shevchenko wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On Mon, Dec 01, 2025 at 04:08:57PM +0000, Conor Dooley wrote:
>> On Sat, Nov 29, 2025 at 10:19:00AM +0200, Andy Shevchenko wrote:
>>> On Fri, Nov 28, 2025 at 08:30:43PM +0100, Jonas Gorski wrote:
>>>> On Fri, Nov 28, 2025 at 7:56 PM Andy Shevchenko
>>>> <andriy.shevchenko@linux.intel.com> wrote:
> ...
>
>>>>> -       if (spi->mode & SPI_MODE_X_MASK & ~spi->controller->mode_bits) {
>>>>> +       if ((spi->mode ^ spi->controller->mode_bits) & SPI_MODE_X_MASK) {
>>>> This changes the behavior: if a bit isn't set in spi->mode that is set
>>>> in mode_bits, it would have been previously accepted, now it's
>>>> refused. E.g. controller has (SPI_CPOL | SPI_CPHA), device only
>>>> SPI_CPOL. 0x1 & 0x3 & ~0x3 => 0, vs (0x1 ^ 0x3) & 0x3 => 0x2
>>>>
>>>> If this is the actually intended behavior here, it is a fix and should
>>>> carry a Fixes tag (the message below implies that).
>>> Yeah, yesterday I was thinking about the same and I was confused by the logic
>>> behind. As far as I understood the comments regarding mode provided by DT is
>>> that the mode is configured in IP and may not be changed. And you are right
>>> about the fix, but let's wait for Microchip to elaborate on the expected
>>> behaviour.
>> Prajna is on holiday and I don't have a setup to actually test this on,
>> but I'm 99% sure that you're both right and the original behaviour was
>> wrong. There's a verilog parameter to the IP block that determines which
>> motorola mode it is and a device that's not an exact match won't work.
> Okay, let's not hurry up with this and wait for testing results.
>
>> FWIW:
>> Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
>>>>>                  dev_err(&spi->dev, "incompatible CPOL/CPHA, must match controller's Motorola mode\n");
>>>>>                  return -EINVAL;
>>>>>          }
> Thanks for the review!
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Hi,

I've tested this on my setup and XOR check matches how the controller
behaves. The SPI mode is fixed in hardware, so the previous logic was
wrong.

Tested-by: Prajna Rajendra Kumar <prajna.rajendrakumar@microchip.com>


  reply	other threads:[~2026-01-08 12:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 18:52 [PATCH v4 0/2] spi: microchip-core: Code improvements (part 2) Andy Shevchenko
2025-11-28 18:52 ` [PATCH v4 1/2] spi: microchip-core: Refactor FIFO read and write handlers Andy Shevchenko
2025-11-28 18:52 ` [PATCH v4 2/2] spi: microchip-core: use XOR instead of ANDNOT to simplify the logic Andy Shevchenko
2025-11-28 19:30   ` Jonas Gorski
2025-11-29  8:19     ` Andy Shevchenko
2025-12-01 16:08       ` Conor Dooley
2025-12-01 17:57         ` Andy Shevchenko
2026-01-08 13:00           ` Prajna Rajendra Kumar [this message]
2026-01-08 17:53             ` Andy Shevchenko

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=12446fa2-570b-4882-80dc-c72a166aaf19@microchip.com \
    --to=prajna.rajendrakumar@microchip.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=conor@kernel.org \
    --cc=jonas.gorski@gmail.com \
    --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