]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] pxa/em-x270: updates for 2.6.29
authorMike Rapoport <mike@compulab.co.il>
Wed, 3 Dec 2008 07:38:10 +0000 (09:38 +0200)
committerEric Miao <eric.miao@marvell.com>
Wed, 21 Jan 2009 07:06:35 +0000 (15:06 +0800)
The patch includes the following updates to EM-X270:
- Added DA9030 support
- Added NOR flash support
- Added QCI with mt9m112 sensor support
- Updated LCD support

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
arch/arm/mach-pxa/em-x270.c

index f5ed8038ede5bb5da55af602fdf2a98e02691746..1aaae97de7d39d9b3b6fab6f2412aeb593be78a4 100644 (file)
 #include <linux/rtc-v3020.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
 #include <linux/input.h>
 #include <linux/gpio_keys.h>
 #include <linux/gpio.h>
+#include <linux/mfd/da903x.h>
+#include <linux/regulator/machine.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/tdo24m.h>
+
+#include <media/soc_camera.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -31,6 +38,9 @@
 #include <mach/ohci.h>
 #include <mach/mmc.h>
 #include <mach/pxa27x_keypad.h>
+#include <mach/i2c.h>
+#include <mach/camera.h>
+#include <mach/pxa2xx_spi.h>
 
 #include "generic.h"
 
@@ -44,6 +54,9 @@
 #define GPIO11_NAND_CS (11)
 #define GPIO56_NAND_RB (56)
 
