Re: [PATCH 6/6] tty: serial: amba-pl011: Parse bits option as 5, 6, 7 or 8 in _get_options

From: Russell King (Oracle)
Date: Tue Oct 31 2023 - 06:11:59 EST


On Tue, Oct 31, 2023 at 10:35:29AM +0100, Théo Lebrun wrote:
> Hello,
>
> On Thu Oct 26, 2023 at 4:53 PM CEST, Hugo Villeneuve wrote:
> > On Thu, 26 Oct 2023 12:41:23 +0200
> > Théo Lebrun <theo.lebrun@xxxxxxxxxxx> wrote:
> >
> > Hi,
> > I would change the commit title to better indicate that you add support
> > for bits 5 and 6, which was missing.
> >
> > Maybe "Add support for 5 and 6 bits in..." ?
> >
> > > pl011_console_get_options() gets called to retrieve currently configured
> > > options from the registers. Previously, LCRH_TX.WLEN was being parsed
> >
> > It took me some time to understand your explanation :) Maybe change
> > to:
> >
> > "Previously, only 7 or 8 bits were supported."
> >
> > > as either 7 or 8 (fallback). Hardware supports values from 5 to 8
> >
> > Add bits:
> >
> > "5 to 8 bits..."
> >
> > And indicate that this patch adds support for 5 and 6 bits.
>
> I agree the whole commit message is unclear. Let's rewrite it. What do
> you think of the following:
>
> tty: serial: amba-pl011: Allow parsing word length of 5/6 bits at console setup
>
> If no options are given at console setup, we parse hardware register
> LCRH_TX.WLEN for bits per word. We compare the value to the 7 bits
> value (UART01x_LCRH_WLEN_7). If the hardware is configured for 5, 6
> or 8 bits per word, we fallback to 8 bits.
>
> Change that behavior to parse the whole range available: from 5 to 8
> bits per word.
>
> Note that we don't add support for 5/6 bits, we only update the parsing
> of the regs (if no options are passed at setup) to reflect the current
> hardware config. The behavior will be different only if the inherited
> value (from reset/bootloader) is 5 or 6: previously we guessed 8 bits
> word length, now we guess the right value.
>
> What's your opinion on this new commit message?

There is no point in supporting 5 or 6 bits for console usage. Think
about it. What values are going to be sent over the console? It'll be
ASCII, which requires at _least_ 7-bit. 6-bit would turn alpha
characters into control characters, punctuation and numbers. 5-bit
would be all control characters.

So there's no point trying to do anything with 5 or 6 bits per byte,
and I decided we might as well take that as an error (or maybe a
case that the hardware has not been setup) and default to 8 bits per
byte.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!