don't touch i2c until it's ready
authorGrazvydas Ignotas <notasas@gmail.com>
Tue, 4 May 2010 14:55:03 +0000 (17:55 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Tue, 4 May 2010 14:55:03 +0000 (17:55 +0300)
arch/arm/mach-omap2/board-omap3pandora.c

index d3b051b..c663742 100644 (file)
 #define GPMC_CS0_BASE  0x60
 #define GPMC_CS_SIZE   0x30
 
+static void pandora_enable_supplies(void)
+{
+       /* someday we'll turn these off when we don't need them */
+#define TWL4030_VAUX4_DEV_GRP          0x23
+#define TWL4030_VAUX4_DEDICATED                0x26
+#define TWL4030_VSIM_DEV_GRP           0x37
+#define TWL4030_VSIM_DEDICATED         0x3a
+
+       /* set vaux4 to ~2.85V (TOUCH, NUBS) */
+       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x0a,
+                            TWL4030_VAUX4_DEDICATED);
+       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20,
+                            TWL4030_VAUX4_DEV_GRP);
+
+       /* set vsim to 2.8V (AUDIO DAC external) */
+       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x04,
+                            TWL4030_VSIM_DEDICATED);
+       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20,
+                            TWL4030_VSIM_DEV_GRP);
+
+       /* set vaux2 to 1.8V (USB HOST PHY power) */
+       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x05,
+                            TWL4030_VAUX2_DEDICATED);
+       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20,
+                            TWL4030_VAUX2_DEV_GRP);
+}
+
 static struct mtd_partition omap3pandora_nand_partitions[] = {
        {
                .name           = "xloader",
@@ -218,7 +245,9 @@ static int omap3pandora_twl_gpio_setup(struct device *dev,
 {
        int ret, gpio_32khz;
 
-       /* hack */
+       /* XXX hacks */
+       pandora_enable_supplies();
+
        gpio_32khz = gpio + 13;
        ret = gpio_request(gpio_32khz, "32kHz");
        if (ret != 0)
@@ -565,36 +594,8 @@ static struct platform_device *omap3pandora_devices[] __initdata = {
        &wl1251_cd_device,
 };
 
-static void pandora_enable_supplies(void)
-{
-       /* someday we'll turn these off when we don't need them */
-#define TWL4030_VAUX4_DEV_GRP          0x23
-#define TWL4030_VAUX4_DEDICATED                0x26
-#define TWL4030_VSIM_DEV_GRP           0x37
-#define TWL4030_VSIM_DEDICATED         0x3a
-
-       /* set vaux4 to ~2.85V (TOUCH, NUBS) */
-       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x0a,
-                            TWL4030_VAUX4_DEDICATED);
-       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20,
-                            TWL4030_VAUX4_DEV_GRP);
-
-       /* set vsim to 2.8V (AUDIO DAC external) */
-       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x04,
-                            TWL4030_VSIM_DEDICATED);
-       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20,
-                            TWL4030_VSIM_DEV_GRP);
-
-       /* set vaux2 to 1.8V (USB HOST PHY power) */
-       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x05,
-                            TWL4030_VAUX2_DEDICATED);
-       twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x20,
-                            TWL4030_VAUX2_DEV_GRP);
-}
-
 static void __init omap3pandora_init(void)
 {
-       pandora_enable_supplies();
        omap3pandora_i2c_init();
        omap3pandora_input_init();
        pandora_wl1251_init();