http://downloads.netgear.com/files/GPL/GPL_Source_V361j_DM111PSP_series_consumer_rele...
[bcm963xx.git] / kernel / linux / arch / arm / mach-sa1100 / cerf.c
1 /*
2  * linux/arch/arm/mach-sa1100/cerf.c
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * Apr-2003 : Removed some old PDA crud [FB]
9  * Oct-2003 : Added uart2 resource [FB]
10  * Jan-2004 : Removed io map for flash [FB]
11  */
12
13 #include <linux/config.h>
14 #include <linux/init.h>
15 #include <linux/kernel.h>
16 #include <linux/tty.h>
17 #include <linux/device.h>
18
19 #include <asm/irq.h>
20 #include <asm/hardware.h>
21 #include <asm/setup.h>
22
23 #include <asm/mach-types.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
26 #include <asm/mach/serial_sa1100.h>
27
28 #include <asm/arch/cerf.h>
29 #include "generic.h"
30
31 static struct resource cerfuart2_resources[] = {
32         [0] = {
33                 .start  = 0x80030000,
34                 .end    = 0x8003ffff,
35                 .flags  = IORESOURCE_MEM,
36         },
37 };
38
39 static struct platform_device cerfuart2_device = {
40         .name           = "sa11x0-uart",
41         .id             = 2,
42         .num_resources  = ARRAY_SIZE(cerfuart2_resources),
43         .resource       = cerfuart2_resources,
44 };
45
46 static struct platform_device *cerf_devices[] __initdata = {
47         &cerfuart2_device,
48 };
49
50 static void __init cerf_init_irq(void)
51 {
52         sa1100_init_irq();
53         set_irq_type(CERF_ETH_IRQ, IRQT_RISING);
54 }
55
56 static struct map_desc cerf_io_desc[] __initdata = {
57   /* virtual     physical    length      type */
58   { 0xf0000000, 0x08000000, 0x00100000, MT_DEVICE }  /* Crystal Ethernet Chip */
59 };
60
61 static void __init cerf_map_io(void)
62 {
63         sa1100_map_io();
64         iotable_init(cerf_io_desc, ARRAY_SIZE(cerf_io_desc));
65
66         sa1100_register_uart(0, 3);
67         sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */
68         sa1100_register_uart(2, 1);
69
70         /* set some GPDR bits here while it's safe */
71         GPDR |= CERF_GPIO_CF_RESET;
72 }
73
74 static int __init cerf_init(void)
75 {
76         int ret;
77
78         if (!machine_is_cerf())
79                 return -ENODEV;
80
81         ret = platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
82         if (ret < 0)
83                 return ret;
84
85         return 0;
86 }
87
88 arch_initcall(cerf_init);
89
90 MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
91         MAINTAINER("support@intrinsyc.com")
92         BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
93         MAPIO(cerf_map_io)
94         INITIRQ(cerf_init_irq)
95         INITTIME(sa1100_init_time)
96 MACHINE_END