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>
23 #include <bcm63xx_gpio.h>
25 void bcm63xx_machine_halt(void)
27 pr_info("System halted\n");
32 static void bcm6348_a1_reboot(void)
36 /* soft reset all blocks */
37 pr_info("soft-resetting all blocks ...\n");
38 reg = bcm_perf_readl(PERF_SOFTRESET_REG);
39 reg &= ~SOFTRESET_6348_ALL;
40 bcm_perf_writel(reg, PERF_SOFTRESET_REG);
43 reg = bcm_perf_readl(PERF_SOFTRESET_REG);
44 reg |= SOFTRESET_6348_ALL;
45 bcm_perf_writel(reg, PERF_SOFTRESET_REG);
48 /* Jump to the power on address. */
49 pr_info("jumping to reset vector.\n");
50 /* set high vectors (base at 0xbfc00000 */
51 set_c0_status(ST0_BEV | ST0_ERL);
52 /* run uncached in kseg0 */
53 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
55 /* remove all wired TLB entries */
65 void bcm63xx_machine_reboot(void)
67 u32 reg, perf_regs[2] = { 0, 0 };
70 /* mask and clear all external irq */
71 switch (bcm63xx_get_cpu_id()) {
73 perf_regs[0] = PERF_EXTIRQ_CFG_REG_3368;
76 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6328;
79 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6338;
82 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6345;
85 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6348;
88 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6358;
91 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6362;
95 for (i = 0; i < 2; i++) {
99 reg = bcm_perf_readl(perf_regs[i]);
100 if (BCMCPU_IS_6348()) {
101 reg &= ~EXTIRQ_CFG_MASK_ALL_6348;
102 reg |= EXTIRQ_CFG_CLEAR_ALL_6348;
104 reg &= ~EXTIRQ_CFG_MASK_ALL;
105 reg |= EXTIRQ_CFG_CLEAR_ALL;
107 bcm_perf_writel(reg, perf_regs[i]);
110 if (BCMCPU_IS_6348() && (bcm63xx_get_cpu_rev() == 0xa1))
113 pr_info("triggering watchdog soft-reset...\n");
114 if (BCMCPU_IS_6328()) {
115 bcm_wdt_writel(1, WDT_SOFTRESET_REG);
117 reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG);
118 reg |= SYS_PLL_SOFT_RESET;
119 bcm_perf_writel(reg, PERF_SYS_PLL_CTL_REG);
125 static void __bcm63xx_machine_reboot(char *p)
127 bcm63xx_machine_reboot();
131 * return system type in /proc/cpuinfo
133 const char *get_system_type(void)
135 static char buf[128];
136 snprintf(buf, sizeof(buf), "bcm63xx/%s (0x%04x/0x%02X)",
138 bcm63xx_get_cpu_id(), bcm63xx_get_cpu_rev());
142 void __init plat_time_init(void)
144 mips_hpt_frequency = bcm63xx_get_cpu_freq() / 2;
147 void __init plat_mem_setup(void)
149 add_memory_region(0, bcm63xx_get_memory_size(), BOOT_MEM_RAM);
151 _machine_halt = bcm63xx_machine_halt;
152 _machine_restart = __bcm63xx_machine_reboot;
153 pm_power_off = bcm63xx_machine_halt;
156 ioport_resource.start = 0;
157 ioport_resource.end = ~0;
162 int __init bcm63xx_register_devices(void)
164 /* register gpiochip */
167 return board_register_devices();
170 arch_initcall(bcm63xx_register_devices);