arm: tegra: ahci/sata: check sata against board id
Bibek Basu [Thu, 11 Oct 2012 10:04:04 +0000 (15:04 +0530)]
If the board has sata support, then only add platform device
Also move slumber code to Idle powergate section to
avoid build failure.

Bug 1171138

Change-Id: I6128f451f348a7fad41fc52579b18939c8a2efcd
Original-author: Mike Thompson <mikthompson@nvidia.com>
Signed-off-by: Mike Thompson <mikthompson@nvidia.com>
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Signed-off-by: Syed Rafiuddin <srafiuddin@nvidia.com>
Reviewed-on: http://git-master/r/143984
Tested-by: Simone Willett <swillett@nvidia.com>
(cherry picked from commit 6e6a0ec500a3113272a593e4466f04d940bc637f)
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: http://git-master/r/166837
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>

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

index af6b128..4b03ddc 100644 (file)
@@ -1530,7 +1530,13 @@ static void __init tegra_cardhu_init(void)
        cardhu_pmon_init();
        cardhu_sensors_init();
        cardhu_setup_bluesleep();
-       cardhu_sata_init();
+       /*
+        * if you want to add support for SATA in your board
+        * then add your board check here like
+        * board_info.board_id == BOARD_E1186
+        */
+       if (board_info.board_id == BOARD_PM315)
+               cardhu_sata_init();
        //audio_wired_jack_init();
        cardhu_pins_state_init();
        cardhu_emc_init();
index 5c58da1..39cf4ac 100644 (file)
@@ -258,10 +258,10 @@ static int tegra_ahci_controller_resume(struct platform_device *pdev);
 static int tegra_ahci_suspend(struct platform_device *pdev, pm_message_t mesg);
 static int tegra_ahci_resume(struct platform_device *pdev);
 static enum port_idle_status tegra_ahci_is_port_idle(struct ata_port *ap);
-static enum port_idle_status tegra_ahci_is_port_slumber(struct ata_port *ap);
 static bool tegra_ahci_are_all_ports_idle(struct ata_host *host);
-static bool tegra_ahci_are_all_ports_slumber(struct ata_host *host);
 #ifdef CONFIG_TEGRA_SATA_IDLE_POWERGATE
+static enum port_idle_status tegra_ahci_is_port_slumber(struct ata_port *ap);
+static bool tegra_ahci_are_all_ports_slumber(struct ata_host *host);
 static unsigned int tegra_ahci_qc_issue(struct ata_queued_cmd *qc);
 static int tegra_ahci_hardreset(struct ata_link *link, unsigned int *class,
                                unsigned long deadline);
@@ -1623,6 +1623,20 @@ static enum port_idle_status tegra_ahci_is_port_idle(struct ata_port *ap)
        return PORT_IS_IDLE;
 }
 
+/* check if all supported ports are idle (no outstanding commands) */
+static bool tegra_ahci_are_all_ports_idle(struct ata_host *host)
+{      int i;
+       struct ata_port *ap;
+
+       for (i = 0; i < host->n_ports; i++) {
+               ap = host->ports[i];
+               if (ap && (tegra_ahci_is_port_idle(ap) == PORT_IS_NOT_IDLE))
+                       return false;
+       }
+       return true;
+}
+
+#ifdef CONFIG_TEGRA_SATA_IDLE_POWERGATE
 static enum port_idle_status tegra_ahci_is_port_slumber(struct ata_port *ap)
 {
        void __iomem *port_mmio = ahci_port_base(ap);
@@ -1638,19 +1652,6 @@ static enum port_idle_status tegra_ahci_is_port_slumber(struct ata_port *ap)
        return PORT_IS_IDLE_NOT_SLUMBER;
 }
 
-/* check if all supported ports are idle (no outstanding commands) */
-static bool tegra_ahci_are_all_ports_idle(struct ata_host *host)
-{      int i;
-       struct ata_port *ap;
-
-       for (i = 0; i < host->n_ports; i++) {
-               ap = host->ports[i];
-               if (ap && (tegra_ahci_is_port_idle(ap) == PORT_IS_NOT_IDLE))
-                       return false;
-       }
-       return true;
-}
-
 /* check if all supported ports are in slumber */
 static bool tegra_ahci_are_all_ports_slumber(struct ata_host *host)
 {      int i;
@@ -1664,7 +1665,6 @@ static bool tegra_ahci_are_all_ports_slumber(struct ata_host *host)
        return true;
 }
 
-#ifdef CONFIG_TEGRA_SATA_IDLE_POWERGATE
 static void tegra_ahci_to_add_idle_timer(struct ata_host *host)
 {
        struct tegra_ahci_host_priv *tegra_hpriv;