[U-Boot] [PATCH v1 (WIP) 02/16] [Timer]Remove calls to set_timer outside arch/

2011-06-28 Thread Graeme Russ
There is no need to use set_timer(). Replace with appropriate use of
get_timer()

Signed-off-by: Graeme Russ 

---
 board/BuS/EB+MCF-EV123/flash.c |   10 ++
 board/cobra5272/flash.c|   10 ++
 board/idmr/flash.c |   10 ++
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/board/BuS/EB+MCF-EV123/flash.c b/board/BuS/EB+MCF-EV123/flash.c
index 3c36367..8b7f957 100644
--- a/board/BuS/EB+MCF-EV123/flash.c
+++ b/board/BuS/EB+MCF-EV123/flash.c
@@ -157,6 +157,7 @@ int amd_flash_erase_sector(flash_info_t * info, int sector)
 {
int state;
ulong result;
+   ulong start;

volatile u16 *addr =
(volatile u16 *) (info->start[sector]);
@@ -171,13 +172,13 @@ int amd_flash_erase_sector(flash_info_t * info, int 
sector)

/* wait until flash is ready */
state = 0;
-   set_timer (0);
+   start = get_timer(0);

do {
result = *addr;

/* check timeout */
-   if (get_timer (0) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+   if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
state = ERR_TIMOUT;
}
@@ -267,6 +268,7 @@ volatile static int amd_write_word (flash_info_t * info, 
ulong dest, u16 data)
ulong result;
int cflag, iflag;
int state;
+   ulong start;

/*
 * Check if Flash is (sufficiently) erased
@@ -295,7 +297,7 @@ volatile static int amd_write_word (flash_info_t * info, 
ulong dest, u16 data)
*addr = data;

/* arm simple, non interrupt dependent timer */
-   set_timer (0);
+   start = get_timer(0);

/* wait until flash is ready */
state = 0;
@@ -303,7 +305,7 @@ volatile static int amd_write_word (flash_info_t * info, 
ulong dest, u16 data)
result = *addr;

/* check timeout */
-   if (get_timer (0) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+   if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
state = ERR_TIMOUT;
}
if (!state && ((result & BIT_RDY_MASK) == (data & 
BIT_RDY_MASK)))
diff --git a/board/cobra5272/flash.c b/board/cobra5272/flash.c
index 33c9361..e8f02eb 100644
--- a/board/cobra5272/flash.c
+++ b/board/cobra5272/flash.c
@@ -147,6 +147,7 @@ int flash_erase (flash_info_t * info, int s_first, int 
s_last)
int iflag, cflag, prot, sect;
int rc = ERR_OK;
int chip1;
+   ulong start;

/* first look for protection bits */

@@ -190,7 +191,7 @@ int flash_erase (flash_info_t * info, int s_first, int 
s_last)
printf ("Erasing sector %2d ... ", sect);

/* arm simple, non interrupt dependent timer */
-   set_timer (0);
+   start = get_timer(0);

if (info->protect[sect] == 0) { /* not protected */
volatile u16 *addr =
@@ -211,7 +212,7 @@ int flash_erase (flash_info_t * info, int s_first, int 
s_last)
result = *addr;

/* check timeout */
-   if (get_timer (0) > 
CONFIG_SYS_FLASH_ERASE_TOUT) {
+   if (get_timer(start) > 
CONFIG_SYS_FLASH_ERASE_TOUT) {
MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
chip1 = TMO;
break;
@@ -264,6 +265,7 @@ static int write_word (flash_info_t * info, ulong dest, 
ulong data)
int rc = ERR_OK;
int cflag, iflag;
int chip1;
+   ulong start;

/*
 * Check if Flash is (sufficiently) erased
@@ -291,7 +293,7 @@ static int write_word (flash_info_t * info, ulong dest, 
ulong data)
*addr = data;

/* arm simple, non interrupt dependent timer */
-   set_timer (0);
+   start = get_timer(0);

/* wait until flash is ready */
chip1 = 0;
@@ -299,7 +301,7 @@ static int write_word (flash_info_t * info, ulong dest, 
ulong data)
result = *addr;

/* check timeout */
-   if (get_timer (0) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+   if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
chip1 = ERR | TMO;
break;
}
diff --git a/board/idmr/flash.c b/board/idmr/flash.c
index 57c9948..9f4ff2b 100644
--- a/board/idmr/flash.c
+++ b/board/idmr/flash.c
@@ -130,6 +130,7 @@ int flash_erase (flash_info_t * info, int s_first, int 
s_last)
int iflag, prot, sect;
int rc = ERR_OK;
int chip1;
+   ulong start;

/* first look for protection bits */

@@ -170,7 +171,7 @@ int flash_erase (flash_info_t * info, int s_first, int 
s_last)
printf ("Erasing sector %2d ... ", se

[U-Boot] [PATCH v1 (WIP) 13/16] [Timer]Replace get_timer() usage in net/

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ 
---
 net/bootp.c |6 +++---
 net/net.c   |   18 +++---
 net/sntp.c  |2 +-
 net/tftp.c  |4 ++--
 4 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/net/bootp.c b/net/bootp.c
index 4db63cb..8c9560d 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -637,7 +637,7 @@ BootpRequest (void)
bp->bp_htype = HWT_ETHER;
bp->bp_hlen = HWL_ETHER;
bp->bp_hops = 0;
-   bp->bp_secs = htons(get_timer(0) / 1000);
+   bp->bp_secs = htons(time_ms_now() / 1000);
NetWriteIP(&bp->bp_ciaddr, 0);
NetWriteIP(&bp->bp_yiaddr, 0);
NetWriteIP(&bp->bp_siaddr, 0);
@@ -660,7 +660,7 @@ BootpRequest (void)
| ((ulong)NetOurEther[3] << 16)
| ((ulong)NetOurEther[4] << 8)
| (ulong)NetOurEther[5];
-   BootpID += get_timer(0);
+   BootpID += time_now_ms();
BootpID  = htonl(BootpID);
NetCopyLong(&bp->bp_id, &BootpID);
 
@@ -819,7 +819,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
bp->bp_htype = HWT_ETHER;
bp->bp_hlen = HWL_ETHER;
bp->bp_hops = 0;
-   bp->bp_secs = htons(get_timer(0) / 1000);
+   bp->bp_secs = htons(time_ms_now() / 1000);
/* Do not set the client IP, your IP, or server IP yet, since it hasn't 
been ACK'ed by
 * the server yet */
 
diff --git a/net/net.c b/net/net.c
index 7a60583..b574481 100644
--- a/net/net.c
+++ b/net/net.c
@@ -290,15 +290,11 @@ void ArpRequest(void)
 
 void ArpTimeoutCheck(void)
 {
-   ulong t;
-
if (!NetArpWaitPacketIP)
return;
 
-   t = get_timer(0);
-
/* check for arp timeout */
-   if ((t - NetArpWaitTimerStart) > ARP_TIMEOUT) {
+   if (time_since_ms(NetArpWaitTimerStart) > ARP_TIMEOUT) {
NetArpWaitTry++;
 
if (NetArpWaitTry >= ARP_TIMEOUT_COUNT) {
@@ -306,7 +302,7 @@ void ArpTimeoutCheck(void)
NetArpWaitTry = 0;
NetStartAgain();
} else {
-   NetArpWaitTimerStart = t;
+   NetArpWaitTimerStart = time_now_ms();
ArpRequest();
}
}
@@ -535,7 +531,7 @@ restart:
 *  Check for a timeout, and run the timeout handler
 *  if we have one.
 */
-   if (timeHandler && ((get_timer(0) - timeStart) > timeDelta)) {
+   if (timeHandler && (time_since_ms(timeStart) > timeDelta)) {
thand_f *x;
 
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
@@ -672,7 +668,7 @@ NetSetTimeout(ulong iv, thand_f *f)
timeHandler = (thand_f *)0;
} else {
timeHandler = f;
-   timeStart = get_timer(0);
+   timeStart = time_now_ms();
timeDelta = iv;
}
 }
@@ -721,7 +717,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, 
int sport, int len)
 
/* and do the ARP request */
NetArpWaitTry = 1;
-   NetArpWaitTimerStart = get_timer(0);
+   NetArpWaitTimerStart = time_now_ms();
ArpRequest();
return 1;   /* waiting */
}
@@ -792,7 +788,7 @@ int PingSend(void)
 
/* and do the ARP request */
NetArpWaitTry = 1;
-   NetArpWaitTimerStart = get_timer(0);
+   NetArpWaitTimerStart = time_now_ms();
ArpRequest();
return 1;   /* waiting */
 }
@@ -1960,7 +1956,7 @@ void copy_filename(char *dst, const char *src, int size)
  */
 unsigned int random_port(void)
 {
-   return 1024 + (get_timer(0) % 0x4000);
+   return 1024 + (time_now_ms() % 0x4000);
 }
 #endif
 
diff --git a/net/sntp.c b/net/sntp.c
index 82f2fe6..5bd2425 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -33,7 +33,7 @@ SntpSend (void)
 
memcpy ((char *)NetTxPacket + NetEthHdrSize() + IP_HDR_SIZE, (char 
*)&pkt, pktlen);
 
-   SntpOurPort = 1 + (get_timer(0) % 4096);
+   SntpOurPort = 1 + (time_now_ms() % 4096);
sport = NTP_SERVICE_PORT;
 
NetSendUDPPacket (NetServerEther, NetNtpServerIP, sport, SntpOurPort, 
pktlen);
diff --git a/net/tftp.c b/net/tftp.c
index a893e02..52a5ddc 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -338,7 +338,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, 
unsigned src,
debug("Got WRQ\n");
TftpRemoteIP = sip;
TftpRemotePort = src;
-   TftpOurPort = 1024 + (get_timer(0) % 3072);
+   TftpOurPort = 1024 + (time_ms_now() % 3072);
TftpLastBlock = 0;
TftpBlockWrap = 0;
TftpBlockWrapOffset = 0;
@@ -654,7 +654,7 @@ TftpStart(void)
TftpTimeoutCount = 0;
TftpState = STATE_SEND_RRQ;
/* Use a pseudo-random port unless a specific port is set */
-   TftpOurPort = 1024 + (get_timer(0) % 3072);
+  

[U-Boot] [PATCH v1 (WIP) 16/16] [Timer]Replace get_timer() usage in arch/

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ 
---
 arch/blackfin/cpu/jtag-console.c   |4 ++--
 arch/microblaze/lib/time.c |4 ++--
 arch/nios2/cpu/epcs.c  |   12 ++--
 arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c |8 
 arch/powerpc/cpu/mpc8260/ether_fcc.c   |   12 ++--
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/arch/blackfin/cpu/jtag-console.c b/arch/blackfin/cpu/jtag-console.c
index e0f2975..97ff1de 100644
--- a/arch/blackfin/cpu/jtag-console.c
+++ b/arch/blackfin/cpu/jtag-console.c
@@ -48,11 +48,11 @@ static inline uint32_t bfin_read_emudat(void)
 static bool jtag_write_emudat(uint32_t emudat)
 {
static bool overflowed = false;
-   ulong timeout = get_timer(0) + CONFIG_JTAG_CONSOLE_TIMEOUT;
+   ulong start = time_now_ms();
while (bfin_read_DBGSTAT() & 0x1) {
if (overflowed)
return overflowed;
-   if (timeout < get_timer(0))
+   if (time_since_ms(start) >= CONFIG_JTAG_CONSOLE_TIMEOUT)
overflowed = true;
}
overflowed = false;
diff --git a/arch/microblaze/lib/time.c b/arch/microblaze/lib/time.c
index da016a0..e5ed3bf 100644
--- a/arch/microblaze/lib/time.c
+++ b/arch/microblaze/lib/time.c
@@ -30,8 +30,8 @@
 void __udelay (unsigned long usec)
 {
int i;
-   i = get_timer (0);
-   while ((get_timer (0) - i) < (usec / 1000)) ;
+   i = time_now_ms();
+   while (time_since_ms(i) < (usec / 1000)) ;
 }
 #else
 void __udelay (unsigned long usec)
diff --git a/arch/nios2/cpu/epcs.c b/arch/nios2/cpu/epcs.c
index 2369431..90e5b99 100644
--- a/arch/nios2/cpu/epcs.c
+++ b/arch/nios2/cpu/epcs.c
@@ -88,9 +88,9 @@ static int epcs_cs (int assert)
writel (tmp | NIOS_SPI_SSO, &epcs->control);
} else {
/* Let all bits shift out */
-   start = get_timer (0);
+   start = time_now_ms();
while ((readl (&epcs->status) & NIOS_SPI_TMT) == 0)
-   if (get_timer (start) > EPCS_TIMEOUT)
+   if (time_since_ms(start) > EPCS_TIMEOUT)
return (-1);
tmp = readl (&epcs->control);
writel (tmp & ~NIOS_SPI_SSO, &epcs->control);
@@ -102,9 +102,9 @@ static int epcs_tx (unsigned char c)
 {
ulong start;
 
-   start = get_timer (0);
+   start = time_now_ms();
while ((readl (&epcs->status) & NIOS_SPI_TRDY) == 0)
-   if (get_timer (start) > EPCS_TIMEOUT)
+   if (time_since_ms(start) > EPCS_TIMEOUT)
return (-1);
writel (c, &epcs->txdata);
return (0);
@@ -114,9 +114,9 @@ static int epcs_rx (void)
 {
ulong start;
 
-   start = get_timer (0);
+   start = time_now_ms();
while ((readl (&epcs->status) & NIOS_SPI_RRDY) == 0)
-   if (get_timer (start) > EPCS_TIMEOUT)
+   if (time_since_ms(start) > EPCS_TIMEOUT)
return (-1);
return (readl (&epcs->rxdata));
 }
diff --git a/arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c 
b/arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c
index 637ae4c..7822811 100644
--- a/arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c
+++ b/arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c
@@ -97,10 +97,10 @@ void i2c_init (int speed, int slaveadd)
 
 static __inline__ int i2c_wait4bus (void)
 {
-   ulong timeval = get_timer (0);
+   ulong timeval = time_now_ms();
 
while (readl (I2CCSR) & MPC107_CSR_MBB)
-   if (get_timer (timeval) > TIMEOUT)
+   if (time_since_ms(timeval) > TIMEOUT)
return -1;
 
return 0;
@@ -109,7 +109,7 @@ static __inline__ int i2c_wait4bus (void)
 static __inline__ int i2c_wait (int write)
 {
u32 csr;
-   ulong timeval = get_timer (0);
+   ulong timeval = time_now_ms();
 
do {
csr = readl (I2CCSR);
@@ -141,7 +141,7 @@ static __inline__ int i2c_wait (int write)
}
 
return 0;
-   } while (get_timer (timeval) < TIMEOUT);
+   } while (time_since_ms(timeval) < TIMEOUT);
 
 #ifdef I2CDBG
printf ("i2c_wait: timed out\n");
diff --git a/arch/powerpc/cpu/mpc8260/ether_fcc.c 
b/arch/powerpc/cpu/mpc8260/ether_fcc.c
index c82958d..89703d9 100644
--- a/arch/powerpc/cpu/mpc8260/ether_fcc.c
+++ b/arch/powerpc/cpu/mpc8260/ether_fcc.c
@@ -887,7 +887,7 @@ eth_loopback_test (void)
 */
 
clear_ctrlc ();
-   runtime = get_timer (0);
+   runtime = time_now_ms();
 
do {
nclosed = 0;
@@ -931,7 +931,7 @@ eth_loopback_test (void)
__asm__ __volatile__ ("eieio");
} while (cp->cp_cpcr & CPM_CR_FLG);
 
-   ecp->clstime = get_timer (0);
+   

[U-Boot] [PATCH v1 (WIP) 14/16] [Timer]Replace get_timer() usage in common/

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ 
---
 common/cmd_misc.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/cmd_misc.c b/common/cmd_misc.c
index 061b1bb..40f84d2 100644
--- a/common/cmd_misc.c
+++ b/common/cmd_misc.c
@@ -29,7 +29,7 @@
 
 int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-   ulong start = get_timer(0);
+   ulong start = time_now_ms();
ulong delay;
 
if (argc != 2)
@@ -37,7 +37,7 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
delay = simple_strtoul(argv[1], NULL, 10) * CONFIG_SYS_HZ;
 
-   while (get_timer(start) < delay) {
+   while (time_since_ms(start) < delay) {
if (ctrlc ())
return (-1);
 
-- 
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v1 (WIP) 11/16] [Timer]Remove reset_timer() completely

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ 
---
 arch/nios2/cpu/interrupts.c |   38 --
 drivers/block/mg_disk.c |3 ---
 drivers/mtd/cfi_flash.c |6 --
 3 files changed, 0 insertions(+), 47 deletions(-)

diff --git a/arch/nios2/cpu/interrupts.c b/arch/nios2/cpu/interrupts.c
index 0a97fa6..5603894 100644
--- a/arch/nios2/cpu/interrupts.c
+++ b/arch/nios2/cpu/interrupts.c
@@ -54,44 +54,6 @@ static struct irq_action vecs[32];
 /*/
 volatile ulong timestamp = 0;
 
-void reset_timer (void)
-{
-   nios_timer_t *tmr =(nios_timer_t *)CONFIG_SYS_NIOS_TMRBASE;
-
-   /* From Embedded Peripherals Handbook:
-*
-* "When the hardware is configured with Writeable period
-* disabled, writing to one of the period_n registers causes
-* the counter to reset to the fixed Timeout Period specified
-* at system generation time."
-*
-* Here we force a reload to prevent early timeouts from
-* get_timer() when the interrupt period is greater than
-* than 1 msec.
-*
-* Simply write to periodl with its own value to force an
-* internal counter reload, THEN reset the timestamp.
-*/
-   writel (readl (&tmr->periodl), &tmr->periodl);
-   timestamp = 0;
-
-   /* From Embedded Peripherals Handbook:
-*
-* "Writing to one of the period_n registers stops the internal
-* counter, except when the hardware is configured with Start/Stop
-* control bits off. If Start/Stop control bits is off, writing
-* either register does not stop the counter."
-*
-* In order to accomodate either configuration, the control
-* register is re-written. If the counter is stopped, it will
-* be restarted. If it is running, the write is essentially
-* a nop.
-*/
-   writel (NIOS_TIMER_ITO | NIOS_TIMER_CONT | NIOS_TIMER_START,
-   &tmr->control);
-
-}
-
 ulong get_timer (ulong base)
 {
WATCHDOG_RESET ();
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index c8cc195..c56adfc 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -91,9 +91,6 @@ static unsigned int mg_wait (u32 expect, u32 msec)
u32 ts, err;
 
err = MG_ERR_NONE;
-#ifdef CONFIG_NIOS2
-   reset_timer();
-#endif
ts = time_now_ms();
 
status = readb(mg_base() + MG_REG_STATUS);
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index dad80c5..9918157 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -573,9 +573,6 @@ static int flash_status_check (flash_info_t * info, 
flash_sect_t sector,
 #endif
 
/* Wait for command completion */
-#ifdef CONFIG_NIOS2
-   reset_timer();
-#endif
start = time_now_ms();
while (flash_is_busy (info, sector)) {
if (time_since_ms(start) > tout) {
@@ -664,9 +661,6 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
 #endif
 
/* Wait for command completion */
-#ifdef CONFIG_NIOS2
-   reset_timer();
-#endif
start = time_now_ms();
while (1) {
switch (info->portwidth) {
-- 
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v1 (WIP) 10/16] [Timer]Replace get_timer() usage in driver/mtd and driver/block

2011-06-28 Thread Graeme Russ
This prepares for final removal of reset_timer() from Nios2

Signed-off-by: Graeme Russ 
---
 drivers/mtd/cfi_flash.c |   12 ++--
 drivers/mtd/nand/nand_base.c|   17 +
 drivers/mtd/spi/eeprom_m95xxx.c |6 +++---
 drivers/mtd/spi/spi_flash.c |6 +++---
 4 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 3ac6c80..dad80c5 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -563,7 +563,7 @@ static int flash_is_busy (flash_info_t * info, flash_sect_t 
sect)
 static int flash_status_check (flash_info_t * info, flash_sect_t sector,
   ulong tout, char *prompt)
 {
-   ulong start;
+   u32 start;
 
 #if CONFIG_SYS_HZ != 1000
if ((ulong)CONFIG_SYS_HZ > 10)
@@ -576,9 +576,9 @@ static int flash_status_check (flash_info_t * info, 
flash_sect_t sector,
 #ifdef CONFIG_NIOS2
reset_timer();
 #endif
-   start = get_timer (0);
+   start = time_now_ms();
while (flash_is_busy (info, sector)) {
-   if (get_timer (start) > tout) {
+   if (time_since_ms(start) > tout) {
printf ("Flash %s timeout at address %lx data %lx\n",
prompt, info->start[sector],
flash_read_long (info, sector, 0));
@@ -653,7 +653,7 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
 ulong tout, char *prompt)
 {
 #ifdef CONFIG_SYS_CFI_FLASH_STATUS_POLL
-   ulong start;
+   u32 start;
int ready;
 
 #if CONFIG_SYS_HZ != 1000
@@ -667,7 +667,7 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
 #ifdef CONFIG_NIOS2
reset_timer();
 #endif
-   start = get_timer(0);
+   start = time_now_ms();
while (1) {
switch (info->portwidth) {
case FLASH_CFI_8BIT:
@@ -688,7 +688,7 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
}
if (ready)
break;
-   if (get_timer(start) > tout) {
+   if (time_since_ms(start) > tout) {
printf("Flash %s timeout at address %lx data %lx\n",
   prompt, (ulong)dst, (ulong)flash_read8(dst));
return ERR_TIMOUT;
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 52f8575..c838695 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -33,6 +33,7 @@
  */
 
 #include 
+#include 
 
 #define ENOTSUPP   524 /* Operation is not supported */
 
@@ -439,12 +440,12 @@ void nand_wait_ready(struct mtd_info *mtd)
 {
struct nand_chip *chip = mtd->priv;
u32 timeo = (CONFIG_SYS_HZ * 20) / 1000;
-   u32 time_start;
+   u32 start;
 
-   time_start = get_timer(0);
+   start = time_now_ms();
 
/* wait until command is processed or timeout occures */
-   while (get_timer(time_start) < timeo) {
+   while (time_since_ms(start) < timeo) {
if (chip->dev_ready)
if (chip->dev_ready(mtd))
break;
@@ -705,7 +706,7 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip 
*this)
 {
unsigned long   timeo;
int state = this->state;
-   u32 time_start;
+   u32 start;
 
if (state == FL_ERASING)
timeo = (CONFIG_SYS_HZ * 400) / 1000;
@@ -717,10 +718,10 @@ static int nand_wait(struct mtd_info *mtd, struct 
nand_chip *this)
else
this->cmdfunc(mtd, NAND_CMD_STATUS, -1, -1);
 
-   time_start = get_timer(0);
+   start = time_now_ms();
 
while (1) {
-   if (get_timer(time_start) > timeo) {
+   if (time_since_ms(start) > timeo) {
printf("Timeout!");
return 0x01;
}
@@ -734,8 +735,8 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip 
*this)
}
}
 #ifdef PPCHAMELON_NAND_TIMER_HACK
-   time_start = get_timer(0);
-   while (get_timer(time_start) < 10)
+   start = time_now_ms();
+   while (time_since_ms(start) < 10)
;
 #endif /*  PPCHAMELON_NAND_TIMER_HACK */
 
diff --git a/drivers/mtd/spi/eeprom_m95xxx.c b/drivers/mtd/spi/eeprom_m95xxx.c
index ef8ed6f..16b194c 100644
--- a/drivers/mtd/spi/eeprom_m95xxx.c
+++ b/drivers/mtd/spi/eeprom_m95xxx.c
@@ -75,7 +75,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int 
len)
 {
struct spi_slave *slave;
char buf[3];
-   ulong start;
+   u32 start;
 
slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 100,
CONFIG_DEFAULT_SPI_MODE);
@@ -103,7 +103,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, 
int len)
if(spi_xfer(sl

[U-Boot] [PATCH v1 (WIP) 09/16] [Timer]Replace get_timer() usage in drivers/block/

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ 
---
 drivers/block/mg_disk.c |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 2198017..c8cc195 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -88,17 +88,16 @@ static void mg_dump_status (const char *msg, unsigned int 
stat, unsigned err)
 static unsigned int mg_wait (u32 expect, u32 msec)
 {
u8 status;
-   u32 from, cur, err;
+   u32 ts, err;
 
err = MG_ERR_NONE;
 #ifdef CONFIG_NIOS2
reset_timer();
 #endif
-   from = get_timer(0);
+   ts = time_now_ms();
 
status = readb(mg_base() + MG_REG_STATUS);
do {
-   cur = get_timer(from);
if (status & MG_REG_STATUS_BIT_BUSY) {
if (expect == MG_REG_STATUS_BIT_BUSY)
break;
@@ -119,9 +118,9 @@ static unsigned int mg_wait (u32 expect, u32 msec)
break;
}
status = readb(mg_base() + MG_REG_STATUS);
-   } while (cur < msec);
+   } while (time_since_ms(ts) < msec);
 
-   if (cur >= msec)
+   if (time_since_ms(ts) >= msec)
err = MG_ERR_TIMEOUT;
 
return err;
-- 
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v1 (WIP) 07/16] [Timer]Remove reset_timer_masked()

2011-06-28 Thread Graeme Russ
Fold implementation into timer_init() where needed

Signed-off-by: Graeme Russ 
---
 arch/arm/cpu/arm1136/mx31/timer.c|7 ---
 arch/arm/cpu/arm1136/omap24xx/timer.c|   14 +++---
 arch/arm/cpu/arm1176/s3c64xx/timer.c |7 ---
 arch/arm/cpu/arm720t/interrupts.c|7 ---
 arch/arm/cpu/arm920t/at91/timer.c|8 
 arch/arm/cpu/arm920t/at91rm9200/timer.c  |7 ---
 arch/arm/cpu/arm920t/ep93xx/timer.c  |   10 +++---
 arch/arm/cpu/arm920t/imx/timer.c |   10 +++---
 arch/arm/cpu/arm920t/ks8695/timer.c  |   15 +--
 arch/arm/cpu/arm920t/s3c24x0/timer.c |7 ---
 arch/arm/cpu/arm925t/timer.c |   12 +++-
 arch/arm/cpu/arm926ejs/armada100/timer.c |   10 ++
 arch/arm/cpu/arm926ejs/kirkwood/timer.c  |   10 ++
 arch/arm/cpu/arm926ejs/mb86r0x/timer.c   |   14 +++---
 arch/arm/cpu/arm926ejs/mx25/timer.c  |9 -
 arch/arm/cpu/arm926ejs/mx27/timer.c  |9 -
 arch/arm/cpu/arm926ejs/orion5x/timer.c   |   10 ++
 arch/arm/cpu/arm926ejs/pantheon/timer.c  |   10 ++
 arch/arm/cpu/arm926ejs/spear/timer.c |   11 +++
 arch/arm/cpu/armv7/mx5/timer.c   |   10 --
 arch/arm/cpu/armv7/omap-common/timer.c   |   11 +++
 arch/arm/cpu/armv7/tegra2/timer.c|7 ---
 arch/arm/cpu/ixp/timer.c |8 
 arch/arm/cpu/pxa/timer.c |8 +---
 arch/arm/cpu/s3c44b0/timer.c |7 ---
 arch/arm/cpu/sa1100/timer.c  |6 --
 board/armltd/integrator/timer.c  |   13 -
 27 files changed, 47 insertions(+), 210 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx31/timer.c 
b/arch/arm/cpu/arm1136/mx31/timer.c
index eac4ffb..c05a39d 100644
--- a/arch/arm/cpu/arm1136/mx31/timer.c
+++ b/arch/arm/cpu/arm1136/mx31/timer.c
@@ -106,13 +106,6 @@ int timer_init (void)
return 0;
 }
 
-void reset_timer_masked (void)
-{
-   /* reset time */
-   gd->lastinc = GPTCNT; /* capture current incrementer value time */
-   gd->tbl = 0; /* start "advancing" time stamp from 0 */
-}
-
 unsigned long long get_ticks (void)
 {
ulong now = GPTCNT; /* current tick value */
diff --git a/arch/arm/cpu/arm1136/omap24xx/timer.c 
b/arch/arm/cpu/arm1136/omap24xx/timer.c
index 6f1ebbf..73bf4a7 100644
--- a/arch/arm/cpu/arm1136/omap24xx/timer.c
+++ b/arch/arm/cpu/arm1136/omap24xx/timer.c
@@ -41,6 +41,13 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static void reset_timer_masked (void)
+{
+   /* reset time */
+   gd->lastinc = READ_TIMER;   /* capture current incrementer value 
time */
+   gd->tbl = 0;/* start "advancing" time stamp from 0 
*/
+}
+
 int timer_init (void)
 {
int32_t val;
@@ -85,13 +92,6 @@ void __udelay (unsigned long usec)
/*NOP*/;
 }
 
-void reset_timer_masked (void)
-{
-   /* reset time */
-   gd->lastinc = READ_TIMER;   /* capture current incrementer value 
time */
-   gd->tbl = 0;/* start "advancing" time stamp from 0 
*/
-}
-
 ulong get_timer_masked (void)
 {
ulong now = READ_TIMER; /* current tick value */
diff --git a/arch/arm/cpu/arm1176/s3c64xx/timer.c 
b/arch/arm/cpu/arm1176/s3c64xx/timer.c
index bc21f86..f16a37b 100644
--- a/arch/arm/cpu/arm1176/s3c64xx/timer.c
+++ b/arch/arm/cpu/arm1176/s3c64xx/timer.c
@@ -135,13 +135,6 @@ ulong get_tbclk(void)
return (ulong)(timer_load_val / 100);
 }
 
-void reset_timer_masked(void)
-{
-   /* reset time */
-   lastdec = read_timer();
-   timestamp = 0;
-}
-
 ulong get_timer_masked(void)
 {
unsigned long long res = get_ticks();
diff --git a/arch/arm/cpu/arm720t/interrupts.c 
b/arch/arm/cpu/arm720t/interrupts.c
index 9cd7fee..fa9c5a2 100644
--- a/arch/arm/cpu/arm720t/interrupts.c
+++ b/arch/arm/cpu/arm720t/interrupts.c
@@ -233,13 +233,6 @@ void __udelay (unsigned long usec)
 #endif
 }
 
-void reset_timer_masked (void)
-{
-   /* reset time */
-   lastdec = READ_TIMER;
-   timestamp = 0;
-}
-
 ulong get_timer_masked (void)
 {
ulong now = READ_TIMER;
diff --git a/arch/arm/cpu/arm920t/at91/timer.c 
b/arch/arm/cpu/arm920t/at91/timer.c
index 374cc25..c321e28 100644
--- a/arch/arm/cpu/arm920t/at91/timer.c
+++ b/arch/arm/cpu/arm920t/at91/timer.c
@@ -82,14 +82,6 @@ void __udelay(unsigned long usec)
udelay_masked(usec);
 }
 
-void reset_timer_masked(void)
-{
-   /* reset time */
-   at91_tc_t *tc = (at91_tc_t *) ATMEL_BASE_TC;
-   gd->lastinc = readl(&tc->tc[0].cv) & 0x;
-   gd->tbl = 0;
-}
-
 ulong get_timer_raw(void)
 {
at91_tc_t *tc = (at91_tc_t *) ATMEL_BASE_TC;
diff --git a/arch/arm/cpu/arm920t/at91rm9200/timer.c 
b/arch/arm/cpu/arm920t/at91rm9200/timer.c
index 9a1ae85..fbe74b6 100644
--- a/arch/arm/cpu/arm920t/at91rm9200/timer.c
+++ b/arch/arm/cpu/arm920t/at91rm9200/timer.c
@@ -81,13 +

[U-Boot] [PATCH v1 (WIP) 06/16] [Timer]Fix at91rm9200/spi.c timer usage

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ 
---
 arch/arm/cpu/arm920t/at91rm9200/spi.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/arm920t/at91rm9200/spi.c 
b/arch/arm/cpu/arm920t/at91rm9200/spi.c
index f3cb5d8..c70efc6 100644
--- a/arch/arm/cpu/arm920t/at91rm9200/spi.c
+++ b/arch/arm/cpu/arm920t/at91rm9200/spi.c
@@ -108,6 +108,7 @@ void AT91F_SpiEnable(int cs)
 unsigned int AT91F_SpiWrite ( AT91PS_DataflashDesc pDesc )
 {
unsigned int timeout;
+   unsigned long start;
 
pDesc->state = BUSY;
 
@@ -132,12 +133,12 @@ unsigned int AT91F_SpiWrite ( AT91PS_DataflashDesc pDesc )
}
 
/* arm simple, non interrupt dependent timer */
-   reset_timer_masked();
+   start = get_timer(0);
timeout = 0;
 
AT91C_BASE_SPI->SPI_PTCR = AT91C_PDC_TXTEN + AT91C_PDC_RXTEN;
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;
pDesc->state = IDLE;
 
-- 
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v1 (WIP) 05/16] [Timer]Remove reset_timer() for non-Nios2 arches

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ 
---
 arch/arm/cpu/arm1136/mx31/timer.c|5 -
 arch/arm/cpu/arm1136/mx35/timer.c|5 -
 arch/arm/cpu/arm1136/omap24xx/timer.c|5 -
 arch/arm/cpu/arm1176/s3c64xx/timer.c |5 -
 arch/arm/cpu/arm1176/tnetv107x/timer.c   |9 -
 arch/arm/cpu/arm720t/interrupts.c|5 -
 arch/arm/cpu/arm920t/a320/timer.c|6 --
 arch/arm/cpu/arm920t/at91/timer.c|6 --
 arch/arm/cpu/arm920t/at91rm9200/timer.c  |6 --
 arch/arm/cpu/arm920t/ep93xx/timer.c  |5 -
 arch/arm/cpu/arm920t/imx/timer.c |6 --
 arch/arm/cpu/arm920t/ks8695/timer.c  |7 +--
 arch/arm/cpu/arm920t/s3c24x0/timer.c |6 --
 arch/arm/cpu/arm925t/timer.c |6 --
 arch/arm/cpu/arm926ejs/armada100/timer.c |5 -
 arch/arm/cpu/arm926ejs/davinci/timer.c   |5 -
 arch/arm/cpu/arm926ejs/kirkwood/timer.c  |5 -
 arch/arm/cpu/arm926ejs/mb86r0x/timer.c   |5 -
 arch/arm/cpu/arm926ejs/mx25/timer.c  |5 -
 arch/arm/cpu/arm926ejs/mx27/timer.c  |5 -
 arch/arm/cpu/arm926ejs/nomadik/timer.c   |   12 +---
 arch/arm/cpu/arm926ejs/omap/timer.c  |6 --
 arch/arm/cpu/arm926ejs/orion5x/timer.c   |5 -
 arch/arm/cpu/arm926ejs/pantheon/timer.c  |5 -
 arch/arm/cpu/arm926ejs/spear/timer.c |6 --
 arch/arm/cpu/arm926ejs/versatile/timer.c |6 --
 arch/arm/cpu/armv7/mx5/timer.c   |5 -
 arch/arm/cpu/armv7/omap-common/timer.c   |5 -
 arch/arm/cpu/armv7/s5p-common/timer.c|5 -
 arch/arm/cpu/armv7/tegra2/timer.c|5 -
 arch/arm/cpu/ixp/timer.c |5 -
 arch/arm/cpu/lh7a40x/timer.c |6 --
 arch/arm/cpu/pxa/timer.c |7 +--
 arch/arm/cpu/s3c44b0/timer.c |6 --
 arch/arm/cpu/sa1100/timer.c  |5 -
 arch/avr32/cpu/interrupts.c  |7 ---
 arch/blackfin/cpu/interrupts.c   |5 -
 arch/m68k/cpu/mcf547x_8x/slicetimer.c|5 -
 arch/m68k/lib/time.c |5 -
 arch/microblaze/cpu/timer.c  |7 +--
 arch/mips/cpu/mips32/time.c  |6 --
 arch/powerpc/lib/interrupts.c|5 -
 arch/sh/lib/time.c   |7 ---
 arch/sh/lib/time_sh2.c   |8 
 arch/sparc/lib/interrupts.c  |7 +--
 arch/x86/lib/timer.c |5 -
 board/armltd/integrator/timer.c  |5 -
 board/armltd/vexpress/ca9x4_ct_vxp.c |5 -
 board/nvidia/common/board.c  |1 -
 49 files changed, 9 insertions(+), 270 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx31/timer.c 
b/arch/arm/cpu/arm1136/mx31/timer.c
index d51acbb..eac4ffb 100644
--- a/arch/arm/cpu/arm1136/mx31/timer.c
+++ b/arch/arm/cpu/arm1136/mx31/timer.c
@@ -113,11 +113,6 @@ void reset_timer_masked (void)
gd->tbl = 0; /* start "advancing" time stamp from 0 */
 }
 
-void reset_timer(void)
-{
-   reset_timer_masked();
-}
-
 unsigned long long get_ticks (void)
 {
ulong now = GPTCNT; /* current tick value */
diff --git a/arch/arm/cpu/arm1136/mx35/timer.c 
b/arch/arm/cpu/arm1136/mx35/timer.c
index 6dfb63a..80c0675 100644
--- a/arch/arm/cpu/arm1136/mx35/timer.c
+++ b/arch/arm/cpu/arm1136/mx35/timer.c
@@ -73,11 +73,6 @@ inline ulong get_timer_masked(void)
return val;
 }
 
-void reset_timer(void)
-{
-   reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
ulong tmp;
diff --git a/arch/arm/cpu/arm1136/omap24xx/timer.c 
b/arch/arm/cpu/arm1136/omap24xx/timer.c
index d6267ba..6f1ebbf 100644
--- a/arch/arm/cpu/arm1136/omap24xx/timer.c
+++ b/arch/arm/cpu/arm1136/omap24xx/timer.c
@@ -57,11 +57,6 @@ int timer_init (void)
 /*
  * timer without interrupts
  */
-void reset_timer (void)
-{
-   reset_timer_masked ();
-}
-
 ulong get_timer (ulong base)
 {
return get_timer_masked () - base;
diff --git a/arch/arm/cpu/arm1176/s3c64xx/timer.c 
b/arch/arm/cpu/arm1176/s3c64xx/timer.c
index 8e54060..bc21f86 100644
--- a/arch/arm/cpu/arm1176/s3c64xx/timer.c
+++ b/arch/arm/cpu/arm1176/s3c64xx/timer.c
@@ -142,11 +142,6 @@ void reset_timer_masked(void)
timestamp = 0;
 }
 
-void reset_timer(void)
-{
-   reset_timer_masked();
-}
-
 ulong get_timer_masked(void)
 {
unsigned long long res = get_ticks();
diff --git a/arch/arm/cpu/arm1176/tnetv107x/timer.c 
b/arch/arm/cpu/arm1176/tnetv107x/timer.c
index c27375c..b3123c5 100644
--- a/arch/arm/cpu/arm1176/tnetv107x/timer.c
+++ b/arch/arm/cpu/arm1176/tnetv107x/timer.c
@@ -60,15 +60,6 @@ int timer_init(void)
return 0;
 }
 
-void reset_timer(void)
-{
-   lastinc = timestamp = 0;
-
-   __raw_writel(0, ®s->tcr);
-   __raw_writel(0, ®s->tim34);
-   __raw_writel(2 << 22,   ®s->tcr);
-}
-

[U-Boot] [PATCH v1 (WIP) 03/16] [Timer]Remove calls to set_timer in arch/

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ 
---
 arch/arm/cpu/arm1136/mx31/timer.c|5 -
 arch/arm/cpu/arm1136/mx35/timer.c|4 
 arch/arm/cpu/arm1136/omap24xx/timer.c|5 -
 arch/arm/cpu/arm1176/s3c64xx/timer.c |5 -
 arch/arm/cpu/arm1176/tnetv107x/timer.c   |5 -
 arch/arm/cpu/arm720t/interrupts.c|5 -
 arch/arm/cpu/arm920t/a320/timer.c|6 --
 arch/arm/cpu/arm920t/at91/timer.c|5 -
 arch/arm/cpu/arm920t/at91rm9200/timer.c  |5 -
 arch/arm/cpu/arm920t/imx/timer.c |5 -
 arch/arm/cpu/arm920t/ks8695/timer.c  |5 -
 arch/arm/cpu/arm920t/s3c24x0/timer.c |5 -
 arch/arm/cpu/arm925t/timer.c |5 -
 arch/arm/cpu/arm926ejs/armada100/timer.c |5 -
 arch/arm/cpu/arm926ejs/kirkwood/timer.c  |5 -
 arch/arm/cpu/arm926ejs/mx25/timer.c  |5 -
 arch/arm/cpu/arm926ejs/mx27/timer.c  |5 -
 arch/arm/cpu/arm926ejs/omap/timer.c  |5 -
 arch/arm/cpu/arm926ejs/orion5x/timer.c   |5 -
 arch/arm/cpu/arm926ejs/pantheon/timer.c  |5 -
 arch/arm/cpu/arm926ejs/spear/timer.c |5 -
 arch/arm/cpu/arm926ejs/versatile/timer.c |5 -
 arch/arm/cpu/armv7/mx5/timer.c   |5 -
 arch/arm/cpu/armv7/omap-common/timer.c   |5 -
 arch/arm/cpu/armv7/s5p-common/timer.c|5 -
 arch/arm/cpu/armv7/tegra2/timer.c|5 -
 arch/arm/cpu/lh7a40x/timer.c |5 -
 arch/arm/cpu/pxa/timer.c |5 -
 arch/arm/cpu/s3c44b0/timer.c |5 -
 arch/arm/cpu/sa1100/timer.c  |5 -
 arch/avr32/cpu/interrupts.c  |   16 
 arch/m68k/cpu/mcf547x_8x/slicetimer.c|4 
 arch/m68k/lib/board.c|2 --
 arch/m68k/lib/time.c |   16 ++--
 arch/microblaze/cpu/timer.c  |5 -
 arch/mips/cpu/mips32/time.c  |6 --
 arch/nios2/cpu/interrupts.c  |6 --
 arch/powerpc/lib/board.c |2 --
 arch/powerpc/lib/interrupts.c|5 -
 arch/sh/lib/time.c   |7 +--
 arch/sh/lib/time_sh2.c   |9 ++---
 arch/sparc/lib/board.c   |2 --
 arch/sparc/lib/interrupts.c  |5 -
 arch/x86/lib/board.c |2 --
 arch/x86/lib/timer.c |5 -
 board/armltd/integrator/timer.c  |6 --
 include/common.h |1 -
 47 files changed, 5 insertions(+), 244 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx31/timer.c 
b/arch/arm/cpu/arm1136/mx31/timer.c
index c4bc3b3..d51acbb 100644
--- a/arch/arm/cpu/arm1136/mx31/timer.c
+++ b/arch/arm/cpu/arm1136/mx31/timer.c
@@ -147,11 +147,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-   gd->tbl = time_to_tick(t);
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
diff --git a/arch/arm/cpu/arm1136/mx35/timer.c 
b/arch/arm/cpu/arm1136/mx35/timer.c
index db1e2c9..6dfb63a 100644
--- a/arch/arm/cpu/arm1136/mx35/timer.c
+++ b/arch/arm/cpu/arm1136/mx35/timer.c
@@ -92,10 +92,6 @@ ulong get_timer(ulong base)
return (tmp / 1000) - base;
 }
 
-void set_timer(ulong t)
-{
-}
-
 /*
  * delay x useconds AND preserve advance timstamp value
  * GPTCNT is now supposed to tick 1 by 1 us.
diff --git a/arch/arm/cpu/arm1136/omap24xx/timer.c 
b/arch/arm/cpu/arm1136/omap24xx/timer.c
index 228ceba..d6267ba 100644
--- a/arch/arm/cpu/arm1136/omap24xx/timer.c
+++ b/arch/arm/cpu/arm1136/omap24xx/timer.c
@@ -67,11 +67,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-   gd->tbl = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
diff --git a/arch/arm/cpu/arm1176/s3c64xx/timer.c 
b/arch/arm/cpu/arm1176/s3c64xx/timer.c
index 9768319..8e54060 100644
--- a/arch/arm/cpu/arm1176/s3c64xx/timer.c
+++ b/arch/arm/cpu/arm1176/s3c64xx/timer.c
@@ -159,11 +159,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-   timestamp = t * (timer_load_val / (100 * CONFIG_SYS_HZ));
-}
-
 void __udelay(unsigned long usec)
 {
unsigned long long tmp;
diff --git a/arch/arm/cpu/arm1176/tnetv107x/timer.c 
b/arch/arm/cpu/arm1176/tnetv107x/timer.c
index a7a400d..c27375c 100644
--- a/arch/arm/cpu/arm1176/tnetv107x/timer.c
+++ b/arch/arm/cpu/arm1176/tnetv107x/timer.c
@@ -88,11 +88,6 @@ ulong get_timer(ulong base)
return (get_timer_raw() / (TIMER_LOAD_VAL / TIM_CLK_DIV)) - base;
 }
 
-void set_timer(ulong t)
-{
-   timestamp = t;
-}
-
 unsigned long long get_ticks(void)
 {
return get_timer(0);
diff --git a/arch/arm/cpu/arm720t/

[U-Boot] [PATCH v1 (WIP) 04/16] [Timer]Allow reset_timer() only for Nios2

2011-06-28 Thread Graeme Russ

Signed-off-by: Graeme Russ 
---
 drivers/block/mg_disk.c |2 ++
 drivers/mtd/cfi_flash.c |4 
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index b74307a..2198017 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -91,7 +91,9 @@ static unsigned int mg_wait (u32 expect, u32 msec)
u32 from, cur, err;
 
err = MG_ERR_NONE;
+#ifdef CONFIG_NIOS2
reset_timer();
+#endif
from = get_timer(0);
 
status = readb(mg_base() + MG_REG_STATUS);
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 6039e1f..3ac6c80 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -573,7 +573,9 @@ static int flash_status_check (flash_info_t * info, 
flash_sect_t sector,
 #endif
 
/* Wait for command completion */
+#ifdef CONFIG_NIOS2
reset_timer();
+#endif
start = get_timer (0);
while (flash_is_busy (info, sector)) {
if (get_timer (start) > tout) {
@@ -662,7 +664,9 @@ static int flash_status_poll(flash_info_t *info, void *src, 
void *dst,
 #endif
 
/* Wait for command completion */
+#ifdef CONFIG_NIOS2
reset_timer();
+#endif
start = get_timer(0);
while (1) {
switch (info->portwidth) {
-- 
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v1 (WIP) 00/16] [Timer]API Rewrite

2011-06-28 Thread Graeme Russ
The following series is a work-in-progress revamp of the timer API. The aim
is to create a new userland API consisting of the following functions
(along with a few arch level support functions):

u32 time_now_ms(void);
u32 time_since_ms(u32 from, u32 to);
u32 time_max_since_ms(u32 from, u32 to);

This current patch series migrates the users of the existing timer API
consisting of get_timer() and reset_timer() to the new API while still
retaining the arch specific framework in the background.

I feel that the arch level implementation should be left for a completely
separate patch series. This will allow the migration to progress in a
series of very neatly defined and distinct (and therefore easily
bisectable) steps.

Note: I have included my SOB on each patch - I am marking this as the
start of the official patch series to bring the following discussion
threads to conclusion:

http://lists.denx.de/pipermail/u-boot/2011-May/093093.html
http://lists.denx.de/pipermail/u-boot/2011-May/093141.html
http://lists.denx.de/pipermail/u-boot/2011-May/093209.html
http://lists.denx.de/pipermail/u-boot/2011-May/093404.html

And the Timer API Task on the wiki:

http://www.denx.de/wiki/U-Boot/TaskTimerAPI

There are 18 days left in the current merge window (and I am going on
holidays for a week during that) so I kind of doubt that this will make
2011.09 - If it does not, However, I _really_ want to pound this out ready
for 2011.12

Comments please

Graeme Russ (16):
  [Timer]Fix misuse of ARM *timer_masked() functions outside arch/arm
  [Timer]Remove calls to set_timer outside arch/
  [Timer]Remove calls to set_timer in arch/
  [Timer]Allow reset_timer() only for Nios2
  [Timer]Remove reset_timer() for non-Nios2 arches
  [Timer]Fix at91rm9200/spi.c timer usage
  [Timer]Remove reset_timer_masked()
  [Timer]Create new userland timer API
  [Timer]Replace get_timer() usage in drivers/block/
  [Timer]Replace get_timer() usage in driver/mtd and driver/block
  [Timer]Remove reset_timer() completely
  [Timer]Replace get_timer() usage in drivers/
  [Timer]Replace get_timer() usage in net/
  [Timer]Replace get_timer() usage in common/
  [Timer]Replace get_timer() usage in board/
  [Timer]Replace get_timer() usage in arch/

 arch/arm/cpu/arm1136/mx31/timer.c  |   17 
 arch/arm/cpu/arm1136/mx35/timer.c  |9 
 arch/arm/cpu/arm1136/omap24xx/timer.c  |   24 +++
 arch/arm/cpu/arm1176/s3c64xx/timer.c   |   17 
 arch/arm/cpu/arm1176/tnetv107x/timer.c |   14 ---
 arch/arm/cpu/arm720t/interrupts.c  |   17 
 arch/arm/cpu/arm920t/a320/timer.c  |   12 --
 arch/arm/cpu/arm920t/at91/timer.c  |   19 -
 arch/arm/cpu/arm920t/at91rm9200/spi.c  |5 +-
 arch/arm/cpu/arm920t/at91rm9200/timer.c|   18 -
 arch/arm/cpu/arm920t/ep93xx/timer.c|   15 +--
 arch/arm/cpu/arm920t/imx/timer.c   |   21 +-
 arch/arm/cpu/arm920t/ks8695/timer.c|   25 ++--
 arch/arm/cpu/arm920t/s3c24x0/timer.c   |   18 -
 arch/arm/cpu/arm925t/timer.c   |   23 +--
 arch/arm/cpu/arm926ejs/armada100/timer.c   |   20 +-
 arch/arm/cpu/arm926ejs/davinci/timer.c |5 --
 arch/arm/cpu/arm926ejs/kirkwood/timer.c|   20 +-
 arch/arm/cpu/arm926ejs/mb86r0x/timer.c |   19 +
 arch/arm/cpu/arm926ejs/mx25/timer.c|   19 -
 arch/arm/cpu/arm926ejs/mx27/timer.c|   19 -
 arch/arm/cpu/arm926ejs/nomadik/timer.c |   12 ++---
 arch/arm/cpu/arm926ejs/omap/timer.c|   11 -
 arch/arm/cpu/arm926ejs/orion5x/timer.c |   20 +-
 arch/arm/cpu/arm926ejs/pantheon/timer.c|   20 +-
 arch/arm/cpu/arm926ejs/spear/timer.c   |   22 +-
 arch/arm/cpu/arm926ejs/versatile/timer.c   |   11 -
 arch/arm/cpu/armv7/mx5/timer.c |   20 ++
 arch/arm/cpu/armv7/omap-common/timer.c |   21 +-
 arch/arm/cpu/armv7/s5p-common/timer.c  |   10 -
 arch/arm/cpu/armv7/tegra2/timer.c  |   17 
 arch/arm/cpu/ixp/timer.c   |   13 --
 arch/arm/cpu/lh7a40x/timer.c   |   11 -
 arch/arm/cpu/pxa/timer.c   |   18 +
 arch/arm/cpu/s3c44b0/timer.c   |   18 -
 arch/arm/cpu/sa1100/timer.c|   16 
 arch/avr32/cpu/interrupts.c|   23 ---
 arch/blackfin/cpu/interrupts.c |5 --
 arch/blackfin/cpu/jtag-console.c   |4 +-
 arch/m68k/cpu/mcf547x_8x/slicetimer.c  |9 
 arch/m68k/lib/board.c  |2 -
 arch/m68k/lib/time.c   |   21 +-
 arch/microblaze/cpu/timer.c|   12 +-
 arch/microblaze/lib/time.c |4 +-
 arch/mips/cpu/mips32/time.c|   12 --
 arch/nios2/cpu/epcs.c  |   12 +++---
 arch/nios2/cpu/interrupts.c

[U-Boot] [STATUS] v2011.06 release, Merge Window is OPEN

2011-06-28 Thread Wolfgang Denk
Hello all,

U-Boot v2011.06 has been released and is available from the git
repository and the FTP server.


KNOWN ISSUES:

- The cleanup after the reorganization of the ARM code has not been
  completed yet. At the moment, approapprox, 100+ ARM boards are
  *broken* and *do not compile*.

  Board maintainers or other interested parties are requested to
  adapt their boards within the current merge window. All boards that
  have not been fixed within the first week of the merge window are
  considered unmaintained and without interest to the community and
  will be removed.

  This is the last such warning.

- We still have not found a new network custodian yet.  Are there any
  volunteers?

The Merge Window for the next release (v2011.09) is open until
Sat Jul 16, 2011, 23:59:59 CEST = 18 days remaining. 

The next release v2011.09 is scheduled for September 04, 2011. 


A little statistics [1] - changes since release v2011.03:

Processed 678 csets from 135 developers
26 employers found
A total of 48114 lines added, 36696 removed (delta 11418)

Developers with the most changesets
Mike Frysinger  63 (9.3%)
Luca Ceresoli   28 (4.1%)
Heiko Schocher  26 (3.8%)
Fabio Estevam   23 (3.4%)
Andreas Bießmann21 (3.1%)
Kumar Gala  21 (3.1%)
Holger Brunck   20 (2.9%)
Reinhard Meyer  18 (2.7%)
Macpaul Lin 18 (2.7%)
Wolfgang Denk   17 (2.5%)
...

Developers with the most changed lines
Mike Frysinger10802 (16.0%)
Wolfgang Denk 8365 (12.4%)
Andy Fleming  4724 (7.0%)
Heiko Schocher2787 (4.1%)
John Rigby2243 (3.3%)
Luca Ceresoli 1779 (2.6%)
Daniel Schwierzeck1726 (2.6%)
Michael Schwingen 1689 (2.5%)
Chander Kashyap   1671 (2.5%)
Macpaul Lin   1503 (2.2%)
...

Developers with the most lines removed
Wolfgang Denk 7936 (21.6%)
Daniel Schwierzeck1500 (4.1%)
Eric Benard895 (2.4%)
Holger Brunck  545 (1.5%)
Scott Wood 503 (1.4%)
Kumar Gala 496 (1.4%)
David Müller (ELSOFT AG)  377 (1.0%)
Alessandro Rubini  363 (1.0%)
Andreas Bießmann  275 (0.7%)
Reinhard Meyer 159 (0.4%)
...

Developers with the most signoffs (total 282)
Kumar Gala  80 (28.4%)
Sandeep Paulraj 32 (11.3%)
Valentin Longchamp  23 (8.2%)
Holger Brunck   19 (6.7%)
Stefan Roese15 (5.3%)
Mike Frysinger  13 (4.6%)
Andy Fleming12 (4.3%)
Minkyu Kang 11 (3.9%)
Scott Wood   8 (2.8%)
Shinya Kuribayashi   6 (2.1%)
...

Developers with the most reviews (total 0)

Developers with the most test credits (total 10)
Mike Frysinger   1 (10.0%)
Andreas Bießmann1 (10.0%)
Anatolij Gustschin   1 (10.0%)
Fabio Estevam1 (10.0%)
Graeme Russ  1 (10.0%)
Stefano Babic1 (10.0%)
Felix Radensky   1 (10.0%)
Magnus Lilja 1 (10.0%)
Andre Schwarz1 (10.0%)
Sughosh Ganu 1 (10.0%)

Developers who gave the most tested-by credits (total 10)
Fabio Estevam2 (20.0%)
Kim Phillips 2 (20.0%)
Anatolij Gustschin   1 (10.0%)
Stefano Babic1 (10.0%)
Stefan Roese 1 (10.0%)
Scott Wood   1 (10.0%)
Priyanka Jain1 (10.0%)
Jens Scharsig1 (10.0%)

Developers with the most report credits (total 5)
Andre Schwarz1 (20.0%)
Kumar Gala   1 (20.0%)
Wolfgang Denk1 (20.0%)
Michael Weiss1 (20.0%)
Jianxi Fu1 (20.0%)

Developers who gave the most report credits (total 5)
Mike Frysinger   2 (40.0%)
Kim Phillips 1 (20.0%)
Anatolij Gustschin   1 (20.0%)
Peter Tyser  1 (20.0%)

Top changeset contributors by employer
(Unknown)  267 (39.4%)
Freescale  127 (18.7%)
Analog Devices  66 (9.7%)
DENX Software Engineering   63 (9.3%)
Keymile 34 (5.0%)
Texas Instruments   10 (1.5%)
Guntermann & Drunck  9 (1.3%)
CompuLab 9 (1.3%)
Graeme Russ  7 (1.0%)
Samsung  7 (1.0%)
...

Top lines changed by employer
(Unknown) 22719 (33.6%)
Freescale 13914 (20.6%)
Analog Devices12353 (18.3%)
DENX Software Engineering 11824 (17.5%)
Keymile   2635 (3.9%)
Mistral891 (1.3%)
Bluewater Systems  420 (0.6%)
Graeme Russ396 (0.6%)
Universita di Pavia378 (0.6%)
Transmode Systems  323 (0.5%)
...

Employers with the most signoffs (total 282)
Freescale  1

Re: [U-Boot] Pull request: u-boot-arm/master

2011-06-28 Thread Wolfgang Denk
Dear Igor Grinberg,

In message <4e09a476.3010...@compulab.co.il> you wrote:
> 
> Can these two also be added for 2011.06:

No, they cannot.  v2011.06 was released yesterday, according to
schedule.  I just need to write the summary message...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Remember thee Ay, thou poor ghost while memory holds a seat  In  this
distracted  globe.  Remember  thee!  Yea, from the table of my memory
I'll wipe away all trivial fond  records,  All  saws  of  books,  all
forms,  all  pressures past, That youth and observation copied there.
Hamlet, I : v : 95 William Shakespeare
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Pull request: u-boot-arm/master

2011-06-28 Thread Igor Grinberg
On 06/28/11 12:52, Igor Grinberg wrote:

> Hi Albert,
>
>
>
> On 06/28/11 08:39, Albert ARIBAUD wrote:
>
>> Hi Wolfgang,
>>
>> The following changes since commit 9623c158f6a5150a21c25026bfba79e7ff7912f5:
>>
>>Merge branch 'master' of git://git.denx.de/u-boot-arm (2011-06-23 
>> 15:37:33 +0200)
>>
>> are available in the git repository at:
>>
>>git://git.denx.de/u-boot-arm.git master
>>
>> Aneesh V (9):
>>arm: make default implementation of cache_flush() weakly linked
>>armv7: cache maintenance operations for armv7
>>armv7: rename cache related CONFIG flags
>>armv7: integrate cache maintenance support
>>arm: minor fixes for cache and mmu handling
>>armv7: add PL310 support to u-boot
>>armv7: adapt omap4 to the new cache maintenance framework
>>armv7: adapt omap3 to the new cache maintenance framework
>>armv7: adapt s5pc1xx to the new cache maintenance framework
> Can these two also be added for 2011.06:
>
> OMAP[34]: fix broken timer:
> http://patchwork.ozlabs.org/patch/76803/
>
> arm: omap2: apollon: fix broken build:
> http://patchwork.ozlabs.org/patch/101877/
>
> ?

Errr, I've just seen 2011.06 already released a couple of hours ago...
I guess it is too late now...

Still, I would be glad if those get into this merge window...

Thanks anyway

-- 
Regards,
Igor.

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Pull request: u-boot-arm/master

2011-06-28 Thread Igor Grinberg
Hi Albert,



On 06/28/11 08:39, Albert ARIBAUD wrote:

> Hi Wolfgang,
>
> The following changes since commit 9623c158f6a5150a21c25026bfba79e7ff7912f5:
>
>Merge branch 'master' of git://git.denx.de/u-boot-arm (2011-06-23 
> 15:37:33 +0200)
>
> are available in the git repository at:
>
>git://git.denx.de/u-boot-arm.git master
>
> Aneesh V (9):
>arm: make default implementation of cache_flush() weakly linked
>armv7: cache maintenance operations for armv7
>armv7: rename cache related CONFIG flags
>armv7: integrate cache maintenance support
>arm: minor fixes for cache and mmu handling
>armv7: add PL310 support to u-boot
>armv7: adapt omap4 to the new cache maintenance framework
>armv7: adapt omap3 to the new cache maintenance framework
>armv7: adapt s5pc1xx to the new cache maintenance framework

Can these two also be added for 2011.06:

OMAP[34]: fix broken timer:
http://patchwork.ozlabs.org/patch/76803/

arm: omap2: apollon: fix broken build:
http://patchwork.ozlabs.org/patch/101877/

?

Thanks

-- 
Regards,
Igor.

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH][x86]Minor cleanups

2011-06-28 Thread Graeme Russ
- Make offset into Global Data for Relocation Offset a generated value for
  use in assembler
- Delete unused Global Data offset #defines
- Delete unused sc520 MMCR offset #defines

Signed-off-by: Graeme Russ 
---
 arch/x86/cpu/start.S   |3 ++-
 arch/x86/include/asm/global_data.h |   19 ---
 arch/x86/include/asm/ic/sc520.h|8 
 lib/asm-offsets.c  |3 +++
 4 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index 7ccc076..31de0f8 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 

 .section .text
 .code32
@@ -114,7 +115,7 @@ relocate_code:

/* Setup call address of in-RAM copy of board_init_r() */
movl$board_init_r, %ebp
-   addl(GD_RELOC_OFF * 4)(%edx), %ebp
+   addl(GENERATED_GD_RELOC_OFF)(%edx), %ebp

/* Setup parameters to board_init_r() */
movl%edx, %eax
diff --git a/arch/x86/include/asm/global_data.h 
b/arch/x86/include/asm/global_data.h
index f8a16d6..f977dbe 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -58,25 +58,6 @@ extern gd_t *gd;

 #endif

-/* Word Offsets into Global Data - MUST match struct gd_t */
-#define GD_BD  0
-#define GD_FLAGS   1
-#define GD_BAUDRATE2
-#define GD_HAVE_CONSOLE3
-#define GD_RELOC_OFF   4
-#define GD_LOAD_OFF5
-#define GD_ENV_ADDR6
-#define GD_ENV_VALID   7
-#define GD_CPU_CLK 8
-#define GD_BUS_CLK 9
-#define GD_RELOC_ADDR  10
-#define GD_START_ADDR_SP   11
-#define GD_RAM_SIZE12
-#define GD_RESET_STATUS13
-#define GD_JT  14
-
-#define GD_SIZE15
-
 /*
  * Global Data Flags
  */
diff --git a/arch/x86/include/asm/ic/sc520.h b/arch/x86/include/asm/ic/sc520.h
index 956c1c2..8b5f47c 100644
--- a/arch/x86/include/asm/ic/sc520.h
+++ b/arch/x86/include/asm/ic/sc520.h
@@ -260,14 +260,6 @@ extern sc520_mmcr_t *sc520_mmcr;
 #define SC520_MMCR_BASE0xfffef000

 /* MMCR Addresses (required for assembler code) */
-#define SC520_DRCCTL   (SC520_MMCR_BASE + 0x010)
-#define SC520_DRCTMCTL (SC520_MMCR_BASE + 0x012)
-#define SC520_DRCCFG   (SC520_MMCR_BASE + 0x014)
-#define SC520_DRCBENDADR   (SC520_MMCR_BASE + 0x018)
-#define SC520_ECCCTL   (SC520_MMCR_BASE + 0x020)
-#define SC520_DBCTL(SC520_MMCR_BASE + 0x040)
-#define SC520_ECCINT   (SC520_MMCR_BASE + 0xd18)
-
 #define SC520_PAR0 (SC520_MMCR_BASE + 0x088)
 #define SC520_PAR1 (SC520_PAR0 + (0x04 * 1))
 #define SC520_PAR2 (SC520_PAR0 + (0x04 * 2))
diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index c88f5d4..6ae32dc 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -28,5 +28,8 @@ int main(void)
DEFINE(GENERATED_BD_INFO_SIZE,
(sizeof(struct bd_info) + 15) & ~15);

+   DEFINE(GENERATED_GD_RELOC_OFF,
+   (offsetof(gd_t, reloc_off)));
+
return 0;
 }
--
1.7.5.2.317.g391b14

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Loan Application.

2011-06-28 Thread Loan Team
We loan at 0.2%, Any interested person,irrespective of your country should 
contact us now Via email for more information.

Contact Email: loansolutiontea...@eb2a.com

Regards,
E-Loan Solution Team.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Loan Application.

2011-06-28 Thread Loan Team
We loan at 0.2%, Any interested person,irrespective of your country should 
contact us now Via email for more information.

Contact Email: loansolutiontea...@eb2a.com

Regards,
E-Loan Solution Team.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


<    1   2