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/kernel.h>
11 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/nand.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/plat-ram.h>
17 #include <linux/mtd/physmap.h>
18 #include <linux/spi/spi.h>
19 #include <linux/spi/flash.h>
20 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
21 #include <linux/usb/isp1362.h>
23 #include <linux/i2c.h>
24 #include <linux/i2c/adp5588.h>
25 #include <linux/etherdevice.h>
26 #include <linux/ata_platform.h>
27 #include <linux/irq.h>
28 #include <linux/interrupt.h>
29 #include <linux/usb/sl811.h>
30 #include <linux/spi/mmc_spi.h>
31 #include <linux/leds.h>
32 #include <linux/input.h>
34 #include <asm/bfin5xx_spi.h>
35 #include <asm/reboot.h>
36 #include <asm/portmux.h>
40 * Name the Board for the /proc/cpuinfo
42 const char bfin_board_name[] = "ADI BF537-STAMP";
45 * Driver needs to know address, irq and flag pin.
48 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
49 #include <linux/usb/isp1760.h>
50 static struct resource bfin_isp1760_resources[] = {
53 .end = 0x203C0000 + 0x000fffff,
54 .flags = IORESOURCE_MEM,
59 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
63 static struct isp1760_platform_data isp1760_priv = {
68 .dack_polarity_high = 0,
69 .dreq_polarity_high = 0,
72 static struct platform_device bfin_isp1760_device = {
76 .platform_data = &isp1760_priv,
78 .num_resources = ARRAY_SIZE(bfin_isp1760_resources),
79 .resource = bfin_isp1760_resources,
83 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
84 #include <linux/gpio_keys.h>
86 static struct gpio_keys_button bfin_gpio_keys_table[] = {
87 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
88 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
89 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
90 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
93 static struct gpio_keys_platform_data bfin_gpio_keys_data = {
94 .buttons = bfin_gpio_keys_table,
95 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
98 static struct platform_device bfin_device_gpiokeys = {
101 .platform_data = &bfin_gpio_keys_data,
106 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
107 static struct resource bfin_pcmcia_cf_resources[] = {
109 .start = 0x20310000, /* IO PORT */
111 .flags = IORESOURCE_MEM,
113 .start = 0x20311000, /* Attribute Memory */
115 .flags = IORESOURCE_MEM,
119 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
121 .start = 6, /* Card Detect PF6 */
123 .flags = IORESOURCE_IRQ,
127 static struct platform_device bfin_pcmcia_cf_device = {
128 .name = "bfin_cf_pcmcia",
130 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
131 .resource = bfin_pcmcia_cf_resources,
135 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
136 static struct platform_device rtc_device = {
142 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
143 #include <linux/smc91x.h>
145 static struct smc91x_platdata smc91x_info = {
146 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
147 .leda = RPC_LED_100_10,
148 .ledb = RPC_LED_TX_RX,
151 static struct resource smc91x_resources[] = {
153 .name = "smc91x-regs",
155 .end = 0x20300300 + 16,
156 .flags = IORESOURCE_MEM,
161 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
164 static struct platform_device smc91x_device = {
167 .num_resources = ARRAY_SIZE(smc91x_resources),
168 .resource = smc91x_resources,
170 .platform_data = &smc91x_info,
175 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
176 static struct resource dm9000_resources[] = {
179 .end = 0x203FB800 + 1,
180 .flags = IORESOURCE_MEM,
184 .end = 0x203FB804 + 1,
185 .flags = IORESOURCE_MEM,
190 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
194 static struct platform_device dm9000_device = {
197 .num_resources = ARRAY_SIZE(dm9000_resources),
198 .resource = dm9000_resources,
202 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
203 static struct resource sl811_hcd_resources[] = {
207 .flags = IORESOURCE_MEM,
211 .flags = IORESOURCE_MEM,
215 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
219 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
220 void sl811_port_power(struct device *dev, int is_on)
222 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
223 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
227 static struct sl811_platform_data sl811_priv = {
229 .power = 250, /* == 500mA */
230 #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
231 .port_power = &sl811_port_power,
235 static struct platform_device sl811_hcd_device = {
239 .platform_data = &sl811_priv,
241 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
242 .resource = sl811_hcd_resources,
246 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
247 static struct resource isp1362_hcd_resources[] = {
251 .flags = IORESOURCE_MEM,
255 .flags = IORESOURCE_MEM,
259 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
263 static struct isp1362_platform_data isp1362_priv = {
268 .int_edge_triggered = 0,
269 .remote_wakeup_connected = 0,
270 .no_power_switching = 1,
271 .power_switching_mode = 0,
274 static struct platform_device isp1362_hcd_device = {
275 .name = "isp1362-hcd",
278 .platform_data = &isp1362_priv,
280 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
281 .resource = isp1362_hcd_resources,
285 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
286 unsigned short bfin_can_peripherals[] = {
287 P_CAN0_RX, P_CAN0_TX, 0
290 static struct resource bfin_can_resources[] = {
294 .flags = IORESOURCE_MEM,
299 .flags = IORESOURCE_IRQ,
304 .flags = IORESOURCE_IRQ,
307 .start = IRQ_CAN_ERROR,
308 .end = IRQ_CAN_ERROR,
309 .flags = IORESOURCE_IRQ,
313 static struct platform_device bfin_can_device = {
315 .num_resources = ARRAY_SIZE(bfin_can_resources),
316 .resource = bfin_can_resources,
318 .platform_data = &bfin_can_peripherals, /* Passed to driver */
323 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
324 static struct platform_device bfin_mii_bus = {
325 .name = "bfin_mii_bus",
328 static struct platform_device bfin_mac_device = {
330 .dev.platform_data = &bfin_mii_bus,
334 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
335 static struct resource net2272_bfin_resources[] = {
338 .end = 0x20300000 + 0x100,
339 .flags = IORESOURCE_MEM,
343 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
347 static struct platform_device net2272_bfin_device = {
350 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
351 .resource = net2272_bfin_resources,
355 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
356 #ifdef CONFIG_MTD_PARTITIONS
357 const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
359 static struct mtd_partition bfin_plat_nand_partitions[] = {
361 .name = "linux kernel(nand)",
365 .name = "file system(nand)",
366 .size = MTDPART_SIZ_FULL,
367 .offset = MTDPART_OFS_APPEND,
372 #define BFIN_NAND_PLAT_CLE 2
373 #define BFIN_NAND_PLAT_ALE 1
374 static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
376 struct nand_chip *this = mtd->priv;
378 if (cmd == NAND_CMD_NONE)
382 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
384 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
387 #define BFIN_NAND_PLAT_READY GPIO_PF3
388 static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
390 return gpio_get_value(BFIN_NAND_PLAT_READY);
393 static struct platform_nand_data bfin_plat_nand_data = {
396 #ifdef CONFIG_MTD_PARTITIONS
397 .part_probe_types = part_probes,
398 .partitions = bfin_plat_nand_partitions,
399 .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
403 .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
404 .dev_ready = bfin_plat_nand_dev_ready,
408 #define MAX(x, y) (x > y ? x : y)
409 static struct resource bfin_plat_nand_resources = {
411 .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
412 .flags = IORESOURCE_IO,
415 static struct platform_device bfin_async_nand_device = {
419 .resource = &bfin_plat_nand_resources,
421 .platform_data = &bfin_plat_nand_data,
425 static void bfin_plat_nand_init(void)
427 gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
430 static void bfin_plat_nand_init(void) {}
433 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
434 static struct mtd_partition stamp_partitions[] = {
436 .name = "bootloader(nor)",
440 .name = "linux kernel(nor)",
442 .offset = MTDPART_OFS_APPEND,
444 .name = "file system(nor)",
445 .size = 0x400000 - 0x40000 - 0x180000 - 0x10000,
446 .offset = MTDPART_OFS_APPEND,
448 .name = "MAC Address(nor)",
449 .size = MTDPART_SIZ_FULL,
451 .mask_flags = MTD_WRITEABLE,
455 static struct physmap_flash_data stamp_flash_data = {
457 .parts = stamp_partitions,
458 .nr_parts = ARRAY_SIZE(stamp_partitions),
459 #ifdef CONFIG_ROMKERNEL
460 .probe_type = "map_rom",
464 static struct resource stamp_flash_resource = {
467 .flags = IORESOURCE_MEM,
470 static struct platform_device stamp_flash_device = {
471 .name = "physmap-flash",
474 .platform_data = &stamp_flash_data,
477 .resource = &stamp_flash_resource,
481 #if defined(CONFIG_MTD_M25P80) \
482 || defined(CONFIG_MTD_M25P80_MODULE)
483 static struct mtd_partition bfin_spi_flash_partitions[] = {
485 .name = "bootloader(spi)",
488 .mask_flags = MTD_CAP_ROM
490 .name = "linux kernel(spi)",
492 .offset = MTDPART_OFS_APPEND,
494 .name = "file system(spi)",
495 .size = MTDPART_SIZ_FULL,
496 .offset = MTDPART_OFS_APPEND,
500 static struct flash_platform_data bfin_spi_flash_data = {
502 .parts = bfin_spi_flash_partitions,
503 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
504 /* .type = "m25p64", */
507 /* SPI flash chip (m25p64) */
508 static struct bfin5xx_spi_chip spi_flash_chip_info = {
509 .enable_dma = 0, /* use dma transfer with this chip*/
514 #if defined(CONFIG_BFIN_SPI_ADC) \
515 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
517 static struct bfin5xx_spi_chip spi_adc_chip_info = {
518 .enable_dma = 1, /* use dma transfer with this chip*/
523 #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
524 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
525 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
531 #if defined(CONFIG_SND_BF5XX_SOC_AD193X) \
532 || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE)
533 static struct bfin5xx_spi_chip ad1938_spi_chip_info = {
539 #if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
540 #include <linux/input/ad714x.h>
541 static struct bfin5xx_spi_chip ad7147_spi_chip_info = {
546 static struct ad714x_slider_plat ad7147_spi_slider_plat[] = {
554 static struct ad714x_button_plat ad7147_spi_button_plat[] = {
556 .keycode = BTN_FORWARD,
566 .keycode = BTN_MIDDLE,
571 .keycode = BTN_RIGHT,
581 static struct ad714x_platform_data ad7147_spi_platform_data = {
584 .slider = ad7147_spi_slider_plat,
585 .button = ad7147_spi_button_plat,
587 {0xFBFF, 0x1FFF, 0, 0x2626, 1600, 1600, 1600, 1600},
588 {0xEFFF, 0x1FFF, 0, 0x2626, 1650, 1650, 1650, 1650},
589 {0xFFFF, 0x1FFE, 0, 0x2626, 1650, 1650, 1650, 1650},
590 {0xFFFF, 0x1FFB, 0, 0x2626, 1650, 1650, 1650, 1650},
591 {0xFFFF, 0x1FEF, 0, 0x2626, 1650, 1650, 1650, 1650},
592 {0xFFFF, 0x1FBF, 0, 0x2626, 1650, 1650, 1650, 1650},
593 {0xFFFF, 0x1EFF, 0, 0x2626, 1650, 1650, 1650, 1650},
594 {0xFFFF, 0x1BFF, 0, 0x2626, 1600, 1600, 1600, 1600},
595 {0xFF7B, 0x3FFF, 0x506, 0x2626, 1100, 1100, 1150, 1150},
596 {0xFDFE, 0x3FFF, 0x606, 0x2626, 1100, 1100, 1150, 1150},
597 {0xFEBA, 0x1FFF, 0x1400, 0x2626, 1200, 1200, 1300, 1300},
598 {0xFFEF, 0x1FFF, 0x0, 0x2626, 1100, 1100, 1150, 1150},
600 .sys_cfg_reg = {0x2B2, 0x0, 0x3233, 0x819, 0x832, 0xCFF, 0xCFF, 0x0},
604 #if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
605 #include <linux/input/ad714x.h>
606 static struct ad714x_button_plat ad7142_i2c_button_plat[] = {
628 static struct ad714x_platform_data ad7142_i2c_platform_data = {
630 .button = ad7142_i2c_button_plat,
632 /* fixme: figure out right setting for all comoponent according
633 * to hardware feature of EVAL-AD7142EB board */
634 {0xE7FF, 0x3FFF, 0x0005, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
635 {0xFDBF, 0x3FFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
636 {0xFFFF, 0x2DFF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
637 {0xFFFF, 0x37BF, 0x0001, 0x2626, 0x01F4, 0x01F4, 0x028A, 0x028A},
638 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
639 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
640 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
641 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
642 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
643 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
644 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
645 {0xFFFF, 0x3FFF, 0x0000, 0x0606, 0x01F4, 0x01F4, 0x0320, 0x0320},
647 .sys_cfg_reg = {0x0B2, 0x0, 0x690, 0x664, 0x290F, 0xF, 0xF, 0x0},
651 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
652 #define MMC_SPI_CARD_DETECT_INT IRQ_PF5
654 static int bfin_mmc_spi_init(struct device *dev,
655 irqreturn_t (*detect_int)(int, void *), void *data)
657 return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int,
658 IRQF_TRIGGER_FALLING, "mmc-spi-detect", data);
661 static void bfin_mmc_spi_exit(struct device *dev, void *data)
663 free_irq(MMC_SPI_CARD_DETECT_INT, data);
666 static struct mmc_spi_platform_data bfin_mmc_spi_pdata = {
667 .init = bfin_mmc_spi_init,
668 .exit = bfin_mmc_spi_exit,
669 .detect_delay = 100, /* msecs */
672 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
679 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
680 #include <linux/spi/ad7877.h>
681 static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
686 static const struct ad7877_platform_data bfin_ad7877_ts_info = {
688 .vref_delay_usecs = 50, /* internal, no capacitor */
691 .pressure_max = 1000,
693 .stopacq_polarity = 1,
694 .first_conversion_delay = 3,
695 .acquisition_time = 1,
697 .pen_down_acc_interval = 1,
701 #if defined(CONFIG_TOUCHSCREEN_AD7879) || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
702 #include <linux/spi/ad7879.h>
703 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
704 .model = 7879, /* Model = AD7879 */
705 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
706 .pressure_max = 10000,
708 .first_conversion_delay = 3, /* wait 512us before do a first conversion */
709 .acquisition_time = 1, /* 4us acquisition time per sample */
710 .median = 2, /* do 8 measurements */
711 .averaging = 1, /* take the average of 4 middle samples */
712 .pen_down_acc_interval = 255, /* 9.4 ms */
713 .gpio_export = 1, /* Export GPIO to gpiolib */
714 .gpio_base = -1, /* Dynamic allocation */
718 #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
719 #include <linux/input/adxl34x.h>
720 static const struct adxl34x_platform_data adxl34x_info = {
724 .tap_threshold = 0x31,
725 .tap_duration = 0x10,
728 .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
729 .act_axis_control = 0xFF,
730 .activity_threshold = 5,
731 .inactivity_threshold = 3,
732 .inactivity_time = 4,
733 .free_fall_threshold = 0x7,
734 .free_fall_time = 0x20,
736 .data_range = ADXL_FULL_RES,
739 .ev_code_x = ABS_X, /* EV_REL */
740 .ev_code_y = ABS_Y, /* EV_REL */
741 .ev_code_z = ABS_Z, /* EV_REL */
743 .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
745 /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
746 /* .ev_code_act_inactivity = KEY_A,*/ /* EV_KEY */
747 .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
748 .fifo_mode = ADXL_FIFO_STREAM,
752 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
753 static struct bfin5xx_spi_chip spi_ad7879_chip_info = {
759 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
760 static struct bfin5xx_spi_chip spidev_chip_info = {
766 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
767 static struct bfin5xx_spi_chip lq035q1_spi_chip_info = {
773 #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
774 static struct bfin5xx_spi_chip enc28j60_spi_chip_info = {
777 .cs_gpio = GPIO_PF10,
781 #if defined(CONFIG_ADF702X) || defined(CONFIG_ADF702X_MODULE)
782 static struct bfin5xx_spi_chip adf7021_spi_chip_info = {
784 .cs_gpio = GPIO_PF10,
787 #include <linux/spi/adf702x.h>
788 #define TXREG 0x0160A470
789 static const u32 adf7021_regs[] = {
808 static struct adf702x_platform_data adf7021_platform_data = {
809 .regs_base = (void *)SPORT1_TCR1,
810 .dma_ch_rx = CH_SPORT1_RX,
811 .dma_ch_tx = CH_SPORT1_TX,
812 .irq_sport_err = IRQ_SPORT1_ERROR,
813 .gpio_int_rfs = GPIO_PF8,
814 .pin_req = {P_SPORT1_DTPRI, P_SPORT1_RFS, P_SPORT1_DRPRI,
815 P_SPORT1_RSCLK, P_SPORT1_TSCLK, 0},
816 .adf702x_model = MODEL_ADF7021,
817 .adf702x_regs = adf7021_regs,
820 static inline void adf702x_mac_init(void)
822 random_ether_addr(adf7021_platform_data.mac_addr);
825 static inline void adf702x_mac_init(void) {}
828 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
829 #include <linux/spi/ads7846.h>
830 static struct bfin5xx_spi_chip ad7873_spi_chip_info = {
834 static int ads7873_get_pendown_state(void)
836 return gpio_get_value(GPIO_PF6);
839 static struct ads7846_platform_data __initdata ad7873_pdata = {
840 .model = 7873, /* AD7873 */
846 .debounce_tol = (~0),
847 .get_pendown_state = ads7873_get_pendown_state,
851 #if defined(CONFIG_MTD_DATAFLASH) \
852 || defined(CONFIG_MTD_DATAFLASH_MODULE)
854 static struct mtd_partition bfin_spi_dataflash_partitions[] = {
856 .name = "bootloader(spi)",
859 .mask_flags = MTD_CAP_ROM
861 .name = "linux kernel(spi)",
863 .offset = MTDPART_OFS_APPEND,
865 .name = "file system(spi)",
866 .size = MTDPART_SIZ_FULL,
867 .offset = MTDPART_OFS_APPEND,
871 static struct flash_platform_data bfin_spi_dataflash_data = {
872 .name = "SPI Dataflash",
873 .parts = bfin_spi_dataflash_partitions,
874 .nr_parts = ARRAY_SIZE(bfin_spi_dataflash_partitions),
878 static struct bfin5xx_spi_chip data_flash_chip_info = {
879 .enable_dma = 0, /* use dma transfer with this chip*/
884 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
885 static struct bfin5xx_spi_chip spi_adxl34x_chip_info = {
886 .enable_dma = 0, /* use dma transfer with this chip*/
891 static struct spi_board_info bfin_spi_board_info[] __initdata = {
892 #if defined(CONFIG_MTD_M25P80) \
893 || defined(CONFIG_MTD_M25P80_MODULE)
895 /* the modalias must be the same as spi device driver name */
896 .modalias = "m25p80", /* Name of spi_driver for this device */
897 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
898 .bus_num = 0, /* Framework bus number */
899 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
900 .platform_data = &bfin_spi_flash_data,
901 .controller_data = &spi_flash_chip_info,
905 #if defined(CONFIG_MTD_DATAFLASH) \
906 || defined(CONFIG_MTD_DATAFLASH_MODULE)
907 { /* DataFlash chip */
908 .modalias = "mtd_dataflash",
909 .max_speed_hz = 33250000, /* max spi clock (SCK) speed in HZ */
910 .bus_num = 0, /* Framework bus number */
911 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
912 .platform_data = &bfin_spi_dataflash_data,
913 .controller_data = &data_flash_chip_info,
917 #if defined(CONFIG_BFIN_SPI_ADC) \
918 || defined(CONFIG_BFIN_SPI_ADC_MODULE)
920 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
921 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
922 .bus_num = 0, /* Framework bus number */
923 .chip_select = 1, /* Framework chip select. */
924 .platform_data = NULL, /* No spi_driver specific config */
925 .controller_data = &spi_adc_chip_info,
929 #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
930 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
932 .modalias = "ad1836",
933 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
935 .chip_select = 4,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
936 .controller_data = &ad1836_spi_chip_info,
941 #if defined(CONFIG_SND_BF5XX_SOC_AD193X) || defined(CONFIG_SND_BF5XX_SOC_AD193X_MODULE)
943 .modalias = "ad193x",
944 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
947 .controller_data = &ad1938_spi_chip_info,
952 #if defined(CONFIG_INPUT_AD714X_SPI) || defined(CONFIG_INPUT_AD714X_SPI_MODULE)
954 .modalias = "ad714x_captouch",
955 .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */
960 .platform_data = &ad7147_spi_platform_data,
961 .controller_data = &ad7147_spi_chip_info,
965 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
967 .modalias = "mmc_spi",
968 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
971 .platform_data = &bfin_mmc_spi_pdata,
972 .controller_data = &mmc_spi_chip_info,
976 #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
978 .modalias = "ad7877",
979 .platform_data = &bfin_ad7877_ts_info,
981 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
984 .controller_data = &spi_ad7877_chip_info,
987 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
989 .modalias = "ad7879",
990 .platform_data = &bfin_ad7879_ts_info,
992 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
995 .controller_data = &spi_ad7879_chip_info,
996 .mode = SPI_CPHA | SPI_CPOL,
999 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
1001 .modalias = "spidev",
1002 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
1005 .controller_data = &spidev_chip_info,
1008 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1010 .modalias = "bfin-lq035q1-spi",
1011 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
1014 .controller_data = &lq035q1_spi_chip_info,
1015 .mode = SPI_CPHA | SPI_CPOL,
1018 #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
1020 .modalias = "enc28j60",
1021 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
1024 .chip_select = 0, /* GPIO controlled SSEL */
1025 .controller_data = &enc28j60_spi_chip_info,
1029 #if defined(CONFIG_INPUT_ADXL34X_SPI) || defined(CONFIG_INPUT_ADXL34X_SPI_MODULE)
1031 .modalias = "adxl34x",
1032 .platform_data = &adxl34x_info,
1034 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
1037 .controller_data = &spi_adxl34x_chip_info,
1041 #if defined(CONFIG_ADF702X) || defined(CONFIG_ADF702X_MODULE)
1043 .modalias = "adf702x",
1044 .max_speed_hz = 16000000, /* max spi clock (SCK) speed in HZ */
1046 .chip_select = 0, /* GPIO controlled SSEL */
1047 .controller_data = &adf7021_spi_chip_info,
1048 .platform_data = &adf7021_platform_data,
1052 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
1054 .modalias = "ads7846",
1055 .max_speed_hz = 2000000, /* max spi clock (SCK) speed in HZ */
1058 .chip_select = GPIO_PF10 + MAX_CTRL_CS, /* GPIO controlled SSEL */
1059 .controller_data = &ad7873_spi_chip_info,
1060 .platform_data = &ad7873_pdata,
1066 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1067 /* SPI controller data */
1068 static struct bfin5xx_spi_master bfin_spi0_info = {
1069 .num_chipselect = 8,
1070 .enable_dma = 1, /* master has the ability to do dma transfer */
1071 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1075 static struct resource bfin_spi0_resource[] = {
1077 .start = SPI0_REGBASE,
1078 .end = SPI0_REGBASE + 0xFF,
1079 .flags = IORESOURCE_MEM,
1084 .flags = IORESOURCE_DMA,
1089 .flags = IORESOURCE_IRQ,
1093 static struct platform_device bfin_spi0_device = {
1095 .id = 0, /* Bus number */
1096 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1097 .resource = bfin_spi0_resource,
1099 .platform_data = &bfin_spi0_info, /* Passed to driver */
1102 #endif /* spi master and devices */
1104 #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
1106 /* SPORT SPI controller data */
1107 static struct bfin5xx_spi_master bfin_sport_spi0_info = {
1108 .num_chipselect = 1, /* master only supports one device */
1109 .enable_dma = 0, /* master don't support DMA */
1110 .pin_req = {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_DRPRI,
1111 P_SPORT0_RSCLK, P_SPORT0_TFS, P_SPORT0_RFS, 0},
1114 static struct resource bfin_sport_spi0_resource[] = {
1116 .start = SPORT0_TCR1,
1117 .end = SPORT0_TCR1 + 0xFF,
1118 .flags = IORESOURCE_MEM,
1121 .start = IRQ_SPORT0_ERROR,
1122 .end = IRQ_SPORT0_ERROR,
1123 .flags = IORESOURCE_IRQ,
1127 static struct platform_device bfin_sport_spi0_device = {
1128 .name = "bfin-sport-spi",
1129 .id = 1, /* Bus number */
1130 .num_resources = ARRAY_SIZE(bfin_sport_spi0_resource),
1131 .resource = bfin_sport_spi0_resource,
1133 .platform_data = &bfin_sport_spi0_info, /* Passed to driver */
1137 static struct bfin5xx_spi_master bfin_sport_spi1_info = {
1138 .num_chipselect = 1, /* master only supports one device */
1139 .enable_dma = 0, /* master don't support DMA */
1140 .pin_req = {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_DRPRI,
1141 P_SPORT1_RSCLK, P_SPORT1_TFS, P_SPORT1_RFS, 0},
1144 static struct resource bfin_sport_spi1_resource[] = {
1146 .start = SPORT1_TCR1,
1147 .end = SPORT1_TCR1 + 0xFF,
1148 .flags = IORESOURCE_MEM,
1151 .start = IRQ_SPORT1_ERROR,
1152 .end = IRQ_SPORT1_ERROR,
1153 .flags = IORESOURCE_IRQ,
1157 static struct platform_device bfin_sport_spi1_device = {
1158 .name = "bfin-sport-spi",
1159 .id = 2, /* Bus number */
1160 .num_resources = ARRAY_SIZE(bfin_sport_spi1_resource),
1161 .resource = bfin_sport_spi1_resource,
1163 .platform_data = &bfin_sport_spi1_info, /* Passed to driver */
1167 #endif /* sport spi master and devices */
1169 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1170 static struct platform_device bfin_fb_device = {
1171 .name = "bf537-lq035",
1175 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1176 #include <asm/bfin-lq035q1.h>
1178 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
1179 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
1180 .ppi_mode = USE_RGB565_16_BIT_PPI,
1181 .use_bl = 0, /* let something else control the LCD Blacklight */
1182 .gpio_bl = GPIO_PF7,
1185 static struct resource bfin_lq035q1_resources[] = {
1187 .start = IRQ_PPI_ERROR,
1188 .end = IRQ_PPI_ERROR,
1189 .flags = IORESOURCE_IRQ,
1193 static struct platform_device bfin_lq035q1_device = {
1194 .name = "bfin-lq035q1",
1196 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
1197 .resource = bfin_lq035q1_resources,
1199 .platform_data = &bfin_lq035q1_data,
1204 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1205 #ifdef CONFIG_SERIAL_BFIN_UART0
1206 static struct resource bfin_uart0_resources[] = {
1209 .end = UART0_GCTL+2,
1210 .flags = IORESOURCE_MEM,
1213 .start = IRQ_UART0_RX,
1214 .end = IRQ_UART0_RX+1,
1215 .flags = IORESOURCE_IRQ,
1218 .start = IRQ_UART0_ERROR,
1219 .end = IRQ_UART0_ERROR,
1220 .flags = IORESOURCE_IRQ,
1223 .start = CH_UART0_TX,
1225 .flags = IORESOURCE_DMA,
1228 .start = CH_UART0_RX,
1230 .flags = IORESOURCE_DMA,
1232 #ifdef CONFIG_BFIN_UART0_CTSRTS
1236 .flags = IORESOURCE_IO,
1241 .flags = IORESOURCE_IO,
1246 unsigned short bfin_uart0_peripherals[] = {
1247 P_UART0_TX, P_UART0_RX, 0
1250 static struct platform_device bfin_uart0_device = {
1251 .name = "bfin-uart",
1253 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
1254 .resource = bfin_uart0_resources,
1256 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
1260 #ifdef CONFIG_SERIAL_BFIN_UART1
1261 static struct resource bfin_uart1_resources[] = {
1264 .end = UART1_GCTL+2,
1265 .flags = IORESOURCE_MEM,
1268 .start = IRQ_UART1_RX,
1269 .end = IRQ_UART1_RX+1,
1270 .flags = IORESOURCE_IRQ,
1273 .start = IRQ_UART1_ERROR,
1274 .end = IRQ_UART1_ERROR,
1275 .flags = IORESOURCE_IRQ,
1278 .start = CH_UART1_TX,
1280 .flags = IORESOURCE_DMA,
1283 .start = CH_UART1_RX,
1285 .flags = IORESOURCE_DMA,
1289 unsigned short bfin_uart1_peripherals[] = {
1290 P_UART1_TX, P_UART1_RX, 0
1293 static struct platform_device bfin_uart1_device = {
1294 .name = "bfin-uart",
1296 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
1297 .resource = bfin_uart1_resources,
1299 .platform_data = &bfin_uart1_peripherals, /* Passed to driver */
1305 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
1306 #ifdef CONFIG_BFIN_SIR0
1307 static struct resource bfin_sir0_resources[] = {
1309 .start = 0xFFC00400,
1311 .flags = IORESOURCE_MEM,
1314 .start = IRQ_UART0_RX,
1315 .end = IRQ_UART0_RX+1,
1316 .flags = IORESOURCE_IRQ,
1319 .start = CH_UART0_RX,
1320 .end = CH_UART0_RX+1,
1321 .flags = IORESOURCE_DMA,
1325 static struct platform_device bfin_sir0_device = {
1328 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
1329 .resource = bfin_sir0_resources,
1332 #ifdef CONFIG_BFIN_SIR1
1333 static struct resource bfin_sir1_resources[] = {
1335 .start = 0xFFC02000,
1337 .flags = IORESOURCE_MEM,
1340 .start = IRQ_UART1_RX,
1341 .end = IRQ_UART1_RX+1,
1342 .flags = IORESOURCE_IRQ,
1345 .start = CH_UART1_RX,
1346 .end = CH_UART1_RX+1,
1347 .flags = IORESOURCE_DMA,
1351 static struct platform_device bfin_sir1_device = {
1354 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
1355 .resource = bfin_sir1_resources,
1360 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
1361 static struct resource bfin_twi0_resource[] = {
1363 .start = TWI0_REGBASE,
1364 .end = TWI0_REGBASE,
1365 .flags = IORESOURCE_MEM,
1370 .flags = IORESOURCE_IRQ,
1374 static struct platform_device i2c_bfin_twi_device = {
1375 .name = "i2c-bfin-twi",
1377 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
1378 .resource = bfin_twi0_resource,
1382 #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1383 static const unsigned short adp5588_keymap[ADP5588_KEYMAPSIZE] = {
1397 [13] = KEY_BACKSLASH,
1409 [26] = KEY_LEFTBRACE,
1410 [27] = KEY_RIGHTBRACE,
1423 [41] = KEY_SEMICOLON,
1424 [42] = KEY_APOSTROPHE,
1425 [43] = KEY_BACKSLASH,
1445 [65] = KEY_BACKSPACE,
1458 static struct adp5588_kpad_platform_data adp5588_kpad_data = {
1461 .keymap = adp5588_keymap,
1462 .keymapsize = ARRAY_SIZE(adp5588_keymap),
1467 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1468 #include <linux/mfd/adp5520.h>
1471 * ADP5520/5501 Backlight Data
1474 static struct adp5520_backlight_platform_data adp5520_backlight_data = {
1475 .fade_in = ADP5520_FADE_T_1200ms,
1476 .fade_out = ADP5520_FADE_T_1200ms,
1477 .fade_led_law = ADP5520_BL_LAW_LINEAR,
1479 .abml_filt = ADP5520_BL_AMBL_FILT_640ms,
1480 .l1_daylight_max = ADP5520_BL_CUR_mA(15),
1481 .l1_daylight_dim = ADP5520_BL_CUR_mA(0),
1482 .l2_office_max = ADP5520_BL_CUR_mA(7),
1483 .l2_office_dim = ADP5520_BL_CUR_mA(0),
1484 .l3_dark_max = ADP5520_BL_CUR_mA(3),
1485 .l3_dark_dim = ADP5520_BL_CUR_mA(0),
1486 .l2_trip = ADP5520_L2_COMP_CURR_uA(700),
1487 .l2_hyst = ADP5520_L2_COMP_CURR_uA(50),
1488 .l3_trip = ADP5520_L3_COMP_CURR_uA(80),
1489 .l3_hyst = ADP5520_L3_COMP_CURR_uA(20),
1493 * ADP5520/5501 LEDs Data
1496 static struct led_info adp5520_leds[] = {
1498 .name = "adp5520-led1",
1499 .default_trigger = "none",
1500 .flags = FLAG_ID_ADP5520_LED1_ADP5501_LED0 | ADP5520_LED_OFFT_600ms,
1502 #ifdef ADP5520_EN_ALL_LEDS
1504 .name = "adp5520-led2",
1505 .default_trigger = "none",
1506 .flags = FLAG_ID_ADP5520_LED2_ADP5501_LED1,
1509 .name = "adp5520-led3",
1510 .default_trigger = "none",
1511 .flags = FLAG_ID_ADP5520_LED3_ADP5501_LED2,
1516 static struct adp5520_leds_platform_data adp5520_leds_data = {
1517 .num_leds = ARRAY_SIZE(adp5520_leds),
1518 .leds = adp5520_leds,
1519 .fade_in = ADP5520_FADE_T_600ms,
1520 .fade_out = ADP5520_FADE_T_600ms,
1521 .led_on_time = ADP5520_LED_ONT_600ms,
1528 static struct adp5520_gpio_platform_data adp5520_gpio_data = {
1530 .gpio_en_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
1531 .gpio_pullup_mask = ADP5520_GPIO_C1 | ADP5520_GPIO_C2 | ADP5520_GPIO_R2,
1535 * ADP5520 Keypad Data
1538 static const unsigned short adp5520_keymap[ADP5520_KEYMAPSIZE] = {
1539 [ADP5520_KEY(0, 0)] = KEY_GRAVE,
1540 [ADP5520_KEY(0, 1)] = KEY_1,
1541 [ADP5520_KEY(0, 2)] = KEY_2,
1542 [ADP5520_KEY(0, 3)] = KEY_3,
1543 [ADP5520_KEY(1, 0)] = KEY_4,
1544 [ADP5520_KEY(1, 1)] = KEY_5,
1545 [ADP5520_KEY(1, 2)] = KEY_6,
1546 [ADP5520_KEY(1, 3)] = KEY_7,
1547 [ADP5520_KEY(2, 0)] = KEY_8,
1548 [ADP5520_KEY(2, 1)] = KEY_9,
1549 [ADP5520_KEY(2, 2)] = KEY_0,
1550 [ADP5520_KEY(2, 3)] = KEY_MINUS,
1551 [ADP5520_KEY(3, 0)] = KEY_EQUAL,
1552 [ADP5520_KEY(3, 1)] = KEY_BACKSLASH,
1553 [ADP5520_KEY(3, 2)] = KEY_BACKSPACE,
1554 [ADP5520_KEY(3, 3)] = KEY_ENTER,
1557 static struct adp5520_keys_platform_data adp5520_keys_data = {
1558 .rows_en_mask = ADP5520_ROW_R3 | ADP5520_ROW_R2 | ADP5520_ROW_R1 | ADP5520_ROW_R0,
1559 .cols_en_mask = ADP5520_COL_C3 | ADP5520_COL_C2 | ADP5520_COL_C1 | ADP5520_COL_C0,
1560 .keymap = adp5520_keymap,
1561 .keymapsize = ARRAY_SIZE(adp5520_keymap),
1566 * ADP5520/5501 Multifuction Device Init Data
1569 static struct adp5520_platform_data adp5520_pdev_data = {
1570 .backlight = &adp5520_backlight_data,
1571 .leds = &adp5520_leds_data,
1572 .gpio = &adp5520_gpio_data,
1573 .keys = &adp5520_keys_data,
1578 #if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
1579 static struct adp5588_gpio_platform_data adp5588_gpio_data = {
1581 .pullup_dis_mask = 0,
1585 #if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
1586 #include <linux/i2c/adp8870.h>
1587 static struct led_info adp8870_leds[] = {
1589 .name = "adp8870-led7",
1590 .default_trigger = "none",
1591 .flags = ADP8870_LED_D7 | ADP8870_LED_OFFT_600ms,
1596 static struct adp8870_backlight_platform_data adp8870_pdata = {
1597 .bl_led_assign = ADP8870_BL_D1 | ADP8870_BL_D2 | ADP8870_BL_D3 |
1598 ADP8870_BL_D4 | ADP8870_BL_D5 | ADP8870_BL_D6, /* 1 = Backlight 0 = Individual LED */
1599 .pwm_assign = 0, /* 1 = Enables PWM mode */
1601 .bl_fade_in = ADP8870_FADE_T_1200ms, /* Backlight Fade-In Timer */
1602 .bl_fade_out = ADP8870_FADE_T_1200ms, /* Backlight Fade-Out Timer */
1603 .bl_fade_law = ADP8870_FADE_LAW_CUBIC1, /* fade-on/fade-off transfer characteristic */
1605 .en_ambl_sens = 1, /* 1 = enable ambient light sensor */
1606 .abml_filt = ADP8870_BL_AMBL_FILT_320ms, /* Light sensor filter time */
1608 .l1_daylight_max = ADP8870_BL_CUR_mA(20), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1609 .l1_daylight_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1610 .l2_bright_max = ADP8870_BL_CUR_mA(14), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1611 .l2_bright_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1612 .l3_office_max = ADP8870_BL_CUR_mA(6), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1613 .l3_office_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1614 .l4_indoor_max = ADP8870_BL_CUR_mA(3), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1615 .l4_indor_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1616 .l5_dark_max = ADP8870_BL_CUR_mA(2), /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
1617 .l5_dark_dim = ADP8870_BL_CUR_mA(0), /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
1619 .l2_trip = ADP8870_L2_COMP_CURR_uA(710), /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1620 .l2_hyst = ADP8870_L2_COMP_CURR_uA(73), /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
1621 .l3_trip = ADP8870_L3_COMP_CURR_uA(389), /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
1622 .l3_hyst = ADP8870_L3_COMP_CURR_uA(54), /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
1623 .l4_trip = ADP8870_L4_COMP_CURR_uA(167), /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
1624 .l4_hyst = ADP8870_L4_COMP_CURR_uA(16), /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */
1625 .l5_trip = ADP8870_L5_COMP_CURR_uA(43), /* use L5_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1626 .l5_hyst = ADP8870_L5_COMP_CURR_uA(11), /* use L6_COMP_CURR_uA(I) 0 <= I <= 138 uA */
1628 .leds = adp8870_leds,
1629 .num_leds = ARRAY_SIZE(adp8870_leds),
1630 .led_fade_law = ADP8870_FADE_LAW_SQUARE, /* fade-on/fade-off transfer characteristic */
1631 .led_fade_in = ADP8870_FADE_T_600ms,
1632 .led_fade_out = ADP8870_FADE_T_600ms,
1633 .led_on_time = ADP8870_LED_ONT_200ms,
1637 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
1638 #if defined(CONFIG_INPUT_AD714X_I2C) || defined(CONFIG_INPUT_AD714X_I2C_MODULE)
1640 I2C_BOARD_INFO("ad7142_captouch", 0x2C),
1642 .platform_data = (void *)&ad7142_i2c_platform_data,
1646 #if defined(CONFIG_AD7150) || defined(CONFIG_AD7150_MODULE)
1648 I2C_BOARD_INFO("ad7150", 0x48),
1649 .irq = IRQ_PG5, /* fixme: use real interrupt number */
1653 #if defined(CONFIG_AD7152) || defined(CONFIG_AD7152_MODULE)
1655 I2C_BOARD_INFO("ad7152", 0x48),
1659 #if defined(CONFIG_AD774X) || defined(CONFIG_AD774X_MODULE)
1661 I2C_BOARD_INFO("ad774x", 0x48),
1665 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
1667 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
1670 #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE)
1672 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
1676 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
1678 I2C_BOARD_INFO("ad7879", 0x2F),
1680 .platform_data = (void *)&bfin_ad7879_ts_info,
1683 #if defined(CONFIG_KEYBOARD_ADP5588) || defined(CONFIG_KEYBOARD_ADP5588_MODULE)
1685 I2C_BOARD_INFO("adp5588-keys", 0x34),
1687 .platform_data = (void *)&adp5588_kpad_data,
1690 #if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1692 I2C_BOARD_INFO("pmic-adp5520", 0x32),
1694 .platform_data = (void *)&adp5520_pdev_data,
1697 #if defined(CONFIG_INPUT_ADXL34X_I2C) || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
1699 I2C_BOARD_INFO("adxl34x", 0x53),
1701 .platform_data = (void *)&adxl34x_info,
1704 #if defined(CONFIG_GPIO_ADP5588) || defined(CONFIG_GPIO_ADP5588_MODULE)
1706 I2C_BOARD_INFO("adp5588-gpio", 0x34),
1707 .platform_data = (void *)&adp5588_gpio_data,
1710 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
1712 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
1715 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1717 I2C_BOARD_INFO("bf537-lq035-ad5280", 0x2C),
1720 #if defined(CONFIG_BACKLIGHT_ADP8870) || defined(CONFIG_BACKLIGHT_ADP8870_MODULE)
1722 I2C_BOARD_INFO("adp8870", 0x2B),
1723 .platform_data = (void *)&adp8870_pdata,
1726 #if defined(CONFIG_SND_SOC_ADAU1371) || defined(CONFIG_SND_SOC_ADAU1371_MODULE)
1728 I2C_BOARD_INFO("adau1371", 0x1A),
1731 #if defined(CONFIG_SND_SOC_ADAU1761) || defined(CONFIG_SND_SOC_ADAU1761_MODULE)
1733 I2C_BOARD_INFO("adau1761", 0x38),
1736 #if defined(CONFIG_AD525X_DPOT) || defined(CONFIG_AD525X_DPOT_MODULE)
1738 I2C_BOARD_INFO("ad5258", 0x18),
1741 #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
1743 I2C_BOARD_INFO("ssm2602", 0x1b),
1748 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
1749 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
1750 static struct resource bfin_sport0_uart_resources[] = {
1752 .start = SPORT0_TCR1,
1753 .end = SPORT0_MRCS3+4,
1754 .flags = IORESOURCE_MEM,
1757 .start = IRQ_SPORT0_RX,
1758 .end = IRQ_SPORT0_RX+1,
1759 .flags = IORESOURCE_IRQ,
1762 .start = IRQ_SPORT0_ERROR,
1763 .end = IRQ_SPORT0_ERROR,
1764 .flags = IORESOURCE_IRQ,
1768 unsigned short bfin_sport0_peripherals[] = {
1769 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
1770 P_SPORT0_DRPRI, P_SPORT0_RSCLK, P_SPORT0_DRSEC, P_SPORT0_DTSEC, 0
1773 static struct platform_device bfin_sport0_uart_device = {
1774 .name = "bfin-sport-uart",
1776 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
1777 .resource = bfin_sport0_uart_resources,
1779 .platform_data = &bfin_sport0_peripherals, /* Passed to driver */
1783 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
1784 static struct resource bfin_sport1_uart_resources[] = {
1786 .start = SPORT1_TCR1,
1787 .end = SPORT1_MRCS3+4,
1788 .flags = IORESOURCE_MEM,
1791 .start = IRQ_SPORT1_RX,
1792 .end = IRQ_SPORT1_RX+1,
1793 .flags = IORESOURCE_IRQ,
1796 .start = IRQ_SPORT1_ERROR,
1797 .end = IRQ_SPORT1_ERROR,
1798 .flags = IORESOURCE_IRQ,
1802 unsigned short bfin_sport1_peripherals[] = {
1803 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
1804 P_SPORT1_DRPRI, P_SPORT1_RSCLK, P_SPORT1_DRSEC, P_SPORT1_DTSEC, 0
1807 static struct platform_device bfin_sport1_uart_device = {
1808 .name = "bfin-sport-uart",
1810 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
1811 .resource = bfin_sport1_uart_resources,
1813 .platform_data = &bfin_sport1_peripherals, /* Passed to driver */
1819 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
1820 #define CF_IDE_NAND_CARD_USE_HDD_INTERFACE
1821 /* #define CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE */
1823 #ifdef CF_IDE_NAND_CARD_USE_HDD_INTERFACE
1824 #define PATA_INT IRQ_PF5
1825 static struct pata_platform_info bfin_pata_platform_data = {
1827 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
1830 static struct resource bfin_pata_resources[] = {
1832 .start = 0x20314020,
1834 .flags = IORESOURCE_MEM,
1837 .start = 0x2031401C,
1839 .flags = IORESOURCE_MEM,
1844 .flags = IORESOURCE_IRQ,
1847 #elif defined(CF_IDE_NAND_CARD_USE_CF_IN_COMMON_MEMORY_MODE)
1848 static struct pata_platform_info bfin_pata_platform_data = {
1851 /* CompactFlash Storage Card Memory Mapped Adressing
1854 static struct resource bfin_pata_resources[] = {
1856 .start = 0x20211800,
1858 .flags = IORESOURCE_MEM,
1861 .start = 0x2021180E, /* Device Ctl */
1863 .flags = IORESOURCE_MEM,
1868 static struct platform_device bfin_pata_device = {
1869 .name = "pata_platform",
1871 .num_resources = ARRAY_SIZE(bfin_pata_resources),
1872 .resource = bfin_pata_resources,
1874 .platform_data = &bfin_pata_platform_data,
1879 static const unsigned int cclk_vlev_datasheet[] =
1881 VRPAIR(VLEV_085, 250000000),
1882 VRPAIR(VLEV_090, 376000000),
1883 VRPAIR(VLEV_095, 426000000),
1884 VRPAIR(VLEV_100, 426000000),
1885 VRPAIR(VLEV_105, 476000000),
1886 VRPAIR(VLEV_110, 476000000),
1887 VRPAIR(VLEV_115, 476000000),
1888 VRPAIR(VLEV_120, 500000000),
1889 VRPAIR(VLEV_125, 533000000),
1890 VRPAIR(VLEV_130, 600000000),
1893 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
1894 .tuple_tab = cclk_vlev_datasheet,
1895 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
1896 .vr_settling_time = 25 /* us */,
1899 static struct platform_device bfin_dpmc = {
1900 .name = "bfin dpmc",
1902 .platform_data = &bfin_dmpc_vreg_data,
1906 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1907 static struct platform_device bfin_i2s = {
1909 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1910 /* TODO: add platform data here */
1914 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1915 static struct platform_device bfin_tdm = {
1917 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1918 /* TODO: add platform data here */
1922 #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1923 static struct platform_device bfin_ac97 = {
1924 .name = "bfin-ac97",
1925 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1926 /* TODO: add platform data here */
1930 static struct platform_device *stamp_devices[] __initdata = {
1934 #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
1935 &bfin_pcmcia_cf_device,
1938 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
1942 #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
1946 #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
1947 &isp1362_hcd_device,
1950 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
1951 &bfin_isp1760_device,
1954 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
1958 #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
1962 #if defined(CONFIG_CAN_BFIN) || defined(CONFIG_CAN_BFIN_MODULE)
1966 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
1971 #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
1972 &net2272_bfin_device,
1975 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
1979 #if defined(CONFIG_SPI_BFIN_SPORT) || defined(CONFIG_SPI_BFIN_SPORT_MODULE)
1980 &bfin_sport_spi0_device,
1981 &bfin_sport_spi1_device,
1984 #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
1988 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
1989 &bfin_lq035q1_device,
1992 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
1993 #ifdef CONFIG_SERIAL_BFIN_UART0
1996 #ifdef CONFIG_SERIAL_BFIN_UART1
2001 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
2002 #ifdef CONFIG_BFIN_SIR0
2005 #ifdef CONFIG_BFIN_SIR1
2010 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
2011 &i2c_bfin_twi_device,
2014 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
2015 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
2016 &bfin_sport0_uart_device,
2018 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
2019 &bfin_sport1_uart_device,
2023 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
2027 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
2028 &bfin_device_gpiokeys,
2031 #if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
2032 &bfin_async_nand_device,
2035 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
2036 &stamp_flash_device,
2039 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
2043 #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
2047 #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
2052 static int __init stamp_init(void)
2054 printk(KERN_INFO "%s(): registering device resources\n", __func__);
2055 bfin_plat_nand_init();
2057 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
2058 i2c_register_board_info(0, bfin_i2c_board_info,
2059 ARRAY_SIZE(bfin_i2c_board_info));
2060 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
2065 arch_initcall(stamp_init);
2068 static struct platform_device *stamp_early_devices[] __initdata = {
2069 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
2070 #ifdef CONFIG_SERIAL_BFIN_UART0
2073 #ifdef CONFIG_SERIAL_BFIN_UART1
2078 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
2079 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
2080 &bfin_sport0_uart_device,
2082 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
2083 &bfin_sport1_uart_device,
2088 void __init native_machine_early_platform_add_devices(void)
2090 printk(KERN_INFO "register early platform devices\n");
2091 early_platform_add_devices(stamp_early_devices,
2092 ARRAY_SIZE(stamp_early_devices));
2095 void native_machine_restart(char *cmd)
2097 /* workaround reboot hang when booting from SPI */
2098 if ((bfin_read_SYSCR() & 0x7) == 0x3)
2099 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
2103 * Currently the MAC address is saved in Flash by U-Boot
2105 #define FLASH_MAC 0x203f0000
2106 void bfin_get_ether_addr(char *addr)
2108 *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC);
2109 *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4);
2111 EXPORT_SYMBOL(bfin_get_ether_addr);