Skip to contentSkip to conversation

spi: mxc_spi: Fix chipselect with DM_SPI in SPL

PATCH New Bernhard Messerklinger 2 participants 5 messages Sep 3, 2018 – Oct 30, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: mxc_spi: Fix chipselect with DM_SPI in SPL

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.

---

 drivers/spi/mxc_spi.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/spi/mxc_spi.c +16 -12
index 0dccc38b82..bd31e79505 100644
@@ -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;
Signature · 1 line
2.18.0
#1 lore raw

PATCH 1/1 spi: mxc_spi: Fix chipselect with DM_SPI in SPL

Quoted 2 lines · Bernhard Messerklinger

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.

Better enabled it for SPL, did you find any size constraint? if yet try for platdata?

#2 lore raw

[U-Boot] Antwort: Re: [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI in SPL

Hi Jagan,

it's not about any size constraint.
To my understanding the macro CONFIG_IS_ENABLED(DM_SPI) is true if CONFIG_SPL_DM_SPI is defined during SPL build. Please tell me if I am wrong.
At the moment this configuration parameter doesn't exist, so I used a #ifdef
which works with CONFIG_DM_SPI.

Would you prefer to add CONFIG_SPL_DM_SPI as configuration parameter?

Bernhard

Von:    Jagan Teki <[email protected]>
An:     Bernhard Messerklinger <[email protected]>, 

Kopie: U-Boot-Denx <[email protected]>, Jagan Teki <[email protected]>

Datum:  03.09.2018 18:33
Betreff:        Re: [U-Boot] [PATCH] spi: mxc_spi: Fix chipselect with 

DM_SPI in SPL

Quoted 2 lines · Bernhard Messerklinger

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.

Better enabled it for SPL, did you find any size constraint? if yet try for platdata?

#3 lore raw

[U-Boot] Antwort: Re: [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI in SPL

Quoted 3 lines

Von: Bernhard Messerklinger/Eggelsberg/AT/B&R
An: Jagan Teki <[email protected]>,
Kopie: Jagan Teki <[email protected]>, U-Boot-Denx

<[email protected]>

Quoted 9 lines

Datum: 04.09.2018 10:54
Betreff: Antwort: Re: [U-Boot] [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI in SPL

Hi Jagan,

it's not about any size constraint.
To my understanding the macro CONFIG_IS_ENABLED(DM_SPI) is true if CONFIG_SPL_DM_SPI is defined during SPL build. Please tell me if I am

wrong.

Quoted 1 line

At the moment this configuration parameter doesn't exist, so I used a

#ifdef

Quoted 9 lines

which works with CONFIG_DM_SPI.

Would you prefer to add CONFIG_SPL_DM_SPI as configuration parameter?

Bernhard

Von: Jagan Teki <[email protected]>
An: Bernhard Messerklinger <[email protected]>,
Kopie: U-Boot-Denx <[email protected]>, Jagan Teki

<[email protected]>

Quoted 2 lines

Datum: 03.09.2018 18:33
Betreff: Re: [U-Boot] [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI

in SPL

Quoted 5 lines
Quoted 2 lines · Bernhard Messerklinger

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.

Quoted 3 lines

Better enabled it for SPL, did you find any size constraint? if yet try for platdata?

Hi Jagan,

Are there any news?

Regards,
Bernhard

#4 lore raw

PATCH 1/1 spi: mxc_spi: Fix chipselect with DM_SPI in SPL

In reply to Bernhard Messerklinger
Quoted 11 lines · Bernhard Messerklinger

Hi Jagan,

it's not about any size constraint.
To my understanding the macro CONFIG_IS_ENABLED(DM_SPI) is true if CONFIG_SPL_DM_SPI is defined during SPL build. Please tell me if I am wrong.
At the moment this configuration parameter doesn't exist, so I used a #ifdef
which works with CONFIG_DM_SPI.

Quoted 1 line

Would you prefer to add CONFIG_SPL_DM_SPI as configuration parameter?

I think your board config is disabling DM_SPI and DM_GPIO for SPL builds, enable it for SPL as well and try.