blob: 4103a97c1a7024ae14e24b15d30b140611a93a7e [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
12 * Copyright 2007 HV Sistemas S.L.
13 *
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
Jeff Garzik0a87e3e2008-02-01 18:02:30 -050041#include <linux/ata_platform.h>
Javier Herreroab472a02007-10-29 16:14:44 +080042#include <linux/irq.h>
Javier Herrerofb96c562007-12-21 18:26:44 +080043
Javier Herreroab472a02007-10-29 16:14:44 +080044#include <asm/dma.h>
45#include <asm/bfin5xx_spi.h>
46#include <asm/reboot.h>
Bryan Wu5d448dd2007-11-12 23:24:42 +080047#include <asm/portmux.h>
Javier Herreroab472a02007-10-29 16:14:44 +080048
49/*
50 * Name the Board for the /proc/cpuinfo
51 */
52const char bfin_board_name[] = "HV Sistemas H8606";
53
Robert P. J. Day09db9482007-11-17 22:57:03 +080054#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
Javier Herreroab472a02007-10-29 16:14:44 +080055static struct platform_device rtc_device = {
56 .name = "rtc-bfin",
57 .id = -1,
58};
59#endif
60
61/*
62* Driver needs to know address, irq and flag pin.
63 */
64 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
65static struct resource dm9000_resources[] = {
66 [0] = {
67 .start = 0x20300000,
Laurent Pinchartda3854f2008-06-24 22:15:58 +010068 .end = 0x20300000 + 1,
Javier Herreroab472a02007-10-29 16:14:44 +080069 .flags = IORESOURCE_MEM,
70 },
71 [1] = {
Laurent Pinchartda3854f2008-06-24 22:15:58 +010072 .start = 0x20300000 + 4,
73 .end = 0x20300000 + 5,
74 .flags = IORESOURCE_MEM,
75 },
76 [2] = {
Javier Herreroab472a02007-10-29 16:14:44 +080077 .start = IRQ_PF10,
78 .end = IRQ_PF10,
79 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
80 },
81};
82
83static struct platform_device dm9000_device = {
84 .id = 0,
85 .name = "dm9000",
86 .resource = dm9000_resources,
87 .num_resources = ARRAY_SIZE(dm9000_resources),
88};
89#endif
90
91#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
92static struct resource smc91x_resources[] = {
93 {
94 .name = "smc91x-regs",
95 .start = 0x20300300,
96 .end = 0x20300300 + 16,
97 .flags = IORESOURCE_MEM,
98 }, {
99 .start = IRQ_PROG_INTB,
100 .end = IRQ_PROG_INTB,
101 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
102 }, {
Javier Herreroab472a02007-10-29 16:14:44 +0800103 .start = IRQ_PF7,
104 .end = IRQ_PF7,
105 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
106 },
107};
108
109static struct platform_device smc91x_device = {
110 .name = "smc91x",
111 .id = 0,
112 .num_resources = ARRAY_SIZE(smc91x_resources),
113 .resource = smc91x_resources,
114};
115#endif
116
117#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
118static struct resource net2272_bfin_resources[] = {
119 {
120 .start = 0x20300000,
121 .end = 0x20300000 + 0x100,
122 .flags = IORESOURCE_MEM,
123 }, {
124 .start = IRQ_PF10,
125 .end = IRQ_PF10,
126 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
127 },
128};
129
130static struct platform_device net2272_bfin_device = {
131 .name = "net2272",
132 .id = -1,
133 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
134 .resource = net2272_bfin_resources,
135};
136#endif
137
138#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
139/* all SPI peripherals info goes here */
140
141#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
142static struct mtd_partition bfin_spi_flash_partitions[] = {
143 {
144 .name = "bootloader",
145 .size = 0x00060000,
146 .offset = 0,
147 .mask_flags = MTD_CAP_ROM
148 }, {
149 .name = "kernel",
150 .size = 0x100000,
151 .offset = 0x60000
152 }, {
153 .name = "file system",
154 .size = 0x6a0000,
155 .offset = 0x00160000,
156 }
157};
158
159static struct flash_platform_data bfin_spi_flash_data = {
160 .name = "m25p80",
161 .parts = bfin_spi_flash_partitions,
162 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
163 .type = "m25p64",
164};
165
166/* SPI flash chip (m25p64) */
167static struct bfin5xx_spi_chip spi_flash_chip_info = {
168 .enable_dma = 0, /* use dma transfer with this chip*/
169 .bits_per_word = 8,
170};
171#endif
172
173#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
174/* SPI ADC chip */
175static struct bfin5xx_spi_chip spi_adc_chip_info = {
176 .ctl_reg = 0x1000,
177 .enable_dma = 1, /* use dma transfer with this chip*/
178 .bits_per_word = 16,
179};
180#endif
181
182#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
183static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
184 .ctl_reg = 0x1000,
185 .enable_dma = 0,
186 .bits_per_word = 16,
187};
188#endif
189
190#if defined(CONFIG_PBX)
191static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
192 .ctl_reg = 0x1c04,
193 .enable_dma = 0,
194 .bits_per_word = 8,
195 .cs_change_per_word = 1,
196};
197#endif
198
199/* Notice: for blackfin, the speed_hz is the value of register
200 * SPI_BAUD, not the real baudrate */
201static struct spi_board_info bfin_spi_board_info[] __initdata = {
202#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
203 {
204 /* the modalias must be the same as spi device driver name */
205 .modalias = "m25p80", /* Name of spi_driver for this device */
206 /* this value is the baudrate divisor */
207 .max_speed_hz = 50000000, /* actual baudrate is SCLK/(2xspeed_hz) */
208 .bus_num = 0, /* Framework bus number */
209 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
210 .platform_data = &bfin_spi_flash_data,
211 .controller_data = &spi_flash_chip_info,
212 .mode = SPI_MODE_3,
213 },
214#endif
215
216#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
217 {
218 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
219 .max_speed_hz = 4, /* actual baudrate is SCLK/(2xspeed_hz) */
220 .bus_num = 1, /* Framework bus number */
221 .chip_select = 1, /* Framework chip select. */
222 .platform_data = NULL, /* No spi_driver specific config */
223 .controller_data = &spi_adc_chip_info,
224 },
225#endif
226
227#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
228 {
229 .modalias = "ad1836-spi",
230 .max_speed_hz = 16,
231 .bus_num = 1,
232 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
233 .controller_data = &ad1836_spi_chip_info,
234 },
235#endif
236
237#if defined(CONFIG_PBX)
238 {
239 .modalias = "fxs-spi",
240 .max_speed_hz = 4,
241 .bus_num = 1,
242 .chip_select = 3,
243 .controller_data = &spi_si3xxx_chip_info,
244 },
245
246 {
247 .modalias = "fxo-spi",
248 .max_speed_hz = 4,
249 .bus_num = 1,
250 .chip_select = 2,
251 .controller_data = &spi_si3xxx_chip_info,
252 },
253#endif
254};
255
256/* SPI (0) */
257static struct resource bfin_spi0_resource[] = {
258 [0] = {
259 .start = SPI0_REGBASE,
260 .end = SPI0_REGBASE + 0xFF,
261 .flags = IORESOURCE_MEM,
262 },
263 [1] = {
264 .start = CH_SPI,
265 .end = CH_SPI,
266 .flags = IORESOURCE_IRQ,
267 }
268};
269
270
271/* SPI controller data */
272static struct bfin5xx_spi_master bfin_spi0_info = {
273 .num_chipselect = 8,
274 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800275 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Javier Herreroab472a02007-10-29 16:14:44 +0800276};
277
278static struct platform_device bfin_spi0_device = {
279 .name = "bfin-spi",
280 .id = 0, /* Bus number */
281 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
282 .resource = bfin_spi0_resource,
283 .dev = {
284 .platform_data = &bfin_spi0_info, /* Passed to driver */
285 },
286};
287#endif /* spi master and devices */
288
289#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
290static struct platform_device bfin_fb_device = {
291 .name = "bf537-fb",
292};
293#endif
294
295#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
296static struct resource bfin_uart_resources[] = {
297 {
298 .start = 0xFFC00400,
299 .end = 0xFFC004FF,
300 .flags = IORESOURCE_MEM,
301 },
302};
303
304static struct platform_device bfin_uart_device = {
305 .name = "bfin-uart",
306 .id = 1,
307 .num_resources = ARRAY_SIZE(bfin_uart_resources),
308 .resource = bfin_uart_resources,
309};
310#endif
311
Graf Yang5be36d22008-04-25 03:09:15 +0800312#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
313static struct resource bfin_sir_resources[] = {
314#ifdef CONFIG_BFIN_SIR0
315 {
316 .start = 0xFFC00400,
317 .end = 0xFFC004FF,
318 .flags = IORESOURCE_MEM,
319 },
320#endif
321};
322
323static struct platform_device bfin_sir_device = {
324 .name = "bfin_sir",
325 .id = 0,
326 .num_resources = ARRAY_SIZE(bfin_sir_resources),
327 .resource = bfin_sir_resources,
328};
329#endif
330
Javier Herrerofb96c562007-12-21 18:26:44 +0800331#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
332
333#include <linux/serial_8250.h>
334#include <linux/serial.h>
335
336/*
337 * Configuration for two 16550 UARTS in FPGA at addresses 0x20200000 and 0x202000010.
338 * running at half system clock, both with interrupt output or-ed to PF8. Change to
339 * suit different FPGA configuration, or to suit real 16550 UARTS connected to the bus
340 */
341
342static struct plat_serial8250_port serial8250_platform_data [] = {
343 {
344 .membase = 0x20200000,
345 .mapbase = 0x20200000,
346 .irq = IRQ_PF8,
347 .flags = UPF_BOOT_AUTOCONF | UART_CONFIG_TYPE,
348 .iotype = UPIO_MEM,
349 .regshift = 1,
350 .uartclk = 66666667,
351 }, {
352 .membase = 0x20200010,
353 .mapbase = 0x20200010,
354 .irq = IRQ_PF8,
355 .flags = UPF_BOOT_AUTOCONF | UART_CONFIG_TYPE,
356 .iotype = UPIO_MEM,
357 .regshift = 1,
358 .uartclk = 66666667,
359 }, {
360 }
361};
362
363static struct platform_device serial8250_device = {
364 .id = PLAT8250_DEV_PLATFORM,
365 .name = "serial8250",
366 .dev = {
367 .platform_data = serial8250_platform_data,
368 },
369};
370
371#endif
372
Javier Herrero7a5f8192008-01-27 19:53:08 +0800373#if defined(CONFIG_KEYBOARD_OPENCORES) || defined(CONFIG_KEYBOARD_OPENCORES_MODULE)
374
375/*
376 * Configuration for one OpenCores keyboard controller in FPGA at address 0x20200030,
377 * interrupt output wired to PF9. Change to suit different FPGA configuration
378 */
379
380static struct resource opencores_kbd_resources[] = {
381 [0] = {
382 .start = 0x20200030,
383 .end = 0x20300030 + 2,
384 .flags = IORESOURCE_MEM,
385 },
386 [1] = {
387 .start = IRQ_PF9,
388 .end = IRQ_PF9,
389 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
390 },
391};
392
393static struct platform_device opencores_kbd_device = {
394 .id = -1,
395 .name = "opencores-kbd",
396 .resource = opencores_kbd_resources,
397 .num_resources = ARRAY_SIZE(opencores_kbd_resources),
398};
399#endif
400
Javier Herrerofb96c562007-12-21 18:26:44 +0800401static struct platform_device *h8606_devices[] __initdata = {
Javier Herreroab472a02007-10-29 16:14:44 +0800402#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
403 &rtc_device,
404#endif
405
406#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
407 &dm9000_device,
408#endif
409
410#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
411 &smc91x_device,
412#endif
413
414#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
415 &net2272_bfin_device,
416#endif
417
418#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
419 &bfin_spi0_device,
420#endif
421
422#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
423 &bfin_uart_device,
424#endif
Javier Herrerofb96c562007-12-21 18:26:44 +0800425
426#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
427 &serial8250_device,
428#endif
Javier Herrero7a5f8192008-01-27 19:53:08 +0800429
Graf Yang5be36d22008-04-25 03:09:15 +0800430#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
431 &bfin_sir_device,
432#endif
433
Javier Herrero7a5f8192008-01-27 19:53:08 +0800434#if defined(CONFIG_KEYBOARD_OPENCORES) || defined(CONFIG_KEYBOARD_OPENCORES_MODULE)
435 &opencores_kbd_device,
436#endif
Javier Herreroab472a02007-10-29 16:14:44 +0800437};
438
439static int __init H8606_init(void)
440{
441 printk(KERN_INFO "HV Sistemas H8606 board support by http://www.hvsistemas.com\n");
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800442 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Javier Herrerofb96c562007-12-21 18:26:44 +0800443 platform_add_devices(h8606_devices, ARRAY_SIZE(h8606_devices));
Javier Herreroab472a02007-10-29 16:14:44 +0800444#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
445 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
446#endif
447 return 0;
448}
449
Mike Frysinger0feea172007-11-15 21:10:42 +0800450arch_initcall(H8606_init);