Merge remote-tracking branch 's5p/for-next'
[linux-2.6/next.git] / arch / mips / bcm63xx / setup.c
blobd0056598fbfcac2e36438dda2940b7cd0df7194b
1 /*
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
4 * for more details.
6 * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
7 */
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>
14 #include <linux/pm.h>
15 #include <asm/bootinfo.h>
16 #include <asm/time.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");
27 while (1)
31 static void bcm6348_a1_reboot(void)
33 u32 reg;
35 /* soft reset all blocks */
36 printk(KERN_INFO "soft-reseting all blocks ...\n");
37 reg = bcm_perf_readl(PERF_SOFTRESET_REG);
38 reg &= ~SOFTRESET_6348_ALL;
39 bcm_perf_writel(reg, PERF_SOFTRESET_REG);
40 mdelay(10);
42 reg = bcm_perf_readl(PERF_SOFTRESET_REG);
43 reg |= SOFTRESET_6348_ALL;
44 bcm_perf_writel(reg, PERF_SOFTRESET_REG);
45 mdelay(10);
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);
53 __flush_cache_all();
54 /* remove all wired TLB entries */
55 write_c0_wired(0);
56 __asm__ __volatile__(
57 "jr\t%0"
59 : "r" (0xbfc00000));
60 while (1)
64 void bcm63xx_machine_reboot(void)
66 u32 reg;
68 /* mask and clear all external irq */
69 reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG);
70 reg &= ~EXTIRQ_CFG_MASK_ALL;
71 reg |= EXTIRQ_CFG_CLEAR_ALL;
72 bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG);
74 if (BCMCPU_IS_6348() && (bcm63xx_get_cpu_rev() == 0xa1))
75 bcm6348_a1_reboot();
77 printk(KERN_INFO "triggering watchdog soft-reset...\n");
78 reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG);
79 reg |= SYS_PLL_SOFT_RESET;
80 bcm_perf_writel(reg, PERF_SYS_PLL_CTL_REG);
81 while (1)
85 static void __bcm63xx_machine_reboot(char *p)
87 bcm63xx_machine_reboot();
91 * return system type in /proc/cpuinfo
93 const char *get_system_type(void)
95 static char buf[128];
96 snprintf(buf, sizeof(buf), "bcm63xx/%s (0x%04x/0x%04X)",
97 board_get_name(),
98 bcm63xx_get_cpu_id(), bcm63xx_get_cpu_rev());
99 return buf;
102 void __init plat_time_init(void)
104 mips_hpt_frequency = bcm63xx_get_cpu_freq() / 2;
107 void __init plat_mem_setup(void)
109 add_memory_region(0, bcm63xx_get_memory_size(), BOOT_MEM_RAM);
111 _machine_halt = bcm63xx_machine_halt;
112 _machine_restart = __bcm63xx_machine_reboot;
113 pm_power_off = bcm63xx_machine_halt;
115 set_io_port_base(0);
116 ioport_resource.start = 0;
117 ioport_resource.end = ~0;
119 board_setup();
122 int __init bcm63xx_register_devices(void)
124 return board_register_devices();
127 arch_initcall(bcm63xx_register_devices);