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