[RFCv1 4/8] phy: amlogic: meson8b-usb2: Use phy set_mode callback function

Martin Blumenstingl martin.blumenstingl at googlemail.com
Thu Jun 17 15:16:06 PDT 2021


Hi Anand,

On Thu, Jun 17, 2021 at 9:43 PM Anand Moon <linux.amoon at gmail.com> wrote:
>
> Reorder the code for phy set_mode in .set_mode callback function.
> For now configure the phy in host mode.
as mentioned in the cover-letter: to my knowledge these register bits
are "static"
The settings for dr_mode == USB_DR_MODE_HOST mainly apply to the
second PHY (usb1_phy)

[...]
> +static int phy_meson8b_usb2_setmode(struct phy *phy, enum phy_mode mode,
> +                                   int submode)
>  {
>         struct phy_meson8b_usb2_priv *priv = phy_get_drvdata(phy);
>         u32 reg;
>
> +       switch (mode) {
> +       case PHY_MODE_USB_HOST:
> +               if (priv->match->host_enable_aca) {
> +                       regmap_update_bits(priv->regmap, REG_ADP_BC,
> +                                          REG_ADP_BC_ACA_ENABLE,
> +                                          REG_ADP_BC_ACA_ENABLE);
> +
> +                       udelay(ACA_ENABLE_COMPLETE_TIME);
> +
> +                       regmap_read(priv->regmap, REG_ADP_BC, &reg);
> +                       if (reg & REG_ADP_BC_ACA_PIN_FLOAT) {
> +                               dev_warn(&phy->dev, "USB ID detect failed!\n");
> +                               return -EINVAL;
> +                       }
> +               }
> +               break;
> +       default:
> +               dev_warn(&phy->dev, "USB ID detect failed to setnode! %d\n", mode);
> +               return -EINVAL;
I have tested this driver already with PHY_MODE_USB_DEVICE (on my
Odroid-C1) so I don't see why we should drop support for this
Also if we want runtime mode switching in this driver then we would
need to undo the changes from "case PHY_MODE_USB_HOST" above

I suggest dropping this patch until we know for sure if and which
registers need to be updated based on the DR mode.


Best regards,
Martin



More information about the linux-amlogic mailing list