Merge branch 'idle-release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb...
[pandora-kernel.git] / 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/platform_device.h>
30 #include <linux/gpio.h>
31 #include <linux/i2c.h>
32 #include <linux/i2c-gpio.h>
33
34 #include <mach/hardware.h>
35
36 #include <asm/mach-types.h>
37 #include <asm/mach/arch.h>
38
39
40 static void __init edb93xx_register_flash(void)
41 {
42         if (machine_is_edb9307() || machine_is_edb9312() ||
43             machine_is_edb9315()) {
44                 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
45         } else {
46                 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
47         }
48 }
49
50 static struct ep93xx_eth_data __initdata edb93xx_eth_data = {
51         .phy_id         = 1,
52 };
53
54
55 /*************************************************************************
56  * EDB93xx i2c peripheral handling
57  *************************************************************************/
58 static struct i2c_gpio_platform_data __initdata edb93xx_i2c_gpio_data = {
59         .sda_pin                = EP93XX_GPIO_LINE_EEDAT,
60         .sda_is_open_drain      = 0,
61         .scl_pin                = EP93XX_GPIO_LINE_EECLK,
62         .scl_is_open_drain      = 0,
63         .udelay                 = 0,    /* default to 100 kHz */
64         .timeout                = 0,    /* default to 100 ms */
65 };
66
67 static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
68         {
69                 I2C_BOARD_INFO("isl1208", 0x6f),
70         },
71 };
72
73 static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = {
74         {
75                 I2C_BOARD_INFO("ds1337", 0x68),
76         },
77 };
78
79 static void __init edb93xx_register_i2c(void)
80 {
81         if (machine_is_edb9302a() || machine_is_edb9307a() ||
82             machine_is_edb9315a()) {
83                 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
84                                     edb93xxa_i2c_board_info,
85                                     ARRAY_SIZE(edb93xxa_i2c_board_info));
86         } else if (machine_is_edb9307() || machine_is_edb9312() ||
87                    machine_is_edb9315()) {
88                 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
89                                     edb93xx_i2c_board_info,
90                                     ARRAY_SIZE(edb93xx_i2c_board_info));
91         }
92 }
93
94
95 /*************************************************************************
96  * EDB93xx pwm
97  *************************************************************************/
98 static void __init edb93xx_register_pwm(void)
99 {
100         if (machine_is_edb9301() ||
101             machine_is_edb9302() || machine_is_edb9302a()) {
102                 /* EP9301 and EP9302 only have pwm.1 (EGPIO14) */
103                 ep93xx_register_pwm(0, 1);
104         } else if (machine_is_edb9307() || machine_is_edb9307a()) {
105                 /* EP9307 only has pwm.0 (PWMOUT) */
106                 ep93xx_register_pwm(1, 0);
107         } else {
108                 /* EP9312 and EP9315 have both */
109                 ep93xx_register_pwm(1, 1);
110         }
111 }
112
113
114 static void __init edb93xx_init_machine(void)
115 {
116         ep93xx_init_devices();
117         edb93xx_register_flash();
118         ep93xx_register_eth(&edb93xx_eth_data, 1);
119         edb93xx_register_i2c();
120         edb93xx_register_pwm();
121 }
122
123
124 #ifdef CONFIG_MACH_EDB9301
125 MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
126         /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
127         .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
128         .map_io         = ep93xx_map_io,
129         .init_irq       = ep93xx_init_irq,
130         .timer          = &ep93xx_timer,
131         .init_machine   = edb93xx_init_machine,
132 MACHINE_END
133 #endif
134
135 #ifdef CONFIG_MACH_EDB9302
136 MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
137         /* Maintainer: George Kashperko <george@chas.com.ua> */
138         .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
139         .map_io         = ep93xx_map_io,
140         .init_irq       = ep93xx_init_irq,
141         .timer          = &ep93xx_timer,
142         .init_machine   = edb93xx_init_machine,
143 MACHINE_END
144 #endif
145
146 #ifdef CONFIG_MACH_EDB9302A
147 MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
148         /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
149         .boot_params    = EP93XX_SDCE0_PHYS_BASE + 0x100,
150         .map_io         = ep93xx_map_io,
151         .init_irq       = ep93xx_init_irq,
152         .timer          = &ep93xx_timer,
153         .init_machine   = edb93xx_init_machine,
154 MACHINE_END
155 #endif
156
157 #ifdef CONFIG_MACH_EDB9307
158 MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
159         /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
160         .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
161         .map_io         = ep93xx_map_io,
162         .init_irq       = ep93xx_init_irq,
163         .timer          = &ep93xx_timer,
164         .init_machine   = edb93xx_init_machine,
165 MACHINE_END
166 #endif
167
168 #ifdef CONFIG_MACH_EDB9307A
169 MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
170         /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
171         .boot_params    = EP93XX_SDCE0_PHYS_BASE + 0x100,
172         .map_io         = ep93xx_map_io,
173         .init_irq       = ep93xx_init_irq,
174         .timer          = &ep93xx_timer,
175         .init_machine   = edb93xx_init_machine,
176 MACHINE_END
177 #endif
178
179 #ifdef CONFIG_MACH_EDB9312
180 MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
181         /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
182         .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
183         .map_io         = ep93xx_map_io,
184         .init_irq       = ep93xx_init_irq,
185         .timer          = &ep93xx_timer,
186         .init_machine   = edb93xx_init_machine,
187 MACHINE_END
188 #endif
189
190 #ifdef CONFIG_MACH_EDB9315
191 MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
192         /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
193         .boot_params    = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
194         .map_io         = ep93xx_map_io,
195         .init_irq       = ep93xx_init_irq,
196         .timer          = &ep93xx_timer,
197         .init_machine   = edb93xx_init_machine,
198 MACHINE_END
199 #endif
200
201 #ifdef CONFIG_MACH_EDB9315A
202 MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
203         /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
204         .boot_params    = EP93XX_SDCE0_PHYS_BASE + 0x100,
205         .map_io         = ep93xx_map_io,
206         .init_irq       = ep93xx_init_irq,
207         .timer          = &ep93xx_timer,
208         .init_machine   = edb93xx_init_machine,
209 MACHINE_END
210 #endif