Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * File: arch/blackfin/mach-bf537/boards/stamp.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) |
| 11 | * Copyright 2004-2006 Analog Devices Inc. |
| 12 | * |
| 13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
| 14 | * |
| 15 | * This program is free software; you can redistribute it and/or modify |
| 16 | * it under the terms of the GNU General Public License as published by |
| 17 | * the Free Software Foundation; either version 2 of the License, or |
| 18 | * (at your option) any later version. |
| 19 | * |
| 20 | * This program is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | * GNU General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License |
| 26 | * along with this program; if not, see the file COPYING, or write |
| 27 | * to the Free Software Foundation, Inc., |
| 28 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 29 | */ |
| 30 | |
| 31 | #include <linux/device.h> |
| 32 | #include <linux/platform_device.h> |
| 33 | #include <linux/mtd/mtd.h> |
| 34 | #include <linux/mtd/partitions.h> |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 35 | #include <linux/mtd/physmap.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 36 | #include <linux/spi/spi.h> |
| 37 | #include <linux/spi/flash.h> |
| 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 | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 40 | #endif |
Jeff Garzik | 0a87e3e | 2008-02-01 18:02:30 -0500 | [diff] [blame] | 41 | #include <linux/ata_platform.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 42 | #include <linux/irq.h> |
| 43 | #include <linux/interrupt.h> |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 44 | #include <linux/i2c.h> |
David Brownell | 27f5d75 | 2007-10-04 18:06:16 -0700 | [diff] [blame] | 45 | #include <linux/usb/sl811.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 46 | #include <asm/dma.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 47 | #include <asm/bfin5xx_spi.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 48 | #include <asm/reboot.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 49 | #include <asm/portmux.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [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-BF537-STAMP"; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [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 | { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 92 | unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 93 | |
Harvey Harrison | b85d858 | 2008-04-23 09:39:01 +0800 | [diff] [blame] | 94 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 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 | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 108 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 109 | #include <linux/input.h> |
| 110 | #include <linux/gpio_keys.h> |
| 111 | |
| 112 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
| 113 | {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"}, |
| 114 | {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"}, |
| 115 | {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"}, |
| 116 | {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"}, |
| 117 | }; |
| 118 | |
| 119 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 120 | .buttons = bfin_gpio_keys_table, |
| 121 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 122 | }; |
| 123 | |
| 124 | static struct platform_device bfin_device_gpiokeys = { |
| 125 | .name = "gpio-keys", |
| 126 | .dev = { |
| 127 | .platform_data = &bfin_gpio_keys_data, |
| 128 | }, |
| 129 | }; |
| 130 | #endif |
| 131 | |
Mike Frysinger | cad2ab6 | 2008-02-22 17:01:31 +0800 | [diff] [blame] | 132 | static struct resource bfin_gpios_resources = { |
| 133 | .start = 0, |
| 134 | .end = MAX_BLACKFIN_GPIOS - 1, |
| 135 | .flags = IORESOURCE_IRQ, |
| 136 | }; |
| 137 | |
| 138 | static struct platform_device bfin_gpios_device = { |
| 139 | .name = "simple-gpio", |
| 140 | .id = -1, |
| 141 | .num_resources = 1, |
| 142 | .resource = &bfin_gpios_resources, |
| 143 | }; |
| 144 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 145 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
| 146 | static struct resource bfin_pcmcia_cf_resources[] = { |
| 147 | { |
| 148 | .start = 0x20310000, /* IO PORT */ |
| 149 | .end = 0x20312000, |
| 150 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 151 | }, { |
Simon Arlott | d2d50aa | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 152 | .start = 0x20311000, /* Attribute Memory */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 153 | .end = 0x20311FFF, |
| 154 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 155 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 156 | .start = IRQ_PF4, |
| 157 | .end = IRQ_PF4, |
| 158 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 159 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 160 | .start = 6, /* Card Detect PF6 */ |
| 161 | .end = 6, |
| 162 | .flags = IORESOURCE_IRQ, |
| 163 | }, |
| 164 | }; |
| 165 | |
| 166 | static struct platform_device bfin_pcmcia_cf_device = { |
| 167 | .name = "bfin_cf_pcmcia", |
| 168 | .id = -1, |
| 169 | .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources), |
| 170 | .resource = bfin_pcmcia_cf_resources, |
| 171 | }; |
| 172 | #endif |
| 173 | |
| 174 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 175 | static struct platform_device rtc_device = { |
| 176 | .name = "rtc-bfin", |
| 177 | .id = -1, |
| 178 | }; |
| 179 | #endif |
| 180 | |
| 181 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 182 | static struct resource smc91x_resources[] = { |
| 183 | { |
| 184 | .name = "smc91x-regs", |
| 185 | .start = 0x20300300, |
| 186 | .end = 0x20300300 + 16, |
| 187 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 188 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 189 | |
| 190 | .start = IRQ_PF7, |
| 191 | .end = IRQ_PF7, |
| 192 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 193 | }, |
| 194 | }; |
| 195 | static struct platform_device smc91x_device = { |
| 196 | .name = "smc91x", |
| 197 | .id = 0, |
| 198 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 199 | .resource = smc91x_resources, |
| 200 | }; |
| 201 | #endif |
| 202 | |
Alex Landau | f40d24d | 2007-07-12 12:11:48 +0800 | [diff] [blame] | 203 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 204 | static struct resource dm9000_resources[] = { |
| 205 | [0] = { |
| 206 | .start = 0x203FB800, |
| 207 | .end = 0x203FB800 + 8, |
| 208 | .flags = IORESOURCE_MEM, |
| 209 | }, |
| 210 | [1] = { |
| 211 | .start = IRQ_PF9, |
| 212 | .end = IRQ_PF9, |
| 213 | .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE), |
| 214 | }, |
| 215 | }; |
| 216 | |
| 217 | static struct platform_device dm9000_device = { |
| 218 | .name = "dm9000", |
| 219 | .id = -1, |
| 220 | .num_resources = ARRAY_SIZE(dm9000_resources), |
| 221 | .resource = dm9000_resources, |
| 222 | }; |
| 223 | #endif |
| 224 | |
Michael Hennerich | 561cc18 | 2007-11-17 23:56:08 +0800 | [diff] [blame] | 225 | #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE) |
| 226 | static struct resource ax88180_resources[] = { |
| 227 | [0] = { |
| 228 | .start = 0x20300000, |
| 229 | .end = 0x20300000 + 0x8000, |
| 230 | .flags = IORESOURCE_MEM, |
| 231 | }, |
| 232 | [1] = { |
| 233 | .start = IRQ_PF7, |
| 234 | .end = IRQ_PF7, |
| 235 | .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL), |
| 236 | }, |
| 237 | }; |
| 238 | |
| 239 | static struct platform_device ax88180_device = { |
| 240 | .name = "ax88180", |
| 241 | .id = -1, |
| 242 | .num_resources = ARRAY_SIZE(ax88180_resources), |
| 243 | .resource = ax88180_resources, |
| 244 | }; |
| 245 | #endif |
| 246 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 247 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) |
| 248 | static struct resource sl811_hcd_resources[] = { |
| 249 | { |
| 250 | .start = 0x20340000, |
| 251 | .end = 0x20340000, |
| 252 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 253 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 254 | .start = 0x20340004, |
| 255 | .end = 0x20340004, |
| 256 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 257 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 258 | .start = CONFIG_USB_SL811_BFIN_IRQ, |
| 259 | .end = CONFIG_USB_SL811_BFIN_IRQ, |
| 260 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 261 | }, |
| 262 | }; |
| 263 | |
| 264 | #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS) |
| 265 | void sl811_port_power(struct device *dev, int is_on) |
| 266 | { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 267 | gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS"); |
Michael Hennerich | acbcd26 | 2008-01-22 18:36:20 +0800 | [diff] [blame] | 268 | gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 269 | } |
| 270 | #endif |
| 271 | |
| 272 | static struct sl811_platform_data sl811_priv = { |
| 273 | .potpg = 10, |
| 274 | .power = 250, /* == 500mA */ |
| 275 | #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS) |
| 276 | .port_power = &sl811_port_power, |
| 277 | #endif |
| 278 | }; |
| 279 | |
| 280 | static struct platform_device sl811_hcd_device = { |
| 281 | .name = "sl811-hcd", |
| 282 | .id = 0, |
| 283 | .dev = { |
| 284 | .platform_data = &sl811_priv, |
| 285 | }, |
| 286 | .num_resources = ARRAY_SIZE(sl811_hcd_resources), |
| 287 | .resource = sl811_hcd_resources, |
| 288 | }; |
| 289 | #endif |
| 290 | |
| 291 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 292 | static struct resource isp1362_hcd_resources[] = { |
| 293 | { |
| 294 | .start = 0x20360000, |
| 295 | .end = 0x20360000, |
| 296 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 297 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 298 | .start = 0x20360004, |
| 299 | .end = 0x20360004, |
| 300 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 301 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 302 | .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ, |
| 303 | .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ, |
| 304 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 305 | }, |
| 306 | }; |
| 307 | |
| 308 | static struct isp1362_platform_data isp1362_priv = { |
| 309 | .sel15Kres = 1, |
| 310 | .clknotstop = 0, |
| 311 | .oc_enable = 0, |
| 312 | .int_act_high = 0, |
| 313 | .int_edge_triggered = 0, |
| 314 | .remote_wakeup_connected = 0, |
| 315 | .no_power_switching = 1, |
| 316 | .power_switching_mode = 0, |
| 317 | }; |
| 318 | |
| 319 | static struct platform_device isp1362_hcd_device = { |
| 320 | .name = "isp1362-hcd", |
| 321 | .id = 0, |
| 322 | .dev = { |
| 323 | .platform_data = &isp1362_priv, |
| 324 | }, |
| 325 | .num_resources = ARRAY_SIZE(isp1362_hcd_resources), |
| 326 | .resource = isp1362_hcd_resources, |
| 327 | }; |
| 328 | #endif |
| 329 | |
| 330 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 331 | static struct platform_device bfin_mac_device = { |
| 332 | .name = "bfin_mac", |
| 333 | }; |
| 334 | #endif |
| 335 | |
| 336 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 337 | static struct resource net2272_bfin_resources[] = { |
| 338 | { |
| 339 | .start = 0x20300000, |
| 340 | .end = 0x20300000 + 0x100, |
| 341 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 342 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 343 | .start = IRQ_PF7, |
| 344 | .end = IRQ_PF7, |
| 345 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 346 | }, |
| 347 | }; |
| 348 | |
| 349 | static struct platform_device net2272_bfin_device = { |
| 350 | .name = "net2272", |
| 351 | .id = -1, |
| 352 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), |
| 353 | .resource = net2272_bfin_resources, |
| 354 | }; |
| 355 | #endif |
| 356 | |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 357 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 358 | static struct mtd_partition stamp_partitions[] = { |
| 359 | { |
| 360 | .name = "Bootloader", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 361 | .size = 0x40000, |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 362 | .offset = 0, |
| 363 | }, { |
| 364 | .name = "Kernel", |
| 365 | .size = 0xE0000, |
| 366 | .offset = MTDPART_OFS_APPEND, |
| 367 | }, { |
| 368 | .name = "RootFS", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 369 | .size = 0x400000 - 0x40000 - 0xE0000 - 0x10000, |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 370 | .offset = MTDPART_OFS_APPEND, |
| 371 | }, { |
| 372 | .name = "MAC Address", |
| 373 | .size = MTDPART_SIZ_FULL, |
| 374 | .offset = 0x3F0000, |
| 375 | .mask_flags = MTD_WRITEABLE, |
| 376 | } |
| 377 | }; |
| 378 | |
| 379 | static struct physmap_flash_data stamp_flash_data = { |
| 380 | .width = 2, |
| 381 | .parts = stamp_partitions, |
| 382 | .nr_parts = ARRAY_SIZE(stamp_partitions), |
| 383 | }; |
| 384 | |
| 385 | static struct resource stamp_flash_resource = { |
| 386 | .start = 0x20000000, |
| 387 | .end = 0x203fffff, |
| 388 | .flags = IORESOURCE_MEM, |
| 389 | }; |
| 390 | |
| 391 | static struct platform_device stamp_flash_device = { |
| 392 | .name = "physmap-flash", |
| 393 | .id = 0, |
| 394 | .dev = { |
| 395 | .platform_data = &stamp_flash_data, |
| 396 | }, |
| 397 | .num_resources = 1, |
| 398 | .resource = &stamp_flash_resource, |
| 399 | }; |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 400 | #endif |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 401 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 402 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 403 | /* all SPI peripherals info goes here */ |
| 404 | |
| 405 | #if defined(CONFIG_MTD_M25P80) \ |
| 406 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 407 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 408 | { |
| 409 | .name = "bootloader", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 410 | .size = 0x00040000, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 411 | .offset = 0, |
| 412 | .mask_flags = MTD_CAP_ROM |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 413 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 414 | .name = "kernel", |
| 415 | .size = 0xe0000, |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 416 | .offset = MTDPART_OFS_APPEND, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 417 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 418 | .name = "file system", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 419 | .size = MTDPART_SIZ_FULL, |
| 420 | .offset = MTDPART_OFS_APPEND, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 421 | } |
| 422 | }; |
| 423 | |
| 424 | static struct flash_platform_data bfin_spi_flash_data = { |
| 425 | .name = "m25p80", |
| 426 | .parts = bfin_spi_flash_partitions, |
| 427 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 428 | .type = "m25p64", |
| 429 | }; |
| 430 | |
| 431 | /* SPI flash chip (m25p64) */ |
| 432 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 433 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 434 | .bits_per_word = 8, |
| 435 | }; |
| 436 | #endif |
| 437 | |
| 438 | #if defined(CONFIG_SPI_ADC_BF533) \ |
| 439 | || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 440 | /* SPI ADC chip */ |
| 441 | static struct bfin5xx_spi_chip spi_adc_chip_info = { |
| 442 | .enable_dma = 1, /* use dma transfer with this chip*/ |
| 443 | .bits_per_word = 16, |
| 444 | }; |
| 445 | #endif |
| 446 | |
| 447 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
| 448 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 449 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 450 | .enable_dma = 0, |
| 451 | .bits_per_word = 16, |
| 452 | }; |
| 453 | #endif |
| 454 | |
| 455 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) |
| 456 | static struct bfin5xx_spi_chip ad9960_spi_chip_info = { |
| 457 | .enable_dma = 0, |
| 458 | .bits_per_word = 16, |
| 459 | }; |
| 460 | #endif |
| 461 | |
| 462 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 463 | static struct bfin5xx_spi_chip spi_mmc_chip_info = { |
| 464 | .enable_dma = 1, |
| 465 | .bits_per_word = 8, |
| 466 | }; |
| 467 | #endif |
| 468 | |
| 469 | #if defined(CONFIG_PBX) |
| 470 | static struct bfin5xx_spi_chip spi_si3xxx_chip_info = { |
| 471 | .ctl_reg = 0x4, /* send zero */ |
| 472 | .enable_dma = 0, |
| 473 | .bits_per_word = 8, |
| 474 | .cs_change_per_word = 1, |
| 475 | }; |
| 476 | #endif |
| 477 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 478 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 479 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 480 | .enable_dma = 0, |
| 481 | .bits_per_word = 16, |
| 482 | }; |
| 483 | |
| 484 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { |
| 485 | .model = 7877, |
| 486 | .vref_delay_usecs = 50, /* internal, no capacitor */ |
| 487 | .x_plate_ohms = 419, |
| 488 | .y_plate_ohms = 486, |
| 489 | .pressure_max = 1000, |
| 490 | .pressure_min = 0, |
| 491 | .stopacq_polarity = 1, |
| 492 | .first_conversion_delay = 3, |
| 493 | .acquisition_time = 1, |
| 494 | .averaging = 1, |
| 495 | .pen_down_acc_interval = 1, |
| 496 | }; |
| 497 | #endif |
| 498 | |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 499 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 500 | static struct bfin5xx_spi_chip spidev_chip_info = { |
| 501 | .enable_dma = 0, |
| 502 | .bits_per_word = 8, |
| 503 | }; |
| 504 | #endif |
| 505 | |
Michael Hennerich | 8e9d5c7 | 2008-04-24 08:46:19 +0800 | [diff] [blame^] | 506 | #if defined(CONFIG_MTD_DATAFLASH) \ |
| 507 | || defined(CONFIG_MTD_DATAFLASH_MODULE) |
| 508 | /* DataFlash chip */ |
| 509 | static struct bfin5xx_spi_chip data_flash_chip_info = { |
| 510 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 511 | .bits_per_word = 8, |
| 512 | }; |
| 513 | #endif |
| 514 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 515 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
| 516 | #if defined(CONFIG_MTD_M25P80) \ |
| 517 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 518 | { |
| 519 | /* the modalias must be the same as spi device driver name */ |
| 520 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 521 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 522 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 523 | .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/ |
| 524 | .platform_data = &bfin_spi_flash_data, |
| 525 | .controller_data = &spi_flash_chip_info, |
| 526 | .mode = SPI_MODE_3, |
| 527 | }, |
| 528 | #endif |
Michael Hennerich | 8e9d5c7 | 2008-04-24 08:46:19 +0800 | [diff] [blame^] | 529 | #if defined(CONFIG_MTD_DATAFLASH) \ |
| 530 | || defined(CONFIG_MTD_DATAFLASH_MODULE) |
| 531 | { /* DataFlash chip */ |
| 532 | .modalias = "mtd_dataflash", |
| 533 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
| 534 | .bus_num = 0, /* Framework bus number */ |
| 535 | .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/ |
| 536 | .controller_data = &data_flash_chip_info, |
| 537 | .mode = SPI_MODE_3, |
| 538 | }, |
| 539 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 540 | #if defined(CONFIG_SPI_ADC_BF533) \ |
| 541 | || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 542 | { |
| 543 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ |
| 544 | .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 545 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 546 | .chip_select = 1, /* Framework chip select. */ |
| 547 | .platform_data = NULL, /* No spi_driver specific config */ |
| 548 | .controller_data = &spi_adc_chip_info, |
| 549 | }, |
| 550 | #endif |
| 551 | |
| 552 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
| 553 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 554 | { |
| 555 | .modalias = "ad1836-spi", |
| 556 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 557 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 558 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, |
| 559 | .controller_data = &ad1836_spi_chip_info, |
| 560 | }, |
| 561 | #endif |
| 562 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) |
| 563 | { |
| 564 | .modalias = "ad9960-spi", |
| 565 | .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 566 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 567 | .chip_select = 1, |
| 568 | .controller_data = &ad9960_spi_chip_info, |
| 569 | }, |
| 570 | #endif |
| 571 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 572 | { |
| 573 | .modalias = "spi_mmc_dummy", |
Sonic Zhang | 111cf97 | 2007-10-30 11:48:42 +0800 | [diff] [blame] | 574 | .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 575 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 576 | .chip_select = 0, |
| 577 | .platform_data = NULL, |
| 578 | .controller_data = &spi_mmc_chip_info, |
| 579 | .mode = SPI_MODE_3, |
| 580 | }, |
| 581 | { |
| 582 | .modalias = "spi_mmc", |
Sonic Zhang | 111cf97 | 2007-10-30 11:48:42 +0800 | [diff] [blame] | 583 | .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 584 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 585 | .chip_select = CONFIG_SPI_MMC_CS_CHAN, |
| 586 | .platform_data = NULL, |
| 587 | .controller_data = &spi_mmc_chip_info, |
| 588 | .mode = SPI_MODE_3, |
| 589 | }, |
| 590 | #endif |
| 591 | #if defined(CONFIG_PBX) |
| 592 | { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 593 | .modalias = "fxs-spi", |
| 594 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 595 | .bus_num = 0, |
| 596 | .chip_select = 8 - CONFIG_J11_JUMPER, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 597 | .controller_data = &spi_si3xxx_chip_info, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 598 | .mode = SPI_MODE_3, |
| 599 | }, |
| 600 | { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 601 | .modalias = "fxo-spi", |
| 602 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 603 | .bus_num = 0, |
| 604 | .chip_select = 8 - CONFIG_J19_JUMPER, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 605 | .controller_data = &spi_si3xxx_chip_info, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 606 | .mode = SPI_MODE_3, |
| 607 | }, |
| 608 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 609 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 610 | { |
| 611 | .modalias = "ad7877", |
| 612 | .platform_data = &bfin_ad7877_ts_info, |
| 613 | .irq = IRQ_PF6, |
| 614 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
Michael Hennerich | c7d4896 | 2007-11-15 21:33:31 +0800 | [diff] [blame] | 615 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 616 | .chip_select = 1, |
| 617 | .controller_data = &spi_ad7877_chip_info, |
| 618 | }, |
| 619 | #endif |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 620 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 621 | { |
| 622 | .modalias = "spidev", |
| 623 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 624 | .bus_num = 0, |
| 625 | .chip_select = 1, |
| 626 | .controller_data = &spidev_chip_info, |
| 627 | }, |
| 628 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 629 | }; |
| 630 | |
| 631 | /* SPI controller data */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 632 | static struct bfin5xx_spi_master bfin_spi0_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 633 | .num_chipselect = 8, |
| 634 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 635 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 636 | }; |
| 637 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 638 | /* SPI (0) */ |
| 639 | static struct resource bfin_spi0_resource[] = { |
| 640 | [0] = { |
| 641 | .start = SPI0_REGBASE, |
| 642 | .end = SPI0_REGBASE + 0xFF, |
| 643 | .flags = IORESOURCE_MEM, |
| 644 | }, |
| 645 | [1] = { |
| 646 | .start = CH_SPI, |
| 647 | .end = CH_SPI, |
| 648 | .flags = IORESOURCE_IRQ, |
| 649 | }, |
| 650 | }; |
| 651 | |
| 652 | static struct platform_device bfin_spi0_device = { |
| 653 | .name = "bfin-spi", |
| 654 | .id = 0, /* Bus number */ |
| 655 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 656 | .resource = bfin_spi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 657 | .dev = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 658 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 659 | }, |
| 660 | }; |
| 661 | #endif /* spi master and devices */ |
| 662 | |
| 663 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) |
| 664 | static struct platform_device bfin_fb_device = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 665 | .name = "bf537-lq035", |
| 666 | }; |
| 667 | #endif |
| 668 | |
| 669 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
| 670 | static struct platform_device bfin_fb_adv7393_device = { |
| 671 | .name = "bfin-adv7393", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 672 | }; |
| 673 | #endif |
| 674 | |
| 675 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 676 | static struct resource bfin_uart_resources[] = { |
Sonic Zhang | 233b28a | 2007-11-21 17:04:41 +0800 | [diff] [blame] | 677 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 678 | { |
| 679 | .start = 0xFFC00400, |
| 680 | .end = 0xFFC004FF, |
| 681 | .flags = IORESOURCE_MEM, |
Sonic Zhang | 233b28a | 2007-11-21 17:04:41 +0800 | [diff] [blame] | 682 | }, |
| 683 | #endif |
| 684 | #ifdef CONFIG_SERIAL_BFIN_UART1 |
| 685 | { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 686 | .start = 0xFFC02000, |
| 687 | .end = 0xFFC020FF, |
| 688 | .flags = IORESOURCE_MEM, |
| 689 | }, |
Sonic Zhang | 233b28a | 2007-11-21 17:04:41 +0800 | [diff] [blame] | 690 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 691 | }; |
| 692 | |
| 693 | static struct platform_device bfin_uart_device = { |
| 694 | .name = "bfin-uart", |
| 695 | .id = 1, |
| 696 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 697 | .resource = bfin_uart_resources, |
| 698 | }; |
| 699 | #endif |
| 700 | |
| 701 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 702 | static struct resource bfin_twi0_resource[] = { |
| 703 | [0] = { |
| 704 | .start = TWI0_REGBASE, |
| 705 | .end = TWI0_REGBASE, |
| 706 | .flags = IORESOURCE_MEM, |
| 707 | }, |
| 708 | [1] = { |
| 709 | .start = IRQ_TWI, |
| 710 | .end = IRQ_TWI, |
| 711 | .flags = IORESOURCE_IRQ, |
| 712 | }, |
| 713 | }; |
| 714 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 715 | static struct platform_device i2c_bfin_twi_device = { |
| 716 | .name = "i2c-bfin-twi", |
| 717 | .id = 0, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 718 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), |
| 719 | .resource = bfin_twi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 720 | }; |
| 721 | #endif |
| 722 | |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 723 | #ifdef CONFIG_I2C_BOARDINFO |
| 724 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
| 725 | #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) |
| 726 | { |
| 727 | I2C_BOARD_INFO("ad7142_joystick", 0x2C), |
| 728 | .type = "ad7142_joystick", |
| 729 | .irq = 55, |
| 730 | }, |
| 731 | #endif |
| 732 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) |
| 733 | { |
| 734 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), |
| 735 | .type = "pcf8574_lcd", |
| 736 | }, |
| 737 | #endif |
| 738 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) |
| 739 | { |
| 740 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), |
| 741 | .type = "pcf8574_keypad", |
| 742 | .irq = 72, |
| 743 | }, |
| 744 | #endif |
| 745 | }; |
| 746 | #endif |
| 747 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 748 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 749 | static struct platform_device bfin_sport0_uart_device = { |
| 750 | .name = "bfin-sport-uart", |
| 751 | .id = 0, |
| 752 | }; |
| 753 | |
| 754 | static struct platform_device bfin_sport1_uart_device = { |
| 755 | .name = "bfin-sport-uart", |
| 756 | .id = 1, |
| 757 | }; |
| 758 | #endif |
| 759 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 760 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 761 | #define PATA_INT 55 |
| 762 | |
| 763 | static struct pata_platform_info bfin_pata_platform_data = { |
| 764 | .ioport_shift = 1, |
Mike Frysinger | 64e5c51 | 2007-10-30 11:56:13 +0800 | [diff] [blame] | 765 | .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 766 | }; |
| 767 | |
| 768 | static struct resource bfin_pata_resources[] = { |
| 769 | { |
| 770 | .start = 0x20314020, |
| 771 | .end = 0x2031403F, |
| 772 | .flags = IORESOURCE_MEM, |
| 773 | }, |
| 774 | { |
| 775 | .start = 0x2031401C, |
| 776 | .end = 0x2031401F, |
| 777 | .flags = IORESOURCE_MEM, |
| 778 | }, |
| 779 | { |
| 780 | .start = PATA_INT, |
| 781 | .end = PATA_INT, |
| 782 | .flags = IORESOURCE_IRQ, |
| 783 | }, |
| 784 | }; |
| 785 | |
| 786 | static struct platform_device bfin_pata_device = { |
| 787 | .name = "pata_platform", |
| 788 | .id = -1, |
| 789 | .num_resources = ARRAY_SIZE(bfin_pata_resources), |
| 790 | .resource = bfin_pata_resources, |
| 791 | .dev = { |
| 792 | .platform_data = &bfin_pata_platform_data, |
| 793 | } |
| 794 | }; |
| 795 | #endif |
| 796 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 797 | static struct platform_device *stamp_devices[] __initdata = { |
| 798 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
| 799 | &bfin_pcmcia_cf_device, |
| 800 | #endif |
| 801 | |
| 802 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 803 | &rtc_device, |
| 804 | #endif |
| 805 | |
| 806 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) |
| 807 | &sl811_hcd_device, |
| 808 | #endif |
| 809 | |
| 810 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 811 | &isp1362_hcd_device, |
| 812 | #endif |
| 813 | |
| 814 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 815 | &smc91x_device, |
| 816 | #endif |
| 817 | |
Alex Landau | f40d24d | 2007-07-12 12:11:48 +0800 | [diff] [blame] | 818 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 819 | &dm9000_device, |
| 820 | #endif |
| 821 | |
Michael Hennerich | 561cc18 | 2007-11-17 23:56:08 +0800 | [diff] [blame] | 822 | #if defined(CONFIG_AX88180) || defined(CONFIG_AX88180_MODULE) |
| 823 | &ax88180_device, |
| 824 | #endif |
| 825 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 826 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 827 | &bfin_mac_device, |
| 828 | #endif |
| 829 | |
| 830 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 831 | &net2272_bfin_device, |
| 832 | #endif |
| 833 | |
| 834 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 835 | &bfin_spi0_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 836 | #endif |
| 837 | |
| 838 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) |
| 839 | &bfin_fb_device, |
| 840 | #endif |
| 841 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 842 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
| 843 | &bfin_fb_adv7393_device, |
| 844 | #endif |
| 845 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 846 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 847 | &bfin_uart_device, |
| 848 | #endif |
| 849 | |
| 850 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 851 | &i2c_bfin_twi_device, |
| 852 | #endif |
| 853 | |
| 854 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 855 | &bfin_sport0_uart_device, |
| 856 | &bfin_sport1_uart_device, |
| 857 | #endif |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 858 | |
| 859 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 860 | &bfin_pata_device, |
| 861 | #endif |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 862 | |
| 863 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 864 | &bfin_device_gpiokeys, |
| 865 | #endif |
Mike Frysinger | cad2ab6 | 2008-02-22 17:01:31 +0800 | [diff] [blame] | 866 | |
| 867 | &bfin_gpios_device, |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 868 | |
| 869 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 870 | &stamp_flash_device, |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 871 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 872 | }; |
| 873 | |
| 874 | static int __init stamp_init(void) |
| 875 | { |
Harvey Harrison | b85d858 | 2008-04-23 09:39:01 +0800 | [diff] [blame] | 876 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 877 | |
| 878 | #ifdef CONFIG_I2C_BOARDINFO |
| 879 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 880 | ARRAY_SIZE(bfin_i2c_board_info)); |
| 881 | #endif |
| 882 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 883 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 884 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 885 | spi_register_board_info(bfin_spi_board_info, |
| 886 | ARRAY_SIZE(bfin_spi_board_info)); |
| 887 | #endif |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 888 | |
| 889 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 890 | irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; |
| 891 | #endif |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 892 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 893 | return 0; |
| 894 | } |
| 895 | |
| 896 | arch_initcall(stamp_init); |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 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); |