Re: [PATCH] serial: core: add support for boot console with arbitrary baud rates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Greg,

On 02/07/2016 07:19 AM, Greg KH wrote:
> On Tue, Dec 08, 2015 at 12:15:00AM +0100, Hauke Mehrtens wrote:
>> The Arduino Yun uses a baud rate of 250000 by default. The serial is
>> going over the Atmel ATmega and is used to connect to this chip.
>> Without this patch Linux wants to switch the console to 230400 Baud.
> 
> Even if you ask for it to be the other rate?

Asking for something else does not work. The serial is connected to a
ATmega32U4 and by default a program which is statically configured to a
baud rate of 250000 is running there. It should work when I replace this
program with something else.

Am I the first one who needed a strange baud rate for the boot console?

>> With this patch Linux will use the configured baud rate and not some
>> standard one which is near by.
> 
> Hm, I'm worried about this change, have you tested it on a "normal"
> system?

I have tested it on some "normal" system I think. I am also unsure about
this patch and want to get some input from the serial driver experts here.

>>
>> Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
>> ---
>>  drivers/tty/serial/serial_core.c | 13 ++++++++++---
>>  include/linux/console.h          |  1 +
>>  2 files changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
>> index def5199..fcdf258 100644
>> --- a/drivers/tty/serial/serial_core.c
>> +++ b/drivers/tty/serial/serial_core.c
>> @@ -164,6 +164,8 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
>>  	if (retval == 0) {
>>  		if (uart_console(uport) && uport->cons->cflag) {
>>  			tty->termios.c_cflag = uport->cons->cflag;
>> +			tty->termios.c_ospeed = uport->cons->baud;
>> +			tty->termios.c_ispeed = uport->cons->baud;
>>  			uport->cons->cflag = 0;
>>  		}
>>  		/*
>> @@ -1909,7 +1911,7 @@ static const struct baud_rates baud_rates[] = {
>>  	{   4800, B4800   },
>>  	{   2400, B2400   },
>>  	{   1200, B1200   },
>> -	{      0, B38400  }
>> +	{      0, BOTHER  }
>>  };
>>  
>>  /**
>> @@ -1948,10 +1950,13 @@ uart_set_options(struct uart_port *port, struct console *co,
>>  	 * Construct a cflag setting.
>>  	 */
>>  	for (i = 0; baud_rates[i].rate; i++)
>> -		if (baud_rates[i].rate <= baud)
>> +		if (baud_rates[i].rate == baud)
>>  			break;
>>  
>>  	termios.c_cflag |= baud_rates[i].cflag;
>> +	if (!baud_rates[i].rate) {
>> +		termios.c_ospeed = baud;
>> +	}
> 
> Minor nit, coding style :(

Sorry, will fix this.

> Always run your patches through scripts/checkpatch.pl please.

Hauke
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux