Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * File: arch/blackfin/mach-bf533/stamp.c |
| 3 | * Based on: arch/blackfin/mach-bf533/ezkit.c |
| 4 | * Author: Aidan Williams <aidan@nicta.com.au> |
| 5 | * |
| 6 | * Created: 2005 |
| 7 | * Description: Board Info File for the BF533-STAMP |
| 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> |
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 <asm/dma.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 44 | #include <asm/bfin5xx_spi.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 45 | #include <asm/reboot.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 46 | #include <asm/portmux.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 47 | |
| 48 | /* |
| 49 | * Name the Board for the /proc/cpuinfo |
| 50 | */ |
Mike Frysinger | 066954a | 2007-10-21 22:36:06 +0800 | [diff] [blame] | 51 | const char bfin_board_name[] = "ADDS-BF533-STAMP"; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 52 | |
| 53 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 54 | static struct platform_device rtc_device = { |
| 55 | .name = "rtc-bfin", |
| 56 | .id = -1, |
| 57 | }; |
| 58 | #endif |
| 59 | |
| 60 | /* |
| 61 | * Driver needs to know address, irq and flag pin. |
| 62 | */ |
| 63 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 64 | static struct resource smc91x_resources[] = { |
| 65 | { |
| 66 | .name = "smc91x-regs", |
| 67 | .start = 0x20300300, |
| 68 | .end = 0x20300300 + 16, |
| 69 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 70 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 71 | .start = IRQ_PF7, |
| 72 | .end = IRQ_PF7, |
| 73 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 74 | }, |
| 75 | }; |
| 76 | |
| 77 | static struct platform_device smc91x_device = { |
| 78 | .name = "smc91x", |
| 79 | .id = 0, |
| 80 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 81 | .resource = smc91x_resources, |
| 82 | }; |
| 83 | #endif |
| 84 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 85 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
| 86 | static struct platform_device bfin_fb_adv7393_device = { |
| 87 | .name = "bfin-adv7393", |
| 88 | }; |
| 89 | #endif |
| 90 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 91 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 92 | static struct resource net2272_bfin_resources[] = { |
| 93 | { |
| 94 | .start = 0x20300000, |
| 95 | .end = 0x20300000 + 0x100, |
| 96 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 97 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 98 | .start = IRQ_PF10, |
| 99 | .end = IRQ_PF10, |
| 100 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 101 | }, |
| 102 | }; |
| 103 | |
| 104 | static struct platform_device net2272_bfin_device = { |
| 105 | .name = "net2272", |
| 106 | .id = -1, |
| 107 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), |
| 108 | .resource = net2272_bfin_resources, |
| 109 | }; |
| 110 | #endif |
| 111 | |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 112 | static struct mtd_partition stamp_partitions[] = { |
| 113 | { |
| 114 | .name = "Bootloader", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame^] | 115 | .size = 0x40000, |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 116 | .offset = 0, |
| 117 | }, { |
| 118 | .name = "Kernel", |
| 119 | .size = 0xE0000, |
| 120 | .offset = MTDPART_OFS_APPEND, |
| 121 | }, { |
| 122 | .name = "RootFS", |
| 123 | .size = MTDPART_SIZ_FULL, |
| 124 | .offset = MTDPART_OFS_APPEND, |
| 125 | } |
| 126 | }; |
| 127 | |
| 128 | static struct physmap_flash_data stamp_flash_data = { |
| 129 | .width = 2, |
| 130 | .parts = stamp_partitions, |
| 131 | .nr_parts = ARRAY_SIZE(stamp_partitions), |
| 132 | }; |
| 133 | |
| 134 | static struct resource stamp_flash_resource[] = { |
| 135 | { |
| 136 | .name = "cfi_probe", |
| 137 | .start = 0x20000000, |
| 138 | .end = 0x203fffff, |
| 139 | .flags = IORESOURCE_MEM, |
| 140 | }, { |
| 141 | .start = CONFIG_ENET_FLASH_PIN, |
| 142 | .flags = IORESOURCE_IRQ, |
| 143 | } |
| 144 | }; |
| 145 | |
| 146 | static struct platform_device stamp_flash_device = { |
| 147 | .name = "BF5xx-Flash", |
| 148 | .id = 0, |
| 149 | .dev = { |
| 150 | .platform_data = &stamp_flash_data, |
| 151 | }, |
| 152 | .num_resources = ARRAY_SIZE(stamp_flash_resource), |
| 153 | .resource = stamp_flash_resource, |
| 154 | }; |
| 155 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 156 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 157 | /* all SPI peripherals info goes here */ |
| 158 | |
| 159 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 160 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 161 | { |
| 162 | .name = "bootloader", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame^] | 163 | .size = 0x00040000, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 164 | .offset = 0, |
| 165 | .mask_flags = MTD_CAP_ROM |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 166 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 167 | .name = "kernel", |
| 168 | .size = 0xe0000, |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame^] | 169 | .offset = MTDPART_OFS_APPEND, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 170 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 171 | .name = "file system", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame^] | 172 | .size = MTDPART_SIZ_FULL, |
| 173 | .offset = MTDPART_OFS_APPEND, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 174 | } |
| 175 | }; |
| 176 | |
| 177 | static struct flash_platform_data bfin_spi_flash_data = { |
| 178 | .name = "m25p80", |
| 179 | .parts = bfin_spi_flash_partitions, |
| 180 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 181 | .type = "m25p64", |
| 182 | }; |
| 183 | |
| 184 | /* SPI flash chip (m25p64) */ |
| 185 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 186 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 187 | .bits_per_word = 8, |
| 188 | }; |
| 189 | #endif |
| 190 | |
| 191 | #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 192 | /* SPI ADC chip */ |
| 193 | static struct bfin5xx_spi_chip spi_adc_chip_info = { |
| 194 | .enable_dma = 1, /* use dma transfer with this chip*/ |
| 195 | .bits_per_word = 16, |
| 196 | }; |
| 197 | #endif |
| 198 | |
| 199 | #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 200 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 201 | .enable_dma = 0, |
| 202 | .bits_per_word = 16, |
| 203 | }; |
| 204 | #endif |
| 205 | |
| 206 | #if defined(CONFIG_PBX) |
| 207 | static struct bfin5xx_spi_chip spi_si3xxx_chip_info = { |
| 208 | .ctl_reg = 0x4, /* send zero */ |
| 209 | .enable_dma = 0, |
| 210 | .bits_per_word = 8, |
| 211 | .cs_change_per_word = 1, |
| 212 | }; |
| 213 | #endif |
| 214 | |
| 215 | #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE) |
| 216 | static struct bfin5xx_spi_chip ad5304_chip_info = { |
| 217 | .enable_dma = 0, |
| 218 | .bits_per_word = 16, |
| 219 | }; |
| 220 | #endif |
| 221 | |
Bryan Wu | ed2fbf5 | 2007-05-21 18:09:10 +0800 | [diff] [blame] | 222 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 223 | static struct bfin5xx_spi_chip spi_mmc_chip_info = { |
| 224 | .enable_dma = 1, |
| 225 | .bits_per_word = 8, |
| 226 | }; |
| 227 | #endif |
| 228 | |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 229 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 230 | static struct bfin5xx_spi_chip spidev_chip_info = { |
| 231 | .enable_dma = 0, |
| 232 | .bits_per_word = 8, |
| 233 | }; |
| 234 | #endif |
| 235 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 236 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
| 237 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 238 | { |
| 239 | /* the modalias must be the same as spi device driver name */ |
| 240 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 241 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 242 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 243 | .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/ |
| 244 | .platform_data = &bfin_spi_flash_data, |
| 245 | .controller_data = &spi_flash_chip_info, |
| 246 | .mode = SPI_MODE_3, |
| 247 | }, |
| 248 | #endif |
| 249 | |
| 250 | #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 251 | { |
| 252 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ |
| 253 | .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 254 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 255 | .chip_select = 1, /* Framework chip select. */ |
| 256 | .platform_data = NULL, /* No spi_driver specific config */ |
| 257 | .controller_data = &spi_adc_chip_info, |
| 258 | }, |
| 259 | #endif |
| 260 | |
| 261 | #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 262 | { |
| 263 | .modalias = "ad1836-spi", |
| 264 | .max_speed_hz = 31250000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 265 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 266 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, |
| 267 | .controller_data = &ad1836_spi_chip_info, |
| 268 | }, |
| 269 | #endif |
| 270 | |
Bryan Wu | ed2fbf5 | 2007-05-21 18:09:10 +0800 | [diff] [blame] | 271 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 272 | { |
| 273 | .modalias = "spi_mmc_dummy", |
Sonic Zhang | 111cf97 | 2007-10-30 11:48:42 +0800 | [diff] [blame] | 274 | .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 275 | .bus_num = 0, |
Bryan Wu | ed2fbf5 | 2007-05-21 18:09:10 +0800 | [diff] [blame] | 276 | .chip_select = 0, |
| 277 | .platform_data = NULL, |
| 278 | .controller_data = &spi_mmc_chip_info, |
| 279 | .mode = SPI_MODE_3, |
| 280 | }, |
| 281 | { |
| 282 | .modalias = "spi_mmc", |
Sonic Zhang | 111cf97 | 2007-10-30 11:48:42 +0800 | [diff] [blame] | 283 | .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 284 | .bus_num = 0, |
Bryan Wu | ed2fbf5 | 2007-05-21 18:09:10 +0800 | [diff] [blame] | 285 | .chip_select = CONFIG_SPI_MMC_CS_CHAN, |
| 286 | .platform_data = NULL, |
| 287 | .controller_data = &spi_mmc_chip_info, |
| 288 | .mode = SPI_MODE_3, |
| 289 | }, |
| 290 | #endif |
| 291 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 292 | #if defined(CONFIG_PBX) |
| 293 | { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 294 | .modalias = "fxs-spi", |
| 295 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 296 | .bus_num = 0, |
| 297 | .chip_select = 8 - CONFIG_J11_JUMPER, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 298 | .controller_data = &spi_si3xxx_chip_info, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 299 | .mode = SPI_MODE_3, |
| 300 | }, |
| 301 | { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 302 | .modalias = "fxo-spi", |
| 303 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 304 | .bus_num = 0, |
| 305 | .chip_select = 8 - CONFIG_J19_JUMPER, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 306 | .controller_data = &spi_si3xxx_chip_info, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 307 | .mode = SPI_MODE_3, |
| 308 | }, |
| 309 | #endif |
| 310 | |
| 311 | #if defined(CONFIG_AD5304) || defined(CONFIG_AD5304_MODULE) |
| 312 | { |
| 313 | .modalias = "ad5304_spi", |
| 314 | .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 315 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 316 | .chip_select = 2, |
| 317 | .platform_data = NULL, |
| 318 | .controller_data = &ad5304_chip_info, |
| 319 | .mode = SPI_MODE_2, |
| 320 | }, |
| 321 | #endif |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 322 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 323 | { |
| 324 | .modalias = "spidev", |
| 325 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 326 | .bus_num = 0, |
| 327 | .chip_select = 1, |
| 328 | .controller_data = &spidev_chip_info, |
| 329 | }, |
| 330 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 331 | }; |
| 332 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 333 | /* SPI (0) */ |
| 334 | static struct resource bfin_spi0_resource[] = { |
| 335 | [0] = { |
| 336 | .start = SPI0_REGBASE, |
| 337 | .end = SPI0_REGBASE + 0xFF, |
| 338 | .flags = IORESOURCE_MEM, |
| 339 | }, |
| 340 | [1] = { |
| 341 | .start = CH_SPI, |
| 342 | .end = CH_SPI, |
| 343 | .flags = IORESOURCE_IRQ, |
| 344 | } |
| 345 | }; |
| 346 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 347 | /* SPI controller data */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 348 | static struct bfin5xx_spi_master bfin_spi0_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 349 | .num_chipselect = 8, |
| 350 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 351 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 352 | }; |
| 353 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 354 | static struct platform_device bfin_spi0_device = { |
| 355 | .name = "bfin-spi", |
| 356 | .id = 0, /* Bus number */ |
| 357 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 358 | .resource = bfin_spi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 359 | .dev = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 360 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 361 | }, |
| 362 | }; |
| 363 | #endif /* spi master and devices */ |
| 364 | |
| 365 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) |
| 366 | static struct platform_device bfin_fb_device = { |
| 367 | .name = "bf537-fb", |
| 368 | }; |
| 369 | #endif |
| 370 | |
| 371 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 372 | static struct resource bfin_uart_resources[] = { |
| 373 | { |
| 374 | .start = 0xFFC00400, |
| 375 | .end = 0xFFC004FF, |
| 376 | .flags = IORESOURCE_MEM, |
| 377 | }, |
| 378 | }; |
| 379 | |
| 380 | static struct platform_device bfin_uart_device = { |
| 381 | .name = "bfin-uart", |
| 382 | .id = 1, |
| 383 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 384 | .resource = bfin_uart_resources, |
| 385 | }; |
| 386 | #endif |
| 387 | |
| 388 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 389 | static struct platform_device bfin_sport0_uart_device = { |
| 390 | .name = "bfin-sport-uart", |
| 391 | .id = 0, |
| 392 | }; |
| 393 | |
| 394 | static struct platform_device bfin_sport1_uart_device = { |
| 395 | .name = "bfin-sport-uart", |
| 396 | .id = 1, |
| 397 | }; |
| 398 | #endif |
| 399 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 400 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 401 | #define PATA_INT 55 |
| 402 | |
| 403 | static struct pata_platform_info bfin_pata_platform_data = { |
| 404 | .ioport_shift = 1, |
| 405 | .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, |
| 406 | }; |
| 407 | |
| 408 | static struct resource bfin_pata_resources[] = { |
| 409 | { |
| 410 | .start = 0x20314020, |
| 411 | .end = 0x2031403F, |
| 412 | .flags = IORESOURCE_MEM, |
| 413 | }, |
| 414 | { |
| 415 | .start = 0x2031401C, |
| 416 | .end = 0x2031401F, |
| 417 | .flags = IORESOURCE_MEM, |
| 418 | }, |
| 419 | { |
| 420 | .start = PATA_INT, |
| 421 | .end = PATA_INT, |
| 422 | .flags = IORESOURCE_IRQ, |
| 423 | }, |
| 424 | }; |
| 425 | |
| 426 | static struct platform_device bfin_pata_device = { |
| 427 | .name = "pata_platform", |
| 428 | .id = -1, |
| 429 | .num_resources = ARRAY_SIZE(bfin_pata_resources), |
| 430 | .resource = bfin_pata_resources, |
| 431 | .dev = { |
| 432 | .platform_data = &bfin_pata_platform_data, |
| 433 | } |
| 434 | }; |
| 435 | #endif |
| 436 | |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 437 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 438 | #include <linux/input.h> |
| 439 | #include <linux/gpio_keys.h> |
| 440 | |
| 441 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
Michael Hennerich | f1bceb4 | 2008-02-02 16:17:52 +0800 | [diff] [blame] | 442 | {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"}, |
| 443 | {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"}, |
| 444 | {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"}, |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 445 | }; |
| 446 | |
| 447 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 448 | .buttons = bfin_gpio_keys_table, |
| 449 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 450 | }; |
| 451 | |
| 452 | static struct platform_device bfin_device_gpiokeys = { |
| 453 | .name = "gpio-keys", |
| 454 | .dev = { |
| 455 | .platform_data = &bfin_gpio_keys_data, |
| 456 | }, |
| 457 | }; |
| 458 | #endif |
| 459 | |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 460 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) |
| 461 | #include <linux/i2c-gpio.h> |
| 462 | |
| 463 | static struct i2c_gpio_platform_data i2c_gpio_data = { |
| 464 | .sda_pin = 2, |
| 465 | .scl_pin = 3, |
| 466 | .sda_is_open_drain = 0, |
| 467 | .scl_is_open_drain = 0, |
| 468 | .udelay = 40, |
| 469 | }; |
| 470 | |
| 471 | static struct platform_device i2c_gpio_device = { |
| 472 | .name = "i2c-gpio", |
| 473 | .id = 0, |
| 474 | .dev = { |
| 475 | .platform_data = &i2c_gpio_data, |
| 476 | }, |
| 477 | }; |
| 478 | #endif |
| 479 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 480 | static struct platform_device *stamp_devices[] __initdata = { |
| 481 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 482 | &rtc_device, |
| 483 | #endif |
| 484 | |
| 485 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 486 | &smc91x_device, |
| 487 | #endif |
| 488 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 489 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
| 490 | &bfin_fb_adv7393_device, |
| 491 | #endif |
| 492 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 493 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 494 | &net2272_bfin_device, |
| 495 | #endif |
| 496 | |
| 497 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 498 | &bfin_spi0_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 499 | #endif |
| 500 | |
| 501 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 502 | &bfin_uart_device, |
| 503 | #endif |
| 504 | |
| 505 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 506 | &bfin_sport0_uart_device, |
| 507 | &bfin_sport1_uart_device, |
| 508 | #endif |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 509 | |
| 510 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 511 | &bfin_pata_device, |
| 512 | #endif |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 513 | |
| 514 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 515 | &bfin_device_gpiokeys, |
| 516 | #endif |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 517 | |
| 518 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) |
| 519 | &i2c_gpio_device, |
| 520 | #endif |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 521 | &stamp_flash_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 522 | }; |
| 523 | |
| 524 | static int __init stamp_init(void) |
| 525 | { |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 526 | int ret; |
| 527 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 528 | printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__); |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 529 | ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 530 | if (ret < 0) |
| 531 | return ret; |
| 532 | |
| 533 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 534 | /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */ |
| 535 | bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN)); |
| 536 | bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN); |
| 537 | SSYNC(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 538 | #endif |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 539 | |
| 540 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 541 | spi_register_board_info(bfin_spi_board_info, |
| 542 | ARRAY_SIZE(bfin_spi_board_info)); |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 543 | #endif |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 544 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 545 | irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; |
| 546 | #endif |
| 547 | return 0; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 548 | } |
| 549 | |
| 550 | arch_initcall(stamp_init); |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 551 | |
| 552 | void native_machine_restart(char *cmd) |
| 553 | { |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 554 | #define BIT_TO_SET (1 << CONFIG_ENET_FLASH_PIN) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 555 | bfin_write_FIO_INEN(~BIT_TO_SET); |
| 556 | bfin_write_FIO_DIR(BIT_TO_SET); |
| 557 | bfin_write_FIO_FLAG_C(BIT_TO_SET); |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 558 | } |