From patchwork Fri Nov 6 07:25:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 11886277 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5B10921 for ; Fri, 6 Nov 2020 07:25:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1873E20A8B for ; Fri, 6 Nov 2020 07:25:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="SADMdHqb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726321AbgKFHZ4 (ORCPT ); Fri, 6 Nov 2020 02:25:56 -0500 Received: from www.zeus03.de ([194.117.254.33]:41456 "EHLO mail.zeus03.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726027AbgKFHZ4 (ORCPT ); Fri, 6 Nov 2020 02:25:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=k1; bh=2YW8An1DBe+NNP SWVLGuVoEIEfzNzbqtC+jRBe9FCe0=; b=SADMdHqbAhlW0pjmIgVKvCTWDsKREy Sx/U3lDWudw0f9w3sH59+9obNUEbDupvHrG0ugiB9Cf/GdBlzS9zhw60dUhnXqS2 Zj3Mh1sYvNFTbeyEnxNF95Dgneh8JvubIM588Ql1qskb8rcmRetK1aOkTxxAP4H7 rgUwgVUG0rB/k= Received: (qmail 858584 invoked from network); 6 Nov 2020 08:25:54 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 6 Nov 2020 08:25:54 +0100 X-UD-Smtp-Session: l3s3148p1@iNt6H2uzVIggAwDPXwt7AGjsMIC0/1f/ From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Yoshihiro Shimoda , Wolfram Sang Subject: [PATCH 1/3] mmc: tmio: when resetting, reset DMA controller, too Date: Fri, 6 Nov 2020 08:25:47 +0100 Message-Id: <20201106072549.1495-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201106072549.1495-1-wsa+renesas@sang-engineering.com> References: <20201106072549.1495-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org When applying a revert, the assumption that DMA only needs to be cleared in specific cases was wrong. We want to reset the DMA controller every time the rest of the HW gets reset, too. Fixes: 34e3211e5492 ("Revert "mmc: tmio: fix reset operation"") Reported-by: Yoshihiro Shimoda Signed-off-by: Wolfram Sang --- drivers/mmc/host/tmio_mmc_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 2fce0518632d..cfb53d7c63d7 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -175,6 +175,8 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host) if (host->reset) host->reset(host); + tmio_mmc_abort_dma(host); + if (host->pdata->flags & TMIO_MMC_SDIO_IRQ) { sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask); sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001); @@ -223,8 +225,6 @@ static void tmio_mmc_reset_work(struct work_struct *work) /* Ready for new calls */ host->mrq = NULL; - - tmio_mmc_abort_dma(host); mmc_request_done(host->mmc, mrq); } From patchwork Fri Nov 6 07:25:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 11886281 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB0121130 for ; Fri, 6 Nov 2020 07:26:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1892C20825 for ; Fri, 6 Nov 2020 07:26:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="RD8v87mI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725830AbgKFHZ5 (ORCPT ); Fri, 6 Nov 2020 02:25:57 -0500 Received: from www.zeus03.de ([194.117.254.33]:41464 "EHLO mail.zeus03.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbgKFHZ4 (ORCPT ); Fri, 6 Nov 2020 02:25:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=k1; bh=u8BmXfQE8Q7zzy pkikRD2J/m3RuKZ3y+1kFKMF9gU3w=; b=RD8v87mI75VZ0yGVE7/QfLx5e+FKLx 5aKyWYGcnG4JJjfBxNfFzzMxJpn+468QgJXwFxq9l588uFx/9S+v6VgPgCv/2zQI fUbki/ZBK16xvUPiHpRxXEuZ628yEPEcHH4X37n/kHVWiFLz1sUkiohW4TH+2yni qG+mlPCHaI1Fo= Received: (qmail 858618 invoked from network); 6 Nov 2020 08:25:54 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 6 Nov 2020 08:25:54 +0100 X-UD-Smtp-Session: l3s3148p1@26KAH2uzVoggAwDPXwt7AGjsMIC0/1f/ From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Yoshihiro Shimoda , Wolfram Sang , Takeshi Saito Subject: [PATCH 2/3] mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF Date: Fri, 6 Nov 2020 08:25:48 +0100 Message-Id: <20201106072549.1495-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201106072549.1495-1-wsa+renesas@sang-engineering.com> References: <20201106072549.1495-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org When powering off a card, we need to disable the tuning HW (like SCC for the Renesas SDHI) to get to a sane state and allow for re-tuning new cards. This was hidden before because we wrongly did that in hw_reset() before which was an unintended use of hw_reset(). Now that we corrected the use of hw_reset() meanwhile, we revealed this shortcoming and need to fix it properly by explicitly calling the downgrade callback. Fixes: 6e7d4de10890 ("mmc: renesas_sdhi: move wrong 'hw_reset' to 'reset'") Suggested-by: Takeshi Saito Reviewed-by: Takeshi Saito Signed-off-by: Wolfram Sang --- drivers/mmc/host/tmio_mmc_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index cfb53d7c63d7..cb4149fd12e0 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -927,6 +927,9 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) switch (ios->power_mode) { case MMC_POWER_OFF: tmio_mmc_power_off(host); + /* Downgrade ensures a sane state for tuning HW (e.g. SCC) */ + if (host->mmc->ops->hs400_downgrade) + host->mmc->ops->hs400_downgrade(host->mmc); host->set_clock(host, 0); break; case MMC_POWER_UP: From patchwork Fri Nov 6 07:25:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 11886285 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 61E40921 for ; Fri, 6 Nov 2020 07:26:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BC3620825 for ; Fri, 6 Nov 2020 07:26:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="VMdZHQ9g" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726190AbgKFHZ5 (ORCPT ); Fri, 6 Nov 2020 02:25:57 -0500 Received: from www.zeus03.de ([194.117.254.33]:41480 "EHLO mail.zeus03.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726262AbgKFHZ5 (ORCPT ); Fri, 6 Nov 2020 02:25:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=k1; bh=v40b6ex/W8faqw qSuNLfB1ZPnYt5rbA+6JSyjKrwpsM=; b=VMdZHQ9g9SjAi/J5Ik5fg3L50+hHu2 Qth2AMRTHwtzWTyg2FdorhLKj+CkP/7+VEe9PP6/Dl4hnfPwOBKPuoRRnp8NcpQG l1F84KwJnYP5klwgaE4IVM4zSsiTayiXYm2nrf4PO9KEpnkIdi6pB39wdMk1fzaU v9igUCi4BHCiU= Received: (qmail 858651 invoked from network); 6 Nov 2020 08:25:55 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 6 Nov 2020 08:25:55 +0100 X-UD-Smtp-Session: l3s3148p1@kKyGH2uzWIggAwDPXwt7AGjsMIC0/1f/ From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Yoshihiro Shimoda , Wolfram Sang Subject: [PATCH 3/3] Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD cards" Date: Fri, 6 Nov 2020 08:25:49 +0100 Message-Id: <20201106072549.1495-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201106072549.1495-1-wsa+renesas@sang-engineering.com> References: <20201106072549.1495-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org This reverts commit db1af1e9712920f47b5dc6a995fca3eec05ea85e. It was only a workaround to hide a regression. We now have proper fixes. Signed-off-by: Wolfram Sang --- drivers/mmc/host/renesas_sdhi_core.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 414314151d0a..20e5eb63caf8 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -572,17 +572,6 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host) TMIO_MASK_INIT_RCAR2); } -/* - * This is a temporary workaround! This driver used 'hw_reset' wrongly and the - * fix for that showed a regression. So, we mimic the old behaviour until the - * proper solution is found. - */ -static void renesas_sdhi_hw_reset(struct mmc_host *mmc) -{ - struct tmio_mmc_host *host = mmc_priv(mmc); - renesas_sdhi_reset(host); -} - #define SH_MOBILE_SDHI_MIN_TAP_ROW 3 static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host) @@ -1020,8 +1009,6 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (of_data && of_data->scc_offset) { priv->scc_ctl = host->ctl + of_data->scc_offset; host->reset = renesas_sdhi_reset; - host->ops.hw_reset = renesas_sdhi_hw_reset; - host->mmc->caps |= MMC_CAP_HW_RESET; } }