+/* Miscelaneous GPIOs */
+#define GPIO93_CAM_RESET       (93)
+
 static unsigned long em_x270_pin_config[] = {
        /* AC'97 */
        GPIO28_AC97_BITCLK,
@@ -154,6 +167,7 @@ static unsigned long em_x270_pin_config[] = {
 
        /* power controls */
        GPIO20_GPIO     | MFP_LPM_DRIVE_LOW,    /* GPRS_PWEN */
+       GPIO93_GPIO     | MFP_LPM_DRIVE_LOW,    /* Camera reset */
        GPIO115_GPIO    | MFP_LPM_DRIVE_LOW,    /* WLAN_PWEN */
 
        /* NAND controls */
@@ -369,6 +383,61 @@ static void __init em_x270_init_nand(void)
 static inline void em_x270_init_nand(void) {}
 #endif
 
+#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
+static struct mtd_partition em_x270_nor_parts[] = {
+       {
+               .name =         "Bootloader",
+               .offset =       0x00000000,
+               .size =         0x00050000,
+               .mask_flags =   MTD_WRITEABLE  /* force read-only */
+       }, {
+               .name =         "Environment",
+               .offset =       0x00050000,
+               .size =         0x00010000,
+       }, {
+               .name =         "Reserved",
+               .offset =       0x00060000,
+               .size =         0x00050000,
+               .mask_flags =   MTD_WRITEABLE  /* force read-only */
+       }, {
+               .name =         "Splashscreen",
+               .offset =       0x000b0000,
+               .size =         0x00050000,
+       }
+};
+
+static struct physmap_flash_data em_x270_nor_data[] = {
+       [0] = {
+               .width = 2,
+               .parts = em_x270_nor_parts,
+               .nr_parts = ARRAY_SIZE(em_x270_nor_parts),
+       },
+};
+
+static struct resource em_x270_nor_flash_resource = {
+       .start  = PXA_CS0_PHYS,
+       .end    = PXA_CS0_PHYS + SZ_1M - 1,
+       .flags  = IORESOURCE_MEM,
+};
+
+static struct platform_device em_x270_physmap_flash = {
+       .name           = "physmap-flash",
+       .id             = 0,
+       .num_resources  = 1,
+       .resource       = &em_x270_nor_flash_resource,
+       .dev            = {
+               .platform_data  = &em_x270_nor_data,
+       },
+};
+
+static void __init em_x270_init_nor(void)
+{
+       platform_device_register(&em_x270_physmap_flash);
+}
+#else
+static inline void em_x270_init_nor(void) {}
+#endif
+
 /* PXA27x OHCI controller setup */
 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
 static int em_x270_ohci_init(struct device *dev)
@@ -442,27 +511,43 @@ static void __init em_x270_init_mmc(void)
 static inline void em_x270_init_mmc(void) {}
 #endif
 
-/* LCD 480x640 */
+/* LCD */
 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
-static struct pxafb_mode_info em_x270_lcd_mode = {
-       .pixclock       = 50000,
-       .bpp            = 16,
-       .xres           = 480,
-       .yres           = 640,
-       .hsync_len      = 8,
-       .vsync_len      = 2,
-       .left_margin    = 8,
-       .upper_margin   = 0,
-       .right_margin   = 24,
-       .lower_margin   = 4,
-       .cmap_greyscale = 0,
+static struct pxafb_mode_info em_x270_lcd_modes[] = {
+       [0] = {
+               .pixclock       = 38250,
+               .bpp            = 16,
+               .xres           = 480,
+               .yres           = 640,
+               .hsync_len      = 8,
+               .vsync_len      = 2,
+               .left_margin    = 8,
+               .upper_margin   = 2,
+               .right_margin   = 24,
+               .lower_margin   = 4,
+               .sync           = 0,
+       },
+       [1] = {
+               .pixclock       = 153800,
+               .bpp            = 16,
+               .xres           = 240,
+               .yres           = 320,
+               .hsync_len      = 8,
+               .vsync_len      = 2,
+               .left_margin    = 8,
+               .upper_margin   = 2,
+               .right_margin   = 88,
+               .lower_margin   = 2,
+               .sync           = 0,
+       },
 };
 
 static struct pxafb_mach_info em_x270_lcd = {
-       .modes          = &em_x270_lcd_mode,
-       .num_modes      = 1,
+       .modes          = em_x270_lcd_modes,
+       .num_modes      = 2,
        .lcd_conn       = LCD_COLOR_TFT_16BPP,
 };
+
 static void __init em_x270_init_lcd(void)
 {
        set_pxa_fb_info(&em_x270_lcd);
@@ -471,6 +556,40 @@ static void __init em_x270_init_lcd(void)
 static inline void em_x270_init_lcd(void) {}
 #endif
 
+#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
+static struct pxa2xx_spi_master em_x270_spi_info = {
+       .num_chipselect = 1,
+};
+
+static struct pxa2xx_spi_chip em_x270_tdo24m_chip = {
+       .rx_threshold = 1,
+       .tx_threshold = 1,
+};
+
+static struct tdo24m_platform_data em_x270_tdo24m_pdata = {
+       .model = TDO35S,
+};
+
+static struct spi_board_info em_x270_spi_devices[] __initdata = {
+       {
+               .modalias = "tdo24m",
+               .max_speed_hz = 1000000,
+               .bus_num = 1,
+               .chip_select = 0,
+               .controller_data = &em_x270_tdo24m_chip,
+               .platform_data = &em_x270_tdo24m_pdata,
+       },
+};
+
+static void __init em_x270_init_spi(void)
+{
+       pxa2xx_set_spi_info(1, &em_x270_spi_info);
+       spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices));
+}
+#else
+static inline void em_x270_init_spi(void) {}
+#endif
+
 #if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
 static void __init em_x270_init_ac97(void)
 {
@@ -535,19 +654,241 @@ static void __init em_x270_init_gpio_keys(void)
 static inline void em_x270_init_gpio_keys(void) {}
 #endif
 
+/* Quick Capture Interface and sensor setup */
+#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
+static struct regulator *em_x270_camera_ldo;
+
+static int em_x270_sensor_init(struct device *dev)
+{
+       int ret;
+
+       ret = gpio_request(GPIO93_CAM_RESET, "camera reset");
+       if (ret)
+               return ret;
+
+       gpio_direction_output(GPIO93_CAM_RESET, 0);
+
+       em_x270_camera_ldo = regulator_get(NULL, "vcc cam");
+       if (em_x270_camera_ldo == NULL) {
+               gpio_free(GPIO93_CAM_RESET);
+               return -ENODEV;
+       }
+
+       ret = regulator_enable(em_x270_camera_ldo);
+       if (ret) {
+               regulator_put(em_x270_camera_ldo);
+               gpio_free(GPIO93_CAM_RESET);
+               return ret;
+       }
+
+       gpio_set_value(GPIO93_CAM_RESET, 1);
+
+       return 0;
+}
+
+struct pxacamera_platform_data em_x270_camera_platform_data = {
+       .init   = em_x270_sensor_init,
+       .flags  = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
+               PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
+       .mclk_10khz = 2600,
+};
+
+static int em_x270_sensor_power(struct device *dev, int on)
+{
+       int ret;
+       int is_on = regulator_is_enabled(em_x270_camera_ldo);
+
+       if (on == is_on)
+               return 0;
+
+       gpio_set_value(GPIO93_CAM_RESET, !on);
+
+       if (on)
+               ret = regulator_enable(em_x270_camera_ldo);
+       else
+               ret = regulator_disable(em_x270_camera_ldo);
+
+       if (ret)
+               return ret;
+
+       gpio_set_value(GPIO93_CAM_RESET, on);
+
+       return 0;
+}
+
+static struct soc_camera_link iclink = {
+       .bus_id = 0,
+       .power = em_x270_sensor_power,
+};
+
+static struct i2c_board_info em_x270_i2c_cam_info[] = {
+       {
+               I2C_BOARD_INFO("mt9m111", 0x48),
+               .platform_data = &iclink,
+       },
+};
+
+static struct i2c_pxa_platform_data em_x270_i2c_info = {
+       .fast_mode = 1,
+};
+
+static void  __init em_x270_init_camera(void)
+{
+       pxa_set_i2c_info(&em_x270_i2c_info);
+       i2c_register_board_info(0, ARRAY_AND_SIZE(em_x270_i2c_cam_info));
+       pxa_set_camera_info(&em_x270_camera_platform_data);
+}
+#else
+static inline void em_x270_init_camera(void) {}
+#endif
+
+/* DA9030 related initializations */
+static struct regulator_consumer_supply ldo3_consumers[] = {
+       {
+               .dev = NULL,
+               .supply = "vcc gps",
+       },
+};
+
+static struct regulator_consumer_supply ldo5_consumers[] = {
+       {
+               .dev = NULL,
+               .supply = "vcc cam",
+       },
+};
+
+static struct regulator_consumer_supply ldo12_consumers[] = {
+       {
+               .dev = NULL,
+               .supply = "vcc usb",
+       },
+};
+
+static struct regulator_consumer_supply ldo19_consumers[] = {
+       {
+               .dev = NULL,
+               .supply = "vcc gprs",
+       },
+};
+
+static struct regulator_init_data ldo3_data = {
+       .constraints = {
+               .min_uV = 3200000,
+               .max_uV = 3200000,
+               .state_mem = {
+                       .enabled = 0,
+               },
+       },
+       .num_consumer_supplies = ARRAY_SIZE(ldo3_consumers),
+       .consumer_supplies = ldo3_consumers,
+};
+
+static struct regulator_init_data ldo5_data = {
+       .constraints = {
+               .min_uV = 3000000,
+               .max_uV = 3000000,
+               .state_mem = {
+                       .enabled = 0,
+               },
+       },
+       .num_consumer_supplies = ARRAY_SIZE(ldo5_consumers),
+       .consumer_supplies = ldo5_consumers,
+};
+
+static struct regulator_init_data ldo12_data = {
+       .constraints = {
+               .min_uV = 3000000,
+               .max_uV = 3000000,
+               .state_mem = {
+                       .enabled = 0,
+               },
+       },
+       .num_consumer_supplies = ARRAY_SIZE(ldo12_consumers),
+       .consumer_supplies = ldo12_consumers,
+};
+
+static struct regulator_init_data ldo19_data = {
+       .constraints = {
+               .min_uV = 3200000,
+               .max_uV = 3200000,
+               .state_mem = {
+                       .enabled = 0,
+               },
+       },
+       .num_consumer_supplies = ARRAY_SIZE(ldo19_consumers),
+       .consumer_supplies = ldo19_consumers,
+};
+
+struct led_info em_x270_led_info = {
+       .name = "em-x270:orange",
+       .default_trigger = "battery-charging-or-full",
+};
+
+struct da903x_subdev_info em_x270_da9030_subdevs[] = {
+       {
+               .name = "da903x-regulator",
+               .id = DA9030_ID_LDO3,
+               .platform_data = &ldo3_data,
+       }, {
+               .name = "da903x-regulator",
+               .id = DA9030_ID_LDO5,
+               .platform_data = &ldo5_data,
+       }, {
+               .name = "da903x-regulator",
+               .id = DA9030_ID_LDO12,
+               .platform_data = &ldo12_data,
+       }, {
+               .name = "da903x-regulator",
+               .id = DA9030_ID_LDO19,
+               .platform_data = &ldo19_data,
+       }, {
+               .name = "da903x-led",
+               .id = DA9030_ID_LED_PC,
+               .platform_data = &em_x270_led_info,
+       }, {
+               .name = "da903x-backlight",
+               .id = DA9030_ID_WLED,
+       }
+};
+
+static struct da903x_platform_data em_x270_da9030_info = {
+       .num_subdevs = ARRAY_SIZE(em_x270_da9030_subdevs),
+       .subdevs = em_x270_da9030_subdevs,
+};
+
+static struct i2c_board_info em_x270_i2c_pmic_info = {
+       I2C_BOARD_INFO("da9030", 0x49),
+       .irq = IRQ_GPIO(0),
+       .platform_data = &em_x270_da9030_info,
+};
+
+static struct i2c_pxa_platform_data em_x270_pwr_i2c_info = {
+       .use_pio = 1,
+};
+
+static void __init em_x270_init_da9030(void)
+{
+       pxa27x_set_i2c_power_info(&em_x270_pwr_i2c_info);
+       i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1);
+}
+
 static void __init em_x270_init(void)
 {
        pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config));
 
+       em_x270_init_da9030();
        em_x270_init_dm9000();
        em_x270_init_rtc();
        em_x270_init_nand();
+       em_x270_init_nor();
        em_x270_init_lcd();
        em_x270_init_mmc();
        em_x270_init_ohci();
        em_x270_init_keypad();
        em_x270_init_gpio_keys();
        em_x270_init_ac97();
+       em_x270_init_camera();
+       em_x270_init_spi();
 }
 
 MACHINE_START(EM_X270, "Compulab EM-X270")