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
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/delay.h>
12 #include <linux/memblock.h>
13 #include <linux/ioport.h>
15 #include <asm/bmips.h>
16 #include <asm/bootinfo.h>
18 #include <asm/reboot.h>
19 #include <asm/cacheflush.h>
20 #include <bcm63xx_board.h>
21 #include <bcm63xx_cpu.h>
22 #include <bcm63xx_regs.h>
23 #include <bcm63xx_io.h>
24 #include <bcm63xx_gpio.h>
27 * CBR addr doesn't change and we can cache it.
28 * For broken SoC/Bootloader CBR addr might also be provided via DT
29 * with "brcm,bmips-cbr-reg" in the "cpus" node.
31 void __iomem *bmips_cbr_addr __read_mostly;
33 void bcm63xx_machine_halt(void)
35 pr_info("System halted\n");
40 static void bcm6348_a1_reboot(void)
44 /* soft reset all blocks */
45 pr_info("soft-resetting all blocks ...\n");
46 reg = bcm_perf_readl(PERF_SOFTRESET_REG);
47 reg &= ~SOFTRESET_6348_ALL;
48 bcm_perf_writel(reg, PERF_SOFTRESET_REG);
51 reg = bcm_perf_readl(PERF_SOFTRESET_REG);
52 reg |= SOFTRESET_6348_ALL;
53 bcm_perf_writel(reg, PERF_SOFTRESET_REG);
56 /* Jump to the power on address. */
57 pr_info("jumping to reset vector.\n");
58 /* set high vectors (base at 0xbfc00000 */
59 set_c0_status(ST0_BEV | ST0_ERL);
60 /* run uncached in kseg0 */
61 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
63 /* remove all wired TLB entries */
73 void bcm63xx_machine_reboot(void)
75 u32 reg, perf_regs[2] = { 0, 0 };
78 /* mask and clear all external irq */
79 switch (bcm63xx_get_cpu_id()) {
81 perf_regs[0] = PERF_EXTIRQ_CFG_REG_3368;
84 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6328;
87 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6338;
90 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6345;
93 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6348;
96 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6358;
99 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6362;
103 for (i = 0; i < 2; i++) {
107 reg = bcm_perf_readl(perf_regs[i]);
108 if (BCMCPU_IS_6348()) {
109 reg &= ~EXTIRQ_CFG_MASK_ALL_6348;
110 reg |= EXTIRQ_CFG_CLEAR_ALL_6348;
112 reg &= ~EXTIRQ_CFG_MASK_ALL;
113 reg |= EXTIRQ_CFG_CLEAR_ALL;
115 bcm_perf_writel(reg, perf_regs[i]);
118 if (BCMCPU_IS_6348() && (bcm63xx_get_cpu_rev() == 0xa1))
121 pr_info("triggering watchdog soft-reset...\n");
122 if (BCMCPU_IS_6328()) {
123 bcm_wdt_writel(1, WDT_SOFTRESET_REG);
125 reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG);
126 reg |= SYS_PLL_SOFT_RESET;
127 bcm_perf_writel(reg, PERF_SYS_PLL_CTL_REG);
133 static void __bcm63xx_machine_reboot(char *p)
135 bcm63xx_machine_reboot();
139 * return system type in /proc/cpuinfo
141 const char *get_system_type(void)
143 static char buf[128];
144 snprintf(buf, sizeof(buf), "bcm63xx/%s (0x%04x/0x%02X)",
146 bcm63xx_get_cpu_id(), bcm63xx_get_cpu_rev());
150 void __init plat_time_init(void)
152 mips_hpt_frequency = bcm63xx_get_cpu_freq() / 2;
155 void __init plat_mem_setup(void)
157 memblock_add(0, bcm63xx_get_memory_size());
159 _machine_halt = bcm63xx_machine_halt;
160 _machine_restart = __bcm63xx_machine_reboot;
161 pm_power_off = bcm63xx_machine_halt;
164 ioport_resource.start = 0;
165 ioport_resource.end = ~0;
170 static int __init bcm63xx_register_devices(void)
172 /* register gpiochip */
175 return board_register_devices();
178 arch_initcall(bcm63xx_register_devices);