Blame view

arch/arm/mach-bcmring/arch.c 5.12 KB
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  /*****************************************************************************
  * Copyright 2003 - 2008 Broadcom Corporation.  All rights reserved.
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
  * under the terms of the GNU General Public License version 2, available at
  * http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
  *
  * Notwithstanding the above, under no circumstances may you combine this
  * software in any way with any other Broadcom software provided under a
  * license other than the GPL, without Broadcom's express prior written
  * consent.
  *****************************************************************************/
  
  #include <linux/kernel.h>
  #include <linux/platform_device.h>
  #include <linux/types.h>
  #include <linux/sched.h>
  #include <linux/interrupt.h>
  #include <linux/init.h>
  #include <linux/errno.h>
  #include <linux/spinlock.h>
  #include <linux/module.h>
  
  #include <linux/proc_fs.h>
  #include <linux/sysctl.h>
  
  #include <asm/irq.h>
  #include <asm/setup.h>
  #include <asm/mach-types.h>
  #include <asm/mach/time.h>
871601131   Will Deacon   ARM: 6047/1: ARM:...
32
  #include <asm/pmu.h>
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  
  #include <asm/mach/arch.h>
  #include <mach/dma.h>
  #include <mach/hardware.h>
  #include <mach/csp/mm_io.h>
  #include <mach/csp/chipcHw_def.h>
  #include <mach/csp/chipcHw_inline.h>
  
  #include <cfg_global.h>
  
  #include "core.h"
  
  HW_DECLARE_SPINLOCK(arch)
  HW_DECLARE_SPINLOCK(gpio)
  #if defined(CONFIG_DEBUG_SPINLOCK)
      EXPORT_SYMBOL(bcmring_gpio_reg_lock);
  #endif
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
50
  /* sysctl */
d1fce9c11   Russell King   ARM: restart: bcm...
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  static int bcmring_arch_warm_reboot;	/* do a warm reboot on hard reset */
  
  static void bcmring_restart(char mode, const char *cmd)
  {
  	printk("arch_reset:%c %x
  ", mode, bcmring_arch_warm_reboot);
  
  	if (mode == 'h') {
  		/* Reboot configured in proc entry */
  		if (bcmring_arch_warm_reboot) {
  			printk("warm reset
  ");
  			/* Issue Warm reset (do not reset ethernet switch, keep alive) */
  			chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_WARM);
  		} else {
  			/* Force reset of everything */
  			printk("force reset
  ");
  			chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_SOFT);
  		}
  	} else {
  		/* Force reset of everything */
  		printk("force reset
  ");
  		chipcHw_reset(chipcHw_REG_SOFT_RESET_CHIP_SOFT);
  	}
  }
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
78
79
80
81
82
  
  static struct ctl_table_header *bcmring_sysctl_header;
  
  static struct ctl_table bcmring_sysctl_warm_reboot[] = {
  	{
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
83
84
85
86
  	 .procname = "warm",
  	 .data = &bcmring_arch_warm_reboot,
  	 .maxlen = sizeof(int),
  	 .mode = 0644,
6d4561110   Eric W. Biederman   sysctl: Drop & in...
87
  	 .proc_handler = proc_dointvec},
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
88
89
90
91
92
  	{}
  };
  
  static struct ctl_table bcmring_sysctl_reboot[] = {
  	{
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
93
94
95
96
97
  	 .procname = "reboot",
  	 .mode = 0555,
  	 .child = bcmring_sysctl_warm_reboot},
  	{}
  };
266dead21   Leo (Hao) Chen   mtd: add bcmring ...
98
99
100
101
102
103
104
  static struct resource nand_resource[] = {
  	[0] = {
  		.start = MM_ADDR_IO_NAND,
  		.end = MM_ADDR_IO_NAND + 0x1000 - 1,
  		.flags = IORESOURCE_MEM,
  	},
  };
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
105
106
107
  static struct platform_device nand_device = {
  	.name = "bcm-nand",
  	.id = -1,
266dead21   Leo (Hao) Chen   mtd: add bcmring ...
108
109
  	.resource = nand_resource,
  	.num_resources	= ARRAY_SIZE(nand_resource),
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
110
  };
871601131   Will Deacon   ARM: 6047/1: ARM:...
111
112
113
114
115
116
117
118
119
120
121
122
  static struct resource pmu_resource = {
  	.start	= IRQ_PMUIRQ,
  	.end	= IRQ_PMUIRQ,
  	.flags	= IORESOURCE_IRQ,
  };
  
  static struct platform_device pmu_device = {
  	.name		= "arm-pmu",
  	.id		= ARM_PMU_DEVICE_CPU,
  	.resource	= &pmu_resource,
  	.num_resources	= 1,
  };
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
123
124
  static struct platform_device *devices[] __initdata = {
  	&nand_device,
871601131   Will Deacon   ARM: 6047/1: ARM:...
125
  	&pmu_device,
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
  };
  
  /****************************************************************************
  *
  *   Called from the customize_machine function in arch/arm/kernel/setup.c
  *
  *   The customize_machine function is tagged as an arch_initcall
  *   (see include/linux/init.h for the order that the various init sections
  *   are called in.
  *
  *****************************************************************************/
  static void __init bcmring_init_machine(void)
  {
  
  	bcmring_sysctl_header = register_sysctl_table(bcmring_sysctl_reboot);
  
  	/* Enable spread spectrum */
  	chipcHw_enableSpreadSpectrum();
  
  	platform_add_devices(devices, ARRAY_SIZE(devices));
  
  	bcmring_amba_init();
  
  	dma_init();
  }
  
  /****************************************************************************
  *
  *   Called from setup_arch (in arch/arm/kernel/setup.c) to fixup any tags
  *   passed in by the boot loader.
  *
  *****************************************************************************/
0744a3ee3   Russell King   ARM: platform fix...
158
159
  static void __init bcmring_fixup(struct tag *t, char **cmdline,
  	struct meminfo *mi) {
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
  #ifdef CONFIG_BLK_DEV_INITRD
  	printk(KERN_NOTICE "bcmring_fixup
  ");
  	t->hdr.tag = ATAG_CORE;
  	t->hdr.size = tag_size(tag_core);
  	t->u.core.flags = 0;
  	t->u.core.pagesize = PAGE_SIZE;
  	t->u.core.rootdev = 31 << 8 | 0;
  	t = tag_next(t);
  
  	t->hdr.tag = ATAG_MEM;
  	t->hdr.size = tag_size(tag_mem32);
  	t->u.mem.start = CFG_GLOBAL_RAM_BASE;
  	t->u.mem.size = CFG_GLOBAL_RAM_SIZE;
  
  	t = tag_next(t);
  
  	t->hdr.tag = ATAG_NONE;
  	t->hdr.size = 0;
  #endif
  }
  
  /****************************************************************************
  *
  *   Machine Description
  *
  *****************************************************************************/
  
  MACHINE_START(BCMRING, "BCMRING")
  	/* Maintainer: Broadcom Corporation */
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
190
191
  	.fixup = bcmring_fixup,
  	.map_io = bcmring_map_io,
ede2e2345   Jiandong Zheng   ARM: 6912/1: bcmr...
192
  	.init_early = bcmring_init_early,
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
193
194
195
  	.init_irq = bcmring_init_irq,
  	.timer = &bcmring_timer,
  	.init_machine = bcmring_init_machine
d1fce9c11   Russell King   ARM: restart: bcm...
196
  	.restart = bcmring_restart,
4663712cc   Leo Chen   ARM: 5643/1: bcmr...
197
  MACHINE_END