Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * File: arch/blackfin/mach-bf537/boards/cm_bf537.c |
| 3 | * Based on: arch/blackfin/mach-bf533/boards/ezkit.c |
| 4 | * Author: Aidan Williams <aidan@nicta.com.au> |
| 5 | * |
| 6 | * Created: 2005 |
| 7 | * Description: Board description file |
| 8 | * |
| 9 | * Modified: |
| 10 | * Copyright 2005 National ICT Australia (NICTA) |
| 11 | * Copyright 2004-2006 Analog Devices Inc. |
| 12 | * |
| 13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
| 14 | * |
| 15 | * This program is free software; you can redistribute it and/or modify |
| 16 | * it under the terms of the GNU General Public License as published by |
| 17 | * the Free Software Foundation; either version 2 of the License, or |
| 18 | * (at your option) any later version. |
| 19 | * |
| 20 | * This program is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | * GNU General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License |
| 26 | * along with this program; if not, see the file COPYING, or write |
| 27 | * to the Free Software Foundation, Inc., |
| 28 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 29 | */ |
| 30 | |
| 31 | #include <linux/device.h> |
Mike Frysinger | 43f73fe | 2007-12-24 19:35:35 +0800 | [diff] [blame] | 32 | #include <linux/etherdevice.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 33 | #include <linux/platform_device.h> |
| 34 | #include <linux/mtd/mtd.h> |
| 35 | #include <linux/mtd/partitions.h> |
Mike Frysinger | 8ea8949 | 2008-08-05 18:14:44 +0800 | [diff] [blame] | 36 | #include <linux/mtd/physmap.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 37 | #include <linux/spi/spi.h> |
| 38 | #include <linux/spi/flash.h> |
Mike Frysinger | b964c59 | 2008-05-10 00:06:10 +0800 | [diff] [blame] | 39 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
Mike Frysinger | f02bcec | 2007-11-15 21:29:15 +0800 | [diff] [blame] | 40 | #include <linux/usb/isp1362.h> |
Mike Frysinger | b964c59 | 2008-05-10 00:06:10 +0800 | [diff] [blame] | 41 | #endif |
Jeff Garzik | 0a87e3e | 2008-02-01 18:02:30 -0500 | [diff] [blame] | 42 | #include <linux/ata_platform.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 43 | #include <linux/irq.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 44 | #include <asm/dma.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 45 | #include <asm/bfin5xx_spi.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 46 | #include <asm/portmux.h> |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 47 | #include <asm/dpmc.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 48 | |
| 49 | /* |
| 50 | * Name the Board for the /proc/cpuinfo |
| 51 | */ |
Mike Frysinger | 066954a | 2007-10-21 22:36:06 +0800 | [diff] [blame] | 52 | const char bfin_board_name[] = "Bluetechnix CM BF537"; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 53 | |
| 54 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 55 | /* all SPI peripherals info goes here */ |
| 56 | |
| 57 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 58 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 59 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 60 | .name = "bootloader(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 61 | .size = 0x00020000, |
| 62 | .offset = 0, |
| 63 | .mask_flags = MTD_CAP_ROM |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 64 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 65 | .name = "linux kernel(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 66 | .size = 0xe0000, |
| 67 | .offset = 0x20000 |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 68 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 69 | .name = "file system(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 70 | .size = 0x700000, |
| 71 | .offset = 0x00100000, |
| 72 | } |
| 73 | }; |
| 74 | |
| 75 | static struct flash_platform_data bfin_spi_flash_data = { |
| 76 | .name = "m25p80", |
| 77 | .parts = bfin_spi_flash_partitions, |
| 78 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 79 | .type = "m25p64", |
| 80 | }; |
| 81 | |
| 82 | /* SPI flash chip (m25p64) */ |
| 83 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 84 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 85 | .bits_per_word = 8, |
| 86 | }; |
| 87 | #endif |
| 88 | |
| 89 | #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 90 | /* SPI ADC chip */ |
| 91 | static struct bfin5xx_spi_chip spi_adc_chip_info = { |
| 92 | .enable_dma = 1, /* use dma transfer with this chip*/ |
| 93 | .bits_per_word = 16, |
| 94 | }; |
| 95 | #endif |
| 96 | |
| 97 | #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 98 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 99 | .enable_dma = 0, |
| 100 | .bits_per_word = 16, |
| 101 | }; |
| 102 | #endif |
| 103 | |
| 104 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) |
| 105 | static struct bfin5xx_spi_chip ad9960_spi_chip_info = { |
| 106 | .enable_dma = 0, |
| 107 | .bits_per_word = 16, |
| 108 | }; |
| 109 | #endif |
| 110 | |
| 111 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 112 | static struct bfin5xx_spi_chip spi_mmc_chip_info = { |
| 113 | .enable_dma = 1, |
| 114 | .bits_per_word = 8, |
| 115 | }; |
| 116 | #endif |
| 117 | |
| 118 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
| 119 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 120 | { |
| 121 | /* the modalias must be the same as spi device driver name */ |
| 122 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 123 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 124 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 125 | .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/ |
| 126 | .platform_data = &bfin_spi_flash_data, |
| 127 | .controller_data = &spi_flash_chip_info, |
| 128 | .mode = SPI_MODE_3, |
| 129 | }, |
| 130 | #endif |
| 131 | |
| 132 | #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 133 | { |
| 134 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ |
| 135 | .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 136 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 137 | .chip_select = 1, /* Framework chip select. */ |
| 138 | .platform_data = NULL, /* No spi_driver specific config */ |
| 139 | .controller_data = &spi_adc_chip_info, |
| 140 | }, |
| 141 | #endif |
| 142 | |
| 143 | #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 144 | { |
| 145 | .modalias = "ad1836-spi", |
| 146 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 147 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 148 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, |
| 149 | .controller_data = &ad1836_spi_chip_info, |
| 150 | }, |
| 151 | #endif |
| 152 | |
| 153 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) |
| 154 | { |
| 155 | .modalias = "ad9960-spi", |
| 156 | .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 157 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 158 | .chip_select = 1, |
| 159 | .controller_data = &ad9960_spi_chip_info, |
| 160 | }, |
| 161 | #endif |
| 162 | |
| 163 | #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE) |
| 164 | { |
| 165 | .modalias = "spi_mmc_dummy", |
| 166 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 167 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 168 | .chip_select = 7, |
| 169 | .platform_data = NULL, |
| 170 | .controller_data = &spi_mmc_chip_info, |
| 171 | .mode = SPI_MODE_3, |
| 172 | }, |
| 173 | { |
| 174 | .modalias = "spi_mmc", |
| 175 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 176 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 177 | .chip_select = CONFIG_SPI_MMC_CS_CHAN, |
| 178 | .platform_data = NULL, |
| 179 | .controller_data = &spi_mmc_chip_info, |
| 180 | .mode = SPI_MODE_3, |
| 181 | }, |
| 182 | #endif |
| 183 | }; |
| 184 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 185 | /* SPI (0) */ |
| 186 | static struct resource bfin_spi0_resource[] = { |
| 187 | [0] = { |
| 188 | .start = SPI0_REGBASE, |
| 189 | .end = SPI0_REGBASE + 0xFF, |
| 190 | .flags = IORESOURCE_MEM, |
| 191 | }, |
| 192 | [1] = { |
| 193 | .start = CH_SPI, |
| 194 | .end = CH_SPI, |
| 195 | .flags = IORESOURCE_IRQ, |
| 196 | } |
| 197 | }; |
| 198 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 199 | /* SPI controller data */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 200 | static struct bfin5xx_spi_master bfin_spi0_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 201 | .num_chipselect = 8, |
| 202 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 203 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 204 | }; |
| 205 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 206 | static struct platform_device bfin_spi0_device = { |
| 207 | .name = "bfin-spi", |
| 208 | .id = 0, /* Bus number */ |
| 209 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 210 | .resource = bfin_spi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 211 | .dev = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 212 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 213 | }, |
| 214 | }; |
| 215 | #endif /* spi master and devices */ |
| 216 | |
| 217 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 218 | static struct platform_device rtc_device = { |
| 219 | .name = "rtc-bfin", |
| 220 | .id = -1, |
| 221 | }; |
| 222 | #endif |
| 223 | |
Michael Hennerich | 0d4a89b | 2008-01-27 19:58:46 +0800 | [diff] [blame] | 224 | #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE) |
| 225 | static struct platform_device hitachi_fb_device = { |
| 226 | .name = "hitachi-tx09", |
| 227 | }; |
| 228 | #endif |
| 229 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 230 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 231 | static struct resource smc91x_resources[] = { |
| 232 | { |
| 233 | .start = 0x20200300, |
| 234 | .end = 0x20200300 + 16, |
| 235 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 236 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 237 | .start = IRQ_PF14, |
| 238 | .end = IRQ_PF14, |
| 239 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 240 | }, |
| 241 | }; |
| 242 | |
| 243 | static struct platform_device smc91x_device = { |
| 244 | .name = "smc91x", |
| 245 | .id = 0, |
| 246 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 247 | .resource = smc91x_resources, |
| 248 | }; |
| 249 | #endif |
| 250 | |
| 251 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 252 | static struct resource isp1362_hcd_resources[] = { |
| 253 | { |
| 254 | .start = 0x20308000, |
| 255 | .end = 0x20308000, |
| 256 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 257 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 258 | .start = 0x20308004, |
| 259 | .end = 0x20308004, |
| 260 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 261 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 262 | .start = IRQ_PG15, |
| 263 | .end = IRQ_PG15, |
| 264 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 265 | }, |
| 266 | }; |
| 267 | |
| 268 | static struct isp1362_platform_data isp1362_priv = { |
| 269 | .sel15Kres = 1, |
| 270 | .clknotstop = 0, |
| 271 | .oc_enable = 0, |
| 272 | .int_act_high = 0, |
| 273 | .int_edge_triggered = 0, |
| 274 | .remote_wakeup_connected = 0, |
| 275 | .no_power_switching = 1, |
| 276 | .power_switching_mode = 0, |
| 277 | }; |
| 278 | |
| 279 | static struct platform_device isp1362_hcd_device = { |
| 280 | .name = "isp1362-hcd", |
| 281 | .id = 0, |
| 282 | .dev = { |
| 283 | .platform_data = &isp1362_priv, |
| 284 | }, |
| 285 | .num_resources = ARRAY_SIZE(isp1362_hcd_resources), |
| 286 | .resource = isp1362_hcd_resources, |
| 287 | }; |
| 288 | #endif |
| 289 | |
| 290 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 291 | static struct resource net2272_bfin_resources[] = { |
| 292 | { |
| 293 | .start = 0x20200000, |
| 294 | .end = 0x20200000 + 0x100, |
| 295 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 296 | }, { |
Michael Hennerich | 8ecc736 | 2007-10-29 17:24:23 +0800 | [diff] [blame] | 297 | .start = IRQ_PH14, |
| 298 | .end = IRQ_PH14, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 299 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 300 | }, |
| 301 | }; |
| 302 | |
| 303 | static struct platform_device net2272_bfin_device = { |
| 304 | .name = "net2272", |
| 305 | .id = -1, |
| 306 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), |
| 307 | .resource = net2272_bfin_resources, |
| 308 | }; |
| 309 | #endif |
| 310 | |
Mike Frysinger | c97618d | 2009-01-07 23:14:38 +0800 | [diff] [blame] | 311 | static struct resource bfin_gpios_resources = { |
| 312 | .start = 0, |
| 313 | .end = MAX_BLACKFIN_GPIOS - 1, |
| 314 | .flags = IORESOURCE_IRQ, |
| 315 | }; |
| 316 | |
| 317 | static struct platform_device bfin_gpios_device = { |
| 318 | .name = "simple-gpio", |
| 319 | .id = -1, |
| 320 | .num_resources = 1, |
| 321 | .resource = &bfin_gpios_resources, |
| 322 | }; |
| 323 | |
Mike Frysinger | 8ea8949 | 2008-08-05 18:14:44 +0800 | [diff] [blame] | 324 | #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE) |
| 325 | static struct mtd_partition cm_partitions[] = { |
| 326 | { |
| 327 | .name = "bootloader(nor)", |
| 328 | .size = 0x40000, |
| 329 | .offset = 0, |
| 330 | }, { |
| 331 | .name = "linux kernel(nor)", |
| 332 | .size = 0xE0000, |
| 333 | .offset = MTDPART_OFS_APPEND, |
| 334 | }, { |
| 335 | .name = "file system(nor)", |
| 336 | .size = MTDPART_SIZ_FULL, |
| 337 | .offset = MTDPART_OFS_APPEND, |
| 338 | } |
| 339 | }; |
| 340 | |
| 341 | static struct physmap_flash_data cm_flash_data = { |
| 342 | .width = 2, |
| 343 | .parts = cm_partitions, |
| 344 | .nr_parts = ARRAY_SIZE(cm_partitions), |
| 345 | }; |
| 346 | |
| 347 | static unsigned cm_flash_gpios[] = { GPIO_PF4 }; |
| 348 | |
| 349 | static struct resource cm_flash_resource[] = { |
| 350 | { |
| 351 | .name = "cfi_probe", |
| 352 | .start = 0x20000000, |
| 353 | .end = 0x201fffff, |
| 354 | .flags = IORESOURCE_MEM, |
| 355 | }, { |
| 356 | .start = (unsigned long)cm_flash_gpios, |
| 357 | .end = ARRAY_SIZE(cm_flash_gpios), |
| 358 | .flags = IORESOURCE_IRQ, |
| 359 | } |
| 360 | }; |
| 361 | |
| 362 | static struct platform_device cm_flash_device = { |
| 363 | .name = "gpio-addr-flash", |
| 364 | .id = 0, |
| 365 | .dev = { |
| 366 | .platform_data = &cm_flash_data, |
| 367 | }, |
| 368 | .num_resources = ARRAY_SIZE(cm_flash_resource), |
| 369 | .resource = cm_flash_resource, |
| 370 | }; |
| 371 | #endif |
| 372 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 373 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 374 | static struct resource bfin_uart_resources[] = { |
| 375 | { |
| 376 | .start = 0xFFC00400, |
| 377 | .end = 0xFFC004FF, |
| 378 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 379 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 380 | .start = 0xFFC02000, |
| 381 | .end = 0xFFC020FF, |
| 382 | .flags = IORESOURCE_MEM, |
| 383 | }, |
| 384 | }; |
| 385 | |
| 386 | static struct platform_device bfin_uart_device = { |
| 387 | .name = "bfin-uart", |
| 388 | .id = 1, |
| 389 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 390 | .resource = bfin_uart_resources, |
| 391 | }; |
| 392 | #endif |
| 393 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 394 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 395 | #ifdef CONFIG_BFIN_SIR0 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 396 | static struct resource bfin_sir0_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 397 | { |
| 398 | .start = 0xFFC00400, |
| 399 | .end = 0xFFC004FF, |
| 400 | .flags = IORESOURCE_MEM, |
| 401 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 402 | { |
| 403 | .start = IRQ_UART0_RX, |
| 404 | .end = IRQ_UART0_RX+1, |
| 405 | .flags = IORESOURCE_IRQ, |
| 406 | }, |
| 407 | { |
| 408 | .start = CH_UART0_RX, |
| 409 | .end = CH_UART0_RX+1, |
| 410 | .flags = IORESOURCE_DMA, |
| 411 | }, |
| 412 | }; |
| 413 | static struct platform_device bfin_sir0_device = { |
| 414 | .name = "bfin_sir", |
| 415 | .id = 0, |
| 416 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
| 417 | .resource = bfin_sir0_resources, |
| 418 | }; |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 419 | #endif |
| 420 | #ifdef CONFIG_BFIN_SIR1 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 421 | static struct resource bfin_sir1_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 422 | { |
| 423 | .start = 0xFFC02000, |
| 424 | .end = 0xFFC020FF, |
| 425 | .flags = IORESOURCE_MEM, |
| 426 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 427 | { |
| 428 | .start = IRQ_UART1_RX, |
| 429 | .end = IRQ_UART1_RX+1, |
| 430 | .flags = IORESOURCE_IRQ, |
| 431 | }, |
| 432 | { |
| 433 | .start = CH_UART1_RX, |
| 434 | .end = CH_UART1_RX+1, |
| 435 | .flags = IORESOURCE_DMA, |
| 436 | }, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 437 | }; |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 438 | static struct platform_device bfin_sir1_device = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 439 | .name = "bfin_sir", |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 440 | .id = 1, |
| 441 | .num_resources = ARRAY_SIZE(bfin_sir1_resources), |
| 442 | .resource = bfin_sir1_resources, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 443 | }; |
| 444 | #endif |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 445 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 446 | |
Mike Frysinger | 56ce835 | 2008-03-26 06:00:18 +0800 | [diff] [blame] | 447 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 448 | static struct resource bfin_twi0_resource[] = { |
| 449 | [0] = { |
| 450 | .start = TWI0_REGBASE, |
| 451 | .end = TWI0_REGBASE, |
| 452 | .flags = IORESOURCE_MEM, |
| 453 | }, |
| 454 | [1] = { |
| 455 | .start = IRQ_TWI, |
| 456 | .end = IRQ_TWI, |
| 457 | .flags = IORESOURCE_IRQ, |
| 458 | }, |
| 459 | }; |
| 460 | |
| 461 | static struct platform_device i2c_bfin_twi_device = { |
| 462 | .name = "i2c-bfin-twi", |
| 463 | .id = 0, |
| 464 | .num_resources = ARRAY_SIZE(bfin_twi0_resource), |
| 465 | .resource = bfin_twi0_resource, |
| 466 | }; |
| 467 | #endif |
| 468 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 469 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 470 | static struct platform_device bfin_sport0_uart_device = { |
| 471 | .name = "bfin-sport-uart", |
| 472 | .id = 0, |
| 473 | }; |
| 474 | |
| 475 | static struct platform_device bfin_sport1_uart_device = { |
| 476 | .name = "bfin-sport-uart", |
| 477 | .id = 1, |
| 478 | }; |
| 479 | #endif |
| 480 | |
| 481 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
Graf Yang | 6531962 | 2009-02-04 16:49:45 +0800 | [diff] [blame^] | 482 | static struct platform_device bfin_mii_bus = { |
| 483 | .name = "bfin_mii_bus", |
| 484 | }; |
| 485 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 486 | static struct platform_device bfin_mac_device = { |
| 487 | .name = "bfin_mac", |
Graf Yang | 6531962 | 2009-02-04 16:49:45 +0800 | [diff] [blame^] | 488 | .dev.platform_data = &bfin_mii_bus, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 489 | }; |
| 490 | #endif |
| 491 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 492 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
Mike Frysinger | fe5aeb9 | 2008-08-05 18:29:56 +0800 | [diff] [blame] | 493 | #define PATA_INT IRQ_PF14 |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 494 | |
| 495 | static struct pata_platform_info bfin_pata_platform_data = { |
| 496 | .ioport_shift = 2, |
| 497 | .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, |
| 498 | }; |
| 499 | |
| 500 | static struct resource bfin_pata_resources[] = { |
| 501 | { |
| 502 | .start = 0x2030C000, |
| 503 | .end = 0x2030C01F, |
| 504 | .flags = IORESOURCE_MEM, |
| 505 | }, |
| 506 | { |
| 507 | .start = 0x2030D018, |
| 508 | .end = 0x2030D01B, |
| 509 | .flags = IORESOURCE_MEM, |
| 510 | }, |
| 511 | { |
| 512 | .start = PATA_INT, |
| 513 | .end = PATA_INT, |
| 514 | .flags = IORESOURCE_IRQ, |
| 515 | }, |
| 516 | }; |
| 517 | |
| 518 | static struct platform_device bfin_pata_device = { |
| 519 | .name = "pata_platform", |
| 520 | .id = -1, |
| 521 | .num_resources = ARRAY_SIZE(bfin_pata_resources), |
| 522 | .resource = bfin_pata_resources, |
| 523 | .dev = { |
| 524 | .platform_data = &bfin_pata_platform_data, |
| 525 | } |
| 526 | }; |
| 527 | #endif |
| 528 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 529 | static const unsigned int cclk_vlev_datasheet[] = |
| 530 | { |
| 531 | VRPAIR(VLEV_085, 250000000), |
| 532 | VRPAIR(VLEV_090, 376000000), |
| 533 | VRPAIR(VLEV_095, 426000000), |
| 534 | VRPAIR(VLEV_100, 426000000), |
| 535 | VRPAIR(VLEV_105, 476000000), |
| 536 | VRPAIR(VLEV_110, 476000000), |
| 537 | VRPAIR(VLEV_115, 476000000), |
| 538 | VRPAIR(VLEV_120, 500000000), |
| 539 | VRPAIR(VLEV_125, 533000000), |
| 540 | VRPAIR(VLEV_130, 600000000), |
| 541 | }; |
| 542 | |
| 543 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { |
| 544 | .tuple_tab = cclk_vlev_datasheet, |
| 545 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), |
| 546 | .vr_settling_time = 25 /* us */, |
| 547 | }; |
| 548 | |
| 549 | static struct platform_device bfin_dpmc = { |
| 550 | .name = "bfin dpmc", |
| 551 | .dev = { |
| 552 | .platform_data = &bfin_dmpc_vreg_data, |
| 553 | }, |
| 554 | }; |
| 555 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 556 | static struct platform_device *cm_bf537_devices[] __initdata = { |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 557 | |
| 558 | &bfin_dpmc, |
| 559 | |
Michael Hennerich | 0d4a89b | 2008-01-27 19:58:46 +0800 | [diff] [blame] | 560 | #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE) |
| 561 | &hitachi_fb_device, |
| 562 | #endif |
| 563 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 564 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 565 | &rtc_device, |
| 566 | #endif |
| 567 | |
| 568 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 569 | &bfin_uart_device, |
| 570 | #endif |
| 571 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 572 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 573 | #ifdef CONFIG_BFIN_SIR0 |
| 574 | &bfin_sir0_device, |
| 575 | #endif |
| 576 | #ifdef CONFIG_BFIN_SIR1 |
| 577 | &bfin_sir1_device, |
| 578 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 579 | #endif |
| 580 | |
Mike Frysinger | 56ce835 | 2008-03-26 06:00:18 +0800 | [diff] [blame] | 581 | #if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE) |
| 582 | &i2c_bfin_twi_device, |
| 583 | #endif |
| 584 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 585 | #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE) |
| 586 | &bfin_sport0_uart_device, |
| 587 | &bfin_sport1_uart_device, |
| 588 | #endif |
| 589 | |
| 590 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 591 | &isp1362_hcd_device, |
| 592 | #endif |
| 593 | |
| 594 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 595 | &smc91x_device, |
| 596 | #endif |
| 597 | |
| 598 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
Graf Yang | 6531962 | 2009-02-04 16:49:45 +0800 | [diff] [blame^] | 599 | &bfin_mii_bus, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 600 | &bfin_mac_device, |
| 601 | #endif |
| 602 | |
| 603 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 604 | &net2272_bfin_device, |
| 605 | #endif |
| 606 | |
| 607 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 608 | &bfin_spi0_device, |
| 609 | #endif |
| 610 | |
| 611 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 612 | &bfin_pata_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 613 | #endif |
Mike Frysinger | 8ea8949 | 2008-08-05 18:14:44 +0800 | [diff] [blame] | 614 | |
| 615 | #if defined(CONFIG_MTD_GPIO_ADDR) || defined(CONFIG_MTD_GPIO_ADDR_MODULE) |
| 616 | &cm_flash_device, |
| 617 | #endif |
Mike Frysinger | c97618d | 2009-01-07 23:14:38 +0800 | [diff] [blame] | 618 | |
| 619 | &bfin_gpios_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 620 | }; |
| 621 | |
| 622 | static int __init cm_bf537_init(void) |
| 623 | { |
Harvey Harrison | b85d858 | 2008-04-23 09:39:01 +0800 | [diff] [blame] | 624 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 625 | platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices)); |
| 626 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 627 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
| 628 | #endif |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 629 | |
| 630 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 631 | irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; |
| 632 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 633 | return 0; |
| 634 | } |
| 635 | |
| 636 | arch_initcall(cm_bf537_init); |
Mike Frysinger | 137b152 | 2007-11-22 16:07:03 +0800 | [diff] [blame] | 637 | |
Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 638 | void bfin_get_ether_addr(char *addr) |
Mike Frysinger | 137b152 | 2007-11-22 16:07:03 +0800 | [diff] [blame] | 639 | { |
| 640 | random_ether_addr(addr); |
| 641 | printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__); |
| 642 | } |
Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 643 | EXPORT_SYMBOL(bfin_get_ether_addr); |