Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1645677rwb; Sun, 14 Aug 2022 08:38:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR5P4ayxcL9g4wp4Vkav2l7IF28n9+U8forCvvURgyFT66fAfLjAnxRo1PxlpaHAdEG+z37Y X-Received: by 2002:a05:6402:2706:b0:43e:5df1:2e04 with SMTP id y6-20020a056402270600b0043e5df12e04mr10897172edd.315.1660491480565; Sun, 14 Aug 2022 08:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660491480; cv=none; d=google.com; s=arc-20160816; b=L5dTyJJA7WJuJt6o3QlvVxQ95AjVl55mCctbpIjdOyoRFuSJy6H/S0J+1O1w1Dqp0C Z7vSkAizp0JphYZxVkz1C0jty9I3lfNO+UM8kZn8kXGj2gYASGRC2uWAfsfnrJSPkpUK pIsvUhYTDzjFRSrmrH3LfbxJMvaDjkM4lNHTcs9pkMJJvHiL/CvLYYwa45eO6P5wvHmW 41ixJvPtfEOcd7XJaFfpMqLM/crSO5bpjeJ2okTNqozXS2DFZ2sK9EXLCL/WUnwcilL9 m79+TJfA6W7EZfx/ElmbSkCoNrAuoDt8QXUuay1tE3ju3u/f0OOdgyumqejvB7NJtcNY 4Syw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yWeifJ8Ql1F6NyopU/3p8+RCFaGK+CXefn5QwhmqsTQ=; b=A24DuWGoKmF/GzXNNe9xfcpLna0ExfP5GBJngi6dLPkQRvitkV+wN5pabBV7wloJku 33JxfH7ueYbv8W0j2de+WQU9fP3wqseSJk0eDZ3Kb2dg7yEJojDDKVVTsMa8Wg7GI5zf C4TVjUK6w7/qpJJ1fhkU40pY3ZWMCvk91C0DyMm1qtSetIUMF9jUTNUkJRHL76HE9T14 uAhXAw43bFR5FNjwO/T3aGoL2W4KVrou59p5aveUwSIweaf09gXrK8+vmz/PVFvHzP/K bmoce8syWxPQbtzGBGSXAqV42H/Q+HVq2x56DhBMbJRyn32MgMSck/fg+GVMTTJKEbEI ZsrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FXI8i2ia; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m16-20020a509310000000b0043e5033412asi5954035eda.189.2022.08.14.08.37.33; Sun, 14 Aug 2022 08:38:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FXI8i2ia; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240568AbiHNPch (ORCPT + 99 others); Sun, 14 Aug 2022 11:32:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240558AbiHNPbl (ORCPT ); Sun, 14 Aug 2022 11:31:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3983E1A836; Sun, 14 Aug 2022 08:29:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1023DB80B27; Sun, 14 Aug 2022 15:29:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAF90C433D6; Sun, 14 Aug 2022 15:29:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660490983; bh=VAZ7bw/cY6Ku/WESVFj7vU3YOdy8tsbj8N9GzWDRbVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FXI8i2ia1XSm5TJypricsEdMMHdrm3FSLWuwY6/kfIP3AbCUdApzyTHVJ0GSTtBQC +pxm0/0lEY47wwyAoUeiTJ+BsFNpCQhWTyIFpVSp4Y+WhviqNQDCigpeqvWu+IgMEO sEcH6Vr2Im1rreVUgzb8SEzzhFvWYibjEtbriEc1eiJNue+qTMTF/HMaV2EeaZ7WzA jyvBFWeCRE855l2UOJCRBCMfXbf6fLIJd96dNG4weCpdKLRMmgjsjDAZs5hpZak8Oj q5Lz8hosqIQ8RV3WfCzBF0qPHo0sD6phRJJVFMB5z4vCw9EHoVQJFAWO2P+rCfaaqE HgMkOzuCvFIuA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takeshi Saito , Wolfram Sang , Yoshihiro Shimoda , Ulf Hansson , Sasha Levin , linux-mmc@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH AUTOSEL 5.19 46/64] mmc: renesas_sdhi: newer SoCs don't need manual tap correction Date: Sun, 14 Aug 2022 11:24:19 -0400 Message-Id: <20220814152437.2374207-46-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814152437.2374207-1-sashal@kernel.org> References: <20220814152437.2374207-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takeshi Saito [ Upstream commit 00e8c11c137b2e4b2bf54dc9881cf32e3441ddb4 ] The newest Gen3 SoCs and Gen4 SoCs do not need manual tap correction with HS400 anymore. So, instead of checking the SDHI version, add a quirk flag and set manual tap correction only for affected SoCs. Signed-off-by: Takeshi Saito [wsa: rebased, renamed the quirk variable, removed stale comment] Signed-off-by: Wolfram Sang Reviewed-by: Yoshihiro Shimoda Tested-by: Yoshihiro Shimoda Link: https://lore.kernel.org/r/20220720072901.1266-1-wsa+renesas@sang-engineering.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/renesas_sdhi.h | 1 + drivers/mmc/host/renesas_sdhi_core.c | 5 ++--- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h index 1a1e3e020a8c..c4abfee1ebae 100644 --- a/drivers/mmc/host/renesas_sdhi.h +++ b/drivers/mmc/host/renesas_sdhi.h @@ -43,6 +43,7 @@ struct renesas_sdhi_quirks { bool hs400_4taps; bool fixed_addr_mode; bool dma_one_rx_only; + bool manual_tap_correction; u32 hs400_bad_taps; const u8 (*hs400_calib_table)[SDHI_CALIB_TABLE_MAX]; }; diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 5fa365d0c7fd..61149c0acaae 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -380,8 +380,7 @@ static void renesas_sdhi_hs400_complete(struct mmc_host *mmc) sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_DT2FF, priv->scc_tappos_hs400); - /* Gen3 can't do automatic tap correction with HS400, so disable it */ - if (sd_ctrl_read16(host, CTL_VERSION) == SDHI_VER_GEN3_SDMMC) + if (priv->quirks && priv->quirks->manual_tap_correction) sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL, ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN & sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL)); @@ -718,7 +717,7 @@ static bool renesas_sdhi_manual_correction(struct tmio_mmc_host *host, bool use_ sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSREQ, 0); /* Change TAP position according to correction status */ - if (sd_ctrl_read16(host, CTL_VERSION) == SDHI_VER_GEN3_SDMMC && + if (priv->quirks && priv->quirks->manual_tap_correction && host->mmc->ios.timing == MMC_TIMING_MMC_HS400) { u32 bad_taps = priv->quirks ? priv->quirks->hs400_bad_taps : 0; /* diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c index 3084b15ae2cb..52915404eb07 100644 --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c @@ -170,6 +170,7 @@ static const struct renesas_sdhi_quirks sdhi_quirks_4tap_nohs400_one_rx = { static const struct renesas_sdhi_quirks sdhi_quirks_4tap = { .hs400_4taps = true, .hs400_bad_taps = BIT(2) | BIT(3) | BIT(6) | BIT(7), + .manual_tap_correction = true, }; static const struct renesas_sdhi_quirks sdhi_quirks_nohs400 = { @@ -182,25 +183,30 @@ static const struct renesas_sdhi_quirks sdhi_quirks_fixed_addr = { static const struct renesas_sdhi_quirks sdhi_quirks_bad_taps1357 = { .hs400_bad_taps = BIT(1) | BIT(3) | BIT(5) | BIT(7), + .manual_tap_correction = true, }; static const struct renesas_sdhi_quirks sdhi_quirks_bad_taps2367 = { .hs400_bad_taps = BIT(2) | BIT(3) | BIT(6) | BIT(7), + .manual_tap_correction = true, }; static const struct renesas_sdhi_quirks sdhi_quirks_r8a7796_es13 = { .hs400_4taps = true, .hs400_bad_taps = BIT(2) | BIT(3) | BIT(6) | BIT(7), .hs400_calib_table = r8a7796_es13_calib_table, + .manual_tap_correction = true, }; static const struct renesas_sdhi_quirks sdhi_quirks_r8a77965 = { .hs400_bad_taps = BIT(2) | BIT(3) | BIT(6) | BIT(7), .hs400_calib_table = r8a77965_calib_table, + .manual_tap_correction = true, }; static const struct renesas_sdhi_quirks sdhi_quirks_r8a77990 = { .hs400_calib_table = r8a77990_calib_table, + .manual_tap_correction = true, }; /* -- 2.35.1