2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/delay.h>
12 #include <linux/bootmem.h>
13 #include <linux/ioport.h>
15 #include <asm/bootinfo.h>
17 #include <asm/reboot.h>
18 #include <asm/cacheflush.h>
19 #include <bcm63xx_board.h>
20 #include <bcm63xx_cpu.h>
21 #include <bcm63xx_regs.h>
22 #include <bcm63xx_io.h>
24 void bcm63xx_machine_halt(void)
26 printk(KERN_INFO
"System halted\n");
31 static void bcm6348_a1_reboot(void)
35 /* soft reset all blocks */
36 printk(KERN_INFO
"soft-resetting all blocks ...\n");
37 reg
= bcm_perf_readl(PERF_SOFTRESET_REG
);
38 reg
&= ~SOFTRESET_6348_ALL
;
39 bcm_perf_writel(reg
, PERF_SOFTRESET_REG
);
42 reg
= bcm_perf_readl(PERF_SOFTRESET_REG
);
43 reg
|= SOFTRESET_6348_ALL
;
44 bcm_perf_writel(reg
, PERF_SOFTRESET_REG
);
47 /* Jump to the power on address. */
48 printk(KERN_INFO
"jumping to reset vector.\n");
49 /* set high vectors (base at 0xbfc00000 */
50 set_c0_status(ST0_BEV
| ST0_ERL
);
51 /* run uncached in kseg0 */
52 change_c0_config(CONF_CM_CMASK
, CONF_CM_UNCACHED
);
54 /* remove all wired TLB entries */
64 void bcm63xx_machine_reboot(void)
66 u32 reg
, perf_regs
[2] = { 0, 0 };
69 /* mask and clear all external irq */
70 switch (bcm63xx_get_cpu_id()) {
72 perf_regs
[0] = PERF_EXTIRQ_CFG_REG_3368
;
75 perf_regs
[0] = PERF_EXTIRQ_CFG_REG_6328
;
78 perf_regs
[0] = PERF_EXTIRQ_CFG_REG_6338
;
81 perf_regs
[0] = PERF_EXTIRQ_CFG_REG_6345
;
84 perf_regs
[0] = PERF_EXTIRQ_CFG_REG_6348
;
87 perf_regs
[0] = PERF_EXTIRQ_CFG_REG_6358
;
90 perf_regs
[0] = PERF_EXTIRQ_CFG_REG_6362
;
94 for (i
= 0; i
< 2; i
++) {
98 reg
= bcm_perf_readl(perf_regs
[i
]);
99 if (BCMCPU_IS_6348()) {
100 reg
&= ~EXTIRQ_CFG_MASK_ALL_6348
;
101 reg
|= EXTIRQ_CFG_CLEAR_ALL_6348
;
103 reg
&= ~EXTIRQ_CFG_MASK_ALL
;
104 reg
|= EXTIRQ_CFG_CLEAR_ALL
;
106 bcm_perf_writel(reg
, perf_regs
[i
]);
109 if (BCMCPU_IS_6348() && (bcm63xx_get_cpu_rev() == 0xa1))
112 printk(KERN_INFO
"triggering watchdog soft-reset...\n");
113 if (BCMCPU_IS_6328()) {
114 bcm_wdt_writel(1, WDT_SOFTRESET_REG
);
116 reg
= bcm_perf_readl(PERF_SYS_PLL_CTL_REG
);
117 reg
|= SYS_PLL_SOFT_RESET
;
118 bcm_perf_writel(reg
, PERF_SYS_PLL_CTL_REG
);
124 static void __bcm63xx_machine_reboot(char *p
)
126 bcm63xx_machine_reboot();
130 * return system type in /proc/cpuinfo
132 const char *get_system_type(void)
134 static char buf
[128];
135 snprintf(buf
, sizeof(buf
), "bcm63xx/%s (0x%04x/0x%02X)",
137 bcm63xx_get_cpu_id(), bcm63xx_get_cpu_rev());
141 void __init
plat_time_init(void)
143 mips_hpt_frequency
= bcm63xx_get_cpu_freq() / 2;
146 void __init
plat_mem_setup(void)
148 add_memory_region(0, bcm63xx_get_memory_size(), BOOT_MEM_RAM
);
150 _machine_halt
= bcm63xx_machine_halt
;
151 _machine_restart
= __bcm63xx_machine_reboot
;
152 pm_power_off
= bcm63xx_machine_halt
;
155 ioport_resource
.start
= 0;
156 ioport_resource
.end
= ~0;
161 int __init
bcm63xx_register_devices(void)
163 return board_register_devices();
166 arch_initcall(bcm63xx_register_devices
);