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_BFIN) || defined(CONFIG_SPI_BFIN_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_RX
,
225 .end
= IRQ_UART0_RX
+ 1,
226 .flags
= IORESOURCE_IRQ
,
229 .start
= IRQ_UART0_ERROR
,
230 .end
= IRQ_UART0_ERROR
,
231 .flags
= IORESOURCE_IRQ
,
234 .start
= CH_UART0_TX
,
236 .flags
= IORESOURCE_DMA
,
239 .start
= CH_UART0_RX
,
241 .flags
= IORESOURCE_DMA
,
245 static unsigned short bfin_uart0_peripherals
[] = {
246 P_UART0_TX
, P_UART0_RX
, 0
249 static struct platform_device bfin_uart0_device
= {
252 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
253 .resource
= bfin_uart0_resources
,
255 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
261 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
262 #ifdef CONFIG_BFIN_SIR0
263 static struct resource bfin_sir0_resources
[] = {
267 .flags
= IORESOURCE_MEM
,
270 .start
= IRQ_UART0_RX
,
271 .end
= IRQ_UART0_RX
+1,
272 .flags
= IORESOURCE_IRQ
,
275 .start
= CH_UART0_RX
,
276 .end
= CH_UART0_RX
+1,
277 .flags
= IORESOURCE_DMA
,
281 static struct platform_device bfin_sir0_device
= {
284 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
285 .resource
= bfin_sir0_resources
,
290 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
291 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
292 static struct resource bfin_sport0_uart_resources
[] = {
294 .start
= SPORT0_TCR1
,
295 .end
= SPORT0_MRCS3
+4,
296 .flags
= IORESOURCE_MEM
,
299 .start
= IRQ_SPORT0_RX
,
300 .end
= IRQ_SPORT0_RX
+1,
301 .flags
= IORESOURCE_IRQ
,
304 .start
= IRQ_SPORT0_ERROR
,
305 .end
= IRQ_SPORT0_ERROR
,
306 .flags
= IORESOURCE_IRQ
,
310 static unsigned short bfin_sport0_peripherals
[] = {
311 P_SPORT0_TFS
, P_SPORT0_DTPRI
, P_SPORT0_TSCLK
, P_SPORT0_RFS
,
312 P_SPORT0_DRPRI
, P_SPORT0_RSCLK
, 0
315 static struct platform_device bfin_sport0_uart_device
= {
316 .name
= "bfin-sport-uart",
318 .num_resources
= ARRAY_SIZE(bfin_sport0_uart_resources
),
319 .resource
= bfin_sport0_uart_resources
,
321 .platform_data
= &bfin_sport0_peripherals
, /* Passed to driver */
325 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
326 static struct resource bfin_sport1_uart_resources
[] = {
328 .start
= SPORT1_TCR1
,
329 .end
= SPORT1_MRCS3
+4,
330 .flags
= IORESOURCE_MEM
,
333 .start
= IRQ_SPORT1_RX
,
334 .end
= IRQ_SPORT1_RX
+1,
335 .flags
= IORESOURCE_IRQ
,
338 .start
= IRQ_SPORT1_ERROR
,
339 .end
= IRQ_SPORT1_ERROR
,
340 .flags
= IORESOURCE_IRQ
,
344 static unsigned short bfin_sport1_peripherals
[] = {
345 P_SPORT1_TFS
, P_SPORT1_DTPRI
, P_SPORT1_TSCLK
, P_SPORT1_RFS
,
346 P_SPORT1_DRPRI
, P_SPORT1_RSCLK
, 0
349 static struct platform_device bfin_sport1_uart_device
= {
350 .name
= "bfin-sport-uart",
352 .num_resources
= ARRAY_SIZE(bfin_sport1_uart_resources
),
353 .resource
= bfin_sport1_uart_resources
,
355 .platform_data
= &bfin_sport1_peripherals
, /* Passed to driver */
361 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
362 static struct resource isp1362_hcd_resources
[] = {
366 .flags
= IORESOURCE_MEM
,
370 .flags
= IORESOURCE_MEM
,
374 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWEDGE
,
378 static struct isp1362_platform_data isp1362_priv
= {
383 .int_edge_triggered
= 0,
384 .remote_wakeup_connected
= 0,
385 .no_power_switching
= 1,
386 .power_switching_mode
= 0,
389 static struct platform_device isp1362_hcd_device
= {
390 .name
= "isp1362-hcd",
393 .platform_data
= &isp1362_priv
,
395 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
396 .resource
= isp1362_hcd_resources
,
401 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
402 static struct resource net2272_bfin_resources
[] = {
405 .end
= 0x20300000 + 0x100,
406 .flags
= IORESOURCE_MEM
,
410 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
414 static struct platform_device net2272_bfin_device
= {
417 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
418 .resource
= net2272_bfin_resources
,
424 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
425 static struct mtd_partition para_partitions
[] = {
427 .name
= "bootloader(nor)",
431 .name
= "linux+rootfs(nor)",
432 .size
= MTDPART_SIZ_FULL
,
433 .offset
= MTDPART_OFS_APPEND
,
437 static struct physmap_flash_data para_flash_data
= {
439 .parts
= para_partitions
,
440 .nr_parts
= ARRAY_SIZE(para_partitions
),
443 static struct resource para_flash_resource
= {
446 .flags
= IORESOURCE_MEM
,
449 static struct platform_device para_flash_device
= {
450 .name
= "physmap-flash",
453 .platform_data
= ¶_flash_data
,
456 .resource
= ¶_flash_resource
,
462 static const unsigned int cclk_vlev_datasheet
[] =
464 VRPAIR(VLEV_085
, 250000000),
465 VRPAIR(VLEV_090
, 376000000),
466 VRPAIR(VLEV_095
, 426000000),
467 VRPAIR(VLEV_100
, 426000000),
468 VRPAIR(VLEV_105
, 476000000),
469 VRPAIR(VLEV_110
, 476000000),
470 VRPAIR(VLEV_115
, 476000000),
471 VRPAIR(VLEV_120
, 600000000),
472 VRPAIR(VLEV_125
, 600000000),
473 VRPAIR(VLEV_130
, 600000000),
476 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
477 .tuple_tab
= cclk_vlev_datasheet
,
478 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
479 .vr_settling_time
= 25 /* us */,
482 static struct platform_device bfin_dpmc
= {
485 .platform_data
= &bfin_dmpc_vreg_data
,
489 static struct platform_device
*cm_bf533_devices
[] __initdata
= {
493 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
494 #ifdef CONFIG_SERIAL_BFIN_UART0
499 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
500 #ifdef CONFIG_BFIN_SIR0
505 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
506 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
507 &bfin_sport0_uart_device
,
509 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
510 &bfin_sport1_uart_device
,
514 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
518 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
522 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
526 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
530 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
531 &net2272_bfin_device
,
534 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
538 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
543 static int __init
cm_bf533_init(void)
545 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
546 platform_add_devices(cm_bf533_devices
, ARRAY_SIZE(cm_bf533_devices
));
547 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
548 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
553 arch_initcall(cm_bf533_init
);
555 static struct platform_device
*cm_bf533_early_devices
[] __initdata
= {
556 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
557 #ifdef CONFIG_SERIAL_BFIN_UART0
562 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
563 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
564 &bfin_sport0_uart_device
,
566 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
567 &bfin_sport1_uart_device
,
572 void __init
native_machine_early_platform_add_devices(void)
574 printk(KERN_INFO
"register early platform devices\n");
575 early_platform_add_devices(cm_bf533_early_devices
,
576 ARRAY_SIZE(cm_bf533_early_devices
));