Pull cpuidle into release branch
[pandora-kernel.git] / arch / blackfin / mach-bf533 / boards / cm_bf533.c
1 /*
2  * File:         arch/blackfin/mach-bf533/boards/cm_bf533.c
3  * Based on:     arch/blackfin/mach-bf533/boards/ezkit.c
4  * Author:       Aidan Williams <aidan@nicta.com.au> Copyright 2005
5  *
6  * Created:      2005
7  * Description:  Board description file
8  *
9  * Modified:
10  *               Copyright 2004-2006 Analog Devices Inc.
11  *
12  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
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 as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, see the file COPYING, or write
26  * to the Free Software Foundation, Inc.,
27  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
28  */
29
30 #include <linux/device.h>
31 #include <linux/platform_device.h>
32 #include <linux/mtd/mtd.h>
33 #include <linux/mtd/partitions.h>
34 #include <linux/spi/spi.h>
35 #include <linux/spi/flash.h>
36 #include <linux/usb_isp1362.h>
37 #include <linux/pata_platform.h>
38 #include <linux/irq.h>
39 #include <asm/dma.h>
40 #include <asm/bfin5xx_spi.h>
41
42 /*
43  * Name the Board for the /proc/cpuinfo
44  */
45 const char bfin_board_name[] = "Bluetechnix CM BF533";
46
47 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
48 /* all SPI peripherals info goes here */
49
50 static struct mtd_partition bfin_spi_flash_partitions[] = {
51         {
52                 .name = "bootloader",
53                 .size = 0x00020000,
54                 .offset = 0,
55                 .mask_flags = MTD_CAP_ROM
56         }, {
57                 .name = "kernel",
58                 .size = 0xe0000,
59                 .offset = 0x20000
60         }, {
61                 .name = "file system",
62                 .size = 0x700000,
63                 .offset = 0x00100000,
64         }
65 };
66
67 static struct flash_platform_data bfin_spi_flash_data = {
68         .name = "m25p80",
69         .parts = bfin_spi_flash_partitions,
70         .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
71         .type = "m25p64",
72 };
73
74 /* SPI flash chip (m25p64) */
75 static struct bfin5xx_spi_chip spi_flash_chip_info = {
76         .enable_dma = 0,         /* use dma transfer with this chip*/
77         .bits_per_word = 8,
78 };
79
80 /* SPI ADC chip */
81 static struct bfin5xx_spi_chip spi_adc_chip_info = {
82         .enable_dma = 1,         /* use dma transfer with this chip*/
83         .bits_per_word = 16,
84 };
85
86 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
87 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
88         .enable_dma = 0,
89         .bits_per_word = 16,
90 };
91 #endif
92
93 static struct spi_board_info bfin_spi_board_info[] __initdata = {
94         {
95                 /* the modalias must be the same as spi device driver name */
96                 .modalias = "m25p80",       /* Name of spi_driver for this device */
97                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
98                 .bus_num = 0,               /* Framework bus number */
99                 .chip_select = 1,           /* Framework chip select. On STAMP537 it is SPISSEL1*/
100                 .platform_data = &bfin_spi_flash_data,
101                 .controller_data = &spi_flash_chip_info,
102                 .mode = SPI_MODE_3,
103         }, {
104                 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
105                 .max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
106                 .bus_num = 0,               /* Framework bus number */
107                 .chip_select = 2,           /* Framework chip select. */
108                 .platform_data = NULL,      /* No spi_driver specific config */
109                 .controller_data = &spi_adc_chip_info,
110         },
111 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
112         {
113                 .modalias = "ad1836-spi",
114                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
115                 .bus_num = 0,
116                 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
117                 .controller_data = &ad1836_spi_chip_info,
118         },
119 #endif
120 };
121
122 /* SPI (0) */
123 static struct resource bfin_spi0_resource[] = {
124         [0] = {
125                 .start = SPI0_REGBASE,
126                 .end   = SPI0_REGBASE + 0xFF,
127                 .flags = IORESOURCE_MEM,
128         },
129         [1] = {
130                 .start = CH_SPI,
131                 .end   = CH_SPI,
132                 .flags = IORESOURCE_IRQ,
133         }
134 };
135
136 /* SPI controller data */
137 static struct bfin5xx_spi_master bfin_spi0_info = {
138         .num_chipselect = 8,
139         .enable_dma = 1,  /* master has the ability to do dma transfer */
140 };
141
142 static struct platform_device bfin_spi0_device = {
143         .name = "bfin-spi",
144         .id = 0, /* Bus number */
145         .num_resources = ARRAY_SIZE(bfin_spi0_resource),
146         .resource = bfin_spi0_resource,
147         .dev = {
148                 .platform_data = &bfin_spi0_info, /* Passed to driver */
149         },
150 };
151 #endif  /* spi master and devices */
152
153 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
154 static struct platform_device rtc_device = {
155         .name = "rtc-bfin",
156         .id   = -1,
157 };
158 #endif
159
160 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
161 static struct resource smc91x_resources[] = {
162         {
163                 .start = 0x20200300,
164                 .end = 0x20200300 + 16,
165                 .flags = IORESOURCE_MEM,
166         }, {
167                 .start = IRQ_PF0,
168                 .end = IRQ_PF0,
169                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
170         },
171 };
172 static struct platform_device smc91x_device = {
173         .name = "smc91x",
174         .id = 0,
175         .num_resources = ARRAY_SIZE(smc91x_resources),
176         .resource = smc91x_resources,
177 };
178 #endif
179
180 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
181 static struct resource bfin_uart_resources[] = {
182         {
183                 .start = 0xFFC00400,
184                 .end = 0xFFC004FF,
185                 .flags = IORESOURCE_MEM,
186         },
187 };
188
189 static struct platform_device bfin_uart_device = {
190         .name = "bfin-uart",
191         .id = 1,
192         .num_resources = ARRAY_SIZE(bfin_uart_resources),
193         .resource = bfin_uart_resources,
194 };
195 #endif
196
197 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
198 static struct platform_device bfin_sport0_uart_device = {
199         .name = "bfin-sport-uart",
200         .id = 0,
201 };
202
203 static struct platform_device bfin_sport1_uart_device = {
204         .name = "bfin-sport-uart",
205         .id = 1,
206 };
207 #endif
208
209 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
210 static struct resource isp1362_hcd_resources[] = {
211         {
212                 .start = 0x20308000,
213                 .end = 0x20308000,
214                 .flags = IORESOURCE_MEM,
215         }, {
216                 .start = 0x20308004,
217                 .end = 0x20308004,
218                 .flags = IORESOURCE_MEM,
219         }, {
220                 .start = IRQ_PF4,
221                 .end = IRQ_PF4,
222                 .flags = IORESOURCE_IRQ,
223         },
224 };
225
226 static struct isp1362_platform_data isp1362_priv = {
227         .sel15Kres = 1,
228         .clknotstop = 0,
229         .oc_enable = 0,
230         .int_act_high = 0,
231         .int_edge_triggered = 0,
232         .remote_wakeup_connected = 0,
233         .no_power_switching = 1,
234         .power_switching_mode = 0,
235 };
236
237 static struct platform_device isp1362_hcd_device = {
238         .name = "isp1362-hcd",
239         .id = 0,
240         .dev = {
241                 .platform_data = &isp1362_priv,
242         },
243         .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
244         .resource = isp1362_hcd_resources,
245 };
246 #endif
247
248 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
249 #define PATA_INT        38
250
251 static struct pata_platform_info bfin_pata_platform_data = {
252         .ioport_shift = 2,
253         .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
254 };
255
256 static struct resource bfin_pata_resources[] = {
257         {
258                 .start = 0x2030C000,
259                 .end = 0x2030C01F,
260                 .flags = IORESOURCE_MEM,
261         },
262         {
263                 .start = 0x2030D018,
264                 .end = 0x2030D01B,
265                 .flags = IORESOURCE_MEM,
266         },
267         {
268                 .start = PATA_INT,
269                 .end = PATA_INT,
270                 .flags = IORESOURCE_IRQ,
271         },
272 };
273
274 static struct platform_device bfin_pata_device = {
275         .name = "pata_platform",
276         .id = -1,
277         .num_resources = ARRAY_SIZE(bfin_pata_resources),
278         .resource = bfin_pata_resources,
279         .dev = {
280                 .platform_data = &bfin_pata_platform_data,
281         }
282 };
283 #endif
284
285 static struct platform_device *cm_bf533_devices[] __initdata = {
286 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
287         &bfin_uart_device,
288 #endif
289
290 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
291         &bfin_sport0_uart_device,
292         &bfin_sport1_uart_device,
293 #endif
294
295 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
296         &rtc_device,
297 #endif
298
299 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
300         &isp1362_hcd_device,
301 #endif
302
303 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
304         &smc91x_device,
305 #endif
306
307 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
308         &bfin_spi0_device,
309 #endif
310
311 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
312         &bfin_pata_device,
313 #endif
314 };
315
316 static int __init cm_bf533_init(void)
317 {
318         printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
319         platform_add_devices(cm_bf533_devices, ARRAY_SIZE(cm_bf533_devices));
320 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
321         spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
322 #endif
323
324 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
325         irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
326 #endif
327         return 0;
328 }
329
330 arch_initcall(cm_bf533_init);