linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: linux@bigler.io
To: Benjamin Bigler <benjamin@bigler.one>
Cc: broonie@kernel.org, francesco@dolcini.it,
	linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
	regressions@lists.linux.dev, stefan.moring@technolution.nl
Subject: Re: spi: imx: Increase imx51 ecspi burst length fails on imx6dl and imx8mm
Date: Mon, 27 Nov 2023 10:09:27 +0100	[thread overview]
Message-ID: <89209fbb46c4ce650141ecb6fdf06476@mail.infomaniak.com> (raw)
In-Reply-To: <c7a38307ac74a973e26ac820a0b98773262720bd.camel@bigler.one>

Hi 

Thank you Benjamin for the patch.
I have tested the patch and is works fine.

Best regards
Stefan Bigler

Am 2023-11-26T14:19:56.000+01:00 hat Benjamin Bigler <benjamin@bigler.one> geschrieben:
>  Hi
> 
> I did some debugging and I think the problem is that in this case bits_per_word is 8. So in
> spi_imx_dma_configure the buswidth is set to DMA_SLAVE_BUSWIDTH_1_BYTE. But in
> mx51_ecspi_prepare_transfer the BURST_LENGTH is now set to (spi_imx->count * spi_imx->bits_per_word
> - 1)
> before 15a6af94a2779d5dfb42ee4bfac858ea8e964a3f it was (spi_imx->bits_per_word - 1). Now the spi
> transmits 4 byte per byte except for the first word. I added the following patch and it worked again
> 
> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> index 498e35c8db2c..f514966e2ada 100644
> --- a/drivers/spi/spi-imx.c
> +++ b/drivers/spi/spi-imx.c
> @@ -659,11 +659,22 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
>  		ctrl |= (spi_imx->target_burst * 8 - 1)
>  			<< MX51_ECSPI_CTRL_BL_OFFSET;
>  	else {
> -		if (spi_imx->count &gt;= 512)
> -			ctrl |= 0xFFF << MX51_ECSPI_CTRL_BL_OFFSET;
> -		else
> -			ctrl |= (spi_imx->count * spi_imx->bits_per_word - 1)
> +		if (spi_imx->usedma)
> +			ctrl |= (spi_imx->bits_per_word *
> +					 spi_imx_bytes_per_word(
> +						 spi_imx->bits_per_word) -
> +				 1)
>  				<< MX51_ECSPI_CTRL_BL_OFFSET;
> +		else {
> +			if (spi_imx->count &gt;= MX51_ECSPI_CTRL_MAX_BURST)
> +				ctrl |= (MX51_ECSPI_CTRL_MAX_BURST - 1)
> +					<< MX51_ECSPI_CTRL_BL_OFFSET;
> +			else
> +				ctrl |= (spi_imx->count *
> +						 spi_imx->bits_per_word -
> +					 1)
> +					<< MX51_ECSPI_CTRL_BL_OFFSET;
> +		}
>  	}
>  
>  	/* set clock speed */
> 
> Best regards,
Benjamin Bigler

  reply	other threads:[~2023-11-27  9:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-18 14:25 spi: imx: Increase imx51 ecspi burst length fails on imx6dl and imx8mm linux
2023-11-18 15:13 ` Linux regression tracking (Thorsten Leemhuis)
2023-11-18 15:15   ` Thorsten Leemhuis
     [not found]     ` <CAB3BuKA+qOY+UhWR-9Ov3qsz3wQr8q8n38MrEMf3FMCthr04yA@mail.gmail.com>
2023-11-18 17:59       ` linux
     [not found]         ` <CAB3BuKARgJhaVNFsP1FQ+2yLe18QU9H17fHKjc-Sf3izE+MZ1Q@mail.gmail.com>
2023-11-20  8:27           ` linux
2023-11-20  8:47             ` Francesco Dolcini
2023-11-20  9:33               ` linux
2023-11-20 10:17                 ` Francesco Dolcini
     [not found]                   ` <CAB3BuKDb6uucujD7ac-w4pa1GVNLSQUA4OGE7i074mQSU==WaA@mail.gmail.com>
2023-11-20 16:45                     ` linux
2023-11-20 17:48                     ` Francesco Dolcini
2023-11-21  9:06                       ` Thorsten Leemhuis
2023-11-21  9:16                         ` Francesco Dolcini
2023-11-21 10:10                           ` Francesco Dolcini
2023-11-21 10:34                           ` linux
2023-11-22 13:26                             ` linux
2023-11-25 22:44                   ` Benjamin Bigler
2023-11-26 13:19                     ` Benjamin Bigler
2023-11-27  9:09                       ` linux [this message]
2023-12-05 13:36                         ` Linux regression tracking (Thorsten Leemhuis)
2023-12-07 19:43                           ` Benjamin Bigler

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=89209fbb46c4ce650141ecb6fdf06476@mail.infomaniak.com \
    --to=linux@bigler.io \
    --cc=benjamin@bigler.one \
    --cc=broonie@kernel.org \
    --cc=francesco@dolcini.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=regressions@lists.linux.dev \
    --cc=stefan.moring@technolution.nl \
    /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).