devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@kernel.org>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	gregkh@linuxfoundation.org, conor+dt@kernel.org,
	shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com,
	peng.fan@nxp.com, linux-usb@vger.kernel.org,
	devicetree@vger.kernel.org, jun.li@nxp.com
Subject: Re: [PATCH v2 1/3] usb: chipidea: imx: improve logic if samsung,picophy-* parameter is 0
Date: Mon, 10 Jul 2023 11:03:47 +0800	[thread overview]
Message-ID: <20230710030347.GA2418446@nchen-desktop> (raw)
In-Reply-To: <20230627112126.1882666-1-xu.yang_2@nxp.com>

On 23-06-27 19:21:24, Xu Yang wrote:
> In current driver, the value of tuning parameter will not take effect
> if samsung,picophy-* is assigned as 0. Because 0 is also a valid value
> acccording to the description of USB_PHY_CFG1 register, this will improve
> the logic to let it work.
> 
> Fixes: 58a3cefb3840 ("usb: chipidea: imx: add two samsung picophy parameters tuning implementation")
> cc: <stable@vger.kernel.org>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

Acked-by: Peter Chen <peter.chen@kernel.org>

Peter

> 
> ---
> Changes in v2:
>  - no change
> ---
>  drivers/usb/chipidea/ci_hdrc_imx.c | 10 ++++++----
>  drivers/usb/chipidea/usbmisc_imx.c |  6 ++++--
>  2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index 336ef6dd8e7d..873539f9a2c0 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -175,10 +175,12 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
>  	if (of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI)
>  		data->ulpi = 1;
>  
> -	of_property_read_u32(np, "samsung,picophy-pre-emp-curr-control",
> -			&data->emp_curr_control);
> -	of_property_read_u32(np, "samsung,picophy-dc-vol-level-adjust",
> -			&data->dc_vol_level_adjust);
> +	if (of_property_read_u32(np, "samsung,picophy-pre-emp-curr-control",
> +			&data->emp_curr_control))
> +		data->emp_curr_control = -1;
> +	if (of_property_read_u32(np, "samsung,picophy-dc-vol-level-adjust",
> +			&data->dc_vol_level_adjust))
> +		data->dc_vol_level_adjust = -1;
>  
>  	return data;
>  }
> diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
> index 9ee9621e2ccc..1c7932f22218 100644
> --- a/drivers/usb/chipidea/usbmisc_imx.c
> +++ b/drivers/usb/chipidea/usbmisc_imx.c
> @@ -659,13 +659,15 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data)
>  			usbmisc->base + MX7D_USBNC_USB_CTRL2);
>  		/* PHY tuning for signal quality */
>  		reg = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG1);
> -		if (data->emp_curr_control && data->emp_curr_control <=
> +		if (data->emp_curr_control >= 0 &&
> +			data->emp_curr_control <=
>  			(TXPREEMPAMPTUNE0_MASK >> TXPREEMPAMPTUNE0_BIT)) {
>  			reg &= ~TXPREEMPAMPTUNE0_MASK;
>  			reg |= (data->emp_curr_control << TXPREEMPAMPTUNE0_BIT);
>  		}
>  
> -		if (data->dc_vol_level_adjust && data->dc_vol_level_adjust <=
> +		if (data->dc_vol_level_adjust >= 0 &&
> +			data->dc_vol_level_adjust <=
>  			(TXVREFTUNE0_MASK >> TXVREFTUNE0_BIT)) {
>  			reg &= ~TXVREFTUNE0_MASK;
>  			reg |= (data->dc_vol_level_adjust << TXVREFTUNE0_BIT);
> -- 
> 2.34.1
> 

-- 

Thanks,
Peter Chen

      parent reply	other threads:[~2023-07-10  3:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 11:21 [PATCH v2 1/3] usb: chipidea: imx: improve logic if samsung,picophy-* parameter is 0 Xu Yang
2023-06-27 11:21 ` [PATCH v2 2/3] dt-bindings: usb: ci-hdrc-usb2: add fsl,picophy-rise-fall-time-adjust property Xu Yang
2023-06-27 13:49   ` Krzysztof Kozlowski
2023-07-10  3:13   ` Peter Chen
2023-06-27 11:21 ` [PATCH v2 3/3] usb: chipidea: imx: add one fsl picophy parameter tuning implementation Xu Yang
2023-07-10  3:12   ` Peter Chen
2023-07-10  3:03 ` Peter Chen [this message]

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=20230710030347.GA2418446@nchen-desktop \
    --to=peter.chen@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.li@nxp.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=xu.yang_2@nxp.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;
as well as URLs for NNTP newsgroup(s).