blob: d8a23cd9b9ed9f860ae22ccfba85ff1d2c4b175f [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
2 * File: arch/blackfin/mach-bf537/boards/cm_bf537.c
3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created: 2005
7 * Description: Board description file
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/device.h>
Mike Frysinger43f73fe2007-12-24 19:35:35 +080032#include <linux/etherdevice.h>
Bryan Wu1394f032007-05-06 14:50:22 -070033#include <linux/platform_device.h>
34#include <linux/mtd/mtd.h>
35#include <linux/mtd/partitions.h>
36#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
Mike Frysingerf02bcec2007-11-15 21:29:15 +080038#include <linux/usb/isp1362.h>
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050039#include <linux/ata_platform.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080040#include <linux/irq.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080041#include <asm/dma.h>
Bryan Wu1394f032007-05-06 14:50:22 -070042#include <asm/bfin5xx_spi.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080043#include <asm/portmux.h>
Bryan Wu1394f032007-05-06 14:50:22 -070044
45/*
46 * Name the Board for the /proc/cpuinfo
47 */
Mike Frysinger066954a2007-10-21 22:36:06 +080048const char bfin_board_name[] = "Bluetechnix CM BF537";
Bryan Wu1394f032007-05-06 14:50:22 -070049
50#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
51/* all SPI peripherals info goes here */
52
53#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
54static struct mtd_partition bfin_spi_flash_partitions[] = {
55 {
56 .name = "bootloader",
57 .size = 0x00020000,
58 .offset = 0,
59 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080060 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070061 .name = "kernel",
62 .size = 0xe0000,
63 .offset = 0x20000
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080064 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070065 .name = "file system",
66 .size = 0x700000,
67 .offset = 0x00100000,
68 }
69};
70
71static struct flash_platform_data bfin_spi_flash_data = {
72 .name = "m25p80",
73 .parts = bfin_spi_flash_partitions,
74 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
75 .type = "m25p64",
76};
77
78/* SPI flash chip (m25p64) */
79static struct bfin5xx_spi_chip spi_flash_chip_info = {
80 .enable_dma = 0, /* use dma transfer with this chip*/
81 .bits_per_word = 8,
82};
83#endif
84
85#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
86/* SPI ADC chip */
87static struct bfin5xx_spi_chip spi_adc_chip_info = {
88 .enable_dma = 1, /* use dma transfer with this chip*/
89 .bits_per_word = 16,
90};
91#endif
92
93#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
94static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
95 .enable_dma = 0,
96 .bits_per_word = 16,
97};
98#endif
99
100#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
101static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
102 .enable_dma = 0,
103 .bits_per_word = 16,
104};
105#endif
106
107#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
108static struct bfin5xx_spi_chip spi_mmc_chip_info = {
109 .enable_dma = 1,
110 .bits_per_word = 8,
111};
112#endif
113
114static struct spi_board_info bfin_spi_board_info[] __initdata = {
115#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
116 {
117 /* the modalias must be the same as spi device driver name */
118 .modalias = "m25p80", /* Name of spi_driver for this device */
119 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800120 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700121 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
122 .platform_data = &bfin_spi_flash_data,
123 .controller_data = &spi_flash_chip_info,
124 .mode = SPI_MODE_3,
125 },
126#endif
127
128#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
129 {
130 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
131 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800132 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700133 .chip_select = 1, /* Framework chip select. */
134 .platform_data = NULL, /* No spi_driver specific config */
135 .controller_data = &spi_adc_chip_info,
136 },
137#endif
138
139#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
140 {
141 .modalias = "ad1836-spi",
142 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800143 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700144 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
145 .controller_data = &ad1836_spi_chip_info,
146 },
147#endif
148
149#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
150 {
151 .modalias = "ad9960-spi",
152 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800153 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700154 .chip_select = 1,
155 .controller_data = &ad9960_spi_chip_info,
156 },
157#endif
158
159#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
160 {
161 .modalias = "spi_mmc_dummy",
162 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800163 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700164 .chip_select = 7,
165 .platform_data = NULL,
166 .controller_data = &spi_mmc_chip_info,
167 .mode = SPI_MODE_3,
168 },
169 {
170 .modalias = "spi_mmc",
171 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800172 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700173 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
174 .platform_data = NULL,
175 .controller_data = &spi_mmc_chip_info,
176 .mode = SPI_MODE_3,
177 },
178#endif
179};
180
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800181/* SPI (0) */
182static struct resource bfin_spi0_resource[] = {
183 [0] = {
184 .start = SPI0_REGBASE,
185 .end = SPI0_REGBASE + 0xFF,
186 .flags = IORESOURCE_MEM,
187 },
188 [1] = {
189 .start = CH_SPI,
190 .end = CH_SPI,
191 .flags = IORESOURCE_IRQ,
192 }
193};
194
Bryan Wu1394f032007-05-06 14:50:22 -0700195/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800196static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700197 .num_chipselect = 8,
198 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800199 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700200};
201
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800202static struct platform_device bfin_spi0_device = {
203 .name = "bfin-spi",
204 .id = 0, /* Bus number */
205 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
206 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700207 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800208 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700209 },
210};
211#endif /* spi master and devices */
212
213#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
214static struct platform_device rtc_device = {
215 .name = "rtc-bfin",
216 .id = -1,
217};
218#endif
219
Michael Hennerich0d4a89b2008-01-27 19:58:46 +0800220#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
221static struct platform_device hitachi_fb_device = {
222 .name = "hitachi-tx09",
223};
224#endif
225
Bryan Wu1394f032007-05-06 14:50:22 -0700226#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
227static struct resource smc91x_resources[] = {
228 {
229 .start = 0x20200300,
230 .end = 0x20200300 + 16,
231 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800232 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700233 .start = IRQ_PF14,
234 .end = IRQ_PF14,
235 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
236 },
237};
238
239static struct platform_device smc91x_device = {
240 .name = "smc91x",
241 .id = 0,
242 .num_resources = ARRAY_SIZE(smc91x_resources),
243 .resource = smc91x_resources,
244};
245#endif
246
247#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
248static struct resource isp1362_hcd_resources[] = {
249 {
250 .start = 0x20308000,
251 .end = 0x20308000,
252 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800253 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700254 .start = 0x20308004,
255 .end = 0x20308004,
256 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800257 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700258 .start = IRQ_PG15,
259 .end = IRQ_PG15,
260 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
261 },
262};
263
264static struct isp1362_platform_data isp1362_priv = {
265 .sel15Kres = 1,
266 .clknotstop = 0,
267 .oc_enable = 0,
268 .int_act_high = 0,
269 .int_edge_triggered = 0,
270 .remote_wakeup_connected = 0,
271 .no_power_switching = 1,
272 .power_switching_mode = 0,
273};
274
275static struct platform_device isp1362_hcd_device = {
276 .name = "isp1362-hcd",
277 .id = 0,
278 .dev = {
279 .platform_data = &isp1362_priv,
280 },
281 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
282 .resource = isp1362_hcd_resources,
283};
284#endif
285
286#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
287static struct resource net2272_bfin_resources[] = {
288 {
289 .start = 0x20200000,
290 .end = 0x20200000 + 0x100,
291 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800292 }, {
Michael Hennerich8ecc7362007-10-29 17:24:23 +0800293 .start = IRQ_PH14,
294 .end = IRQ_PH14,
Bryan Wu1394f032007-05-06 14:50:22 -0700295 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
296 },
297};
298
299static struct platform_device net2272_bfin_device = {
300 .name = "net2272",
301 .id = -1,
302 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
303 .resource = net2272_bfin_resources,
304};
305#endif
306
307#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
308static struct resource bfin_uart_resources[] = {
309 {
310 .start = 0xFFC00400,
311 .end = 0xFFC004FF,
312 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800313 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700314 .start = 0xFFC02000,
315 .end = 0xFFC020FF,
316 .flags = IORESOURCE_MEM,
317 },
318};
319
320static struct platform_device bfin_uart_device = {
321 .name = "bfin-uart",
322 .id = 1,
323 .num_resources = ARRAY_SIZE(bfin_uart_resources),
324 .resource = bfin_uart_resources,
325};
326#endif
327
Graf Yang5be36d22008-04-25 03:09:15 +0800328#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
329static struct resource bfin_sir_resources[] = {
330#ifdef CONFIG_BFIN_SIR0
331 {
332 .start = 0xFFC00400,
333 .end = 0xFFC004FF,
334 .flags = IORESOURCE_MEM,
335 },
336#endif
337#ifdef CONFIG_BFIN_SIR1
338 {
339 .start = 0xFFC02000,
340 .end = 0xFFC020FF,
341 .flags = IORESOURCE_MEM,
342 },
343#endif
344};
345
346static struct platform_device bfin_sir_device = {
347 .name = "bfin_sir",
348 .id = 0,
349 .num_resources = ARRAY_SIZE(bfin_sir_resources),
350 .resource = bfin_sir_resources,
351};
352#endif
353
Mike Frysinger56ce8352008-03-26 06:00:18 +0800354#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
355static struct resource bfin_twi0_resource[] = {
356 [0] = {
357 .start = TWI0_REGBASE,
358 .end = TWI0_REGBASE,
359 .flags = IORESOURCE_MEM,
360 },
361 [1] = {
362 .start = IRQ_TWI,
363 .end = IRQ_TWI,
364 .flags = IORESOURCE_IRQ,
365 },
366};
367
368static struct platform_device i2c_bfin_twi_device = {
369 .name = "i2c-bfin-twi",
370 .id = 0,
371 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
372 .resource = bfin_twi0_resource,
373};
374#endif
375
Bryan Wu1394f032007-05-06 14:50:22 -0700376#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
377static struct platform_device bfin_sport0_uart_device = {
378 .name = "bfin-sport-uart",
379 .id = 0,
380};
381
382static struct platform_device bfin_sport1_uart_device = {
383 .name = "bfin-sport-uart",
384 .id = 1,
385};
386#endif
387
388#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
389static struct platform_device bfin_mac_device = {
390 .name = "bfin_mac",
391};
392#endif
393
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800394#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
395#define PATA_INT 64
396
397static struct pata_platform_info bfin_pata_platform_data = {
398 .ioport_shift = 2,
399 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
400};
401
402static struct resource bfin_pata_resources[] = {
403 {
404 .start = 0x2030C000,
405 .end = 0x2030C01F,
406 .flags = IORESOURCE_MEM,
407 },
408 {
409 .start = 0x2030D018,
410 .end = 0x2030D01B,
411 .flags = IORESOURCE_MEM,
412 },
413 {
414 .start = PATA_INT,
415 .end = PATA_INT,
416 .flags = IORESOURCE_IRQ,
417 },
418};
419
420static struct platform_device bfin_pata_device = {
421 .name = "pata_platform",
422 .id = -1,
423 .num_resources = ARRAY_SIZE(bfin_pata_resources),
424 .resource = bfin_pata_resources,
425 .dev = {
426 .platform_data = &bfin_pata_platform_data,
427 }
428};
429#endif
430
Bryan Wu1394f032007-05-06 14:50:22 -0700431static struct platform_device *cm_bf537_devices[] __initdata = {
Michael Hennerich0d4a89b2008-01-27 19:58:46 +0800432#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
433 &hitachi_fb_device,
434#endif
435
Bryan Wu1394f032007-05-06 14:50:22 -0700436#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
437 &rtc_device,
438#endif
439
440#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
441 &bfin_uart_device,
442#endif
443
Graf Yang5be36d22008-04-25 03:09:15 +0800444#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
445 &bfin_sir_device,
446#endif
447
Mike Frysinger56ce8352008-03-26 06:00:18 +0800448#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
449 &i2c_bfin_twi_device,
450#endif
451
Bryan Wu1394f032007-05-06 14:50:22 -0700452#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
453 &bfin_sport0_uart_device,
454 &bfin_sport1_uart_device,
455#endif
456
457#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
458 &isp1362_hcd_device,
459#endif
460
461#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
462 &smc91x_device,
463#endif
464
465#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
466 &bfin_mac_device,
467#endif
468
469#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
470 &net2272_bfin_device,
471#endif
472
473#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800474 &bfin_spi0_device,
475#endif
476
477#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
478 &bfin_pata_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700479#endif
480};
481
482static int __init cm_bf537_init(void)
483{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800484 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu1394f032007-05-06 14:50:22 -0700485 platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices));
486#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
487 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
488#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800489
490#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
491 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
492#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700493 return 0;
494}
495
496arch_initcall(cm_bf537_init);
Mike Frysinger137b1522007-11-22 16:07:03 +0800497
Mike Frysinger9862cc52007-11-15 21:21:20 +0800498void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +0800499{
500 random_ether_addr(addr);
501 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
502}
Mike Frysinger9862cc52007-11-15 21:21:20 +0800503EXPORT_SYMBOL(bfin_get_ether_addr);