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_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_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*/
66 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
67 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
69 /* the modalias must be the same as spi device driver name */
70 .modalias
= "m25p80", /* Name of spi_driver for this device */
71 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
72 .bus_num
= 0, /* Framework bus number */
73 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
74 .platform_data
= &bfin_spi_flash_data
,
75 .controller_data
= &spi_flash_chip_info
,
80 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
83 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
88 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
90 .modalias
= "mmc_spi",
91 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
100 static struct resource bfin_spi0_resource
[] = {
102 .start
= SPI0_REGBASE
,
103 .end
= SPI0_REGBASE
+ 0xFF,
104 .flags
= IORESOURCE_MEM
,
109 .flags
= IORESOURCE_DMA
,
114 .flags
= IORESOURCE_IRQ
,
118 /* SPI controller data */
119 static struct bfin5xx_spi_master bfin_spi0_info
= {
121 .enable_dma
= 1, /* master has the ability to do dma transfer */
122 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
125 static struct platform_device bfin_spi0_device
= {
127 .id
= 0, /* Bus number */
128 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
129 .resource
= bfin_spi0_resource
,
131 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
134 #endif /* spi master and devices */
137 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
138 static struct platform_device hitachi_fb_device
= {
139 .name
= "hitachi-tx09",
144 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
145 #include <linux/smc91x.h>
147 static struct smc91x_platdata smc91x_info
= {
148 .flags
= SMC91X_USE_32BIT
| SMC91X_NOWAIT
,
149 .leda
= RPC_LED_100_10
,
150 .ledb
= RPC_LED_TX_RX
,
153 static struct resource smc91x_resources
[] = {
155 .name
= "smc91x-regs",
157 .end
= 0x28000300 + 16,
158 .flags
= IORESOURCE_MEM
,
162 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
165 static struct platform_device smc91x_device
= {
168 .num_resources
= ARRAY_SIZE(smc91x_resources
),
169 .resource
= smc91x_resources
,
171 .platform_data
= &smc91x_info
,
176 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
177 #include <linux/smsc911x.h>
179 static struct resource smsc911x_resources
[] = {
181 .name
= "smsc911x-memory",
183 .end
= 0x24008000 + 0xFF,
184 .flags
= IORESOURCE_MEM
,
189 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
193 static struct smsc911x_platform_config smsc911x_config
= {
194 .flags
= SMSC911X_USE_16BIT
,
195 .irq_polarity
= SMSC911X_IRQ_POLARITY_ACTIVE_LOW
,
196 .irq_type
= SMSC911X_IRQ_TYPE_OPEN_DRAIN
,
197 .phy_interface
= PHY_INTERFACE_MODE_MII
,
200 static struct platform_device smsc911x_device
= {
203 .num_resources
= ARRAY_SIZE(smsc911x_resources
),
204 .resource
= smsc911x_resources
,
206 .platform_data
= &smsc911x_config
,
211 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
212 static struct resource net2272_bfin_resources
[] = {
215 .end
= 0x24000000 + 0x100,
216 .flags
= IORESOURCE_MEM
,
220 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
224 static struct platform_device net2272_bfin_device
= {
227 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
228 .resource
= net2272_bfin_resources
,
232 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
233 static struct resource isp1362_hcd_resources
[] = {
237 .flags
= IORESOURCE_MEM
,
241 .flags
= IORESOURCE_MEM
,
245 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWEDGE
,
249 static struct isp1362_platform_data isp1362_priv
= {
254 .int_edge_triggered
= 0,
255 .remote_wakeup_connected
= 0,
256 .no_power_switching
= 1,
257 .power_switching_mode
= 0,
260 static struct platform_device isp1362_hcd_device
= {
261 .name
= "isp1362-hcd",
264 .platform_data
= &isp1362_priv
,
266 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
267 .resource
= isp1362_hcd_resources
,
271 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
272 #ifdef CONFIG_SERIAL_BFIN_UART0
273 static struct resource bfin_uart0_resources
[] = {
275 .start
= BFIN_UART_THR
,
276 .end
= BFIN_UART_GCTL
+2,
277 .flags
= IORESOURCE_MEM
,
280 .start
= IRQ_UART_TX
,
282 .flags
= IORESOURCE_IRQ
,
285 .start
= IRQ_UART_RX
,
287 .flags
= IORESOURCE_IRQ
,
290 .start
= IRQ_UART_ERROR
,
291 .end
= IRQ_UART_ERROR
,
292 .flags
= IORESOURCE_IRQ
,
297 .flags
= IORESOURCE_DMA
,
302 .flags
= IORESOURCE_DMA
,
306 static unsigned short bfin_uart0_peripherals
[] = {
307 P_UART0_TX
, P_UART0_RX
, 0
310 static struct platform_device bfin_uart0_device
= {
313 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
314 .resource
= bfin_uart0_resources
,
316 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
322 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
323 #ifdef CONFIG_BFIN_SIR0
324 static struct resource bfin_sir0_resources
[] = {
328 .flags
= IORESOURCE_MEM
,
331 .start
= IRQ_UART0_RX
,
332 .end
= IRQ_UART0_RX
+1,
333 .flags
= IORESOURCE_IRQ
,
336 .start
= CH_UART0_RX
,
337 .end
= CH_UART0_RX
+1,
338 .flags
= IORESOURCE_DMA
,
342 static struct platform_device bfin_sir0_device
= {
345 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
346 .resource
= bfin_sir0_resources
,
351 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
352 #define PATA_INT IRQ_PF46
354 static struct pata_platform_info bfin_pata_platform_data
= {
356 .irq_type
= IRQF_TRIGGER_HIGH
,
359 static struct resource bfin_pata_resources
[] = {
363 .flags
= IORESOURCE_MEM
,
368 .flags
= IORESOURCE_MEM
,
373 .flags
= IORESOURCE_IRQ
,
377 static struct platform_device bfin_pata_device
= {
378 .name
= "pata_platform",
380 .num_resources
= ARRAY_SIZE(bfin_pata_resources
),
381 .resource
= bfin_pata_resources
,
383 .platform_data
= &bfin_pata_platform_data
,
388 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
389 static struct mtd_partition para_partitions
[] = {
391 .name
= "bootloader(nor)",
395 .name
= "linux kernel(nor)",
397 .offset
= MTDPART_OFS_APPEND
,
399 .name
= "file system(nor)",
400 .size
= MTDPART_SIZ_FULL
,
401 .offset
= MTDPART_OFS_APPEND
,
405 static struct physmap_flash_data para_flash_data
= {
407 .parts
= para_partitions
,
408 .nr_parts
= ARRAY_SIZE(para_partitions
),
411 static struct resource para_flash_resource
= {
414 .flags
= IORESOURCE_MEM
,
417 static struct platform_device para_flash_device
= {
418 .name
= "physmap-flash",
421 .platform_data
= ¶_flash_data
,
424 .resource
= ¶_flash_resource
,
428 static const unsigned int cclk_vlev_datasheet
[] =
430 VRPAIR(VLEV_085
, 250000000),
431 VRPAIR(VLEV_090
, 300000000),
432 VRPAIR(VLEV_095
, 313000000),
433 VRPAIR(VLEV_100
, 350000000),
434 VRPAIR(VLEV_105
, 400000000),
435 VRPAIR(VLEV_110
, 444000000),
436 VRPAIR(VLEV_115
, 450000000),
437 VRPAIR(VLEV_120
, 475000000),
438 VRPAIR(VLEV_125
, 500000000),
439 VRPAIR(VLEV_130
, 600000000),
442 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
443 .tuple_tab
= cclk_vlev_datasheet
,
444 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
445 .vr_settling_time
= 25 /* us */,
448 static struct platform_device bfin_dpmc
= {
451 .platform_data
= &bfin_dmpc_vreg_data
,
455 static struct platform_device
*cm_bf561_devices
[] __initdata
= {
459 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
463 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
464 #ifdef CONFIG_SERIAL_BFIN_UART0
469 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
470 #ifdef CONFIG_BFIN_SIR0
475 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
479 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
483 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
487 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
488 &net2272_bfin_device
,
491 #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
495 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
499 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
504 static int __init
net2272_init(void)
506 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
509 ret
= gpio_request(GPIO_PF46
, "net2272");
513 /* Reset USB Chip, PF46 */
514 gpio_direction_output(GPIO_PF46
, 0);
516 gpio_set_value(GPIO_PF46
, 1);
522 static int __init
cm_bf561_init(void)
524 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
525 platform_add_devices(cm_bf561_devices
, ARRAY_SIZE(cm_bf561_devices
));
526 #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
527 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
530 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
531 irq_set_status_flags(PATA_INT
, IRQ_NOAUTOEN
);
535 pr_warning("unable to configure net2272; it probably won't work\n");
540 arch_initcall(cm_bf561_init
);
542 static struct platform_device
*cm_bf561_early_devices
[] __initdata
= {
543 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
544 #ifdef CONFIG_SERIAL_BFIN_UART0
550 void __init
native_machine_early_platform_add_devices(void)
552 printk(KERN_INFO
"register early platform devices\n");
553 early_platform_add_devices(cm_bf561_early_devices
,
554 ARRAY_SIZE(cm_bf561_early_devices
));