From patchwork Thu Jun 30 02:54:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seungwon Jeon X-Patchwork-Id: 931472 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5U3NgKB030562 for ; Thu, 30 Jun 2011 03:23:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757676Ab1F3DXd (ORCPT ); Wed, 29 Jun 2011 23:23:33 -0400 Received: from ganesha.gnumonks.org ([213.95.27.120]:50391 "EHLO ganesha.gnumonks.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753655Ab1F3DXd (ORCPT ); Wed, 29 Jun 2011 23:23:33 -0400 Received: from uucp by ganesha.gnumonks.org with local-bsmtp (Exim 4.72) (envelope-from ) id 1Qc7qj-0002wK-Uj; Thu, 30 Jun 2011 05:23:29 +0200 Received: from [12.23.102.153] (helo=sunrise.dsn.sec.samsung.com) by jackpot.kr.gnumonks.org with esmtp (Exim 4.69) (envelope-from ) id 1Qc75L-0005Fp-Gd; Thu, 30 Jun 2011 11:34:31 +0900 From: Seungwon Jeon To: linux-mmc@vger.kernel.org, cjb@laptop.org Cc: linux-kernel@vger.kernel.org, Seungwon Jeon Subject: [PATCH] mmc: dw_mmc: Supply clocks for both host and card. Date: Thu, 30 Jun 2011 11:54:57 +0900 Message-Id: <1309402497-29191-1-git-send-email-tgih.jun@samsung.com> X-Mailer: git-send-email 1.7.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 30 Jun 2011 03:23:42 +0000 (UTC) Add enabling clocks for both host controller and card. Signed-off-by: Seungwon Jeon --- drivers/mmc/host/dw_mmc.c | 33 ++++++++++++++++++++++++++++++++- include/linux/mmc/dw_mmc.h | 7 +++++++ 2 files changed, 39 insertions(+), 1 deletions(-) -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" 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/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 10b6979..a524416 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1797,6 +1797,24 @@ static int dw_mci_probe(struct platform_device *pdev) goto err_freehost; } + host->hclk = clk_get(&pdev->dev, pdata->hclk_name); + if (IS_ERR(host->hclk)) { + dev_err(&pdev->dev, + "Failed to get hclk\n"); + ret = PTR_ERR(host->hclk); + goto err_freehost; + } + clk_enable(host->hclk); + + host->cclk = clk_get(&pdev->dev, pdata->cclk_name); + if (IS_ERR(host->cclk)) { + dev_err(&pdev->dev, + "Failed to get cclk\n"); + ret = PTR_ERR(host->cclk); + goto err_free_hclk; + } + clk_enable(host->cclk); + host->bus_hz = pdata->bus_hz; host->quirks = pdata->quirks; @@ -1806,7 +1824,7 @@ static int dw_mci_probe(struct platform_device *pdev) ret = -ENOMEM; host->regs = ioremap(regs->start, regs->end - regs->start + 1); if (!host->regs) - goto err_freehost; + goto err_free_cclk; host->dma_ops = pdata->dma_ops; dw_mci_init_dma(host); @@ -1945,6 +1963,13 @@ err_dmaunmap: regulator_put(host->vmmc); } +err_free_cclk: + clk_disable(host->cclk); + clk_put(host->cclk); + +err_free_hclk: + clk_disable(host->hclk); + clk_put(host->hclk); err_freehost: kfree(host); @@ -1983,6 +2008,12 @@ static int __exit dw_mci_remove(struct platform_device *pdev) regulator_put(host->vmmc); } + clk_disable(host->cclk); + clk_put(host->cclk); + + clk_disable(host->hclk); + clk_put(host->hclk); + iounmap(host->regs); kfree(host); diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h index f3f68ee..56b3f27 100644 --- a/include/linux/mmc/dw_mmc.h +++ b/include/linux/mmc/dw_mmc.h @@ -47,6 +47,8 @@ struct mmc_data; * @cmd: The command currently being sent to the card, or NULL. * @data: The data currently being transferred, or NULL if no data * transfer is in progress. + * @hclk: Clock for host. + * @cclk: Clock for card. * @use_dma: Whether DMA channel is initialized or not. * @sg_dma: Bus address of DMA buffer. * @sg_cpu: Virtual address of DMA buffer. @@ -118,6 +120,8 @@ struct dw_mci { struct mmc_request *mrq; struct mmc_command *cmd; struct mmc_data *data; + struct clk *hclk; + struct clk *cclk; /* DMA interface members*/ int use_dma; @@ -218,6 +222,9 @@ struct dw_mci_board { /* delay in mS before detecting cards after interrupt */ u32 detect_delay_ms; + char *hclk_name; + char *cclk_name; + int (*init)(u32 slot_id, irq_handler_t , void *); int (*get_ro)(u32 slot_id); int (*get_cd)(u32 slot_id);