Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 1 | /* |
| 2 | * File: arch/blackfin/mach-bf527/boards/ezkit.c |
| 3 | * Based on: arch/blackfin/mach-bf537/boards/stamp.c |
| 4 | * Author: Aidan Williams <aidan@nicta.com.au> |
| 5 | * |
| 6 | * Created: |
| 7 | * Description: |
| 8 | * |
| 9 | * Modified: |
| 10 | * Copyright 2005 National ICT Australia (NICTA) |
Michael Hennerich | a628a8b | 2008-01-22 17:29:16 +0800 | [diff] [blame] | 11 | * Copyright 2004-2008 Analog Devices Inc. |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 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 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
Mike Frysinger | f02bcec | 2007-11-15 21:29:15 +0800 | [diff] [blame] | 38 | #include <linux/usb/isp1362.h> |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 39 | #endif |
Jeff Garzik | 0a87e3e | 2008-02-01 18:02:30 -0500 | [diff] [blame] | 40 | #include <linux/ata_platform.h> |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 41 | #include <linux/irq.h> |
| 42 | #include <linux/interrupt.h> |
Mike Frysinger | 632f658 | 2007-11-15 21:25:47 +0800 | [diff] [blame] | 43 | #include <linux/usb/sl811.h> |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 44 | #include <linux/usb/musb.h> |
Michael Hennerich | 64307f7 | 2007-10-29 16:55:18 +0800 | [diff] [blame] | 45 | #include <asm/cplb.h> |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 46 | #include <asm/dma.h> |
| 47 | #include <asm/bfin5xx_spi.h> |
| 48 | #include <asm/reboot.h> |
Michael Hennerich | 64307f7 | 2007-10-29 16:55:18 +0800 | [diff] [blame] | 49 | #include <asm/nand.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 50 | #include <asm/portmux.h> |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 51 | #include <linux/spi/ad7877.h> |
| 52 | |
| 53 | /* |
| 54 | * Name the Board for the /proc/cpuinfo |
| 55 | */ |
Mike Frysinger | 066954a | 2007-10-21 22:36:06 +0800 | [diff] [blame] | 56 | const char bfin_board_name[] = "ADDS-BF527-EZKIT"; |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 57 | |
| 58 | /* |
| 59 | * Driver needs to know address, irq and flag pin. |
| 60 | */ |
| 61 | |
| 62 | #define ISP1761_BASE 0x203C0000 |
| 63 | #define ISP1761_IRQ IRQ_PF7 |
| 64 | |
| 65 | #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) |
| 66 | static struct resource bfin_isp1761_resources[] = { |
| 67 | [0] = { |
| 68 | .name = "isp1761-regs", |
| 69 | .start = ISP1761_BASE + 0x00000000, |
| 70 | .end = ISP1761_BASE + 0x000fffff, |
| 71 | .flags = IORESOURCE_MEM, |
| 72 | }, |
| 73 | [1] = { |
| 74 | .start = ISP1761_IRQ, |
| 75 | .end = ISP1761_IRQ, |
| 76 | .flags = IORESOURCE_IRQ, |
| 77 | }, |
| 78 | }; |
| 79 | |
| 80 | static struct platform_device bfin_isp1761_device = { |
| 81 | .name = "isp1761", |
| 82 | .id = 0, |
| 83 | .num_resources = ARRAY_SIZE(bfin_isp1761_resources), |
| 84 | .resource = bfin_isp1761_resources, |
| 85 | }; |
| 86 | |
| 87 | static struct platform_device *bfin_isp1761_devices[] = { |
| 88 | &bfin_isp1761_device, |
| 89 | }; |
| 90 | |
| 91 | int __init bfin_isp1761_init(void) |
| 92 | { |
| 93 | unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices); |
| 94 | |
| 95 | printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__); |
| 96 | set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING); |
| 97 | |
| 98 | return platform_add_devices(bfin_isp1761_devices, num_devices); |
| 99 | } |
| 100 | |
| 101 | void __exit bfin_isp1761_exit(void) |
| 102 | { |
| 103 | platform_device_unregister(&bfin_isp1761_device); |
| 104 | } |
| 105 | |
| 106 | arch_initcall(bfin_isp1761_init); |
| 107 | #endif |
| 108 | |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 109 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 110 | static struct resource musb_resources[] = { |
| 111 | [0] = { |
| 112 | .start = 0xffc03800, |
| 113 | .end = 0xffc03cff, |
| 114 | .flags = IORESOURCE_MEM, |
| 115 | }, |
| 116 | [1] = { /* general IRQ */ |
| 117 | .start = IRQ_USB_INT0, |
| 118 | .end = IRQ_USB_INT0, |
| 119 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 120 | }, |
| 121 | [2] = { /* DMA IRQ */ |
| 122 | .start = IRQ_USB_DMA, |
| 123 | .end = IRQ_USB_DMA, |
| 124 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 125 | }, |
| 126 | }; |
| 127 | |
| 128 | static struct musb_hdrc_platform_data musb_plat = { |
| 129 | #if defined(CONFIG_USB_MUSB_OTG) |
| 130 | .mode = MUSB_OTG, |
| 131 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) |
| 132 | .mode = MUSB_HOST, |
| 133 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) |
| 134 | .mode = MUSB_PERIPHERAL, |
| 135 | #endif |
| 136 | .multipoint = 0, |
| 137 | }; |
| 138 | |
| 139 | static u64 musb_dmamask = ~(u32)0; |
| 140 | |
| 141 | static struct platform_device musb_device = { |
| 142 | .name = "musb_hdrc", |
| 143 | .id = 0, |
| 144 | .dev = { |
| 145 | .dma_mask = &musb_dmamask, |
| 146 | .coherent_dma_mask = 0xffffffff, |
| 147 | .platform_data = &musb_plat, |
| 148 | }, |
| 149 | .num_resources = ARRAY_SIZE(musb_resources), |
| 150 | .resource = musb_resources, |
| 151 | }; |
| 152 | #endif |
| 153 | |
| 154 | #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE) |
| 155 | |
| 156 | static struct resource bf52x_t350mcqb_resources[] = { |
| 157 | { |
| 158 | .start = IRQ_PPI_ERROR, |
| 159 | .end = IRQ_PPI_ERROR, |
| 160 | .flags = IORESOURCE_IRQ, |
| 161 | }, |
| 162 | }; |
| 163 | |
| 164 | static struct platform_device bf52x_t350mcqb_device = { |
| 165 | .name = "bfin-t350mcqb", |
| 166 | .id = -1, |
| 167 | .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources), |
| 168 | .resource = bf52x_t350mcqb_resources, |
| 169 | }; |
| 170 | #endif |
| 171 | |
Michael Hennerich | 64307f7 | 2007-10-29 16:55:18 +0800 | [diff] [blame] | 172 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 173 | static struct mtd_partition partition_info[] = { |
| 174 | { |
| 175 | .name = "Linux Kernel", |
| 176 | .offset = 0, |
| 177 | .size = 4 * SIZE_1M, |
| 178 | }, |
| 179 | { |
| 180 | .name = "File System", |
| 181 | .offset = 4 * SIZE_1M, |
| 182 | .size = (256 - 4) * SIZE_1M, |
| 183 | }, |
| 184 | }; |
| 185 | |
| 186 | static struct bf5xx_nand_platform bf5xx_nand_platform = { |
| 187 | .page_size = NFC_PG_SIZE_256, |
| 188 | .data_width = NFC_NWIDTH_8, |
| 189 | .partitions = partition_info, |
| 190 | .nr_partitions = ARRAY_SIZE(partition_info), |
| 191 | .rd_dly = 3, |
| 192 | .wr_dly = 3, |
| 193 | }; |
| 194 | |
| 195 | static struct resource bf5xx_nand_resources[] = { |
| 196 | { |
| 197 | .start = NFC_CTL, |
| 198 | .end = NFC_DATA_RD + 2, |
| 199 | .flags = IORESOURCE_MEM, |
| 200 | }, |
| 201 | { |
| 202 | .start = CH_NFC, |
| 203 | .end = CH_NFC, |
| 204 | .flags = IORESOURCE_IRQ, |
| 205 | }, |
| 206 | }; |
| 207 | |
| 208 | static struct platform_device bf5xx_nand_device = { |
| 209 | .name = "bf5xx-nand", |
| 210 | .id = 0, |
| 211 | .num_resources = ARRAY_SIZE(bf5xx_nand_resources), |
| 212 | .resource = bf5xx_nand_resources, |
| 213 | .dev = { |
| 214 | .platform_data = &bf5xx_nand_platform, |
| 215 | }, |
| 216 | }; |
| 217 | #endif |
| 218 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 219 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
| 220 | static struct resource bfin_pcmcia_cf_resources[] = { |
| 221 | { |
| 222 | .start = 0x20310000, /* IO PORT */ |
| 223 | .end = 0x20312000, |
| 224 | .flags = IORESOURCE_MEM, |
| 225 | }, { |
| 226 | .start = 0x20311000, /* Attribute Memory */ |
| 227 | .end = 0x20311FFF, |
| 228 | .flags = IORESOURCE_MEM, |
| 229 | }, { |
| 230 | .start = IRQ_PF4, |
| 231 | .end = IRQ_PF4, |
| 232 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 233 | }, { |
| 234 | .start = 6, /* Card Detect PF6 */ |
| 235 | .end = 6, |
| 236 | .flags = IORESOURCE_IRQ, |
| 237 | }, |
| 238 | }; |
| 239 | |
| 240 | static struct platform_device bfin_pcmcia_cf_device = { |
| 241 | .name = "bfin_cf_pcmcia", |
| 242 | .id = -1, |
| 243 | .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources), |
| 244 | .resource = bfin_pcmcia_cf_resources, |
| 245 | }; |
| 246 | #endif |
| 247 | |
| 248 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 249 | static struct platform_device rtc_device = { |
| 250 | .name = "rtc-bfin", |
| 251 | .id = -1, |
| 252 | }; |
| 253 | #endif |
| 254 | |
| 255 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 256 | static struct resource smc91x_resources[] = { |
| 257 | { |
| 258 | .name = "smc91x-regs", |
| 259 | .start = 0x20300300, |
| 260 | .end = 0x20300300 + 16, |
| 261 | .flags = IORESOURCE_MEM, |
| 262 | }, { |
| 263 | |
| 264 | .start = IRQ_PF7, |
| 265 | .end = IRQ_PF7, |
| 266 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 267 | }, |
| 268 | }; |
| 269 | static struct platform_device smc91x_device = { |
| 270 | .name = "smc91x", |
| 271 | .id = 0, |
| 272 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 273 | .resource = smc91x_resources, |
| 274 | }; |
| 275 | #endif |
| 276 | |
| 277 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 278 | static struct resource dm9000_resources[] = { |
| 279 | [0] = { |
| 280 | .start = 0x203FB800, |
| 281 | .end = 0x203FB800 + 8, |
| 282 | .flags = IORESOURCE_MEM, |
| 283 | }, |
| 284 | [1] = { |
| 285 | .start = IRQ_PF9, |
| 286 | .end = IRQ_PF9, |
| 287 | .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE), |
| 288 | }, |
| 289 | }; |
| 290 | |
| 291 | static struct platform_device dm9000_device = { |
| 292 | .name = "dm9000", |
| 293 | .id = -1, |
| 294 | .num_resources = ARRAY_SIZE(dm9000_resources), |
| 295 | .resource = dm9000_resources, |
| 296 | }; |
| 297 | #endif |
| 298 | |
| 299 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) |
| 300 | static struct resource sl811_hcd_resources[] = { |
| 301 | { |
| 302 | .start = 0x20340000, |
| 303 | .end = 0x20340000, |
| 304 | .flags = IORESOURCE_MEM, |
| 305 | }, { |
| 306 | .start = 0x20340004, |
| 307 | .end = 0x20340004, |
| 308 | .flags = IORESOURCE_MEM, |
| 309 | }, { |
| 310 | .start = CONFIG_USB_SL811_BFIN_IRQ, |
| 311 | .end = CONFIG_USB_SL811_BFIN_IRQ, |
| 312 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 313 | }, |
| 314 | }; |
| 315 | |
| 316 | #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS) |
| 317 | void sl811_port_power(struct device *dev, int is_on) |
| 318 | { |
| 319 | gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS"); |
Michael Hennerich | acbcd26 | 2008-01-22 18:36:20 +0800 | [diff] [blame] | 320 | gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on); |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 321 | } |
| 322 | #endif |
| 323 | |
| 324 | static struct sl811_platform_data sl811_priv = { |
| 325 | .potpg = 10, |
| 326 | .power = 250, /* == 500mA */ |
| 327 | #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS) |
| 328 | .port_power = &sl811_port_power, |
| 329 | #endif |
| 330 | }; |
| 331 | |
| 332 | static struct platform_device sl811_hcd_device = { |
| 333 | .name = "sl811-hcd", |
| 334 | .id = 0, |
| 335 | .dev = { |
| 336 | .platform_data = &sl811_priv, |
| 337 | }, |
| 338 | .num_resources = ARRAY_SIZE(sl811_hcd_resources), |
| 339 | .resource = sl811_hcd_resources, |
| 340 | }; |
| 341 | #endif |
| 342 | |
| 343 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 344 | static struct resource isp1362_hcd_resources[] = { |
| 345 | { |
| 346 | .start = 0x20360000, |
| 347 | .end = 0x20360000, |
| 348 | .flags = IORESOURCE_MEM, |
| 349 | }, { |
| 350 | .start = 0x20360004, |
| 351 | .end = 0x20360004, |
| 352 | .flags = IORESOURCE_MEM, |
| 353 | }, { |
| 354 | .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ, |
| 355 | .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ, |
| 356 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 357 | }, |
| 358 | }; |
| 359 | |
| 360 | static struct isp1362_platform_data isp1362_priv = { |
| 361 | .sel15Kres = 1, |
| 362 | .clknotstop = 0, |
| 363 | .oc_enable = 0, |
| 364 | .int_act_high = 0, |
| 365 | .int_edge_triggered = 0, |
| 366 | .remote_wakeup_connected = 0, |
| 367 | .no_power_switching = 1, |
| 368 | .power_switching_mode = 0, |
| 369 | }; |
| 370 | |
| 371 | static struct platform_device isp1362_hcd_device = { |
| 372 | .name = "isp1362-hcd", |
| 373 | .id = 0, |
| 374 | .dev = { |
| 375 | .platform_data = &isp1362_priv, |
| 376 | }, |
| 377 | .num_resources = ARRAY_SIZE(isp1362_hcd_resources), |
| 378 | .resource = isp1362_hcd_resources, |
| 379 | }; |
| 380 | #endif |
| 381 | |
| 382 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 383 | static struct platform_device bfin_mac_device = { |
| 384 | .name = "bfin_mac", |
| 385 | }; |
| 386 | #endif |
| 387 | |
| 388 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 389 | static struct resource net2272_bfin_resources[] = { |
| 390 | { |
| 391 | .start = 0x20300000, |
| 392 | .end = 0x20300000 + 0x100, |
| 393 | .flags = IORESOURCE_MEM, |
| 394 | }, { |
| 395 | .start = IRQ_PF7, |
| 396 | .end = IRQ_PF7, |
| 397 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 398 | }, |
| 399 | }; |
| 400 | |
| 401 | static struct platform_device net2272_bfin_device = { |
| 402 | .name = "net2272", |
| 403 | .id = -1, |
| 404 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), |
| 405 | .resource = net2272_bfin_resources, |
| 406 | }; |
| 407 | #endif |
| 408 | |
| 409 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 410 | /* all SPI peripherals info goes here */ |
| 411 | |
| 412 | #if defined(CONFIG_MTD_M25P80) \ |
| 413 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 414 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 415 | { |
| 416 | .name = "bootloader", |
| 417 | .size = 0x00020000, |
| 418 | .offset = 0, |
| 419 | .mask_flags = MTD_CAP_ROM |
| 420 | }, { |
| 421 | .name = "kernel", |
| 422 | .size = 0xe0000, |
| 423 | .offset = 0x20000 |
| 424 | }, { |
| 425 | .name = "file system", |
| 426 | .size = 0x700000, |
| 427 | .offset = 0x00100000, |
| 428 | } |
| 429 | }; |
| 430 | |
| 431 | static struct flash_platform_data bfin_spi_flash_data = { |
| 432 | .name = "m25p80", |
| 433 | .parts = bfin_spi_flash_partitions, |
| 434 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 435 | .type = "m25p64", |
| 436 | }; |
| 437 | |
| 438 | /* SPI flash chip (m25p64) */ |
| 439 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 440 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 441 | .bits_per_word = 8, |
| 442 | }; |
| 443 | #endif |
| 444 | |
| 445 | #if defined(CONFIG_SPI_ADC_BF533) \ |
| 446 | || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 447 | /* SPI ADC chip */ |
| 448 | static struct bfin5xx_spi_chip spi_adc_chip_info = { |
| 449 | .enable_dma = 1, /* use dma transfer with this chip*/ |
| 450 | .bits_per_word = 16, |
| 451 | }; |
| 452 | #endif |
| 453 | |
| 454 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
| 455 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 456 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 457 | .enable_dma = 0, |
| 458 | .bits_per_word = 16, |
| 459 | }; |
| 460 | #endif |
| 461 | |
| 462 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) |
| 463 | static struct bfin5xx_spi_chip ad9960_spi_chip_info = { |
| 464 | .enable_dma = 0, |
| 465 | .bits_per_word = 16, |
| 466 | }; |
| 467 | #endif |
| 468 | |
| 469 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 470 | static struct bfin5xx_spi_chip spi_mmc_chip_info = { |
| 471 | .enable_dma = 1, |
| 472 | .bits_per_word = 8, |
| 473 | }; |
| 474 | #endif |
| 475 | |
| 476 | #if defined(CONFIG_PBX) |
| 477 | static struct bfin5xx_spi_chip spi_si3xxx_chip_info = { |
| 478 | .ctl_reg = 0x4, /* send zero */ |
| 479 | .enable_dma = 0, |
| 480 | .bits_per_word = 8, |
| 481 | .cs_change_per_word = 1, |
| 482 | }; |
| 483 | #endif |
| 484 | |
| 485 | #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE) |
| 486 | static struct bfin5xx_spi_chip ad5304_chip_info = { |
| 487 | .enable_dma = 0, |
| 488 | .bits_per_word = 16, |
| 489 | }; |
| 490 | #endif |
| 491 | |
| 492 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 493 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { |
| 494 | .enable_dma = 0, |
| 495 | .bits_per_word = 16, |
| 496 | }; |
| 497 | |
| 498 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { |
| 499 | .model = 7877, |
| 500 | .vref_delay_usecs = 50, /* internal, no capacitor */ |
| 501 | .x_plate_ohms = 419, |
| 502 | .y_plate_ohms = 486, |
| 503 | .pressure_max = 1000, |
| 504 | .pressure_min = 0, |
| 505 | .stopacq_polarity = 1, |
| 506 | .first_conversion_delay = 3, |
| 507 | .acquisition_time = 1, |
| 508 | .averaging = 1, |
| 509 | .pen_down_acc_interval = 1, |
| 510 | }; |
| 511 | #endif |
| 512 | |
Michael Hennerich | c7d4896 | 2007-11-15 21:33:31 +0800 | [diff] [blame] | 513 | #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \ |
Michael Hennerich | 0954f70 | 2007-11-13 00:16:19 +0800 | [diff] [blame] | 514 | && defined(CONFIG_SND_SOC_WM8731_SPI) |
| 515 | static struct bfin5xx_spi_chip spi_wm8731_chip_info = { |
| 516 | .enable_dma = 0, |
| 517 | .bits_per_word = 16, |
| 518 | }; |
| 519 | #endif |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 520 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
| 521 | #if defined(CONFIG_MTD_M25P80) \ |
| 522 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 523 | { |
| 524 | /* the modalias must be the same as spi device driver name */ |
| 525 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 526 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
| 527 | .bus_num = 0, /* Framework bus number */ |
| 528 | .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/ |
| 529 | .platform_data = &bfin_spi_flash_data, |
| 530 | .controller_data = &spi_flash_chip_info, |
| 531 | .mode = SPI_MODE_3, |
| 532 | }, |
| 533 | #endif |
| 534 | |
| 535 | #if defined(CONFIG_SPI_ADC_BF533) \ |
| 536 | || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 537 | { |
| 538 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ |
| 539 | .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ |
| 540 | .bus_num = 0, /* Framework bus number */ |
| 541 | .chip_select = 1, /* Framework chip select. */ |
| 542 | .platform_data = NULL, /* No spi_driver specific config */ |
| 543 | .controller_data = &spi_adc_chip_info, |
| 544 | }, |
| 545 | #endif |
| 546 | |
| 547 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
| 548 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 549 | { |
| 550 | .modalias = "ad1836-spi", |
| 551 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 552 | .bus_num = 0, |
| 553 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, |
| 554 | .controller_data = &ad1836_spi_chip_info, |
| 555 | }, |
| 556 | #endif |
| 557 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) |
| 558 | { |
| 559 | .modalias = "ad9960-spi", |
| 560 | .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */ |
| 561 | .bus_num = 0, |
| 562 | .chip_select = 1, |
| 563 | .controller_data = &ad9960_spi_chip_info, |
| 564 | }, |
| 565 | #endif |
| 566 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 567 | { |
| 568 | .modalias = "spi_mmc_dummy", |
| 569 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
| 570 | .bus_num = 0, |
| 571 | .chip_select = 0, |
| 572 | .platform_data = NULL, |
| 573 | .controller_data = &spi_mmc_chip_info, |
| 574 | .mode = SPI_MODE_3, |
| 575 | }, |
| 576 | { |
| 577 | .modalias = "spi_mmc", |
| 578 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
| 579 | .bus_num = 0, |
| 580 | .chip_select = CONFIG_SPI_MMC_CS_CHAN, |
| 581 | .platform_data = NULL, |
| 582 | .controller_data = &spi_mmc_chip_info, |
| 583 | .mode = SPI_MODE_3, |
| 584 | }, |
| 585 | #endif |
| 586 | #if defined(CONFIG_PBX) |
| 587 | { |
| 588 | .modalias = "fxs-spi", |
| 589 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
| 590 | .bus_num = 0, |
| 591 | .chip_select = 8 - CONFIG_J11_JUMPER, |
| 592 | .controller_data = &spi_si3xxx_chip_info, |
| 593 | .mode = SPI_MODE_3, |
| 594 | }, |
| 595 | { |
| 596 | .modalias = "fxo-spi", |
| 597 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
| 598 | .bus_num = 0, |
| 599 | .chip_select = 8 - CONFIG_J19_JUMPER, |
| 600 | .controller_data = &spi_si3xxx_chip_info, |
| 601 | .mode = SPI_MODE_3, |
| 602 | }, |
| 603 | #endif |
| 604 | #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE) |
| 605 | { |
| 606 | .modalias = "ad5304_spi", |
| 607 | .max_speed_hz = 1250000, /* max spi clock (SCK) speed in HZ */ |
| 608 | .bus_num = 0, |
| 609 | .chip_select = 2, |
| 610 | .platform_data = NULL, |
| 611 | .controller_data = &ad5304_chip_info, |
| 612 | .mode = SPI_MODE_2, |
| 613 | }, |
| 614 | #endif |
| 615 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 616 | { |
| 617 | .modalias = "ad7877", |
| 618 | .platform_data = &bfin_ad7877_ts_info, |
| 619 | .irq = IRQ_PF6, |
| 620 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
Michael Hennerich | 0954f70 | 2007-11-13 00:16:19 +0800 | [diff] [blame] | 621 | .bus_num = 0, |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 622 | .chip_select = 1, |
| 623 | .controller_data = &spi_ad7877_chip_info, |
| 624 | }, |
| 625 | #endif |
Michael Hennerich | c7d4896 | 2007-11-15 21:33:31 +0800 | [diff] [blame] | 626 | #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \ |
Michael Hennerich | 0954f70 | 2007-11-13 00:16:19 +0800 | [diff] [blame] | 627 | && defined(CONFIG_SND_SOC_WM8731_SPI) |
| 628 | { |
| 629 | .modalias = "wm8731", |
| 630 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 631 | .bus_num = 0, |
| 632 | .chip_select = 5, |
| 633 | .controller_data = &spi_wm8731_chip_info, |
| 634 | .mode = SPI_MODE_0, |
| 635 | }, |
| 636 | #endif |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 637 | }; |
| 638 | |
| 639 | /* SPI controller data */ |
| 640 | static struct bfin5xx_spi_master bfin_spi0_info = { |
| 641 | .num_chipselect = 8, |
| 642 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 643 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 644 | }; |
| 645 | |
| 646 | /* SPI (0) */ |
| 647 | static struct resource bfin_spi0_resource[] = { |
| 648 | [0] = { |
| 649 | .start = SPI0_REGBASE, |
| 650 | .end = SPI0_REGBASE + 0xFF, |
| 651 | .flags = IORESOURCE_MEM, |
| 652 | }, |
| 653 | [1] = { |
| 654 | .start = CH_SPI, |
| 655 | .end = CH_SPI, |
| 656 | .flags = IORESOURCE_IRQ, |
| 657 | }, |
| 658 | }; |
| 659 | |
| 660 | static struct platform_device bfin_spi0_device = { |
| 661 | .name = "bfin-spi", |
| 662 | .id = 0, /* Bus number */ |
| 663 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 664 | .resource = bfin_spi0_resource, |
| 665 | .dev = { |
| 666 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
| 667 | }, |
| 668 | }; |
| 669 | #endif /* spi master and devices */ |
| 670 | |
| 671 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) |
| 672 | static struct platform_device bfin_fb_device = { |
| 673 | .name = "bf537-lq035", |
| 674 | }; |
| 675 | #endif |
| 676 | |
| 677 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
| 678 | static struct platform_device bfin_fb_adv7393_device = { |
| 679 | .name = "bfin-adv7393", |
| 680 | }; |
| 681 | #endif |
| 682 | |
| 683 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 684 | static struct resource bfin_uart_resources[] = { |
| 685 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 686 | { |
| 687 | .start = 0xFFC00400, |
| 688 | .end = 0xFFC004FF, |
| 689 | .flags = IORESOURCE_MEM, |
| 690 | }, |
| 691 | #endif |
| 692 | #ifdef CONFIG_SERIAL_BFIN_UART1 |
| 693 | { |
| 694 | .start = 0xFFC02000, |
| 695 | .end = 0xFFC020FF, |
| 696 | .flags = IORESOURCE_MEM, |
| 697 | }, |
| 698 | #endif |
| 699 | }; |
| 700 | |
| 701 | static struct platform_device bfin_uart_device = { |
| 702 | .name = "bfin-uart", |
| 703 | .id = 1, |
| 704 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 705 | .resource = bfin_uart_resources, |
| 706 | }; |
| 707 | #endif |
| 708 | |
| 709 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 710 | static struct resource bfin_twi0_resource[] = { |
| 711 | [0] = { |
| 712 | .start = TWI0_REGBASE, |
| 713 | .end = TWI0_REGBASE, |
| 714 | .flags = IORESOURCE_MEM, |
| 715 | }, |
| 716 | [1] = { |
| 717 | .start = IRQ_TWI, |
| 718 | .end = IRQ_TWI, |
| 719 | .flags = IORESOURCE_IRQ, |
| 720 | }, |
| 721 | }; |
| 722 | |
| 723 | static struct platform_device i2c_bfin_twi_device = { |
| 724 | .name = "i2c-bfin-twi", |
| 725 | .id = 0, |
| 726 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), |
| 727 | .resource = bfin_twi0_resource, |
| 728 | }; |
| 729 | #endif |
| 730 | |
| 731 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 732 | static struct platform_device bfin_sport0_uart_device = { |
| 733 | .name = "bfin-sport-uart", |
| 734 | .id = 0, |
| 735 | }; |
| 736 | |
| 737 | static struct platform_device bfin_sport1_uart_device = { |
| 738 | .name = "bfin-sport-uart", |
| 739 | .id = 1, |
| 740 | }; |
| 741 | #endif |
| 742 | |
| 743 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 744 | #define PATA_INT 55 |
| 745 | |
| 746 | static struct pata_platform_info bfin_pata_platform_data = { |
| 747 | .ioport_shift = 1, |
| 748 | .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, |
| 749 | }; |
| 750 | |
| 751 | static struct resource bfin_pata_resources[] = { |
| 752 | { |
| 753 | .start = 0x20314020, |
| 754 | .end = 0x2031403F, |
| 755 | .flags = IORESOURCE_MEM, |
| 756 | }, |
| 757 | { |
| 758 | .start = 0x2031401C, |
| 759 | .end = 0x2031401F, |
| 760 | .flags = IORESOURCE_MEM, |
| 761 | }, |
| 762 | { |
| 763 | .start = PATA_INT, |
| 764 | .end = PATA_INT, |
| 765 | .flags = IORESOURCE_IRQ, |
| 766 | }, |
| 767 | }; |
| 768 | |
| 769 | static struct platform_device bfin_pata_device = { |
| 770 | .name = "pata_platform", |
| 771 | .id = -1, |
| 772 | .num_resources = ARRAY_SIZE(bfin_pata_resources), |
| 773 | .resource = bfin_pata_resources, |
| 774 | .dev = { |
| 775 | .platform_data = &bfin_pata_platform_data, |
| 776 | } |
| 777 | }; |
| 778 | #endif |
| 779 | |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 780 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 781 | #include <linux/input.h> |
| 782 | #include <linux/gpio_keys.h> |
| 783 | |
| 784 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
| 785 | {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"}, |
| 786 | {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"}, |
| 787 | }; |
| 788 | |
| 789 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 790 | .buttons = bfin_gpio_keys_table, |
| 791 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 792 | }; |
| 793 | |
| 794 | static struct platform_device bfin_device_gpiokeys = { |
| 795 | .name = "gpio-keys", |
| 796 | .dev = { |
| 797 | .platform_data = &bfin_gpio_keys_data, |
| 798 | }, |
| 799 | }; |
| 800 | #endif |
| 801 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 802 | static struct platform_device *stamp_devices[] __initdata = { |
Michael Hennerich | 64307f7 | 2007-10-29 16:55:18 +0800 | [diff] [blame] | 803 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 804 | &bf5xx_nand_device, |
| 805 | #endif |
| 806 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 807 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
| 808 | &bfin_pcmcia_cf_device, |
| 809 | #endif |
| 810 | |
| 811 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 812 | &rtc_device, |
| 813 | #endif |
| 814 | |
| 815 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) |
| 816 | &sl811_hcd_device, |
| 817 | #endif |
| 818 | |
| 819 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 820 | &isp1362_hcd_device, |
| 821 | #endif |
| 822 | |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 823 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 824 | &musb_device, |
| 825 | #endif |
| 826 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 827 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 828 | &smc91x_device, |
| 829 | #endif |
| 830 | |
| 831 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 832 | &dm9000_device, |
| 833 | #endif |
| 834 | |
| 835 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 836 | &bfin_mac_device, |
| 837 | #endif |
| 838 | |
| 839 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 840 | &net2272_bfin_device, |
| 841 | #endif |
| 842 | |
| 843 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 844 | &bfin_spi0_device, |
| 845 | #endif |
| 846 | |
| 847 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) |
| 848 | &bfin_fb_device, |
| 849 | #endif |
| 850 | |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 851 | #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE) |
| 852 | &bf52x_t350mcqb_device, |
| 853 | #endif |
| 854 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 855 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
| 856 | &bfin_fb_adv7393_device, |
| 857 | #endif |
| 858 | |
| 859 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 860 | &bfin_uart_device, |
| 861 | #endif |
| 862 | |
| 863 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 864 | &i2c_bfin_twi_device, |
| 865 | #endif |
| 866 | |
| 867 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 868 | &bfin_sport0_uart_device, |
| 869 | &bfin_sport1_uart_device, |
| 870 | #endif |
| 871 | |
| 872 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 873 | &bfin_pata_device, |
| 874 | #endif |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 875 | |
| 876 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 877 | &bfin_device_gpiokeys, |
| 878 | #endif |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 879 | }; |
| 880 | |
| 881 | static int __init stamp_init(void) |
| 882 | { |
| 883 | printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__); |
| 884 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 885 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 886 | spi_register_board_info(bfin_spi_board_info, |
| 887 | ARRAY_SIZE(bfin_spi_board_info)); |
| 888 | #endif |
| 889 | |
| 890 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 891 | irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; |
| 892 | #endif |
| 893 | return 0; |
| 894 | } |
| 895 | |
| 896 | arch_initcall(stamp_init); |
| 897 | |
| 898 | void native_machine_restart(char *cmd) |
| 899 | { |
| 900 | /* workaround reboot hang when booting from SPI */ |
| 901 | if ((bfin_read_SYSCR() & 0x7) == 0x3) |
| 902 | bfin_gpio_reset_spi0_ssel1(); |
| 903 | } |
Mike Frysinger | 137b152 | 2007-11-22 16:07:03 +0800 | [diff] [blame] | 904 | |
| 905 | /* |
| 906 | * Currently the MAC address is saved in Flash by U-Boot |
| 907 | */ |
| 908 | #define FLASH_MAC 0x203f0000 |
Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 909 | void bfin_get_ether_addr(char *addr) |
Mike Frysinger | 137b152 | 2007-11-22 16:07:03 +0800 | [diff] [blame] | 910 | { |
| 911 | *(u32 *)(&(addr[0])) = bfin_read32(FLASH_MAC); |
| 912 | *(u16 *)(&(addr[4])) = bfin_read16(FLASH_MAC + 4); |
| 913 | } |
Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 914 | EXPORT_SYMBOL(bfin_get_ether_addr); |