With the same Kernel, I can connect and run a FTDI USB-232 IC and I can setup the driver for 250k as below. The same type of tty configuration does not work with the APQ8016.
root@linaro-developer:~# apt-get install setserial
root@linaro-developer:~# setserial -a /dev/ttyUSB0 spd_cust
root@linaro-developer:~# setserial -a /dev/ttyUSB0 divisor 96
root@linaro-developer:~# stty cs8 -parenb cstopb -F /dev/ttyUSB0 38400
root@linaro-developer:~# setserial -a /dev/ttyUSB0
/dev/ttyUSB0, Line 0, UART: unknown, Port: 0x0000, IRQ: 0
Baud_base: 24000000, close_delay: 0, divisor: 96
closing_wait: infinite
Flags: spd_cust low_latency
stty: /dev/ttyUSB0: unable to perform all requested operations
root@linaro-developer:~# stty -F /dev/ttyUSB0
speed 0 baud; line = 0;
-brkint -imaxbel
root@linaro-developer:~# echo "Hello World" > /dev/ttyUSB0
Trying the same configuration on the APQ_8016, the first error is that spd_cust is deprecated for msm_serial.
root@linaro-developer:~# apt-get install setserial
root@linaro-developer:~# setserial -av /dev/ttyMSM1 spd_cust
[ 491.312449] msm_serial 78af000.serial: setserial sets custom speed on ttyMSM1. This is deprecated.
/dev/ttyMSM1, Line 1, UART: undefined, Port: 0x0000, IRQ: 137
Baud_base: 230400, close_delay: 50, divisor: 0
closing_wait: 3000
Flags: spd_cust
Setting the baudrate to 500000, which is a legitimate baudrate from kernel/drivers/tty/tty_ioctl.c sets without error, but the actual baudrate of the ttyMSM1 is 921600 (rounding to nearest). Setting the baudrate to 1000000 (1M) does select the correct baudrate.
root@linaro-developer:~# stty -F /dev/ttyMSM1 500000
root@linaro-developer:~# echo "Hello World" > /dev/ttyMSM1
root@linaro-developer:~# stty -F /dev/ttyMSM1 1000000
root@linaro-developer:~# echo "Hello World" > /dev/ttyMSM1
The 1M baudrate is promising that 250k might be possible with the right divisor but selecting the 38400 custom baudrate setting does not have the desired response (is deprecated).
kernel/drivers/tty/serial/serial_core.c
/*
* Old custom speed handling.
*/
if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
quot = port->custom_divisor;
else
quot = DIV_ROUND_CLOSEST(port->uartclk, 16 * baud);
return quot;
...
Any advice where to start with the kernel modifications, or whether a 250k baudrate is supported by the APQ8016 or APQ8016/Linux combination.
Thanks.