15 #include <linux/kernel.h>
18 #include <linux/i2c.h>
25 #include <linux/slab.h>
27 #include <linux/input.h>
35 #include <mach/common.h>
46 static inline int have_imager(
void)
52 static inline int have_tvp7002(
void)
58 #define DM365_EVM_PHY_ID "davinci_mdio-0:01"
62 #define CPLD_OFFSET(a13a8,a2a1) (((a13a8) << 10) + ((a2a1) << 3))
64 #define CPLD_VERSION CPLD_OFFSET(0,0)
65 #define CPLD_TEST CPLD_OFFSET(0,1)
66 #define CPLD_LEDS CPLD_OFFSET(0,2)
67 #define CPLD_MUX CPLD_OFFSET(0,3)
68 #define CPLD_SWITCH CPLD_OFFSET(1,0)
69 #define CPLD_POWER CPLD_OFFSET(1,1)
70 #define CPLD_VIDEO CPLD_OFFSET(1,2)
71 #define CPLD_CARDSTAT CPLD_OFFSET(1,3)
73 #define CPLD_DILC_OUT CPLD_OFFSET(2,0)
74 #define CPLD_DILC_IN CPLD_OFFSET(2,1)
76 #define CPLD_IMG_DIR0 CPLD_OFFSET(2,2)
77 #define CPLD_IMG_MUX0 CPLD_OFFSET(2,3)
78 #define CPLD_IMG_MUX1 CPLD_OFFSET(3,0)
79 #define CPLD_IMG_DIR1 CPLD_OFFSET(3,1)
80 #define CPLD_IMG_MUX2 CPLD_OFFSET(3,2)
81 #define CPLD_IMG_MUX3 CPLD_OFFSET(3,3)
82 #define CPLD_IMG_DIR2 CPLD_OFFSET(4,0)
83 #define CPLD_IMG_MUX4 CPLD_OFFSET(4,1)
84 #define CPLD_IMG_MUX5 CPLD_OFFSET(4,2)
86 #define CPLD_RESETS CPLD_OFFSET(4,3)
88 #define CPLD_CCD_DIR1 CPLD_OFFSET(0x3e,0)
89 #define CPLD_CCD_IO1 CPLD_OFFSET(0x3e,1)
90 #define CPLD_CCD_DIR2 CPLD_OFFSET(0x3e,2)
91 #define CPLD_CCD_IO2 CPLD_OFFSET(0x3e,3)
92 #define CPLD_CCD_DIR3 CPLD_OFFSET(0x3f,0)
93 #define CPLD_CCD_IO3 CPLD_OFFSET(0x3f,1)
104 #define NAND_BLOCK_SIZE SZ_128K
109 .name =
"bootloader",
125 .name =
"filesystem1",
130 .name =
"filesystem2",
139 .mask_chipsel =
BIT(14),
140 .parts = davinci_nand_partitions,
141 .nr_parts =
ARRAY_SIZE(davinci_nand_partitions),
147 static struct resource davinci_nand_resources[] = {
160 .name =
"davinci_nand",
162 .num_resources =
ARRAY_SIZE(davinci_nand_resources),
163 .resource = davinci_nand_resources,
165 .platform_data = &davinci_nand_data,
170 .byte_len = (256*1024) / 8,
184 .platform_data = &eeprom_info,
196 static int dm365evm_keyscan_enable(
struct device *
dev)
201 static unsigned short dm365evm_keymap[] = {
222 .device_enable = dm365evm_keyscan_enable,
223 .keymap = dm365evm_keymap,
232 static int cpld_mmc_get_cd(
int module)
241 static int cpld_mmc_get_ro(
int module)
251 .get_cd = cpld_mmc_get_cd,
252 .get_ro = cpld_mmc_get_ro,
254 .max_freq = 50000000,
259 static void dm365evm_emac_configure(
void)
295 static void dm365evm_mmc_configure(
void)
316 #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
338 static struct vpfe_route tvp5146_routes[] = {
349 static struct vpfe_subdev_info vpfe_sub_devs[] = {
354 .inputs = tvp5146_inputs,
355 .routes = tvp5146_routes,
358 .if_type = VPFE_BT656,
359 .hdpol = VPFE_PINPOL_POSITIVE,
360 .vdpol = VPFE_PINPOL_POSITIVE,
364 .platform_data = &tvp5146_pdata,
369 static struct vpfe_config vpfe_cfg = {
371 .sub_devs = vpfe_sub_devs,
373 .card_name =
"DM365 EVM",
377 static void __init evm_init_i2c(
void)
384 &davinci_nand_device,
387 static inline int have_leds(
void)
389 #ifdef CONFIG_LEDS_CLASS
401 static const struct {
405 {
"dm365evm::ds2", },
406 {
"dm365evm::ds3", },
407 {
"dm365evm::ds4", },
408 {
"dm365evm::ds5", },
409 {
"dm365evm::ds6",
"nand-disk", },
410 {
"dm365evm::ds7",
"mmc1", },
411 {
"dm365evm::ds8",
"mmc0", },
412 {
"dm365evm::ds9",
"heartbeat", },
435 static int __init cpld_leds_init(
void)
439 if (!have_leds() || !cpld)
451 led->
cdev.name = cpld_leds[
i].name;
452 led->
cdev.brightness_set = cpld_led_set;
453 led->
cdev.brightness_get = cpld_led_get;
454 led->
cdev.default_trigger = cpld_leds[
i].trigger;
469 static void __init evm_init_cpld(
void)
473 struct clk *aemif_clk;
479 if (IS_ERR(aemif_clk))
491 pr_err(
"ERROR: can't map CPLD\n");
532 dm365evm_mmc_configure();
536 dm365evm_emac_configure();
543 if (have_tvp7002()) {
546 label =
"tvp7002 HD";
551 label =
"tvp5146 SD";
556 pr_info(
"EVM: %s video input\n", label);
565 static void __init dm365_evm_map_io(
void)
582 .platform_data = &at25640,
583 .max_speed_hz = 10 * 1000 * 1000,
590 static __init void dm365_evm_init(
void)
595 dm365evm_emac_configure();
596 dm365evm_mmc_configure();
603 #ifdef CONFIG_SND_DM365_AIC3X_CODEC
605 #elif defined(CONFIG_SND_DM365_VOICE_CODEC)
616 .atag_offset = 0x100,
617 .map_io = dm365_evm_map_io,
620 .init_machine = dm365_evm_init,