From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Herrmann Date: Tue, 15 Jul 2014 10:26:11 +0200 Subject: [U-Boot] [PATCH 06/25] dm: spi: Add a uclass for SPI In-Reply-To: <1405385792-4469-7-git-send-email-sjg@chromium.org> References: <1405385792-4469-1-git-send-email-sjg@chromium.org> <1405385792-4469-7-git-send-email-sjg@chromium.org> Message-ID: <1661162.zvPDlbZl9o@bloomfield> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > --- > > ... > +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