Re: [PATCH v2 2/2] serial: earlycon: allow to specify uartclk in earlycon kernel-parameter

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

 



On Tue, Oct 20, 2015 at 8:20 PM, Masahiro Yamada
<yamada.masahiro@xxxxxxxxxxxxx> wrote:
> Hi Peter,
> (+ Rob Herring, Stefan Agner)
>
> 2015-10-20 23:00 GMT+09:00 Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>:
>> On 10/19/2015 11:36 PM, Masahiro Yamada wrote:
>>> The input clock frequency varies from device to device, but the
>>> earlycon uses the fixed frequency (BASE_BAUD * 16).  It makes
>>> impossible to set the correct divisor to the register.
>>
>> So the bootloader hasn't setup the serial port?
>
> It does.
> I use U-boot and the serial port is already set up by U-boot.

This problem is now moving into u-boot which is using DT for configuration.

> But, earlycon setup functions update hardware registers.
> See  early_serial8250_setup(), ingenic_early_console_setup(), etc.
>
>
> Without port->uartclk set to a valid value,
> the init code in earlycon setup does not make sense.
>
>
> What I want to clarify is,
> what should we do in the earlycon setup function?
>
> Currently, I see
>  [1] set device->con->write callback
>  [2] initialize UART port registers
>
>
> For [2], we need to know baudrate and input clock frequency.
> (and the latter is missing, that's why my patch is here.)

I'm missing context of what you did, but it needs to be parse-able
from a flattened tree. My suggestion would be use clock-frequency
property in the uart node. We should be able to parse that. This came
up with u-boot as well[1].


> In order to be independent of a boot loader, we also need
>   [3]  pinctrl (pin-muxing)

We have to draw the line somewhere and I think this falls below it.
What if we have to turn on a regulator for the pins or RS-232
transceiver, turn on power domain, take peripheral out of reset, and
the list goes on... Hopefully a debug path would never be that
complicated.

> But, it is difficult to handle pinctrl in the earlycon framework.

earlycon is for debug. Either fix your bootloader or you need some
platform specific setup hacks to get the h/w in a working state if you
need to debug.

Rob

[1] https://patchwork.ozlabs.org/patch/492697/
--
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