From patchwork Fri Jul 29 04:15:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 9252027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EA9E260871 for ; Fri, 29 Jul 2016 04:18:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCA1B27E63 for ; Fri, 29 Jul 2016 04:18:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D12D627F46; Fri, 29 Jul 2016 04:18:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9426627F88 for ; Fri, 29 Jul 2016 04:18:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bSzFz-0003t1-7U; Fri, 29 Jul 2016 04:18:43 +0000 Received: from lucky1.263xmail.com ([211.157.147.133]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bSzFv-0003oG-DS for linux-rockchip@lists.infradead.org; Fri, 29 Jul 2016 04:18:40 +0000 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.105]) by lucky1.263xmail.com (Postfix) with SMTP id 84AC253B29; Fri, 29 Jul 2016 12:18:19 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id B810A39C; Fri, 29 Jul 2016 12:18:16 +0800 (CST) X-RL-SENDER: shawn.lin@rock-chips.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <057885b9ccc9b2efc998d696eef9ab68> X-ATTACHMENT-NUM: 0 X-SENDER: lintao@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 11195YE7MFV; Fri, 29 Jul 2016 12:18:19 +0800 (CST) From: Shawn Lin To: Heiko Stuebner , Rob Herring , Jaehoon Chung , Ulf Hansson Subject: [PATCH 4/5] mmc: dw_mmc: add power domain support Date: Fri, 29 Jul 2016 12:15:02 +0800 Message-Id: <1469765703-30999-5-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1469765703-30999-1-git-send-email-shawn.lin@rock-chips.com> References: <1469765703-30999-1-git-send-email-shawn.lin@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160728_211839_941221_9F6232B8 X-CRM114-Status: UNSURE ( 5.97 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Elaine Zhang , Feng Xiao , Shawn Lin , Brian Norris , linux-mmc@vger.kernel.org, Douglas Anderson , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We should enable power domain once provided. Otherwise we take risk of bus err as it's maybe in off state before probing. Signed-off-by: Shawn Lin --- drivers/mmc/host/dw_mmc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 32380d5..8b39168 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -3024,6 +3026,9 @@ int dw_mci_probe(struct dw_mci *host) host->bus_hz = clk_get_rate(host->ciu_clk); } + pm_runtime_enable(host->dev); + pm_runtime_get_sync(host->dev); + if (!host->bus_hz) { dev_err(host->dev, "Platform data must supply bus speed\n"); @@ -3197,6 +3202,9 @@ err_clk_biu: if (!IS_ERR(host->biu_clk)) clk_disable_unprepare(host->biu_clk); + pm_runtime_put(host->dev); + pm_runtime_disable(host->dev); + return ret; } EXPORT_SYMBOL(dw_mci_probe); @@ -3226,6 +3234,9 @@ void dw_mci_remove(struct dw_mci *host) if (!IS_ERR(host->biu_clk)) clk_disable_unprepare(host->biu_clk); + + pm_runtime_put(host->dev); + pm_runtime_disable(host->dev); } EXPORT_SYMBOL(dw_mci_remove);