linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-sh@vger.kernel.org, glaubitz@physik.fu-berlin.de
Subject: Re: [RESEND RFC PATCH 10/12] serial/sh-sci: Fix earlyprintk / earlycon.
Date: Wed, 06 Sep 2023 16:27:50 +0900	[thread overview]
Message-ID: <87edjbvk09.wl-ysato@users.sourceforge.jp> (raw)
In-Reply-To: <CAMuHMdX6eGEFH9wbqWOV07gi=vcgfsdnnrZm9UG8wCjYRwRYsQ@mail.gmail.com>

On Fri, 01 Sep 2023 22:26:14 +0900,
Geert Uytterhoeven wrote:
> 
> Hi Sato-san,
> 
> On Thu, Aug 31, 2023 at 11:23 AM Yoshinori Sato
> <ysato@users.sourceforge.jp> wrote:
> > - earlyprintk having fault.
> > - fix shortname conflict.
> > - fix SCI regshift in SH4.
> >
> > Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
> 
> Thanks for your patch!
> 
> > --- a/drivers/tty/serial/sh-sci.c
> > +++ b/drivers/tty/serial/sh-sci.c
> > @@ -2721,7 +2721,7 @@ static int sci_remap_port(struct uart_port *port)
> >         if (port->membase)
> >                 return 0;
> >
> > -       if (port->dev->of_node || (port->flags & UPF_IOREMAP)) {
> > +       if ((port->dev && port->dev->of_node) || (port->flags & UPF_IOREMAP)) {
> 
> Why is this needed? It works fine on arm32, arm64, and riscv.

earlycon works fine, but the old earlyprintk was stuck.
I don't think it's used much, but it's a problem if it doesn't work
when checking old sh targets.

> >                 port->membase = ioremap(port->mapbase, sport->reg_size);
> >                 if (unlikely(!port->membase)) {
> >                         dev_err(port->dev, "can't remap port#%d\n", port->line);
> > @@ -3507,6 +3507,10 @@ static int __init early_console_setup(struct earlycon_device *device,
> >         if (!device->port.membase)
> >                 return -ENODEV;
> >
> > +       if (type == PORT_SCI &&
> > +           (IS_ENABLED(CONFIG_CPU_SH3) || IS_ENABLED(CONFIG_CPU_SH4))) {
> > +               device->port.regshift = 2;
> > +       }
> 
> How do you run into this, given you don't have any SCI ports enabled
> in your DTS, only SCIF?
> 
> Anyway, I think this should be fixed in sci_init_single(), by extending
> the driver to support the more-or-less standard "reg-shift" DT property
> (as I said before in
> https://lore.kernel.org/all/CAMuHMdW2gxDzYbP_0Z90o8mHdUm_BV6e+gMHpELJx_g=ezAbdw@mail.gmail.com).

earlycon cannot reference DeviceTree.
If you give the value of reg-shift dynamically, you need to use a kernel
parameter.
I don't think this is necessary either, but it's a problem if it doesn't work.

> >         device->port.serial_in = sci_serial_in;
> >         device->port.serial_out = sci_serial_out;
> >         device->port.type = type;
> > @@ -3556,8 +3560,8 @@ static int __init hscif_early_console_setup(struct earlycon_device *device,
> >
> >  OF_EARLYCON_DECLARE(sci, "renesas,sci", sci_early_console_setup);
> >  OF_EARLYCON_DECLARE(scif, "renesas,scif", scif_early_console_setup);
> > -OF_EARLYCON_DECLARE(scif, "renesas,scif-r7s9210", rzscifa_early_console_setup);
> > -OF_EARLYCON_DECLARE(scif, "renesas,scif-r9a07g044", rzscifa_early_console_setup);
> > +OF_EARLYCON_DECLARE(rzscif, "renesas,scif-r7s9210", rzscifa_early_console_setup);
> > +OF_EARLYCON_DECLARE(rzscif, "renesas,scif-r9a07g044", rzscifa_early_console_setup);
> 
> Why?

The earlycon parameter uses the first name.
If sh4 and rz use the same name, one of them will not work properly.

> 
> >  OF_EARLYCON_DECLARE(scifa, "renesas,scifa", scifa_early_console_setup);
> >  OF_EARLYCON_DECLARE(scifb, "renesas,scifb", scifb_early_console_setup);
> >  OF_EARLYCON_DECLARE(hscif, "renesas,hscif", hscif_early_console_setup);
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

-- 
Yosinori Sato

  reply	other threads:[~2023-09-06  7:27 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31  1:11 [RESEND RFC PATCH 00/12] DeviceTree support for SH7751 based boards Yoshinori Sato
2023-08-31  1:11 ` [RESEND RFC PATCH 01/12] sh: Add OF target boards Yoshinori Sato
2023-09-01 12:22   ` Geert Uytterhoeven
2023-09-01 14:26   ` Geert Uytterhoeven
2023-09-06  8:05     ` Yoshinori Sato
2023-09-06  8:12       ` John Paul Adrian Glaubitz
2023-09-07  3:28         ` Yoshinori Sato
2023-09-07  3:35     ` Yoshinori Sato
2023-08-31  1:11 ` [RESEND RFC PATCH 02/12] sh: Update OF handling Yoshinori Sato
2023-09-01 12:25   ` Geert Uytterhoeven
2023-08-31  1:11 ` [RESEND RFC PATCH 03/12] sh: SH4 OF support Yoshinori Sato
2023-09-01 12:26   ` Geert Uytterhoeven
2023-09-13 12:23   ` Geert Uytterhoeven
2023-09-15  9:21     ` Yoshinori Sato
2023-08-31  1:11 ` [RESEND RFC PATCH 04/12] clk: SH7750 / 7751 clk driver Yoshinori Sato
2023-09-01 12:26   ` Geert Uytterhoeven
2023-09-07  3:44     ` Yoshinori Sato
2023-08-31  1:11 ` [RESEND RFC PATCH 05/12] drivers/irqchip: Add SH7751 and boards specific irqchip Yoshinori Sato
2023-09-01 12:49   ` Geert Uytterhoeven
2023-08-31  1:11 ` [RESEND RFC PATCH 06/12] drivers/pci: Add SH7751 PCI Host bridge driver Yoshinori Sato
2023-09-01 12:54   ` Geert Uytterhoeven
2023-08-31  1:11 ` [RESEND RFC PATCH 07/12] clocksource: Update sh_tmu of handling Yoshinori Sato
2023-08-31  6:48   ` Krzysztof Kozlowski
2023-09-01 13:01   ` Geert Uytterhoeven
2023-09-01 13:40     ` Yoshinori Sato
2023-08-31  1:11 ` [RESEND RFC PATCH 08/12] mfd/sm501: Add OF properties Yoshinori Sato
2023-08-31  6:51   ` Krzysztof Kozlowski
2023-09-01 13:09   ` Geert Uytterhoeven
2023-08-31  1:11 ` [RESEND RFC PATCH 09/12] of: FDT vaddr support for SH Yoshinori Sato
2023-08-31  6:48   ` Krzysztof Kozlowski
2023-09-01 13:11   ` Geert Uytterhoeven
2023-09-01 13:33     ` Yoshinori Sato
2023-08-31  1:11 ` [RESEND RFC PATCH 10/12] serial/sh-sci: Fix earlyprintk / earlycon Yoshinori Sato
2023-09-01 13:26   ` Geert Uytterhoeven
2023-09-06  7:27     ` Yoshinori Sato [this message]
2023-08-31  1:11 ` [RESEND RFC PATCH 11/12] sh: target dts Yoshinori Sato
2023-09-01 14:23   ` Geert Uytterhoeven
2023-08-31  1:11 ` [RESEND RFC PATCH 12/12] sh: OF defconfig Yoshinori Sato

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=87edjbvk09.wl-ysato@users.sourceforge.jp \
    --to=ysato@users.sourceforge.jp \
    --cc=geert@linux-m68k.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-sh@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).