Merge branch 'acpi-ec'
[linux-drm-fsl-dcu.git] / drivers / ata / ahci_imx.c
index 35d51c59a370d5c6dbbfe7a3e36a2808754434e7..3f3a7db208ae51d2734f0be82e01d9682ce9c80b 100644 (file)
@@ -28,6 +28,8 @@
 #include <linux/libata.h>
 #include "ahci.h"
 
+#define DRV_NAME "ahci-imx"
+
 enum {
        /* Timer 1-ms Register */
        IMX_TIMER1MS                            = 0x00e0,
@@ -221,11 +223,9 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv)
        if (imxpriv->no_device)
                return 0;
 
-       if (hpriv->target_pwr) {
-               ret = regulator_enable(hpriv->target_pwr);
-               if (ret)
-                       return ret;
-       }
+       ret = ahci_platform_enable_regulators(hpriv);
+       if (ret)
+               return ret;
 
        ret = clk_prepare_enable(imxpriv->sata_ref_clk);
        if (ret < 0)
@@ -270,8 +270,7 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv)
 disable_clk:
        clk_disable_unprepare(imxpriv->sata_ref_clk);
 disable_regulator:
-       if (hpriv->target_pwr)
-               regulator_disable(hpriv->target_pwr);
+       ahci_platform_disable_regulators(hpriv);
 
        return ret;
 }
@@ -291,8 +290,7 @@ static void imx_sata_disable(struct ahci_host_priv *hpriv)
 
        clk_disable_unprepare(imxpriv->sata_ref_clk);
 
-       if (hpriv->target_pwr)
-               regulator_disable(hpriv->target_pwr);
+       ahci_platform_disable_regulators(hpriv);
 }
 
 static void ahci_imx_error_handler(struct ata_port *ap)
@@ -524,6 +522,10 @@ static u32 imx_ahci_parse_props(struct device *dev,
        return reg_value;
 }
 
+static struct scsi_host_template ahci_platform_sht = {
+       AHCI_SHT(DRV_NAME),
+};
+
 static int imx_ahci_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
@@ -620,7 +622,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
        reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000;
        writel(reg_val, hpriv->mmio + IMX_TIMER1MS);
 
-       ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info);
+       ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info,
+                                     &ahci_platform_sht);
        if (ret)
                goto disable_sata;
 
@@ -678,7 +681,7 @@ static struct platform_driver imx_ahci_driver = {
        .probe = imx_ahci_probe,
        .remove = ata_platform_remove_one,
        .driver = {
-               .name = "ahci-imx",
+               .name = DRV_NAME,
                .of_match_table = imx_ahci_of_match,
                .pm = &ahci_imx_pm_ops,
        },