All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] spi: omap3: pre-initialize bus-speed with max. slave-speed
@ 2018-06-02  6:06 Hannes Schmelzer
  2018-06-02  6:06 ` [U-Boot] [PATCH 2/2] spi: omap3: fix set_speed and set_mode dm callbacks Hannes Schmelzer
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Schmelzer @ 2018-06-02  6:06 UTC (permalink / raw)
  To: u-boot

Otherwise the frequency is zero and the clock divider cannot be setup by
'omap3_spi_set_speed' function.

Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
---

 drivers/spi/omap3_spi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c
index 4169abd..a149abe 100644
--- a/drivers/spi/omap3_spi.c
+++ b/drivers/spi/omap3_spi.c
@@ -590,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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH 2/2] spi: omap3: fix set_speed and set_mode dm callbacks
  2018-06-02  6:06 [U-Boot] [PATCH 1/2] spi: omap3: pre-initialize bus-speed with max. slave-speed Hannes Schmelzer
@ 2018-06-02  6:06 ` Hannes Schmelzer
  0 siblings, 0 replies; 2+ messages in thread
From: Hannes Schmelzer @ 2018-06-02  6:06 UTC (permalink / raw)
  To: u-boot

commit 84807922874e03895bbf15c4472a2dcee8fbbd03
("spi: omap3: Skip set_mode, set_speed from claim") did break SPI
support on my AM335x board.

The named commit:

- ignored the responsible arguments (speed, mode)
The set speed/mode function must use the supplied function arguments to
work properly. With this commit we take those arguments and transfer
them to the priv-data.

- used wrong udevice pointer for getting priv data
the udevice-pointer within function argument is already the spi-bus
device, so it is wrong looking here for some parent (ocp-bus in this
case) and getting priv-pointer from there.

Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>

---

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

diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c
index a149abe..766436e 100644
--- a/drivers/spi/omap3_spi.c
+++ b/drivers/spi/omap3_spi.c
@@ -650,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;
@@ -663,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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-02  6:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-02  6:06 [U-Boot] [PATCH 1/2] spi: omap3: pre-initialize bus-speed with max. slave-speed Hannes Schmelzer
2018-06-02  6:06 ` [U-Boot] [PATCH 2/2] spi: omap3: fix set_speed and set_mode dm callbacks Hannes Schmelzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.