From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernhard Messerklinger Date: Mon, 3 Sep 2018 12:32:01 +0200 Subject: [U-Boot] [PATCH] spi: mxc_spi: Fix chipselect with DM_SPI in SPL Message-ID: <20180903103202.9819-1-bernhard.messerklinger@br-automation.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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