http://downloads.netgear.com/files/GPL/GPL_Source_V361j_DM111PSP_series_consumer_rele...
[bcm963xx.git] / kernel / linux / arch / arm / mach-omap / board-innovator.c
1 /*
2  * linux/arch/arm/mach-omap/board-innovator.c
3  *
4  * Board specific inits for OMAP-1510 and OMAP-1610 Innovator
5  *
6  * Copyright (C) 2001 RidgeRun, Inc.
7  * Author: Greg Lonnon <glonnon@ridgerun.com>
8  *
9  * Copyright (C) 2002 MontaVista Software, Inc.
10  *
11  * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6
12  * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.com>
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License version 2 as
16  * published by the Free Software Foundation.
17  */
18
19 #include <linux/kernel.h>
20 #include <linux/init.h>
21 #include <linux/device.h>
22 #include <linux/delay.h>
23
24 #include <asm/hardware.h>
25 #include <asm/mach-types.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/map.h>
28
29 #include <asm/arch/clocks.h>
30 #include <asm/arch/gpio.h>
31 #include <asm/arch/fpga.h>
32
33 #include "common.h"
34
35 #ifdef CONFIG_ARCH_OMAP1510
36
37 extern int omap_gpio_init(void);
38
39 /* Only FPGA needs to be mapped here. All others are done with ioremap */
40 static struct map_desc innovator1510_io_desc[] __initdata = {
41 { OMAP1510_FPGA_BASE, OMAP1510_FPGA_START, OMAP1510_FPGA_SIZE,
42         MT_DEVICE },
43 };
44
45 static struct resource innovator1510_smc91x_resources[] = {
46         [0] = {
47                 .start  = OMAP1510_FPGA_ETHR_START,     /* Physical */
48                 .end    = OMAP1510_FPGA_ETHR_START + 16,
49                 .flags  = IORESOURCE_MEM,
50         },
51         [1] = {
52                 .start  = INT_ETHER,
53                 .end    = INT_ETHER,
54                 .flags  = IORESOURCE_IRQ,
55         },
56 };
57
58 static struct platform_device innovator1510_smc91x_device = {
59         .name           = "smc91x",
60         .id             = 0,
61         .num_resources  = ARRAY_SIZE(innovator1510_smc91x_resources),
62         .resource       = innovator1510_smc91x_resources,
63 };
64
65 static struct platform_device *innovator1510_devices[] __initdata = {
66         &innovator1510_smc91x_device,
67 };
68
69 #endif /* CONFIG_ARCH_OMAP1510 */
70
71 #ifdef CONFIG_ARCH_OMAP1610
72
73 static struct map_desc innovator1610_io_desc[] __initdata = {
74 { OMAP1610_ETHR_BASE, OMAP1610_ETHR_START, OMAP1610_ETHR_SIZE,MT_DEVICE },
75 { OMAP1610_NOR_FLASH_BASE, OMAP1610_NOR_FLASH_START, OMAP1610_NOR_FLASH_SIZE,
76         MT_DEVICE },
77 };
78
79 static struct resource innovator1610_smc91x_resources[] = {
80         [0] = {
81                 .start  = OMAP1610_ETHR_START,          /* Physical */
82                 .end    = OMAP1610_ETHR_START + SZ_4K,
83                 .flags  = IORESOURCE_MEM,
84         },
85         [1] = {
86                 .start  = 0,                            /* Really GPIO 0 */
87                 .end    = 0,
88                 .flags  = IORESOURCE_IRQ,
89         },
90 };
91
92 static struct platform_device innovator1610_smc91x_device = {
93         .name           = "smc91x",
94         .id             = 0,
95         .num_resources  = ARRAY_SIZE(innovator1610_smc91x_resources),
96         .resource       = innovator1610_smc91x_resources,
97 };
98
99 static struct platform_device *innovator1610_devices[] __initdata = {
100         &innovator1610_smc91x_device,
101 };
102
103 #endif /* CONFIG_ARCH_OMAP1610 */
104
105 void innovator_init_irq(void)
106 {
107         omap_init_irq();
108 #ifdef CONFIG_ARCH_OMAP1510
109         if (cpu_is_omap1510()) {
110                 omap_gpio_init();
111                 fpga_init_irq();
112         }
113 #endif
114 }
115
116 static void __init innovator_init(void)
117 {
118 #ifdef CONFIG_ARCH_OMAP1510
119         if (cpu_is_omap1510()) {
120                 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
121         }
122 #endif
123 #ifdef CONFIG_ARCH_OMAP1610
124         if (cpu_is_omap1610()) {
125                 platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices));
126         }
127 #endif
128 }
129
130 static void __init innovator_map_io(void)
131 {
132         omap_map_io();
133
134 #ifdef CONFIG_ARCH_OMAP1510
135         if (cpu_is_omap1510()) {
136                 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
137                 udelay(10);     /* Delay needed for FPGA */
138
139                 /* Dump the Innovator FPGA rev early - useful info for support. */
140                 printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
141                        fpga_read(OMAP1510_FPGA_REV_HIGH),
142                        fpga_read(OMAP1510_FPGA_REV_LOW),
143                        fpga_read(OMAP1510_FPGA_BOARD_REV));
144         }
145 #endif
146 #ifdef CONFIG_ARCH_OMAP1610
147         if (cpu_is_omap1610()) {
148                 iotable_init(innovator1610_io_desc, ARRAY_SIZE(innovator1610_io_desc));
149         }
150 #endif
151 }
152
153 MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
154         MAINTAINER("MontaVista Software, Inc.")
155         BOOT_MEM(0x10000000, 0xfff00000, 0xfef00000)
156         BOOT_PARAMS(0x10000100)
157         MAPIO(innovator_map_io)
158         INITIRQ(innovator_init_irq)
159         INITTIME(omap_init_time)
160         INIT_MACHINE(innovator_init)
161 MACHINE_END