blob: a102615cac7cd17de48de18a1fb42fb05ecb5658 [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>
32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h>
35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h>
Mike Frysingerf02bcec2007-11-15 21:29:15 +080037#include <linux/usb/isp1362.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080038#include <linux/pata_platform.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080039#include <linux/irq.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080040#include <asm/dma.h>
Bryan Wu1394f032007-05-06 14:50:22 -070041#include <asm/bfin5xx_spi.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080042#include <asm/portmux.h>
Bryan Wu1394f032007-05-06 14:50:22 -070043
44/*
45 * Name the Board for the /proc/cpuinfo
46 */
Mike Frysinger066954a2007-10-21 22:36:06 +080047const char bfin_board_name[] = "Bluetechnix CM BF537";
Bryan Wu1394f032007-05-06 14:50:22 -070048
49#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
50/* all SPI peripherals info goes here */
51
52#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
53static struct mtd_partition bfin_spi_flash_partitions[] = {
54 {
55 .name = "bootloader",
56 .size = 0x00020000,
57 .offset = 0,
58 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080059 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070060 .name = "kernel",
61 .size = 0xe0000,
62 .offset = 0x20000
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080063 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070064 .name = "file system",
65 .size = 0x700000,
66 .offset = 0x00100000,
67 }
68};
69
70static struct flash_platform_data bfin_spi_flash_data = {
71 .name = "m25p80",
72 .parts = bfin_spi_flash_partitions,
73 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
74 .type = "m25p64",
75};
76
77/* SPI flash chip (m25p64) */
78static struct bfin5xx_spi_chip spi_flash_chip_info = {
79 .enable_dma = 0, /* use dma transfer with this chip*/
80 .bits_per_word = 8,
81};
82#endif
83
84#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
85/* SPI ADC chip */
86static struct bfin5xx_spi_chip spi_adc_chip_info = {
87 .enable_dma = 1, /* use dma transfer with this chip*/
88 .bits_per_word = 16,
89};
90#endif
91
92#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
93static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
94 .enable_dma = 0,
95 .bits_per_word = 16,
96};
97#endif
98
99#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
100static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
101 .enable_dma = 0,
102 .bits_per_word = 16,
103};
104#endif
105
106#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
107static struct bfin5xx_spi_chip spi_mmc_chip_info = {
108 .enable_dma = 1,
109 .bits_per_word = 8,
110};
111#endif
112
113static struct spi_board_info bfin_spi_board_info[] __initdata = {
114#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
115 {
116 /* the modalias must be the same as spi device driver name */
117 .modalias = "m25p80", /* Name of spi_driver for this device */
118 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800119 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700120 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
121 .platform_data = &bfin_spi_flash_data,
122 .controller_data = &spi_flash_chip_info,
123 .mode = SPI_MODE_3,
124 },
125#endif
126
127#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
128 {
129 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
130 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800131 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700132 .chip_select = 1, /* Framework chip select. */
133 .platform_data = NULL, /* No spi_driver specific config */
134 .controller_data = &spi_adc_chip_info,
135 },
136#endif
137
138#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
139 {
140 .modalias = "ad1836-spi",
141 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800142 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700143 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
144 .controller_data = &ad1836_spi_chip_info,
145 },
146#endif
147
148#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
149 {
150 .modalias = "ad9960-spi",
151 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800152 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700153 .chip_select = 1,
154 .controller_data = &ad9960_spi_chip_info,
155 },
156#endif
157
158#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
159 {
160 .modalias = "spi_mmc_dummy",
161 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800162 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700163 .chip_select = 7,
164 .platform_data = NULL,
165 .controller_data = &spi_mmc_chip_info,
166 .mode = SPI_MODE_3,
167 },
168 {
169 .modalias = "spi_mmc",
170 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800171 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700172 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
173 .platform_data = NULL,
174 .controller_data = &spi_mmc_chip_info,
175 .mode = SPI_MODE_3,
176 },
177#endif
178};
179
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800180/* SPI (0) */
181static struct resource bfin_spi0_resource[] = {
182 [0] = {
183 .start = SPI0_REGBASE,
184 .end = SPI0_REGBASE + 0xFF,
185 .flags = IORESOURCE_MEM,
186 },
187 [1] = {
188 .start = CH_SPI,
189 .end = CH_SPI,
190 .flags = IORESOURCE_IRQ,
191 }
192};
193
Bryan Wu1394f032007-05-06 14:50:22 -0700194/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800195static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700196 .num_chipselect = 8,
197 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800198 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700199};
200
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800201static struct platform_device bfin_spi0_device = {
202 .name = "bfin-spi",
203 .id = 0, /* Bus number */
204 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
205 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700206 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800207 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700208 },
209};
210#endif /* spi master and devices */
211
212#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
213static struct platform_device rtc_device = {
214 .name = "rtc-bfin",
215 .id = -1,
216};
217#endif
218
Michael Hennerich0d4a89b2008-01-27 19:58:46 +0800219#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
220static struct platform_device hitachi_fb_device = {
221 .name = "hitachi-tx09",
222};
223#endif
224
Bryan Wu1394f032007-05-06 14:50:22 -0700225#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
226static struct resource smc91x_resources[] = {
227 {
228 .start = 0x20200300,
229 .end = 0x20200300 + 16,
230 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800231 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700232 .start = IRQ_PF14,
233 .end = IRQ_PF14,
234 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
235 },
236};
237
238static struct platform_device smc91x_device = {
239 .name = "smc91x",
240 .id = 0,
241 .num_resources = ARRAY_SIZE(smc91x_resources),
242 .resource = smc91x_resources,
243};
244#endif
245
246#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
247static struct resource isp1362_hcd_resources[] = {
248 {
249 .start = 0x20308000,
250 .end = 0x20308000,
251 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800252 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700253 .start = 0x20308004,
254 .end = 0x20308004,
255 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800256 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700257 .start = IRQ_PG15,
258 .end = IRQ_PG15,
259 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
260 },
261};
262
263static struct isp1362_platform_data isp1362_priv = {
264 .sel15Kres = 1,
265 .clknotstop = 0,
266 .oc_enable = 0,
267 .int_act_high = 0,
268 .int_edge_triggered = 0,
269 .remote_wakeup_connected = 0,
270 .no_power_switching = 1,
271 .power_switching_mode = 0,
272};
273
274static struct platform_device isp1362_hcd_device = {
275 .name = "isp1362-hcd",
276 .id = 0,
277 .dev = {
278 .platform_data = &isp1362_priv,
279 },
280 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
281 .resource = isp1362_hcd_resources,
282};
283#endif
284
285#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
286static struct resource net2272_bfin_resources[] = {
287 {
288 .start = 0x20200000,
289 .end = 0x20200000 + 0x100,
290 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800291 }, {
Michael Hennerich8ecc7362007-10-29 17:24:23 +0800292 .start = IRQ_PH14,
293 .end = IRQ_PH14,
Bryan Wu1394f032007-05-06 14:50:22 -0700294 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
295 },
296};
297
298static struct platform_device net2272_bfin_device = {
299 .name = "net2272",
300 .id = -1,
301 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
302 .resource = net2272_bfin_resources,
303};
304#endif
305
306#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
307static struct resource bfin_uart_resources[] = {
308 {
309 .start = 0xFFC00400,
310 .end = 0xFFC004FF,
311 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800312 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700313 .start = 0xFFC02000,
314 .end = 0xFFC020FF,
315 .flags = IORESOURCE_MEM,
316 },
317};
318
319static struct platform_device bfin_uart_device = {
320 .name = "bfin-uart",
321 .id = 1,
322 .num_resources = ARRAY_SIZE(bfin_uart_resources),
323 .resource = bfin_uart_resources,
324};
325#endif
326
327#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
328static struct platform_device bfin_sport0_uart_device = {
329 .name = "bfin-sport-uart",
330 .id = 0,
331};
332
333static struct platform_device bfin_sport1_uart_device = {
334 .name = "bfin-sport-uart",
335 .id = 1,
336};
337#endif
338
339#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
340static struct platform_device bfin_mac_device = {
341 .name = "bfin_mac",
342};
343#endif
344
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800345#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
346#define PATA_INT 64
347
348static struct pata_platform_info bfin_pata_platform_data = {
349 .ioport_shift = 2,
350 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
351};
352
353static struct resource bfin_pata_resources[] = {
354 {
355 .start = 0x2030C000,
356 .end = 0x2030C01F,
357 .flags = IORESOURCE_MEM,
358 },
359 {
360 .start = 0x2030D018,
361 .end = 0x2030D01B,
362 .flags = IORESOURCE_MEM,
363 },
364 {
365 .start = PATA_INT,
366 .end = PATA_INT,
367 .flags = IORESOURCE_IRQ,
368 },
369};
370
371static struct platform_device bfin_pata_device = {
372 .name = "pata_platform",
373 .id = -1,
374 .num_resources = ARRAY_SIZE(bfin_pata_resources),
375 .resource = bfin_pata_resources,
376 .dev = {
377 .platform_data = &bfin_pata_platform_data,
378 }
379};
380#endif
381
Bryan Wu1394f032007-05-06 14:50:22 -0700382static struct platform_device *cm_bf537_devices[] __initdata = {
Michael Hennerich0d4a89b2008-01-27 19:58:46 +0800383#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
384 &hitachi_fb_device,
385#endif
386
Bryan Wu1394f032007-05-06 14:50:22 -0700387#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
388 &rtc_device,
389#endif
390
391#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
392 &bfin_uart_device,
393#endif
394
395#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
396 &bfin_sport0_uart_device,
397 &bfin_sport1_uart_device,
398#endif
399
400#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
401 &isp1362_hcd_device,
402#endif
403
404#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
405 &smc91x_device,
406#endif
407
408#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
409 &bfin_mac_device,
410#endif
411
412#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
413 &net2272_bfin_device,
414#endif
415
416#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800417 &bfin_spi0_device,
418#endif
419
420#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
421 &bfin_pata_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700422#endif
423};
424
425static int __init cm_bf537_init(void)
426{
427 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
428 platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices));
429#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
430 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
431#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800432
433#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
434 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
435#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700436 return 0;
437}
438
439arch_initcall(cm_bf537_init);
Mike Frysinger137b1522007-11-22 16:07:03 +0800440
Mike Frysinger9862cc52007-11-15 21:21:20 +0800441void bfin_get_ether_addr(char *addr)
Mike Frysinger137b1522007-11-22 16:07:03 +0800442{
443 random_ether_addr(addr);
444 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
445}
Mike Frysinger9862cc52007-11-15 21:21:20 +0800446EXPORT_SYMBOL(bfin_get_ether_addr);