devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@nxp.com>
To: Roger Quadros <rogerq@ti.com>
Cc: "balbi@kernel.org" <balbi@kernel.org>,
	"pawell@cadence.com" <pawell@cadence.com>,
	"kurahul@cadence.com" <kurahul@cadence.com>,
	"nsekhar@ti.com" <nsekhar@ti.com>,
	"vigneshr@ti.com" <vigneshr@ti.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH 3/3] usb: cdns3: Enable workaround for USB2.0 PHY Rx compliance test PHY lockup
Date: Thu, 27 Aug 2020 11:09:54 +0000	[thread overview]
Message-ID: <20200827110838.GA5983@b29397-desktop> (raw)
In-Reply-To: <20200825120059.12436-4-rogerq@ti.com>

On 20-08-25 15:00:59, Roger Quadros wrote:
> From: Pawel Laszczak <pawell@cadence.com>
> 
> USB2.0 PHY hangs in Rx Compliance test when the incoming packet
> amplitude is varied below and above the Squelch Level of
> Receiver during the active packet multiple times.
> 
> Version 1 of the controller allows PHY to be reset when RX fail condition
> is detected to work around the above issue. This feature is
> disabled by default and needs to be enabled using a bit from
> the newly added PHYRST_CFG register. This patch enables the workaround.
> 
> As there is no way to distinguish between the controller version
> before the device controller is started we need to rely on a
> DT property to decide when to apply the workaround.
> 
> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>

Reviewed-by: Peter Chen <peter.chen@nxp.com>

Peter
> ---
>  drivers/usb/cdns3/core.c |  2 ++
>  drivers/usb/cdns3/core.h |  1 +
>  drivers/usb/cdns3/drd.c  | 12 ++++++++++++
>  drivers/usb/cdns3/drd.h  |  5 ++++-
>  4 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
> index 5c1586ec7824..34b36487682b 100644
> --- a/drivers/usb/cdns3/core.c
> +++ b/drivers/usb/cdns3/core.c
> @@ -443,6 +443,8 @@ static int cdns3_probe(struct platform_device *pdev)
>  		return -ENXIO;
>  	}
>  
> +	cdns->phyrst_a_enable = device_property_read_bool(dev, "cdns,phyrst-a-enable");
> +
>  	cdns->otg_res = *res;
>  
>  	mutex_init(&cdns->mutex);
> diff --git a/drivers/usb/cdns3/core.h b/drivers/usb/cdns3/core.h
> index 1ad1f1fe61e9..24cf0f1b5726 100644
> --- a/drivers/usb/cdns3/core.h
> +++ b/drivers/usb/cdns3/core.h
> @@ -76,6 +76,7 @@ struct cdns3 {
>  #define CDNS3_CONTROLLER_V0	0
>  #define CDNS3_CONTROLLER_V1	1
>  	u32				version;
> +	bool				phyrst_a_enable;
>  
>  	int				otg_irq;
>  	int				dev_irq;
> diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c
> index 6234bcd6158a..b74803e9703d 100644
> --- a/drivers/usb/cdns3/drd.c
> +++ b/drivers/usb/cdns3/drd.c
> @@ -42,6 +42,18 @@ int cdns3_set_mode(struct cdns3 *cdns, enum usb_dr_mode mode)
>  			reg = readl(&cdns->otg_v1_regs->override);
>  			reg |= OVERRIDE_IDPULLUP;
>  			writel(reg, &cdns->otg_v1_regs->override);
> +
> +			/*
> +			 * Enable work around feature built into the
> +			 * controller to address issue with RX Sensitivity
> +			 * est (EL_17) for USB2 PHY. The issue only occures
> +			 * for 0x0002450D controller version.
> +			 */
> +			if (cdns->phyrst_a_enable) {
> +				reg = readl(&cdns->otg_v1_regs->phyrst_cfg);
> +				reg |= PHYRST_CFG_PHYRST_A_ENABLE;
> +				writel(reg, &cdns->otg_v1_regs->phyrst_cfg);
> +			}
>  		} else {
>  			reg = readl(&cdns->otg_v0_regs->ctrl1);
>  			reg |= OVERRIDE_IDPULLUP_V0;
> diff --git a/drivers/usb/cdns3/drd.h b/drivers/usb/cdns3/drd.h
> index 7e7cf7fa2dd3..f1ccae285a16 100644
> --- a/drivers/usb/cdns3/drd.h
> +++ b/drivers/usb/cdns3/drd.h
> @@ -31,7 +31,7 @@ struct cdns3_otg_regs {
>  	__le32 simulate;
>  	__le32 override;
>  	__le32 susp_ctrl;
> -	__le32 reserved4;
> +	__le32 phyrst_cfg;
>  	__le32 anasts;
>  	__le32 adp_ramp_time;
>  	__le32 ctrl1;
> @@ -153,6 +153,9 @@ struct cdns3_otg_common_regs {
>  /* Only for CDNS3_CONTROLLER_V0 version */
>  #define OVERRIDE_IDPULLUP_V0		BIT(24)
>  
> +/* PHYRST_CFG - bitmasks */
> +#define PHYRST_CFG_PHYRST_A_ENABLE     BIT(0)
> +
>  #define CDNS3_ID_PERIPHERAL		1
>  #define CDNS3_ID_HOST			0
>  
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

-- 

Thanks,
Peter Chen

      parent reply	other threads:[~2020-08-27 15:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 12:00 [PATCH 0/3] usb: cdns,usb3: Convert DT binding to YALM Roger Quadros
2020-08-25 12:00 ` [PATCH 1/3] dt-bindings: usb: Convert cdns-usb3.txt to YAML schema Roger Quadros
2020-08-25 12:00 ` [PATCH 2/3] dt-bindings: usb: cdns,usb3: Add cdns,phyrst-a-enable property Roger Quadros
2020-08-27 11:14   ` Peter Chen
2020-09-02 13:28     ` Roger Quadros
2020-09-02 22:48       ` Peter Chen
2020-08-25 12:00 ` [PATCH 3/3] usb: cdns3: Enable workaround for USB2.0 PHY Rx compliance test PHY lockup Roger Quadros
2020-08-26  3:21   ` Peter Chen
2020-08-26  4:04     ` Pawel Laszczak
2020-08-26  7:16       ` Peter Chen
2020-08-26  7:44         ` Pawel Laszczak
2020-08-26  8:07           ` Peter Chen
2020-08-26 12:49             ` Roger Quadros
2020-08-27  0:24               ` Peter Chen
2020-08-27  9:36                 ` Roger Quadros
2020-08-27 13:02                   ` Felipe Balbi
2020-08-27 11:09   ` 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=20200827110838.GA5983@b29397-desktop \
    --to=peter.chen@nxp.com \
    --cc=balbi@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kurahul@cadence.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=pawell@cadence.com \
    --cc=robh+dt@kernel.org \
    --cc=rogerq@ti.com \
    --cc=vigneshr@ti.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).