On 22-09-20, 00:24, 周琰杰 (Zhou Yanjie) wrote:

> +#define USBPCR_IDPULLUP_LSB  28
> +#define USBPCR_IDPULLUP_MASK         GENMASK(29, USBPCR_IDPULLUP_LSB)
> +#define USBPCR_IDPULLUP_ALWAYS               (0x2 << USBPCR_IDPULLUP_LSB)
> +#define USBPCR_IDPULLUP_SUSPEND              (0x1 << USBPCR_IDPULLUP_LSB)
> +#define USBPCR_IDPULLUP_OTG                  (0x0 << USBPCR_IDPULLUP_LSB)

why not define these as 0, 1, 2 and then use
FIELD_PREP(value, USBPCR_IDPULLUP_MASK), please do this for rest as
well.

> +static int ingenic_usb_phy_set_mode(struct phy *phy,
> +                               enum phy_mode mode, int submode)
> +{
> +     struct ingenic_usb_phy *priv = phy_get_drvdata(phy);
> +     u32 reg;
> +
> +     switch (mode) {
> +     case PHY_MODE_USB_HOST:
> +             reg = readl(priv->base + REG_USBPCR_OFFSET);
> +             reg &= ~(USBPCR_VBUSVLDEXT | USBPCR_VBUSVLDEXTSEL | 
> USBPCR_OTG_DISABLE);

use u32_encode_bits or u32p_replace_bit to program registers using mask
defined
-- 
~Vinod

Reply via email to