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> |
| 11 | #include <linux/mtd/mtd.h> |
| 12 | #include <linux/mtd/partitions.h> |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 13 | #include <linux/mtd/plat-ram.h> |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 14 | #include <linux/mtd/physmap.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 15 | #include <linux/spi/spi.h> |
| 16 | #include <linux/spi/flash.h> |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 17 | #if IS_ENABLED(CONFIG_USB_ISP1362_HCD) |
Mike Frysinger | f02bcec | 2007-11-15 21:29:15 +0800 | [diff] [blame] | 18 | #include <linux/usb/isp1362.h> |
Mike Frysinger | 67f2d33 | 2008-02-09 01:49:23 +0800 | [diff] [blame] | 19 | #endif |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 20 | #include <linux/irq.h> |
Michael Hennerich | 50c4c08 | 2009-09-22 13:10:09 +0000 | [diff] [blame] | 21 | #include <linux/i2c.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> |
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 | fe85cad | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 30 | const char bfin_board_name[] = "ADI BF533-EZKIT"; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 31 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 32 | #if IS_ENABLED(CONFIG_RTC_DRV_BFIN) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 33 | static struct platform_device rtc_device = { |
| 34 | .name = "rtc-bfin", |
| 35 | .id = -1, |
| 36 | }; |
| 37 | #endif |
| 38 | |
| 39 | /* |
| 40 | * USB-LAN EzExtender board |
| 41 | * Driver needs to know address, irq and flag pin. |
| 42 | */ |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 43 | #if IS_ENABLED(CONFIG_SMC91X) |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 44 | #include <linux/smc91x.h> |
| 45 | |
| 46 | static struct smc91x_platdata smc91x_info = { |
| 47 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, |
| 48 | .leda = RPC_LED_100_10, |
| 49 | .ledb = RPC_LED_TX_RX, |
| 50 | }; |
| 51 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 52 | static struct resource smc91x_resources[] = { |
| 53 | { |
| 54 | .name = "smc91x-regs", |
| 55 | .start = 0x20310300, |
| 56 | .end = 0x20310300 + 16, |
| 57 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 58 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 59 | .start = IRQ_PF9, |
| 60 | .end = IRQ_PF9, |
| 61 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 62 | }, |
| 63 | }; |
| 64 | static struct platform_device smc91x_device = { |
| 65 | .name = "smc91x", |
| 66 | .id = 0, |
| 67 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 68 | .resource = smc91x_resources, |
Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 69 | .dev = { |
| 70 | .platform_data = &smc91x_info, |
| 71 | }, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 72 | }; |
| 73 | #endif |
| 74 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 75 | #if IS_ENABLED(CONFIG_MTD_PHYSMAP) |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 76 | static struct mtd_partition ezkit_partitions_a[] = { |
| 77 | { |
| 78 | .name = "bootloader(nor a)", |
| 79 | .size = 0x40000, |
| 80 | .offset = 0, |
| 81 | }, { |
| 82 | .name = "linux kernel(nor a)", |
| 83 | .size = MTDPART_SIZ_FULL, |
| 84 | .offset = MTDPART_OFS_APPEND, |
| 85 | }, |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 86 | }; |
| 87 | |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 88 | static struct physmap_flash_data ezkit_flash_data_a = { |
| 89 | .width = 2, |
| 90 | .parts = ezkit_partitions_a, |
| 91 | .nr_parts = ARRAY_SIZE(ezkit_partitions_a), |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 92 | }; |
| 93 | |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 94 | static struct resource ezkit_flash_resource_a = { |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 95 | .start = 0x20000000, |
| 96 | .end = 0x200fffff, |
| 97 | .flags = IORESOURCE_MEM, |
| 98 | }; |
| 99 | |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 100 | static struct platform_device ezkit_flash_device_a = { |
| 101 | .name = "physmap-flash", |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 102 | .id = 0, |
| 103 | .dev = { |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 104 | .platform_data = &ezkit_flash_data_a, |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 105 | }, |
| 106 | .num_resources = 1, |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 107 | .resource = &ezkit_flash_resource_a, |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 108 | }; |
| 109 | |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 110 | static struct mtd_partition ezkit_partitions_b[] = { |
| 111 | { |
| 112 | .name = "file system(nor b)", |
| 113 | .size = MTDPART_SIZ_FULL, |
| 114 | .offset = MTDPART_OFS_APPEND, |
| 115 | }, |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 116 | }; |
| 117 | |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 118 | static struct physmap_flash_data ezkit_flash_data_b = { |
| 119 | .width = 2, |
| 120 | .parts = ezkit_partitions_b, |
| 121 | .nr_parts = ARRAY_SIZE(ezkit_partitions_b), |
| 122 | }; |
| 123 | |
| 124 | static struct resource ezkit_flash_resource_b = { |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 125 | .start = 0x20100000, |
| 126 | .end = 0x201fffff, |
| 127 | .flags = IORESOURCE_MEM, |
| 128 | }; |
| 129 | |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 130 | static struct platform_device ezkit_flash_device_b = { |
| 131 | .name = "physmap-flash", |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 132 | .id = 4, |
| 133 | .dev = { |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 134 | .platform_data = &ezkit_flash_data_b, |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 135 | }, |
| 136 | .num_resources = 1, |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 137 | .resource = &ezkit_flash_resource_b, |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 138 | }; |
| 139 | #endif |
| 140 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 141 | #if IS_ENABLED(CONFIG_MTD_PLATRAM) |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 142 | static struct platdata_mtd_ram sram_data_a = { |
| 143 | .mapname = "Flash A SRAM", |
| 144 | .bankwidth = 2, |
| 145 | }; |
| 146 | |
| 147 | static struct resource sram_resource_a = { |
| 148 | .start = 0x20240000, |
| 149 | .end = 0x2024ffff, |
| 150 | .flags = IORESOURCE_MEM, |
| 151 | }; |
| 152 | |
| 153 | static struct platform_device sram_device_a = { |
| 154 | .name = "mtd-ram", |
| 155 | .id = 8, |
| 156 | .dev = { |
| 157 | .platform_data = &sram_data_a, |
| 158 | }, |
| 159 | .num_resources = 1, |
| 160 | .resource = &sram_resource_a, |
| 161 | }; |
| 162 | |
| 163 | static struct platdata_mtd_ram sram_data_b = { |
| 164 | .mapname = "Flash B SRAM", |
| 165 | .bankwidth = 2, |
| 166 | }; |
| 167 | |
| 168 | static struct resource sram_resource_b = { |
| 169 | .start = 0x202c0000, |
| 170 | .end = 0x202cffff, |
| 171 | .flags = IORESOURCE_MEM, |
| 172 | }; |
| 173 | |
| 174 | static struct platform_device sram_device_b = { |
| 175 | .name = "mtd-ram", |
| 176 | .id = 9, |
| 177 | .dev = { |
| 178 | .platform_data = &sram_data_b, |
| 179 | }, |
| 180 | .num_resources = 1, |
| 181 | .resource = &sram_resource_b, |
| 182 | }; |
| 183 | #endif |
| 184 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 185 | #if IS_ENABLED(CONFIG_MTD_M25P80) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 186 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 187 | { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 188 | .name = "bootloader(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 189 | .size = 0x00020000, |
| 190 | .offset = 0, |
| 191 | .mask_flags = MTD_CAP_ROM |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 192 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 193 | .name = "linux kernel(spi)", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 194 | .size = 0xe0000, |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 195 | .offset = MTDPART_OFS_APPEND, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 196 | }, { |
Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 197 | .name = "file system(spi)", |
Mike Frysinger | edf0564 | 2008-02-25 11:38:11 +0800 | [diff] [blame] | 198 | .size = MTDPART_SIZ_FULL, |
| 199 | .offset = MTDPART_OFS_APPEND, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 200 | } |
| 201 | }; |
| 202 | |
| 203 | static struct flash_platform_data bfin_spi_flash_data = { |
| 204 | .name = "m25p80", |
| 205 | .parts = bfin_spi_flash_partitions, |
| 206 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 207 | .type = "m25p64", |
| 208 | }; |
| 209 | |
| 210 | /* SPI flash chip (m25p64) */ |
| 211 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 212 | .enable_dma = 0, /* use dma transfer with this chip*/ |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 213 | }; |
| 214 | #endif |
| 215 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 216 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 217 | #if IS_ENABLED(CONFIG_MTD_M25P80) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 218 | { |
| 219 | /* the modalias must be the same as spi device driver name */ |
| 220 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 221 | .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 222 | .bus_num = 0, /* Framework bus number */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 223 | .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/ |
| 224 | .platform_data = &bfin_spi_flash_data, |
| 225 | .controller_data = &spi_flash_chip_info, |
| 226 | .mode = SPI_MODE_3, |
| 227 | }, |
| 228 | #endif |
| 229 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 230 | #if IS_ENABLED(CONFIG_SND_BF5XX_SOC_AD183X) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 231 | { |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 232 | .modalias = "ad183x", |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 233 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 234 | .bus_num = 0, |
Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 235 | .chip_select = 4, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 236 | }, |
| 237 | #endif |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 238 | #if IS_ENABLED(CONFIG_SPI_SPIDEV) |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 239 | { |
| 240 | .modalias = "spidev", |
| 241 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
| 242 | .bus_num = 0, |
| 243 | .chip_select = 1, |
Michael Hennerich | 6e66893 | 2008-02-09 01:54:09 +0800 | [diff] [blame] | 244 | }, |
| 245 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 246 | }; |
| 247 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 248 | #if IS_ENABLED(CONFIG_SPI_BFIN5XX) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 249 | /* SPI (0) */ |
| 250 | static struct resource bfin_spi0_resource[] = { |
| 251 | [0] = { |
| 252 | .start = SPI0_REGBASE, |
| 253 | .end = SPI0_REGBASE + 0xFF, |
| 254 | .flags = IORESOURCE_MEM, |
| 255 | }, |
| 256 | [1] = { |
| 257 | .start = CH_SPI, |
| 258 | .end = CH_SPI, |
Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 259 | .flags = IORESOURCE_DMA, |
| 260 | }, |
| 261 | [2] = { |
| 262 | .start = IRQ_SPI, |
| 263 | .end = IRQ_SPI, |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 264 | .flags = IORESOURCE_IRQ, |
| 265 | } |
| 266 | }; |
| 267 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 268 | /* SPI controller data */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 269 | static struct bfin5xx_spi_master bfin_spi0_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 270 | .num_chipselect = 8, |
| 271 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 272 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 273 | }; |
| 274 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 275 | static struct platform_device bfin_spi0_device = { |
| 276 | .name = "bfin-spi", |
| 277 | .id = 0, /* Bus number */ |
| 278 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 279 | .resource = bfin_spi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 280 | .dev = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 281 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 282 | }, |
| 283 | }; |
| 284 | #endif /* spi master and devices */ |
| 285 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 286 | #if IS_ENABLED(CONFIG_SERIAL_BFIN) |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 287 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 288 | static struct resource bfin_uart0_resources[] = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 289 | { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 290 | .start = BFIN_UART_THR, |
| 291 | .end = BFIN_UART_GCTL+2, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 292 | .flags = IORESOURCE_MEM, |
| 293 | }, |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 294 | { |
Sonic Zhang | edb0a64 | 2011-08-01 17:53:21 +0800 | [diff] [blame] | 295 | .start = IRQ_UART0_TX, |
| 296 | .end = IRQ_UART0_TX, |
| 297 | .flags = IORESOURCE_IRQ, |
| 298 | }, |
| 299 | { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 300 | .start = IRQ_UART0_RX, |
Sonic Zhang | edb0a64 | 2011-08-01 17:53:21 +0800 | [diff] [blame] | 301 | .end = IRQ_UART0_RX, |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 302 | .flags = IORESOURCE_IRQ, |
| 303 | }, |
| 304 | { |
| 305 | .start = IRQ_UART0_ERROR, |
| 306 | .end = IRQ_UART0_ERROR, |
| 307 | .flags = IORESOURCE_IRQ, |
| 308 | }, |
| 309 | { |
| 310 | .start = CH_UART0_TX, |
| 311 | .end = CH_UART0_TX, |
| 312 | .flags = IORESOURCE_DMA, |
| 313 | }, |
| 314 | { |
| 315 | .start = CH_UART0_RX, |
| 316 | .end = CH_UART0_RX, |
| 317 | .flags = IORESOURCE_DMA, |
| 318 | }, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 319 | }; |
| 320 | |
Mike Frysinger | a8b1988 | 2010-11-24 09:23:04 +0000 | [diff] [blame] | 321 | static unsigned short bfin_uart0_peripherals[] = { |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 322 | P_UART0_TX, P_UART0_RX, 0 |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 323 | }; |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 324 | |
| 325 | static struct platform_device bfin_uart0_device = { |
| 326 | .name = "bfin-uart", |
| 327 | .id = 0, |
| 328 | .num_resources = ARRAY_SIZE(bfin_uart0_resources), |
| 329 | .resource = bfin_uart0_resources, |
| 330 | .dev = { |
| 331 | .platform_data = &bfin_uart0_peripherals, /* Passed to driver */ |
| 332 | }, |
| 333 | }; |
| 334 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 335 | #endif |
| 336 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 337 | #if IS_ENABLED(CONFIG_BFIN_SIR) |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 338 | #ifdef CONFIG_BFIN_SIR0 |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 339 | static struct resource bfin_sir0_resources[] = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 340 | { |
| 341 | .start = 0xFFC00400, |
| 342 | .end = 0xFFC004FF, |
| 343 | .flags = IORESOURCE_MEM, |
| 344 | }, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 345 | { |
| 346 | .start = IRQ_UART0_RX, |
| 347 | .end = IRQ_UART0_RX+1, |
| 348 | .flags = IORESOURCE_IRQ, |
| 349 | }, |
| 350 | { |
| 351 | .start = CH_UART0_RX, |
| 352 | .end = CH_UART0_RX+1, |
| 353 | .flags = IORESOURCE_DMA, |
| 354 | }, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 355 | }; |
| 356 | |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 357 | static struct platform_device bfin_sir0_device = { |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 358 | .name = "bfin_sir", |
| 359 | .id = 0, |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 360 | .num_resources = ARRAY_SIZE(bfin_sir0_resources), |
| 361 | .resource = bfin_sir0_resources, |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 362 | }; |
| 363 | #endif |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 364 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 365 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 366 | #if IS_ENABLED(CONFIG_KEYBOARD_GPIO) |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 367 | #include <linux/input.h> |
| 368 | #include <linux/gpio_keys.h> |
| 369 | |
| 370 | static struct gpio_keys_button bfin_gpio_keys_table[] = { |
| 371 | {BTN_0, GPIO_PF7, 1, "gpio-keys: BTN0"}, |
| 372 | {BTN_1, GPIO_PF8, 1, "gpio-keys: BTN1"}, |
| 373 | {BTN_2, GPIO_PF9, 1, "gpio-keys: BTN2"}, |
| 374 | {BTN_3, GPIO_PF10, 1, "gpio-keys: BTN3"}, |
| 375 | }; |
| 376 | |
| 377 | static struct gpio_keys_platform_data bfin_gpio_keys_data = { |
| 378 | .buttons = bfin_gpio_keys_table, |
| 379 | .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table), |
| 380 | }; |
| 381 | |
| 382 | static struct platform_device bfin_device_gpiokeys = { |
| 383 | .name = "gpio-keys", |
| 384 | .dev = { |
| 385 | .platform_data = &bfin_gpio_keys_data, |
| 386 | }, |
| 387 | }; |
| 388 | #endif |
| 389 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 390 | #if IS_ENABLED(CONFIG_I2C_GPIO) |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 391 | #include <linux/i2c-gpio.h> |
| 392 | |
| 393 | static struct i2c_gpio_platform_data i2c_gpio_data = { |
Mike Frysinger | 3d7dc88 | 2010-07-02 21:02:50 +0000 | [diff] [blame] | 394 | .sda_pin = GPIO_PF1, |
| 395 | .scl_pin = GPIO_PF0, |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 396 | .sda_is_open_drain = 0, |
| 397 | .scl_is_open_drain = 0, |
| 398 | .udelay = 40, |
| 399 | }; |
| 400 | |
| 401 | static struct platform_device i2c_gpio_device = { |
| 402 | .name = "i2c-gpio", |
| 403 | .id = 0, |
| 404 | .dev = { |
| 405 | .platform_data = &i2c_gpio_data, |
| 406 | }, |
| 407 | }; |
| 408 | #endif |
| 409 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 410 | static const unsigned int cclk_vlev_datasheet[] = |
| 411 | { |
| 412 | VRPAIR(VLEV_085, 250000000), |
| 413 | VRPAIR(VLEV_090, 376000000), |
| 414 | VRPAIR(VLEV_095, 426000000), |
| 415 | VRPAIR(VLEV_100, 426000000), |
| 416 | VRPAIR(VLEV_105, 476000000), |
| 417 | VRPAIR(VLEV_110, 476000000), |
| 418 | VRPAIR(VLEV_115, 476000000), |
| 419 | VRPAIR(VLEV_120, 600000000), |
| 420 | VRPAIR(VLEV_125, 600000000), |
| 421 | VRPAIR(VLEV_130, 600000000), |
| 422 | }; |
| 423 | |
| 424 | static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = { |
| 425 | .tuple_tab = cclk_vlev_datasheet, |
| 426 | .tabsize = ARRAY_SIZE(cclk_vlev_datasheet), |
| 427 | .vr_settling_time = 25 /* us */, |
| 428 | }; |
| 429 | |
| 430 | static struct platform_device bfin_dpmc = { |
| 431 | .name = "bfin dpmc", |
| 432 | .dev = { |
| 433 | .platform_data = &bfin_dmpc_vreg_data, |
| 434 | }, |
| 435 | }; |
| 436 | |
Michael Hennerich | 50c4c08 | 2009-09-22 13:10:09 +0000 | [diff] [blame] | 437 | static struct i2c_board_info __initdata bfin_i2c_board_info[] = { |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 438 | #if IS_ENABLED(CONFIG_FB_BFIN_7393) |
Michael Hennerich | 50c4c08 | 2009-09-22 13:10:09 +0000 | [diff] [blame] | 439 | { |
| 440 | I2C_BOARD_INFO("bfin-adv7393", 0x2B), |
| 441 | }, |
| 442 | #endif |
| 443 | }; |
| 444 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 445 | #if IS_ENABLED(CONFIG_SND_BF5XX_I2S) |
Barry Song | 7e1082b | 2010-01-12 03:59:18 +0000 | [diff] [blame] | 446 | static struct platform_device bfin_i2s = { |
| 447 | .name = "bfin-i2s", |
| 448 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
| 449 | /* TODO: add platform data here */ |
| 450 | }; |
| 451 | #endif |
| 452 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 453 | #if IS_ENABLED(CONFIG_SND_BF5XX_AC97) |
Barry Song | 7e1082b | 2010-01-12 03:59:18 +0000 | [diff] [blame] | 454 | static struct platform_device bfin_ac97 = { |
| 455 | .name = "bfin-ac97", |
| 456 | .id = CONFIG_SND_BF5XX_SPORT_NUM, |
| 457 | /* TODO: add platform data here */ |
| 458 | }; |
| 459 | #endif |
| 460 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 461 | static struct platform_device *ezkit_devices[] __initdata = { |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 462 | |
| 463 | &bfin_dpmc, |
| 464 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 465 | #if IS_ENABLED(CONFIG_MTD_PHYSMAP) |
Mike Frysinger | 7036c61 | 2009-09-22 22:23:04 -0400 | [diff] [blame] | 466 | &ezkit_flash_device_a, |
| 467 | &ezkit_flash_device_b, |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 468 | #endif |
| 469 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 470 | #if IS_ENABLED(CONFIG_MTD_PLATRAM) |
Mike Frysinger | 4d5e6fd | 2009-06-13 06:34:49 -0400 | [diff] [blame] | 471 | &sram_device_a, |
| 472 | &sram_device_b, |
| 473 | #endif |
| 474 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 475 | #if IS_ENABLED(CONFIG_SMC91X) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 476 | &smc91x_device, |
| 477 | #endif |
| 478 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 479 | #if IS_ENABLED(CONFIG_SPI_BFIN5XX) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 480 | &bfin_spi0_device, |
| 481 | #endif |
| 482 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 483 | #if IS_ENABLED(CONFIG_RTC_DRV_BFIN) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 484 | &rtc_device, |
| 485 | #endif |
| 486 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 487 | #if IS_ENABLED(CONFIG_SERIAL_BFIN) |
Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 488 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 489 | &bfin_uart0_device, |
| 490 | #endif |
Sonic Zhang | e062cea | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 491 | #endif |
| 492 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 493 | #if IS_ENABLED(CONFIG_BFIN_SIR) |
Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 494 | #ifdef CONFIG_BFIN_SIR0 |
| 495 | &bfin_sir0_device, |
| 496 | #endif |
Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 497 | #endif |
| 498 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 499 | #if IS_ENABLED(CONFIG_KEYBOARD_GPIO) |
Michael Hennerich | 2463ef2 | 2008-01-27 16:49:48 +0800 | [diff] [blame] | 500 | &bfin_device_gpiokeys, |
| 501 | #endif |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 502 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 503 | #if IS_ENABLED(CONFIG_I2C_GPIO) |
Bryan Wu | e316395 | 2008-01-24 16:19:15 +0800 | [diff] [blame] | 504 | &i2c_gpio_device, |
| 505 | #endif |
Barry Song | 7e1082b | 2010-01-12 03:59:18 +0000 | [diff] [blame] | 506 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 507 | #if IS_ENABLED(CONFIG_SND_BF5XX_I2S) |
Barry Song | 7e1082b | 2010-01-12 03:59:18 +0000 | [diff] [blame] | 508 | &bfin_i2s, |
| 509 | #endif |
| 510 | |
Steven Miao | c4a2c58 | 2014-04-12 02:07:27 +0800 | [diff] [blame] | 511 | #if IS_ENABLED(CONFIG_SND_BF5XX_AC97) |
Barry Song | 7e1082b | 2010-01-12 03:59:18 +0000 | [diff] [blame] | 512 | &bfin_ac97, |
| 513 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 514 | }; |
| 515 | |
| 516 | static int __init ezkit_init(void) |
| 517 | { |
Harvey Harrison | b85d858 | 2008-04-23 09:39:01 +0800 | [diff] [blame] | 518 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 519 | platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 520 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
Michael Hennerich | 50c4c08 | 2009-09-22 13:10:09 +0000 | [diff] [blame] | 521 | i2c_register_board_info(0, bfin_i2c_board_info, |
| 522 | ARRAY_SIZE(bfin_i2c_board_info)); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 523 | return 0; |
| 524 | } |
| 525 | |
| 526 | arch_initcall(ezkit_init); |
Sonic Zhang | c13ce9f | 2009-09-23 09:37:46 +0000 | [diff] [blame] | 527 | |
| 528 | static struct platform_device *ezkit_early_devices[] __initdata = { |
| 529 | #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK) |
| 530 | #ifdef CONFIG_SERIAL_BFIN_UART0 |
| 531 | &bfin_uart0_device, |
| 532 | #endif |
| 533 | #endif |
| 534 | }; |
| 535 | |
| 536 | void __init native_machine_early_platform_add_devices(void) |
| 537 | { |
| 538 | printk(KERN_INFO "register early platform devices\n"); |
| 539 | early_platform_add_devices(ezkit_early_devices, |
| 540 | ARRAY_SIZE(ezkit_early_devices)); |
| 541 | } |