* [PATCH] usb: cdnsp: fix L1 resume issue for RTL_REVISION_NEW_LPM version
[not found] <20250423111535.3894417-1-pawell@cadence.com>
@ 2025-04-23 11:43 ` Pawel Laszczak
2025-04-24 6:07 ` Peter Chen (CIX)
0 siblings, 1 reply; 4+ messages in thread
From: Pawel Laszczak @ 2025-04-23 11:43 UTC (permalink / raw)
To: peter.chen@kernel.org
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Pawel Laszczak
The controllers with rtl version greeter than
RTL_REVISION_NEW_LPM (0x00002700) has bug which causes that controller
doesn't resume from L1 state. It happens if after receiving LPM packet
controller starts transitioning to L1 and in this moment the driver force
resuming by write operation to PORTSC.PLS.
It's corner case and happens when write operation to PORTSC occurs during
device delay before transitioning to L1 after transmitting ACK
time (TL1TokenRetry).
Forcing transition from L1->L0 by driver for revision greeter than
RTL_REVISION_NEW_LPM is not needed, so driver can simply fix this issue
through block call of cdnsp_force_l0_go function.
Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
cc: stable@vger.kernel.org
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
---
drivers/usb/cdns3/cdnsp-gadget.c | 2 ++
drivers/usb/cdns3/cdnsp-gadget.h | 3 +++
drivers/usb/cdns3/cdnsp-ring.c | 3 ++-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c
index 7f5534db2086..4824a10df07e 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.c
+++ b/drivers/usb/cdns3/cdnsp-gadget.c
@@ -1793,6 +1793,8 @@ static void cdnsp_get_rev_cap(struct cdnsp_device *pdev)
reg += cdnsp_find_next_ext_cap(reg, 0, RTL_REV_CAP);
pdev->rev_cap = reg;
+ pdev->rtl_revision = readl(&pdev->rev_cap->rtl_revision);
+
dev_info(pdev->dev, "Rev: %08x/%08x, eps: %08x, buff: %08x/%08x\n",
readl(&pdev->rev_cap->ctrl_revision),
readl(&pdev->rev_cap->rtl_revision),
diff --git a/drivers/usb/cdns3/cdnsp-gadget.h b/drivers/usb/cdns3/cdnsp-gadget.h
index 87ac0cd113e7..fa02f861217f 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.h
+++ b/drivers/usb/cdns3/cdnsp-gadget.h
@@ -1360,6 +1360,7 @@ struct cdnsp_port {
* @rev_cap: Controller Capabilities Registers.
* @hcs_params1: Cached register copies of read-only HCSPARAMS1
* @hcc_params: Cached register copies of read-only HCCPARAMS1
+ * @rtl_revision: Cached controller rtl revision.
* @setup: Temporary buffer for setup packet.
* @ep0_preq: Internal allocated request used during enumeration.
* @ep0_stage: ep0 stage during enumeration process.
@@ -1414,6 +1415,8 @@ struct cdnsp_device {
__u32 hcs_params1;
__u32 hcs_params3;
__u32 hcc_params;
+ #define RTL_REVISION_NEW_LPM 0x00002701
+ __u32 rtl_revision;
/* Lock used in interrupt thread context. */
spinlock_t lock;
struct usb_ctrlrequest setup;
diff --git a/drivers/usb/cdns3/cdnsp-ring.c b/drivers/usb/cdns3/cdnsp-ring.c
index 46852529499d..fd06cb85c4ea 100644
--- a/drivers/usb/cdns3/cdnsp-ring.c
+++ b/drivers/usb/cdns3/cdnsp-ring.c
@@ -308,7 +308,8 @@ static bool cdnsp_ring_ep_doorbell(struct cdnsp_device *pdev,
writel(db_value, reg_addr);
- cdnsp_force_l0_go(pdev);
+ if (pdev->rtl_revision < RTL_REVISION_NEW_LPM)
+ cdnsp_force_l0_go(pdev);
/* Doorbell was set. */
return true;
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: cdnsp: fix L1 resume issue for RTL_REVISION_NEW_LPM version
2025-04-23 11:43 ` [PATCH] usb: cdnsp: fix L1 resume issue for RTL_REVISION_NEW_LPM version Pawel Laszczak
@ 2025-04-24 6:07 ` Peter Chen (CIX)
2025-04-24 9:01 ` Pawel Laszczak
0 siblings, 1 reply; 4+ messages in thread
From: Peter Chen (CIX) @ 2025-04-24 6:07 UTC (permalink / raw)
To: Pawel Laszczak
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
On 25-04-23 11:43:03, Pawel Laszczak wrote:
> The controllers with rtl version greeter than
less than?
> RTL_REVISION_NEW_LPM (0x00002700) has bug which causes that controller
> doesn't resume from L1 state. It happens if after receiving LPM packet
> controller starts transitioning to L1 and in this moment the driver force
> resuming by write operation to PORTSC.PLS.
> It's corner case and happens when write operation to PORTSC occurs during
> device delay before transitioning to L1 after transmitting ACK
> time (TL1TokenRetry).
>
> Forcing transition from L1->L0 by driver for revision greeter than
%s/greeter/larger
> RTL_REVISION_NEW_LPM is not needed, so driver can simply fix this issue
> through block call of cdnsp_force_l0_go function.
>
> Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
> cc: stable@vger.kernel.org
> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
> ---
> drivers/usb/cdns3/cdnsp-gadget.c | 2 ++
> drivers/usb/cdns3/cdnsp-gadget.h | 3 +++
> drivers/usb/cdns3/cdnsp-ring.c | 3 ++-
> 3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c
> index 7f5534db2086..4824a10df07e 100644
> --- a/drivers/usb/cdns3/cdnsp-gadget.c
> +++ b/drivers/usb/cdns3/cdnsp-gadget.c
> @@ -1793,6 +1793,8 @@ static void cdnsp_get_rev_cap(struct cdnsp_device *pdev)
> reg += cdnsp_find_next_ext_cap(reg, 0, RTL_REV_CAP);
> pdev->rev_cap = reg;
>
> + pdev->rtl_revision = readl(&pdev->rev_cap->rtl_revision);
> +
> dev_info(pdev->dev, "Rev: %08x/%08x, eps: %08x, buff: %08x/%08x\n",
> readl(&pdev->rev_cap->ctrl_revision),
> readl(&pdev->rev_cap->rtl_revision),
> diff --git a/drivers/usb/cdns3/cdnsp-gadget.h b/drivers/usb/cdns3/cdnsp-gadget.h
> index 87ac0cd113e7..fa02f861217f 100644
> --- a/drivers/usb/cdns3/cdnsp-gadget.h
> +++ b/drivers/usb/cdns3/cdnsp-gadget.h
> @@ -1360,6 +1360,7 @@ struct cdnsp_port {
> * @rev_cap: Controller Capabilities Registers.
> * @hcs_params1: Cached register copies of read-only HCSPARAMS1
> * @hcc_params: Cached register copies of read-only HCCPARAMS1
> + * @rtl_revision: Cached controller rtl revision.
> * @setup: Temporary buffer for setup packet.
> * @ep0_preq: Internal allocated request used during enumeration.
> * @ep0_stage: ep0 stage during enumeration process.
> @@ -1414,6 +1415,8 @@ struct cdnsp_device {
> __u32 hcs_params1;
> __u32 hcs_params3;
> __u32 hcc_params;
> + #define RTL_REVISION_NEW_LPM 0x00002701
0x2700?
> + __u32 rtl_revision;
> /* Lock used in interrupt thread context. */
> spinlock_t lock;
> struct usb_ctrlrequest setup;
> diff --git a/drivers/usb/cdns3/cdnsp-ring.c b/drivers/usb/cdns3/cdnsp-ring.c
> index 46852529499d..fd06cb85c4ea 100644
> --- a/drivers/usb/cdns3/cdnsp-ring.c
> +++ b/drivers/usb/cdns3/cdnsp-ring.c
> @@ -308,7 +308,8 @@ static bool cdnsp_ring_ep_doorbell(struct cdnsp_device *pdev,
>
> writel(db_value, reg_addr);
>
> - cdnsp_force_l0_go(pdev);
> + if (pdev->rtl_revision < RTL_REVISION_NEW_LPM)
> + cdnsp_force_l0_go(pdev);
Pawel, it may not solve all issues for controllers which RTL version
is less than 0x2700, do you have any other patches for it?
--
Best regards,
Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] usb: cdnsp: fix L1 resume issue for RTL_REVISION_NEW_LPM version
2025-04-24 6:07 ` Peter Chen (CIX)
@ 2025-04-24 9:01 ` Pawel Laszczak
2025-04-24 11:36 ` Pawel Laszczak
0 siblings, 1 reply; 4+ messages in thread
From: Pawel Laszczak @ 2025-04-24 9:01 UTC (permalink / raw)
To: Peter Chen (CIX)
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
>
>On 25-04-23 11:43:03, Pawel Laszczak wrote:
>> The controllers with rtl version greeter than
>less than?
>
>> RTL_REVISION_NEW_LPM (0x00002700) has bug which causes that controller
>> doesn't resume from L1 state. It happens if after receiving LPM packet
>> controller starts transitioning to L1 and in this moment the driver
>> force resuming by write operation to PORTSC.PLS.
>> It's corner case and happens when write operation to PORTSC occurs
>> during device delay before transitioning to L1 after transmitting ACK
>> time (TL1TokenRetry).
>>
>> Forcing transition from L1->L0 by driver for revision greeter than
>
>%s/greeter/larger
>
>> RTL_REVISION_NEW_LPM is not needed, so driver can simply fix this
>> issue through block call of cdnsp_force_l0_go function.
>>
>> Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence
>> USBSSP DRD Driver")
>> cc: stable@vger.kernel.org
>> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
>> ---
>> drivers/usb/cdns3/cdnsp-gadget.c | 2 ++
>> drivers/usb/cdns3/cdnsp-gadget.h | 3 +++
>> drivers/usb/cdns3/cdnsp-ring.c | 3 ++-
>> 3 files changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/cdns3/cdnsp-gadget.c
>> b/drivers/usb/cdns3/cdnsp-gadget.c
>> index 7f5534db2086..4824a10df07e 100644
>> --- a/drivers/usb/cdns3/cdnsp-gadget.c
>> +++ b/drivers/usb/cdns3/cdnsp-gadget.c
>> @@ -1793,6 +1793,8 @@ static void cdnsp_get_rev_cap(struct cdnsp_device
>*pdev)
>> reg += cdnsp_find_next_ext_cap(reg, 0, RTL_REV_CAP);
>> pdev->rev_cap = reg;
>>
>> + pdev->rtl_revision = readl(&pdev->rev_cap->rtl_revision);
>> +
>> dev_info(pdev->dev, "Rev: %08x/%08x, eps: %08x, buff: %08x/%08x\n",
>> readl(&pdev->rev_cap->ctrl_revision),
>> readl(&pdev->rev_cap->rtl_revision),
>> diff --git a/drivers/usb/cdns3/cdnsp-gadget.h
>> b/drivers/usb/cdns3/cdnsp-gadget.h
>> index 87ac0cd113e7..fa02f861217f 100644
>> --- a/drivers/usb/cdns3/cdnsp-gadget.h
>> +++ b/drivers/usb/cdns3/cdnsp-gadget.h
>> @@ -1360,6 +1360,7 @@ struct cdnsp_port {
>> * @rev_cap: Controller Capabilities Registers.
>> * @hcs_params1: Cached register copies of read-only HCSPARAMS1
>> * @hcc_params: Cached register copies of read-only HCCPARAMS1
>> + * @rtl_revision: Cached controller rtl revision.
>> * @setup: Temporary buffer for setup packet.
>> * @ep0_preq: Internal allocated request used during enumeration.
>> * @ep0_stage: ep0 stage during enumeration process.
>> @@ -1414,6 +1415,8 @@ struct cdnsp_device {
>> __u32 hcs_params1;
>> __u32 hcs_params3;
>> __u32 hcc_params;
>> + #define RTL_REVISION_NEW_LPM 0x00002701
>
>0x2700?
>
>> + __u32 rtl_revision;
>> /* Lock used in interrupt thread context. */
>> spinlock_t lock;
>> struct usb_ctrlrequest setup;
>> diff --git a/drivers/usb/cdns3/cdnsp-ring.c
>> b/drivers/usb/cdns3/cdnsp-ring.c index 46852529499d..fd06cb85c4ea
>> 100644
>> --- a/drivers/usb/cdns3/cdnsp-ring.c
>> +++ b/drivers/usb/cdns3/cdnsp-ring.c
>> @@ -308,7 +308,8 @@ static bool cdnsp_ring_ep_doorbell(struct
>> cdnsp_device *pdev,
>>
>> writel(db_value, reg_addr);
>>
>> - cdnsp_force_l0_go(pdev);
>> + if (pdev->rtl_revision < RTL_REVISION_NEW_LPM)
>> + cdnsp_force_l0_go(pdev);
>
>Pawel, it may not solve all issues for controllers which RTL version is less than
>0x2700, do you have any other patches for it?
At this moment, it's the last patch for LPM issues which we was able to
debug and make fix in driver.
Thanks,
Pawel
>
>--
>
>Best regards,
>Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] usb: cdnsp: fix L1 resume issue for RTL_REVISION_NEW_LPM version
2025-04-24 9:01 ` Pawel Laszczak
@ 2025-04-24 11:36 ` Pawel Laszczak
0 siblings, 0 replies; 4+ messages in thread
From: Pawel Laszczak @ 2025-04-24 11:36 UTC (permalink / raw)
To: Peter Chen (CIX)
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
>>
>>On 25-04-23 11:43:03, Pawel Laszczak wrote:
>>> The controllers with rtl version greeter than
>>less than?
>>
>>> RTL_REVISION_NEW_LPM (0x00002700) has bug which causes that
>>> controller doesn't resume from L1 state. It happens if after
>>> receiving LPM packet controller starts transitioning to L1 and in
>>> this moment the driver force resuming by write operation to PORTSC.PLS.
>>> It's corner case and happens when write operation to PORTSC occurs
>>> during device delay before transitioning to L1 after transmitting ACK
>>> time (TL1TokenRetry).
>>>
>>> Forcing transition from L1->L0 by driver for revision greeter than
>>
>>%s/greeter/larger
>>
>>> RTL_REVISION_NEW_LPM is not needed, so driver can simply fix this
>>> issue through block call of cdnsp_force_l0_go function.
>>>
>>> Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence
>>> USBSSP DRD Driver")
>>> cc: stable@vger.kernel.org
>>> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
>>> ---
>>> drivers/usb/cdns3/cdnsp-gadget.c | 2 ++
>>> drivers/usb/cdns3/cdnsp-gadget.h | 3 +++
>>> drivers/usb/cdns3/cdnsp-ring.c | 3 ++-
>>> 3 files changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/cdns3/cdnsp-gadget.c
>>> b/drivers/usb/cdns3/cdnsp-gadget.c
>>> index 7f5534db2086..4824a10df07e 100644
>>> --- a/drivers/usb/cdns3/cdnsp-gadget.c
>>> +++ b/drivers/usb/cdns3/cdnsp-gadget.c
>>> @@ -1793,6 +1793,8 @@ static void cdnsp_get_rev_cap(struct
>>> cdnsp_device
>>*pdev)
>>> reg += cdnsp_find_next_ext_cap(reg, 0, RTL_REV_CAP);
>>> pdev->rev_cap = reg;
>>>
>>> + pdev->rtl_revision = readl(&pdev->rev_cap->rtl_revision);
>>> +
>>> dev_info(pdev->dev, "Rev: %08x/%08x, eps: %08x, buff: %08x/%08x\n",
>>> readl(&pdev->rev_cap->ctrl_revision),
>>> readl(&pdev->rev_cap->rtl_revision),
>>> diff --git a/drivers/usb/cdns3/cdnsp-gadget.h
>>> b/drivers/usb/cdns3/cdnsp-gadget.h
>>> index 87ac0cd113e7..fa02f861217f 100644
>>> --- a/drivers/usb/cdns3/cdnsp-gadget.h
>>> +++ b/drivers/usb/cdns3/cdnsp-gadget.h
>>> @@ -1360,6 +1360,7 @@ struct cdnsp_port {
>>> * @rev_cap: Controller Capabilities Registers.
>>> * @hcs_params1: Cached register copies of read-only HCSPARAMS1
>>> * @hcc_params: Cached register copies of read-only HCCPARAMS1
>>> + * @rtl_revision: Cached controller rtl revision.
>>> * @setup: Temporary buffer for setup packet.
>>> * @ep0_preq: Internal allocated request used during enumeration.
>>> * @ep0_stage: ep0 stage during enumeration process.
>>> @@ -1414,6 +1415,8 @@ struct cdnsp_device {
>>> __u32 hcs_params1;
>>> __u32 hcs_params3;
>>> __u32 hcc_params;
>>> + #define RTL_REVISION_NEW_LPM 0x00002701
>>
>>0x2700?
It does no matter - 0x2700 has not been part of any delivery package.
I will change it to 0x2700.
This issue will be fixed in RTL_REVISION >= 0x276E
>>
>>> + __u32 rtl_revision;
>>> /* Lock used in interrupt thread context. */
>>> spinlock_t lock;
>>> struct usb_ctrlrequest setup;
>>> diff --git a/drivers/usb/cdns3/cdnsp-ring.c
>>> b/drivers/usb/cdns3/cdnsp-ring.c index 46852529499d..fd06cb85c4ea
>>> 100644
>>> --- a/drivers/usb/cdns3/cdnsp-ring.c
>>> +++ b/drivers/usb/cdns3/cdnsp-ring.c
>>> @@ -308,7 +308,8 @@ static bool cdnsp_ring_ep_doorbell(struct
>>> cdnsp_device *pdev,
>>>
>>> writel(db_value, reg_addr);
>>>
>>> - cdnsp_force_l0_go(pdev);
>>> + if (pdev->rtl_revision < RTL_REVISION_NEW_LPM)
>>> + cdnsp_force_l0_go(pdev);
>>
>>Pawel, it may not solve all issues for controllers which RTL version is
>>less than 0x2700, do you have any other patches for it?
>
>At this moment, it's the last patch for LPM issues which we was able to debug
>and make fix in driver.
>
>Thanks,
>Pawel
>
>>
>>--
>>
>>Best regards,
>>Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-24 11:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250423111535.3894417-1-pawell@cadence.com>
2025-04-23 11:43 ` [PATCH] usb: cdnsp: fix L1 resume issue for RTL_REVISION_NEW_LPM version Pawel Laszczak
2025-04-24 6:07 ` Peter Chen (CIX)
2025-04-24 9:01 ` Pawel Laszczak
2025-04-24 11:36 ` Pawel Laszczak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox