RE: [PATCH v2 10/11] phy: renesas: phy-rcar-gen3-usb2: Add OTG support for RZ/G2L

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Biju-san, Geert-san,

> From: Geert Uytterhoeven, Sent: Wednesday, June 23, 2021 12:29 AM
> 
> Hi Biju,
> 
> Thanks for your patch!
> 
> On Mon, Jun 21, 2021 at 11:40 AM Biju Das 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.

Thank you for your comments. I think we need to extend
rcar_gen3_phy_usb2_match_table[].data because we cannot add
any private data into phy_ops.

I'll send further comments for this patch on other email thread.

Best regards,
Yoshihiro Shimoda





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux