Merge commit 'origin/master' into next
[linux-2.6] / arch / arm / mach-ep93xx / edb93xx.c
1 /*
2  * arch/arm/mach-ep93xx/edb93xx.c
3  * Cirrus Logic EDB93xx Development Board support.
4  *
5  * EDB93XX, EDB9301, EDB9307A
6  * Copyright (C) 2008-2009 H Hartley Sweeten <hsweeten@visionengravers.com>
7  *
8  * EDB9302
9  * Copyright (C) 2006 George Kashperko <george@chas.com.ua>
10  *
11  * EDB9302A, EDB9315, EDB9315A
12  * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
13  *
14  * EDB9307
15  * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
16  *
17  * EDB9312
18  * Copyright (C) 2006 Infosys Technologies Limited
19  *                    Toufeeq Hussain <toufeeq_hussain@infosys.com>
20  *
21  * This program is free software; you can redistribute it and/or modify
22  * it under the terms of the GNU General Public License as published by
23  * the Free Software Foundation; either version 2 of the License, or (at
24  * your option) any later version.
25  */
26
27 #include <linux/kernel.h>
28 #include <linux/init.h>
29 #include <linux/mm.h>
30 #include <linux/sched.h>
31 #include <linux/interrupt.h>
32 #include <linux/ioport.h>
33 #include <linux/mtd/physmap.h>
34 #include <linux/platform_device.h>
35 #include <linux/io.h>
36 #include <linux/i2c.h>
37 #include <mach/hardware.h>
38 #include <asm/mach-types.h>
39 #include <asm/mach/arch.h>
40
41 static struct physmap_flash_data edb93xx_flash_data;
42
43 static struct resource edb93xx_flash_resource = {
44         .flags          = IORESOURCE_MEM,
45 };
46
47 static struct platform_device edb93xx_flash = {
48         .name           = "physmap-flash",
49         .id             = 0,
50         .dev            = {
51                 .platform_data  = &edb93xx_flash_data,
52         },
53         .num_resources  = 1,
54         .resource       = &edb93xx_flash_resource,
55 };
56
57 static void __init __edb93xx_register_flash(unsigned int width,
58                         resource_size_t start, resource_size_t size)
59 {
60         edb93xx_flash_data.width        = width;
61         edb93xx_flash_resource.start    = start;
62         edb93xx_flash_resource.end      = start + size - 1;
63
64         platform_device_register(&edb93xx_flash);
65 }
66
67 static void __init edb93xx_register_flash(void)
68 {
69         if (machine_is_edb9307() || machine_is_edb9312() ||
70             machine_is_edb9315()) {
71                 __edb93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
72         } else {
73                 __edb93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
74         }
75 }
76
77 static struct ep93xx_eth_data edb93xx_eth_data = {
78         .phy_id         = 1,
79 };
80
81 static struct i2c_board_info __initdata edb93xxa_i2c_data[] = {
82         {
83                 I2C_BOARD_INFO("isl1208", 0x6f),
84         },
85 };
86
87 static struct i2c_board_info __initdata edb93xx_i2c_data[] = {
88         {
89                 I2C_BOARD_INFO("ds1337", 0x68),
90         },
91 };
92
93 static void __init edb93xx_register_i2c(void)
94 {
95         if (machine_is_edb9302a() || machine_is_edb9307a() ||
96             machine_is_edb9315a()) {
97                 ep93xx_register_i2c(edb93xxa_i2c_data,
98                                 ARRAY_SIZE(edb93xxa_i2c_data));
99         } else if (machine_is_edb9307() || machine_is_edb9312() ||
100                    machine_is_edb9315()) {
101                 ep93xx_register_i2c(edb93xx_i2c_data,
102                                 ARRAY_SIZE(edb93xx_i2c_data));
103         }
104 }
105
106 static void __init edb93xx_init_machine(void)
107 {
108         ep93xx_init_devices();
109         edb93xx_register_flash();
110         ep93xx_register_eth(&edb93xx_eth_data, 1);
111         edb93xx_register_i2c();
112 }
113
114
115 #ifdef CONFIG_MACH_EDB9301
116 MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
117         /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
118         .phys_io        = EP93XX_APB_PHYS_BASE,
119         .io_pg_offst    = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
120         .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
121         .map_io         = ep93xx_map_io,
122         .init_irq       = ep93xx_init_irq,
123         .timer          = &ep93xx_timer,
124         .init_machine   = edb93xx_init_machine,
125 MACHINE_END
126 #endif
127
128 #ifdef CONFIG_MACH_EDB9302
129 MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
130         /* Maintainer: George Kashperko <george@chas.com.ua> */
131         .phys_io        = EP93XX_APB_PHYS_BASE,
132         .io_pg_offst    = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
133         .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
134         .map_io         = ep93xx_map_io,
135         .init_irq       = ep93xx_init_irq,
136         .timer          = &ep93xx_timer,
137         .init_machine   = edb93xx_init_machine,
138 MACHINE_END
139 #endif
140
141 #ifdef CONFIG_MACH_EDB9302A
142 MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
143         /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
144         .phys_io        = EP93XX_APB_PHYS_BASE,
145         .io_pg_offst    = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
146         .boot_params    = EP93XX_SDCE0_PHYS_BASE + 0x100,
147         .map_io         = ep93xx_map_io,
148         .init_irq       = ep93xx_init_irq,
149         .timer          = &ep93xx_timer,
150         .init_machine   = edb93xx_init_machine,
151 MACHINE_END
152 #endif
153
154 #ifdef CONFIG_MACH_EDB9307
155 MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
156         /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
157         .phys_io        = EP93XX_APB_PHYS_BASE,
158         .io_pg_offst    = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
159         .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
160         .map_io         = ep93xx_map_io,
161         .init_irq       = ep93xx_init_irq,
162         .timer          = &ep93xx_timer,
163         .init_machine   = edb93xx_init_machine,
164 MACHINE_END
165 #endif
166
167 #ifdef CONFIG_MACH_EDB9307A
168 MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
169         /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
170         .phys_io        = EP93XX_APB_PHYS_BASE,
171         .io_pg_offst    = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
172         .boot_params    = EP93XX_SDCE0_PHYS_BASE + 0x100,
173         .map_io         = ep93xx_map_io,
174         .init_irq       = ep93xx_init_irq,
175         .timer          = &ep93xx_timer,
176         .init_machine   = edb93xx_init_machine,
177 MACHINE_END
178 #endif
179
180 #ifdef CONFIG_MACH_EDB9312
181 MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
182         /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
183         .phys_io        = EP93XX_APB_PHYS_BASE,
184         .io_pg_offst    = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
185         .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
186         .map_io         = ep93xx_map_io,
187         .init_irq       = ep93xx_init_irq,
188         .timer          = &ep93xx_timer,
189         .init_machine   = edb93xx_init_machine,
190 MACHINE_END
191 #endif
192
193 #ifdef CONFIG_MACH_EDB9315
194 MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
195         /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
196         .phys_io        = EP93XX_APB_PHYS_BASE,
197         .io_pg_offst    = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
198         .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
199         .map_io         = ep93xx_map_io,
200         .init_irq       = ep93xx_init_irq,
201         .timer          = &ep93xx_timer,
202         .init_machine   = edb93xx_init_machine,
203 MACHINE_END
204 #endif
205
206 #ifdef CONFIG_MACH_EDB9315A
207 MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
208         /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
209         .phys_io        = EP93XX_APB_PHYS_BASE,
210         .io_pg_offst    = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
211         .boot_params    = EP93XX_SDCE0_PHYS_BASE + 0x100,
212         .map_io         = ep93xx_map_io,
213         .init_irq       = ep93xx_init_irq,
214         .timer          = &ep93xx_timer,
215         .init_machine   = edb93xx_init_machine,
216 MACHINE_END
217 #endif