Skip to contentSkip to conversation

API Rewrite

PATCH Superseded Graeme Russ 10 participants 110 messages Jun 28, 2011 – Sep 28, 2011 Page 1 of 2

Subsystems (27)
lore
Share & tools
lore
#0 lore raw

cover API Rewrite

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                |   44 ---------------------
 arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c |    8 ++--
 arch/powerpc/cpu/mpc8260/ether_fcc.c       |   12 +++---
 arch/powerpc/lib/board.c                   |    2 -
 arch/powerpc/lib/interrupts.c              |   10 -----
 arch/sh/lib/time.c                         |   12 ------
 arch/sh/lib/time_sh2.c                     |   15 +-------
 arch/sparc/lib/board.c                     |    2 -
 arch/sparc/lib/interrupts.c                |   12 +-----
 arch/x86/lib/board.c                       |    2 -
 arch/x86/lib/timer.c                       |   10 -----
 board/BuS/EB+MCF-EV123/flash.c             |   10 +++--
 board/LEOX/elpt860/flash.c                 |   12 +++---
 board/Marvell/common/flash.c               |   16 ++++----
 board/Marvell/common/intel_flash.c         |   19 ++++-----
 board/RPXClassic/flash.c                   |    8 ++--
 board/RPXlite/flash.c                      |    8 ++--
 board/RPXlite_dw/flash.c                   |    8 ++--
 board/RRvision/flash.c                     |    8 ++--
 board/a3000/flash.c                        |    8 ++--
 board/alaska/flash.c                       |   34 ++++++++--------
 board/altera/common/AMDLV065D.c            |    8 ++--
 board/altera/common/flash.c                |   10 ++--
 board/amcc/common/flash.c                  |   16 ++++----
 board/amcc/taihu/flash.c                   |   16 ++++----
 board/amcc/yucca/flash.c                   |   16 ++++----
 board/amirix/ap1000/flash.c                |    4 +-
 board/armadillo/flash.c                    |    6 ++-
 board/armltd/integrator/timer.c            |   24 ++----------
 board/armltd/vexpress/ca9x4_ct_vxp.c       |    5 --
 board/astro/mcf5373l/mcf5373l.c            |    4 +-
 board/atc/flash.c                          |   22 +++++-----
 board/atmel/at91rm9200dk/flash.c           |   10 +++--
 board/atmel/atstk1000/flash.c              |    2 +-
 board/bmw/flash.c                          |    8 ++--
 board/c2mon/flash.c                        |    8 ++--
 board/cerf250/flash.c                      |   14 +++----
 board/cm4008/flash.c                       |   10 +++--
 board/cm41xx/flash.c                       |   10 +++--
 board/cmc_pu2/flash.c                      |   11 +++--
 board/cmi/flash.c                          |   12 +++---
 board/cobra5272/flash.c                    |   10 +++--
 board/cogent/flash.c                       |   14 +++---
 board/cpc45/flash.c                        |    8 ++--
 board/cpu86/flash.c                        |   16 ++++----
 board/cpu87/flash.c                        |   16 ++++----
 board/cradle/flash.c                       |   10 +++--
 board/cray/L1/flash.c                      |    8 ++--
 board/csb226/flash.c                       |   10 +++--
 board/cu824/flash.c                        |    8 ++--
 board/dave/common/flash.c                  |    8 ++--
 board/dnp1110/flash.c                      |   14 +++----
 board/earthlcd/favr-32-ezkit/flash.c       |    2 +-
 board/eltec/bab7xx/flash.c                 |    8 ++--
 board/eltec/elppc/flash.c                  |    8 ++--
 board/eltec/mhpc/flash.c                   |    8 ++--
 board/emk/common/flash.c                   |   18 ++++----
 board/ep7312/flash.c                       |   10 +++--
 board/ep8260/flash.c                       |    8 ++--
 board/esd/common/flash.c                   |    8 ++--
 board/esd/cpci5200/strataflash.c           |    4 +-
 board/esd/pf5200/flash.c                   |   18 ++++----
 board/esteem192e/flash.c                   |   18 ++++----
 board/etin/debris/flash.c                  |   16 ++++----
 board/etx094/flash.c                       |   12 +++---
 board/evb4510/flash.c                      |    4 +-
 board/evb64260/flash.c                     |    8 ++--
 board/evb64260/intel_flash.c               |   18 ++++-----
 board/fads/flash.c                         |    8 ++--
 board/flagadm/flash.c                      |   22 +++++-----
 board/freescale/m5253demo/flash.c          |   14 +++---
 board/freescale/mpc8260ads/flash.c         |   12 +++---
 board/freescale/mpc8266ads/flash.c         |   12 +++---
 board/funkwerk/vovpn-gw/flash.c            |   16 ++++----
 board/g2000/strataflash.c                  |    4 +-
 board/gcplus/flash.c                       |   14 +++----
 board/gen860t/flash.c                      |   16 ++++----
 board/genietv/flash.c                      |    8 ++--
 board/gw8260/flash.c                       |    8 ++--
 board/hermes/flash.c                       |    8 ++--
 board/hidden_dragon/flash.c                |    8 ++--
 board/hymod/flash.c                        |   10 ++--
 board/icecube/flash.c                      |   18 ++++----
 board/icu862/flash.c                       |    8 ++--
 board/idmr/flash.c                         |   10 +++--
 board/impa7/flash.c                        |   10 +++--
 board/incaip/flash.c                       |   22 +++++-----
 board/innokom/flash.c                      |   10 +++--
 board/ip860/flash.c                        |    8 ++--
 board/iphase4539/flash.c                   |    8 ++--
 board/ivm/flash.c                          |    8 ++--
 board/ixdp425/flash.c                      |   10 +++--
 board/jse/flash.c                          |    8 ++--
 board/kup/common/flash.c                   |   12 +++---
 board/lantec/flash.c                       |    8 ++--
 board/lart/flash.c                         |   10 +++--
 board/linkstation/avr.c                    |   40 ++++++++++----------
 board/lpd7a40x/flash.c                     |   10 +++--
 board/lubbock/flash.c                      |   14 +++----
 board/lwmon/flash.c                        |   10 ++--
 board/mbx8xx/flash.c                       |    8 ++--
 board/modnet50/flash.c                     |   14 ++++---
 board/mpl/common/flash.c                   |   16 ++++----
 board/mpl/mip405/mip405.c                  |   11 ++---
 board/mpl/vcma9/flash.c                    |   10 +++--
 board/musenki/flash.c                      |    8 ++--
 board/mvblue/flash.c                       |    8 ++--
 board/mx1ads/syncflash.c                   |    2 +-
 board/mx1fs2/flash.c                       |   16 ++++----
 board/netphone/flash.c                     |    8 ++--
 board/netta/flash.c                        |    8 ++--
 board/netta2/flash.c                       |    8 ++--
 board/netvia/flash.c                       |    8 ++--
 board/ns9750dev/flash.c                    |   15 +++----
 board/nvidia/common/board.c                |    1 -
 board/nx823/flash.c                        |    8 ++--
 board/o2dnt/flash.c                        |   26 ++++++------
 board/oxc/flash.c                          |    8 ++--
 board/pcippc2/flash.c                      |    8 ++--
 board/pcs440ep/flash.c                     |   12 +++---
 board/pleb2/flash.c                        |   18 ++++----
 board/pm520/flash.c                        |   22 +++++-----
 board/pm826/flash.c                        |    8 ++--
 board/pm828/flash.c                        |    8 ++--
 board/ppmc7xx/flash.c                      |    8 ++--
 board/ppmc8260/strataflash.c               |    4 +-
 board/prodrive/common/flash.c              |   12 +++---
 board/psyent/common/AMDLV065D.c            |    8 ++--
 board/r360mpi/flash.c                      |    8 ++--
 board/rbc823/flash.c                       |    8 ++--
 board/rmu/flash.c                          |    8 ++--
 board/rpxsuper/flash.c                     |    8 ++--
 board/rsdproto/flash.c                     |    8 ++--
 board/sacsng/flash.c                       |    8 ++--
 board/samsung/smdk2400/flash.c             |   10 +++--
 board/sandburst/common/flash.c             |    8 ++--
 board/sandpoint/flash.c                    |    8 ++--
 board/sbc2410x/flash.c                     |   10 +++--
 board/sbc405/strataflash.c                 |    4 +-
 board/sbc8240/flash.c                      |    8 ++--
 board/sbc8260/flash.c                      |    8 ++--
 board/scb9328/flash.c                      |    5 +-
 board/shannon/flash.c                      |   10 +++--
 board/siemens/IAD210/flash.c               |    8 ++--
 board/siemens/SCM/flash.c                  |    8 ++--
 board/siemens/SMN42/flash.c                |    8 ++--
 board/sixnet/flash.c                       |   12 +++---
 board/snmc/qs850/flash.c                   |    8 ++--
 board/snmc/qs860t/flash.c                  |   18 ++++----
 board/stx/stxgp3/flash.c                   |   12 +++---
 board/svm_sc8xx/flash.c                    |   16 ++++----
 board/tb0229/flash.c                       |   18 ++++----
 board/ti/omap1610inn/flash.c               |   15 +++----
 board/ti/omap730p2/flash.c                 |   15 +++----
 board/tqc/tqm5200/cam5200_flash.c          |   16 ++++----
 board/trab/cmd_trab.c                      |    6 +-
 board/trab/flash.c                         |   10 +++--
 board/utx8245/flash.c                      |    8 ++--
 board/v37/flash.c                          |   12 +++---
 board/w7o/flash.c                          |   20 +++++-----
 board/w7o/fpga.c                           |   10 ++--
 board/westel/amx860/flash.c                |    8 ++--
 board/xaeniax/flash.c                      |   14 +++----
 board/xm250/flash.c                        |   23 +++++------
 board/zeus/zeus.c                          |    4 +-
 board/zylonite/flash.c                     |   14 +++----
 common/cmd_misc.c                          |    4 +-
 drivers/block/mg_disk.c                    |   10 ++---
 drivers/fpga/ACEX1K.c                      |    5 +-
 drivers/fpga/cyclon2.c                     |    5 +-
 drivers/fpga/spartan2.c                    |   30 +++++++++------
 drivers/fpga/spartan3.c                    |   32 ++++++++++------
 drivers/fpga/virtex2.c                     |   20 ++++++----
 drivers/i2c/bfin-twi_i2c.c                 |    6 +-
 drivers/i2c/spr_i2c.c                      |   28 ++++++++------
 drivers/i2c/u8500_i2c.c                    |    8 ++--
 drivers/input/ps2mult.c                    |    6 +-
 drivers/mmc/omap_hsmmc.c                   |   57 +++++++++++++++-------------
 drivers/mtd/cfi_flash.c                    |   14 +++----
 drivers/mtd/nand/nand_base.c               |   17 ++++----
 drivers/mtd/spi/atmel.c                    |    4 +-
 drivers/mtd/spi/eeprom_m95xxx.c            |    5 +-
 drivers/mtd/spi/spi_flash.c                |    6 +-
 drivers/net/4xx_enet.c                     |    8 +--
 drivers/net/bcm570x.c                      |    2 +-
 drivers/net/cs8900.c                       |   17 ++++----
 drivers/net/dm9000x.c                      |    6 +-
 drivers/net/ethoc.c                        |    6 +-
 drivers/net/fec_mxc.c                      |   18 ++++----
 drivers/net/ftgmac100.c                    |    6 +-
 drivers/net/ftmac100.c                     |    6 +-
 drivers/net/greth.c                        |   16 ++++----
 drivers/net/lan91c96.c                     |    5 +-
 drivers/net/ne2000_base.c                  |    6 +-
 drivers/net/netarm_eth.c                   |   14 ++++--
 drivers/net/ns7520_eth.c                   |    5 +-
 drivers/net/ns9750_eth.c                   |    4 +-
 drivers/net/rtl8139.c                      |    6 +-
 drivers/net/rtl8169.c                      |   26 ++++++-------
 drivers/net/smc91111.c                     |    4 +-
 drivers/serial/serial_clps7111.c           |    6 +-
 drivers/serial/serial_netarm.c             |    4 +-
 drivers/spi/atmel_dataflash_spi.c          |    8 +--
 drivers/usb/gadget/ether.c                 |   25 ++++++------
 drivers/usb/host/ehci-hcd.c                |    8 ++--
 drivers/usb/host/sl811-hcd.c               |    5 +-
 include/common.h                           |   37 ++++++++++--------
 lib/time.c                                 |   26 +++++++++++++
 net/bootp.c                                |    6 +-
 net/net.c                                  |   18 +++-----
 net/sntp.c                                 |    2 +-
 net/tftp.c                                 |    4 +-
 258 files changed, 1238 insertions(+), 1866 deletions(-)

--
1.7.5.2.317.g391b14

#1 lore raw

PATCH 1/16 Fix misuse of ARM *timer_masked() functions outside arch/arm

---
 board/armadillo/flash.c          |    6 ++++--
 board/atmel/at91rm9200dk/flash.c |   10 ++++++----
 board/cerf250/flash.c            |   14 ++++++--------
 board/cm4008/flash.c             |   10 ++++++----
 board/cm41xx/flash.c             |   10 ++++++----
 board/cmc_pu2/flash.c            |   11 ++++++-----
 board/cradle/flash.c             |   10 ++++++----
 board/csb226/flash.c             |   10 ++++++----
 board/dnp1110/flash.c            |   14 ++++++--------
 board/ep7312/flash.c             |   10 ++++++----
 board/gcplus/flash.c             |   14 ++++++--------
 board/impa7/flash.c              |   10 ++++++----
 board/innokom/flash.c            |   10 ++++++----
 board/ixdp425/flash.c            |   10 ++++++----
 board/lart/flash.c               |   10 ++++++----
 board/lpd7a40x/flash.c           |   10 ++++++----
 board/lubbock/flash.c            |   14 ++++++--------
 board/modnet50/flash.c           |   14 ++++++++------
 board/mpl/vcma9/flash.c          |   10 ++++++----
 board/mx1ads/syncflash.c         |    2 +-
 board/ns9750dev/flash.c          |   15 ++++++---------
 board/pleb2/flash.c              |   18 +++++++++---------
 board/samsung/smdk2400/flash.c   |   10 ++++++----
 board/sbc2410x/flash.c           |   10 ++++++----
 board/scb9328/flash.c            |    5 +++--
 board/shannon/flash.c            |   10 ++++++----
 board/ti/omap1610inn/flash.c     |   15 ++++++---------
 board/ti/omap730p2/flash.c       |   15 ++++++---------
 board/trab/cmd_trab.c            |    6 +++---
 board/trab/flash.c               |   10 ++++++----
 board/xaeniax/flash.c            |   14 ++++++--------
 board/xm250/flash.c              |   23 +++++++++++------------
 board/zylonite/flash.c           |   14 ++++++--------
 drivers/mtd/spi/eeprom_m95xxx.c  |    5 +++--
 drivers/net/fec_mxc.c            |    6 +++---
 drivers/net/netarm_eth.c         |   12 +++++++-----
 36 files changed, 208 insertions(+), 189 deletions(-)
board/armadillo/flash.c +4 -2
index cdbbfd0..cf7d7f6 100644
@@ -162,6 +162,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int rc = ERR_OK;
 	unsigned long base;
 	unsigned long addr;
