2 * The generic setup file for PMC-Sierra MSP processors
4 * Copyright 2005-2007 PMC-Sierra, Inc,
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>
16 #include <asm/r4kcache.h>
17 #include <asm/reboot.h>
18 #include <asm/smp-ops.h>
24 #if defined(CONFIG_PMC_MSP7120_GW)
25 #include <msp_regops.h>
26 #define MSP_BOARD_RESET_GPIO 9
29 extern void msp_serial_setup(void);
31 #if defined(CONFIG_PMC_MSP7120_EVAL) || \
32 defined(CONFIG_PMC_MSP7120_GW) || \
33 defined(CONFIG_PMC_MSP7120_FPGA)
35 * Performs the reset for MSP7120-based boards
37 void msp7120_reset(void)
39 void *start, *end, *iptr;
42 /* Diasble all interrupts */
44 #ifdef CONFIG_SYS_SUPPORTS_MULTITHREADING
48 /* Cache the reset code of this function */
49 __asm__ __volatile__ (
52 " la %0,startpoint \n"
55 : "=r" (start), "=r" (end)
59 for (iptr = (void *)((unsigned int)start & ~(L1_CACHE_BYTES - 1));
60 iptr < end; iptr += L1_CACHE_BYTES)
63 __asm__ __volatile__ (
67 /* Put the DDRC into self-refresh mode */
68 DDRC_INDIRECT_WRITE(DDRC_CTL(10), 0xb, 1 << 16);
72 * DO NOT do anything from here on out that might even
73 * think about fetching from RAM - i.e., don't call any
74 * non-inlined functions, and be VERY sure that any inline
75 * functions you do call do NOT access any sort of RAM
79 /* Wait a bit for the DDRC to settle */
80 for (i = 0; i < 100000000; i++);
82 #if defined(CONFIG_PMC_MSP7120_GW)
84 * Set GPIO 9 HI, (tied to board reset logic)
85 * GPIO 9 is the 4th GPIO of register 3
87 * NOTE: We cannot use the higher-level msp_gpio_mode()/out()
88 * as GPIO char driver may not be enabled and it would look up
91 set_value_reg32(GPIO_CFG3_REG, 0xf000, 0x8000);
92 set_reg32(GPIO_DATA3_REG, 8);
95 * In case GPIO9 doesn't reset the board (jumper configurable!)
96 * fallback to device reset below.
99 /* Set bit 1 of the MSP7120 reset register */
100 *RST_SET_REG = 0x00000001;
102 __asm__ __volatile__ (
108 void msp_restart(char *command)
110 printk(KERN_WARNING "Now rebooting .......\n");
112 #if defined(CONFIG_PMC_MSP7120_EVAL) || \
113 defined(CONFIG_PMC_MSP7120_GW) || \
114 defined(CONFIG_PMC_MSP7120_FPGA)
117 /* No chip-specific reset code, just jump to the ROM reset vector */
118 set_c0_status(ST0_BEV | ST0_ERL);
119 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
123 __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
129 printk(KERN_WARNING "\n** You can safely turn off the power\n");
131 /* If possible call official function to get CPU WARs */
135 __asm__(".set\tmips3\n\t" "wait\n\t" ".set\tmips0");
138 void msp_power_off(void)
143 void __init plat_mem_setup(void)
145 _machine_restart = msp_restart;
146 _machine_halt = msp_halt;
147 pm_power_off = msp_power_off;
150 void __init prom_init(void)
152 unsigned long family;
153 unsigned long revision;
156 prom_argv = (char **)fw_arg1;
157 prom_envp = (char **)fw_arg2;
160 * Someday we can use this with PMON2000 to get a
161 * platform call prom routines for output etc. without
162 * having to use grody hacks. For now it's unused.
164 * struct callvectors *cv = (struct callvectors *) fw_arg3;
166 family = identify_family();
167 revision = identify_revision();
171 if (FPGA_IS_MSP4200(revision)) {
172 /* Old-style revision ID */
173 mips_machtype = MACH_MSP4200_FPGA;
175 mips_machtype = MACH_MSP_OTHER;
180 #if defined(CONFIG_PMC_MSP4200_EVAL)
181 mips_machtype = MACH_MSP4200_EVAL;
182 #elif defined(CONFIG_PMC_MSP4200_GW)
183 mips_machtype = MACH_MSP4200_GW;
185 mips_machtype = MACH_MSP_OTHER;
189 case FAMILY_MSP4200_FPGA:
190 mips_machtype = MACH_MSP4200_FPGA;
194 #if defined(CONFIG_PMC_MSP7120_EVAL)
195 mips_machtype = MACH_MSP7120_EVAL;
196 #elif defined(CONFIG_PMC_MSP7120_GW)
197 mips_machtype = MACH_MSP7120_GW;
199 mips_machtype = MACH_MSP_OTHER;
203 case FAMILY_MSP7100_FPGA:
204 mips_machtype = MACH_MSP7120_FPGA;
208 /* we don't recognize the machine */
209 mips_machtype = MACH_UNKNOWN;
210 panic("***Bogosity factor five***, exiting");
219 * Sub-system setup follows.
220 * Setup functions can either be called here or using the
221 * subsys_initcall mechanism (i.e. see msp_pci_setup). The
222 * order in which they are called can be changed by using the
223 * link order in arch/mips/pmc-sierra/msp71xx/Makefile.
225 * NOTE: Please keep sub-system specific initialization code
226 * in separate specific files.
230 register_vsmp_smp_ops();