2 * Copyright 2004-2009 Analog Devices Inc.
3 * 2007-2008 HV Sistemas S.L.
4 * Javier Herrero <jherrero@hvsistemas.es>
5 * 2005 National ICT Australia (NICTA)
6 * Aidan Williams <aidan@nicta.com.au>
8 * Licensed under the GPL-2 or later.
11 #include <linux/device.h>
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/spi/spi.h>
16 #include <linux/spi/flash.h>
17 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
18 #include <linux/usb/isp1362.h>
20 #include <linux/irq.h>
23 #include <asm/bfin5xx_spi.h>
24 #include <asm/reboot.h>
25 #include <asm/portmux.h>
28 * Name the Board for the /proc/cpuinfo
30 const char bfin_board_name[] = "HV Sistemas H8606";
32 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
33 static struct platform_device rtc_device = {
40 * Driver needs to know address, irq and flag pin.
42 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
43 static struct resource dm9000_resources[] = {
47 .flags = IORESOURCE_MEM,
52 .flags = IORESOURCE_MEM,
57 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | IRQF_SHARED | IRQF_TRIGGER_HIGH),
61 static struct platform_device dm9000_device = {
64 .resource = dm9000_resources,
65 .num_resources = ARRAY_SIZE(dm9000_resources),
69 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
70 #include <linux/smc91x.h>
72 static struct smc91x_platdata smc91x_info = {
73 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
74 .leda = RPC_LED_100_10,
75 .ledb = RPC_LED_TX_RX,
78 static struct resource smc91x_resources[] = {
80 .name = "smc91x-regs",
82 .end = 0x20300300 + 16,
83 .flags = IORESOURCE_MEM,
85 .start = IRQ_PROG_INTB,
87 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
91 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
95 static struct platform_device smc91x_device = {
98 .num_resources = ARRAY_SIZE(smc91x_resources),
99 .resource = smc91x_resources,
101 .platform_data = &smc91x_info,
106 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
107 static struct resource net2272_bfin_resources[] = {
110 .end = 0x20300000 + 0x100,
111 .flags = IORESOURCE_MEM,
115 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
119 static struct platform_device net2272_bfin_device = {
122 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
123 .resource = net2272_bfin_resources,
127 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
128 /* all SPI peripherals info goes here */
130 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
131 static struct mtd_partition bfin_spi_flash_partitions[] = {
133 .name = "bootloader (spi)",
136 .mask_flags = MTD_CAP_ROM
138 .name = "fpga (spi)",
142 .name = "linux kernel (spi)",
146 .name = "jffs2 root file system (spi)",
152 static struct flash_platform_data bfin_spi_flash_data = {
154 .parts = bfin_spi_flash_partitions,
155 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
159 /* SPI flash chip (m25p64) */
160 static struct bfin5xx_spi_chip spi_flash_chip_info = {
161 .enable_dma = 0, /* use dma transfer with this chip*/
166 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
168 static struct bfin5xx_spi_chip spi_adc_chip_info = {
170 .enable_dma = 1, /* use dma transfer with this chip*/
175 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
176 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
183 /* Notice: for blackfin, the speed_hz is the value of register
184 * SPI_BAUD, not the real baudrate */
185 static struct spi_board_info bfin_spi_board_info[] __initdata = {
186 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
188 /* the modalias must be the same as spi device driver name */
189 .modalias = "m25p80", /* Name of spi_driver for this device */
190 /* this value is the baudrate divisor */
191 .max_speed_hz = 50000000, /* actual baudrate is SCLK/(2xspeed_hz) */
192 .bus_num = 0, /* Framework bus number */
193 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
194 .platform_data = &bfin_spi_flash_data,
195 .controller_data = &spi_flash_chip_info,
200 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
202 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
203 .max_speed_hz = 4, /* actual baudrate is SCLK/(2xspeed_hz) */
204 .bus_num = 1, /* Framework bus number */
205 .chip_select = 1, /* Framework chip select. */
206 .platform_data = NULL, /* No spi_driver specific config */
207 .controller_data = &spi_adc_chip_info,
211 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
213 .modalias = "ad1836",
216 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
217 .controller_data = &ad1836_spi_chip_info,
224 static struct resource bfin_spi0_resource[] = {
226 .start = SPI0_REGBASE,
227 .end = SPI0_REGBASE + 0xFF,
228 .flags = IORESOURCE_MEM,
233 .flags = IORESOURCE_DMA,
238 .flags = IORESOURCE_IRQ,
243 /* SPI controller data */
244 static struct bfin5xx_spi_master bfin_spi0_info = {
246 .enable_dma = 1, /* master has the ability to do dma transfer */
247 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
250 static struct platform_device bfin_spi0_device = {
252 .id = 0, /* Bus number */
253 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
254 .resource = bfin_spi0_resource,
256 .platform_data = &bfin_spi0_info, /* Passed to driver */
259 #endif /* spi master and devices */
261 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
262 static struct platform_device bfin_fb_device = {
267 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
268 static struct resource bfin_uart_resources[] = {
272 .flags = IORESOURCE_MEM,
276 static struct platform_device bfin_uart_device = {
279 .num_resources = ARRAY_SIZE(bfin_uart_resources),
280 .resource = bfin_uart_resources,
284 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
285 #ifdef CONFIG_BFIN_SIR0
286 static struct resource bfin_sir0_resources[] = {
290 .flags = IORESOURCE_MEM,
293 .start = IRQ_UART0_RX,
294 .end = IRQ_UART0_RX+1,
295 .flags = IORESOURCE_IRQ,
298 .start = CH_UART0_RX,
299 .end = CH_UART0_RX+1,
300 .flags = IORESOURCE_DMA,
304 static struct platform_device bfin_sir0_device = {
307 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
308 .resource = bfin_sir0_resources,
313 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
315 #include <linux/serial_8250.h>
316 #include <linux/serial.h>
319 * Configuration for two 16550 UARTS in FPGA at addresses 0x20200000 and 0x202000010.
320 * running at half system clock, both with interrupt output or-ed to PF8. Change to
321 * suit different FPGA configuration, or to suit real 16550 UARTS connected to the bus
324 static struct plat_serial8250_port serial8250_platform_data [] = {
326 .membase = (void *)0x20200000,
327 .mapbase = 0x20200000,
329 .flags = UPF_BOOT_AUTOCONF | UART_CONFIG_TYPE,
334 .membase = (void *)0x20200010,
335 .mapbase = 0x20200010,
337 .flags = UPF_BOOT_AUTOCONF | UART_CONFIG_TYPE,
345 static struct platform_device serial8250_device = {
346 .id = PLAT8250_DEV_PLATFORM,
347 .name = "serial8250",
349 .platform_data = serial8250_platform_data,
355 #if defined(CONFIG_KEYBOARD_OPENCORES) || defined(CONFIG_KEYBOARD_OPENCORES_MODULE)
358 * Configuration for one OpenCores keyboard controller in FPGA at address 0x20200030,
359 * interrupt output wired to PF9. Change to suit different FPGA configuration
362 static struct resource opencores_kbd_resources[] = {
365 .end = 0x20300030 + 2,
366 .flags = IORESOURCE_MEM,
371 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
375 static struct platform_device opencores_kbd_device = {
377 .name = "opencores-kbd",
378 .resource = opencores_kbd_resources,
379 .num_resources = ARRAY_SIZE(opencores_kbd_resources),
383 static struct platform_device *h8606_devices[] __initdata = {
384 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
388 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
392 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
396 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
397 &net2272_bfin_device,
400 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
404 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
408 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
412 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
413 #ifdef CONFIG_BFIN_SIR0
418 #if defined(CONFIG_KEYBOARD_OPENCORES) || defined(CONFIG_KEYBOARD_OPENCORES_MODULE)
419 &opencores_kbd_device,
423 static int __init H8606_init(void)
425 printk(KERN_INFO "HV Sistemas H8606 board support by http://www.hvsistemas.com\n");
426 printk(KERN_INFO "%s(): registering device resources\n", __func__);
427 platform_add_devices(h8606_devices, ARRAY_SIZE(h8606_devices));
428 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
429 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
434 arch_initcall(H8606_init);