Linux USB
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: "周琰杰 (Zhou Yanjie)" <zhouyanjie@wanyeetech.com>
Cc: balbi@kernel.org, gregkh@linuxfoundation.org, kishon@ti.com,
	paul@crapouillou.net, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, christophe.jaillet@wanadoo.fr,
	dongsheng.qiu@ingenic.com, aric.pzqi@ingenic.com,
	rick.tyliu@ingenic.com, yanfei.li@ingenic.com,
	sernia.zhou@foxmail.com, zhenwenjin@gmail.com
Subject: Re: [PATCH v5 2/2] PHY: Ingenic: Add USB PHY driver using generic PHY framework.
Date: Wed, 23 Sep 2020 11:05:00 +0530	[thread overview]
Message-ID: <20200923053500.GD2968@vkoul-mobl> (raw)
In-Reply-To: <20200921162417.52004-3-zhouyanjie@wanyeetech.com>

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	other threads:[~2020-09-23  5:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-21 16:24 [PATCH v5 0/2] Use the generic PHY framework for Ingenic USB PHY 周琰杰 (Zhou Yanjie)
2020-09-21 16:24 ` [PATCH v5 1/2] USB: PHY: JZ4770: Remove unnecessary function calls 周琰杰 (Zhou Yanjie)
2020-09-21 16:24 ` [PATCH v5 2/2] PHY: Ingenic: Add USB PHY driver using generic PHY framework 周琰杰 (Zhou Yanjie)
2020-09-23  5:35   ` Vinod Koul [this message]
2020-09-23 13:52     ` Zhou Yanjie

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=20200923053500.GD2968@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=aric.pzqi@ingenic.com \
    --cc=balbi@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dongsheng.qiu@ingenic.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=paul@crapouillou.net \
    --cc=rick.tyliu@ingenic.com \
    --cc=sernia.zhou@foxmail.com \
    --cc=yanfei.li@ingenic.com \
    --cc=zhenwenjin@gmail.com \
    --cc=zhouyanjie@wanyeetech.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