[U-Boot] [PATCH] TI DaVinci: Driver for the davinci SPI controller

Sudhakar Rajashekhara sudhakar.raj at ti.com
Mon Jan 4 10:46:19 CET 2010


Hi,

On Fri, Dec 25, 2009 at 22:41:13, Dirk Behme wrote:
> On 23.12.2009 08:44, Sudhakar Rajashekhara wrote:
> > From: Sekhar Nori<nsekhar at ti.com>
> >
> > This adds a driver for the SPI controller found on davinci
> > based SoCs from Texas Instruments.
> >
> > Signed-off-by: Sekhar Nori<nsekhar at ti.com>
> > Signed-off-by: Sudhakar Rajashekhara<sudhakar.raj at ti.com>
> > ---
> >   drivers/spi/Makefile      |    1 +
> >   drivers/spi/davinci_spi.c |  205 +++++++++++++++++++++++++++++++++++++++++++++
> >   drivers/spi/davinci_spi.h |   84 ++++++++++++++++++
> >   3 files changed, 290 insertions(+), 0 deletions(-)
> >   create mode 100644 drivers/spi/davinci_spi.c
> >   create mode 100644 drivers/spi/davinci_spi.h
> >
> > diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> > index 824d8e7..07b9611 100644
> > --- a/drivers/spi/Makefile
> > +++ b/drivers/spi/Makefile
> > @@ -34,6 +34,7 @@ COBJS-$(CONFIG_MPC52XX_SPI) += mpc52xx_spi.o
> >   COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
> >   COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
> >   COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
> > +COBJS-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
> 
> Should this list be kept sorted alphabetically? I.e.
> 

I'll arrange them alphabetically.

> ...
> COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
> COBJS-$(CONFIG_CF_SPI) += cf_spi.o
>   +COBJS-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
> COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
> ...
> 
> ?
> 
> >   COBJS	:= $(COBJS-y)
> >   SRCS	:= $(COBJS:.o=.c)
> > diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
> > new file mode 100644
> > index 0000000..1c988bb
> > --- /dev/null
> > +++ b/drivers/spi/davinci_spi.c
> > @@ -0,0 +1,205 @@
> ...
> > +void spi_init()
> ...
> > +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
> > +			unsigned int max_hz, unsigned int mode)
> ...
> > +void spi_free_slave(struct spi_slave *slave)
> ....
> > +int spi_claim_bus(struct spi_slave *slave)
> ....
> > +void spi_release_bus(struct spi_slave *slave)
> ....
> > +int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
> > +		const void *dout, void *din, unsigned long flags)
> 
> I wonder if all (SPI API) functions from include/spi.h should be 
> implemented? I.e. do we need (dummy) functions for spi_cs_is_valid(), 
> spi_cs_activate() and spi_cs_deactivate(), too? Just in case a driver 
> does use them.
> 

Currently none of the SPI Flash drivers are using the above functions. I'll 
implement the above functions as dummy and later as and when the need arises,
these functions will be implemented.

> > diff --git a/drivers/spi/davinci_spi.h b/drivers/spi/davinci_spi.h
> > new file mode 100644
> > index 0000000..b3bf916
> > --- /dev/null
> > +++ b/drivers/spi/davinci_spi.h
> > @@ -0,0 +1,84 @@
> > +/*
> > + * Register definitions for the DaVinci SPI Controller
> > + */
> 
> Do we want a complete GPL header, like in the .c file, here, too?
> 
> Do we want a protection against multiple inclusion
> 
> #ifndef _DAVINCI_SPI_H_
> #define _DAVINCI_SPI_H_
> 
> in this header file?

I'll add the GPL header and guard against multiple inclusion.

Thanks for the comments. I'll submit an updated version of the patch soon.

Regards,
Sudhakar




More information about the U-Boot mailing list