Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] usb: xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host
@ 2024-08-29  7:30 WangYuli
  2024-08-29  8:46 ` Greg KH
  2024-08-29  9:38 ` Sergei Shtylyov
  0 siblings, 2 replies; 6+ messages in thread
From: WangYuli @ 2024-08-29  7:30 UTC (permalink / raw)
  To: mathias.nyman, gregkh, bhelgaas
  Cc: linux-usb, linux-kernel, linux-pci, guanwentao, zhanjun, WangYuli,
	Chen Baozi, Wang Zhimin, Chen Zhenhua, Wang Yinfeng, Jiakun Shuai

The resume operation of Phytium Px210 xHCI host would failed
to restore state. Use the XHCI_RESET_ON_RESUME quirk to skip
it and reset the controller after resume.

Co-developed-by: Chen Baozi <chenbaozi@phytium.com.cn>
Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
Co-developed-by: Wang Zhimin <wangzhimin1179@phytium.com.cn>
Signed-off-by: Wang Zhimin <wangzhimin1179@phytium.com.cn>
Co-developed-by: Chen Zhenhua <chenzhenhua@phytium.com.cn>
Signed-off-by: Chen Zhenhua <chenzhenhua@phytium.com.cn>
Co-developed-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Co-developed-by: Jiakun Shuai <shuaijiakun1288@phytium.com.cn>
Signed-off-by: Jiakun Shuai <shuaijiakun1288@phytium.com.cn>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
---
 drivers/usb/host/xhci-pci.c | 6 ++++++
 include/linux/pci_ids.h     | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index b5705ed01d83..af967644489c 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -55,6 +55,8 @@
 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI		0x51ed
 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_PCH_XHCI	0x54ed
 
+#define PCI_DEVICE_ID_PHYTIUM_XHCI			0xdc27
+
 /* Thunderbolt */
 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI		0x1138
 #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI	0x15b5
@@ -407,6 +409,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	if (pdev->vendor == PCI_VENDOR_ID_VIA)
 		xhci->quirks |= XHCI_RESET_ON_RESUME;
 
+	if (pdev->vendor == PCI_VENDOR_ID_PHYTIUM ||
+	    pdev->device == PCI_DEVICE_ID_PHYTIUM_XHCI)
+		xhci->quirks |= XHCI_RESET_ON_RESUME;
+
 	/* See https://bugzilla.kernel.org/show_bug.cgi?id=79511 */
 	if (pdev->vendor == PCI_VENDOR_ID_VIA &&
 			pdev->device == 0x3432)
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index e388c8b1cbc2..25fff4130503 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2605,6 +2605,8 @@
 
 #define PCI_VENDOR_ID_FUNGIBLE		0x1dad
 
+#define PCI_VENDOR_ID_PHYTIUM		0x1db7
+
 #define PCI_VENDOR_ID_HXT		0x1dbf
 
 #define PCI_VENDOR_ID_TEKRAM		0x1de1
-- 
2.43.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host
  2024-08-29  7:30 [PATCH] usb: xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host WangYuli
