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