2 * File: arch/blackfin/mach-bf527/boards/ezkit.c
3 * Based on: arch/blackfin/mach-bf537/boards/stamp.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2008 Analog Devices Inc.
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #include <linux/device.h>
32 #include <linux/platform_device.h>
33 #include <linux/mtd/mtd.h>
34 #include <linux/mtd/partitions.h>
35 #include <linux/mtd/physmap.h>
36 #include <linux/spi/spi.h>
37 #include <linux/spi/flash.h>
38 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
39 #include <linux/usb/isp1362.h>
41 #include <linux/i2c.h>
42 #include <linux/irq.h>
43 #include <linux/interrupt.h>
44 #include <linux/usb/sl811.h>
45 #include <linux/usb/musb.h>
47 #include <asm/bfin5xx_spi.h>
48 #include <asm/reboot.h>
50 #include <asm/portmux.h>
52 #include <linux/spi/ad7877.h>
55 * Name the Board for the /proc/cpuinfo
57 const char bfin_board_name[] = "ADI BF527-EZKIT";
60 * Driver needs to know address, irq and flag pin.
63 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
64 #include <linux/usb/isp1760.h>
65 static struct resource bfin_isp1760_resources[] = {
68 .end = 0x203C0000 + 0x000fffff,
69 .flags = IORESOURCE_MEM,
74 .flags = IORESOURCE_IRQ,
78 static struct isp1760_platform_data isp1760_priv = {
84 .dack_polarity_high = 0,
85 .dreq_polarity_high = 0,
88 static struct platform_device bfin_isp1760_device = {
89 .name = "isp1760-hcd",
92 .platform_data = &isp1760_priv,
94 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
95 .resource = bfin_isp1760_resources,
99 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
100 static struct resource musb_resources[] = {
104 .flags = IORESOURCE_MEM,
106 [1] = { /* general IRQ */
107 .start = IRQ_USB_INT0,
109 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
111 [2] = { /* DMA IRQ */
112 .start = IRQ_USB_DMA,
114 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
118 static struct musb_hdrc_config musb_config = {
125 .gpio_vrsel = GPIO_PG13,
128 static struct musb_hdrc_platform_data musb_plat = {
129 #if defined(CONFIG_USB_MUSB_OTG)
131 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
133 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
134 .mode = MUSB_PERIPHERAL,
136 .config = &musb_config,
139 static u64 musb_dmamask = ~(u32)0;
141 static struct platform_device musb_device = {
145 .dma_mask = &musb_dmamask,
146 .coherent_dma_mask = 0xffffffff,
147 .platform_data = &musb_plat,
149 .num_resources = ARRAY_SIZE(musb_resources),
150 .resource = musb_resources,
154 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
156 static struct resource bf52x_t350mcqb_resources[] = {
158 .start = IRQ_PPI_ERROR,
159 .end = IRQ_PPI_ERROR,
160 .flags = IORESOURCE_IRQ,
164 static struct platform_device bf52x_t350mcqb_device = {
165 .name = "bfin-t350mcqb",
167 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
168 .resource = bf52x_t350mcqb_resources,
172 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
173 static struct mtd_partition ezkit_partitions[] = {
175 .name = "bootloader(nor)",
179 .name = "linux kernel(nor)",
181 .offset = MTDPART_OFS_APPEND,
183 .name = "file system(nor)",
184 .size = MTDPART_SIZ_FULL,
185 .offset = MTDPART_OFS_APPEND,
189 static struct physmap_flash_data ezkit_flash_data = {
191 .parts = ezkit_partitions,
192 .nr_parts = ARRAY_SIZE(ezkit_partitions),
195 static struct resource ezkit_flash_resource = {
198 .flags = IORESOURCE_MEM,
201 static struct platform_device ezkit_flash_device = {
202 .name = "physmap-flash",
205 .platform_data = &ezkit_flash_data,
208 .resource = &ezkit_flash_resource,
212 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
213 static struct mtd_partition partition_info[] = {
215 .name = "linux kernel(nand)",
217 .size = 4 * 1024 * 1024,
220 .name = "file system(nand)",
221 .offset = MTDPART_OFS_APPEND,
222 .size = MTDPART_SIZ_FULL,
226 static struct bf5xx_nand_platform bf5xx_nand_platform = {
227 .page_size = NFC_PG_SIZE_256,
228 .data_width = NFC_NWIDTH_8,
229 .partitions = partition_info,
230 .nr_partitions = ARRAY_SIZE(partition_info),
235 static struct resource bf5xx_nand_resources[] = {
238 .end = NFC_DATA_RD + 2,
239 .flags = IORESOURCE_MEM,
244 .flags = IORESOURCE_IRQ,
248 static struct platform_device bf5xx_nand_device = {
249 .name = "bf5xx-nand",
251 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
252 .resource = bf5xx_nand_resources,
254 .platform_data = &bf5xx_nand_platform,
259 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
260 static struct resource bfin_pcmcia_cf_resources[] = {
262 .start = 0x20310000, /* IO PORT */
264 .flags = IORESOURCE_MEM,
266 .start = 0x20311000, /* Attribute Memory */
268 .flags = IORESOURCE_MEM,
272 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
274 .start = 6, /* Card Detect PF6 */
276 .flags = IORESOURCE_IRQ,
280 static struct platform_device bfin_pcmcia_cf_device = {
281 .name = "bfin_cf_pcmcia",
283 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
284 .resource = bfin_pcmcia_cf_resources,
288 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
289 static struct platform_device rtc_device = {
295 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
296 static struct resource smc91x_resources[] = {
298 .name = "smc91x-regs",
300 .end = 0x20300300 + 16,
301 .flags = IORESOURCE_MEM,
306 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
309 static struct platform_device smc91x_device = {
312 .num_resources = ARRAY_SIZE(smc91x_resources),
313 .resource = smc91x_resources,
317 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
318 static struct resource dm9000_resources[] = {
321 .end = 0x203FB800 + 1,
322 .flags = IORESOURCE_MEM,
325 .start = 0x203FB800 + 4,
326 .end = 0x203FB800 + 5,
327 .flags = IORESOURCE_MEM,
332 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
336 static struct platform_device dm9000_device = {
339 .num_resources = ARRAY_SIZE(dm9000_resources),
340 .resource = dm9000_resources,
344 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
345 static struct resource sl811_hcd_resources[] = {
349 .flags = IORESOURCE_MEM,
353 .flags = IORESOURCE_MEM,
355 .start = CONFIG_USB_SL811_BFIN_IRQ,
356 .end = CONFIG_USB_SL811_BFIN_IRQ,
357 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
361 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
362 void sl811_port_power(struct device *dev, int is_on)
364 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
365 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
369 static struct sl811_platform_data sl811_priv = {
371 .power = 250, /* == 500mA */
372 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
373 .port_power = &sl811_port_power,
377 static struct platform_device sl811_hcd_device = {
381 .platform_data = &sl811_priv,
383 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
384 .resource = sl811_hcd_resources,
388 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
389 static struct resource isp1362_hcd_resources[] = {
393 .flags = IORESOURCE_MEM,
397 .flags = IORESOURCE_MEM,
399 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
400 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
401 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
405 static struct isp1362_platform_data isp1362_priv = {
410 .int_edge_triggered = 0,
411 .remote_wakeup_connected = 0,
412 .no_power_switching = 1,
413 .power_switching_mode = 0,
416 static struct platform_device isp1362_hcd_device = {
417 .name = "isp1362-hcd",
420 .platform_data = &isp1362_priv,
422 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
423 .resource = isp1362_hcd_resources,
427 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
428 static struct platform_device bfin_mii_bus = {
429 .name = "bfin_mii_bus",
432 static struct platform_device bfin_mac_device = {
434 .dev.platform_data = &bfin_mii_bus,
438 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
439 static struct resource net2272_bfin_resources[] = {
442 .end = 0x20300000 + 0x100,
443 .flags = IORESOURCE_MEM,
447 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
451 static struct platform_device net2272_bfin_device = {
454 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
455 .resource = net2272_bfin_resources,
459 #if defined(CONFIG_MTD_M25P80) \
460 || defined(CONFIG_MTD_M25P80_MODULE)
461 static struct mtd_partition bfin_spi_flash_partitions[] = {
463 .name = "bootloader(spi)",
466 .mask_flags = MTD_CAP_ROM
468 .name = "linux kernel(spi)",
469 .size = MTDPART_SIZ_FULL,
470 .offset = MTDPART_OFS_APPEND,
474 static struct flash_platform_data bfin_spi_flash_data = {
476 .parts = bfin_spi_flash_partitions,
477 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
481 /* SPI flash chip (m25p64) */
482 static struct bfin5xx_spi_chip spi_flash_chip_info = {
483 .enable_dma = 0, /* use dma transfer with this chip*/
488 #if defined(CONFIG_SPI_ADC_BF533) \
489 || defined(CONFIG_SPI_ADC_BF533_MODULE)
491 static struct bfin5xx_spi_chip spi_adc_chip_info = {
492 .enable_dma = 1, /* use dma transfer with this chip*/
497 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
498 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
499 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
505 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
506 static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
512 #if defined(CONFIG_PBX)
513 static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
514 .ctl_reg = 0x4, /* send zero */
517 .cs_change_per_word = 1,
521 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
522 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
527 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
529 .vref_delay_usecs = 50, /* internal, no capacitor */
532 .pressure_max = 1000,
534 .stopacq_polarity = 1,
535 .first_conversion_delay = 3,
536 .acquisition_time = 1,
538 .pen_down_acc_interval = 1,
542 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
543 #include <linux/spi/ad7879.h>
544 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
545 .model = 7879, /* Model = AD7879 */
546 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
547 .pressure_max = 10000,
549 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
550 .acquisition_time = 1, /* 4us acquisition time per sample */
551 .median = 2, /* do 8 measurements */
552 .averaging = 1, /* take the average of 4 middle samples */
553 .pen_down_acc_interval = 255, /* 9.4 ms */
554 .gpio_output = 1, /* configure AUX/VBAT/GPIO as GPIO output */
555 .gpio_default = 1, /* During initialization set GPIO = HIGH */
559 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
560 static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
566 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
567 && defined(CONFIG_SND_SOC_WM8731_SPI)
568 static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
574 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
575 static struct bfin5xx_spi_chip spidev_chip_info = {
581 static struct spi_board_info bfin_spi_board_info[] __initdata = {
582 #if defined(CONFIG_MTD_M25P80) \
583 || defined(CONFIG_MTD_M25P80_MODULE)
585 /* the modalias must be the same as spi device driver name */
586 .modalias = "m25p80", /* Name of spi_driver for this device */
587 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
588 .bus_num = 0, /* Framework bus number */
589 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
590 .platform_data = &bfin_spi_flash_data,
591 .controller_data = &spi_flash_chip_info,
596 #if defined(CONFIG_SPI_ADC_BF533) \
597 || defined(CONFIG_SPI_ADC_BF533_MODULE)
599 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
600 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
601 .bus_num = 0, /* Framework bus number */
602 .chip_select = 1, /* Framework chip select. */
603 .platform_data = NULL, /* No spi_driver specific config */
604 .controller_data = &spi_adc_chip_info,
608 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
609 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
611 .modalias = "ad1836-spi",
612 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
614 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
615 .controller_data = &ad1836_spi_chip_info,
618 #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
620 .modalias = "ad9960-spi",
621 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
624 .controller_data = &ad9960_spi_chip_info,
627 #if defined(CONFIG_PBX)
629 .modalias = "fxs-spi",
630 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
632 .chip_select = 8 - CONFIG_J11_JUMPER,
633 .controller_data = &spi_si3xxx_chip_info,
637 .modalias = "fxo-spi",
638 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
640 .chip_select = 8 - CONFIG_J19_JUMPER,
641 .controller_data = &spi_si3xxx_chip_info,
645 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
647 .modalias = "ad7877",
648 .platform_data = &bfin_ad7877_ts_info,
650 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
653 .controller_data = &spi_ad7877_chip_info,
656 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
658 .modalias = "ad7879",
659 .platform_data = &bfin_ad7879_ts_info,
661 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
664 .controller_data = &spi_ad7879_chip_info,
665 .mode = SPI_CPHA | SPI_CPOL,
668 #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
669 && defined(CONFIG_SND_SOC_WM8731_SPI)
671 .modalias = "wm8731",
672 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
675 .controller_data = &spi_wm8731_chip_info,
679 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
681 .modalias = "spidev",
682 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
685 .controller_data = &spidev_chip_info,
690 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
691 /* SPI controller data */
692 static struct bfin5xx_spi_master bfin_spi0_info = {
694 .enable_dma = 1, /* master has the ability to do dma transfer */
695 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
699 static struct resource bfin_spi0_resource[] = {
701 .start = SPI0_REGBASE,
702 .end = SPI0_REGBASE + 0xFF,
703 .flags = IORESOURCE_MEM,
708 .flags = IORESOURCE_IRQ,
712 static struct platform_device bfin_spi0_device = {
714 .id = 0, /* Bus number */
715 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
716 .resource = bfin_spi0_resource,
718 .platform_data = &bfin_spi0_info, /* Passed to driver */
721 #endif /* spi master and devices */
723 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
724 static struct platform_device bfin_fb_device = {
725 .name = "bf537-lq035",
729 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
730 static struct platform_device bfin_fb_adv7393_device = {
731 .name = "bfin-adv7393",
735 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
736 static struct resource bfin_uart_resources[] = {
737 #ifdef CONFIG_SERIAL_BFIN_UART0
741 .flags = IORESOURCE_MEM,
744 #ifdef CONFIG_SERIAL_BFIN_UART1
748 .flags = IORESOURCE_MEM,
753 static struct platform_device bfin_uart_device = {
756 .num_resources = ARRAY_SIZE(bfin_uart_resources),
757 .resource = bfin_uart_resources,
761 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
762 #ifdef CONFIG_BFIN_SIR0
763 static struct resource bfin_sir0_resources[] = {
767 .flags = IORESOURCE_MEM,
770 .start = IRQ_UART0_RX,
771 .end = IRQ_UART0_RX+1,
772 .flags = IORESOURCE_IRQ,
775 .start = CH_UART0_RX,
776 .end = CH_UART0_RX+1,
777 .flags = IORESOURCE_DMA,
781 static struct platform_device bfin_sir0_device = {
784 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
785 .resource = bfin_sir0_resources,
788 #ifdef CONFIG_BFIN_SIR1
789 static struct resource bfin_sir1_resources[] = {
793 .flags = IORESOURCE_MEM,
796 .start = IRQ_UART1_RX,
797 .end = IRQ_UART1_RX+1,
798 .flags = IORESOURCE_IRQ,
801 .start = CH_UART1_RX,
802 .end = CH_UART1_RX+1,
803 .flags = IORESOURCE_DMA,
807 static struct platform_device bfin_sir1_device = {
810 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
811 .resource = bfin_sir1_resources,
816 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
817 static struct resource bfin_twi0_resource[] = {
819 .start = TWI0_REGBASE,
821 .flags = IORESOURCE_MEM,
826 .flags = IORESOURCE_IRQ,
830 static struct platform_device i2c_bfin_twi_device = {
831 .name = "i2c-bfin-twi",
833 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
834 .resource = bfin_twi0_resource,
838 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
839 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
841 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
844 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
846 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
852 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
853 static struct platform_device bfin_sport0_uart_device = {
854 .name = "bfin-sport-uart",
858 static struct platform_device bfin_sport1_uart_device = {
859 .name = "bfin-sport-uart",
864 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
865 #include <linux/input.h>
866 #include <linux/gpio_keys.h>
868 static struct gpio_keys_button bfin_gpio_keys_table[] = {
869 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
870 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
873 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
874 .buttons = bfin_gpio_keys_table,
875 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
878 static struct platform_device bfin_device_gpiokeys = {
881 .platform_data = &bfin_gpio_keys_data,
886 #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
887 #include <linux/input.h>
888 #include <asm/bfin_rotary.h>
890 static struct bfin_rotary_platform_data bfin_rotary_data = {
891 /*.rotary_up_key = KEY_UP,*/
892 /*.rotary_down_key = KEY_DOWN,*/
893 .rotary_rel_code = REL_WHEEL,
894 .rotary_button_key = KEY_ENTER,
895 .debounce = 10, /* 0..17 */
896 .mode = ROT_QUAD_ENC | ROT_DEBE,
899 static struct resource bfin_rotary_resources[] = {
903 .flags = IORESOURCE_IRQ,
907 static struct platform_device bfin_rotary_device = {
908 .name = "bfin-rotary",
910 .num_resources = ARRAY_SIZE(bfin_rotary_resources),
911 .resource = bfin_rotary_resources,
913 .platform_data = &bfin_rotary_data,
918 static struct resource bfin_gpios_resources = {
920 .end = MAX_BLACKFIN_GPIOS - 1,
921 .flags = IORESOURCE_IRQ,
924 static struct platform_device bfin_gpios_device = {
925 .name = "simple-gpio",
928 .resource = &bfin_gpios_resources,
931 static const unsigned int cclk_vlev_datasheet[] =
933 VRPAIR(VLEV_100, 400000000),
934 VRPAIR(VLEV_105, 426000000),
935 VRPAIR(VLEV_110, 500000000),
936 VRPAIR(VLEV_115, 533000000),
937 VRPAIR(VLEV_120, 600000000),
940 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
941 .tuple_tab = cclk_vlev_datasheet,
942 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
943 .vr_settling_time = 25 /* us */,
946 static struct platform_device bfin_dpmc = {
949 .platform_data = &bfin_dmpc_vreg_data,
953 static struct platform_device *stamp_devices[] __initdata = {
957 #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
961 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
962 &bfin_pcmcia_cf_device,
965 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
969 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
973 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
977 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
978 &bfin_isp1760_device,
981 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
985 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
989 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
993 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
998 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
999 &net2272_bfin_device,
1002 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1006 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1010 #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
1011 &bf52x_t350mcqb_device,
1014 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1015 &bfin_fb_adv7393_device,
1018 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1022 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1023 #ifdef CONFIG_BFIN_SIR0
1026 #ifdef CONFIG_BFIN_SIR1
1031 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1032 &i2c_bfin_twi_device,
1035 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1036 &bfin_sport0_uart_device,
1037 &bfin_sport1_uart_device,
1040 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
1041 &bfin_device_gpiokeys,
1044 #if defined(CONFIG_JOYSTICK_BFIN_ROTARY) || defined(CONFIG_JOYSTICK_BFIN_ROTARY_MODULE)
1045 &bfin_rotary_device,
1048 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
1049 &ezkit_flash_device,
1055 static int __init ezkit_init(void)
1057 printk(KERN_INFO "%s(): registering device resources\n", __func__);
1058 i2c_register_board_info(0, bfin_i2c_board_info,
1059 ARRAY_SIZE(bfin_i2c_board_info));
1060 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
1061 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
1065 arch_initcall(ezkit_init);
1067 void native_machine_restart(char *cmd)
1069 /* workaround reboot hang when booting from SPI */
1070 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1071 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
1074 void bfin_get_ether_addr(char *addr)
1076 /* the MAC is stored in OTP memory page 0xDF */
1079 u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A;
1081 ret = otp_read(0xDF, 0x00, &otp_mac);
1083 char *otp_mac_p = (char *)&otp_mac;
1084 for (ret = 0; ret < 6; ++ret)
1085 addr[ret] = otp_mac_p[5 - ret];
1088 EXPORT_SYMBOL(bfin_get_ether_addr);