19 #include <linux/kernel.h>
24 #include <linux/i2c.h>
35 #include <linux/export.h>
40 #include <mach/common.h>
51 #define NAND_BLOCK_SIZE SZ_128K
90 .parts = davinci_nand_partitions,
91 .nr_parts =
ARRAY_SIZE(davinci_nand_partitions),
96 static struct resource davinci_nand_resources[] = {
109 .name =
"davinci_nand",
112 .num_resources =
ARRAY_SIZE(davinci_nand_resources),
113 .resource = davinci_nand_resources,
116 .platform_data = &davinci_nand_data,
120 #if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
121 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
128 #define DM646X_EVM_ATA_RST BIT(0)
129 #define DM646X_EVM_ATA_PWD BIT(1)
145 .addr = client->
addr,
166 static struct i2c_driver dm6467evm_cpld_driver = {
167 .driver.name =
"cpld_reg0",
168 .id_table = cpld_reg_ids,
169 .probe = cpld_reg0_probe,
174 static struct gpio_led evm_leds[] = {
175 { .name =
"DS1", .active_low = 1, },
176 { .name =
"DS2", .active_low = 1, },
177 { .name =
"DS3", .active_low = 1, },
178 { .name =
"DS4", .active_low = 1, },
189 unsigned int ngpio,
void *
c)
201 sizeof(evm_led_data));
203 evm_led_dev->
dev.parent = &client->
dev;
212 static int evm_led_teardown(
struct i2c_client *client,
int gpio,
213 unsigned ngpio,
void *c)
224 static int evm_sw_setup(
struct i2c_client *client,
int gpio,
225 unsigned ngpio,
void *c)
231 for (i = 0; i < 4; ++
i) {
232 snprintf(label, 10,
"user_sw%d", i);
236 evm_sw_gpio[
i] = gpio++;
245 status = gpio_export(evm_sw_gpio[i], 0);
254 for (i = 0; i < 4; ++
i) {
255 if (evm_sw_gpio[i] != -
EINVAL) {
263 static int evm_sw_teardown(
struct i2c_client *client,
int gpio,
264 unsigned ngpio,
void *c)
268 for (i = 0; i < 4; ++
i) {
269 if (evm_sw_gpio[i] != -
EINVAL) {
270 gpio_unexport(evm_sw_gpio[i]);
278 static int evm_pcf_setup(
struct i2c_client *client,
int gpio,
279 unsigned int ngpio,
void *c)
286 status = evm_sw_setup(client, gpio, 4, c);
290 return evm_led_setup(client, gpio+4, 4, c);
293 static int evm_pcf_teardown(
struct i2c_client *client,
int gpio,
294 unsigned int ngpio,
void *c)
298 evm_sw_teardown(client, gpio, 4, c);
299 evm_led_teardown(client, gpio+4, 4, c);
306 .setup = evm_pcf_setup,
307 .teardown = evm_pcf_teardown,
316 .byte_len = (256*1024) / 8,
323 static u8 dm646x_iis_serializer_direction[] = {
327 static u8 dm646x_dit_serializer_direction[] = {
333 .tx_dma_offset = 0x400,
334 .rx_dma_offset = 0x400,
336 .num_serializer =
ARRAY_SIZE(dm646x_iis_serializer_direction),
338 .serial_dir = dm646x_iis_serializer_direction,
342 .tx_dma_offset = 0x400,
345 .num_serializer =
ARRAY_SIZE(dm646x_dit_serializer_direction),
347 .serial_dir = dm646x_dit_serializer_direction,
354 static int cpld_video_probe(
struct i2c_client *client,
372 static struct i2c_driver cpld_video_driver = {
374 .name =
"cpld_video",
376 .probe = cpld_video_probe,
377 .remove = cpld_video_remove,
378 .id_table = cpld_video_id,
381 static void evm_init_cpld(
void)
383 i2c_add_driver(&cpld_video_driver);
389 .platform_data = &eeprom_info,
393 .platform_data = &pcf_data,
414 #define VCH2CLK_MASK (BIT_MASK(10) | BIT_MASK(9) | BIT_MASK(8))
415 #define VCH2CLK_SYSCLK8 (BIT(9))
416 #define VCH2CLK_AUXCLK (BIT(9) | BIT(8))
417 #define VCH3CLK_MASK (BIT_MASK(14) | BIT_MASK(13) | BIT_MASK(12))
418 #define VCH3CLK_SYSCLK8 (BIT(13))
419 #define VCH3CLK_AUXCLK (BIT(14) | BIT(13))
421 #define VIDCH2CLK (BIT(10))
422 #define VIDCH3CLK (BIT(11))
423 #define VIDCH1CLK (BIT(4))
424 #define TVP7002_INPUT (BIT(4))
425 #define TVP5147_INPUT (~BIT(4))
426 #define VPIF_INPUT_ONE_CHANNEL (BIT(5))
427 #define VPIF_INPUT_TWO_CHANNEL (~BIT(5))
428 #define TVP5147_CH0 "tvp514x-0"
429 #define TVP5147_CH1 "tvp514x-1"
434 static int set_vpif_clock(
int mux_mode,
int hd)
449 spin_unlock_irqrestore(&vpif_reg_lock, flags);
480 spin_unlock_irqrestore(&vpif_reg_lock, flags);
500 static const struct vpif_output dm6467_ch0_outputs[] = {
509 .subdev_name =
"adv7343",
519 .subdev_name =
"adv7343",
530 .subdev_name =
"adv7343",
536 .set_clock = set_vpif_clock,
537 .subdevinfo = dm646x_vpif_subdev,
538 .subdev_count =
ARRAY_SIZE(dm646x_vpif_subdev),
540 .outputs = dm6467_ch0_outputs,
541 .output_count =
ARRAY_SIZE(dm6467_ch0_outputs),
543 .card_name =
"DM646x EVM",
554 static int setup_vpif_input_path(
int channel,
const char *sub_dev_name)
588 static int setup_vpif_input_channel_mode(
int mux_mode)
612 spin_unlock_irqrestore(&vpif_reg_lock, flags);
627 #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
634 .platform_data = &tvp5146_pdata,
641 .platform_data = &tvp5146_pdata,
646 static const struct vpif_input dm6467_ch0_inputs[] = {
661 static const struct vpif_input dm6467_ch1_inputs[] = {
677 .setup_input_path = setup_vpif_input_path,
678 .setup_input_channel_mode = setup_vpif_input_channel_mode,
679 .subdev_info = vpif_capture_sdev_info,
680 .subdev_count =
ARRAY_SIZE(vpif_capture_sdev_info),
682 .inputs = dm6467_ch0_inputs,
692 .inputs = dm6467_ch1_inputs,
703 static void __init evm_init_video(
void)
708 &dm646x_vpif_capture_cfg);
711 static void __init evm_init_i2c(
void)
714 i2c_add_driver(&dm6467evm_cpld_driver);
720 #define CDCE949_XIN_RATE 27000000
723 static struct clk cdce_clk_in = {
729 CLK(
NULL,
"xin", &cdce_clk_in),
733 static void __init cdce_clk_init(
void)
738 for (c = cdce_clks; c->
clk; c++) {
745 #define DM6467T_EVM_REF_FREQ 33000000
747 static void __init davinci_map_io(
void)
751 if (machine_is_davinci_dm6467tevm())
758 .enabled_uarts = (1 << 0),
761 #define DM646X_EVM_PHY_ID "davinci_mdio-0:01"
767 static const s16 dm646x_dma_rsv_chans[][2] = {
777 static const s16 dm646x_dma_rsv_slots[][2] = {
790 .rsv_chans = dm646x_dma_rsv_chans,
791 .rsv_slots = dm646x_dma_rsv_slots,
795 static __init void evm_init(
void)
804 if (machine_is_davinci_dm6467tevm())
805 davinci_nand_data.
timing = &dm6467tevm_nandflash_timing;
818 .atag_offset = 0x100,
819 .map_io = davinci_map_io,
822 .init_machine = evm_init,
829 .atag_offset = 0x100,
830 .map_io = davinci_map_io,
833 .init_machine = evm_init,