From nobody Fri Oct 30 07:35:54 2026 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 4jGCZL4tKpz6yP9f for ; Fri, 30 Oct 2026 07:35:54 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jGCZL46K1z4qBx for ; Fri, 30 Oct 2026 07:35:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793345754; 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=8V1Kt7i8IQKkZi3+iggg+p892PQBAn71CY8/1CSd2CQ=; b=BcKW1hTreU6jqN3idsI3aTXFyayzKpZjFXUyl5p0xtE5FjsP4UbFfbZaIg3dlvZ2U5Zpwi dSQ9cG6ATRm9vCAC3XyceomrVfLNrna6mIP/ArfZwPSdB3n6B0YG8t7zDzSi58CeXZZLzK ivTJyEPNqyOcOSdxkKF0F/IGKJFcWt12RpV8Lz1yUi6HCbk4RBgMh0uW8ofqb9svJaUBJt HY2fUbfVS0Yy7VwL4xXlbQhQqwA7wnVVMRr4ldxSfQ+vMBLSDTwa1Mnqw0g2W7xEOh0SCN QcpxAbxQmuzL5XJLEnSCTeHe5VZ8spkelxNBV3XLiVs1qGIgezRqAApCL2Z0qA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793345754; b=OnzI/WggcuOR7qrkTVuDElKJQaKDZhoTSCGIJplQk54XtzZ136IeT1xS+uxc1z7H7sGKC+ 0ny7Hap0mvF7eMDaThsiWVzHbKxKbNK/Yfq9SL7uDAo4cDf/Hj1EoqZi15ncWqrMLcIvPI HNj+F4yJPkWviTPWO94Ur+dI1g9yKoHzlGYFh5XKLI6oh4w0S7NbHdPcExeEgwPj8nCd9f J0NPxdE0lfcaXfO3prVi0OsfY7Glmw5Zn0jHytrjjC+86UpFg5bFCA82Oz/Q7E7WoOl7by qRxtNWiNkt5DDyZyaz0Xo3Z3UGDoBXFvIAbK59e1APJAARgVH3DzB2CGGVU/WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793345754; 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=8V1Kt7i8IQKkZi3+iggg+p892PQBAn71CY8/1CSd2CQ=; b=Qh2Zt7/nGqUXOkIJJP4lwMXJ4HidwX59VWhyob06f03S3Kl8VjtUxPQSyfaz0+sfN4OvHw 8Qnt1zdE/L36d0p+0ksRPLwgfYNYeycYabF3DY2YtC5flUqZQZ2Kqj9dGu0VabjTeMwlGr 7hMHMFF2S3HlHAslZxMAzx+3jkWJIBHb39dnQAKKHIkygC6e+u1MRjh3SBQyelkIzGZwJf NfpZeTaAVnFtOrCM6xRMshHNF0ocblbu/8K6Ah5cxzSnUJ8gzNQLxghvy8Oz1Kvr8Omyrd kgHnhTGmupIG+URXme3iEvd10CjNIVx2jaXCvtEOOMV7Abj7DNwyz0VqvkWcNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jGCZL3n53zHNf for ; Fri, 30 Oct 2026 07:35:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2018d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 30 Oct 2026 07:35:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 2a6580e15b62 - main - mmccam: Add a helper to change the host settings List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2a6580e15b62da11dbe728c6c4f512c15283cd49 Auto-Submitted: auto-generated Date: Fri, 30 Oct 2026 07:35:54 +0000 Message-Id: <6ae448da.2018d.79a6cc45@gitrepo.freebsd.org> The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=2a6580e15b62da11dbe728c6c4f512c15283cd49 commit 2a6580e15b62da11dbe728c6c4f512c15283cd49 Author: Emmanuel Vadot AuthorDate: 2026-10-20 17:41:01 +0000 Commit: Emmanuel Vadot CommitDate: 2026-10-30 07:35:35 +0000 mmccam: Add a helper to change the host settings The same five lines to build and send an XPT_SET_TRAN_SETTINGS request to the controller were repeated for the bus timing, bus width, VCCQ and clock changes. Add sdda_set_host_ios() and use it at those places. No functional change. Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D60921 --- sys/cam/mmc/mmc_da.c | 58 ++++++++++++++++++++-------------------------------- 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/sys/cam/mmc/mmc_da.c b/sys/cam/mmc/mmc_da.c index 3a5a7eedb4a1..aa7d876d067e 100644 --- a/sys/cam/mmc/mmc_da.c +++ b/sys/cam/mmc/mmc_da.c @@ -1030,6 +1030,22 @@ mmc_sd_switch(struct cam_periph *periph, union ccb *ccb, return (err); } +/* + * Send the host settings of the ccb (ios, with ios_valid telling which ones + * to change) to the controller. + */ +static void +sdda_set_host_ios(union ccb *ccb) +{ + + ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; + ccb->ccb_h.flags = CAM_DIR_NONE; + ccb->ccb_h.retry_count = 0; + ccb->ccb_h.timeout = 100; + ccb->ccb_h.cbfcnp = NULL; + xpt_action(ccb); +} + static int mmc_set_timing(struct cam_periph *periph, union ccb *ccb, @@ -1063,14 +1079,9 @@ mmc_set_timing(struct cam_periph *periph, /* Set high-speed timing on the host */ struct ccb_trans_settings_mmc *cts; cts = &ccb->cts.proto_specific.mmc; - ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; - ccb->ccb_h.flags = CAM_DIR_NONE; - ccb->ccb_h.retry_count = 0; - ccb->ccb_h.timeout = 100; - ccb->ccb_h.cbfcnp = NULL; cts->ios.timing = timing; cts->ios_valid = MMC_BT; - xpt_action(ccb); + sdda_set_host_ios(ccb); return (err); } @@ -1139,14 +1150,9 @@ sdda_set_bus_width(struct cam_periph *periph, union ccb *ccb, int width) /* Now card is done, set the host to the same width */ struct ccb_trans_settings_mmc *cts; cts = &ccb->cts.proto_specific.mmc; - ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; - ccb->ccb_h.flags = CAM_DIR_NONE; - ccb->ccb_h.retry_count = 0; - ccb->ccb_h.timeout = 100; - ccb->ccb_h.cbfcnp = NULL; cts->ios.bus_width = width; cts->ios_valid = MMC_BW; - xpt_action(ccb); + sdda_set_host_ios(ccb); } static inline const char @@ -1393,49 +1399,29 @@ finish_hs_tests: for (timing = bus_timing_mmc_ddr52; timing > bus_timing_normal; timing--) { if (isset(&softc->vccq_120, timing)) { /* Set VCCQ = 1.2V */ - start_ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; - start_ccb->ccb_h.flags = CAM_DIR_NONE; - start_ccb->ccb_h.retry_count = 0; - start_ccb->ccb_h.timeout = 100; - start_ccb->ccb_h.cbfcnp = NULL; cts->ios.vccq = vccq_120; cts->ios_valid = MMC_VCCQ; - xpt_action(start_ccb); + sdda_set_host_ios(start_ccb); break; } else if (isset(&softc->vccq_180, timing)) { /* Set VCCQ = 1.8V */ - start_ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; - start_ccb->ccb_h.flags = CAM_DIR_NONE; - start_ccb->ccb_h.retry_count = 0; - start_ccb->ccb_h.timeout = 100; - start_ccb->ccb_h.cbfcnp = NULL; cts->ios.vccq = vccq_180; cts->ios_valid = MMC_VCCQ; - xpt_action(start_ccb); + sdda_set_host_ios(start_ccb); break; } else { /* Set VCCQ = 3.3V */ - start_ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; - start_ccb->ccb_h.flags = CAM_DIR_NONE; - start_ccb->ccb_h.retry_count = 0; - start_ccb->ccb_h.timeout = 100; - start_ccb->ccb_h.cbfcnp = NULL; cts->ios.vccq = vccq_330; cts->ios_valid = MMC_VCCQ; - xpt_action(start_ccb); + sdda_set_host_ios(start_ccb); break; } } /* Set frequency on the controller */ - start_ccb->ccb_h.func_code = XPT_SET_TRAN_SETTINGS; - start_ccb->ccb_h.flags = CAM_DIR_NONE; - start_ccb->ccb_h.retry_count = 0; - start_ccb->ccb_h.timeout = 100; - start_ccb->ccb_h.cbfcnp = NULL; cts->ios.clock = f_max; cts->ios_valid = MMC_CLK; - xpt_action(start_ccb); + sdda_set_host_ios(start_ccb); /* Set bus width */ enum mmc_bus_width desired_bus_width = bus_width_1;