blob: 074dad6b1c18b478bf5e85d31e86456f0755085e [file] [log] [blame]
Leo Chen46637122009-08-07 19:56:19 +01001/*****************************************************************************
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
44HW_DECLARE_SPINLOCK(arch)
45HW_DECLARE_SPINLOCK(gpio)
46#if defined(CONFIG_DEBUG_SPINLOCK)
47 EXPORT_SYMBOL(bcmring_gpio_reg_lock);
48#endif
49
50/* FIXME: temporary solution */
51#define BCM_SYSCTL_REBOOT_WARM 1
52#define CTL_BCM_REBOOT 112
53
54/* sysctl */
55int bcmring_arch_warm_reboot; /* do a warm reboot on hard reset */
56
57static struct ctl_table_header *bcmring_sysctl_header;
58
59static struct ctl_table bcmring_sysctl_warm_reboot[] = {
60 {
61 .ctl_name = BCM_SYSCTL_REBOOT_WARM,
62 .procname = "warm",
63 .data = &bcmring_arch_warm_reboot,
64 .maxlen = sizeof(int),
65 .mode = 0644,
66 .proc_handler = &proc_dointvec},
67 {}
68};
69
70static struct ctl_table bcmring_sysctl_reboot[] = {
71 {
72 .ctl_name = CTL_BCM_REBOOT,
73 .procname = "reboot",
74 .mode = 0555,
75 .child = bcmring_sysctl_warm_reboot},
76 {}
77};
78
Leo (Hao) Chen266dead2009-10-09 19:13:08 -070079static struct resource nand_resource[] = {
80 [0] = {
81 .start = MM_ADDR_IO_NAND,
82 .end = MM_ADDR_IO_NAND + 0x1000 - 1,
83 .flags = IORESOURCE_MEM,
84 },
85};
86
Leo Chen46637122009-08-07 19:56:19 +010087static struct platform_device nand_device = {
88 .name = "bcm-nand",
89 .id = -1,
Leo (Hao) Chen266dead2009-10-09 19:13:08 -070090 .resource = nand_resource,
91 .num_resources = ARRAY_SIZE(nand_resource),
Leo Chen46637122009-08-07 19:56:19 +010092};
93
94static struct platform_device *devices[] __initdata = {
95 &nand_device,
96};
97
98/****************************************************************************
99*
100* Called from the customize_machine function in arch/arm/kernel/setup.c
101*
102* The customize_machine function is tagged as an arch_initcall
103* (see include/linux/init.h for the order that the various init sections
104* are called in.
105*
106*****************************************************************************/
107static void __init bcmring_init_machine(void)
108{
109
110 bcmring_sysctl_header = register_sysctl_table(bcmring_sysctl_reboot);
111
112 /* Enable spread spectrum */
113 chipcHw_enableSpreadSpectrum();
114
115 platform_add_devices(devices, ARRAY_SIZE(devices));
116
117 bcmring_amba_init();
118
119 dma_init();
120}
121
122/****************************************************************************
123*
124* Called from setup_arch (in arch/arm/kernel/setup.c) to fixup any tags
125* passed in by the boot loader.
126*
127*****************************************************************************/
128
129static void __init bcmring_fixup(struct machine_desc *desc,
130 struct tag *t, char **cmdline, struct meminfo *mi) {
131#ifdef CONFIG_BLK_DEV_INITRD
132 printk(KERN_NOTICE "bcmring_fixup\n");
133 t->hdr.tag = ATAG_CORE;
134 t->hdr.size = tag_size(tag_core);
135 t->u.core.flags = 0;
136 t->u.core.pagesize = PAGE_SIZE;
137 t->u.core.rootdev = 31 << 8 | 0;
138 t = tag_next(t);
139
140 t->hdr.tag = ATAG_MEM;
141 t->hdr.size = tag_size(tag_mem32);
142 t->u.mem.start = CFG_GLOBAL_RAM_BASE;
143 t->u.mem.size = CFG_GLOBAL_RAM_SIZE;
144
145 t = tag_next(t);
146
147 t->hdr.tag = ATAG_NONE;
148 t->hdr.size = 0;
149#endif
150}
151
152/****************************************************************************
153*
154* Machine Description
155*
156*****************************************************************************/
157
158MACHINE_START(BCMRING, "BCMRING")
159 /* Maintainer: Broadcom Corporation */
160 .phys_io = MM_IO_START,
161 .io_pg_offst = (MM_IO_BASE >> 18) & 0xfffc,
162 .fixup = bcmring_fixup,
163 .map_io = bcmring_map_io,
164 .init_irq = bcmring_init_irq,
165 .timer = &bcmring_timer,
166 .init_machine = bcmring_init_machine
167MACHINE_END