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 | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 13 | #include <linux/mtd/plat-ram.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> |
Mike Frysinger | 67f2d33 | 2008-02-09 01:49:23 +0800 | [diff] [blame] | 16 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
Mike Frysinger | f02bcec | 2007-11-15 21:29:15 +0800 | [diff] [blame] | 17 | #include <linux/usb/isp1362.h> |
Mike Frysinger | 67f2d33 | 2008-02-09 01:49:23 +0800 | [diff] [blame] | 18 | #endif |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 19 | #include <linux/irq.h> |
Michael Hennerich | 50c4c08 | 2009-09-22 13:10:09 +0000 | [diff] [blame^] | 20 | #include <linux/i2c.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 21 | #include <asm/dma.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 22 | #include <asm/bfin5xx_spi.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 23 | #include <asm/portmux.h> |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 24 | #include <asm/dpmc.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 25 | |
| 26 | /* |
| 27 | * Name the Board for the /proc/cpuinfo |
| 28 | */ |
Mike Frysinger | fe85cad | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 29 | const char bfin_board_name[] = "ADI BF533-EZKIT"; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 30 | |
| 31 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 32 | static struct platform_device rtc_device = { |
| 33 | .name = "rtc-bfin", |
| 34 | .id = -1, |
| 35 | }; |
| 36 | #endif |
| 37 | |
| 38 | /* |
| 39 | * USB-LAN EzExtender board |
| 40 | * Driver needs to know address, irq and flag pin. |
| 41 | */ |
| 42 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 43 | #include <linux/smc91x.h> |
| 44 | |
| 45 | static struct smc91x_platdata smc91x_info = { |
| 46 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, |
| 47 | .leda = RPC_LED_100_10, |
| 48 | .ledb = RPC_LED_TX_RX, |
| 49 | }; |
| 50 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 51 | static struct resource smc91x_resources[] = { |
| 52 | { |
| 53 | .name = "smc91x-regs", |
| 54 | .start = 0x20310300, |
| 55 | .end = 0x20310300 + 16, |
| 56 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 57 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 58 | .start = IRQ_PF9, |
| 59 | .end = IRQ_PF9, |
| 60 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 61 | }, |
| 62 | }; |
| 63 | static struct platform_device smc91x_device = { |
| 64 | .name = "smc91x", |
| 65 | .id = 0, |
| 66 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 67 | .resource = smc91x_resources, |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 68 | .dev = { |
| 69 | .platform_data = &smc91x_info, |
| 70 | }, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 71 | }; |
| 72 | #endif |
| 73 | |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 74 | #if defined(CONFIG_MTD_PSD4256G) || defined(CONFIG_MTD_PSD4256G_MODULE) |
| 75 | static const char *map_probes[] = { |
| 76 | "stm_flash", |
| 77 | NULL, |
| 78 | }; |
| 79 | |
| 80 | static struct platdata_mtd_ram stm_pri_data_a = { |
| 81 | .mapname = "Flash A Primary", |
| 82 | .map_probes = map_probes, |
| 83 | .bankwidth = 2, |
| 84 | }; |
| 85 | |
| 86 | static struct resource stm_pri_resource_a = { |
| 87 | .start = 0x20000000, |
| 88 | .end = 0x200fffff, |
| 89 | .flags = IORESOURCE_MEM, |
| 90 | }; |
| 91 | |
| 92 | static struct platform_device stm_pri_device_a = { |
| 93 | .name = "mtd-ram", |
| 94 | .id = 0, |
| 95 | .dev = { |
| 96 | .platform_data = &stm_pri_data_a, |
| 97 | }, |
| 98 | .num_resources = 1, |
| 99 | .resource = &stm_pri_resource_a, |
| 100 | }; |
| 101 | |
| 102 | static struct platdata_mtd_ram stm_pri_data_b = { |
| 103 | .mapname = "Flash B Primary", |
| 104 | .map_probes = map_probes, |
| 105 | .bankwidth = 2, |
| 106 | }; |
| 107 | |
| 108 | static struct resource stm_pri_resource_b = { |
| 109 | .start = 0x20100000, |
| 110 | .end = 0x201fffff, |
| 111 | .flags = IORESOURCE_MEM, |
| 112 | }; |
| 113 | |
| 114 | static struct platform_device stm_pri_device_b = { |
| 115 | .name = "mtd-ram", |
| 116 | .id = 4, |
| 117 | .dev = { |
| 118 | .platform_data = &stm_pri_data_b, |
| 119 | }, |
| 120 | .num_resources = 1, |
| 121 | .resource = &stm_pri_resource_b, |
| 122 | }; |
| 123 | #endif |
| 124 | |
| 125 | #if defined(CONFIG_MTD_PLATRAM) || defined(CONFIG_MTD_PLATRAM_MODULE) |
| 126 | static struct platdata_mtd_ram sram_data_a = { |
| 127 | .mapname = "Flash A SRAM", |
| 128 | .bankwidth = 2, |
| 129 | }; |
| 130 | |
| 131 | static struct resource sram_resource_a = { |
| 132 | .start = 0x20240000, |
| 133 | .end = 0x2024ffff, |
| 134 | .flags = IORESOURCE_MEM, |
| 135 | }; |
| 136 | |
| 137 | static struct platform_device sram_device_a = { |
| 138 | .name = "mtd-ram", |
| 139 | .id = 8, |
| 140 | .dev = { |
| 141 | .platform_data = &sram_data_a, |
| 142 | }, |
| 143 | .num_resources = 1, |
| 144 | .resource = &sram_resource_a, |
| 145 | }; |
| 146 | |
| 147 | static struct platdata_mtd_ram sram_data_b = { |
| 148 | .mapname = "Flash B SRAM", |
| 149 | .bankwidth = 2, |
| 150 | }; |
| 151 | |
| 152 | static struct resource sram_resource_b = { |
| 153 | .start = 0x202c0000, |
| 154 | .end = 0x202cffff, |
| 155 | .flags = IORESOURCE_MEM, |
| 156 | }; |
| 157 | |
| 158 | static struct platform_device sram_device_b = { |
| 159 | .name = "mtd-ram", |
| 160 | .id = 9, |
| 161 | .dev = { |
| 162 | .platform_data = &sram_data_b, |
| 163 | }, |
| 164 | .num_resources = 1, |
| 165 | .resource = &sram_resource_b, |
| 166 | }; |
| 167 | #endif |
| 168 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 169 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 170 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 171 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 172 | .name = "bootloader(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 173 | .size = 0x00020000, |
| 174 | .offset = 0, |
| 175 | .mask_flags = MTD_CAP_ROM |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 176 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 177 | .name = "linux kernel(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 178 | .size = 0xe0000, |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 179 | .offset = MTDPART_OFS_APPEND, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 180 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 181 | .name = "file system(spi)", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 182 | .size = MTDPART_SIZ_FULL, |
| 183 | .offset = MTDPART_OFS_APPEND, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 184 | } |
| 185 | }; |
| 186 | |
| 187 | static struct flash_platform_data bfin_spi_flash_data = { |
| 188 | .name = "m25p80", |
| 189 | .parts = bfin_spi_flash_partitions, |
| 190 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 191 | .type = "m25p64", |
| 192 | }; |
| 193 | |
| 194 | /* SPI flash chip (m25p64) */ |
| 195 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 196 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 197 | .bits_per_word = 8, |
| 198 | }; |
| 199 | #endif |
| 200 | |
Mike Frysinger | a261eec | 2009-05-20 14:05:36 +0000 | [diff] [blame] | 201 | #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 202 | /* SPI ADC chip */ |
| 203 | static struct bfin5xx_spi_chip spi_adc_chip_info = { |
| 204 | .enable_dma = 1, /* use dma transfer with this chip*/ |
| 205 | .bits_per_word = 16, |
| 206 | }; |
| 207 | #endif |
| 208 | |
| 209 | #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 210 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 211 | .enable_dma = 0, |
| 212 | .bits_per_word = 16, |
| 213 | }; |
| 214 | #endif |
| 215 | |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 216 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 217 | static struct bfin5xx_spi_chip spidev_chip_info = { |
| 218 | .enable_dma = 0, |
| 219 | .bits_per_word = 8, |
| 220 | }; |
| 221 | #endif |
| 222 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 223 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
| 224 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 225 | { |
| 226 | /* the modalias must be the same as spi device driver name */ |
| 227 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 228 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 229 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 230 | .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/ |
| 231 | .platform_data = &bfin_spi_flash_data, |
| 232 | .controller_data = &spi_flash_chip_info, |
| 233 | .mode = SPI_MODE_3, |
| 234 | }, |
| 235 | #endif |
| 236 | |
Mike Frysinger | a261eec | 2009-05-20 14:05:36 +0000 | [diff] [blame] | 237 | #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 238 | { |
| 239 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ |
| 240 | .max_speed_hz = 6250000, /* 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 = 1, /* Framework chip select. */ |
| 243 | .platform_data = NULL, /* No spi_driver specific config */ |
| 244 | .controller_data = &spi_adc_chip_info, |
| 245 | }, |
| 246 | #endif |
| 247 | |
| 248 | #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 249 | { |
Barry Song | dac9817 | 2009-08-13 21:07:37 +0000 | [diff] [blame] | 250 | .modalias = "ad1836", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 251 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 252 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 253 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, |
| 254 | .controller_data = &ad1836_spi_chip_info, |
| 255 | }, |
| 256 | #endif |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 257 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 258 | { |
| 259 | .modalias = "spidev", |
| 260 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 261 | .bus_num = 0, |
| 262 | .chip_select = 1, |
| 263 | .controller_data = &spidev_chip_info, |
| 264 | }, |
| 265 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 266 | }; |
| 267 | |
Mike Frysinger | 5bda272 | 2008-06-07 15:03:01 +0800 | [diff] [blame] | 268 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 269 | /* SPI (0) */ |
| 270 | static struct resource bfin_spi0_resource[] = { |
| 271 | [0] = { |
| 272 | .start = SPI0_REGBASE, |
| 273 | .end = SPI0_REGBASE + 0xFF, |
| 274 | .flags = IORESOURCE_MEM, |
| 275 | }, |
| 276 | [1] = { |
| 277 | .start = CH_SPI, |
| 278 | .end = CH_SPI, |
Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 279 | .flags = IORESOURCE_DMA, |
| 280 | }, |
| 281 | [2] = { |
| 282 | .start = IRQ_SPI, |
| 283 | .end = IRQ_SPI, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 284 | .flags = IORESOURCE_IRQ, |
| 285 | } |
| 286 | }; |
| 287 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 288 | /* SPI controller data */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 289 | static struct bfin5xx_spi_master bfin_spi0_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 290 | .num_chipselect = 8, |
| 291 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 292 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 293 | }; |
| 294 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 295 | static struct platform_device bfin_spi0_device = { |
| 296 | .name = "bfin-spi", |
| 297 | .id = 0, /* Bus number */ |
| 298 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 299 | .resource = bfin_spi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 300 | .dev = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 301 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 302 | }, |
| 303 | }; |
| 304 | #endif /* spi master and devices */ |
| 305 | |
| 306 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 307 | static struct resource bfin_uart_resources[] = { |
| 308 | { |
| 309 | .start = 0xFFC00400, |
| 310 | .end = 0xFFC004FF, |
| 311 | .flags = IORESOURCE_MEM, |
| 312 | }, |
| 313 | }; |
| 314 | |
| 315 | static struct platform_device bfin_uart_device = { |
| 316 | .name = "bfin-uart", |
| 317 | .id = 1, |
| 318 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 319 | .resource = bfin_uart_resources, |
| 320 | }; |
| 321 | #endif |
| 322 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 323 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 324 | #ifdef CONFIG_BFIN_SIR0 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 325 | static struct resource bfin_sir0_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 326 | { |
| 327 | .start = 0xFFC00400, |
| 328 | .end = 0xFFC004FF, |
| 329 | .flags = IORESOURCE_MEM, |
| 330 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 331 | { |
| 332 | .start = IRQ_UART0_RX, |
| 333 | .end = IRQ_UART0_RX+1, |
| 334 | .flags = IORESOURCE_IRQ, |
| 335 | }, |
| 336 | { |
| 337 | .start = CH_UART0_RX, |
| 338 | .end = CH_UART0_RX+1, |
| 339 | .flags = IORESOURCE_DMA, |
| 340 | }, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 341 | }; |
| 342 | |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 343 | static struct platform_device bfin_sir0_device = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 344 | .name = "bfin_sir", |
| 345 | .id = 0, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 346 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
| 347 | .resource = bfin_sir0_resources, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 348 | }; |
| 349 | #endif |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 350 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 351 | |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 352 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 353 | #include <linux/input.h> |
| 354 | #include <linux/gpio_keys.h> |
| 355 | |
| 356 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
| 357 | {BTN_0, GPIO_PF7, 1, "gpio-keys: BTN0"}, |
| 358 | {BTN_1, GPIO_PF8, 1, "gpio-keys: BTN1"}, |
| 359 | {BTN_2, GPIO_PF9, 1, "gpio-keys: BTN2"}, |
| 360 | {BTN_3, GPIO_PF10, 1, "gpio-keys: BTN3"}, |
| 361 | }; |
| 362 | |
| 363 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 364 | .buttons = bfin_gpio_keys_table, |
| 365 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 366 | }; |
| 367 | |
| 368 | static struct platform_device bfin_device_gpiokeys = { |
| 369 | .name = "gpio-keys", |
| 370 | .dev = { |
| 371 | .platform_data = &bfin_gpio_keys_data, |
| 372 | }, |
| 373 | }; |
| 374 | #endif |
| 375 | |
Mike Frysinger | cad2ab6 | 2008-02-22 17:01:31 +0800 | [diff] [blame] | 376 | static struct resource bfin_gpios_resources = { |
| 377 | .start = 0, |
| 378 | .end = MAX_BLACKFIN_GPIOS - 1, |
| 379 | .flags = IORESOURCE_IRQ, |
| 380 | }; |
| 381 | |
| 382 | static struct platform_device bfin_gpios_device = { |
| 383 | .name = "simple-gpio", |
| 384 | .id = -1, |
| 385 | .num_resources = 1, |
| 386 | .resource = &bfin_gpios_resources, |
| 387 | }; |
| 388 | |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 389 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) |
| 390 | #include <linux/i2c-gpio.h> |
| 391 | |
| 392 | static struct i2c_gpio_platform_data i2c_gpio_data = { |
| 393 | .sda_pin = 1, |
| 394 | .scl_pin = 0, |
| 395 | .sda_is_open_drain = 0, |
| 396 | .scl_is_open_drain = 0, |
| 397 | .udelay = 40, |
| 398 | }; |
| 399 | |
| 400 | static struct platform_device i2c_gpio_device = { |
| 401 | .name = "i2c-gpio", |
| 402 | .id = 0, |
| 403 | .dev = { |
| 404 | .platform_data = &i2c_gpio_data, |
| 405 | }, |
| 406 | }; |
| 407 | #endif |
| 408 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 409 | static const unsigned int cclk_vlev_datasheet[] = |
| 410 | { |
| 411 | VRPAIR(VLEV_085, 250000000), |
| 412 | VRPAIR(VLEV_090, 376000000), |
| 413 | VRPAIR(VLEV_095, 426000000), |
| 414 | VRPAIR(VLEV_100, 426000000), |
| 415 | VRPAIR(VLEV_105, 476000000), |
| 416 | VRPAIR(VLEV_110, 476000000), |
| 417 | VRPAIR(VLEV_115, 476000000), |
| 418 | VRPAIR(VLEV_120, 600000000), |
| 419 | VRPAIR(VLEV_125, 600000000), |
| 420 | VRPAIR(VLEV_130, 600000000), |
| 421 | }; |
| 422 | |
| 423 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { |
| 424 | .tuple_tab = cclk_vlev_datasheet, |
| 425 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), |
| 426 | .vr_settling_time = 25 /* us */, |
| 427 | }; |
| 428 | |
| 429 | static struct platform_device bfin_dpmc = { |
| 430 | .name = "bfin dpmc", |
| 431 | .dev = { |
| 432 | .platform_data = &bfin_dmpc_vreg_data, |
| 433 | }, |
| 434 | }; |
| 435 | |
Michael Hennerich | 50c4c08 | 2009-09-22 13:10:09 +0000 | [diff] [blame^] | 436 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
| 437 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
| 438 | { |
| 439 | I2C_BOARD_INFO("bfin-adv7393", 0x2B), |
| 440 | }, |
| 441 | #endif |
| 442 | }; |
| 443 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 444 | static struct platform_device *ezkit_devices[] __initdata = { |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 445 | |
| 446 | &bfin_dpmc, |
| 447 | |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 448 | #if defined(CONFIG_MTD_PSD4256G) || defined(CONFIG_MTD_PSD4256G_MODULE) |
| 449 | &stm_pri_device_a, |
| 450 | &stm_pri_device_b, |
| 451 | #endif |
| 452 | |
| 453 | #if defined(CONFIG_MTD_PLATRAM) || defined(CONFIG_MTD_PLATRAM_MODULE) |
| 454 | &sram_device_a, |
| 455 | &sram_device_b, |
| 456 | #endif |
| 457 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 458 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 459 | &smc91x_device, |
| 460 | #endif |
| 461 | |
| 462 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 463 | &bfin_spi0_device, |
| 464 | #endif |
| 465 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 466 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 467 | &rtc_device, |
| 468 | #endif |
| 469 | |
Sonic Zhang | e062cea | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 470 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 471 | &bfin_uart_device, |
| 472 | #endif |
| 473 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 474 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 475 | #ifdef CONFIG_BFIN_SIR0 |
| 476 | &bfin_sir0_device, |
| 477 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 478 | #endif |
| 479 | |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 480 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 481 | &bfin_device_gpiokeys, |
| 482 | #endif |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 483 | |
| 484 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) |
| 485 | &i2c_gpio_device, |
| 486 | #endif |
Mike Frysinger | cad2ab6 | 2008-02-22 17:01:31 +0800 | [diff] [blame] | 487 | |
| 488 | &bfin_gpios_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 489 | }; |
| 490 | |
| 491 | static int __init ezkit_init(void) |
| 492 | { |
Harvey Harrison | b85d858 | 2008-04-23 09:39:01 +0800 | [diff] [blame] | 493 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 494 | platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 495 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
Michael Hennerich | 50c4c08 | 2009-09-22 13:10:09 +0000 | [diff] [blame^] | 496 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 497 | ARRAY_SIZE(bfin_i2c_board_info)); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 498 | return 0; |
| 499 | } |
| 500 | |
| 501 | arch_initcall(ezkit_init); |