blob: c2ce9034ba87f5b856cb6e1cae89fb69060b8ffe [file] [log] [blame]
Hartley Sweetena2bd40d2009-05-04 19:09:25 +01001/*
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>
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010029#include <linux/platform_device.h>
Hartley Sweeten6531a992009-10-08 00:45:00 +010030#include <linux/gpio.h>
31#include <linux/i2c.h>
32#include <linux/i2c-gpio.h>
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010033
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010034#include <mach/hardware.h>
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010035
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010036#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
38
Hartley Sweeten583ddaf2009-07-06 17:39:50 +010039
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010040static void __init edb93xx_register_flash(void)
41{
42 if (machine_is_edb9307() || machine_is_edb9312() ||
43 machine_is_edb9315()) {
Hartley Sweeten16bcf782010-06-10 16:19:08 +010044 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010045 } else {
Hartley Sweeten16bcf782010-06-10 16:19:08 +010046 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010047 }
48}
49
Hartley Sweetenb370e082010-03-18 18:04:06 +010050static struct ep93xx_eth_data __initdata edb93xx_eth_data = {
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010051 .phy_id = 1,
52};
53
Hartley Sweeten6531a992009-10-08 00:45:00 +010054
55/*************************************************************************
56 * EDB93xx i2c peripheral handling
57 *************************************************************************/
Hartley Sweetenb370e082010-03-18 18:04:06 +010058static struct i2c_gpio_platform_data __initdata edb93xx_i2c_gpio_data = {
Hartley Sweeten6531a992009-10-08 00:45:00 +010059 .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
67static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010068 {
69 I2C_BOARD_INFO("isl1208", 0x6f),
70 },
71};
72
Hartley Sweeten6531a992009-10-08 00:45:00 +010073static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = {
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010074 {
75 I2C_BOARD_INFO("ds1337", 0x68),
76 },
77};
78
79static void __init edb93xx_register_i2c(void)
80{
81 if (machine_is_edb9302a() || machine_is_edb9307a() ||
82 machine_is_edb9315a()) {
Hartley Sweeten6531a992009-10-08 00:45:00 +010083 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
84 edb93xxa_i2c_board_info,
85 ARRAY_SIZE(edb93xxa_i2c_board_info));
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010086 } else if (machine_is_edb9307() || machine_is_edb9312() ||
87 machine_is_edb9315()) {
Hartley Sweeten3d977c02009-10-14 01:56:10 +010088 ep93xx_register_i2c(&edb93xx_i2c_gpio_data,
Hartley Sweeten6531a992009-10-08 00:45:00 +010089 edb93xx_i2c_board_info,
90 ARRAY_SIZE(edb93xx_i2c_board_info));
Hartley Sweetena2bd40d2009-05-04 19:09:25 +010091 }
92}
93
Hartley Sweeten1fbd9722010-01-11 21:38:00 +010094
95/*************************************************************************
96 * EDB93xx pwm
97 *************************************************************************/
98static 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
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100114static 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();
Hartley Sweeten1fbd9722010-01-11 21:38:00 +0100120 edb93xx_register_pwm();
Hartley Sweetena2bd40d2009-05-04 19:09:25 +0100121}
122
123
124#ifdef CONFIG_MACH_EDB9301
125MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
126 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
127 .phys_io = EP93XX_APB_PHYS_BASE,
128 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
129 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
130 .map_io = ep93xx_map_io,
131 .init_irq = ep93xx_init_irq,
132 .timer = &ep93xx_timer,
133 .init_machine = edb93xx_init_machine,
134MACHINE_END
135#endif
136
137#ifdef CONFIG_MACH_EDB9302
138MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
139 /* Maintainer: George Kashperko <george@chas.com.ua> */
140 .phys_io = EP93XX_APB_PHYS_BASE,
141 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
142 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
143 .map_io = ep93xx_map_io,
144 .init_irq = ep93xx_init_irq,
145 .timer = &ep93xx_timer,
146 .init_machine = edb93xx_init_machine,
147MACHINE_END
148#endif
149
150#ifdef CONFIG_MACH_EDB9302A
151MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
152 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
153 .phys_io = EP93XX_APB_PHYS_BASE,
154 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
155 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
156 .map_io = ep93xx_map_io,
157 .init_irq = ep93xx_init_irq,
158 .timer = &ep93xx_timer,
159 .init_machine = edb93xx_init_machine,
160MACHINE_END
161#endif
162
163#ifdef CONFIG_MACH_EDB9307
164MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
165 /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
166 .phys_io = EP93XX_APB_PHYS_BASE,
167 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
168 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
169 .map_io = ep93xx_map_io,
170 .init_irq = ep93xx_init_irq,
171 .timer = &ep93xx_timer,
172 .init_machine = edb93xx_init_machine,
173MACHINE_END
174#endif
175
176#ifdef CONFIG_MACH_EDB9307A
177MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
178 /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
179 .phys_io = EP93XX_APB_PHYS_BASE,
180 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
181 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
182 .map_io = ep93xx_map_io,
183 .init_irq = ep93xx_init_irq,
184 .timer = &ep93xx_timer,
185 .init_machine = edb93xx_init_machine,
186MACHINE_END
187#endif
188
189#ifdef CONFIG_MACH_EDB9312
190MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
191 /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
192 .phys_io = EP93XX_APB_PHYS_BASE,
193 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
194 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
195 .map_io = ep93xx_map_io,
196 .init_irq = ep93xx_init_irq,
197 .timer = &ep93xx_timer,
198 .init_machine = edb93xx_init_machine,
199MACHINE_END
200#endif
201
202#ifdef CONFIG_MACH_EDB9315
203MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
204 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
205 .phys_io = EP93XX_APB_PHYS_BASE,
206 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
207 .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
208 .map_io = ep93xx_map_io,
209 .init_irq = ep93xx_init_irq,
210 .timer = &ep93xx_timer,
211 .init_machine = edb93xx_init_machine,
212MACHINE_END
213#endif
214
215#ifdef CONFIG_MACH_EDB9315A
216MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
217 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
218 .phys_io = EP93XX_APB_PHYS_BASE,
219 .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
220 .boot_params = EP93XX_SDCE0_PHYS_BASE + 0x100,
221 .map_io = ep93xx_map_io,
222 .init_irq = ep93xx_init_irq,
223 .timer = &ep93xx_timer,
224 .init_machine = edb93xx_init_machine,
225MACHINE_END
226#endif