spi-topcliff-pch: Fix issue for transmitting over 4KByte
[zen-stable.git] / arch / blackfin / mach-bf527 / boards / tll6527m.c
blob360e97fc529363d53193c34decc623d27b31a34e
1 /* File: arch/blackfin/mach-bf527/boards/tll6527m.c
2 * Based on: arch/blackfin/mach-bf527/boards/ezkit.c
3 * Author: Ashish Gupta
5 * Copyright: 2010 - The Learning Labs Inc.
7 * Licensed under the GPL-2 or later.
8 */
10 #include <linux/device.h>
11 #include <linux/export.h>
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/mtd/physmap.h>
16 #include <linux/spi/spi.h>
17 #include <linux/spi/flash.h>
18 #include <linux/i2c.h>
19 #include <linux/irq.h>
20 #include <linux/interrupt.h>
21 #include <linux/usb/musb.h>
22 #include <linux/leds.h>
23 #include <linux/input.h>
24 #include <asm/dma.h>
25 #include <asm/bfin5xx_spi.h>
26 #include <asm/reboot.h>
27 #include <asm/nand.h>
28 #include <asm/portmux.h>
29 #include <asm/dpmc.h>
31 #if defined(CONFIG_TOUCHSCREEN_AD7879) \
32 || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
33 #include <linux/spi/ad7879.h>
34 #define LCD_BACKLIGHT_GPIO 0x40
35 /* TLL6527M uses TLL7UIQ35 / ADI LCD EZ Extender. AD7879 AUX GPIO is used for
36 * LCD Backlight Enable
38 #endif
41 * Name the Board for the /proc/cpuinfo
43 const char bfin_board_name[] = "TLL6527M";
45 * Driver needs to know address, irq and flag pin.
48 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
49 static struct resource musb_resources[] = {
50 [0] = {
51 .start = 0xffc03800,
52 .end = 0xffc03cff,
53 .flags = IORESOURCE_MEM,
55 [1] = { /* general IRQ */
56 .start = IRQ_USB_INT0,
57 .end = IRQ_USB_INT0,
58 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
60 [2] = { /* DMA IRQ */
61 .start = IRQ_USB_DMA,
62 .end = IRQ_USB_DMA,
63 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
67 static struct musb_hdrc_config musb_config = {
68 .multipoint = 0,
69 .dyn_fifo = 0,
70 .soft_con = 1,
71 .dma = 1,
72 .num_eps = 8,
73 .dma_channels = 8,
74 /*.gpio_vrsel = GPIO_PG13,*/
75 /* Some custom boards need to be active low, just set it to "0"
76 * if it is the case.
78 .gpio_vrsel_active = 1,
81 static struct musb_hdrc_platform_data musb_plat = {
82 #if defined(CONFIG_USB_MUSB_OTG)
83 .mode = MUSB_OTG,
84 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
85 .mode = MUSB_HOST,
86 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
87 .mode = MUSB_PERIPHERAL,
88 #endif
89 .config = &musb_config,
92 static u64 musb_dmamask = ~(u32)0;
94 static struct platform_device musb_device = {
95 .name = "musb-blackfin",
96 .id = 0,
97 .dev = {
98 .dma_mask = &musb_dmamask,
99 .coherent_dma_mask = 0xffffffff,
100 .platform_data = &musb_plat,
102 .num_resources = ARRAY_SIZE(musb_resources),
103 .resource = musb_resources,
105 #endif
107 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
108 #include <asm/bfin-lq035q1.h>
110 static struct bfin_lq035q1fb_disp_info bfin_lq035q1_data = {
111 .mode = LQ035_NORM | LQ035_RGB | LQ035_RL | LQ035_TB,
112 .ppi_mode = USE_RGB565_16_BIT_PPI,
113 .use_bl = 1,
114 .gpio_bl = LCD_BACKLIGHT_GPIO,
117 static struct resource bfin_lq035q1_resources[] = {
119 .start = IRQ_PPI_ERROR,
120 .end = IRQ_PPI_ERROR,
121 .flags = IORESOURCE_IRQ,
125 static struct platform_device bfin_lq035q1_device = {
126 .name = "bfin-lq035q1",
127 .id = -1,
128 .num_resources = ARRAY_SIZE(bfin_lq035q1_resources),
129 .resource = bfin_lq035q1_resources,
130 .dev = {
131 .platform_data = &bfin_lq035q1_data,
134 #endif
136 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
137 static struct mtd_partition tll6527m_partitions[] = {
139 .name = "bootloader(nor)",
140 .size = 0xA0000,
141 .offset = 0,
142 }, {
143 .name = "linux kernel(nor)",
144 .size = 0xD00000,
145 .offset = MTDPART_OFS_APPEND,
146 }, {
147 .name = "file system(nor)",
148 .size = MTDPART_SIZ_FULL,
149 .offset = MTDPART_OFS_APPEND,
153 static struct physmap_flash_data tll6527m_flash_data = {
154 .width = 2,
155 .parts = tll6527m_partitions,
156 .nr_parts = ARRAY_SIZE(tll6527m_partitions),
159 static unsigned tll6527m_flash_gpios[] = { GPIO_PG11, GPIO_PH11, GPIO_PH12 };
161 static struct resource tll6527m_flash_resource[] = {
163 .name = "cfi_probe",
164 .start = 0x20000000,
165 .end = 0x201fffff,
166 .flags = IORESOURCE_MEM,
167 }, {
168 .start = (unsigned long)tll6527m_flash_gpios,
169 .end = ARRAY_SIZE(tll6527m_flash_gpios),
170 .flags = IORESOURCE_IRQ,
174 static struct platform_device tll6527m_flash_device = {
175 .name = "gpio-addr-flash",
176 .id = 0,
177 .dev = {
178 .platform_data = &tll6527m_flash_data,
180 .num_resources = ARRAY_SIZE(tll6527m_flash_resource),
181 .resource = tll6527m_flash_resource,
183 #endif
185 #if defined(CONFIG_GPIO_DECODER) || defined(CONFIG_GPIO_DECODER_MODULE)
186 /* An SN74LVC138A 3:8 decoder chip has been used to generate 7 augmented
187 * outputs used as SPI CS lines for all SPI SLAVE devices on TLL6527v1-0.
188 * EXP_GPIO_SPISEL_BASE is the base number for the expanded outputs being
189 * used as SPI CS lines, this should be > MAX_BLACKFIN_GPIOS
191 #include <linux/gpio-decoder.h>
192 #define EXP_GPIO_SPISEL_BASE 0x64
193 static unsigned gpio_addr_inputs[] = {
194 GPIO_PG1, GPIO_PH9, GPIO_PH10
197 static struct gpio_decoder_platform_data spi_decoded_cs = {
198 .base = EXP_GPIO_SPISEL_BASE,
199 .input_addrs = gpio_addr_inputs,
200 .nr_input_addrs = ARRAY_SIZE(gpio_addr_inputs),
201 .default_output = 0,
202 /* .default_output = (1 << ARRAY_SIZE(gpio_addr_inputs)) - 1 */
205 static struct platform_device spi_decoded_gpio = {
206 .name = "gpio-decoder",
207 .id = 0,
208 .dev = {
209 .platform_data = &spi_decoded_cs,
213 #else
214 #define EXP_GPIO_SPISEL_BASE 0x0
216 #endif
218 #if defined(CONFIG_INPUT_ADXL34X) || defined(CONFIG_INPUT_ADXL34X_MODULE)
219 #include <linux/input/adxl34x.h>
220 static const struct adxl34x_platform_data adxl345_info = {
221 .x_axis_offset = 0,
222 .y_axis_offset = 0,
223 .z_axis_offset = 0,
224 .tap_threshold = 0x31,
225 .tap_duration = 0x10,
226 .tap_latency = 0x60,
227 .tap_window = 0xF0,
228 .tap_axis_control = ADXL_TAP_X_EN | ADXL_TAP_Y_EN | ADXL_TAP_Z_EN,
229 .act_axis_control = 0xFF,
230 .activity_threshold = 5,
231 .inactivity_threshold = 2,
232 .inactivity_time = 2,
233 .free_fall_threshold = 0x7,
234 .free_fall_time = 0x20,
235 .data_rate = 0x8,
236 .data_range = ADXL_FULL_RES,
238 .ev_type = EV_ABS,
239 .ev_code_x = ABS_X, /* EV_REL */
240 .ev_code_y = ABS_Y, /* EV_REL */
241 .ev_code_z = ABS_Z, /* EV_REL */
243 .ev_code_tap = {BTN_TOUCH, BTN_TOUCH, BTN_TOUCH}, /* EV_KEY x,y,z */
245 /* .ev_code_ff = KEY_F,*/ /* EV_KEY */
246 .ev_code_act_inactivity = KEY_A, /* EV_KEY */
247 .use_int2 = 1,
248 .power_mode = ADXL_AUTO_SLEEP | ADXL_LINK,
249 .fifo_mode = ADXL_FIFO_STREAM,
251 #endif
253 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
254 static struct platform_device rtc_device = {
255 .name = "rtc-bfin",
256 .id = -1,
258 #endif
260 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
261 #include <linux/bfin_mac.h>
262 static const unsigned short bfin_mac_peripherals[] = P_RMII0;
264 static struct bfin_phydev_platform_data bfin_phydev_data[] = {
266 .addr = 1,
267 .irq = IRQ_MAC_PHYINT,
271 static struct bfin_mii_bus_platform_data bfin_mii_bus_data = {
272 .phydev_number = 1,
273 .phydev_data = bfin_phydev_data,
274 .phy_mode = PHY_INTERFACE_MODE_RMII,
275 .mac_peripherals = bfin_mac_peripherals,
278 static struct platform_device bfin_mii_bus = {
279 .name = "bfin_mii_bus",
280 .dev = {
281 .platform_data = &bfin_mii_bus_data,
285 static struct platform_device bfin_mac_device = {
286 .name = "bfin_mac",
287 .dev = {
288 .platform_data = &bfin_mii_bus,
291 #endif
293 #if defined(CONFIG_MTD_M25P80) \
294 || defined(CONFIG_MTD_M25P80_MODULE)
295 static struct mtd_partition bfin_spi_flash_partitions[] = {
297 .name = "bootloader(spi)",
298 .size = 0x00040000,
299 .offset = 0,
300 .mask_flags = MTD_CAP_ROM
301 }, {
302 .name = "linux kernel(spi)",
303 .size = MTDPART_SIZ_FULL,
304 .offset = MTDPART_OFS_APPEND,
308 static struct flash_platform_data bfin_spi_flash_data = {
309 .name = "m25p80",
310 .parts = bfin_spi_flash_partitions,
311 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
312 .type = "m25p16",
315 /* SPI flash chip (m25p64) */
316 static struct bfin5xx_spi_chip spi_flash_chip_info = {
317 .enable_dma = 0, /* use dma transfer with this chip*/
319 #endif
321 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
322 static struct bfin5xx_spi_chip mmc_spi_chip_info = {
323 .enable_dma = 0,
325 #endif
327 #if defined(CONFIG_TOUCHSCREEN_AD7879) \
328 || defined(CONFIG_TOUCHSCREEN_AD7879_MODULE)
329 static const struct ad7879_platform_data bfin_ad7879_ts_info = {
330 .model = 7879, /* Model = AD7879 */
331 .x_plate_ohms = 620, /* 620 Ohm from the touch datasheet */
332 .pressure_max = 10000,
333 .pressure_min = 0,
334 .first_conversion_delay = 3,
335 /* wait 512us before do a first conversion */
336 .acquisition_time = 1, /* 4us acquisition time per sample */
337 .median = 2, /* do 8 measurements */
338 .averaging = 1,
339 /* take the average of 4 middle samples */
340 .pen_down_acc_interval = 255, /* 9.4 ms */
341 .gpio_export = 1, /* configure AUX as GPIO output*/
342 .gpio_base = LCD_BACKLIGHT_GPIO,
344 #endif
346 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
347 static struct platform_device bfin_i2s = {
348 .name = "bfin-i2s",
349 .id = CONFIG_SND_BF5XX_SPORT_NUM,
350 /* TODO: add platform data here */
352 #endif
354 #if defined(CONFIG_GPIO_MCP23S08) || defined(CONFIG_GPIO_MCP23S08_MODULE)
355 #include <linux/spi/mcp23s08.h>
356 static const struct mcp23s08_platform_data bfin_mcp23s08_sys_gpio_info = {
357 .chip[0].is_present = true,
358 .base = 0x30,
360 static const struct mcp23s08_platform_data bfin_mcp23s08_usr_gpio_info = {
361 .chip[2].is_present = true,
362 .base = 0x38,
364 #endif
366 static struct spi_board_info bfin_spi_board_info[] __initdata = {
367 #if defined(CONFIG_MTD_M25P80) \
368 || defined(CONFIG_MTD_M25P80_MODULE)
370 /* the modalias must be the same as spi device driver name */
371 .modalias = "m25p80", /* Name of spi_driver for this device */
372 .max_speed_hz = 25000000,
373 /* max spi clock (SCK) speed in HZ */
374 .bus_num = 0, /* Framework bus number */
375 .chip_select = EXP_GPIO_SPISEL_BASE + 0x04 + MAX_CTRL_CS,
376 /* Can be connected to TLL6527M GPIO connector */
377 /* Either SPI_ADC or M25P80 FLASH can be installed at a time */
378 .platform_data = &bfin_spi_flash_data,
379 .controller_data = &spi_flash_chip_info,
380 .mode = SPI_MODE_3,
382 #endif
384 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
386 .modalias = "mmc_spi",
388 * TLL6527M V1.0 does not support SD Card at SPI Clock > 10 MHz due to
389 * SPI buffer limitations
391 .max_speed_hz = 10000000,
392 /* max spi clock (SCK) speed in HZ */
393 .bus_num = 0,
394 .chip_select = EXP_GPIO_SPISEL_BASE + 0x05 + MAX_CTRL_CS,
395 .controller_data = &mmc_spi_chip_info,
396 .mode = SPI_MODE_0,
398 #endif
399 #if defined(CONFIG_TOUCHSCREEN_AD7879_SPI) \
400 || defined(CONFIG_TOUCHSCREEN_AD7879_SPI_MODULE)
402 .modalias = "ad7879",
403 .platform_data = &bfin_ad7879_ts_info,
404 .irq = IRQ_PH14,
405 .max_speed_hz = 5000000,
406 /* max spi clock (SCK) speed in HZ */
407 .bus_num = 0,
408 .chip_select = EXP_GPIO_SPISEL_BASE + 0x07 + MAX_CTRL_CS,
409 .mode = SPI_CPHA | SPI_CPOL,
411 #endif
412 #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
414 .modalias = "spidev",
415 .max_speed_hz = 10000000,
416 /* TLL6527Mv1-0 supports max spi clock (SCK) speed = 10 MHz */
417 .bus_num = 0,
418 .chip_select = EXP_GPIO_SPISEL_BASE + 0x03 + MAX_CTRL_CS,
419 .mode = SPI_CPHA | SPI_CPOL,
421 #endif
422 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
424 .modalias = "bfin-lq035q1-spi",
425 .max_speed_hz = 20000000,
426 .bus_num = 0,
427 .chip_select = EXP_GPIO_SPISEL_BASE + 0x06 + MAX_CTRL_CS,
428 .mode = SPI_CPHA | SPI_CPOL,
430 #endif
431 #if defined(CONFIG_GPIO_MCP23S08) || defined(CONFIG_GPIO_MCP23S08_MODULE)
433 .modalias = "mcp23s08",
434 .platform_data = &bfin_mcp23s08_sys_gpio_info,
435 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
436 .bus_num = 0,
437 .chip_select = EXP_GPIO_SPISEL_BASE + 0x01 + MAX_CTRL_CS,
438 .mode = SPI_CPHA | SPI_CPOL,
441 .modalias = "mcp23s08",
442 .platform_data = &bfin_mcp23s08_usr_gpio_info,
443 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
444 .bus_num = 0,
445 .chip_select = EXP_GPIO_SPISEL_BASE + 0x02 + MAX_CTRL_CS,
446 .mode = SPI_CPHA | SPI_CPOL,
448 #endif
451 #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
452 /* SPI controller data */
453 static struct bfin5xx_spi_master bfin_spi0_info = {
454 .num_chipselect = EXP_GPIO_SPISEL_BASE + 8 + MAX_CTRL_CS,
455 /* EXP_GPIO_SPISEL_BASE will be > MAX_BLACKFIN_GPIOS */
456 .enable_dma = 1, /* master has the ability to do dma transfer */
457 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
460 /* SPI (0) */
461 static struct resource bfin_spi0_resource[] = {
462 [0] = {
463 .start = SPI0_REGBASE,
464 .end = SPI0_REGBASE + 0xFF,
465 .flags = IORESOURCE_MEM,
467 [1] = {
468 .start = CH_SPI,
469 .end = CH_SPI,
470 .flags = IORESOURCE_DMA,
472 [2] = {
473 .start = IRQ_SPI,
474 .end = IRQ_SPI,
475 .flags = IORESOURCE_IRQ,
479 static struct platform_device bfin_spi0_device = {
480 .name = "bfin-spi",
481 .id = 0, /* Bus number */
482 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
483 .resource = bfin_spi0_resource,
484 .dev = {
485 .platform_data = &bfin_spi0_info, /* Passed to driver */
488 #endif /* spi master and devices */
490 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
491 #ifdef CONFIG_SERIAL_BFIN_UART0
492 static struct resource bfin_uart0_resources[] = {
494 .start = UART0_THR,
495 .end = UART0_GCTL+2,
496 .flags = IORESOURCE_MEM,
499 .start = IRQ_UART0_TX,
500 .end = IRQ_UART0_TX,
501 .flags = IORESOURCE_IRQ,
504 .start = IRQ_UART0_RX,
505 .end = IRQ_UART0_RX,
506 .flags = IORESOURCE_IRQ,
509 .start = IRQ_UART0_ERROR,
510 .end = IRQ_UART0_ERROR,
511 .flags = IORESOURCE_IRQ,
514 .start = CH_UART0_TX,
515 .end = CH_UART0_TX,
516 .flags = IORESOURCE_DMA,
519 .start = CH_UART0_RX,
520 .end = CH_UART0_RX,
521 .flags = IORESOURCE_DMA,
525 static unsigned short bfin_uart0_peripherals[] = {
526 P_UART0_TX, P_UART0_RX, 0
529 static struct platform_device bfin_uart0_device = {
530 .name = "bfin-uart",
531 .id = 0,
532 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
533 .resource = bfin_uart0_resources,
534 .dev = {
535 .platform_data = &bfin_uart0_peripherals,
536 /* Passed to driver */
539 #endif
540 #ifdef CONFIG_SERIAL_BFIN_UART1
541 static struct resource bfin_uart1_resources[] = {
543 .start = UART1_THR,
544 .end = UART1_GCTL+2,
545 .flags = IORESOURCE_MEM,
548 .start = IRQ_UART1_TX,
549 .end = IRQ_UART1_TX,
550 .flags = IORESOURCE_IRQ,
553 .start = IRQ_UART1_RX,
554 .end = IRQ_UART1_RX,
555 .flags = IORESOURCE_IRQ,
558 .start = IRQ_UART1_ERROR,
559 .end = IRQ_UART1_ERROR,
560 .flags = IORESOURCE_IRQ,
563 .start = CH_UART1_TX,
564 .end = CH_UART1_TX,
565 .flags = IORESOURCE_DMA,
568 .start = CH_UART1_RX,
569 .end = CH_UART1_RX,
570 .flags = IORESOURCE_DMA,
572 #ifdef CONFIG_BFIN_UART1_CTSRTS
573 { /* CTS pin */
574 .start = GPIO_PF9,
575 .end = GPIO_PF9,
576 .flags = IORESOURCE_IO,
578 { /* RTS pin */
579 .start = GPIO_PF10,
580 .end = GPIO_PF10,
581 .flags = IORESOURCE_IO,
583 #endif
586 static unsigned short bfin_uart1_peripherals[] = {
587 P_UART1_TX, P_UART1_RX, 0
590 static struct platform_device bfin_uart1_device = {
591 .name = "bfin-uart",
592 .id = 1,
593 .num_resources = ARRAY_SIZE(bfin_uart1_resources),
594 .resource = bfin_uart1_resources,
595 .dev = {
596 .platform_data = &bfin_uart1_peripherals,
597 /* Passed to driver */
600 #endif
601 #endif
603 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
604 #ifdef CONFIG_BFIN_SIR0
605 static struct resource bfin_sir0_resources[] = {
607 .start = 0xFFC00400,
608 .end = 0xFFC004FF,
609 .flags = IORESOURCE_MEM,
612 .start = IRQ_UART0_RX,
613 .end = IRQ_UART0_RX+1,
614 .flags = IORESOURCE_IRQ,
617 .start = CH_UART0_RX,
618 .end = CH_UART0_RX+1,
619 .flags = IORESOURCE_DMA,
623 static struct platform_device bfin_sir0_device = {
624 .name = "bfin_sir",
625 .id = 0,
626 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
627 .resource = bfin_sir0_resources,
629 #endif
630 #ifdef CONFIG_BFIN_SIR1
631 static struct resource bfin_sir1_resources[] = {
633 .start = 0xFFC02000,
634 .end = 0xFFC020FF,
635 .flags = IORESOURCE_MEM,
638 .start = IRQ_UART1_RX,
639 .end = IRQ_UART1_RX+1,
640 .flags = IORESOURCE_IRQ,
643 .start = CH_UART1_RX,
644 .end = CH_UART1_RX+1,
645 .flags = IORESOURCE_DMA,
649 static struct platform_device bfin_sir1_device = {
650 .name = "bfin_sir",
651 .id = 1,
652 .num_resources = ARRAY_SIZE(bfin_sir1_resources),
653 .resource = bfin_sir1_resources,
655 #endif
656 #endif
658 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
659 static struct resource bfin_twi0_resource[] = {
660 [0] = {
661 .start = TWI0_REGBASE,
662 .end = TWI0_REGBASE,
663 .flags = IORESOURCE_MEM,
665 [1] = {
666 .start = IRQ_TWI,
667 .end = IRQ_TWI,
668 .flags = IORESOURCE_IRQ,
672 static struct platform_device i2c_bfin_twi_device = {
673 .name = "i2c-bfin-twi",
674 .id = 0,
675 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
676 .resource = bfin_twi0_resource,
678 #endif
680 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
681 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
683 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
685 #endif
687 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
689 I2C_BOARD_INFO("bfin-adv7393", 0x2B),
691 #endif
692 #if defined(CONFIG_TOUCHSCREEN_AD7879_I2C) \
693 || defined(CONFIG_TOUCHSCREEN_AD7879_I2C_MODULE)
695 I2C_BOARD_INFO("ad7879", 0x2C),
696 .irq = IRQ_PH14,
697 .platform_data = (void *)&bfin_ad7879_ts_info,
699 #endif
700 #if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE)
702 I2C_BOARD_INFO("ssm2602", 0x1b),
704 #endif
706 I2C_BOARD_INFO("adm1192", 0x2e),
710 I2C_BOARD_INFO("ltc3576", 0x09),
712 #if defined(CONFIG_INPUT_ADXL34X_I2C) \
713 || defined(CONFIG_INPUT_ADXL34X_I2C_MODULE)
715 I2C_BOARD_INFO("adxl34x", 0x53),
716 .irq = IRQ_PH13,
717 .platform_data = (void *)&adxl345_info,
719 #endif
722 #if defined(CONFIG_SERIAL_BFIN_SPORT) \
723 || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
724 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
725 static struct resource bfin_sport0_uart_resources[] = {
727 .start = SPORT0_TCR1,
728 .end = SPORT0_MRCS3+4,
729 .flags = IORESOURCE_MEM,
732 .start = IRQ_SPORT0_RX,
733 .end = IRQ_SPORT0_RX+1,
734 .flags = IORESOURCE_IRQ,
737 .start = IRQ_SPORT0_ERROR,
738 .end = IRQ_SPORT0_ERROR,
739 .flags = IORESOURCE_IRQ,
743 static unsigned short bfin_sport0_peripherals[] = {
744 P_SPORT0_TFS, P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
745 P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0
748 static struct platform_device bfin_sport0_uart_device = {
749 .name = "bfin-sport-uart",
750 .id = 0,
751 .num_resources = ARRAY_SIZE(bfin_sport0_uart_resources),
752 .resource = bfin_sport0_uart_resources,
753 .dev = {
754 .platform_data = &bfin_sport0_peripherals,
755 /* Passed to driver */
758 #endif
759 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
760 static struct resource bfin_sport1_uart_resources[] = {
762 .start = SPORT1_TCR1,
763 .end = SPORT1_MRCS3+4,
764 .flags = IORESOURCE_MEM,
767 .start = IRQ_SPORT1_RX,
768 .end = IRQ_SPORT1_RX+1,
769 .flags = IORESOURCE_IRQ,
772 .start = IRQ_SPORT1_ERROR,
773 .end = IRQ_SPORT1_ERROR,
774 .flags = IORESOURCE_IRQ,
778 static unsigned short bfin_sport1_peripherals[] = {
779 P_SPORT1_TFS, P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
780 P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0
783 static struct platform_device bfin_sport1_uart_device = {
784 .name = "bfin-sport-uart",
785 .id = 1,
786 .num_resources = ARRAY_SIZE(bfin_sport1_uart_resources),
787 .resource = bfin_sport1_uart_resources,
788 .dev = {
789 .platform_data = &bfin_sport1_peripherals,
790 /* Passed to driver */
793 #endif
794 #endif
796 static const unsigned int cclk_vlev_datasheet[] = {
797 VRPAIR(VLEV_100, 400000000),
798 VRPAIR(VLEV_105, 426000000),
799 VRPAIR(VLEV_110, 500000000),
800 VRPAIR(VLEV_115, 533000000),
801 VRPAIR(VLEV_120, 600000000),
804 static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
805 .tuple_tab = cclk_vlev_datasheet,
806 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
807 .vr_settling_time = 25 /* us */,
810 static struct platform_device bfin_dpmc = {
811 .name = "bfin dpmc",
812 .dev = {
813 .platform_data = &bfin_dmpc_vreg_data,
817 static struct platform_device *tll6527m_devices[] __initdata = {
819 &bfin_dpmc,
821 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
822 &rtc_device,
823 #endif
825 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
826 &musb_device,
827 #endif
829 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
830 &bfin_mii_bus,
831 &bfin_mac_device,
832 #endif
834 #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE)
835 &bfin_spi0_device,
836 #endif
838 #if defined(CONFIG_FB_BFIN_LQ035Q1) || defined(CONFIG_FB_BFIN_LQ035Q1_MODULE)
839 &bfin_lq035q1_device,
840 #endif
842 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
843 #ifdef CONFIG_SERIAL_BFIN_UART0
844 &bfin_uart0_device,
845 #endif
846 #ifdef CONFIG_SERIAL_BFIN_UART1
847 &bfin_uart1_device,
848 #endif
849 #endif
851 #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
852 #ifdef CONFIG_BFIN_SIR0
853 &bfin_sir0_device,
854 #endif
855 #ifdef CONFIG_BFIN_SIR1
856 &bfin_sir1_device,
857 #endif
858 #endif
860 #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
861 &i2c_bfin_twi_device,
862 #endif
864 #if defined(CONFIG_SERIAL_BFIN_SPORT) \
865 || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
866 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
867 &bfin_sport0_uart_device,
868 #endif
869 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
870 &bfin_sport1_uart_device,
871 #endif
872 #endif
874 #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE)
875 &tll6527m_flash_device,
876 #endif
878 #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
879 &bfin_i2s,
880 #endif
882 #if defined(CONFIG_GPIO_DECODER) || defined(CONFIG_GPIO_DECODER_MODULE)
883 &spi_decoded_gpio,
884 #endif
887 static int __init tll6527m_init(void)
889 printk(KERN_INFO "%s(): registering device resources\n", __func__);
890 i2c_register_board_info(0, bfin_i2c_board_info,
891 ARRAY_SIZE(bfin_i2c_board_info));
892 platform_add_devices(tll6527m_devices, ARRAY_SIZE(tll6527m_devices));
893 spi_register_board_info(bfin_spi_board_info,
894 ARRAY_SIZE(bfin_spi_board_info));
895 return 0;
898 arch_initcall(tll6527m_init);
900 static struct platform_device *tll6527m_early_devices[] __initdata = {
901 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
902 #ifdef CONFIG_SERIAL_BFIN_UART0
903 &bfin_uart0_device,
904 #endif
905 #ifdef CONFIG_SERIAL_BFIN_UART1
906 &bfin_uart1_device,
907 #endif
908 #endif
910 #if defined(CONFIG_SERIAL_BFIN_SPORT_CONSOLE)
911 #ifdef CONFIG_SERIAL_BFIN_SPORT0_UART
912 &bfin_sport0_uart_device,
913 #endif
914 #ifdef CONFIG_SERIAL_BFIN_SPORT1_UART
915 &bfin_sport1_uart_device,
916 #endif
917 #endif
920 void __init native_machine_early_platform_add_devices(void)
922 printk(KERN_INFO "register early platform devices\n");
923 early_platform_add_devices(tll6527m_early_devices,
924 ARRAY_SIZE(tll6527m_early_devices));
927 void native_machine_restart(char *cmd)
929 /* workaround reboot hang when booting from SPI */
930 if ((bfin_read_SYSCR() & 0x7) == 0x3)
931 bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
934 void bfin_get_ether_addr(char *addr)
936 /* the MAC is stored in OTP memory page 0xDF */
937 u32 ret;
938 u64 otp_mac;
939 u32 (*otp_read)(u32 page, u32 flags,
940 u64 *page_content) = (void *)0xEF00001A;
942 ret = otp_read(0xDF, 0x00, &otp_mac);
943 if (!(ret & 0x1)) {
944 char *otp_mac_p = (char *)&otp_mac;
945 for (ret = 0; ret < 6; ++ret)
946 addr[ret] = otp_mac_p[5 - ret];
949 EXPORT_SYMBOL(bfin_get_ether_addr);