From nobody Wed Nov 05 14:40:41 2025 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 4d1p0B0VCpz6GPyC; Wed, 05 Nov 2025 14:40:42 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d1p096yDbz4J98; Wed, 05 Nov 2025 14:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762353642; 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=RPlwTVA9NGemoUhjEYyNaSu6MMhEcMl3Y47jvrpgXaQ=; b=ZljDPBoubtYrj6QWbUHBj9nfkIy3vjqSZcpyZb41tOuaDfArREPvvoKguN2ewdpBg5i2Ct siq/w7G64l5Zjcnsxd7qF125O+LGtqLRm6NF4CBWIC1HHjj6GA5erzEPcKDcudzirdizoJ k9m0ooVu8vlQZKFq/NsrRwo+uDrwkyzG+svClMcvg3oOg3NdjiOIpVImIvVO0ggaJFvAJX KdGNYSq8YX4x7TPUqBzJwgGSeNCwwqmrzst5eSQJPZ81+bXIC4e3OHQoMcn/ADvcwVBW3g 78ZD4IpryKTU0ksxOzh0X9q2X4c4D00ZzSz9zMHpD4NJHKKzc61sMOsl7lJgSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762353642; 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=RPlwTVA9NGemoUhjEYyNaSu6MMhEcMl3Y47jvrpgXaQ=; b=lDIQydSxVe7LomRlL37+oDgpl2xc6ebMudRlw5sEEtibq4cLNIP6xsd0xv+tZVwXRDJuBs 9A8a8+MiR0/OwDFxiAVzcj1QorFT/7Bewi+1v5VBUBv7vFtLzKTGqLeprpxDc/MpwtyK0b imLm3TBhDeVY7BFcgc35jVRlEKKUKTmWRyNGxBp+I+NoeBeY4giAqgq5ftBn1c3rnmwZ1L TBm8NMdMS7w1g7jaDpi7waj3J5kC1TFkAAuh57lTZvsRCIA3v0koB25/you+9mhau515Qv w+QOamzhUFVQkcKn2GIiikk/8myCxhL8YpJGiZfLFZOCUuOR8lVkFUTOfH8EVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1762353642; a=rsa-sha256; cv=none; b=raH4aKiVLpfPOmGO4s238vWn44TkG5PUwsLnKWZVgjQ0VyOGO4G1oIgt9ZsvKYGxiFiHjv Sbxdl1bm/IJDobzTE5awnVXCcwiPhv0QcI+TiNXWwLfnRTXN/SKBdYtJ6bIyVoJybr4XuL nWGxWKIUG6zknQ1D+RVIe2soyX9Rowg3VBej9VgWjuvGcX0KDZsS6xe0lt+emo5pokpjuj Z4+Y+GGo8wSo+h5BdbLNeKsiKBmdCinGzmv7WbPDwPa4WuQ3Tcacc8KNxMBb+5KzlUE+BS I5oU+SeQnQPwfRg0dfIOS3mHAgOabSFpuiuE7K7QXv5b7hVcX1cY35OKyZovKA== 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 4d1p096Gfcznpx; Wed, 05 Nov 2025 14:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5A5Eefew029432; Wed, 5 Nov 2025 14:40:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5A5Eefq1029429; Wed, 5 Nov 2025 14:40:41 GMT (envelope-from git) Date: Wed, 5 Nov 2025 14:40:41 GMT Message-Id: <202511051440.5A5Eefq1029429@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 768ee6d45482 - main - mmc_fdt: handle broken-cd property 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 768ee6d454821cc63247cb4ffe526c5a06accff0 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=768ee6d454821cc63247cb4ffe526c5a06accff0 commit 768ee6d454821cc63247cb4ffe526c5a06accff0 Author: Mitchell Horne AuthorDate: 2025-11-05 14:37:36 +0000 Commit: Mitchell Horne CommitDate: 2025-11-05 14:40:34 +0000 mmc_fdt: handle broken-cd property The documented properties [1] for card-detection are one of: - cd-gpios - non-removable - broken-cd In cd_setup() we handle the first two, but not the latter, resulting in a silently undetected card on an affected system. To work around this, force cd_disabled when broken-cd is specified, so that the card detect helper function gets to run. A more complete solution would implement some kind of polling mechanism to detect the card's presence or removal. Some variants of the Allwinner D1, such as the Lichee Rv, specify this property in the mmc0 device node. [1] sys/contrib/device-tree/Bindings/mmc/mmc-controller.yaml Reported by: Haowu Ge Tested by: Haowu Ge Reviewed by: imp, manu, mmel MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D53546 --- sys/dev/mmc/mmc_fdt_helpers.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/dev/mmc/mmc_fdt_helpers.c b/sys/dev/mmc/mmc_fdt_helpers.c index aed85dab55f4..980785464a00 100644 --- a/sys/dev/mmc/mmc_fdt_helpers.c +++ b/sys/dev/mmc/mmc_fdt_helpers.c @@ -159,6 +159,17 @@ cd_setup(struct mmc_helper *helper, phandle_t node) return; } + /* + * If the device has no card-detection, treat it as non-removable. + * This could be improved by polling for detection. + */ + if (helper->props & MMC_PROP_BROKEN_CD) { + helper->cd_disabled = true; + if (bootverbose) + device_printf(dev, "Broken card-detect\n"); + return; + } + /* * If there is no cd-gpios property, then presumably the hardware * PRESENT_STATE register and interrupts will reflect card state