Message ID | 20180903103202.9819-1-bernhard.messerklinger@br-automation.com |
---|---|
State | Changes Requested |
Delegated to: | Stefano Babic |
Headers | show |
Series | [U-Boot] spi: mxc_spi: Fix chipselect with DM_SPI in SPL | expand |
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, 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?
> 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
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.
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;
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(-)