From patchwork Wed Jun 6 23:22:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 10451021 X-Patchwork-Delegate: geert@linux-m68k.org 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 097D760375 for ; Wed, 6 Jun 2018 23:24:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED321297D9 for ; Wed, 6 Jun 2018 23:24:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E13F8297FF; Wed, 6 Jun 2018 23:24:30 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81E97297D9 for ; Wed, 6 Jun 2018 23:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752736AbeFFXYa (ORCPT ); Wed, 6 Jun 2018 19:24:30 -0400 Received: from bin-mail-out-06.binero.net ([195.74.38.229]:39852 "EHLO bin-mail-out-06.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752257AbeFFXY3 (ORCPT ); Wed, 6 Jun 2018 19:24:29 -0400 X-Halon-ID: b951983d-69e0-11e8-b831-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id b951983d-69e0-11e8-b831-005056917f90; Thu, 07 Jun 2018 01:24:17 +0200 (CEST) From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: Wolfram Sang , Ulf Hansson , linux-mmc@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Masaharu Hayakawa , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH 3/3] mmc: tmio: Fix reset operation Date: Thu, 7 Jun 2018 01:22:52 +0200 Message-Id: <20180606232252.31583-4-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180606232252.31583-1-niklas.soderlund+renesas@ragnatech.se> References: <20180606232252.31583-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Masaharu Hayakawa SD / MMC did not operate properly when suspend transition failed. Because the SCC was not reset at resume, issue of the command failed. Changed tmio_mmc_reset() to tmio_mmc_hw_reset() in order to add reset of SCC to tmio_mmc_host_runtime_resume(). On runtime power management resume, the host clock needs to be enabled before calling tmio_mmc_reset. If the mmc device has a power domain entry, the host clock is enabled via genpd_runtime_resume, running before tmio_mmc_host_runtime_resume. If the mmc device has no power domain entry, however, genpd_runtime_resume is not called. This patch changes tmio_mmc_host_runtime_resume to enable the host clock before calling tmio_mmc_reset. Signed-off-by: Masaharu Hayakawa [Niklas: small fixes when rebase to mmc/next] Signed-off-by: Niklas Söderlund --- drivers/mmc/host/tmio_mmc_core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 9f5793407552a23a..da10b26d8f2d80e7 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -247,6 +247,10 @@ static void tmio_mmc_hw_reset(struct mmc_host *mmc) { struct tmio_mmc_host *host = mmc_priv(mmc); + tmio_mmc_reset(host); + + tmio_mmc_abort_dma(host); + if (host->hw_reset) host->hw_reset(host); } @@ -289,7 +293,7 @@ static void tmio_mmc_reset_work(struct work_struct *work) spin_unlock_irqrestore(&host->lock, flags); - tmio_mmc_reset(host); + tmio_mmc_hw_reset(host->mmc); /* Ready for new calls */ host->mrq = NULL; @@ -1271,7 +1275,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) _host->sdio_irq_mask = TMIO_SDIO_MASK_ALL; tmio_mmc_clk_stop(_host); - tmio_mmc_reset(_host); + tmio_mmc_hw_reset(mmc); sd_ctrl_write32_as_16_and_16(_host, CTL_IRQ_MASK, TMIO_MASK_INIT); _host->sdcard_irq_mask = sd_ctrl_read16_and_16_as_32(_host, CTL_IRQ_MASK); @@ -1372,8 +1376,8 @@ int tmio_mmc_host_runtime_resume(struct device *dev) { struct tmio_mmc_host *host = dev_get_drvdata(dev); - tmio_mmc_reset(host); tmio_mmc_clk_enable(host); + tmio_mmc_hw_reset(host->mmc); if (host->clk_cache) tmio_mmc_set_clock(host, host->clk_cache);