From: Balaji T K <balajitk@xxxxxx>
Some platforms have a PHY hooked up to the
SATA controller. The PHY needs to be initialized
and powered up for SATA to work. We do that
using the PHY framework.
[Roger Q] Cleaned up.
CC: Tejun Heo <tj@xxxxxxxxxx>[...]
Signed-off-by: Balaji T K <balajitk@xxxxxx>
Signed-off-by: Roger Quadros <rogerq@xxxxxx>
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index d5ced13..b476642 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -142,6 +142,39 @@ static int ahci_probe(struct platform_device *pdev)
}
}
+ hpriv->phy = devm_phy_get(dev, "sata-phy");
+ if (IS_ERR(hpriv->phy)) {
+ rc = PTR_ERR(hpriv->phy);
+ switch (rc) {
+ case -ENODEV:
+ case -ENOSYS:
+ /* continue normally */
+ hpriv->phy = NULL;
+ break;
+
+ case -EPROBE_DEFER:
+ goto disable_unprepare_clk;
+ break;
+
+ default:
+ dev_err(dev, "couldn't get sata-phy\n");
+ goto disable_unprepare_clk;
+ break;