aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mach-ecovec24/setup.c
diff options
context:
space:
mode:
authorKuninori Morimoto <morimoto.kuninori@renesas.com>2009-12-15 00:37:26 -0500
committerPaul Mundt <lethal@linux-sh.org>2009-12-15 08:03:07 -0500
commit9aa25d64499161048ff024cde704f912a41fad6f (patch)
treef6ea0915ce67bef06d591ef77368a3c7b7893180 /arch/sh/boards/mach-ecovec24/setup.c
parent207efd07e8c7b4da1f6f9940c40e20b8afc9195c (diff)
sh: mach-ecovec24: Add mt9t112 camera support
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/mach-ecovec24/setup.c')
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c79
1 files changed, 78 insertions, 1 deletions
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index d4ac32b63572..89c5a715d0b6 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -29,6 +29,7 @@
29#include <video/sh_mobile_lcdc.h> 29#include <video/sh_mobile_lcdc.h>
30#include <media/sh_mobile_ceu.h> 30#include <media/sh_mobile_ceu.h>
31#include <media/tw9910.h> 31#include <media/tw9910.h>
32#include <media/mt9t112.h>
32#include <asm/heartbeat.h> 33#include <asm/heartbeat.h>
33#include <asm/sh_eth.h> 34#include <asm/sh_eth.h>
34#include <asm/clock.h> 35#include <asm/clock.h>
@@ -566,11 +567,19 @@ static struct platform_device msiof0_device = {
566 567
567#endif 568#endif
568 569
569/* I2C Video */ 570/* I2C Video/Camera */
570static struct i2c_board_info i2c_camera[] = { 571static struct i2c_board_info i2c_camera[] = {
571 { 572 {
572 I2C_BOARD_INFO("tw9910", 0x45), 573 I2C_BOARD_INFO("tw9910", 0x45),
573 }, 574 },
575 {
576 /* 1st camera */
577 I2C_BOARD_INFO("mt9t112", 0x3c),
578 },
579 {
580 /* 2nd camera */
581 I2C_BOARD_INFO("mt9t112", 0x3c),
582 },
574}; 583};
575 584
576/* tw9910 */ 585/* tw9910 */
@@ -599,6 +608,52 @@ static struct soc_camera_link tw9910_link = {
599 .priv = &tw9910_info, 608 .priv = &tw9910_info,
600}; 609};
601 610
611/* mt9t112 */
612static int mt9t112_power1(struct device *dev, int mode)
613{
614 gpio_set_value(GPIO_PTA3, mode);
615 if (mode)
616 mdelay(100);
617
618 return 0;
619}
620
621static struct mt9t112_camera_info mt9t112_info1 = {
622 .flags = MT9T112_FLAG_PCLK_RISING_EDGE | MT9T112_FLAG_DATAWIDTH_8,
623 .divider = { 0x49, 0x6, 0, 6, 0, 9, 9, 6, 0 }, /* for 24MHz */
624};
625
626static struct soc_camera_link mt9t112_link1 = {
627 .i2c_adapter_id = 0,
628 .power = mt9t112_power1,
629 .bus_id = 0,
630 .board_info = &i2c_camera[1],
631 .module_name = "mt9t112",
632 .priv = &mt9t112_info1,
633};
634
635static int mt9t112_power2(struct device *dev, int mode)
636{
637 gpio_set_value(GPIO_PTA4, mode);
638 if (mode)
639 mdelay(100);
640
641 return 0;
642}
643
644static struct mt9t112_camera_info mt9t112_info2 = {
645 .flags = MT9T112_FLAG_PCLK_RISING_EDGE | MT9T112_FLAG_DATAWIDTH_8,
646 .divider = { 0x49, 0x6, 0, 6, 0, 9, 9, 6, 0 }, /* for 24MHz */
647};
648
649static struct soc_camera_link mt9t112_link2 = {
650 .i2c_adapter_id = 1,
651 .power = mt9t112_power2,
652 .bus_id = 1,
653 .board_info = &i2c_camera[2],
654 .module_name = "mt9t112",
655 .priv = &mt9t112_info2,
656};
602 657
603static struct platform_device camera_devices[] = { 658static struct platform_device camera_devices[] = {
604 { 659 {
@@ -608,6 +663,20 @@ static struct platform_device camera_devices[] = {
608 .platform_data = &tw9910_link, 663 .platform_data = &tw9910_link,
609 }, 664 },
610 }, 665 },
666 {
667 .name = "soc-camera-pdrv",
668 .id = 1,
669 .dev = {
670 .platform_data = &mt9t112_link1,
671 },
672 },
673 {
674 .name = "soc-camera-pdrv",
675 .id = 2,
676 .dev = {
677 .platform_data = &mt9t112_link2,
678 },
679 },
611}; 680};
612 681
613static struct platform_device *ecovec_devices[] __initdata = { 682static struct platform_device *ecovec_devices[] __initdata = {
@@ -627,6 +696,8 @@ static struct platform_device *ecovec_devices[] __initdata = {
627 &msiof0_device, 696 &msiof0_device,
628#endif 697#endif
629 &camera_devices[0], 698 &camera_devices[0],
699 &camera_devices[1],
700 &camera_devices[2],
630}; 701};
631 702
632#define EEPROM_ADDR 0x50 703#define EEPROM_ADDR 0x50
@@ -943,6 +1014,12 @@ static int __init arch_setup(void)
943 gpio_request(GPIO_PTU2, NULL); 1014 gpio_request(GPIO_PTU2, NULL);
944 gpio_direction_output(GPIO_PTU2, 1); 1015 gpio_direction_output(GPIO_PTU2, 1);
945 1016
1017 /* enable Camera */
1018 gpio_request(GPIO_PTA3, NULL);
1019 gpio_request(GPIO_PTA4, NULL);
1020 gpio_direction_output(GPIO_PTA3, 0);
1021 gpio_direction_output(GPIO_PTA4, 0);
1022
946 /* enable I2C device */ 1023 /* enable I2C device */
947 i2c_register_board_info(1, i2c1_devices, 1024 i2c_register_board_info(1, i2c1_devices,
948 ARRAY_SIZE(i2c1_devices)); 1025 ARRAY_SIZE(i2c1_devices));