OMAP3: Move wait_on_value() function to not duplicate code
authorEnric Balletbo i Serra <eballetbo@gmail.com>
Wed, 25 May 2011 09:07:51 +0000 (11:07 +0200)
committerAnand Gadiyar <gadiyar@ti.com>
Thu, 14 Jul 2011 12:10:48 +0000 (17:40 +0530)
The wait_on_value() function is implemented by various boards, this
patch moves this function to a common place to not duplicate code.

 board/omap3530beagle/omap3530beagle.c :216:u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
 board/igep00x0/igep00x0.c             :90:u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
 board/omap3430sdp/omap3430sdp.c       :104:u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
 board/omap3evm/omap3evm.c             :148:u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
 board/omap3430labrador/omap3430sdp.c  :101:u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
 board/overo/overo.c                   :207:u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)

Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
board/igep00x0/igep00x0.c
board/omap3430labrador/omap3430sdp.c
board/omap3430sdp/omap3430sdp.c
board/omap3530beagle/omap3530beagle.c
board/omap3evm/omap3evm.c
board/overo/overo.c
cpu/omap3/sys_info.c

index f1c1829..0b2ce5e 100644 (file)
@@ -83,23 +83,6 @@ u32 get_mem_type(void)
        return GPMC_ONENAND;
 }
 
-/*********************************************************************
- * wait_on_value() - common routine to allow waiting for changes in
- *   volatile regs.
- *********************************************************************/
-u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
-{
-       u32 i = 0, val;
-       do {
-               ++i;
-               val = __raw_readl(read_addr) & read_bit_mask;
-               if (val == match_value)
-                       return 1;
-               if (i == bound)
-                       return 0;
-       } while (1);
-}
-
 /*************************************************************
  * get_sys_clk_speed - determine reference oscillator speed
  *  based on known 32kHz clock and gptimer.
index 300deb1..79d0dce 100644 (file)
@@ -94,23 +94,6 @@ u32 cpu_is_3410(void)
        }
 }
 
-/*********************************************************************
- * wait_on_value() - common routine to allow waiting for changes in
- *   volatile regs.
- *********************************************************************/
-u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
-{
-       u32 i = 0, val;
-       do {
-               ++i;
-               val = __raw_readl(read_addr) & read_bit_mask;
-               if (val == match_value)
-                       return (1);
-               if (i == bound)
-                       return (0);
-       } while (1);
-}
-
 #ifdef CFG_3430SDRAM_DDR
 /*********************************************************************
  * config_3430sdram_ddr() - Init DDR on 3430SDP dev board.
index bfa61dc..bb6070e 100644 (file)
@@ -97,23 +97,6 @@ u32 cpu_is_3410(void)
        }
 }
 
-/*********************************************************************
- * wait_on_value() - common routine to allow waiting for changes in
- *   volatile regs.
- *********************************************************************/
-u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
-{
-       u32 i = 0, val;
-       do {
-               ++i;
-               val = __raw_readl(read_addr) & read_bit_mask;
-               if (val == match_value)
-                       return (1);
-               if (i == bound)
-                       return (0);
-       } while (1);
-}
-
 #ifdef CFG_3430SDRAM_DDR
 /*********************************************************************
  * config_3430sdram_ddr() - Init DDR on 3430SDP dev board.
index 5659f3b..5a97d96 100644 (file)
@@ -209,23 +209,6 @@ int beagle_revision(void)
        return rev;
 }
 
-/*********************************************************************
- * wait_on_value() - common routine to allow waiting for changes in
- *   volatile regs.
- *********************************************************************/
-u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
-{
-       u32 i = 0, val;
-       do {
-               ++i;
-               val = __raw_readl(read_addr) & read_bit_mask;
-               if (val == match_value)
-                       return 1;
-               if (i == bound)
-                       return 0;
-       } while (1);
-}
-
 #ifdef CFG_3430SDRAM_DDR
 
 #define MICRON_DDR     0
index 4265da1..5071046 100644 (file)
@@ -141,23 +141,6 @@ u32 cpu_is_3410(void)
        }
 }
 
-/*********************************************************************
- * wait_on_value() - common routine to allow waiting for changes in
- *   volatile regs.
- *********************************************************************/
-u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
-{
-       u32 i = 0, val;
-       do {
-               ++i;
-               val = __raw_readl(read_addr) & read_bit_mask;
-               if (val == match_value)
-                       return (1);
-               if (i == bound)
-                       return (0);
-       } while (1);
-}
-
 #ifdef CFG_3430SDRAM_DDR
 /*********************************************************************
  * config_3430sdram_ddr() - Init DDR on 3430SDP dev board.
index 3b61335..e7ac7a6 100644 (file)
@@ -200,23 +200,6 @@ int get_board_revision(void)
        return revision;
 }
 
-/*********************************************************************
- * wait_on_value() - common routine to allow waiting for changes in
- *   volatile regs.
- *********************************************************************/
-u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
-{
-       u32 i = 0, val;
-       do {
-               ++i;
-               val = __raw_readl(read_addr) & read_bit_mask;
-               if (val == match_value)
-                       return 1;
-               if (i == bound)
-                       return 0;
-       } while (1);
-}
-
 #ifdef CFG_3430SDRAM_DDR
 /*********************************************************************
  * config_3430sdram_ddr() - Init DDR on 3430SDP dev board.
index bcf5f8e..d6568a9 100644 (file)
@@ -48,6 +48,23 @@ void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value)
 }
 
 /*
+ * wait_on_value(): common routine to allow waiting for changes in
+ * volatile regs.
+ */
+u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
+{
+       u32 i = 0, val;
+       do {
+               ++i;
+               val = __raw_readl(read_addr) & read_bit_mask;
+               if (val == match_value)
+                       return 1;
+               if (i == bound)
+                       return 0;
+       } while (1);
+}
+
+/*
  *  get_device_type(): tell if GP/HS/EMU/TST
  */
 u32 get_device_type(void)