[U-Boot] [PATCH 06/25] dm: spi: Add a uclass for SPI

Pavel Herrmann morpheus.ibis at gmail.com
Tue Jul 15 10:26:11 CEST 2014


Hi

On Monday 14 of July 2014 18:56:13 Simon Glass wrote:
> Add a uclass which provides access to SPI buses and includes operations
> required by SPI.
> 
> For a time driver model will need to co-exist with the legacy SPI interface
> so some parts of the header file are changed depending on which is in use.
> The exports are adjusted also since some functions are not available with
> driver model.
> 
> Boards must define CONFIG_DM_SPI to use driver model for SPI.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
> ...
> +int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
> +	     const void *dout, void *din, unsigned long flags)
> +{
> +	struct udevice *dev = slave->dev;
> +	struct udevice *bus = dev->parent;

is this the best interface here?
I think it would be cleaner if bus drivers had interfaces which follow a 
certain template, such as
bus_ops(struct udevice *bus, struct udevice *child, ...)

struct spi_slave would be a prime candidate to have in child->parentdata 
(which should only be accessed by the parent IIUC)

regards
Pavel Herrmann


More information about the U-Boot mailing list