From patchwork Mon Jan 30 10:02:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 92806 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1358184qgi; Mon, 30 Jan 2017 02:03:38 -0800 (PST) X-Received: by 10.84.149.102 with SMTP id b35mr30561076plh.3.1485770618513; Mon, 30 Jan 2017 02:03:38 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z30si12143943plh.61.2017.01.30.02.03.38; Mon, 30 Jan 2017 02:03:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752472AbdA3KDX (ORCPT + 7 others); Mon, 30 Jan 2017 05:03:23 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:37718 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752124AbdA3KC0 (ORCPT ); Mon, 30 Jan 2017 05:02:26 -0500 Received: by mail-wm0-f52.google.com with SMTP id v77so39991215wmv.0 for ; Mon, 30 Jan 2017 02:02:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cAjprMZL7lixJ6O8hEdPl09m5ssLDsBG08nAWPWVXuo=; b=OsdcLViv3M/huSfurjAph6mf17d7NCuX8CR3xB6vd7ORk9pGXMydY5GzNnOb/ssZzT bENHz6a76Ws/JcLj0D3O1EBhM8HfwCOyh0isB2rUHFeKxBnW+4POE01ccXefbqF7qaBC 8pMCi7HlbolZaKsnNycr3zzjo5kgJBNJ/cr4A3RhjHiuRdxs/K2gKSnbmm7bjyt/1GH0 uwZlzV3h/tAFyp6boEIZiQw4TK/VxJZILJ5AL9pA/ngLyv9BpCCMxxY98syodYqZKoq5 9pHgDeyA/ZW89ZjB2vQLojCMYAtGR1vJGmem7B/rmMYGxg0AGiRL1lCVeULYnpsi7nPv WG9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cAjprMZL7lixJ6O8hEdPl09m5ssLDsBG08nAWPWVXuo=; b=EZaF+eKugqNXw2UGHLHYw+OMdqAv8UbK5AInA7CXwnnvyJwdWiLqEh8oNrl7rTutpr QDaDtarDdymczxgBx6kuwlyRASuOlqSWtYb0rdMe+95rEVis3A8RS08gVf7vVVZOQmzz bEYibxtAOQJi2HAcV3RjUTVqQwAbDmVqUcqBw6UbibJrB1bGbwdro+yVO9A2zH3GZPtW K0Fhm+5jutw2v9fQagmLyEdXZAJ/tolMINZd5prlrahgo06CVMRnhl3vOYWhREv1QzKf SvfbutnC/y1IBcIBcPMIADvtyTgSc/kLcwq33rpJMvei/Ac+FW9xj0sqRxXMsDTWLgS6 An7g== X-Gm-Message-State: AIkVDXKtUdZw1s5atnz6tlv9qfcNTDMrDsdulU07WoNA/7Yiig/jhg+zZMf6KTfP5OX8pco9 X-Received: by 10.28.209.202 with SMTP id i193mr14756946wmg.20.1485770539370; Mon, 30 Jan 2017 02:02:19 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id j18sm21939536wrb.33.2017.01.30.02.02.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Jan 2017 02:02:18 -0800 (PST) From: Bartosz Golaszewski To: Kevin Hilman , Sekhar Nori , Patrick Titiano , Michael Turquette , Tejun Heo , Rob Herring , Mark Rutland , Russell King , David Lechner Cc: linux-ide@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski Subject: [PATCH v7 04/14] sata: ahci-da850: get the sata clock using a connection id Date: Mon, 30 Jan 2017 11:02:01 +0100 Message-Id: <1485770531-6772-5-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1485770531-6772-1-git-send-email-bgolaszewski@baylibre.com> References: <1485770531-6772-1-git-send-email-bgolaszewski@baylibre.com> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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 Acked-by: Tejun Heo --- drivers/ata/ahci_da850.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c index 267a3d3..e397bab 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;