aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/usb251xb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc/usb251xb.c')
-rw-r--r--drivers/usb/misc/usb251xb.c59
1 files changed, 24 insertions, 35 deletions
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;