linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Sebastian Andrzej Siewior
	<bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Cc: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	sodaville-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
	Dirk Brandewie
	<dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 8/9] spi/pxa2xx: Modify RX-Tresh instead of busy-loop for the remaining RX bytes.
Date: Wed, 29 Dec 2010 01:12:01 -0700	[thread overview]
Message-ID: <20101229081201.GU8172@angua.secretlab.ca> (raw)
In-Reply-To: <1291312057-7933-9-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>

On Thu, Dec 02, 2010 at 06:47:36PM +0100, Sebastian Andrzej Siewior wrote:
> After all TX bytes are sent, the driver spins while the SPI core is busy
> and then it spins for a "short" period of time until RX bytes are
> available.
> On Sodavile the busy flag disappears pretty quick and after that it
> takes approx ~130ms (sometimes less but not much) until there are bytes
> available in the RX FIFO.
> This patch removes the busy loop and modifies the RX threshould so we
> get woken up once the remainings bytes arrived.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
> Signed-off-by: Dirk Brandewie <dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

picked up for -next via merge

g.

> ---
>  drivers/spi/pxa2xx_spi.c |   56 ++++++++++++++++++++++++++++++++--------------
>  1 files changed, 39 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
> index a54685b..9ca6454 100644
> --- a/drivers/spi/pxa2xx_spi.c
> +++ b/drivers/spi/pxa2xx_spi.c
> @@ -660,13 +660,25 @@ static irqreturn_t dma_transfer(struct driver_data *drv_data)
>  	return IRQ_NONE;
>  }
>  
> +static void reset_sccr1(struct driver_data *drv_data)
> +{
> +	void __iomem *reg = drv_data->ioaddr;
> +	struct chip_data *chip = drv_data->cur_chip;
> +	u32 sccr1_reg;
> +
> +	sccr1_reg = read_SSCR1(reg) & ~drv_data->int_cr1;
> +	sccr1_reg &= ~SSCR1_RFT;
> +	sccr1_reg |= chip->threshold;
> +	write_SSCR1(sccr1_reg, reg);
> +}
> +
>  static void int_error_stop(struct driver_data *drv_data, const char* msg)
>  {
>  	void __iomem *reg = drv_data->ioaddr;
>  
>  	/* Stop and reset SSP */
>  	write_SSSR_CS(drv_data, drv_data->clear_sr);
> -	write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg);
> +	reset_sccr1(drv_data);
>  	if (!pxa25x_ssp_comp(drv_data))
>  		write_SSTO(0, reg);
>  	flush(drv_data);
> @@ -684,7 +696,7 @@ static void int_transfer_complete(struct driver_data *drv_data)
>  
>  	/* Stop SSP */
>  	write_SSSR_CS(drv_data, drv_data->clear_sr);
> -	write_SSCR1(read_SSCR1(reg) & ~drv_data->int_cr1, reg);
> +	reset_sccr1(drv_data);
>  	if (!pxa25x_ssp_comp(drv_data))
>  		write_SSTO(0, reg);
>  
> @@ -739,24 +751,34 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)
>  	}
>  
>  	if (drv_data->tx == drv_data->tx_end) {
> -		write_SSCR1(read_SSCR1(reg) & ~SSCR1_TIE, reg);
> -		/* PXA25x_SSP has no timeout, read trailing bytes */
> +		u32 bytes_left;
> +		u32 sccr1_reg;
> +
> +		sccr1_reg = read_SSCR1(reg);
> +		sccr1_reg &= ~SSCR1_TIE;
> +
> +		/*
> +		 * PXA25x_SSP has no timeout, set up rx threshould for the
> +		 * remaing RX bytes.
> +		 */
>  		if (pxa25x_ssp_comp(drv_data)) {
> -			if (!wait_ssp_rx_stall(reg))
> -			{
> -				int_error_stop(drv_data, "interrupt_transfer: "
> -						"rx stall failed");
> -				return IRQ_HANDLED;
> -			}
> -			if (!drv_data->read(drv_data))
> -			{
> -				int_error_stop(drv_data,
> -						"interrupt_transfer: "
> -						"trailing byte read failed");
> -				return IRQ_HANDLED;
> +
> +			sccr1_reg &= ~SSCR1_RFT;
> +
> +			bytes_left = drv_data->rx_end - drv_data->rx;
> +			switch (drv_data->n_bytes) {
> +			case 4:
> +				bytes_left >>= 1;
> +			case 2:
> +				bytes_left >>= 1;
>  			}
> -			int_transfer_complete(drv_data);
> +
> +			if (bytes_left > RX_THRESH_DFLT)
> +				bytes_left = RX_THRESH_DFLT;
> +
> +			sccr1_reg |= SSCR1_RxTresh(bytes_left);
>  		}
> +		write_SSCR1(sccr1_reg, reg);
>  	}
>  
>  	/* We did something */
> -- 
> 1.7.3.2
> 

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl

  parent reply	other threads:[~2010-12-29  8:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-02 17:47 SPI support for CE4100, v2 Sebastian Andrzej Siewior
     [not found] ` <1291312057-7933-1-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-12-02 17:47   ` [PATCH 1/9] spi/pxa2xx: register driver properly Sebastian Andrzej Siewior
     [not found]     ` <1291312057-7933-2-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-12-29  8:11       ` Grant Likely
2010-12-29 17:00         ` David Brownell
2010-12-29 21:26           ` Sebastian Andrzej Siewior
     [not found]             ` <20101229212635.GA31347-Hfxr4Dq0UpYb1SvskN2V4Q@public.gmane.org>
2010-12-29 21:40               ` Grant Likely
     [not found]                 ` <20101229214054.GB15198-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-12-30  1:55                   ` David Brownell
     [not found]           ` <349566.41372.qm-g47maUHHHF+ORdMXk8NaZPu2YVrzzGjVVpNB7YpNyf8@public.gmane.org>
2010-12-29 21:36             ` Grant Likely
2010-12-02 17:47   ` [PATCH 2/9] spi/pxa2xx: add support for shared IRQ handler Sebastian Andrzej Siewior
     [not found]     ` <1291312057-7933-3-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-12-29  8:11       ` Grant Likely
2010-12-02 17:47   ` [PATCH 3/9] spi/pxa2xx: Use define for SSSR_TFL_MASK instead of plain numbers Sebastian Andrzej Siewior
     [not found]     ` <1291312057-7933-4-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-12-29  8:11       ` Grant Likely
2010-12-02 17:47   ` [PATCH 4/9] arm/pxa2xx: reorgazine SSP and SPI header files Sebastian Andrzej Siewior
     [not found]     ` <1291312057-7933-5-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-12-29  8:11       ` Grant Likely
2010-12-02 17:47   ` [PATCH 5/9] spi/pxa2xx: Add CE4100 support Sebastian Andrzej Siewior
     [not found]     ` <1291312057-7933-6-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-12-29  8:11       ` Grant Likely
2010-12-02 17:47   ` [PATCH 6/9] spi/pxa2xx: Consider CE4100's FIFO depth Sebastian Andrzej Siewior
     [not found]     ` <1291312057-7933-7-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-12-29  8:11       ` Grant Likely
2010-12-02 17:47   ` [PATCH 7/9] spi/pxa2xx: Add chipselect support for Sodaville Sebastian Andrzej Siewior
     [not found]     ` <1291312057-7933-8-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-12-29  8:11       ` Grant Likely
2010-12-02 17:47   ` [PATCH 8/9] spi/pxa2xx: Modify RX-Tresh instead of busy-loop for the remaining RX bytes Sebastian Andrzej Siewior
     [not found]     ` <1291312057-7933-9-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-12-29  8:12       ` Grant Likely [this message]
2010-12-02 17:47   ` [PATCH 9/9] spi/pxa2xx: pass of_node to spi device and set a parent device Sebastian Andrzej Siewior
     [not found]     ` <1291312057-7933-10-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-12-29  8:11       ` Grant Likely
2010-12-09 16:43   ` [sodaville] SPI support for CE4100, v2 Sebastian Andrzej Siewior
     [not found]     ` <4D01074A.2020106-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-12-29  8:10       ` Grant Likely
  -- strict thread matches above, loose matches on Subject: below --
2010-11-24 11:13 SPI support for Sodaville Sebastian Andrzej Siewior
     [not found] ` <1290597207-29838-1-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-11-24 11:13   ` [PATCH 8/9] spi/pxa2xx: Modify RX-Tresh instead of busy-loop for the remaining RX bytes Sebastian Andrzej Siewior

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=20101229081201.GU8172@angua.secretlab.ca \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=sodaville-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@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).