@ 2024-08-29  8:46 ` Greg KH
  2024-08-29  8:55   ` WangYuli
  2024-08-29  9:38 ` Sergei Shtylyov
  1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2024-08-29  8:46 UTC (permalink / raw)
  To: WangYuli
  Cc: mathias.nyman, bhelgaas, linux-usb, linux-kernel, linux-pci,
	guanwentao, zhanjun, Chen Baozi, Wang Zhimin, Chen Zhenhua,
	Wang Yinfeng, Jiakun Shuai

On Thu, Aug 29, 2024 at 03:30:05PM +0800, WangYuli wrote:
> The resume operation of Phytium Px210 xHCI host would failed
> to restore state. Use the XHCI_RESET_ON_RESUME quirk to skip
> it and reset the controller after resume.
> 
> Co-developed-by: Chen Baozi <chenbaozi@phytium.com.cn>
> Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
> Co-developed-by: Wang Zhimin <wangzhimin1179@phytium.com.cn>
> Signed-off-by: Wang Zhimin <wangzhimin1179@phytium.com.cn>
> Co-developed-by: Chen Zhenhua <chenzhenhua@phytium.com.cn>
> Signed-off-by: Chen Zhenhua <chenzhenhua@phytium.com.cn>
> Co-developed-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
> Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
> Co-developed-by: Jiakun Shuai <shuaijiakun1288@phytium.com.cn>
> Signed-off-by: Jiakun Shuai <shuaijiakun1288@phytium.com.cn>
> Signed-off-by: WangYuli <wangyuli@uniontech.com>
> ---
>  drivers/usb/host/xhci-pci.c | 6 ++++++
>  include/linux/pci_ids.h     | 2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index b5705ed01d83..af967644489c 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -55,6 +55,8 @@
>  #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI		0x51ed
>  #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_PCH_XHCI	0x54ed
>  
> +#define PCI_DEVICE_ID_PHYTIUM_XHCI			0xdc27
> +
>  /* Thunderbolt */
>  #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI		0x1138
>  #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI	0x15b5
> @@ -407,6 +409,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
>  	if (pdev->vendor == PCI_VENDOR_ID_VIA)
>  		xhci->quirks |= XHCI_RESET_ON_RESUME;
>  
> +	if (pdev->vendor == PCI_VENDOR_ID_PHYTIUM ||
> +	    pdev->device == PCI_DEVICE_ID_PHYTIUM_XHCI)
> +		xhci->quirks |= XHCI_RESET_ON_RESUME;
> +
>  	/* See https://bugzilla.kernel.org/show_bug.cgi?id=79511 */
>  	if (pdev->vendor == PCI_VENDOR_ID_VIA &&
>  			pdev->device == 0x3432)
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index e388c8b1cbc2..25fff4130503 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -2605,6 +2605,8 @@
>  
>  #define PCI_VENDOR_ID_FUNGIBLE		0x1dad
>  
> +#define PCI_VENDOR_ID_PHYTIUM		0x1db7

Please read the top of this file, there's no need to add this id to this
file as you are only using it in one .c file.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host
  2024-08-29  8:46 ` Greg KH
@ 2024-08-29  8:55   ` WangYuli
  2024-08-29  9:09     ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: WangYuli @ 2024-08-29  8:55 UTC (permalink / raw)
  To: Greg KH
  Cc: mathias.nyman, bhelgaas, linux-usb, linux-kernel, linux-pci,
	guanwentao, zhanjun, Chen Baozi, Wang Zhimin, Chen Zhenhua,
	Wang Yinfeng, Jiakun Shuai


On 2024/8/29 16:46, Greg KH wrote:
> Please read the top of this file, there's no need to add this id to this
> file as you are only using it in one .c file.

Thanks for review.

More files using PCI_VENDOR_ID_PHYTIUM will appear,though maybe not in 
the USB subsystem.

These patches are on their way and I won't keep you waiting too long.

However,if I temporarily delete this line and use a raw hexadecimal 
value in xhci-pci.c,I'll need to modify xhci-pci.c again soon.

If you think it is more reasonable and acceptable,I'll send a patch-v2 
immediately to avoid breaking the rules for pci_ids.

>
> thanks,
>
> greg k-h
>
Thanks,
-- 
WangYuli


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host
  2024-08-29  8:55   ` WangYuli
@ 2024-08-29  9:09     ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2024-08-29  9:09 UTC (permalink / raw)
  To: WangYuli
  Cc: mathias.nyman, bhelgaas, linux-usb, linux-kernel, linux-pci,
	guanwentao, zhanjun, Chen Baozi, Wang Zhimin, Chen Zhenhua,
	Wang Yinfeng, Jiakun Shuai

On Thu, Aug 29, 2024 at 04:55:19PM +0800, WangYuli wrote:
> 
> On 2024/8/29 16:46, Greg KH wrote:
> > Please read the top of this file, there's no need to add this id to this
> > file as you are only using it in one .c file.
> 
> Thanks for review.
> 
> More files using PCI_VENDOR_ID_PHYTIUM will appear,though maybe not in the
> USB subsystem.
> 
> These patches are on their way and I won't keep you waiting too long.

When that change happens, then you can add it to the .h file.

> However,if I temporarily delete this line and use a raw hexadecimal value in
> xhci-pci.c,I'll need to modify xhci-pci.c again soon.

