Roy Huang | 24a07a1 | 2007-07-12 22:41:45 +0800 | [diff] [blame] | 1 | /* |
| 2 | * File: arch/blackfin/mach-bf548/boards/ezkit.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-2007 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> |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 35 | #include <linux/mtd/physmap.h> |
Roy Huang | 24a07a1 | 2007-07-12 22:41:45 +0800 | [diff] [blame] | 36 | #include <linux/spi/spi.h> |
| 37 | #include <linux/spi/flash.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 38 | #include <linux/irq.h> |
Roy Huang | 24a07a1 | 2007-07-12 22:41:45 +0800 | [diff] [blame] | 39 | #include <linux/interrupt.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 40 | #include <linux/usb/musb.h> |
Roy Huang | 24a07a1 | 2007-07-12 22:41:45 +0800 | [diff] [blame] | 41 | #include <asm/bfin5xx_spi.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 42 | #include <asm/cplb.h> |
| 43 | #include <asm/dma.h> |
| 44 | #include <asm/gpio.h> |
| 45 | #include <asm/nand.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 46 | #include <asm/portmux.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 47 | #include <asm/mach/bf54x_keys.h> |
| 48 | #include <linux/input.h> |
| 49 | #include <linux/spi/ad7877.h> |
Roy Huang | 24a07a1 | 2007-07-12 22:41:45 +0800 | [diff] [blame] | 50 | |
| 51 | /* |
| 52 | * Name the Board for the /proc/cpuinfo |
| 53 | */ |
Mike Frysinger | 066954a | 2007-10-21 22:36:06 +0800 | [diff] [blame] | 54 | const char bfin_board_name[] = "ADSP-BF548-EZKIT"; |
Roy Huang | 24a07a1 | 2007-07-12 22:41:45 +0800 | [diff] [blame] | 55 | |
| 56 | /* |
| 57 | * Driver needs to know address, irq and flag pin. |
| 58 | */ |
| 59 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 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) |
Michael Hennerich | 8f740ef | 2007-10-13 00:36:46 -0400 | [diff] [blame] | 93 | static const unsigned int bf548_keymap[] = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 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, |
Michael Hennerich | 8f740ef | 2007-10-13 00:36:46 -0400 | [diff] [blame] | 115 | .keymap = bf548_keymap, |
| 116 | .keymapsize = ARRAY_SIZE(bf548_keymap), |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 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 | |
Roy Huang | 24a07a1 | 2007-07-12 22:41:45 +0800 | [diff] [blame] | 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 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 188 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 189 | static struct resource smsc911x_resources[] = { |
| 190 | { |
| 191 | .name = "smsc911x-memory", |
| 192 | .start = 0x24000000, |
| 193 | .end = 0x24000000 + 0xFF, |
| 194 | .flags = IORESOURCE_MEM, |
| 195 | }, |
| 196 | { |
| 197 | .start = IRQ_PE8, |
| 198 | .end = IRQ_PE8, |
| 199 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 200 | }, |
| 201 | }; |
| 202 | static struct platform_device smsc911x_device = { |
| 203 | .name = "smsc911x", |
| 204 | .id = 0, |
| 205 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 206 | .resource = smsc911x_resources, |
| 207 | }; |
| 208 | #endif |
| 209 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 210 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 211 | static struct resource musb_resources[] = { |
| 212 | [0] = { |
| 213 | .start = 0xFFC03C00, |
| 214 | .end = 0xFFC040FF, |
| 215 | .flags = IORESOURCE_MEM, |
| 216 | }, |
| 217 | [1] = { /* general IRQ */ |
| 218 | .start = IRQ_USB_INT0, |
| 219 | .end = IRQ_USB_INT0, |
| 220 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 221 | }, |
| 222 | [2] = { /* DMA IRQ */ |
| 223 | .start = IRQ_USB_DMA, |
| 224 | .end = IRQ_USB_DMA, |
| 225 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 226 | }, |
| 227 | }; |
| 228 | |
| 229 | static struct musb_hdrc_platform_data musb_plat = { |
Bryan Wu | 2935077 | 2007-12-24 12:20:19 +0800 | [diff] [blame] | 230 | #if defined(CONFIG_USB_MUSB_OTG) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 231 | .mode = MUSB_OTG, |
Bryan Wu | 2935077 | 2007-12-24 12:20:19 +0800 | [diff] [blame] | 232 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 233 | .mode = MUSB_HOST, |
Bryan Wu | 2935077 | 2007-12-24 12:20:19 +0800 | [diff] [blame] | 234 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 235 | .mode = MUSB_PERIPHERAL, |
| 236 | #endif |
Bryan Wu | 2935077 | 2007-12-24 12:20:19 +0800 | [diff] [blame] | 237 | .multipoint = 0, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 238 | }; |
| 239 | |
| 240 | static u64 musb_dmamask = ~(u32)0; |
| 241 | |
| 242 | static struct platform_device musb_device = { |
| 243 | .name = "musb_hdrc", |
| 244 | .id = 0, |
| 245 | .dev = { |
| 246 | .dma_mask = &musb_dmamask, |
| 247 | .coherent_dma_mask = 0xffffffff, |
| 248 | .platform_data = &musb_plat, |
| 249 | }, |
| 250 | .num_resources = ARRAY_SIZE(musb_resources), |
| 251 | .resource = musb_resources, |
| 252 | }; |
| 253 | #endif |
| 254 | |
| 255 | #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) |
| 256 | static struct resource bfin_atapi_resources[] = { |
| 257 | { |
| 258 | .start = 0xFFC03800, |
| 259 | .end = 0xFFC0386F, |
| 260 | .flags = IORESOURCE_MEM, |
| 261 | }, |
| 262 | { |
| 263 | .start = IRQ_ATAPI_ERR, |
| 264 | .end = IRQ_ATAPI_ERR, |
| 265 | .flags = IORESOURCE_IRQ, |
| 266 | }, |
| 267 | }; |
| 268 | |
| 269 | static struct platform_device bfin_atapi_device = { |
| 270 | .name = "pata-bf54x", |
| 271 | .id = -1, |
| 272 | .num_resources = ARRAY_SIZE(bfin_atapi_resources), |
| 273 | .resource = bfin_atapi_resources, |
| 274 | }; |
| 275 | #endif |
| 276 | |
| 277 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 278 | static struct mtd_partition partition_info[] = { |
| 279 | { |
| 280 | .name = "Linux Kernel", |
| 281 | .offset = 0, |
| 282 | .size = 4 * SIZE_1M, |
| 283 | }, |
| 284 | { |
| 285 | .name = "File System", |
| 286 | .offset = 4 * SIZE_1M, |
| 287 | .size = (256 - 4) * SIZE_1M, |
| 288 | }, |
| 289 | }; |
| 290 | |
| 291 | static struct bf5xx_nand_platform bf5xx_nand_platform = { |
| 292 | .page_size = NFC_PG_SIZE_256, |
| 293 | .data_width = NFC_NWIDTH_8, |
| 294 | .partitions = partition_info, |
| 295 | .nr_partitions = ARRAY_SIZE(partition_info), |
| 296 | .rd_dly = 3, |
| 297 | .wr_dly = 3, |
| 298 | }; |
| 299 | |
| 300 | static struct resource bf5xx_nand_resources[] = { |
| 301 | { |
| 302 | .start = 0xFFC03B00, |
| 303 | .end = 0xFFC03B4F, |
| 304 | .flags = IORESOURCE_MEM, |
| 305 | }, |
| 306 | { |
| 307 | .start = CH_NFC, |
| 308 | .end = CH_NFC, |
| 309 | .flags = IORESOURCE_IRQ, |
| 310 | }, |
| 311 | }; |
| 312 | |
| 313 | static struct platform_device bf5xx_nand_device = { |
| 314 | .name = "bf5xx-nand", |
| 315 | .id = 0, |
| 316 | .num_resources = ARRAY_SIZE(bf5xx_nand_resources), |
| 317 | .resource = bf5xx_nand_resources, |
| 318 | .dev = { |
| 319 | .platform_data = &bf5xx_nand_platform, |
| 320 | }, |
| 321 | }; |
| 322 | #endif |
| 323 | |
| 324 | #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN) |
| 325 | static struct platform_device bf54x_sdh_device = { |
| 326 | .name = "bfin-sdh", |
| 327 | .id = 0, |
| 328 | }; |
| 329 | #endif |
| 330 | |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 331 | static struct mtd_partition ezkit_partitions[] = { |
| 332 | { |
| 333 | .name = "Bootloader", |
| 334 | .size = 0x20000, |
| 335 | .offset = 0, |
| 336 | }, { |
| 337 | .name = "Kernel", |
| 338 | .size = 0xE0000, |
| 339 | .offset = MTDPART_OFS_APPEND, |
| 340 | }, { |
| 341 | .name = "RootFS", |
| 342 | .size = MTDPART_SIZ_FULL, |
| 343 | .offset = MTDPART_OFS_APPEND, |
| 344 | } |
| 345 | }; |
| 346 | |
| 347 | static struct physmap_flash_data ezkit_flash_data = { |
| 348 | .width = 2, |
| 349 | .parts = ezkit_partitions, |
| 350 | .nr_parts = ARRAY_SIZE(ezkit_partitions), |
| 351 | }; |
| 352 | |
| 353 | static struct resource ezkit_flash_resource = { |
| 354 | .start = 0x20000000, |
| 355 | .end = 0x20ffffff, |
| 356 | .flags = IORESOURCE_MEM, |
| 357 | }; |
| 358 | |
| 359 | static struct platform_device ezkit_flash_device = { |
| 360 | .name = "physmap-flash", |
| 361 | .id = 0, |
| 362 | .dev = { |
| 363 | .platform_data = &ezkit_flash_data, |
| 364 | }, |
| 365 | .num_resources = 1, |
| 366 | .resource = &ezkit_flash_resource, |
| 367 | }; |
| 368 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 369 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 370 | /* all SPI peripherals info goes here */ |
| 371 | #if defined(CONFIG_MTD_M25P80) \ |
| 372 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 373 | /* SPI flash chip (m25p16) */ |
| 374 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 375 | { |
| 376 | .name = "bootloader", |
| 377 | .size = 0x00040000, |
| 378 | .offset = 0, |
| 379 | .mask_flags = MTD_CAP_ROM |
| 380 | }, { |
| 381 | .name = "linux kernel", |
| 382 | .size = 0x1c0000, |
| 383 | .offset = 0x40000 |
| 384 | } |
| 385 | }; |
| 386 | |
| 387 | static struct flash_platform_data bfin_spi_flash_data = { |
| 388 | .name = "m25p80", |
| 389 | .parts = bfin_spi_flash_partitions, |
| 390 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 391 | .type = "m25p16", |
| 392 | }; |
| 393 | |
| 394 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 395 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 396 | .bits_per_word = 8, |
| 397 | .cs_change_per_word = 0, |
| 398 | }; |
| 399 | #endif |
| 400 | |
| 401 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 402 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { |
Michael Hennerich | c7d4896 | 2007-11-15 21:33:31 +0800 | [diff] [blame] | 403 | .cs_change_per_word = 0, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 404 | .enable_dma = 0, |
| 405 | .bits_per_word = 16, |
| 406 | }; |
| 407 | |
| 408 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { |
| 409 | .model = 7877, |
| 410 | .vref_delay_usecs = 50, /* internal, no capacitor */ |
| 411 | .x_plate_ohms = 419, |
| 412 | .y_plate_ohms = 486, |
| 413 | .pressure_max = 1000, |
| 414 | .pressure_min = 0, |
| 415 | .stopacq_polarity = 1, |
| 416 | .first_conversion_delay = 3, |
| 417 | .acquisition_time = 1, |
| 418 | .averaging = 1, |
| 419 | .pen_down_acc_interval = 1, |
| 420 | }; |
| 421 | #endif |
| 422 | |
| 423 | static struct spi_board_info bf54x_spi_board_info[] __initdata = { |
| 424 | #if defined(CONFIG_MTD_M25P80) \ |
| 425 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 426 | { |
| 427 | /* the modalias must be the same as spi device driver name */ |
| 428 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 429 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
| 430 | .bus_num = 0, /* Framework bus number */ |
| 431 | .chip_select = 1, /* SPI_SSEL1*/ |
| 432 | .platform_data = &bfin_spi_flash_data, |
| 433 | .controller_data = &spi_flash_chip_info, |
| 434 | .mode = SPI_MODE_3, |
| 435 | }, |
| 436 | #endif |
| 437 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 438 | { |
| 439 | .modalias = "ad7877", |
| 440 | .platform_data = &bfin_ad7877_ts_info, |
| 441 | .irq = IRQ_PJ11, |
| 442 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
| 443 | .bus_num = 0, |
| 444 | .chip_select = 2, |
| 445 | .controller_data = &spi_ad7877_chip_info, |
| 446 | }, |
| 447 | #endif |
| 448 | }; |
| 449 | |
| 450 | /* SPI (0) */ |
| 451 | static struct resource bfin_spi0_resource[] = { |
| 452 | [0] = { |
| 453 | .start = SPI0_REGBASE, |
| 454 | .end = SPI0_REGBASE + 0xFF, |
| 455 | .flags = IORESOURCE_MEM, |
| 456 | }, |
| 457 | [1] = { |
| 458 | .start = CH_SPI0, |
| 459 | .end = CH_SPI0, |
| 460 | .flags = IORESOURCE_IRQ, |
| 461 | } |
| 462 | }; |
| 463 | |
| 464 | /* SPI (1) */ |
| 465 | static struct resource bfin_spi1_resource[] = { |
| 466 | [0] = { |
| 467 | .start = SPI1_REGBASE, |
| 468 | .end = SPI1_REGBASE + 0xFF, |
| 469 | .flags = IORESOURCE_MEM, |
| 470 | }, |
| 471 | [1] = { |
| 472 | .start = CH_SPI1, |
| 473 | .end = CH_SPI1, |
| 474 | .flags = IORESOURCE_IRQ, |
| 475 | } |
| 476 | }; |
| 477 | |
| 478 | /* SPI controller data */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 479 | static struct bfin5xx_spi_master bf54x_spi_master_info0 = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 480 | .num_chipselect = 8, |
| 481 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 482 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 483 | }; |
| 484 | |
| 485 | static struct platform_device bf54x_spi_master0 = { |
| 486 | .name = "bfin-spi", |
| 487 | .id = 0, /* Bus number */ |
| 488 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 489 | .resource = bfin_spi0_resource, |
| 490 | .dev = { |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 491 | .platform_data = &bf54x_spi_master_info0, /* Passed to driver */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 492 | }, |
| 493 | }; |
| 494 | |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 495 | static struct bfin5xx_spi_master bf54x_spi_master_info1 = { |
| 496 | .num_chipselect = 8, |
| 497 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
| 498 | .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0}, |
| 499 | }; |
| 500 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 501 | static struct platform_device bf54x_spi_master1 = { |
| 502 | .name = "bfin-spi", |
| 503 | .id = 1, /* Bus number */ |
| 504 | .num_resources = ARRAY_SIZE(bfin_spi1_resource), |
| 505 | .resource = bfin_spi1_resource, |
| 506 | .dev = { |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 507 | .platform_data = &bf54x_spi_master_info1, /* Passed to driver */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 508 | }, |
| 509 | }; |
| 510 | #endif /* spi master and devices */ |
| 511 | |
| 512 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 513 | static struct resource bfin_twi0_resource[] = { |
| 514 | [0] = { |
| 515 | .start = TWI0_REGBASE, |
| 516 | .end = TWI0_REGBASE + 0xFF, |
| 517 | .flags = IORESOURCE_MEM, |
| 518 | }, |
| 519 | [1] = { |
| 520 | .start = IRQ_TWI0, |
| 521 | .end = IRQ_TWI0, |
| 522 | .flags = IORESOURCE_IRQ, |
| 523 | }, |
| 524 | }; |
| 525 | |
| 526 | static struct platform_device i2c_bfin_twi0_device = { |
| 527 | .name = "i2c-bfin-twi", |
| 528 | .id = 0, |
| 529 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), |
| 530 | .resource = bfin_twi0_resource, |
| 531 | }; |
| 532 | |
Mike Frysinger | 7160e950 | 2007-11-21 16:03:07 +0800 | [diff] [blame] | 533 | #if !defined(CONFIG_BF542) /* The BF542 only has 1 TWI */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 534 | static struct resource bfin_twi1_resource[] = { |
| 535 | [0] = { |
| 536 | .start = TWI1_REGBASE, |
| 537 | .end = TWI1_REGBASE + 0xFF, |
| 538 | .flags = IORESOURCE_MEM, |
| 539 | }, |
| 540 | [1] = { |
| 541 | .start = IRQ_TWI1, |
| 542 | .end = IRQ_TWI1, |
| 543 | .flags = IORESOURCE_IRQ, |
| 544 | }, |
| 545 | }; |
| 546 | |
| 547 | static struct platform_device i2c_bfin_twi1_device = { |
| 548 | .name = "i2c-bfin-twi", |
| 549 | .id = 1, |
| 550 | .num_resources = ARRAY_SIZE(bfin_twi1_resource), |
| 551 | .resource = bfin_twi1_resource, |
| 552 | }; |
| 553 | #endif |
Mike Frysinger | 7160e950 | 2007-11-21 16:03:07 +0800 | [diff] [blame] | 554 | #endif |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 555 | |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 556 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 557 | #include <linux/gpio_keys.h> |
| 558 | |
| 559 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
| 560 | {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"}, |
| 561 | {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"}, |
| 562 | {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"}, |
| 563 | {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"}, |
| 564 | }; |
| 565 | |
| 566 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 567 | .buttons = bfin_gpio_keys_table, |
| 568 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 569 | }; |
| 570 | |
| 571 | static struct platform_device bfin_device_gpiokeys = { |
| 572 | .name = "gpio-keys", |
| 573 | .dev = { |
| 574 | .platform_data = &bfin_gpio_keys_data, |
| 575 | }, |
| 576 | }; |
| 577 | #endif |
| 578 | |
Roy Huang | 24a07a1 | 2007-07-12 22:41:45 +0800 | [diff] [blame] | 579 | static struct platform_device *ezkit_devices[] __initdata = { |
| 580 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 581 | &rtc_device, |
| 582 | #endif |
| 583 | |
| 584 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 585 | &bfin_uart_device, |
| 586 | #endif |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 587 | |
| 588 | #if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) |
| 589 | &bf54x_lq043_device, |
| 590 | #endif |
| 591 | |
| 592 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 593 | &smsc911x_device, |
| 594 | #endif |
| 595 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 596 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 597 | &musb_device, |
| 598 | #endif |
| 599 | |
| 600 | #if defined(CONFIG_PATA_BF54X) || defined(CONFIG_PATA_BF54X_MODULE) |
| 601 | &bfin_atapi_device, |
| 602 | #endif |
| 603 | |
| 604 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 605 | &bf5xx_nand_device, |
| 606 | #endif |
| 607 | |
| 608 | #if defined(CONFIG_SDH_BFIN) || defined(CONFIG_SDH_BFIN) |
| 609 | &bf54x_sdh_device, |
| 610 | #endif |
| 611 | |
| 612 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 613 | &bf54x_spi_master0, |
Bryan Wu | d4b1d27 | 2007-10-21 17:03:55 +0800 | [diff] [blame] | 614 | &bf54x_spi_master1, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 615 | #endif |
| 616 | |
| 617 | #if defined(CONFIG_KEYBOARD_BFIN) || defined(CONFIG_KEYBOARD_BFIN_MODULE) |
| 618 | &bf54x_kpad_device, |
| 619 | #endif |
| 620 | |
| 621 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 622 | &i2c_bfin_twi0_device, |
Mike Frysinger | 7160e950 | 2007-11-21 16:03:07 +0800 | [diff] [blame] | 623 | #if !defined(CONFIG_BF542) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 624 | &i2c_bfin_twi1_device, |
| 625 | #endif |
Mike Frysinger | 7160e950 | 2007-11-21 16:03:07 +0800 | [diff] [blame] | 626 | #endif |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 627 | |
| 628 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 629 | &bfin_device_gpiokeys, |
| 630 | #endif |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 631 | &ezkit_flash_device, |
Roy Huang | 24a07a1 | 2007-07-12 22:41:45 +0800 | [diff] [blame] | 632 | }; |
| 633 | |
| 634 | static int __init stamp_init(void) |
| 635 | { |
| 636 | printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__); |
| 637 | platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 638 | |
| 639 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 640 | spi_register_board_info(bf54x_spi_board_info, |
| 641 | ARRAY_SIZE(bf54x_spi_board_info)); |
| 642 | #endif |
| 643 | |
Roy Huang | 24a07a1 | 2007-07-12 22:41:45 +0800 | [diff] [blame] | 644 | return 0; |
| 645 | } |
| 646 | |
| 647 | arch_initcall(stamp_init); |