3 * Texas Instruments, <www.ti.com>
4 * Richard Woodruff <r-woodruff2@ti.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 #include <asm/arch/cpu.h>
25 #include <asm/arch/bits.h>
26 #include <asm/arch/mem.h>
27 #include <asm/arch/clocks.h>
28 #include <asm/arch/sys_proto.h>
29 #include <asm/arch/sys_info.h>
31 /************************************************************
32 * sdelay() - simple spin loop. Will be constant time as
33 * its generally used in bypass conditions only. This
34 * is necessary until timers are accessible.
36 * not inline to increase chances its in cache when called
37 *************************************************************/
38 void sdelay(unsigned long loops)
40 __asm__ volatile ("1:\n" "subs %0, %1, #1\n"
41 "bne 1b" : "=r" (loops) : "0"(loops));
44 /*****************************************************************
45 * sr32 - clear & set a value in a bit range for a 32 bit address
46 *****************************************************************/
47 void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value)
52 tmp = __raw_readl(addr) & ~(msk << start_bit);
53 tmp |= value << start_bit;
54 __raw_writel(tmp, addr);
57 /*********************************************************************
58 * wait_on_value() - common routine to allow waiting for changes in
60 *********************************************************************/
61 u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
66 val = __raw_readl(read_addr) & read_bit_mask;
67 if (val == match_value)