[PATCH 5/9] spi: add litex spiflash driver

Antony Pavlov antonynpavlov at gmail.com
Wed May 5 08:10:10 PDT 2021


On Wed, 5 May 2021 12:39:14 +0200
Ahmad Fatoum <a.fatoum at pengutronix.de> wrote:

Hi Ahmad!

> Hello Antony,
> 
> On 05.05.21 12:08, Antony Pavlov wrote:
> > Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
> > ---
> >  drivers/spi/Kconfig          |   3 +
> >  drivers/spi/Makefile         |   1 +
> >  drivers/spi/litex_spiflash.c | 242 +++++++++++++++++++++++++++++++++++
> >  3 files changed, 246 insertions(+)
> > 
> > diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
> > index 323d93efeb..714d30e909 100644
> > --- a/drivers/spi/Kconfig
> > +++ b/drivers/spi/Kconfig
> > @@ -74,6 +74,9 @@ config DRIVER_SPI_IMX_2_3
> >  	depends on ARCH_IMX50 || ARCH_IMX51 || ARCH_IMX53 || ARCH_IMX6 || ARCH_IMX7 || ARCH_IMX8MQ
> >  	default y
> >  
> > +config DRIVER_SPI_LITEX_SPIFLASH
> > +	bool "Litex SPIFLASH bitbang master driver"
> 
> The SPI controller is called SPIFLASH?

Yes. Simple SPI flash controller is part of litex repo:
https://github.com/enjoy-digital/litex/blob/master/litex/soc/cores/spi_flash.py

There is another LiteX SPI controller: https://github.com/litex-hub/litespi

...

> > --- /dev/null
> > +++ b/drivers/spi/litex_spiflash.c
> > @@ -0,0 +1,242 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Copyright (C) 2020 Antony Pavlov <antonynpavlov at gmail.com>
> > + *
> > + */
> > +
> > +#include <common.h>
> > +#include <init.h>
> > +#include <driver.h>
> > +#include <spi/spi.h>
> > +#include <io.h>
> > +#include <clock.h>
> 
> Unused now, I think.

Yes, clock.h is unused.

...

> > +
> > +#define spidelay(nsecs) udelay(nsecs/1000)
> 
> Unused.
> 
> > +
> > +#include "spi-bitbang-txrx.h"


No, spidelay() is used inside of spi-bitbang-txrx.h.
...

> > +
> > +	litex_spiflash_spi_enable(litex_spiflash_spi);
> > +
> > +	/* inactivate chip select signal */
> 
> Nitpick s/inactivate/deactivate/

Quora.com says that there is no big difference (see
https://www.quora.com/What-is-the-difference-between-deactivate-and-inactivate)
but 'git grep' on linux kernel sources says that deactivate is more popular.

-- 
Best regards,
  Antony Pavlov



More information about the barebox mailing list