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/mtd/physmap.h>
15 #include <linux/spi/spi.h>
16 #include <linux/spi/flash.h>
17 #include <linux/spi/mmc_spi.h>
18 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
19 #include <linux/usb/isp1362.h>
21 #include <linux/irq.h>
23 #include <asm/bfin5xx_spi.h>
24 #include <asm/portmux.h>
28 * Name the Board for the /proc/cpuinfo
30 const char bfin_board_name
[] = "Bluetechnix CM BF533";
32 #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
33 /* all SPI peripherals info goes here */
34 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
35 static struct mtd_partition bfin_spi_flash_partitions
[] = {
37 .name
= "bootloader(spi)",
40 .mask_flags
= MTD_CAP_ROM
42 .name
= "linux kernel(spi)",
46 .name
= "file system(spi)",
52 static struct flash_platform_data bfin_spi_flash_data
= {
54 .parts
= bfin_spi_flash_partitions
,
55 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
59 /* SPI flash chip (m25p64) */
60 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
61 .enable_dma
= 0, /* use dma transfer with this chip*/
65 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
66 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
71 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
72 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
74 /* the modalias must be the same as spi device driver name */
75 .modalias
= "m25p80", /* Name of spi_driver for this device */
76 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
77 .bus_num
= 0, /* Framework bus number */
78 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
79 .platform_data
= &bfin_spi_flash_data
,
80 .controller_data
= &spi_flash_chip_info
,
85 #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
88 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
94 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
96 .modalias
= "mmc_spi",
97 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
100 .controller_data
= &mmc_spi_chip_info
,
107 static struct resource bfin_spi0_resource
[] = {
109 .start
= SPI0_REGBASE
,
110 .end
= SPI0_REGBASE
+ 0xFF,
111 .flags
= IORESOURCE_MEM
,
116 .flags
= IORESOURCE_DMA
,
121 .flags
= IORESOURCE_IRQ
,
125 /* SPI controller data */
126 static struct bfin5xx_spi_master bfin_spi0_info
= {
128 .enable_dma
= 1, /* master has the ability to do dma transfer */
129 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
132 static struct platform_device bfin_spi0_device
= {
134 .id
= 0, /* Bus number */
135 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
136 .resource
= bfin_spi0_resource
,
138 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
141 #endif /* spi master and devices */
143 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
144 static struct platform_device rtc_device
= {
150 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
151 #include <linux/smc91x.h>
153 static struct smc91x_platdata smc91x_info
= {
154 .flags
= SMC91X_USE_16BIT
| SMC91X_NOWAIT
,
155 .leda
= RPC_LED_100_10
,
156 .ledb
= RPC_LED_TX_RX
,
159 static struct resource smc91x_resources
[] = {
162 .end
= 0x20200300 + 16,
163 .flags
= IORESOURCE_MEM
,
167 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
170 static struct platform_device smc91x_device
= {
173 .num_resources
= ARRAY_SIZE(smc91x_resources
),
174 .resource
= smc91x_resources
,
176 .platform_data
= &smc91x_info
,
181 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
182 #include <linux/smsc911x.h>
184 static struct resource smsc911x_resources
[] = {
186 .name
= "smsc911x-memory",
188 .end
= 0x20308000 + 0xFF,
189 .flags
= IORESOURCE_MEM
,
193 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
197 static struct smsc911x_platform_config smsc911x_config
= {
198 .flags
= SMSC911X_USE_16BIT
,
199 .irq_polarity
= SMSC911X_IRQ_POLARITY_ACTIVE_LOW
,
200 .irq_type
= SMSC911X_IRQ_TYPE_OPEN_DRAIN
,
201 .phy_interface
= PHY_INTERFACE_MODE_MII
,
204 static struct platform_device smsc911x_device
= {
207 .num_resources
= ARRAY_SIZE(smsc911x_resources
),
208 .resource
= smsc911x_resources
,
210 .platform_data
= &smsc911x_config
,
215 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
216 #ifdef CONFIG_SERIAL_BFIN_UART0
217 static struct resource bfin_uart0_resources
[] = {
219 .start
= BFIN_UART_THR
,
220 .end
= BFIN_UART_GCTL
+2,
221 .flags
= IORESOURCE_MEM
,
224 .start
= IRQ_UART0_TX
,
226 .flags
= IORESOURCE_IRQ
,
229 .start
= IRQ_UART0_RX
,
231 .flags
= IORESOURCE_IRQ
,
234 .start
= IRQ_UART0_ERROR
,
235 .end
= IRQ_UART0_ERROR
,
236 .flags
= IORESOURCE_IRQ
,
239 .start
= CH_UART0_TX
,
241 .flags
= IORESOURCE_DMA
,
244 .start
= CH_UART0_RX
,
246 .flags
= IORESOURCE_DMA
,
250 static unsigned short bfin_uart0_peripherals
[] = {
251 P_UART0_TX
, P_UART0_RX
, 0
254 static struct platform_device bfin_uart0_device
= {
257 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
258 .resource
= bfin_uart0_resources
,
260 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
266 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
267 #ifdef CONFIG_BFIN_SIR0
268 static struct resource bfin_sir0_resources
[] = {
272 .flags
= IORESOURCE_MEM
,
275 .start
= IRQ_UART0_RX
,
276 .end
= IRQ_UART0_RX
+1,
277 .flags
= IORESOURCE_IRQ
,
280 .start
= CH_UART0_RX
,
281 .end
= CH_UART0_RX
+1,
282 .flags
= IORESOURCE_DMA
,
286 static struct platform_device bfin_sir0_device
= {
289 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
290 .resource
= bfin_sir0_resources
,
295 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
296 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
297 static struct resource bfin_sport0_uart_resources
[] = {
299 .start
= SPORT0_TCR1
,
300 .end
= SPORT0_MRCS3
+4,
301 .flags
= IORESOURCE_MEM
,
304 .start
= IRQ_SPORT0_RX
,
305 .end
= IRQ_SPORT0_RX
+1,
306 .flags
= IORESOURCE_IRQ
,
309 .start
= IRQ_SPORT0_ERROR
,
310 .end
= IRQ_SPORT0_ERROR
,
311 .flags
= IORESOURCE_IRQ
,
315 static unsigned short bfin_sport0_peripherals
[] = {
316 P_SPORT0_TFS
, P_SPORT0_DTPRI
, P_SPORT0_TSCLK
, P_SPORT0_RFS
,
317 P_SPORT0_DRPRI
, P_SPORT0_RSCLK
, 0
320 static struct platform_device bfin_sport0_uart_device
= {
321 .name
= "bfin-sport-uart",
323 .num_resources
= ARRAY_SIZE(bfin_sport0_uart_resources
),
324 .resource
= bfin_sport0_uart_resources
,
326 .platform_data
= &bfin_sport0_peripherals
, /* Passed to driver */
330 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
331 static struct resource bfin_sport1_uart_resources
[] = {
333 .start
= SPORT1_TCR1
,
334 .end
= SPORT1_MRCS3
+4,
335 .flags
= IORESOURCE_MEM
,
338 .start
= IRQ_SPORT1_RX
,
339 .end
= IRQ_SPORT1_RX
+1,
340 .flags
= IORESOURCE_IRQ
,
343 .start
= IRQ_SPORT1_ERROR
,
344 .end
= IRQ_SPORT1_ERROR
,
345 .flags
= IORESOURCE_IRQ
,
349 static unsigned short bfin_sport1_peripherals
[] = {
350 P_SPORT1_TFS
, P_SPORT1_DTPRI
, P_SPORT1_TSCLK
, P_SPORT1_RFS
,
351 P_SPORT1_DRPRI
, P_SPORT1_RSCLK
, 0
354 static struct platform_device bfin_sport1_uart_device
= {
355 .name
= "bfin-sport-uart",
357 .num_resources
= ARRAY_SIZE(bfin_sport1_uart_resources
),
358 .resource
= bfin_sport1_uart_resources
,
360 .platform_data
= &bfin_sport1_peripherals
, /* Passed to driver */
366 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
367 static struct resource isp1362_hcd_resources
[] = {
371 .flags
= IORESOURCE_MEM
,
375 .flags
= IORESOURCE_MEM
,
379 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWEDGE
,
383 static struct isp1362_platform_data isp1362_priv
= {
388 .int_edge_triggered
= 0,
389 .remote_wakeup_connected
= 0,
390 .no_power_switching
= 1,
391 .power_switching_mode
= 0,
394 static struct platform_device isp1362_hcd_device
= {
395 .name
= "isp1362-hcd",
398 .platform_data
= &isp1362_priv
,
400 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
401 .resource
= isp1362_hcd_resources
,
406 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
407 static struct resource net2272_bfin_resources
[] = {
410 .end
= 0x20300000 + 0x100,
411 .flags
= IORESOURCE_MEM
,
415 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
419 static struct platform_device net2272_bfin_device
= {
422 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
423 .resource
= net2272_bfin_resources
,
429 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
430 static struct mtd_partition para_partitions
[] = {
432 .name
= "bootloader(nor)",
436 .name
= "linux+rootfs(nor)",
437 .size
= MTDPART_SIZ_FULL
,
438 .offset
= MTDPART_OFS_APPEND
,
442 static struct physmap_flash_data para_flash_data
= {
444 .parts
= para_partitions
,
445 .nr_parts
= ARRAY_SIZE(para_partitions
),
448 static struct resource para_flash_resource
= {
451 .flags
= IORESOURCE_MEM
,
454 static struct platform_device para_flash_device
= {
455 .name
= "physmap-flash",
458 .platform_data
= ¶_flash_data
,
461 .resource
= ¶_flash_resource
,
467 static const unsigned int cclk_vlev_datasheet
[] =
469 VRPAIR(VLEV_085
, 250000000),
470 VRPAIR(VLEV_090
, 376000000),
471 VRPAIR(VLEV_095
, 426000000),
472 VRPAIR(VLEV_100
, 426000000),
473 VRPAIR(VLEV_105
, 476000000),
474 VRPAIR(VLEV_110
, 476000000),
475 VRPAIR(VLEV_115
, 476000000),
476 VRPAIR(VLEV_120
, 600000000),
477 VRPAIR(VLEV_125
, 600000000),
478 VRPAIR(VLEV_130
, 600000000),
481 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
482 .tuple_tab
= cclk_vlev_datasheet
,
483 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
484 .vr_settling_time
= 25 /* us */,
487 static struct platform_device bfin_dpmc
= {
490 .platform_data
= &bfin_dmpc_vreg_data
,
494 static struct platform_device
*cm_bf533_devices
[] __initdata
= {
498 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
499 #ifdef CONFIG_SERIAL_BFIN_UART0
504 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
505 #ifdef CONFIG_BFIN_SIR0
510 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
511 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
512 &bfin_sport0_uart_device
,
514 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
515 &bfin_sport1_uart_device
,
519 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
523 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
527 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
531 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
535 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
536 &net2272_bfin_device
,
539 #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
543 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
548 static int __init
cm_bf533_init(void)
550 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
551 platform_add_devices(cm_bf533_devices
, ARRAY_SIZE(cm_bf533_devices
));
552 #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
553 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
558 arch_initcall(cm_bf533_init
);
560 static struct platform_device
*cm_bf533_early_devices
[] __initdata
= {
561 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
562 #ifdef CONFIG_SERIAL_BFIN_UART0
567 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
568 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
569 &bfin_sport0_uart_device
,
571 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
572 &bfin_sport1_uart_device
,
577 void __init
native_machine_early_platform_add_devices(void)
579 printk(KERN_INFO
"register early platform devices\n");
580 early_platform_add_devices(cm_bf533_early_devices
,
581 ARRAY_SIZE(cm_bf533_early_devices
));