Date: Fri, 24 Jul 2020 23:26:43 +0200 From: Gordon Bergling <gbe@freebsd.org> To: Ilya Bakulin <kibab@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r363497 - head/sbin/camcontrol Message-ID: <20200724212643.GA68779@lion.0xfce3.net> In-Reply-To: <202007242114.06OLExIJ032705@repo.freebsd.org> References: <202007242114.06OLExIJ032705@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--8t9RHnE3ZwKMSgU+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Thanks, this will become very handy when working on IO infrastructure. --Gordon On Fri, Jul 24, 2020 at 09:14:59PM +0000, Ilya Bakulin wrote: > Author: kibab > Date: Fri Jul 24 21:14:59 2020 > New Revision: 363497 > URL: https://svnweb.freebsd.org/changeset/base/363497 >=20 > Log: > Make it possible to get/set MMC frequency from camcontrol > =20 > Enhance camcontrol(8) so that it's possible to manually set frequency f= or SD/MMC cards. > While here, display more information about the current controller, such= as > supported operating modes and VCCQ voltages, as well as current VCCQ vo= ltage. > =20 > Reviewed by: manu > Approved by: imp (mentor) > Differential Revision: https://reviews.freebsd.org/D25795 >=20 > Modified: > head/sbin/camcontrol/camcontrol.c >=20 > Modified: head/sbin/camcontrol/camcontrol.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sbin/camcontrol/camcontrol.c Fri Jul 24 20:54:07 2020 (r363496) > +++ head/sbin/camcontrol/camcontrol.c Fri Jul 24 21:14:59 2020 (r363497) > @@ -190,7 +190,7 @@ static struct camcontrol_opts option_table[] =3D { > {"rescan", CAM_CMD_RESCAN, CAM_ARG_NONE, NULL}, > {"reset", CAM_CMD_RESET, CAM_ARG_NONE, NULL}, > {"cmd", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, > - {"mmcsdcmd", CAM_CMD_MMCSD_CMD, CAM_ARG_NONE, "c:a:f:Wb:l:41S:I"}, > + {"mmcsdcmd", CAM_CMD_MMCSD_CMD, CAM_ARG_NONE, "c:a:F:f:Wb:l:41S:I"}, > {"command", CAM_CMD_SCSI_CMD, CAM_ARG_NONE, scsicmd_opts}, > {"smpcmd", CAM_CMD_SMP_CMD, CAM_ARG_NONE, "r:R:"}, > {"smprg", CAM_CMD_SMP_RG, CAM_ARG_NONE, smprg_opts}, > @@ -7833,10 +7833,12 @@ mmcsdcmd(struct cam_device *device, int argc, cha= r **a > int retval; > int is_write =3D 0; > int is_bw_4 =3D 0, is_bw_1 =3D 0; > + int is_frequency =3D 0; > int is_highspeed =3D 0, is_stdspeed =3D 0; > int is_info_request =3D 0; > int flags =3D 0; > uint8_t mmc_data_byte =3D 0; > + uint32_t mmc_frequency =3D 0; > =20 > /* For IO_RW_EXTENDED command */ > uint8_t *mmc_data =3D NULL; > @@ -7873,6 +7875,10 @@ mmcsdcmd(struct cam_device *device, int argc, char= **a > case 'I': > is_info_request =3D 1; > break; > + case 'F': > + is_frequency =3D 1; > + mmc_frequency =3D strtol(optarg, NULL, 0); > + break; > case 'c': > mmc_opcode =3D strtol(optarg, NULL, 0); > if (mmc_opcode < 0) { > @@ -7978,6 +7984,23 @@ mmcsdcmd(struct cam_device *device, int argc, char= **a > return (retval); > } > =20 > + if (is_frequency) { > + struct ccb_trans_settings_mmc *cts; > + ccb->ccb_h.func_code =3D XPT_SET_TRAN_SETTINGS; > + ccb->ccb_h.flags =3D 0; > + cts =3D &ccb->cts.proto_specific.mmc; > + cts->ios.clock =3D mmc_frequency; > + cts->ios_valid =3D MMC_CLK; > + if (((retval =3D cam_send_ccb(device, ccb)) < 0) > + || ((ccb->ccb_h.status & CAM_STATUS_MASK) !=3D CAM_REQ_CMP)) { > + warn("Error sending command"); > + } else { > + printf("Parameters set OK\n"); > + } > + cam_freeccb(ccb); > + return (retval); > + } > + > // Switch bus speed instead of sending IO command > if (is_stdspeed || is_highspeed) { > struct ccb_trans_settings_mmc *cts; > @@ -8011,13 +8034,48 @@ mmcsdcmd(struct cam_device *device, int argc, cha= r **a > printf("Host OCR: 0x%x\n", cts->host_ocr); > printf("Min frequency: %u KHz\n", cts->host_f_min / 1000); > printf("Max frequency: %u MHz\n", cts->host_f_max / 1000000); > - printf("Supported bus width: "); > + printf("Supported bus width:\n"); > if (cts->host_caps & MMC_CAP_4_BIT_DATA) > printf(" 4 bit\n"); > if (cts->host_caps & MMC_CAP_8_BIT_DATA) > printf(" 8 bit\n"); > - printf("\nCurrent settings:\n"); > - printf("Bus width: "); > + > + printf("Supported operating modes:\n"); > + if (cts->host_caps & MMC_CAP_HSPEED) > + printf(" Can do High Speed transfers\n"); > + if (cts->host_caps & MMC_CAP_UHS_SDR12) > + printf(" Can do UHS SDR12\n"); > + if (cts->host_caps & MMC_CAP_UHS_SDR25) > + printf(" Can do UHS SDR25\n"); > + if (cts->host_caps & MMC_CAP_UHS_SDR50) > + printf(" Can do UHS SDR50\n"); > + if (cts->host_caps & MMC_CAP_UHS_SDR104) > + printf(" Can do UHS SDR104\n"); > + if (cts->host_caps & MMC_CAP_UHS_DDR50) > + printf(" Can do UHS DDR50\n"); > + if (cts->host_caps & MMC_CAP_MMC_DDR52_120) > + printf(" Can do eMMC DDR52 at 1.2V\n"); > + if (cts->host_caps & MMC_CAP_MMC_DDR52_180) > + printf(" Can do eMMC DDR52 at 1.8V\n"); > + if (cts->host_caps & MMC_CAP_MMC_HS200_120) > + printf(" Can do eMMC HS200 at 1.2V\n"); > + if (cts->host_caps & MMC_CAP_MMC_HS200_180) > + printf(" Can do eMMC HS200 at 1.8V\n"); > + if (cts->host_caps & MMC_CAP_MMC_HS400_120) > + printf(" Can do eMMC HS400 at 1.2V\n"); > + if (cts->host_caps & MMC_CAP_MMC_HS400_180) > + printf(" Can do eMMC HS400 at 1.8V\n"); > + > + printf("Supported VCCQ voltages:\n"); > + if (cts->host_caps & MMC_CAP_SIGNALING_120) > + printf(" 1.2V\n"); > + if (cts->host_caps & MMC_CAP_SIGNALING_180) > + printf(" 1.8V\n"); > + if (cts->host_caps & MMC_CAP_SIGNALING_330) > + printf(" 3.3V\n"); > + > + printf("Current settings:\n"); > + printf(" Bus width: "); > switch (cts->ios.bus_width) { > case bus_width_1: > printf("1 bit\n"); > @@ -8029,10 +8087,23 @@ mmcsdcmd(struct cam_device *device, int argc, cha= r **a > printf("8 bit\n"); > break; > } > - printf("Freq: %d.%03d MHz%s\n", > + printf(" Freq: %d.%03d MHz%s\n", > cts->ios.clock / 1000000, > (cts->ios.clock / 1000) % 1000, > - cts->ios.timing =3D=3D bus_timing_hs ? "(high-speed timing)" : = ""); > + cts->ios.timing =3D=3D bus_timing_hs ? " (high-speed timing)" := ""); > + > + printf(" VCCQ: "); > + switch (cts->ios.vccq) { > + case vccq_330: > + printf("3.3V\n"); > + break; > + case vccq_180: > + printf("1.8V\n"); > + break; > + case vccq_120: > + printf("1.2V\n"); > + break; > + } > return (0); > } > =20 > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" --8t9RHnE3ZwKMSgU+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEEYbWI0KY5X7yH/Fy4OQX2V8rP09wFAl8bUhFfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDYx QjU4OEQwQTYzOTVGQkM4N0ZDNUNCODM5MDVGNjU3Q0FDRkQzREMACgkQOQX2V8rP 09xREQf7Bd785gGsafHvLxLomLDLsljXnrbvILvS806SsC8Y0+x0pTo6gk2x2Dfp bjBXVJcTXtAlKUj3nd6Fd2preNx5D6MD/574ejpt6+wf/Fn4568lTSXCL0UjtjBb Ju4LpZw9LFdx5m8um7RWiTlQUlZRXWwGuFQH5mlssa3KcGB4bA4VCVWWYSBYIAGw GS81P8J1TZnlvPvk4jiWoF5TJedpvDw16v7PBHFDxMntoImgeRMWmSEjCIUPn9OR F0tzgTy93IbLpZBM7Y6oIB+phSfW0DYHLZ4xVSlTI8IRq4nOoUa6xHvhUdkUr9ER R2u6xuhmIcPN1x5BvvQMjoqoFEAYMg== =rD9G -----END PGP SIGNATURE----- --8t9RHnE3ZwKMSgU+--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200724212643.GA68779>