linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Vinod Koul <vkoul@kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	linux-phy@lists.infradead.org,
	Chris Paterson <Chris.Paterson2@renesas.com>,
	Biju Das <biju.das@bp.renesas.com>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v2 10/11] phy: renesas: phy-rcar-gen3-usb2: Add OTG support for RZ/G2L
Date: Tue, 22 Jun 2021 17:29:15 +0200	[thread overview]
Message-ID: <CAMuHMdVHFaM+SAEBLyV0HOoFLpZgJ5PrJXx4vxQ8fsaopEAm9g@mail.gmail.com> (raw)
In-Reply-To: <20210621093943.12143-11-biju.das.jz@bp.renesas.com>

Hi Biju,

Thanks for your patch!

On Mon, Jun 21, 2021 at 11:40 AM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> This patch adds OTG support for RZ/G2L SoC.
>
> RZ/G2L USB2.0 phy is compatible with rcar gen3, but it uses
> line ctrl register for OTG_ID pin changes. Apart from this
> it uses a different OTG-BC interrupt bit for device recognition.

So it is not compatible? ;-)

> --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
> @@ -535,6 +555,11 @@ static const struct phy_ops rz_g1c_phy_usb2_ops = {
>         .owner          = THIS_MODULE,
>  };
>
> +static const struct soc_device_attribute soc_no_adp_ctrl[] = {
> +       { .soc_id = "r9a07g044", .data = (void *)true },
> +       { /* Sentinel */ }
> +};
> +
>  static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = {
>         {
>                 .compatible = "renesas,usb2-phy-r8a77470",
> @@ -613,6 +638,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
>         struct phy_provider *provider;
>         const struct phy_ops *phy_usb2_ops;
>         int ret = 0, i;
> +       const struct soc_device_attribute *attr;
>
>         if (!dev->of_node) {
>                 dev_err(dev, "This driver needs device tree\n");
> @@ -627,6 +653,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
>         if (IS_ERR(channel->base))
>                 return PTR_ERR(channel->base);
>
> +       channel->obint_enable_bits = USB2_OBINT_SESSVLDCHG | USB2_OBINT_IDDIGCHG;
>         /* get irq number here and request_irq for OTG in phy_init */
>         channel->irq = platform_get_irq_optional(pdev, 0);
>         channel->dr_mode = rcar_gen3_get_dr_mode(dev->of_node);
> @@ -634,6 +661,12 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
>                 int ret;
>
>                 channel->is_otg_channel = true;
> +               attr = soc_device_match(soc_no_adp_ctrl);
> +               if (attr) {
> +                       channel->soc_no_adp_ctrl = attr->data;
> +                       channel->obint_enable_bits = USB2_OBINT_IDCHG_EN;
> +               }

Please don't abuse soc_device_match() for matching with a different
variant that uses a different compatible value.  Just add an entry
to rcar_gen3_phy_usb2_match_table[] instead.
I don't know if you can handle RZ/G2L just using a different phy_ops,
or need to extend rcar_gen3_phy_usb2_match_table[].data.

> +
>                 channel->uses_otg_pins = !of_property_read_bool(dev->of_node,
>                                                         "renesas,no-otg-pins");
>                 channel->extcon = devm_extcon_dev_allocate(dev,

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

  reply	other threads:[~2021-06-22 15:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21  9:39 [PATCH v2 00/11] Add USB2.0 support Biju Das
2021-06-21  9:39 ` [PATCH v2 01/11] dt-bindings: phy: renesas: Document RZ/G2L USB PHY Control bindings Biju Das
2021-06-21 17:40   ` Rob Herring
2021-06-22 16:58   ` Rob Herring
2021-06-23 13:38     ` Biju Das
2021-06-23 14:13       ` Rob Herring
2021-06-23 14:29         ` Geert Uytterhoeven
2021-06-23 15:45         ` Biju Das
2021-06-25 10:11           ` Biju Das
2021-06-21  9:39 ` [PATCH v2 02/11] drivers: clk: renesas: r9a07g044-cpg: Add USB clocks Biju Das
2021-06-21  9:39 ` [PATCH v2 03/11] phy: renesas: Add RZ/G2L usb phy control driver Biju Das
2021-06-21  9:39 ` [PATCH v2 04/11] arm64: configs: defconfig: Enable RZ/G2L USB PHY " Biju Das
2021-06-21  9:39 ` [PATCH v2 05/11] dt-bindings: phy: renesas,usb2-phy: Document RZ/G2L phy bindings Biju Das
2021-06-22 15:33   ` Geert Uytterhoeven
2021-06-21  9:39 ` [PATCH v2 06/11] dt-bindings: usb: generic-ohci: Document RZ/G2L SoC bindings Biju Das
2021-06-21 17:40   ` Rob Herring
2021-06-22 10:03     ` Biju Das
2021-06-22 19:30   ` Rob Herring
2021-06-23 14:20     ` Biju Das
2021-06-21  9:39 ` [PATCH v2 07/11] dt-bindings: usb: generic-ehci: " Biju Das
2021-06-21 17:40   ` Rob Herring
2021-06-22 10:04     ` Biju Das
2021-06-21  9:39 ` [PATCH v2 08/11] arm64: dts: renesas: r9a07g044: Add USB2.0 phy and host support Biju Das
2021-06-21  9:39 ` [PATCH v2 09/11] dt-bindings: usb: renesas,usbhs: Document RZ/G2L bindings Biju Das
2021-06-21  9:39 ` [PATCH v2 10/11] phy: renesas: phy-rcar-gen3-usb2: Add OTG support for RZ/G2L Biju Das
2021-06-22 15:29   ` Geert Uytterhoeven [this message]
2021-06-23  7:04     ` Yoshihiro Shimoda
2021-06-23 11:52     ` Biju Das
2021-06-23  8:02   ` Yoshihiro Shimoda
2021-06-23 11:54     ` Biju Das
2021-06-21  9:39 ` [PATCH v2 11/11] arm64: dts: renesas: r9a07g044: Add USB2.0 device support Biju Das

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=CAMuHMdVHFaM+SAEBLyV0HOoFLpZgJ5PrJXx4vxQ8fsaopEAm9g@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=Chris.Paterson2@renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=biju.das@bp.renesas.com \
    --cc=kishon@ti.com \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=vkoul@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.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).