Merge branch 'reiserfs/kill-bkl' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / arch / arm / mach-bcmring / arch.c
1 /*****************************************************************************
2 * Copyright 2003 - 2008 Broadcom Corporation.  All rights reserved.
3 *
4 * Unless you and Broadcom execute a separate written software license
5 * agreement governing use of this software, this software is licensed to you
6 * under the terms of the GNU General Public License version 2, available at
7 * http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
8 *
9 * Notwithstanding the above, under no circumstances may you combine this
10 * software in any way with any other Broadcom software provided under a
11 * license other than the GPL, without Broadcom's express prior written
12 * consent.
13 *****************************************************************************/
14
15 #include <linux/kernel.h>
16 #include <linux/platform_device.h>
17 #include <linux/types.h>
18 #include <linux/sched.h>
19 #include <linux/interrupt.h>
20 #include <linux/init.h>
21 #include <linux/errno.h>
22 #include <linux/spinlock.h>
23 #include <linux/module.h>
24
25 #include <linux/proc_fs.h>
26 #include <linux/sysctl.h>
27
28 #include <asm/irq.h>
29 #include <asm/setup.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/time.h>
32
33 #include <asm/mach/arch.h>
34 #include <mach/dma.h>
35 #include <mach/hardware.h>
36 #include <mach/csp/mm_io.h>
37 #include <mach/csp/chipcHw_def.h>
38 #include <mach/csp/chipcHw_inline.h>
39
40 #include <cfg_global.h>
41
42 #include "core.h"
43
44 HW_DECLARE_SPINLOCK(arch)
45 HW_DECLARE_SPINLOCK(gpio)
46 #if defined(CONFIG_DEBUG_SPINLOCK)
47     EXPORT_SYMBOL(bcmring_gpio_reg_lock);
48 #endif
49
50 /* sysctl */
51 int bcmring_arch_warm_reboot;   /* do a warm reboot on hard reset */
52
53 static struct ctl_table_header *bcmring_sysctl_header;
54
55 static struct ctl_table bcmring_sysctl_warm_reboot[] = {
56         {
57          .procname = "warm",
58          .data = &bcmring_arch_warm_reboot,
59          .maxlen = sizeof(int),
60          .mode = 0644,
61          .proc_handler = proc_dointvec},
62         {}
63 };
64
65 static struct ctl_table bcmring_sysctl_reboot[] = {
66         {
67          .procname = "reboot",
68          .mode = 0555,
69          .child = bcmring_sysctl_warm_reboot},
70         {}
71 };
72
73 static struct resource nand_resource[] = {
74         [0] = {
75                 .start = MM_ADDR_IO_NAND,
76                 .end = MM_ADDR_IO_NAND + 0x1000 - 1,
77                 .flags = IORESOURCE_MEM,
78         },
79 };
80
81 static struct platform_device nand_device = {
82         .name = "bcm-nand",
83         .id = -1,
84         .resource = nand_resource,
85         .num_resources  = ARRAY_SIZE(nand_resource),
86 };
87
88 static struct platform_device *devices[] __initdata = {
89         &nand_device,
90 };
91
92 /****************************************************************************
93 *
94 *   Called from the customize_machine function in arch/arm/kernel/setup.c
95 *
96 *   The customize_machine function is tagged as an arch_initcall
97 *   (see include/linux/init.h for the order that the various init sections
98 *   are called in.
99 *
100 *****************************************************************************/
101 static void __init bcmring_init_machine(void)
102 {
103
104         bcmring_sysctl_header = register_sysctl_table(bcmring_sysctl_reboot);
105
106         /* Enable spread spectrum */
107         chipcHw_enableSpreadSpectrum();
108
109         platform_add_devices(devices, ARRAY_SIZE(devices));
110
111         bcmring_amba_init();
112
113         dma_init();
114 }
115
116 /****************************************************************************
117 *
118 *   Called from setup_arch (in arch/arm/kernel/setup.c) to fixup any tags
119 *   passed in by the boot loader.
120 *
121 *****************************************************************************/
122
123 static void __init bcmring_fixup(struct machine_desc *desc,
124      struct tag *t, char **cmdline, struct meminfo *mi) {
125 #ifdef CONFIG_BLK_DEV_INITRD
126         printk(KERN_NOTICE "bcmring_fixup\n");
127         t->hdr.tag = ATAG_CORE;
128         t->hdr.size = tag_size(tag_core);
129         t->u.core.flags = 0;
130         t->u.core.pagesize = PAGE_SIZE;
131         t->u.core.rootdev = 31 << 8 | 0;
132         t = tag_next(t);
133
134         t->hdr.tag = ATAG_MEM;
135         t->hdr.size = tag_size(tag_mem32);
136         t->u.mem.start = CFG_GLOBAL_RAM_BASE;
137         t->u.mem.size = CFG_GLOBAL_RAM_SIZE;
138
139         t = tag_next(t);
140
141         t->hdr.tag = ATAG_NONE;
142         t->hdr.size = 0;
143 #endif
144 }
145
146 /****************************************************************************
147 *
148 *   Machine Description
149 *
150 *****************************************************************************/
151
152 MACHINE_START(BCMRING, "BCMRING")
153         /* Maintainer: Broadcom Corporation */
154         .phys_io = MM_IO_START,
155         .io_pg_offst = (MM_IO_BASE >> 18) & 0xfffc,
156         .fixup = bcmring_fixup,
157         .map_io = bcmring_map_io,
158         .init_irq = bcmring_init_irq,
159         .timer = &bcmring_timer,
160         .init_machine = bcmring_init_machine
161 MACHINE_END