2 * Copyright 2004-2009 Analog Devices Inc.
3 * 2008-2009 Bluetechnix
4 * 2005 National ICT Australia (NICTA)
5 * Aidan Williams <aidan@nicta.com.au>
7 * Licensed under the GPL-2 or later.
10 #include <linux/device.h>
11 #include <linux/platform_device.h>
12 #include <linux/mtd/mtd.h>
13 #include <linux/mtd/partitions.h>
14 #include <linux/spi/spi.h>
15 #include <linux/spi/flash.h>
16 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
17 #include <linux/usb/isp1362.h>
19 #include <linux/ata_platform.h>
20 #include <linux/irq.h>
22 #include <asm/bfin5xx_spi.h>
23 #include <asm/portmux.h>
25 #include <linux/mtd/physmap.h>
28 * Name the Board for the /proc/cpuinfo
30 const char bfin_board_name
[] = "Bluetechnix CM BF561";
32 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
33 /* all SPI peripherals info goes here */
35 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
36 static struct mtd_partition bfin_spi_flash_partitions
[] = {
38 .name
= "bootloader(spi)",
41 .mask_flags
= MTD_CAP_ROM
43 .name
= "linux kernel(spi)",
47 .name
= "file system(spi)",
53 static struct flash_platform_data bfin_spi_flash_data
= {
55 .parts
= bfin_spi_flash_partitions
,
56 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
60 /* SPI flash chip (m25p64) */
61 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
62 .enable_dma
= 0, /* use dma transfer with this chip*/
67 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
69 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
70 .enable_dma
= 1, /* use dma transfer with this chip*/
75 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
76 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
82 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
83 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
89 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
90 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
92 /* the modalias must be the same as spi device driver name */
93 .modalias
= "m25p80", /* Name of spi_driver for this device */
94 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
95 .bus_num
= 0, /* Framework bus number */
96 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
97 .platform_data
= &bfin_spi_flash_data
,
98 .controller_data
= &spi_flash_chip_info
,
103 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
105 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
106 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
107 .bus_num
= 0, /* Framework bus number */
108 .chip_select
= 1, /* Framework chip select. */
109 .platform_data
= NULL
, /* No spi_driver specific config */
110 .controller_data
= &spi_adc_chip_info
,
114 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
116 .modalias
= "ad183x",
117 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
120 .controller_data
= &ad1836_spi_chip_info
,
123 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
125 .modalias
= "mmc_spi",
126 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
129 .controller_data
= &mmc_spi_chip_info
,
136 static struct resource bfin_spi0_resource
[] = {
138 .start
= SPI0_REGBASE
,
139 .end
= SPI0_REGBASE
+ 0xFF,
140 .flags
= IORESOURCE_MEM
,
145 .flags
= IORESOURCE_DMA
,
150 .flags
= IORESOURCE_IRQ
,
154 /* SPI controller data */
155 static struct bfin5xx_spi_master bfin_spi0_info
= {
157 .enable_dma
= 1, /* master has the ability to do dma transfer */
158 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
161 static struct platform_device bfin_spi0_device
= {
163 .id
= 0, /* Bus number */
164 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
165 .resource
= bfin_spi0_resource
,
167 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
170 #endif /* spi master and devices */
173 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
174 static struct platform_device hitachi_fb_device
= {
175 .name
= "hitachi-tx09",
180 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
181 #include <linux/smc91x.h>
183 static struct smc91x_platdata smc91x_info
= {
184 .flags
= SMC91X_USE_32BIT
| SMC91X_NOWAIT
,
185 .leda
= RPC_LED_100_10
,
186 .ledb
= RPC_LED_TX_RX
,
189 static struct resource smc91x_resources
[] = {
191 .name
= "smc91x-regs",
193 .end
= 0x28000300 + 16,
194 .flags
= IORESOURCE_MEM
,
198 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
201 static struct platform_device smc91x_device
= {
204 .num_resources
= ARRAY_SIZE(smc91x_resources
),
205 .resource
= smc91x_resources
,
207 .platform_data
= &smc91x_info
,
212 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
213 #include <linux/smsc911x.h>
215 static struct resource smsc911x_resources
[] = {
217 .name
= "smsc911x-memory",
219 .end
= 0x24008000 + 0xFF,
220 .flags
= IORESOURCE_MEM
,
225 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
229 static struct smsc911x_platform_config smsc911x_config
= {
230 .flags
= SMSC911X_USE_16BIT
,
231 .irq_polarity
= SMSC911X_IRQ_POLARITY_ACTIVE_LOW
,
232 .irq_type
= SMSC911X_IRQ_TYPE_OPEN_DRAIN
,
233 .phy_interface
= PHY_INTERFACE_MODE_MII
,
236 static struct platform_device smsc911x_device
= {
239 .num_resources
= ARRAY_SIZE(smsc911x_resources
),
240 .resource
= smsc911x_resources
,
242 .platform_data
= &smsc911x_config
,
247 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
248 static struct resource net2272_bfin_resources
[] = {
251 .end
= 0x24000000 + 0x100,
252 .flags
= IORESOURCE_MEM
,
256 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
260 static struct platform_device net2272_bfin_device
= {
263 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
264 .resource
= net2272_bfin_resources
,
268 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
269 static struct resource isp1362_hcd_resources
[] = {
273 .flags
= IORESOURCE_MEM
,
277 .flags
= IORESOURCE_MEM
,
281 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
285 static struct isp1362_platform_data isp1362_priv
= {
290 .int_edge_triggered
= 0,
291 .remote_wakeup_connected
= 0,
292 .no_power_switching
= 1,
293 .power_switching_mode
= 0,
296 static struct platform_device isp1362_hcd_device
= {
297 .name
= "isp1362-hcd",
300 .platform_data
= &isp1362_priv
,
302 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
303 .resource
= isp1362_hcd_resources
,
307 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
308 #ifdef CONFIG_SERIAL_BFIN_UART0
309 static struct resource bfin_uart0_resources
[] = {
311 .start
= BFIN_UART_THR
,
312 .end
= BFIN_UART_GCTL
+2,
313 .flags
= IORESOURCE_MEM
,
316 .start
= IRQ_UART_RX
,
317 .end
= IRQ_UART_RX
+1,
318 .flags
= IORESOURCE_IRQ
,
321 .start
= IRQ_UART_ERROR
,
322 .end
= IRQ_UART_ERROR
,
323 .flags
= IORESOURCE_IRQ
,
328 .flags
= IORESOURCE_DMA
,
333 .flags
= IORESOURCE_DMA
,
337 unsigned short bfin_uart0_peripherals
[] = {
338 P_UART0_TX
, P_UART0_RX
, 0
341 static struct platform_device bfin_uart0_device
= {
344 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
345 .resource
= bfin_uart0_resources
,
347 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
353 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
354 #ifdef CONFIG_BFIN_SIR0
355 static struct resource bfin_sir0_resources
[] = {
359 .flags
= IORESOURCE_MEM
,
362 .start
= IRQ_UART0_RX
,
363 .end
= IRQ_UART0_RX
+1,
364 .flags
= IORESOURCE_IRQ
,
367 .start
= CH_UART0_RX
,
368 .end
= CH_UART0_RX
+1,
369 .flags
= IORESOURCE_DMA
,
373 static struct platform_device bfin_sir0_device
= {
376 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
377 .resource
= bfin_sir0_resources
,
382 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
383 #define PATA_INT IRQ_PF46
385 static struct pata_platform_info bfin_pata_platform_data
= {
387 .irq_type
= IRQF_TRIGGER_HIGH
| IRQF_DISABLED
,
390 static struct resource bfin_pata_resources
[] = {
394 .flags
= IORESOURCE_MEM
,
399 .flags
= IORESOURCE_MEM
,
404 .flags
= IORESOURCE_IRQ
,
408 static struct platform_device bfin_pata_device
= {
409 .name
= "pata_platform",
411 .num_resources
= ARRAY_SIZE(bfin_pata_resources
),
412 .resource
= bfin_pata_resources
,
414 .platform_data
= &bfin_pata_platform_data
,
419 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
420 static struct mtd_partition para_partitions
[] = {
422 .name
= "bootloader(nor)",
426 .name
= "linux kernel(nor)",
428 .offset
= MTDPART_OFS_APPEND
,
430 .name
= "file system(nor)",
431 .size
= MTDPART_SIZ_FULL
,
432 .offset
= MTDPART_OFS_APPEND
,
436 static struct physmap_flash_data para_flash_data
= {
438 .parts
= para_partitions
,
439 .nr_parts
= ARRAY_SIZE(para_partitions
),
442 static struct resource para_flash_resource
= {
445 .flags
= IORESOURCE_MEM
,
448 static struct platform_device para_flash_device
= {
449 .name
= "physmap-flash",
452 .platform_data
= ¶_flash_data
,
455 .resource
= ¶_flash_resource
,
459 static const unsigned int cclk_vlev_datasheet
[] =
461 VRPAIR(VLEV_085
, 250000000),
462 VRPAIR(VLEV_090
, 300000000),
463 VRPAIR(VLEV_095
, 313000000),
464 VRPAIR(VLEV_100
, 350000000),
465 VRPAIR(VLEV_105
, 400000000),
466 VRPAIR(VLEV_110
, 444000000),
467 VRPAIR(VLEV_115
, 450000000),
468 VRPAIR(VLEV_120
, 475000000),
469 VRPAIR(VLEV_125
, 500000000),
470 VRPAIR(VLEV_130
, 600000000),
473 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
474 .tuple_tab
= cclk_vlev_datasheet
,
475 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
476 .vr_settling_time
= 25 /* us */,
479 static struct platform_device bfin_dpmc
= {
482 .platform_data
= &bfin_dmpc_vreg_data
,
486 static struct platform_device
*cm_bf561_devices
[] __initdata
= {
490 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
494 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
495 #ifdef CONFIG_SERIAL_BFIN_UART0
500 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
501 #ifdef CONFIG_BFIN_SIR0
506 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
510 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
514 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
518 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
519 &net2272_bfin_device
,
522 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
526 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
530 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
535 static int __init
cm_bf561_init(void)
537 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
538 platform_add_devices(cm_bf561_devices
, ARRAY_SIZE(cm_bf561_devices
));
539 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
540 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
543 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
544 irq_desc
[PATA_INT
].status
|= IRQ_NOAUTOEN
;
549 arch_initcall(cm_bf561_init
);
551 static struct platform_device
*cm_bf561_early_devices
[] __initdata
= {
552 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
553 #ifdef CONFIG_SERIAL_BFIN_UART0
559 void __init
native_machine_early_platform_add_devices(void)
561 printk(KERN_INFO
"register early platform devices\n");
562 early_platform_add_devices(cm_bf561_early_devices
,
563 ARRAY_SIZE(cm_bf561_early_devices
));