diff mbox

[U-Boot,1/2] Fix timer usage of the Atmel SPI dataflash driver

Message ID 1296168378-8399-1-git-send-email-linux@bohmer.net
State Superseded
Delegated to: Reinhard Meyer
Headers show

Commit Message

Remy Bohmer Jan. 27, 2011, 10:46 p.m. UTC
Signed-off-by: Remy Bohmer <linux@bohmer.net>
---
 drivers/spi/atmel_dataflash_spi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Comments

Reinhard Meyer April 18, 2011, 10:36 a.m. UTC | #1
Dear Remy Bohmer,
> Signed-off-by: Remy Bohmer <linux@bohmer.net>
> ---
>  drivers/spi/atmel_dataflash_spi.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/spi/atmel_dataflash_spi.c b/drivers/spi/atmel_dataflash_spi.c
> index 4a5c4aa..2f23f54 100644
> --- a/drivers/spi/atmel_dataflash_spi.c
> +++ b/drivers/spi/atmel_dataflash_spi.c
> @@ -133,7 +133,7 @@ unsigned int AT91F_SpiWrite1(AT91PS_DataflashDesc pDesc);
>  
>  unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc)
>  {
> -	unsigned int timeout;
> +	u32 time_start, timeout;
>  
>  	pDesc->state = BUSY;
>  
> @@ -158,12 +158,12 @@ unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc)
>  	}
>  
>  	/* arm simple, non interrupt dependent timer */
> -	reset_timer_masked();
> -	timeout = 0;
> +	time_start = get_timer(0);
>  
>  	writel(AT91_SPI_TXTEN + AT91_SPI_RXTEN, AT91_BASE_SPI + AT91_SPI_PTCR);
>  	while (!(readl(AT91_BASE_SPI + AT91_SPI_SR) & AT91_SPI_RXBUFF) &&
> -		((timeout = get_timer_masked()) < CONFIG_SYS_SPI_WRITE_TOUT));
> +		((timeout = get_timer(time_start)) < CONFIG_SYS_SPI_WRITE_TOUT));
> +
>  	writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, AT91_BASE_SPI + AT91_SPI_PTCR);
>  	pDesc->state = IDLE;

This issue had already been fixed by the ATMEL rework.
 
But you are welcome to further "fix" this driver to use structure SoC access ;)

Best Regards, Reinhard
diff mbox

Patch

diff --git a/drivers/spi/atmel_dataflash_spi.c b/drivers/spi/atmel_dataflash_spi.c
index 4a5c4aa..2f23f54 100644
--- a/drivers/spi/atmel_dataflash_spi.c
+++ b/drivers/spi/atmel_dataflash_spi.c
@@ -133,7 +133,7 @@  unsigned int AT91F_SpiWrite1(AT91PS_DataflashDesc pDesc);
 
 unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc)
 {
-	unsigned int timeout;
+	u32 time_start, timeout;
 
 	pDesc->state = BUSY;
 
@@ -158,12 +158,12 @@  unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc)
 	}
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
-	timeout = 0;
+	time_start = get_timer(0);
 
 	writel(AT91_SPI_TXTEN + AT91_SPI_RXTEN, AT91_BASE_SPI + AT91_SPI_PTCR);
 	while (!(readl(AT91_BASE_SPI + AT91_SPI_SR) & AT91_SPI_RXBUFF) &&
-		((timeout = get_timer_masked()) < CONFIG_SYS_SPI_WRITE_TOUT));
+		((timeout = get_timer(time_start)) < CONFIG_SYS_SPI_WRITE_TOUT));
+
 	writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, AT91_BASE_SPI + AT91_SPI_PTCR);
 	pDesc->state = IDLE;