arm: tegra: sata: Fix LP0 resume problem
Yen Lin [Thu, 3 Jan 2013 23:01:56 +0000 (15:01 -0800)]
- Fix a bug in ahci-tegra.c when checking if SATA is on when resuming
- Add codes to support PM315 which uses LDO1 regulator for SATA rails

bug 1206518

Change-Id: Iaa910b1948fbcf5e45491977fd8ed0b313d2e0ae
Signed-off-by: Yen Lin <yelin@nvidia.com>
Reviewed-on: http://git-master/r/188441
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Allen Martin <amartin@nvidia.com>
Reviewed-by: Peng Wu <pengw@nvidia.com>
Tested-by: Peng Wu <pengw@nvidia.com>
Reviewed-by: Eric Brower <ebrower@nvidia.com>

arch/arm/mach-tegra/board-cardhu-power.c
drivers/ata/ahci-tegra.c

index db86a07..d69426a 100644 (file)
@@ -115,6 +115,18 @@ static struct regulator_consumer_supply tps6591x_ldo1_supply_0[] = {
        REGULATOR_SUPPLY("vdd_pexa", NULL),
 };
 
+static struct regulator_consumer_supply tps6591x_ldo1_supply_pm315[] = {
+       REGULATOR_SUPPLY("avdd_pexb", NULL),
+       REGULATOR_SUPPLY("vdd_pexb", NULL),
+       REGULATOR_SUPPLY("avdd_pex_pll", NULL),
+       REGULATOR_SUPPLY("avdd_pexa", NULL),
+       REGULATOR_SUPPLY("vdd_pexa", NULL),
+       REGULATOR_SUPPLY("avdd_sata", NULL),
+       REGULATOR_SUPPLY("vdd_sata", NULL),
+       REGULATOR_SUPPLY("avdd_sata_pll", NULL),
+       REGULATOR_SUPPLY("avdd_plle", NULL),
+};
+
 static struct regulator_consumer_supply tps6591x_ldo2_supply_0[] = {
        REGULATOR_SUPPLY("avdd_sata", NULL),
        REGULATOR_SUPPLY("vdd_sata", NULL),
@@ -453,6 +465,14 @@ int __init cardhu_regulator_init(void)
                pr_info("VSEL 1:0 %d%d\n",
                        tps62361_pdata.vsel1_def_state,
                        tps62361_pdata.vsel0_def_state);
+       } else if (board_info.board_id == BOARD_PM315) {
+               /* On PM315, SATA rails are on LDO1 */
+               pdata_ldo1_0.regulator.num_consumer_supplies =
+                                       ARRAY_SIZE(tps6591x_ldo1_supply_pm315);
+               pdata_ldo1_0.regulator.consumer_supplies =
+                                       tps6591x_ldo1_supply_pm315;
+               pdata_ldo2_0.regulator.num_consumer_supplies = 0;
+               pdata_ldo2_0.regulator.consumer_supplies = NULL;
        }
 
        if (((board_info.board_id == BOARD_E1291) ||
index 39cf4ac..c904728 100644 (file)
@@ -926,7 +926,7 @@ static int tegra_ahci_controller_resume(struct platform_device *pdev)
        }
 
        spin_lock_irqsave(&host->lock, flags);
-       if (!tegra_hpriv->pg_state == SATA_ON) {
+       if (tegra_hpriv->pg_state == SATA_ON) {
                dev_dbg(host->dev, "resume: SATA already powered on\n");
        } else {
                dev_dbg(host->dev, "resume: powering on SATA...\n");