mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] spi: add STM32 SPI controller driver
Date: Fri, 19 Nov 2021 11:36:26 +0300	[thread overview]
Message-ID: <20211119113626.d550f1e237bbd974899a6db5@gmail.com> (raw)
In-Reply-To: <c166fe6f-7265-cc58-5d68-1f3dd2b424a3@pengutronix.de>

On Thu, 18 Nov 2021 13:32:18 +0100
Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:

Hi Ahmad!

> On 08.11.21 18:01, Antony Pavlov wrote:
> > On Fri,  5 Nov 2021 08:46:57 +0100
> > Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
> > 
> >> Tested on a STM32MP1 communicating with a ksz9563.
> > 
> > ...
> > 
> >> diff --git a/drivers/spi/stm32_spi.c b/drivers/spi/stm32_spi.c
> >> new file mode 100644
> >> index 000000000000..0cb04a968c8a
> >> --- /dev/null
> >> +++ b/drivers/spi/stm32_spi.c
> >> @@ -0,0 +1,590 @@
> >> +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
> >> +/*
> >> + * Copyright (C) 2019, STMicroelectronics - All Rights Reserved
> >> + *
> >> + * Driver for STMicroelectronics Serial peripheral interface (SPI)
> >> + */
> >> +
> > 
> > ...
> > 
> >> +/* STM32_SPI_CR2 bit fields */
> >> +#define SPI_CR2_TSIZE		GENMASK(15, 0)
> > 
> > So SPI_CR2_TSIZE is (64K - 1)
> > 
> > ...
> > 
> >> +
> >> +static int stm32_spi_transfer_one(struct stm32_spi_priv *priv,
> >> +				  struct spi_transfer *t)
> >> +{
> >> +	struct device_d *dev = priv->master.dev;
> >> +	u32 sr;
> >> +	u32 ifcr = 0;
> >> +	u32 mode;
> >> +	int xfer_status = 0;
> >> +
> >> +	if (t->len <= SPI_CR2_TSIZE)
> >> +		writel(t->len, priv->base + STM32_SPI_CR2);
> >> +	else
> >> +		return -EMSGSIZE;
> > 
> > So stm32_spi_transfer_one() can transfer no more than (64K - 1).
> > At the other hand imd tends to read more than  (64K - 1) from SPI flash, e.g.
> > 
> >   barebox:/ imd /dev/m25p0
> >   imd: error 90
> > 
> > Here is my solution for handling SPI flash by stm32 SPI driver (not tested on stm32):
> 
> Thanks for the input. I believe I have STM32 with a SPI flash, where
> I should be able to test this. I'll report back once I come around to it.
> 
> Can I have your Signed-off-by for this patch here?

Yes, please add my Signed-off-by for the patch.

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


      reply	other threads:[~2021-11-19  8:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05  7:46 Ahmad Fatoum
2021-11-05  9:24 ` Sascha Hauer
2021-11-08 17:01 ` Antony Pavlov
2021-11-18 12:32   ` Ahmad Fatoum
2021-11-19  8:36     ` Antony Pavlov [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=20211119113626.d550f1e237bbd974899a6db5@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --subject='Re: [PATCH] spi: add STM32 SPI controller driver' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox