Author: gavin
Date: Sun Aug  8 20:53:00 2010
New Revision: 211083
URL: http://svn.freebsd.org/changeset/base/211083

Log:
  The PL2302X can support any baud rate <= 6Mbps, allow any rate to be set.
  
  PR:           usb/128324
  Submitted by: Mike Durian <durian shadetreesoftware.com> (original patch)
  MFC after:    2 weeks

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

Modified: head/sys/dev/usb/serial/uplcom.c
==============================================================================
--- head/sys/dev/usb/serial/uplcom.c    Sun Aug  8 20:34:53 2010        
(r211082)
+++ head/sys/dev/usb/serial/uplcom.c    Sun Aug  8 20:53:00 2010        
(r211083)
@@ -599,25 +599,33 @@ static const int32_t uplcom_rates[] = {
 static int
 uplcom_pre_param(struct ucom_softc *ucom, struct termios *t)
 {
+       struct uplcom_softc *sc = ucom->sc_parent;
        uint8_t i;
 
        DPRINTF("\n");
 
-       /* check requested baud rate */
-
-       for (i = 0;; i++) {
-
-               if (i != N_UPLCOM_RATES) {
-                       if (uplcom_rates[i] == t->c_ospeed) {
-                               break;
-                       }
-               } else {
-                       DPRINTF("invalid baud rate (%d)\n", t->c_ospeed);
-                       return (EIO);
+       /**
+        * Check requested baud rate.
+        *
+        * The PL2303 can only set specific baud rates, up to 1228800 baud.
+        * The PL2303X can set any baud rate up to 6Mb.
+        * The PL2303HX rev. D can set any baud rate up to 12Mb.
+        *
+        * XXX: We currently cannot identify the PL2303HX rev. D, so treat
+        *      it the same as the PL2303X.
+        */
+       if (sc->sc_chiptype == TYPE_PL2303) {
+               for (i = 0; i < N_UPLCOM_RATES; i++) {
+                       if (uplcom_rates[i] == t->c_ospeed)
+                               return (0);
                }
+       } else {
+               if (t->c_ospeed <= 6000000)
+                       return (0);
        }
 
-       return (0);
+       DPRINTF("uplcom_param: bad baud rate (%d)\n", t->c_ospeed);
+       return (EIO);
 }
 
 static void
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to