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