From patchwork Thu Jul 5 10:14:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 1159091 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 19B143FD4F for ; Thu, 5 Jul 2012 10:19:11 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Smj63-0006YF-E7; Thu, 05 Jul 2012 10:15:39 +0000 Received: from mail-bk0-f49.google.com ([209.85.214.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Smj4p-0006Dw-8J for linux-arm-kernel@lists.infradead.org; Thu, 05 Jul 2012 10:14:26 +0000 Received: by bkcji2 with SMTP id ji2so2770127bkc.36 for ; Thu, 05 Jul 2012 03:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=bMGFZLvKMNyldgeux2S18Anz+zdTCjOiPHPwjlYwKNA=; b=0qM8pCG2LiC3jEfEWhATTGeJ6rEGaNLfBux6+cogaaoWyZSugAB/RYk75uxDV9MXlN poy/8dPFr4dI7wVzxaz+u30xP28Hpf0ZYgXP1/+52UpI5Gm2uyfUdR7iSX36TOuon8ZN 7WEoUhpBH0bQbYQfXCT13B/WfE4mA1+dG5kWi7e4piXLKiglVrAiLn+79q5aMrlwp9oz eukgXZ0Q6U4pI7os8B0dVpqZJ30M7vtpX7ALzwwLb49TMQxxz6n7ABMZvLbNB8LS/ob1 HjAOkhlYmgigar9iVBQNFOk7kTafqXMaGJeSnuIpLGozbjGAB7OJyVVikWxOkOtA1f9a 8K2A== Received: by 10.204.148.75 with SMTP id o11mr13251775bkv.11.1341483255407; Thu, 05 Jul 2012 03:14:15 -0700 (PDT) Received: from localhost.localdomain (dslc-082-083-240-137.pools.arcor-ip.net. [82.83.240.137]) by mx.google.com with ESMTPS id m2sm20250426bkm.2.2012.07.05.03.14.13 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Jul 2012 03:14:14 -0700 (PDT) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH v1 2/2] mmc: sdhci-dove: Prepare for common clock framework Date: Thu, 5 Jul 2012 12:14:01 +0200 Message-Id: <1341483241-18300-2-git-send-email-sebastian.hesselbarth@googlemail.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1341483241-18300-1-git-send-email-sebastian.hesselbarth@googlemail.com> References: <1341483241-18300-1-git-send-email-sebastian.hesselbarth@googlemail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (sebastian.hesselbarth[at]googlemail.com) 0.8 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [82.83.240.137 listed in dnsbl.sorbs.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.49 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Viresh Kumar , Chris Ball , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Manuel Lauss , Anton Vorontsov , Shawn Guo , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org As mach-dove is moving towards common clock framework prepare the sdhci driver to grab it's clock. Signed-off-by: Sebastian Hesselbarth Cc: Chris Ball Cc: Anton Vorontsov Cc: Shawn Guo Cc: Viresh Kumar Cc: Manuel Lauss Cc: linux-mmc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/mmc/host/sdhci-dove.c | 48 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c index 9c85368..a6e53a1 100644 --- a/drivers/mmc/host/sdhci-dove.c +++ b/drivers/mmc/host/sdhci-dove.c @@ -20,11 +20,17 @@ */ #include +#include +#include #include #include #include "sdhci-pltfm.h" +struct sdhci_dove_priv { + struct clk *clk; +}; + static u16 sdhci_dove_readw(struct sdhci_host *host, int reg) { u16 ret; @@ -72,11 +78,51 @@ static struct sdhci_pltfm_data sdhci_dove_pdata = { static int __devinit sdhci_dove_probe(struct platform_device *pdev) { - return sdhci_pltfm_register(pdev, &sdhci_dove_pdata); + struct sdhci_host *host; + struct sdhci_pltfm_host *pltfm_host; + struct sdhci_dove_priv *priv; + int ret; + + ret = sdhci_pltfm_register(pdev, &sdhci_dove_pdata); + if (ret) + goto sdhci_dove_register_fail; + + priv = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_dove_priv), + GFP_KERNEL); + if (!priv) { + dev_err(&pdev->dev, "unable to allocate private data"); + ret = -ENOMEM; + goto sdhci_dove_allocate_fail; + } + + host = platform_get_drvdata(pdev); + pltfm_host = sdhci_priv(host); + pltfm_host->priv = priv; + + priv->clk = clk_get(&pdev->dev, NULL); + if (!IS_ERR(priv->clk)) + clk_prepare_enable(priv->clk); + return 0; + +sdhci_dove_allocate_fail: + sdhci_pltfm_unregister(pdev); +sdhci_dove_register_fail: + return ret; } static int __devexit sdhci_dove_remove(struct platform_device *pdev) { + struct sdhci_host *host = platform_get_drvdata(pdev); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_dove_priv *priv = pltfm_host->priv; + + if (priv->clk) { + if (!IS_ERR(priv->clk)) { + clk_disable_unprepare(priv->clk); + clk_put(priv->clk); + } + devm_kfree(&pdev->dev, priv->clk); + } return sdhci_pltfm_unregister(pdev); }