// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2012 by Alan Stern */ /* This file is part of ehci-hcd.c */ /*-------------------------------------------------------------------------*/ /* Set a bit in the USBCMD register */ static void ehci_set_command_bit(struct ehci_hcd *ehci, u32 bit) { … } /* Clear a bit in the USBCMD register */ static void ehci_clear_command_bit(struct ehci_hcd *ehci, u32 bit) { … } /*-------------------------------------------------------------------------*/ /* * EHCI timer support... Now using hrtimers. * * Lots of different events are triggered from ehci->hrtimer. Whenever * the timer routine runs, it checks each possible event; events that are * currently enabled and whose expiration time has passed get handled. * The set of enabled events is stored as a collection of bitflags in * ehci->enabled_hrtimer_events, and they are numbered in order of * increasing delay values (ranging between 1 ms and 100 ms). * * Rather than implementing a sorted list or tree of all pending events, * we keep track only of the lowest-numbered pending event, in * ehci->next_hrtimer_event. Whenever ehci->hrtimer gets restarted, its * expiration time is set to the timeout value for this event. * * As a result, events might not get handled right away; the actual delay * could be anywhere up to twice the requested delay. This doesn't * matter, because none of the events are especially time-critical. The * ones that matter most all have a delay of 1 ms, so they will be * handled after 2 ms at most, which is okay. In addition to this, we * allow for an expiration range of 1 ms. */ /* * Delay lengths for the hrtimer event types. * Keep this list sorted by delay length, in the same order as * the event types indexed by enum ehci_hrtimer_event in ehci.h. */ static unsigned event_delays_ns[] = …; /* Enable a pending hrtimer event */ static void ehci_enable_event(struct ehci_hcd *ehci, unsigned event, bool resched) { … } /* Poll the STS_ASS status bit; see when it agrees with CMD_ASE */ static void ehci_poll_ASS(struct ehci_hcd *ehci) { … } /* Turn off the async schedule after a brief delay */ static void ehci_disable_ASE(struct ehci_hcd *ehci) { … } /* Poll the STS_PSS status bit; see when it agrees with CMD_PSE */ static void ehci_poll_PSS(struct ehci_hcd *ehci) { … } /* Turn off the periodic schedule after a brief delay */ static void ehci_disable_PSE(struct ehci_hcd *ehci) { … } /* Poll the STS_HALT status bit; see when a dead controller stops */ static void ehci_handle_controller_death(struct ehci_hcd *ehci) { … } /* start to unlink interrupt QHs */ static void ehci_handle_start_intr_unlinks(struct ehci_hcd *ehci) { … } /* Handle unlinked interrupt QHs once they are gone from the hardware */ static void ehci_handle_intr_unlinks(struct ehci_hcd *ehci) { … } /* Start another free-iTDs/siTDs cycle */ static void start_free_itds(struct ehci_hcd *ehci) { … } /* Wait for controller to stop using old iTDs and siTDs */ static void end_free_itds(struct ehci_hcd *ehci) { … } /* Handle lost (or very late) IAA interrupts */ static void ehci_iaa_watchdog(struct ehci_hcd *ehci) { … } /* Enable the I/O watchdog, if appropriate */ static void turn_on_io_watchdog(struct ehci_hcd *ehci) { … } /* * Handler functions for the hrtimer event types. * Keep this array in the same order as the event types indexed by * enum ehci_hrtimer_event in ehci.h. */ static void (*event_handlers[])(struct ehci_hcd *) = …; static enum hrtimer_restart ehci_hrtimer_func(struct hrtimer *t) { … }