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