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