From owner-svn-src-all@FreeBSD.ORG Sun Aug 8 20:53:01 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04163106564A; Sun, 8 Aug 2010 20:53:01 +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 E76E18FC15; Sun, 8 Aug 2010 20:53:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78Kr01C074949; Sun, 8 Aug 2010 20:53:00 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78Kr0oW074947; Sun, 8 Aug 2010 20:53:00 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201008082053.o78Kr0oW074947@svn.freebsd.org> From: Gavin Atkinson Date: Sun, 8 Aug 2010 20:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211083 - head/sys/dev/usb/serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 20:53:01 -0000 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 (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