ARM: 6168/1: ep93xx: move physmap flash registration into core.c
[platform/adaptation/renesas_rcar/renesas_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         .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,
134 MACHINE_END
135 #endif
136
137 #ifdef CONFIG_MACH_EDB9302
138 MACHINE_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,
147 MACHINE_END
148 #endif
149
150 #ifdef CONFIG_MACH_EDB9302A
151 MACHINE_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,
160 MACHINE_END
161 #endif
162
163 #ifdef CONFIG_MACH_EDB9307
164 MACHINE_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,
173 MACHINE_END
174 #endif
175
176 #ifdef CONFIG_MACH_EDB9307A
177 MACHINE_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,
186 MACHINE_END
187 #endif
188
189 #ifdef CONFIG_MACH_EDB9312
190 MACHINE_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,
199 MACHINE_END
200 #endif
201
202 #ifdef CONFIG_MACH_EDB9315
203 MACHINE_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,
212 MACHINE_END
213 #endif
214
215 #ifdef CONFIG_MACH_EDB9315A
216 MACHINE_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,
225 MACHINE_END
226 #endif