svn commit: r239732 - stable/9/sys/dev/usb/serial

Gavin Atkinson gavin at FreeBSD.org
Mon Aug 27 14:44:41 UTC 2012


Author: gavin
Date: Mon Aug 27 14:44:40 2012
New Revision: 239732
URL: http://svn.freebsd.org/changeset/base/239732

Log:
  Merge r238778 from head:
  
    The baud rate on CP1201/2/3 devices can be set in one of two ways:
     - The USLCOM_SET_BAUD_DIV command (0x01)
     - The USLCOM_SET_BAUD_RATE command (0x13)
  
    Devices based on the CP1204 will only accept the latter command, and ignore
    the former.  As the latter command works on all chips that this driver
    supports, switch to always using it.
  
    A slight confusion here is that the previously used command was incorrectly
    named USLCOM_BAUD_RATE - even though we no longer use it, rename it to
    USLCOM_SET_BAUD_DIV to closer match the name used in the datasheet.
  
    This change reflects a similar change made in the Linux driver, which was
    submitted by preston.fick at silabs.com, and has been tested on all of the
    uslcom(4) devices I have to hand.

Modified:
  stable/9/sys/dev/usb/serial/uslcom.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/serial/uslcom.c
==============================================================================
--- stable/9/sys/dev/usb/serial/uslcom.c	Mon Aug 27 13:50:01 2012	(r239731)
+++ stable/9/sys/dev/usb/serial/uslcom.c	Mon Aug 27 14:44:40 2012	(r239732)
@@ -70,12 +70,13 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, deb
 
 /* Request codes */
 #define	USLCOM_UART		0x00
-#define	USLCOM_BAUD_RATE	0x01	
+#define	USLCOM_SET_BAUD_DIV	0x01	
 #define	USLCOM_DATA		0x03
 #define	USLCOM_BREAK		0x05
 #define	USLCOM_CTRL		0x07
 #define	USLCOM_RCTRL            0x08
 #define	USLCOM_SET_FLOWCTRL     0x13
+#define	USLCOM_SET_BAUD_RATE	0x1e	
 #define	USLCOM_VENDOR_SPECIFIC	0xff
 
 /* USLCOM_UART values */
@@ -92,8 +93,8 @@ SYSCTL_INT(_hw_usb_uslcom, OID_AUTO, deb
 #define	USLCOM_CTRL_RI          0x0040
 #define	USLCOM_CTRL_DCD		0x0080
 
-/* USLCOM_BAUD_RATE values */
-#define	USLCOM_BAUD_REF		0x384000
+/* USLCOM_SET_BAUD_DIV values */
+#define	USLCOM_BAUD_REF		3686400 /* 3.6864 MHz */
 
 /* USLCOM_DATA values */
 #define	USLCOM_STOP_BITS_1	0x00
@@ -511,19 +512,20 @@ uslcom_param(struct ucom_softc *ucom, st
 {
 	struct uslcom_softc *sc = ucom->sc_parent;
 	struct usb_device_request req;
-	uint32_t flowctrl[4];
+	uint32_t baudrate, flowctrl[4];
 	uint16_t data;
 
 	DPRINTF("\n");
 
+	baudrate = t->c_ospeed;
 	req.bmRequestType = USLCOM_WRITE;
-	req.bRequest = USLCOM_BAUD_RATE;
-	USETW(req.wValue, USLCOM_BAUD_REF / t->c_ospeed);
+	req.bRequest = USLCOM_SET_BAUD_RATE;
+	USETW(req.wValue, 0);
 	USETW(req.wIndex, USLCOM_PORT_NO);
-	USETW(req.wLength, 0);
+	USETW(req.wLength, sizeof(baudrate));
 
-        if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, 
-	    &req, NULL, 0, 1000)) {
+	if (ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, 
+	    &req, &baudrate, 0, 1000)) {
 		DPRINTF("Set baudrate failed (ignored)\n");
 	}
 


More information about the svn-src-stable mailing list