[U-Boot] [PATCH v4 2/6] serial: add UniPhier serial driver

Simon Glass sjg at chromium.org
Fri Sep 5 18:41:54 CEST 2014


Hi Masahiro,

On 5 September 2014 06:03, Masahiro Yamada <yamada.m at jp.panasonic.com> wrote:
> Hi Marek,
>
>
>
> On Fri, 5 Sep 2014 12:35:18 +0200
> Marek Vasut <marex at denx.de> wrote:
>
>> On Friday, September 05, 2014 at 07:50:19 AM, Masahiro Yamada wrote:
>> > The driver for on-chip UART used on Panasonic UniPhier platform.
>> >
>> > Signed-off-by: Masahiro Yamada <yamada.m at jp.panasonic.com>
>>
>> [...]
>>
>> Hi!
>>
>> > +static void uniphier_serial_putc(struct uniphier_serial *port, const char
>> > c) +{
>> > +   if (c == '\n')
>> > +           uniphier_serial_putc(port, '\r');
>>
>> Just curious, but what is the concensus about inserting \r upon \n ? Shouldn't
>> this be something that the "upper layers" do consistently ? I recall seeing this
>> in some drivers and not seeing this in the others, so I wonder why this is like
>> so ...
>
>
> This converts "\n" to "\r\n".
>
> Without this conversion, CarriageReturn is not provided,
> which means the cursor goes to the next line, but
> column position does not change.
>
>
> For example,
>
> printf("Hello\nWorld\n");
>
> will be displayed on (at least my) terminal emulator like this:
>
>
> Hello
>      World
>
>
> With the conversion code, it will be displaye as follows:
>
> Hello
> World
>
>
>
> Perhaps the behavior might depend on
> which therminal emulator you are using.
> (also depend on the preference
> how LF and CR are handled.)
>
>
>
> Maybe we can move  "\n -> \r\n" logic
> to the upper layer and allow users to enable/disable it
> with a CONFIG_ option.

Do you think we could use driver model instead? We have the serial
infrastructure in place and I will likely merge it next week.

It moves the \r\n logic to a higher level.

It also removes the need for all the horrible #define stuff you have
here to deal with multiple serial ports.

Does your board have SPL? If so, does it use serial in SPL?

Regards,
Simon


More information about the U-Boot mailing list