blob: 199fde69b96499303b16ebafe1db483ff567990b [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
Mike Frysinger56ce8352008-03-26 06:00:18 +0800328#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
329static struct resource bfin_twi0_resource[] = {
330 [0] = {
331 .start = TWI0_REGBASE,
332 .end = TWI0_REGBASE,
333 .flags = IORESOURCE_MEM,
334 },
335 [1] = {
336 .start = IRQ_TWI,
337 .end = IRQ_TWI,
338 .flags = IORESOURCE_IRQ,
339 },
340};
341
342static struct platform_device i2c_bfin_twi_device = {
343 .name = "i2c-bfin-twi",
344 .id = 0,
345 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
346 .resource = bfin_twi0_resource,
347};
348#endif
349
Bryan Wu1394f032007-05-06 14:50:22 -0700350#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
351static struct platform_device bfin_sport0_uart_device = {
352 .name = "bfin-sport-uart",
353 .id = 0,
354};
355
356static struct platform_device bfin_sport1_uart_device = {
357 .name = "bfin-sport-uart",
358 .id = 1,
359};
360#endif
361
362#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
363static struct platform_device bfin_mac_device = {
364 .name = "bfin_mac",
365};
366#endif
367
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800368#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
369#define PATA_INT 64
370
371static struct pata_platform_info bfin_pata_platform_data = {
372 .ioport_shift = 2,
373 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
374};
375
376static struct resource bfin_pata_resources[] = {
377 {
378 .start = 0x2030C000,
379 .end = 0x2030C01F,
380 .flags = IORESOURCE_MEM,
381 },
382 {
383 .start = 0x2030D018,
384 .end = 0x2030D01B,
385 .flags = IORESOURCE_MEM,
386 },
387 {
388 .start = PATA_INT,
389 .end = PATA_INT,
390 .flags = IORESOURCE_IRQ,
391 },
392};
393
394static struct platform_device bfin_pata_device = {
395 .name = "pata_platform",
396 .id = -1,
397 .num_resources = ARRAY_SIZE(bfin_pata_resources),
398 .resource = bfin_pata_resources,
399 .dev = {
400 .platform_data = &bfin_pata_platform_data,
401 }
402};
403#endif
404
Bryan Wu1394f032007-05-06 14:50:22 -0700405static struct platform_device *cm_bf537_devices[] __initdata = {
Michael Hennerich0d4a89b2008-01-27 19:58:46 +0800406#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
407 &hitachi_fb_device,
408#endif
409
Bryan Wu1394f032007-05-06 14:50:22 -0700410#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
411 &rtc_device,
412#endif
413
414#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
415 &bfin_uart_device,
416#endif
417
Mike Frysinger56ce8352008-03-26 06:00:18 +0800418#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
419 &i2c_bfin_twi_device,
420#endif
421
Bryan Wu1394f032007-05-06 14:50:22 -0700422#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
423 &bfin_sport0_uart_device,
424 &bfin_sport1_uart_device,
425#endif
426
427#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
428 &isp1362_hcd_device,
429#endif
430
431#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
432 &smc91x_device,
433#endif
434
435#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
436 &bfin_mac_device,
437#endif
438
439#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
440 &net2272_bfin_device,
441#endif
442
443#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800444 &bfin_spi0_device,
445#endif
446
447#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
448 &bfin_pata_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700449#endif
450};
451
452static int __init cm_bf537_init(void)
453{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800454 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Bryan Wu1394f032007-05-06 14:50:22 -0700455 platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices));
456#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
457 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
458#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800459
460#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
461 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
462#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700463 return 0;
464}
465
466arch_initcall(cm_bf537_init);
Mike Frysinger137b1522007-11-22 16:07:03 +0800467
Mike Frysinger9862cc52007-11-15 21:21:20 +0800468void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +0800469{
470 random_ether_addr(addr);
471 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
472}
Mike Frysinger9862cc52007-11-15 21:21:20 +0800473EXPORT_SYMBOL(bfin_get_ether_addr);