On Fri, May 19, 2017 at 08:17:50PM +0200, Mark Kettenis wrote:
> The "official" Firefly-RK3399 firmware use a baudrate of 1.5 Mbps.
> This is somewhat annoying (OpenBSD/arm64 expects the console to run at
> 115200 bps) and I plan to provide firmware images that use the
> standard rate instead.  But until I figure out how to properly build
> ATF (ARM Trusted Firmware) for the board, I'm stuck with 1.5 MBps.
> 
> The Firefly-RK3399 board that was donated to me came with a little
> serial-to-USB converter board that containst a Silican Labs CP2104
> chip.  This chip is supported by uslcom(4), but that drivers limits
> the baudrate to speeds up to 921600.  But the chip defenitely supports
> the higher rates.
> 
> Turns out the older CP2101/2/3 chips only support speeds up to 921600
> bps, but later chips support speeds up to 2 Mbps.  The diff below
> raises the limit to 2 Mbps.  This allows me to connect to the board.  
> 
> I'm not sure what happens if you try to configure speeds above 921600
> for the older chips.  My guess would be that the USLCOM_SET_BAUD_RATE
> command will fail, but maybe it will simply pick a supported speed.  I
> don't think that's a big issue and it's not really worth trying to
> figure out which of the supported devices don't support the high
> rates,
> 
> ok?
> 
> 
> Index: uslcom.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/uslcom.c,v
> retrieving revision 1.39
> diff -u -p -r1.39 uslcom.c
> --- uslcom.c  2 Sep 2016 09:14:59 -0000       1.39
> +++ uslcom.c  19 May 2017 18:12:19 -0000
> @@ -438,7 +438,7 @@ uslcom_param(void *vsc, int portno, stru
>       uint32_t baudrate, flowctrl[4];
>       int data;
>  
> -     if (t->c_ospeed <= 0 || t->c_ospeed > 921600)
> +     if (t->c_ospeed <= 0 || t->c_ospeed > 2000000)
>               return (EINVAL);
>  
>       baudrate = t->c_ospeed;
> 

Command doesn't fail on older chips though I doubt they actually run at
2000000 in the end.

uslcom0 at uhub3 port 2 configuration 1 interface 0 "Silicon Labs CP2102 USB to 
UART Bridge Controller" rev 1.10/1.00 addr 5
ucom0 at uslcom0 portno 0

before:

# cu -l cuaU0 -s 2000000
cu: tcsetattr: Invalid argument

after:

# cu -l cuaU0 -s 2000000
Connected to /dev/cuaU0 (speed 2000000)

Anyway this is worth doing, perhaps add a note in uslcom(4) about
which hardware can only do 921600 and which tops out at 2000000.

ok jsg@

Attached a port that builds a rk3399 atf bl31.bin, no idea what it puts
out on serial, perhaps that would require switching from release to
debug.

Attachment: arm-trusted-firmware.tgz
Description: application/tar-gz

Reply via email to