Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Jonathan Marek <jonathan@marek.ca>
To: Maramaina Naresh <naresh.maramaina@oss.qualcomm.com>,
	Mark Brown <broonie@kernel.org>,
	konrad.dybcio@oss.qualcomm.com
Cc: kernel@quicinc.com, linux-arm-msm@vger.kernel.org,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, dmitry.baryshkov@oss.qualcomm.com,
	bjorande@quicinc.com, mukesh.savaliya@oss.qualcomm.com,
	praveen.talari@oss.qualcomm.com, jyothi.seerapu@oss.qualcomm.com
Subject: Re: [PATCH v1] spi: geni-qcom: Fix CPHA and CPOL mode change detection
Date: Mon, 16 Mar 2026 13:13:07 -0400	[thread overview]
Message-ID: <4a7d89ef-0f63-a7c3-e996-ff9fc476a04e@marek.ca> (raw)
In-Reply-To: <20260316-spi-geni-cpha-cpol-fix-v1-1-4cb44c176b79@oss.qualcomm.com>

Reviewed-by: Jonathan Marek <jonathan@marek.ca>

at least it doesn't look like this stupid mistake breaks anything 
upstream (no spi-cpha/spi-cpol in any qcom dts)

On 3/16/26 9:23 AM, Maramaina Naresh wrote:
> setup_fifo_params computes mode_changed from spi->mode flags but tests
> it against SE_SPI_CPHA and SE_SPI_CPOL, which are register offsets,
> not SPI mode bits. This causes CPHA and CPOL updates to be skipped
> on mode switches, leaving the controller with stale clock phase
> and polarity settings.
> 
> Fix this by using SPI_CPHA and SPI_CPOL to detect mode changes before
> updating the corresponding registers.
> 
> Fixes: 781c3e71c94c ("spi: spi-geni-qcom: rework setup_fifo_params")
> Signed-off-by: Maramaina Naresh <naresh.maramaina@oss.qualcomm.com>
> ---
> This patch fixes SPI mode change detection in the spi-geni-qcom driver.
> 
> setup_fifo_params compared spi->mode against SE_SPI_CPHA/SE_SPI_CPOL,
> which are register offsets instead of SPI_CPHA/SPI_CPOL mode bits.
> This could skip CPHA/CPOL updates on mode switches and leave stale
> clock configuration.
> 
> This is a single-patch series.
> ---
>   drivers/spi/spi-geni-qcom.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
> index 43ce47f2454c..772b7148ba5f 100644
> --- a/drivers/spi/spi-geni-qcom.c
> +++ b/drivers/spi/spi-geni-qcom.c
> @@ -359,9 +359,9 @@ static int setup_fifo_params(struct spi_device *spi_slv,
>   		writel((spi_slv->mode & SPI_LOOP) ? LOOPBACK_ENABLE : 0, se->base + SE_SPI_LOOPBACK);
>   	if (cs_changed)
>   		writel(chipselect, se->base + SE_SPI_DEMUX_SEL);
> -	if (mode_changed & SE_SPI_CPHA)
> +	if (mode_changed & SPI_CPHA)
>   		writel((spi_slv->mode & SPI_CPHA) ? CPHA : 0, se->base + SE_SPI_CPHA);
> -	if (mode_changed & SE_SPI_CPOL)
> +	if (mode_changed & SPI_CPOL)
>   		writel((spi_slv->mode & SPI_CPOL) ? CPOL : 0, se->base + SE_SPI_CPOL);
>   	if ((mode_changed & SPI_CS_HIGH) || (cs_changed && (spi_slv->mode & SPI_CS_HIGH)))
>   		writel((spi_slv->mode & SPI_CS_HIGH) ? BIT(chipselect) : 0, se->base + SE_SPI_DEMUX_OUTPUT_INV);
> 
> ---
> base-commit: 7109a2155340cc7b21f27e832ece6df03592f2e8
> change-id: 20260316-spi-geni-cpha-cpol-fix-89126ed55325
> 
> Best regards,
> 

  parent reply	other threads:[~2026-03-16 17:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 13:23 [PATCH v1] spi: geni-qcom: Fix CPHA and CPOL mode change detection Maramaina Naresh
2026-03-16 13:28 ` Konrad Dybcio
2026-03-16 14:48 ` Mark Brown
2026-03-16 17:13 ` Jonathan Marek [this message]
2026-03-21  3:04   ` Val Packett
2026-03-16 17:52 ` 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=4a7d89ef-0f63-a7c3-e996-ff9fc476a04e@marek.ca \
    --to=jonathan@marek.ca \
    --cc=bjorande@quicinc.com \
    --cc=broonie@kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=jyothi.seerapu@oss.qualcomm.com \
    --cc=kernel@quicinc.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mukesh.savaliya@oss.qualcomm.com \
    --cc=naresh.maramaina@oss.qualcomm.com \
    --cc=praveen.talari@oss.qualcomm.com \
    --cc=stable@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