From patchwork Tue Jul 16 15:01:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 11046253 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-2.web.codeaurora.org (Postfix) with ESMTP id CC1EE1510 for ; Tue, 16 Jul 2019 15:01:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBACC285E2 for ; Tue, 16 Jul 2019 15:01:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B01B2285EC; Tue, 16 Jul 2019 15:01:22 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 88DBE285E2 for ; Tue, 16 Jul 2019 15:01:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728390AbfGPPBV (ORCPT ); Tue, 16 Jul 2019 11:01:21 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.52]:30243 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725926AbfGPPBV (ORCPT ); Tue, 16 Jul 2019 11:01:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1563289278; s=strato-dkim-0002; d=fpond.eu; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=imbz7BdBKL+eONzyyt38SkoblfiMxaQY/kENBBY+wnw=; b=gfnMSpC1mCqjKQhjcuYb7Q0nYshdWSTWljleZRvyC8IW/TX1Y2M/CvaUSsTfDcTDIa w0Itn+H8MEUEbhjCtpoyRwj3iCPFTQxZqth7C6XBLFDy6X6vydo8jmNTNLDMHB8sY8Ks FLtHijd3+d12d9bdZAhv9NN7MZ/aPIGvg/5cJptx4agKwYMA7y0lR9Cn59WQ7I5YpHLh UyZIv+SmuVr8SnmhKg9poc8rNpijPTKzemzembRd4rmkgxVjxQ1keZCntx4urQ7wjSnc bDTbqayX6FPwTyPRdocct1qu8F35hAAmymRYhWOx/0yJs+jdlxZuNXGsou2FvRLSocOF /Vzg== X-RZG-AUTH: ":OWANVUa4dPFUgKR/3dpvnYP0Np73dmm4I5W0/AvA67Ot4fvR82dYd7rJSdw=" X-RZG-CLASS-ID: mo00 Received: from groucho.site by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id h0a328v6GF1Dd5H (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Tue, 16 Jul 2019 17:01:13 +0200 (CEST) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org, linux-mmc@vger.kernel.org Cc: niklas.soderlund@ragnatech.se, wsa@the-dreams.de, yamada.masahiro@socionext.com, geert@linux-m68k.org, ulf.hansson@linaro.org, magnus.damm@gmail.com, Ulrich Hecht Subject: [PATCH 1/2] mmc: tmio: leave clock handling to PM if enabled Date: Tue, 16 Jul 2019 17:01:03 +0200 Message-Id: <1563289264-26432-2-git-send-email-uli+renesas@fpond.eu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1563289264-26432-1-git-send-email-uli+renesas@fpond.eu> References: <1563289264-26432-1-git-send-email-uli+renesas@fpond.eu> 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 This fixes a clock imbalance that occurs because the SD clock is handled by both PM and the hardware driver. See https://www.spinics.net/lists/linux-mmc/msg44431.html for details. This patch removes the clock handling from the driver's PM callbacks and turns the clock off after probing. Reported-by: Geert Uytterhoeven Signed-off-by: Ulrich Hecht --- drivers/mmc/host/tmio_mmc_core.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 31ffcc3..26dcbba 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1260,9 +1260,14 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) /* See if we also get DMA */ tmio_mmc_request_dma(_host, pdata); - pm_runtime_set_active(&pdev->dev); +#ifdef CONFIG_PM + /* PM handles the clock; disable it so it won't be enabled twice. */ + if (_host->clk_disable) + _host->clk_disable(_host); + pm_runtime_get_sync(&pdev->dev); pm_runtime_set_autosuspend_delay(&pdev->dev, 50); pm_runtime_use_autosuspend(&pdev->dev); +#endif ret = mmc_add_host(mmc); if (ret) @@ -1302,20 +1307,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host) EXPORT_SYMBOL_GPL(tmio_mmc_host_remove); #ifdef CONFIG_PM -static int tmio_mmc_clk_enable(struct tmio_mmc_host *host) -{ - if (!host->clk_enable) - return -ENOTSUPP; - - return host->clk_enable(host); -} - -static void tmio_mmc_clk_disable(struct tmio_mmc_host *host) -{ - if (host->clk_disable) - host->clk_disable(host); -} - int tmio_mmc_host_runtime_suspend(struct device *dev) { struct tmio_mmc_host *host = dev_get_drvdata(dev); @@ -1325,8 +1316,6 @@ int tmio_mmc_host_runtime_suspend(struct device *dev) if (host->clk_cache) host->set_clock(host, 0); - tmio_mmc_clk_disable(host); - return 0; } EXPORT_SYMBOL_GPL(tmio_mmc_host_runtime_suspend); @@ -1340,7 +1329,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev) { struct tmio_mmc_host *host = dev_get_drvdata(dev); - tmio_mmc_clk_enable(host); tmio_mmc_hw_reset(host->mmc); if (host->clk_cache) From patchwork Tue Jul 16 15:01:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 11046257 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-2.web.codeaurora.org (Postfix) with ESMTP id F24F11800 for ; Tue, 16 Jul 2019 15:01:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E214D285CE for ; Tue, 16 Jul 2019 15:01:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D63FC285E2; Tue, 16 Jul 2019 15:01:22 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 ABC3A285E5 for ; Tue, 16 Jul 2019 15:01:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725926AbfGPPBV (ORCPT ); Tue, 16 Jul 2019 11:01:21 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.82]:18387 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387857AbfGPPBV (ORCPT ); Tue, 16 Jul 2019 11:01:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1563289279; s=strato-dkim-0002; d=fpond.eu; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=/oKBVysnS6pnsgJqnvc4PKg6WVXy4zXMetDOoCMTtvs=; b=FlbvAbobE01Z3+0air5cdR69ZKm8FW9Y/GfbwC24BIZOtXpe1deYOdHJ0EoCo9p6th 9TQJNl8aqoVlVWIIpLo4nedZOaMFFZ+xLtw2kUd/lscZmofgtqcsvQt0jnELp5dILQLG mtoHdcE61W1QLfzuwtD2xq25g7CNxowCs38YKyHgdpO7pqocmEE1GPxz4vLSoteYexyZ kkCwHS2jX8j+mhFFiPdwDKB5tq7WFshLfEREZr9vFsoU3NngJTBs4gN892IOEy9yqZhs i9bxiSsEGAuEbt9eX2SXbbNeuieqUvXqQVYGqLIgbvDBWDF8NeuXYs3eem/XgTbbJ5eA 5LXg== X-RZG-AUTH: ":OWANVUa4dPFUgKR/3dpvnYP0Np73dmm4I5W0/AvA67Ot4fvR82dYd7rJSdw=" X-RZG-CLASS-ID: mo00 Received: from groucho.site by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id h0a328v6GF1Ed5I (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Tue, 16 Jul 2019 17:01:14 +0200 (CEST) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org, linux-mmc@vger.kernel.org Cc: niklas.soderlund@ragnatech.se, wsa@the-dreams.de, yamada.masahiro@socionext.com, geert@linux-m68k.org, ulf.hansson@linaro.org, magnus.damm@gmail.com, Ulrich Hecht Subject: [PATCH 2/2] mmc: tmio: remove obsolete PM workaround Date: Tue, 16 Jul 2019 17:01:04 +0200 Message-Id: <1563289264-26432-3-git-send-email-uli+renesas@fpond.eu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1563289264-26432-1-git-send-email-uli+renesas@fpond.eu> References: <1563289264-26432-1-git-send-email-uli+renesas@fpond.eu> 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 Obsoleted by "mmc: tmio: move runtime PM enablement to the driver implementations". Signed-off-by: Ulrich Hecht --- drivers/mmc/host/tmio_mmc_core.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 26dcbba..29c0d2c 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1221,15 +1221,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) _host->reset = tmio_mmc_reset; /* - * On Gen2+, eMMC with NONREMOVABLE currently fails because native - * hotplug gets disabled. It seems RuntimePM related yet we need further - * research. Since we are planning a PM overhaul anyway, let's enforce - * for now the device being active by enabling native hotplug always. - */ - if (pdata->flags & TMIO_MMC_MIN_RCAR2) - _host->native_hotplug = true; - - /* * While using internal tmio hardware logic for card detection, we need * to ensure it stays powered for it to work. */