linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
To: Bryan Wu <cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Yi Li <yi.li-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 16/16] Blackfin SPI Driver: fix bug - correct usage of struct spi_transfer.cs_change
Date: Thu, 20 Nov 2008 12:51:33 -0800	[thread overview]
Message-ID: <200811201251.33339.david-b@pacbell.net> (raw)
In-Reply-To: <1226994760-4301-17-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

On Monday 17 November 2008, Bryan Wu wrote:
> From: Yi Li <yi.li-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
> 
> According to comments in linux/spi/spi.h:
> 
>  * All SPI transfers start with the relevant chipselect active.  Normally
>  * it stays selected until after the last transfer in a message. Drivers
>  * can affect the chipselect signal using cs_change.
>  *
>  * (i) If the transfer isn't the last one in the message, this flag is
>  * used to make the chipselect briefly go inactive in the middle of the
>  * message.  Toggling chipselect in this way may be needed to terminate
>  * a chip command, letting a single spi_message perform all of group of
>  * chip transactions together.
>  *
>  * (ii) When the transfer is the last one in the message, the chip may
>  * stay selected until the next transfer.  On multi-device SPI busses
>  * with nothing blocking messages going to other devices, this is just
>  * a performance hint; starting a message to another device deselects
>  * this one.  But in other cases, this can be used to ensure correctness.
>  * Some devices need protocol transactions to be built from a series of
>  * spi_message submissions, where the content of one message is determined
>  * by the results of previous messages and where the whole transaction
>  * ends when the chipselect goes intactive.
> 
> Signed-off-by: Yi Li <yi.li-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Bryan Wu <cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Acked-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>