+	ulong start;
 
 	if ((info->flash_id & FLASH_VENDMASK) !=
 	    (FUJ_MANUFACT & FLASH_VENDMASK)) {
@@ -192,7 +193,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	/* Start erase on unprotected sectors */
 	for (sect = s_first; sect <= s_last && !ctrlc (); sect++) {
 		/* ARM simple, non interrupt dependent timer */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 
@@ -232,6 +233,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 {
 	int flag;
 	unsigned long base;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -250,7 +252,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	flag = disable_interrupts ();
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	base = dest & 0xF0000000;
 	FL_WORD (base + (0x555 << 1)) = 0xAA;
board/atmel/at91rm9200dk/flash.c +6 -4
index 902c3c4..be22743 100644
@@ -285,6 +285,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 */
 
@@ -325,7 +326,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			volatile u16 *addr = (volatile u16 *) (info->start[sect]);
@@ -345,7 +346,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 				result = *addr;
 
 				/* check timeout */
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip1 = TMO;
 					break;
@@ -400,6 +401,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
@@ -425,7 +427,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait until flash is ready */
 	chip1 = 0;
@@ -433,7 +435,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 		result = *addr;
 
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			chip1 = ERR | TMO;
 			break;
 		}
board/cerf250/flash.c +6 -8
index a4b201e..e1e7807 100644
@@ -221,7 +221,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -254,9 +254,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -269,14 +266,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -393,6 +390,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -406,11 +404,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/cm4008/flash.c +6 -4
index 2e66872..d6fd519 100644
@@ -209,6 +209,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int flag, prot, sect;
 	ulong type;
 	int rcode = 0;
+	ulong start;
 
 	if ((s_first < 0) || (s_first > s_last)) {
 		if (info->flash_id == FLASH_UNKNOWN) {
@@ -250,7 +251,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 */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			addr = (volatile unsigned char *) (info->start[sect]);
 			*addr = 0x50;	/* clear status register */
@@ -258,7 +259,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;	/* erase confirm */
 
 			while (((status = *addr) & 0x80) != 0x80) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = 0xB0;	/* suspend erase */
@@ -370,6 +371,7 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	volatile unsigned char *addr = (volatile unsigned char *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -384,11 +386,11 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = 0xFF;	/* restore read mode */
 			return (1);
 		}
board/cm41xx/flash.c +6 -4
index 2e66872..d6fd519 100644
@@ -209,6 +209,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int flag, prot, sect;
 	ulong type;
 	int rcode = 0;
+	ulong start;
 
 	if ((s_first < 0) || (s_first > s_last)) {
 		if (info->flash_id == FLASH_UNKNOWN) {
@@ -250,7 +251,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 */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			addr = (volatile unsigned char *) (info->start[sect]);
 			*addr = 0x50;	/* clear status register */
@@ -258,7 +259,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;	/* erase confirm */
 
 			while (((status = *addr) & 0x80) != 0x80) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = 0xB0;	/* suspend erase */
@@ -370,6 +371,7 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	volatile unsigned char *addr = (volatile unsigned char *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -384,11 +386,11 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = 0xFF;	/* restore read mode */
 			return (1);
 		}
board/cmc_pu2/flash.c +6 -5
index d832e62..d10faab 100644
@@ -264,7 +264,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	vu_short *addr = (vu_short *)(info->start[0]);
 	int flag, prot, sect, ssect, l_sect;
-	ulong now, last;
+	ulong now, last, start;
 
 	debug ("flash_erase: first: %d last: %d\n", s_first, s_last);
 
@@ -335,11 +335,11 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 		if (l_sect < 0)
 			goto DONE;
 
-		reset_timer_masked ();
+		start = get_timer(0);
 		last  = 0;
 		addr = (vu_short *)(info->start[l_sect]);
 		while ((addr[0] & 0x0080) != 0x0080) {
-			if ((now = get_timer_masked ()) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+			if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 				printf ("Timeout\n");
 				return 1;
 			}
@@ -434,6 +434,7 @@ static int write_word_amd (flash_info_t *info, vu_short *dest, ushort data)
 {
 	int flag;
 	vu_short *base;		/* first address in flash bank	*/
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*dest & data) != data) {
@@ -455,11 +456,11 @@ static int write_word_amd (flash_info_t *info, vu_short *dest, ushort data)
 	if (flag)
 		enable_interrupts();
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* data polling for D7 */
 	while ((*dest & 0x0080) != (data & 0x0080)) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*dest = 0x00F0;	/* reset bank */
 			return (1);
 		}
board/cradle/flash.c +6 -4
index b5635fb..1601782 100644
@@ -136,6 +136,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -173,7 +174,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_short *addr = (vu_short *) (info->start[sect]);
@@ -182,7 +183,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;	/* erase confirm */
 
 			while ((*addr & 0x80) != 0x80) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0xB0;	/* suspend erase */
 					*addr = 0xFF;	/* reset to read mode */
@@ -221,6 +222,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	vu_short *addr = (vu_short *) dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -246,11 +248,11 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((val = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0xB0;
board/csb226/flash.c +6 -4
index 02ded1c..e103470 100644
@@ -141,6 +141,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -175,7 +176,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 */
-		reset_timer_masked();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) { /* not protected */
 			u32 * volatile addr = (u32 * volatile)(info->start[sect]);
@@ -189,7 +190,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 			*addr = 0x00D000D0;	/* erase confirm */
 
 			while ((*addr & 0x00800080) != 0x00800080) {
-				if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0x00B000B0; /* suspend erase*/
 					*addr = 0x00FF00FF; /* read mode    */
 					rc = ERR_TIMOUT;
@@ -221,6 +222,7 @@ static int write_long (flash_info_t *info, ulong dest, ulong data)
 	u32 * volatile addr = (u32 * volatile)dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* read array command - just for the case... */
 	*addr = 0x00FF00FF;
@@ -247,11 +249,11 @@ static int write_long (flash_info_t *info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while(((val = *addr) & 0x00800080) != 0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0x00B000B0;
board/dnp1110/flash.c +6 -8
index c81abc5..53f89ee 100644
@@ -212,7 +212,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int	flash_erase (flash_info_t *info, int s_first, int s_last)
 {
     int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
     if ((s_first < 0) || (s_first > s_last)) {
@@ -245,9 +245,6 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last  = start;
-
    /* Disable interrupts which might cause a timeout here */
     flag = disable_interrupts();
 
@@ -260,14 +257,14 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 	printf("Erasing sector %2d ... ", sect);
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 			*addr = (FPW)0x00500050;	/* clear status register */
 			*addr = (FPW)0x00200020;	/* erase setup */
 			*addr = (FPW)0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW)0x00800080) != (FPW)0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW)0x00B000B0; /* suspend erase	  */
 					*addr = (FPW)0x00FF00FF; /* reset to read mode */
@@ -385,6 +382,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *)dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -398,11 +396,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW)0x00800080) != (FPW)0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (start = get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW)0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/ep7312/flash.c +6 -4
index 0c2b3ae..2ed9c9a 100644
@@ -119,6 +119,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -156,7 +157,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_short *addr = (vu_short *) (info->start[sect]);
@@ -165,7 +166,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;		/* erase confirm */
 
 			while ((*addr & 0x80) != 0x80) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0xB0;	/* suspend erase */
 					*addr = 0xFF;	/* reset to read mode */
 					rc = ERR_TIMOUT;
@@ -203,6 +204,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	vu_short *addr = (vu_short *) dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -228,11 +230,11 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((val = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0xB0;
board/gcplus/flash.c +6 -8
index 8511582..ab567e8 100644
@@ -225,7 +225,7 @@ int
 flash_erase(flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -258,9 +258,6 @@ flash_erase(flash_info_t * info, int s_first, int s_last)
 		printf("\n");
 	}
 
-	start = get_timer(0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts();
 
@@ -273,7 +270,7 @@ flash_erase(flash_info_t * info, int s_first, int s_last)
 			printf("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
@@ -282,7 +279,7 @@ flash_erase(flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				 *addr) & (FPW) 0x00800080) !=
 			       (FPW) 0x00800080) {
-				if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase         */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -401,6 +398,7 @@ write_data(flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -414,11 +412,11 @@ write_data(flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/impa7/flash.c +6 -4
index d0c5880..6eae428 100644
@@ -128,6 +128,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -165,7 +166,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_long *addr = (vu_long *) (info->start[sect]);
@@ -174,7 +175,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0x00D000D0;	/* erase confirm */
 
 			while ((*addr & 0x00800080) != 0x00800080) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0x00B000B0;	/* suspend erase */
 					*addr = 0x00FF00FF;	/* reset to read mode */
@@ -211,6 +212,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	ulong barf;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -236,14 +238,14 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* read status register command */
 	*addr = 0x00700070;
 
 	/* wait while polling the status register */
 	while ((*addr & 0x00800080) != 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0x00B000B0;
board/innokom/flash.c +6 -4
index 8c95341..ed4b987 100644
@@ -182,6 +182,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -218,7 +219,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 		PRINTK("\n");
 
 		/* arm simple, non interrupt dependent timer */
-		reset_timer_masked();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			u16 * volatile addr = (u16 * volatile)(info->start[sect]);
@@ -235,7 +236,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 
 			while ((*addr & 0x0080) != 0x0080) {
 				PRINTK(".");
-				if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0x00B0; /* suspend erase*/
 					*addr = 0x00FF; /* read mode    */
 					rc = ERR_TIMOUT;
@@ -279,6 +280,7 @@ static int write_word (flash_info_t *info, ulong dest, ushort data)
 	volatile u16 *addr = (u16 *)dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) return ERR_NOT_ERASED;
@@ -302,11 +304,11 @@ static int write_word (flash_info_t *info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while(((val = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			*addr = 0xB0; /* suspend program command */
 			goto outahere;
board/ixdp425/flash.c +6 -4
index f1d9190..5e4e0e7 100644
@@ -218,6 +218,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int flag, prot, sect;
 	ulong type;
 	int rcode = 0;
+	ulong start;
 
 	if ((s_first < 0) || (s_first > s_last)) {
 		if (info->flash_id == FLASH_UNKNOWN) {
@@ -260,7 +261,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 */
-			reset_timer_masked ();
+			start = get_timer(start);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
@@ -269,7 +270,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				 *addr) & (FPW) 0x00800080) !=
 			       (FPW) 0x00800080) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase         */
@@ -388,6 +389,7 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -402,11 +404,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/lart/flash.c +6 -4
index 29a331e..408c884 100644
@@ -250,6 +250,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
     ulong result;
     int iflag, cflag, prot, sect;
     int rc = ERR_OK;
+    ulong start;
 
     /* first look for protection bits */
 
@@ -291,7 +292,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 */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	if (info->protect[sect] == 0)
 	{	/* not protected */
@@ -305,7 +306,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 	    do
 	    {
 		/* check timeout */
-		if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 		{
 		    *addr = PUZZLE_TO_FLASH(CMD_SUSPEND);
 		    result = BIT_TIMEOUT;
@@ -354,6 +355,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     ulong result;
     int rc = ERR_OK;
     int cflag, iflag;
+    ulong start;
 
     /* Check if Flash is (sufficiently) erased
      */
@@ -377,13 +379,13 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     *addr = data;
 
     /* arm simple, non interrupt dependent timer */
-    reset_timer_masked();
+    start = get_timer(0);
 
     /* wait until flash is ready */
     do
     {
 	/* check timeout */
-	if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+	if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 	{
 	    *addr = PUZZLE_TO_FLASH(CMD_SUSPEND);
 	    result = BIT_TIMEOUT;
board/lpd7a40x/flash.c +6 -4
index a3ba75b..f5c0713 100644
@@ -229,6 +229,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	ulong result, result1;
 	int iflag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -284,7 +285,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			sect, info->start[sect]);
 
 		/* arm simple, non interrupt dependent timer */
-		reset_timer_masked();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_long *addr = (vu_long *) (info->start[sect]);
@@ -297,7 +298,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			/* wait until flash is ready */
 			do {
 				/* check timeout */
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = CMD_STATUS_RESET;
 					result = BIT_TIMEOUT;
 					break;
@@ -357,6 +358,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	ulong result;
 	int rc = ERR_OK;
 	int iflag;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -387,12 +389,12 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait until flash is ready */
 	do {
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			*addr = CMD_SUSPEND;
 			result = BIT_TIMEOUT;
 			break;
board/lubbock/flash.c +6 -8
index a4b201e..1ea2893 100644
@@ -221,7 +221,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -254,9 +254,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -269,14 +266,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -393,6 +390,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -406,11 +404,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start)) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/modnet50/flash.c +8 -6
index 4c31143..4834e21 100644
@@ -291,6 +291,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, sect, setup_offset = 0;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN) {
 		printf ("- missing\n");
@@ -338,14 +339,14 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 						(__u16) SECERASE_CMD;
 
 					/* wait some time */
-					reset_timer_masked ();
-					while (get_timer_masked () < 1000) {
+					start = get_timer(0);
+					while (get_timer(start) < 1000) {
 					}
 
 					/* arm simple, non interrupt dependent timer */
-					reset_timer_masked ();
+					start = get_timer(0);
 					while (flash_check_erase_amd (info->start[sect])) {
-						if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+						if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 							printf ("timeout!\n");
 							/* OOPS: reach timeout,
 							 * try to reset chip
@@ -411,6 +412,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 {
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*(__u16 *) (dest) & data) != data)
@@ -446,10 +448,10 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	}
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	while (flash_check_write_amd (dest)) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			printf ("timeout! @ %08lX\n", dest);
 			/* OOPS: reach timeout,
 			 *       try to reset chip */
board/mpl/vcma9/flash.c +6 -4
index 7abf9cf..5d49204 100644
@@ -175,6 +175,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int iflag, cflag, prot, sect;
 	int rc = ERR_OK;
 	int chip;
+	ulong start;
 
 	/* first look for protection bits */
 
@@ -215,7 +216,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_short *addr = (vu_short *) (info->start[sect]);
@@ -235,7 +236,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 				result = *addr;
 
 				/* check timeout */
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip = TMO;
@@ -297,6 +298,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 	int rc = ERR_OK;
 	int cflag, iflag;
 	int chip;
+	ulong start;
 
 	/*
 	 * Check if Flash is (sufficiently) erased
@@ -323,7 +325,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait until flash is ready */
 	chip = 0;
@@ -331,7 +333,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 		result = *addr;
 
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			chip = ERR | TMO;
 			break;
 		}
board/mx1ads/syncflash.c +1 -1
index 47f613c..7331efa 100644
@@ -276,7 +276,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) {
 
 /* arm simple, non interrupt dependent timer */
 
-		reset_timer_masked();
+		get_timer(0);
 
 		SF_NvmodeErase();
 		SF_NvmodeWrite();
board/ns9750dev/flash.c +6 -9
index 5b56b98..185bc2d 100644
@@ -261,7 +261,7 @@ void flash_unprotect_sectors (FPWV * addr)
 int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -294,10 +294,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -312,7 +308,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			flash_unprotect_sectors (addr);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;/* clear status register */
 			*addr = (FPW) 0x00200020;/* erase setup */
@@ -321,7 +317,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				*addr) & (FPW) 0x00800080) !=
 				(FPW) 0x00800080) {
-					if (get_timer_masked () >
+					if (get_timer(start) >
 					CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					/* suspend erase     */
@@ -441,6 +437,7 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -454,11 +451,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/pleb2/flash.c +9 -9
index a8897dc..2406c5f 100644
@@ -472,7 +472,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	FPWV *addr;
 	int flag, prot, sect;
 	int intel = (info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL;
-	ulong now, last;
+	ulong start, now, last;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -516,8 +516,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	reset_timer_masked ();
-
 	/* Start erase on unprotected sectors */
 	for (sect = s_first; sect <= s_last && rcode == 0; sect++) {
 
@@ -527,7 +525,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		/* Disable interrupts which might cause a timeout here */
 		flag = disable_interrupts ();
 
-		reset_timer_masked ();
+		start = get_timer(0);
 		last = 0;
 
 		addr = (FPWV *) (info->start[sect]);
@@ -559,7 +557,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 
 		while ((*addr & (FPW) 0x00800080) != (FPW) 0x00800080) {
 			if ((now =
-			     get_timer_masked ()) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+			     get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 				printf ("Timeout\n");
 
 				if (intel) {
@@ -661,6 +659,7 @@ static int write_word_amd (flash_info_t * info, FPWV * dest, FPW data)
 	int flag;
 	int res = 0;		/* result, assume success       */
 	FPWV *base;		/* first address in flash bank  */
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*dest & data) != data) {
@@ -683,12 +682,12 @@ static int write_word_amd (flash_info_t * info, FPWV * dest, FPW data)
 	if (flag)
 		enable_interrupts ();
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* data polling for D7 */
 	while (res == 0
 	       && (*dest & (FPW) 0x00800080) != (data & (FPW) 0x00800080)) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*dest = (FPW) 0x00F000F0;	/* reset bank */
 			res = 1;
 		}
@@ -711,6 +710,7 @@ static int write_word_intel (flash_info_t * info, FPWV * dest, FPW data)
 {
 	int flag;
 	int res = 0;		/* result, assume success       */
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*dest & data) != data) {
@@ -730,10 +730,10 @@ static int write_word_intel (flash_info_t * info, FPWV * dest, FPW data)
 	if (flag)
 		enable_interrupts ();
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	while (res == 0 && (*dest & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*dest = (FPW) 0x00B000B0;	/* Suspend program      */
 			res = 1;
 		}
board/samsung/smdk2400/flash.c +6 -4
index fb69c21..47382fe 100644
@@ -231,6 +231,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	ulong result, result1;
 	int iflag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -286,7 +287,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			sect, info->start[sect]);
 
 		/* arm simple, non interrupt dependent timer */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_long *addr = (vu_long *) (info->start[sect]);
@@ -299,7 +300,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			/* wait until flash is ready */
 			do {
 				/* check timeout */
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = CMD_STATUS_RESET;
 					result = BIT_TIMEOUT;
 					break;
@@ -359,6 +360,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	ulong result;
 	int rc = ERR_OK;
 	int iflag;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -389,12 +391,12 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait until flash is ready */
 	do {
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			*addr = CMD_SUSPEND;
 			result = BIT_TIMEOUT;
 			break;
board/sbc2410x/flash.c +6 -4
index abb0935..d209a6f 100644
@@ -173,6 +173,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int iflag, cflag, prot, sect;
 	int rc = ERR_OK;
 	int chip;
+	ulong start;
 
 	/* first look for protection bits */
 
@@ -213,7 +214,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_short *addr = (vu_short *) (info->start[sect]);
@@ -233,7 +234,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 				result = *addr;
 
 				/* check timeout */
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip = TMO;
@@ -295,6 +296,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 	int rc = ERR_OK;
 	int cflag, iflag;
 	int chip;
+	ulong start;
 
 	/*
 	 * Check if Flash is (sufficiently) erased
@@ -322,7 +324,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	get_timer(start);
 
 	/* wait until flash is ready */
 	chip = 0;
@@ -330,7 +332,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 		result = *addr;
 
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			chip = ERR | TMO;
 			break;
 		}
board/scb9328/flash.c +3 -2
index c6f94ae..00c660a 100644
@@ -97,11 +97,12 @@ static FLASH_BUS_RET flash_status_reg (void)
 static int flash_ready (ulong timeout)
 {
 	int ok = 1;
+	ulong start;
 
-	reset_timer_masked ();
+	start = get_timer(0);
 	while ((flash_status_reg () & FLASH_CMD (CFI_INTEL_SR_READY)) !=
 		   FLASH_CMD (CFI_INTEL_SR_READY)) {
-		if (get_timer_masked () > timeout && timeout != 0) {
+		if (get_timer(start) > timeout && timeout != 0) {
 			ok = 0;
 			break;
 		}
board/shannon/flash.c +6 -4
index 0455afa..179ec5f 100644
@@ -190,6 +190,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, chip2;
+    ulong start;
 
     /* first look for protection bits */
 
@@ -231,7 +232,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 */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	if (info->protect[sect] == 0)
 	{	/* not protected */
@@ -253,7 +254,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 		result = *addr;
 
 		/* check timeout */
-		if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 		{
 		    MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 		    chip1 = TMO;
@@ -322,6 +323,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     int rc = ERR_OK;
     int cflag, iflag;
     int chip1, chip2;
+    ulong start;
 
     /*
      * Check if Flash is (sufficiently) erased
@@ -349,7 +351,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     *addr = data;
 
     /* arm simple, non interrupt dependent timer */
-    reset_timer_masked();
+    start = get_timer(0);
 
     /* wait until flash is ready */
     chip1 = chip2 = 0;
@@ -358,7 +360,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
 	result = *addr;
 
 	/* check timeout */
-	if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+	if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 	{
 	    chip1 = ERR | TMO;
 	    break;
board/ti/omap1610inn/flash.c +6 -9
index 36200ad..1b67d08 100644
@@ -278,7 +278,7 @@ void flash_unprotect_sectors (FPWV * addr)
 int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -311,10 +311,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -329,7 +325,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			flash_unprotect_sectors (addr);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;/* clear status register */
 			*addr = (FPW) 0x00200020;/* erase setup */
@@ -338,7 +334,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				*addr) & (FPW) 0x00800080) !=
 				(FPW) 0x00800080) {
-					if (get_timer_masked () >
+					if (get_timer(start) >
 					CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					/* suspend erase     */
@@ -458,6 +454,7 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -470,11 +467,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/ti/omap730p2/flash.c +6 -9
index 5b56b98..185bc2d 100644
@@ -261,7 +261,7 @@ void flash_unprotect_sectors (FPWV * addr)
 int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -294,10 +294,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -312,7 +308,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			flash_unprotect_sectors (addr);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;/* clear status register */
 			*addr = (FPW) 0x00200020;/* erase setup */
@@ -321,7 +317,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				*addr) & (FPW) 0x00800080) !=
 				(FPW) 0x00800080) {
-					if (get_timer_masked () >
+					if (get_timer(start) >
 					CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					/* suspend erase     */
@@ -441,6 +437,7 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -454,11 +451,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/trab/cmd_trab.c +3 -3
index dec3c61..17890d9 100644
@@ -201,7 +201,7 @@ int do_burn_in (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		 * avoid timestamp overflow problem after about 68 minutes of
 		 * udelay() time.
 		 */
-		reset_timer_masked ();
+		get_timer(0);
 		for (i = 0; i < BIF_MAX; i++) {
 
 			/* call test function */
@@ -715,7 +715,7 @@ static void led_blink (void)
 
 	/* blink LED. This function does not return! */
 	while (1) {
-		reset_timer_masked ();
+		get_timer(0);
 		led_set (1);
 		udelay (1000000 / LED_BLINK_FREQ / 2);
 		led_set (0);
@@ -860,7 +860,7 @@ int do_temp_log (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 			 * reset timer to avoid timestamp overflow problem
 			 * after about 68 minutes of udelay() time.
 			 */
-			reset_timer_masked ();
+			get_timer(0);
 			sdelay (delay);
 	}
 
board/trab/flash.c +6 -4
index 4e89c41..bde1f77 100644
@@ -182,6 +182,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int iflag, prot, sect;
 	int rc = ERR_OK;
 	int chip1, chip2;
+	ulong start;
 
 	debug ("flash_erase: s_first %d  s_last %d\n", s_first, s_last);
 
@@ -237,7 +238,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			sect, info->start[sect]);
 
 		/* arm simple, non interrupt dependent timer */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_long *addr = (vu_long *) (info->start[sect]);
@@ -257,7 +258,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 				result = *addr;
 
 				/* check timeout */
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip1 = TMO;
 					break;
@@ -315,6 +316,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	vu_long *addr = (vu_long *) dest;
 	ulong result;
 	int rc = ERR_OK;
+	ulong start;
 
 #if 0
 	int cflag;
@@ -348,7 +350,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start= get_timer(0);
 
 	/* wait until flash is ready */
 	chip1 = chip2 = 0;
@@ -356,7 +358,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 		result = *addr;
 
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			chip1 = ERR | TMO;
 			break;
 		}
board/xaeniax/flash.c +6 -8
index b051c89..6cb0aca 100644
@@ -221,7 +221,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -254,9 +254,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -269,14 +266,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -393,6 +390,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -406,11 +404,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/xm250/flash.c +11 -12
index b02149c..e825aba 100644
@@ -250,7 +250,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -283,9 +283,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -298,14 +295,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -422,6 +419,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -435,11 +433,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
@@ -470,6 +468,7 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
 	int rc = 0;
 	vu_long *addr = (vu_long *)(info->start[sector]);
 	int flag = disable_interrupts();
+	ulong start;
 
 	*addr = INTEL_CLEAR;	/* Clear status register */
 	if (prot) {			/* Set sector lock bit */
@@ -481,10 +480,10 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
 		*addr = INTEL_CONFIRM;	/* clear */
 	}
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	while ((*addr & INTEL_FINISHED) != INTEL_FINISHED) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_UNLOCK_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_UNLOCK_TOUT) {
 			printf("Flash lock bit operation timed out\n");
 			rc = 1;
 			break;
@@ -510,13 +509,13 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
 		{
 			if (info->protect[i])
 			{
-				reset_timer_masked ();
+				start = get_timer(0);
 				addr = (vu_long *)(info->start[i]);
 				*addr = INTEL_LOCKBIT;	/* Sector lock bit */
 				*addr = INTEL_PROTECT;	/* set */
 				while ((*addr & INTEL_FINISHED) != INTEL_FINISHED)
 				{
-					if (get_timer_masked () > CONFIG_SYS_FLASH_UNLOCK_TOUT)
+					if (get_timer(start) > CONFIG_SYS_FLASH_UNLOCK_TOUT)
 					{
 						printf("Flash lock bit operation timed out\n");
 						rc = 1;
board/zylonite/flash.c +6 -8
index 5ba84c6..3ee0ab8 100644
@@ -224,7 +224,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -257,9 +257,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -272,14 +269,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -396,6 +393,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -409,11 +407,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
drivers/mtd/spi/eeprom_m95xxx.c +3 -2
index 632db4e..ef8ed6f 100644
@@ -75,6 +75,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
 {
 	struct spi_slave *slave;
 	char buf[3];
+	ulong start;
 
 	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
 			CONFIG_DEFAULT_SPI_MODE);
@@ -102,7 +103,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
 	if(spi_xfer(slave, len * 8, buffer, NULL, SPI_XFER_END))
 		return -1;
 
-	reset_timer_masked();
+	start = get_timer(0);
 	do {
 		buf[0] = SPI_EEPROM_RDSR;
 		buf[1] = 0;
@@ -111,7 +112,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
 		if (!(buf[1] & 1))
 			break;
 
-	} while (get_timer_masked() < CONFIG_SYS_SPI_WRITE_TOUT);
+	} while (get_timer(start) < CONFIG_SYS_SPI_WRITE_TOUT);
 
 	if (buf[1] & 1)
 		printf ("*** spi_write: Time out while writing!\n");
drivers/net/fec_mxc.c +3 -3
index 4e4cd27..ab90afa 100644
@@ -86,7 +86,7 @@ static int fec_miiphy_read(const char *dev, uint8_t phyAddr, uint8_t regAddr,
 	/*
 	 * wait for the related interrupt
 	 */
-	start = get_timer_masked();
+	start = get_timer(0);
 	while (!(readl(&fec->eth->ievent) & FEC_IEVENT_MII)) {
 		if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
 			printf("Read MDIO failed...\n");
@@ -138,7 +138,7 @@ static int fec_miiphy_write(const char *dev, uint8_t phyAddr, uint8_t regAddr,
 	/*
 	 * wait for the MII interrupt
 	 */
-	start = get_timer_masked();
+	start = get_timer(0);
 	while (!(readl(&fec->eth->ievent) & FEC_IEVENT_MII)) {
 		if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
 			printf("Write MDIO failed...\n");
@@ -189,7 +189,7 @@ static int miiphy_wait_aneg(struct eth_device *dev)
 	/*
 	 * Wait for AN completion
 	 */
-	start = get_timer_masked();
+	start = get_timer(0);
 	do {
 		if (get_timer(start) > (CONFIG_SYS_HZ * 5)) {
 			printf("%s: Autonegotiation timeout\n", dev->name);
drivers/net/netarm_eth.c +7 -5
index c9e324e..f54817e 100644
@@ -81,9 +81,10 @@ static unsigned int na_mii_read (int reg)
 
 static int na_mii_poll_busy (void)
 {
+	ulong start;
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
-	while (get_timer_masked () < NA_MII_POLL_BUSY_DELAY) {
+	start = get_timer(0));
+	while (get_timer(start) < NA_MII_POLL_BUSY_DELAY) {
 		if (!(GET_EADDR (NETARM_ETH_MII_IND) & NETARM_ETH_MIII_BUSY)) {
 			return 1;
 		}
@@ -164,19 +165,20 @@ static unsigned int na_mii_check_speed (void)
 static int reset_eth (void)
 {
 	int pt;
+	ulong start;
 
 	na_get_mac_addr ();
 	pt = na_mii_identify_phy ();
 
 	/* reset the phy */
 	na_mii_write (MII_PHY_CONTROL, 0x8000);
-	reset_timer_masked ();
-	while (get_timer_masked () < NA_MII_NEGOTIATE_DELAY) {
+	start = get_timer(0);
+	while (get_timer(start) < NA_MII_NEGOTIATE_DELAY) {
 		if ((na_mii_read (MII_PHY_STATUS) & 0x8000) == 0) {
 			break;
 		}
 	}
-	if (get_timer_masked () >= NA_MII_NEGOTIATE_DELAY)
+	if (get_timer(start) >= NA_MII_NEGOTIATE_DELAY)
 		printf ("phy reset timeout\n");
 
 	/* set the PCS reg */

--
1.7.5.2.317.g391b14

#2 lore raw

PATCH 1/16 Fix misuse of ARM *timer_masked() functions outside arch/arm

Dear Graeme Russ,

Am 28.06.2011 13:40, schrieb Graeme Russ:

Quoted 3 lines

---

..

Quoted 1 line
 board/atmel/at91rm9200dk/flash.c |   10 ++++++----

don't mind at91rm9200dk, it uses deprecated arm920t/at91rm9200 api and will therefore removed in this merge window.

regards

Andreas Bie?mann

#3 lore raw

PATCH 1/16 Fix misuse of ARM *timer_masked() functions outside arch/arm

In reply to Graeme Russ

Dear Graeme Russ,

Quoted 2 lines · In message <[email protected]> you wrote:

I consider this a bug fix, independent from the other dicussion. This should be applied in any case.

Best regards,

Wolfgang Denk

Signature · 4 lines
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: wd at denx.de
"We don't care.  We don't have to.  We're the Phone Company."
#4 lore raw

PATCH 1/16 Fix misuse of ARM *timer_masked() functions outside arch/arm

Hi Wolfgang,

Le 11/07/2011 23:57, Wolfgang Denk a ?crit :

Quoted 6 lines

Dear Graeme Russ,

Quoted 2 lines · In message<[email protected]> you wrote:
Quoted 8 lines

I consider this a bug fix, independent from the other dicussion. This should be applied in any case.

Best regards,

Wolfgang Denk

Patch applies on u-boot-arm/master except for 4 files which are not found:

board/ixdp425/flash.c, removed by commit 973af335e61eede3578371330abd3971805887f5, "update/fix IXDP425 / IXDPG425 boards"

board/mpl/vcma9/flash.c: removed by commit 6d754843ff62312999a265162c67588913cab991, "VCMA9: use CFI driver (and remove the old one)"

board/trab/cmd_trab.c and board/trab/flash.c: removed by commit 566e5cf451ae7e33e31bb62ae5b9b258e33f8609, "ARM: drop unsupported 'trab' board"

If this is fine with everyone, I can pull this patch in u-boot-arm/master despite the four errors.

Amicalement,

Signature · 1 line
Albert.
#5 lore raw

PATCH 1/16 Fix misuse of ARM *timer_masked() functions outside arch/arm

Dear Albert ARIBAUD,

Quoted 11 lines · In message <[email protected]> you wrote:

Patch applies on u-boot-arm/master except for 4 files which are not found:

board/ixdp425/flash.c, removed by commit 973af335e61eede3578371330abd3971805887f5, "update/fix IXDP425 / IXDPG425 boards"

board/mpl/vcma9/flash.c: removed by commit 6d754843ff62312999a265162c67588913cab991, "VCMA9: use CFI driver (and remove the old one)"

Quoted 6 lines

board/trab/cmd_trab.c and board/trab/flash.c: removed by commit 566e5cf451ae7e33e31bb62ae5b9b258e33f8609, "ARM: drop unsupported 'trab' board"

If this is fine with everyone, I can pull this patch in u-boot-arm/master despite the four errors.

Please do. These files were all correctly removed recently.

Best regards,

Wolfgang Denk

Signature · 5 lines
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: wd at denx.de
In the bathtub of history the truth is harder to hold than the  soap,
and much more difficult to find ...     - Terry Pratchett, _Sourcery_
#6 lore raw

PATCH 1/16 Fix misuse of ARM *timer_masked() functions outside arch/arm

Hi Wolfgang,

Quoted 14 lines · Wolfgang Denk

Dear Albert ARIBAUD,

Quoted 11 lines · In message <[email protected]> you wrote:

Patch applies on u-boot-arm/master except for 4 files which are not found:

board/ixdp425/flash.c, removed by commit 973af335e61eede3578371330abd3971805887f5, "update/fix IXDP425 / IXDPG425 boards"

board/mpl/vcma9/flash.c: removed by commit 6d754843ff62312999a265162c67588913cab991, "VCMA9: use CFI driver (and remove the old one)"

Quoted 8 lines
Quoted 6 lines

board/trab/cmd_trab.c and board/trab/flash.c: removed by commit 566e5cf451ae7e33e31bb62ae5b9b258e33f8609, "ARM: drop unsupported 'trab' board"

If this is fine with everyone, I can pull this patch in u-boot-arm/master despite the four errors.

Please do. These files were all correctly removed recently.

I'm OK with this, but I'm about to rebase - After that, I will rename the series, truncate it to only include the ack'd patches, rev them to V2, set their respective in-reply-to to the WIP patches and set the remainder to RFC in patchwork

So I could either:
- Send a revised version as a separate patch for ARM and remove it from
the series
- Include it in the truncated series
- Remove it from the series and let Albert process it as is

Which do you prefer?

Regards,

Graeme

#7 lore raw

PATCH 1/16 Fix misuse of ARM *timer_masked() functions outside arch/arm

Dear Graeme Russ,

Quoted 8 lines · In message <[email protected]> you wrote:

So I could either:
- Send a revised version as a separate patch for ARM and remove it from
the series
- Include it in the truncated series
- Remove it from the series and let Albert process it as is

Which do you prefer?

I'm fine with each of these - I just like to see this go in :-)

Best regards,

Wolfgang Denk

Signature · 4 lines
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: wd at denx.de
C++ is the best example of second-system effect since OS/360.
#8 lore raw

PATCH 1/16 Fix misuse of ARM *timer_masked() functions outside arch/arm

Hi Wolfgang,

Quoted 10 lines · Wolfgang Denk

Dear Graeme Russ,

Quoted 7 lines · In message <[email protected]> you wrote:

So I could either:
- Send a revised version as a separate patch for ARM and remove it from
the series
- Include it in the truncated series
- Remove it from the series and let Albert process it as is

Quoted 3 lines
Quoted 1 line

Which do you prefer?

I'm fine with each of these - I just like to see this go in :-)

OK, I'll go with option #2 and rename the series 'Simplify Timer API'. I'll post this in the next day or two (hopefully tonight)

This will get the existing Timer API into a state where I can proceed with the outcome of our latest round of discussion.

Regards,

Graeme

#9 lore raw

PATCH v2 1/7 Timer: Fix misuse of ARM *timer_masked() functions outside arch/arm

In reply to Graeme Russ

---
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

 board/armadillo/flash.c          |    6 ++++--
 board/atmel/at91rm9200dk/flash.c |   10 ++++++----
 board/cerf250/flash.c            |   14 ++++++--------
 board/cm4008/flash.c             |   10 ++++++----
 board/cm41xx/flash.c             |   10 ++++++----
 board/cmc_pu2/flash.c            |   11 ++++++-----
 board/cradle/flash.c             |   10 ++++++----
 board/csb226/flash.c             |   10 ++++++----
 board/dnp1110/flash.c            |   14 ++++++--------
 board/ep7312/flash.c             |   10 ++++++----
 board/gcplus/flash.c             |   14 ++++++--------
 board/impa7/flash.c              |   10 ++++++----
 board/innokom/flash.c            |   10 ++++++----
 board/lart/flash.c               |   10 ++++++----
 board/lpd7a40x/flash.c           |   10 ++++++----
 board/lubbock/flash.c            |   14 ++++++--------
 board/modnet50/flash.c           |   14 ++++++++------
 board/mx1ads/syncflash.c         |    2 +-
 board/ns9750dev/flash.c          |   15 ++++++---------
 board/pleb2/flash.c              |   18 +++++++++---------
 board/samsung/smdk2400/flash.c   |   10 ++++++----
 board/sbc2410x/flash.c           |   10 ++++++----
 board/scb9328/flash.c            |    5 +++--
 board/shannon/flash.c            |   10 ++++++----
 board/ti/omap1610inn/flash.c     |   15 ++++++---------
 board/ti/omap730p2/flash.c       |   15 ++++++---------
 board/xaeniax/flash.c            |   14 ++++++--------
 board/xm250/flash.c              |   23 +++++++++++------------
 board/zylonite/flash.c           |   14 ++++++--------
 drivers/mtd/spi/eeprom_m95xxx.c  |    5 +++--
 drivers/net/fec_mxc.c            |    6 +++---
 drivers/net/netarm_eth.c         |   12 +++++++-----
 32 files changed, 187 insertions(+), 174 deletions(-)
board/armadillo/flash.c +4 -2
index cdbbfd0..cf7d7f6 100644
@@ -162,6 +162,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int rc = ERR_OK;
 	unsigned long base;
 	unsigned long addr;
+	ulong start;
 
 	if ((info->flash_id & FLASH_VENDMASK) !=
 	    (FUJ_MANUFACT & FLASH_VENDMASK)) {
@@ -192,7 +193,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	/* Start erase on unprotected sectors */
 	for (sect = s_first; sect <= s_last && !ctrlc (); sect++) {
 		/* ARM simple, non interrupt dependent timer */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 
@@ -232,6 +233,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 {
 	int flag;
 	unsigned long base;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -250,7 +252,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	flag = disable_interrupts ();
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	base = dest & 0xF0000000;
 	FL_WORD (base + (0x555 << 1)) = 0xAA;
board/atmel/at91rm9200dk/flash.c +6 -4
index 902c3c4..be22743 100644
@@ -285,6 +285,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 */
 
@@ -325,7 +326,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			volatile u16 *addr = (volatile u16 *) (info->start[sect]);
@@ -345,7 +346,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 				result = *addr;
 
 				/* check timeout */
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip1 = TMO;
 					break;
@@ -400,6 +401,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
@@ -425,7 +427,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait until flash is ready */
 	chip1 = 0;
@@ -433,7 +435,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 		result = *addr;
 
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			chip1 = ERR | TMO;
 			break;
 		}
board/cerf250/flash.c +6 -8
index a4b201e..e1e7807 100644
@@ -221,7 +221,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -254,9 +254,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -269,14 +266,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -393,6 +390,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -406,11 +404,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/cm4008/flash.c +6 -4
index 2e66872..d6fd519 100644
@@ -209,6 +209,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int flag, prot, sect;
 	ulong type;
 	int rcode = 0;
+	ulong start;
 
 	if ((s_first < 0) || (s_first > s_last)) {
 		if (info->flash_id == FLASH_UNKNOWN) {
@@ -250,7 +251,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 */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			addr = (volatile unsigned char *) (info->start[sect]);
 			*addr = 0x50;	/* clear status register */
@@ -258,7 +259,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;	/* erase confirm */
 
 			while (((status = *addr) & 0x80) != 0x80) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = 0xB0;	/* suspend erase */
@@ -370,6 +371,7 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	volatile unsigned char *addr = (volatile unsigned char *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -384,11 +386,11 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = 0xFF;	/* restore read mode */
 			return (1);
 		}
board/cm41xx/flash.c +6 -4
index 2e66872..d6fd519 100644
@@ -209,6 +209,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int flag, prot, sect;
 	ulong type;
 	int rcode = 0;
+	ulong start;
 
 	if ((s_first < 0) || (s_first > s_last)) {
 		if (info->flash_id == FLASH_UNKNOWN) {
@@ -250,7 +251,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 */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			addr = (volatile unsigned char *) (info->start[sect]);
 			*addr = 0x50;	/* clear status register */
@@ -258,7 +259,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;	/* erase confirm */
 
 			while (((status = *addr) & 0x80) != 0x80) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = 0xB0;	/* suspend erase */
@@ -370,6 +371,7 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	volatile unsigned char *addr = (volatile unsigned char *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -384,11 +386,11 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = 0xFF;	/* restore read mode */
 			return (1);
 		}
board/cmc_pu2/flash.c +6 -5
index d832e62..d10faab 100644
@@ -264,7 +264,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	vu_short *addr = (vu_short *)(info->start[0]);
 	int flag, prot, sect, ssect, l_sect;
-	ulong now, last;
+	ulong now, last, start;
 
 	debug ("flash_erase: first: %d last: %d\n", s_first, s_last);
 
@@ -335,11 +335,11 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 		if (l_sect < 0)
 			goto DONE;
 
-		reset_timer_masked ();
+		start = get_timer(0);
 		last  = 0;
 		addr = (vu_short *)(info->start[l_sect]);
 		while ((addr[0] & 0x0080) != 0x0080) {
-			if ((now = get_timer_masked ()) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+			if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 				printf ("Timeout\n");
 				return 1;
 			}
@@ -434,6 +434,7 @@ static int write_word_amd (flash_info_t *info, vu_short *dest, ushort data)
 {
 	int flag;
 	vu_short *base;		/* first address in flash bank	*/
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*dest & data) != data) {
@@ -455,11 +456,11 @@ static int write_word_amd (flash_info_t *info, vu_short *dest, ushort data)
 	if (flag)
 		enable_interrupts();
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* data polling for D7 */
 	while ((*dest & 0x0080) != (data & 0x0080)) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*dest = 0x00F0;	/* reset bank */
 			return (1);
 		}
board/cradle/flash.c +6 -4
index b5635fb..1601782 100644
@@ -136,6 +136,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -173,7 +174,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_short *addr = (vu_short *) (info->start[sect]);
@@ -182,7 +183,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;	/* erase confirm */
 
 			while ((*addr & 0x80) != 0x80) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0xB0;	/* suspend erase */
 					*addr = 0xFF;	/* reset to read mode */
@@ -221,6 +222,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	vu_short *addr = (vu_short *) dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -246,11 +248,11 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((val = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0xB0;
board/csb226/flash.c +6 -4
index 02ded1c..e103470 100644
@@ -141,6 +141,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -175,7 +176,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 */
-		reset_timer_masked();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) { /* not protected */
 			u32 * volatile addr = (u32 * volatile)(info->start[sect]);
@@ -189,7 +190,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 			*addr = 0x00D000D0;	/* erase confirm */
 
 			while ((*addr & 0x00800080) != 0x00800080) {
-				if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0x00B000B0; /* suspend erase*/
 					*addr = 0x00FF00FF; /* read mode    */
 					rc = ERR_TIMOUT;
@@ -221,6 +222,7 @@ static int write_long (flash_info_t *info, ulong dest, ulong data)
 	u32 * volatile addr = (u32 * volatile)dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* read array command - just for the case... */
 	*addr = 0x00FF00FF;
@@ -247,11 +249,11 @@ static int write_long (flash_info_t *info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while(((val = *addr) & 0x00800080) != 0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0x00B000B0;
board/dnp1110/flash.c +6 -8
index c81abc5..53f89ee 100644
@@ -212,7 +212,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int	flash_erase (flash_info_t *info, int s_first, int s_last)
 {
     int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
     if ((s_first < 0) || (s_first > s_last)) {
@@ -245,9 +245,6 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last  = start;
-
    /* Disable interrupts which might cause a timeout here */
     flag = disable_interrupts();
 
@@ -260,14 +257,14 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 	printf("Erasing sector %2d ... ", sect);
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 			*addr = (FPW)0x00500050;	/* clear status register */
 			*addr = (FPW)0x00200020;	/* erase setup */
 			*addr = (FPW)0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW)0x00800080) != (FPW)0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW)0x00B000B0; /* suspend erase	  */
 					*addr = (FPW)0x00FF00FF; /* reset to read mode */
@@ -385,6 +382,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *)dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -398,11 +396,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW)0x00800080) != (FPW)0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (start = get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW)0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/ep7312/flash.c +6 -4
index 0c2b3ae..2ed9c9a 100644
@@ -119,6 +119,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -156,7 +157,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_short *addr = (vu_short *) (info->start[sect]);
@@ -165,7 +166,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;		/* erase confirm */
 
 			while ((*addr & 0x80) != 0x80) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0xB0;	/* suspend erase */
 					*addr = 0xFF;	/* reset to read mode */
 					rc = ERR_TIMOUT;
@@ -203,6 +204,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	vu_short *addr = (vu_short *) dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -228,11 +230,11 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((val = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0xB0;
board/gcplus/flash.c +6 -8
index 8511582..ab567e8 100644
@@ -225,7 +225,7 @@ int
 flash_erase(flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -258,9 +258,6 @@ flash_erase(flash_info_t * info, int s_first, int s_last)
 		printf("\n");
 	}
 
-	start = get_timer(0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts();
 
@@ -273,7 +270,7 @@ flash_erase(flash_info_t * info, int s_first, int s_last)
 			printf("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
@@ -282,7 +279,7 @@ flash_erase(flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				 *addr) & (FPW) 0x00800080) !=
 			       (FPW) 0x00800080) {
-				if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase         */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -401,6 +398,7 @@ write_data(flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -414,11 +412,11 @@ write_data(flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/impa7/flash.c +6 -4
index d0c5880..6eae428 100644
@@ -128,6 +128,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -165,7 +166,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_long *addr = (vu_long *) (info->start[sect]);
@@ -174,7 +175,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0x00D000D0;	/* erase confirm */
 
 			while ((*addr & 0x00800080) != 0x00800080) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0x00B000B0;	/* suspend erase */
 					*addr = 0x00FF00FF;	/* reset to read mode */
@@ -211,6 +212,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	ulong barf;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -236,14 +238,14 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* read status register command */
 	*addr = 0x00700070;
 
 	/* wait while polling the status register */
 	while ((*addr & 0x00800080) != 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0x00B000B0;
board/innokom/flash.c +6 -4
index 8c95341..ed4b987 100644
@@ -182,6 +182,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -218,7 +219,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 		PRINTK("\n");
 
 		/* arm simple, non interrupt dependent timer */
-		reset_timer_masked();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			u16 * volatile addr = (u16 * volatile)(info->start[sect]);
@@ -235,7 +236,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 
 			while ((*addr & 0x0080) != 0x0080) {
 				PRINTK(".");
-				if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0x00B0; /* suspend erase*/
 					*addr = 0x00FF; /* read mode    */
 					rc = ERR_TIMOUT;
@@ -279,6 +280,7 @@ static int write_word (flash_info_t *info, ulong dest, ushort data)
 	volatile u16 *addr = (u16 *)dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) return ERR_NOT_ERASED;
@@ -302,11 +304,11 @@ static int write_word (flash_info_t *info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while(((val = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			*addr = 0xB0; /* suspend program command */
 			goto outahere;
board/lart/flash.c +6 -4
index 29a331e..408c884 100644
@@ -250,6 +250,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
     ulong result;
     int iflag, cflag, prot, sect;
     int rc = ERR_OK;
+    ulong start;
 
     /* first look for protection bits */
 
@@ -291,7 +292,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 */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	if (info->protect[sect] == 0)
 	{	/* not protected */
@@ -305,7 +306,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 	    do
 	    {
 		/* check timeout */
-		if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 		{
 		    *addr = PUZZLE_TO_FLASH(CMD_SUSPEND);
 		    result = BIT_TIMEOUT;
@@ -354,6 +355,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     ulong result;
     int rc = ERR_OK;
     int cflag, iflag;
+    ulong start;
 
     /* Check if Flash is (sufficiently) erased
      */
@@ -377,13 +379,13 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     *addr = data;
 
     /* arm simple, non interrupt dependent timer */
-    reset_timer_masked();
+    start = get_timer(0);
 
     /* wait until flash is ready */
     do
     {
 	/* check timeout */
-	if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+	if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 	{
 	    *addr = PUZZLE_TO_FLASH(CMD_SUSPEND);
 	    result = BIT_TIMEOUT;
board/lpd7a40x/flash.c +6 -4
index a3ba75b..f5c0713 100644
@@ -229,6 +229,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	ulong result, result1;
 	int iflag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -284,7 +285,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			sect, info->start[sect]);
 
 		/* arm simple, non interrupt dependent timer */
-		reset_timer_masked();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_long *addr = (vu_long *) (info->start[sect]);
@@ -297,7 +298,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			/* wait until flash is ready */
 			do {
 				/* check timeout */
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = CMD_STATUS_RESET;
 					result = BIT_TIMEOUT;
 					break;
@@ -357,6 +358,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	ulong result;
 	int rc = ERR_OK;
 	int iflag;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -387,12 +389,12 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait until flash is ready */
 	do {
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			*addr = CMD_SUSPEND;
 			result = BIT_TIMEOUT;
 			break;
board/lubbock/flash.c +6 -8
index a4b201e..1ea2893 100644
@@ -221,7 +221,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -254,9 +254,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -269,14 +266,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -393,6 +390,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -406,11 +404,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start)) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/modnet50/flash.c +8 -6
index 4c31143..4834e21 100644
@@ -291,6 +291,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, sect, setup_offset = 0;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN) {
 		printf ("- missing\n");
@@ -338,14 +339,14 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 						(__u16) SECERASE_CMD;
 
 					/* wait some time */
-					reset_timer_masked ();
-					while (get_timer_masked () < 1000) {
+					start = get_timer(0);
+					while (get_timer(start) < 1000) {
 					}
 
 					/* arm simple, non interrupt dependent timer */
-					reset_timer_masked ();
+					start = get_timer(0);
 					while (flash_check_erase_amd (info->start[sect])) {
-						if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+						if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 							printf ("timeout!\n");
 							/* OOPS: reach timeout,
 							 * try to reset chip
@@ -411,6 +412,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 {
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*(__u16 *) (dest) & data) != data)
@@ -446,10 +448,10 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	}
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	while (flash_check_write_amd (dest)) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			printf ("timeout! @ %08lX\n", dest);
 			/* OOPS: reach timeout,
 			 *       try to reset chip */
board/mx1ads/syncflash.c +1 -1
index 47f613c..7331efa 100644
@@ -276,7 +276,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) {
 
 /* arm simple, non interrupt dependent timer */
 
-		reset_timer_masked();
+		get_timer(0);
 
 		SF_NvmodeErase();
 		SF_NvmodeWrite();
board/ns9750dev/flash.c +6 -9
index 5b56b98..185bc2d 100644
@@ -261,7 +261,7 @@ void flash_unprotect_sectors (FPWV * addr)
 int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -294,10 +294,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -312,7 +308,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			flash_unprotect_sectors (addr);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;/* clear status register */
 			*addr = (FPW) 0x00200020;/* erase setup */
@@ -321,7 +317,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				*addr) & (FPW) 0x00800080) !=
 				(FPW) 0x00800080) {
-					if (get_timer_masked () >
+					if (get_timer(start) >
 					CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					/* suspend erase     */
@@ -441,6 +437,7 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -454,11 +451,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/pleb2/flash.c +9 -9
index a8897dc..2406c5f 100644
@@ -472,7 +472,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	FPWV *addr;
 	int flag, prot, sect;
 	int intel = (info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL;
-	ulong now, last;
+	ulong start, now, last;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -516,8 +516,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	reset_timer_masked ();
-
 	/* Start erase on unprotected sectors */
 	for (sect = s_first; sect <= s_last && rcode == 0; sect++) {
 
@@ -527,7 +525,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		/* Disable interrupts which might cause a timeout here */
 		flag = disable_interrupts ();
 
-		reset_timer_masked ();
+		start = get_timer(0);
 		last = 0;
 
 		addr = (FPWV *) (info->start[sect]);
@@ -559,7 +557,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 
 		while ((*addr & (FPW) 0x00800080) != (FPW) 0x00800080) {
 			if ((now =
-			     get_timer_masked ()) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+			     get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 				printf ("Timeout\n");
 
 				if (intel) {
@@ -661,6 +659,7 @@ static int write_word_amd (flash_info_t * info, FPWV * dest, FPW data)
 	int flag;
 	int res = 0;		/* result, assume success       */
 	FPWV *base;		/* first address in flash bank  */
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*dest & data) != data) {
@@ -683,12 +682,12 @@ static int write_word_amd (flash_info_t * info, FPWV * dest, FPW data)
 	if (flag)
 		enable_interrupts ();
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* data polling for D7 */
 	while (res == 0
 	       && (*dest & (FPW) 0x00800080) != (data & (FPW) 0x00800080)) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*dest = (FPW) 0x00F000F0;	/* reset bank */
 			res = 1;
 		}
@@ -711,6 +710,7 @@ static int write_word_intel (flash_info_t * info, FPWV * dest, FPW data)
 {
 	int flag;
 	int res = 0;		/* result, assume success       */
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*dest & data) != data) {
@@ -730,10 +730,10 @@ static int write_word_intel (flash_info_t * info, FPWV * dest, FPW data)
 	if (flag)
 		enable_interrupts ();
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	while (res == 0 && (*dest & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*dest = (FPW) 0x00B000B0;	/* Suspend program      */
 			res = 1;
 		}
board/samsung/smdk2400/flash.c +6 -4
index fb69c21..47382fe 100644
@@ -231,6 +231,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	ulong result, result1;
 	int iflag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -286,7 +287,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			sect, info->start[sect]);
 
 		/* arm simple, non interrupt dependent timer */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_long *addr = (vu_long *) (info->start[sect]);
@@ -299,7 +300,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			/* wait until flash is ready */
 			do {
 				/* check timeout */
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = CMD_STATUS_RESET;
 					result = BIT_TIMEOUT;
 					break;
@@ -359,6 +360,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	ulong result;
 	int rc = ERR_OK;
 	int iflag;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -389,12 +391,12 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait until flash is ready */
 	do {
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			*addr = CMD_SUSPEND;
 			result = BIT_TIMEOUT;
 			break;
board/sbc2410x/flash.c +6 -4
index abb0935..d209a6f 100644
@@ -173,6 +173,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int iflag, cflag, prot, sect;
 	int rc = ERR_OK;
 	int chip;
+	ulong start;
 
 	/* first look for protection bits */
 
@@ -213,7 +214,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_short *addr = (vu_short *) (info->start[sect]);
@@ -233,7 +234,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 				result = *addr;
 
 				/* check timeout */
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip = TMO;
@@ -295,6 +296,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 	int rc = ERR_OK;
 	int cflag, iflag;
 	int chip;
+	ulong start;
 
 	/*
 	 * Check if Flash is (sufficiently) erased
@@ -322,7 +324,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	get_timer(start);
 
 	/* wait until flash is ready */
 	chip = 0;
@@ -330,7 +332,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 		result = *addr;
 
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			chip = ERR | TMO;
 			break;
 		}
board/scb9328/flash.c +3 -2
index c6f94ae..00c660a 100644
@@ -97,11 +97,12 @@ static FLASH_BUS_RET flash_status_reg (void)
 static int flash_ready (ulong timeout)
 {
 	int ok = 1;
+	ulong start;
 
-	reset_timer_masked ();
+	start = get_timer(0);
 	while ((flash_status_reg () & FLASH_CMD (CFI_INTEL_SR_READY)) !=
 		   FLASH_CMD (CFI_INTEL_SR_READY)) {
-		if (get_timer_masked () > timeout && timeout != 0) {
+		if (get_timer(start) > timeout && timeout != 0) {
 			ok = 0;
 			break;
 		}
board/shannon/flash.c +6 -4
index 0455afa..179ec5f 100644
@@ -190,6 +190,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, chip2;
+    ulong start;
 
     /* first look for protection bits */
 
@@ -231,7 +232,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 */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	if (info->protect[sect] == 0)
 	{	/* not protected */
@@ -253,7 +254,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 		result = *addr;
 
 		/* check timeout */
-		if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 		{
 		    MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 		    chip1 = TMO;
@@ -322,6 +323,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     int rc = ERR_OK;
     int cflag, iflag;
     int chip1, chip2;
+    ulong start;
 
     /*
      * Check if Flash is (sufficiently) erased
@@ -349,7 +351,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     *addr = data;
 
     /* arm simple, non interrupt dependent timer */
-    reset_timer_masked();
+    start = get_timer(0);
 
     /* wait until flash is ready */
     chip1 = chip2 = 0;
@@ -358,7 +360,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
 	result = *addr;
 
 	/* check timeout */
-	if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+	if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 	{
 	    chip1 = ERR | TMO;
 	    break;
board/ti/omap1610inn/flash.c +6 -9
index 36200ad..1b67d08 100644
@@ -278,7 +278,7 @@ void flash_unprotect_sectors (FPWV * addr)
 int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -311,10 +311,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -329,7 +325,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			flash_unprotect_sectors (addr);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;/* clear status register */
 			*addr = (FPW) 0x00200020;/* erase setup */
@@ -338,7 +334,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				*addr) & (FPW) 0x00800080) !=
 				(FPW) 0x00800080) {
-					if (get_timer_masked () >
+					if (get_timer(start) >
 					CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					/* suspend erase     */
@@ -458,6 +454,7 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -470,11 +467,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/ti/omap730p2/flash.c +6 -9
index 5b56b98..185bc2d 100644
@@ -261,7 +261,7 @@ void flash_unprotect_sectors (FPWV * addr)
 int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -294,10 +294,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -312,7 +308,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			flash_unprotect_sectors (addr);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;/* clear status register */
 			*addr = (FPW) 0x00200020;/* erase setup */
@@ -321,7 +317,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				*addr) & (FPW) 0x00800080) !=
 				(FPW) 0x00800080) {
-					if (get_timer_masked () >
+					if (get_timer(start) >
 					CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					/* suspend erase     */
@@ -441,6 +437,7 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -454,11 +451,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/xaeniax/flash.c +6 -8
index b051c89..6cb0aca 100644
@@ -221,7 +221,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -254,9 +254,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -269,14 +266,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -393,6 +390,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -406,11 +404,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/xm250/flash.c +11 -12
index b02149c..e825aba 100644
@@ -250,7 +250,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -283,9 +283,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -298,14 +295,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -422,6 +419,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -435,11 +433,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
@@ -470,6 +468,7 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
 	int rc = 0;
 	vu_long *addr = (vu_long *)(info->start[sector]);
 	int flag = disable_interrupts();
+	ulong start;
 
 	*addr = INTEL_CLEAR;	/* Clear status register */
 	if (prot) {			/* Set sector lock bit */
@@ -481,10 +480,10 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
 		*addr = INTEL_CONFIRM;	/* clear */
 	}
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	while ((*addr & INTEL_FINISHED) != INTEL_FINISHED) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_UNLOCK_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_UNLOCK_TOUT) {
 			printf("Flash lock bit operation timed out\n");
 			rc = 1;
 			break;
@@ -510,13 +509,13 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
 		{
 			if (info->protect[i])
 			{
-				reset_timer_masked ();
+				start = get_timer(0);
 				addr = (vu_long *)(info->start[i]);
 				*addr = INTEL_LOCKBIT;	/* Sector lock bit */
 				*addr = INTEL_PROTECT;	/* set */
 				while ((*addr & INTEL_FINISHED) != INTEL_FINISHED)
 				{
-					if (get_timer_masked () > CONFIG_SYS_FLASH_UNLOCK_TOUT)
+					if (get_timer(start) > CONFIG_SYS_FLASH_UNLOCK_TOUT)
 					{
 						printf("Flash lock bit operation timed out\n");
 						rc = 1;
board/zylonite/flash.c +6 -8
index 5ba84c6..3ee0ab8 100644
@@ -224,7 +224,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -257,9 +257,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -272,14 +269,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -396,6 +393,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -409,11 +407,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
drivers/mtd/spi/eeprom_m95xxx.c +3 -2
index 632db4e..ef8ed6f 100644
@@ -75,6 +75,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
 {
 	struct spi_slave *slave;
 	char buf[3];
+	ulong start;
 
 	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
 			CONFIG_DEFAULT_SPI_MODE);
@@ -102,7 +103,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
 	if(spi_xfer(slave, len * 8, buffer, NULL, SPI_XFER_END))
 		return -1;
 
-	reset_timer_masked();
+	start = get_timer(0);
 	do {
 		buf[0] = SPI_EEPROM_RDSR;
 		buf[1] = 0;
@@ -111,7 +112,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
 		if (!(buf[1] & 1))
 			break;
 
-	} while (get_timer_masked() < CONFIG_SYS_SPI_WRITE_TOUT);
+	} while (get_timer(start) < CONFIG_SYS_SPI_WRITE_TOUT);
 
 	if (buf[1] & 1)
 		printf ("*** spi_write: Time out while writing!\n");
drivers/net/fec_mxc.c +3 -3
index 4e4cd27..ab90afa 100644
@@ -86,7 +86,7 @@ static int fec_miiphy_read(const char *dev, uint8_t phyAddr, uint8_t regAddr,
 	/*
 	 * wait for the related interrupt
 	 */
-	start = get_timer_masked();
+	start = get_timer(0);
 	while (!(readl(&fec->eth->ievent) & FEC_IEVENT_MII)) {
 		if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
 			printf("Read MDIO failed...\n");
@@ -138,7 +138,7 @@ static int fec_miiphy_write(const char *dev, uint8_t phyAddr, uint8_t regAddr,
 	/*
 	 * wait for the MII interrupt
 	 */
-	start = get_timer_masked();
+	start = get_timer(0);
 	while (!(readl(&fec->eth->ievent) & FEC_IEVENT_MII)) {
 		if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
 			printf("Write MDIO failed...\n");
@@ -189,7 +189,7 @@ static int miiphy_wait_aneg(struct eth_device *dev)
 	/*
 	 * Wait for AN completion
 	 */
-	start = get_timer_masked();
+	start = get_timer(0);
 	do {
 		if (get_timer(start) > (CONFIG_SYS_HZ * 5)) {
 			printf("%s: Autonegotiation timeout\n", dev->name);
drivers/net/netarm_eth.c +7 -5
index c9e324e..f54817e 100644
@@ -81,9 +81,10 @@ static unsigned int na_mii_read (int reg)
 
 static int na_mii_poll_busy (void)
 {
+	ulong start;
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
-	while (get_timer_masked () < NA_MII_POLL_BUSY_DELAY) {
+	start = get_timer(0));
+	while (get_timer(start) < NA_MII_POLL_BUSY_DELAY) {
 		if (!(GET_EADDR (NETARM_ETH_MII_IND) & NETARM_ETH_MIII_BUSY)) {
 			return 1;
 		}
@@ -164,19 +165,20 @@ static unsigned int na_mii_check_speed (void)
 static int reset_eth (void)
 {
 	int pt;
+	ulong start;
 
 	na_get_mac_addr ();
 	pt = na_mii_identify_phy ();
 
 	/* reset the phy */
 	na_mii_write (MII_PHY_CONTROL, 0x8000);
-	reset_timer_masked ();
-	while (get_timer_masked () < NA_MII_NEGOTIATE_DELAY) {
+	start = get_timer(0);
+	while (get_timer(start) < NA_MII_NEGOTIATE_DELAY) {
 		if ((na_mii_read (MII_PHY_STATUS) & 0x8000) == 0) {
 			break;
 		}
 	}
-	if (get_timer_masked () >= NA_MII_NEGOTIATE_DELAY)
+	if (get_timer(start) >= NA_MII_NEGOTIATE_DELAY)
 		printf ("phy reset timeout\n");
 
 	/* set the PCS reg */

--
1.7.5.2.317.g391b14

#10 lore raw

PATCH v2 1/7 Timer: Fix misuse of ARM *timer_masked() functions outside arch/arm

Hi Greame,

Le 15/07/2011 14:16, Graeme Russ a ?crit :

Quoted 3 lines

---
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

Applied to u-boot-arm/master, thanks!

Amicalement,

Signature · 1 line
Albert.
#11 lore raw

PATCH v2 1/7 Timer: Fix misuse of ARM *timer_masked() functions outside arch/arm

Quoted 8 lines · Albert ARIBAUD

Hi Greame,

Le 15/07/2011 14:16, Graeme Russ a ?crit :

Quoted 3 lines

---
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

Applied to u-boot-arm/master, thanks!

Oops, I forgot my SoB - I was going to repost this series with correct SoB

Regards,

Graeme

#12 lore raw

PATCH v2 1/7 Timer: Fix misuse of ARM *timer_masked() functions outside arch/arm

Le 16/07/2011 10:59, Graeme Russ a ?crit :

Quoted 8 lines · Albert ARIBAUD
Quoted 7 lines

Hi Greame,

Le 15/07/2011 14:16, Graeme Russ a ?crit :

Quoted 3 lines

---
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

Quoted 7 lines
Quoted 1 line

Applied to u-boot-arm/master, thanks!

Oops, I forgot my SoB - I was going to repost this series with correct SoB

Regards,

Graeme

Oops, forgot to check this... Will fix and push -f once you're done.

Amicalement,

Signature · 1 line
Albert.
#13 lore raw

PATCH v3 1/7 Timer: Fix misuse of ARM *timer_masked() functions outside arch/arm

In reply to Graeme Russ

---
Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

 board/armadillo/flash.c          |    6 ++++--
 board/atmel/at91rm9200dk/flash.c |   10 ++++++----
 board/cerf250/flash.c            |   14 ++++++--------
 board/cm4008/flash.c             |   10 ++++++----
 board/cm41xx/flash.c             |   10 ++++++----
 board/cmc_pu2/flash.c            |   11 ++++++-----
 board/cradle/flash.c             |   10 ++++++----
 board/csb226/flash.c             |   10 ++++++----
 board/dnp1110/flash.c            |   14 ++++++--------
 board/ep7312/flash.c             |   10 ++++++----
 board/gcplus/flash.c             |   14 ++++++--------
 board/impa7/flash.c              |   10 ++++++----
 board/innokom/flash.c            |   10 ++++++----
 board/lart/flash.c               |   10 ++++++----
 board/lpd7a40x/flash.c           |   10 ++++++----
 board/lubbock/flash.c            |   14 ++++++--------
 board/modnet50/flash.c           |   14 ++++++++------
 board/mx1ads/syncflash.c         |    2 +-
 board/ns9750dev/flash.c          |   15 ++++++---------
 board/pleb2/flash.c              |   18 +++++++++---------
 board/samsung/smdk2400/flash.c   |   10 ++++++----
 board/sbc2410x/flash.c           |   10 ++++++----
 board/scb9328/flash.c            |    5 +++--
 board/shannon/flash.c            |   10 ++++++----
 board/ti/omap1610inn/flash.c     |   15 ++++++---------
 board/ti/omap730p2/flash.c       |   15 ++++++---------
 board/xaeniax/flash.c            |   14 ++++++--------
 board/xm250/flash.c              |   23 +++++++++++------------
 board/zylonite/flash.c           |   14 ++++++--------
 drivers/mtd/spi/eeprom_m95xxx.c  |    5 +++--
 drivers/net/fec_mxc.c            |    6 +++---
 drivers/net/netarm_eth.c         |   12 +++++++-----
 32 files changed, 187 insertions(+), 174 deletions(-)
board/armadillo/flash.c +4 -2
index cdbbfd0..cf7d7f6 100644
@@ -162,6 +162,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int rc = ERR_OK;
 	unsigned long base;
 	unsigned long addr;
+	ulong start;
 
 	if ((info->flash_id & FLASH_VENDMASK) !=
 	    (FUJ_MANUFACT & FLASH_VENDMASK)) {
@@ -192,7 +193,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	/* Start erase on unprotected sectors */
 	for (sect = s_first; sect <= s_last && !ctrlc (); sect++) {
 		/* ARM simple, non interrupt dependent timer */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 
@@ -232,6 +233,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 {
 	int flag;
 	unsigned long base;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -250,7 +252,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	flag = disable_interrupts ();
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	base = dest & 0xF0000000;
 	FL_WORD (base + (0x555 << 1)) = 0xAA;
board/atmel/at91rm9200dk/flash.c +6 -4
index 902c3c4..be22743 100644
@@ -285,6 +285,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 */
 
@@ -325,7 +326,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			volatile u16 *addr = (volatile u16 *) (info->start[sect]);
@@ -345,7 +346,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 				result = *addr;
 
 				/* check timeout */
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip1 = TMO;
 					break;
@@ -400,6 +401,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
@@ -425,7 +427,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait until flash is ready */
 	chip1 = 0;
@@ -433,7 +435,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 		result = *addr;
 
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			chip1 = ERR | TMO;
 			break;
 		}
board/cerf250/flash.c +6 -8
index a4b201e..e1e7807 100644
@@ -221,7 +221,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -254,9 +254,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -269,14 +266,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -393,6 +390,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -406,11 +404,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/cm4008/flash.c +6 -4
index 2e66872..d6fd519 100644
@@ -209,6 +209,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int flag, prot, sect;
 	ulong type;
 	int rcode = 0;
+	ulong start;
 
 	if ((s_first < 0) || (s_first > s_last)) {
 		if (info->flash_id == FLASH_UNKNOWN) {
@@ -250,7 +251,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 */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			addr = (volatile unsigned char *) (info->start[sect]);
 			*addr = 0x50;	/* clear status register */
@@ -258,7 +259,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;	/* erase confirm */
 
 			while (((status = *addr) & 0x80) != 0x80) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = 0xB0;	/* suspend erase */
@@ -370,6 +371,7 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	volatile unsigned char *addr = (volatile unsigned char *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -384,11 +386,11 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = 0xFF;	/* restore read mode */
 			return (1);
 		}
board/cm41xx/flash.c +6 -4
index 2e66872..d6fd519 100644
@@ -209,6 +209,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int flag, prot, sect;
 	ulong type;
 	int rcode = 0;
+	ulong start;
 
 	if ((s_first < 0) || (s_first > s_last)) {
 		if (info->flash_id == FLASH_UNKNOWN) {
@@ -250,7 +251,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 */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			addr = (volatile unsigned char *) (info->start[sect]);
 			*addr = 0x50;	/* clear status register */
@@ -258,7 +259,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;	/* erase confirm */
 
 			while (((status = *addr) & 0x80) != 0x80) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = 0xB0;	/* suspend erase */
@@ -370,6 +371,7 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	volatile unsigned char *addr = (volatile unsigned char *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -384,11 +386,11 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = 0xFF;	/* restore read mode */
 			return (1);
 		}
board/cmc_pu2/flash.c +6 -5
index d832e62..d10faab 100644
@@ -264,7 +264,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	vu_short *addr = (vu_short *)(info->start[0]);
 	int flag, prot, sect, ssect, l_sect;
-	ulong now, last;
+	ulong now, last, start;
 
 	debug ("flash_erase: first: %d last: %d\n", s_first, s_last);
 
@@ -335,11 +335,11 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 		if (l_sect < 0)
 			goto DONE;
 
-		reset_timer_masked ();
+		start = get_timer(0);
 		last  = 0;
 		addr = (vu_short *)(info->start[l_sect]);
 		while ((addr[0] & 0x0080) != 0x0080) {
-			if ((now = get_timer_masked ()) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+			if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 				printf ("Timeout\n");
 				return 1;
 			}
@@ -434,6 +434,7 @@ static int write_word_amd (flash_info_t *info, vu_short *dest, ushort data)
 {
 	int flag;
 	vu_short *base;		/* first address in flash bank	*/
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*dest & data) != data) {
@@ -455,11 +456,11 @@ static int write_word_amd (flash_info_t *info, vu_short *dest, ushort data)
 	if (flag)
 		enable_interrupts();
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* data polling for D7 */
 	while ((*dest & 0x0080) != (data & 0x0080)) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*dest = 0x00F0;	/* reset bank */
 			return (1);
 		}
board/cradle/flash.c +6 -4
index b5635fb..1601782 100644
@@ -136,6 +136,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -173,7 +174,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_short *addr = (vu_short *) (info->start[sect]);
@@ -182,7 +183,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;	/* erase confirm */
 
 			while ((*addr & 0x80) != 0x80) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0xB0;	/* suspend erase */
 					*addr = 0xFF;	/* reset to read mode */
@@ -221,6 +222,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	vu_short *addr = (vu_short *) dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -246,11 +248,11 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((val = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0xB0;
board/csb226/flash.c +6 -4
index 02ded1c..e103470 100644
@@ -141,6 +141,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -175,7 +176,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 */
-		reset_timer_masked();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) { /* not protected */
 			u32 * volatile addr = (u32 * volatile)(info->start[sect]);
@@ -189,7 +190,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 			*addr = 0x00D000D0;	/* erase confirm */
 
 			while ((*addr & 0x00800080) != 0x00800080) {
-				if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0x00B000B0; /* suspend erase*/
 					*addr = 0x00FF00FF; /* read mode    */
 					rc = ERR_TIMOUT;
@@ -221,6 +222,7 @@ static int write_long (flash_info_t *info, ulong dest, ulong data)
 	u32 * volatile addr = (u32 * volatile)dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* read array command - just for the case... */
 	*addr = 0x00FF00FF;
@@ -247,11 +249,11 @@ static int write_long (flash_info_t *info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while(((val = *addr) & 0x00800080) != 0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0x00B000B0;
board/dnp1110/flash.c +6 -8
index c81abc5..53f89ee 100644
@@ -212,7 +212,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int	flash_erase (flash_info_t *info, int s_first, int s_last)
 {
     int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
     if ((s_first < 0) || (s_first > s_last)) {
@@ -245,9 +245,6 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last  = start;
-
    /* Disable interrupts which might cause a timeout here */
     flag = disable_interrupts();
 
@@ -260,14 +257,14 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 	printf("Erasing sector %2d ... ", sect);
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 			*addr = (FPW)0x00500050;	/* clear status register */
 			*addr = (FPW)0x00200020;	/* erase setup */
 			*addr = (FPW)0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW)0x00800080) != (FPW)0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW)0x00B000B0; /* suspend erase	  */
 					*addr = (FPW)0x00FF00FF; /* reset to read mode */
@@ -385,6 +382,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *)dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -398,11 +396,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW)0x00800080) != (FPW)0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (start = get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW)0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/ep7312/flash.c +6 -4
index 0c2b3ae..2ed9c9a 100644
@@ -119,6 +119,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -156,7 +157,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_short *addr = (vu_short *) (info->start[sect]);
@@ -165,7 +166,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0xD0;		/* erase confirm */
 
 			while ((*addr & 0x80) != 0x80) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0xB0;	/* suspend erase */
 					*addr = 0xFF;	/* reset to read mode */
 					rc = ERR_TIMOUT;
@@ -203,6 +204,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	vu_short *addr = (vu_short *) dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -228,11 +230,11 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((val = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0xB0;
board/gcplus/flash.c +6 -8
index 8511582..ab567e8 100644
@@ -225,7 +225,7 @@ int
 flash_erase(flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -258,9 +258,6 @@ flash_erase(flash_info_t * info, int s_first, int s_last)
 		printf("\n");
 	}
 
-	start = get_timer(0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts();
 
@@ -273,7 +270,7 @@ flash_erase(flash_info_t * info, int s_first, int s_last)
 			printf("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
@@ -282,7 +279,7 @@ flash_erase(flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				 *addr) & (FPW) 0x00800080) !=
 			       (FPW) 0x00800080) {
-				if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase         */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -401,6 +398,7 @@ write_data(flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -414,11 +412,11 @@ write_data(flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/impa7/flash.c +6 -4
index d0c5880..6eae428 100644
@@ -128,6 +128,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -165,7 +166,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_long *addr = (vu_long *) (info->start[sect]);
@@ -174,7 +175,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			*addr = 0x00D000D0;	/* erase confirm */
 
 			while ((*addr & 0x00800080) != 0x00800080) {
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0x00B000B0;	/* suspend erase */
 					*addr = 0x00FF00FF;	/* reset to read mode */
@@ -211,6 +212,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	ulong barf;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased
 	 */
@@ -236,14 +238,14 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* read status register command */
 	*addr = 0x00700070;
 
 	/* wait while polling the status register */
 	while ((*addr & 0x00800080) != 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			/* suspend program command */
 			*addr = 0x00B000B0;
board/innokom/flash.c +6 -4
index 8c95341..ed4b987 100644
@@ -182,6 +182,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN)
 		return ERR_UNKNOWN_FLASH_TYPE;
@@ -218,7 +219,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 		PRINTK("\n");
 
 		/* arm simple, non interrupt dependent timer */
-		reset_timer_masked();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			u16 * volatile addr = (u16 * volatile)(info->start[sect]);
@@ -235,7 +236,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 
 			while ((*addr & 0x0080) != 0x0080) {
 				PRINTK(".");
-				if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = 0x00B0; /* suspend erase*/
 					*addr = 0x00FF; /* read mode    */
 					rc = ERR_TIMOUT;
@@ -279,6 +280,7 @@ static int write_word (flash_info_t *info, ulong dest, ushort data)
 	volatile u16 *addr = (u16 *)dest, val;
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) return ERR_NOT_ERASED;
@@ -302,11 +304,11 @@ static int write_word (flash_info_t *info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while(((val = *addr) & 0x80) != 0x80) {
-		if (get_timer_masked() > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			rc = ERR_TIMOUT;
 			*addr = 0xB0; /* suspend program command */
 			goto outahere;
board/lart/flash.c +6 -4
index 29a331e..408c884 100644
@@ -250,6 +250,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
     ulong result;
     int iflag, cflag, prot, sect;
     int rc = ERR_OK;
+    ulong start;
 
     /* first look for protection bits */
 
@@ -291,7 +292,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 */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	if (info->protect[sect] == 0)
 	{	/* not protected */
@@ -305,7 +306,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 	    do
 	    {
 		/* check timeout */
-		if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 		{
 		    *addr = PUZZLE_TO_FLASH(CMD_SUSPEND);
 		    result = BIT_TIMEOUT;
@@ -354,6 +355,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     ulong result;
     int rc = ERR_OK;
     int cflag, iflag;
+    ulong start;
 
     /* Check if Flash is (sufficiently) erased
      */
@@ -377,13 +379,13 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     *addr = data;
 
     /* arm simple, non interrupt dependent timer */
-    reset_timer_masked();
+    start = get_timer(0);
 
     /* wait until flash is ready */
     do
     {
 	/* check timeout */
-	if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+	if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 	{
 	    *addr = PUZZLE_TO_FLASH(CMD_SUSPEND);
 	    result = BIT_TIMEOUT;
board/lpd7a40x/flash.c +6 -4
index a3ba75b..f5c0713 100644
@@ -229,6 +229,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	ulong result, result1;
 	int iflag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -284,7 +285,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			sect, info->start[sect]);
 
 		/* arm simple, non interrupt dependent timer */
-		reset_timer_masked();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_long *addr = (vu_long *) (info->start[sect]);
@@ -297,7 +298,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			/* wait until flash is ready */
 			do {
 				/* check timeout */
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = CMD_STATUS_RESET;
 					result = BIT_TIMEOUT;
 					break;
@@ -357,6 +358,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	ulong result;
 	int rc = ERR_OK;
 	int iflag;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -387,12 +389,12 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait until flash is ready */
 	do {
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			*addr = CMD_SUSPEND;
 			result = BIT_TIMEOUT;
 			break;
board/lubbock/flash.c +6 -8
index a4b201e..1ea2893 100644
@@ -221,7 +221,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -254,9 +254,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -269,14 +266,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -393,6 +390,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -406,11 +404,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start)) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/modnet50/flash.c +8 -6
index 4c31143..4834e21 100644
@@ -291,6 +291,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, sect, setup_offset = 0;
 	int rc = ERR_OK;
+	ulong start;
 
 	if (info->flash_id == FLASH_UNKNOWN) {
 		printf ("- missing\n");
@@ -338,14 +339,14 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 						(__u16) SECERASE_CMD;
 
 					/* wait some time */
-					reset_timer_masked ();
-					while (get_timer_masked () < 1000) {
+					start = get_timer(0);
+					while (get_timer(start) < 1000) {
 					}
 
 					/* arm simple, non interrupt dependent timer */
-					reset_timer_masked ();
+					start = get_timer(0);
 					while (flash_check_erase_amd (info->start[sect])) {
-						if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+						if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 							printf ("timeout!\n");
 							/* OOPS: reach timeout,
 							 * try to reset chip
@@ -411,6 +412,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 {
 	int rc = ERR_OK;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*(__u16 *) (dest) & data) != data)
@@ -446,10 +448,10 @@ static int write_word (flash_info_t * info, ulong dest, ushort data)
 	}
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	while (flash_check_write_amd (dest)) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			printf ("timeout! @ %08lX\n", dest);
 			/* OOPS: reach timeout,
 			 *       try to reset chip */
board/mx1ads/syncflash.c +1 -1
index 47f613c..7331efa 100644
@@ -276,7 +276,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) {
 
 /* arm simple, non interrupt dependent timer */
 
-		reset_timer_masked();
+		get_timer(0);
 
 		SF_NvmodeErase();
 		SF_NvmodeWrite();
board/ns9750dev/flash.c +6 -9
index 5b56b98..185bc2d 100644
@@ -261,7 +261,7 @@ void flash_unprotect_sectors (FPWV * addr)
 int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -294,10 +294,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -312,7 +308,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			flash_unprotect_sectors (addr);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;/* clear status register */
 			*addr = (FPW) 0x00200020;/* erase setup */
@@ -321,7 +317,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				*addr) & (FPW) 0x00800080) !=
 				(FPW) 0x00800080) {
-					if (get_timer_masked () >
+					if (get_timer(start) >
 					CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					/* suspend erase     */
@@ -441,6 +437,7 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -454,11 +451,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/pleb2/flash.c +9 -9
index a8897dc..2406c5f 100644
@@ -472,7 +472,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	FPWV *addr;
 	int flag, prot, sect;
 	int intel = (info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL;
-	ulong now, last;
+	ulong start, now, last;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -516,8 +516,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	reset_timer_masked ();
-
 	/* Start erase on unprotected sectors */
 	for (sect = s_first; sect <= s_last && rcode == 0; sect++) {
 
@@ -527,7 +525,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		/* Disable interrupts which might cause a timeout here */
 		flag = disable_interrupts ();
 
-		reset_timer_masked ();
+		start = get_timer(0);
 		last = 0;
 
 		addr = (FPWV *) (info->start[sect]);
@@ -559,7 +557,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 
 		while ((*addr & (FPW) 0x00800080) != (FPW) 0x00800080) {
 			if ((now =
-			     get_timer_masked ()) > CONFIG_SYS_FLASH_ERASE_TOUT) {
+			     get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 				printf ("Timeout\n");
 
 				if (intel) {
@@ -661,6 +659,7 @@ static int write_word_amd (flash_info_t * info, FPWV * dest, FPW data)
 	int flag;
 	int res = 0;		/* result, assume success       */
 	FPWV *base;		/* first address in flash bank  */
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*dest & data) != data) {
@@ -683,12 +682,12 @@ static int write_word_amd (flash_info_t * info, FPWV * dest, FPW data)
 	if (flag)
 		enable_interrupts ();
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* data polling for D7 */
 	while (res == 0
 	       && (*dest & (FPW) 0x00800080) != (data & (FPW) 0x00800080)) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*dest = (FPW) 0x00F000F0;	/* reset bank */
 			res = 1;
 		}
@@ -711,6 +710,7 @@ static int write_word_intel (flash_info_t * info, FPWV * dest, FPW data)
 {
 	int flag;
 	int res = 0;		/* result, assume success       */
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*dest & data) != data) {
@@ -730,10 +730,10 @@ static int write_word_intel (flash_info_t * info, FPWV * dest, FPW data)
 	if (flag)
 		enable_interrupts ();
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	while (res == 0 && (*dest & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*dest = (FPW) 0x00B000B0;	/* Suspend program      */
 			res = 1;
 		}
board/samsung/smdk2400/flash.c +6 -4
index fb69c21..47382fe 100644
@@ -231,6 +231,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	ulong result, result1;
 	int iflag, prot, sect;
 	int rc = ERR_OK;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -286,7 +287,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			sect, info->start[sect]);
 
 		/* arm simple, non interrupt dependent timer */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_long *addr = (vu_long *) (info->start[sect]);
@@ -299,7 +300,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			/* wait until flash is ready */
 			do {
 				/* check timeout */
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					*addr = CMD_STATUS_RESET;
 					result = BIT_TIMEOUT;
 					break;
@@ -359,6 +360,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	ulong result;
 	int rc = ERR_OK;
 	int iflag;
+	ulong start;
 
 #ifdef USE_920T_MMU
 	int cflag;
@@ -389,12 +391,12 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait until flash is ready */
 	do {
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			*addr = CMD_SUSPEND;
 			result = BIT_TIMEOUT;
 			break;
board/sbc2410x/flash.c +6 -4
index abb0935..d209a6f 100644
@@ -173,6 +173,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	int iflag, cflag, prot, sect;
 	int rc = ERR_OK;
 	int chip;
+	ulong start;
 
 	/* first look for protection bits */
 
@@ -213,7 +214,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 */
-		reset_timer_masked ();
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			vu_short *addr = (vu_short *) (info->start[sect]);
@@ -233,7 +234,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 				result = *addr;
 
 				/* check timeout */
-				if (get_timer_masked () >
+				if (get_timer(start) >
 				    CONFIG_SYS_FLASH_ERASE_TOUT) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip = TMO;
@@ -295,6 +296,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 	int rc = ERR_OK;
 	int cflag, iflag;
 	int chip;
+	ulong start;
 
 	/*
 	 * Check if Flash is (sufficiently) erased
@@ -322,7 +324,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	get_timer(start);
 
 	/* wait until flash is ready */
 	chip = 0;
@@ -330,7 +332,7 @@ static int write_hword (flash_info_t * info, ulong dest, ushort data)
 		result = *addr;
 
 		/* check timeout */
-		if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 			chip = ERR | TMO;
 			break;
 		}
board/scb9328/flash.c +3 -2
index c6f94ae..00c660a 100644
@@ -97,11 +97,12 @@ static FLASH_BUS_RET flash_status_reg (void)
 static int flash_ready (ulong timeout)
 {
 	int ok = 1;
+	ulong start;
 
-	reset_timer_masked ();
+	start = get_timer(0);
 	while ((flash_status_reg () & FLASH_CMD (CFI_INTEL_SR_READY)) !=
 		   FLASH_CMD (CFI_INTEL_SR_READY)) {
-		if (get_timer_masked () > timeout && timeout != 0) {
+		if (get_timer(start) > timeout && timeout != 0) {
 			ok = 0;
 			break;
 		}
board/shannon/flash.c +6 -4
index 0455afa..179ec5f 100644
@@ -190,6 +190,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, chip2;
+    ulong start;
 
     /* first look for protection bits */
 
@@ -231,7 +232,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 */
-	reset_timer_masked();
+	start = get_timer(0);
 
 	if (info->protect[sect] == 0)
 	{	/* not protected */
@@ -253,7 +254,7 @@ int	flash_erase (flash_info_t *info, int s_first, int s_last)
 		result = *addr;
 
 		/* check timeout */
-		if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 		{
 		    MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 		    chip1 = TMO;
@@ -322,6 +323,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     int rc = ERR_OK;
     int cflag, iflag;
     int chip1, chip2;
+    ulong start;
 
     /*
      * Check if Flash is (sufficiently) erased
@@ -349,7 +351,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
     *addr = data;
 
     /* arm simple, non interrupt dependent timer */
-    reset_timer_masked();
+    start = get_timer(0);
 
     /* wait until flash is ready */
     chip1 = chip2 = 0;
@@ -358,7 +360,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)
 	result = *addr;
 
 	/* check timeout */
-	if (get_timer_masked() > CONFIG_SYS_FLASH_ERASE_TOUT)
+	if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT)
 	{
 	    chip1 = ERR | TMO;
 	    break;
board/ti/omap1610inn/flash.c +6 -9
index 36200ad..1b67d08 100644
@@ -278,7 +278,7 @@ void flash_unprotect_sectors (FPWV * addr)
 int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -311,10 +311,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -329,7 +325,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			flash_unprotect_sectors (addr);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;/* clear status register */
 			*addr = (FPW) 0x00200020;/* erase setup */
@@ -338,7 +334,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				*addr) & (FPW) 0x00800080) !=
 				(FPW) 0x00800080) {
-					if (get_timer_masked () >
+					if (get_timer(start) >
 					CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					/* suspend erase     */
@@ -458,6 +454,7 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -470,11 +467,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/ti/omap730p2/flash.c +6 -9
index 5b56b98..185bc2d 100644
@@ -261,7 +261,7 @@ void flash_unprotect_sectors (FPWV * addr)
 int flash_erase (flash_info_t * info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -294,10 +294,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -312,7 +308,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			flash_unprotect_sectors (addr);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;/* clear status register */
 			*addr = (FPW) 0x00200020;/* erase setup */
@@ -321,7 +317,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			while (((status =
 				*addr) & (FPW) 0x00800080) !=
 				(FPW) 0x00800080) {
-					if (get_timer_masked () >
+					if (get_timer(start) >
 					CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					/* suspend erase     */
@@ -441,6 +437,7 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -454,11 +451,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/xaeniax/flash.c +6 -8
index b051c89..6cb0aca 100644
@@ -221,7 +221,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -254,9 +254,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -269,14 +266,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -393,6 +390,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -406,11 +404,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
board/xm250/flash.c +11 -12
index b02149c..e825aba 100644
@@ -250,7 +250,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -283,9 +283,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -298,14 +295,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -422,6 +419,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -435,11 +433,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
@@ -470,6 +468,7 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
 	int rc = 0;
 	vu_long *addr = (vu_long *)(info->start[sector]);
 	int flag = disable_interrupts();
+	ulong start;
 
 	*addr = INTEL_CLEAR;	/* Clear status register */
 	if (prot) {			/* Set sector lock bit */
@@ -481,10 +480,10 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
 		*addr = INTEL_CONFIRM;	/* clear */
 	}
 
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	while ((*addr & INTEL_FINISHED) != INTEL_FINISHED) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_UNLOCK_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_UNLOCK_TOUT) {
 			printf("Flash lock bit operation timed out\n");
 			rc = 1;
 			break;
@@ -510,13 +509,13 @@ int flash_real_protect(flash_info_t *info, long sector, int prot)
 		{
 			if (info->protect[i])
 			{
-				reset_timer_masked ();
+				start = get_timer(0);
 				addr = (vu_long *)(info->start[i]);
 				*addr = INTEL_LOCKBIT;	/* Sector lock bit */
 				*addr = INTEL_PROTECT;	/* set */
 				while ((*addr & INTEL_FINISHED) != INTEL_FINISHED)
 				{
-					if (get_timer_masked () > CONFIG_SYS_FLASH_UNLOCK_TOUT)
+					if (get_timer(start) > CONFIG_SYS_FLASH_UNLOCK_TOUT)
 					{
 						printf("Flash lock bit operation timed out\n");
 						rc = 1;
board/zylonite/flash.c +6 -8
index 5ba84c6..3ee0ab8 100644
@@ -224,7 +224,7 @@ static ulong flash_get_size (FPW *addr, flash_info_t *info)
 int flash_erase (flash_info_t *info, int s_first, int s_last)
 {
 	int flag, prot, sect;
-	ulong type, start, last;
+	ulong type, start;
 	int rcode = 0;
 
 	if ((s_first < 0) || (s_first > s_last)) {
@@ -257,9 +257,6 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 		printf ("\n");
 	}
 
-	start = get_timer (0);
-	last = start;
-
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts ();
 
@@ -272,14 +269,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)
 			printf ("Erasing sector %2d ... ", sect);
 
 			/* arm simple, non interrupt dependent timer */
-			reset_timer_masked ();
+			start = get_timer(0);
 
 			*addr = (FPW) 0x00500050;	/* clear status register */
 			*addr = (FPW) 0x00200020;	/* erase setup */
 			*addr = (FPW) 0x00D000D0;	/* erase confirm */
 
 			while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-				if (get_timer_masked () > CONFIG_SYS_FLASH_ERASE_TOUT) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) {
 					printf ("Timeout\n");
 					*addr = (FPW) 0x00B000B0;	/* suspend erase     */
 					*addr = (FPW) 0x00FF00FF;	/* reset to read mode */
@@ -396,6 +393,7 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	FPWV *addr = (FPWV *) dest;
 	ulong status;
 	int flag;
+	ulong start;
 
 	/* Check if Flash is (sufficiently) erased */
 	if ((*addr & data) != data) {
@@ -409,11 +407,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)
 	*addr = data;
 
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
+	start = get_timer(0);
 
 	/* wait while polling the status register */
 	while (((status = *addr) & (FPW) 0x00800080) != (FPW) 0x00800080) {
-		if (get_timer_masked () > CONFIG_SYS_FLASH_WRITE_TOUT) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
 			*addr = (FPW) 0x00FF00FF;	/* restore read mode */
 			return (1);
 		}
drivers/mtd/spi/eeprom_m95xxx.c +3 -2
index 632db4e..ef8ed6f 100644
@@ -75,6 +75,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
 {
 	struct spi_slave *slave;
 	char buf[3];
+	ulong start;
 
 	slave = spi_setup_slave(CONFIG_DEFAULT_SPI_BUS, 1, 1000000,
 			CONFIG_DEFAULT_SPI_MODE);
@@ -102,7 +103,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
 	if(spi_xfer(slave, len * 8, buffer, NULL, SPI_XFER_END))
 		return -1;
 
-	reset_timer_masked();
+	start = get_timer(0);
 	do {
 		buf[0] = SPI_EEPROM_RDSR;
 		buf[1] = 0;
@@ -111,7 +112,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)
 		if (!(buf[1] & 1))
 			break;
 
-	} while (get_timer_masked() < CONFIG_SYS_SPI_WRITE_TOUT);
+	} while (get_timer(start) < CONFIG_SYS_SPI_WRITE_TOUT);
 
 	if (buf[1] & 1)
 		printf ("*** spi_write: Time out while writing!\n");
drivers/net/fec_mxc.c +3 -3
index 4e4cd27..ab90afa 100644
@@ -86,7 +86,7 @@ static int fec_miiphy_read(const char *dev, uint8_t phyAddr, uint8_t regAddr,
 	/*
 	 * wait for the related interrupt
 	 */
-	start = get_timer_masked();
+	start = get_timer(0);
 	while (!(readl(&fec->eth->ievent) & FEC_IEVENT_MII)) {
 		if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
 			printf("Read MDIO failed...\n");
@@ -138,7 +138,7 @@ static int fec_miiphy_write(const char *dev, uint8_t phyAddr, uint8_t regAddr,
 	/*
 	 * wait for the MII interrupt
 	 */
-	start = get_timer_masked();
+	start = get_timer(0);
 	while (!(readl(&fec->eth->ievent) & FEC_IEVENT_MII)) {
 		if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
 			printf("Write MDIO failed...\n");
@@ -189,7 +189,7 @@ static int miiphy_wait_aneg(struct eth_device *dev)
 	/*
 	 * Wait for AN completion
 	 */
-	start = get_timer_masked();
+	start = get_timer(0);
 	do {
 		if (get_timer(start) > (CONFIG_SYS_HZ * 5)) {
 			printf("%s: Autonegotiation timeout\n", dev->name);
drivers/net/netarm_eth.c +7 -5
index c9e324e..f54817e 100644
@@ -81,9 +81,10 @@ static unsigned int na_mii_read (int reg)
 
 static int na_mii_poll_busy (void)
 {
+	ulong start;
 	/* arm simple, non interrupt dependent timer */
-	reset_timer_masked ();
-	while (get_timer_masked () < NA_MII_POLL_BUSY_DELAY) {
+	start = get_timer(0));
+	while (get_timer(start) < NA_MII_POLL_BUSY_DELAY) {
 		if (!(GET_EADDR (NETARM_ETH_MII_IND) & NETARM_ETH_MIII_BUSY)) {
 			return 1;
 		}
@@ -164,19 +165,20 @@ static unsigned int na_mii_check_speed (void)
 static int reset_eth (void)
 {
 	int pt;
+	ulong start;
 
 	na_get_mac_addr ();
 	pt = na_mii_identify_phy ();
 
 	/* reset the phy */
 	na_mii_write (MII_PHY_CONTROL, 0x8000);
-	reset_timer_masked ();
-	while (get_timer_masked () < NA_MII_NEGOTIATE_DELAY) {
+	start = get_timer(0);
+	while (get_timer(start) < NA_MII_NEGOTIATE_DELAY) {
 		if ((na_mii_read (MII_PHY_STATUS) & 0x8000) == 0) {
 			break;
 		}
 	}
-	if (get_timer_masked () >= NA_MII_NEGOTIATE_DELAY)
+	if (get_timer(start) >= NA_MII_NEGOTIATE_DELAY)
 		printf ("phy reset timeout\n");
 
 	/* set the PCS reg */

--
1.7.5.2.317.g391b14

#14 lore raw

PATCH v3 1/7 Timer: Fix misuse of ARM *timer_masked() functions outside arch/arm

Hi Greame,

Le 16/07/2011 11:31, Graeme Russ a ?crit :

Quoted 7 lines

---
Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

Applied tu u-boot-arm/master (forced push), thanks!

Amicalement,

Signature · 1 line
Albert.
#15 lore raw

PATCH 2/16 Remove calls to set_timer outside arch/

In reply to Graeme Russ

There is no need to use set_timer(). Replace with appropriate use of get_timer()

---
 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(-)
board/BuS/EB+MCF-EV123/flash.c +6 -4
index 3c36367..8b7f957 100644
@@ -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)))
board/cobra5272/flash.c +6 -4
index 33c9361..e8f02eb 100644
@@ -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;
 		}
board/idmr/flash.c +6 -4
index 57c9948..9f4ff2b 100644
@@ -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 ... ", sect);
 
 		/* arm simple, non interrupt dependent timer */
-		set_timer (0);
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			volatile u16 *addr =
@@ -191,7 +192,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 * CONFIG_SYS_HZ / 1000) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT * CONFIG_SYS_HZ / 1000) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip1 = TMO;
 					break;
@@ -248,6 +249,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	int rc = ERR_OK;
 	int iflag;
 	int chip1;
+	ulong start;
 
 	/*
 	 * Check if Flash is (sufficiently) erased
@@ -272,7 +274,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;
@@ -280,7 +282,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 * CONFIG_SYS_HZ / 1000) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT * CONFIG_SYS_HZ / 1000) {
 			chip1 = ERR | TMO;
 			break;
 		}

--
1.7.5.2.317.g391b14

#16 lore raw

PATCH 2/16 Remove calls to set_timer outside arch/

Dear Graeme Russ,

Quoted 4 lines · In message <[email protected]> you wrote:

There is no need to use set_timer(). Replace with appropriate use of get_timer()

Best regards,

Wolfgang Denk

Signature · 6 lines
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: wd at denx.de
"He only drinks when he gets depressed." "Why does he get depressed?"
"Sometimes it's because he hasn't had a drink."
                                     - Terry Pratchett, _Men at Arms_
#17 lore raw

PATCH v2 2/7 Timer: Remove calls to set_timer outside arch/

In reply to Graeme Russ

There is no need to use set_timer(). Replace with appropriate use of get_timer()

---
Sorry Wolfgang, but this patch has been through a few versions before it got integrated into the larger Timer API hence the v1->v2->v1 debacle.

checkpatch complains about long lines and brace usage in the board specific flash.c files - They are deprecated and not worth fixing for style

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

Changes since V1:
- Fix typo in commit message
- Add reset_timer() to Nios2 get_timer(0)

Changes since V2
- No longer remove reset_timer()

---
 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(-)
board/BuS/EB+MCF-EV123/flash.c +6 -4
index 3c36367..8b7f957 100644
@@ -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)))
board/cobra5272/flash.c +6 -4
index 33c9361..e8f02eb 100644
@@ -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;
 		}
board/idmr/flash.c +6 -4
index 57c9948..9f4ff2b 100644
@@ -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 ... ", sect);
 
 		/* arm simple, non interrupt dependent timer */
-		set_timer (0);
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			volatile u16 *addr =
@@ -191,7 +192,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 * CONFIG_SYS_HZ / 1000) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT * CONFIG_SYS_HZ / 1000) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip1 = TMO;
 					break;
@@ -248,6 +249,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	int rc = ERR_OK;
 	int iflag;
 	int chip1;
+	ulong start;
 
 	/*
 	 * Check if Flash is (sufficiently) erased
@@ -272,7 +274,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;
@@ -280,7 +282,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 * CONFIG_SYS_HZ / 1000) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT * CONFIG_SYS_HZ / 1000) {
 			chip1 = ERR | TMO;
 			break;
 		}

--
1.7.5.2.317.g391b14

#18 lore raw

PATCH v3 2/7 Timer: Remove calls to set_timer outside arch/

There is no need to use set_timer(). Replace with appropriate use of get_timer()

---
Sorry Wolfgang, but this patch has been through a few versions before it got integrated into the larger Timer API hence the v1->v2->v1 debacle.

checkpatch complains about long lines and brace usage in the board specific flash.c files - They are deprecated and not worth fixing for style

Changes since v2:
- None - Revised to v3 with other patches in series

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

Changes since V1:
- Fix typo in commit message
- Add reset_timer() to Nios2 get_timer(0)

Changes since V2
- No longer remove reset_timer()

---
 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(-)
board/BuS/EB+MCF-EV123/flash.c +6 -4
index 3c36367..8b7f957 100644
@@ -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)))
board/cobra5272/flash.c +6 -4
index 33c9361..e8f02eb 100644
@@ -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;
 		}
board/idmr/flash.c +6 -4
index 57c9948..9f4ff2b 100644
@@ -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 ... ", sect);
 
 		/* arm simple, non interrupt dependent timer */
-		set_timer (0);
+		start = get_timer(0);
 
 		if (info->protect[sect] == 0) {	/* not protected */
 			volatile u16 *addr =
@@ -191,7 +192,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 * CONFIG_SYS_HZ / 1000) {
+				if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT * CONFIG_SYS_HZ / 1000) {
 					MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 					chip1 = TMO;
 					break;
@@ -248,6 +249,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)
 	int rc = ERR_OK;
 	int iflag;
 	int chip1;
+	ulong start;
 
 	/*
 	 * Check if Flash is (sufficiently) erased
@@ -272,7 +274,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;
@@ -280,7 +282,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 * CONFIG_SYS_HZ / 1000) {
+		if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT * CONFIG_SYS_HZ / 1000) {
 			chip1 = ERR | TMO;
 			break;
 		}

--
1.7.5.2.317.g391b14

#19 lore raw

PATCH v3 2/7 Timer: Remove calls to set_timer outside arch/

Dear Graeme Russ,

Quoted 21 lines · In message <[email protected]> you wrote:

There is no need to use set_timer(). Replace with appropriate use of get_timer()

---
Sorry Wolfgang, but this patch has been through a few versions before it got integrated into the larger Timer API hence the v1->v2->v1 debacle.

checkpatch complains about long lines and brace usage in the board specific flash.c files - They are deprecated and not worth fixing for style

Changes since v2:
- None - Revised to v3 with other patches in series

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

Changes since V1:
- Fix typo in commit message
- Add reset_timer() to Nios2 get_timer(0)

Quoted 7 lines

Changes since V2
- No longer remove reset_timer()

---
 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(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
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: wd at denx.de
While most peoples' opinions change, the conviction of their correct-
ness never does.
#20 lore raw

PATCH 3/16 Remove calls to set_timer in arch/

In reply to 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(-)
arch/arm/cpu/arm1136/mx31/timer.c +0 -5
index c4bc3b3..d51acbb 100644
@@ -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)
 {
arch/arm/cpu/arm1136/mx35/timer.c +0 -4
index db1e2c9..6dfb63a 100644
@@ -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.
arch/arm/cpu/arm1136/omap24xx/timer.c +0 -5
index 228ceba..d6267ba 100644
@@ -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)
 {
arch/arm/cpu/arm1176/s3c64xx/timer.c +0 -5
index 9768319..8e54060 100644
@@ -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;
arch/arm/cpu/arm1176/tnetv107x/timer.c +0 -5
index a7a400d..c27375c 100644
@@ -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);
arch/arm/cpu/arm720t/interrupts.c +0 -5
index eb8d425..164ca5d 100644
@@ -219,11 +219,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/arm920t/a320/timer.c +0 -6
index 95cb8fd..b9c83c0 100644
@@ -132,12 +132,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	debug("%s(%lx)\n", __func__, t);
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/arm920t/at91/timer.c +0 -5
index f0ad7d6..a69de57 100644
@@ -83,11 +83,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->tbl = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	udelay_masked(usec);
arch/arm/cpu/arm920t/at91rm9200/timer.c +0 -5
index 9c54bbe..0bcb775 100644
@@ -82,11 +82,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	udelay_masked(usec);
arch/arm/cpu/arm920t/imx/timer.c +0 -5
index b06b518..ff85a41 100644
@@ -62,11 +62,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer (ulong t)
-{
-	/* nop */
-}
-
 void reset_timer_masked (void)
 {
 	TCTL1 &= ~TCTL_TEN;
arch/arm/cpu/arm920t/ks8695/timer.c +0 -5
index 886e370..8e14109 100644
@@ -76,11 +76,6 @@ ulong get_timer(ulong base)
        return (get_timer_masked() - base);
 }
 
-void set_timer(ulong t)
-{
-	timer_ticks = t;
-}
-
 void __udelay(ulong usec)
 {
 	ulong start = get_timer_masked();
arch/arm/cpu/arm920t/s3c24x0/timer.c +0 -5
index 8cf9ff6..22767c5 100644
@@ -94,11 +94,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/arm925t/timer.c +0 -5
index 7dfe2b5..fdaeda5 100644
@@ -75,11 +75,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/armada100/timer.c +0 -5
index 5d911c5..eb49234 100644
@@ -111,11 +111,6 @@ ulong get_timer(ulong base)
 		base);
 }
 
-void set_timer(ulong t)
-{
-	gd->tbu = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	ulong delayticks;
arch/arm/cpu/arm926ejs/kirkwood/timer.c +0 -5
index 3e80329..e890edb 100644
@@ -122,11 +122,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	uint current;
arch/arm/cpu/arm926ejs/mx25/timer.c +0 -5
index 14f0c2d..af26b4c 100644
@@ -170,11 +170,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = time_to_tick(t);
-}
-
 /* delay x useconds AND preserve advance timstamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/mx27/timer.c +0 -5
index 5c1cf01..127e670 100644
@@ -173,11 +173,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = time_to_tick(t);
-}
-
 /* delay x useconds AND preserve advance timstamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/omap/timer.c +0 -5
index 88a0ee6..f2e4deb 100644
@@ -76,11 +76,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/orion5x/timer.c +0 -5
index 9d45260..f691c99 100644
@@ -129,11 +129,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 static inline ulong uboot_cntr_val(void)
 {
 	return readl(CNTMR_VAL_REG(UBOOT_CNTR));
arch/arm/cpu/arm926ejs/pantheon/timer.c +0 -5
index ca7f7f0..b487416 100644
@@ -119,11 +119,6 @@ ulong get_timer(ulong base)
 		base);
 }
 
-void set_timer(ulong t)
-{
-	gd->tbu = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	ulong delayticks;
arch/arm/cpu/arm926ejs/spear/timer.c +0 -5
index 66cf4de..7305abd 100644
@@ -87,11 +87,6 @@ ulong get_timer(ulong base)
 	return (get_timer_masked() / GPT_RESOLUTION) - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/arm926ejs/versatile/timer.c +0 -5
index 2e243b1..0e51a63 100644
@@ -105,11 +105,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/armv7/mx5/timer.c +0 -5
index 1972f64..40ee0be 100644
@@ -99,11 +99,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/armv7/omap-common/timer.c +0 -5
index 9beebb1..5dcd044 100644
@@ -72,11 +72,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->tbl = t;
-}
-
 /* delay x useconds */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/armv7/s5p-common/timer.c +0 -5
index b750d16..0b69f06 100644
@@ -60,11 +60,6 @@ unsigned long get_timer(unsigned long base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(unsigned long t)
-{
-	gd->tbl = t;
-}
-
 /* delay x useconds */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/armv7/tegra2/timer.c +0 -5
index fb061d0..4458de9 100644
@@ -58,11 +58,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->tbl = t;
-}
-
 /* delay x useconds */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/lh7a40x/timer.c +0 -5
index 2691315..6c6277d 100644
@@ -85,11 +85,6 @@ ulong get_timer (ulong base)
 	return (get_timer_masked() - base);
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo,tmp;
arch/arm/cpu/pxa/timer.c +0 -5
index ec950c7..8900a70 100644
@@ -74,11 +74,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	/* nop */
-}
-
 void __udelay (unsigned long usec)
 {
 	udelay_masked (usec);
arch/arm/cpu/s3c44b0/timer.c +0 -5
index 6f1d8f6..d30e1aa 100644
@@ -70,11 +70,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/sa1100/timer.c +0 -5
index 0207501..10ad964 100644
@@ -44,11 +44,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked ();
 }
 
-void set_timer (ulong t)
-{
-	/* nop */
-}
-
 void __udelay (unsigned long usec)
 {
 	udelay_masked (usec);
arch/avr32/cpu/interrupts.c +0 -16
index c6ea435..8406f91 100644
@@ -77,22 +77,6 @@ unsigned long get_timer(unsigned long base)
 	return (unsigned long)(now >> 32) - base;
 }
 
-void set_timer(unsigned long t)
-{
-	unsigned long long ticks = t;
-	unsigned long lo, hi, hi_new;
-
-	ticks = (ticks * get_tbclk()) / CONFIG_SYS_HZ;
-	hi = ticks >> 32;
-	lo = ticks & 0xffffffffUL;
-
-	do {
-		timer_overflow = hi;
-		sysreg_write(COUNT, lo);
-		hi_new = timer_overflow;
-	} while (hi_new != hi);
-}
-
 /*
  * For short delays only. It will overflow after a few seconds.
  */
arch/m68k/cpu/mcf547x_8x/slicetimer.c +0 -4
index 8dc010a..49dba6a 100644
@@ -105,8 +105,4 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
 #endif				/* CONFIG_SLTTMR */
arch/m68k/lib/board.c +0 -2
index 6a892db..945ab66 100644
@@ -574,8 +574,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	udelay (20);
 
-	set_timer (0);
-
 	/* Insert function pointers now that we have relocated the code */
 
 	/* Initialize from environment */
arch/m68k/lib/time.c +2 -14
index 7eaea5e..d10bcc7 100644
@@ -126,10 +126,6 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
 #endif				/* CONFIG_MCFTMR */
 
 #if defined(CONFIG_MCFPIT)
@@ -173,14 +169,6 @@ void timer_init(void)
 	timerp->pcsr |= PIT_PCSR_PRE(CONFIG_SYS_PIT_PRESCALE) | PIT_PCSR_EN;
 }
 
-void set_timer(ulong t)
-{
-	volatile pit_t *timerp = (pit_t *) (CONFIG_SYS_PIT_BASE);
-
-	timestamp = 0;
-	timerp->pmr = lastinc = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	unsigned short now, diff;
@@ -196,8 +184,8 @@ ulong get_timer(ulong base)
 
 void wait_ticks(unsigned long ticks)
 {
-	set_timer(0);
-	while (get_timer(0) < ticks) ;
+	u32 start = get_timer(0);
+	while (get_timer(start) < ticks) ;
 }
 #endif				/* CONFIG_MCFPIT */
 
arch/microblaze/cpu/timer.c +0 -5
index 4936c62..59ed126 100644
@@ -45,11 +45,6 @@ ulong get_timer (ulong base)
 }
 #endif
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 #ifdef CONFIG_SYS_INTC_0
 #ifdef CONFIG_SYS_TIMER_0
 microblaze_timer_t *tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR);
arch/mips/cpu/mips32/time.c +0 -6
index 0e66441..b0a9c1f 100644
@@ -64,12 +64,6 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-	write_c0_compare(read_c0_count() + CYCLES_PER_JIFFY);
-}
-
 void __udelay(unsigned long usec)
 {
 	unsigned int tmo;
arch/nios2/cpu/interrupts.c +0 -6
index 63acfa9..0a97fa6 100644
@@ -98,12 +98,6 @@ ulong get_timer (ulong base)
 	return (timestamp - base);
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
-
 /* The board must handle this interrupt if a timer is not
  * provided.
  */
arch/powerpc/lib/board.c +0 -2
index aaa5add..22bbc52 100644
@@ -932,8 +932,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	udelay (20);
 
-	set_timer (0);
-
 	/* Initialize from environment */
 	if ((s = getenv ("loadaddr")) != NULL) {
 		load_addr = simple_strtoul (s, NULL, 16);
arch/powerpc/lib/interrupts.c +0 -5
index f603170..847ad37 100644
@@ -146,8 +146,3 @@ ulong get_timer (ulong base)
 {
 	return (timestamp - base);
 }
-
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
arch/sh/lib/time.c +1 -6
index bc1656f..c4bfc86 100644
@@ -139,15 +139,10 @@ unsigned long get_timer (unsigned long base)
 	return tick_to_time(get_ticks()) - base;
 }
 
-void set_timer (unsigned long t)
-{
-	writel((0 - t), TCNT0);
-}
-
 void reset_timer (void)
 {
 	tmu_timer_stop(0);
-	set_timer (0);
+	writel(0, TCNT0);
 	tmu_timer_start(0);
 }
 
arch/sh/lib/time_sh2.c +2 -7
index 789b46f..a5c838b 100644
@@ -54,7 +54,7 @@ int timer_init(void)
 
 	/* User Device 0 only */
 	cmt_timer_stop(0);
-	set_timer(CMT_TIMER_RESET);
+	writew(CMT_TIMER_RESET, CMCOR_0);
 	cmt_timer_start(0);
 
 	return 0;
@@ -90,15 +90,10 @@ ulong get_timer(ulong base)
 	return (get_usec() / 1000) - base;
 }
 
-void set_timer(ulong t)
-{
-	writew((u16) t, CMCOR_0);
-}
-
 void reset_timer(void)
 {
 	cmt_timer_stop(0);
-	set_timer(CMT_TIMER_RESET);
+	writew(CMT_TIMER_RESET, CMCOR_0);
 	cmt0_timer = 0;
 	cmt_timer_start(0);
 }
arch/sparc/lib/board.c +0 -2
index 386cd04..6b705e5 100644
@@ -365,8 +365,6 @@ void board_init_f(ulong bootflag)
 
 	udelay(20);
 
-	set_timer(0);
-
 	/* Initialize from environment */
 	if ((s = getenv("loadaddr")) != NULL) {
 		load_addr = simple_strtoul(s, NULL, 16);
arch/sparc/lib/interrupts.c +0 -5
index 4c73b82..5274311 100644
@@ -100,11 +100,6 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void timer_interrupt_init(void)
 {
 	int irq;
arch/x86/lib/board.c +0 -2
index df54222..c92291b 100644
@@ -363,8 +363,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 	udelay(20);
 
-	set_timer (0);
-
 	/* Initialize from environment */
 	if ((s = getenv ("loadaddr")) != NULL) {
 		load_addr = simple_strtoul (s, NULL, 16);
arch/x86/lib/timer.c +0 -5
index 8fc68cd..199ca8e 100644
@@ -103,8 +103,3 @@ ulong get_timer (ulong base)
 {
 	return (system_ticks - base);
 }
-
-void set_timer (ulong t)
-{
-	system_ticks = t;
-}
board/armltd/integrator/timer.c +0 -6
index 7562ffa..5406066 100644
@@ -117,12 +117,6 @@ ulong get_timer (ulong base_ticks)
 	return get_timer_masked () - base_ticks;
 }
 
-void set_timer (ulong ticks)
-{
-	timestamp   = ticks;
-	total_count = ticks * div_timer;
-}
-
 /* delay usec useconds */
 void __udelay (unsigned long usec)
 {
include/common.h +0 -1
index 1e4a6a5..340e585 100644
@@ -586,7 +586,6 @@ void	irq_install_handler(int, interrupt_handler_t *, void *);
 void	irq_free_handler   (int);
 void	reset_timer	   (void);
 ulong	get_timer	   (ulong base);
-void	set_timer	   (ulong t);
 void	enable_interrupts  (void);
 int	disable_interrupts (void);
 
Signature · 1 line
1.7.5.2.317.g391b14
#21 lore raw

PATCH 3/16 Remove calls to set_timer in arch/

Dear Graeme Russ,

Quoted 2 lines · In message <[email protected]> you wrote:

The description is not quite correct, as you not only remove the calls to that function, but also it's implementation itself.

Otherwise:

Best regards,

Wolfgang Denk

Signature · 5 lines
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: wd at denx.de
Accident: A condition in which presence of mind is good, but  absence
of body is better.
#22 lore raw

PATCH v2 3/7 Timer: Remove set_timer completely

In reply to Graeme Russ

---
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6
- Updated description

 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/armv7/u8500/timer.c         |    5 -----
 arch/arm/cpu/ixp/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 -
 49 files changed, 5 insertions(+), 254 deletions(-)
arch/arm/cpu/arm1136/mx31/timer.c +0 -5
index c4bc3b3..d51acbb 100644
@@ -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)
 {
arch/arm/cpu/arm1136/mx35/timer.c +0 -4
index db1e2c9..6dfb63a 100644
@@ -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.
arch/arm/cpu/arm1136/omap24xx/timer.c +0 -5
index 228ceba..d6267ba 100644
@@ -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)
 {
arch/arm/cpu/arm1176/s3c64xx/timer.c +0 -5
index 9768319..8e54060 100644
@@ -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;
arch/arm/cpu/arm1176/tnetv107x/timer.c +0 -5
index a7a400d..c27375c 100644
@@ -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);
arch/arm/cpu/arm720t/interrupts.c +0 -5
index eb8d425..164ca5d 100644
@@ -219,11 +219,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/arm920t/a320/timer.c +0 -6
index 95cb8fd..b9c83c0 100644
@@ -132,12 +132,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	debug("%s(%lx)\n", __func__, t);
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/arm920t/at91/timer.c +0 -5
index f0ad7d6..a69de57 100644
@@ -83,11 +83,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->tbl = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	udelay_masked(usec);
arch/arm/cpu/arm920t/at91rm9200/timer.c +0 -5
index 9c54bbe..0bcb775 100644
@@ -82,11 +82,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	udelay_masked(usec);
arch/arm/cpu/arm920t/imx/timer.c +0 -5
index b06b518..ff85a41 100644
@@ -62,11 +62,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer (ulong t)
-{
-	/* nop */
-}
-
 void reset_timer_masked (void)
 {
 	TCTL1 &= ~TCTL_TEN;
arch/arm/cpu/arm920t/ks8695/timer.c +0 -5
index 886e370..8e14109 100644
@@ -76,11 +76,6 @@ ulong get_timer(ulong base)
        return (get_timer_masked() - base);
 }
 
-void set_timer(ulong t)
-{
-	timer_ticks = t;
-}
-
 void __udelay(ulong usec)
 {
 	ulong start = get_timer_masked();
arch/arm/cpu/arm920t/s3c24x0/timer.c +0 -5
index f17b7ea..bba06d5 100644
@@ -94,11 +94,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/arm925t/timer.c +0 -5
index 7dfe2b5..fdaeda5 100644
@@ -75,11 +75,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/armada100/timer.c +0 -5
index 5d911c5..eb49234 100644
@@ -111,11 +111,6 @@ ulong get_timer(ulong base)
 		base);
 }
 
-void set_timer(ulong t)
-{
-	gd->tbu = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	ulong delayticks;
arch/arm/cpu/arm926ejs/kirkwood/timer.c +0 -5
index 3e80329..e890edb 100644
@@ -122,11 +122,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	uint current;
arch/arm/cpu/arm926ejs/mx25/timer.c +0 -5
index 14f0c2d..af26b4c 100644
@@ -170,11 +170,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = time_to_tick(t);
-}
-
 /* delay x useconds AND preserve advance timstamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/mx27/timer.c +0 -5
index 5c1cf01..127e670 100644
@@ -173,11 +173,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = time_to_tick(t);
-}
-
 /* delay x useconds AND preserve advance timstamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/omap/timer.c +0 -5
index 88a0ee6..f2e4deb 100644
@@ -76,11 +76,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/orion5x/timer.c +0 -5
index 9d45260..f691c99 100644
@@ -129,11 +129,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 static inline ulong uboot_cntr_val(void)
 {
 	return readl(CNTMR_VAL_REG(UBOOT_CNTR));
arch/arm/cpu/arm926ejs/pantheon/timer.c +0 -5
index ca7f7f0..b487416 100644
@@ -119,11 +119,6 @@ ulong get_timer(ulong base)
 		base);
 }
 
-void set_timer(ulong t)
-{
-	gd->tbu = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	ulong delayticks;
arch/arm/cpu/arm926ejs/spear/timer.c +0 -5
index 66cf4de..7305abd 100644
@@ -87,11 +87,6 @@ ulong get_timer(ulong base)
 	return (get_timer_masked() / GPT_RESOLUTION) - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/arm926ejs/versatile/timer.c +0 -5
index 2e243b1..0e51a63 100644
@@ -105,11 +105,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/armv7/mx5/timer.c +0 -5
index 1972f64..40ee0be 100644
@@ -99,11 +99,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/armv7/omap-common/timer.c +0 -5
index 59bbca8..a0f6b7c 100644
@@ -73,11 +73,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->tbl = t;
-}
-
 /* delay x useconds */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/armv7/s5p-common/timer.c +0 -5
index b750d16..0b69f06 100644
@@ -60,11 +60,6 @@ unsigned long get_timer(unsigned long base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(unsigned long t)
-{
-	gd->tbl = t;
-}
-
 /* delay x useconds */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/armv7/tegra2/timer.c +0 -5
index fb061d0..4458de9 100644
@@ -58,11 +58,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->tbl = t;
-}
-
 /* delay x useconds */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/armv7/u8500/timer.c +0 -5
index 8e96eaa..79aad99 100644
@@ -129,11 +129,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->tbl = t;
-}
-
 /*
  * Emulation of Power architecture long long timebase.
  *
arch/arm/cpu/ixp/timer.c +0 -5
index 9f3ea42..c25e72f 100644
@@ -104,11 +104,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->timestamp = time_to_tick(t);
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/lh7a40x/timer.c +0 -5
index 2691315..6c6277d 100644
@@ -85,11 +85,6 @@ ulong get_timer (ulong base)
 	return (get_timer_masked() - base);
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo,tmp;
arch/arm/cpu/pxa/timer.c +0 -5
index ec950c7..8900a70 100644
@@ -74,11 +74,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	/* nop */
-}
-
 void __udelay (unsigned long usec)
 {
 	udelay_masked (usec);
arch/arm/cpu/s3c44b0/timer.c +0 -5
index 6f1d8f6..d30e1aa 100644
@@ -70,11 +70,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/sa1100/timer.c +0 -5
index 0207501..10ad964 100644
@@ -44,11 +44,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked ();
 }
 
-void set_timer (ulong t)
-{
-	/* nop */
-}
-
 void __udelay (unsigned long usec)
 {
 	udelay_masked (usec);
arch/avr32/cpu/interrupts.c +0 -16
index c6ea435..8406f91 100644
@@ -77,22 +77,6 @@ unsigned long get_timer(unsigned long base)
 	return (unsigned long)(now >> 32) - base;
 }
 
-void set_timer(unsigned long t)
-{
-	unsigned long long ticks = t;
-	unsigned long lo, hi, hi_new;
-
-	ticks = (ticks * get_tbclk()) / CONFIG_SYS_HZ;
-	hi = ticks >> 32;
-	lo = ticks & 0xffffffffUL;
-
-	do {
-		timer_overflow = hi;
-		sysreg_write(COUNT, lo);
-		hi_new = timer_overflow;
-	} while (hi_new != hi);
-}
-
 /*
  * For short delays only. It will overflow after a few seconds.
  */
arch/m68k/cpu/mcf547x_8x/slicetimer.c +0 -4
index 8dc010a..49dba6a 100644
@@ -105,8 +105,4 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
 #endif				/* CONFIG_SLTTMR */
arch/m68k/lib/board.c +0 -2
index 6a892db..945ab66 100644
@@ -574,8 +574,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	udelay (20);
 
-	set_timer (0);
-
 	/* Insert function pointers now that we have relocated the code */
 
 	/* Initialize from environment */
arch/m68k/lib/time.c +2 -14
index 7eaea5e..d10bcc7 100644
@@ -126,10 +126,6 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
 #endif				/* CONFIG_MCFTMR */
 
 #if defined(CONFIG_MCFPIT)
@@ -173,14 +169,6 @@ void timer_init(void)
 	timerp->pcsr |= PIT_PCSR_PRE(CONFIG_SYS_PIT_PRESCALE) | PIT_PCSR_EN;
 }
 
-void set_timer(ulong t)
-{
-	volatile pit_t *timerp = (pit_t *) (CONFIG_SYS_PIT_BASE);
-
-	timestamp = 0;
-	timerp->pmr = lastinc = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	unsigned short now, diff;
@@ -196,8 +184,8 @@ ulong get_timer(ulong base)
 
 void wait_ticks(unsigned long ticks)
 {
-	set_timer(0);
-	while (get_timer(0) < ticks) ;
+	u32 start = get_timer(0);
+	while (get_timer(start) < ticks) ;
 }
 #endif				/* CONFIG_MCFPIT */
 
arch/microblaze/cpu/timer.c +0 -5
index 4936c62..59ed126 100644
@@ -45,11 +45,6 @@ ulong get_timer (ulong base)
 }
 #endif
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 #ifdef CONFIG_SYS_INTC_0
 #ifdef CONFIG_SYS_TIMER_0
 microblaze_timer_t *tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR);
arch/mips/cpu/mips32/time.c +0 -6
index 0e66441..b0a9c1f 100644
@@ -64,12 +64,6 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-	write_c0_compare(read_c0_count() + CYCLES_PER_JIFFY);
-}
-
 void __udelay(unsigned long usec)
 {
 	unsigned int tmo;
arch/nios2/cpu/interrupts.c +0 -6
index 63acfa9..0a97fa6 100644
@@ -98,12 +98,6 @@ ulong get_timer (ulong base)
 	return (timestamp - base);
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
-
 /* The board must handle this interrupt if a timer is not
  * provided.
  */
arch/powerpc/lib/board.c +0 -2
index aaa5add..22bbc52 100644
@@ -932,8 +932,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	udelay (20);
 
-	set_timer (0);
-
 	/* Initialize from environment */
 	if ((s = getenv ("loadaddr")) != NULL) {
 		load_addr = simple_strtoul (s, NULL, 16);
arch/powerpc/lib/interrupts.c +0 -5
index f603170..847ad37 100644
@@ -146,8 +146,3 @@ ulong get_timer (ulong base)
 {
 	return (timestamp - base);
 }
-
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
arch/sh/lib/time.c +1 -6
index bc1656f..c4bfc86 100644
@@ -139,15 +139,10 @@ unsigned long get_timer (unsigned long base)
 	return tick_to_time(get_ticks()) - base;
 }
 
-void set_timer (unsigned long t)
-{
-	writel((0 - t), TCNT0);
-}
-
 void reset_timer (void)
 {
 	tmu_timer_stop(0);
-	set_timer (0);
+	writel(0, TCNT0);
 	tmu_timer_start(0);
 }
 
arch/sh/lib/time_sh2.c +2 -7
index 789b46f..a5c838b 100644
@@ -54,7 +54,7 @@ int timer_init(void)
 
 	/* User Device 0 only */
 	cmt_timer_stop(0);
-	set_timer(CMT_TIMER_RESET);
+	writew(CMT_TIMER_RESET, CMCOR_0);
 	cmt_timer_start(0);
 
 	return 0;
@@ -90,15 +90,10 @@ ulong get_timer(ulong base)
 	return (get_usec() / 1000) - base;
 }
 
-void set_timer(ulong t)
-{
-	writew((u16) t, CMCOR_0);
-}
-
 void reset_timer(void)
 {
 	cmt_timer_stop(0);
-	set_timer(CMT_TIMER_RESET);
+	writew(CMT_TIMER_RESET, CMCOR_0);
 	cmt0_timer = 0;
 	cmt_timer_start(0);
 }
arch/sparc/lib/board.c +0 -2
index 386cd04..6b705e5 100644
@@ -365,8 +365,6 @@ void board_init_f(ulong bootflag)
 
 	udelay(20);
 
-	set_timer(0);
-
 	/* Initialize from environment */
 	if ((s = getenv("loadaddr")) != NULL) {
 		load_addr = simple_strtoul(s, NULL, 16);
arch/sparc/lib/interrupts.c +0 -5
index 4c73b82..5274311 100644
@@ -100,11 +100,6 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void timer_interrupt_init(void)
 {
 	int irq;
arch/x86/lib/board.c +0 -2
index df54222..c92291b 100644
@@ -363,8 +363,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 	udelay(20);
 
-	set_timer (0);
-
 	/* Initialize from environment */
 	if ((s = getenv ("loadaddr")) != NULL) {
 		load_addr = simple_strtoul (s, NULL, 16);
arch/x86/lib/timer.c +0 -5
index 8fc68cd..199ca8e 100644
@@ -103,8 +103,3 @@ ulong get_timer (ulong base)
 {
 	return (system_ticks - base);
 }
-
-void set_timer (ulong t)
-{
-	system_ticks = t;
-}
board/armltd/integrator/timer.c +0 -6
index 7562ffa..5406066 100644
@@ -117,12 +117,6 @@ ulong get_timer (ulong base_ticks)
 	return get_timer_masked () - base_ticks;
 }
 
-void set_timer (ulong ticks)
-{
-	timestamp   = ticks;
-	total_count = ticks * div_timer;
-}
-
 /* delay usec useconds */
 void __udelay (unsigned long usec)
 {
include/common.h +0 -1
index 2c8513a..1f5c8fa 100644
@@ -587,7 +587,6 @@ void	irq_install_handler(int, interrupt_handler_t *, void *);
 void	irq_free_handler   (int);
 void	reset_timer	   (void);
 ulong	get_timer	   (ulong base);
-void	set_timer	   (ulong t);
 void	enable_interrupts  (void);
 int	disable_interrupts (void);
 

--
1.7.5.2.317.g391b14

#23 lore raw

PATCH v3 3/7 Timer: Remove set_timer completely

---
Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6
- Updated description

 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/armv7/u8500/timer.c         |    5 -----
 arch/arm/cpu/ixp/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 -
 49 files changed, 5 insertions(+), 254 deletions(-)
arch/arm/cpu/arm1136/mx31/timer.c +0 -5
index c4bc3b3..d51acbb 100644
@@ -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)
 {
arch/arm/cpu/arm1136/mx35/timer.c +0 -4
index db1e2c9..6dfb63a 100644
@@ -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.
arch/arm/cpu/arm1136/omap24xx/timer.c +0 -5
index 228ceba..d6267ba 100644
@@ -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)
 {
arch/arm/cpu/arm1176/s3c64xx/timer.c +0 -5
index 9768319..8e54060 100644
@@ -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;
arch/arm/cpu/arm1176/tnetv107x/timer.c +0 -5
index a7a400d..c27375c 100644
@@ -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);
arch/arm/cpu/arm720t/interrupts.c +0 -5
index eb8d425..164ca5d 100644
@@ -219,11 +219,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/arm920t/a320/timer.c +0 -6
index 95cb8fd..b9c83c0 100644
@@ -132,12 +132,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	debug("%s(%lx)\n", __func__, t);
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/arm920t/at91/timer.c +0 -5
index f0ad7d6..a69de57 100644
@@ -83,11 +83,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->tbl = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	udelay_masked(usec);
arch/arm/cpu/arm920t/at91rm9200/timer.c +0 -5
index 9c54bbe..0bcb775 100644
@@ -82,11 +82,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	udelay_masked(usec);
arch/arm/cpu/arm920t/imx/timer.c +0 -5
index b06b518..ff85a41 100644
@@ -62,11 +62,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer (ulong t)
-{
-	/* nop */
-}
-
 void reset_timer_masked (void)
 {
 	TCTL1 &= ~TCTL_TEN;
arch/arm/cpu/arm920t/ks8695/timer.c +0 -5
index 886e370..8e14109 100644
@@ -76,11 +76,6 @@ ulong get_timer(ulong base)
        return (get_timer_masked() - base);
 }
 
-void set_timer(ulong t)
-{
-	timer_ticks = t;
-}
-
 void __udelay(ulong usec)
 {
 	ulong start = get_timer_masked();
arch/arm/cpu/arm920t/s3c24x0/timer.c +0 -5
index f17b7ea..bba06d5 100644
@@ -94,11 +94,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/arm925t/timer.c +0 -5
index 7dfe2b5..fdaeda5 100644
@@ -75,11 +75,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/armada100/timer.c +0 -5
index 5d911c5..eb49234 100644
@@ -111,11 +111,6 @@ ulong get_timer(ulong base)
 		base);
 }
 
-void set_timer(ulong t)
-{
-	gd->tbu = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	ulong delayticks;
arch/arm/cpu/arm926ejs/kirkwood/timer.c +0 -5
index 3e80329..e890edb 100644
@@ -122,11 +122,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	uint current;
arch/arm/cpu/arm926ejs/mx25/timer.c +0 -5
index 14f0c2d..af26b4c 100644
@@ -170,11 +170,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = time_to_tick(t);
-}
-
 /* delay x useconds AND preserve advance timstamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/mx27/timer.c +0 -5
index 5c1cf01..127e670 100644
@@ -173,11 +173,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = time_to_tick(t);
-}
-
 /* delay x useconds AND preserve advance timstamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/omap/timer.c +0 -5
index 88a0ee6..f2e4deb 100644
@@ -76,11 +76,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/arm926ejs/orion5x/timer.c +0 -5
index 9d45260..f691c99 100644
@@ -129,11 +129,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 static inline ulong uboot_cntr_val(void)
 {
 	return readl(CNTMR_VAL_REG(UBOOT_CNTR));
arch/arm/cpu/arm926ejs/pantheon/timer.c +0 -5
index ca7f7f0..b487416 100644
@@ -119,11 +119,6 @@ ulong get_timer(ulong base)
 		base);
 }
 
-void set_timer(ulong t)
-{
-	gd->tbu = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	ulong delayticks;
arch/arm/cpu/arm926ejs/spear/timer.c +0 -5
index 66cf4de..7305abd 100644
@@ -87,11 +87,6 @@ ulong get_timer(ulong base)
 	return (get_timer_masked() / GPT_RESOLUTION) - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay(unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/arm926ejs/versatile/timer.c +0 -5
index 2e243b1..0e51a63 100644
@@ -105,11 +105,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay (unsigned long usec)
 {
arch/arm/cpu/armv7/mx5/timer.c +0 -5
index 1972f64..40ee0be 100644
@@ -99,11 +99,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/armv7/omap-common/timer.c +0 -5
index 59bbca8..a0f6b7c 100644
@@ -73,11 +73,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->tbl = t;
-}
-
 /* delay x useconds */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/armv7/s5p-common/timer.c +0 -5
index b750d16..0b69f06 100644
@@ -60,11 +60,6 @@ unsigned long get_timer(unsigned long base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(unsigned long t)
-{
-	gd->tbl = t;
-}
-
 /* delay x useconds */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/armv7/tegra2/timer.c +0 -5
index fb061d0..4458de9 100644
@@ -58,11 +58,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->tbl = t;
-}
-
 /* delay x useconds */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/armv7/u8500/timer.c +0 -5
index 8e96eaa..79aad99 100644
@@ -129,11 +129,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->tbl = t;
-}
-
 /*
  * Emulation of Power architecture long long timebase.
  *
arch/arm/cpu/ixp/timer.c +0 -5
index 9f3ea42..c25e72f 100644
@@ -104,11 +104,6 @@ ulong get_timer(ulong base)
 	return get_timer_masked() - base;
 }
 
-void set_timer(ulong t)
-{
-	gd->timestamp = time_to_tick(t);
-}
-
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay(unsigned long usec)
 {
arch/arm/cpu/lh7a40x/timer.c +0 -5
index 2691315..6c6277d 100644
@@ -85,11 +85,6 @@ ulong get_timer (ulong base)
 	return (get_timer_masked() - base);
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo,tmp;
arch/arm/cpu/pxa/timer.c +0 -5
index ec950c7..8900a70 100644
@@ -74,11 +74,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	/* nop */
-}
-
 void __udelay (unsigned long usec)
 {
 	udelay_masked (usec);
arch/arm/cpu/s3c44b0/timer.c +0 -5
index 6f1d8f6..d30e1aa 100644
@@ -70,11 +70,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked () - base;
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 void __udelay (unsigned long usec)
 {
 	ulong tmo;
arch/arm/cpu/sa1100/timer.c +0 -5
index 0207501..10ad964 100644
@@ -44,11 +44,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked ();
 }
 
-void set_timer (ulong t)
-{
-	/* nop */
-}
-
 void __udelay (unsigned long usec)
 {
 	udelay_masked (usec);
arch/avr32/cpu/interrupts.c +0 -16
index c6ea435..8406f91 100644
@@ -77,22 +77,6 @@ unsigned long get_timer(unsigned long base)
 	return (unsigned long)(now >> 32) - base;
 }
 
-void set_timer(unsigned long t)
-{
-	unsigned long long ticks = t;
-	unsigned long lo, hi, hi_new;
-
-	ticks = (ticks * get_tbclk()) / CONFIG_SYS_HZ;
-	hi = ticks >> 32;
-	lo = ticks & 0xffffffffUL;
-
-	do {
-		timer_overflow = hi;
-		sysreg_write(COUNT, lo);
-		hi_new = timer_overflow;
-	} while (hi_new != hi);
-}
-
 /*
  * For short delays only. It will overflow after a few seconds.
  */
arch/m68k/cpu/mcf547x_8x/slicetimer.c +0 -4
index 8dc010a..49dba6a 100644
@@ -105,8 +105,4 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
 #endif				/* CONFIG_SLTTMR */
arch/m68k/lib/board.c +0 -2
index 6a892db..945ab66 100644
@@ -574,8 +574,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	udelay (20);
 
-	set_timer (0);
-
 	/* Insert function pointers now that we have relocated the code */
 
 	/* Initialize from environment */
arch/m68k/lib/time.c +2 -14
index 7eaea5e..d10bcc7 100644
@@ -126,10 +126,6 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
 #endif				/* CONFIG_MCFTMR */
 
 #if defined(CONFIG_MCFPIT)
@@ -173,14 +169,6 @@ void timer_init(void)
 	timerp->pcsr |= PIT_PCSR_PRE(CONFIG_SYS_PIT_PRESCALE) | PIT_PCSR_EN;
 }
 
-void set_timer(ulong t)
-{
-	volatile pit_t *timerp = (pit_t *) (CONFIG_SYS_PIT_BASE);
-
-	timestamp = 0;
-	timerp->pmr = lastinc = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	unsigned short now, diff;
@@ -196,8 +184,8 @@ ulong get_timer(ulong base)
 
 void wait_ticks(unsigned long ticks)
 {
-	set_timer(0);
-	while (get_timer(0) < ticks) ;
+	u32 start = get_timer(0);
+	while (get_timer(start) < ticks) ;
 }
 #endif				/* CONFIG_MCFPIT */
 
arch/microblaze/cpu/timer.c +0 -5
index 4936c62..59ed126 100644
@@ -45,11 +45,6 @@ ulong get_timer (ulong base)
 }
 #endif
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
 #ifdef CONFIG_SYS_INTC_0
 #ifdef CONFIG_SYS_TIMER_0
 microblaze_timer_t *tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR);
arch/mips/cpu/mips32/time.c +0 -6
index 0e66441..b0a9c1f 100644
@@ -64,12 +64,6 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-	write_c0_compare(read_c0_count() + CYCLES_PER_JIFFY);
-}
-
 void __udelay(unsigned long usec)
 {
 	unsigned int tmo;
arch/nios2/cpu/interrupts.c +0 -6
index 63acfa9..0a97fa6 100644
@@ -98,12 +98,6 @@ ulong get_timer (ulong base)
 	return (timestamp - base);
 }
 
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
-
-
 /* The board must handle this interrupt if a timer is not
  * provided.
  */
arch/powerpc/lib/board.c +0 -2
index aaa5add..22bbc52 100644
@@ -932,8 +932,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	udelay (20);
 
-	set_timer (0);
-
 	/* Initialize from environment */
 	if ((s = getenv ("loadaddr")) != NULL) {
 		load_addr = simple_strtoul (s, NULL, 16);
arch/powerpc/lib/interrupts.c +0 -5
index f603170..847ad37 100644
@@ -146,8 +146,3 @@ ulong get_timer (ulong base)
 {
 	return (timestamp - base);
 }
-
-void set_timer (ulong t)
-{
-	timestamp = t;
-}
arch/sh/lib/time.c +1 -6
index bc1656f..c4bfc86 100644
@@ -139,15 +139,10 @@ unsigned long get_timer (unsigned long base)
 	return tick_to_time(get_ticks()) - base;
 }
 
-void set_timer (unsigned long t)
-{
-	writel((0 - t), TCNT0);
-}
-
 void reset_timer (void)
 {
 	tmu_timer_stop(0);
-	set_timer (0);
+	writel(0, TCNT0);
 	tmu_timer_start(0);
 }
 
arch/sh/lib/time_sh2.c +2 -7
index 789b46f..a5c838b 100644
@@ -54,7 +54,7 @@ int timer_init(void)
 
 	/* User Device 0 only */
 	cmt_timer_stop(0);
-	set_timer(CMT_TIMER_RESET);
+	writew(CMT_TIMER_RESET, CMCOR_0);
 	cmt_timer_start(0);
 
 	return 0;
@@ -90,15 +90,10 @@ ulong get_timer(ulong base)
 	return (get_usec() / 1000) - base;
 }
 
-void set_timer(ulong t)
-{
-	writew((u16) t, CMCOR_0);
-}
-
 void reset_timer(void)
 {
 	cmt_timer_stop(0);
-	set_timer(CMT_TIMER_RESET);
+	writew(CMT_TIMER_RESET, CMCOR_0);
 	cmt0_timer = 0;
 	cmt_timer_start(0);
 }
arch/sparc/lib/board.c +0 -2
index 386cd04..6b705e5 100644
@@ -365,8 +365,6 @@ void board_init_f(ulong bootflag)
 
 	udelay(20);
 
-	set_timer(0);
-
 	/* Initialize from environment */
 	if ((s = getenv("loadaddr")) != NULL) {
 		load_addr = simple_strtoul(s, NULL, 16);
arch/sparc/lib/interrupts.c +0 -5
index 4c73b82..5274311 100644
@@ -100,11 +100,6 @@ ulong get_timer(ulong base)
 	return (timestamp - base);
 }
 
-void set_timer(ulong t)
-{
-	timestamp = t;
-}
-
 void timer_interrupt_init(void)
 {
 	int irq;
arch/x86/lib/board.c +0 -2
index df54222..c92291b 100644
@@ -363,8 +363,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 	udelay(20);
 
-	set_timer (0);
-
 	/* Initialize from environment */
 	if ((s = getenv ("loadaddr")) != NULL) {
 		load_addr = simple_strtoul (s, NULL, 16);
arch/x86/lib/timer.c +0 -5
index 8fc68cd..199ca8e 100644
@@ -103,8 +103,3 @@ ulong get_timer (ulong base)
 {
 	return (system_ticks - base);
 }
-
-void set_timer (ulong t)
-{
-	system_ticks = t;
-}
board/armltd/integrator/timer.c +0 -6
index 7562ffa..5406066 100644
@@ -117,12 +117,6 @@ ulong get_timer (ulong base_ticks)
 	return get_timer_masked () - base_ticks;
 }
 
-void set_timer (ulong ticks)
-{
-	timestamp   = ticks;
-	total_count = ticks * div_timer;
-}
-
 /* delay usec useconds */
 void __udelay (unsigned long usec)
 {
include/common.h +0 -1
index 2c8513a..1f5c8fa 100644
@@ -587,7 +587,6 @@ void	irq_install_handler(int, interrupt_handler_t *, void *);
 void	irq_free_handler   (int);
 void	reset_timer	   (void);
 ulong	get_timer	   (ulong base);
-void	set_timer	   (ulong t);
 void	enable_interrupts  (void);
 int	disable_interrupts (void);
 

--
1.7.5.2.317.g391b14

#24 lore raw

PATCH v3 3/7 Timer: Remove set_timer completely

Dear Graeme Russ,

Quoted 51 lines · In message <[email protected]> you wrote:

---
Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6
- Updated description

 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/armv7/u8500/timer.c         |    5 -----
 arch/arm/cpu/ixp/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 +------
Quoted 8 lines
 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 -
 49 files changed, 5 insertions(+), 254 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
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: wd at denx.de
"What terrible way to die."
"There are no good ways."
	-- Sulu and Kirk, "That Which Survives", stardate unknown
#25 lore raw

PATCH 4/16 Allow reset_timer() only for Nios2

In reply to Graeme Russ
---
 drivers/block/mg_disk.c |    2 ++
 drivers/mtd/cfi_flash.c |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)
drivers/block/mg_disk.c +2 -0
index b74307a..2198017 100644
@@ -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);
drivers/mtd/cfi_flash.c +4 -0
index 6039e1f..3ac6c80 100644
@@ -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) {
Signature · 1 line
1.7.5.2.317.g391b14
#26 lore raw

PATCH 4/16 Allow reset_timer() only for Nios2

Dear Graeme Russ,

Quoted 12 lines · In message <[email protected]> you wrote:
---
 drivers/block/mg_disk.c |    2 ++
 drivers/mtd/cfi_flash.c |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)
drivers/block/mg_disk.c +0 -0
index b74307a..2198017 100644

drivers/block/mg_disk.c static unsigned int mg_wait (u32 expect, u32 msec) · line 96

Quoted 6 lines
drivers/block/mg_disk.c +2 -0
@@ -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

I don't think this is a good idea. Instead of making this depend on a specific architecture, we should make it depend on some feature.

I. e. please change "#ifdef CONFIG_NIOS2" into some "#ifdef CONFIG_BROKEN_TIMERS" or CONFIG_TERRIBLY_SLOW_CLOCK or the like.

Best regards,

Wolfgang Denk

Signature · 4 lines
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: wd at denx.de
"At least they're __________EXPERIENCED incompetents"
#27 lore raw

PATCH v2 4/7 Timer: Allow reset_timer() only for systems with low resolution timers

In reply to Graeme Russ

---
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6
- Introduce new #define CONFIG_SYS_LOW_RES_TIMER

 drivers/block/mg_disk.c         |    2 ++
 drivers/mtd/cfi_flash.c         |    4 ++++
 include/configs/PCI5441.h       |    1 +
 include/configs/PK1C20.h        |    1 +
 include/configs/nios2-generic.h |    1 +
 5 files changed, 9 insertions(+), 0 deletions(-)
drivers/block/mg_disk.c +2 -0
index b74307a..921bce9 100644
@@ -91,7 +91,9 @@ static unsigned int mg_wait (u32 expect, u32 msec)
 	u32 from, cur, err;
 
 	err = MG_ERR_NONE;
+#ifdef CONFIG_SYS_LOW_RES_TIMER
 	reset_timer();
+#endif
 	from = get_timer(0);
 
 	status = readb(mg_base() + MG_REG_STATUS);
drivers/mtd/cfi_flash.c +4 -0
index 929f9a9..ac91dfd 100644
@@ -573,7 +573,9 @@ static int flash_status_check (flash_info_t * info, flash_sect_t sector,
 #endif
 
 	/* Wait for command completion */
+#ifdef CONFIG_SYS_LOW_RES_TIMER
 	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_SYS_LOW_RES_TIMER
 	reset_timer();
+#endif
 	start = get_timer(0);
 	while (1) {
 		switch (info->portwidth) {
include/configs/PCI5441.h +1 -0
index 70775e7..ae5bc2e 100644
@@ -118,6 +118,7 @@
  * TMRMS represents the desired mecs per tick (msecs per interrupt).
  *----------------------------------------------------------------------*/
 #define CONFIG_SYS_HZ			1000	/* Always 1000 */
+#define CONFIG_SYS_LOW_RES_TIMER
 #define CONFIG_SYS_NIOS_TMRBASE	0x00920860	/* Tick timer base addr	*/
 #define CONFIG_SYS_NIOS_TMRIRQ		3	/* Timer IRQ num */
 #define CONFIG_SYS_NIOS_TMRMS		10	/* Desired period (msec)*/
include/configs/PK1C20.h +1 -0
index b466c4b..95c30cc 100644
@@ -128,6 +128,7 @@
  * TMRMS represents the desired mecs per tick (msecs per interrupt).
  *----------------------------------------------------------------------*/
 #define CONFIG_SYS_HZ			1000	/* Always 1000 */
+#define CONFIG_SYS_LOW_RES_TIMER
 #define CONFIG_SYS_NIOS_TMRBASE	0x02120820	/* Tick timer base addr */
 #define CONFIG_SYS_NIOS_TMRIRQ		3	/* Timer IRQ num */
 #define CONFIG_SYS_NIOS_TMRMS		10	/* Desired period */
include/configs/nios2-generic.h +1 -0
index 53f2084..d57d53c 100644
@@ -52,6 +52,7 @@
 /*
  * TIMER
  */
+#define CONFIG_SYS_LOW_RES_TIMER
 #define CONFIG_SYS_NIOS_TMRBASE	CONFIG_SYS_TIMER_BASE
 #define CONFIG_SYS_NIOS_TMRIRQ		CONFIG_SYS_TIMER_IRQ
 #define CONFIG_SYS_HZ			1000	/* Always 1000 */

--
1.7.5.2.317.g391b14

#28 lore raw

PATCH v3 4/7 Timer: Allow reset_timer() only for systems with low resolution timers

---
Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6
- Introduce new #define CONFIG_SYS_LOW_RES_TIMER

 drivers/block/mg_disk.c         |    2 ++
 drivers/mtd/cfi_flash.c         |    4 ++++
 include/configs/PCI5441.h       |    1 +
 include/configs/PK1C20.h        |    1 +
 include/configs/nios2-generic.h |    1 +
 5 files changed, 9 insertions(+), 0 deletions(-)
drivers/block/mg_disk.c +2 -0
index b74307a..921bce9 100644
@@ -91,7 +91,9 @@ static unsigned int mg_wait (u32 expect, u32 msec)
 	u32 from, cur, err;
 
 	err = MG_ERR_NONE;
+#ifdef CONFIG_SYS_LOW_RES_TIMER
 	reset_timer();
+#endif
 	from = get_timer(0);
 
 	status = readb(mg_base() + MG_REG_STATUS);
drivers/mtd/cfi_flash.c +4 -0
index 929f9a9..ac91dfd 100644
@@ -573,7 +573,9 @@ static int flash_status_check (flash_info_t * info, flash_sect_t sector,
 #endif
 
 	/* Wait for command completion */
+#ifdef CONFIG_SYS_LOW_RES_TIMER
 	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_SYS_LOW_RES_TIMER
 	reset_timer();
+#endif
 	start = get_timer(0);
 	while (1) {
 		switch (info->portwidth) {
include/configs/PCI5441.h +1 -0
index 70775e7..ae5bc2e 100644
@@ -118,6 +118,7 @@
  * TMRMS represents the desired mecs per tick (msecs per interrupt).
  *----------------------------------------------------------------------*/
 #define CONFIG_SYS_HZ			1000	/* Always 1000 */
+#define CONFIG_SYS_LOW_RES_TIMER
 #define CONFIG_SYS_NIOS_TMRBASE	0x00920860	/* Tick timer base addr	*/
 #define CONFIG_SYS_NIOS_TMRIRQ		3	/* Timer IRQ num */
 #define CONFIG_SYS_NIOS_TMRMS		10	/* Desired period (msec)*/
include/configs/PK1C20.h +1 -0
index b466c4b..95c30cc 100644
@@ -128,6 +128,7 @@
  * TMRMS represents the desired mecs per tick (msecs per interrupt).
  *----------------------------------------------------------------------*/
 #define CONFIG_SYS_HZ			1000	/* Always 1000 */
+#define CONFIG_SYS_LOW_RES_TIMER
 #define CONFIG_SYS_NIOS_TMRBASE	0x02120820	/* Tick timer base addr */
 #define CONFIG_SYS_NIOS_TMRIRQ		3	/* Timer IRQ num */
 #define CONFIG_SYS_NIOS_TMRMS		10	/* Desired period */
include/configs/nios2-generic.h +1 -0
index 53f2084..d57d53c 100644
@@ -52,6 +52,7 @@
 /*
  * TIMER
  */
+#define CONFIG_SYS_LOW_RES_TIMER
 #define CONFIG_SYS_NIOS_TMRBASE	CONFIG_SYS_TIMER_BASE
 #define CONFIG_SYS_NIOS_TMRIRQ		CONFIG_SYS_TIMER_IRQ
 #define CONFIG_SYS_HZ			1000	/* Always 1000 */

--
1.7.5.2.317.g391b14

#29 lore raw

PATCH v3 4/7 Timer: Allow reset_timer() only for systems with low resolution timers

Dear Graeme Russ,

Quoted 9 lines · In message <[email protected]> you wrote:

---
Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6
- Introduce new #define CONFIG_SYS_LOW_RES_TIMER

Quoted 6 lines
 drivers/block/mg_disk.c         |    2 ++
 drivers/mtd/cfi_flash.c         |    4 ++++
 include/configs/PCI5441.h       |    1 +
 include/configs/PK1C20.h        |    1 +
 include/configs/nios2-generic.h |    1 +
 5 files changed, 9 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
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: wd at denx.de
This cultural mystique surrounding the  biological  function  --  you
realize humans are overly preoccupied with the subject.
	-- Kelinda the Kelvan, "By Any Other Name", stardate 4658.9
#30 lore raw

PATCH 5/16 Remove reset_timer() for non-Nios2 arches

In reply to 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(-)
arch/arm/cpu/arm1136/mx31/timer.c +0 -5
index d51acbb..eac4ffb 100644
@@ -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 */
arch/arm/cpu/arm1136/mx35/timer.c +0 -5
index 6dfb63a..80c0675 100644
@@ -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;
arch/arm/cpu/arm1136/omap24xx/timer.c +0 -5
index d6267ba..6f1ebbf 100644
@@ -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;
arch/arm/cpu/arm1176/s3c64xx/timer.c +0 -5
index 8e54060..bc21f86 100644
@@ -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();
arch/arm/cpu/arm1176/tnetv107x/timer.c +0 -9
index c27375c..b3123c5 100644
@@ -60,15 +60,6 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_timer(void)
-{
-	lastinc = timestamp = 0;
-
-	__raw_writel(0,		&regs->tcr);
-	__raw_writel(0,		&regs->tim34);
-	__raw_writel(2 << 22,	&regs->tcr);
-}
-
 static ulong get_timer_raw(void)
 {
 	ulong now = __raw_readl(&regs->tim34);
arch/arm/cpu/arm720t/interrupts.c +0 -5
index 164ca5d..9cd7fee 100644
@@ -209,11 +209,6 @@ int timer_init (void)
 
 #if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_NETARM) || defined(CONFIG_ARMADILLO) || defined(CONFIG_LPC2292)
 
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base)
 {
 	return get_timer_masked () - base;
arch/arm/cpu/arm920t/a320/timer.c +0 -6
index b9c83c0..443d31d 100644
@@ -81,12 +81,6 @@ void reset_timer_masked(void)
 	debug("%s(): lastdec = %lx\n", __func__, lastdec);
 }
 
-void reset_timer(void)
-{
-	debug("%s()\n", __func__);
-	reset_timer_masked();
-}
-
 /*
  * return timer ticks
  */
arch/arm/cpu/arm920t/at91/timer.c +0 -6
index a69de57..374cc25 100644
@@ -72,12 +72,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;
arch/arm/cpu/arm920t/at91rm9200/timer.c +0 -6
index 0bcb775..9a1ae85 100644
@@ -71,12 +71,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;
arch/arm/cpu/arm920t/ep93xx/timer.c +0 -5
index 4a0ce4d..f19ec61 100644
@@ -97,11 +97,6 @@ void reset_timer_masked(void)
 	timer.ticks = 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 void __udelay(unsigned long usec)
 {
 	unsigned long long target;
arch/arm/cpu/arm920t/imx/timer.c +0 -6
index ff85a41..cdb2148 100644
@@ -51,12 +51,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;
arch/arm/cpu/arm920t/ks8695/timer.c +1 -6
index 8e14109..c78fd90 100644
@@ -33,7 +33,7 @@ ulong timer_ticks;
 
 int timer_init (void)
 {
-	reset_timer();
+	reset_timer_masked();
 
 	return 0;
 }
@@ -55,11 +55,6 @@ void reset_timer_masked(void)
 	timer_ticks = 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer_masked(void)
 {
 	/* Check for timer wrap */
arch/arm/cpu/arm920t/s3c24x0/timer.c +0 -6
index 22767c5..4e50291 100644
@@ -83,12 +83,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;
arch/arm/cpu/arm925t/timer.c +0 -6
index fdaeda5..9c965e0 100644
@@ -64,12 +64,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;
arch/arm/cpu/arm926ejs/armada100/timer.c +0 -5
index eb49234..86da0ce 100644
@@ -100,11 +100,6 @@ ulong get_timer_masked(void)
 	return gd->tbu;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return ((get_timer_masked() / (CONFIG_SYS_HZ_CLOCK / 1000)) -
arch/arm/cpu/arm926ejs/davinci/timer.c +0 -5
index 1c6fa4a..8b1734c 100644
@@ -78,11 +78,6 @@ int timer_init(void)
 	return(0);
 }
 
-void reset_timer(void)
-{
-	gd->timer_reset_value = get_ticks();
-}
-
 /*
  * Get the current 64 bit timer tick count
  */
arch/arm/cpu/arm926ejs/kirkwood/timer.c +0 -5
index e890edb..5beb3f5 100644
@@ -112,11 +112,6 @@ ulong get_timer_masked(void)
 	return timestamp;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/arm926ejs/mb86r0x/timer.c +0 -5
index 6966b0d..5f54085 100644
@@ -121,11 +121,6 @@ void __udelay(unsigned long usec)
 		 /*NOP*/;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/arm926ejs/mx25/timer.c +0 -5
index af26b4c..9a84b50 100644
@@ -130,11 +130,6 @@ void reset_timer_masked(void)
 	timestamp = 0; /* start "advancing" time stamp from 0 */
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 unsigned long long get_ticks (void)
 {
 	struct gpt_regs *gpt = (struct gpt_regs *)IMX_GPT1_BASE;
arch/arm/cpu/arm926ejs/mx27/timer.c +0 -5
index 127e670..058dbee 100644
@@ -133,11 +133,6 @@ void reset_timer_masked(void)
 	timestamp = 0; /* start "advancing" time stamp from 0 */
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 unsigned long long get_ticks (void)
 {
 	struct gpt_regs *regs = (struct gpt_regs *)IMX_TIM1_BASE;
arch/arm/cpu/arm926ejs/nomadik/timer.c +5 -7
index 1d98ef3..1cd0e1f 100644
@@ -40,16 +40,12 @@
 /* Configure a free-running, auto-wrap counter with no prescaler */
 int timer_init(void)
 {
+	ulong val;
+
 	writel(MTU_CRn_ENA | MTU_CRn_PRESCALE_1 | MTU_CRn_32BITS,
 	       CONFIG_SYS_TIMERBASE + MTU_CR(0));
-	reset_timer();
-	return 0;
-}
 
-/* Restart counting from 0 */
-void reset_timer(void)
-{
-	ulong val;
+	/* Reset the timer */
 	writel(0, CONFIG_SYS_TIMERBASE + MTU_LR(0));
 	/*
 	 * The load-register isn't really immediate: it changes on clock
@@ -59,6 +55,8 @@ void reset_timer(void)
 	val = READ_TIMER();
 	while (READ_TIMER() == val)
 		;
+
+	return 0;
 }
 
 /* Return how many HZ passed since "base" */
arch/arm/cpu/arm926ejs/omap/timer.c +0 -6
index f2e4deb..390c9c8 100644
@@ -65,12 +65,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;
arch/arm/cpu/arm926ejs/orion5x/timer.c +0 -5
index f691c99..5bc43c8 100644
@@ -119,11 +119,6 @@ ulong get_timer_masked(void)
 	return timestamp;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/arm926ejs/pantheon/timer.c +0 -5
index b487416..2727adc 100644
@@ -108,11 +108,6 @@ ulong get_timer_masked(void)
 	return gd->tbu;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return ((get_timer_masked() / (CONFIG_SYS_HZ_CLOCK / 1000)) -
arch/arm/cpu/arm926ejs/spear/timer.c +0 -6
index 7305abd..cbef34f 100644
@@ -76,12 +76,6 @@ int timer_init(void)
 /*
  * timer without interrupts
  */
-
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return (get_timer_masked() / GPT_RESOLUTION) - base;
arch/arm/cpu/arm926ejs/versatile/timer.c +0 -6
index 0e51a63..f58e151 100644
@@ -94,12 +94,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;
arch/arm/cpu/armv7/mx5/timer.c +0 -5
index 40ee0be..4525beb 100644
@@ -69,11 +69,6 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 void reset_timer_masked(void)
 {
 	ulong val = __raw_readl(&cur_gpt->counter);
arch/arm/cpu/armv7/omap-common/timer.c +0 -5
index 5dcd044..24ab853 100644
@@ -62,11 +62,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;
arch/arm/cpu/armv7/s5p-common/timer.c +0 -5
index 0b69f06..359c21f 100644
@@ -50,11 +50,6 @@ int timer_init(void)
 /*
  * timer without interrupts
  */
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 unsigned long get_timer(unsigned long base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/armv7/tegra2/timer.c +0 -5
index 4458de9..2761c12 100644
@@ -48,11 +48,6 @@ struct timerus *timer_base = (struct timerus *)NV_PA_TMRUS_BASE;
 #define TIMER_LOAD_VAL	0xffffffff
 
 /* timer without interrupts */
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/ixp/timer.c +0 -5
index edf341f..1ab8cd3 100644
@@ -61,11 +61,6 @@ ulong get_timer (ulong base)
 	return timestamp - base;
 }
 
-void reset_timer (void)
-{
-	timestamp = 0;
-}
-
 int timer_init (void)
 {
 	/* install interrupt handler for timer */
arch/arm/cpu/lh7a40x/timer.c +0 -6
index 6c6277d..58b35b1 100644
@@ -74,12 +74,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);
arch/arm/cpu/pxa/timer.c +1 -6
index 8900a70..44dae9a 100644
@@ -59,16 +59,11 @@ static inline unsigned long long us_to_tick(unsigned long long us)
 
 int timer_init (void)
 {
-	reset_timer();
+	reset_timer_masked();
 
 	return 0;
 }
 
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base)
 {
 	return get_timer_masked () - base;
arch/arm/cpu/s3c44b0/timer.c +0 -6
index d30e1aa..ce48952 100644
@@ -59,12 +59,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;
arch/arm/cpu/sa1100/timer.c +0 -5
index 10ad964..694c03a 100644
@@ -34,11 +34,6 @@ int timer_init (void)
 	return 0;
 }
 
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base)
 {
 	return get_timer_masked ();
arch/avr32/cpu/interrupts.c +0 -7
index 8406f91..6681e13 100644
@@ -62,13 +62,6 @@ unsigned long long get_ticks(void)
 	return ((unsigned long long)hi_now << 32) | lo;
 }
 
-void reset_timer(void)
-{
-	sysreg_write(COUNT, 0);
-	cpu_sync_pipeline();	/* process any pending interrupts */
-	timer_overflow = 0;
-}
-
 unsigned long get_timer(unsigned long base)
 {
 	u64 now = get_ticks();
arch/blackfin/cpu/interrupts.c +0 -5
index 54a67b4..9189816 100644
@@ -152,8 +152,3 @@ ulong get_timer(ulong base)
 
 	return (milisec - base);
 }
-
-void reset_timer(void)
-{
-	timer_init();
-}
arch/m68k/cpu/mcf547x_8x/slicetimer.c +0 -5
index 49dba6a..467a807 100644
@@ -95,11 +95,6 @@ void timer_init(void)
 	timerp->cr = SLT_CR_RUN | SLT_CR_IEN | SLT_CR_TEN;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	return (timestamp - base);
arch/m68k/lib/time.c +0 -5
index d10bcc7..a316cdf 100644
@@ -116,11 +116,6 @@ void timer_init(void)
 	    DTIM_DTMR_FRR | DTIM_DTMR_ORRI | DTIM_DTMR_RST_EN;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	return (timestamp - base);
arch/microblaze/cpu/timer.c +1 -6
index 59ed126..a167755 100644
@@ -28,11 +28,6 @@
 
 volatile int timestamp = 0;
 
-void reset_timer (void)
-{
-	timestamp = 0;
-}
-
 #ifdef CONFIG_SYS_TIMER_0
 ulong get_timer (ulong base)
 {
@@ -61,7 +56,7 @@ int timer_init (void)
 	tmr->control = TIMER_INTERRUPT | TIMER_RESET;
 	tmr->control =
 	    TIMER_ENABLE | TIMER_ENABLE_INTR | TIMER_RELOAD | TIMER_DOWN_COUNT;
-	reset_timer ();
+	timestamp = 0;
 	install_interrupt_handler (CONFIG_SYS_TIMER_0_IRQ, timer_isr, (void *)tmr);
 	return 0;
 }
arch/mips/cpu/mips32/time.c +0 -6
index b0a9c1f..350896a 100644
@@ -42,12 +42,6 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-	write_c0_compare(read_c0_count() + CYCLES_PER_JIFFY);
-}
-
 ulong get_timer(ulong base)
 {
 	unsigned int count;
arch/powerpc/lib/interrupts.c +0 -5
index 847ad37..aeae413 100644
@@ -137,11 +137,6 @@ void timer_interrupt (struct pt_regs *regs)
 #endif /* CONFIG_SHOW_ACTIVITY */
 }
 
-void reset_timer (void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer (ulong base)
 {
 	return (timestamp - base);
arch/sh/lib/time.c +0 -7
index c4bfc86..c70baed 100644
@@ -139,13 +139,6 @@ unsigned long get_timer (unsigned long base)
 	return tick_to_time(get_ticks()) - base;
 }
 
-void reset_timer (void)
-{
-	tmu_timer_stop(0);
-	writel(0, TCNT0);
-	tmu_timer_start(0);
-}
-
 unsigned long get_tbclk (void)
 {
 	return timer_freq;
arch/sh/lib/time_sh2.c +0 -8
index a5c838b..5827118 100644
@@ -90,14 +90,6 @@ ulong get_timer(ulong base)
 	return (get_usec() / 1000) - base;
 }
 
-void reset_timer(void)
-{
-	cmt_timer_stop(0);
-	writew(CMT_TIMER_RESET, CMCOR_0);
-	cmt0_timer = 0;
-	cmt_timer_start(0);
-}
-
 void __udelay(unsigned long usec)
 {
 	unsigned long end = get_usec() + usec;
arch/sparc/lib/interrupts.c +1 -6
index 5274311..61ee90b 100644
@@ -90,11 +90,6 @@ void timer_interrupt(struct pt_regs *regs)
 	timestamp++;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	return (timestamp - base);
@@ -104,7 +99,7 @@ void timer_interrupt_init(void)
 {
 	int irq;
 
-	reset_timer();
+	timestamp = 0;
 
 	irq = timer_interrupt_init_cpu();
 
arch/x86/lib/timer.c +0 -5
index 199ca8e..a822d66 100644
@@ -94,11 +94,6 @@ void timer_isr(void *unused)
 	}
 }
 
-void reset_timer (void)
-{
-	system_ticks = 0;
-}
-
 ulong get_timer (ulong base)
 {
 	return (system_ticks - base);
board/armltd/integrator/timer.c +0 -5
index 5406066..6734e8d 100644
@@ -107,11 +107,6 @@ int timer_init (void)
 /*
  * timer without interrupts
  */
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base_ticks)
 {
 	return get_timer_masked () - base_ticks;
board/armltd/vexpress/ca9x4_ct_vxp.c +0 -5
index 6e5884b..da6f14d 100644
@@ -199,11 +199,6 @@ void reset_timer_masked(void)
 	timestamp = 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer_masked(void)
 {
 	ulong now = readl(&systimer_base->timer0value) / 1000;
board/nvidia/common/board.c +0 -1
index 3d6c248..c48c7ef 100644
@@ -62,7 +62,6 @@ int board_early_init_f(void)
  */
 int timer_init(void)
 {
-	reset_timer();
 	return 0;
 }
 
Signature · 1 line
1.7.5.2.317.g391b14
#31 lore raw

PATCH 5/16 Remove reset_timer() for non-Nios2 arches

Dear Graeme Russ,

Quoted 2 lines · In message <[email protected]> you wrote:

Seems this patch conflicts with 03/16, which apparently already removed the same code, at least in some places?

Best regards,

Wolfgang Denk

Signature · 6 lines
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: wd at denx.de
"He only drinks when he gets depressed." "Why does he get depressed?"
"Sometimes it's because he hasn't had a drink."
                                     - Terry Pratchett, _Men at Arms_
#32 lore raw

PATCH 5/16 Remove reset_timer() for non-Nios2 arches

Quoted 8 lines · Wolfgang Denk

Dear Graeme Russ,

Quoted 2 lines · In message <[email protected]> you wrote:

Seems this patch conflicts with 03/16, which apparently already removed the same code, at least in some places?

The conflict was due to a recent patch submitted outside this series - Fixed during rebase

Regards,

Graeme

#33 lore raw

PATCH v2 5/7 Timer: Remove reset_timer() for non-Nios2 arches

In reply to Graeme Russ

---
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

 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(-)
arch/arm/cpu/arm1136/mx31/timer.c +0 -5
index d51acbb..eac4ffb 100644
@@ -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 */
arch/arm/cpu/arm1136/mx35/timer.c +0 -5
index 6dfb63a..80c0675 100644
@@ -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;
arch/arm/cpu/arm1136/omap24xx/timer.c +0 -5
index d6267ba..6f1ebbf 100644
@@ -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;
arch/arm/cpu/arm1176/s3c64xx/timer.c +0 -5
index 8e54060..bc21f86 100644
@@ -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();
arch/arm/cpu/arm1176/tnetv107x/timer.c +0 -9
index c27375c..b3123c5 100644
@@ -60,15 +60,6 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_timer(void)
-{
-	lastinc = timestamp = 0;
-
-	__raw_writel(0,		&regs->tcr);
-	__raw_writel(0,		&regs->tim34);
-	__raw_writel(2 << 22,	&regs->tcr);
-}
-
 static ulong get_timer_raw(void)
 {
 	ulong now = __raw_readl(&regs->tim34);
arch/arm/cpu/arm720t/interrupts.c +0 -5
index 164ca5d..9cd7fee 100644
@@ -209,11 +209,6 @@ int timer_init (void)
 
 #if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_NETARM) || defined(CONFIG_ARMADILLO) || defined(CONFIG_LPC2292)
 
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base)
 {
 	return get_timer_masked () - base;
arch/arm/cpu/arm920t/a320/timer.c +0 -6
index b9c83c0..443d31d 100644
@@ -81,12 +81,6 @@ void reset_timer_masked(void)
 	debug("%s(): lastdec = %lx\n", __func__, lastdec);
 }
 
-void reset_timer(void)
-{
-	debug("%s()\n", __func__);
-	reset_timer_masked();
-}
-
 /*
  * return timer ticks
  */
arch/arm/cpu/arm920t/at91/timer.c +0 -6
index a69de57..374cc25 100644
@@ -72,12 +72,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;
arch/arm/cpu/arm920t/at91rm9200/timer.c +0 -6
index 0bcb775..9a1ae85 100644
@@ -71,12 +71,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;
arch/arm/cpu/arm920t/ep93xx/timer.c +0 -5
index 4a0ce4d..f19ec61 100644
@@ -97,11 +97,6 @@ void reset_timer_masked(void)
 	timer.ticks = 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 void __udelay(unsigned long usec)
 {
 	unsigned long long target;
arch/arm/cpu/arm920t/imx/timer.c +0 -6
index ff85a41..cdb2148 100644
@@ -51,12 +51,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;
arch/arm/cpu/arm920t/ks8695/timer.c +1 -6
index 8e14109..c78fd90 100644
@@ -33,7 +33,7 @@ ulong timer_ticks;
 
 int timer_init (void)
 {
-	reset_timer();
+	reset_timer_masked();
 
 	return 0;
 }
@@ -55,11 +55,6 @@ void reset_timer_masked(void)
 	timer_ticks = 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer_masked(void)
 {
 	/* Check for timer wrap */
arch/arm/cpu/arm920t/s3c24x0/timer.c +0 -6
index bba06d5..9c71b80 100644
@@ -83,12 +83,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;
arch/arm/cpu/arm925t/timer.c +0 -6
index fdaeda5..9c965e0 100644
@@ -64,12 +64,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;
arch/arm/cpu/arm926ejs/armada100/timer.c +0 -5
index eb49234..86da0ce 100644
@@ -100,11 +100,6 @@ ulong get_timer_masked(void)
 	return gd->tbu;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return ((get_timer_masked() / (CONFIG_SYS_HZ_CLOCK / 1000)) -
arch/arm/cpu/arm926ejs/davinci/timer.c +0 -5
index 1c6fa4a..8b1734c 100644
@@ -78,11 +78,6 @@ int timer_init(void)
 	return(0);
 }
 
-void reset_timer(void)
-{
-	gd->timer_reset_value = get_ticks();
-}
-
 /*
  * Get the current 64 bit timer tick count
  */
arch/arm/cpu/arm926ejs/kirkwood/timer.c +0 -5
index e890edb..5beb3f5 100644
@@ -112,11 +112,6 @@ ulong get_timer_masked(void)
 	return timestamp;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/arm926ejs/mb86r0x/timer.c +0 -5
index 6966b0d..5f54085 100644
@@ -121,11 +121,6 @@ void __udelay(unsigned long usec)
 		 /*NOP*/;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/arm926ejs/mx25/timer.c +0 -5
index af26b4c..9a84b50 100644
@@ -130,11 +130,6 @@ void reset_timer_masked(void)
 	timestamp = 0; /* start "advancing" time stamp from 0 */
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 unsigned long long get_ticks (void)
 {
 	struct gpt_regs *gpt = (struct gpt_regs *)IMX_GPT1_BASE;
arch/arm/cpu/arm926ejs/mx27/timer.c +0 -5
index 127e670..058dbee 100644
@@ -133,11 +133,6 @@ void reset_timer_masked(void)
 	timestamp = 0; /* start "advancing" time stamp from 0 */
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 unsigned long long get_ticks (void)
 {
 	struct gpt_regs *regs = (struct gpt_regs *)IMX_TIM1_BASE;
arch/arm/cpu/arm926ejs/nomadik/timer.c +5 -7
index 1d98ef3..1cd0e1f 100644
@@ -40,16 +40,12 @@
 /* Configure a free-running, auto-wrap counter with no prescaler */
 int timer_init(void)
 {
+	ulong val;
+
 	writel(MTU_CRn_ENA | MTU_CRn_PRESCALE_1 | MTU_CRn_32BITS,
 	       CONFIG_SYS_TIMERBASE + MTU_CR(0));
-	reset_timer();
-	return 0;
-}
 
-/* Restart counting from 0 */
-void reset_timer(void)
-{
-	ulong val;
+	/* Reset the timer */
 	writel(0, CONFIG_SYS_TIMERBASE + MTU_LR(0));
 	/*
 	 * The load-register isn't really immediate: it changes on clock
@@ -59,6 +55,8 @@ void reset_timer(void)
 	val = READ_TIMER();
 	while (READ_TIMER() == val)
 		;
+
+	return 0;
 }
 
 /* Return how many HZ passed since "base" */
arch/arm/cpu/arm926ejs/omap/timer.c +0 -6
index f2e4deb..390c9c8 100644
@@ -65,12 +65,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;
arch/arm/cpu/arm926ejs/orion5x/timer.c +0 -5
index f691c99..5bc43c8 100644
@@ -119,11 +119,6 @@ ulong get_timer_masked(void)
 	return timestamp;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/arm926ejs/pantheon/timer.c +0 -5
index b487416..2727adc 100644
@@ -108,11 +108,6 @@ ulong get_timer_masked(void)
 	return gd->tbu;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return ((get_timer_masked() / (CONFIG_SYS_HZ_CLOCK / 1000)) -
arch/arm/cpu/arm926ejs/spear/timer.c +0 -6
index 7305abd..cbef34f 100644
@@ -76,12 +76,6 @@ int timer_init(void)
 /*
  * timer without interrupts
  */
-
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return (get_timer_masked() / GPT_RESOLUTION) - base;
arch/arm/cpu/arm926ejs/versatile/timer.c +0 -6
index 0e51a63..f58e151 100644
@@ -94,12 +94,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;
arch/arm/cpu/armv7/mx5/timer.c +0 -5
index 40ee0be..4525beb 100644
@@ -69,11 +69,6 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 void reset_timer_masked(void)
 {
 	ulong val = __raw_readl(&cur_gpt->counter);
arch/arm/cpu/armv7/omap-common/timer.c +0 -5
index a0f6b7c..4756e26 100644
@@ -63,11 +63,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;
arch/arm/cpu/armv7/s5p-common/timer.c +0 -5
index 0b69f06..359c21f 100644
@@ -50,11 +50,6 @@ int timer_init(void)
 /*
  * timer without interrupts
  */
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 unsigned long get_timer(unsigned long base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/armv7/tegra2/timer.c +0 -5
index 4458de9..2761c12 100644
@@ -48,11 +48,6 @@ struct timerus *timer_base = (struct timerus *)NV_PA_TMRUS_BASE;
 #define TIMER_LOAD_VAL	0xffffffff
 
 /* timer without interrupts */
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/ixp/timer.c +0 -5
index c25e72f..087ddf8 100644
@@ -89,11 +89,6 @@ void reset_timer_masked(void)
 	gd->timestamp = 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer_masked(void)
 {
 	return tick_to_time(get_ticks());
arch/arm/cpu/lh7a40x/timer.c +0 -6
index 6c6277d..58b35b1 100644
@@ -74,12 +74,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);
arch/arm/cpu/pxa/timer.c +1 -6
index 8900a70..44dae9a 100644
@@ -59,16 +59,11 @@ static inline unsigned long long us_to_tick(unsigned long long us)
 
 int timer_init (void)
 {
-	reset_timer();
+	reset_timer_masked();
 
 	return 0;
 }
 
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base)
 {
 	return get_timer_masked () - base;
arch/arm/cpu/s3c44b0/timer.c +0 -6
index d30e1aa..ce48952 100644
@@ -59,12 +59,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;
arch/arm/cpu/sa1100/timer.c +0 -5
index 10ad964..694c03a 100644
@@ -34,11 +34,6 @@ int timer_init (void)
 	return 0;
 }
 
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base)
 {
 	return get_timer_masked ();
arch/avr32/cpu/interrupts.c +0 -7
index 8406f91..6681e13 100644
@@ -62,13 +62,6 @@ unsigned long long get_ticks(void)
 	return ((unsigned long long)hi_now << 32) | lo;
 }
 
-void reset_timer(void)
-{
-	sysreg_write(COUNT, 0);
-	cpu_sync_pipeline();	/* process any pending interrupts */
-	timer_overflow = 0;
-}
-
 unsigned long get_timer(unsigned long base)
 {
 	u64 now = get_ticks();
arch/blackfin/cpu/interrupts.c +0 -5
index 54a67b4..9189816 100644
@@ -152,8 +152,3 @@ ulong get_timer(ulong base)
 
 	return (milisec - base);
 }
-
-void reset_timer(void)
-{
-	timer_init();
-}
arch/m68k/cpu/mcf547x_8x/slicetimer.c +0 -5
index 49dba6a..467a807 100644
@@ -95,11 +95,6 @@ void timer_init(void)
 	timerp->cr = SLT_CR_RUN | SLT_CR_IEN | SLT_CR_TEN;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	return (timestamp - base);
arch/m68k/lib/time.c +0 -5
index d10bcc7..a316cdf 100644
@@ -116,11 +116,6 @@ void timer_init(void)
 	    DTIM_DTMR_FRR | DTIM_DTMR_ORRI | DTIM_DTMR_RST_EN;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	return (timestamp - base);
arch/microblaze/cpu/timer.c +1 -6
index 59ed126..a167755 100644
@@ -28,11 +28,6 @@
 
 volatile int timestamp = 0;
 
-void reset_timer (void)
-{
-	timestamp = 0;
-}
-
 #ifdef CONFIG_SYS_TIMER_0
 ulong get_timer (ulong base)
 {
@@ -61,7 +56,7 @@ int timer_init (void)
 	tmr->control = TIMER_INTERRUPT | TIMER_RESET;
 	tmr->control =
 	    TIMER_ENABLE | TIMER_ENABLE_INTR | TIMER_RELOAD | TIMER_DOWN_COUNT;
-	reset_timer ();
+	timestamp = 0;
 	install_interrupt_handler (CONFIG_SYS_TIMER_0_IRQ, timer_isr, (void *)tmr);
 	return 0;
 }
arch/mips/cpu/mips32/time.c +0 -6
index b0a9c1f..350896a 100644
@@ -42,12 +42,6 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-	write_c0_compare(read_c0_count() + CYCLES_PER_JIFFY);
-}
-
 ulong get_timer(ulong base)
 {
 	unsigned int count;
arch/powerpc/lib/interrupts.c +0 -5
index 847ad37..aeae413 100644
@@ -137,11 +137,6 @@ void timer_interrupt (struct pt_regs *regs)
 #endif /* CONFIG_SHOW_ACTIVITY */
 }
 
-void reset_timer (void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer (ulong base)
 {
 	return (timestamp - base);
arch/sh/lib/time.c +0 -7
index c4bfc86..c70baed 100644
@@ -139,13 +139,6 @@ unsigned long get_timer (unsigned long base)
 	return tick_to_time(get_ticks()) - base;
 }
 
-void reset_timer (void)
-{
-	tmu_timer_stop(0);
-	writel(0, TCNT0);
-	tmu_timer_start(0);
-}
-
 unsigned long get_tbclk (void)
 {
 	return timer_freq;
arch/sh/lib/time_sh2.c +0 -8
index a5c838b..5827118 100644
@@ -90,14 +90,6 @@ ulong get_timer(ulong base)
 	return (get_usec() / 1000) - base;
 }
 
-void reset_timer(void)
-{
-	cmt_timer_stop(0);
-	writew(CMT_TIMER_RESET, CMCOR_0);
-	cmt0_timer = 0;
-	cmt_timer_start(0);
-}
-
 void __udelay(unsigned long usec)
 {
 	unsigned long end = get_usec() + usec;
arch/sparc/lib/interrupts.c +1 -6
index 5274311..61ee90b 100644
@@ -90,11 +90,6 @@ void timer_interrupt(struct pt_regs *regs)
 	timestamp++;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	return (timestamp - base);
@@ -104,7 +99,7 @@ void timer_interrupt_init(void)
 {
 	int irq;
 
-	reset_timer();
+	timestamp = 0;
 
 	irq = timer_interrupt_init_cpu();
 
arch/x86/lib/timer.c +0 -5
index 199ca8e..a822d66 100644
@@ -94,11 +94,6 @@ void timer_isr(void *unused)
 	}
 }
 
-void reset_timer (void)
-{
-	system_ticks = 0;
-}
-
 ulong get_timer (ulong base)
 {
 	return (system_ticks - base);
board/armltd/integrator/timer.c +0 -5
index 5406066..6734e8d 100644
@@ -107,11 +107,6 @@ int timer_init (void)
 /*
  * timer without interrupts
  */
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base_ticks)
 {
 	return get_timer_masked () - base_ticks;
board/armltd/vexpress/ca9x4_ct_vxp.c +0 -5
index 6e5884b..da6f14d 100644
@@ -199,11 +199,6 @@ void reset_timer_masked(void)
 	timestamp = 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer_masked(void)
 {
 	ulong now = readl(&systimer_base->timer0value) / 1000;
board/nvidia/common/board.c +0 -1
index 3d6c248..c48c7ef 100644
@@ -62,7 +62,6 @@ int board_early_init_f(void)
  */
 int timer_init(void)
 {
-	reset_timer();
 	return 0;
 }
 

--
1.7.5.2.317.g391b14

#34 lore raw

PATCH v3 5/7 Timer: Remove reset_timer() for non-Nios2 arches

---
Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

 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(-)
arch/arm/cpu/arm1136/mx31/timer.c +0 -5
index d51acbb..eac4ffb 100644
@@ -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 */
arch/arm/cpu/arm1136/mx35/timer.c +0 -5
index 6dfb63a..80c0675 100644
@@ -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;
arch/arm/cpu/arm1136/omap24xx/timer.c +0 -5
index d6267ba..6f1ebbf 100644
@@ -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;
arch/arm/cpu/arm1176/s3c64xx/timer.c +0 -5
index 8e54060..bc21f86 100644
@@ -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();
arch/arm/cpu/arm1176/tnetv107x/timer.c +0 -9
index c27375c..b3123c5 100644
@@ -60,15 +60,6 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_timer(void)
-{
-	lastinc = timestamp = 0;
-
-	__raw_writel(0,		&regs->tcr);
-	__raw_writel(0,		&regs->tim34);
-	__raw_writel(2 << 22,	&regs->tcr);
-}
-
 static ulong get_timer_raw(void)
 {
 	ulong now = __raw_readl(&regs->tim34);
arch/arm/cpu/arm720t/interrupts.c +0 -5
index 164ca5d..9cd7fee 100644
@@ -209,11 +209,6 @@ int timer_init (void)
 
 #if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_NETARM) || defined(CONFIG_ARMADILLO) || defined(CONFIG_LPC2292)
 
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base)
 {
 	return get_timer_masked () - base;
arch/arm/cpu/arm920t/a320/timer.c +0 -6
index b9c83c0..443d31d 100644
@@ -81,12 +81,6 @@ void reset_timer_masked(void)
 	debug("%s(): lastdec = %lx\n", __func__, lastdec);
 }
 
-void reset_timer(void)
-{
-	debug("%s()\n", __func__);
-	reset_timer_masked();
-}
-
 /*
  * return timer ticks
  */
arch/arm/cpu/arm920t/at91/timer.c +0 -6
index a69de57..374cc25 100644
@@ -72,12 +72,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;
arch/arm/cpu/arm920t/at91rm9200/timer.c +0 -6
index 0bcb775..9a1ae85 100644
@@ -71,12 +71,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;
arch/arm/cpu/arm920t/ep93xx/timer.c +0 -5
index 4a0ce4d..f19ec61 100644
@@ -97,11 +97,6 @@ void reset_timer_masked(void)
 	timer.ticks = 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 void __udelay(unsigned long usec)
 {
 	unsigned long long target;
arch/arm/cpu/arm920t/imx/timer.c +0 -6
index ff85a41..cdb2148 100644
@@ -51,12 +51,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;
arch/arm/cpu/arm920t/ks8695/timer.c +1 -6
index 8e14109..c78fd90 100644
@@ -33,7 +33,7 @@ ulong timer_ticks;
 
 int timer_init (void)
 {
-	reset_timer();
+	reset_timer_masked();
 
 	return 0;
 }
@@ -55,11 +55,6 @@ void reset_timer_masked(void)
 	timer_ticks = 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer_masked(void)
 {
 	/* Check for timer wrap */
arch/arm/cpu/arm920t/s3c24x0/timer.c +0 -6
index bba06d5..9c71b80 100644
@@ -83,12 +83,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;
arch/arm/cpu/arm925t/timer.c +0 -6
index fdaeda5..9c965e0 100644
@@ -64,12 +64,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;
arch/arm/cpu/arm926ejs/armada100/timer.c +0 -5
index eb49234..86da0ce 100644
@@ -100,11 +100,6 @@ ulong get_timer_masked(void)
 	return gd->tbu;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return ((get_timer_masked() / (CONFIG_SYS_HZ_CLOCK / 1000)) -
arch/arm/cpu/arm926ejs/davinci/timer.c +0 -5
index 1c6fa4a..8b1734c 100644
@@ -78,11 +78,6 @@ int timer_init(void)
 	return(0);
 }
 
-void reset_timer(void)
-{
-	gd->timer_reset_value = get_ticks();
-}
-
 /*
  * Get the current 64 bit timer tick count
  */
arch/arm/cpu/arm926ejs/kirkwood/timer.c +0 -5
index e890edb..5beb3f5 100644
@@ -112,11 +112,6 @@ ulong get_timer_masked(void)
 	return timestamp;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/arm926ejs/mb86r0x/timer.c +0 -5
index 6966b0d..5f54085 100644
@@ -121,11 +121,6 @@ void __udelay(unsigned long usec)
 		 /*NOP*/;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/arm926ejs/mx25/timer.c +0 -5
index af26b4c..9a84b50 100644
@@ -130,11 +130,6 @@ void reset_timer_masked(void)
 	timestamp = 0; /* start "advancing" time stamp from 0 */
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 unsigned long long get_ticks (void)
 {
 	struct gpt_regs *gpt = (struct gpt_regs *)IMX_GPT1_BASE;
arch/arm/cpu/arm926ejs/mx27/timer.c +0 -5
index 127e670..058dbee 100644
@@ -133,11 +133,6 @@ void reset_timer_masked(void)
 	timestamp = 0; /* start "advancing" time stamp from 0 */
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 unsigned long long get_ticks (void)
 {
 	struct gpt_regs *regs = (struct gpt_regs *)IMX_TIM1_BASE;
arch/arm/cpu/arm926ejs/nomadik/timer.c +5 -7
index 1d98ef3..1cd0e1f 100644
@@ -40,16 +40,12 @@
 /* Configure a free-running, auto-wrap counter with no prescaler */
 int timer_init(void)
 {
+	ulong val;
+
 	writel(MTU_CRn_ENA | MTU_CRn_PRESCALE_1 | MTU_CRn_32BITS,
 	       CONFIG_SYS_TIMERBASE + MTU_CR(0));
-	reset_timer();
-	return 0;
-}
 
-/* Restart counting from 0 */
-void reset_timer(void)
-{
-	ulong val;
+	/* Reset the timer */
 	writel(0, CONFIG_SYS_TIMERBASE + MTU_LR(0));
 	/*
 	 * The load-register isn't really immediate: it changes on clock
@@ -59,6 +55,8 @@ void reset_timer(void)
 	val = READ_TIMER();
 	while (READ_TIMER() == val)
 		;
+
+	return 0;
 }
 
 /* Return how many HZ passed since "base" */
arch/arm/cpu/arm926ejs/omap/timer.c +0 -6
index f2e4deb..390c9c8 100644
@@ -65,12 +65,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;
arch/arm/cpu/arm926ejs/orion5x/timer.c +0 -5
index f691c99..5bc43c8 100644
@@ -119,11 +119,6 @@ ulong get_timer_masked(void)
 	return timestamp;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/arm926ejs/pantheon/timer.c +0 -5
index b487416..2727adc 100644
@@ -108,11 +108,6 @@ ulong get_timer_masked(void)
 	return gd->tbu;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return ((get_timer_masked() / (CONFIG_SYS_HZ_CLOCK / 1000)) -
arch/arm/cpu/arm926ejs/spear/timer.c +0 -6
index 7305abd..cbef34f 100644
@@ -76,12 +76,6 @@ int timer_init(void)
 /*
  * timer without interrupts
  */
-
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return (get_timer_masked() / GPT_RESOLUTION) - base;
arch/arm/cpu/arm926ejs/versatile/timer.c +0 -6
index 0e51a63..f58e151 100644
@@ -94,12 +94,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;
arch/arm/cpu/armv7/mx5/timer.c +0 -5
index 40ee0be..4525beb 100644
@@ -69,11 +69,6 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 void reset_timer_masked(void)
 {
 	ulong val = __raw_readl(&cur_gpt->counter);
arch/arm/cpu/armv7/omap-common/timer.c +0 -5
index a0f6b7c..4756e26 100644
@@ -63,11 +63,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;
arch/arm/cpu/armv7/s5p-common/timer.c +0 -5
index 0b69f06..359c21f 100644
@@ -50,11 +50,6 @@ int timer_init(void)
 /*
  * timer without interrupts
  */
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 unsigned long get_timer(unsigned long base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/armv7/tegra2/timer.c +0 -5
index 4458de9..2761c12 100644
@@ -48,11 +48,6 @@ struct timerus *timer_base = (struct timerus *)NV_PA_TMRUS_BASE;
 #define TIMER_LOAD_VAL	0xffffffff
 
 /* timer without interrupts */
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer(ulong base)
 {
 	return get_timer_masked() - base;
arch/arm/cpu/ixp/timer.c +0 -5
index c25e72f..087ddf8 100644
@@ -89,11 +89,6 @@ void reset_timer_masked(void)
 	gd->timestamp = 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer_masked(void)
 {
 	return tick_to_time(get_ticks());
arch/arm/cpu/lh7a40x/timer.c +0 -6
index 6c6277d..58b35b1 100644
@@ -74,12 +74,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);
arch/arm/cpu/pxa/timer.c +1 -6
index 8900a70..44dae9a 100644
@@ -59,16 +59,11 @@ static inline unsigned long long us_to_tick(unsigned long long us)
 
 int timer_init (void)
 {
-	reset_timer();
+	reset_timer_masked();
 
 	return 0;
 }
 
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base)
 {
 	return get_timer_masked () - base;
arch/arm/cpu/s3c44b0/timer.c +0 -6
index d30e1aa..ce48952 100644
@@ -59,12 +59,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;
arch/arm/cpu/sa1100/timer.c +0 -5
index 10ad964..694c03a 100644
@@ -34,11 +34,6 @@ int timer_init (void)
 	return 0;
 }
 
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base)
 {
 	return get_timer_masked ();
arch/avr32/cpu/interrupts.c +0 -7
index 8406f91..6681e13 100644
@@ -62,13 +62,6 @@ unsigned long long get_ticks(void)
 	return ((unsigned long long)hi_now << 32) | lo;
 }
 
-void reset_timer(void)
-{
-	sysreg_write(COUNT, 0);
-	cpu_sync_pipeline();	/* process any pending interrupts */
-	timer_overflow = 0;
-}
-
 unsigned long get_timer(unsigned long base)
 {
 	u64 now = get_ticks();
arch/blackfin/cpu/interrupts.c +0 -5
index 54a67b4..9189816 100644
@@ -152,8 +152,3 @@ ulong get_timer(ulong base)
 
 	return (milisec - base);
 }
-
-void reset_timer(void)
-{
-	timer_init();
-}
arch/m68k/cpu/mcf547x_8x/slicetimer.c +0 -5
index 49dba6a..467a807 100644
@@ -95,11 +95,6 @@ void timer_init(void)
 	timerp->cr = SLT_CR_RUN | SLT_CR_IEN | SLT_CR_TEN;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	return (timestamp - base);
arch/m68k/lib/time.c +0 -5
index d10bcc7..a316cdf 100644
@@ -116,11 +116,6 @@ void timer_init(void)
 	    DTIM_DTMR_FRR | DTIM_DTMR_ORRI | DTIM_DTMR_RST_EN;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	return (timestamp - base);
arch/microblaze/cpu/timer.c +1 -6
index 59ed126..a167755 100644
@@ -28,11 +28,6 @@
 
 volatile int timestamp = 0;
 
-void reset_timer (void)
-{
-	timestamp = 0;
-}
-
 #ifdef CONFIG_SYS_TIMER_0
 ulong get_timer (ulong base)
 {
@@ -61,7 +56,7 @@ int timer_init (void)
 	tmr->control = TIMER_INTERRUPT | TIMER_RESET;
 	tmr->control =
 	    TIMER_ENABLE | TIMER_ENABLE_INTR | TIMER_RELOAD | TIMER_DOWN_COUNT;
-	reset_timer ();
+	timestamp = 0;
 	install_interrupt_handler (CONFIG_SYS_TIMER_0_IRQ, timer_isr, (void *)tmr);
 	return 0;
 }
arch/mips/cpu/mips32/time.c +0 -6
index b0a9c1f..350896a 100644
@@ -42,12 +42,6 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-	write_c0_compare(read_c0_count() + CYCLES_PER_JIFFY);
-}
-
 ulong get_timer(ulong base)
 {
 	unsigned int count;
arch/powerpc/lib/interrupts.c +0 -5
index 847ad37..aeae413 100644
@@ -137,11 +137,6 @@ void timer_interrupt (struct pt_regs *regs)
 #endif /* CONFIG_SHOW_ACTIVITY */
 }
 
-void reset_timer (void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer (ulong base)
 {
 	return (timestamp - base);
arch/sh/lib/time.c +0 -7
index c4bfc86..c70baed 100644
@@ -139,13 +139,6 @@ unsigned long get_timer (unsigned long base)
 	return tick_to_time(get_ticks()) - base;
 }
 
-void reset_timer (void)
-{
-	tmu_timer_stop(0);
-	writel(0, TCNT0);
-	tmu_timer_start(0);
-}
-
 unsigned long get_tbclk (void)
 {
 	return timer_freq;
arch/sh/lib/time_sh2.c +0 -8
index a5c838b..5827118 100644
@@ -90,14 +90,6 @@ ulong get_timer(ulong base)
 	return (get_usec() / 1000) - base;
 }
 
-void reset_timer(void)
-{
-	cmt_timer_stop(0);
-	writew(CMT_TIMER_RESET, CMCOR_0);
-	cmt0_timer = 0;
-	cmt_timer_start(0);
-}
-
 void __udelay(unsigned long usec)
 {
 	unsigned long end = get_usec() + usec;
arch/sparc/lib/interrupts.c +1 -6
index 5274311..61ee90b 100644
@@ -90,11 +90,6 @@ void timer_interrupt(struct pt_regs *regs)
 	timestamp++;
 }
 
-void reset_timer(void)
-{
-	timestamp = 0;
-}
-
 ulong get_timer(ulong base)
 {
 	return (timestamp - base);
@@ -104,7 +99,7 @@ void timer_interrupt_init(void)
 {
 	int irq;
 
-	reset_timer();
+	timestamp = 0;
 
 	irq = timer_interrupt_init_cpu();
 
arch/x86/lib/timer.c +0 -5
index 199ca8e..a822d66 100644
@@ -94,11 +94,6 @@ void timer_isr(void *unused)
 	}
 }
 
-void reset_timer (void)
-{
-	system_ticks = 0;
-}
-
 ulong get_timer (ulong base)
 {
 	return (system_ticks - base);
board/armltd/integrator/timer.c +0 -5
index 5406066..6734e8d 100644
@@ -107,11 +107,6 @@ int timer_init (void)
 /*
  * timer without interrupts
  */
-void reset_timer (void)
-{
-	reset_timer_masked ();
-}
-
 ulong get_timer (ulong base_ticks)
 {
 	return get_timer_masked () - base_ticks;
board/armltd/vexpress/ca9x4_ct_vxp.c +0 -5
index 6e5884b..da6f14d 100644
@@ -199,11 +199,6 @@ void reset_timer_masked(void)
 	timestamp = 0;
 }
 
-void reset_timer(void)
-{
-	reset_timer_masked();
-}
-
 ulong get_timer_masked(void)
 {
 	ulong now = readl(&systimer_base->timer0value) / 1000;
board/nvidia/common/board.c +0 -1
index 3d6c248..c48c7ef 100644
@@ -62,7 +62,6 @@ int board_early_init_f(void)
  */
 int timer_init(void)
 {
-	reset_timer();
 	return 0;
 }
 

--
1.7.5.2.317.g391b14

#35 lore raw

PATCH v3 5/7 Timer: Remove reset_timer() for non-Nios2 arches

Dear Graeme Russ,

Quoted 50 lines · In message <[email protected]> you wrote:

---
Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

 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 -----
Quoted 8 lines
 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(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
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: wd at denx.de
Heavier than air flying machines are impossible.
                    -- Lord Kelvin, President, Royal Society, c. 1895
#36 lore raw

PATCH v3 5/7 Timer: Remove reset_timer() for non-Nios2 arches

Quoted 3 lines · On Tuesday, July 26, 2011 08:53:37 Wolfgang Denk wrote:

Dear Graeme Russ,

In message <[email protected]> you

Quoted 60 lines · wrote:
Quoted 51 lines

---

Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

 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 -----
Quoted 8 lines
 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(-)
Quoted 1 line

Applied, thanks.

Wolfgang: is there something wrong with your application process ? it seems that Graeme had a proper s-o-b tag in his patch on the mailing list, but the patch that's actually in git is missing it (as are some others). any idea ? -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110819/72ff0967/attachment.pgp

#37 lore raw

PATCH v3 5/7 Timer: Remove reset_timer() for non-Nios2 arches

Mike,

Quoted 54 lines · Mike Frysinger
Quoted 3 lines · On Tuesday, July 26, 2011 08:53:37 Wolfgang Denk wrote:

Dear Graeme Russ,

In message <[email protected]> you

Quoted 41 lines · wrote:
Quoted 41 lines

---

Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

 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 ------
Quoted 8 lines
Quoted 8 lines
 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 +------
Quoted 1 line

Wolfgang: is there something wrong with your application process ? it

seems

Quoted 1 line

that Graeme had a proper s-o-b tag in his patch on the mailing list, but

the

Quoted 1 line

patch that's actually in git is missing it (as are some others). any idea

?

I wonder if git needs a blank line between the sob and ---

Regards,

Graeme

#38 lore raw

PATCH v3 5/7 Timer: Remove reset_timer() for non-Nios2 arches

Quoted 1 line · On Friday, August 19, 2011 18:55:38 Graeme Russ wrote:

I wonder if git needs a blank line between the sob and ---

mine never have
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110819/980a2251/attachment.pgp

#39 lore raw

PATCH v3 5/7 Timer: Remove reset_timer() for non-Nios2 arches

In reply to Mike Frysinger

Dear Mike Frysinger,

Quoted 4 lines · In message <[email protected]> you wrote:

Wolfgang: is there something wrong with your application process ? it seems that Graeme had a proper s-o-b tag in his patch on the mailing list, but the patch that's actually in git is missing it (as are some others). any idea ?

I think this might be a problem with PatchWork which matches patches based on their hash over the body only; if several versions of a the same patch get posted that differonly in the commit message, the hash based mapping will (incorrectly) pick the oldest entry.

Best regards,

Wolfgang Denk

Signature · 9 lines
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: wd at denx.de
[War] is instinctive. But the instinct can  be  fought.  We're  human
beings  with the blood of a million savage years on our hands! But we
can stop it. We can admit that we're killers ... but we're not  going
to  kill  today. That's all it takes! Knowing that we're not going to
kill today!
	-- Kirk, "A Taste of Armageddon", stardate 3193.0
#40 lore raw

PATCH 6/16 Fix at91rm9200/spi.c timer usage

In reply to Graeme Russ
---
 arch/arm/cpu/arm920t/at91rm9200/spi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/cpu/arm920t/at91rm9200/spi.c +3 -2
index f3cb5d8..c70efc6 100644
@@ -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;
 
Signature · 1 line
1.7.5.2.317.g391b14
#41 lore raw

PATCH 6/16 Fix at91rm9200/spi.c timer usage

Dear Graeme Russ,

Am 28.06.2011 13:40, schrieb Graeme Russ:

Quoted 5 lines
---
 arch/arm/cpu/arm920t/at91rm9200/spi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

don't mind arm920t/at91rm9200, it will be removed in this merge window (see end of doc/README.at91-soc and various discussion threads).

regards

Andreas Bie?mann

#42 lore raw

PATCH v2 6/7 Timer: Fix at91rm9200/spi.c timer usage

In reply to Graeme Russ

---
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

 arch/arm/cpu/arm920t/at91rm9200/spi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/cpu/arm920t/at91rm9200/spi.c +3 -2
index f3cb5d8..c70efc6 100644
@@ -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

#43 lore raw

PATCH v3 6/7 Timer: Fix at91rm9200/spi.c timer usage

---
Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

 arch/arm/cpu/arm920t/at91rm9200/spi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/cpu/arm920t/at91rm9200/spi.c +3 -2
index f3cb5d8..c70efc6 100644
@@ -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

#44 lore raw

PATCH v3 6/7 Timer: Fix at91rm9200/spi.c timer usage

Dear Graeme Russ,

Quoted 10 lines · In message <[email protected]> you wrote:

---
Changes since v2:
- Added Signed-off-by

Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6

 arch/arm/cpu/arm920t/at91rm9200/spi.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
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: wd at denx.de
The following statement is not true.  The previous statement is true.
#45 lore raw

PATCH 7/16 Remove reset_timer_masked()

In reply to Graeme Russ

Fold implementation into timer_init() where needed

---
 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(-)
arch/arm/cpu/arm1136/mx31/timer.c +0 -7
index eac4ffb..c05a39d 100644
@@ -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 */
arch/arm/cpu/arm1136/omap24xx/timer.c +7 -7
index 6f1ebbf..73bf4a7 100644
@@ -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 */
arch/arm/cpu/arm1176/s3c64xx/timer.c +0 -7
index bc21f86..f16a37b 100644
@@ -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();
arch/arm/cpu/arm720t/interrupts.c +0 -7
index 9cd7fee..fa9c5a2 100644
@@ -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;
arch/arm/cpu/arm920t/at91/timer.c +0 -8
index 374cc25..c321e28 100644
@@ -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) & 0x0000ffff;
-	gd->tbl = 0;
-}
-
 ulong get_timer_raw(void)
 {
 	at91_tc_t *tc = (at91_tc_t *) ATMEL_BASE_TC;
arch/arm/cpu/arm920t/at91rm9200/timer.c +0 -7
index 9a1ae85..fbe74b6 100644
@@ -81,13 +81,6 @@ void __udelay (unsigned long usec)
 	udelay_masked(usec);
 }
 
-void reset_timer_masked (void)
-{
-	/* reset time */
-	lastinc = READ_TIMER;
-	timestamp = 0;
-}
-
 ulong get_timer_raw (void)
 {
 	ulong now = READ_TIMER;
arch/arm/cpu/arm920t/ep93xx/timer.c +3 -7
index f19ec61..a3990a7 100644
@@ -91,12 +91,6 @@ unsigned long get_timer(unsigned long base)
 	return get_timer_masked() - base;
 }
 
-void reset_timer_masked(void)
-{
-	read_timer();
-	timer.ticks = 0;
-}
-
 void __udelay(unsigned long usec)
 {
 	unsigned long long target;
@@ -123,7 +117,9 @@ int timer_init(void)
 	writel(TIMER_ENABLE | TIMER_CLKSEL,
 		&timer_regs->timer3.control);
 
-	reset_timer_masked();
+	/* Reset the timer */
+	read_timer();
+	timer.ticks = 0;
 
 	return 0;
 }
arch/arm/cpu/arm920t/imx/timer.c +3 -7
index cdb2148..6141bd4 100644
@@ -43,7 +43,9 @@ int timer_init (void)
 	TPRER1 = get_PERCLK1() / 1000000; /* 1 MHz */
 	TCTL1 |= TCTL_FRR | (1<<1); /* Freerun Mode, PERCLK1 input */
 
-	reset_timer_masked();
+	/* Reset the timer */
+	TCTL1 &= ~TCTL_TEN;
+	TCTL1 |= TCTL_TEN; /* Enable timer */
 
 	return (0);
 }
@@ -56,12 +58,6 @@ ulong get_timer (ulong base)
 	return get_timer_masked() - base;
 }
 
-void reset_timer_masked (void)
-{
-	TCTL1 &= ~TCTL_TEN;
-	TCTL1 |= TCTL_TEN; /* Enable timer */
-}
-
 ulong get_timer_masked (void)
 {
 	return TCN1;
arch/arm/cpu/arm920t/ks8695/timer.c +5 -10
index c78fd90..234fe91 100644
@@ -33,7 +33,11 @@ ulong timer_ticks;
 
 int timer_init (void)
 {
-	reset_timer_masked();
+	/* Set the hadware timer for 1ms */
+	ks8695_write(KS8695_TIMER1, TIMER_COUNT);
+	ks8695_write(KS8695_TIMER1_PCOUNT, TIMER_PULSE);
+	ks8695_write(KS8695_TIMER_CTRL, 0x2);
+	timer_ticks = 0;
 
 	return 0;
 }
@@ -46,15 +50,6 @@ int timer_init (void)
 #define	TIMER_COUNT	(TIMER_INTERVAL / 2)
 #define	TIMER_PULSE	TIMER_COUNT
 
-void reset_timer_masked(void)
-{
-	/* Set the hadware timer for 1ms */
-	ks8695_write(KS8695_TIMER1, TIMER_COUNT);
-	ks8695_write(KS8695_TIMER1_PCOUNT, TIMER_PULSE);
-	ks8695_write(KS8695_TIMER_CTRL, 0x2);
-	timer_ticks = 0;
-}
-
 ulong get_timer_masked(void)
 {
 	/* Check for timer wrap */
arch/arm/cpu/arm920t/s3c24x0/timer.c +0 -7
index 4e50291..7327d6c 100644
@@ -101,13 +101,6 @@ void __udelay (unsigned long usec)
 		/*NOP*/;
 }
 
-void reset_timer_masked(void)
-{
-	/* reset time */
-	lastdec = READ_TIMER();
-	timestamp = 0;
-}
-
 ulong get_timer_masked(void)
 {
 	ulong tmr = get_ticks();
arch/arm/cpu/arm925t/timer.c +3 -9
index 9c965e0..1b9386b 100644
@@ -56,7 +56,9 @@ int timer_init (void)
 		CONFIG_SYS_TIMERBASE + CNTL_TIMER);
 
 	/* init the timestamp and lastdec value */
-	reset_timer_masked();
+	lastdec = __raw_readl(CONFIG_SYS_TIMERBASE + READ_TIM) /
+			(TIMER_CLOCK / CONFIG_SYS_HZ);
+	timestamp = 0;	       /* start "advancing" time stamp from 0 */
 
 	return 0;
 }
@@ -85,14 +87,6 @@ void __udelay (unsigned long usec)
 	}
 }
 
-void reset_timer_masked (void)
-{
-	/* reset time */
-	lastdec = __raw_readl(CONFIG_SYS_TIMERBASE + READ_TIM) /
-			(TIMER_CLOCK / CONFIG_SYS_HZ);
-	timestamp = 0;	       /* start "advancing" time stamp from 0 */
-}
-
 ulong get_timer_masked (void)
 {
 	uint32_t now = __raw_readl(CONFIG_SYS_TIMERBASE + READ_TIM) /
arch/arm/cpu/arm926ejs/armada100/timer.c +2 -8
index 86da0ce..82a6d7b 100644
@@ -77,13 +77,6 @@ ulong read_timer(void)
 	return(readl(&armd1timers->cvwr));
 }
 
-void reset_timer_masked(void)
-{
-	/* reset time */
-	gd->tbl = read_timer();
-	gd->tbu = 0;
-}
-
 ulong get_timer_masked(void)
 {
 	ulong now = read_timer();
@@ -142,7 +135,8 @@ int timer_init(void)
 	/* Enable timer 0 */
 	writel(0x1, &armd1timers->cer);
 	/* init the gd->tbu and gd->tbl value */
-	reset_timer_masked();
+	gd->tbl = read_timer();
+	gd->tbu = 0;
 
 	return 0;
 }
arch/arm/cpu/arm926ejs/kirkwood/timer.c +2 -8
index 5beb3f5..b4f6cf8 100644
@@ -88,13 +88,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define timestamp gd->tbl
 #define lastdec gd->lastinc
 
-void reset_timer_masked(void)
-{
-	/* reset time */
-	lastdec = READ_TIMER;
-	timestamp = 0;
-}
-
 ulong get_timer_masked(void)
 {
 	ulong now = READ_TIMER;
@@ -154,7 +147,8 @@ int timer_init(void)
 	writel(cntmrctrl, CNTMR_CTRL_REG);
 
 	/* init the timestamp and lastdec value */
-	reset_timer_masked();
+	lastdec = READ_TIMER;
+	timestamp = 0;
 
 	return 0;
 }
arch/arm/cpu/arm926ejs/mb86r0x/timer.c +3 -11
index 5f54085..8f38056 100644
@@ -68,7 +68,9 @@ int timer_init(void)
 
 	writel(ctrl, &timer->control);
 
-	reset_timer_masked();
+	/* capture current value time */
+	lastdec = readl(&timer->value);
+	timestamp = 0; /* start "advancing" time stamp from 0 */
 
 	return 0;
 }
@@ -94,16 +96,6 @@ unsigned long long get_ticks(void)
 	return timestamp;
 }
 
-void reset_timer_masked(void)
-{
-	struct mb86r0x_timer * timer = (struct mb86r0x_timer *)
-					MB86R0x_TIMER_BASE;
-
-	/* capture current value time */
-	lastdec = readl(&timer->value);
-	timestamp = 0; /* start "advancing" time stamp from 0 */
-}
-
 ulong get_timer_masked(void)
 {
 	return tick_to_time(get_ticks());
arch/arm/cpu/arm926ejs/mx25/timer.c +0 -9
index 9a84b50..131d600 100644
@@ -121,15 +121,6 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_timer_masked(void)
-{
-	struct gpt_regs *gpt = (struct gpt_regs *)IMX_GPT1_BASE;
-	/* reset time */
-	/* capture current incrementer value time */
-	lastinc = readl(&gpt->counter);
-	timestamp = 0; /* start "advancing" time stamp from 0 */
-}
-
 unsigned long long get_ticks (void)
 {
 	struct gpt_regs *gpt = (struct gpt_regs *)IMX_GPT1_BASE;
arch/arm/cpu/arm926ejs/mx27/timer.c +0 -9
index 058dbee..df76d16 100644
@@ -124,15 +124,6 @@ int timer_init(void)
 	return 0;
 }
 
-void reset_timer_masked(void)
-{
-	struct gpt_regs *regs = (struct gpt_regs *)IMX_TIM1_BASE;
-	/* reset time */
-	/* capture current incrementer value time */
-	lastinc = readl(&regs->gpt_tcn);
-	timestamp = 0; /* start "advancing" time stamp from 0 */
-}
-
 unsigned long long get_ticks (void)
 {
 	struct gpt_regs *regs = (struct gpt_regs *)IMX_TIM1_BASE;
arch/arm/cpu/arm926ejs/orion5x/timer.c +2 -8
index 5bc43c8..17df68f 100644
@@ -95,13 +95,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define timestamp gd->tbl
 #define lastdec gd->lastinc
 
-void reset_timer_masked(void)
-{
-	/* reset time */
-	lastdec = read_timer();
-	timestamp = 0;
-}
-
 ulong get_timer_masked(void)
 {
 	ulong now = read_timer();
@@ -171,5 +164,6 @@ int timer_init(void)
 void timer_init_r(void)
 {
 	/* init the timestamp and lastdec value */
-	reset_timer_masked();
+	lastdec = read_timer();
+	timestamp = 0;
 }
arch/arm/cpu/arm926ejs/pantheon/timer.c +2 -8
index 2727adc..c71162a 100644
@@ -85,13 +85,6 @@ ulong read_timer(void)
 	return val;
 }
 
-void reset_timer_masked(void)
-{
-	/* reset time */
-	gd->tbl = read_timer();
-	gd->tbu = 0;
-}
-
 ulong get_timer_masked(void)
 {
 	ulong now = read_timer();
@@ -151,7 +144,8 @@ int timer_init(void)
 	/* Enable timer 0 */
 	writel(0x1, &panthtimers->cer);
 	/* init the gd->tbu and gd->tbl value */
-	reset_timer_masked();
+	gd->tbl = read_timer();
+	gd->tbu = 0;
 
 	return 0;
 }
arch/arm/cpu/arm926ejs/spear/timer.c +3 -8
index cbef34f..1dc7860 100644
@@ -68,7 +68,9 @@ int timer_init(void)
 	/* auto reload, start timer */
 	writel(readl(&gpt_regs_p->control) | GPT_ENABLE, &gpt_regs_p->control);
 
-	reset_timer_masked();
+	/* Reset the timer */
+	lastdec = READ_TIMER();
+	timestamp = 0;
 
 	return 0;
 }
@@ -97,13 +99,6 @@ void __udelay(unsigned long usec)
 		;
 }
 
-void reset_timer_masked(void)
-{
-	/* reset time */
-	lastdec = READ_TIMER();
-	timestamp = 0;
-}
-
 ulong get_timer_masked(void)
 {
 	ulong now = READ_TIMER();
arch/arm/cpu/armv7/mx5/timer.c +4 -6
index 4525beb..2544b08 100644
@@ -52,6 +52,7 @@ DECLARE_GLOBAL_DATA_PTR;
 int timer_init(void)
 {
 	int i;
+	ulong val;
 
 	/* setup GP Timer 1 */
 	__raw_writel(GPTCR_SWR, &cur_gpt->control);
@@ -65,15 +66,12 @@ int timer_init(void)
 	/* Freerun Mode, PERCLK1 input */
 	i = __raw_readl(&cur_gpt->control);
 	__raw_writel(i | GPTCR_CLKSOURCE_32 | GPTCR_TEN, &cur_gpt->control);
-	reset_timer_masked();
-	return 0;
-}
 
-void reset_timer_masked(void)
-{
-	ulong val = __raw_readl(&cur_gpt->counter);
+	val = __raw_readl(&cur_gpt->counter);
 	lastinc = val / (CONFIG_SYS_MX5_CLK32 / CONFIG_SYS_HZ);
 	timestamp = 0;
+
+	return 0;
 }
 
 ulong get_timer_masked(void)
arch/arm/cpu/armv7/omap-common/timer.c +3 -8
index 24ab853..83d9dc7 100644
@@ -54,7 +54,9 @@ int timer_init(void)
 	writel((CONFIG_SYS_PTV << 2) | TCLR_PRE | TCLR_AR | TCLR_ST,
 		&timer_base->tclr);
 
-	reset_timer_masked();	/* init the timestamp and lastinc value */
+	/* reset time, capture current incrementer value time */
+	gd->lastinc = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
+	gd->tbl = 0;		/* start "advancing" time stamp from 0 */
 
 	return 0;
 }
@@ -83,13 +85,6 @@ void __udelay(unsigned long usec)
 	}
 }
 
-void reset_timer_masked(void)
-{
-	/* reset time, capture current incrementer value time */
-	gd->lastinc = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
-	gd->tbl = 0;		/* start "advancing" time stamp from 0 */
-}
-
 ulong get_timer_masked(void)
 {
 	/* current tick value */
arch/arm/cpu/armv7/tegra2/timer.c +0 -7
index 2761c12..0b9fa64 100644
@@ -69,13 +69,6 @@ void __udelay(unsigned long usec)
 	}
 }
 
-void reset_timer_masked(void)
-{
-	/* reset time, capture current incrementer value time */
-	gd->lastinc = readl(&timer_base->cntr_1us) / (TIMER_CLK/CONFIG_SYS_HZ);
-	gd->tbl = 0;		/* start "advancing" time stamp from 0 */
-}
-
 ulong get_timer_masked(void)
 {
 	ulong now;
arch/arm/cpu/ixp/timer.c +0 -8
index 1ab8cd3..54585c7 100644
@@ -101,14 +101,6 @@ void __udelay (unsigned long usec)
 
 static ulong reload_constant = 0xfffffff0;
 
-void reset_timer_masked (void)
-{
-	ulong reload = reload_constant | IXP425_OST_ONE_SHOT | IXP425_OST_ENABLE;
-
-	*IXP425_OSST = IXP425_OSST_TIMER_1_PEND;
-	*IXP425_OSRT1 = reload;
-}
-
 ulong get_timer_masked (void)
 {
 	/*
arch/arm/cpu/pxa/timer.c +1 -7
index 44dae9a..2866745 100644
@@ -59,7 +59,7 @@ static inline unsigned long long us_to_tick(unsigned long long us)
 
 int timer_init (void)
 {
-	reset_timer_masked();
+	writel(0, OSCR);
 
 	return 0;
 }
@@ -74,12 +74,6 @@ void __udelay (unsigned long usec)
 	udelay_masked (usec);
 }
 
-
-void reset_timer_masked (void)
-{
-	writel(0, OSCR);
-}
-
 ulong get_timer_masked (void)
 {
 	return tick_to_time(get_ticks());
arch/arm/cpu/s3c44b0/timer.c +0 -7
index ce48952..6c2f066 100644
@@ -78,13 +78,6 @@ void __udelay (unsigned long usec)
 		/*NOP*/;
 }
 
-void reset_timer_masked (void)
-{
-	/* reset time */
-	lastdec = READ_TIMER;
-	timestamp = 0;
-}
-
 ulong get_timer_masked (void)
 {
 	ulong now = READ_TIMER;
arch/arm/cpu/sa1100/timer.c +0 -6
index 694c03a..53bec0b 100644
@@ -44,12 +44,6 @@ void __udelay (unsigned long usec)
 	udelay_masked (usec);
 }
 
-
-void reset_timer_masked (void)
-{
-	OSCR = 0;
-}
-
 ulong get_timer_masked (void)
 {
 	return OSCR;
board/armltd/integrator/timer.c +4 -9
index 6734e8d..f10a026 100644
@@ -95,7 +95,10 @@ int timer_init (void)
 
 	/* init the timestamp */
 	total_count = 0ULL;
-	reset_timer_masked();
+	/* capure current decrementer value    */
+	lastdec	  = READ_TIMER;
+	/* start "advancing" time stamp from 0 */
+	timestamp = 0L;
 
 	div_timer = CONFIG_SYS_HZ_CLOCK;
 	do_div(div_timer, CONFIG_SYS_HZ);
@@ -129,14 +132,6 @@ void __udelay (unsigned long usec)
 	}
 }
 
-void reset_timer_masked (void)
-{
-	/* capure current decrementer value    */
-	lastdec	  = READ_TIMER;
-	/* start "advancing" time stamp from 0 */
-	timestamp = 0L;
-}
-
 /* converts the timer reading to U-Boot ticks	       */
 /* the timestamp is the number of ticks since reset    */
 ulong get_timer_masked (void)
Signature · 1 line
1.7.5.2.317.g391b14
#46 lore raw

PATCH 7/16 Remove reset_timer_masked()

Dear Graeme Russ,

Quoted 1 line · In message <[email protected]> you wrote:

Fold implementation into timer_init() where needed

This needs a better description, then, if you don;t really remove it.

I'm otherwise fine with that, too.

Best regards,

Wolfgang Denk

Signature · 5 lines
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: wd at denx.de
Syntactic sugar causes cancer of the semicolon.
                - Epigrams in Programming, ACM SIGPLAN Sept. 1982