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> |
| 10 | #include <linux/platform_device.h> |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 11 | #include <linux/mtd/mtd.h> |
| 12 | #include <linux/mtd/partitions.h> |
| 13 | #include <linux/mtd/physmap.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 14 | #include <linux/spi/spi.h> |
Michael Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 15 | #include <linux/irq.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 16 | #include <linux/interrupt.h> |
Barry Song | 027285e | 2010-06-28 08:39:37 +0000 | [diff] [blame] | 17 | #include <linux/delay.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 18 | #include <asm/dma.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 19 | #include <asm/bfin5xx_spi.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 20 | #include <asm/portmux.h> |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 21 | #include <asm/dpmc.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 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 BF561-EZKIT"; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 27 | |
Michael Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 28 | #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) |
Michael Hennerich | 3f37569 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 29 | #include <linux/usb/isp1760.h> |
| 30 | static struct resource bfin_isp1760_resources[] = { |
| 31 | [0] = { |
| 32 | .start = 0x2C0F0000, |
| 33 | .end = 0x203C0000 + 0xfffff, |
Michael Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 34 | .flags = IORESOURCE_MEM, |
| 35 | }, |
Michael Hennerich | 3f37569 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 36 | [1] = { |
| 37 | .start = IRQ_PF10, |
| 38 | .end = IRQ_PF10, |
Michael Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 39 | .flags = IORESOURCE_IRQ, |
| 40 | }, |
| 41 | }; |
| 42 | |
Michael Hennerich | 3f37569 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 43 | static struct isp1760_platform_data isp1760_priv = { |
| 44 | .is_isp1761 = 0, |
Michael Hennerich | 3f37569 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 45 | .bus_width_16 = 1, |
| 46 | .port1_otg = 0, |
| 47 | .analog_oc = 0, |
| 48 | .dack_polarity_high = 0, |
| 49 | .dreq_polarity_high = 0, |
| 50 | }; |
| 51 | |
| 52 | static struct platform_device bfin_isp1760_device = { |
Michael Hennerich | c6feb76 | 2009-10-15 10:37:33 +0000 | [diff] [blame] | 53 | .name = "isp1760", |
Michael Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 54 | .id = 0, |
Michael Hennerich | 3f37569 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 55 | .dev = { |
| 56 | .platform_data = &isp1760_priv, |
| 57 | }, |
| 58 | .num_resources = ARRAY_SIZE(bfin_isp1760_resources), |
| 59 | .resource = bfin_isp1760_resources, |
Michael Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 60 | }; |
Michael Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 61 | #endif |
| 62 | |
Michael Hennerich | e9d76c2 | 2008-02-02 14:55:28 +0800 | [diff] [blame] | 63 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 64 | #include <linux/usb/isp1362.h> |
| 65 | |
| 66 | static struct resource isp1362_hcd_resources[] = { |
| 67 | { |
| 68 | .start = 0x2c060000, |
| 69 | .end = 0x2c060000, |
| 70 | .flags = IORESOURCE_MEM, |
| 71 | }, { |
| 72 | .start = 0x2c060004, |
| 73 | .end = 0x2c060004, |
| 74 | .flags = IORESOURCE_MEM, |
| 75 | }, { |
| 76 | .start = IRQ_PF8, |
| 77 | .end = IRQ_PF8, |
Michael Hennerich | 9e75894 | 2010-03-18 12:51:49 +0000 | [diff] [blame] | 78 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, |
Michael Hennerich | e9d76c2 | 2008-02-02 14:55:28 +0800 | [diff] [blame] | 79 | }, |
| 80 | }; |
| 81 | |
| 82 | static struct isp1362_platform_data isp1362_priv = { |
| 83 | .sel15Kres = 1, |
| 84 | .clknotstop = 0, |
| 85 | .oc_enable = 0, |
| 86 | .int_act_high = 0, |
| 87 | .int_edge_triggered = 0, |
| 88 | .remote_wakeup_connected = 0, |
| 89 | .no_power_switching = 1, |
| 90 | .power_switching_mode = 0, |
| 91 | }; |
| 92 | |
| 93 | static struct platform_device isp1362_hcd_device = { |
| 94 | .name = "isp1362-hcd", |
| 95 | .id = 0, |
| 96 | .dev = { |
| 97 | .platform_data = &isp1362_priv, |
| 98 | }, |
| 99 | .num_resources = ARRAY_SIZE(isp1362_hcd_resources), |
| 100 | .resource = isp1362_hcd_resources, |
| 101 | }; |
| 102 | #endif |
| 103 | |
Michael Hennerich | 83d9cde | 2008-02-02 16:25:17 +0800 | [diff] [blame] | 104 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 105 | static struct resource net2272_bfin_resources[] = { |
| 106 | { |
| 107 | .start = 0x2C000000, |
| 108 | .end = 0x2C000000 + 0x7F, |
| 109 | .flags = IORESOURCE_MEM, |
| 110 | }, { |
Mike Frysinger | 9be8631 | 2011-05-04 11:20:15 -0400 | [diff] [blame] | 111 | .start = 1, |
| 112 | .flags = IORESOURCE_BUS, |
| 113 | }, { |
Michael Hennerich | 83d9cde | 2008-02-02 16:25:17 +0800 | [diff] [blame] | 114 | .start = IRQ_PF10, |
| 115 | .end = IRQ_PF10, |
| 116 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 117 | }, |
| 118 | }; |
| 119 | |
| 120 | static struct platform_device net2272_bfin_device = { |
| 121 | .name = "net2272", |
| 122 | .id = -1, |
| 123 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), |
| 124 | .resource = net2272_bfin_resources, |
| 125 | }; |
| 126 | #endif |
| 127 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 128 | /* |
| 129 | * USB-LAN EzExtender board |
| 130 | * Driver needs to know address, irq and flag pin. |
| 131 | */ |
| 132 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 133 | #include <linux/smc91x.h> |
| 134 | |
| 135 | static struct smc91x_platdata smc91x_info = { |
| 136 | .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT, |
| 137 | .leda = RPC_LED_100_10, |
| 138 | .ledb = RPC_LED_TX_RX, |
| 139 | }; |
| 140 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 141 | static struct resource smc91x_resources[] = { |
| 142 | { |
| 143 | .name = "smc91x-regs", |
| 144 | .start = 0x2C010300, |
| 145 | .end = 0x2C010300 + 16, |
| 146 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 147 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 148 | |
| 149 | .start = IRQ_PF9, |
| 150 | .end = IRQ_PF9, |
| 151 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 152 | }, |
| 153 | }; |
| 154 | |
| 155 | static struct platform_device smc91x_device = { |
| 156 | .name = "smc91x", |
| 157 | .id = 0, |
| 158 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 159 | .resource = smc91x_resources, |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 160 | .dev = { |
| 161 | .platform_data = &smc91x_info, |
| 162 | }, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 163 | }; |
| 164 | #endif |
| 165 | |
| 166 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 167 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 168 | static struct resource bfin_uart0_resources[] = { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 169 | { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 170 | .start = BFIN_UART_THR, |
| 171 | .end = BFIN_UART_GCTL+2, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 172 | .flags = IORESOURCE_MEM, |
| 173 | }, |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 174 | { |
Sonic Zhang | edb0a64 | 2011-08-01 17:53:21 +0800 | [diff] [blame] | 175 | .start = IRQ_UART_TX, |
| 176 | .end = IRQ_UART_TX, |
| 177 | .flags = IORESOURCE_IRQ, |
| 178 | }, |
| 179 | { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 180 | .start = IRQ_UART_RX, |
Sonic Zhang | edb0a64 | 2011-08-01 17:53:21 +0800 | [diff] [blame] | 181 | .end = IRQ_UART_RX, |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 182 | .flags = IORESOURCE_IRQ, |
| 183 | }, |
| 184 | { |
| 185 | .start = IRQ_UART_ERROR, |
| 186 | .end = IRQ_UART_ERROR, |
| 187 | .flags = IORESOURCE_IRQ, |
| 188 | }, |
| 189 | { |
| 190 | .start = CH_UART_TX, |
| 191 | .end = CH_UART_TX, |
| 192 | .flags = IORESOURCE_DMA, |
| 193 | }, |
| 194 | { |
| 195 | .start = CH_UART_RX, |
| 196 | .end = CH_UART_RX, |
| 197 | .flags = IORESOURCE_DMA, |
| 198 | }, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 199 | }; |
| 200 | |
Mike Frysinger | a8b1988 | 2010-11-24 09:23:04 +0000 | [diff] [blame] | 201 | static unsigned short bfin_uart0_peripherals[] = { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 202 | P_UART0_TX, P_UART0_RX, 0 |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 203 | }; |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 204 | |
| 205 | static struct platform_device bfin_uart0_device = { |
| 206 | .name = "bfin-uart", |
| 207 | .id = 0, |
| 208 | .num_resources = ARRAY_SIZE(bfin_uart0_resources), |
| 209 | .resource = bfin_uart0_resources, |
| 210 | .dev = { |
| 211 | .platform_data = &bfin_uart0_peripherals, /* Passed to driver */ |
| 212 | }, |
| 213 | }; |
| 214 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 215 | #endif |
| 216 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 217 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 218 | #ifdef CONFIG_BFIN_SIR0 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 219 | static struct resource bfin_sir0_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 220 | { |
| 221 | .start = 0xFFC00400, |
| 222 | .end = 0xFFC004FF, |
| 223 | .flags = IORESOURCE_MEM, |
| 224 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 225 | { |
| 226 | .start = IRQ_UART0_RX, |
| 227 | .end = IRQ_UART0_RX+1, |
| 228 | .flags = IORESOURCE_IRQ, |
| 229 | }, |
| 230 | { |
| 231 | .start = CH_UART0_RX, |
| 232 | .end = CH_UART0_RX+1, |
| 233 | .flags = IORESOURCE_DMA, |
| 234 | }, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 235 | }; |
| 236 | |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 237 | static struct platform_device bfin_sir0_device = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 238 | .name = "bfin_sir", |
| 239 | .id = 0, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 240 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
| 241 | .resource = bfin_sir0_resources, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 242 | }; |
| 243 | #endif |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 244 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 245 | |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 246 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 247 | static struct mtd_partition ezkit_partitions[] = { |
| 248 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 249 | .name = "bootloader(nor)", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 250 | .size = 0x40000, |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 251 | .offset = 0, |
| 252 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 253 | .name = "linux kernel(nor)", |
Grace Pan | ac76d88 | 2008-04-24 06:33:56 +0800 | [diff] [blame] | 254 | .size = 0x1C0000, |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 255 | .offset = MTDPART_OFS_APPEND, |
| 256 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 257 | .name = "file system(nor)", |
Mike Frysinger | 5607204 | 2011-05-09 18:46:17 -0400 | [diff] [blame] | 258 | .size = 0x800000 - 0x40000 - 0x1C0000 - 0x2000 * 8, |
| 259 | .offset = MTDPART_OFS_APPEND, |
| 260 | }, { |
| 261 | .name = "config(nor)", |
| 262 | .size = 0x2000 * 7, |
| 263 | .offset = MTDPART_OFS_APPEND, |
| 264 | }, { |
| 265 | .name = "u-boot env(nor)", |
| 266 | .size = 0x2000, |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 267 | .offset = MTDPART_OFS_APPEND, |
| 268 | } |
| 269 | }; |
| 270 | |
| 271 | static struct physmap_flash_data ezkit_flash_data = { |
| 272 | .width = 2, |
| 273 | .parts = ezkit_partitions, |
| 274 | .nr_parts = ARRAY_SIZE(ezkit_partitions), |
| 275 | }; |
| 276 | |
| 277 | static struct resource ezkit_flash_resource = { |
| 278 | .start = 0x20000000, |
| 279 | .end = 0x207fffff, |
| 280 | .flags = IORESOURCE_MEM, |
| 281 | }; |
| 282 | |
| 283 | static struct platform_device ezkit_flash_device = { |
| 284 | .name = "physmap-flash", |
| 285 | .id = 0, |
| 286 | .dev = { |
| 287 | .platform_data = &ezkit_flash_data, |
| 288 | }, |
| 289 | .num_resources = 1, |
| 290 | .resource = &ezkit_flash_resource, |
| 291 | }; |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 292 | #endif |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 293 | |
Sonic Zhang | 7d157fb | 2011-11-07 18:40:10 +0800 | [diff] [blame] | 294 | #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 295 | /* SPI (0) */ |
| 296 | static struct resource bfin_spi0_resource[] = { |
| 297 | [0] = { |
| 298 | .start = SPI0_REGBASE, |
| 299 | .end = SPI0_REGBASE + 0xFF, |
| 300 | .flags = IORESOURCE_MEM, |
| 301 | }, |
| 302 | [1] = { |
| 303 | .start = CH_SPI, |
| 304 | .end = CH_SPI, |
Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 305 | .flags = IORESOURCE_DMA, |
| 306 | }, |
| 307 | [2] = { |
| 308 | .start = IRQ_SPI, |
| 309 | .end = IRQ_SPI, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 310 | .flags = IORESOURCE_IRQ, |
| 311 | } |
| 312 | }; |
| 313 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 314 | /* SPI controller data */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 315 | static struct bfin5xx_spi_master bfin_spi0_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 316 | .num_chipselect = 8, |
| 317 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 318 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 319 | }; |
| 320 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 321 | static struct platform_device bfin_spi0_device = { |
| 322 | .name = "bfin-spi", |
| 323 | .id = 0, /* Bus number */ |
| 324 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 325 | .resource = bfin_spi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 326 | .dev = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 327 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 328 | }, |
| 329 | }; |
Mike Frysinger | 5bda272 | 2008-06-07 15:03:01 +0800 | [diff] [blame] | 330 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 331 | |
| 332 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 333 | #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \ |
| 334 | || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 335 | { |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 336 | .modalias = "ad183x", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 337 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 338 | .bus_num = 0, |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 339 | .chip_select = 4, |
Barry Song | 027285e | 2010-06-28 08:39:37 +0000 | [diff] [blame] | 340 | .platform_data = "ad1836", /* only includes chip name for the moment */ |
Barry Song | 027285e | 2010-06-28 08:39:37 +0000 | [diff] [blame] | 341 | .mode = SPI_MODE_3, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 342 | }, |
| 343 | #endif |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 344 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 345 | { |
| 346 | .modalias = "spidev", |
| 347 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 348 | .bus_num = 0, |
| 349 | .chip_select = 1, |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 350 | }, |
| 351 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 352 | }; |
| 353 | |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 354 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 355 | #include <linux/input.h> |
| 356 | #include <linux/gpio_keys.h> |
| 357 | |
| 358 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
| 359 | {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"}, |
| 360 | {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"}, |
| 361 | {BTN_2, GPIO_PF7, 1, "gpio-keys: BTN2"}, |
| 362 | {BTN_3, GPIO_PF8, 1, "gpio-keys: BTN3"}, |
| 363 | }; |
| 364 | |
| 365 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 366 | .buttons = bfin_gpio_keys_table, |
| 367 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 368 | }; |
| 369 | |
| 370 | static struct platform_device bfin_device_gpiokeys = { |
| 371 | .name = "gpio-keys", |
| 372 | .dev = { |
| 373 | .platform_data = &bfin_gpio_keys_data, |
| 374 | }, |
| 375 | }; |
| 376 | #endif |
| 377 | |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 378 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) |
| 379 | #include <linux/i2c-gpio.h> |
| 380 | |
| 381 | static struct i2c_gpio_platform_data i2c_gpio_data = { |
Mike Frysinger | 3d7dc88 | 2010-07-02 21:02:50 +0000 | [diff] [blame] | 382 | .sda_pin = GPIO_PF1, |
| 383 | .scl_pin = GPIO_PF0, |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 384 | .sda_is_open_drain = 0, |
| 385 | .scl_is_open_drain = 0, |
Aaron Wu | 7c8e62d | 2011-12-12 18:04:54 +0800 | [diff] [blame] | 386 | .udelay = 10, |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 387 | }; |
| 388 | |
| 389 | static struct platform_device i2c_gpio_device = { |
| 390 | .name = "i2c-gpio", |
| 391 | .id = 0, |
| 392 | .dev = { |
| 393 | .platform_data = &i2c_gpio_data, |
| 394 | }, |
| 395 | }; |
| 396 | #endif |
| 397 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 398 | static const unsigned int cclk_vlev_datasheet[] = |
| 399 | { |
| 400 | VRPAIR(VLEV_085, 250000000), |
| 401 | VRPAIR(VLEV_090, 300000000), |
| 402 | VRPAIR(VLEV_095, 313000000), |
| 403 | VRPAIR(VLEV_100, 350000000), |
| 404 | VRPAIR(VLEV_105, 400000000), |
| 405 | VRPAIR(VLEV_110, 444000000), |
| 406 | VRPAIR(VLEV_115, 450000000), |
| 407 | VRPAIR(VLEV_120, 475000000), |
| 408 | VRPAIR(VLEV_125, 500000000), |
| 409 | VRPAIR(VLEV_130, 600000000), |
| 410 | }; |
| 411 | |
| 412 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { |
| 413 | .tuple_tab = cclk_vlev_datasheet, |
| 414 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), |
| 415 | .vr_settling_time = 25 /* us */, |
| 416 | }; |
| 417 | |
| 418 | static struct platform_device bfin_dpmc = { |
| 419 | .name = "bfin dpmc", |
| 420 | .dev = { |
| 421 | .platform_data = &bfin_dmpc_vreg_data, |
| 422 | }, |
| 423 | }; |
| 424 | |
Bob Liu | dda6779 | 2012-01-05 11:11:20 +0800 | [diff] [blame] | 425 | #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \ |
| 426 | || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE) |
| 427 | #include <linux/videodev2.h> |
| 428 | #include <media/blackfin/bfin_capture.h> |
| 429 | #include <media/blackfin/ppi.h> |
| 430 | |
| 431 | static const unsigned short ppi_req[] = { |
| 432 | P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3, |
| 433 | P_PPI0_D4, P_PPI0_D5, P_PPI0_D6, P_PPI0_D7, |
| 434 | P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2, |
| 435 | 0, |
| 436 | }; |
| 437 | |
| 438 | static const struct ppi_info ppi_info = { |
| 439 | .type = PPI_TYPE_PPI, |
| 440 | .dma_ch = CH_PPI0, |
| 441 | .irq_err = IRQ_PPI1_ERROR, |
| 442 | .base = (void __iomem *)PPI0_CONTROL, |
| 443 | .pin_req = ppi_req, |
| 444 | }; |
| 445 | |
| 446 | #if defined(CONFIG_VIDEO_ADV7183) \ |
| 447 | || defined(CONFIG_VIDEO_ADV7183_MODULE) |
| 448 | #include <media/adv7183.h> |
| 449 | static struct v4l2_input adv7183_inputs[] = { |
| 450 | { |
| 451 | .index = 0, |
| 452 | .name = "Composite", |
| 453 | .type = V4L2_INPUT_TYPE_CAMERA, |
| 454 | .std = V4L2_STD_ALL, |
Scott Jiang | c38670b | 2012-06-20 18:46:54 -0400 | [diff] [blame] | 455 | .capabilities = V4L2_IN_CAP_STD, |
Bob Liu | dda6779 | 2012-01-05 11:11:20 +0800 | [diff] [blame] | 456 | }, |
| 457 | { |
| 458 | .index = 1, |
| 459 | .name = "S-Video", |
| 460 | .type = V4L2_INPUT_TYPE_CAMERA, |
| 461 | .std = V4L2_STD_ALL, |
Scott Jiang | c38670b | 2012-06-20 18:46:54 -0400 | [diff] [blame] | 462 | .capabilities = V4L2_IN_CAP_STD, |
Bob Liu | dda6779 | 2012-01-05 11:11:20 +0800 | [diff] [blame] | 463 | }, |
| 464 | { |
| 465 | .index = 2, |
| 466 | .name = "Component", |
| 467 | .type = V4L2_INPUT_TYPE_CAMERA, |
| 468 | .std = V4L2_STD_ALL, |
Scott Jiang | c38670b | 2012-06-20 18:46:54 -0400 | [diff] [blame] | 469 | .capabilities = V4L2_IN_CAP_STD, |
Bob Liu | dda6779 | 2012-01-05 11:11:20 +0800 | [diff] [blame] | 470 | }, |
| 471 | }; |
| 472 | |
| 473 | static struct bcap_route adv7183_routes[] = { |
| 474 | { |
| 475 | .input = ADV7183_COMPOSITE4, |
| 476 | .output = ADV7183_8BIT_OUT, |
| 477 | }, |
| 478 | { |
| 479 | .input = ADV7183_SVIDEO0, |
| 480 | .output = ADV7183_8BIT_OUT, |
| 481 | }, |
| 482 | { |
| 483 | .input = ADV7183_COMPONENT0, |
| 484 | .output = ADV7183_8BIT_OUT, |
| 485 | }, |
| 486 | }; |
| 487 | |
| 488 | |
| 489 | static const unsigned adv7183_gpio[] = { |
| 490 | GPIO_PF13, /* reset pin */ |
| 491 | GPIO_PF2, /* output enable pin */ |
| 492 | }; |
| 493 | |
| 494 | static struct bfin_capture_config bfin_capture_data = { |
| 495 | .card_name = "BF561", |
| 496 | .inputs = adv7183_inputs, |
| 497 | .num_inputs = ARRAY_SIZE(adv7183_inputs), |
| 498 | .routes = adv7183_routes, |
| 499 | .i2c_adapter_id = 0, |
| 500 | .board_info = { |
| 501 | .type = "adv7183", |
| 502 | .addr = 0x20, |
| 503 | .platform_data = (void *)adv7183_gpio, |
| 504 | }, |
| 505 | .ppi_info = &ppi_info, |
| 506 | .ppi_control = (PACK_EN | DLEN_8 | DMA32 | FLD_SEL), |
| 507 | }; |
| 508 | #endif |
| 509 | |
| 510 | static struct platform_device bfin_capture_device = { |
| 511 | .name = "bfin_capture", |
| 512 | .dev = { |
| 513 | .platform_data = &bfin_capture_data, |
| 514 | }, |
| 515 | }; |
| 516 | #endif |
| 517 | |
Barry Song | 027285e | 2010-06-28 08:39:37 +0000 | [diff] [blame] | 518 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) |
| 519 | static struct platform_device bfin_i2s = { |
| 520 | .name = "bfin-i2s", |
| 521 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
| 522 | /* TODO: add platform data here */ |
| 523 | }; |
| 524 | #endif |
| 525 | |
| 526 | #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) |
| 527 | static struct platform_device bfin_tdm = { |
| 528 | .name = "bfin-tdm", |
| 529 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
| 530 | /* TODO: add platform data here */ |
| 531 | }; |
| 532 | #endif |
| 533 | |
| 534 | #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) |
| 535 | static struct platform_device bfin_ac97 = { |
| 536 | .name = "bfin-ac97", |
| 537 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
| 538 | /* TODO: add platform data here */ |
| 539 | }; |
| 540 | #endif |
| 541 | |
Scott Jiang | 63f49dc | 2012-08-10 18:06:09 -0400 | [diff] [blame] | 542 | #if defined(CONFIG_SND_BF5XX_SOC_AD1836) \ |
| 543 | || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE) |
| 544 | static const char * const ad1836_link[] = { |
| 545 | "bfin-tdm.0", |
| 546 | "spi0.4", |
| 547 | }; |
| 548 | static struct platform_device bfin_ad1836_machine = { |
| 549 | .name = "bfin-snd-ad1836", |
| 550 | .id = -1, |
| 551 | .dev = { |
| 552 | .platform_data = (void *)ad1836_link, |
| 553 | }, |
| 554 | }; |
| 555 | #endif |
| 556 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 557 | static struct platform_device *ezkit_devices[] __initdata = { |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 558 | |
| 559 | &bfin_dpmc, |
| 560 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 561 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 562 | &smc91x_device, |
| 563 | #endif |
Michael Hennerich | 561cc18 | 2007-11-17 23:56:08 +0800 | [diff] [blame] | 564 | |
Michael Hennerich | 83d9cde | 2008-02-02 16:25:17 +0800 | [diff] [blame] | 565 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 566 | &net2272_bfin_device, |
| 567 | #endif |
| 568 | |
Michael Hennerich | 3f37569 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 569 | #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) |
| 570 | &bfin_isp1760_device, |
| 571 | #endif |
| 572 | |
Sonic Zhang | 7d157fb | 2011-11-07 18:40:10 +0800 | [diff] [blame] | 573 | #if defined(CONFIG_SPI_BFIN5XX) || defined(CONFIG_SPI_BFIN5XX_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 574 | &bfin_spi0_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 575 | #endif |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 576 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 577 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 578 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 579 | &bfin_uart0_device, |
| 580 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 581 | #endif |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 582 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 583 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 584 | #ifdef CONFIG_BFIN_SIR0 |
| 585 | &bfin_sir0_device, |
| 586 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 587 | #endif |
| 588 | |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 589 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 590 | &bfin_device_gpiokeys, |
| 591 | #endif |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 592 | |
| 593 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) |
| 594 | &i2c_gpio_device, |
| 595 | #endif |
Michael Hennerich | e9d76c2 | 2008-02-02 14:55:28 +0800 | [diff] [blame] | 596 | |
| 597 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 598 | &isp1362_hcd_device, |
| 599 | #endif |
| 600 | |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 601 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 602 | &ezkit_flash_device, |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 603 | #endif |
Barry Song | 027285e | 2010-06-28 08:39:37 +0000 | [diff] [blame] | 604 | |
Bob Liu | dda6779 | 2012-01-05 11:11:20 +0800 | [diff] [blame] | 605 | #if defined(CONFIG_VIDEO_BLACKFIN_CAPTURE) \ |
| 606 | || defined(CONFIG_VIDEO_BLACKFIN_CAPTURE_MODULE) |
| 607 | &bfin_capture_device, |
| 608 | #endif |
| 609 | |
Barry Song | 027285e | 2010-06-28 08:39:37 +0000 | [diff] [blame] | 610 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) |
| 611 | &bfin_i2s, |
| 612 | #endif |
| 613 | |
| 614 | #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) |
| 615 | &bfin_tdm, |
| 616 | #endif |
| 617 | |
| 618 | #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) |
| 619 | &bfin_ac97, |
| 620 | #endif |
Scott Jiang | 63f49dc | 2012-08-10 18:06:09 -0400 | [diff] [blame] | 621 | |
| 622 | #if defined(CONFIG_SND_BF5XX_SOC_AD1836) || \ |
| 623 | defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE) |
| 624 | &bfin_ad1836_machine, |
| 625 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 626 | }; |
| 627 | |
Mike Frysinger | 9be8631 | 2011-05-04 11:20:15 -0400 | [diff] [blame] | 628 | static int __init net2272_init(void) |
| 629 | { |
| 630 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 631 | int ret; |
| 632 | |
| 633 | ret = gpio_request(GPIO_PF11, "net2272"); |
| 634 | if (ret) |
| 635 | return ret; |
| 636 | |
| 637 | /* Reset the USB chip */ |
| 638 | gpio_direction_output(GPIO_PF11, 0); |
| 639 | mdelay(2); |
| 640 | gpio_set_value(GPIO_PF11, 1); |
| 641 | #endif |
| 642 | |
| 643 | return 0; |
| 644 | } |
| 645 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 646 | static int __init ezkit_init(void) |
| 647 | { |
| 648 | int ret; |
| 649 | |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 650 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 651 | |
| 652 | ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 653 | if (ret < 0) |
| 654 | return ret; |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 655 | |
| 656 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 657 | bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12)); |
| 658 | SSYNC(); |
| 659 | #endif |
| 660 | |
Barry Song | 027285e | 2010-06-28 08:39:37 +0000 | [diff] [blame] | 661 | #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE) |
| 662 | bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 15)); |
| 663 | bfin_write_FIO0_FLAG_S(1 << 15); |
| 664 | SSYNC(); |
| 665 | /* |
| 666 | * This initialization lasts for approximately 4500 MCLKs. |
| 667 | * MCLK = 12.288MHz |
| 668 | */ |
| 669 | udelay(400); |
| 670 | #endif |
| 671 | |
Mike Frysinger | 9be8631 | 2011-05-04 11:20:15 -0400 | [diff] [blame] | 672 | if (net2272_init()) |
| 673 | pr_warning("unable to configure net2272; it probably won't work\n"); |
| 674 | |
Mike Frysinger | 5bda272 | 2008-06-07 15:03:01 +0800 | [diff] [blame] | 675 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 676 | return 0; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 677 | } |
| 678 | |
| 679 | arch_initcall(ezkit_init); |
Sonic Zhang | c13ce9f | 2009-09-23 09:37:46 +0000 | [diff] [blame] | 680 | |
| 681 | static struct platform_device *ezkit_early_devices[] __initdata = { |
| 682 | #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK) |
| 683 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 684 | &bfin_uart0_device, |
| 685 | #endif |
| 686 | #endif |
| 687 | }; |
| 688 | |
| 689 | void __init native_machine_early_platform_add_devices(void) |
| 690 | { |
| 691 | printk(KERN_INFO "register early platform devices\n"); |
| 692 | early_platform_add_devices(ezkit_early_devices, |
| 693 | ARRAY_SIZE(ezkit_early_devices)); |
| 694 | } |