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