From owner-svn-src-stable-8@FreeBSD.ORG Thu Sep 23 09:52:28 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BD4F106564A; Thu, 23 Sep 2010 09:52:28 +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 1E2A38FC0C; Thu, 23 Sep 2010 09:52:28 +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 o8N9qSGp060547; Thu, 23 Sep 2010 09:52:28 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8N9qRiu060545; Thu, 23 Sep 2010 09:52:28 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201009230952.o8N9qRiu060545@svn.freebsd.org> From: Gavin Atkinson Date: Thu, 23 Sep 2010 09:52:27 +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: r213051 - stable/8/sys/dev/usb/serial X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2010 09:52:28 -0000 Author: gavin Date: Thu Sep 23 09:52:27 2010 New Revision: 213051 URL: http://svn.freebsd.org/changeset/base/213051 Log: Merge r211083 from head: The PL2302X can support any baud rate <= 6Mbps, allow any rate to be set. PR: usb/128324 Submitted by: Mike Durian (original patch) Modified: stable/8/sys/dev/usb/serial/uplcom.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/serial/uplcom.c ============================================================================== --- stable/8/sys/dev/usb/serial/uplcom.c Thu Sep 23 09:05:40 2010 (r213050) +++ stable/8/sys/dev/usb/serial/uplcom.c Thu Sep 23 09:52:27 2010 (r213051) @@ -597,25 +597,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