Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1562726

[PATCH v4 04/14] sata: ahci-da850: get the sata clock using a connection id

From Bartosz Golaszewski <bgolaszewski@baylibre.com>
Newsgroups linux.kernel
Subject [PATCH v4 04/14] sata: ahci-da850: get the sata clock using a connection id
Date 2017-01-19 14:40 +0100
Message-ID <t1l6z-27b-45@gated-at.bofh.it> (permalink)
References <t1l6y-27b-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


In preparation for using two clocks in the driver (the sysclk2-based
clock and the external REFCLK), check if we got a 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>
---
 drivers/ata/ahci_da850.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
index 267a3d3..8cfdc86 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 first clock. This SATA controller uses
+	 * two clocks for which we specify two connection ids. If we don't
+	 * have a clock at this point - call clk_get() again with
+	 * con_id = "sata".
+	 */
+	if (!hpriv->clks[0]) {
+		clk = clk_get(dev, "sata");
+		if (IS_ERR(clk))
+			return PTR_ERR(clk);
+
+		hpriv->clks[0] = clk;
+	}
+
 	rc = ahci_platform_enable_resources(hpriv);
 	if (rc)
 		return rc;
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 00/14] ARM: da850-lcdk: add SATA support Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-19 14:40 +0100
  [PATCH v4 09/14] sata: ahci: export ahci_do_hardreset() locally Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-19 14:40 +0100
  [PATCH v4 06/14] ARM: davinci: da850: model the SATA refclk Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-19 14:40 +0100
    Re: [PATCH v4 06/14] ARM: davinci: da850: model the SATA refclk Sekhar Nori <nsekhar@ti.com> - 2017-01-20 12:00 +0100
      Re: [PATCH v4 06/14] ARM: davinci: da850: model the SATA refclk Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-20 12:00 +0100
  [PATCH v4 04/14] sata: ahci-da850: get the sata clock using a connection id Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-19 14:40 +0100
  [PATCH v4 05/14] ARM: davinci: da850: add con_id for the SATA clock Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-19 14:40 +0100
  [PATCH v4 12/14] ARM: dts: da850: add the SATA node Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-19 14:40 +0100
    Re: [PATCH v4 12/14] ARM: dts: da850: add the SATA node Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2017-01-19 19:00 +0100
  [PATCH v4 13/14] ARM: dts: da850-lcdk: enable the SATA node Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-19 14:40 +0100
  [PATCH v4 11/14] sata: ahci-da850: un-hardcode the MPY bits Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-19 14:40 +0100
  [PATCH v4 03/14] ARM: davinci: add a clock lookup entry for the SATA clock Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-19 14:40 +0100
  [PATCH v4 08/14] sata: ahci-da850: implement a workaround for the softreset quirk Bartosz Golaszewski <bgolaszewski@baylibre.com> - 2017-01-19 16:30 +0100

csiph-web