]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - arch/arm/mach-omap1/board-ams-delta.c
omap1: Add initcall checks for omap1 and booted board
[mv-sheeva.git] / arch / arm / mach-omap1 / board-ams-delta.c
index 73c86392fcd3ac1e147bcc7e25d64eb5f91daedf..dc82f3d028b584229bf4ef3a61b9b536340ca799 100644 (file)
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
+#include <linux/leds.h>
 #include <linux/platform_device.h>
 #include <linux/serial_8250.h>
 
+#include <media/soc_camera.h>
+
 #include <asm/serial.h>
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
+#include <plat/io.h>
 #include <plat/board-ams-delta.h>
 #include <mach/gpio.h>
 #include <plat/keypad.h>
@@ -32,6 +36,7 @@
 #include <plat/usb.h>
 #include <plat/board.h>
 #include <plat/common.h>
+#include <mach/camera.h>
 
 #include <mach/ams-delta-fiq.h>
 
@@ -213,10 +218,56 @@ static struct platform_device ams_delta_led_device = {
        .id     = -1
 };
 
+static struct i2c_board_info ams_delta_camera_board_info[] = {
+       {
+               I2C_BOARD_INFO("ov6650", 0x60),
+       },
+};
+
+#ifdef CONFIG_LEDS_TRIGGERS
+DEFINE_LED_TRIGGER(ams_delta_camera_led_trigger);
+
+static int ams_delta_camera_power(struct device *dev, int power)
+{
+       /*
+        * turn on camera LED
+        */
+       if (power)
+               led_trigger_event(ams_delta_camera_led_trigger, LED_FULL);
+       else
+               led_trigger_event(ams_delta_camera_led_trigger, LED_OFF);
+       return 0;
+}
+#else
+#define ams_delta_camera_power NULL
+#endif
+
+static struct soc_camera_link __initdata ams_delta_iclink = {
+       .bus_id         = 0,    /* OMAP1 SoC camera bus */
+       .i2c_adapter_id = 1,
+       .board_info     = &ams_delta_camera_board_info[0],
+       .module_name    = "ov6650",
+       .power          = ams_delta_camera_power,
+};
+
+static struct platform_device ams_delta_camera_device = {
+       .name   = "soc-camera-pdrv",
+       .id     = 0,
+       .dev    = {
+               .platform_data = &ams_delta_iclink,
+       },
+};
+
+static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
+       .camexclk_khz   = 12000,        /* default 12MHz clock, no extra DPLL */
+       .lclk_khz_max   = 1334,         /* results in 5fps CIF, 10fps QCIF */
+};
+
 static struct platform_device *ams_delta_devices[] __initdata = {
        &ams_delta_kp_device,
        &ams_delta_lcd_device,
        &ams_delta_led_device,
+       &ams_delta_camera_device,
 };
 
 static void __init ams_delta_init(void)
@@ -225,6 +276,20 @@ static void __init ams_delta_init(void)
        omap_cfg_reg(UART1_TX);
        omap_cfg_reg(UART1_RTS);
 
+       /* parallel camera interface */
+       omap_cfg_reg(H19_1610_CAM_EXCLK);
+       omap_cfg_reg(J15_1610_CAM_LCLK);
+       omap_cfg_reg(L18_1610_CAM_VS);
+       omap_cfg_reg(L15_1610_CAM_HS);
+       omap_cfg_reg(L19_1610_CAM_D0);
+       omap_cfg_reg(K14_1610_CAM_D1);
+       omap_cfg_reg(K15_1610_CAM_D2);
+       omap_cfg_reg(K19_1610_CAM_D3);
+       omap_cfg_reg(K18_1610_CAM_D4);
+       omap_cfg_reg(J14_1610_CAM_D5);
+       omap_cfg_reg(J19_1610_CAM_D6);
+       omap_cfg_reg(J18_1610_CAM_D7);
+
        iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
 
        omap_board_config = ams_delta_config;
@@ -236,18 +301,21 @@ static void __init ams_delta_init(void)
        ams_delta_latch2_write(~0, 0);
 
        omap1_usb_init(&ams_delta_usb_config);
+       omap1_set_camera_info(&ams_delta_camera_platform_data);
+#ifdef CONFIG_LEDS_TRIGGERS
+       led_trigger_register_simple("ams_delta_camera",
+                       &ams_delta_camera_led_trigger);
+#endif
        platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
 
-#ifdef CONFIG_AMS_DELTA_FIQ
        ams_delta_init_fiq();
-#endif
 
        omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
 }
 
 static struct plat_serial8250_port ams_delta_modem_ports[] = {
        {
-               .membase        = (void *) AMS_DELTA_MODEM_VIRT,
+               .membase        = IOMEM(AMS_DELTA_MODEM_VIRT),
                .mapbase        = AMS_DELTA_MODEM_PHYS,
                .irq            = -EINVAL, /* changed later */
                .flags          = UPF_BOOT_AUTOCONF,
@@ -271,6 +339,9 @@ static int __init ams_delta_modem_init(void)
 {
        int err;
 
+       if (!machine_is_ams_delta())
+               return -ENODEV;
+
        omap_cfg_reg(M14_1510_GPIO2);
        ams_delta_modem_ports[0].irq =
                        gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);