Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * TI DaVinci DM646X EVM board |
| 3 | * |
| 4 | * Derived from: arch/arm/mach-davinci/board-evm.c |
| 5 | * Copyright (C) 2006 Texas Instruments. |
| 6 | * |
| 7 | * (C) 2007-2008, MontaVista Software, Inc. |
| 8 | * |
| 9 | * This file is licensed under the terms of the GNU General Public License |
| 10 | * version 2. This program is licensed "as is" without any warranty of any |
| 11 | * kind, whether express or implied. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | /************************************************************************** |
| 16 | * Included Files |
| 17 | **************************************************************************/ |
| 18 | |
| 19 | #include <linux/kernel.h> |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 20 | #include <linux/init.h> |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 21 | #include <linux/leds.h> |
| 22 | #include <linux/gpio.h> |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 23 | #include <linux/platform_device.h> |
| 24 | #include <linux/i2c.h> |
Vivien Didelot | 25f73ed | 2013-09-27 15:06:28 -0400 | [diff] [blame] | 25 | #include <linux/platform_data/at24.h> |
Wolfram Sang | b6480fa | 2017-05-21 23:57:26 +0200 | [diff] [blame] | 26 | #include <linux/platform_data/pcf857x.h> |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 27 | |
Mauro Carvalho Chehab | b5dcee2 | 2015-11-10 12:01:44 -0200 | [diff] [blame] | 28 | #include <media/i2c/tvp514x.h> |
| 29 | #include <media/i2c/adv7343.h> |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 30 | |
Hemant Pedanekar | 50fbabf | 2009-09-18 23:09:29 +0530 | [diff] [blame] | 31 | #include <linux/mtd/mtd.h> |
Boris Brezillon | d4092d7 | 2017-08-04 17:29:10 +0200 | [diff] [blame] | 32 | #include <linux/mtd/rawnand.h> |
Hemant Pedanekar | 50fbabf | 2009-09-18 23:09:29 +0530 | [diff] [blame] | 33 | #include <linux/mtd/partitions.h> |
Sekhar Nori | c1978e1 | 2009-11-24 18:25:15 +0530 | [diff] [blame] | 34 | #include <linux/clk.h> |
Paul Gortmaker | dc28094 | 2011-07-31 16:17:29 -0400 | [diff] [blame] | 35 | #include <linux/export.h> |
Philip Avinash | 834acb2 | 2013-08-18 10:49:02 +0530 | [diff] [blame] | 36 | #include <linux/platform_data/gpio-davinci.h> |
| 37 | #include <linux/platform_data/i2c-davinci.h> |
| 38 | #include <linux/platform_data/mtd-davinci.h> |
| 39 | #include <linux/platform_data/mtd-davinci-aemif.h> |
Hemant Pedanekar | 50fbabf | 2009-09-18 23:09:29 +0530 | [diff] [blame] | 40 | |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 41 | #include <asm/mach-types.h> |
| 42 | #include <asm/mach/arch.h> |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 43 | |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 44 | #include <mach/common.h> |
Philip Avinash | 834acb2 | 2013-08-18 10:49:02 +0530 | [diff] [blame] | 45 | #include <mach/irqs.h> |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 46 | #include <mach/serial.h> |
Kevin Hilman | ac7b75b | 2009-05-07 06:19:40 -0700 | [diff] [blame] | 47 | |
Manjunath Hadli | 39c6d2d | 2011-12-21 19:13:35 +0530 | [diff] [blame] | 48 | #include "davinci.h" |
Sekhar Nori | c1978e1 | 2009-11-24 18:25:15 +0530 | [diff] [blame] | 49 | |
Hemant Pedanekar | 50fbabf | 2009-09-18 23:09:29 +0530 | [diff] [blame] | 50 | #define NAND_BLOCK_SIZE SZ_128K |
| 51 | |
Hemant Pedanekar | 50fbabf | 2009-09-18 23:09:29 +0530 | [diff] [blame] | 52 | /* Note: We are setting first partition as 'bootloader' constituting UBL, U-Boot |
| 53 | * and U-Boot environment this avoids dependency on any particular combination |
| 54 | * of UBL, U-Boot or flashing tools etc. |
| 55 | */ |
| 56 | static struct mtd_partition davinci_nand_partitions[] = { |
| 57 | { |
| 58 | /* UBL, U-Boot with environment */ |
| 59 | .name = "bootloader", |
| 60 | .offset = MTDPART_OFS_APPEND, |
| 61 | .size = 16 * NAND_BLOCK_SIZE, |
| 62 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
| 63 | }, { |
| 64 | .name = "kernel", |
| 65 | .offset = MTDPART_OFS_APPEND, |
| 66 | .size = SZ_4M, |
| 67 | .mask_flags = 0, |
| 68 | }, { |
| 69 | .name = "filesystem", |
| 70 | .offset = MTDPART_OFS_APPEND, |
| 71 | .size = MTDPART_SIZ_FULL, |
| 72 | .mask_flags = 0, |
| 73 | } |
| 74 | }; |
| 75 | |
Sekhar Nori | 0b3fc7b | 2010-08-09 15:46:40 +0530 | [diff] [blame] | 76 | static struct davinci_aemif_timing dm6467tevm_nandflash_timing = { |
| 77 | .wsetup = 29, |
| 78 | .wstrobe = 24, |
| 79 | .whold = 14, |
| 80 | .rsetup = 19, |
| 81 | .rstrobe = 33, |
| 82 | .rhold = 0, |
| 83 | .ta = 29, |
| 84 | }; |
| 85 | |
Hemant Pedanekar | 50fbabf | 2009-09-18 23:09:29 +0530 | [diff] [blame] | 86 | static struct davinci_nand_pdata davinci_nand_data = { |
| 87 | .mask_cle = 0x80000, |
| 88 | .mask_ale = 0x40000, |
| 89 | .parts = davinci_nand_partitions, |
| 90 | .nr_parts = ARRAY_SIZE(davinci_nand_partitions), |
| 91 | .ecc_mode = NAND_ECC_HW, |
Sekhar Nori | acd3635 | 2013-08-16 14:43:48 +0530 | [diff] [blame] | 92 | .ecc_bits = 1, |
Hemant Pedanekar | 50fbabf | 2009-09-18 23:09:29 +0530 | [diff] [blame] | 93 | .options = 0, |
| 94 | }; |
| 95 | |
| 96 | static struct resource davinci_nand_resources[] = { |
| 97 | { |
Sergei Shtylyov | 7034217 | 2010-04-16 21:29:11 +0400 | [diff] [blame] | 98 | .start = DM646X_ASYNC_EMIF_CS2_SPACE_BASE, |
| 99 | .end = DM646X_ASYNC_EMIF_CS2_SPACE_BASE + SZ_32M - 1, |
Hemant Pedanekar | 50fbabf | 2009-09-18 23:09:29 +0530 | [diff] [blame] | 100 | .flags = IORESOURCE_MEM, |
| 101 | }, { |
Sergei Shtylyov | 7034217 | 2010-04-16 21:29:11 +0400 | [diff] [blame] | 102 | .start = DM646X_ASYNC_EMIF_CONTROL_BASE, |
| 103 | .end = DM646X_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1, |
Hemant Pedanekar | 50fbabf | 2009-09-18 23:09:29 +0530 | [diff] [blame] | 104 | .flags = IORESOURCE_MEM, |
| 105 | }, |
| 106 | }; |
| 107 | |
| 108 | static struct platform_device davinci_nand_device = { |
| 109 | .name = "davinci_nand", |
| 110 | .id = 0, |
| 111 | |
| 112 | .num_resources = ARRAY_SIZE(davinci_nand_resources), |
| 113 | .resource = davinci_nand_resources, |
| 114 | |
| 115 | .dev = { |
| 116 | .platform_data = &davinci_nand_data, |
| 117 | }, |
| 118 | }; |
| 119 | |
Sekhar Nori | 28d4d1d | 2017-03-22 19:21:01 +0100 | [diff] [blame] | 120 | #define HAS_ATA (IS_ENABLED(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ |
| 121 | IS_ENABLED(CONFIG_PATA_BK3710)) |
Sekhar Nori | b73b526 | 2009-11-24 18:25:14 +0530 | [diff] [blame] | 122 | |
Arnd Bergmann | 8e58041 | 2016-02-01 21:35:58 +0100 | [diff] [blame] | 123 | #ifdef CONFIG_I2C |
Sekhar Nori | b73b526 | 2009-11-24 18:25:14 +0530 | [diff] [blame] | 124 | /* CPLD Register 0 bits to control ATA */ |
| 125 | #define DM646X_EVM_ATA_RST BIT(0) |
| 126 | #define DM646X_EVM_ATA_PWD BIT(1) |
| 127 | |
Hemant Pedanekar | 548197b | 2009-07-17 23:30:36 +0530 | [diff] [blame] | 128 | /* CPLD Register 0 Client: used for I/O Control */ |
| 129 | static int cpld_reg0_probe(struct i2c_client *client, |
| 130 | const struct i2c_device_id *id) |
| 131 | { |
| 132 | if (HAS_ATA) { |
| 133 | u8 data; |
| 134 | struct i2c_msg msg[2] = { |
| 135 | { |
| 136 | .addr = client->addr, |
| 137 | .flags = I2C_M_RD, |
| 138 | .len = 1, |
| 139 | .buf = &data, |
| 140 | }, |
| 141 | { |
| 142 | .addr = client->addr, |
| 143 | .flags = 0, |
| 144 | .len = 1, |
| 145 | .buf = &data, |
| 146 | }, |
| 147 | }; |
| 148 | |
| 149 | /* Clear ATA_RSTn and ATA_PWD bits to enable ATA operation. */ |
| 150 | i2c_transfer(client->adapter, msg, 1); |
| 151 | data &= ~(DM646X_EVM_ATA_RST | DM646X_EVM_ATA_PWD); |
| 152 | i2c_transfer(client->adapter, msg + 1, 1); |
| 153 | } |
| 154 | |
| 155 | return 0; |
| 156 | } |
| 157 | |
| 158 | static const struct i2c_device_id cpld_reg_ids[] = { |
| 159 | { "cpld_reg0", 0, }, |
| 160 | { }, |
| 161 | }; |
| 162 | |
| 163 | static struct i2c_driver dm6467evm_cpld_driver = { |
| 164 | .driver.name = "cpld_reg0", |
| 165 | .id_table = cpld_reg_ids, |
| 166 | .probe = cpld_reg0_probe, |
| 167 | }; |
| 168 | |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 169 | /* LEDS */ |
| 170 | |
| 171 | static struct gpio_led evm_leds[] = { |
| 172 | { .name = "DS1", .active_low = 1, }, |
| 173 | { .name = "DS2", .active_low = 1, }, |
| 174 | { .name = "DS3", .active_low = 1, }, |
| 175 | { .name = "DS4", .active_low = 1, }, |
| 176 | }; |
| 177 | |
Sekhar Nori | 445094f | 2009-11-04 17:08:42 +0530 | [diff] [blame] | 178 | static const struct gpio_led_platform_data evm_led_data = { |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 179 | .num_leds = ARRAY_SIZE(evm_leds), |
| 180 | .leds = evm_leds, |
| 181 | }; |
| 182 | |
| 183 | static struct platform_device *evm_led_dev; |
| 184 | |
| 185 | static int evm_led_setup(struct i2c_client *client, int gpio, |
| 186 | unsigned int ngpio, void *c) |
| 187 | { |
| 188 | struct gpio_led *leds = evm_leds; |
| 189 | int status; |
| 190 | |
| 191 | while (ngpio--) { |
| 192 | leds->gpio = gpio++; |
| 193 | leds++; |
Peter Senna Tschudin | baad1b3 | 2012-09-18 18:59:59 +0200 | [diff] [blame] | 194 | } |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 195 | |
| 196 | evm_led_dev = platform_device_alloc("leds-gpio", 0); |
| 197 | platform_device_add_data(evm_led_dev, &evm_led_data, |
| 198 | sizeof(evm_led_data)); |
| 199 | |
| 200 | evm_led_dev->dev.parent = &client->dev; |
| 201 | status = platform_device_add(evm_led_dev); |
| 202 | if (status < 0) { |
| 203 | platform_device_put(evm_led_dev); |
| 204 | evm_led_dev = NULL; |
| 205 | } |
| 206 | return status; |
| 207 | } |
| 208 | |
| 209 | static int evm_led_teardown(struct i2c_client *client, int gpio, |
| 210 | unsigned ngpio, void *c) |
| 211 | { |
| 212 | if (evm_led_dev) { |
| 213 | platform_device_unregister(evm_led_dev); |
| 214 | evm_led_dev = NULL; |
| 215 | } |
| 216 | return 0; |
| 217 | } |
| 218 | |
| 219 | static int evm_sw_gpio[4] = { -EINVAL, -EINVAL, -EINVAL, -EINVAL }; |
| 220 | |
| 221 | static int evm_sw_setup(struct i2c_client *client, int gpio, |
| 222 | unsigned ngpio, void *c) |
| 223 | { |
| 224 | int status; |
| 225 | int i; |
| 226 | char label[10]; |
| 227 | |
| 228 | for (i = 0; i < 4; ++i) { |
| 229 | snprintf(label, 10, "user_sw%d", i); |
| 230 | status = gpio_request(gpio, label); |
| 231 | if (status) |
| 232 | goto out_free; |
| 233 | evm_sw_gpio[i] = gpio++; |
| 234 | |
| 235 | status = gpio_direction_input(evm_sw_gpio[i]); |
| 236 | if (status) { |
| 237 | gpio_free(evm_sw_gpio[i]); |
| 238 | evm_sw_gpio[i] = -EINVAL; |
| 239 | goto out_free; |
| 240 | } |
| 241 | |
| 242 | status = gpio_export(evm_sw_gpio[i], 0); |
| 243 | if (status) { |
| 244 | gpio_free(evm_sw_gpio[i]); |
| 245 | evm_sw_gpio[i] = -EINVAL; |
| 246 | goto out_free; |
| 247 | } |
| 248 | } |
| 249 | return status; |
| 250 | out_free: |
| 251 | for (i = 0; i < 4; ++i) { |
| 252 | if (evm_sw_gpio[i] != -EINVAL) { |
| 253 | gpio_free(evm_sw_gpio[i]); |
| 254 | evm_sw_gpio[i] = -EINVAL; |
| 255 | } |
| 256 | } |
| 257 | return status; |
| 258 | } |
| 259 | |
| 260 | static int evm_sw_teardown(struct i2c_client *client, int gpio, |
| 261 | unsigned ngpio, void *c) |
| 262 | { |
| 263 | int i; |
| 264 | |
| 265 | for (i = 0; i < 4; ++i) { |
| 266 | if (evm_sw_gpio[i] != -EINVAL) { |
| 267 | gpio_unexport(evm_sw_gpio[i]); |
| 268 | gpio_free(evm_sw_gpio[i]); |
| 269 | evm_sw_gpio[i] = -EINVAL; |
| 270 | } |
| 271 | } |
| 272 | return 0; |
| 273 | } |
| 274 | |
| 275 | static int evm_pcf_setup(struct i2c_client *client, int gpio, |
| 276 | unsigned int ngpio, void *c) |
| 277 | { |
| 278 | int status; |
| 279 | |
| 280 | if (ngpio < 8) |
| 281 | return -EINVAL; |
| 282 | |
| 283 | status = evm_sw_setup(client, gpio, 4, c); |
| 284 | if (status) |
| 285 | return status; |
| 286 | |
| 287 | return evm_led_setup(client, gpio+4, 4, c); |
| 288 | } |
| 289 | |
| 290 | static int evm_pcf_teardown(struct i2c_client *client, int gpio, |
| 291 | unsigned int ngpio, void *c) |
| 292 | { |
| 293 | BUG_ON(ngpio < 8); |
| 294 | |
| 295 | evm_sw_teardown(client, gpio, 4, c); |
| 296 | evm_led_teardown(client, gpio+4, 4, c); |
| 297 | |
| 298 | return 0; |
| 299 | } |
| 300 | |
| 301 | static struct pcf857x_platform_data pcf_data = { |
| 302 | .gpio_base = DAVINCI_N_GPIO+1, |
| 303 | .setup = evm_pcf_setup, |
| 304 | .teardown = evm_pcf_teardown, |
| 305 | }; |
| 306 | |
| 307 | /* Most of this EEPROM is unused, but U-Boot uses some data: |
| 308 | * - 0x7f00, 6 bytes Ethernet Address |
| 309 | * - ... newer boards may have more |
| 310 | */ |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 311 | |
| 312 | static struct at24_platform_data eeprom_info = { |
| 313 | .byte_len = (256*1024) / 8, |
| 314 | .page_size = 64, |
| 315 | .flags = AT24_FLAG_ADDR16, |
Mark A. Greer | b14dc0f | 2009-04-15 12:41:27 -0700 | [diff] [blame] | 316 | .setup = davinci_get_mac_addr, |
| 317 | .context = (void *)0x7f00, |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 318 | }; |
Arnd Bergmann | 8e58041 | 2016-02-01 21:35:58 +0100 | [diff] [blame] | 319 | #endif |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 320 | |
Chaithrika U S | 25acf55 | 2009-06-05 06:28:08 -0400 | [diff] [blame] | 321 | static u8 dm646x_iis_serializer_direction[] = { |
| 322 | TX_MODE, RX_MODE, INACTIVE_MODE, INACTIVE_MODE, |
| 323 | }; |
| 324 | |
| 325 | static u8 dm646x_dit_serializer_direction[] = { |
| 326 | TX_MODE, |
| 327 | }; |
| 328 | |
| 329 | static struct snd_platform_data dm646x_evm_snd_data[] = { |
| 330 | { |
Chaithrika U S | 25acf55 | 2009-06-05 06:28:08 -0400 | [diff] [blame] | 331 | .tx_dma_offset = 0x400, |
| 332 | .rx_dma_offset = 0x400, |
| 333 | .op_mode = DAVINCI_MCASP_IIS_MODE, |
| 334 | .num_serializer = ARRAY_SIZE(dm646x_iis_serializer_direction), |
| 335 | .tdm_slots = 2, |
| 336 | .serial_dir = dm646x_iis_serializer_direction, |
Sekhar Nori | 48519f0 | 2010-07-19 12:31:16 +0530 | [diff] [blame] | 337 | .asp_chan_q = EVENTQ_0, |
Chaithrika U S | 25acf55 | 2009-06-05 06:28:08 -0400 | [diff] [blame] | 338 | }, |
| 339 | { |
Chaithrika U S | 25acf55 | 2009-06-05 06:28:08 -0400 | [diff] [blame] | 340 | .tx_dma_offset = 0x400, |
| 341 | .rx_dma_offset = 0, |
| 342 | .op_mode = DAVINCI_MCASP_DIT_MODE, |
| 343 | .num_serializer = ARRAY_SIZE(dm646x_dit_serializer_direction), |
| 344 | .tdm_slots = 32, |
| 345 | .serial_dir = dm646x_dit_serializer_direction, |
Sekhar Nori | 48519f0 | 2010-07-19 12:31:16 +0530 | [diff] [blame] | 346 | .asp_chan_q = EVENTQ_0, |
Chaithrika U S | 25acf55 | 2009-06-05 06:28:08 -0400 | [diff] [blame] | 347 | }, |
| 348 | }; |
| 349 | |
Arnd Bergmann | 8e58041 | 2016-02-01 21:35:58 +0100 | [diff] [blame] | 350 | #ifdef CONFIG_I2C |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 351 | static struct i2c_client *cpld_client; |
| 352 | |
| 353 | static int cpld_video_probe(struct i2c_client *client, |
| 354 | const struct i2c_device_id *id) |
| 355 | { |
| 356 | cpld_client = client; |
| 357 | return 0; |
| 358 | } |
| 359 | |
Greg Kroah-Hartman | 351a102 | 2012-12-21 14:02:24 -0800 | [diff] [blame] | 360 | static int cpld_video_remove(struct i2c_client *client) |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 361 | { |
| 362 | cpld_client = NULL; |
| 363 | return 0; |
| 364 | } |
| 365 | |
| 366 | static const struct i2c_device_id cpld_video_id[] = { |
| 367 | { "cpld_video", 0 }, |
| 368 | { } |
| 369 | }; |
| 370 | |
| 371 | static struct i2c_driver cpld_video_driver = { |
| 372 | .driver = { |
| 373 | .name = "cpld_video", |
| 374 | }, |
| 375 | .probe = cpld_video_probe, |
| 376 | .remove = cpld_video_remove, |
| 377 | .id_table = cpld_video_id, |
| 378 | }; |
| 379 | |
| 380 | static void evm_init_cpld(void) |
| 381 | { |
| 382 | i2c_add_driver(&cpld_video_driver); |
| 383 | } |
| 384 | |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 385 | static struct i2c_board_info __initdata i2c_info[] = { |
| 386 | { |
| 387 | I2C_BOARD_INFO("24c256", 0x50), |
| 388 | .platform_data = &eeprom_info, |
| 389 | }, |
| 390 | { |
| 391 | I2C_BOARD_INFO("pcf8574a", 0x38), |
| 392 | .platform_data = &pcf_data, |
| 393 | }, |
Hemant Pedanekar | 548197b | 2009-07-17 23:30:36 +0530 | [diff] [blame] | 394 | { |
| 395 | I2C_BOARD_INFO("cpld_reg0", 0x3a), |
| 396 | }, |
Chaithrika U S | 1a7ff8f | 2009-08-25 15:20:05 +0300 | [diff] [blame] | 397 | { |
| 398 | I2C_BOARD_INFO("tlv320aic33", 0x18), |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 399 | }, |
| 400 | { |
| 401 | I2C_BOARD_INFO("cpld_video", 0x3b), |
| 402 | }, |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 403 | }; |
| 404 | |
| 405 | static struct davinci_i2c_platform_data i2c_pdata = { |
| 406 | .bus_freq = 100 /* kHz */, |
| 407 | .bus_delay = 0 /* usec */, |
| 408 | }; |
| 409 | |
Sekhar Nori | b73b526 | 2009-11-24 18:25:14 +0530 | [diff] [blame] | 410 | #define VCH2CLK_MASK (BIT_MASK(10) | BIT_MASK(9) | BIT_MASK(8)) |
| 411 | #define VCH2CLK_SYSCLK8 (BIT(9)) |
| 412 | #define VCH2CLK_AUXCLK (BIT(9) | BIT(8)) |
| 413 | #define VCH3CLK_MASK (BIT_MASK(14) | BIT_MASK(13) | BIT_MASK(12)) |
| 414 | #define VCH3CLK_SYSCLK8 (BIT(13)) |
| 415 | #define VCH3CLK_AUXCLK (BIT(14) | BIT(13)) |
| 416 | |
| 417 | #define VIDCH2CLK (BIT(10)) |
| 418 | #define VIDCH3CLK (BIT(11)) |
| 419 | #define VIDCH1CLK (BIT(4)) |
| 420 | #define TVP7002_INPUT (BIT(4)) |
| 421 | #define TVP5147_INPUT (~BIT(4)) |
| 422 | #define VPIF_INPUT_ONE_CHANNEL (BIT(5)) |
| 423 | #define VPIF_INPUT_TWO_CHANNEL (~BIT(5)) |
| 424 | #define TVP5147_CH0 "tvp514x-0" |
| 425 | #define TVP5147_CH1 "tvp514x-1" |
| 426 | |
Sekhar Nori | b73b526 | 2009-11-24 18:25:14 +0530 | [diff] [blame] | 427 | /* spin lock for updating above registers */ |
| 428 | static spinlock_t vpif_reg_lock; |
| 429 | |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 430 | static int set_vpif_clock(int mux_mode, int hd) |
| 431 | { |
| 432 | unsigned long flags; |
| 433 | unsigned int value; |
| 434 | int val = 0; |
| 435 | int err = 0; |
| 436 | |
Manjunath Hadli | 5cfb19a | 2011-12-21 19:13:36 +0530 | [diff] [blame] | 437 | if (!cpld_client) |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 438 | return -ENXIO; |
| 439 | |
| 440 | /* disable the clock */ |
| 441 | spin_lock_irqsave(&vpif_reg_lock, flags); |
Manjunath Hadli | 5cfb19a | 2011-12-21 19:13:36 +0530 | [diff] [blame] | 442 | value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS)); |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 443 | value |= (VIDCH3CLK | VIDCH2CLK); |
Manjunath Hadli | 5cfb19a | 2011-12-21 19:13:36 +0530 | [diff] [blame] | 444 | __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS)); |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 445 | spin_unlock_irqrestore(&vpif_reg_lock, flags); |
| 446 | |
| 447 | val = i2c_smbus_read_byte(cpld_client); |
| 448 | if (val < 0) |
| 449 | return val; |
| 450 | |
| 451 | if (mux_mode == 1) |
| 452 | val &= ~0x40; |
| 453 | else |
| 454 | val |= 0x40; |
| 455 | |
| 456 | err = i2c_smbus_write_byte(cpld_client, val); |
| 457 | if (err) |
| 458 | return err; |
| 459 | |
Manjunath Hadli | 5cfb19a | 2011-12-21 19:13:36 +0530 | [diff] [blame] | 460 | value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL)); |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 461 | value &= ~(VCH2CLK_MASK); |
| 462 | value &= ~(VCH3CLK_MASK); |
| 463 | |
| 464 | if (hd >= 1) |
| 465 | value |= (VCH2CLK_SYSCLK8 | VCH3CLK_SYSCLK8); |
| 466 | else |
| 467 | value |= (VCH2CLK_AUXCLK | VCH3CLK_AUXCLK); |
| 468 | |
Manjunath Hadli | 5cfb19a | 2011-12-21 19:13:36 +0530 | [diff] [blame] | 469 | __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL)); |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 470 | |
| 471 | spin_lock_irqsave(&vpif_reg_lock, flags); |
Manjunath Hadli | 5cfb19a | 2011-12-21 19:13:36 +0530 | [diff] [blame] | 472 | value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS)); |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 473 | /* enable the clock */ |
| 474 | value &= ~(VIDCH3CLK | VIDCH2CLK); |
Manjunath Hadli | 5cfb19a | 2011-12-21 19:13:36 +0530 | [diff] [blame] | 475 | __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS)); |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 476 | spin_unlock_irqrestore(&vpif_reg_lock, flags); |
| 477 | |
| 478 | return 0; |
| 479 | } |
| 480 | |
| 481 | static struct vpif_subdev_info dm646x_vpif_subdev[] = { |
| 482 | { |
| 483 | .name = "adv7343", |
| 484 | .board_info = { |
| 485 | I2C_BOARD_INFO("adv7343", 0x2a), |
| 486 | }, |
| 487 | }, |
| 488 | { |
| 489 | .name = "ths7303", |
| 490 | .board_info = { |
| 491 | I2C_BOARD_INFO("ths7303", 0x2c), |
| 492 | }, |
| 493 | }, |
| 494 | }; |
| 495 | |
Lad, Prabhakar | 2bd4e58 | 2012-09-25 08:11:49 -0300 | [diff] [blame] | 496 | static const struct vpif_output dm6467_ch0_outputs[] = { |
| 497 | { |
| 498 | .output = { |
| 499 | .index = 0, |
| 500 | .name = "Composite", |
| 501 | .type = V4L2_OUTPUT_TYPE_ANALOG, |
| 502 | .capabilities = V4L2_OUT_CAP_STD, |
| 503 | .std = V4L2_STD_ALL, |
| 504 | }, |
| 505 | .subdev_name = "adv7343", |
| 506 | .output_route = ADV7343_COMPOSITE_ID, |
| 507 | }, |
| 508 | { |
| 509 | .output = { |
| 510 | .index = 1, |
| 511 | .name = "Component", |
| 512 | .type = V4L2_OUTPUT_TYPE_ANALOG, |
Hans Verkuil | 20a005a | 2013-02-15 15:10:45 -0300 | [diff] [blame] | 513 | .capabilities = V4L2_OUT_CAP_DV_TIMINGS, |
Lad, Prabhakar | 2bd4e58 | 2012-09-25 08:11:49 -0300 | [diff] [blame] | 514 | }, |
| 515 | .subdev_name = "adv7343", |
| 516 | .output_route = ADV7343_COMPONENT_ID, |
| 517 | }, |
| 518 | { |
| 519 | .output = { |
| 520 | .index = 2, |
| 521 | .name = "S-Video", |
| 522 | .type = V4L2_OUTPUT_TYPE_ANALOG, |
| 523 | .capabilities = V4L2_OUT_CAP_STD, |
| 524 | .std = V4L2_STD_ALL, |
| 525 | }, |
| 526 | .subdev_name = "adv7343", |
| 527 | .output_route = ADV7343_SVIDEO_ID, |
| 528 | }, |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 529 | }; |
| 530 | |
| 531 | static struct vpif_display_config dm646x_vpif_display_config = { |
| 532 | .set_clock = set_vpif_clock, |
| 533 | .subdevinfo = dm646x_vpif_subdev, |
| 534 | .subdev_count = ARRAY_SIZE(dm646x_vpif_subdev), |
Sekhar Nori | 7d46899 | 2018-05-11 20:51:35 +0530 | [diff] [blame^] | 535 | .i2c_adapter_id = 1, |
Lad, Prabhakar | 2bd4e58 | 2012-09-25 08:11:49 -0300 | [diff] [blame] | 536 | .chan_config[0] = { |
| 537 | .outputs = dm6467_ch0_outputs, |
| 538 | .output_count = ARRAY_SIZE(dm6467_ch0_outputs), |
| 539 | }, |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 540 | .card_name = "DM646x EVM", |
| 541 | }; |
| 542 | |
| 543 | /** |
| 544 | * setup_vpif_input_path() |
| 545 | * @channel: channel id (0 - CH0, 1 - CH1) |
| 546 | * @sub_dev_name: ptr sub device name |
| 547 | * |
| 548 | * This will set vpif input to capture data from tvp514x or |
| 549 | * tvp7002. |
| 550 | */ |
| 551 | static int setup_vpif_input_path(int channel, const char *sub_dev_name) |
| 552 | { |
| 553 | int err = 0; |
| 554 | int val; |
| 555 | |
| 556 | /* for channel 1, we don't do anything */ |
| 557 | if (channel != 0) |
| 558 | return 0; |
| 559 | |
| 560 | if (!cpld_client) |
| 561 | return -ENXIO; |
| 562 | |
| 563 | val = i2c_smbus_read_byte(cpld_client); |
| 564 | if (val < 0) |
| 565 | return val; |
| 566 | |
| 567 | if (!strcmp(sub_dev_name, TVP5147_CH0) || |
| 568 | !strcmp(sub_dev_name, TVP5147_CH1)) |
| 569 | val &= TVP5147_INPUT; |
| 570 | else |
| 571 | val |= TVP7002_INPUT; |
| 572 | |
| 573 | err = i2c_smbus_write_byte(cpld_client, val); |
| 574 | if (err) |
| 575 | return err; |
| 576 | return 0; |
| 577 | } |
| 578 | |
| 579 | /** |
| 580 | * setup_vpif_input_channel_mode() |
| 581 | * @mux_mode: mux mode. 0 - 1 channel or (1) - 2 channel |
| 582 | * |
| 583 | * This will setup input mode to one channel (TVP7002) or 2 channel (TVP5147) |
| 584 | */ |
| 585 | static int setup_vpif_input_channel_mode(int mux_mode) |
| 586 | { |
| 587 | unsigned long flags; |
| 588 | int err = 0; |
| 589 | int val; |
| 590 | u32 value; |
| 591 | |
Manjunath Hadli | 5cfb19a | 2011-12-21 19:13:36 +0530 | [diff] [blame] | 592 | if (!cpld_client) |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 593 | return -ENXIO; |
| 594 | |
| 595 | val = i2c_smbus_read_byte(cpld_client); |
| 596 | if (val < 0) |
| 597 | return val; |
| 598 | |
| 599 | spin_lock_irqsave(&vpif_reg_lock, flags); |
Manjunath Hadli | 5cfb19a | 2011-12-21 19:13:36 +0530 | [diff] [blame] | 600 | value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL)); |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 601 | if (mux_mode) { |
| 602 | val &= VPIF_INPUT_TWO_CHANNEL; |
| 603 | value |= VIDCH1CLK; |
| 604 | } else { |
| 605 | val |= VPIF_INPUT_ONE_CHANNEL; |
| 606 | value &= ~VIDCH1CLK; |
| 607 | } |
Manjunath Hadli | 5cfb19a | 2011-12-21 19:13:36 +0530 | [diff] [blame] | 608 | __raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL)); |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 609 | spin_unlock_irqrestore(&vpif_reg_lock, flags); |
| 610 | |
| 611 | err = i2c_smbus_write_byte(cpld_client, val); |
| 612 | if (err) |
| 613 | return err; |
| 614 | |
| 615 | return 0; |
| 616 | } |
| 617 | |
| 618 | static struct tvp514x_platform_data tvp5146_pdata = { |
| 619 | .clk_polarity = 0, |
| 620 | .hs_polarity = 1, |
| 621 | .vs_polarity = 1 |
| 622 | }; |
| 623 | |
| 624 | #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL) |
| 625 | |
| 626 | static struct vpif_subdev_info vpif_capture_sdev_info[] = { |
| 627 | { |
| 628 | .name = TVP5147_CH0, |
| 629 | .board_info = { |
| 630 | I2C_BOARD_INFO("tvp5146", 0x5d), |
| 631 | .platform_data = &tvp5146_pdata, |
| 632 | }, |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 633 | }, |
| 634 | { |
| 635 | .name = TVP5147_CH1, |
| 636 | .board_info = { |
| 637 | I2C_BOARD_INFO("tvp5146", 0x5c), |
| 638 | .platform_data = &tvp5146_pdata, |
| 639 | }, |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 640 | }, |
| 641 | }; |
| 642 | |
Kevin Hilman | 231ce27 | 2017-06-09 10:21:10 -0700 | [diff] [blame] | 643 | static struct vpif_input dm6467_ch0_inputs[] = { |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 644 | { |
| 645 | .input = { |
| 646 | .index = 0, |
| 647 | .name = "Composite", |
| 648 | .type = V4L2_INPUT_TYPE_CAMERA, |
Hans Verkuil | 7aaad13 | 2012-09-20 09:06:25 -0300 | [diff] [blame] | 649 | .capabilities = V4L2_IN_CAP_STD, |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 650 | .std = TVP514X_STD_ALL, |
| 651 | }, |
| 652 | .subdev_name = TVP5147_CH0, |
Hans Verkuil | 7aaad13 | 2012-09-20 09:06:25 -0300 | [diff] [blame] | 653 | .input_route = INPUT_CVBS_VI2B, |
| 654 | .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 655 | }, |
| 656 | }; |
| 657 | |
Kevin Hilman | 231ce27 | 2017-06-09 10:21:10 -0700 | [diff] [blame] | 658 | static struct vpif_input dm6467_ch1_inputs[] = { |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 659 | { |
| 660 | .input = { |
| 661 | .index = 0, |
| 662 | .name = "S-Video", |
| 663 | .type = V4L2_INPUT_TYPE_CAMERA, |
Hans Verkuil | 7aaad13 | 2012-09-20 09:06:25 -0300 | [diff] [blame] | 664 | .capabilities = V4L2_IN_CAP_STD, |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 665 | .std = TVP514X_STD_ALL, |
| 666 | }, |
| 667 | .subdev_name = TVP5147_CH1, |
Hans Verkuil | 7aaad13 | 2012-09-20 09:06:25 -0300 | [diff] [blame] | 668 | .input_route = INPUT_SVIDEO_VI2C_VI1C, |
| 669 | .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 670 | }, |
| 671 | }; |
| 672 | |
| 673 | static struct vpif_capture_config dm646x_vpif_capture_cfg = { |
| 674 | .setup_input_path = setup_vpif_input_path, |
| 675 | .setup_input_channel_mode = setup_vpif_input_channel_mode, |
| 676 | .subdev_info = vpif_capture_sdev_info, |
| 677 | .subdev_count = ARRAY_SIZE(vpif_capture_sdev_info), |
Sekhar Nori | 7d46899 | 2018-05-11 20:51:35 +0530 | [diff] [blame^] | 678 | .i2c_adapter_id = 1, |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 679 | .chan_config[0] = { |
| 680 | .inputs = dm6467_ch0_inputs, |
| 681 | .input_count = ARRAY_SIZE(dm6467_ch0_inputs), |
Hans Verkuil | 0d4f35f | 2012-09-20 09:06:32 -0300 | [diff] [blame] | 682 | .vpif_if = { |
| 683 | .if_type = VPIF_IF_BT656, |
| 684 | .hd_pol = 1, |
| 685 | .vd_pol = 1, |
| 686 | .fid_pol = 0, |
| 687 | }, |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 688 | }, |
| 689 | .chan_config[1] = { |
| 690 | .inputs = dm6467_ch1_inputs, |
| 691 | .input_count = ARRAY_SIZE(dm6467_ch1_inputs), |
Hans Verkuil | 0d4f35f | 2012-09-20 09:06:32 -0300 | [diff] [blame] | 692 | .vpif_if = { |
| 693 | .if_type = VPIF_IF_BT656, |
| 694 | .hd_pol = 1, |
| 695 | .vd_pol = 1, |
| 696 | .fid_pol = 0, |
| 697 | }, |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 698 | }, |
| 699 | }; |
| 700 | |
| 701 | static void __init evm_init_video(void) |
| 702 | { |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 703 | spin_lock_init(&vpif_reg_lock); |
| 704 | |
| 705 | dm646x_setup_vpif(&dm646x_vpif_display_config, |
| 706 | &dm646x_vpif_capture_cfg); |
| 707 | } |
| 708 | |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 709 | static void __init evm_init_i2c(void) |
| 710 | { |
| 711 | davinci_init_i2c(&i2c_pdata); |
Hemant Pedanekar | 548197b | 2009-07-17 23:30:36 +0530 | [diff] [blame] | 712 | i2c_add_driver(&dm6467evm_cpld_driver); |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 713 | i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); |
Muralidharan Karicheri | 85609c1 | 2009-09-16 13:15:30 -0400 | [diff] [blame] | 714 | evm_init_cpld(); |
| 715 | evm_init_video(); |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 716 | } |
Arnd Bergmann | 8e58041 | 2016-02-01 21:35:58 +0100 | [diff] [blame] | 717 | #endif |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 718 | |
David Lechner | 96c0817 | 2018-01-19 21:20:22 -0600 | [diff] [blame] | 719 | #define DM646X_REF_FREQ 27000000 |
| 720 | #define DM646X_AUX_FREQ 24000000 |
Sekhar Nori | 56e580d | 2011-06-14 15:33:20 +0000 | [diff] [blame] | 721 | #define DM6467T_EVM_REF_FREQ 33000000 |
| 722 | |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 723 | static void __init davinci_map_io(void) |
| 724 | { |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 725 | dm646x_init(); |
David Lechner | 96c0817 | 2018-01-19 21:20:22 -0600 | [diff] [blame] | 726 | } |
Sekhar Nori | 56e580d | 2011-06-14 15:33:20 +0000 | [diff] [blame] | 727 | |
David Lechner | 96c0817 | 2018-01-19 21:20:22 -0600 | [diff] [blame] | 728 | static void __init dm646x_evm_init_time(void) |
| 729 | { |
| 730 | dm646x_init_time(DM646X_REF_FREQ, DM646X_AUX_FREQ); |
| 731 | } |
| 732 | |
| 733 | static void __init dm6467t_evm_init_time(void) |
| 734 | { |
| 735 | dm646x_init_time(DM6467T_EVM_REF_FREQ, DM646X_AUX_FREQ); |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 736 | } |
| 737 | |
Sekhar Nori | f6f9758 | 2012-01-21 02:48:17 +0530 | [diff] [blame] | 738 | #define DM646X_EVM_PHY_ID "davinci_mdio-0:01" |
Rajashekhara, Sudhakar | cce3ddd | 2010-06-29 11:35:15 +0530 | [diff] [blame] | 739 | /* |
| 740 | * The following EDMA channels/slots are not being used by drivers (for |
| 741 | * example: Timer, GPIO, UART events etc) on dm646x, hence they are being |
| 742 | * reserved for codecs on the DSP side. |
| 743 | */ |
| 744 | static const s16 dm646x_dma_rsv_chans[][2] = { |
| 745 | /* (offset, number) */ |
| 746 | { 0, 4}, |
| 747 | {13, 3}, |
| 748 | {24, 4}, |
| 749 | {30, 2}, |
| 750 | {54, 3}, |
| 751 | {-1, -1} |
| 752 | }; |
| 753 | |
| 754 | static const s16 dm646x_dma_rsv_slots[][2] = { |
| 755 | /* (offset, number) */ |
| 756 | { 0, 4}, |
| 757 | {13, 3}, |
| 758 | {24, 4}, |
| 759 | {30, 2}, |
| 760 | {54, 3}, |
| 761 | {128, 384}, |
| 762 | {-1, -1} |
| 763 | }; |
| 764 | |
| 765 | static struct edma_rsv_info dm646x_edma_rsv[] = { |
| 766 | { |
| 767 | .rsv_chans = dm646x_dma_rsv_chans, |
| 768 | .rsv_slots = dm646x_dma_rsv_slots, |
| 769 | }, |
| 770 | }; |
| 771 | |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 772 | static __init void evm_init(void) |
| 773 | { |
Philip Avinash | 834acb2 | 2013-08-18 10:49:02 +0530 | [diff] [blame] | 774 | int ret; |
Mark A. Greer | 972412b | 2009-04-15 12:40:56 -0700 | [diff] [blame] | 775 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
| 776 | |
Philip Avinash | 834acb2 | 2013-08-18 10:49:02 +0530 | [diff] [blame] | 777 | ret = dm646x_gpio_register(); |
| 778 | if (ret) |
| 779 | pr_warn("%s: GPIO init failed: %d\n", __func__, ret); |
| 780 | |
Arnd Bergmann | 8e58041 | 2016-02-01 21:35:58 +0100 | [diff] [blame] | 781 | #ifdef CONFIG_I2C |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 782 | evm_init_i2c(); |
Arnd Bergmann | 8e58041 | 2016-02-01 21:35:58 +0100 | [diff] [blame] | 783 | #endif |
| 784 | |
Manjunathappa, Prakash | fcf7157 | 2013-06-19 14:45:42 +0530 | [diff] [blame] | 785 | davinci_serial_init(dm646x_serial_device); |
Chaithrika U S | 25acf55 | 2009-06-05 06:28:08 -0400 | [diff] [blame] | 786 | dm646x_init_mcasp0(&dm646x_evm_snd_data[0]); |
| 787 | dm646x_init_mcasp1(&dm646x_evm_snd_data[1]); |
Mark A. Greer | 972412b | 2009-04-15 12:40:56 -0700 | [diff] [blame] | 788 | |
Sekhar Nori | 0b3fc7b | 2010-08-09 15:46:40 +0530 | [diff] [blame] | 789 | if (machine_is_davinci_dm6467tevm()) |
| 790 | davinci_nand_data.timing = &dm6467tevm_nandflash_timing; |
| 791 | |
Hemant Pedanekar | 50fbabf | 2009-09-18 23:09:29 +0530 | [diff] [blame] | 792 | platform_device_register(&davinci_nand_device); |
| 793 | |
Ivan Khoronzhuk | 67f5185 | 2014-01-30 13:03:40 +0200 | [diff] [blame] | 794 | if (davinci_aemif_setup(&davinci_nand_device)) |
| 795 | pr_warn("%s: Cannot configure AEMIF.\n", __func__); |
| 796 | |
Rajashekhara, Sudhakar | cce3ddd | 2010-06-29 11:35:15 +0530 | [diff] [blame] | 797 | dm646x_init_edma(dm646x_edma_rsv); |
| 798 | |
Hemant Pedanekar | 548197b | 2009-07-17 23:30:36 +0530 | [diff] [blame] | 799 | if (HAS_ATA) |
Sergei Shtylyov | 7a9978a | 2010-04-21 18:11:33 +0400 | [diff] [blame] | 800 | davinci_init_ide(); |
Hemant Pedanekar | 548197b | 2009-07-17 23:30:36 +0530 | [diff] [blame] | 801 | |
Cyril Chemparathy | 782f2d7 | 2010-09-15 10:11:25 -0400 | [diff] [blame] | 802 | soc_info->emac_pdata->phy_id = DM646X_EVM_PHY_ID; |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 803 | } |
| 804 | |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 805 | MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM") |
Nicolas Pitre | e7e5601 | 2011-07-05 22:38:11 -0400 | [diff] [blame] | 806 | .atag_offset = 0x100, |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 807 | .map_io = davinci_map_io, |
Cyril Chemparathy | bd80894 | 2010-05-07 17:06:37 -0400 | [diff] [blame] | 808 | .init_irq = davinci_irq_init, |
David Lechner | 96c0817 | 2018-01-19 21:20:22 -0600 | [diff] [blame] | 809 | .init_time = dm646x_evm_init_time, |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 810 | .init_machine = evm_init, |
Shawn Guo | 3aa3e84 | 2012-04-26 09:45:39 +0800 | [diff] [blame] | 811 | .init_late = davinci_init_late, |
Nicolas Pitre | f68deab | 2011-07-05 22:28:08 -0400 | [diff] [blame] | 812 | .dma_zone_size = SZ_128M, |
Kevin Hilman | e38d92f | 2009-04-29 17:44:58 -0700 | [diff] [blame] | 813 | MACHINE_END |
| 814 | |
Sekhar Nori | c1978e1 | 2009-11-24 18:25:15 +0530 | [diff] [blame] | 815 | MACHINE_START(DAVINCI_DM6467TEVM, "DaVinci DM6467T EVM") |
Nicolas Pitre | e7e5601 | 2011-07-05 22:38:11 -0400 | [diff] [blame] | 816 | .atag_offset = 0x100, |
Sekhar Nori | c1978e1 | 2009-11-24 18:25:15 +0530 | [diff] [blame] | 817 | .map_io = davinci_map_io, |
Cyril Chemparathy | bd80894 | 2010-05-07 17:06:37 -0400 | [diff] [blame] | 818 | .init_irq = davinci_irq_init, |
David Lechner | 96c0817 | 2018-01-19 21:20:22 -0600 | [diff] [blame] | 819 | .init_time = dm6467t_evm_init_time, |
Sekhar Nori | c1978e1 | 2009-11-24 18:25:15 +0530 | [diff] [blame] | 820 | .init_machine = evm_init, |
Shawn Guo | 3aa3e84 | 2012-04-26 09:45:39 +0800 | [diff] [blame] | 821 | .init_late = davinci_init_late, |
Nicolas Pitre | f68deab | 2011-07-05 22:28:08 -0400 | [diff] [blame] | 822 | .dma_zone_size = SZ_128M, |
Sekhar Nori | c1978e1 | 2009-11-24 18:25:15 +0530 | [diff] [blame] | 823 | MACHINE_END |
| 824 | |