Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 1 | /* |
| 2 | * File: arch/blackfin/mach-bf527/boards/ezkit.c |
| 3 | * Based on: arch/blackfin/mach-bf537/boards/stamp.c |
| 4 | * Author: Aidan Williams <aidan@nicta.com.au> |
| 5 | * |
| 6 | * Created: |
| 7 | * Description: |
| 8 | * |
| 9 | * Modified: |
| 10 | * Copyright 2005 National ICT Australia (NICTA) |
Michael Hennerich | a628a8b | 2008-01-22 17:29:16 +0800 | [diff] [blame] | 11 | * Copyright 2004-2008 Analog Devices Inc. |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 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> |
Michael Hennerich | d7e5dd4 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 35 | #include <linux/mtd/physmap.h> |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [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> |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 40 | #endif |
Bryan Wu | 7226868 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 41 | #include <linux/i2c.h> |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 42 | #include <linux/irq.h> |
| 43 | #include <linux/interrupt.h> |
Mike Frysinger | 632f658 | 2007-11-15 21:25:47 +0800 | [diff] [blame] | 44 | #include <linux/usb/sl811.h> |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 45 | #include <linux/usb/musb.h> |
Michael Hennerich | 64307f7 | 2007-10-29 16:55:18 +0800 | [diff] [blame] | 46 | #include <asm/cplb.h> |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 47 | #include <asm/dma.h> |
| 48 | #include <asm/bfin5xx_spi.h> |
| 49 | #include <asm/reboot.h> |
Michael Hennerich | 64307f7 | 2007-10-29 16:55:18 +0800 | [diff] [blame] | 50 | #include <asm/nand.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 51 | #include <asm/portmux.h> |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 52 | #include <asm/dpmc.h> |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 53 | #include <linux/spi/ad7877.h> |
| 54 | |
| 55 | /* |
| 56 | * Name the Board for the /proc/cpuinfo |
| 57 | */ |
Mike Frysinger | 066954a | 2007-10-21 22:36:06 +0800 | [diff] [blame] | 58 | const char bfin_board_name[] = "ADDS-BF527-EZKIT"; |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 59 | |
| 60 | /* |
| 61 | * Driver needs to know address, irq and flag pin. |
| 62 | */ |
| 63 | |
| 64 | #define ISP1761_BASE 0x203C0000 |
| 65 | #define ISP1761_IRQ IRQ_PF7 |
| 66 | |
| 67 | #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) |
| 68 | static struct resource bfin_isp1761_resources[] = { |
| 69 | [0] = { |
| 70 | .name = "isp1761-regs", |
| 71 | .start = ISP1761_BASE + 0x00000000, |
| 72 | .end = ISP1761_BASE + 0x000fffff, |
| 73 | .flags = IORESOURCE_MEM, |
| 74 | }, |
| 75 | [1] = { |
| 76 | .start = ISP1761_IRQ, |
| 77 | .end = ISP1761_IRQ, |
| 78 | .flags = IORESOURCE_IRQ, |
| 79 | }, |
| 80 | }; |
| 81 | |
| 82 | static struct platform_device bfin_isp1761_device = { |
| 83 | .name = "isp1761", |
| 84 | .id = 0, |
| 85 | .num_resources = ARRAY_SIZE(bfin_isp1761_resources), |
| 86 | .resource = bfin_isp1761_resources, |
| 87 | }; |
| 88 | |
| 89 | static struct platform_device *bfin_isp1761_devices[] = { |
| 90 | &bfin_isp1761_device, |
| 91 | }; |
| 92 | |
| 93 | int __init bfin_isp1761_init(void) |
| 94 | { |
| 95 | unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices); |
| 96 | |
Harvey Harrison | b85d858 | 2008-04-23 09:39:01 +0800 | [diff] [blame] | 97 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 98 | set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING); |
| 99 | |
| 100 | return platform_add_devices(bfin_isp1761_devices, num_devices); |
| 101 | } |
| 102 | |
| 103 | void __exit bfin_isp1761_exit(void) |
| 104 | { |
| 105 | platform_device_unregister(&bfin_isp1761_device); |
| 106 | } |
| 107 | |
| 108 | arch_initcall(bfin_isp1761_init); |
| 109 | #endif |
| 110 | |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 111 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 112 | static struct resource musb_resources[] = { |
| 113 | [0] = { |
| 114 | .start = 0xffc03800, |
| 115 | .end = 0xffc03cff, |
| 116 | .flags = IORESOURCE_MEM, |
| 117 | }, |
| 118 | [1] = { /* general IRQ */ |
| 119 | .start = IRQ_USB_INT0, |
| 120 | .end = IRQ_USB_INT0, |
| 121 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 122 | }, |
| 123 | [2] = { /* DMA IRQ */ |
| 124 | .start = IRQ_USB_DMA, |
| 125 | .end = IRQ_USB_DMA, |
| 126 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 127 | }, |
| 128 | }; |
| 129 | |
Bryan Wu | 50041ac | 2008-10-08 13:39:40 +0800 | [diff] [blame^] | 130 | static struct musb_hdrc_config musb_config = { |
| 131 | .multipoint = 0, |
| 132 | .dyn_fifo = 0, |
| 133 | .soft_con = 1, |
| 134 | .dma = 1, |
| 135 | .num_eps = 7, |
| 136 | .dma_channels = 7, |
| 137 | .gpio_vrsel = GPIO_PG13, |
| 138 | }; |
| 139 | |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 140 | static struct musb_hdrc_platform_data musb_plat = { |
| 141 | #if defined(CONFIG_USB_MUSB_OTG) |
| 142 | .mode = MUSB_OTG, |
| 143 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) |
| 144 | .mode = MUSB_HOST, |
| 145 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) |
| 146 | .mode = MUSB_PERIPHERAL, |
| 147 | #endif |
Bryan Wu | 50041ac | 2008-10-08 13:39:40 +0800 | [diff] [blame^] | 148 | .config = &musb_config, |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 149 | }; |
| 150 | |
| 151 | static u64 musb_dmamask = ~(u32)0; |
| 152 | |
| 153 | static struct platform_device musb_device = { |
| 154 | .name = "musb_hdrc", |
| 155 | .id = 0, |
| 156 | .dev = { |
| 157 | .dma_mask = &musb_dmamask, |
| 158 | .coherent_dma_mask = 0xffffffff, |
| 159 | .platform_data = &musb_plat, |
| 160 | }, |
| 161 | .num_resources = ARRAY_SIZE(musb_resources), |
| 162 | .resource = musb_resources, |
| 163 | }; |
| 164 | #endif |
| 165 | |
| 166 | #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE) |
| 167 | |
| 168 | static struct resource bf52x_t350mcqb_resources[] = { |
| 169 | { |
| 170 | .start = IRQ_PPI_ERROR, |
| 171 | .end = IRQ_PPI_ERROR, |
| 172 | .flags = IORESOURCE_IRQ, |
| 173 | }, |
| 174 | }; |
| 175 | |
| 176 | static struct platform_device bf52x_t350mcqb_device = { |
| 177 | .name = "bfin-t350mcqb", |
| 178 | .id = -1, |
| 179 | .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources), |
| 180 | .resource = bf52x_t350mcqb_resources, |
| 181 | }; |
| 182 | #endif |
| 183 | |
Michael Hennerich | d7e5dd4 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 184 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
| 185 | static struct mtd_partition ezkit_partitions[] = { |
| 186 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 187 | .name = "bootloader(nor)", |
Michael Hennerich | d7e5dd4 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 188 | .size = 0x40000, |
| 189 | .offset = 0, |
| 190 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 191 | .name = "linux kernel(nor)", |
Michael Hennerich | d7e5dd4 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 192 | .size = 0x1C0000, |
| 193 | .offset = MTDPART_OFS_APPEND, |
| 194 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 195 | .name = "file system(nor)", |
Michael Hennerich | d7e5dd4 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 196 | .size = MTDPART_SIZ_FULL, |
| 197 | .offset = MTDPART_OFS_APPEND, |
| 198 | } |
| 199 | }; |
| 200 | |
| 201 | static struct physmap_flash_data ezkit_flash_data = { |
| 202 | .width = 2, |
| 203 | .parts = ezkit_partitions, |
| 204 | .nr_parts = ARRAY_SIZE(ezkit_partitions), |
| 205 | }; |
| 206 | |
| 207 | static struct resource ezkit_flash_resource = { |
| 208 | .start = 0x20000000, |
| 209 | .end = 0x203fffff, |
| 210 | .flags = IORESOURCE_MEM, |
| 211 | }; |
| 212 | |
| 213 | static struct platform_device ezkit_flash_device = { |
| 214 | .name = "physmap-flash", |
| 215 | .id = 0, |
| 216 | .dev = { |
| 217 | .platform_data = &ezkit_flash_data, |
| 218 | }, |
| 219 | .num_resources = 1, |
| 220 | .resource = &ezkit_flash_resource, |
| 221 | }; |
| 222 | #endif |
| 223 | |
Michael Hennerich | 64307f7 | 2007-10-29 16:55:18 +0800 | [diff] [blame] | 224 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 225 | static struct mtd_partition partition_info[] = { |
| 226 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 227 | .name = "linux kernel(nand)", |
Michael Hennerich | 64307f7 | 2007-10-29 16:55:18 +0800 | [diff] [blame] | 228 | .offset = 0, |
| 229 | .size = 4 * SIZE_1M, |
| 230 | }, |
| 231 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 232 | .name = "file system(nand)", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 233 | .offset = MTDPART_OFS_APPEND, |
| 234 | .size = MTDPART_SIZ_FULL, |
Michael Hennerich | 64307f7 | 2007-10-29 16:55:18 +0800 | [diff] [blame] | 235 | }, |
| 236 | }; |
| 237 | |
| 238 | static struct bf5xx_nand_platform bf5xx_nand_platform = { |
| 239 | .page_size = NFC_PG_SIZE_256, |
| 240 | .data_width = NFC_NWIDTH_8, |
| 241 | .partitions = partition_info, |
| 242 | .nr_partitions = ARRAY_SIZE(partition_info), |
| 243 | .rd_dly = 3, |
| 244 | .wr_dly = 3, |
| 245 | }; |
| 246 | |
| 247 | static struct resource bf5xx_nand_resources[] = { |
| 248 | { |
| 249 | .start = NFC_CTL, |
| 250 | .end = NFC_DATA_RD + 2, |
| 251 | .flags = IORESOURCE_MEM, |
| 252 | }, |
| 253 | { |
| 254 | .start = CH_NFC, |
| 255 | .end = CH_NFC, |
| 256 | .flags = IORESOURCE_IRQ, |
| 257 | }, |
| 258 | }; |
| 259 | |
| 260 | static struct platform_device bf5xx_nand_device = { |
| 261 | .name = "bf5xx-nand", |
| 262 | .id = 0, |
| 263 | .num_resources = ARRAY_SIZE(bf5xx_nand_resources), |
| 264 | .resource = bf5xx_nand_resources, |
| 265 | .dev = { |
| 266 | .platform_data = &bf5xx_nand_platform, |
| 267 | }, |
| 268 | }; |
| 269 | #endif |
| 270 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 271 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
| 272 | static struct resource bfin_pcmcia_cf_resources[] = { |
| 273 | { |
| 274 | .start = 0x20310000, /* IO PORT */ |
| 275 | .end = 0x20312000, |
| 276 | .flags = IORESOURCE_MEM, |
| 277 | }, { |
| 278 | .start = 0x20311000, /* Attribute Memory */ |
| 279 | .end = 0x20311FFF, |
| 280 | .flags = IORESOURCE_MEM, |
| 281 | }, { |
| 282 | .start = IRQ_PF4, |
| 283 | .end = IRQ_PF4, |
| 284 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 285 | }, { |
| 286 | .start = 6, /* Card Detect PF6 */ |
| 287 | .end = 6, |
| 288 | .flags = IORESOURCE_IRQ, |
| 289 | }, |
| 290 | }; |
| 291 | |
| 292 | static struct platform_device bfin_pcmcia_cf_device = { |
| 293 | .name = "bfin_cf_pcmcia", |
| 294 | .id = -1, |
| 295 | .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources), |
| 296 | .resource = bfin_pcmcia_cf_resources, |
| 297 | }; |
| 298 | #endif |
| 299 | |
| 300 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 301 | static struct platform_device rtc_device = { |
| 302 | .name = "rtc-bfin", |
| 303 | .id = -1, |
| 304 | }; |
| 305 | #endif |
| 306 | |
| 307 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 308 | static struct resource smc91x_resources[] = { |
| 309 | { |
| 310 | .name = "smc91x-regs", |
| 311 | .start = 0x20300300, |
| 312 | .end = 0x20300300 + 16, |
| 313 | .flags = IORESOURCE_MEM, |
| 314 | }, { |
| 315 | |
| 316 | .start = IRQ_PF7, |
| 317 | .end = IRQ_PF7, |
| 318 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 319 | }, |
| 320 | }; |
| 321 | static struct platform_device smc91x_device = { |
| 322 | .name = "smc91x", |
| 323 | .id = 0, |
| 324 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 325 | .resource = smc91x_resources, |
| 326 | }; |
| 327 | #endif |
| 328 | |
| 329 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 330 | static struct resource dm9000_resources[] = { |
| 331 | [0] = { |
| 332 | .start = 0x203FB800, |
Laurent Pinchart | da3854f | 2008-06-24 22:15:58 +0100 | [diff] [blame] | 333 | .end = 0x203FB800 + 1, |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 334 | .flags = IORESOURCE_MEM, |
| 335 | }, |
| 336 | [1] = { |
Laurent Pinchart | da3854f | 2008-06-24 22:15:58 +0100 | [diff] [blame] | 337 | .start = 0x203FB800 + 4, |
| 338 | .end = 0x203FB800 + 5, |
| 339 | .flags = IORESOURCE_MEM, |
| 340 | }, |
| 341 | [2] = { |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 342 | .start = IRQ_PF9, |
| 343 | .end = IRQ_PF9, |
| 344 | .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE), |
| 345 | }, |
| 346 | }; |
| 347 | |
| 348 | static struct platform_device dm9000_device = { |
| 349 | .name = "dm9000", |
| 350 | .id = -1, |
| 351 | .num_resources = ARRAY_SIZE(dm9000_resources), |
| 352 | .resource = dm9000_resources, |
| 353 | }; |
| 354 | #endif |
| 355 | |
| 356 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) |
| 357 | static struct resource sl811_hcd_resources[] = { |
| 358 | { |
| 359 | .start = 0x20340000, |
| 360 | .end = 0x20340000, |
| 361 | .flags = IORESOURCE_MEM, |
| 362 | }, { |
| 363 | .start = 0x20340004, |
| 364 | .end = 0x20340004, |
| 365 | .flags = IORESOURCE_MEM, |
| 366 | }, { |
| 367 | .start = CONFIG_USB_SL811_BFIN_IRQ, |
| 368 | .end = CONFIG_USB_SL811_BFIN_IRQ, |
| 369 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 370 | }, |
| 371 | }; |
| 372 | |
| 373 | #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS) |
| 374 | void sl811_port_power(struct device *dev, int is_on) |
| 375 | { |
| 376 | gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS"); |
Michael Hennerich | acbcd26 | 2008-01-22 18:36:20 +0800 | [diff] [blame] | 377 | gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on); |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 378 | } |
| 379 | #endif |
| 380 | |
| 381 | static struct sl811_platform_data sl811_priv = { |
| 382 | .potpg = 10, |
| 383 | .power = 250, /* == 500mA */ |
| 384 | #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS) |
| 385 | .port_power = &sl811_port_power, |
| 386 | #endif |
| 387 | }; |
| 388 | |
| 389 | static struct platform_device sl811_hcd_device = { |
| 390 | .name = "sl811-hcd", |
| 391 | .id = 0, |
| 392 | .dev = { |
| 393 | .platform_data = &sl811_priv, |
| 394 | }, |
| 395 | .num_resources = ARRAY_SIZE(sl811_hcd_resources), |
| 396 | .resource = sl811_hcd_resources, |
| 397 | }; |
| 398 | #endif |
| 399 | |
| 400 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 401 | static struct resource isp1362_hcd_resources[] = { |
| 402 | { |
| 403 | .start = 0x20360000, |
| 404 | .end = 0x20360000, |
| 405 | .flags = IORESOURCE_MEM, |
| 406 | }, { |
| 407 | .start = 0x20360004, |
| 408 | .end = 0x20360004, |
| 409 | .flags = IORESOURCE_MEM, |
| 410 | }, { |
| 411 | .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ, |
| 412 | .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ, |
| 413 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 414 | }, |
| 415 | }; |
| 416 | |
| 417 | static struct isp1362_platform_data isp1362_priv = { |
| 418 | .sel15Kres = 1, |
| 419 | .clknotstop = 0, |
| 420 | .oc_enable = 0, |
| 421 | .int_act_high = 0, |
| 422 | .int_edge_triggered = 0, |
| 423 | .remote_wakeup_connected = 0, |
| 424 | .no_power_switching = 1, |
| 425 | .power_switching_mode = 0, |
| 426 | }; |
| 427 | |
| 428 | static struct platform_device isp1362_hcd_device = { |
| 429 | .name = "isp1362-hcd", |
| 430 | .id = 0, |
| 431 | .dev = { |
| 432 | .platform_data = &isp1362_priv, |
| 433 | }, |
| 434 | .num_resources = ARRAY_SIZE(isp1362_hcd_resources), |
| 435 | .resource = isp1362_hcd_resources, |
| 436 | }; |
| 437 | #endif |
| 438 | |
| 439 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 440 | static struct platform_device bfin_mac_device = { |
| 441 | .name = "bfin_mac", |
| 442 | }; |
| 443 | #endif |
| 444 | |
| 445 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 446 | static struct resource net2272_bfin_resources[] = { |
| 447 | { |
| 448 | .start = 0x20300000, |
| 449 | .end = 0x20300000 + 0x100, |
| 450 | .flags = IORESOURCE_MEM, |
| 451 | }, { |
| 452 | .start = IRQ_PF7, |
| 453 | .end = IRQ_PF7, |
| 454 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 455 | }, |
| 456 | }; |
| 457 | |
| 458 | static struct platform_device net2272_bfin_device = { |
| 459 | .name = "net2272", |
| 460 | .id = -1, |
| 461 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), |
| 462 | .resource = net2272_bfin_resources, |
| 463 | }; |
| 464 | #endif |
| 465 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 466 | #if defined(CONFIG_MTD_M25P80) \ |
| 467 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 468 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 469 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 470 | .name = "bootloader(spi)", |
Grace Pan | ac76d88 | 2008-04-24 06:33:56 +0800 | [diff] [blame] | 471 | .size = 0x00040000, |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 472 | .offset = 0, |
| 473 | .mask_flags = MTD_CAP_ROM |
| 474 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 475 | .name = "linux kernel(spi)", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 476 | .size = MTDPART_SIZ_FULL, |
| 477 | .offset = MTDPART_OFS_APPEND, |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 478 | } |
| 479 | }; |
| 480 | |
| 481 | static struct flash_platform_data bfin_spi_flash_data = { |
| 482 | .name = "m25p80", |
| 483 | .parts = bfin_spi_flash_partitions, |
| 484 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
Michael Hennerich | b9c9e78 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 485 | .type = "m25p16", |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 486 | }; |
| 487 | |
| 488 | /* SPI flash chip (m25p64) */ |
| 489 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 490 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 491 | .bits_per_word = 8, |
| 492 | }; |
| 493 | #endif |
| 494 | |
| 495 | #if defined(CONFIG_SPI_ADC_BF533) \ |
| 496 | || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 497 | /* SPI ADC chip */ |
| 498 | static struct bfin5xx_spi_chip spi_adc_chip_info = { |
| 499 | .enable_dma = 1, /* use dma transfer with this chip*/ |
| 500 | .bits_per_word = 16, |
| 501 | }; |
| 502 | #endif |
| 503 | |
| 504 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
| 505 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 506 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 507 | .enable_dma = 0, |
| 508 | .bits_per_word = 16, |
| 509 | }; |
| 510 | #endif |
| 511 | |
| 512 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) |
| 513 | static struct bfin5xx_spi_chip ad9960_spi_chip_info = { |
| 514 | .enable_dma = 0, |
| 515 | .bits_per_word = 16, |
| 516 | }; |
| 517 | #endif |
| 518 | |
| 519 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 520 | static struct bfin5xx_spi_chip spi_mmc_chip_info = { |
| 521 | .enable_dma = 1, |
| 522 | .bits_per_word = 8, |
| 523 | }; |
| 524 | #endif |
| 525 | |
| 526 | #if defined(CONFIG_PBX) |
| 527 | static struct bfin5xx_spi_chip spi_si3xxx_chip_info = { |
| 528 | .ctl_reg = 0x4, /* send zero */ |
| 529 | .enable_dma = 0, |
| 530 | .bits_per_word = 8, |
| 531 | .cs_change_per_word = 1, |
| 532 | }; |
| 533 | #endif |
| 534 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 535 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 536 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { |
| 537 | .enable_dma = 0, |
| 538 | .bits_per_word = 16, |
| 539 | }; |
| 540 | |
| 541 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { |
| 542 | .model = 7877, |
| 543 | .vref_delay_usecs = 50, /* internal, no capacitor */ |
| 544 | .x_plate_ohms = 419, |
| 545 | .y_plate_ohms = 486, |
| 546 | .pressure_max = 1000, |
| 547 | .pressure_min = 0, |
| 548 | .stopacq_polarity = 1, |
| 549 | .first_conversion_delay = 3, |
| 550 | .acquisition_time = 1, |
| 551 | .averaging = 1, |
| 552 | .pen_down_acc_interval = 1, |
| 553 | }; |
| 554 | #endif |
| 555 | |
Michael Hennerich | c7d4896 | 2007-11-15 21:33:31 +0800 | [diff] [blame] | 556 | #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \ |
Michael Hennerich | 0954f70 | 2007-11-13 00:16:19 +0800 | [diff] [blame] | 557 | && defined(CONFIG_SND_SOC_WM8731_SPI) |
| 558 | static struct bfin5xx_spi_chip spi_wm8731_chip_info = { |
| 559 | .enable_dma = 0, |
| 560 | .bits_per_word = 16, |
| 561 | }; |
| 562 | #endif |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 563 | |
| 564 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 565 | static struct bfin5xx_spi_chip spidev_chip_info = { |
| 566 | .enable_dma = 0, |
| 567 | .bits_per_word = 8, |
| 568 | }; |
| 569 | #endif |
| 570 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 571 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
| 572 | #if defined(CONFIG_MTD_M25P80) \ |
| 573 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 574 | { |
| 575 | /* the modalias must be the same as spi device driver name */ |
| 576 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 577 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
| 578 | .bus_num = 0, /* Framework bus number */ |
| 579 | .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/ |
| 580 | .platform_data = &bfin_spi_flash_data, |
| 581 | .controller_data = &spi_flash_chip_info, |
| 582 | .mode = SPI_MODE_3, |
| 583 | }, |
| 584 | #endif |
| 585 | |
| 586 | #if defined(CONFIG_SPI_ADC_BF533) \ |
| 587 | || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 588 | { |
| 589 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ |
| 590 | .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ |
| 591 | .bus_num = 0, /* Framework bus number */ |
| 592 | .chip_select = 1, /* Framework chip select. */ |
| 593 | .platform_data = NULL, /* No spi_driver specific config */ |
| 594 | .controller_data = &spi_adc_chip_info, |
| 595 | }, |
| 596 | #endif |
| 597 | |
| 598 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
| 599 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 600 | { |
| 601 | .modalias = "ad1836-spi", |
| 602 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 603 | .bus_num = 0, |
| 604 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, |
| 605 | .controller_data = &ad1836_spi_chip_info, |
| 606 | }, |
| 607 | #endif |
| 608 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) |
| 609 | { |
| 610 | .modalias = "ad9960-spi", |
| 611 | .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */ |
| 612 | .bus_num = 0, |
| 613 | .chip_select = 1, |
| 614 | .controller_data = &ad9960_spi_chip_info, |
| 615 | }, |
| 616 | #endif |
| 617 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 618 | { |
| 619 | .modalias = "spi_mmc_dummy", |
| 620 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
| 621 | .bus_num = 0, |
| 622 | .chip_select = 0, |
| 623 | .platform_data = NULL, |
| 624 | .controller_data = &spi_mmc_chip_info, |
| 625 | .mode = SPI_MODE_3, |
| 626 | }, |
| 627 | { |
| 628 | .modalias = "spi_mmc", |
| 629 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
| 630 | .bus_num = 0, |
| 631 | .chip_select = CONFIG_SPI_MMC_CS_CHAN, |
| 632 | .platform_data = NULL, |
| 633 | .controller_data = &spi_mmc_chip_info, |
| 634 | .mode = SPI_MODE_3, |
| 635 | }, |
| 636 | #endif |
| 637 | #if defined(CONFIG_PBX) |
| 638 | { |
| 639 | .modalias = "fxs-spi", |
| 640 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
| 641 | .bus_num = 0, |
| 642 | .chip_select = 8 - CONFIG_J11_JUMPER, |
| 643 | .controller_data = &spi_si3xxx_chip_info, |
| 644 | .mode = SPI_MODE_3, |
| 645 | }, |
| 646 | { |
| 647 | .modalias = "fxo-spi", |
| 648 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
| 649 | .bus_num = 0, |
| 650 | .chip_select = 8 - CONFIG_J19_JUMPER, |
| 651 | .controller_data = &spi_si3xxx_chip_info, |
| 652 | .mode = SPI_MODE_3, |
| 653 | }, |
| 654 | #endif |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 655 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 656 | { |
| 657 | .modalias = "ad7877", |
| 658 | .platform_data = &bfin_ad7877_ts_info, |
Bryan Wu | 2eb74ae | 2008-05-31 15:17:25 +0800 | [diff] [blame] | 659 | .irq = IRQ_PF8, |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 660 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
Michael Hennerich | 0954f70 | 2007-11-13 00:16:19 +0800 | [diff] [blame] | 661 | .bus_num = 0, |
Bryan Wu | 2eb74ae | 2008-05-31 15:17:25 +0800 | [diff] [blame] | 662 | .chip_select = 2, |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 663 | .controller_data = &spi_ad7877_chip_info, |
| 664 | }, |
| 665 | #endif |
Michael Hennerich | c7d4896 | 2007-11-15 21:33:31 +0800 | [diff] [blame] | 666 | #if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \ |
Michael Hennerich | 0954f70 | 2007-11-13 00:16:19 +0800 | [diff] [blame] | 667 | && defined(CONFIG_SND_SOC_WM8731_SPI) |
| 668 | { |
| 669 | .modalias = "wm8731", |
| 670 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 671 | .bus_num = 0, |
| 672 | .chip_select = 5, |
| 673 | .controller_data = &spi_wm8731_chip_info, |
| 674 | .mode = SPI_MODE_0, |
| 675 | }, |
| 676 | #endif |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 677 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 678 | { |
| 679 | .modalias = "spidev", |
| 680 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 681 | .bus_num = 0, |
| 682 | .chip_select = 1, |
| 683 | .controller_data = &spidev_chip_info, |
| 684 | }, |
| 685 | #endif |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 686 | }; |
| 687 | |
Mike Frysinger | 5bda272 | 2008-06-07 15:03:01 +0800 | [diff] [blame] | 688 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 689 | /* SPI controller data */ |
| 690 | static struct bfin5xx_spi_master bfin_spi0_info = { |
| 691 | .num_chipselect = 8, |
| 692 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 693 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 694 | }; |
| 695 | |
| 696 | /* SPI (0) */ |
| 697 | static struct resource bfin_spi0_resource[] = { |
| 698 | [0] = { |
| 699 | .start = SPI0_REGBASE, |
| 700 | .end = SPI0_REGBASE + 0xFF, |
| 701 | .flags = IORESOURCE_MEM, |
| 702 | }, |
| 703 | [1] = { |
| 704 | .start = CH_SPI, |
| 705 | .end = CH_SPI, |
| 706 | .flags = IORESOURCE_IRQ, |
| 707 | }, |
| 708 | }; |
| 709 | |
| 710 | static struct platform_device bfin_spi0_device = { |
| 711 | .name = "bfin-spi", |
| 712 | .id = 0, /* Bus number */ |
| 713 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 714 | .resource = bfin_spi0_resource, |
| 715 | .dev = { |
| 716 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
| 717 | }, |
| 718 | }; |
| 719 | #endif /* spi master and devices */ |
| 720 | |
| 721 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) |
| 722 | static struct platform_device bfin_fb_device = { |
| 723 | .name = "bf537-lq035", |
| 724 | }; |
| 725 | #endif |
| 726 | |
| 727 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
| 728 | static struct platform_device bfin_fb_adv7393_device = { |
| 729 | .name = "bfin-adv7393", |
| 730 | }; |
| 731 | #endif |
| 732 | |
| 733 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 734 | static struct resource bfin_uart_resources[] = { |
| 735 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 736 | { |
| 737 | .start = 0xFFC00400, |
| 738 | .end = 0xFFC004FF, |
| 739 | .flags = IORESOURCE_MEM, |
| 740 | }, |
| 741 | #endif |
| 742 | #ifdef CONFIG_SERIAL_BFIN_UART1 |
| 743 | { |
| 744 | .start = 0xFFC02000, |
| 745 | .end = 0xFFC020FF, |
| 746 | .flags = IORESOURCE_MEM, |
| 747 | }, |
| 748 | #endif |
| 749 | }; |
| 750 | |
| 751 | static struct platform_device bfin_uart_device = { |
| 752 | .name = "bfin-uart", |
| 753 | .id = 1, |
| 754 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 755 | .resource = bfin_uart_resources, |
| 756 | }; |
| 757 | #endif |
| 758 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 759 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
| 760 | static struct resource bfin_sir_resources[] = { |
| 761 | #ifdef CONFIG_BFIN_SIR0 |
| 762 | { |
| 763 | .start = 0xFFC00400, |
| 764 | .end = 0xFFC004FF, |
| 765 | .flags = IORESOURCE_MEM, |
| 766 | }, |
| 767 | #endif |
| 768 | #ifdef CONFIG_BFIN_SIR1 |
| 769 | { |
| 770 | .start = 0xFFC02000, |
| 771 | .end = 0xFFC020FF, |
| 772 | .flags = IORESOURCE_MEM, |
| 773 | }, |
| 774 | #endif |
| 775 | }; |
| 776 | |
| 777 | static struct platform_device bfin_sir_device = { |
| 778 | .name = "bfin_sir", |
| 779 | .id = 0, |
| 780 | .num_resources = ARRAY_SIZE(bfin_sir_resources), |
| 781 | .resource = bfin_sir_resources, |
| 782 | }; |
| 783 | #endif |
| 784 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 785 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 786 | static struct resource bfin_twi0_resource[] = { |
| 787 | [0] = { |
| 788 | .start = TWI0_REGBASE, |
| 789 | .end = TWI0_REGBASE, |
| 790 | .flags = IORESOURCE_MEM, |
| 791 | }, |
| 792 | [1] = { |
| 793 | .start = IRQ_TWI, |
| 794 | .end = IRQ_TWI, |
| 795 | .flags = IORESOURCE_IRQ, |
| 796 | }, |
| 797 | }; |
| 798 | |
| 799 | static struct platform_device i2c_bfin_twi_device = { |
| 800 | .name = "i2c-bfin-twi", |
| 801 | .id = 0, |
| 802 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), |
| 803 | .resource = bfin_twi0_resource, |
| 804 | }; |
| 805 | #endif |
| 806 | |
Bryan Wu | 7226868 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 807 | #ifdef CONFIG_I2C_BOARDINFO |
| 808 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
| 809 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) |
| 810 | { |
| 811 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), |
Bryan Wu | 7226868 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 812 | }, |
| 813 | #endif |
| 814 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) |
| 815 | { |
| 816 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), |
Bryan Wu | 7226868 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 817 | .irq = IRQ_PF8, |
| 818 | }, |
| 819 | #endif |
| 820 | }; |
| 821 | #endif |
| 822 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 823 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 824 | static struct platform_device bfin_sport0_uart_device = { |
| 825 | .name = "bfin-sport-uart", |
| 826 | .id = 0, |
| 827 | }; |
| 828 | |
| 829 | static struct platform_device bfin_sport1_uart_device = { |
| 830 | .name = "bfin-sport-uart", |
| 831 | .id = 1, |
| 832 | }; |
| 833 | #endif |
| 834 | |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 835 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 836 | #include <linux/input.h> |
| 837 | #include <linux/gpio_keys.h> |
| 838 | |
| 839 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
| 840 | {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"}, |
| 841 | {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"}, |
| 842 | }; |
| 843 | |
| 844 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 845 | .buttons = bfin_gpio_keys_table, |
| 846 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 847 | }; |
| 848 | |
| 849 | static struct platform_device bfin_device_gpiokeys = { |
| 850 | .name = "gpio-keys", |
| 851 | .dev = { |
| 852 | .platform_data = &bfin_gpio_keys_data, |
| 853 | }, |
| 854 | }; |
| 855 | #endif |
| 856 | |
Mike Frysinger | cad2ab6 | 2008-02-22 17:01:31 +0800 | [diff] [blame] | 857 | static struct resource bfin_gpios_resources = { |
| 858 | .start = 0, |
| 859 | .end = MAX_BLACKFIN_GPIOS - 1, |
| 860 | .flags = IORESOURCE_IRQ, |
| 861 | }; |
| 862 | |
| 863 | static struct platform_device bfin_gpios_device = { |
| 864 | .name = "simple-gpio", |
| 865 | .id = -1, |
| 866 | .num_resources = 1, |
| 867 | .resource = &bfin_gpios_resources, |
| 868 | }; |
| 869 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 870 | static const unsigned int cclk_vlev_datasheet[] = |
| 871 | { |
| 872 | VRPAIR(VLEV_100, 400000000), |
| 873 | VRPAIR(VLEV_105, 426000000), |
| 874 | VRPAIR(VLEV_110, 500000000), |
| 875 | VRPAIR(VLEV_115, 533000000), |
| 876 | VRPAIR(VLEV_120, 600000000), |
| 877 | }; |
| 878 | |
| 879 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { |
| 880 | .tuple_tab = cclk_vlev_datasheet, |
| 881 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), |
| 882 | .vr_settling_time = 25 /* us */, |
| 883 | }; |
| 884 | |
| 885 | static struct platform_device bfin_dpmc = { |
| 886 | .name = "bfin dpmc", |
| 887 | .dev = { |
| 888 | .platform_data = &bfin_dmpc_vreg_data, |
| 889 | }, |
| 890 | }; |
| 891 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 892 | static struct platform_device *stamp_devices[] __initdata = { |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 893 | |
| 894 | &bfin_dpmc, |
| 895 | |
Michael Hennerich | 64307f7 | 2007-10-29 16:55:18 +0800 | [diff] [blame] | 896 | #if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) |
| 897 | &bf5xx_nand_device, |
| 898 | #endif |
| 899 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 900 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
| 901 | &bfin_pcmcia_cf_device, |
| 902 | #endif |
| 903 | |
| 904 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 905 | &rtc_device, |
| 906 | #endif |
| 907 | |
| 908 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) |
| 909 | &sl811_hcd_device, |
| 910 | #endif |
| 911 | |
| 912 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 913 | &isp1362_hcd_device, |
| 914 | #endif |
| 915 | |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 916 | #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) |
| 917 | &musb_device, |
| 918 | #endif |
| 919 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 920 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 921 | &smc91x_device, |
| 922 | #endif |
| 923 | |
| 924 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 925 | &dm9000_device, |
| 926 | #endif |
| 927 | |
| 928 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
| 929 | &bfin_mac_device, |
| 930 | #endif |
| 931 | |
| 932 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 933 | &net2272_bfin_device, |
| 934 | #endif |
| 935 | |
| 936 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 937 | &bfin_spi0_device, |
| 938 | #endif |
| 939 | |
| 940 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) |
| 941 | &bfin_fb_device, |
| 942 | #endif |
| 943 | |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 944 | #if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE) |
| 945 | &bf52x_t350mcqb_device, |
| 946 | #endif |
| 947 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 948 | #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) |
| 949 | &bfin_fb_adv7393_device, |
| 950 | #endif |
| 951 | |
| 952 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 953 | &bfin_uart_device, |
| 954 | #endif |
| 955 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 956 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
| 957 | &bfin_sir_device, |
| 958 | #endif |
| 959 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 960 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 961 | &i2c_bfin_twi_device, |
| 962 | #endif |
| 963 | |
| 964 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 965 | &bfin_sport0_uart_device, |
| 966 | &bfin_sport1_uart_device, |
| 967 | #endif |
| 968 | |
Michael Hennerich | 1089e22 | 2007-12-24 11:49:29 +0800 | [diff] [blame] | 969 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 970 | &bfin_device_gpiokeys, |
| 971 | #endif |
Mike Frysinger | cad2ab6 | 2008-02-22 17:01:31 +0800 | [diff] [blame] | 972 | |
Michael Hennerich | d7e5dd4 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 973 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
| 974 | &ezkit_flash_device, |
| 975 | #endif |
| 976 | |
Mike Frysinger | cad2ab6 | 2008-02-22 17:01:31 +0800 | [diff] [blame] | 977 | &bfin_gpios_device, |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 978 | }; |
| 979 | |
| 980 | static int __init stamp_init(void) |
| 981 | { |
Harvey Harrison | b85d858 | 2008-04-23 09:39:01 +0800 | [diff] [blame] | 982 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
Bryan Wu | 7226868 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 983 | |
| 984 | #ifdef CONFIG_I2C_BOARDINFO |
| 985 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 986 | ARRAY_SIZE(bfin_i2c_board_info)); |
| 987 | #endif |
| 988 | |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 989 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
Mike Frysinger | 5bda272 | 2008-06-07 15:03:01 +0800 | [diff] [blame] | 990 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
Michael Hennerich | 5900314 | 2007-10-21 16:54:27 +0800 | [diff] [blame] | 991 | return 0; |
| 992 | } |
| 993 | |
| 994 | arch_initcall(stamp_init); |
| 995 | |
| 996 | void native_machine_restart(char *cmd) |
| 997 | { |
| 998 | /* workaround reboot hang when booting from SPI */ |
| 999 | if ((bfin_read_SYSCR() & 0x7) == 0x3) |
| 1000 | bfin_gpio_reset_spi0_ssel1(); |
| 1001 | } |
Mike Frysinger | 137b152 | 2007-11-22 16:07:03 +0800 | [diff] [blame] | 1002 | |
Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 1003 | void bfin_get_ether_addr(char *addr) |
Mike Frysinger | 137b152 | 2007-11-22 16:07:03 +0800 | [diff] [blame] | 1004 | { |
Mike Frysinger | 181afa94 | 2008-02-25 11:42:17 +0800 | [diff] [blame] | 1005 | /* the MAC is stored in OTP memory page 0xDF */ |
| 1006 | u32 ret; |
| 1007 | u64 otp_mac; |
| 1008 | u32 (*otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)0xEF00001A; |
| 1009 | |
| 1010 | ret = otp_read(0xDF, 0x00, &otp_mac); |
| 1011 | if (!(ret & 0x1)) { |
| 1012 | char *otp_mac_p = (char *)&otp_mac; |
| 1013 | for (ret = 0; ret < 6; ++ret) |
| 1014 | addr[ret] = otp_mac_p[5 - ret]; |
| 1015 | } |
Mike Frysinger | 137b152 | 2007-11-22 16:07:03 +0800 | [diff] [blame] | 1016 | } |
Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 1017 | EXPORT_SYMBOL(bfin_get_ether_addr); |