mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-20 22:21:41 +00:00
Timer: Fix at91rm9200/spi.c timer usage
This commit is contained in:
parent
4769be21cc
commit
53fc43c682
1 changed files with 3 additions and 2 deletions
|
@ -108,6 +108,7 @@ void AT91F_SpiEnable(int cs)
|
||||||
unsigned int AT91F_SpiWrite ( AT91PS_DataflashDesc pDesc )
|
unsigned int AT91F_SpiWrite ( AT91PS_DataflashDesc pDesc )
|
||||||
{
|
{
|
||||||
unsigned int timeout;
|
unsigned int timeout;
|
||||||
|
unsigned long start;
|
||||||
|
|
||||||
pDesc->state = BUSY;
|
pDesc->state = BUSY;
|
||||||
|
|
||||||
|
@ -132,12 +133,12 @@ unsigned int AT91F_SpiWrite ( AT91PS_DataflashDesc pDesc )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* arm simple, non interrupt dependent timer */
|
/* arm simple, non interrupt dependent timer */
|
||||||
reset_timer_masked();
|
start = get_timer(0);
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
|
|
||||||
AT91C_BASE_SPI->SPI_PTCR = AT91C_PDC_TXTEN + AT91C_PDC_RXTEN;
|
AT91C_BASE_SPI->SPI_PTCR = AT91C_PDC_TXTEN + AT91C_PDC_RXTEN;
|
||||||
while(!(AT91C_BASE_SPI->SPI_SR & AT91C_SPI_RXBUFF) &&
|
while(!(AT91C_BASE_SPI->SPI_SR & AT91C_SPI_RXBUFF) &&
|
||||||
((timeout = get_timer_masked() ) < CONFIG_SYS_SPI_WRITE_TOUT));
|
((timeout = get_timer(start) ) < CONFIG_SYS_SPI_WRITE_TOUT));
|
||||||
AT91C_BASE_SPI->SPI_PTCR = AT91C_PDC_TXTDIS + AT91C_PDC_RXTDIS;
|
AT91C_BASE_SPI->SPI_PTCR = AT91C_PDC_TXTDIS + AT91C_PDC_RXTDIS;
|
||||||
pDesc->state = IDLE;
|
pDesc->state = IDLE;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue