Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * File: arch/blackfin/mach-bf537/boards/stamp.c |
| 3 | * Based on: arch/blackfin/mach-bf533/boards/ezkit.c |
| 4 | * Author: Aidan Williams <aidan@nicta.com.au> |
| 5 | * |
| 6 | * Created: |
| 7 | * Description: |
| 8 | * |
| 9 | * Modified: |
| 10 | * Copyright 2005 National ICT Australia (NICTA) |
Michael Hennerich | a628a8b | 2008-01-22 17:29:16 +0800 | [diff] [blame] | 11 | * Copyright 2004-2008 Analog Devices Inc. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 12 | * |
| 13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
| 14 | * |
| 15 | * This program is free software; you can redistribute it and/or modify |
| 16 | * it under the terms of the GNU General Public License as published by |
| 17 | * the Free Software Foundation; either version 2 of the License, or |
| 18 | * (at your option) any later version. |
| 19 | * |
| 20 | * This program is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | * GNU General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License |
| 26 | * along with this program; if not, see the file COPYING, or write |
| 27 | * to the Free Software Foundation, Inc., |
| 28 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 29 | */ |
| 30 | |
| 31 | #include <linux/device.h> |
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> |
| 36 | #include <linux/spi/spi.h> |
| 37 | #include <linux/spi/flash.h> |
| 38 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
Mike Frysinger | f02bcec | 2007-11-15 21:29:15 +0800 | [diff] [blame] | 39 | #include <linux/usb/isp1362.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 40 | #endif |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 41 | #include <linux/irq.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 42 | #include <asm/dma.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 43 | #include <asm/bfin5xx_spi.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 44 | #include <asm/portmux.h> |
David Brownell | 27f5d75 | 2007-10-04 18:06:16 -0700 | [diff] [blame] | 45 | #include <linux/usb/sl811.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 46 | |
| 47 | #include <linux/spi/ad7877.h> |
| 48 | |
| 49 | /* |
| 50 | * Name the Board for the /proc/cpuinfo |
| 51 | */ |
Mike Frysinger | fe85cad | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 52 | const char bfin_board_name[] = "ADI PNAV-1.0"; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 53 | |
| 54 | /* |
| 55 | * Driver needs to know address, irq and flag pin. |
| 56 | */ |
| 57 | |
| 58 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
| 59 | static struct resource bfin_pcmcia_cf_resources[] = { |
| 60 | { |
| 61 | .start = 0x20310000, /* IO PORT */ |
| 62 | .end = 0x20312000, |
| 63 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 64 | }, { |
Simon Arlott | d2d50aa | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 65 | .start = 0x20311000, /* Attribute Memory */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 66 | .end = 0x20311FFF, |
| 67 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 68 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 69 | .start = IRQ_PF4, |
| 70 | .end = IRQ_PF4, |
| 71 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 72 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 73 | .start = 6, /* Card Detect PF6 */ |
| 74 | .end = 6, |
| 75 | .flags = IORESOURCE_IRQ, |
| 76 | }, |
| 77 | }; |
| 78 | |
| 79 | static struct platform_device bfin_pcmcia_cf_device = { |
| 80 | .name = "bfin_cf_pcmcia", |
| 81 | .id = -1, |
| 82 | .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources), |
| 83 | .resource = bfin_pcmcia_cf_resources, |
| 84 | }; |
| 85 | #endif |
| 86 | |
| 87 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 88 | static struct platform_device rtc_device = { |
| 89 | .name = "rtc-bfin", |
| 90 | .id = -1, |
| 91 | }; |
| 92 | #endif |
| 93 | |
| 94 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 95 | static struct resource smc91x_resources[] = { |
| 96 | { |
| 97 | .name = "smc91x-regs", |
| 98 | .start = 0x20300300, |
| 99 | .end = 0x20300300 + 16, |
| 100 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 101 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 102 | |
| 103 | .start = IRQ_PF7, |
| 104 | .end = IRQ_PF7, |
| 105 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 106 | }, |
| 107 | }; |
| 108 | static struct platform_device smc91x_device = { |
| 109 | .name = "smc91x", |
| 110 | .id = 0, |
| 111 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 112 | .resource = smc91x_resources, |
| 113 | }; |
| 114 | #endif |
| 115 | |
| 116 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) |
| 117 | static struct resource sl811_hcd_resources[] = { |
| 118 | { |
| 119 | .start = 0x20340000, |
| 120 | .end = 0x20340000, |
| 121 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 122 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 123 | .start = 0x20340004, |
| 124 | .end = 0x20340004, |
| 125 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 126 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 127 | .start = CONFIG_USB_SL811_BFIN_IRQ, |
| 128 | .end = CONFIG_USB_SL811_BFIN_IRQ, |
| 129 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 130 | }, |
| 131 | }; |
| 132 | |
| 133 | #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS) |
| 134 | void sl811_port_power(struct device *dev, int is_on) |
| 135 | { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 136 | gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS"); |
Michael Hennerich | acbcd26 | 2008-01-22 18:36:20 +0800 | [diff] [blame] | 137 | gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 138 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 139 | } |
| 140 | #endif |
| 141 | |
| 142 | static struct sl811_platform_data sl811_priv = { |
| 143 | .potpg = 10, |
| 144 | .power = 250, /* == 500mA */ |
| 145 | #if defined(CONFIG_USB_SL811_BFIN_USE_VBUS) |
| 146 | .port_power = &sl811_port_power, |
| 147 | #endif |
| 148 | }; |
| 149 | |
| 150 | static struct platform_device sl811_hcd_device = { |
| 151 | .name = "sl811-hcd", |
| 152 | .id = 0, |
| 153 | .dev = { |
| 154 | .platform_data = &sl811_priv, |
| 155 | }, |
| 156 | .num_resources = ARRAY_SIZE(sl811_hcd_resources), |
| 157 | .resource = sl811_hcd_resources, |
| 158 | }; |
| 159 | #endif |
| 160 | |
| 161 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 162 | static struct resource isp1362_hcd_resources[] = { |
| 163 | { |
| 164 | .start = 0x20360000, |
| 165 | .end = 0x20360000, |
| 166 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 167 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 168 | .start = 0x20360004, |
| 169 | .end = 0x20360004, |
| 170 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 171 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 172 | .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ, |
| 173 | .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ, |
| 174 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 175 | }, |
| 176 | }; |
| 177 | |
| 178 | static struct isp1362_platform_data isp1362_priv = { |
| 179 | .sel15Kres = 1, |
| 180 | .clknotstop = 0, |
| 181 | .oc_enable = 0, |
| 182 | .int_act_high = 0, |
| 183 | .int_edge_triggered = 0, |
| 184 | .remote_wakeup_connected = 0, |
| 185 | .no_power_switching = 1, |
| 186 | .power_switching_mode = 0, |
| 187 | }; |
| 188 | |
| 189 | static struct platform_device isp1362_hcd_device = { |
| 190 | .name = "isp1362-hcd", |
| 191 | .id = 0, |
| 192 | .dev = { |
| 193 | .platform_data = &isp1362_priv, |
| 194 | }, |
| 195 | .num_resources = ARRAY_SIZE(isp1362_hcd_resources), |
| 196 | .resource = isp1362_hcd_resources, |
| 197 | }; |
| 198 | #endif |
| 199 | |
| 200 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
Graf Yang | 6531962 | 2009-02-04 16:49:45 +0800 | [diff] [blame] | 201 | static struct platform_device bfin_mii_bus = { |
| 202 | .name = "bfin_mii_bus", |
| 203 | }; |
| 204 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 205 | static struct platform_device bfin_mac_device = { |
| 206 | .name = "bfin_mac", |
Graf Yang | 6531962 | 2009-02-04 16:49:45 +0800 | [diff] [blame] | 207 | .dev.platform_data = &bfin_mii_bus, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 208 | }; |
| 209 | #endif |
| 210 | |
| 211 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 212 | static struct resource net2272_bfin_resources[] = { |
| 213 | { |
| 214 | .start = 0x20300000, |
| 215 | .end = 0x20300000 + 0x100, |
| 216 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 217 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 218 | .start = IRQ_PF7, |
| 219 | .end = IRQ_PF7, |
| 220 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 221 | }, |
| 222 | }; |
| 223 | |
| 224 | static struct platform_device net2272_bfin_device = { |
| 225 | .name = "net2272", |
| 226 | .id = -1, |
| 227 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), |
| 228 | .resource = net2272_bfin_resources, |
| 229 | }; |
| 230 | #endif |
| 231 | |
| 232 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 233 | /* all SPI peripherals info goes here */ |
| 234 | |
| 235 | #if defined(CONFIG_MTD_M25P80) \ |
| 236 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 237 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 238 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 239 | .name = "bootloader(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 240 | .size = 0x00020000, |
| 241 | .offset = 0, |
| 242 | .mask_flags = MTD_CAP_ROM |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 243 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 244 | .name = "linux kernel(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 245 | .size = 0xe0000, |
| 246 | .offset = 0x20000 |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 247 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 248 | .name = "file system(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 249 | .size = 0x700000, |
| 250 | .offset = 0x00100000, |
| 251 | } |
| 252 | }; |
| 253 | |
| 254 | static struct flash_platform_data bfin_spi_flash_data = { |
| 255 | .name = "m25p80", |
| 256 | .parts = bfin_spi_flash_partitions, |
| 257 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 258 | .type = "m25p64", |
| 259 | }; |
| 260 | |
| 261 | /* SPI flash chip (m25p64) */ |
| 262 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 263 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 264 | .bits_per_word = 8, |
| 265 | }; |
| 266 | #endif |
| 267 | |
Mike Frysinger | a261eec | 2009-05-20 14:05:36 +0000 | [diff] [blame^] | 268 | #if defined(CONFIG_BFIN_SPI_ADC) \ |
| 269 | || defined(CONFIG_BFIN_SPI_ADC_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 270 | /* SPI ADC chip */ |
| 271 | static struct bfin5xx_spi_chip spi_adc_chip_info = { |
| 272 | .enable_dma = 1, /* use dma transfer with this chip*/ |
| 273 | .bits_per_word = 16, |
| 274 | }; |
| 275 | #endif |
| 276 | |
| 277 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
| 278 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 279 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 280 | .enable_dma = 0, |
| 281 | .bits_per_word = 16, |
| 282 | }; |
| 283 | #endif |
| 284 | |
| 285 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) |
| 286 | static struct bfin5xx_spi_chip ad9960_spi_chip_info = { |
| 287 | .enable_dma = 0, |
| 288 | .bits_per_word = 16, |
| 289 | }; |
| 290 | #endif |
| 291 | |
Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 292 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) |
| 293 | static struct bfin5xx_spi_chip mmc_spi_chip_info = { |
| 294 | .enable_dma = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 295 | .bits_per_word = 8, |
| 296 | }; |
| 297 | #endif |
| 298 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 299 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 300 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { |
Michael Hennerich | c7d4896 | 2007-11-15 21:33:31 +0800 | [diff] [blame] | 301 | .cs_change_per_word = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 302 | .enable_dma = 0, |
| 303 | .bits_per_word = 16, |
| 304 | }; |
| 305 | |
| 306 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { |
| 307 | .model = 7877, |
| 308 | .vref_delay_usecs = 50, /* internal, no capacitor */ |
| 309 | .x_plate_ohms = 419, |
| 310 | .y_plate_ohms = 486, |
| 311 | .pressure_max = 1000, |
| 312 | .pressure_min = 0, |
| 313 | .stopacq_polarity = 1, |
| 314 | .first_conversion_delay = 3, |
| 315 | .acquisition_time = 1, |
| 316 | .averaging = 1, |
| 317 | .pen_down_acc_interval = 1, |
| 318 | }; |
| 319 | #endif |
| 320 | |
| 321 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
| 322 | #if defined(CONFIG_MTD_M25P80) \ |
| 323 | || defined(CONFIG_MTD_M25P80_MODULE) |
| 324 | { |
| 325 | /* the modalias must be the same as spi device driver name */ |
| 326 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 327 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 328 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 329 | .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/ |
| 330 | .platform_data = &bfin_spi_flash_data, |
| 331 | .controller_data = &spi_flash_chip_info, |
| 332 | .mode = SPI_MODE_3, |
| 333 | }, |
| 334 | #endif |
| 335 | |
Mike Frysinger | a261eec | 2009-05-20 14:05:36 +0000 | [diff] [blame^] | 336 | #if defined(CONFIG_BFIN_SPI_ADC) \ |
| 337 | || defined(CONFIG_BFIN_SPI_ADC_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 338 | { |
| 339 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ |
| 340 | .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 341 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 342 | .chip_select = 1, /* Framework chip select. */ |
| 343 | .platform_data = NULL, /* No spi_driver specific config */ |
| 344 | .controller_data = &spi_adc_chip_info, |
| 345 | }, |
| 346 | #endif |
| 347 | |
| 348 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
| 349 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 350 | { |
| 351 | .modalias = "ad1836-spi", |
| 352 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 353 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 354 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, |
| 355 | .controller_data = &ad1836_spi_chip_info, |
| 356 | }, |
| 357 | #endif |
| 358 | #if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE) |
| 359 | { |
| 360 | .modalias = "ad9960-spi", |
| 361 | .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 362 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 363 | .chip_select = 1, |
| 364 | .controller_data = &ad9960_spi_chip_info, |
| 365 | }, |
| 366 | #endif |
Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 367 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 368 | { |
Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 369 | .modalias = "mmc_spi", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 370 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 371 | .bus_num = 0, |
Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 372 | .chip_select = 5, |
| 373 | .controller_data = &mmc_spi_chip_info, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 374 | .mode = SPI_MODE_3, |
| 375 | }, |
| 376 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 377 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) |
| 378 | { |
| 379 | .modalias = "ad7877", |
| 380 | .platform_data = &bfin_ad7877_ts_info, |
| 381 | .irq = IRQ_PF2, |
| 382 | .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */ |
Michael Hennerich | c7d4896 | 2007-11-15 21:33:31 +0800 | [diff] [blame] | 383 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 384 | .chip_select = 5, |
| 385 | .controller_data = &spi_ad7877_chip_info, |
| 386 | }, |
| 387 | #endif |
| 388 | |
| 389 | }; |
| 390 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 391 | /* SPI (0) */ |
| 392 | static struct resource bfin_spi0_resource[] = { |
| 393 | [0] = { |
| 394 | .start = SPI0_REGBASE, |
| 395 | .end = SPI0_REGBASE + 0xFF, |
| 396 | .flags = IORESOURCE_MEM, |
| 397 | }, |
| 398 | [1] = { |
| 399 | .start = CH_SPI, |
| 400 | .end = CH_SPI, |
| 401 | .flags = IORESOURCE_IRQ, |
| 402 | } |
| 403 | }; |
| 404 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 405 | /* SPI controller data */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 406 | static struct bfin5xx_spi_master bfin_spi0_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 407 | .num_chipselect = 8, |
| 408 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 409 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 410 | }; |
| 411 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 412 | static struct platform_device bfin_spi0_device = { |
| 413 | .name = "bfin-spi", |
| 414 | .id = 0, /* Bus number */ |
| 415 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 416 | .resource = bfin_spi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 417 | .dev = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 418 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 419 | }, |
| 420 | }; |
| 421 | #endif /* spi master and devices */ |
| 422 | |
| 423 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) |
| 424 | static struct platform_device bfin_fb_device = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 425 | .name = "bf537-lq035", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 426 | }; |
| 427 | #endif |
| 428 | |
| 429 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 430 | static struct resource bfin_uart_resources[] = { |
| 431 | { |
| 432 | .start = 0xFFC00400, |
| 433 | .end = 0xFFC004FF, |
| 434 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 435 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 436 | .start = 0xFFC02000, |
| 437 | .end = 0xFFC020FF, |
| 438 | .flags = IORESOURCE_MEM, |
| 439 | }, |
| 440 | }; |
| 441 | |
| 442 | static struct platform_device bfin_uart_device = { |
| 443 | .name = "bfin-uart", |
| 444 | .id = 1, |
| 445 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 446 | .resource = bfin_uart_resources, |
| 447 | }; |
| 448 | #endif |
| 449 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 450 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 451 | #ifdef CONFIG_BFIN_SIR0 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 452 | static struct resource bfin_sir0_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 453 | { |
| 454 | .start = 0xFFC00400, |
| 455 | .end = 0xFFC004FF, |
| 456 | .flags = IORESOURCE_MEM, |
| 457 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 458 | { |
| 459 | .start = IRQ_UART0_RX, |
| 460 | .end = IRQ_UART0_RX+1, |
| 461 | .flags = IORESOURCE_IRQ, |
| 462 | }, |
| 463 | { |
| 464 | .start = CH_UART0_RX, |
| 465 | .end = CH_UART0_RX+1, |
| 466 | .flags = IORESOURCE_DMA, |
| 467 | }, |
| 468 | }; |
| 469 | |
| 470 | static struct platform_device bfin_sir0_device = { |
| 471 | .name = "bfin_sir", |
| 472 | .id = 0, |
| 473 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
| 474 | .resource = bfin_sir0_resources, |
| 475 | }; |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 476 | #endif |
| 477 | #ifdef CONFIG_BFIN_SIR1 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 478 | static struct resource bfin_sir1_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 479 | { |
| 480 | .start = 0xFFC02000, |
| 481 | .end = 0xFFC020FF, |
| 482 | .flags = IORESOURCE_MEM, |
| 483 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 484 | { |
| 485 | .start = IRQ_UART1_RX, |
| 486 | .end = IRQ_UART1_RX+1, |
| 487 | .flags = IORESOURCE_IRQ, |
| 488 | }, |
| 489 | { |
| 490 | .start = CH_UART1_RX, |
| 491 | .end = CH_UART1_RX+1, |
| 492 | .flags = IORESOURCE_DMA, |
| 493 | }, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 494 | }; |
| 495 | |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 496 | static struct platform_device bfin_sir1_device = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 497 | .name = "bfin_sir", |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 498 | .id = 1, |
| 499 | .num_resources = ARRAY_SIZE(bfin_sir1_resources), |
| 500 | .resource = bfin_sir1_resources, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 501 | }; |
| 502 | #endif |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 503 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 504 | |
| 505 | static struct platform_device *stamp_devices[] __initdata = { |
| 506 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) |
| 507 | &bfin_pcmcia_cf_device, |
| 508 | #endif |
| 509 | |
| 510 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 511 | &rtc_device, |
| 512 | #endif |
| 513 | |
| 514 | #if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE) |
| 515 | &sl811_hcd_device, |
| 516 | #endif |
| 517 | |
| 518 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 519 | &isp1362_hcd_device, |
| 520 | #endif |
| 521 | |
| 522 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 523 | &smc91x_device, |
| 524 | #endif |
| 525 | |
| 526 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) |
Graf Yang | 6531962 | 2009-02-04 16:49:45 +0800 | [diff] [blame] | 527 | &bfin_mii_bus, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 528 | &bfin_mac_device, |
| 529 | #endif |
| 530 | |
| 531 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 532 | &net2272_bfin_device, |
| 533 | #endif |
| 534 | |
| 535 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 536 | &bfin_spi0_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 537 | #endif |
| 538 | |
| 539 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) |
| 540 | &bfin_fb_device, |
| 541 | #endif |
| 542 | |
| 543 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 544 | &bfin_uart_device, |
| 545 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 546 | |
| 547 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 548 | #ifdef CONFIG_BFIN_SIR0 |
| 549 | &bfin_sir0_device, |
| 550 | #endif |
| 551 | #ifdef CONFIG_BFIN_SIR1 |
| 552 | &bfin_sir1_device, |
| 553 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 554 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 555 | }; |
| 556 | |
Mike Frysinger | 7f6678c | 2009-02-04 16:49:45 +0800 | [diff] [blame] | 557 | static int __init pnav_init(void) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 558 | { |
Harvey Harrison | b85d858 | 2008-04-23 09:39:01 +0800 | [diff] [blame] | 559 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 560 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 561 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 562 | spi_register_board_info(bfin_spi_board_info, |
| 563 | ARRAY_SIZE(bfin_spi_board_info)); |
| 564 | #endif |
| 565 | return 0; |
| 566 | } |
| 567 | |
Mike Frysinger | 7f6678c | 2009-02-04 16:49:45 +0800 | [diff] [blame] | 568 | arch_initcall(pnav_init); |
Mike Frysinger | 137b152 | 2007-11-22 16:07:03 +0800 | [diff] [blame] | 569 | |
Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 570 | void bfin_get_ether_addr(char *addr) |
Mike Frysinger | 137b152 | 2007-11-22 16:07:03 +0800 | [diff] [blame] | 571 | { |
| 572 | random_ether_addr(addr); |
| 573 | printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__); |
| 574 | } |
Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 575 | EXPORT_SYMBOL(bfin_get_ether_addr); |