Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1333691

Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels CHCONF_FORCE in prepare_message

From Michael Welling <mwelling@ieee.org>
Newsgroups linux.kernel
Subject Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels CHCONF_FORCE in prepare_message
Date 2016-02-15 00:00 +0100
Message-ID <r2dO3-Ir-41@gated-at.bofh.it> (permalink)
References <r2duF-zw-3@gated-at.bofh.it> <r2duI-zw-73@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Feb 14, 2016 at 02:20:48PM -0800, Greg Kroah-Hartman wrote:
> 4.3-stable review patch.  If anyone has any objections, please let me know.
>

If not planned it should be considered that we include the latest two
commits to spi-omap2-mcpsi into stable as well.

spi: omap2-mcspi: Prevent duplicate gpio_request
spi: omap2-mcspi: Add calls for pinctrl state select 

Let me know if I need to do anything to make this happen.

> ------------------
> 
> From: Neil Armstrong <narmstrong@baylibre.com>
> 
> commit 468a32082b04c7febccfcd55b06ecbc438fcddcc upstream.
> 
> Since the "Switch driver to use transfer_one" change, the cs_change
> behavior has changed and a channel chip select can still be
> asserted when changing channel from a previous last transfer in a
> message having the cs_change attribute.
> 
> Since there is no sense having multiple chip select being asserted at the
> same time, disable all the remaining forced chip selects in a the
> prepare_message called right before a spi_transfer_one_message call.
> It ignores the current channel configuration in order to keep the
> possibility to leave the chip select asserted between messages.
> 
> It fixes this bug on a DM8168 SoC ES2.1 Soc and an OMAP4 ES2.1 SoC.
> It was hanging all the other channels transfers when a CHCONF_FORCE
> is present on the wrong channel.
> 
> Fixes: b28cb9414db9 ("spi: omap2-mcspi: Switch driver to use transfer_one")
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Reviewed-by: Michael Welling <mwelling@ieee.org>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> ---
>  drivers/spi/spi-omap2-mcspi.c |   28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> --- a/drivers/spi/spi-omap2-mcspi.c
> +++ b/drivers/spi/spi-omap2-mcspi.c
> @@ -1217,6 +1217,33 @@ out:
>  	return status;
>  }
>  
> +static int omap2_mcspi_prepare_message(struct spi_master *master,
> +				       struct spi_message *msg)
> +{
> +	struct omap2_mcspi	*mcspi = spi_master_get_devdata(master);
> +	struct omap2_mcspi_regs	*ctx = &mcspi->ctx;
> +	struct omap2_mcspi_cs	*cs;
> +
> +	/* Only a single channel can have the FORCE bit enabled
> +	 * in its chconf0 register.
> +	 * Scan all channels and disable them except the current one.
> +	 * A FORCE can remain from a last transfer having cs_change enabled
> +	 */
> +	list_for_each_entry(cs, &ctx->cs, node) {
> +		if (msg->spi->controller_state == cs)
> +			continue;
> +
> +		if ((cs->chconf0 & OMAP2_MCSPI_CHCONF_FORCE)) {
> +			cs->chconf0 &= ~OMAP2_MCSPI_CHCONF_FORCE;
> +			writel_relaxed(cs->chconf0,
> +					cs->base + OMAP2_MCSPI_CHCONF0);
> +			readl_relaxed(cs->base + OMAP2_MCSPI_CHCONF0);
> +		}
> +	}
> +
> +	return 0;
> +}
> +
>  static int omap2_mcspi_transfer_one(struct spi_master *master,
>  		struct spi_device *spi, struct spi_transfer *t)
>  {
> @@ -1344,6 +1371,7 @@ static int omap2_mcspi_probe(struct plat
>  	master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
>  	master->setup = omap2_mcspi_setup;
>  	master->auto_runtime_pm = true;
> +	master->prepare_message = omap2_mcspi_prepare_message;
>  	master->transfer_one = omap2_mcspi_transfer_one;
>  	master->set_cs = omap2_mcspi_set_cs;
>  	master->cleanup = omap2_mcspi_cleanup;
> 
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels CHCONF_FORCE in prepare_message Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-02-14 23:40 +0100
  Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels  CHCONF_FORCE in prepare_message Michael Welling <mwelling@ieee.org> - 2016-02-15 00:00 +0100
    Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels  CHCONF_FORCE in prepare_message Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-02-15 01:30 +0100
      Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels  CHCONF_FORCE in prepare_message Michael Welling <mwelling@ieee.org> - 2016-02-15 04:10 +0100
        Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels  CHCONF_FORCE in prepare_message Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-02-15 19:20 +0100
          Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels  CHCONF_FORCE in prepare_message Michael Welling <mwelling@ieee.org> - 2016-02-15 20:00 +0100
            Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels  CHCONF_FORCE in prepare_message Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-02-15 20:40 +0100
              Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels  CHCONF_FORCE in prepare_message Michael Welling <mwelling@ieee.org> - 2016-02-15 21:10 +0100
    Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels  CHCONF_FORCE in prepare_message Mark Brown <broonie@kernel.org> - 2016-02-15 12:10 +0100
      Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels  CHCONF_FORCE in prepare_message Michael Welling <mwelling@ieee.org> - 2016-02-15 16:30 +0100
        Re: [PATCH 4.3 041/200] spi: omap2-mcspi: disable other channels  CHCONF_FORCE in prepare_message Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-02-15 19:20 +0100

csiph-web