Skip to contentSkip to conversation

usb: xhci: Fix vendor command error if the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION.

PATCH New Ted Chen 4 participants 8 messages Nov 25, 2015 – Jan 25, 2016

Subsystems (2)
lore
Share & tools
lore

Ted Chen

author
#0 lore raw

PATCH 1/1 usb: xhci: Fix vendor command error if the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION.

Add a condition of set_address and set_configuration to check if the request is standardized.

---
 drivers/usb/host/xhci.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +4 -2
index ca598aa..cb8a04b 100644
@@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct usb_device *udev, unsigned long pipe,
 	if (usb_pipedevice(pipe) == ctrl->rootdev)
 		return xhci_submit_root(udev, pipe, buffer, setup);
 
-	if (setup->request == USB_REQ_SET_ADDRESS)
+	if (setup->request == USB_REQ_SET_ADDRESS &&
+	   (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD)
 		return xhci_address_device(udev, root_portnr);
 
-	if (setup->request == USB_REQ_SET_CONFIGURATION) {
+	if (setup->request == USB_REQ_SET_CONFIGURATION &&
+	   (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
 		ret = xhci_set_configuration(udev);
 		if (ret) {
 			puts("Failed to configure xHCI endpoint\n");
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/1 usb: xhci: Fix vendor command error if the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION.

Add a condition of set_address and set_configuration to check if the request is standardized.

---
 drivers/usb/host/xhci.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +4 -2
index ca598aa..cb8a04b 100644
@@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct usb_device *udev, unsigned long pipe,
 	if (usb_pipedevice(pipe) == ctrl->rootdev)
 		return xhci_submit_root(udev, pipe, buffer, setup);
 
-	if (setup->request == USB_REQ_SET_ADDRESS)
+	if (setup->request == USB_REQ_SET_ADDRESS &&
+	   (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD)
 		return xhci_address_device(udev, root_portnr);
 
-	if (setup->request == USB_REQ_SET_CONFIGURATION) {
+	if (setup->request == USB_REQ_SET_CONFIGURATION &&
+	   (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
 		ret = xhci_set_configuration(udev);
 		if (ret) {
 			puts("Failed to configure xHCI endpoint\n");
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/1 usb: xhci: Fix vendor command error if the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION.

Hi Ted,

Quoted 28 lines · Ted Chen

Add a condition of set_address and set_configuration to check if the request is standardized.

---
 drivers/usb/host/xhci.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +4 -3
index ca598aa..cb8a04b 100644
@@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct usb_device *udev, unsigned long pipe,
        if (usb_pipedevice(pipe) == ctrl->rootdev)
                return xhci_submit_root(udev, pipe, buffer, setup);
 
-       if (setup->request == USB_REQ_SET_ADDRESS)
+       if (setup->request == USB_REQ_SET_ADDRESS &&
+          (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD)
                return xhci_address_device(udev, root_portnr);
 
-       if (setup->request == USB_REQ_SET_CONFIGURATION) {
+       if (setup->request == USB_REQ_SET_CONFIGURATION &&
+          (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
                ret = xhci_set_configuration(udev);
                if (ret) {
                        puts("Failed to configure xHCI endpoint\n");
--
Quoted 2 lines

1.7.9.5

Tested on Odroid-XU4 with Ethernet USB3.0 RT8153-VB.

-Anand Moon

#3 lore raw

PATCH 1/1 usb: xhci: Fix vendor command error if the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION.

Hi Anand,

I have a odroid-xu4, but it doesn't detect the rtl8153:

U-Boot 2016.01-rc1-00441-g75507d5-dirty (Dec 07 2015 - 15:46:09 +0800) for ODROID-XU3

CPU:   Exynos5422 @ 800 MHz
Model: Odroid XU3 based on EXYNOS5422
Board: Odroid XU3 based on EXYNOS5422
Type:  xu4
DRAM:  2 GiB

__of_translate_address: Bad cell count for gpx0
MMC: EXYNOS DWMMC: 0, EXYNOS DWMMC: 1
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0

switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
starting USB...

USB0:   USB EHCI 1.00
USB1:   Register 2000140 NbrPorts 2

Starting the controller
USB XHCI 1.00
USB2: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 1 for devices... 2 USB Device(s) found
scanning bus 2 for devices... 2 USB Device(s) found
scanning usb for ethernet devices... Setup ERROR: address device
command for slot 1.
Unknown version 0x0000
Unknown Device
0 Ethernet Device(s) found
No ethernet found.

could you send me your odroid-xu3_defconfig? Thanks. BTW, I added "#define CONFIG_USB_ETHER_RTL8152" to include/configs/exynos5-common.h

Regards,
Joe

Quoted 46 lines · Anand Moon

Hi Ted,

drivers/usb/host/xhci.c static int _xhci_submit_control_msg(struct

Quoted 13 lines · Ted Chen

Add a condition of set_address and set_configuration to check if the request is standardized.

---
 drivers/usb/host/xhci.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +0 -0
index ca598aa..cb8a04b 100644
@@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct

usb_device *udev, unsigned long pipe,

Quoted 15 lines
drivers/usb/host/xhci.c +4 -3
        if (usb_pipedevice(pipe) == ctrl->rootdev)
                return xhci_submit_root(udev, pipe, buffer, setup);
 
-       if (setup->request == USB_REQ_SET_ADDRESS)
+       if (setup->request == USB_REQ_SET_ADDRESS &&
+          (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD)
                return xhci_address_device(udev, root_portnr);
 
-       if (setup->request == USB_REQ_SET_CONFIGURATION) {
+       if (setup->request == USB_REQ_SET_CONFIGURATION &&
+          (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
                ret = xhci_set_configuration(udev);
                if (ret) {
                        puts("Failed to configure xHCI endpoint\n");
--
Quoted 2 lines

1.7.9.5

Tested on Odroid-XU4 with Ethernet USB3.0 RT8153-VB.

-Anand Moon
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#4 lore raw

PATCH 1/1 usb: xhci: Fix vendor command error if the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION.

Oops, please ignore this message. The rtl8153 is detected :)

Quoted 101 lines · Joe Culler

Hi Anand,

I have a odroid-xu4, but it doesn't detect the rtl8153:

U-Boot 2016.01-rc1-00441-g75507d5-dirty (Dec 07 2015 - 15:46:09 +0800) for ODROID-XU3

CPU:   Exynos5422 @ 800 MHz
Model: Odroid XU3 based on EXYNOS5422
Board: Odroid XU3 based on EXYNOS5422
Type:  xu4
DRAM:  2 GiB

__of_translate_address: Bad cell count for gpx0
MMC: EXYNOS DWMMC: 0, EXYNOS DWMMC: 1
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0

switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
starting USB...

USB0:   USB EHCI 1.00
USB1:   Register 2000140 NbrPorts 2

Starting the controller
USB XHCI 1.00
USB2: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 1 for devices... 2 USB Device(s) found
scanning bus 2 for devices... 2 USB Device(s) found
scanning usb for ethernet devices... Setup ERROR: address device
command for slot 1.
Unknown version 0x0000
Unknown Device
0 Ethernet Device(s) found
No ethernet found.

could you send me your odroid-xu3_defconfig? Thanks. BTW, I added "#define CONFIG_USB_ETHER_RTL8152" to include/configs/exynos5-common.h

Regards,
Joe

Quoted 46 lines · Anand Moon

Hi Ted,

drivers/usb/host/xhci.c static int _xhci_submit_control_msg(struct

Quoted 13 lines · Ted Chen

Add a condition of set_address and set_configuration to check if the request is standardized.

---
 drivers/usb/host/xhci.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +0 -0
index ca598aa..cb8a04b 100644
@@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct

usb_device *udev, unsigned long pipe,

Quoted 15 lines
drivers/usb/host/xhci.c +4 -3
        if (usb_pipedevice(pipe) == ctrl->rootdev)
                return xhci_submit_root(udev, pipe, buffer, setup);
 
-       if (setup->request == USB_REQ_SET_ADDRESS)
+       if (setup->request == USB_REQ_SET_ADDRESS &&
+          (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD)
                return xhci_address_device(udev, root_portnr);
 
-       if (setup->request == USB_REQ_SET_CONFIGURATION) {
+       if (setup->request == USB_REQ_SET_CONFIGURATION &&
+          (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
                ret = xhci_set_configuration(udev);
                if (ret) {
                        puts("Failed to configure xHCI endpoint\n");
--
Quoted 2 lines

1.7.9.5

Tested on Odroid-XU4 with Ethernet USB3.0 RT8153-VB.

-Anand Moon
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#5 lore raw

PATCH 1/1 usb: xhci: Fix vendor command error if the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION.

In reply to Ted Chen
Quoted 13 lines · Ted Chen

Add a condition of set_address and set_configuration to check if the request is standardized.

---
 drivers/usb/host/xhci.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +0 -0
index ca598aa..cb8a04b 100644

drivers/usb/host/xhci.c static int _xhci_submit_control_msg(struct usb_device · line 943

Quoted 3 lines
drivers/usb/host/xhci.c +0 -0
@@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct usb_device
 *udev, unsigned long pipe, if (usb_pipedevice(pipe) == ctrl->rootdev)
 		return xhci_submit_root(udev, pipe, buffer, setup);
 

Hi!
What do you say we reorder the check a little:

if ((setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
	if (setup->request == USB_REQ_SET_ADDRESS)
		return xhci_address_device(udev, root_portnr);

	if (setup->request == USB_REQ_SET_CONFIGURATION)
		...
}

Also, I suspect this sort of fix needs to be applied to at least dwc3 ep0.c, r8a66597-hcd.c and musb_hcd.c as well.

Paging Hans so he can share his visdom too :)

drivers/usb/host/xhci.c static int _xhci_submit_control_msg(struct usb_device *udev, unsigned long pipe, · line 952

Quoted 11 lines
drivers/usb/host/xhci.c +4 -2
-	if (setup->request == USB_REQ_SET_ADDRESS)
+	if (setup->request == USB_REQ_SET_ADDRESS &&
+	   (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD)
 		return xhci_address_device(udev, root_portnr);
 
-	if (setup->request == USB_REQ_SET_CONFIGURATION) {
+	if (setup->request == USB_REQ_SET_CONFIGURATION &&
+	   (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
 		ret = xhci_set_configuration(udev);
 		if (ret) {
 			puts("Failed to configure xHCI endpoint\n");

Best regards,
Marek Vasut

author
#6 lore raw

PATCH 1/1 usb: xhci: Fix vendor command error if the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION.

Hi Marek,

Quoted 41 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: Thursday, November 26, 2015 9:25 AM
To: Ted
Cc: swarren at nvidia.com; u-boot at lists.denx.de; linux.amoon at gmail.com; Hans de Goede
Subject: Re: [PATCH] usb: xhci: Fix vendor command error if the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION.

Quoted 1 line · Ted Chen

Add a condition of set_address and set_configuration to

check if the

Review

Quoted 8 lines

request is standardized.

---
 drivers/usb/host/xhci.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/host/xhci.c index

Quoted 5 lines

ca598aa..cb8a04b 100644

drivers/usb/host/xhci.c +0 -0
@@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct 

usb_device *udev, unsigned long pipe, if

(usb_pipedevice(pipe) == ctrl->rootdev)

Quoted 2 lines

return xhci_submit_root(udev, pipe, buffer, setup);

Hi!
What do you say we reorder the check a little:

if ((setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
	if (setup->request == USB_REQ_SET_ADDRESS)
		return xhci_address_device(udev, root_portnr);

	if (setup->request == USB_REQ_SET_CONFIGURATION)
		...
}
Quoted 3 lines

Also, I suspect this sort of fix needs to be applied to at least dwc3 ep0.c, r8a66597-hcd.c and musb_hcd.c as well.

I don't have another board in my hand, so I can't verify the other xhci host controller.

But I have confirmed this patch in xhci.c actually can fix errors while the the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION in USB vendor command.

Quoted 1 line

Paging Hans so he can share his visdom too :)

Hi Hans,

Do you have any comments?

Thanks

Quoted 18 lines

drivers/usb/host/xhci.c static int _xhci_submit_control_msg(struct usb_device *udev, unsigned long pipe, · line 952

Quoted 12 lines
drivers/usb/host/xhci.c +4 -2
-	if (setup->request == USB_REQ_SET_ADDRESS)
+	if (setup->request == USB_REQ_SET_ADDRESS &&
+	   (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD)
 		return xhci_address_device(udev, root_portnr);
 
-	if (setup->request == USB_REQ_SET_CONFIGURATION) {
+	if (setup->request == USB_REQ_SET_CONFIGURATION &&
+	   (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
 		ret = xhci_set_configuration(udev);
 		if (ret) {
 			puts("Failed to configure xHCI endpoint\n");

Best regards,
Marek Vasut

------Please consider the environment before printing this e-mail.

#7 lore raw

PATCH 1/1 usb: xhci: Fix vendor command error if the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION.

Quoted 1 line · Ted

Hi Marek,

Hi Ted,

Quoted 49 lines
Quoted 49 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: Thursday, November 26, 2015 9:25 AM
To: Ted
Cc: swarren at nvidia.com; u-boot at lists.denx.de; linux.amoon at gmail.com; Hans de Goede
Subject: Re: [PATCH] usb: xhci: Fix vendor command error if the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION.

Quoted 1 line · Ted Chen

Add a condition of set_address and set_configuration to

check if the

Review

Quoted 9 lines

request is standardized.

---

 drivers/usb/host/xhci.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/host/xhci.c index

Quoted 5 lines

ca598aa..cb8a04b 100644

drivers/usb/host/xhci.c +0 -0
@@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct

usb_device *udev, unsigned long pipe, if

(usb_pipedevice(pipe) == ctrl->rootdev)

Quoted 1 line

return xhci_submit_root(udev, pipe, buffer, setup);

Hi!
What do you say we reorder the check a little:

if ((setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {

	if (setup->request == USB_REQ_SET_ADDRESS)
	
		return xhci_address_device(udev, root_portnr);
	
	if (setup->request == USB_REQ_SET_CONFIGURATION)
	
		...
Quoted 7 lines
Quoted 4 lines

}

Also, I suspect this sort of fix needs to be applied to at least dwc3 ep0.c, r8a66597-hcd.c and musb_hcd.c as well.

I don't have another board in my hand, so I can't verify the other xhci host controller.

That's fine, just fixing this problem everywhere is enough and the people who have the controller can test it themselves.

Quoted 3 lines

But I have confirmed this patch in xhci.c actually can fix errors while the the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION in USB vendor command.

Excellent.

Quoted 7 lines
Quoted 1 line

Paging Hans so he can share his visdom too :)

Hi Hans,

Do you have any comments?

Thanks

Thanks!

Quoted 19 lines
Quoted 19 lines
Quoted 4 lines
drivers/usb/host/xhci.c +2 -1
-	if (setup->request == USB_REQ_SET_ADDRESS)
+	if (setup->request == USB_REQ_SET_ADDRESS &&
+	   (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD)
 

drivers/usb/host/xhci.c static int _xhci_submit_control_msg(struct usb_device *udev, unsigned long pipe, · line 952

Quoted 10 lines
drivers/usb/host/xhci.c +2 -1
 		return xhci_address_device(udev, root_portnr);
 
-	if (setup->request == USB_REQ_SET_CONFIGURATION) {
+	if (setup->request == USB_REQ_SET_CONFIGURATION &&
+	   (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
 
 		ret = xhci_set_configuration(udev);
 		if (ret) {
 
 			puts("Failed to configure xHCI endpoint\n");

Best regards,
Marek Vasut

------Please consider the environment before printing this e-mail.