aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/testing/sysfs-bus-usb-lvstest13
-rw-r--r--drivers/usb/misc/lvstest.c41
2 files changed, 54 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-usb-lvstest b/Documentation/ABI/testing/sysfs-bus-usb-lvstest
index 5151290cf8e7..ee0046dc4192 100644
--- a/Documentation/ABI/testing/sysfs-bus-usb-lvstest
+++ b/Documentation/ABI/testing/sysfs-bus-usb-lvstest
@@ -45,3 +45,16 @@ Contact: Pratyush Anand <pratyush.anand@gmail.com>
45Description: 45Description:
46 Write to this node to issue "U3 exit" for Link Layer 46 Write to this node to issue "U3 exit" for Link Layer
47 Validation device. It is needed for TD.7.36. 47 Validation device. It is needed for TD.7.36.
48
49What: /sys/bus/usb/devices/.../enable_compliance
50Date: July 2017
51Description:
52 Write to this node to set the port to compliance mode to test
53 with Link Layer Validation device. It is needed for TD.7.34.
54
55What: /sys/bus/usb/devices/.../warm_reset
56Date: July 2017
57Description:
58 Write to this node to issue "Warm Reset" for Link Layer Validation
59 device. It may be needed to properly reset an xHCI 1.1 host port if
60 compliance mode needed to be explicitly enabled.
diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
index 2142132a1f82..ddddd6387f66 100644
--- a/drivers/usb/misc/lvstest.c
+++ b/drivers/usb/misc/lvstest.c
@@ -178,6 +178,25 @@ static ssize_t hot_reset_store(struct device *dev,
178} 178}
179static DEVICE_ATTR_WO(hot_reset); 179static DEVICE_ATTR_WO(hot_reset);
180 180
181static ssize_t warm_reset_store(struct device *dev,
182 struct device_attribute *attr, const char *buf, size_t count)
183{
184 struct usb_interface *intf = to_usb_interface(dev);
185 struct usb_device *hdev = interface_to_usbdev(intf);
186 struct lvs_rh *lvs = usb_get_intfdata(intf);
187 int ret;
188
189 ret = lvs_rh_set_port_feature(hdev, lvs->portnum,
190 USB_PORT_FEAT_BH_PORT_RESET);
191 if (ret < 0) {
192 dev_err(dev, "can't issue warm reset %d\n", ret);
193 return ret;
194 }
195
196 return count;
197}
198static DEVICE_ATTR_WO(warm_reset);
199
181static ssize_t u2_timeout_store(struct device *dev, 200static ssize_t u2_timeout_store(struct device *dev,
182 struct device_attribute *attr, const char *buf, size_t count) 201 struct device_attribute *attr, const char *buf, size_t count)
183{ 202{
@@ -274,13 +293,35 @@ free_desc:
274} 293}
275static DEVICE_ATTR_WO(get_dev_desc); 294static DEVICE_ATTR_WO(get_dev_desc);
276 295
296static ssize_t enable_compliance_store(struct device *dev,
297 struct device_attribute *attr, const char *buf, size_t count)
298{
299 struct usb_interface *intf = to_usb_interface(dev);
300 struct usb_device *hdev = interface_to_usbdev(intf);
301 struct lvs_rh *lvs = usb_get_intfdata(intf);
302 int ret;
303
304 ret = lvs_rh_set_port_feature(hdev,
305 lvs->portnum | USB_SS_PORT_LS_COMP_MOD << 3,
306 USB_PORT_FEAT_LINK_STATE);
307 if (ret < 0) {
308 dev_err(dev, "can't enable compliance mode %d\n", ret);
309 return ret;
310 }
311
312 return count;
313}
314static DEVICE_ATTR_WO(enable_compliance);
315
277static struct attribute *lvs_attributes[] = { 316static struct attribute *lvs_attributes[] = {
278 &dev_attr_get_dev_desc.attr, 317 &dev_attr_get_dev_desc.attr,
279 &dev_attr_u1_timeout.attr, 318 &dev_attr_u1_timeout.attr,
280 &dev_attr_u2_timeout.attr, 319 &dev_attr_u2_timeout.attr,
281 &dev_attr_hot_reset.attr, 320 &dev_attr_hot_reset.attr,
321 &dev_attr_warm_reset.attr,
282 &dev_attr_u3_entry.attr, 322 &dev_attr_u3_entry.attr,
283 &dev_attr_u3_exit.attr, 323 &dev_attr_u3_exit.attr,
324 &dev_attr_enable_compliance.attr,
284 NULL 325 NULL
285}; 326};
286 327