From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh+dt@kernel.org>,
Jiri Slaby <jirislaby@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
Prabhakar <prabhakar.csengg@gmail.com>,
Biju Das <biju.das.jz@bp.renesas.com>
Subject: Re: [PATCH 3/3] serial: sh-sci: Add reset support for RZ/G2L SoC
Date: Mon, 8 Nov 2021 17:39:52 +0100 [thread overview]
Message-ID: <CAMuHMdWLfUNh7PQWpARS6CNymqpGO_29tgy7NLtgmJ-BRgyUaA@mail.gmail.com> (raw)
In-Reply-To: <20211103173127.13701-4-prabhakar.mahadev-lad.rj@bp.renesas.com>
Hi Prabhakar,
On Wed, Nov 3, 2021 at 6:31 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> On RZ/G2L devices should be explicitly pulled out of reset for it
> to work. This patch adds support to read the "resets" property and
> performs deassert/assert when required.
>
> Also, propagate the error to the caller of sci_parse_dt() instead of
> returning NULL in case of failure.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Thanks for your patch!
> ---
> Hi Geert,
> For handling the resets I was in dual mind whether to perform
> reset based on compatible strings or soc-id, let me know your
> thoughts. Currently no SoC's use "renesas,sci" so using the same
> for performing the reset operation for SCI.
We do, on H8/300.
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -3203,23 +3204,58 @@ static const struct of_device_id of_sci_match[] = {
> };
> MODULE_DEVICE_TABLE(of, of_sci_match);
>
> +static void sci_reset_control_assert(void *data)
> +{
> + reset_control_assert(data);
> +}
> +
> static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev,
> unsigned int *dev_id)
> {
> struct device_node *np = pdev->dev.of_node;
> + const struct of_device_id *of_id;
> struct plat_sci_port *p;
> struct sci_port *sp;
> const void *data;
> int id;
>
> if (!IS_ENABLED(CONFIG_OF) || !np)
> - return NULL;
> + return ERR_PTR(-EINVAL);
> +
> + of_id = of_match_device(of_sci_match, &pdev->dev);
> + if (!of_id)
> + return ERR_PTR(-EINVAL);
>
> - data = of_device_get_match_data(&pdev->dev);
> + if (!strcmp(of_id->compatible, "renesas,scif-r9a07g044") ||
> + !strcmp(of_id->compatible, "renesas,sci")) {
This will match on H8/300, too, which doesn't have resets.
Please match against "renesas,sci-r9a07g044" instead.
Please don't use explicit strcmp() calls here, but add a flag to
of_sci_match[].data.
> + struct reset_control *rstc;
> + int ret;
> +
> + rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> + if (IS_ERR(rstc)) {
> + dev_err(&pdev->dev, "Error: missing reset ctrl\n");
> + return ERR_PTR(PTR_ERR(rstc));
> + }
> +
> + ret = reset_control_deassert(rstc);
> + if (ret) {
> + dev_err(&pdev->dev, "failed to deassert %d\n", ret);
> + return ERR_PTR(ret);
> + }
> +
> + ret = devm_add_action_or_reset(&pdev->dev, sci_reset_control_assert, rstc);
> + if (ret) {
> + dev_err(&pdev->dev, "failed to register assert devm action, %d\n",
> + ret);
> + return ERR_PTR(ret);
> + }
> + }
> +
> + data = of_id->data;
>
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
next prev parent reply other threads:[~2021-11-08 16:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 17:31 [PATCH 0/3] RZ/G2L SCI support and sh-sci driver update Lad Prabhakar
2021-11-03 17:31 ` [PATCH 1/3] dt-bindings: serial: renesas,scif: Make resets as a required property Lad Prabhakar
2021-11-08 16:29 ` Geert Uytterhoeven
2021-11-09 0:36 ` Lad, Prabhakar
2021-11-03 17:31 ` [PATCH 2/3] dt-bindings: serial: renesas,sci: Document RZ/G2L SoC Lad Prabhakar
2021-11-08 16:19 ` Geert Uytterhoeven
2021-11-09 0:17 ` Lad, Prabhakar
2021-11-08 16:21 ` Geert Uytterhoeven
2021-11-09 0:19 ` Lad, Prabhakar
2021-11-03 17:31 ` [PATCH 3/3] serial: sh-sci: Add reset support for " Lad Prabhakar
2021-11-08 16:39 ` Geert Uytterhoeven [this message]
2021-11-09 0:33 ` Lad, Prabhakar
2021-11-09 7:49 ` Geert Uytterhoeven
2021-11-09 9:02 ` Lad, Prabhakar
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=CAMuHMdWLfUNh7PQWpARS6CNymqpGO_29tgy7NLtgmJ-BRgyUaA@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=biju.das.jz@bp.renesas.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=prabhakar.csengg@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh+dt@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).