From owner-svn-src-stable@FreeBSD.ORG Mon Aug 27 13:50:02 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0C2B3106566B; Mon, 27 Aug 2012 13:50:02 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE04C8FC0A; Mon, 27 Aug 2012 13:50:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7RDo1qe006184; Mon, 27 Aug 2012 13:50:01 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7RDo1vn006182; Mon, 27 Aug 2012 13:50:01 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201208271350.q7RDo1vn006182@svn.freebsd.org> From: Gavin Atkinson Date: Mon, 27 Aug 2012 13:50:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239731 - stable/8/sys/dev/usb/serial X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 13:50:02 -0000 Author: gavin Date: Mon Aug 27 13:50:01 2012 New Revision: 239731 URL: http://svn.freebsd.org/changeset/base/239731 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/8/sys/dev/usb/serial/uslcom.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) Modified: stable/8/sys/dev/usb/serial/uslcom.c ============================================================================== --- stable/8/sys/dev/usb/serial/uslcom.c Mon Aug 27 13:22:27 2012 (r239730) +++ stable/8/sys/dev/usb/serial/uslcom.c Mon Aug 27 13:50:01 2012 (r239731) @@ -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"); }