diff options
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r-- | drivers/usb/misc/iowarrior.c | 21 | ||||
-rw-r--r-- | drivers/usb/misc/usb251xb.c | 59 |
2 files changed, 39 insertions, 41 deletions
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 095778ff984d..37c63cb39714 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -781,12 +781,6 @@ static int iowarrior_probe(struct usb_interface *interface, | |||
781 | iface_desc = interface->cur_altsetting; | 781 | iface_desc = interface->cur_altsetting; |
782 | dev->product_id = le16_to_cpu(udev->descriptor.idProduct); | 782 | dev->product_id = le16_to_cpu(udev->descriptor.idProduct); |
783 | 783 | ||
784 | if (iface_desc->desc.bNumEndpoints < 1) { | ||
785 | dev_err(&interface->dev, "Invalid number of endpoints\n"); | ||
786 | retval = -EINVAL; | ||
787 | goto error; | ||
788 | } | ||
789 | |||
790 | /* set up the endpoint information */ | 784 | /* set up the endpoint information */ |
791 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | 785 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { |
792 | endpoint = &iface_desc->endpoint[i].desc; | 786 | endpoint = &iface_desc->endpoint[i].desc; |
@@ -797,6 +791,21 @@ static int iowarrior_probe(struct usb_interface *interface, | |||
797 | /* this one will match for the IOWarrior56 only */ | 791 | /* this one will match for the IOWarrior56 only */ |
798 | dev->int_out_endpoint = endpoint; | 792 | dev->int_out_endpoint = endpoint; |
799 | } | 793 | } |
794 | |||
795 | if (!dev->int_in_endpoint) { | ||
796 | dev_err(&interface->dev, "no interrupt-in endpoint found\n"); | ||
797 | retval = -ENODEV; | ||
798 | goto error; | ||
799 | } | ||
800 | |||
801 | if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) { | ||
802 | if (!dev->int_out_endpoint) { | ||
803 | dev_err(&interface->dev, "no interrupt-out endpoint found\n"); | ||
804 | retval = -ENODEV; | ||
805 | goto error; | ||
806 | } | ||
807 | } | ||
808 | |||
800 | /* we have to check the report_size often, so remember it in the endianness suitable for our machine */ | 809 | /* we have to check the report_size often, so remember it in the endianness suitable for our machine */ |
801 | dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint); | 810 | dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint); |
802 | if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) && | 811 | if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) && |
diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c index 4e18600dc9b4..91f66d68bcb7 100644 --- a/drivers/usb/misc/usb251xb.c +++ b/drivers/usb/misc/usb251xb.c | |||
@@ -375,18 +375,24 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, | |||
375 | if (of_get_property(np, "dynamic-power-switching", NULL)) | 375 | if (of_get_property(np, "dynamic-power-switching", NULL)) |
376 | hub->conf_data2 |= BIT(7); | 376 | hub->conf_data2 |= BIT(7); |
377 | 377 | ||
378 | if (of_get_property(np, "oc-delay-100us", NULL)) { | 378 | if (!of_property_read_u32(np, "oc-delay-us", property_u32)) { |
379 | hub->conf_data2 &= ~BIT(5); | 379 | if (*property_u32 == 100) { |
380 | hub->conf_data2 &= ~BIT(4); | 380 | /* 100 us*/ |
381 | } else if (of_get_property(np, "oc-delay-4ms", NULL)) { | 381 | hub->conf_data2 &= ~BIT(5); |
382 | hub->conf_data2 &= ~BIT(5); | 382 | hub->conf_data2 &= ~BIT(4); |
383 | hub->conf_data2 |= BIT(4); | 383 | } else if (*property_u32 == 4000) { |
384 | } else if (of_get_property(np, "oc-delay-8ms", NULL)) { | 384 | /* 4 ms */ |
385 | hub->conf_data2 |= BIT(5); | 385 | hub->conf_data2 &= ~BIT(5); |
386 | hub->conf_data2 &= ~BIT(4); | 386 | hub->conf_data2 |= BIT(4); |
387 | } else if (of_get_property(np, "oc-delay-16ms", NULL)) { | 387 | } else if (*property_u32 == 16000) { |
388 | hub->conf_data2 |= BIT(5); | 388 | /* 16 ms */ |
389 | hub->conf_data2 |= BIT(4); | 389 | hub->conf_data2 |= BIT(5); |
390 | hub->conf_data2 |= BIT(4); | ||
391 | } else { | ||
392 | /* 8 ms (DEFAULT) */ | ||
393 | hub->conf_data2 |= BIT(5); | ||
394 | hub->conf_data2 &= ~BIT(4); | ||
395 | } | ||
390 | } | 396 | } |
391 | 397 | ||
392 | if (of_get_property(np, "compound-device", NULL)) | 398 | if (of_get_property(np, "compound-device", NULL)) |
@@ -432,30 +438,9 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, | |||
432 | } | 438 | } |
433 | } | 439 | } |
434 | 440 | ||
435 | hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF; | ||
436 | if (!of_property_read_u32(np, "max-sp-power", property_u32)) | ||
437 | hub->max_power_sp = min_t(u8, be32_to_cpu(*property_u32) / 2, | ||
438 | 250); | ||
439 | |||
440 | hub->max_power_bp = USB251XB_DEF_MAX_POWER_BUS; | ||
441 | if (!of_property_read_u32(np, "max-bp-power", property_u32)) | ||
442 | hub->max_power_bp = min_t(u8, be32_to_cpu(*property_u32) / 2, | ||
443 | 250); | ||
444 | |||
445 | hub->max_current_sp = USB251XB_DEF_MAX_CURRENT_SELF; | ||
446 | if (!of_property_read_u32(np, "max-sp-current", property_u32)) | ||
447 | hub->max_current_sp = min_t(u8, be32_to_cpu(*property_u32) / 2, | ||
448 | 250); | ||
449 | |||
450 | hub->max_current_bp = USB251XB_DEF_MAX_CURRENT_BUS; | ||
451 | if (!of_property_read_u32(np, "max-bp-current", property_u32)) | ||
452 | hub->max_current_bp = min_t(u8, be32_to_cpu(*property_u32) / 2, | ||
453 | 250); | ||
454 | |||
455 | hub->power_on_time = USB251XB_DEF_POWER_ON_TIME; | 441 | hub->power_on_time = USB251XB_DEF_POWER_ON_TIME; |
456 | if (!of_property_read_u32(np, "power-on-time", property_u32)) | 442 | if (!of_property_read_u32(np, "power-on-time-ms", property_u32)) |
457 | hub->power_on_time = min_t(u8, be32_to_cpu(*property_u32) / 2, | 443 | hub->power_on_time = min_t(u8, *property_u32 / 2, 255); |
458 | 255); | ||
459 | 444 | ||
460 | if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1)) | 445 | if (of_property_read_u16_array(np, "language-id", &hub->lang_id, 1)) |
461 | hub->lang_id = USB251XB_DEF_LANGUAGE_ID; | 446 | hub->lang_id = USB251XB_DEF_LANGUAGE_ID; |
@@ -492,6 +477,10 @@ static int usb251xb_get_ofdata(struct usb251xb *hub, | |||
492 | /* The following parameters are currently not exposed to devicetree, but | 477 | /* The following parameters are currently not exposed to devicetree, but |
493 | * may be as soon as needed. | 478 | * may be as soon as needed. |
494 | */ | 479 | */ |
480 | hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF; | ||
481 | hub->max_power_bp = USB251XB_DEF_MAX_POWER_BUS; | ||
482 | hub->max_current_sp = USB251XB_DEF_MAX_CURRENT_SELF; | ||
483 | hub->max_current_bp = USB251XB_DEF_MAX_CURRENT_BUS; | ||
495 | hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE; | 484 | hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE; |
496 | hub->boost_up = USB251XB_DEF_BOOST_UP; | 485 | hub->boost_up = USB251XB_DEF_BOOST_UP; |
497 | hub->boost_x = USB251XB_DEF_BOOST_X; | 486 | hub->boost_x = USB251XB_DEF_BOOST_X; |