All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI in SPL
@ 2018-09-03 10:32 Bernhard Messerklinger
  2018-09-03 16:33 ` Jagan Teki
  0 siblings, 1 reply; 5+ messages in thread
From: Bernhard Messerklinger @ 2018-09-03 10:32 UTC (permalink / raw)
  To: u-boot

Since CONFIG_IS_ENABLED(DM_SPI) is not working in SPL because
CONFIG_SPL_DM_SPI is not defined we should go with #ifdef CONFIG_DM_SPI.

Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
---

 drivers/spi/mxc_spi.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index 0dccc38b82..bd31e79505 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -57,26 +57,30 @@ static inline struct mxc_spi_slave *to_mxc_spi_slave(struct spi_slave *slave)
 	return container_of(slave, struct mxc_spi_slave, slave);
 }
 
+#ifdef CONFIG_DM_SPI
 static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs)
 {
-	if (CONFIG_IS_ENABLED(DM_SPI)) {
-		dm_gpio_set_value(&mxcs->ss, 1);
-	} else {
-		if (mxcs->gpio > 0)
-			gpio_set_value(mxcs->gpio, mxcs->ss_pol);
-	}
+	dm_gpio_set_value(&mxcs->ss, 1);
 }
 
 static void mxc_spi_cs_deactivate(struct mxc_spi_slave *mxcs)
 {
-	if (CONFIG_IS_ENABLED(DM_SPI)) {
-		dm_gpio_set_value(&mxcs->ss, 0);
-	} else {
-		if (mxcs->gpio > 0)
-			gpio_set_value(mxcs->gpio, !(mxcs->ss_pol));
-	}
+	dm_gpio_set_value(&mxcs->ss, 0);
+}
+#else
+static void mxc_spi_cs_activate(struct mxc_spi_slave *mxcs)
+{
+	if (mxcs->gpio > 0)
+		gpio_set_value(mxcs->gpio, mxcs->ss_pol);
 }
 
+static void mxc_spi_cs_deactivate(struct mxc_spi_slave *mxcs)
+{
+	if (mxcs->gpio > 0)
+		gpio_set_value(mxcs->gpio, !(mxcs->ss_pol));
+}
+#endif
+
 u32 get_cspi_div(u32 div)
 {
 	int i;
-- 
2.18.0

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

end of thread, other threads:[~2018-10-30 13:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-03 10:32 [U-Boot] [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI in SPL Bernhard Messerklinger
2018-09-03 16:33 ` Jagan Teki
2018-09-04  8:54   ` [U-Boot] Antwort: " Bernhard Messerklinger
2018-10-30 13:21     ` Bernhard Messerklinger
2018-10-30 13:28     ` [U-Boot] " Jagan Teki

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.