]> git.sur5r.net Git - u-boot/blobdiff - drivers/spi/omap3_spi.c
spi: omap3: fix set_speed and set_mode dm callbacks
[u-boot] / drivers / spi / omap3_spi.c
index 1ac691a68e7a2404dcaa7a6c2cbbda68bf3dd30f..766436ea5f9845bd3be4b5186df1d93c6ba0a5a2 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2016 Jagan Teki <jteki@openedev.com>
  *                   Christophe Ricard <christophe.ricard@gmail.com>
@@ -13,8 +14,6 @@
  * Copyright (C) 2005, 2006 Nokia Corporation
  *
  * Modified by Ruslan Araslanov <ruslan.araslanov@vitecmm.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -591,6 +590,8 @@ 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->freq = slave_plat->max_hz;
+
        _omap3_spi_claim_bus(priv);
 
        return 0;
@@ -649,12 +650,10 @@ static int omap3_spi_xfer(struct udevice *dev, unsigned int bitlen,
 
 static int omap3_spi_set_speed(struct udevice *dev, 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;
+       struct omap3_spi_priv *priv = dev_get_priv(dev);
+
+       priv->freq = speed;
        _omap3_spi_set_speed(priv);
 
        return 0;
@@ -662,12 +661,10 @@ static int omap3_spi_set_speed(struct udevice *dev, unsigned int speed)
 
 static int omap3_spi_set_mode(struct udevice *dev, 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);
+       struct omap3_spi_priv *priv = dev_get_priv(dev);
+
+       priv->mode = mode;
 
-       priv->cs = slave_plat->cs;
-       priv->mode = slave_plat->mode;
        _omap3_spi_set_mode(priv);
 
        return 0;