2 * File: arch/blackfin/mach-bf533/boards/cm_bf561.c
3 * Based on: arch/blackfin/mach-bf533/boards/ezkit.c
4 * Author: Aidan Williams <aidan@nicta.com.au> Copyright 2005
7 * Description: Board description file
10 * Copyright 2004-2006 Analog Devices Inc.
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #include <linux/device.h>
31 #include <linux/platform_device.h>
32 #include <linux/mtd/mtd.h>
33 #include <linux/mtd/partitions.h>
34 #include <linux/spi/spi.h>
35 #include <linux/spi/flash.h>
36 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
37 #include <linux/usb/isp1362.h>
39 #include <linux/ata_platform.h>
40 #include <linux/irq.h>
42 #include <asm/bfin5xx_spi.h>
43 #include <asm/portmux.h>
45 #include <linux/mtd/physmap.h>
48 * Name the Board for the /proc/cpuinfo
50 const char bfin_board_name
[] = "Bluetechnix CM BF561";
52 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
53 /* all SPI peripherals info goes here */
55 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
56 static struct mtd_partition bfin_spi_flash_partitions
[] = {
58 .name
= "bootloader(spi)",
61 .mask_flags
= MTD_CAP_ROM
63 .name
= "linux kernel(spi)",
67 .name
= "file system(spi)",
73 static struct flash_platform_data bfin_spi_flash_data
= {
75 .parts
= bfin_spi_flash_partitions
,
76 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
80 /* SPI flash chip (m25p64) */
81 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
82 .enable_dma
= 0, /* use dma transfer with this chip*/
87 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
89 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
90 .enable_dma
= 1, /* use dma transfer with this chip*/
95 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
96 static struct bfin5xx_spi_chip ad1836_spi_chip_info
= {
102 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
103 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
109 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
110 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
112 /* the modalias must be the same as spi device driver name */
113 .modalias
= "m25p80", /* Name of spi_driver for this device */
114 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
115 .bus_num
= 0, /* Framework bus number */
116 .chip_select
= 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
117 .platform_data
= &bfin_spi_flash_data
,
118 .controller_data
= &spi_flash_chip_info
,
123 #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
125 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
126 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
127 .bus_num
= 0, /* Framework bus number */
128 .chip_select
= 1, /* Framework chip select. */
129 .platform_data
= NULL
, /* No spi_driver specific config */
130 .controller_data
= &spi_adc_chip_info
,
134 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
136 .modalias
= "ad1836",
137 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
139 .chip_select
= CONFIG_SND_BLACKFIN_SPI_PFBIT
,
140 .controller_data
= &ad1836_spi_chip_info
,
143 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
145 .modalias
= "mmc_spi",
146 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
149 .controller_data
= &mmc_spi_chip_info
,
156 static struct resource bfin_spi0_resource
[] = {
158 .start
= SPI0_REGBASE
,
159 .end
= SPI0_REGBASE
+ 0xFF,
160 .flags
= IORESOURCE_MEM
,
165 .flags
= IORESOURCE_DMA
,
170 .flags
= IORESOURCE_IRQ
,
174 /* SPI controller data */
175 static struct bfin5xx_spi_master bfin_spi0_info
= {
177 .enable_dma
= 1, /* master has the ability to do dma transfer */
178 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
181 static struct platform_device bfin_spi0_device
= {
183 .id
= 0, /* Bus number */
184 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
185 .resource
= bfin_spi0_resource
,
187 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
190 #endif /* spi master and devices */
193 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
194 static struct platform_device hitachi_fb_device
= {
195 .name
= "hitachi-tx09",
200 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
201 #include <linux/smc91x.h>
203 static struct smc91x_platdata smc91x_info
= {
204 .flags
= SMC91X_USE_32BIT
| SMC91X_NOWAIT
,
205 .leda
= RPC_LED_100_10
,
206 .ledb
= RPC_LED_TX_RX
,
209 static struct resource smc91x_resources
[] = {
211 .name
= "smc91x-regs",
213 .end
= 0x28000300 + 16,
214 .flags
= IORESOURCE_MEM
,
218 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
221 static struct platform_device smc91x_device
= {
224 .num_resources
= ARRAY_SIZE(smc91x_resources
),
225 .resource
= smc91x_resources
,
227 .platform_data
= &smc91x_info
,
232 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
233 #include <linux/smsc911x.h>
235 static struct resource smsc911x_resources
[] = {
237 .name
= "smsc911x-memory",
239 .end
= 0x24008000 + 0xFF,
240 .flags
= IORESOURCE_MEM
,
245 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_LOWLEVEL
,
249 static struct smsc911x_platform_config smsc911x_config
= {
250 .flags
= SMSC911X_USE_16BIT
,
251 .irq_polarity
= SMSC911X_IRQ_POLARITY_ACTIVE_LOW
,
252 .irq_type
= SMSC911X_IRQ_TYPE_OPEN_DRAIN
,
253 .phy_interface
= PHY_INTERFACE_MODE_MII
,
256 static struct platform_device smsc911x_device
= {
259 .num_resources
= ARRAY_SIZE(smsc911x_resources
),
260 .resource
= smsc911x_resources
,
262 .platform_data
= &smsc911x_config
,
267 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
268 static struct resource net2272_bfin_resources
[] = {
271 .end
= 0x24000000 + 0x100,
272 .flags
= IORESOURCE_MEM
,
276 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
280 static struct platform_device net2272_bfin_device
= {
283 .num_resources
= ARRAY_SIZE(net2272_bfin_resources
),
284 .resource
= net2272_bfin_resources
,
288 static struct resource bfin_gpios_resources
= {
290 .end
= MAX_BLACKFIN_GPIOS
- 1,
291 .flags
= IORESOURCE_IRQ
,
294 static struct platform_device bfin_gpios_device
= {
295 .name
= "simple-gpio",
298 .resource
= &bfin_gpios_resources
,
301 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
302 static struct resource isp1362_hcd_resources
[] = {
306 .flags
= IORESOURCE_MEM
,
310 .flags
= IORESOURCE_MEM
,
314 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHLEVEL
,
318 static struct isp1362_platform_data isp1362_priv
= {
323 .int_edge_triggered
= 0,
324 .remote_wakeup_connected
= 0,
325 .no_power_switching
= 1,
326 .power_switching_mode
= 0,
329 static struct platform_device isp1362_hcd_device
= {
330 .name
= "isp1362-hcd",
333 .platform_data
= &isp1362_priv
,
335 .num_resources
= ARRAY_SIZE(isp1362_hcd_resources
),
336 .resource
= isp1362_hcd_resources
,
340 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
341 static struct resource bfin_uart_resources
[] = {
345 .flags
= IORESOURCE_MEM
,
349 static struct platform_device bfin_uart_device
= {
352 .num_resources
= ARRAY_SIZE(bfin_uart_resources
),
353 .resource
= bfin_uart_resources
,
357 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
358 #ifdef CONFIG_BFIN_SIR0
359 static struct resource bfin_sir0_resources
[] = {
363 .flags
= IORESOURCE_MEM
,
366 .start
= IRQ_UART0_RX
,
367 .end
= IRQ_UART0_RX
+1,
368 .flags
= IORESOURCE_IRQ
,
371 .start
= CH_UART0_RX
,
372 .end
= CH_UART0_RX
+1,
373 .flags
= IORESOURCE_DMA
,
377 static struct platform_device bfin_sir0_device
= {
380 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
381 .resource
= bfin_sir0_resources
,
386 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
387 #define PATA_INT IRQ_PF46
389 static struct pata_platform_info bfin_pata_platform_data
= {
391 .irq_type
= IRQF_TRIGGER_HIGH
| IRQF_DISABLED
,
394 static struct resource bfin_pata_resources
[] = {
398 .flags
= IORESOURCE_MEM
,
403 .flags
= IORESOURCE_MEM
,
408 .flags
= IORESOURCE_IRQ
,
412 static struct platform_device bfin_pata_device
= {
413 .name
= "pata_platform",
415 .num_resources
= ARRAY_SIZE(bfin_pata_resources
),
416 .resource
= bfin_pata_resources
,
418 .platform_data
= &bfin_pata_platform_data
,
423 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
424 static struct mtd_partition para_partitions
[] = {
426 .name
= "bootloader(nor)",
430 .name
= "linux kernel(nor)",
432 .offset
= MTDPART_OFS_APPEND
,
434 .name
= "file system(nor)",
435 .size
= MTDPART_SIZ_FULL
,
436 .offset
= MTDPART_OFS_APPEND
,
440 static struct physmap_flash_data para_flash_data
= {
442 .parts
= para_partitions
,
443 .nr_parts
= ARRAY_SIZE(para_partitions
),
446 static struct resource para_flash_resource
= {
449 .flags
= IORESOURCE_MEM
,
452 static struct platform_device para_flash_device
= {
453 .name
= "physmap-flash",
456 .platform_data
= ¶_flash_data
,
459 .resource
= ¶_flash_resource
,
463 static const unsigned int cclk_vlev_datasheet
[] =
465 VRPAIR(VLEV_085
, 250000000),
466 VRPAIR(VLEV_090
, 300000000),
467 VRPAIR(VLEV_095
, 313000000),
468 VRPAIR(VLEV_100
, 350000000),
469 VRPAIR(VLEV_105
, 400000000),
470 VRPAIR(VLEV_110
, 444000000),
471 VRPAIR(VLEV_115
, 450000000),
472 VRPAIR(VLEV_120
, 475000000),
473 VRPAIR(VLEV_125
, 500000000),
474 VRPAIR(VLEV_130
, 600000000),
477 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
478 .tuple_tab
= cclk_vlev_datasheet
,
479 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
480 .vr_settling_time
= 25 /* us */,
483 static struct platform_device bfin_dpmc
= {
486 .platform_data
= &bfin_dmpc_vreg_data
,
490 static struct platform_device
*cm_bf561_devices
[] __initdata
= {
494 #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
498 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
502 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
503 #ifdef CONFIG_BFIN_SIR0
508 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
512 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
516 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
520 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
521 &net2272_bfin_device
,
524 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
528 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
532 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
539 static int __init
cm_bf561_init(void)
541 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
542 platform_add_devices(cm_bf561_devices
, ARRAY_SIZE(cm_bf561_devices
));
543 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
544 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
547 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
548 irq_desc
[PATA_INT
].status
|= IRQ_NOAUTOEN
;
553 arch_initcall(cm_bf561_init
);