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