Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 1 | /* |
| 2 | * File: arch/blackfin/mach-bf548/boards/cm_bf548.c |
| 3 | * Based on: arch/blackfin/mach-bf537/boards/ezkit.c |
| 4 | * Author: Aidan Williams <aidan@nicta.com.au> |
| 5 | * |
| 6 | * Created: |
| 7 | * Description: |
| 8 | * |
| 9 | * Modified: |
| 10 | * Copyright 2005 National ICT Australia (NICTA) |
| 11 | * Copyright 2004-2008 Analog Devices Inc. |
| 12 | * |
| 13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
| 14 | * |
| 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. |
| 19 | * |
| 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. |
| 24 | * |
| 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 |
| 29 | */ |
| 30 | |
| 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/spi/spi.h> |
| 36 | #include <linux/spi/flash.h> |
| 37 | #include <linux/irq.h> |
| 38 | #include <linux/interrupt.h> |
| 39 | #include <linux/usb/musb.h> |
| 40 | #include <asm/bfin5xx_spi.h> |
| 41 | #include <asm/cplb.h> |
| 42 | #include <asm/dma.h> |
| 43 | #include <asm/gpio.h> |
| 44 | #include <asm/nand.h> |
| 45 | #include <asm/portmux.h> |
| 46 | #include <asm/mach/bf54x_keys.h> |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame^] | 47 | #include <asm/dpmc.h> |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 48 | #include <linux/input.h> |
| 49 | #include <linux/spi/ad7877.h> |
| 50 | |
| 51 | /* |
| 52 | * Name the Board for the /proc/cpuinfo |
| 53 | */ |
| 54 | const char bfin_board_name[] = "Bluetechnix CM-BF548"; |
| 55 | |
| 56 | /* |
| 57 | * Driver needs to know address, irq and flag pin. |
| 58 | */ |
| 59 | |
| 60 | #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) |
| 61 | |
| 62 | #include <asm/mach/bf54x-lq043.h> |
| 63 | |
| 64 | static struct bfin_bf54xfb_mach_info bf54x_lq043_data = { |
| 65 | .width = 480, |
| 66 | .height = 272, |
| 67 | .xres = {480, 480, 480}, |
| 68 | .yres = {272, 272, 272}, |
| 69 | .bpp = {24, 24, 24}, |
| 70 | .disp = GPIO_PE3, |
| 71 | }; |
| 72 | |
| 73 | static struct resource bf54x_lq043_resources[] = { |
| 74 | { |
| 75 | .start = IRQ_EPPI0_ERR, |
| 76 | .end = IRQ_EPPI0_ERR, |
| 77 | .flags = IORESOURCE_IRQ, |
| 78 | }, |
| 79 | }; |
| 80 | |
| 81 | static struct platform_device bf54x_lq043_device = { |
| 82 | .name = "bf54x-lq043", |
| 83 | .id = -1, |
| 84 | .num_resources = ARRAY_SIZE(bf54x_lq043_resources), |
| 85 | .resource = bf54x_lq043_resources, |
| 86 | .dev = { |
| 87 | .platform_data = &bf54x_lq043_data, |
| 88 | }, |
| 89 | }; |
| 90 | #endif |
| 91 | |
| 92 | #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE) |
| 93 | static unsigned int bf548_keymap[] = { |
| 94 | KEYVAL(0, 0, KEY_ENTER), |
| 95 | KEYVAL(0, 1, KEY_HELP), |
| 96 | KEYVAL(0, 2, KEY_0), |
| 97 | KEYVAL(0, 3, KEY_BACKSPACE), |
| 98 | KEYVAL(1, 0, KEY_TAB), |
| 99 | KEYVAL(1, 1, KEY_9), |
| 100 | KEYVAL(1, 2, KEY_8), |
| 101 | KEYVAL(1, 3, KEY_7), |
| 102 | KEYVAL(2, 0, KEY_DOWN), |
| 103 | KEYVAL(2, 1, KEY_6), |
| 104 | KEYVAL(2, 2, KEY_5), |
| 105 | KEYVAL(2, 3, KEY_4), |
| 106 | KEYVAL(3, 0, KEY_UP), |
| 107 | KEYVAL(3, 1, KEY_3), |
| 108 | KEYVAL(3, 2, KEY_2), |
| 109 | KEYVAL(3, 3, KEY_1), |
| 110 | }; |
| 111 | |
| 112 | static struct bfin_kpad_platform_data bf54x_kpad_data = { |
| 113 | .rows = 4, |
| 114 | .cols = 4, |
| 115 | .keymap = bf548_keymap, |
| 116 | .keymapsize = ARRAY_SIZE(bf548_keymap), |
| 117 | .repeat = 0, |
| 118 | .debounce_time = 5000, /* ns (5ms) */ |
| 119 | .coldrive_time = 1000, /* ns (1ms) */ |
| 120 | .keyup_test_interval = 50, /* ms (50ms) */ |
| 121 | }; |
| 122 | |
| 123 | static struct resource bf54x_kpad_resources[] = { |
| 124 | { |
| 125 | .start = IRQ_KEY, |
| 126 | .end = IRQ_KEY, |
| 127 | .flags = IORESOURCE_IRQ, |
| 128 | }, |
| 129 | }; |
| 130 | |
| 131 | static struct platform_device bf54x_kpad_device = { |
| 132 | .name = "bf54x-keys", |
| 133 | .id = -1, |
| 134 | .num_resources = ARRAY_SIZE(bf54x_kpad_resources), |
| 135 | .resource = bf54x_kpad_resources, |
| 136 | .dev = { |
| 137 | .platform_data = &bf54x_kpad_data, |
| 138 | }, |
| 139 | }; |
| 140 | #endif |
| 141 | |
| 142 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 143 | static struct platform_device rtc_device = { |
| 144 | .name = "rtc-bfin", |
| 145 | .id = -1, |
| 146 | }; |
| 147 | #endif |
| 148 | |
| 149 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 150 | static struct resource bfin_uart_resources[] = { |
| 151 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 152 | { |
| 153 | .start = 0xFFC00400, |
| 154 | .end = 0xFFC004FF, |
| 155 | .flags = IORESOURCE_MEM, |
| 156 | }, |
| 157 | #endif |
| 158 | #ifdef CONFIG_SERIAL_BFIN_UART1 |
| 159 | { |
| 160 | .start = 0xFFC02000, |
| 161 | .end = 0xFFC020FF, |
| 162 | .flags = IORESOURCE_MEM, |
| 163 | }, |
| 164 | #endif |
| 165 | #ifdef CONFIG_SERIAL_BFIN_UART2 |
| 166 | { |
| 167 | .start = 0xFFC02100, |
| 168 | .end = 0xFFC021FF, |
| 169 | .flags = IORESOURCE_MEM, |
| 170 | }, |
| 171 | #endif |
| 172 | #ifdef CONFIG_SERIAL_BFIN_UART3 |
| 173 | { |
| 174 | .start = 0xFFC03100, |
| 175 | .end = 0xFFC031FF, |
| 176 | }, |
| 177 | #endif |
| 178 | }; |
| 179 | |
| 180 | static struct platform_device bfin_uart_device = { |
| 181 | .name = "bfin-uart", |
| 182 | .id = 1, |
| 183 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 184 | .resource = bfin_uart_resources, |
| 185 | }; |
| 186 | #endif |
| 187 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 188 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
| 189 | static struct resource bfin_sir_resources[] = { |
| 190 | #ifdef CONFIG_BFIN_SIR0 |
| 191 | { |
| 192 | .start = 0xFFC00400, |
| 193 | .end = 0xFFC004FF, |
| 194 | .flags = IORESOURCE_MEM, |
| 195 | }, |
| 196 | #endif |
| 197 | #ifdef CONFIG_BFIN_SIR1 |
| 198 | { |
| 199 | .start = 0xFFC02000, |
| 200 | .end = 0xFFC020FF, |
| 201 | .flags = IORESOURCE_MEM, |
| 202 | }, |
| 203 | #endif |
| 204 | #ifdef CONFIG_BFIN_SIR2 |
| 205 | { |
| 206 | .start = 0xFFC02100, |
| 207 | .end = 0xFFC021FF, |
| 208 | .flags = IORESOURCE_MEM, |
| 209 | }, |
| 210 | #endif |
| 211 | #ifdef CONFIG_BFIN_SIR3 |
| 212 | { |
| 213 | .start = 0xFFC03100, |
| 214 | .end = 0xFFC031FF, |
| 215 | .flags = IORESOURCE_MEM, |
| 216 | }, |
| 217 | #endif |
| 218 | }; |
| 219 | |
| 220 | static struct platform_device bfin_sir_device = { |
| 221 | .name = "bfin_sir", |
| 222 | .id = 0, |
| 223 | .num_resources = ARRAY_SIZE(bfin_sir_resources), |
| 224 | .resource = bfin_sir_resources, |
| 225 | }; |
| 226 | #endif |
| 227 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 228 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 229 | static struct resource smsc911x_resources[] = { |
| 230 | { |
| 231 | .name = "smsc911x-memory", |
| 232 | .start = 0x24000000, |
| 233 | .end = 0x24000000 + 0xFF, |
| 234 | .flags = IORESOURCE_MEM, |
| 235 | }, |
| 236 | { |
| 237 | .start = IRQ_PE6, |
| 238 | .end = IRQ_PE6, |
| 239 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 240 | }, |
| 241 | }; |
| 242 | static struct platform_device smsc911x_device = { |
| 243 | .name = "smsc911x", |
| 244 | .id = 0, |
| 245 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 246 | .resource = smsc911x_resources, |
| 247 | }; |
| 248 | #endif |
| 249 | |
| 250 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 251 | static struct resource musb_resources[] = { |
| 252 | [0] = { |
| 253 | .start = 0xFFC03C00, |
| 254 | .end = 0xFFC040FF, |
| 255 | .flags = IORESOURCE_MEM, |
| 256 | }, |
| 257 | [1] = { /* general IRQ */ |
| 258 | .start = IRQ_USB_INT0, |
| 259 | .end = IRQ_USB_INT0, |
| 260 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 261 | }, |
| 262 | [2] = { /* DMA IRQ */ |
| 263 | .start = IRQ_USB_DMA, |
| 264 | .end = IRQ_USB_DMA, |
| 265 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 266 | }, |
| 267 | }; |
| 268 | |
| 269 | static struct musb_hdrc_platform_data musb_plat = { |
| 270 | #if defined(CONFIG_USB_MUSB_OTG) |
| 271 | .mode = MUSB_OTG, |
| 272 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) |
| 273 | .mode = MUSB_HOST, |
| 274 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) |
| 275 | .mode = MUSB_PERIPHERAL, |
| 276 | #endif |
| 277 | .multipoint = 0, |
| 278 | }; |
| 279 | |
| 280 | static u64 musb_dmamask = ~(u32)0; |
| 281 | |
| 282 | static struct platform_device musb_device = { |
| 283 | .name = "musb_hdrc", |
| 284 | .id = 0, |
| 285 | .dev = { |
| 286 | .dma_mask = &musb_dmamask, |
| 287 | .coherent_dma_mask = 0xffffffff, |
| 288 | .platform_data = &musb_plat, |
| 289 | }, |
| 290 | .num_resources = ARRAY_SIZE(musb_resources), |
| 291 | .resource = musb_resources, |
| 292 | }; |
| 293 | #endif |
| 294 | |
| 295 | #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) |
| 296 | static struct resource bfin_atapi_resources[] = { |
| 297 | { |
| 298 | .start = 0xFFC03800, |
| 299 | .end = 0xFFC0386F, |
| 300 | .flags = IORESOURCE_MEM, |
| 301 | }, |
| 302 | { |
| 303 | .start = IRQ_ATAPI_ERR, |
| 304 | .end = IRQ_ATAPI_ERR, |
| 305 | .flags = IORESOURCE_IRQ, |
| 306 | }, |
| 307 | }; |
| 308 | |
| 309 | static struct platform_device bfin_atapi_device = { |
| 310 | .name = "pata-bf54x", |
| 311 | .id = -1, |
| 312 | .num_resources = ARRAY_SIZE(bfin_atapi_resources), |
| 313 | .resource = bfin_atapi_resources, |
| 314 | }; |
| 315 | #endif |
| 316 | |
| 317 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 318 | static struct mtd_partition partition_info[] = { |
| 319 | { |
| 320 | .name = "Linux Kernel", |
| 321 | .offset = 0, |
| 322 | .size = 4 * SIZE_1M, |
| 323 | }, |
| 324 | { |
| 325 | .name = "File System", |
| 326 | .offset = 4 * SIZE_1M, |
| 327 | .size = (256 - 4) * SIZE_1M, |
| 328 | }, |
| 329 | }; |
| 330 | |
| 331 | static struct bf5xx_nand_platform bf5xx_nand_platform = { |
| 332 | .page_size = NFC_PG_SIZE_256, |
| 333 | .data_width = NFC_NWIDTH_8, |
| 334 | .partitions = partition_info, |
| 335 | .nr_partitions = ARRAY_SIZE(partition_info), |
| 336 | .rd_dly = 3, |
| 337 | .wr_dly = 3, |
| 338 | }; |
| 339 | |
| 340 | static struct resource bf5xx_nand_resources[] = { |
| 341 | { |
| 342 | .start = 0xFFC03B00, |
| 343 | .end = 0xFFC03B4F, |
| 344 | .flags = IORESOURCE_MEM, |
| 345 | }, |
| 346 | { |
| 347 | .start = CH_NFC, |
| 348 | .end = CH_NFC, |
| 349 | .flags = IORESOURCE_IRQ, |
| 350 | }, |
| 351 | }; |
| 352 | |
| 353 | static struct platform_device bf5xx_nand_device = { |
| 354 | .name = "bf5xx-nand", |
| 355 | .id = 0, |
| 356 | .num_resources = ARRAY_SIZE(bf5xx_nand_resources), |
| 357 | .resource = bf5xx_nand_resources, |
| 358 | .dev = { |
| 359 | .platform_data = &bf5xx_nand_platform, |
| 360 | }, |
| 361 | }; |
| 362 | #endif |
| 363 | |
| 364 | #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE) |
| 365 | static struct platform_device bf54x_sdh_device = { |
| 366 | .name = "bfin-sdh", |
| 367 | .id = 0, |
| 368 | }; |
| 369 | #endif |
| 370 | |
| 371 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 372 | /* all SPI peripherals info goes here */ |
| 373 | #if defined(CONFIG_MTD_M25P80) \ |
| 374 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 375 | /* SPI flash chip (m25p16) */ |
| 376 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 377 | { |
| 378 | .name = "bootloader", |
| 379 | .size = 0x00040000, |
| 380 | .offset = 0, |
| 381 | .mask_flags = MTD_CAP_ROM |
| 382 | }, { |
| 383 | .name = "linux kernel", |
| 384 | .size = 0x1c0000, |
| 385 | .offset = 0x40000 |
| 386 | } |
| 387 | }; |
| 388 | |
| 389 | static struct flash_platform_data bfin_spi_flash_data = { |
| 390 | .name = "m25p80", |
| 391 | .parts = bfin_spi_flash_partitions, |
| 392 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 393 | .type = "m25p16", |
| 394 | }; |
| 395 | |
| 396 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 397 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 398 | .bits_per_word = 8, |
| 399 | .cs_change_per_word = 0, |
| 400 | }; |
| 401 | #endif |
| 402 | |
| 403 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 404 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { |
| 405 | .cs_change_per_word = 0, |
| 406 | .enable_dma = 0, |
| 407 | .bits_per_word = 16, |
| 408 | }; |
| 409 | |
| 410 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { |
| 411 | .model = 7877, |
| 412 | .vref_delay_usecs = 50, /* internal, no capacitor */ |
| 413 | .x_plate_ohms = 419, |
| 414 | .y_plate_ohms = 486, |
| 415 | .pressure_max = 1000, |
| 416 | .pressure_min = 0, |
| 417 | .stopacq_polarity = 1, |
| 418 | .first_conversion_delay = 3, |
| 419 | .acquisition_time = 1, |
| 420 | .averaging = 1, |
| 421 | .pen_down_acc_interval = 1, |
| 422 | }; |
| 423 | #endif |
| 424 | |
| 425 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 426 | static struct bfin5xx_spi_chip spidev_chip_info = { |
| 427 | .enable_dma = 0, |
| 428 | .bits_per_word = 8, |
| 429 | }; |
| 430 | #endif |
| 431 | |
| 432 | static struct spi_board_info bf54x_spi_board_info[] __initdata = { |
| 433 | #if defined(CONFIG_MTD_M25P80) \ |
| 434 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 435 | { |
| 436 | /* the modalias must be the same as spi device driver name */ |
| 437 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 438 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
| 439 | .bus_num = 0, /* Framework bus number */ |
| 440 | .chip_select = 1, /* SPI_SSEL1*/ |
| 441 | .platform_data = &bfin_spi_flash_data, |
| 442 | .controller_data = &spi_flash_chip_info, |
| 443 | .mode = SPI_MODE_3, |
| 444 | }, |
| 445 | #endif |
| 446 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 447 | { |
| 448 | .modalias = "ad7877", |
| 449 | .platform_data = &bfin_ad7877_ts_info, |
| 450 | .irq = IRQ_PJ11, |
| 451 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
| 452 | .bus_num = 0, |
| 453 | .chip_select = 2, |
| 454 | .controller_data = &spi_ad7877_chip_info, |
| 455 | }, |
| 456 | #endif |
| 457 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 458 | { |
| 459 | .modalias = "spidev", |
| 460 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 461 | .bus_num = 0, |
| 462 | .chip_select = 1, |
| 463 | .controller_data = &spidev_chip_info, |
| 464 | }, |
| 465 | #endif |
| 466 | }; |
| 467 | |
| 468 | /* SPI (0) */ |
| 469 | static struct resource bfin_spi0_resource[] = { |
| 470 | [0] = { |
| 471 | .start = SPI0_REGBASE, |
| 472 | .end = SPI0_REGBASE + 0xFF, |
| 473 | .flags = IORESOURCE_MEM, |
| 474 | }, |
| 475 | [1] = { |
| 476 | .start = CH_SPI0, |
| 477 | .end = CH_SPI0, |
| 478 | .flags = IORESOURCE_IRQ, |
| 479 | } |
| 480 | }; |
| 481 | |
| 482 | /* SPI (1) */ |
| 483 | static struct resource bfin_spi1_resource[] = { |
| 484 | [0] = { |
| 485 | .start = SPI1_REGBASE, |
| 486 | .end = SPI1_REGBASE + 0xFF, |
| 487 | .flags = IORESOURCE_MEM, |
| 488 | }, |
| 489 | [1] = { |
| 490 | .start = CH_SPI1, |
| 491 | .end = CH_SPI1, |
| 492 | .flags = IORESOURCE_IRQ, |
| 493 | } |
| 494 | }; |
| 495 | |
| 496 | /* SPI controller data */ |
| 497 | static struct bfin5xx_spi_master bf54x_spi_master_info0 = { |
| 498 | .num_chipselect = 8, |
| 499 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
| 500 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
| 501 | }; |
| 502 | |
| 503 | static struct platform_device bf54x_spi_master0 = { |
| 504 | .name = "bfin-spi", |
| 505 | .id = 0, /* Bus number */ |
| 506 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 507 | .resource = bfin_spi0_resource, |
| 508 | .dev = { |
| 509 | .platform_data = &bf54x_spi_master_info0, /* Passed to driver */ |
| 510 | }, |
| 511 | }; |
| 512 | |
| 513 | static struct bfin5xx_spi_master bf54x_spi_master_info1 = { |
| 514 | .num_chipselect = 8, |
| 515 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
| 516 | .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0}, |
| 517 | }; |
| 518 | |
| 519 | static struct platform_device bf54x_spi_master1 = { |
| 520 | .name = "bfin-spi", |
| 521 | .id = 1, /* Bus number */ |
| 522 | .num_resources = ARRAY_SIZE(bfin_spi1_resource), |
| 523 | .resource = bfin_spi1_resource, |
| 524 | .dev = { |
| 525 | .platform_data = &bf54x_spi_master_info1, /* Passed to driver */ |
| 526 | }, |
| 527 | }; |
| 528 | #endif /* spi master and devices */ |
| 529 | |
| 530 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 531 | static struct resource bfin_twi0_resource[] = { |
| 532 | [0] = { |
| 533 | .start = TWI0_REGBASE, |
| 534 | .end = TWI0_REGBASE + 0xFF, |
| 535 | .flags = IORESOURCE_MEM, |
| 536 | }, |
| 537 | [1] = { |
| 538 | .start = IRQ_TWI0, |
| 539 | .end = IRQ_TWI0, |
| 540 | .flags = IORESOURCE_IRQ, |
| 541 | }, |
| 542 | }; |
| 543 | |
| 544 | static struct platform_device i2c_bfin_twi0_device = { |
| 545 | .name = "i2c-bfin-twi", |
| 546 | .id = 0, |
| 547 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), |
| 548 | .resource = bfin_twi0_resource, |
| 549 | }; |
| 550 | |
| 551 | #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ |
| 552 | static struct resource bfin_twi1_resource[] = { |
| 553 | [0] = { |
| 554 | .start = TWI1_REGBASE, |
| 555 | .end = TWI1_REGBASE + 0xFF, |
| 556 | .flags = IORESOURCE_MEM, |
| 557 | }, |
| 558 | [1] = { |
| 559 | .start = IRQ_TWI1, |
| 560 | .end = IRQ_TWI1, |
| 561 | .flags = IORESOURCE_IRQ, |
| 562 | }, |
| 563 | }; |
| 564 | |
| 565 | static struct platform_device i2c_bfin_twi1_device = { |
| 566 | .name = "i2c-bfin-twi", |
| 567 | .id = 1, |
| 568 | .num_resources = ARRAY_SIZE(bfin_twi1_resource), |
| 569 | .resource = bfin_twi1_resource, |
| 570 | }; |
| 571 | #endif |
| 572 | #endif |
| 573 | |
| 574 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 575 | #include <linux/gpio_keys.h> |
| 576 | |
| 577 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
| 578 | {BTN_0, GPIO_PH7, 1, "gpio-keys: BTN0"}, |
| 579 | }; |
| 580 | |
| 581 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 582 | .buttons = bfin_gpio_keys_table, |
| 583 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 584 | }; |
| 585 | |
| 586 | static struct platform_device bfin_device_gpiokeys = { |
| 587 | .name = "gpio-keys", |
| 588 | .dev = { |
| 589 | .platform_data = &bfin_gpio_keys_data, |
| 590 | }, |
| 591 | }; |
| 592 | #endif |
| 593 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame^] | 594 | static const unsigned int cclk_vlev_datasheet[] = |
| 595 | { |
| 596 | /* |
| 597 | * Internal VLEV BF54XSBBC1533 |
| 598 | ****temporarily using these values until data sheet is updated |
| 599 | */ |
| 600 | VRPAIR(VLEV_085, 150000000), |
| 601 | VRPAIR(VLEV_090, 250000000), |
| 602 | VRPAIR(VLEV_110, 276000000), |
| 603 | VRPAIR(VLEV_115, 301000000), |
| 604 | VRPAIR(VLEV_120, 525000000), |
| 605 | VRPAIR(VLEV_125, 550000000), |
| 606 | VRPAIR(VLEV_130, 600000000), |
| 607 | }; |
| 608 | |
| 609 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { |
| 610 | .tuple_tab = cclk_vlev_datasheet, |
| 611 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), |
| 612 | .vr_settling_time = 25 /* us */, |
| 613 | }; |
| 614 | |
| 615 | static struct platform_device bfin_dpmc = { |
| 616 | .name = "bfin dpmc", |
| 617 | .dev = { |
| 618 | .platform_data = &bfin_dmpc_vreg_data, |
| 619 | }, |
| 620 | }; |
| 621 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 622 | static struct platform_device *cm_bf548_devices[] __initdata = { |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame^] | 623 | |
| 624 | &bfin_dpmc, |
| 625 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 626 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 627 | &rtc_device, |
| 628 | #endif |
| 629 | |
| 630 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 631 | &bfin_uart_device, |
| 632 | #endif |
| 633 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 634 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
| 635 | &bfin_sir_device, |
| 636 | #endif |
| 637 | |
Michael Hennerich | db68254 | 2008-04-24 03:18:59 +0800 | [diff] [blame] | 638 | #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) |
| 639 | &bf54x_lq043_device, |
| 640 | #endif |
| 641 | |
| 642 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 643 | &smsc911x_device, |
| 644 | #endif |
| 645 | |
| 646 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 647 | &musb_device, |
| 648 | #endif |
| 649 | |
| 650 | #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) |
| 651 | &bfin_atapi_device, |
| 652 | #endif |
| 653 | |
| 654 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 655 | &bf5xx_nand_device, |
| 656 | #endif |
| 657 | |
| 658 | #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN_MODULE) |
| 659 | &bf54x_sdh_device, |
| 660 | #endif |
| 661 | |
| 662 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 663 | &bf54x_spi_master0, |
| 664 | &bf54x_spi_master1, |
| 665 | #endif |
| 666 | |
| 667 | #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE) |
| 668 | &bf54x_kpad_device, |
| 669 | #endif |
| 670 | |
| 671 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 672 | /* &i2c_bfin_twi0_device, */ |
| 673 | #if !defined(CONFIG_BF542) |
| 674 | &i2c_bfin_twi1_device, |
| 675 | #endif |
| 676 | #endif |
| 677 | |
| 678 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 679 | &bfin_device_gpiokeys, |
| 680 | #endif |
| 681 | }; |
| 682 | |
| 683 | static int __init cm_bf548_init(void) |
| 684 | { |
| 685 | printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__); |
| 686 | platform_add_devices(cm_bf548_devices, ARRAY_SIZE(cm_bf548_devices)); |
| 687 | |
| 688 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 689 | spi_register_board_info(bf54x_spi_board_info, |
| 690 | ARRAY_SIZE(bf54x_spi_board_info)); |
| 691 | #endif |
| 692 | |
| 693 | return 0; |
| 694 | } |
| 695 | |
| 696 | arch_initcall(cm_bf548_init); |