From nobody Sun Aug 06 20:36:19 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RJrnv3QMBz4mNFT; Sun, 6 Aug 2023 20:36:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RJrnv2sT3z4bBQ; Sun, 6 Aug 2023 20:36:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691354179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J6TY10t1kdCB3p5PIxMGPBgrzfq8ApEhOV95eCrgHBg=; b=ac+P4s0C2OVyvB0vPaJQXKazlHdOEau0d4YyY9Sk4Sy35k9rOsHroQ6Wu9z/pprS5RiwX/ 8GQ8nKh//qNGQrnu4TweAU4HBAStrRrSwRCR0cWsSZO4P93lE8WBjJgzwC+36OS/nNoBsE Ngfn/BIOCE5wzfdlamlivjZdjHGS+jQLzXWkbMBJf4HVgH82GliesBLowwLoJleIo8TsMP PR5oOe4BpvGkW+/3afPiS53iQ2Am5dJ6r0Tux+TDeU3uJ11wy3D+nH6Cf90EF0wQcUD6/T EFxAkukvXLYP2eKcy3Lci+KUdQnd/Kqk9kraz+zYQ0a0sJtkXcWDZwOdtlrLIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691354179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J6TY10t1kdCB3p5PIxMGPBgrzfq8ApEhOV95eCrgHBg=; b=LbYPK0HAOj1ipg2TpEaWOWehbCCGkS0aVgsoPurwvi7oqS6YvWmB7XB2Dz1DTZu/e6rxoW LfBTg/Ct/pRerfrP7yK385P9jEOomeLizKzVRot77sb3psjk/YQQxqwCL62oaKbSYkR2WD QD/LtcJ8MRFg5fD6D4V5pAlZqtNGoME5aZh5iczUEg9PZPP8fOKKkW+Fx9u0dt/2CCuyO7 4iDdnlSwDmmlp/GwzvK95fcb3METa0a0eM/OZ+7cQ2ybgKeb9OPXqhVM35/vVxvo0wv3iS WswIQ6kl4YolLOVS8aop97a2Wvc4+OHrTwIQOrrEh6Ti2zvx0lHpya3K8CwElA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691354179; a=rsa-sha256; cv=none; b=X0ZB9YfF0S+tEYLUu0H49mFEu+IeotEmjvraOau+DahS8nCZlQBlFbvWJKcVLXafVGWdTQ onr+oSe4AGZNLzLzatDP35IqMOsr170Dlm2t/UgOjn7Vc1zBpYvqHnbljVcQkgnuHiTULG 3UQHegKO7ct/onBngd0vxwWK5rOHEqoDbdDr7/T3FoM+R6P4hAnIMgeTLd9aeh6u8irXRm gJ1Eru4NeOexiriuUj4qJMS+GnXU0h+jjkHyeiTVv50uYOQKX/KAMjb5+UJ3ovx4tVRsw6 owSPx19yeMJC/IFtBHmgKFbjZCAX8qTvfyNHw/0OUEveOBYpDqTDrApoxoRQsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RJrnv1hvBz8mW; Sun, 6 Aug 2023 20:36:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 376KaJOw042528; Sun, 6 Aug 2023 20:36:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 376KaJPc042527; Sun, 6 Aug 2023 20:36:19 GMT (envelope-from git) Date: Sun, 6 Aug 2023 20:36:19 GMT Message-Id: <202308062036.376KaJPc042527@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Marius Strobl Subject: git: a6222e182c74 - stable/13 - mmc(4): Don't call bridge driver for timings not requiring tuning List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: marius X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a6222e182c7464903f60f288b7784a31d702ce8c Auto-Submitted: auto-generated The branch stable/13 has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=a6222e182c7464903f60f288b7784a31d702ce8c commit a6222e182c7464903f60f288b7784a31d702ce8c Author: Marius Strobl AuthorDate: 2023-04-12 21:46:02 +0000 Commit: Marius Strobl CommitDate: 2023-08-06 17:03:45 +0000 mmc(4): Don't call bridge driver for timings not requiring tuning The original idea behind calling into the bridge driver was to have the logic deciding whether tuning is actually required for a particular bus timing in a given slot as well as doing the sanity checking only on the controller layer which also generally is better suited for these due to say SDHCI_SDR50_NEEDS_TUNING. On another thought, not every such driver should need to check whether tuning is required at all, though, and not everything is SDHCI in the first place. Adjust sdhci(4) accordingly keeping sdhci_generic_tune() a bit cautious still. (cherry picked from commit bd15d31cef50060d90356384ba7b878d398fc9f3) --- sys/dev/mmc/mmc.c | 9 +++++++++ sys/dev/sdhci/sdhci.c | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c index 4e4e3507a1f8..e725cd1c66cb 100644 --- a/sys/dev/mmc/mmc.c +++ b/sys/dev/mmc/mmc.c @@ -2243,6 +2243,15 @@ clock: mmcbr_set_clock(dev, max_dtr); mmcbr_update_ios(dev); + /* + * Don't call into the bridge driver for timings definitely + * not requiring tuning. Note that it's up to the upper + * layer to actually execute tuning otherwise. + */ + if (timing <= bus_timing_uhs_sdr25 || + timing == bus_timing_mmc_ddr52) + goto power_class; + if (mmcbr_tune(dev, hs400) != 0) { device_printf(dev, "Card at relative address %d " "failed to execute initial tuning\n", rca); diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index 6094e49f2cfa..8ea016093686 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -1373,10 +1373,12 @@ sdhci_generic_tune(device_t brdev __unused, device_t reqdev, bool hs400) case bus_timing_uhs_sdr50: if (slot->opt & SDHCI_SDR50_NEEDS_TUNING) break; - /* FALLTHROUGH */ - default: SDHCI_UNLOCK(slot); return (0); + default: + slot_printf(slot, "Tuning requested but not required.\n"); + SDHCI_UNLOCK(slot); + return (EINVAL); } tune_cmd = slot->tune_cmd;