svn commit: r332963 - head/sys/dev/usb/serial

Emmanuel Vadot manu at FreeBSD.org
Tue Apr 24 19:11:06 UTC 2018


Author: manu
Date: Tue Apr 24 19:11:05 2018
New Revision: 332963
URL: https://svnweb.freebsd.org/changeset/base/332963

Log:
  uslcom: Both CP2104 and CP2105 can support up to 2Mbps baudrate
  
  MFC after:	1 week

Modified:
  head/sys/dev/usb/serial/uslcom.c

Modified: head/sys/dev/usb/serial/uslcom.c
==============================================================================
--- head/sys/dev/usb/serial/uslcom.c	Tue Apr 24 19:10:51 2018	(r332962)
+++ head/sys/dev/usb/serial/uslcom.c	Tue Apr 24 19:11:05 2018	(r332963)
@@ -612,7 +612,22 @@ uslcom_cfg_set_rts(struct ucom_softc *ucom, uint8_t on
 static int
 uslcom_pre_param(struct ucom_softc *ucom, struct termios *t)
 {
-	if (t->c_ospeed <= 0 || t->c_ospeed > 921600)
+	struct uslcom_softc *sc = ucom->sc_parent;
+	uint32_t maxspeed;
+
+	switch (sc->sc_partnum) {
+	case USLCOM_PARTNUM_CP2104:
+	case USLCOM_PARTNUM_CP2105:
+		maxspeed = 2000000;
+		break;
+	case USLCOM_PARTNUM_CP2101:
+	case USLCOM_PARTNUM_CP2102:
+	case USLCOM_PARTNUM_CP2103:
+	default:
+		maxspeed = 921600;
+		break;
+	}
+	if (t->c_ospeed <= 0 || t->c_ospeed > maxspeed)
 		return (EINVAL);
 	return (0);
 }


More information about the svn-src-all mailing list