Just put the define in xhci-pci.c and all will be fine.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host
  2024-08-29  7:30 [PATCH] usb: xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host WangYuli
  2024-08-29  8:46 ` Greg KH
@ 2024-08-29  9:38 ` Sergei Shtylyov
  2024-08-29 16:51   ` Bjorn Helgaas
  1 sibling, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2024-08-29  9:38 UTC (permalink / raw)
  To: WangYuli, mathias.nyman, gregkh, bhelgaas
  Cc: linux-usb, linux-kernel, linux-pci, guanwentao, zhanjun,
	Chen Baozi, Wang Zhimin, Chen Zhenhua, Wang Yinfeng, Jiakun Shuai

On 8/29/24 10:30 AM, WangYuli wrote:

> The resume operation of Phytium Px210 xHCI host would failed

   Fail?

> to restore state. Use the XHCI_RESET_ON_RESUME quirk to skip
> it and reset the controller after resume.
> 
> Co-developed-by: Chen Baozi <chenbaozi@phytium.com.cn>
> Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
> Co-developed-by: Wang Zhimin <wangzhimin1179@phytium.com.cn>
> Signed-off-by: Wang Zhimin <wangzhimin1179@phytium.com.cn>
> Co-developed-by: Chen Zhenhua <chenzhenhua@phytium.com.cn>
> Signed-off-by: Chen Zhenhua <chenzhenhua@phytium.com.cn>
> Co-developed-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
> Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
> Co-developed-by: Jiakun Shuai <shuaijiakun1288@phytium.com.cn>
> Signed-off-by: Jiakun Shuai <shuaijiakun1288@phytium.com.cn>
> Signed-off-by: WangYuli <wangyuli@uniontech.com>
[...]

> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index b5705ed01d83..af967644489c 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -55,6 +55,8 @@
>  #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI		0x51ed
>  #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_PCH_XHCI	0x54ed
>  
> +#define PCI_DEVICE_ID_PHYTIUM_XHCI			0xdc27
> +
>  /* Thunderbolt */
>  #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI		0x1138
>  #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI	0x15b5
> @@ -407,6 +409,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
>  	if (pdev->vendor == PCI_VENDOR_ID_VIA)
>  		xhci->quirks |= XHCI_RESET_ON_RESUME;
>  
> +	if (pdev->vendor == PCI_VENDOR_ID_PHYTIUM ||

   Hm, ||, not &&?

> +	    pdev->device == PCI_DEVICE_ID_PHYTIUM_XHCI)
> +		xhci->quirks |= XHCI_RESET_ON_RESUME;
> +
>  	/* See https://bugzilla.kernel.org/show_bug.cgi?id=79511 */
>  	if (pdev->vendor == PCI_VENDOR_ID_VIA &&
>  			pdev->device == 0x3432)
[...]

MBR, Sergey

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] usb: xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host
  2024-08-29  9:38 ` Sergei Shtylyov
@ 2024-08-29 16:51   ` Bjorn Helgaas
  0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2024-08-29 16:51 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: WangYuli, mathias.nyman, gregkh, bhelgaas, linux-usb,
	linux-kernel, linux-pci, guanwentao, zhanjun, Chen Baozi,
	Wang Zhimin, Chen Zhenhua, Wang Yinfeng, Jiakun Shuai

On Thu, Aug 29, 2024 at 12:38:58PM +0300, Sergei Shtylyov wrote:
> On 8/29/24 10:30 AM, WangYuli wrote:
> > +	if (pdev->vendor == PCI_VENDOR_ID_PHYTIUM ||
> 
>    Hm, ||, not &&?
> 
> > +	    pdev->device == PCI_DEVICE_ID_PHYTIUM_XHCI)
> > +		xhci->quirks |= XHCI_RESET_ON_RESUME;

Definitely a bug, thanks for spotting it!  Must check both Vendor
*and* Device ID.  There are likely unrelated devices from other
vendors using the PCI_DEVICE_ID_PHYTIUM_XHCI Device ID value.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-08-29 16:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-29  7:30 [PATCH] usb: xHCI: add XHCI_RESET_ON_RESUME quirk for Phytium xHCI host WangYuli
2024-08-29  8:46 ` Greg KH
2024-08-29  8:55   ` WangYuli
2024-08-29  9:09     ` Greg KH
2024-08-29  9:38 ` Sergei Shtylyov
2024-08-29 16:51   ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox