[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200923053500.GD2968@vkoul-mobl>
Date: Wed, 23 Sep 2020 11:05:00 +0530
From: Vinod Koul <vkoul@...nel.org>
To: 周琰杰 (Zhou Yanjie)
<zhouyanjie@...yeetech.com>
Cc: balbi@...nel.org, gregkh@...uxfoundation.org, kishon@...com,
paul@...pouillou.net, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org, christophe.jaillet@...adoo.fr,
dongsheng.qiu@...enic.com, aric.pzqi@...enic.com,
rick.tyliu@...enic.com, yanfei.li@...enic.com,
sernia.zhou@...mail.com, zhenwenjin@...il.com
Subject: Re: [PATCH v5 2/2] PHY: Ingenic: Add USB PHY driver using generic
PHY framework.
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
Powered by blists - more mailing lists