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