Commit 9694b724 authored by Simon Glass's avatar Simon Glass Committed by Jagannadha Sutradharudu Teki

dm: spi: Correct SPI claim/release_bus() methods

These methods should be passed a slave device, not a bus. This matches the
old SPI interface. It is important to know which device is claiming the bus
so passing a bus is not that useful.
Reported-by: default avatarHaikun Wang <haikun.wang@freescale.com>
Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Tested-by: default avatarPeng Fan <Peng.Fan@freescale.com>
Reviewed-by: default avatarJagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
parent 4fbad92e
......@@ -296,8 +296,9 @@ static int exynos_spi_probe(struct udevice *bus)
return 0;
}
static int exynos_spi_claim_bus(struct udevice *bus)
static int exynos_spi_claim_bus(struct udevice *dev)
{
struct udevice *bus = dev->parent;
struct exynos_spi_priv *priv = dev_get_priv(bus);
exynos_pinmux_config(priv->periph_id, PINMUX_FLAG_NONE);
......@@ -308,8 +309,9 @@ static int exynos_spi_claim_bus(struct udevice *bus)
return 0;
}
static int exynos_spi_release_bus(struct udevice *bus)
static int exynos_spi_release_bus(struct udevice *dev)
{
struct udevice *bus = dev->parent;
struct exynos_spi_priv *priv = dev_get_priv(bus);
spi_flush_fifo(priv->regs);
......
......@@ -67,7 +67,7 @@ int spi_claim_bus(struct spi_slave *slave)
if (ret)
return ret;
return ops->claim_bus ? ops->claim_bus(bus) : 0;
return ops->claim_bus ? ops->claim_bus(dev) : 0;
}
void spi_release_bus(struct spi_slave *slave)
......@@ -77,7 +77,7 @@ void spi_release_bus(struct spi_slave *slave)
struct dm_spi_ops *ops = spi_get_ops(bus);
if (ops->release_bus)
ops->release_bus(bus);
ops->release_bus(dev);
}
int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
......
......@@ -153,8 +153,9 @@ static int tegra114_spi_probe(struct udevice *bus)
return 0;
}
static int tegra114_spi_claim_bus(struct udevice *bus)
static int tegra114_spi_claim_bus(struct udevice *dev)
{
struct udevice *bus = dev->parent;
struct tegra114_spi_priv *priv = dev_get_priv(bus);
struct spi_regs *regs = priv->regs;
......
......@@ -125,8 +125,9 @@ static int tegra20_sflash_probe(struct udevice *bus)
return 0;
}
static int tegra20_sflash_claim_bus(struct udevice *bus)
static int tegra20_sflash_claim_bus(struct udevice *dev)
{
struct udevice *bus = dev->parent;
struct tegra20_sflash_priv *priv = dev_get_priv(bus);
struct spi_regs *regs = priv->regs;
u32 reg;
......
......@@ -141,8 +141,9 @@ static int tegra30_spi_probe(struct udevice *bus)
return 0;
}
static int tegra30_spi_claim_bus(struct udevice *bus)
static int tegra30_spi_claim_bus(struct udevice *dev)
{
struct udevice *bus = dev->parent;
struct tegra30_spi_priv *priv = dev_get_priv(bus);
struct spi_regs *regs = priv->regs;
u32 reg;
......
......@@ -386,12 +386,12 @@ struct dm_spi_ops {
* allowed to claim the same bus for several slaves without releasing
* the bus in between.
*
* @bus: The SPI slave
* @dev: The SPI slave
*
* Returns: 0 if the bus was claimed successfully, or a negative value
* if it wasn't.
*/
int (*claim_bus)(struct udevice *bus);
int (*claim_bus)(struct udevice *dev);
/**
* Release the SPI bus
......@@ -400,9 +400,9 @@ struct dm_spi_ops {
* all transfers have finished. It may disable any SPI hardware as
* appropriate.
*
* @bus: The SPI slave
* @dev: The SPI slave
*/
int (*release_bus)(struct udevice *bus);
int (*release_bus)(struct udevice *dev);
/**
* Set the word length for SPI transactions
......@@ -414,7 +414,7 @@ struct dm_spi_ops {
*
* Returns: 0 on success, -ve on failure.
*/
int (*set_wordlen)(struct udevice *bus, unsigned int wordlen);
int (*set_wordlen)(struct udevice *dev, unsigned int wordlen);
/**
* SPI transfer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment