summaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorBartosz Golaszewski <bgolaszewski@baylibre.com>2017-01-30 11:02:01 +0100
committerSekhar Nori <nsekhar@ti.com>2017-01-31 17:25:13 +0530
commit82dbe1a68fd65a4dae8f01e4f214221857f8161b (patch)
treed6728713f4b2795f75edffd7bb2df8d92ea8437b /drivers/ata
parent7ce7d89f48834cefece7804d38fc5d85382edf77 (diff)
downloadlinux-82dbe1a68fd65a4dae8f01e4f214221857f8161b.tar.bz2
sata: ahci-da850: get the sata clock using a connection id
In preparation for using two clocks in the driver (the sysclk2-based clock and the external REFCLK), check if we got the functional clock after calling ahci_platform_get_resources(). If not, retry calling clk_get() with con_id specified. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci_da850.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
index 267a3d3e79f4..e397bab80a23 100644
--- a/drivers/ata/ahci_da850.c
+++ b/drivers/ata/ahci_da850.c
@@ -71,12 +71,28 @@ static int ahci_da850_probe(struct platform_device *pdev)
struct ahci_host_priv *hpriv;
struct resource *res;
void __iomem *pwrdn_reg;
+ struct clk *clk;
int rc;
hpriv = ahci_platform_get_resources(pdev);
if (IS_ERR(hpriv))
return PTR_ERR(hpriv);
+ /*
+ * Internally ahci_platform_get_resources() calls clk_get(dev, NULL)
+ * when trying to obtain the functional clock. This SATA controller
+ * uses two clocks for which we specify two connection ids. If we don't
+ * have the functional clock at this point - call clk_get() again with
+ * con_id = "fck".
+ */
+ if (!hpriv->clks[0]) {
+ clk = clk_get(dev, "fck");
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+
+ hpriv->clks[0] = clk;
+ }
+
rc = ahci_platform_enable_resources(hpriv);
if (rc)
return rc;