ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / 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
23 #include <asm/hardware.h>
24 #include <asm/mach/arch.h>
25 #include <asm/mach/map.h>
26
27 #include <asm/arch/clocks.h>
28 #include <asm/arch/gpio.h>
29 #include <asm/arch/fpga.h>
30
31 #include "common.h"
32
33 #ifdef CONFIG_ARCH_OMAP1510
34
35 extern int omap_gpio_init(void);
36
37 /* Only FPGA needs to be mapped here. All others are done with ioremap */
38 static struct map_desc innovator1510_io_desc[] __initdata = {
39 { OMAP1510P1_FPGA_BASE, OMAP1510P1_FPGA_START, OMAP1510P1_FPGA_SIZE,
40         MT_DEVICE },
41 };
42
43 static struct resource innovator1510_smc91x_resources[] = {
44         [0] = {
45                 .start  = OMAP1510P1_FPGA_ETHR_START,   /* Physical */
46                 .end    = OMAP1510P1_FPGA_ETHR_START + 16,
47                 .flags  = IORESOURCE_MEM,
48         },
49         [1] = {
50                 .start  = INT_ETHER,
51                 .end    = INT_ETHER,
52                 .flags  = IORESOURCE_IRQ,
53         },
54 };
55
56 static struct platform_device innovator1510_smc91x_device = {
57         .name           = "smc91x",
58         .id             = 0,
59         .num_resources  = ARRAY_SIZE(innovator1510_smc91x_resources),
60         .resource       = innovator1510_smc91x_resources,
61 };
62
63 static struct platform_device *innovator1510_devices[] __initdata = {
64         &innovator1510_smc91x_device,
65 };
66
67 #endif /* CONFIG_ARCH_OMAP1510 */
68
69 #ifdef CONFIG_ARCH_OMAP1610
70
71 static struct map_desc innovator1610_io_desc[] __initdata = {
72 { OMAP1610_ETHR_BASE, OMAP1610_ETHR_START, OMAP1610_ETHR_SIZE,MT_DEVICE },
73 { OMAP1610_NOR_FLASH_BASE, OMAP1610_NOR_FLASH_START, OMAP1610_NOR_FLASH_SIZE,
74         MT_DEVICE },
75 };
76
77 static struct resource innovator1610_smc91x_resources[] = {
78         [0] = {
79                 .start  = OMAP1610_ETHR_START,          /* Physical */
80                 .end    = OMAP1610_ETHR_START + SZ_4K,
81                 .flags  = IORESOURCE_MEM,
82         },
83         [1] = {
84                 .start  = 0,                            /* Really GPIO 0 */
85                 .end    = 0,
86                 .flags  = IORESOURCE_IRQ,
87         },
88 };
89
90 static struct platform_device innovator1610_smc91x_device = {
91         .name           = "smc91x",
92         .id             = 0,
93         .num_resources  = ARRAY_SIZE(innovator1610_smc91x_resources),
94         .resource       = innovator1610_smc91x_resources,
95 };
96
97 static struct platform_device *innovator1610_devices[] __initdata = {
98         &innovator1610_smc91x_device,
99 };
100
101 #endif /* CONFIG_ARCH_OMAP1610 */
102
103 void innovator_init_irq(void)
104 {
105         omap_init_irq();
106 #ifdef CONFIG_ARCH_OMAP1510
107         if (cpu_is_omap1510()) {
108                 omap_gpio_init();
109                 fpga_init_irq();
110         }
111 #endif
112 }
113
114 static void __init innovator_init(void)
115 {
116 #ifdef CONFIG_ARCH_OMAP1510
117         if (cpu_is_omap1510()) {
118                 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
119         }
120 #endif
121 #ifdef CONFIG_ARCH_OMAP1610
122         if (cpu_is_omap1610()) {
123                 platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices));
124         }
125 #endif
126 }
127
128 static void __init innovator_map_io(void)
129 {
130         omap_map_io();
131
132 #ifdef CONFIG_ARCH_OMAP1510
133         if (cpu_is_omap1510()) {
134                 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
135
136                 /* Dump the Innovator FPGA rev early - useful info for support. */
137                 printk("Innovator FPGA Rev %d.%d Board Rev %d\n",
138                        fpga_read(OMAP1510P1_FPGA_REV_HIGH),
139                        fpga_read(OMAP1510P1_FPGA_REV_LOW),
140                        fpga_read(OMAP1510P1_FPGA_BOARD_REV));
141         }
142 #endif
143 #ifdef CONFIG_ARCH_OMAP1610
144         if (cpu_is_omap1610()) {
145                 iotable_init(innovator1610_io_desc, ARRAY_SIZE(innovator1610_io_desc));
146         }
147 #endif
148 }
149
150 MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
151         MAINTAINER("MontaVista Software, Inc.")
152         BOOT_MEM(0x10000000, 0xe0000000, 0xe0000000)
153         BOOT_PARAMS(0x10000100)
154         MAPIO(innovator_map_io)
155         INITIRQ(innovator_init_irq)
156         INIT_MACHINE(innovator_init)
157 MACHINE_END