Created attachment 190665 [details] proposed patch for high baudrate support 1., Current uplcom module supports only the pre-defined baud rates, because free baudrate setting requires a divisor calculating formula. The product page of the vendor refers to the Linux module source as a reference application (http://lxr.free-electrons.com/source/drivers/usb/serial/pl2303.c), in which the formula is implemented clearly. (The baseline frequency constant is about 1/1000 off from the one actually used by the binary drivers though.) After porting the formula, the baud rate can be set to any arbitrary value. 2., The current chip type detection is kind of black magic, while the ID values of the bcdDevice[0] are officially documented in the product datasheets (http://www.prolific.com.tw/US/ShowProduct.aspx?pcid=41&showlevel=0017-0037-0041) The current detection could not identify the type HXD chips, so disables the baud rates above 6 Mbaud, while the chip supports up to 12Mbaud. 3., The current interrupt callback doesn't process neither the overrun/parity/frame/break error flags, nor the RI and DSR status flags. As I needed the high bitrates, ported the baudrate formula from the Linux code , please decide if it is legal or not, there already was a "Determine the chip type. This algorithm is taken from Linux." comment in the code. I also checked the formula against the values used by the binary driver and corrected the baseline frequency. Also checked the so-called standard baudrates (that shall work by directly writing them to dwDTERate register) on a PL2303HX, and removed the non-working ones. (For those who want to play with the values: writing 0xf0-s with 8bit no parity produces one square wave per 10 bits (1 start, 8 data, 1 stop), so measuring the freqency on TxD gives 1/10th of the actual baud rate :D) I've attached the patch, the changed file (for an easier review) and the small freqency test I used. NOTE: I have only a PL2303HX (bcdDevice[0]==3) at hand now, so it would be great if someone with other models could test at least the detection code.
Created attachment 190666 [details] modified file for easier review
Created attachment 190667 [details] pattern generator for frequency measurements
Confirming that this fixes 1.5M baud rate (as used by Rockchip devices) on PL2303HX.
Hi, Can I bug you to shuffle this over to Phabricator [0] and tag myself (@kevans) and @hselasky to start with? Refer to [1] for creating a revision on Phabricator -- notably, please do include the full context. Thanks, Kyle Evans [0] https://reviews.freebsd.org [1] https://wiki.freebsd.org/Phabricator#Create_a_Revision
(In reply to Kyle Evans from comment #4) Hi, Here's the revision link: https://reviews.freebsd.org/D16639 I hope I did it according to the process. I haven't used Phabricator before, so if I missed something, please give a hint how to do it right :). Regards, Gabor Simon
A commit references this bug: Author: hselasky Date: Mon Oct 22 11:58:31 UTC 2018 New revision: 339587 URL: https://svnweb.freebsd.org/changeset/base/339587 Log: Added support for formula-based arbitrary baud rates, in contrast to the current fixed values, which enables use of rates above 1 Mbps. Improved the detection of HXD chips, and the status flag handling as well. Submitted by: Gabor Simon <gabor.simon75@gmail.com> PR: 225932 Differential revision: https://reviews.freebsd.org/D16639 MFC after: 1 week Sponsored by: Mellanox Technologies Changes: head/sys/dev/usb/serial/uplcom.c
Will MFC later.
A commit references this bug: Author: hselasky Date: Mon Oct 29 12:08:15 UTC 2018 New revision: 339851 URL: https://svnweb.freebsd.org/changeset/base/339851 Log: MFC r339587: Added support for formula-based arbitrary baud rates, in contrast to the current fixed values, which enables use of rates above 1 Mbps. Improved the detection of HXD chips, and the status flag handling as well. Submitted by: Gabor Simon <gabor.simon75@gmail.com> PR: 225932 Approved by: re (kib) Differential revision: https://reviews.freebsd.org/D16639 Sponsored by: Mellanox Technologies Changes: _U stable/12/ stable/12/sys/dev/usb/serial/uplcom.c
A commit references this bug: Author: hselasky Date: Mon Oct 29 12:10:07 UTC 2018 New revision: 339852 URL: https://svnweb.freebsd.org/changeset/base/339852 Log: MFC r339587: Added support for formula-based arbitrary baud rates, in contrast to the current fixed values, which enables use of rates above 1 Mbps. Improved the detection of HXD chips, and the status flag handling as well. Submitted by: Gabor Simon <gabor.simon75@gmail.com> PR: 225932 Differential revision: https://reviews.freebsd.org/D16639 Sponsored by: Mellanox Technologies Changes: _U stable/11/ stable/11/sys/dev/usb/serial/uplcom.c
A commit references this bug: Author: hselasky Date: Mon Oct 29 12:11:28 UTC 2018 New revision: 339853 URL: https://svnweb.freebsd.org/changeset/base/339853 Log: MFC r339587: Added support for formula-based arbitrary baud rates, in contrast to the current fixed values, which enables use of rates above 1 Mbps. Improved the detection of HXD chips, and the status flag handling as well. Submitted by: Gabor Simon <gabor.simon75@gmail.com> PR: 225932 Differential revision: https://reviews.freebsd.org/D16639 Sponsored by: Mellanox Technologies Changes: _U stable/10/ stable/10/sys/dev/usb/serial/uplcom.c
A commit references this bug: Author: hselasky Date: Mon Oct 29 12:13:05 UTC 2018 New revision: 339854 URL: https://svnweb.freebsd.org/changeset/base/339854 Log: MFC r339587: Added support for formula-based arbitrary baud rates, in contrast to the current fixed values, which enables use of rates above 1 Mbps. Improved the detection of HXD chips, and the status flag handling as well. Submitted by: Gabor Simon <gabor.simon75@gmail.com> PR: 225932 Differential revision: https://reviews.freebsd.org/D16639 Sponsored by: Mellanox Technologies Changes: _U stable/9/sys/ stable/9/sys/dev/usb/serial/uplcom.c