Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
setup.c
Go to the documentation of this file.
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.
5  *
6  * Copyright (C) 2008 Maxime Bizon <[email protected]>
7  */
8 
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>
23 
25 {
26  printk(KERN_INFO "System halted\n");
27  while (1)
28  ;
29 }
30 
31 static void bcm6348_a1_reboot(void)
32 {
33  u32 reg;
34 
35  /* soft reset all blocks */
36  printk(KERN_INFO "soft-resetting all blocks ...\n");
38  reg &= ~SOFTRESET_6348_ALL;
40  mdelay(10);
41 
43  reg |= SOFTRESET_6348_ALL;
45  mdelay(10);
46 
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 */
55  write_c0_wired(0);
56  __asm__ __volatile__(
57  "jr\t%0"
58  :
59  : "r" (0xbfc00000));
60  while (1)
61  ;
62 }
63 
65 {
66  u32 reg, perf_regs[2] = { 0, 0 };
67  unsigned int i;
68 
69  /* mask and clear all external irq */
70  switch (bcm63xx_get_cpu_id()) {
71  case BCM6328_CPU_ID:
72  perf_regs[0] = PERF_EXTIRQ_CFG_REG_6328;
73  break;
74  case BCM6338_CPU_ID:
75  perf_regs[0] = PERF_EXTIRQ_CFG_REG_6338;
76  break;
77  case BCM6345_CPU_ID:
78  perf_regs[0] = PERF_EXTIRQ_CFG_REG_6345;
79  break;
80  case BCM6348_CPU_ID:
81  perf_regs[0] = PERF_EXTIRQ_CFG_REG_6348;
82  break;
83  case BCM6358_CPU_ID:
84  perf_regs[0] = PERF_EXTIRQ_CFG_REG_6358;
85  break;
86  }
87 
88  for (i = 0; i < 2; i++) {
89  if (!perf_regs[i])
90  break;
91 
92  reg = bcm_perf_readl(perf_regs[i]);
93  if (BCMCPU_IS_6348()) {
96  } else {
97  reg &= ~EXTIRQ_CFG_MASK_ALL;
98  reg |= EXTIRQ_CFG_CLEAR_ALL;
99  }
100  bcm_perf_writel(reg, perf_regs[i]);
101  }
102 
103  if (BCMCPU_IS_6348() && (bcm63xx_get_cpu_rev() == 0xa1))
104  bcm6348_a1_reboot();
105 
106  printk(KERN_INFO "triggering watchdog soft-reset...\n");
107  if (BCMCPU_IS_6328()) {
109  } else {
111  reg |= SYS_PLL_SOFT_RESET;
113  }
114  while (1)
115  ;
116 }
117 
118 static void __bcm63xx_machine_reboot(char *p)
119 {
121 }
122 
123 /*
124  * return system type in /proc/cpuinfo
125  */
126 const char *get_system_type(void)
127 {
128  static char buf[128];
129  snprintf(buf, sizeof(buf), "bcm63xx/%s (0x%04x/0x%04X)",
130  board_get_name(),
131  bcm63xx_get_cpu_id(), bcm63xx_get_cpu_rev());
132  return buf;
133 }
134 
136 {
138 }
139 
141 {
143 
145  _machine_restart = __bcm63xx_machine_reboot;
147 
148  set_io_port_base(0);
149  ioport_resource.start = 0;
150  ioport_resource.end = ~0;
151 
152  board_setup();
153 }
154 
156 {
157  return board_register_devices();
158 }
159