2 * Copyright 2004-2009 Analog Devices Inc.
3 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
6 * Licensed under the GPL-2 or later.
9 #include <linux/device.h>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/mtd/physmap.h>
14 #include <linux/spi/spi.h>
15 #include <linux/spi/flash.h>
17 #include <linux/i2c.h>
18 #include <linux/irq.h>
19 #include <linux/interrupt.h>
21 #include <asm/bfin5xx_spi.h>
22 #include <asm/reboot.h>
23 #include <asm/portmux.h>
25 #include <asm/bfin_sdh.h>
26 #include <linux/spi/ad7877.h>
30 * Name the Board for the /proc/cpuinfo
32 const char bfin_board_name
[] = "ADI BF518F-EZBRD";
35 * Driver needs to know address, irq and flag pin.
38 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
39 static struct mtd_partition ezbrd_partitions
[] = {
41 .name
= "bootloader(nor)",
45 .name
= "linux kernel(nor)",
47 .offset
= MTDPART_OFS_APPEND
,
49 .name
= "file system(nor)",
50 .size
= MTDPART_SIZ_FULL
,
51 .offset
= MTDPART_OFS_APPEND
,
55 static struct physmap_flash_data ezbrd_flash_data
= {
57 .parts
= ezbrd_partitions
,
58 .nr_parts
= ARRAY_SIZE(ezbrd_partitions
),
61 static struct resource ezbrd_flash_resource
= {
63 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
68 .flags
= IORESOURCE_MEM
,
71 static struct platform_device ezbrd_flash_device
= {
72 .name
= "physmap-flash",
75 .platform_data
= &ezbrd_flash_data
,
78 .resource
= &ezbrd_flash_resource
,
82 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
83 static struct platform_device rtc_device
= {
89 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
90 #include <linux/bfin_mac.h>
91 static const unsigned short bfin_mac_peripherals
[] = {
105 static struct bfin_phydev_platform_data bfin_phydev_data
[] = {
107 #if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
112 .irq
= IRQ_MAC_PHYINT
,
116 static struct bfin_mii_bus_platform_data bfin_mii_bus_data
= {
118 .phydev_data
= bfin_phydev_data
,
119 .phy_mode
= PHY_INTERFACE_MODE_MII
,
120 .mac_peripherals
= bfin_mac_peripherals
,
121 #if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
122 .phy_mask
= 0xfff7, /* Only probe the port phy connect to the on chip MAC */
126 static struct platform_device bfin_mii_bus
= {
127 .name
= "bfin_mii_bus",
129 .platform_data
= &bfin_mii_bus_data
,
133 static struct platform_device bfin_mac_device
= {
136 .platform_data
= &bfin_mii_bus
,
140 #if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
141 static struct dsa_chip_data ksz8893m_switch_chip_data
= {
142 .mii_bus
= &bfin_mii_bus
.dev
,
150 static struct dsa_platform_data ksz8893m_switch_data
= {
152 .netdev
= &bfin_mac_device
.dev
,
153 .chip
= &ksz8893m_switch_chip_data
,
156 static struct platform_device ksz8893m_switch_device
= {
160 .dev
.platform_data
= &ksz8893m_switch_data
,
165 #if defined(CONFIG_MTD_M25P80) \
166 || defined(CONFIG_MTD_M25P80_MODULE)
167 static struct mtd_partition bfin_spi_flash_partitions
[] = {
169 .name
= "bootloader(spi)",
172 .mask_flags
= MTD_CAP_ROM
174 .name
= "linux kernel(spi)",
175 .size
= MTDPART_SIZ_FULL
,
176 .offset
= MTDPART_OFS_APPEND
,
180 static struct flash_platform_data bfin_spi_flash_data
= {
182 .parts
= bfin_spi_flash_partitions
,
183 .nr_parts
= ARRAY_SIZE(bfin_spi_flash_partitions
),
187 /* SPI flash chip (m25p64) */
188 static struct bfin5xx_spi_chip spi_flash_chip_info
= {
189 .enable_dma
= 0, /* use dma transfer with this chip*/
194 #if defined(CONFIG_BFIN_SPI_ADC) \
195 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
197 static struct bfin5xx_spi_chip spi_adc_chip_info
= {
198 .enable_dma
= 1, /* use dma transfer with this chip*/
203 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
204 #if defined(CONFIG_NET_DSA_KSZ8893M) \
205 || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
206 /* SPI SWITCH CHIP */
207 static struct bfin5xx_spi_chip spi_switch_info
= {
214 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
215 static struct bfin5xx_spi_chip mmc_spi_chip_info
= {
221 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
222 static struct bfin5xx_spi_chip spi_ad7877_chip_info
= {
227 static const struct ad7877_platform_data bfin_ad7877_ts_info
= {
229 .vref_delay_usecs
= 50, /* internal, no capacitor */
232 .pressure_max
= 1000,
234 .stopacq_polarity
= 1,
235 .first_conversion_delay
= 3,
236 .acquisition_time
= 1,
238 .pen_down_acc_interval
= 1,
242 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
243 && defined(CONFIG_SND_SOC_WM8731_SPI)
244 static struct bfin5xx_spi_chip spi_wm8731_chip_info
= {
250 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
251 static struct bfin5xx_spi_chip spidev_chip_info
= {
257 static struct spi_board_info bfin_spi_board_info
[] __initdata
= {
258 #if defined(CONFIG_MTD_M25P80) \
259 || defined(CONFIG_MTD_M25P80_MODULE)
261 /* the modalias must be the same as spi device driver name */
262 .modalias
= "m25p80", /* Name of spi_driver for this device */
263 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
264 .bus_num
= 0, /* Framework bus number */
265 .chip_select
= 2, /* On BF518F-EZBRD it's SPI0_SSEL2 */
266 .platform_data
= &bfin_spi_flash_data
,
267 .controller_data
= &spi_flash_chip_info
,
272 #if defined(CONFIG_BFIN_SPI_ADC) \
273 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
275 .modalias
= "bfin_spi_adc", /* Name of spi_driver for this device */
276 .max_speed_hz
= 6250000, /* max spi clock (SCK) speed in HZ */
277 .bus_num
= 0, /* Framework bus number */
278 .chip_select
= 1, /* Framework chip select. */
279 .platform_data
= NULL
, /* No spi_driver specific config */
280 .controller_data
= &spi_adc_chip_info
,
284 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
285 #if defined(CONFIG_NET_DSA_KSZ8893M) \
286 || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
288 .modalias
= "ksz8893m",
289 .max_speed_hz
= 5000000,
292 .platform_data
= NULL
,
293 .controller_data
= &spi_switch_info
,
299 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
301 .modalias
= "mmc_spi",
302 .max_speed_hz
= 25000000, /* max spi clock (SCK) speed in HZ */
305 .controller_data
= &mmc_spi_chip_info
,
309 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
311 .modalias
= "ad7877",
312 .platform_data
= &bfin_ad7877_ts_info
,
314 .max_speed_hz
= 12500000, /* max spi clock (SCK) speed in HZ */
317 .controller_data
= &spi_ad7877_chip_info
,
320 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
321 && defined(CONFIG_SND_SOC_WM8731_SPI)
323 .modalias
= "wm8731",
324 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
327 .controller_data
= &spi_wm8731_chip_info
,
331 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
333 .modalias
= "spidev",
334 .max_speed_hz
= 3125000, /* max spi clock (SCK) speed in HZ */
337 .controller_data
= &spidev_chip_info
,
340 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
342 .modalias
= "bfin-lq035q1-spi",
343 .max_speed_hz
= 20000000, /* max spi clock (SCK) speed in HZ */
346 .controller_data
= &lq035q1_spi_chip_info
,
347 .mode
= SPI_CPHA
| SPI_CPOL
,
352 /* SPI controller data */
353 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
355 static struct bfin5xx_spi_master bfin_spi0_info
= {
357 .enable_dma
= 1, /* master has the ability to do dma transfer */
358 .pin_req
= {P_SPI0_SCK
, P_SPI0_MISO
, P_SPI0_MOSI
, 0},
361 static struct resource bfin_spi0_resource
[] = {
363 .start
= SPI0_REGBASE
,
364 .end
= SPI0_REGBASE
+ 0xFF,
365 .flags
= IORESOURCE_MEM
,
370 .flags
= IORESOURCE_DMA
,
375 .flags
= IORESOURCE_IRQ
,
379 static struct platform_device bfin_spi0_device
= {
381 .id
= 0, /* Bus number */
382 .num_resources
= ARRAY_SIZE(bfin_spi0_resource
),
383 .resource
= bfin_spi0_resource
,
385 .platform_data
= &bfin_spi0_info
, /* Passed to driver */
390 static struct bfin5xx_spi_master bfin_spi1_info
= {
392 .enable_dma
= 1, /* master has the ability to do dma transfer */
393 .pin_req
= {P_SPI1_SCK
, P_SPI1_MISO
, P_SPI1_MOSI
, 0},
396 static struct resource bfin_spi1_resource
[] = {
398 .start
= SPI1_REGBASE
,
399 .end
= SPI1_REGBASE
+ 0xFF,
400 .flags
= IORESOURCE_MEM
,
405 .flags
= IORESOURCE_DMA
,
410 .flags
= IORESOURCE_IRQ
,
414 static struct platform_device bfin_spi1_device
= {
416 .id
= 1, /* Bus number */
417 .num_resources
= ARRAY_SIZE(bfin_spi1_resource
),
418 .resource
= bfin_spi1_resource
,
420 .platform_data
= &bfin_spi1_info
, /* Passed to driver */
423 #endif /* spi master and devices */
425 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
426 #ifdef CONFIG_SERIAL_BFIN_UART0
427 static struct resource bfin_uart0_resources
[] = {
431 .flags
= IORESOURCE_MEM
,
434 .start
= IRQ_UART0_RX
,
435 .end
= IRQ_UART0_RX
+1,
436 .flags
= IORESOURCE_IRQ
,
439 .start
= IRQ_UART0_ERROR
,
440 .end
= IRQ_UART0_ERROR
,
441 .flags
= IORESOURCE_IRQ
,
444 .start
= CH_UART0_TX
,
446 .flags
= IORESOURCE_DMA
,
449 .start
= CH_UART0_RX
,
451 .flags
= IORESOURCE_DMA
,
455 static unsigned short bfin_uart0_peripherals
[] = {
456 P_UART0_TX
, P_UART0_RX
, 0
459 static struct platform_device bfin_uart0_device
= {
462 .num_resources
= ARRAY_SIZE(bfin_uart0_resources
),
463 .resource
= bfin_uart0_resources
,
465 .platform_data
= &bfin_uart0_peripherals
, /* Passed to driver */
469 #ifdef CONFIG_SERIAL_BFIN_UART1
470 static struct resource bfin_uart1_resources
[] = {
474 .flags
= IORESOURCE_MEM
,
477 .start
= IRQ_UART1_RX
,
478 .end
= IRQ_UART1_RX
+1,
479 .flags
= IORESOURCE_IRQ
,
482 .start
= IRQ_UART1_ERROR
,
483 .end
= IRQ_UART1_ERROR
,
484 .flags
= IORESOURCE_IRQ
,
487 .start
= CH_UART1_TX
,
489 .flags
= IORESOURCE_DMA
,
492 .start
= CH_UART1_RX
,
494 .flags
= IORESOURCE_DMA
,
498 static unsigned short bfin_uart1_peripherals
[] = {
499 P_UART1_TX
, P_UART1_RX
, 0
502 static struct platform_device bfin_uart1_device
= {
505 .num_resources
= ARRAY_SIZE(bfin_uart1_resources
),
506 .resource
= bfin_uart1_resources
,
508 .platform_data
= &bfin_uart1_peripherals
, /* Passed to driver */
514 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
515 #ifdef CONFIG_BFIN_SIR0
516 static struct resource bfin_sir0_resources
[] = {
520 .flags
= IORESOURCE_MEM
,
523 .start
= IRQ_UART0_RX
,
524 .end
= IRQ_UART0_RX
+1,
525 .flags
= IORESOURCE_IRQ
,
528 .start
= CH_UART0_RX
,
529 .end
= CH_UART0_RX
+1,
530 .flags
= IORESOURCE_DMA
,
534 static struct platform_device bfin_sir0_device
= {
537 .num_resources
= ARRAY_SIZE(bfin_sir0_resources
),
538 .resource
= bfin_sir0_resources
,
541 #ifdef CONFIG_BFIN_SIR1
542 static struct resource bfin_sir1_resources
[] = {
546 .flags
= IORESOURCE_MEM
,
549 .start
= IRQ_UART1_RX
,
550 .end
= IRQ_UART1_RX
+1,
551 .flags
= IORESOURCE_IRQ
,
554 .start
= CH_UART1_RX
,
555 .end
= CH_UART1_RX
+1,
556 .flags
= IORESOURCE_DMA
,
560 static struct platform_device bfin_sir1_device
= {
563 .num_resources
= ARRAY_SIZE(bfin_sir1_resources
),
564 .resource
= bfin_sir1_resources
,
569 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
570 static struct platform_device bfin_i2s
= {
572 .id
= CONFIG_SND_BF5XX_SPORT_NUM
,
573 /* TODO: add platform data here */
577 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
578 static struct resource bfin_twi0_resource
[] = {
580 .start
= TWI0_REGBASE
,
582 .flags
= IORESOURCE_MEM
,
587 .flags
= IORESOURCE_IRQ
,
591 static struct platform_device i2c_bfin_twi_device
= {
592 .name
= "i2c-bfin-twi",
594 .num_resources
= ARRAY_SIZE(bfin_twi0_resource
),
595 .resource
= bfin_twi0_resource
,
599 static struct i2c_board_info __initdata bfin_i2c_board_info
[] = {
600 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
602 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
605 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
607 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
611 #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
613 I2C_BOARD_INFO("ssm2602", 0x1b),
618 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
619 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
620 static struct resource bfin_sport0_uart_resources
[] = {
622 .start
= SPORT0_TCR1
,
623 .end
= SPORT0_MRCS3
+4,
624 .flags
= IORESOURCE_MEM
,
627 .start
= IRQ_SPORT0_RX
,
628 .end
= IRQ_SPORT0_RX
+1,
629 .flags
= IORESOURCE_IRQ
,
632 .start
= IRQ_SPORT0_ERROR
,
633 .end
= IRQ_SPORT0_ERROR
,
634 .flags
= IORESOURCE_IRQ
,
638 static unsigned short bfin_sport0_peripherals
[] = {
639 P_SPORT0_TFS
, P_SPORT0_DTPRI
, P_SPORT0_TSCLK
, P_SPORT0_RFS
,
640 P_SPORT0_DRPRI
, P_SPORT0_RSCLK
, 0
643 static struct platform_device bfin_sport0_uart_device
= {
644 .name
= "bfin-sport-uart",
646 .num_resources
= ARRAY_SIZE(bfin_sport0_uart_resources
),
647 .resource
= bfin_sport0_uart_resources
,
649 .platform_data
= &bfin_sport0_peripherals
, /* Passed to driver */
653 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
654 static struct resource bfin_sport1_uart_resources
[] = {
656 .start
= SPORT1_TCR1
,
657 .end
= SPORT1_MRCS3
+4,
658 .flags
= IORESOURCE_MEM
,
661 .start
= IRQ_SPORT1_RX
,
662 .end
= IRQ_SPORT1_RX
+1,
663 .flags
= IORESOURCE_IRQ
,
666 .start
= IRQ_SPORT1_ERROR
,
667 .end
= IRQ_SPORT1_ERROR
,
668 .flags
= IORESOURCE_IRQ
,
672 static unsigned short bfin_sport1_peripherals
[] = {
673 P_SPORT1_TFS
, P_SPORT1_DTPRI
, P_SPORT1_TSCLK
, P_SPORT1_RFS
,
674 P_SPORT1_DRPRI
, P_SPORT1_RSCLK
, 0
677 static struct platform_device bfin_sport1_uart_device
= {
678 .name
= "bfin-sport-uart",
680 .num_resources
= ARRAY_SIZE(bfin_sport1_uart_resources
),
681 .resource
= bfin_sport1_uart_resources
,
683 .platform_data
= &bfin_sport1_peripherals
, /* Passed to driver */
689 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
690 #include <linux/input.h>
691 #include <linux/gpio_keys.h>
693 static struct gpio_keys_button bfin_gpio_keys_table
[] = {
694 {BTN_0
, GPIO_PG0
, 1, "gpio-keys: BTN0"},
695 {BTN_1
, GPIO_PG13
, 1, "gpio-keys: BTN1"},
698 static struct gpio_keys_platform_data bfin_gpio_keys_data
= {
699 .buttons
= bfin_gpio_keys_table
,
700 .nbuttons
= ARRAY_SIZE(bfin_gpio_keys_table
),
703 static struct platform_device bfin_device_gpiokeys
= {
706 .platform_data
= &bfin_gpio_keys_data
,
711 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
713 static struct bfin_sd_host bfin_sdh_data
= {
715 .irq_int0
= IRQ_RSI_INT0
,
716 .pin_req
= {P_RSI_DATA0
, P_RSI_DATA1
, P_RSI_DATA2
, P_RSI_DATA3
, P_RSI_CMD
, P_RSI_CLK
, 0},
719 static struct platform_device bf51x_sdh_device
= {
723 .platform_data
= &bfin_sdh_data
,
728 static const unsigned int cclk_vlev_datasheet
[] =
730 VRPAIR(VLEV_100
, 400000000),
731 VRPAIR(VLEV_105
, 426000000),
732 VRPAIR(VLEV_110
, 500000000),
733 VRPAIR(VLEV_115
, 533000000),
734 VRPAIR(VLEV_120
, 600000000),
737 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data
= {
738 .tuple_tab
= cclk_vlev_datasheet
,
739 .tabsize
= ARRAY_SIZE(cclk_vlev_datasheet
),
740 .vr_settling_time
= 25 /* us */,
743 static struct platform_device bfin_dpmc
= {
746 .platform_data
= &bfin_dmpc_vreg_data
,
750 static struct platform_device
*stamp_devices
[] __initdata
= {
754 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
758 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
761 #if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
762 &ksz8893m_switch_device
,
766 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
771 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
772 #ifdef CONFIG_SERIAL_BFIN_UART0
775 #ifdef CONFIG_SERIAL_BFIN_UART1
780 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
781 #ifdef CONFIG_BFIN_SIR0
784 #ifdef CONFIG_BFIN_SIR1
789 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
790 &i2c_bfin_twi_device
,
793 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
797 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
798 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
799 &bfin_sport0_uart_device
,
801 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
802 &bfin_sport1_uart_device
,
806 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
807 &bfin_device_gpiokeys
,
810 #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE)
814 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
819 static int __init
ezbrd_init(void)
821 printk(KERN_INFO
"%s(): registering device resources\n", __func__
);
822 i2c_register_board_info(0, bfin_i2c_board_info
,
823 ARRAY_SIZE(bfin_i2c_board_info
));
824 platform_add_devices(stamp_devices
, ARRAY_SIZE(stamp_devices
));
825 spi_register_board_info(bfin_spi_board_info
, ARRAY_SIZE(bfin_spi_board_info
));
826 /* setup BF518-EZBRD GPIO pin PG11 to AMS2, PG15 to AMS3. */
827 peripheral_request(P_AMS2
, "ParaFlash");
828 #if !defined(CONFIG_SPI_BFIN) && !defined(CONFIG_SPI_BFIN_MODULE)
829 peripheral_request(P_AMS3
, "ParaFlash");
834 arch_initcall(ezbrd_init
);
836 static struct platform_device
*ezbrd_early_devices
[] __initdata
= {
837 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
838 #ifdef CONFIG_SERIAL_BFIN_UART0
841 #ifdef CONFIG_SERIAL_BFIN_UART1
846 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
847 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
848 &bfin_sport0_uart_device
,
850 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
851 &bfin_sport1_uart_device
,
856 void __init
native_machine_early_platform_add_devices(void)
858 printk(KERN_INFO
"register early platform devices\n");
859 early_platform_add_devices(ezbrd_early_devices
,
860 ARRAY_SIZE(ezbrd_early_devices
));
863 void native_machine_restart(char *cmd
)
865 /* workaround reboot hang when booting from SPI */
866 if ((bfin_read_SYSCR() & 0x7) == 0x3)
867 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS
);
870 void bfin_get_ether_addr(char *addr
)
872 /* the MAC is stored in OTP memory page 0xDF */
875 u32 (*otp_read
)(u32 page
, u32 flags
, u64
*page_content
) = (void *)0xEF00001A;
877 ret
= otp_read(0xDF, 0x00, &otp_mac
);
879 char *otp_mac_p
= (char *)&otp_mac
;
880 for (ret
= 0; ret
< 6; ++ret
)
881 addr
[ret
] = otp_mac_p
[5 - ret
];
884 EXPORT_SYMBOL(bfin_get_ether_addr
);