| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * TI DaVinci DM646X EVM board | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Derived from: arch/arm/mach-davinci/board-evm.c | 
					
						
							|  |  |  |  * Copyright (C) 2006 Texas Instruments. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * (C) 2007-2008, MontaVista Software, Inc. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This file is licensed under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * version 2. This program is licensed "as is" without any warranty of any | 
					
						
							|  |  |  |  * kind, whether express or implied. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**************************************************************************
 | 
					
						
							|  |  |  |  * Included Files | 
					
						
							|  |  |  |  **************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/kernel.h>
 | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | #include <linux/leds.h>
 | 
					
						
							|  |  |  | #include <linux/gpio.h>
 | 
					
						
							|  |  |  | #include <linux/platform_device.h>
 | 
					
						
							|  |  |  | #include <linux/i2c.h>
 | 
					
						
							| 
									
										
										
										
											2013-09-27 15:06:28 -04:00
										 |  |  | #include <linux/platform_data/at24.h>
 | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | #include <linux/i2c/pcf857x.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | #include <media/tvp514x.h>
 | 
					
						
							| 
									
										
										
										
											2012-09-25 08:11:49 -03:00
										 |  |  | #include <media/adv7343.h>
 | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-18 23:09:29 +05:30
										 |  |  | #include <linux/mtd/mtd.h>
 | 
					
						
							|  |  |  | #include <linux/mtd/nand.h>
 | 
					
						
							|  |  |  | #include <linux/mtd/partitions.h>
 | 
					
						
							| 
									
										
										
										
											2009-11-24 18:25:15 +05:30
										 |  |  | #include <linux/clk.h>
 | 
					
						
							| 
									
										
										
										
											2011-07-31 16:17:29 -04:00
										 |  |  | #include <linux/export.h>
 | 
					
						
							| 
									
										
										
										
											2013-08-18 10:49:02 +05:30
										 |  |  | #include <linux/platform_data/gpio-davinci.h>
 | 
					
						
							|  |  |  | #include <linux/platform_data/i2c-davinci.h>
 | 
					
						
							|  |  |  | #include <linux/platform_data/mtd-davinci.h>
 | 
					
						
							|  |  |  | #include <linux/platform_data/mtd-davinci-aemif.h>
 | 
					
						
							| 
									
										
										
										
											2009-09-18 23:09:29 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | #include <asm/mach-types.h>
 | 
					
						
							|  |  |  | #include <asm/mach/arch.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <mach/common.h>
 | 
					
						
							| 
									
										
										
										
											2013-08-18 10:49:02 +05:30
										 |  |  | #include <mach/irqs.h>
 | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | #include <mach/serial.h>
 | 
					
						
							| 
									
										
										
										
											2010-01-06 17:19:49 +05:30
										 |  |  | #include <mach/clock.h>
 | 
					
						
							|  |  |  | #include <mach/cdce949.h>
 | 
					
						
							| 
									
										
										
										
											2009-05-07 06:19:40 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:35 +05:30
										 |  |  | #include "davinci.h"
 | 
					
						
							| 
									
										
										
										
											2009-11-24 18:25:15 +05:30
										 |  |  | #include "clock.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-18 23:09:29 +05:30
										 |  |  | #define NAND_BLOCK_SIZE		SZ_128K
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Note: We are setting first partition as 'bootloader' constituting UBL, U-Boot
 | 
					
						
							|  |  |  |  * and U-Boot environment this avoids dependency on any particular combination | 
					
						
							|  |  |  |  * of UBL, U-Boot or flashing tools etc. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static struct mtd_partition davinci_nand_partitions[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		/* UBL, U-Boot with environment */ | 
					
						
							|  |  |  | 		.name		= "bootloader", | 
					
						
							|  |  |  | 		.offset		= MTDPART_OFS_APPEND, | 
					
						
							|  |  |  | 		.size		= 16 * NAND_BLOCK_SIZE, | 
					
						
							|  |  |  | 		.mask_flags	= MTD_WRITEABLE,	/* force read-only */ | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.name		= "kernel", | 
					
						
							|  |  |  | 		.offset		= MTDPART_OFS_APPEND, | 
					
						
							|  |  |  | 		.size		= SZ_4M, | 
					
						
							|  |  |  | 		.mask_flags	= 0, | 
					
						
							|  |  |  | 	}, { | 
					
						
							|  |  |  | 		.name		= "filesystem", | 
					
						
							|  |  |  | 		.offset		= MTDPART_OFS_APPEND, | 
					
						
							|  |  |  | 		.size		= MTDPART_SIZ_FULL, | 
					
						
							|  |  |  | 		.mask_flags	= 0, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-09 15:46:40 +05:30
										 |  |  | static struct davinci_aemif_timing dm6467tevm_nandflash_timing = { | 
					
						
							|  |  |  | 	.wsetup		= 29, | 
					
						
							|  |  |  | 	.wstrobe	= 24, | 
					
						
							|  |  |  | 	.whold		= 14, | 
					
						
							|  |  |  | 	.rsetup		= 19, | 
					
						
							|  |  |  | 	.rstrobe	= 33, | 
					
						
							|  |  |  | 	.rhold		= 0, | 
					
						
							|  |  |  | 	.ta		= 29, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-18 23:09:29 +05:30
										 |  |  | static struct davinci_nand_pdata davinci_nand_data = { | 
					
						
							|  |  |  | 	.mask_cle 		= 0x80000, | 
					
						
							|  |  |  | 	.mask_ale 		= 0x40000, | 
					
						
							|  |  |  | 	.parts			= davinci_nand_partitions, | 
					
						
							|  |  |  | 	.nr_parts		= ARRAY_SIZE(davinci_nand_partitions), | 
					
						
							|  |  |  | 	.ecc_mode		= NAND_ECC_HW, | 
					
						
							| 
									
										
										
										
											2013-08-16 14:43:48 +05:30
										 |  |  | 	.ecc_bits		= 1, | 
					
						
							| 
									
										
										
										
											2009-09-18 23:09:29 +05:30
										 |  |  | 	.options		= 0, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct resource davinci_nand_resources[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2010-04-16 21:29:11 +04:00
										 |  |  | 		.start		= DM646X_ASYNC_EMIF_CS2_SPACE_BASE, | 
					
						
							|  |  |  | 		.end		= DM646X_ASYNC_EMIF_CS2_SPACE_BASE + SZ_32M - 1, | 
					
						
							| 
									
										
										
										
											2009-09-18 23:09:29 +05:30
										 |  |  | 		.flags		= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, { | 
					
						
							| 
									
										
										
										
											2010-04-16 21:29:11 +04:00
										 |  |  | 		.start		= DM646X_ASYNC_EMIF_CONTROL_BASE, | 
					
						
							|  |  |  | 		.end		= DM646X_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1, | 
					
						
							| 
									
										
										
										
											2009-09-18 23:09:29 +05:30
										 |  |  | 		.flags		= IORESOURCE_MEM, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device davinci_nand_device = { | 
					
						
							|  |  |  | 	.name			= "davinci_nand", | 
					
						
							|  |  |  | 	.id			= 0, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.num_resources		= ARRAY_SIZE(davinci_nand_resources), | 
					
						
							|  |  |  | 	.resource		= davinci_nand_resources, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.dev			= { | 
					
						
							|  |  |  | 		.platform_data	= &davinci_nand_data, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-01 12:43:44 +05:30
										 |  |  | #define HAS_ATA		IS_ENABLED(CONFIG_BLK_DEV_PALMCHIP_BK3710)
 | 
					
						
							| 
									
										
										
										
											2009-11-24 18:25:14 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  | /* CPLD Register 0 bits to control ATA */ | 
					
						
							|  |  |  | #define DM646X_EVM_ATA_RST		BIT(0)
 | 
					
						
							|  |  |  | #define DM646X_EVM_ATA_PWD		BIT(1)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-17 23:30:36 +05:30
										 |  |  | /* CPLD Register 0 Client: used for I/O Control */ | 
					
						
							|  |  |  | static int cpld_reg0_probe(struct i2c_client *client, | 
					
						
							|  |  |  | 			   const struct i2c_device_id *id) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (HAS_ATA) { | 
					
						
							|  |  |  | 		u8 data; | 
					
						
							|  |  |  | 		struct i2c_msg msg[2] = { | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				.addr = client->addr, | 
					
						
							|  |  |  | 				.flags = I2C_M_RD, | 
					
						
							|  |  |  | 				.len = 1, | 
					
						
							|  |  |  | 				.buf = &data, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			{ | 
					
						
							|  |  |  | 				.addr = client->addr, | 
					
						
							|  |  |  | 				.flags = 0, | 
					
						
							|  |  |  | 				.len = 1, | 
					
						
							|  |  |  | 				.buf = &data, | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		/* Clear ATA_RSTn and ATA_PWD bits to enable ATA operation. */ | 
					
						
							|  |  |  | 		i2c_transfer(client->adapter, msg, 1); | 
					
						
							|  |  |  | 		data &= ~(DM646X_EVM_ATA_RST | DM646X_EVM_ATA_PWD); | 
					
						
							|  |  |  | 		i2c_transfer(client->adapter, msg + 1, 1); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const struct i2c_device_id cpld_reg_ids[] = { | 
					
						
							|  |  |  | 	{ "cpld_reg0", 0, }, | 
					
						
							|  |  |  | 	{ }, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct i2c_driver dm6467evm_cpld_driver = { | 
					
						
							|  |  |  | 	.driver.name	= "cpld_reg0", | 
					
						
							|  |  |  | 	.id_table	= cpld_reg_ids, | 
					
						
							|  |  |  | 	.probe		= cpld_reg0_probe, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | /* LEDS */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct gpio_led evm_leds[] = { | 
					
						
							|  |  |  | 	{ .name = "DS1", .active_low = 1, }, | 
					
						
							|  |  |  | 	{ .name = "DS2", .active_low = 1, }, | 
					
						
							|  |  |  | 	{ .name = "DS3", .active_low = 1, }, | 
					
						
							|  |  |  | 	{ .name = "DS4", .active_low = 1, }, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-04 17:08:42 +05:30
										 |  |  | static const struct gpio_led_platform_data evm_led_data = { | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | 	.num_leds = ARRAY_SIZE(evm_leds), | 
					
						
							|  |  |  | 	.leds     = evm_leds, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct platform_device *evm_led_dev; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int evm_led_setup(struct i2c_client *client, int gpio, | 
					
						
							|  |  |  | 			unsigned int ngpio, void *c) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	struct gpio_led *leds = evm_leds; | 
					
						
							|  |  |  | 	int status; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	while (ngpio--) { | 
					
						
							|  |  |  | 		leds->gpio = gpio++; | 
					
						
							|  |  |  | 		leds++; | 
					
						
							| 
									
										
										
										
											2012-09-18 18:59:59 +02:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	evm_led_dev = platform_device_alloc("leds-gpio", 0); | 
					
						
							|  |  |  | 	platform_device_add_data(evm_led_dev, &evm_led_data, | 
					
						
							|  |  |  | 				sizeof(evm_led_data)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	evm_led_dev->dev.parent = &client->dev; | 
					
						
							|  |  |  | 	status = platform_device_add(evm_led_dev); | 
					
						
							|  |  |  | 	if (status < 0) { | 
					
						
							|  |  |  | 		platform_device_put(evm_led_dev); | 
					
						
							|  |  |  | 		evm_led_dev = NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return status; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int evm_led_teardown(struct i2c_client *client, int gpio, | 
					
						
							|  |  |  | 				unsigned ngpio, void *c) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (evm_led_dev) { | 
					
						
							|  |  |  | 		platform_device_unregister(evm_led_dev); | 
					
						
							|  |  |  | 		evm_led_dev = NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int evm_sw_gpio[4] = { -EINVAL, -EINVAL, -EINVAL, -EINVAL }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int evm_sw_setup(struct i2c_client *client, int gpio, | 
					
						
							|  |  |  | 			unsigned ngpio, void *c) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int status; | 
					
						
							|  |  |  | 	int i; | 
					
						
							|  |  |  | 	char label[10]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for (i = 0; i < 4; ++i) { | 
					
						
							|  |  |  | 		snprintf(label, 10, "user_sw%d", i); | 
					
						
							|  |  |  | 		status = gpio_request(gpio, label); | 
					
						
							|  |  |  | 		if (status) | 
					
						
							|  |  |  | 			goto out_free; | 
					
						
							|  |  |  | 		evm_sw_gpio[i] = gpio++; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		status = gpio_direction_input(evm_sw_gpio[i]); | 
					
						
							|  |  |  | 		if (status) { | 
					
						
							|  |  |  | 			gpio_free(evm_sw_gpio[i]); | 
					
						
							|  |  |  | 			evm_sw_gpio[i] = -EINVAL; | 
					
						
							|  |  |  | 			goto out_free; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		status = gpio_export(evm_sw_gpio[i], 0); | 
					
						
							|  |  |  | 		if (status) { | 
					
						
							|  |  |  | 			gpio_free(evm_sw_gpio[i]); | 
					
						
							|  |  |  | 			evm_sw_gpio[i] = -EINVAL; | 
					
						
							|  |  |  | 			goto out_free; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return status; | 
					
						
							|  |  |  | out_free: | 
					
						
							|  |  |  | 	for (i = 0; i < 4; ++i) { | 
					
						
							|  |  |  | 		if (evm_sw_gpio[i] != -EINVAL) { | 
					
						
							|  |  |  | 			gpio_free(evm_sw_gpio[i]); | 
					
						
							|  |  |  | 			evm_sw_gpio[i] = -EINVAL; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return status; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int evm_sw_teardown(struct i2c_client *client, int gpio, | 
					
						
							|  |  |  | 			unsigned ngpio, void *c) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int i; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for (i = 0; i < 4; ++i) { | 
					
						
							|  |  |  | 		if (evm_sw_gpio[i] != -EINVAL) { | 
					
						
							|  |  |  | 			gpio_unexport(evm_sw_gpio[i]); | 
					
						
							|  |  |  | 			gpio_free(evm_sw_gpio[i]); | 
					
						
							|  |  |  | 			evm_sw_gpio[i] = -EINVAL; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int evm_pcf_setup(struct i2c_client *client, int gpio, | 
					
						
							|  |  |  | 			unsigned int ngpio, void *c) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int status; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (ngpio < 8) | 
					
						
							|  |  |  | 		return -EINVAL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	status = evm_sw_setup(client, gpio, 4, c); | 
					
						
							|  |  |  | 	if (status) | 
					
						
							|  |  |  | 		return status; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return evm_led_setup(client, gpio+4, 4, c); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int evm_pcf_teardown(struct i2c_client *client, int gpio, | 
					
						
							|  |  |  | 			unsigned int ngpio, void *c) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	BUG_ON(ngpio < 8); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	evm_sw_teardown(client, gpio, 4, c); | 
					
						
							|  |  |  | 	evm_led_teardown(client, gpio+4, 4, c); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct pcf857x_platform_data pcf_data = { | 
					
						
							|  |  |  | 	.gpio_base	= DAVINCI_N_GPIO+1, | 
					
						
							|  |  |  | 	.setup		= evm_pcf_setup, | 
					
						
							|  |  |  | 	.teardown	= evm_pcf_teardown, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Most of this EEPROM is unused, but U-Boot uses some data:
 | 
					
						
							|  |  |  |  *  - 0x7f00, 6 bytes Ethernet Address | 
					
						
							|  |  |  |  *  - ... newer boards may have more | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct at24_platform_data eeprom_info = { | 
					
						
							|  |  |  | 	.byte_len       = (256*1024) / 8, | 
					
						
							|  |  |  | 	.page_size      = 64, | 
					
						
							|  |  |  | 	.flags          = AT24_FLAG_ADDR16, | 
					
						
							| 
									
										
										
										
											2009-04-15 12:41:27 -07:00
										 |  |  | 	.setup          = davinci_get_mac_addr, | 
					
						
							|  |  |  | 	.context	= (void *)0x7f00, | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-06-05 06:28:08 -04:00
										 |  |  | static u8 dm646x_iis_serializer_direction[] = { | 
					
						
							|  |  |  |        TX_MODE, RX_MODE, INACTIVE_MODE, INACTIVE_MODE, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static u8 dm646x_dit_serializer_direction[] = { | 
					
						
							|  |  |  |        TX_MODE, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct snd_platform_data dm646x_evm_snd_data[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.tx_dma_offset  = 0x400, | 
					
						
							|  |  |  | 		.rx_dma_offset  = 0x400, | 
					
						
							|  |  |  | 		.op_mode        = DAVINCI_MCASP_IIS_MODE, | 
					
						
							|  |  |  | 		.num_serializer = ARRAY_SIZE(dm646x_iis_serializer_direction), | 
					
						
							|  |  |  | 		.tdm_slots      = 2, | 
					
						
							|  |  |  | 		.serial_dir     = dm646x_iis_serializer_direction, | 
					
						
							| 
									
										
										
										
											2010-07-19 12:31:16 +05:30
										 |  |  | 		.asp_chan_q     = EVENTQ_0, | 
					
						
							| 
									
										
										
										
											2009-06-05 06:28:08 -04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.tx_dma_offset  = 0x400, | 
					
						
							|  |  |  | 		.rx_dma_offset  = 0, | 
					
						
							|  |  |  | 		.op_mode        = DAVINCI_MCASP_DIT_MODE, | 
					
						
							|  |  |  | 		.num_serializer = ARRAY_SIZE(dm646x_dit_serializer_direction), | 
					
						
							|  |  |  | 		.tdm_slots      = 32, | 
					
						
							|  |  |  | 		.serial_dir     = dm646x_dit_serializer_direction, | 
					
						
							| 
									
										
										
										
											2010-07-19 12:31:16 +05:30
										 |  |  | 		.asp_chan_q     = EVENTQ_0, | 
					
						
							| 
									
										
										
										
											2009-06-05 06:28:08 -04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | static struct i2c_client *cpld_client; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int cpld_video_probe(struct i2c_client *client, | 
					
						
							|  |  |  | 			const struct i2c_device_id *id) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	cpld_client = client; | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-21 14:02:24 -08:00
										 |  |  | static int cpld_video_remove(struct i2c_client *client) | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | { | 
					
						
							|  |  |  | 	cpld_client = NULL; | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const struct i2c_device_id cpld_video_id[] = { | 
					
						
							|  |  |  | 	{ "cpld_video", 0 }, | 
					
						
							|  |  |  | 	{ } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct i2c_driver cpld_video_driver = { | 
					
						
							|  |  |  | 	.driver = { | 
					
						
							|  |  |  | 		.name	= "cpld_video", | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	.probe		= cpld_video_probe, | 
					
						
							|  |  |  | 	.remove		= cpld_video_remove, | 
					
						
							|  |  |  | 	.id_table	= cpld_video_id, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void evm_init_cpld(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	i2c_add_driver(&cpld_video_driver); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | static struct i2c_board_info __initdata i2c_info[] =  { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		I2C_BOARD_INFO("24c256", 0x50), | 
					
						
							|  |  |  | 		.platform_data  = &eeprom_info, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		I2C_BOARD_INFO("pcf8574a", 0x38), | 
					
						
							|  |  |  | 		.platform_data	= &pcf_data, | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2009-07-17 23:30:36 +05:30
										 |  |  | 	{ | 
					
						
							|  |  |  | 		I2C_BOARD_INFO("cpld_reg0", 0x3a), | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2009-08-25 15:20:05 +03:00
										 |  |  | 	{ | 
					
						
							|  |  |  | 		I2C_BOARD_INFO("tlv320aic33", 0x18), | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		I2C_BOARD_INFO("cpld_video", 0x3b), | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2010-01-06 17:19:49 +05:30
										 |  |  | 	{ | 
					
						
							|  |  |  | 		I2C_BOARD_INFO("cdce949", 0x6c), | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct davinci_i2c_platform_data i2c_pdata = { | 
					
						
							|  |  |  | 	.bus_freq       = 100 /* kHz */, | 
					
						
							|  |  |  | 	.bus_delay      = 0 /* usec */, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-24 18:25:14 +05:30
										 |  |  | #define VCH2CLK_MASK		(BIT_MASK(10) | BIT_MASK(9) | BIT_MASK(8))
 | 
					
						
							|  |  |  | #define VCH2CLK_SYSCLK8		(BIT(9))
 | 
					
						
							|  |  |  | #define VCH2CLK_AUXCLK		(BIT(9) | BIT(8))
 | 
					
						
							|  |  |  | #define VCH3CLK_MASK		(BIT_MASK(14) | BIT_MASK(13) | BIT_MASK(12))
 | 
					
						
							|  |  |  | #define VCH3CLK_SYSCLK8		(BIT(13))
 | 
					
						
							|  |  |  | #define VCH3CLK_AUXCLK		(BIT(14) | BIT(13))
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define VIDCH2CLK		(BIT(10))
 | 
					
						
							|  |  |  | #define VIDCH3CLK		(BIT(11))
 | 
					
						
							|  |  |  | #define VIDCH1CLK		(BIT(4))
 | 
					
						
							|  |  |  | #define TVP7002_INPUT		(BIT(4))
 | 
					
						
							|  |  |  | #define TVP5147_INPUT		(~BIT(4))
 | 
					
						
							|  |  |  | #define VPIF_INPUT_ONE_CHANNEL	(BIT(5))
 | 
					
						
							|  |  |  | #define VPIF_INPUT_TWO_CHANNEL	(~BIT(5))
 | 
					
						
							|  |  |  | #define TVP5147_CH0		"tvp514x-0"
 | 
					
						
							|  |  |  | #define TVP5147_CH1		"tvp514x-1"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* spin lock for updating above registers */ | 
					
						
							|  |  |  | static spinlock_t vpif_reg_lock; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | static int set_vpif_clock(int mux_mode, int hd) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long flags; | 
					
						
							|  |  |  | 	unsigned int value; | 
					
						
							|  |  |  | 	int val = 0; | 
					
						
							|  |  |  | 	int err = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 	if (!cpld_client) | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 		return -ENXIO; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* disable the clock */ | 
					
						
							|  |  |  | 	spin_lock_irqsave(&vpif_reg_lock, flags); | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 	value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS)); | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	value |= (VIDCH3CLK | VIDCH2CLK); | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 	__raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS)); | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	spin_unlock_irqrestore(&vpif_reg_lock, flags); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	val = i2c_smbus_read_byte(cpld_client); | 
					
						
							|  |  |  | 	if (val < 0) | 
					
						
							|  |  |  | 		return val; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (mux_mode == 1) | 
					
						
							|  |  |  | 		val &= ~0x40; | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		val |= 0x40; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	err = i2c_smbus_write_byte(cpld_client, val); | 
					
						
							|  |  |  | 	if (err) | 
					
						
							|  |  |  | 		return err; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 	value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL)); | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	value &= ~(VCH2CLK_MASK); | 
					
						
							|  |  |  | 	value &= ~(VCH3CLK_MASK); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (hd >= 1) | 
					
						
							|  |  |  | 		value |= (VCH2CLK_SYSCLK8 | VCH3CLK_SYSCLK8); | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		value |= (VCH2CLK_AUXCLK | VCH3CLK_AUXCLK); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 	__raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL)); | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock_irqsave(&vpif_reg_lock, flags); | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 	value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS)); | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	/* enable the clock */ | 
					
						
							|  |  |  | 	value &= ~(VIDCH3CLK | VIDCH2CLK); | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 	__raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VSCLKDIS)); | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	spin_unlock_irqrestore(&vpif_reg_lock, flags); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct vpif_subdev_info dm646x_vpif_subdev[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name	= "adv7343", | 
					
						
							|  |  |  | 		.board_info = { | 
					
						
							|  |  |  | 			I2C_BOARD_INFO("adv7343", 0x2a), | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name	= "ths7303", | 
					
						
							|  |  |  | 		.board_info = { | 
					
						
							|  |  |  | 			I2C_BOARD_INFO("ths7303", 0x2c), | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-25 08:11:49 -03:00
										 |  |  | static const struct vpif_output dm6467_ch0_outputs[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.output = { | 
					
						
							|  |  |  | 			.index = 0, | 
					
						
							|  |  |  | 			.name = "Composite", | 
					
						
							|  |  |  | 			.type = V4L2_OUTPUT_TYPE_ANALOG, | 
					
						
							|  |  |  | 			.capabilities = V4L2_OUT_CAP_STD, | 
					
						
							|  |  |  | 			.std = V4L2_STD_ALL, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		.subdev_name = "adv7343", | 
					
						
							|  |  |  | 		.output_route = ADV7343_COMPOSITE_ID, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.output = { | 
					
						
							|  |  |  | 			.index = 1, | 
					
						
							|  |  |  | 			.name = "Component", | 
					
						
							|  |  |  | 			.type = V4L2_OUTPUT_TYPE_ANALOG, | 
					
						
							| 
									
										
										
										
											2013-02-15 15:10:45 -03:00
										 |  |  | 			.capabilities = V4L2_OUT_CAP_DV_TIMINGS, | 
					
						
							| 
									
										
										
										
											2012-09-25 08:11:49 -03:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		.subdev_name = "adv7343", | 
					
						
							|  |  |  | 		.output_route = ADV7343_COMPONENT_ID, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.output = { | 
					
						
							|  |  |  | 			.index = 2, | 
					
						
							|  |  |  | 			.name = "S-Video", | 
					
						
							|  |  |  | 			.type = V4L2_OUTPUT_TYPE_ANALOG, | 
					
						
							|  |  |  | 			.capabilities = V4L2_OUT_CAP_STD, | 
					
						
							|  |  |  | 			.std = V4L2_STD_ALL, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		.subdev_name = "adv7343", | 
					
						
							|  |  |  | 		.output_route = ADV7343_SVIDEO_ID, | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct vpif_display_config dm646x_vpif_display_config = { | 
					
						
							|  |  |  | 	.set_clock	= set_vpif_clock, | 
					
						
							|  |  |  | 	.subdevinfo	= dm646x_vpif_subdev, | 
					
						
							|  |  |  | 	.subdev_count	= ARRAY_SIZE(dm646x_vpif_subdev), | 
					
						
							| 
									
										
										
										
											2012-09-25 08:11:49 -03:00
										 |  |  | 	.chan_config[0] = { | 
					
						
							|  |  |  | 		.outputs = dm6467_ch0_outputs, | 
					
						
							|  |  |  | 		.output_count = ARRAY_SIZE(dm6467_ch0_outputs), | 
					
						
							|  |  |  | 	}, | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	.card_name	= "DM646x EVM", | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * setup_vpif_input_path() | 
					
						
							|  |  |  |  * @channel: channel id (0 - CH0, 1 - CH1) | 
					
						
							|  |  |  |  * @sub_dev_name: ptr sub device name | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This will set vpif input to capture data from tvp514x or | 
					
						
							|  |  |  |  * tvp7002. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static int setup_vpif_input_path(int channel, const char *sub_dev_name) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int err = 0; | 
					
						
							|  |  |  | 	int val; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* for channel 1, we don't do anything */ | 
					
						
							|  |  |  | 	if (channel != 0) | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (!cpld_client) | 
					
						
							|  |  |  | 		return -ENXIO; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	val = i2c_smbus_read_byte(cpld_client); | 
					
						
							|  |  |  | 	if (val < 0) | 
					
						
							|  |  |  | 		return val; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (!strcmp(sub_dev_name, TVP5147_CH0) || | 
					
						
							|  |  |  | 	    !strcmp(sub_dev_name, TVP5147_CH1)) | 
					
						
							|  |  |  | 		val &= TVP5147_INPUT; | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 		val |= TVP7002_INPUT; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	err = i2c_smbus_write_byte(cpld_client, val); | 
					
						
							|  |  |  | 	if (err) | 
					
						
							|  |  |  | 		return err; | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * setup_vpif_input_channel_mode() | 
					
						
							|  |  |  |  * @mux_mode:  mux mode. 0 - 1 channel or (1) - 2 channel | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This will setup input mode to one channel (TVP7002) or 2 channel (TVP5147) | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static int setup_vpif_input_channel_mode(int mux_mode) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	unsigned long flags; | 
					
						
							|  |  |  | 	int err = 0; | 
					
						
							|  |  |  | 	int val; | 
					
						
							|  |  |  | 	u32 value; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 	if (!cpld_client) | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 		return -ENXIO; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	val = i2c_smbus_read_byte(cpld_client); | 
					
						
							|  |  |  | 	if (val < 0) | 
					
						
							|  |  |  | 		return val; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	spin_lock_irqsave(&vpif_reg_lock, flags); | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 	value = __raw_readl(DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL)); | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	if (mux_mode) { | 
					
						
							|  |  |  | 		val &= VPIF_INPUT_TWO_CHANNEL; | 
					
						
							|  |  |  | 		value |= VIDCH1CLK; | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		val |= VPIF_INPUT_ONE_CHANNEL; | 
					
						
							|  |  |  | 		value &= ~VIDCH1CLK; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-12-21 19:13:36 +05:30
										 |  |  | 	__raw_writel(value, DAVINCI_SYSMOD_VIRT(SYSMOD_VIDCLKCTL)); | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	spin_unlock_irqrestore(&vpif_reg_lock, flags); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	err = i2c_smbus_write_byte(cpld_client, val); | 
					
						
							|  |  |  | 	if (err) | 
					
						
							|  |  |  | 		return err; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct tvp514x_platform_data tvp5146_pdata = { | 
					
						
							|  |  |  | 	.clk_polarity = 0, | 
					
						
							|  |  |  | 	.hs_polarity = 1, | 
					
						
							|  |  |  | 	.vs_polarity = 1 | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct vpif_subdev_info vpif_capture_sdev_info[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name	= TVP5147_CH0, | 
					
						
							|  |  |  | 		.board_info = { | 
					
						
							|  |  |  | 			I2C_BOARD_INFO("tvp5146", 0x5d), | 
					
						
							|  |  |  | 			.platform_data = &tvp5146_pdata, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.name	= TVP5147_CH1, | 
					
						
							|  |  |  | 		.board_info = { | 
					
						
							|  |  |  | 			I2C_BOARD_INFO("tvp5146", 0x5c), | 
					
						
							|  |  |  | 			.platform_data = &tvp5146_pdata, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const struct vpif_input dm6467_ch0_inputs[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.input = { | 
					
						
							|  |  |  | 			.index = 0, | 
					
						
							|  |  |  | 			.name = "Composite", | 
					
						
							|  |  |  | 			.type = V4L2_INPUT_TYPE_CAMERA, | 
					
						
							| 
									
										
										
										
											2012-09-20 09:06:25 -03:00
										 |  |  | 			.capabilities = V4L2_IN_CAP_STD, | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 			.std = TVP514X_STD_ALL, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		.subdev_name = TVP5147_CH0, | 
					
						
							| 
									
										
										
										
											2012-09-20 09:06:25 -03:00
										 |  |  | 		.input_route = INPUT_CVBS_VI2B, | 
					
						
							|  |  |  | 		.output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const struct vpif_input dm6467_ch1_inputs[] = { | 
					
						
							|  |  |  |        { | 
					
						
							|  |  |  | 		.input = { | 
					
						
							|  |  |  | 			.index = 0, | 
					
						
							|  |  |  | 			.name = "S-Video", | 
					
						
							|  |  |  | 			.type = V4L2_INPUT_TYPE_CAMERA, | 
					
						
							| 
									
										
										
										
											2012-09-20 09:06:25 -03:00
										 |  |  | 			.capabilities = V4L2_IN_CAP_STD, | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 			.std = TVP514X_STD_ALL, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		.subdev_name = TVP5147_CH1, | 
					
						
							| 
									
										
										
										
											2012-09-20 09:06:25 -03:00
										 |  |  | 		.input_route = INPUT_SVIDEO_VI2C_VI1C, | 
					
						
							|  |  |  | 		.output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct vpif_capture_config dm646x_vpif_capture_cfg = { | 
					
						
							|  |  |  | 	.setup_input_path = setup_vpif_input_path, | 
					
						
							|  |  |  | 	.setup_input_channel_mode = setup_vpif_input_channel_mode, | 
					
						
							|  |  |  | 	.subdev_info = vpif_capture_sdev_info, | 
					
						
							|  |  |  | 	.subdev_count = ARRAY_SIZE(vpif_capture_sdev_info), | 
					
						
							|  |  |  | 	.chan_config[0] = { | 
					
						
							|  |  |  | 		.inputs = dm6467_ch0_inputs, | 
					
						
							|  |  |  | 		.input_count = ARRAY_SIZE(dm6467_ch0_inputs), | 
					
						
							| 
									
										
										
										
											2012-09-20 09:06:32 -03:00
										 |  |  | 		.vpif_if = { | 
					
						
							|  |  |  | 			.if_type = VPIF_IF_BT656, | 
					
						
							|  |  |  | 			.hd_pol = 1, | 
					
						
							|  |  |  | 			.vd_pol = 1, | 
					
						
							|  |  |  | 			.fid_pol = 0, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 	.chan_config[1] = { | 
					
						
							|  |  |  | 		.inputs = dm6467_ch1_inputs, | 
					
						
							|  |  |  | 		.input_count = ARRAY_SIZE(dm6467_ch1_inputs), | 
					
						
							| 
									
										
										
										
											2012-09-20 09:06:32 -03:00
										 |  |  | 		.vpif_if = { | 
					
						
							|  |  |  | 			.if_type = VPIF_IF_BT656, | 
					
						
							|  |  |  | 			.hd_pol = 1, | 
					
						
							|  |  |  | 			.vd_pol = 1, | 
					
						
							|  |  |  | 			.fid_pol = 0, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void __init evm_init_video(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	spin_lock_init(&vpif_reg_lock); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	dm646x_setup_vpif(&dm646x_vpif_display_config, | 
					
						
							|  |  |  | 			  &dm646x_vpif_capture_cfg); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | static void __init evm_init_i2c(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	davinci_init_i2c(&i2c_pdata); | 
					
						
							| 
									
										
										
										
											2009-07-17 23:30:36 +05:30
										 |  |  | 	i2c_add_driver(&dm6467evm_cpld_driver); | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | 	i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); | 
					
						
							| 
									
										
										
										
											2009-09-16 13:15:30 -04:00
										 |  |  | 	evm_init_cpld(); | 
					
						
							|  |  |  | 	evm_init_video(); | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-06 17:19:49 +05:30
										 |  |  | #define CDCE949_XIN_RATE	27000000
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* CDCE949 support - "lpsc" field is overridden to work as clock number */ | 
					
						
							|  |  |  | static struct clk cdce_clk_in = { | 
					
						
							|  |  |  | 	.name	= "cdce_xin", | 
					
						
							|  |  |  | 	.rate	= CDCE949_XIN_RATE, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-11 08:22:23 -08:00
										 |  |  | static struct clk_lookup cdce_clks[] = { | 
					
						
							| 
									
										
										
										
											2010-01-06 17:19:49 +05:30
										 |  |  | 	CLK(NULL, "xin", &cdce_clk_in), | 
					
						
							|  |  |  | 	CLK(NULL, NULL, NULL), | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void __init cdce_clk_init(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-11 08:22:23 -08:00
										 |  |  | 	struct clk_lookup *c; | 
					
						
							| 
									
										
										
										
											2010-01-06 17:19:49 +05:30
										 |  |  | 	struct clk *clk; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-11 08:22:23 -08:00
										 |  |  | 	for (c = cdce_clks; c->clk; c++) { | 
					
						
							|  |  |  | 		clk = c->clk; | 
					
						
							|  |  |  | 		clkdev_add(c); | 
					
						
							| 
									
										
										
										
											2010-01-06 17:19:49 +05:30
										 |  |  | 		clk_register(clk); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-14 15:33:20 +00:00
										 |  |  | #define DM6467T_EVM_REF_FREQ		33000000
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | static void __init davinci_map_io(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	dm646x_init(); | 
					
						
							| 
									
										
										
										
											2011-06-14 15:33:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (machine_is_davinci_dm6467tevm()) | 
					
						
							|  |  |  | 		davinci_set_refclk_rate(DM6467T_EVM_REF_FREQ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-06 17:19:49 +05:30
										 |  |  | 	cdce_clk_init(); | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-01-21 02:48:17 +05:30
										 |  |  | #define DM646X_EVM_PHY_ID		"davinci_mdio-0:01"
 | 
					
						
							| 
									
										
										
										
											2010-06-29 11:35:15 +05:30
										 |  |  | /*
 | 
					
						
							|  |  |  |  * The following EDMA channels/slots are not being used by drivers (for | 
					
						
							|  |  |  |  * example: Timer, GPIO, UART events etc) on dm646x, hence they are being | 
					
						
							|  |  |  |  * reserved for codecs on the DSP side. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static const s16 dm646x_dma_rsv_chans[][2] = { | 
					
						
							|  |  |  | 	/* (offset, number) */ | 
					
						
							|  |  |  | 	{ 0,  4}, | 
					
						
							|  |  |  | 	{13,  3}, | 
					
						
							|  |  |  | 	{24,  4}, | 
					
						
							|  |  |  | 	{30,  2}, | 
					
						
							|  |  |  | 	{54,  3}, | 
					
						
							|  |  |  | 	{-1, -1} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static const s16 dm646x_dma_rsv_slots[][2] = { | 
					
						
							|  |  |  | 	/* (offset, number) */ | 
					
						
							|  |  |  | 	{ 0,  4}, | 
					
						
							|  |  |  | 	{13,  3}, | 
					
						
							|  |  |  | 	{24,  4}, | 
					
						
							|  |  |  | 	{30,  2}, | 
					
						
							|  |  |  | 	{54,  3}, | 
					
						
							|  |  |  | 	{128, 384}, | 
					
						
							|  |  |  | 	{-1, -1} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static struct edma_rsv_info dm646x_edma_rsv[] = { | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		.rsv_chans	= dm646x_dma_rsv_chans, | 
					
						
							|  |  |  | 		.rsv_slots	= dm646x_dma_rsv_slots, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | static __init void evm_init(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2013-08-18 10:49:02 +05:30
										 |  |  | 	int ret; | 
					
						
							| 
									
										
										
										
											2009-04-15 12:40:56 -07:00
										 |  |  | 	struct davinci_soc_info *soc_info = &davinci_soc_info; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-18 10:49:02 +05:30
										 |  |  | 	ret = dm646x_gpio_register(); | 
					
						
							|  |  |  | 	if (ret) | 
					
						
							|  |  |  | 		pr_warn("%s: GPIO init failed: %d\n", __func__, ret); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | 	evm_init_i2c(); | 
					
						
							| 
									
										
										
										
											2013-06-19 14:45:42 +05:30
										 |  |  | 	davinci_serial_init(dm646x_serial_device); | 
					
						
							| 
									
										
										
										
											2009-06-05 06:28:08 -04:00
										 |  |  | 	dm646x_init_mcasp0(&dm646x_evm_snd_data[0]); | 
					
						
							|  |  |  | 	dm646x_init_mcasp1(&dm646x_evm_snd_data[1]); | 
					
						
							| 
									
										
										
										
											2009-04-15 12:40:56 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-09 15:46:40 +05:30
										 |  |  | 	if (machine_is_davinci_dm6467tevm()) | 
					
						
							|  |  |  | 		davinci_nand_data.timing = &dm6467tevm_nandflash_timing; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-18 23:09:29 +05:30
										 |  |  | 	platform_device_register(&davinci_nand_device); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-29 11:35:15 +05:30
										 |  |  | 	dm646x_init_edma(dm646x_edma_rsv); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-17 23:30:36 +05:30
										 |  |  | 	if (HAS_ATA) | 
					
						
							| 
									
										
										
										
											2010-04-21 18:11:33 +04:00
										 |  |  | 		davinci_init_ide(); | 
					
						
							| 
									
										
										
										
											2009-07-17 23:30:36 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-15 10:11:25 -04:00
										 |  |  | 	soc_info->emac_pdata->phy_id = DM646X_EVM_PHY_ID; | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM") | 
					
						
							| 
									
										
										
										
											2011-07-05 22:38:11 -04:00
										 |  |  | 	.atag_offset  = 0x100, | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | 	.map_io       = davinci_map_io, | 
					
						
							| 
									
										
										
										
											2010-05-07 17:06:37 -04:00
										 |  |  | 	.init_irq     = davinci_irq_init, | 
					
						
							| 
									
										
										
										
											2012-11-08 12:40:59 -07:00
										 |  |  | 	.init_time	= davinci_timer_init, | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | 	.init_machine = evm_init, | 
					
						
							| 
									
										
										
										
											2012-04-26 09:45:39 +08:00
										 |  |  | 	.init_late	= davinci_init_late, | 
					
						
							| 
									
										
										
										
											2011-07-05 22:28:08 -04:00
										 |  |  | 	.dma_zone_size	= SZ_128M, | 
					
						
							| 
									
										
										
										
											2011-12-05 11:29:46 +01:00
										 |  |  | 	.restart	= davinci_restart, | 
					
						
							| 
									
										
										
										
											2009-04-29 17:44:58 -07:00
										 |  |  | MACHINE_END | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-24 18:25:15 +05:30
										 |  |  | MACHINE_START(DAVINCI_DM6467TEVM, "DaVinci DM6467T EVM") | 
					
						
							| 
									
										
										
										
											2011-07-05 22:38:11 -04:00
										 |  |  | 	.atag_offset  = 0x100, | 
					
						
							| 
									
										
										
										
											2009-11-24 18:25:15 +05:30
										 |  |  | 	.map_io       = davinci_map_io, | 
					
						
							| 
									
										
										
										
											2010-05-07 17:06:37 -04:00
										 |  |  | 	.init_irq     = davinci_irq_init, | 
					
						
							| 
									
										
										
										
											2012-11-08 12:40:59 -07:00
										 |  |  | 	.init_time	= davinci_timer_init, | 
					
						
							| 
									
										
										
										
											2009-11-24 18:25:15 +05:30
										 |  |  | 	.init_machine = evm_init, | 
					
						
							| 
									
										
										
										
											2012-04-26 09:45:39 +08:00
										 |  |  | 	.init_late	= davinci_init_late, | 
					
						
							| 
									
										
										
										
											2011-07-05 22:28:08 -04:00
										 |  |  | 	.dma_zone_size	= SZ_128M, | 
					
						
							| 
									
										
										
										
											2011-12-05 11:29:46 +01:00
										 |  |  | 	.restart	= davinci_restart, | 
					
						
							| 
									
										
										
										
											2009-11-24 18:25:15 +05:30
										 |  |  | MACHINE_END | 
					
						
							|  |  |  | 
 |