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

* [U-Boot] [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI in SPL
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Jagan Teki @ 2018-09-03 16:33 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 3, 2018 at 4:02 PM, Bernhard Messerklinger
<bernhard.messerklinger@br-automation.com> wrote:
> 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?

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

* [U-Boot] Antwort: Re: [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI in SPL
  2018-09-03 16:33 ` Jagan Teki
@ 2018-09-04  8:54   ` Bernhard Messerklinger
  2018-10-30 13:21     ` Bernhard Messerklinger
  2018-10-30 13:28     ` [U-Boot] " Jagan Teki
  0 siblings, 2 replies; 5+ messages in thread
From: Bernhard Messerklinger @ 2018-09-04  8:54 UTC (permalink / raw)
  To: u-boot

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 <jagan@amarulasolutions.com>
An:     Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>, 

Kopie:  U-Boot-Denx <u-boot@lists.denx.de>, Jagan Teki 
<jagan@openedev.com>
Datum:  03.09.2018 18:33
Betreff:        Re: [U-Boot] [PATCH] spi: mxc_spi: Fix chipselect with 
DM_SPI in SPL



On Mon, Sep 3, 2018 at 4:02 PM, Bernhard Messerklinger
<bernhard.messerklinger@br-automation.com> wrote:
> 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?

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

* [U-Boot] Antwort: Re: [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI in SPL
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Bernhard Messerklinger @ 2018-10-30 13:21 UTC (permalink / raw)
  To: u-boot

> Von: Bernhard Messerklinger/Eggelsberg/AT/B&R
> An: Jagan Teki <jagan@amarulasolutions.com>, 
> Kopie: Jagan Teki <jagan@openedev.com>, U-Boot-Denx 
<u-boot@lists.denx.de>
> 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.
> 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 <jagan@amarulasolutions.com>
> An: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>, 
> Kopie: U-Boot-Denx <u-boot@lists.denx.de>, Jagan Teki 
<jagan@openedev.com>
> Datum: 03.09.2018 18:33
> Betreff: Re: [U-Boot] [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI 
in SPL
> 
> On Mon, Sep 3, 2018 at 4:02 PM, Bernhard Messerklinger
> <bernhard.messerklinger@br-automation.com> wrote:
> > 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?

Hi Jagan,

Are there any news?

Regards,
Bernhard

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

* [U-Boot] [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI in SPL
  2018-09-04  8:54   ` [U-Boot] Antwort: " Bernhard Messerklinger
  2018-10-30 13:21     ` Bernhard Messerklinger
@ 2018-10-30 13:28     ` Jagan Teki
  1 sibling, 0 replies; 5+ messages in thread
From: Jagan Teki @ 2018-10-30 13:28 UTC (permalink / raw)
  To: u-boot

On Tue, Sep 4, 2018 at 2:24 PM Bernhard Messerklinger
<bernhard.messerklinger@br-automation.com> wrote:
>
> 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?

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

^ permalink raw reply	[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.