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 | }, { |
| 111 | .start = IRQ_PF10, |
| 112 | .end = IRQ_PF10, |
| 113 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 114 | }, |
| 115 | }; |
| 116 | |
| 117 | static struct platform_device net2272_bfin_device = { |
| 118 | .name = "net2272", |
| 119 | .id = -1, |
| 120 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), |
| 121 | .resource = net2272_bfin_resources, |
| 122 | }; |
| 123 | #endif |
| 124 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 125 | /* |
| 126 | * USB-LAN EzExtender board |
| 127 | * Driver needs to know address, irq and flag pin. |
| 128 | */ |
| 129 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 130 | #include <linux/smc91x.h> |
| 131 | |
| 132 | static struct smc91x_platdata smc91x_info = { |
| 133 | .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT, |
| 134 | .leda = RPC_LED_100_10, |
| 135 | .ledb = RPC_LED_TX_RX, |
| 136 | }; |
| 137 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 138 | static struct resource smc91x_resources[] = { |
| 139 | { |
| 140 | .name = "smc91x-regs", |
| 141 | .start = 0x2C010300, |
| 142 | .end = 0x2C010300 + 16, |
| 143 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 144 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 145 | |
| 146 | .start = IRQ_PF9, |
| 147 | .end = IRQ_PF9, |
| 148 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 149 | }, |
| 150 | }; |
| 151 | |
| 152 | static struct platform_device smc91x_device = { |
| 153 | .name = "smc91x", |
| 154 | .id = 0, |
| 155 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 156 | .resource = smc91x_resources, |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 157 | .dev = { |
| 158 | .platform_data = &smc91x_info, |
| 159 | }, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 160 | }; |
| 161 | #endif |
| 162 | |
| 163 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 164 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 165 | static struct resource bfin_uart0_resources[] = { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 166 | { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 167 | .start = BFIN_UART_THR, |
| 168 | .end = BFIN_UART_GCTL+2, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 169 | .flags = IORESOURCE_MEM, |
| 170 | }, |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 171 | { |
| 172 | .start = IRQ_UART_RX, |
| 173 | .end = IRQ_UART_RX+1, |
| 174 | .flags = IORESOURCE_IRQ, |
| 175 | }, |
| 176 | { |
| 177 | .start = IRQ_UART_ERROR, |
| 178 | .end = IRQ_UART_ERROR, |
| 179 | .flags = IORESOURCE_IRQ, |
| 180 | }, |
| 181 | { |
| 182 | .start = CH_UART_TX, |
| 183 | .end = CH_UART_TX, |
| 184 | .flags = IORESOURCE_DMA, |
| 185 | }, |
| 186 | { |
| 187 | .start = CH_UART_RX, |
| 188 | .end = CH_UART_RX, |
| 189 | .flags = IORESOURCE_DMA, |
| 190 | }, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 191 | }; |
| 192 | |
Mike Frysinger | a8b1988 | 2010-11-24 09:23:04 +0000 | [diff] [blame] | 193 | static unsigned short bfin_uart0_peripherals[] = { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 194 | P_UART0_TX, P_UART0_RX, 0 |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 195 | }; |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 196 | |
| 197 | static struct platform_device bfin_uart0_device = { |
| 198 | .name = "bfin-uart", |
| 199 | .id = 0, |
| 200 | .num_resources = ARRAY_SIZE(bfin_uart0_resources), |
| 201 | .resource = bfin_uart0_resources, |
| 202 | .dev = { |
| 203 | .platform_data = &bfin_uart0_peripherals, /* Passed to driver */ |
| 204 | }, |
| 205 | }; |
| 206 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 207 | #endif |
| 208 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 209 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 210 | #ifdef CONFIG_BFIN_SIR0 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 211 | static struct resource bfin_sir0_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 212 | { |
| 213 | .start = 0xFFC00400, |
| 214 | .end = 0xFFC004FF, |
| 215 | .flags = IORESOURCE_MEM, |
| 216 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 217 | { |
| 218 | .start = IRQ_UART0_RX, |
| 219 | .end = IRQ_UART0_RX+1, |
| 220 | .flags = IORESOURCE_IRQ, |
| 221 | }, |
| 222 | { |
| 223 | .start = CH_UART0_RX, |
| 224 | .end = CH_UART0_RX+1, |
| 225 | .flags = IORESOURCE_DMA, |
| 226 | }, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 227 | }; |
| 228 | |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 229 | static struct platform_device bfin_sir0_device = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 230 | .name = "bfin_sir", |
| 231 | .id = 0, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 232 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
| 233 | .resource = bfin_sir0_resources, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 234 | }; |
| 235 | #endif |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 236 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 237 | |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 238 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 239 | static struct mtd_partition ezkit_partitions[] = { |
| 240 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 241 | .name = "bootloader(nor)", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 242 | .size = 0x40000, |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 243 | .offset = 0, |
| 244 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 245 | .name = "linux kernel(nor)", |
Grace Pan | ac76d88 | 2008-04-24 06:33:56 +0800 | [diff] [blame] | 246 | .size = 0x1C0000, |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 247 | .offset = MTDPART_OFS_APPEND, |
| 248 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 249 | .name = "file system(nor)", |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 250 | .size = MTDPART_SIZ_FULL, |
| 251 | .offset = MTDPART_OFS_APPEND, |
| 252 | } |
| 253 | }; |
| 254 | |
| 255 | static struct physmap_flash_data ezkit_flash_data = { |
| 256 | .width = 2, |
| 257 | .parts = ezkit_partitions, |
| 258 | .nr_parts = ARRAY_SIZE(ezkit_partitions), |
| 259 | }; |
| 260 | |
| 261 | static struct resource ezkit_flash_resource = { |
| 262 | .start = 0x20000000, |
| 263 | .end = 0x207fffff, |
| 264 | .flags = IORESOURCE_MEM, |
| 265 | }; |
| 266 | |
| 267 | static struct platform_device ezkit_flash_device = { |
| 268 | .name = "physmap-flash", |
| 269 | .id = 0, |
| 270 | .dev = { |
| 271 | .platform_data = &ezkit_flash_data, |
| 272 | }, |
| 273 | .num_resources = 1, |
| 274 | .resource = &ezkit_flash_resource, |
| 275 | }; |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 276 | #endif |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 277 | |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 278 | #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \ |
| 279 | || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 280 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 281 | .enable_dma = 0, |
| 282 | .bits_per_word = 16, |
| 283 | }; |
| 284 | #endif |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 285 | |
| 286 | #if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) |
| 287 | static struct bfin5xx_spi_chip spidev_chip_info = { |
| 288 | .enable_dma = 0, |
| 289 | .bits_per_word = 8, |
| 290 | }; |
| 291 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 292 | |
Mike Frysinger | 5bda272 | 2008-06-07 15:03:01 +0800 | [diff] [blame] | 293 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 294 | /* SPI (0) */ |
| 295 | static struct resource bfin_spi0_resource[] = { |
| 296 | [0] = { |
| 297 | .start = SPI0_REGBASE, |
| 298 | .end = SPI0_REGBASE + 0xFF, |
| 299 | .flags = IORESOURCE_MEM, |
| 300 | }, |
| 301 | [1] = { |
| 302 | .start = CH_SPI, |
| 303 | .end = CH_SPI, |
Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 304 | .flags = IORESOURCE_DMA, |
| 305 | }, |
| 306 | [2] = { |
| 307 | .start = IRQ_SPI, |
| 308 | .end = IRQ_SPI, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 309 | .flags = IORESOURCE_IRQ, |
| 310 | } |
| 311 | }; |
| 312 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 313 | /* SPI controller data */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 314 | static struct bfin5xx_spi_master bfin_spi0_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 315 | .num_chipselect = 8, |
| 316 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 317 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 318 | }; |
| 319 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 320 | static struct platform_device bfin_spi0_device = { |
| 321 | .name = "bfin-spi", |
| 322 | .id = 0, /* Bus number */ |
| 323 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 324 | .resource = bfin_spi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 325 | .dev = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 326 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 327 | }, |
| 328 | }; |
Mike Frysinger | 5bda272 | 2008-06-07 15:03:01 +0800 | [diff] [blame] | 329 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 330 | |
| 331 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 332 | #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \ |
| 333 | || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 334 | { |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 335 | .modalias = "ad183x", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 336 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 337 | .bus_num = 0, |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 338 | .chip_select = 4, |
Barry Song | 027285e | 2010-06-28 08:39:37 +0000 | [diff] [blame] | 339 | .platform_data = "ad1836", /* only includes chip name for the moment */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 340 | .controller_data = &ad1836_spi_chip_info, |
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, |
| 350 | .controller_data = &spidev_chip_info, |
| 351 | }, |
| 352 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 353 | }; |
| 354 | |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 355 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 356 | #include <linux/input.h> |
| 357 | #include <linux/gpio_keys.h> |
| 358 | |
| 359 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
| 360 | {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"}, |
| 361 | {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"}, |
| 362 | {BTN_2, GPIO_PF7, 1, "gpio-keys: BTN2"}, |
| 363 | {BTN_3, GPIO_PF8, 1, "gpio-keys: BTN3"}, |
| 364 | }; |
| 365 | |
| 366 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 367 | .buttons = bfin_gpio_keys_table, |
| 368 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 369 | }; |
| 370 | |
| 371 | static struct platform_device bfin_device_gpiokeys = { |
| 372 | .name = "gpio-keys", |
| 373 | .dev = { |
| 374 | .platform_data = &bfin_gpio_keys_data, |
| 375 | }, |
| 376 | }; |
| 377 | #endif |
| 378 | |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 379 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) |
| 380 | #include <linux/i2c-gpio.h> |
| 381 | |
| 382 | static struct i2c_gpio_platform_data i2c_gpio_data = { |
Mike Frysinger | 3d7dc88 | 2010-07-02 21:02:50 +0000 | [diff] [blame] | 383 | .sda_pin = GPIO_PF1, |
| 384 | .scl_pin = GPIO_PF0, |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 385 | .sda_is_open_drain = 0, |
| 386 | .scl_is_open_drain = 0, |
| 387 | .udelay = 40, |
| 388 | }; |
| 389 | |
| 390 | static struct platform_device i2c_gpio_device = { |
| 391 | .name = "i2c-gpio", |
| 392 | .id = 0, |
| 393 | .dev = { |
| 394 | .platform_data = &i2c_gpio_data, |
| 395 | }, |
| 396 | }; |
| 397 | #endif |
| 398 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 399 | static const unsigned int cclk_vlev_datasheet[] = |
| 400 | { |
| 401 | VRPAIR(VLEV_085, 250000000), |
| 402 | VRPAIR(VLEV_090, 300000000), |
| 403 | VRPAIR(VLEV_095, 313000000), |
| 404 | VRPAIR(VLEV_100, 350000000), |
| 405 | VRPAIR(VLEV_105, 400000000), |
| 406 | VRPAIR(VLEV_110, 444000000), |
| 407 | VRPAIR(VLEV_115, 450000000), |
| 408 | VRPAIR(VLEV_120, 475000000), |
| 409 | VRPAIR(VLEV_125, 500000000), |
| 410 | VRPAIR(VLEV_130, 600000000), |
| 411 | }; |
| 412 | |
| 413 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { |
| 414 | .tuple_tab = cclk_vlev_datasheet, |
| 415 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), |
| 416 | .vr_settling_time = 25 /* us */, |
| 417 | }; |
| 418 | |
| 419 | static struct platform_device bfin_dpmc = { |
| 420 | .name = "bfin dpmc", |
| 421 | .dev = { |
| 422 | .platform_data = &bfin_dmpc_vreg_data, |
| 423 | }, |
| 424 | }; |
| 425 | |
Barry Song | 027285e | 2010-06-28 08:39:37 +0000 | [diff] [blame] | 426 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) |
| 427 | static struct platform_device bfin_i2s = { |
| 428 | .name = "bfin-i2s", |
| 429 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
| 430 | /* TODO: add platform data here */ |
| 431 | }; |
| 432 | #endif |
| 433 | |
| 434 | #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) |
| 435 | static struct platform_device bfin_tdm = { |
| 436 | .name = "bfin-tdm", |
| 437 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
| 438 | /* TODO: add platform data here */ |
| 439 | }; |
| 440 | #endif |
| 441 | |
| 442 | #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) |
| 443 | static struct platform_device bfin_ac97 = { |
| 444 | .name = "bfin-ac97", |
| 445 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
| 446 | /* TODO: add platform data here */ |
| 447 | }; |
| 448 | #endif |
| 449 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 450 | static struct platform_device *ezkit_devices[] __initdata = { |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 451 | |
| 452 | &bfin_dpmc, |
| 453 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 454 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 455 | &smc91x_device, |
| 456 | #endif |
Michael Hennerich | 561cc18 | 2007-11-17 23:56:08 +0800 | [diff] [blame] | 457 | |
Michael Hennerich | 83d9cde | 2008-02-02 16:25:17 +0800 | [diff] [blame] | 458 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 459 | &net2272_bfin_device, |
| 460 | #endif |
| 461 | |
Michael Hennerich | 3f37569 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 462 | #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) |
| 463 | &bfin_isp1760_device, |
| 464 | #endif |
| 465 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 466 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 467 | &bfin_spi0_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 468 | #endif |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 469 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 470 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 471 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 472 | &bfin_uart0_device, |
| 473 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 474 | #endif |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 475 | |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 476 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 477 | #ifdef CONFIG_BFIN_SIR0 |
| 478 | &bfin_sir0_device, |
| 479 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 480 | #endif |
| 481 | |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 482 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 483 | &bfin_device_gpiokeys, |
| 484 | #endif |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 485 | |
| 486 | #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE) |
| 487 | &i2c_gpio_device, |
| 488 | #endif |
Michael Hennerich | e9d76c2 | 2008-02-02 14:55:28 +0800 | [diff] [blame] | 489 | |
| 490 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 491 | &isp1362_hcd_device, |
| 492 | #endif |
| 493 | |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 494 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
Mike Frysinger | de8c43f | 2008-01-24 17:14:04 +0800 | [diff] [blame] | 495 | &ezkit_flash_device, |
Mike Frysinger | 793dc27 | 2008-03-26 08:09:12 +0800 | [diff] [blame] | 496 | #endif |
Barry Song | 027285e | 2010-06-28 08:39:37 +0000 | [diff] [blame] | 497 | |
| 498 | #if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) |
| 499 | &bfin_i2s, |
| 500 | #endif |
| 501 | |
| 502 | #if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) |
| 503 | &bfin_tdm, |
| 504 | #endif |
| 505 | |
| 506 | #if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) |
| 507 | &bfin_ac97, |
| 508 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 509 | }; |
| 510 | |
| 511 | static int __init ezkit_init(void) |
| 512 | { |
| 513 | int ret; |
| 514 | |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 515 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 516 | |
| 517 | ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 518 | if (ret < 0) |
| 519 | return ret; |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 520 | |
| 521 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 522 | bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12)); |
| 523 | SSYNC(); |
| 524 | #endif |
| 525 | |
Barry Song | 027285e | 2010-06-28 08:39:37 +0000 | [diff] [blame] | 526 | #if defined(CONFIG_SND_BF5XX_SOC_AD183X) || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE) |
| 527 | bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 15)); |
| 528 | bfin_write_FIO0_FLAG_S(1 << 15); |
| 529 | SSYNC(); |
| 530 | /* |
| 531 | * This initialization lasts for approximately 4500 MCLKs. |
| 532 | * MCLK = 12.288MHz |
| 533 | */ |
| 534 | udelay(400); |
| 535 | #endif |
| 536 | |
Mike Frysinger | 5bda272 | 2008-06-07 15:03:01 +0800 | [diff] [blame] | 537 | 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] | 538 | return 0; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 539 | } |
| 540 | |
| 541 | arch_initcall(ezkit_init); |
Sonic Zhang | c13ce9f | 2009-09-23 09:37:46 +0000 | [diff] [blame] | 542 | |
| 543 | static struct platform_device *ezkit_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(ezkit_early_devices, |
| 555 | ARRAY_SIZE(ezkit_early_devices)); |
| 556 | } |