From patchwork Wed Jul 31 16:17:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 11068635 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 6B597174A for ; Wed, 31 Jul 2019 16:17:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5561F1FFCD for ; Wed, 31 Jul 2019 16:17:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49C301FFE4; Wed, 31 Jul 2019 16:17:53 +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 E823E1FFDB for ; Wed, 31 Jul 2019 16:17:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729410AbfGaQRv (ORCPT ); Wed, 31 Jul 2019 12:17:51 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.52]:30039 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbfGaQRv (ORCPT ); Wed, 31 Jul 2019 12:17:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1564589868; 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=Mbr13au7Bfs6hyrvcRpJ6tBGO2CuHoO+AS8RtGSO9/8=; b=ADkLTpvtQ+E/2IAY7Fls6XP7OFf6VWxSMTAf+CsIccRxX8PZYXZ7OC8P8ME1qINaQZ yQb+WCkG9rowLf0u8I+8UKK0X0AJq9jts52iSESvchTv5+Wv36fcc1B1Kgx6InLWxifG KKZveUCo7c5vHtk6Dsx3BOZGSJvoaLMQEByTQXFXKjGJmeMA5S9V7+r0w5c9ds4mkK87 VWTYfFNcLeAR6OhwdYYT0yNVGORTpzG1jNzT3MBwebJ1fogZRZD4t/THc8zG0Pvxv1iN PYntJtLNBwXvl29vSx3llEZmp57QPPmxGa0IpfcLUaes4l2VFoGD6R5l2zl3fyR9vsUP sbUQ== X-RZG-AUTH: ":OWANVUa4dPFUgKR/3dpvnYP0Np73dmm4I5W0/AvA67Ot4fvR82dZd6zDDg==" X-RZG-CLASS-ID: mo00 Received: from groucho.site by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id h0a328v6VGHgaNZ (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); Wed, 31 Jul 2019 18:17:42 +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 v2 1/2] mmc: tmio: leave clock handling to runtime PM if enabled Date: Wed, 31 Jul 2019 18:17:36 +0200 Message-Id: <1564589857-17720-2-git-send-email-uli+renesas@fpond.eu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564589857-17720-1-git-send-email-uli+renesas@fpond.eu> References: <1564589857-17720-1-git-send-email-uli+renesas@fpond.eu> 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 This fixes a clock imbalance that occurs on Renesas systems because the SD clock is handled by both runtime PM and the hardware driver. After a suspend/resume cycle both enable the same clock, resulting in an enable count of 2 even if the clock is only used by one device. See https://www.spinics.net/lists/linux-mmc/msg44431.html for details. This patch removes the clock handling from the driver's runtime PM callbacks and turns the clock off after probing if the device has a power domain attached. Reported-by: Geert Uytterhoeven Signed-off-by: Ulrich Hecht Tested-by: Niklas Söderlund --- drivers/mmc/host/tmio_mmc_core.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 31ffcc3..733ff96 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 && pdev->dev.pm_domain) + _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) @@ -1325,7 +1330,8 @@ int tmio_mmc_host_runtime_suspend(struct device *dev) if (host->clk_cache) host->set_clock(host, 0); - tmio_mmc_clk_disable(host); + if (!dev->pm_domain) + tmio_mmc_clk_disable(host); return 0; } @@ -1340,7 +1346,9 @@ int tmio_mmc_host_runtime_resume(struct device *dev) { struct tmio_mmc_host *host = dev_get_drvdata(dev); - tmio_mmc_clk_enable(host); + if (!dev->pm_domain) + tmio_mmc_clk_enable(host); + tmio_mmc_hw_reset(host->mmc); if (host->clk_cache) From patchwork Wed Jul 31 16:17:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 11068639 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 05AA3912 for ; Wed, 31 Jul 2019 16:17:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7FE71FFCD for ; Wed, 31 Jul 2019 16:17:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBAA6200CB; Wed, 31 Jul 2019 16:17:53 +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 8D2701FFCD for ; Wed, 31 Jul 2019 16:17:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729389AbfGaQRx (ORCPT ); Wed, 31 Jul 2019 12:17:53 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.84]:26904 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbfGaQRx (ORCPT ); Wed, 31 Jul 2019 12:17:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1564589869; 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=LUAukr8Fa+7cR98+MjnDbcRvcMBn81Uabyl9ncZFn9U=; b=oSbqMlXZin+FUn8Uem5mhSE0aMD6ZNcuSqIyqYTZNMURaKnpXWwh68wr0jubk3ygIr nNFCJX9I0vdGxj/tBIRYriPnW4LhDuwb2GeVts1BlyQ2T9cGboYGaqmP/vxwcf9uQADV XpFdTwSatW6xDB8QTmw4vYoRQbqUmCF3rG9SPVRfUEkdEiNeowQW2JNhjWanTxnjR3FD NHXd3SAJz7a74d8OVBan9+kIklhP5UfNuLCmDaESt8CA7uBzXYfPPO2KD7NHnvKN4FDu V9OP//qowkp0F3Hbh3OMItDjm1bGOhG0YORiI2/a89rnELpIxsrdGQ+oEg2pzej+TtKr UY0Q== X-RZG-AUTH: ":OWANVUa4dPFUgKR/3dpvnYP0Np73dmm4I5W0/AvA67Ot4fvR82dZd6zDDg==" X-RZG-CLASS-ID: mo00 Received: from groucho.site by smtp.strato.de (RZmta 44.24 DYNA|AUTH) with ESMTPSA id h0a328v6VGHhaNa (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); Wed, 31 Jul 2019 18:17:43 +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 v2 2/2] mmc: tmio: remove obsolete PM workaround Date: Wed, 31 Jul 2019 18:17:37 +0200 Message-Id: <1564589857-17720-3-git-send-email-uli+renesas@fpond.eu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564589857-17720-1-git-send-email-uli+renesas@fpond.eu> References: <1564589857-17720-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 commit 7ff213193310ef8d ("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 733ff96..72877c6 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. */