> ---
>  drivers/spi/spi_bfin5xx.c |   15 ++++++++-------
>  1 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
> index 8cf5d6e..0e3102a 100644
> --- a/drivers/spi/spi_bfin5xx.c
> +++ b/drivers/spi/spi_bfin5xx.c
> @@ -540,15 +540,13 @@ static void giveback(struct driver_data *drv_data)
>  
>  	msg->state = NULL;
>  
> -	/* disable chip select signal. And not stop spi in autobuffer mode */
> -	if (drv_data->tx_dma != 0xFFFF) {
> -		cs_deactive(drv_data, chip);
> -		bfin_spi_disable(drv_data);
> -	}
> -
>  	if (!drv_data->cs_change)
>  		cs_deactive(drv_data, chip);
>  
> +	/* Not stop spi in autobuffer mode */
> +	if (drv_data->tx_dma != 0xFFFF)
> +		bfin_spi_disable(drv_data);
> +
>  	if (msg->complete)
>  		msg->complete(msg->context);
>  }
> @@ -757,7 +755,8 @@ static void pump_transfers(unsigned long data)
>  
>  	write_STAT(drv_data, BIT_STAT_CLR);
>  	cr = (read_CTRL(drv_data) & (~BIT_CTL_TIMOD));
> -	cs_active(drv_data, chip);
> +	if (drv_data->cs_change)
> +		cs_active(drv_data, chip);
>  
>  	dev_dbg(&drv_data->pdev->dev,
>  		"now pumping a transfer: width is %d, len is %d\n",
> @@ -920,6 +919,8 @@ static void pump_transfers(unsigned long data)
>  			message->state = next_transfer(drv_data);
>  		}
>  
> +		if (drv_data->cs_change)
> +			cs_active(drv_data, chip);
>  		/* Schedule next transfer tasklet */
>  		tasklet_schedule(&drv_data->pump_transfers);
>  
> -- 
> 1.5.6.3
> 
> 



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

      parent reply	other threads:[~2008-11-20 20:51 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-18  7:52 (no subject) Bryan Wu
     [not found] ` <1226994760-4301-1-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-18  7:52   ` [PATCH 01/16] Blackfin SPI Driver: ensure cache coherency before doing DMA Bryan Wu
     [not found]     ` <1226994760-4301-2-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:24       ` David Brownell
     [not found]         ` <200811201224.15493.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-11-20 20:58           ` Mike Frysinger
     [not found]             ` <8bd0f97a0811201258j14dfcf46vce1655632bb12e2-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-11-20 21:47               ` David Brownell
     [not found]                 ` <200811201347.46355.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-11-20 21:57                   ` Mike Frysinger
     [not found]                     ` <8bd0f97a0811201357g1ffeb7d3pfad6e178fb20050e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-11-20 22:05                       ` David Brownell
     [not found]                         ` <200811201405.06811.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2009-02-05  9:30                           ` Bryan Wu
2009-02-05 23:51                             ` David Brownell
     [not found]                               ` <200902051551.14146.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2009-02-06  2:31                                 ` Bryan Wu
2008-11-18  7:52   ` [PATCH 02/16] Blackfin SPI Driver: Fix erroneous SPI Clock divisor calculation Bryan Wu
     [not found]     ` <1226994760-4301-3-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:25       ` David Brownell
2008-11-18  7:52   ` [PATCH 03/16] Blackfin SPI Driver: move bfin_addr_dcachable() and friends into the cacheflush header where it belongs Bryan Wu
     [not found]     ` <1226994760-4301-4-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:26       ` David Brownell
2008-11-18  7:52   ` [PATCH 04/16] Blackfin SPI Driver: use len_in_bytes when we care about the number of bytes transferred Bryan Wu
     [not found]     ` <1226994760-4301-5-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:25       ` David Brownell
2008-11-18  7:52   ` [PATCH 05/16] Blackfin SPI Driver: pass DMA overflow error to the higher level Bryan Wu
     [not found]     ` <1226994760-4301-6-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:29       ` David Brownell
2008-11-18  7:52   ` [PATCH 06/16] Blackfin SPI Driver: unify duplicated code in dma read/write paths Bryan Wu
     [not found]     ` <1226994760-4301-7-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:32       ` David Brownell
2008-11-18  7:52   ` [PATCH 07/16] Blackfin SPI Driver: drop bogus cast and touchup dma label Bryan Wu
     [not found]     ` <1226994760-4301-8-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:34       ` David Brownell
2008-11-18  7:52   ` [PATCH 08/16] Blackfin SPI Driver: add a few more debug messages in useful places Bryan Wu
     [not found]     ` <1226994760-4301-9-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:35       ` David Brownell
2008-11-18  7:52   ` [PATCH 09/16] Blackfin SPI Driver: do not check for SPI errors if DMA itself did not flag any Bryan Wu
2008-11-18  7:52   ` [PATCH 10/16] Blackfin SPI Driver: use the properl BIT_CTL_xxx defines Bryan Wu
     [not found]     ` <1226994760-4301-11-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:37       ` David Brownell
2008-11-18  7:52   ` [PATCH 11/16] Blackfin SPI Driver: remove duplicated MAX_SPI_SSEL and remove unnecessary array size Bryan Wu
2008-11-18  7:52   ` [PATCH 12/16] Blackfin SPI Driver: get dma working for SPI flashes Bryan Wu
     [not found]     ` <1226994760-4301-13-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:43       ` David Brownell
2008-11-18  7:52   ` [PATCH 13/16] Blackfin SPI Driver: add timeout while waiting for SPIF in dma irq handler Bryan Wu
2008-11-18  7:52   ` [PATCH 14/16] Blackfin SPI Driver: tweak magic spi dma sequence to get it working on BF54x Bryan Wu
2008-11-18  7:52   ` [PATCH 15/16] Blackfin SPI Driver: fix bug - spi controller driver does not assert/deassert CS correctly Bryan Wu
     [not found]     ` <1226994760-4301-16-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:47       ` David Brownell
2008-11-18  7:52   ` [PATCH 16/16] Blackfin SPI Driver: fix bug - correct usage of struct spi_transfer.cs_change Bryan Wu
     [not found]     ` <1226994760-4301-17-git-send-email-cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2008-11-20 20:51       ` David Brownell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200811201251.33339.david-b@pacbell.net \
    --to=david-b-ybekhbn/0ldr7s880joybq@public.gmane.org \
    --cc=cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=yi.li-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).