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> |
| 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 | b964c59 | 2008-05-10 00:06:10 +0800 | [diff] [blame] | 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> |
Mike Frysinger | b964c59 | 2008-05-10 00:06:10 +0800 | [diff] [blame] | 18 | #endif |
Jeff Garzik | 0a87e3e | 2008-02-01 18:02:30 -0500 | [diff] [blame] | 19 | #include <linux/ata_platform.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 20 | #include <linux/irq.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 21 | #include <asm/dma.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 22 | #include <asm/bfin5xx_spi.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 23 | #include <asm/portmux.h> |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 24 | #include <asm/dpmc.h> |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 25 | #include <linux/mtd/physmap.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 26 | |
| 27 | /* |
| 28 | * Name the Board for the /proc/cpuinfo |
| 29 | */ |
Mike Frysinger | 066954a | 2007-10-21 22:36:06 +0800 | [diff] [blame] | 30 | const char bfin_board_name[] = "Bluetechnix CM BF561"; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 31 | |
| 32 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Simon Arlott | d2d50aa | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 33 | /* all SPI peripherals info goes here */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 34 | |
| 35 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 36 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 37 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 38 | .name = "bootloader(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 39 | .size = 0x00020000, |
| 40 | .offset = 0, |
| 41 | .mask_flags = MTD_CAP_ROM |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 42 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 43 | .name = "linux kernel(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 44 | .size = 0xe0000, |
| 45 | .offset = 0x20000 |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 46 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 47 | .name = "file system(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 48 | .size = 0x700000, |
| 49 | .offset = 0x00100000, |
| 50 | } |
| 51 | }; |
| 52 | |
| 53 | static struct flash_platform_data bfin_spi_flash_data = { |
| 54 | .name = "m25p80", |
| 55 | .parts = bfin_spi_flash_partitions, |
| 56 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 57 | .type = "m25p64", |
| 58 | }; |
| 59 | |
| 60 | /* SPI flash chip (m25p64) */ |
| 61 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 62 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 63 | .bits_per_word = 8, |
| 64 | }; |
| 65 | #endif |
| 66 | |
Mike Frysinger | a261eec | 2009-05-20 14:05:36 +0000 | [diff] [blame] | 67 | #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 68 | /* SPI ADC chip */ |
| 69 | static struct bfin5xx_spi_chip spi_adc_chip_info = { |
| 70 | .enable_dma = 1, /* use dma transfer with this chip*/ |
| 71 | .bits_per_word = 16, |
| 72 | }; |
| 73 | #endif |
| 74 | |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame^] | 75 | #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 76 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 77 | .enable_dma = 0, |
| 78 | .bits_per_word = 16, |
| 79 | }; |
| 80 | #endif |
| 81 | |
Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 82 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) |
| 83 | static struct bfin5xx_spi_chip mmc_spi_chip_info = { |
| 84 | .enable_dma = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 85 | .bits_per_word = 8, |
| 86 | }; |
| 87 | #endif |
| 88 | |
| 89 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
| 90 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 91 | { |
| 92 | /* the modalias must be the same as spi device driver name */ |
| 93 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 94 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 95 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 96 | .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/ |
| 97 | .platform_data = &bfin_spi_flash_data, |
| 98 | .controller_data = &spi_flash_chip_info, |
| 99 | .mode = SPI_MODE_3, |
| 100 | }, |
| 101 | #endif |
| 102 | |
Mike Frysinger | a261eec | 2009-05-20 14:05:36 +0000 | [diff] [blame] | 103 | #if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 104 | { |
| 105 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ |
| 106 | .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 107 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 108 | .chip_select = 1, /* Framework chip select. */ |
| 109 | .platform_data = NULL, /* No spi_driver specific config */ |
| 110 | .controller_data = &spi_adc_chip_info, |
| 111 | }, |
| 112 | #endif |
| 113 | |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame^] | 114 | #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 115 | { |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame^] | 116 | .modalias = "ad183x", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 117 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 118 | .bus_num = 0, |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame^] | 119 | .chip_select = 4, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 120 | .controller_data = &ad1836_spi_chip_info, |
| 121 | }, |
| 122 | #endif |
Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 123 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 124 | { |
Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 125 | .modalias = "mmc_spi", |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 126 | .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 127 | .bus_num = 0, |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 128 | .chip_select = 1, |
Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 129 | .controller_data = &mmc_spi_chip_info, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 130 | .mode = SPI_MODE_3, |
| 131 | }, |
| 132 | #endif |
| 133 | }; |
| 134 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 135 | /* SPI (0) */ |
| 136 | static struct resource bfin_spi0_resource[] = { |
| 137 | [0] = { |
| 138 | .start = SPI0_REGBASE, |
| 139 | .end = SPI0_REGBASE + 0xFF, |
| 140 | .flags = IORESOURCE_MEM, |
| 141 | }, |
| 142 | [1] = { |
| 143 | .start = CH_SPI, |
| 144 | .end = CH_SPI, |
Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 145 | .flags = IORESOURCE_DMA, |
| 146 | }, |
| 147 | [2] = { |
| 148 | .start = IRQ_SPI, |
| 149 | .end = IRQ_SPI, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 150 | .flags = IORESOURCE_IRQ, |
Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 151 | }, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 152 | }; |
| 153 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 154 | /* SPI controller data */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 155 | static struct bfin5xx_spi_master bfin_spi0_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 156 | .num_chipselect = 8, |
| 157 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 158 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 159 | }; |
| 160 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 161 | static struct platform_device bfin_spi0_device = { |
| 162 | .name = "bfin-spi", |
| 163 | .id = 0, /* Bus number */ |
| 164 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 165 | .resource = bfin_spi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 166 | .dev = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 167 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 168 | }, |
| 169 | }; |
| 170 | #endif /* spi master and devices */ |
| 171 | |
| 172 | |
Michael Hennerich | 0d4a89b | 2008-01-27 19:58:46 +0800 | [diff] [blame] | 173 | #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE) |
| 174 | static struct platform_device hitachi_fb_device = { |
| 175 | .name = "hitachi-tx09", |
| 176 | }; |
| 177 | #endif |
| 178 | |
| 179 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 180 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 181 | #include <linux/smc91x.h> |
| 182 | |
| 183 | static struct smc91x_platdata smc91x_info = { |
| 184 | .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT, |
| 185 | .leda = RPC_LED_100_10, |
| 186 | .ledb = RPC_LED_TX_RX, |
| 187 | }; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 188 | |
| 189 | static struct resource smc91x_resources[] = { |
| 190 | { |
| 191 | .name = "smc91x-regs", |
| 192 | .start = 0x28000300, |
| 193 | .end = 0x28000300 + 16, |
| 194 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 195 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 196 | .start = IRQ_PF0, |
| 197 | .end = IRQ_PF0, |
| 198 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 199 | }, |
| 200 | }; |
| 201 | static struct platform_device smc91x_device = { |
| 202 | .name = "smc91x", |
| 203 | .id = 0, |
| 204 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 205 | .resource = smc91x_resources, |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 206 | .dev = { |
| 207 | .platform_data = &smc91x_info, |
| 208 | }, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 209 | }; |
| 210 | #endif |
| 211 | |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 212 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 213 | #include <linux/smsc911x.h> |
| 214 | |
| 215 | static struct resource smsc911x_resources[] = { |
| 216 | { |
| 217 | .name = "smsc911x-memory", |
| 218 | .start = 0x24008000, |
| 219 | .end = 0x24008000 + 0xFF, |
| 220 | .flags = IORESOURCE_MEM, |
| 221 | }, |
| 222 | { |
| 223 | .start = IRQ_PF43, |
| 224 | .end = IRQ_PF43, |
| 225 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 226 | }, |
| 227 | }; |
| 228 | |
| 229 | static struct smsc911x_platform_config smsc911x_config = { |
| 230 | .flags = SMSC911X_USE_16BIT, |
| 231 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 232 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, |
| 233 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 234 | }; |
| 235 | |
| 236 | static struct platform_device smsc911x_device = { |
| 237 | .name = "smsc911x", |
| 238 | .id = 0, |
| 239 | .num_resources = ARRAY_SIZE(smsc911x_resources), |
| 240 | .resource = smsc911x_resources, |
| 241 | .dev = { |
| 242 | .platform_data = &smsc911x_config, |
| 243 | }, |
| 244 | }; |
| 245 | #endif |
| 246 | |
| 247 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 248 | static struct resource net2272_bfin_resources[] = { |
| 249 | { |
| 250 | .start = 0x24000000, |
| 251 | .end = 0x24000000 + 0x100, |
| 252 | .flags = IORESOURCE_MEM, |
| 253 | }, { |
| 254 | .start = IRQ_PF45, |
| 255 | .end = IRQ_PF45, |
| 256 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 257 | }, |
| 258 | }; |
| 259 | |
| 260 | static struct platform_device net2272_bfin_device = { |
| 261 | .name = "net2272", |
| 262 | .id = -1, |
| 263 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), |
| 264 | .resource = net2272_bfin_resources, |
| 265 | }; |
| 266 | #endif |
| 267 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 268 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 269 | static struct resource isp1362_hcd_resources[] = { |
| 270 | { |
| 271 | .start = 0x24008000, |
| 272 | .end = 0x24008000, |
| 273 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 274 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 275 | .start = 0x24008004, |
| 276 | .end = 0x24008004, |
| 277 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 278 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 279 | .start = IRQ_PF47, |
| 280 | .end = IRQ_PF47, |
| 281 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 282 | }, |
| 283 | }; |
| 284 | |
| 285 | static struct isp1362_platform_data isp1362_priv = { |
| 286 | .sel15Kres = 1, |
| 287 | .clknotstop = 0, |
| 288 | .oc_enable = 0, |
| 289 | .int_act_high = 0, |
| 290 | .int_edge_triggered = 0, |
| 291 | .remote_wakeup_connected = 0, |
| 292 | .no_power_switching = 1, |
| 293 | .power_switching_mode = 0, |
| 294 | }; |
| 295 | |
| 296 | static struct platform_device isp1362_hcd_device = { |
| 297 | .name = "isp1362-hcd", |
| 298 | .id = 0, |
| 299 | .dev = { |
| 300 | .platform_data = &isp1362_priv, |
| 301 | }, |
| 302 | .num_resources = ARRAY_SIZE(isp1362_hcd_resources), |
| 303 | .resource = isp1362_hcd_resources, |
| 304 | }; |
| 305 | #endif |
| 306 | |
| 307 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 308 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 309 | static struct resource bfin_uart0_resources[] = { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 310 | { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 311 | .start = BFIN_UART_THR, |
| 312 | .end = BFIN_UART_GCTL+2, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 313 | .flags = IORESOURCE_MEM, |
| 314 | }, |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 315 | { |
| 316 | .start = IRQ_UART_RX, |
| 317 | .end = IRQ_UART_RX+1, |
| 318 | .flags = IORESOURCE_IRQ, |
| 319 | }, |
| 320 | { |
| 321 | .start = IRQ_UART_ERROR, |
| 322 | .end = IRQ_UART_ERROR, |
| 323 | .flags = IORESOURCE_IRQ, |
| 324 | }, |
| 325 | { |
| 326 | .start = CH_UART_TX, |
| 327 | .end = CH_UART_TX, |
| 328 | .flags = IORESOURCE_DMA, |
| 329 | }, |
| 330 | { |
| 331 | .start = CH_UART_RX, |
| 332 | .end = CH_UART_RX, |
| 333 | .flags = IORESOURCE_DMA, |
| 334 | }, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 335 | }; |
| 336 | |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 337 | unsigned short bfin_uart0_peripherals[] = { |
| 338 | P_UART0_TX, P_UART0_RX, 0 |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 339 | }; |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 340 | |
| 341 | static struct platform_device bfin_uart0_device = { |
| 342 | .name = "bfin-uart", |
| 343 | .id = 0, |
| 344 | .num_resources = ARRAY_SIZE(bfin_uart0_resources), |
| 345 | .resource = bfin_uart0_resources, |
| 346 | .dev = { |
| 347 | .platform_data = &bfin_uart0_peripherals, /* Passed to driver */ |
| 348 | }, |
| 349 | }; |
| 350 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 351 | #endif |
| 352 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 353 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 354 | #ifdef CONFIG_BFIN_SIR0 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 355 | static struct resource bfin_sir0_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 356 | { |
| 357 | .start = 0xFFC00400, |
| 358 | .end = 0xFFC004FF, |
| 359 | .flags = IORESOURCE_MEM, |
| 360 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 361 | { |
| 362 | .start = IRQ_UART0_RX, |
| 363 | .end = IRQ_UART0_RX+1, |
| 364 | .flags = IORESOURCE_IRQ, |
| 365 | }, |
| 366 | { |
| 367 | .start = CH_UART0_RX, |
| 368 | .end = CH_UART0_RX+1, |
| 369 | .flags = IORESOURCE_DMA, |
| 370 | }, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 371 | }; |
| 372 | |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 373 | static struct platform_device bfin_sir0_device = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 374 | .name = "bfin_sir", |
| 375 | .id = 0, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 376 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
| 377 | .resource = bfin_sir0_resources, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 378 | }; |
| 379 | #endif |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 380 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 381 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 382 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
Mike Frysinger | fe5aeb9 | 2008-08-05 18:29:56 +0800 | [diff] [blame] | 383 | #define PATA_INT IRQ_PF46 |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 384 | |
| 385 | static struct pata_platform_info bfin_pata_platform_data = { |
| 386 | .ioport_shift = 2, |
| 387 | .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, |
| 388 | }; |
| 389 | |
| 390 | static struct resource bfin_pata_resources[] = { |
| 391 | { |
| 392 | .start = 0x2400C000, |
| 393 | .end = 0x2400C001F, |
| 394 | .flags = IORESOURCE_MEM, |
| 395 | }, |
| 396 | { |
| 397 | .start = 0x2400D018, |
| 398 | .end = 0x2400D01B, |
| 399 | .flags = IORESOURCE_MEM, |
| 400 | }, |
| 401 | { |
| 402 | .start = PATA_INT, |
| 403 | .end = PATA_INT, |
| 404 | .flags = IORESOURCE_IRQ, |
| 405 | }, |
| 406 | }; |
| 407 | |
| 408 | static struct platform_device bfin_pata_device = { |
| 409 | .name = "pata_platform", |
| 410 | .id = -1, |
| 411 | .num_resources = ARRAY_SIZE(bfin_pata_resources), |
| 412 | .resource = bfin_pata_resources, |
| 413 | .dev = { |
| 414 | .platform_data = &bfin_pata_platform_data, |
| 415 | } |
| 416 | }; |
| 417 | #endif |
| 418 | |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 419 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
| 420 | static struct mtd_partition para_partitions[] = { |
| 421 | { |
| 422 | .name = "bootloader(nor)", |
| 423 | .size = 0x40000, |
| 424 | .offset = 0, |
| 425 | }, { |
| 426 | .name = "linux kernel(nor)", |
| 427 | .size = 0x100000, |
| 428 | .offset = MTDPART_OFS_APPEND, |
| 429 | }, { |
| 430 | .name = "file system(nor)", |
| 431 | .size = MTDPART_SIZ_FULL, |
| 432 | .offset = MTDPART_OFS_APPEND, |
| 433 | } |
| 434 | }; |
| 435 | |
| 436 | static struct physmap_flash_data para_flash_data = { |
| 437 | .width = 2, |
| 438 | .parts = para_partitions, |
| 439 | .nr_parts = ARRAY_SIZE(para_partitions), |
| 440 | }; |
| 441 | |
| 442 | static struct resource para_flash_resource = { |
| 443 | .start = 0x20000000, |
| 444 | .end = 0x207fffff, |
| 445 | .flags = IORESOURCE_MEM, |
| 446 | }; |
| 447 | |
| 448 | static struct platform_device para_flash_device = { |
| 449 | .name = "physmap-flash", |
| 450 | .id = 0, |
| 451 | .dev = { |
| 452 | .platform_data = ¶_flash_data, |
| 453 | }, |
| 454 | .num_resources = 1, |
| 455 | .resource = ¶_flash_resource, |
| 456 | }; |
| 457 | #endif |
| 458 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 459 | static const unsigned int cclk_vlev_datasheet[] = |
| 460 | { |
| 461 | VRPAIR(VLEV_085, 250000000), |
| 462 | VRPAIR(VLEV_090, 300000000), |
| 463 | VRPAIR(VLEV_095, 313000000), |
| 464 | VRPAIR(VLEV_100, 350000000), |
| 465 | VRPAIR(VLEV_105, 400000000), |
| 466 | VRPAIR(VLEV_110, 444000000), |
| 467 | VRPAIR(VLEV_115, 450000000), |
| 468 | VRPAIR(VLEV_120, 475000000), |
| 469 | VRPAIR(VLEV_125, 500000000), |
| 470 | VRPAIR(VLEV_130, 600000000), |
| 471 | }; |
| 472 | |
| 473 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { |
| 474 | .tuple_tab = cclk_vlev_datasheet, |
| 475 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), |
| 476 | .vr_settling_time = 25 /* us */, |
| 477 | }; |
| 478 | |
| 479 | static struct platform_device bfin_dpmc = { |
| 480 | .name = "bfin dpmc", |
| 481 | .dev = { |
| 482 | .platform_data = &bfin_dmpc_vreg_data, |
| 483 | }, |
| 484 | }; |
| 485 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 486 | static struct platform_device *cm_bf561_devices[] __initdata = { |
| 487 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 488 | &bfin_dpmc, |
| 489 | |
Michael Hennerich | 0d4a89b | 2008-01-27 19:58:46 +0800 | [diff] [blame] | 490 | #if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE) |
| 491 | &hitachi_fb_device, |
| 492 | #endif |
| 493 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 494 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 495 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 496 | &bfin_uart0_device, |
| 497 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 498 | #endif |
| 499 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 500 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 501 | #ifdef CONFIG_BFIN_SIR0 |
| 502 | &bfin_sir0_device, |
| 503 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 504 | #endif |
| 505 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 506 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 507 | &isp1362_hcd_device, |
| 508 | #endif |
| 509 | |
| 510 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 511 | &smc91x_device, |
| 512 | #endif |
| 513 | |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 514 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 515 | &smsc911x_device, |
| 516 | #endif |
| 517 | |
| 518 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 519 | &net2272_bfin_device, |
| 520 | #endif |
| 521 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 522 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 523 | &bfin_spi0_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 524 | #endif |
| 525 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 526 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 527 | &bfin_pata_device, |
| 528 | #endif |
Mike Frysinger | c97618d | 2009-01-07 23:14:38 +0800 | [diff] [blame] | 529 | |
Harald Krapfenbauer | 9c21453 | 2009-09-10 15:30:03 +0000 | [diff] [blame] | 530 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
| 531 | ¶_flash_device, |
| 532 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 533 | }; |
| 534 | |
| 535 | static int __init cm_bf561_init(void) |
| 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(cm_bf561_devices, ARRAY_SIZE(cm_bf561_devices)); |
| 539 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 540 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
| 541 | #endif |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 542 | |
| 543 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 544 | irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; |
| 545 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 546 | return 0; |
| 547 | } |
| 548 | |
| 549 | arch_initcall(cm_bf561_init); |
Sonic Zhang | c13ce9f | 2009-09-23 09:37:46 +0000 | [diff] [blame] | 550 | |
| 551 | static struct platform_device *cm_bf561_early_devices[] __initdata = { |
| 552 | #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK) |
| 553 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 554 | &bfin_uart0_device, |
| 555 | #endif |
| 556 | #endif |
| 557 | }; |
| 558 | |
| 559 | void __init native_machine_early_platform_add_devices(void) |
| 560 | { |
| 561 | printk(KERN_INFO "register early platform devices\n"); |
| 562 | early_platform_add_devices(cm_bf561_early_devices, |
| 563 | ARRAY_SIZE(cm_bf561_early_devices)); |
| 564 | } |