1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * The generic setup file for PMC-Sierra MSP processors
5 * Copyright 2005-2007 PMC-Sierra, Inc,
6 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
9 #include <linux/delay.h>
11 #include <asm/bootinfo.h>
12 #include <asm/cacheflush.h>
14 #include <asm/r4kcache.h>
15 #include <asm/reboot.h>
16 #include <asm/smp-ops.h>
22 #if defined(CONFIG_PMC_MSP7120_GW)
23 #include <msp_regops.h>
24 #define MSP_BOARD_RESET_GPIO 9
27 extern void msp_serial_setup(void);
29 #if defined(CONFIG_PMC_MSP7120_EVAL) || \
30 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
;
39 /* Diasble all interrupts */
41 #ifdef CONFIG_SYS_SUPPORTS_MULTITHREADING
45 /* Cache the reset code of this function */
46 __asm__
__volatile__ (
49 " la %0,startpoint \n"
52 : "=r" (start
), "=r" (end
)
56 for (iptr
= (void *)((unsigned int)start
& ~(L1_CACHE_BYTES
- 1));
57 iptr
< end
; iptr
+= L1_CACHE_BYTES
)
60 __asm__
__volatile__ (
64 /* Put the DDRC into self-refresh mode */
65 DDRC_INDIRECT_WRITE(DDRC_CTL(10), 0xb, 1 << 16);
69 * DO NOT do anything from here on out that might even
70 * think about fetching from RAM - i.e., don't call any
71 * non-inlined functions, and be VERY sure that any inline
72 * functions you do call do NOT access any sort of RAM
76 /* Wait a bit for the DDRC to settle */
79 #if defined(CONFIG_PMC_MSP7120_GW)
81 * Set GPIO 9 HI, (tied to board reset logic)
82 * GPIO 9 is the 4th GPIO of register 3
84 * NOTE: We cannot use the higher-level msp_gpio_mode()/out()
85 * as GPIO char driver may not be enabled and it would look up
88 set_value_reg32(GPIO_CFG3_REG
, 0xf000, 0x8000);
89 set_reg32(GPIO_DATA3_REG
, 8);
92 * In case GPIO9 doesn't reset the board (jumper configurable!)
93 * fallback to device reset below.
96 /* Set bit 1 of the MSP7120 reset register */
97 *RST_SET_REG
= 0x00000001;
99 __asm__
__volatile__ (
105 void msp_restart(char *command
)
107 printk(KERN_WARNING
"Now rebooting .......\n");
109 #if defined(CONFIG_PMC_MSP7120_EVAL) || \
110 defined(CONFIG_PMC_MSP7120_GW) || \
111 defined(CONFIG_PMC_MSP7120_FPGA)
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
);
120 __asm__
__volatile__("jr\t%0"::"r"(0xbfc00000));
126 printk(KERN_WARNING
"\n** You can safely turn off the power\n");
128 /* If possible call official function to get CPU WARs */
132 __asm__(".set\tmips3\n\t" "wait\n\t" ".set\tmips0");
135 void msp_power_off(void)
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
;
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();
168 if (FPGA_IS_MSP4200(revision
)) {
169 /* Old-style revision ID */
170 mips_machtype
= MACH_MSP4200_FPGA
;
172 mips_machtype
= MACH_MSP_OTHER
;
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
;
182 mips_machtype
= MACH_MSP_OTHER
;
186 case FAMILY_MSP4200_FPGA
:
187 mips_machtype
= MACH_MSP4200_FPGA
;
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
;
196 mips_machtype
= MACH_MSP_OTHER
;
200 case FAMILY_MSP7100_FPGA
:
201 mips_machtype
= MACH_MSP7120_FPGA
;
205 /* we don't recognize the machine */
206 mips_machtype
= MACH_UNKNOWN
;
207 panic("***Bogosity factor five***, exiting");
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.
227 register_vsmp_smp_ops();