GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / mips / pmc-sierra / msp71xx / msp_setup.c
blob936280b442e78c354b513cdc3dc5d90781a27a03
1 /*
2 * The generic setup file for PMC-Sierra MSP processors
4 * Copyright 2005-2007 PMC-Sierra, Inc,
5 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
13 #include <asm/bootinfo.h>
14 #include <asm/cacheflush.h>
15 #include <asm/r4kcache.h>
16 #include <asm/reboot.h>
17 #include <asm/time.h>
19 #include <msp_prom.h>
20 #include <msp_regs.h>
22 #if defined(CONFIG_PMC_MSP7120_GW)
23 #include <msp_regops.h>
24 #define MSP_BOARD_RESET_GPIO 9
25 #endif
27 extern void msp_serial_setup(void);
28 extern void pmctwiled_setup(void);
30 #if defined(CONFIG_PMC_MSP7120_EVAL) || defined(CONFIG_PMC_MSP7120_GW) || \
31 defined(CONFIG_PMC_MSP7120_FPGA)
33 * Performs the reset for MSP7120-based boards
35 void msp7120_reset(void)
37 void *start, *end, *iptr;
38 register int i;
40 /* Diasble all interrupts */
41 local_irq_disable();
42 #ifdef CONFIG_SYS_SUPPORTS_MULTITHREADING
43 dvpe();
44 #endif
46 /* Cache the reset code of this function */
47 __asm__ __volatile__ (
48 " .set push \n"
49 " .set mips3 \n"
50 " la %0,startpoint \n"
51 " la %1,endpoint \n"
52 " .set pop \n"
53 : "=r" (start), "=r" (end)
57 for (iptr = (void *)((unsigned int)start & ~(L1_CACHE_BYTES - 1));
58 iptr < end; iptr += L1_CACHE_BYTES)
59 cache_op(Fill, iptr);
61 __asm__ __volatile__ (
62 "startpoint: \n"
65 /* Put the DDRC into self-refresh mode */
66 DDRC_INDIRECT_WRITE(DDRC_CTL(10), 0xb, 1 << 16);
69 * IMPORTANT!
70 * DO NOT do anything from here on out that might even
71 * think about fetching from RAM - i.e., don't call any
72 * non-inlined functions, and be VERY sure that any inline
73 * functions you do call do NOT access any sort of RAM
74 * anywhere!
77 /* Wait a bit for the DDRC to settle */
78 for (i = 0; i < 100000000; i++);
80 #if defined(CONFIG_PMC_MSP7120_GW)
82 * Set GPIO 9 HI, (tied to board reset logic)
83 * GPIO 9 is the 4th GPIO of register 3
85 * NOTE: We cannot use the higher-level msp_gpio_mode()/out()
86 * as GPIO char driver may not be enabled and it would look up
87 * data inRAM!
89 set_value_reg32(GPIO_CFG3_REG, 0xf000, 0x8000);
90 set_reg32(GPIO_DATA3_REG, 8);
93 * In case GPIO9 doesn't reset the board (jumper configurable!)
94 * fallback to device reset below.
96 #endif
97 /* Set bit 1 of the MSP7120 reset register */
98 *RST_SET_REG = 0x00000001;
100 __asm__ __volatile__ (
101 "endpoint: \n"
104 #endif
106 void msp_restart(char *command)
108 printk(KERN_WARNING "Now rebooting .......\n");
110 #if defined(CONFIG_PMC_MSP7120_EVAL) || defined(CONFIG_PMC_MSP7120_GW) || \
111 defined(CONFIG_PMC_MSP7120_FPGA)
112 msp7120_reset();
113 #else
114 /* No chip-specific reset code, just jump to the ROM reset vector */
115 set_c0_status(ST0_BEV | ST0_ERL);
116 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
117 flush_cache_all();
118 write_c0_wired(0);
120 __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
121 #endif
124 void msp_halt(void)
126 printk(KERN_WARNING "\n** You can safely turn off the power\n");
127 while (1)
128 /* If possible call official function to get CPU WARs */
129 if (cpu_wait)
130 (*cpu_wait)();
131 else
132 __asm__(".set\tmips3\n\t" "wait\n\t" ".set\tmips0");
135 void msp_power_off(void)
137 msp_halt();
140 void __init plat_mem_setup(void)
142 _machine_restart = msp_restart;
143 _machine_halt = msp_halt;
144 pm_power_off = msp_power_off;
147 void __init prom_init(void)
149 unsigned long family;
150 unsigned long revision;
152 prom_argc = fw_arg0;
153 prom_argv = (char **)fw_arg1;
154 prom_envp = (char **)fw_arg2;
157 * Someday we can use this with PMON2000 to get a
158 * platform call prom routines for output etc. without
159 * having to use grody hacks. For now it's unused.
161 * struct callvectors *cv = (struct callvectors *) fw_arg3;
163 family = identify_family();
164 revision = identify_revision();
166 switch (family) {
167 case FAMILY_FPGA:
168 if (FPGA_IS_MSP4200(revision)) {
169 /* Old-style revision ID */
170 mips_machtype = MACH_MSP4200_FPGA;
171 } else {
172 mips_machtype = MACH_MSP_OTHER;
174 break;
176 case FAMILY_MSP4200:
177 #if defined(CONFIG_PMC_MSP4200_EVAL)
178 mips_machtype = MACH_MSP4200_EVAL;
179 #elif defined(CONFIG_PMC_MSP4200_GW)
180 mips_machtype = MACH_MSP4200_GW;
181 #else
182 mips_machtype = MACH_MSP_OTHER;
183 #endif
184 break;
186 case FAMILY_MSP4200_FPGA:
187 mips_machtype = MACH_MSP4200_FPGA;
188 break;
190 case FAMILY_MSP7100:
191 #if defined(CONFIG_PMC_MSP7120_EVAL)
192 mips_machtype = MACH_MSP7120_EVAL;
193 #elif defined(CONFIG_PMC_MSP7120_GW)
194 mips_machtype = MACH_MSP7120_GW;
195 #else
196 mips_machtype = MACH_MSP_OTHER;
197 #endif
198 break;
200 case FAMILY_MSP7100_FPGA:
201 mips_machtype = MACH_MSP7120_FPGA;
202 break;
204 default:
205 /* we don't recognize the machine */
206 mips_machtype = MACH_UNKNOWN;
207 panic("***Bogosity factor five***, exiting\n");
208 break;
211 prom_init_cmdline();
213 prom_meminit();
216 * Sub-system setup follows.
217 * Setup functions can either be called here or using the
218 * subsys_initcall mechanism (i.e. see msp_pci_setup). The
219 * order in which they are called can be changed by using the
220 * link order in arch/mips/pmc-sierra/msp71xx/Makefile.
222 * NOTE: Please keep sub-system specific initialization code
223 * in separate specific files.
225 msp_serial_setup();
227 #ifdef CONFIG_PMCTWILED
229 * Setup LED states before the subsys_initcall loads other
230 * dependant drivers/modules.
232 pmctwiled_setup();
233 #endif