aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci_imx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/ahci_imx.c')
-rw-r--r--drivers/ata/ahci_imx.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index 35d51c59a370..3f3a7db208ae 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -28,6 +28,8 @@
28#include <linux/libata.h> 28#include <linux/libata.h>
29#include "ahci.h" 29#include "ahci.h"
30 30
31#define DRV_NAME "ahci-imx"
32
31enum { 33enum {
32 /* Timer 1-ms Register */ 34 /* Timer 1-ms Register */
33 IMX_TIMER1MS = 0x00e0, 35 IMX_TIMER1MS = 0x00e0,
@@ -221,11 +223,9 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv)
221 if (imxpriv->no_device) 223 if (imxpriv->no_device)
222 return 0; 224 return 0;
223 225
224 if (hpriv->target_pwr) { 226 ret = ahci_platform_enable_regulators(hpriv);
225 ret = regulator_enable(hpriv->target_pwr); 227 if (ret)
226 if (ret) 228 return ret;
227 return ret;
228 }
229 229
230 ret = clk_prepare_enable(imxpriv->sata_ref_clk); 230 ret = clk_prepare_enable(imxpriv->sata_ref_clk);
231 if (ret < 0) 231 if (ret < 0)
@@ -270,8 +270,7 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv)
270disable_clk: 270disable_clk:
271 clk_disable_unprepare(imxpriv->sata_ref_clk); 271 clk_disable_unprepare(imxpriv->sata_ref_clk);
272disable_regulator: 272disable_regulator:
273 if (hpriv->target_pwr) 273 ahci_platform_disable_regulators(hpriv);
274 regulator_disable(hpriv->target_pwr);
275 274
276 return ret; 275 return ret;
277} 276}
@@ -291,8 +290,7 @@ static void imx_sata_disable(struct ahci_host_priv *hpriv)
291 290
292 clk_disable_unprepare(imxpriv->sata_ref_clk); 291 clk_disable_unprepare(imxpriv->sata_ref_clk);
293 292
294 if (hpriv->target_pwr) 293 ahci_platform_disable_regulators(hpriv);
295 regulator_disable(hpriv->target_pwr);
296} 294}
297 295
298static void ahci_imx_error_handler(struct ata_port *ap) 296static void ahci_imx_error_handler(struct ata_port *ap)
@@ -524,6 +522,10 @@ static u32 imx_ahci_parse_props(struct device *dev,
524 return reg_value; 522 return reg_value;
525} 523}
526 524
525static struct scsi_host_template ahci_platform_sht = {
526 AHCI_SHT(DRV_NAME),
527};
528
527static int imx_ahci_probe(struct platform_device *pdev) 529static int imx_ahci_probe(struct platform_device *pdev)
528{ 530{
529 struct device *dev = &pdev->dev; 531 struct device *dev = &pdev->dev;
@@ -620,7 +622,8 @@ static int imx_ahci_probe(struct platform_device *pdev)
620 reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000; 622 reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000;
621 writel(reg_val, hpriv->mmio + IMX_TIMER1MS); 623 writel(reg_val, hpriv->mmio + IMX_TIMER1MS);
622 624
623 ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info); 625 ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info,
626 &ahci_platform_sht);
624 if (ret) 627 if (ret)
625 goto disable_sata; 628 goto disable_sata;
626 629
@@ -678,7 +681,7 @@ static struct platform_driver imx_ahci_driver = {
678 .probe = imx_ahci_probe, 681 .probe = imx_ahci_probe,
679 .remove = ata_platform_remove_one, 682 .remove = ata_platform_remove_one,
680 .driver = { 683 .driver = {
681 .name = "ahci-imx", 684 .name = DRV_NAME,
682 .of_match_table = imx_ahci_of_match, 685 .of_match_table = imx_ahci_of_match,
683 .pm = &ahci_imx_pm_ops, 686 .pm = &ahci_imx_pm_ops,
684 }, 687 },