linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maarten Brock <m.brock@vanmierlo.com>
To: Michal Simek <michal.simek@xilinx.com>
Cc: Helmut Grohne <helmut.grohne@intenta.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>,
	Jan Kiszka <jan.kiszka@web.de>,
	linux-serial@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-serial-owner@vger.kernel.org
Subject: Re: [PATCH] tty: xilinx_uartps: Really fix id assignment
Date: Wed, 22 Jul 2020 18:50:58 +0200	[thread overview]
Message-ID: <775b7fc75f27513f70df63854ddccf58@vanmierlo.com> (raw)
In-Reply-To: <c652674b-97c1-c333-0d75-ae40c3c7de49@xilinx.com>

On 2020-07-22 09:18, Michal Simek wrote:
> On 13. 07. 20 18:08, Maarten Brock wrote:
>> On 2020-07-13 14:10, Helmut Grohne wrote:
>>> Hi Michal,
>>> 
>>> On Mon, Jul 13, 2020 at 01:49:38PM +0200, Michal Simek wrote:
>>>> On 13. 07. 20 9:11, Helmut Grohne wrote:
>>>> > Let me try to enumerate those I know:
>>>> >
>>>> > uart0    | uart1    | console | remark
>>>> > ---------+----------+---------+----------
>>>> > serial0  | serial1  | ttyPS0  | regular case
>>>> > serial0  | serial1  | ttyPS1  | normal assignment, second console
>>>> > serial1  | serial0  | ttyPS0  | -> Jan Kiszka, broken since revert
>>>> > disabled | serial0  | ttyPS0  | use only uart1 as serial0
>>>> > serial0  | disabled | ttyPS0  | regular case with uart1 disabled
>>>> >
>>>> > Out of these, I'm actively using configurations 3 and 4.
>>>> >
>>>> > Which of these scenarios do you test already?
>>>> 
>>>> For above we are missing also others
>>>> serial1 | serial0 | ttyPS1
>>>> disabled| serial1 | ttyPS1
>>> 
>>> Is it actually possible to have ttyPS1, but no ttyPS0? I think I 
>>> tried
>>> doing that earlier and it resulted in there being ttyPS0, but no 
>>> ttyPS1.
>> 
>> What if you also have a 16550 (in the PL) and give it the serial0 
>> alias?
>> Or a UARTlite? The serialN alias is inappropriate to set the number 
>> for
>> ttyPSn. How are you supposed to create all of ttyPS0, ttyS0 and ttyUL0
>> using a single serial0 alias?
> 
> yes this combination is not possible and I don't think this is xilinx
> specific issue.
> I expect the same problem you have with ttyAMA, ttyS and others.

Well, it is very easy to add a 16550 in the programmable logic of a 
Zynq.
Worse, it's impossible to only add uartps devices as the IP for it is
not available to the public.
It is less easy to add a 16550 to a CPU with ttyAMA but no external bus.
But if you add e.g. an I2C/SPI based SC16IS7xx which generates ttySCx 
you
might have the same problems.

But the problem is worse. What happens if you give the serial0 alias to
a xilinx_uartps and the 16550 driver has already taken ttyS0? (Or vice
versa?) Will the uartps still use ttyPS0 or will it ignore the serial0
alias? I predict the latter.

I see only two ways out.
* Let uartps generate ttySx device names, or
* Do not use serialN alias to set the number.

It was already stated that it is impossible to have ttyPS1 and no 
ttyPS0.
That would mean we cannot give serial0 to ttyS0 and serial1 to ttyPS1.
This makes me wonder if the opposite is valid: to give serial0 to ttyPS0
and serial1 to ttyS1. Probably not either.

There really needs to be a way to create deterministic names for the
devices!

>>>> serial1 | disables | ttyPS0
>>> 
>>> I'm not sure what this is supposed to mean. When there is no serial0
>>> alias, I'd expect ttyPS0 to be missing. However as indicated above 
>>> that
>>> is not what happens in practice. So either of these two 
>>> configurations
>>> seems invalid to me.
>>> 
>>>> All of these above are just not setting any console= on bootargs.
>>> 
>>> We usually set the console= assignment on bootargs.
>>> 
>>>> It means mix of these combinations is tested regularly but not all 
>>>> of
>>>> them. Do you see any other combination which is not supported?
>>> 
>>> I'm not aware of further relevant combinations.
>>> 
>>> Can we maybe trim down the matrix somehow? In my context, the need 
>>> for
>>> swapping the serial aliases arises from a limitation in u-boot-xlnx 
>>> and
>>> the desire to use one dtb for both linux and u-boot. It requires that
>>> the serial0 alias is the console. Are there other reasons to swap 
>>> them?
>>> If not, maybe fixing u-boot would be an option?
>>> 
>>> Helmut
>> 
>> I think that it would be better if u-boot used a "console" alias.
> 
> console is defined in bootargs which is OS specific feature. U-Boot has
> no idea what ttyPS, ttyS, etc means. That's why I don't think there is
> something wrong in this in u-boot. But please elaborate more on this
> because I am not aware about any issue on u-boot configuration.
> 
> Thanks,
> Michal

What I meant to say is that apparently U-boot requires serial0 to point 
to
the user-interface. This limits your options when assigning aliases. If
U-boot would use a different entry (e.g. "console" or better yet
"earlycon") things might be easier. serial0 should not be special IMHO.

But let's not diverge too much here.

Maarten


  reply	other threads:[~2020-07-22 16:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18  8:11 [PATCH] Revert "tty: xilinx_uartps: Fix missing id assignment to the console" Jan Kiszka
2020-06-18  8:17 ` Michal Simek
2020-07-09  7:48 ` [PATCH] tty: xilinx_uartps: Really fix id assignment Helmut Grohne
2020-07-10 11:45   ` Michal Simek
2020-07-13  7:11     ` Helmut Grohne
2020-07-13 11:49       ` Michal Simek
2020-07-13 12:10         ` Helmut Grohne
2020-07-13 16:08           ` Maarten Brock
2020-07-22  7:18             ` Michal Simek
2020-07-22 16:50               ` Maarten Brock [this message]
2020-07-24  9:19                 ` Michal Simek
2020-07-22  7:14           ` Michal Simek
2020-07-23  9:50             ` Helmut Grohne
2020-07-24  8:43               ` Michal Simek
2020-07-10 12:45   ` Greg Kroah-Hartman
2020-07-13  7:32     ` [PATCH v2] " Helmut Grohne

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=775b7fc75f27513f70df63854ddccf58@vanmierlo.com \
    --to=m.brock@vanmierlo.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=helmut.grohne@intenta.de \
    --cc=jan.kiszka@web.de \
    --cc=jslaby@suse.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial-owner@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=shubhrajyoti.datta@xilinx.com \
    /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;
as well as URLs for NNTP newsgroup(s).