Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame^] | 2 | * Copyright 2004-2009 Analog Devices Inc. |
| 3 | * 2005 National ICT Australia (NICTA) |
| 4 | * Aidan Williams <aidan@nicta.com.au> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 5 | * |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame^] | 6 | * Licensed under the GPL-2 or later. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <linux/device.h> |
| 10 | #include <linux/platform_device.h> |
| 11 | #include <linux/mtd/mtd.h> |
| 12 | #include <linux/mtd/partitions.h> |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 13 | #include <linux/mtd/physmap.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 14 | #include <linux/spi/spi.h> |
| 15 | #include <linux/spi/flash.h> |
Yi Li | 2120b68 | 2009-07-16 10:12:30 +0000 | [diff] [blame] | 16 | #include <linux/spi/mmc_spi.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 17 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
Mike Frysinger | f02bcec | 2007-11-15 21:29:15 +0800 | [diff] [blame] | 18 | #include <linux/usb/isp1362.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 19 | #endif |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 20 | #include <linux/irq.h> |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 21 | #include <linux/i2c.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 22 | #include <asm/dma.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 23 | #include <asm/bfin5xx_spi.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 24 | #include <asm/reboot.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 25 | #include <asm/portmux.h> |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 26 | #include <asm/dpmc.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 27 | |
| 28 | /* |
| 29 | * Name the Board for the /proc/cpuinfo |
| 30 | */ |
Mike Frysinger | fe85cad | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 31 | const char bfin_board_name[] = "ADI BF533-STAMP"; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 32 | |
| 33 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 34 | static struct platform_device rtc_device = { |
| 35 | .name = "rtc-bfin", |
| 36 | .id = -1, |
| 37 | }; |
| 38 | #endif |
| 39 | |
| 40 | /* |
| 41 | * Driver needs to know address, irq and flag pin. |
| 42 | */ |
| 43 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 44 | #include <linux/smc91x.h> |
| 45 | |
| 46 | static struct smc91x_platdata smc91x_info = { |
| 47 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, |
| 48 | .leda = RPC_LED_100_10, |
| 49 | .ledb = RPC_LED_TX_RX, |
| 50 | }; |
| 51 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 52 | static struct resource smc91x_resources[] = { |
| 53 | { |
| 54 | .name = "smc91x-regs", |
| 55 | .start = 0x20300300, |
| 56 | .end = 0x20300300 + 16, |
| 57 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 58 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 59 | .start = IRQ_PF7, |
| 60 | .end = IRQ_PF7, |
| 61 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 62 | }, |
| 63 | }; |
| 64 | |
| 65 | static struct platform_device smc91x_device = { |
| 66 | .name = "smc91x", |
| 67 | .id = 0, |
| 68 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 69 | .resource = smc91x_resources, |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 70 | .dev = { |
| 71 | .platform_data = &smc91x_info, |
| 72 | }, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 73 | }; |
| 74 | #endif |
| 75 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 76 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
| 77 | static struct platform_device bfin_fb_adv7393_device = { |
| 78 | .name = "bfin-adv7393", |
| 79 | }; |
| 80 | #endif |
| 81 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 82 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 83 | static struct resource net2272_bfin_resources[] = { |
| 84 | { |
| 85 | .start = 0x20300000, |
| 86 | .end = 0x20300000 + 0x100, |
| 87 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 88 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 89 | .start = IRQ_PF10, |
| 90 | .end = IRQ_PF10, |
| 91 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 92 | }, |
| 93 | }; |
| 94 | |
| 95 | static struct platform_device net2272_bfin_device = { |
| 96 | .name = "net2272", |
| 97 | .id = -1, |
| 98 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), |
| 99 | .resource = net2272_bfin_resources, |
| 100 | }; |
| 101 | #endif |
| 102 | |
Mike Frysinger | 9cd9c61 | 2008-05-13 12:31:32 +0800 | [diff] [blame] | 103 | #if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE) |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 104 | static struct mtd_partition stamp_partitions[] = { |
| 105 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 106 | .name = "bootloader(nor)", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 107 | .size = 0x40000, |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 108 | .offset = 0, |
| 109 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 110 | .name = "linux kernel(nor)", |
Grace Pan | 6ecb5b6 | 2009-01-07 23:14:38 +0800 | [diff] [blame] | 111 | .size = 0x180000, |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 112 | .offset = MTDPART_OFS_APPEND, |
| 113 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 114 | .name = "file system(nor)", |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 115 | .size = MTDPART_SIZ_FULL, |
| 116 | .offset = MTDPART_OFS_APPEND, |
| 117 | } |
| 118 | }; |
| 119 | |
| 120 | static struct physmap_flash_data stamp_flash_data = { |
| 121 | .width = 2, |
| 122 | .parts = stamp_partitions, |
| 123 | .nr_parts = ARRAY_SIZE(stamp_partitions), |
| 124 | }; |
| 125 | |
| 126 | static struct resource stamp_flash_resource[] = { |
| 127 | { |
| 128 | .name = "cfi_probe", |
| 129 | .start = 0x20000000, |
| 130 | .end = 0x203fffff, |
| 131 | .flags = IORESOURCE_MEM, |
| 132 | }, { |
Mike Frysinger | 9cd9c61 | 2008-05-13 12:31:32 +0800 | [diff] [blame] | 133 | .start = 0x7BB07BB0, /* AMBCTL0 setting when accessing flash */ |
| 134 | .end = 0x7BB07BB0, /* AMBCTL1 setting when accessing flash */ |
| 135 | .flags = IORESOURCE_MEM, |
| 136 | }, { |
| 137 | .start = GPIO_PF0, |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 138 | .flags = IORESOURCE_IRQ, |
| 139 | } |
| 140 | }; |
| 141 | |
| 142 | static struct platform_device stamp_flash_device = { |
Mike Frysinger | 9cd9c61 | 2008-05-13 12:31:32 +0800 | [diff] [blame] | 143 | .name = "bfin-async-flash", |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 144 | .id = 0, |
| 145 | .dev = { |
| 146 | .platform_data = &stamp_flash_data, |
| 147 | }, |
| 148 | .num_resources = ARRAY_SIZE(stamp_flash_resource), |
| 149 | .resource = stamp_flash_resource, |
| 150 | }; |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 151 | #endif |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 152 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 153 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 154 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 155 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 156 | .name = "bootloader(spi)", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 157 | .size = 0x00040000, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 158 | .offset = 0, |
| 159 | .mask_flags = MTD_CAP_ROM |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 160 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 161 | .name = "linux kernel(spi)", |
Grace Pan | 6ecb5b6 | 2009-01-07 23:14:38 +0800 | [diff] [blame] | 162 | .size = 0x180000, |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 163 | .offset = MTDPART_OFS_APPEND, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 164 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 165 | .name = "file system(spi)", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 166 | .size = MTDPART_SIZ_FULL, |
| 167 | .offset = MTDPART_OFS_APPEND, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 168 | } |
| 169 | }; |
| 170 | |
| 171 | static struct flash_platform_data bfin_spi_flash_data = { |
| 172 | .name = "m25p80", |
| 173 | .parts = bfin_spi_flash_partitions, |
| 174 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 175 | .type = "m25p64", |
| 176 | }; |
| 177 | |
| 178 | /* SPI flash chip (m25p64) */ |
| 179 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 180 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 181 | .bits_per_word = 8, |
| 182 | }; |
| 183 | #endif |
| 184 | |
Mike Frysinger | a261eec | 2009-05-20 14:05:36 +0000 | [diff] [blame] | 185 | #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 186 | /* SPI ADC chip */ |
| 187 | static struct bfin5xx_spi_chip spi_adc_chip_info = { |
| 188 | .enable_dma = 1, /* use dma transfer with this chip*/ |
| 189 | .bits_per_word = 16, |
| 190 | }; |
| 191 | #endif |
| 192 | |
| 193 | #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 194 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 195 | .enable_dma = 0, |
| 196 | .bits_per_word = 16, |
| 197 | }; |
| 198 | #endif |
| 199 | |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 200 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 201 | static struct bfin5xx_spi_chip spidev_chip_info = { |
| 202 | .enable_dma = 0, |
| 203 | .bits_per_word = 8, |
| 204 | }; |
| 205 | #endif |
| 206 | |
Yi Li | 2120b68 | 2009-07-16 10:12:30 +0000 | [diff] [blame] | 207 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) |
| 208 | #define MMC_SPI_CARD_DETECT_INT IRQ_PF5 |
| 209 | static int bfin_mmc_spi_init(struct device *dev, |
| 210 | irqreturn_t (*detect_int)(int, void *), void *data) |
| 211 | { |
| 212 | return request_irq(MMC_SPI_CARD_DETECT_INT, detect_int, |
| 213 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, |
| 214 | "mmc-spi-detect", data); |
| 215 | } |
| 216 | |
| 217 | static void bfin_mmc_spi_exit(struct device *dev, void *data) |
| 218 | { |
| 219 | free_irq(MMC_SPI_CARD_DETECT_INT, data); |
| 220 | } |
| 221 | |
| 222 | static struct mmc_spi_platform_data bfin_mmc_spi_pdata = { |
| 223 | .init = bfin_mmc_spi_init, |
| 224 | .exit = bfin_mmc_spi_exit, |
| 225 | .detect_delay = 100, /* msecs */ |
| 226 | }; |
| 227 | |
| 228 | static struct bfin5xx_spi_chip mmc_spi_chip_info = { |
| 229 | .enable_dma = 0, |
| 230 | .bits_per_word = 8, |
| 231 | .pio_interrupt = 0, |
| 232 | }; |
| 233 | #endif |
| 234 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 235 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
| 236 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 237 | { |
| 238 | /* the modalias must be the same as spi device driver name */ |
| 239 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 240 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 241 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 242 | .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/ |
| 243 | .platform_data = &bfin_spi_flash_data, |
| 244 | .controller_data = &spi_flash_chip_info, |
| 245 | .mode = SPI_MODE_3, |
| 246 | }, |
| 247 | #endif |
| 248 | |
Mike Frysinger | a261eec | 2009-05-20 14:05:36 +0000 | [diff] [blame] | 249 | #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 250 | { |
| 251 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ |
| 252 | .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 253 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 254 | .chip_select = 1, /* Framework chip select. */ |
| 255 | .platform_data = NULL, /* No spi_driver specific config */ |
| 256 | .controller_data = &spi_adc_chip_info, |
| 257 | }, |
| 258 | #endif |
| 259 | |
| 260 | #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 261 | { |
Barry Song | dac9817 | 2009-08-13 21:07:37 +0000 | [diff] [blame] | 262 | .modalias = "ad1836", |
Cliff Cai | 858c5e9 | 2009-07-22 06:34:55 +0000 | [diff] [blame] | 263 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 264 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 265 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, |
| 266 | .controller_data = &ad1836_spi_chip_info, |
| 267 | }, |
| 268 | #endif |
| 269 | |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 270 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 271 | { |
| 272 | .modalias = "spidev", |
| 273 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 274 | .bus_num = 0, |
| 275 | .chip_select = 1, |
| 276 | .controller_data = &spidev_chip_info, |
| 277 | }, |
| 278 | #endif |
Yi Li | 2120b68 | 2009-07-16 10:12:30 +0000 | [diff] [blame] | 279 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) |
| 280 | { |
| 281 | .modalias = "mmc_spi", |
| 282 | .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */ |
| 283 | .bus_num = 0, |
| 284 | .chip_select = 4, |
| 285 | .platform_data = &bfin_mmc_spi_pdata, |
| 286 | .controller_data = &mmc_spi_chip_info, |
| 287 | .mode = SPI_MODE_3, |
| 288 | }, |
| 289 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 290 | }; |
| 291 | |
Mike Frysinger | 5bda272 | 2008-06-07 15:03:01 +0800 | [diff] [blame] | 292 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 293 | /* SPI (0) */ |
| 294 | static struct resource bfin_spi0_resource[] = { |
| 295 | [0] = { |
| 296 | .start = SPI0_REGBASE, |
| 297 | .end = SPI0_REGBASE + 0xFF, |
| 298 | .flags = IORESOURCE_MEM, |
| 299 | }, |
| 300 | [1] = { |
| 301 | .start = CH_SPI, |
| 302 | .end = CH_SPI, |
Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 303 | .flags = IORESOURCE_DMA, |
| 304 | }, |
| 305 | [2] = { |
| 306 | .start = IRQ_SPI, |
| 307 | .end = IRQ_SPI, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 308 | .flags = IORESOURCE_IRQ, |
| 309 | } |
| 310 | }; |
| 311 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 312 | /* SPI controller data */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 313 | static struct bfin5xx_spi_master bfin_spi0_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 314 | .num_chipselect = 8, |
| 315 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 316 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
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 | static struct platform_device bfin_spi0_device = { |
| 320 | .name = "bfin-spi", |
| 321 | .id = 0, /* Bus number */ |
| 322 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 323 | .resource = bfin_spi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 324 | .dev = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 325 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 326 | }, |
| 327 | }; |
| 328 | #endif /* spi master and devices */ |
| 329 | |
| 330 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) |
| 331 | static struct platform_device bfin_fb_device = { |
| 332 | .name = "bf537-fb", |
| 333 | }; |
| 334 | #endif |
| 335 | |
| 336 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 337 | static struct resource bfin_uart_resources[] = { |
| 338 | { |
| 339 | .start = 0xFFC00400, |
| 340 | .end = 0xFFC004FF, |
| 341 | .flags = IORESOURCE_MEM, |
| 342 | }, |
| 343 | }; |
| 344 | |
| 345 | static struct platform_device bfin_uart_device = { |
| 346 | .name = "bfin-uart", |
| 347 | .id = 1, |
| 348 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 349 | .resource = bfin_uart_resources, |
| 350 | }; |
| 351 | #endif |
| 352 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 353 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 354 | #ifdef CONFIG_BFIN_SIR0 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 355 | static struct resource bfin_sir0_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 356 | { |
| 357 | .start = 0xFFC00400, |
| 358 | .end = 0xFFC004FF, |
| 359 | .flags = IORESOURCE_MEM, |
| 360 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 361 | { |
| 362 | .start = IRQ_UART0_RX, |
| 363 | .end = IRQ_UART0_RX+1, |
| 364 | .flags = IORESOURCE_IRQ, |
| 365 | }, |
| 366 | { |
| 367 | .start = CH_UART0_RX, |
| 368 | .end = CH_UART0_RX+1, |
| 369 | .flags = IORESOURCE_DMA, |
| 370 | }, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 371 | }; |
| 372 | |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 373 | static struct platform_device bfin_sir0_device = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 374 | .name = "bfin_sir", |
| 375 | .id = 0, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 376 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
| 377 | .resource = bfin_sir0_resources, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 378 | }; |
| 379 | #endif |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 380 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 381 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 382 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 383 | static struct platform_device bfin_sport0_uart_device = { |
| 384 | .name = "bfin-sport-uart", |
| 385 | .id = 0, |
| 386 | }; |
| 387 | |
| 388 | static struct platform_device bfin_sport1_uart_device = { |
| 389 | .name = "bfin-sport-uart", |
| 390 | .id = 1, |
| 391 | }; |
| 392 | #endif |
| 393 | |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 394 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 395 | #include <linux/input.h> |
| 396 | #include <linux/gpio_keys.h> |
| 397 | |
| 398 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
Michael Hennerich | f1bceb4 | 2008-02-02 16:17:52 +0800 | [diff] [blame] | 399 | {BTN_0, GPIO_PF5, 0, "gpio-keys: BTN0"}, |
| 400 | {BTN_1, GPIO_PF6, 0, "gpio-keys: BTN1"}, |
| 401 | {BTN_2, GPIO_PF8, 0, "gpio-keys: BTN2"}, |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 402 | }; |
| 403 | |
| 404 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 405 | .buttons = bfin_gpio_keys_table, |
| 406 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 407 | }; |
| 408 | |
| 409 | static struct platform_device bfin_device_gpiokeys = { |
| 410 | .name = "gpio-keys", |
| 411 | .dev = { |
| 412 | .platform_data = &bfin_gpio_keys_data, |
| 413 | }, |
| 414 | }; |
| 415 | #endif |
| 416 | |
Mike Frysinger | cad2ab6 | 2008-02-22 17:01:31 +0800 | [diff] [blame] | 417 | static struct resource bfin_gpios_resources = { |
| 418 | .start = 0, |
| 419 | .end = MAX_BLACKFIN_GPIOS - 1, |
| 420 | .flags = IORESOURCE_IRQ, |
| 421 | }; |
| 422 | |
| 423 | static struct platform_device bfin_gpios_device = { |
| 424 | .name = "simple-gpio", |
| 425 | .id = -1, |
| 426 | .num_resources = 1, |
| 427 | .resource = &bfin_gpios_resources, |
| 428 | }; |
| 429 | |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 430 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) |
| 431 | #include <linux/i2c-gpio.h> |
| 432 | |
| 433 | static struct i2c_gpio_platform_data i2c_gpio_data = { |
| 434 | .sda_pin = 2, |
| 435 | .scl_pin = 3, |
| 436 | .sda_is_open_drain = 0, |
| 437 | .scl_is_open_drain = 0, |
| 438 | .udelay = 40, |
| 439 | }; |
| 440 | |
| 441 | static struct platform_device i2c_gpio_device = { |
| 442 | .name = "i2c-gpio", |
| 443 | .id = 0, |
| 444 | .dev = { |
| 445 | .platform_data = &i2c_gpio_data, |
| 446 | }, |
| 447 | }; |
| 448 | #endif |
| 449 | |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 450 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
| 451 | #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) |
| 452 | { |
| 453 | I2C_BOARD_INFO("ad7142_joystick", 0x2C), |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 454 | .irq = 39, |
| 455 | }, |
| 456 | #endif |
Michael Hennerich | ebd5833 | 2009-07-02 11:00:38 +0000 | [diff] [blame] | 457 | #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE) |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 458 | { |
| 459 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 460 | }, |
| 461 | #endif |
Michael Hennerich | 204844e | 2009-06-30 14:57:22 +0000 | [diff] [blame] | 462 | #if defined(CONFIG_INPUT_PCF8574) || defined(CONFIG_INPUT_PCF8574_MODULE) |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 463 | { |
| 464 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 465 | .irq = 39, |
| 466 | }, |
| 467 | #endif |
| 468 | }; |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 469 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 470 | static const unsigned int cclk_vlev_datasheet[] = |
| 471 | { |
| 472 | VRPAIR(VLEV_085, 250000000), |
| 473 | VRPAIR(VLEV_090, 376000000), |
| 474 | VRPAIR(VLEV_095, 426000000), |
| 475 | VRPAIR(VLEV_100, 426000000), |
| 476 | VRPAIR(VLEV_105, 476000000), |
| 477 | VRPAIR(VLEV_110, 476000000), |
| 478 | VRPAIR(VLEV_115, 476000000), |
| 479 | VRPAIR(VLEV_120, 600000000), |
| 480 | VRPAIR(VLEV_125, 600000000), |
| 481 | VRPAIR(VLEV_130, 600000000), |
| 482 | }; |
| 483 | |
| 484 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { |
| 485 | .tuple_tab = cclk_vlev_datasheet, |
| 486 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), |
| 487 | .vr_settling_time = 25 /* us */, |
| 488 | }; |
| 489 | |
| 490 | static struct platform_device bfin_dpmc = { |
| 491 | .name = "bfin dpmc", |
| 492 | .dev = { |
| 493 | .platform_data = &bfin_dmpc_vreg_data, |
| 494 | }, |
| 495 | }; |
| 496 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 497 | static struct platform_device *stamp_devices[] __initdata = { |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 498 | |
| 499 | &bfin_dpmc, |
| 500 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 501 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 502 | &rtc_device, |
| 503 | #endif |
| 504 | |
| 505 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 506 | &smc91x_device, |
| 507 | #endif |
| 508 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 509 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
| 510 | &bfin_fb_adv7393_device, |
| 511 | #endif |
| 512 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 513 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 514 | &net2272_bfin_device, |
| 515 | #endif |
| 516 | |
| 517 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 518 | &bfin_spi0_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 519 | #endif |
| 520 | |
| 521 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 522 | &bfin_uart_device, |
| 523 | #endif |
| 524 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 525 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 526 | #ifdef CONFIG_BFIN_SIR0 |
| 527 | &bfin_sir0_device, |
| 528 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 529 | #endif |
| 530 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 531 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 532 | &bfin_sport0_uart_device, |
| 533 | &bfin_sport1_uart_device, |
| 534 | #endif |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 535 | |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 536 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 537 | &bfin_device_gpiokeys, |
| 538 | #endif |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 539 | |
| 540 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) |
| 541 | &i2c_gpio_device, |
| 542 | #endif |
Mike Frysinger | cad2ab6 | 2008-02-22 17:01:31 +0800 | [diff] [blame] | 543 | |
| 544 | &bfin_gpios_device, |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 545 | |
Mike Frysinger | 9cd9c61 | 2008-05-13 12:31:32 +0800 | [diff] [blame] | 546 | #if defined(CONFIG_MTD_BFIN_ASYNC) || defined(CONFIG_MTD_BFIN_ASYNC_MODULE) |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 547 | &stamp_flash_device, |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 548 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 549 | }; |
| 550 | |
| 551 | static int __init stamp_init(void) |
| 552 | { |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 553 | int ret; |
| 554 | |
Harvey Harrison | b85d858 | 2008-04-23 09:39:01 +0800 | [diff] [blame] | 555 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 556 | |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 557 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 558 | ARRAY_SIZE(bfin_i2c_board_info)); |
Bryan Wu | 81d9c7f | 2008-03-26 10:02:13 +0800 | [diff] [blame] | 559 | |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 560 | ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 561 | if (ret < 0) |
| 562 | return ret; |
| 563 | |
| 564 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 565 | /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */ |
Mike Frysinger | 9cd9c61 | 2008-05-13 12:31:32 +0800 | [diff] [blame] | 566 | bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0); |
| 567 | bfin_write_FIO_FLAG_S(PF0); |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 568 | SSYNC(); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 569 | #endif |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 570 | |
Mike Frysinger | 5bda272 | 2008-06-07 15:03:01 +0800 | [diff] [blame] | 571 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 572 | return 0; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 573 | } |
| 574 | |
| 575 | arch_initcall(stamp_init); |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 576 | |
| 577 | void native_machine_restart(char *cmd) |
| 578 | { |
Mike Frysinger | 9cd9c61 | 2008-05-13 12:31:32 +0800 | [diff] [blame] | 579 | /* workaround pull up on cpld / flash pin not being strong enough */ |
| 580 | bfin_write_FIO_INEN(~PF0); |
| 581 | bfin_write_FIO_DIR(PF0); |
| 582 | bfin_write_FIO_FLAG_C(PF0); |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 583 | } |