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