Pull cpuidle into release branch
[linux-2.6] / arch / blackfin / mach-bf561 / boards / cm_bf561.c
1 /*
2  * File:         arch/blackfin/mach-bf533/boards/cm_bf561.c
3  * Based on:     arch/blackfin/mach-bf533/boards/ezkit.c
4  * Author:       Aidan Williams <aidan@nicta.com.au> Copyright 2005
5  *
6  * Created:      2006
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 BF561";
46
47 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
48 /* all SPI peripherals info goes here */
49
50 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
51 static struct mtd_partition bfin_spi_flash_partitions[] = {
52         {
53                 .name = "bootloader",
54                 .size = 0x00020000,
55                 .offset = 0,
56                 .mask_flags = MTD_CAP_ROM
57         }, {
58                 .name = "kernel",
59                 .size = 0xe0000,
60                 .offset = 0x20000
61         }, {
62                 .name = "file system",
63                 .size = 0x700000,
64                 .offset = 0x00100000,
65         }
66 };
67
68 static struct flash_platform_data bfin_spi_flash_data = {
69         .name = "m25p80",
70         .parts = bfin_spi_flash_partitions,
71         .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
72         .type = "m25p64",
73 };
74
75 /* SPI flash chip (m25p64) */
76 static struct bfin5xx_spi_chip spi_flash_chip_info = {
77         .enable_dma = 0,         /* use dma transfer with this chip*/
78         .bits_per_word = 8,
79 };
80 #endif
81
82 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
83 /* SPI ADC chip */
84 static struct bfin5xx_spi_chip spi_adc_chip_info = {
85         .enable_dma = 1,         /* use dma transfer with this chip*/
86         .bits_per_word = 16,
87 };
88 #endif
89
90 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
91 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
92         .enable_dma = 0,
93         .bits_per_word = 16,
94 };
95 #endif
96
97 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
98 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
99         .enable_dma = 0,
100         .bits_per_word = 16,
101 };
102 #endif
103
104 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
105 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
106         .enable_dma = 1,
107         .bits_per_word = 8,
108 };
109 #endif
110
111 static struct spi_board_info bfin_spi_board_info[] __initdata = {
112 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
113         {
114                 /* the modalias must be the same as spi device driver name */
115                 .modalias = "m25p80", /* Name of spi_driver for this device */
116                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
117                 .bus_num = 0, /* Framework bus number */
118                 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
119                 .platform_data = &bfin_spi_flash_data,
120                 .controller_data = &spi_flash_chip_info,
121                 .mode = SPI_MODE_3,
122         },
123 #endif
124
125 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
126         {
127                 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
128                 .max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
129                 .bus_num = 0, /* Framework bus number */
130                 .chip_select = 1, /* Framework chip select. */
131                 .platform_data = NULL, /* No spi_driver specific config */
132                 .controller_data = &spi_adc_chip_info,
133         },
134 #endif
135
136 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
137         {
138                 .modalias = "ad1836-spi",
139                 .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
140                 .bus_num = 0,
141                 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
142                 .controller_data = &ad1836_spi_chip_info,
143         },
144 #endif
145 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
146         {
147                 .modalias = "ad9960-spi",
148                 .max_speed_hz = 10000000,     /* max spi clock (SCK) speed in HZ */
149                 .bus_num = 0,
150                 .chip_select = 1,
151                 .controller_data = &ad9960_spi_chip_info,
152         },
153 #endif
154 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
155         {
156                 .modalias = "spi_mmc",
157                 .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
158                 .bus_num = 0,
159                 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
160                 .platform_data = NULL,
161                 .controller_data = &spi_mmc_chip_info,
162                 .mode = SPI_MODE_3,
163         },
164 #endif
165 };
166
167 /* SPI (0) */
168 static struct resource bfin_spi0_resource[] = {
169         [0] = {
170                 .start = SPI0_REGBASE,
171                 .end   = SPI0_REGBASE + 0xFF,
172                 .flags = IORESOURCE_MEM,
173         },
174         [1] = {
175                 .start = CH_SPI,
176                 .end   = CH_SPI,
177                 .flags = IORESOURCE_IRQ,
178         }
179 };
180
181 /* SPI controller data */
182 static struct bfin5xx_spi_master bfin_spi0_info = {
183         .num_chipselect = 8,
184         .enable_dma = 1,  /* master has the ability to do dma transfer */
185 };
186
187 static struct platform_device bfin_spi0_device = {
188         .name = "bfin-spi",
189         .id = 0, /* Bus number */
190         .num_resources = ARRAY_SIZE(bfin_spi0_resource),
191         .resource = bfin_spi0_resource,
192         .dev = {
193                 .platform_data = &bfin_spi0_info, /* Passed to driver */
194         },
195 };
196 #endif  /* spi master and devices */
197
198
199 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
200
201 static struct resource smc91x_resources[] = {
202         {
203                 .name = "smc91x-regs",
204                 .start = 0x28000300,
205                 .end = 0x28000300 + 16,
206                 .flags = IORESOURCE_MEM,
207         }, {
208                 .start = IRQ_PF0,
209                 .end = IRQ_PF0,
210                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
211         },
212 };
213 static struct platform_device smc91x_device = {
214         .name = "smc91x",
215         .id = 0,
216         .num_resources = ARRAY_SIZE(smc91x_resources),
217         .resource = smc91x_resources,
218 };
219 #endif
220
221 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
222 static struct resource isp1362_hcd_resources[] = {
223         {
224                 .start = 0x24008000,
225                 .end = 0x24008000,
226                 .flags = IORESOURCE_MEM,
227         }, {
228                 .start = 0x24008004,
229                 .end = 0x24008004,
230                 .flags = IORESOURCE_MEM,
231         }, {
232                 .start = IRQ_PF47,
233                 .end = IRQ_PF47,
234                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
235         },
236 };
237
238 static struct isp1362_platform_data isp1362_priv = {
239         .sel15Kres = 1,
240         .clknotstop = 0,
241         .oc_enable = 0,
242         .int_act_high = 0,
243         .int_edge_triggered = 0,
244         .remote_wakeup_connected = 0,
245         .no_power_switching = 1,
246         .power_switching_mode = 0,
247 };
248
249 static struct platform_device isp1362_hcd_device = {
250         .name = "isp1362-hcd",
251         .id = 0,
252         .dev = {
253                 .platform_data = &isp1362_priv,
254         },
255         .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
256         .resource = isp1362_hcd_resources,
257 };
258 #endif
259
260 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
261 static struct resource bfin_uart_resources[] = {
262         {
263                 .start = 0xFFC00400,
264                 .end = 0xFFC004FF,
265                 .flags = IORESOURCE_MEM,
266         },
267 };
268
269 static struct platform_device bfin_uart_device = {
270         .name = "bfin-uart",
271         .id = 1,
272         .num_resources = ARRAY_SIZE(bfin_uart_resources),
273         .resource = bfin_uart_resources,
274 };
275 #endif
276
277 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
278 #define PATA_INT        119
279
280 static struct pata_platform_info bfin_pata_platform_data = {
281         .ioport_shift = 2,
282         .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
283 };
284
285 static struct resource bfin_pata_resources[] = {
286         {
287                 .start = 0x2400C000,
288                 .end = 0x2400C001F,
289                 .flags = IORESOURCE_MEM,
290         },
291         {
292                 .start = 0x2400D018,
293                 .end = 0x2400D01B,
294                 .flags = IORESOURCE_MEM,
295         },
296         {
297                 .start = PATA_INT,
298                 .end = PATA_INT,
299                 .flags = IORESOURCE_IRQ,
300         },
301 };
302
303 static struct platform_device bfin_pata_device = {
304         .name = "pata_platform",
305         .id = -1,
306         .num_resources = ARRAY_SIZE(bfin_pata_resources),
307         .resource = bfin_pata_resources,
308         .dev = {
309                 .platform_data = &bfin_pata_platform_data,
310         }
311 };
312 #endif
313
314 static struct platform_device *cm_bf561_devices[] __initdata = {
315
316 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
317         &bfin_uart_device,
318 #endif
319
320 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
321         &isp1362_hcd_device,
322 #endif
323
324 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
325         &smc91x_device,
326 #endif
327
328 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
329         &bfin_spi0_device,
330 #endif
331
332 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
333         &bfin_pata_device,
334 #endif
335 };
336
337 static int __init cm_bf561_init(void)
338 {
339         printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
340         platform_add_devices(cm_bf561_devices, ARRAY_SIZE(cm_bf561_devices));
341 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
342         spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
343 #endif
344
345 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
346         irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
347 #endif
348         return 0;
349 }
350
351 arch_initcall(cm_bf561_init);