xhci.c (103afda0e6ac58927bc85dc5a7ebc0f51892f407) xhci.c (dfba2174dc421ecad8dc50741054a305cd3ba681)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * xHCI host controller driver
4 *
5 * Copyright (C) 2008 Intel Corp.
6 *
7 * Author: Sarah Sharp
8 * Some code borrowed from the Linux EHCI driver.

--- 7 unchanged lines hidden (view full) ---

16#include <linux/slab.h>
17#include <linux/dmi.h>
18#include <linux/dma-mapping.h>
19
20#include "xhci.h"
21#include "xhci-trace.h"
22#include "xhci-mtk.h"
23#include "xhci-debugfs.h"
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * xHCI host controller driver
4 *
5 * Copyright (C) 2008 Intel Corp.
6 *
7 * Author: Sarah Sharp
8 * Some code borrowed from the Linux EHCI driver.

--- 7 unchanged lines hidden (view full) ---

16#include <linux/slab.h>
17#include <linux/dmi.h>
18#include <linux/dma-mapping.h>
19
20#include "xhci.h"
21#include "xhci-trace.h"
22#include "xhci-mtk.h"
23#include "xhci-debugfs.h"
24#include "xhci-dbgcap.h"
24
25#define DRIVER_AUTHOR "Sarah Sharp"
26#define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver"
27
28#define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E)
29
30/* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */
31static int link_quirk;

--- 585 unchanged lines hidden (view full) ---

617 ret = xhci_queue_vendor_command(xhci, command, 0, 0, 0,
618 TRB_TYPE(TRB_NEC_GET_FW));
619 if (ret)
620 xhci_free_command(xhci, command);
621 }
622 xhci_dbg_trace(xhci, trace_xhci_dbg_init,
623 "Finished xhci_run for USB2 roothub");
624
25
26#define DRIVER_AUTHOR "Sarah Sharp"
27#define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver"
28
29#define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E)
30
31/* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */
32static int link_quirk;

--- 585 unchanged lines hidden (view full) ---

618 ret = xhci_queue_vendor_command(xhci, command, 0, 0, 0,
619 TRB_TYPE(TRB_NEC_GET_FW));
620 if (ret)
621 xhci_free_command(xhci, command);
622 }
623 xhci_dbg_trace(xhci, trace_xhci_dbg_init,
624 "Finished xhci_run for USB2 roothub");
625
626 xhci_dbc_init(xhci);
627
625 xhci_debugfs_init(xhci);
626
627 return 0;
628}
629EXPORT_SYMBOL_GPL(xhci_run);
630
631/*
632 * Stop xHCI driver.

--- 16 unchanged lines hidden (view full) ---

649 /* usb core will free this hcd shortly, unset pointer */
650 xhci->shared_hcd = NULL;
651 mutex_unlock(&xhci->mutex);
652 return;
653 }
654
655 xhci_debugfs_exit(xhci);
656
628 xhci_debugfs_init(xhci);
629
630 return 0;
631}
632EXPORT_SYMBOL_GPL(xhci_run);
633
634/*
635 * Stop xHCI driver.

--- 16 unchanged lines hidden (view full) ---

652 /* usb core will free this hcd shortly, unset pointer */
653 xhci->shared_hcd = NULL;
654 mutex_unlock(&xhci->mutex);
655 return;
656 }
657
658 xhci_debugfs_exit(xhci);
659
660 xhci_dbc_exit(xhci);
661
657 spin_lock_irq(&xhci->lock);
658 xhci->xhc_state |= XHCI_STATE_HALTED;
659 xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
660 xhci_halt(xhci);
661 xhci_reset(xhci);
662 spin_unlock_irq(&xhci->lock);
663
664 xhci_cleanup_msix(xhci);

--- 200 unchanged lines hidden (view full) ---

865
866 if (!hcd->state)
867 return 0;
868
869 if (hcd->state != HC_STATE_SUSPENDED ||
870 xhci->shared_hcd->state != HC_STATE_SUSPENDED)
871 return -EINVAL;
872
662 spin_lock_irq(&xhci->lock);
663 xhci->xhc_state |= XHCI_STATE_HALTED;
664 xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
665 xhci_halt(xhci);
666 xhci_reset(xhci);
667 spin_unlock_irq(&xhci->lock);
668
669 xhci_cleanup_msix(xhci);

--- 200 unchanged lines hidden (view full) ---

870
871 if (!hcd->state)
872 return 0;
873
874 if (hcd->state != HC_STATE_SUSPENDED ||
875 xhci->shared_hcd->state != HC_STATE_SUSPENDED)
876 return -EINVAL;
877
878 xhci_dbc_suspend(xhci);
879
873 /* Clear root port wake on bits if wakeup not allowed. */
874 if (!do_wakeup)
875 xhci_disable_port_wake_on_bits(xhci);
876
877 /* Don't poll the roothubs on bus suspend. */
878 xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
879 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
880 del_timer_sync(&hcd->rh_timer);

--- 179 unchanged lines hidden (view full) ---

1060 /* this is done in bus_resume */
1061
1062 /* step 6: restart each of the previously
1063 * Running endpoints by ringing their doorbells
1064 */
1065
1066 spin_unlock_irq(&xhci->lock);
1067
880 /* Clear root port wake on bits if wakeup not allowed. */
881 if (!do_wakeup)
882 xhci_disable_port_wake_on_bits(xhci);
883
884 /* Don't poll the roothubs on bus suspend. */
885 xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
886 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
887 del_timer_sync(&hcd->rh_timer);

--- 179 unchanged lines hidden (view full) ---

1067 /* this is done in bus_resume */
1068
1069 /* step 6: restart each of the previously
1070 * Running endpoints by ringing their doorbells
1071 */
1072
1073 spin_unlock_irq(&xhci->lock);
1074
1075 xhci_dbc_resume(xhci);
1076
1068 done:
1069 if (retval == 0) {
1070 /* Resume root hubs only when have pending events. */
1071 status = readl(&xhci->op_regs->status);
1072 if (status & STS_EINT) {
1073 usb_hcd_resume_root_hub(xhci->shared_hcd);
1074 usb_hcd_resume_root_hub(hcd);
1075 }

--- 3939 unchanged lines hidden ---
1077 done:
1078 if (retval == 0) {
1079 /* Resume root hubs only when have pending events. */
1080 status = readl(&xhci->op_regs->status);
1081 if (status & STS_EINT) {
1082 usb_hcd_resume_root_hub(xhci->shared_hcd);
1083 usb_hcd_resume_root_hub(hcd);
1084 }

--- 3939 unchanged lines hidden ---