diff mbox series

[U-Boot,v2,1/2] spi: omap3: Skip set_mode, set_speed from claim

Message ID 20180307050046.3892-1-jagan@amarulasolutions.com
State Accepted
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series [U-Boot,v2,1/2] spi: omap3: Skip set_mode, set_speed from claim | expand

Commit Message

Jagan Teki March 7, 2018, 5 a.m. UTC
set_mode, set_seed functions has separate function pointers
in dm_spi_ops, so use them in relevent one instead of
calling from claim_bus.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- None

 drivers/spi/omap3_spi.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Comments

Jagan Teki March 13, 2018, 2:15 p.m. UTC | #1
On Wed, Mar 7, 2018 at 10:30 AM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
> set_mode, set_seed functions has separate function pointers
> in dm_spi_ops, so use them in relevent one instead of
> calling from claim_bus.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---

Applied to u-boot-spi/master
diff mbox series

Patch

diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c
index 1da4542af0..b8a0bf495a 100644
--- a/drivers/spi/omap3_spi.c
+++ b/drivers/spi/omap3_spi.c
@@ -456,9 +456,6 @@  static void _omap3_spi_claim_bus(struct omap3_spi_priv *priv)
 	conf |= OMAP3_MCSPI_MODULCTRL_SINGLE;
 
 	writel(conf, &priv->regs->modulctrl);
-
-	_omap3_spi_set_mode(priv);
-	_omap3_spi_set_speed(priv);
 }
 
 #ifndef CONFIG_DM_SPI
@@ -594,8 +591,6 @@  static int omap3_spi_claim_bus(struct udevice *dev)
 	struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
 
 	priv->cs = slave_plat->cs;
-	priv->mode = slave_plat->mode;
-	priv->freq = slave_plat->max_hz;
 	_omap3_spi_claim_bus(priv);
 
 	return 0;
@@ -652,11 +647,27 @@  static int omap3_spi_xfer(struct udevice *dev, unsigned int bitlen,
 
 static int omap3_spi_set_speed(struct udevice *bus, unsigned int speed)
 {
+	struct udevice *bus = dev->parent;
+	struct omap3_spi_priv *priv = dev_get_priv(bus);
+	struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+
+	priv->cs = slave_plat->cs;
+	priv->freq = slave_plat->max_hz;
+	_omap3_spi_set_speed(priv);
+
 	return 0;
 }
 
 static int omap3_spi_set_mode(struct udevice *bus, uint mode)
 {
+	struct udevice *bus = dev->parent;
+	struct omap3_spi_priv *priv = dev_get_priv(bus);
+	struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+
+	priv->cs = slave_plat->cs;
+	priv->mode = slave_plat->mode;
+	_omap3_spi_set_mode(priv);
+
 	return 0;
 }