From: peter.griffin@linaro.org (Peter Griffin)
To: linux-arm-kernel@lists.infradead.org
Subject: [STLinux Kernel] [PATCH 3/8] serial: st-asc: Read in all Pinctrl states
Date: Mon, 30 Jan 2017 22:35:21 +0000 [thread overview]
Message-ID: <20170130223521.GA12847@griffinp-ThinkPad-X1-Carbon-2nd> (raw)
In-Reply-To: <20170130191159.zv5jegvu4fetcmzo@dell>
Hi Lee,
On Mon, 30 Jan 2017, Lee Jones wrote:
> On Mon, 30 Jan 2017, Peter Griffin wrote:
> > On Mon, 30 Jan 2017, Lee Jones wrote:
> > > On Mon, 30 Jan 2017, Peter Griffin wrote:
> > > > On Fri, 27 Jan 2017, Lee Jones wrote:
> > > > > On Wed, 25 Jan 2017, Peter Griffin wrote:
> > > > > > On Tue, 24 Jan 2017, Lee Jones wrote:
> > > > > >
> > > > > > > There are now 2 possible separate/different Pinctrl states which can
> > > > > > > be provided from platform data. One which encompasses the lines
> > > > > > > required for HW flow-control (CTS/RTS) and another which does not
> > > > > > > specify these lines, such that they can be used via GPIO mechanisms
> > > > > > > for manually toggling (i.e. from a request by `stty`).
> > > > > > >
> > > > > > > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > > > > > > ---
> > > > > > > drivers/tty/serial/st-asc.c | 28 ++++++++++++++++++++++++++++
> > > > > > > 1 file changed, 28 insertions(+)
> > > > > > >
> > > > > > > diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
> > > > > > > index 397df50..03801ed 100644
> > > > > > > --- a/drivers/tty/serial/st-asc.c
> > > > > > > +++ b/drivers/tty/serial/st-asc.c
>
> [...]
>
> > > > > > > + pinctrl_lookup_state(ascport->pinctrl, "manual-rts");
> > > > > > > + if (IS_ERR(ascport->states[MANUAL_RTS]))
> > > > > > > + ascport->states[MANUAL_RTS] = NULL;
> > > > > > > +
> > > > > >
> > > > > > The different pinctrl states looks like a neat solution to the problem.
> > > > > >
> > > > > > My only concern here is that 'default' state is implying a hw-flow-control
> > > > > > pinmux config, and manual-rts is implying what is the current upstream
> > > > > > 'default' pinmux config.
> > > > > >
> > > > > > Which maybe ok if you update all uarts, but currently only serial0
> > > > > > is updated. So the other uarts current 'default' is actually the same as serial0
> > > > > > 'manual-rts' grouping, which conceptually is odd.
> > > > > >
> > > > > > Would it not be better to make 'manual-rts' the default state? As that aligns
> > > > > > to what is currently already the default for the other UARTS? And then make
> > > > > > hw-flow-control the optional state for serial0?
> > > > > >
> > > > > > That also has the advantage that 'default' has the same meaning with older DT's.
> > > > >
> > > > > The reason it was done is this was because none of the other UARTs
> > > > > require 2 separate Pinctrl configurations, only this one. Moreover,
> > > > > if they support RTS/CTS then I believe that the lines should be
> > > > > defined in Pinctrl.
> > > >
> > > > Yes I agree with that.
> > > >
> > > > > Thus, it was my plan to update all UART's default
> > > > > Pinctrl configs to include the RTS/CTS lines.
> > > > >
> > > >
> > > > I still don't see the point in changing the meaning of 'default' group and breaking
> > > > ABI if you don't need to?
> > > >
> > > > As far as I can tell if you swap the meaning of 'default' and 'maunal-rts'
> > > > groups you get all the benefits of this series whilst also maintaining backwards
> > > > compatbility with older DT's.
> > >
> > > What makes you think this will break ABI?
> >
> > I've not tried it, but an older DT defines one group, 'default' which contains
> > the same pin config as your new optional 'manual-rts' group.
> >
> > The driver now reads like the manual-rts pin config is optional and should be stored in
> > ascport->states[MANUAL_RTS]. An older DT will pass that same pin config as the default
> > group and it will be stored in ascport->states[DEFAULT].
> >
> > That seems wrong to me, and if it executes OK it wouldn't be what you
> > expect by reading the code.
>
> This makes no sense at a functional level.
>
> Old kernel, old DTB:
>
> ASC driver doesn't understand Pinctrl, but since only the "default"
> state is defined, that's what will be used as a matter of course.
> RTS/CTS aren't configured, but that doesn't matter because the DTS
> does not advertise that HW flow-control is available. In this
> use-case neither HW flow-control, nor manual toggling of the RTS line
> is possible.
>
> New kernel, old DTB:
>
> ASC driver demands "default" and requests "manual-rts" Pinctrl states,
> but "manual-rts" isn't available so "default" will be the only
> utilised state. Unlike the first example above, "default" now
> contains the RTS and CTS lines,
No it doesn't, default just contains 'tx' & 'rx' pins, as it has always
done until now.
Which is IMO where the condusion arises, as it is the same pin configuration
as what you are now calling 'manual-rts' which the driver just tried and failed
to obtain (although in reality it has actually obtained those pins but stored
them in DEFAULT instead.
I presume this is why it didn't make sense to you above.
>but since the DTS does not advertise
> HW flow-control as available they will be harmlessly unused. This
> configuration culminates in the same result as the first example
> i.e. no HW flow-control and no manual toggling. However, there are no
> detremental effects to the driver's functions.
>
<snip>
>New kernel, new DTB:
>
> ASC driver demands "default" and requests "manual-rts" Pinctrl
> states. If DTS advertises that HW flow-control is possible and the
> client requests it, ASC will use the "default" state and HW
> flow-control will commence. If HW flow-control is not requested by
> the client and "manual-rts" is available, then ASC will request the
> RTS line is handled by GPIO until such times as the client requests
> HW flow-control, at which point ASC will disable GPIO and request the
> "default" state again.
Unless it is uart 1 or 2, in which case 'default' still only contains
tx & rx pins, and you have the same situation as above.
>
> It is not possible to read C-code and make assumptions that the DTB
> will be in a particular state as you suggest.
> No disparity ever
> exists and the code is always clear IMHO.
>
Really?
ascport->states[DEFAULT]: may contain "tx, rx" or "tx, rx, cts & rts"
ascport->states[MANUAL_RTS]: may contain "tx, rx", or it could be stored in DEFAULT
And as the series currently is you have a mixture of the two in the same kernel
depending on what instance of the UART you are.
regards,
Peter.
next prev parent reply other threads:[~2017-01-30 22:35 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 13:43 [PATCH 0/8] serial: st-asc: Allow handling of RTS line Lee Jones
2017-01-24 13:43 ` [PATCH 1/8] serial: st-asc: Ignore the parity error bit if 8-bit mode is enabled Lee Jones
2017-01-25 11:02 ` [STLinux Kernel] " Peter Griffin
2017-01-24 13:43 ` [PATCH 2/8] serial: st-asc: Provide RTS functionality Lee Jones
2017-01-25 11:03 ` [STLinux Kernel] " Peter Griffin
2017-01-24 13:43 ` [PATCH 3/8] serial: st-asc: Read in all Pinctrl states Lee Jones
2017-01-24 21:28 ` kbuild test robot
2017-01-25 11:21 ` [STLinux Kernel] " Peter Griffin
2017-01-27 11:54 ` Lee Jones
2017-01-30 14:23 ` Peter Griffin
2017-01-30 15:32 ` Lee Jones
2017-01-30 16:10 ` Peter Griffin
2017-01-30 19:11 ` Lee Jones
2017-01-30 22:35 ` Peter Griffin [this message]
2017-01-31 10:13 ` Lee Jones
2017-01-31 11:31 ` Peter Griffin
2017-01-31 12:27 ` Lee Jones
2017-02-01 11:50 ` Peter Griffin
2017-02-01 12:47 ` Lee Jones
2017-01-24 13:43 ` [PATCH 4/8] serial: st-asc: (De)Register GPIOD and swap Pinctrl profiles Lee Jones
2017-01-24 22:00 ` kbuild test robot
2017-01-25 11:24 ` [STLinux Kernel] " Peter Griffin
2017-01-24 13:43 ` [PATCH 5/8] ARM: dts: STiH410-b2260: Identify the UART RTS line Lee Jones
2017-01-24 13:43 ` [PATCH 6/8] ARM: dts: STiH407-pinctrl: Add Pinctrl group for HW flow-control Lee Jones
2017-01-25 11:01 ` [STLinux Kernel] " Peter Griffin
2017-01-24 13:43 ` [PATCH 7/8] ARM: dts: STiH407-family: Use new Pinctrl groups Lee Jones
2017-01-25 11:54 ` [STLinux Kernel] " Peter Griffin
2017-01-27 11:03 ` Lee Jones
2017-01-27 11:29 ` Lee Jones
2017-01-24 13:43 ` [PATCH 8/8] ARM: dts: STiH407-family: Enable HW flow-control Lee Jones
2017-01-25 10:59 ` [STLinux Kernel] " Peter Griffin
2017-01-25 11:40 ` Peter Griffin
2017-01-27 11:33 ` Lee Jones
2017-01-27 11:32 ` Lee Jones
2017-01-25 10:07 ` [PATCH 0/8] serial: st-asc: Allow handling of RTS line Greg KH
2017-01-25 15:35 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170130223521.GA12847@griffinp-ThinkPad-X1-Carbon-2nd \
--to=peter.griffin@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox