diff options
Diffstat (limited to 'drivers/usb/host/ehci-hub.c')
-rw-r--r-- | drivers/usb/host/ehci-hub.c | 78 |
1 files changed, 2 insertions, 76 deletions
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index ea6184bf48d0..bf2c8f65e1ae 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -471,29 +471,6 @@ static int ehci_bus_resume (struct usb_hcd *hcd) | |||
471 | 471 | ||
472 | /*-------------------------------------------------------------------------*/ | 472 | /*-------------------------------------------------------------------------*/ |
473 | 473 | ||
474 | /* Display the ports dedicated to the companion controller */ | ||
475 | static ssize_t show_companion(struct device *dev, | ||
476 | struct device_attribute *attr, | ||
477 | char *buf) | ||
478 | { | ||
479 | struct ehci_hcd *ehci; | ||
480 | int nports, index, n; | ||
481 | int count = PAGE_SIZE; | ||
482 | char *ptr = buf; | ||
483 | |||
484 | ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev))); | ||
485 | nports = HCS_N_PORTS(ehci->hcs_params); | ||
486 | |||
487 | for (index = 0; index < nports; ++index) { | ||
488 | if (test_bit(index, &ehci->companion_ports)) { | ||
489 | n = scnprintf(ptr, count, "%d\n", index + 1); | ||
490 | ptr += n; | ||
491 | count -= n; | ||
492 | } | ||
493 | } | ||
494 | return ptr - buf; | ||
495 | } | ||
496 | |||
497 | /* | 474 | /* |
498 | * Sets the owner of a port | 475 | * Sets the owner of a port |
499 | */ | 476 | */ |
@@ -528,58 +505,6 @@ static void set_owner(struct ehci_hcd *ehci, int portnum, int new_owner) | |||
528 | } | 505 | } |
529 | } | 506 | } |
530 | 507 | ||
531 | /* | ||
532 | * Dedicate or undedicate a port to the companion controller. | ||
533 | * Syntax is "[-]portnum", where a leading '-' sign means | ||
534 | * return control of the port to the EHCI controller. | ||
535 | */ | ||
536 | static ssize_t store_companion(struct device *dev, | ||
537 | struct device_attribute *attr, | ||
538 | const char *buf, size_t count) | ||
539 | { | ||
540 | struct ehci_hcd *ehci; | ||
541 | int portnum, new_owner; | ||
542 | |||
543 | ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev))); | ||
544 | new_owner = PORT_OWNER; /* Owned by companion */ | ||
545 | if (sscanf(buf, "%d", &portnum) != 1) | ||
546 | return -EINVAL; | ||
547 | if (portnum < 0) { | ||
548 | portnum = - portnum; | ||
549 | new_owner = 0; /* Owned by EHCI */ | ||
550 | } | ||
551 | if (portnum <= 0 || portnum > HCS_N_PORTS(ehci->hcs_params)) | ||
552 | return -ENOENT; | ||
553 | portnum--; | ||
554 | if (new_owner) | ||
555 | set_bit(portnum, &ehci->companion_ports); | ||
556 | else | ||
557 | clear_bit(portnum, &ehci->companion_ports); | ||
558 | set_owner(ehci, portnum, new_owner); | ||
559 | return count; | ||
560 | } | ||
561 | static DEVICE_ATTR(companion, 0644, show_companion, store_companion); | ||
562 | |||
563 | static inline int create_companion_file(struct ehci_hcd *ehci) | ||
564 | { | ||
565 | int i = 0; | ||
566 | |||
567 | /* with integrated TT there is no companion! */ | ||
568 | if (!ehci_is_TDI(ehci)) | ||
569 | i = device_create_file(ehci_to_hcd(ehci)->self.controller, | ||
570 | &dev_attr_companion); | ||
571 | return i; | ||
572 | } | ||
573 | |||
574 | static inline void remove_companion_file(struct ehci_hcd *ehci) | ||
575 | { | ||
576 | /* with integrated TT there is no companion! */ | ||
577 | if (!ehci_is_TDI(ehci)) | ||
578 | device_remove_file(ehci_to_hcd(ehci)->self.controller, | ||
579 | &dev_attr_companion); | ||
580 | } | ||
581 | |||
582 | |||
583 | /*-------------------------------------------------------------------------*/ | 508 | /*-------------------------------------------------------------------------*/ |
584 | 509 | ||
585 | static int check_reset_complete ( | 510 | static int check_reset_complete ( |
@@ -891,10 +816,11 @@ static int ehci_hub_control ( | |||
891 | * power switching; they're allowed to just limit the | 816 | * power switching; they're allowed to just limit the |
892 | * current. khubd will turn the power back on. | 817 | * current. khubd will turn the power back on. |
893 | */ | 818 | */ |
894 | if (HCS_PPC (ehci->hcs_params)){ | 819 | if ((temp & PORT_OC) && HCS_PPC(ehci->hcs_params)) { |
895 | ehci_writel(ehci, | 820 | ehci_writel(ehci, |
896 | temp & ~(PORT_RWC_BITS | PORT_POWER), | 821 | temp & ~(PORT_RWC_BITS | PORT_POWER), |
897 | status_reg); | 822 | status_reg); |
823 | temp = ehci_readl(ehci, status_reg); | ||
898 | } | 824 | } |
899 | } | 825 | } |
900 | 826 | ||