3 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
7 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
10 * See file CREDITS for list of people who contributed to this
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License as
15 * published by the Free Software Foundation; either version 2 of
16 * the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
35 #include <asm/arch/pxa-regs.h>
40 * setup up stack if necessary
44 FIXME: the stack is _below_ the uboot code!!
47 IRQ_STACK_START = _armboot_end +
48 CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4;
49 FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ;
50 _armboot_real_end = FIQ_STACK_START + 4;
52 _armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
58 int cleanup_before_linux (void)
61 * this function is called just before we call linux
62 * it prepares the processor for linux
64 * just disable everything that can disturb booting linux
69 disable_interrupts ();
71 /* turn off I-cache */
72 asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
74 asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
77 asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
82 int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
84 extern void reset_cpu (ulong addr);
86 printf ("resetting ...\n");
88 udelay (50000); /* wait 50 ms */
89 disable_interrupts ();
97 void icache_enable (void)
101 /* read control register */
102 asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
107 /* write back to control register */
108 asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
111 void icache_disable (void)
115 /* read control register */
116 asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
121 /* write back to control register */
122 asm ("mcr p15, 0, %0, c1, c0, 0": :"r" (i));
125 asm ("mcr p15, 0, %0, c7, c5, 0": :"r" (i));
128 int icache_status (void)
132 /* read control register */
133 asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i));
139 /* we will never enable dcache, because we have to setup MMU first */
140 void dcache_enable (void)
145 void dcache_disable (void)
150 int dcache_status (void)
152 return 0; /* always off */
155 void set_GPIO_mode(int gpio_mode)
157 int gpio = gpio_mode & GPIO_MD_MASK_NR;
158 int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8;
161 if (gpio_mode & GPIO_MD_MASK_DIR)
163 GPDR(gpio) |= GPIO_bit(gpio);
167 GPDR(gpio) &= ~GPIO_bit(gpio);
169 gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
170 GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2));