[U-Boot] [PATCH 05/14] spi: add common fdt SPI driver interface

Allen Martin amartin at nvidia.com
Thu Feb 14 21:07:50 CET 2013


On Wed, Feb 13, 2013 at 02:40:29PM -0800, Stephen Warren wrote:
> On 02/12/2013 08:23 PM, Allen Martin wrote:
> > Add a common interface to fdt based SPI drivers.  Each driver is
> > represented by a table entry in fdt_spi_drivers[].  If there are
> > multiple SPI drivers in the table, the first driver to return success
> > from spi_init() will be registered as the SPI driver.
> 
> I don't think there should be a global concept of "the" SPI driver;
> instances of both SPI blocks exist on Tegra20, so they should be able to
> co-exist, using the SFLASH driver for 1 SPI port, and the SLINK driver
> for the other 4 ports.

I agree, but that's probably beyond the scope of this series, as
that's a more global problem.  Other drivers call directly into the
SPI driver by use of well known function names, so that would need to
be abstracted to fix.

> 
> How does this patch interact with any SPI-related device manager work?

I'm not sure what device manager is in the context of u-boot.  Is that
the same as the unified driver model that's being documented in
doc/driver-model?  If so I think this fits in really well with that.
The "struct ops" described there is almost identical to the callbacks
I added in "struct fdt_spi_driver" 

> 
> > +void spi_init(void)
> > +{
> > +	int i;
> > +	int num_drivers = sizeof(fdt_spi_drivers) /
> > +		sizeof(struct fdt_spi_driver);
> 
> U-Boot doesn't have an ARSIZE/ARRAY_SIZE macro?

Will fix.

> 
> > diff --git a/include/configs/cardhu.h b/include/configs/cardhu.h
> 
> >  /* SPI */
> >  #define CONFIG_TEGRA30_SPI
> > -#define CONFIG_TEGRA_SLINK_CTRLS       6
> > +#define CONFIG_TEGRA30_SPI_CTRLS       6
> 
> Should that be in one of the other patches?

Yes, probably the renaming patch if we decide to keep it.

-- 
nvpublic


More information about the U-Boot mailing list