From nobody Mon Nov 14 09:34:13 2022 X-Original-To: freebsd-hackers@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 4N9kfc4WWLz4d7XM for ; Mon, 14 Nov 2022 09:34:32 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic317-22.consmr.mail.gq1.yahoo.com (sonic317-22.consmr.mail.gq1.yahoo.com [98.137.66.148]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4N9kfb3FL8z3Gnh for ; Mon, 14 Nov 2022 09:34:31 +0000 (UTC) (envelope-from marklmi@yahoo.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=VGvjgKv9; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.66.148 as permitted sender) smtp.mailfrom=marklmi@yahoo.com; dmarc=pass (policy=reject) header.from=yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1668418469; bh=ZvoqJnroVU94IvV20zoBOyF3dhKpqrH8zl1NcgrmMEE=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From:Subject:Reply-To; b=VGvjgKv9LNSDfb2RNxZSMgBbHtWkNsNK3pHCAHXhijbwySfZuvZlwsUf2w3yiKVbDSDHy3B14LevTa+jLeTzbGd7u02ZE3VX/O4ZMFzlayQseA/16W44ZfSmhZyUDfgMEv5s7iWdq/s90IjQMm2ykmJ18XbBD9PLjamOxtYG2UTKVzg4YaWijJBpFTvdRO24T5Cio2b4H5ctmcEcfUzqZ2qkPM5+xCgrTx8VolGQCbUTOLGHsxpZg7acd2LK7QD8PjveeG3K2lCXUh4Nk1Sh2lvCp0Wuq7FrxgfBhy7J3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jDQq4uGzUXR3HX_cgLWgemz4eXnx5T3qTtuk3w5FFtyikbPSELJwNlS424.fz3qu4Af Ezanj2O827Fy_8ktXHR0oTxd0usZfL3vu6hHsKg8WrNOrdu4IcYiUtTMLbDyOyvmvyH1jEBQX23d nZw_pUW_ILYYNgw1o3V4dp8UU1tELSBrsSSf9V5mrI3dtmWixcZZZdjKy7JgT7nMTwZOJpq8g2yi Y9MQjjniFQBxkUqtIWwH93ij9Xts8GX.723WloeAXRZ8SLiUGAof0ziVEex8BZkWFoV2HrlU5nyb bVbLrHKoGunFlkcAAG9Iwh0DqgS_0F2OW2JI.xrpeoObHg_ITIxl6mk0VMQNPY1voAzXXJTX6uLa KJzdOTV0CCo995SGxBDSzHXEP6Ej80n9zhWuNpV..KOHPweAWJUIAkZKIBYuvP6kuls3XgRmf2IJ rj8EgAgsZqFSLHAy9XDpElXzxaB6xxkxiONnCz3Zv2gsxGKvFYE4l9nBAnTMQqjdPdoYtsj8eD4n uGsWY1qRftxsS_1rMxBAIKLJtv7b8x9OOeSdRvwS1OitrZ5OMeD6CJlp71Uvkk4xuHQ6hxho3erA EatPx2f0md4HtFXOko4g29qTLDO.tfJX6CcLVDGnP.3bpZ16G4kBqz20CxjslcPVRtqQKAGERxwy UtUouXCNCvSUfyRwqbNlBFF9YeO.wzh7wE8Nfnr9W8mABdU31gjVape2UpVPFOn3txa.0XPqf75t nP2xhWQ-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.gq1.yahoo.com with HTTP; Mon, 14 Nov 2022 09:34:29 +0000 Received: by hermes--production-bf1-5878955b5f-kkjj4 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID c755d50069d4ce5586cddd925e6d76e2; Mon, 14 Nov 2022 09:34:26 +0000 (UTC) Content-Type: text/plain; charset=utf-8 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) Subject: Re: I could use some help From: Mark Millard In-Reply-To: <8F50D6A9-0BC2-4BCF-9E1B-D7C9F4C42F0A@yahoo.com> Date: Mon, 14 Nov 2022 01:34:13 -0800 Cc: Mark Johnston Content-Transfer-Encoding: quoted-printable Message-Id: <269A1184-D943-42AB-9B4C-0E6D93178139@yahoo.com> References: <8F50D6A9-0BC2-4BCF-9E1B-D7C9F4C42F0A@yahoo.com> To: crb@chrisbowman.com, FreeBSD Hackers X-Mailer: Apple Mail (2.3731.200.110.1.12) X-Spamd-Result: default: False [0.08 / 15.00]; NEURAL_SPAM_SHORT(0.58)[0.577]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; MIME_GOOD(-0.10)[text/plain]; FROM_EQ_ENVFROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; RCVD_IN_DNSWL_NONE(0.00)[98.137.66.148:from]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim] X-Rspamd-Queue-Id: 4N9kfb3FL8z3Gnh X-Spamd-Bar: / X-ThisMailContainsUnwantedMimeParts: N My understanding is that HS400 and HS200 requires "tuining the phase" to be supported and this involves CMD21 to generate test patterns used for the tuning process. = https://lists.freebsd.org/archives/freebsd-hackers/2022-November/001648.ht= ml reports: mmc0: CMD7 RESULT: 1 mmc0: CMD7 failed, RESULT: 1 sdhci_fdt0-slot0: sdhci_generic_write_ivar: var=3D0 mmc0: setting transfer rate to 50.000MHz (HS400 with enhanced strobe = timing) mmc0: REQUEST: CMD7 arg 0 flags 0 but shows not even one CMD21: no actual tuning for HS400 (or HS200) was done. An old quote of mine was: QUOTE HS400 needs CMD21 use for synchronizing the command responses on the CMD line to the CLK (a temporary use of HS200 mode to do the tuning). . . . But there is more context that I should have referenced: For HS400, when Enhanced Strobe is disabled, the CMD-out line (from device to host) has no matching strobe to go with it in any fixed signal-timing relationship from what I've read. . . . (Data Out and CRC Response always are synced to the Strobe.) END QUOTE This issue exists on Rock64 and in an exchange about that Andriy Gapon wrote: QUOTE On 2021-Dec-10, at 02:35, Andriy Gapon wrote: > On 10/12/2021 11:51, Kornel Dul=C4=99ba wrote: >> On Thu, Dec 9, 2021 at 11:54 PM Mark Millard = wrote: >>> Note the "tuned phase to 245" as part of that. >> Yep, it looks like in Linux they're doing some custom tuning logic >> specific to this controller. >> FreeBSD only executes generic tuning code, which apparently is not = enough. >=20 >=20 > AFAICS, we do not have any support for setting clock phases at all. END QUOTE I came to the same conclusion that there is not such thing as generic tuning involved and there is no support for any specific controller for the tuning needed for HS200 and HS400. (There is also a Drive Strength setting involved for HS200 --and HS400 has possibly one more Drive Strength alternative by count. More missing support?) I eventually got into the JEDEC standard and wrote . . . QUOTE Looking some more, it looks like the Tuning-Process-Completed-No loop for HS200 in JESD84-B51 that can involve CMD21 is implicitly always there to allow adjusting implicit parameters. Otherwise, nothing changes: CMD21 use of itself does not adjust anything. . . . In fact there is a sequence of steps listed in another place about the concept-explanation that is explicit about: Sampling Control Block of Host is incremented by one step. in the looping (along with comparisons to a known tuning block pattern). . . . It also does report that any other implementation may be used: it is just an example for illustration. Possibly using the center of an observed valid window is mentioned. So I would expect that any time there is not a device-specific definition for how to do the adjustment for the loop, HS200 and HS400 should be disabled for lack of device specific driver software to support the activity. JESD84-B51 does not define any specific method of adjustment of itself as far as I can tell: there is no general/default technique. END QUOTE This traced back to FreeBSD using null_tune and null_return, which were (from old notes): static int null_retune(device_t brdev __unused, device_t reqdev __unused, bool reset __unused) { return (0); } static int null_tune(device_t brdev __unused, device_t reqdev __unused, bool hs400 __unused) { return (0); } e.MMC support can be made operational (with a speed tradeoff) by just not picking to use HS200 or HS400 so that the tune/return activity is not involved. I use a patch for that to allow the Rock64 to use its user-replacable e.MMC . (I've no other context where I use e.MMC these days.) QUOTE What I've done in my patch is analogous to what the the code shown after the #define SDHCI_CAP_MODES_TUNING above does, translated to fit the mmc's pre-existing code structure. END QUOTE My patch to main [so: 14] looks like (some whitespace details may not survive): # git -C /usr/main-src/ diff sys/dev/mmc/ diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c index 5fce6cbf47a1..ff6896f35678 100644 --- a/sys/dev/mmc/mmc.c +++ b/sys/dev/mmc/mmc.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1512,6 +1513,8 @@ mmc_timing_to_string(enum mmc_bus_timing timing) static bool mmc_host_timing(device_t dev, enum mmc_bus_timing timing) { + kobjop_desc_t kobj_desc; + kobj_method_t *kobj_method; int host_caps; =20 host_caps =3D mmcbr_get_caps(dev); @@ -1543,14 +1546,37 @@ mmc_host_timing(device_t dev, enum = mmc_bus_timing timing) case bus_timing_mmc_ddr52: return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_DDR52)); case bus_timing_mmc_hs200: - return (HOST_TIMING_CAP(host_caps, = MMC_CAP_MMC_HS200_120) || - HOST_TIMING_CAP(host_caps, = MMC_CAP_MMC_HS200_180)); case bus_timing_mmc_hs400: - return (HOST_TIMING_CAP(host_caps, = MMC_CAP_MMC_HS400_120) || - HOST_TIMING_CAP(host_caps, = MMC_CAP_MMC_HS400_180)); case bus_timing_mmc_hs400es: - return (HOST_TIMING_CAP(host_caps, MMC_CAP_MMC_HS400 | - MMC_CAP_MMC_ENH_STROBE)); + /* + * Disable eMMC modes that require use of + * MMC_SEND_TUNING_BLOCK_HS200 to set things up if = either the + * tune or re-tune method is the default NULL = implementation. + */ + kobj_desc =3D &mmcbr_tune_desc; + kobj_method =3D = kobj_lookup_method(((kobj_t)dev)->ops->cls, NULL, + kobj_desc); + if (kobj_method =3D=3D &kobj_desc->deflt) + return (false); + kobj_desc =3D &mmcbr_retune_desc; + kobj_method =3D = kobj_lookup_method(((kobj_t)dev)->ops->cls, NULL, + kobj_desc); + if (kobj_method =3D=3D &kobj_desc->deflt) { + return (false); + } + + /* + * Otherwise track the host capabilities. + */ + if (timing =3D=3D bus_timing_mmc_hs200) + return (HOST_TIMING_CAP(host_caps, = MMC_CAP_MMC_HS200_120) || + HOST_TIMING_CAP(host_caps, = MMC_CAP_MMC_HS200_180)); + if (timing =3D=3D bus_timing_mmc_hs400) + return (HOST_TIMING_CAP(host_caps, = MMC_CAP_MMC_HS400_120) || + HOST_TIMING_CAP(host_caps, = MMC_CAP_MMC_HS400_180)); + if (timing =3D=3D bus_timing_mmc_hs400es) + return (HOST_TIMING_CAP(host_caps, = MMC_CAP_MMC_HS400 | + MMC_CAP_MMC_ENH_STROBE)); } =20 #undef HOST_TIMING_CAP =3D=3D=3D Mark Millard marklmi at yahoo.com