remove unused empty files
[openwrt/openwrt.git] / target / linux / aruba-2.6 / files / arch / mips / aruba / setup.c
1 /**************************************************************************
2 *
3 * BRIEF MODULE DESCRIPTION
4 * setup routines for IDT EB434 boards
5 *
6 * Copyright 2004 IDT Inc. (rischelp@idt.com)
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 *
28 *
29 **************************************************************************
30 * May 2004 rkt, neb
31 *
32 * Initial Release
33 *
34 *
35 *
36 **************************************************************************
37 */
38
39 #include <linux/init.h>
40 #include <linux/module.h>
41 #include <linux/mm.h>
42 #include <linux/sched.h>
43 #include <linux/irq.h>
44 #include <asm/bootinfo.h>
45 #include <asm/io.h>
46 #include <linux/ioport.h>
47 #include <asm/mipsregs.h>
48 #include <asm/pgtable.h>
49 #include <asm/reboot.h>
50 #include <asm/addrspace.h> /* for KSEG1ADDR() */
51 #include <asm/idt-boards/rc32434/rc32434.h>
52 #include <linux/pm.h>
53 #include <linux/platform_device.h>
54 #include <linux/mtd/partitions.h>
55 #include <linux/mtd/physmap.h>
56
57 extern char *__init prom_getcmdline(void);
58
59 extern void (*board_time_init) (void);
60 extern void aruba_time_init(void);
61 extern void aruba_reset(void);
62
63 #define epldMask ((volatile unsigned char *)0xB900000d)
64
65 static void aruba_machine_restart(char *command)
66 {
67 switch (mips_machtype) {
68 case MACH_ARUBA_AP70:
69 *(volatile u32 *)KSEG1ADDR(0x18008000) = 0x80000001;
70 break;
71 case MACH_ARUBA_AP65:
72 case MACH_ARUBA_AP60:
73 default:
74 /* Reset*/
75 *((volatile u32 *)KSEG1ADDR(0x1c003020)) = 0x00080350; // reset everything in sight
76 udelay(100);
77 *((volatile u32 *)KSEG1ADDR(0x1c003020)) = 0; // reset everything in sight
78 udelay(100);
79 *((volatile u32 *)KSEG1ADDR(0x1c003020)) = 0x3; // cold reset the cpu & system
80 break;
81 }
82 }
83
84 static void aruba_machine_halt(void)
85 {
86 for (;;) continue;
87 }
88
89 extern char * getenv(char *e);
90
91 extern void unlock_ap60_70_flash(void);
92
93 static struct resource aruba_flash_resource = {
94 .start = 0x1fc00000,
95 .end = 0x1fffffffULL,
96 .flags = IORESOURCE_MEM,
97 };
98
99 static struct mtd_partition aruba_flash_parts[] = {
100 {
101 .name = "kernel",
102 .offset = 0x80000,
103 .size = 0x370000,
104 },
105 {
106 .name = "rootfs",
107 .offset = 0x140000,
108 .size = 0x2B0000,
109 },
110 {
111 .name = "NVRAM",
112 .offset = 0x3f8000,
113 .size = 0x2000,
114 }
115 };
116
117 static struct physmap_flash_data aruba_flash_data = {
118 .width = 1,
119 .parts = aruba_flash_parts,
120 .nr_parts = ARRAY_SIZE(aruba_flash_parts),
121 };
122
123 static struct platform_device aruba_flash_device = {
124 .name = "physmap-flash",
125 .id = 0,
126 .dev = {
127 .platform_data = &aruba_flash_data,
128 },
129 .num_resources = 1,
130 .resource = &aruba_flash_resource,
131 };
132
133 static int aruba_setup_flash(void)
134 {
135 platform_device_register(&aruba_flash_device);
136
137 return 0;
138 };
139
140 arch_initcall (aruba_setup_flash);
141
142 void __init plat_mem_setup(void)
143 {
144 board_time_init = aruba_time_init;
145
146 _machine_restart = aruba_machine_restart;
147 _machine_halt = aruba_machine_halt;
148 pm_power_off = aruba_machine_halt;
149
150 set_io_port_base(KSEG1);
151
152 /* Enable PCI interrupts in EPLD Mask register */
153 *epldMask = 0x0;
154 *(epldMask + 1) = 0x0;
155
156 write_c0_wired(0);
157 unlock_ap60_70_flash();
158
159 printk("BOARD - %s\n",getenv("boardname"));
160 }
161
162 int page_is_ram(unsigned long pagenr)
163 {
164 return 1;
165 }
166
167 const char *get_system_type(void)
168 {
169 switch (mips_machtype) {
170 case MACH_ARUBA_AP70:
171 return "Aruba AP70";
172 case MACH_ARUBA_AP65:
173 return "Aruba AP65";
174 case MACH_ARUBA_AP60:
175 return "Aruba AP60/AP61";
176 default:
177 return "Aruba UNKNOWN";
178 }
179 }
180
181 EXPORT_SYMBOL(get_system_type);