blob: 1bd8b61e6888c8b592ea69a7789fda4af69b02e9 [file] [log] [blame]
Javier Herreroab472a02007-10-29 16:14:44 +08001/*
2 * File: arch/blackfin/mach-bf533/H8606.c
3 * Based on: arch/blackfin/mach-bf533/stamp.c
4 * Author: Javier Herrero <jherrero@hvsistemas.es>
5 *
6 * Created: 2007
7 * Description: Board Info File for the HV Sistemas H8606 board
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc
Javier Herrero45138432008-10-09 18:06:47 +080012 * Copyright 2007,2008 HV Sistemas S.L.
Javier Herreroab472a02007-10-29 16:14:44 +080013 *
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, see the file COPYING, or write
28 * to the Free Software Foundation, Inc.,
29 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 */
31
32#include <linux/device.h>
33#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>
38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
Mike Frysingerf02bcec2007-11-15 21:29:15 +080039#include <linux/usb/isp1362.h>
Javier Herreroab472a02007-10-29 16:14:44 +080040#endif
Javier Herreroab472a02007-10-29 16:14:44 +080041#include <linux/irq.h>
Javier Herrerofb96c562007-12-21 18:26:44 +080042
Javier Herreroab472a02007-10-29 16:14:44 +080043#include <asm/dma.h>
44#include <asm/bfin5xx_spi.h>
45#include <asm/reboot.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080046#include <asm/portmux.h>
Javier Herreroab472a02007-10-29 16:14:44 +080047
48/*
49 * Name the Board for the /proc/cpuinfo
50 */
51const char bfin_board_name[] = "HV Sistemas H8606";
52
Robert P. J. Day09db9482007-11-17 22:57:03 +080053#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
Javier Herreroab472a02007-10-29 16:14:44 +080054static struct platform_device rtc_device = {
55 .name = "rtc-bfin",
56 .id = -1,
57};
58#endif
59
60/*
61* Driver needs to know address, irq and flag pin.
62 */
63 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
64static struct resource dm9000_resources[] = {
65 [0] = {
66 .start = 0x20300000,
Javier Herrero45138432008-10-09 18:06:47 +080067 .end = 0x20300002,
Javier Herreroab472a02007-10-29 16:14:44 +080068 .flags = IORESOURCE_MEM,
69 },
70 [1] = {
Javier Herrero45138432008-10-09 18:06:47 +080071 .start = 0x20300004,
72 .end = 0x20300006,
Laurent Pinchartda3854f2008-06-24 22:15:58 +010073 .flags = IORESOURCE_MEM,
74 },
75 [2] = {
Javier Herreroab472a02007-10-29 16:14:44 +080076 .start = IRQ_PF10,
77 .end = IRQ_PF10,
Javier Herrero45138432008-10-09 18:06:47 +080078 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | IRQF_SHARED | IRQF_TRIGGER_HIGH),
Javier Herreroab472a02007-10-29 16:14:44 +080079 },
80};
81
82static struct platform_device dm9000_device = {
83 .id = 0,
84 .name = "dm9000",
85 .resource = dm9000_resources,
86 .num_resources = ARRAY_SIZE(dm9000_resources),
87};
88#endif
89
90#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
Michael Hennerich61f09b52009-07-24 08:48:31 +000091#include <linux/smc91x.h>
92
93static struct smc91x_platdata smc91x_info = {
94 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
95 .leda = RPC_LED_100_10,
96 .ledb = RPC_LED_TX_RX,
97};
98
Javier Herreroab472a02007-10-29 16:14:44 +080099static struct resource smc91x_resources[] = {
100 {
101 .name = "smc91x-regs",
102 .start = 0x20300300,
103 .end = 0x20300300 + 16,
104 .flags = IORESOURCE_MEM,
105 }, {
106 .start = IRQ_PROG_INTB,
107 .end = IRQ_PROG_INTB,
108 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
109 }, {
Javier Herreroab472a02007-10-29 16:14:44 +0800110 .start = IRQ_PF7,
111 .end = IRQ_PF7,
112 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
113 },
114};
115
116static struct platform_device smc91x_device = {
117 .name = "smc91x",
118 .id = 0,
119 .num_resources = ARRAY_SIZE(smc91x_resources),
120 .resource = smc91x_resources,
Michael Hennerich61f09b52009-07-24 08:48:31 +0000121 .dev = {
122 .platform_data = &smc91x_info,
123 },
Javier Herreroab472a02007-10-29 16:14:44 +0800124};
125#endif
126
127#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
128static struct resource net2272_bfin_resources[] = {
129 {
130 .start = 0x20300000,
131 .end = 0x20300000 + 0x100,
132 .flags = IORESOURCE_MEM,
133 }, {
134 .start = IRQ_PF10,
135 .end = IRQ_PF10,
136 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
137 },
138};
139
140static struct platform_device net2272_bfin_device = {
141 .name = "net2272",
142 .id = -1,
143 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
144 .resource = net2272_bfin_resources,
145};
146#endif
147
148#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
149/* all SPI peripherals info goes here */
150
151#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
152static struct mtd_partition bfin_spi_flash_partitions[] = {
153 {
Javier Herrero45138432008-10-09 18:06:47 +0800154 .name = "bootloader (spi)",
155 .size = 0x40000,
Javier Herreroab472a02007-10-29 16:14:44 +0800156 .offset = 0,
157 .mask_flags = MTD_CAP_ROM
158 }, {
Javier Herrero45138432008-10-09 18:06:47 +0800159 .name = "fpga (spi)",
160 .size = 0x30000,
161 .offset = 0x40000
Javier Herreroab472a02007-10-29 16:14:44 +0800162 }, {
Javier Herrero45138432008-10-09 18:06:47 +0800163 .name = "linux kernel (spi)",
164 .size = 0x150000,
165 .offset = 0x70000
166 }, {
167 .name = "jffs2 root file system (spi)",
168 .size = 0x640000,
169 .offset = 0x1c0000,
Javier Herreroab472a02007-10-29 16:14:44 +0800170 }
171};
172
173static struct flash_platform_data bfin_spi_flash_data = {
174 .name = "m25p80",
175 .parts = bfin_spi_flash_partitions,
176 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
177 .type = "m25p64",
178};
179
180/* SPI flash chip (m25p64) */
181static struct bfin5xx_spi_chip spi_flash_chip_info = {
182 .enable_dma = 0, /* use dma transfer with this chip*/
183 .bits_per_word = 8,
184};
185#endif
186
Mike Frysingera261eec2009-05-20 14:05:36 +0000187#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Javier Herreroab472a02007-10-29 16:14:44 +0800188/* SPI ADC chip */
189static struct bfin5xx_spi_chip spi_adc_chip_info = {
190 .ctl_reg = 0x1000,
191 .enable_dma = 1, /* use dma transfer with this chip*/
192 .bits_per_word = 16,
193};
194#endif
195
196#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
197static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
198 .ctl_reg = 0x1000,
199 .enable_dma = 0,
200 .bits_per_word = 16,
201};
202#endif
203
204#if defined(CONFIG_PBX)
205static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
206 .ctl_reg = 0x1c04,
207 .enable_dma = 0,
208 .bits_per_word = 8,
209 .cs_change_per_word = 1,
210};
211#endif
212
213/* Notice: for blackfin, the speed_hz is the value of register
214 * SPI_BAUD, not the real baudrate */
215static struct spi_board_info bfin_spi_board_info[] __initdata = {
216#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
217 {
218 /* the modalias must be the same as spi device driver name */
219 .modalias = "m25p80", /* Name of spi_driver for this device */
220 /* this value is the baudrate divisor */
221 .max_speed_hz = 50000000, /* actual baudrate is SCLK/(2xspeed_hz) */
222 .bus_num = 0, /* Framework bus number */
223 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
224 .platform_data = &bfin_spi_flash_data,
225 .controller_data = &spi_flash_chip_info,
226 .mode = SPI_MODE_3,
227 },
228#endif
229
Mike Frysingera261eec2009-05-20 14:05:36 +0000230#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
Javier Herreroab472a02007-10-29 16:14:44 +0800231 {
232 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
233 .max_speed_hz = 4, /* actual baudrate is SCLK/(2xspeed_hz) */
234 .bus_num = 1, /* Framework bus number */
235 .chip_select = 1, /* Framework chip select. */
236 .platform_data = NULL, /* No spi_driver specific config */
237 .controller_data = &spi_adc_chip_info,
238 },
239#endif
240
241#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
242 {
243 .modalias = "ad1836-spi",
244 .max_speed_hz = 16,
245 .bus_num = 1,
246 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
247 .controller_data = &ad1836_spi_chip_info,
248 },
249#endif
250
251#if defined(CONFIG_PBX)
252 {
253 .modalias = "fxs-spi",
254 .max_speed_hz = 4,
255 .bus_num = 1,
256 .chip_select = 3,
257 .controller_data = &spi_si3xxx_chip_info,
258 },
259
260 {
261 .modalias = "fxo-spi",
262 .max_speed_hz = 4,
263 .bus_num = 1,
264 .chip_select = 2,
265 .controller_data = &spi_si3xxx_chip_info,
266 },
267#endif
268};
269
270/* SPI (0) */
271static struct resource bfin_spi0_resource[] = {
272 [0] = {
273 .start = SPI0_REGBASE,
274 .end = SPI0_REGBASE + 0xFF,
275 .flags = IORESOURCE_MEM,
276 },
277 [1] = {
278 .start = CH_SPI,
279 .end = CH_SPI,
Yi Li53122692009-06-05 12:11:11 +0000280 .flags = IORESOURCE_DMA,
281 },
282 [2] = {
283 .start = IRQ_SPI,
284 .end = IRQ_SPI,
Javier Herreroab472a02007-10-29 16:14:44 +0800285 .flags = IORESOURCE_IRQ,
286 }
287};
288
289
290/* SPI controller data */
291static struct bfin5xx_spi_master bfin_spi0_info = {
292 .num_chipselect = 8,
293 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800294 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Javier Herreroab472a02007-10-29 16:14:44 +0800295};
296
297static struct platform_device bfin_spi0_device = {
298 .name = "bfin-spi",
299 .id = 0, /* Bus number */
300 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
301 .resource = bfin_spi0_resource,
302 .dev = {
303 .platform_data = &bfin_spi0_info, /* Passed to driver */
304 },
305};
306#endif /* spi master and devices */
307
308#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
309static struct platform_device bfin_fb_device = {
310 .name = "bf537-fb",
311};
312#endif
313
314#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
315static struct resource bfin_uart_resources[] = {
316 {
317 .start = 0xFFC00400,
318 .end = 0xFFC004FF,
319 .flags = IORESOURCE_MEM,
320 },
321};
322
323static struct platform_device bfin_uart_device = {
324 .name = "bfin-uart",
325 .id = 1,
326 .num_resources = ARRAY_SIZE(bfin_uart_resources),
327 .resource = bfin_uart_resources,
328};
329#endif
330
Graf Yang5be36d22008-04-25 03:09:15 +0800331#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang5be36d22008-04-25 03:09:15 +0800332#ifdef CONFIG_BFIN_SIR0
Graf Yang42bd8bc2009-01-07 23:14:39 +0800333static struct resource bfin_sir0_resources[] = {
Graf Yang5be36d22008-04-25 03:09:15 +0800334 {
335 .start = 0xFFC00400,
336 .end = 0xFFC004FF,
337 .flags = IORESOURCE_MEM,
338 },
Graf Yang42bd8bc2009-01-07 23:14:39 +0800339 {
340 .start = IRQ_UART0_RX,
341 .end = IRQ_UART0_RX+1,
342 .flags = IORESOURCE_IRQ,
343 },
344 {
345 .start = CH_UART0_RX,
346 .end = CH_UART0_RX+1,
347 .flags = IORESOURCE_DMA,
348 },
Graf Yang5be36d22008-04-25 03:09:15 +0800349};
350
Graf Yang42bd8bc2009-01-07 23:14:39 +0800351static struct platform_device bfin_sir0_device = {
Graf Yang5be36d22008-04-25 03:09:15 +0800352 .name = "bfin_sir",
353 .id = 0,
Graf Yang42bd8bc2009-01-07 23:14:39 +0800354 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
355 .resource = bfin_sir0_resources,
Graf Yang5be36d22008-04-25 03:09:15 +0800356};
357#endif
Graf Yang42bd8bc2009-01-07 23:14:39 +0800358#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800359
Javier Herrerofb96c562007-12-21 18:26:44 +0800360#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
361
362#include <linux/serial_8250.h>
363#include <linux/serial.h>
364
365/*
366 * Configuration for two 16550 UARTS in FPGA at addresses 0x20200000 and 0x202000010.
367 * running at half system clock, both with interrupt output or-ed to PF8. Change to
368 * suit different FPGA configuration, or to suit real 16550 UARTS connected to the bus
369 */
370
371static struct plat_serial8250_port serial8250_platform_data [] = {
372 {
Javier Herrero45138432008-10-09 18:06:47 +0800373 .membase = (void *)0x20200000,
Javier Herrerofb96c562007-12-21 18:26:44 +0800374 .mapbase = 0x20200000,
375 .irq = IRQ_PF8,
376 .flags = UPF_BOOT_AUTOCONF | UART_CONFIG_TYPE,
377 .iotype = UPIO_MEM,
378 .regshift = 1,
379 .uartclk = 66666667,
380 }, {
Javier Herrero45138432008-10-09 18:06:47 +0800381 .membase = (void *)0x20200010,
Javier Herrerofb96c562007-12-21 18:26:44 +0800382 .mapbase = 0x20200010,
383 .irq = IRQ_PF8,
384 .flags = UPF_BOOT_AUTOCONF | UART_CONFIG_TYPE,
385 .iotype = UPIO_MEM,
386 .regshift = 1,
387 .uartclk = 66666667,
388 }, {
389 }
390};
391
392static struct platform_device serial8250_device = {
393 .id = PLAT8250_DEV_PLATFORM,
394 .name = "serial8250",
395 .dev = {
396 .platform_data = serial8250_platform_data,
397 },
398};
399
400#endif
401
Javier Herrero7a5f8192008-01-27 19:53:08 +0800402#if defined(CONFIG_KEYBOARD_OPENCORES) || defined(CONFIG_KEYBOARD_OPENCORES_MODULE)
403
404/*
405 * Configuration for one OpenCores keyboard controller in FPGA at address 0x20200030,
406 * interrupt output wired to PF9. Change to suit different FPGA configuration
407 */
408
409static struct resource opencores_kbd_resources[] = {
410 [0] = {
411 .start = 0x20200030,
412 .end = 0x20300030 + 2,
413 .flags = IORESOURCE_MEM,
414 },
415 [1] = {
416 .start = IRQ_PF9,
417 .end = IRQ_PF9,
418 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
419 },
420};
421
422static struct platform_device opencores_kbd_device = {
423 .id = -1,
424 .name = "opencores-kbd",
425 .resource = opencores_kbd_resources,
426 .num_resources = ARRAY_SIZE(opencores_kbd_resources),
427};
428#endif
429
Javier Herrerofb96c562007-12-21 18:26:44 +0800430static struct platform_device *h8606_devices[] __initdata = {
Javier Herreroab472a02007-10-29 16:14:44 +0800431#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
432 &rtc_device,
433#endif
434
435#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
436 &dm9000_device,
437#endif
438
439#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
440 &smc91x_device,
441#endif
442
443#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
444 &net2272_bfin_device,
445#endif
446
447#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
448 &bfin_spi0_device,
449#endif
450
451#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
452 &bfin_uart_device,
453#endif
Javier Herrerofb96c562007-12-21 18:26:44 +0800454
455#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
456 &serial8250_device,
457#endif
Javier Herrero7a5f8192008-01-27 19:53:08 +0800458
Graf Yang5be36d22008-04-25 03:09:15 +0800459#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
Graf Yang42bd8bc2009-01-07 23:14:39 +0800460#ifdef CONFIG_BFIN_SIR0
461 &bfin_sir0_device,
462#endif
Graf Yang5be36d22008-04-25 03:09:15 +0800463#endif
464
Javier Herrero7a5f8192008-01-27 19:53:08 +0800465#if defined(CONFIG_KEYBOARD_OPENCORES) || defined(CONFIG_KEYBOARD_OPENCORES_MODULE)
466 &opencores_kbd_device,
467#endif
Javier Herreroab472a02007-10-29 16:14:44 +0800468};
469
470static int __init H8606_init(void)
471{
472 printk(KERN_INFO "HV Sistemas H8606 board support by http://www.hvsistemas.com\n");
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800473 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Javier Herrerofb96c562007-12-21 18:26:44 +0800474 platform_add_devices(h8606_devices, ARRAY_SIZE(h8606_devices));
Javier Herreroab472a02007-10-29 16:14:44 +0800475#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
476 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
477#endif
478 return 0;
479}
480
Mike Frysinger0feea172007-11-15 21:10:42 +0800481arch_initcall(H8606_init);