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*/
67 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
68 static struct bfin5xx_spi_chip spi_adc_chip_info = {
69 .enable_dma = 1, /* use dma transfer with this chip*/
74 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
75 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
81 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
82 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
88 static struct spi_board_info bfin_spi_board_info[] __initdata = {
89 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
91 /* the modalias must be the same as spi device driver name */
92 .modalias = "m25p80", /* Name of spi_driver for this device */
93 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
94 .bus_num = 0, /* Framework bus number */
95 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
96 .platform_data = &bfin_spi_flash_data,
97 .controller_data = &spi_flash_chip_info,
102 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
104 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
105 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
106 .bus_num = 0, /* Framework bus number */
107 .chip_select = 2, /* Framework chip select. */
108 .platform_data = NULL, /* No spi_driver specific config */
109 .controller_data = &spi_adc_chip_info,
113 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
115 .modalias = "ad1836",
116 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
118 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
119 .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 */
172 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
173 static struct platform_device rtc_device = {
179 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
180 #include <linux/smc91x.h>
182 static struct smc91x_platdata smc91x_info = {
183 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
184 .leda = RPC_LED_100_10,
185 .ledb = RPC_LED_TX_RX,
188 static struct resource smc91x_resources[] = {
191 .end = 0x20200300 + 16,
192 .flags = IORESOURCE_MEM,
196 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
199 static struct platform_device smc91x_device = {
202 .num_resources = ARRAY_SIZE(smc91x_resources),
203 .resource = smc91x_resources,
205 .platform_data = &smc91x_info,
210 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
211 #include <linux/smsc911x.h>
213 static struct resource smsc911x_resources[] = {
215 .name = "smsc911x-memory",
217 .end = 0x20308000 + 0xFF,
218 .flags = IORESOURCE_MEM,
222 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
226 static struct smsc911x_platform_config smsc911x_config = {
227 .flags = SMSC911X_USE_16BIT,
228 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
229 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
230 .phy_interface = PHY_INTERFACE_MODE_MII,
233 static struct platform_device smsc911x_device = {
236 .num_resources = ARRAY_SIZE(smsc911x_resources),
237 .resource = smsc911x_resources,
239 .platform_data = &smsc911x_config,
244 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
245 static struct resource bfin_uart_resources[] = {
249 .flags = IORESOURCE_MEM,
253 static struct platform_device bfin_uart_device = {
256 .num_resources = ARRAY_SIZE(bfin_uart_resources),
257 .resource = bfin_uart_resources,
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 static struct platform_device bfin_sport0_uart_device = {
292 .name = "bfin-sport-uart",
296 static struct platform_device bfin_sport1_uart_device = {
297 .name = "bfin-sport-uart",
302 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
303 static struct resource isp1362_hcd_resources[] = {
307 .flags = IORESOURCE_MEM,
311 .flags = IORESOURCE_MEM,
315 .flags = IORESOURCE_IRQ,
319 static struct isp1362_platform_data isp1362_priv = {
324 .int_edge_triggered = 0,
325 .remote_wakeup_connected = 0,
326 .no_power_switching = 1,
327 .power_switching_mode = 0,
330 static struct platform_device isp1362_hcd_device = {
331 .name = "isp1362-hcd",
334 .platform_data = &isp1362_priv,
336 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
337 .resource = isp1362_hcd_resources,
342 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
343 static struct resource net2272_bfin_resources[] = {
346 .end = 0x20300000 + 0x100,
347 .flags = IORESOURCE_MEM,
351 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
355 static struct platform_device net2272_bfin_device = {
358 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
359 .resource = net2272_bfin_resources,
365 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
366 static struct mtd_partition para_partitions[] = {
368 .name = "bootloader(nor)",
372 .name = "linux+rootfs(nor)",
373 .size = MTDPART_SIZ_FULL,
374 .offset = MTDPART_OFS_APPEND,
378 static struct physmap_flash_data para_flash_data = {
380 .parts = para_partitions,
381 .nr_parts = ARRAY_SIZE(para_partitions),
384 static struct resource para_flash_resource = {
387 .flags = IORESOURCE_MEM,
390 static struct platform_device para_flash_device = {
391 .name = "physmap-flash",
394 .platform_data = ¶_flash_data,
397 .resource = ¶_flash_resource,
403 static const unsigned int cclk_vlev_datasheet[] =
405 VRPAIR(VLEV_085, 250000000),
406 VRPAIR(VLEV_090, 376000000),
407 VRPAIR(VLEV_095, 426000000),
408 VRPAIR(VLEV_100, 426000000),
409 VRPAIR(VLEV_105, 476000000),
410 VRPAIR(VLEV_110, 476000000),
411 VRPAIR(VLEV_115, 476000000),
412 VRPAIR(VLEV_120, 600000000),
413 VRPAIR(VLEV_125, 600000000),
414 VRPAIR(VLEV_130, 600000000),
417 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
418 .tuple_tab = cclk_vlev_datasheet,
419 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
420 .vr_settling_time = 25 /* us */,
423 static struct platform_device bfin_dpmc = {
426 .platform_data = &bfin_dmpc_vreg_data,
430 static struct platform_device *cm_bf533_devices[] __initdata = {
434 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
438 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
439 #ifdef CONFIG_BFIN_SIR0
444 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
445 &bfin_sport0_uart_device,
446 &bfin_sport1_uart_device,
449 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
453 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
457 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
461 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
465 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
466 &net2272_bfin_device,
469 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
473 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
478 static int __init cm_bf533_init(void)
480 printk(KERN_INFO "%s(): registering device resources\n", __func__);
481 platform_add_devices(cm_bf533_devices, ARRAY_SIZE(cm_bf533_devices));
482 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
483 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
488 arch_initcall(cm_bf533_init);