diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-04-21 15:56:37 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-27 17:43:45 -0400 |
commit | d5926ae7a827bdd06b588ffbc56fd4525cd9214a (patch) | |
tree | e5c63a32abfff5d504e4201d93ab593427c5e810 /drivers/usb/core/hcd.h | |
parent | 02597d2deec2a3de0e2b52c1f83904b65626a0d5 (diff) |
[PATCH] usbcore support for root-hub IRQ instead of polling
This is a revised version of an earlier patch to add support to usbcore
for driving root hubs by interrupts rather than polling.
There's a temporary flag added to struct usb_hcd, marking devices whose
drivers are aware of the new mechanism. By default that flag doesn't get
set so drivers will continue to see the same polling behavior as before.
This way we can convert the HCDs one by one to use interrupt-based event
reporting, and the temporary flag can be removed when they're all done.
Also included is a small change to the hcd_disable_endpoint routine.
Although endpoints normally shouldn't be disabled while a controller is
suspended, it's legal to do so when the controller's driver is being
rmmod'ed.
Lastly the patch adds a new callback, .hub_irq_enable, for use by HCDs
where the root hub's port-change interrupts are level-triggered rather
than edge-triggered. The callback is invoked each time khubd has finished
processing a root hub, to let the HCD know that the interrupt can safely
be re-enabled.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/hcd.h')
-rw-r--r-- | drivers/usb/core/hcd.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 325a51656c3..ac5752778e3 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -65,7 +65,8 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */ | |||
65 | const char *product_desc; /* product/vendor string */ | 65 | const char *product_desc; /* product/vendor string */ |
66 | char irq_descr[24]; /* driver + bus # */ | 66 | char irq_descr[24]; /* driver + bus # */ |
67 | 67 | ||
68 | struct timer_list rh_timer; /* drives root hub */ | 68 | struct timer_list rh_timer; /* drives root-hub polling */ |
69 | struct urb *status_urb; /* the current status urb */ | ||
69 | 70 | ||
70 | /* | 71 | /* |
71 | * hardware info/state | 72 | * hardware info/state |
@@ -76,6 +77,12 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */ | |||
76 | unsigned remote_wakeup:1;/* sw should use wakeup? */ | 77 | unsigned remote_wakeup:1;/* sw should use wakeup? */ |
77 | unsigned rh_registered:1;/* is root hub registered? */ | 78 | unsigned rh_registered:1;/* is root hub registered? */ |
78 | 79 | ||
80 | /* The next flag is a stopgap, to be removed when all the HCDs | ||
81 | * support the new root-hub polling mechanism. */ | ||
82 | unsigned uses_new_polling:1; | ||
83 | unsigned poll_rh:1; /* poll for rh status? */ | ||
84 | unsigned poll_pending:1; /* status has changed? */ | ||
85 | |||
79 | int irq; /* irq allocated */ | 86 | int irq; /* irq allocated */ |
80 | void __iomem *regs; /* device memory/io */ | 87 | void __iomem *regs; /* device memory/io */ |
81 | u64 rsrc_start; /* memory/io resource start */ | 88 | u64 rsrc_start; /* memory/io resource start */ |
@@ -207,6 +214,8 @@ struct hc_driver { | |||
207 | int (*hub_suspend)(struct usb_hcd *); | 214 | int (*hub_suspend)(struct usb_hcd *); |
208 | int (*hub_resume)(struct usb_hcd *); | 215 | int (*hub_resume)(struct usb_hcd *); |
209 | int (*start_port_reset)(struct usb_hcd *, unsigned port_num); | 216 | int (*start_port_reset)(struct usb_hcd *, unsigned port_num); |
217 | void (*hub_irq_enable)(struct usb_hcd *); | ||
218 | /* Needed only if port-change IRQs are level-triggered */ | ||
210 | }; | 219 | }; |
211 | 220 | ||
212 | extern void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb, struct pt_regs *regs); | 221 | extern void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb, struct pt_regs *regs); |
@@ -243,7 +252,9 @@ void hcd_buffer_free (struct usb_bus *bus, size_t size, | |||
243 | 252 | ||
244 | /* generic bus glue, needed for host controllers that don't use PCI */ | 253 | /* generic bus glue, needed for host controllers that don't use PCI */ |
245 | extern irqreturn_t usb_hcd_irq (int irq, void *__hcd, struct pt_regs *r); | 254 | extern irqreturn_t usb_hcd_irq (int irq, void *__hcd, struct pt_regs *r); |
255 | |||
246 | extern void usb_hc_died (struct usb_hcd *hcd); | 256 | extern void usb_hc_died (struct usb_hcd *hcd); |
257 | extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd); | ||
247 | 258 | ||
248 | /* -------------------------------------------------------------------------- */ | 259 | /* -------------------------------------------------------------------------- */ |
249 | 260 | ||
@@ -360,6 +371,8 @@ extern wait_queue_head_t usb_kill_urb_queue; | |||
360 | extern struct usb_bus *usb_bus_get (struct usb_bus *bus); | 371 | extern struct usb_bus *usb_bus_get (struct usb_bus *bus); |
361 | extern void usb_bus_put (struct usb_bus *bus); | 372 | extern void usb_bus_put (struct usb_bus *bus); |
362 | 373 | ||
374 | extern void usb_enable_root_hub_irq (struct usb_bus *bus); | ||
375 | |||
363 | extern int usb_find_interface_driver (struct usb_device *dev, | 376 | extern int usb_find_interface_driver (struct usb_device *dev, |
364 | struct usb_interface *interface); | 377 | struct usb_interface *interface); |
365 | 378 | ||