···125126 /* more shared queuing code would be good; it should support127 * smarter scheduling, handle transaction translators, etc;128- * input size of periodic table to an interrupt scheduler. 129 * (ohci 32, uhci 1024, ehci 256/512/1024).130 */131···133 * this structure.134 */135 unsigned long hcd_priv[0]136- __attribute__ ((aligned (sizeof(unsigned long))));137};138139/* 2.4 does this a bit differently ... */140-static inline struct usb_bus *hcd_to_bus (struct usb_hcd *hcd)141{142 return &hcd->self;143}144145-static inline struct usb_hcd *bus_to_hcd (struct usb_bus *bus)146{147 return container_of(bus, struct usb_hcd, self);148}···202 struct usb_host_endpoint *ep);203204 /* root hub support */205- int (*hub_status_data) (struct usb_hcd *hcd, char *buf);206- int (*hub_control) (struct usb_hcd *hcd,207 u16 typeReq, u16 wValue, u16 wIndex,208 char *buf, u16 wLength);209- int (*bus_suspend)(struct usb_hcd *);210- int (*bus_resume)(struct usb_hcd *);211- int (*start_port_reset)(struct usb_hcd *, unsigned port_num);212- void (*hub_irq_enable)(struct usb_hcd *);213 /* Needed only if port-change IRQs are level-triggered */214215 /* force handover of high-speed port to full-speed companion */216- void (*relinquish_port)(struct usb_hcd *, int);217};218219extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);···221 int status);222extern void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb);223224-extern int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags);225-extern int usb_hcd_unlink_urb (struct urb *urb, int status);226extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,227 int status);228extern void usb_hcd_flush_endpoint(struct usb_device *udev,229 struct usb_host_endpoint *ep);230extern void usb_hcd_disable_endpoint(struct usb_device *udev,231 struct usb_host_endpoint *ep);232-extern int usb_hcd_get_frame_number (struct usb_device *udev);233234-extern struct usb_hcd *usb_create_hcd (const struct hc_driver *driver,235 struct device *dev, char *bus_name);236-extern struct usb_hcd *usb_get_hcd (struct usb_hcd *hcd);237-extern void usb_put_hcd (struct usb_hcd *hcd);238extern int usb_add_hcd(struct usb_hcd *hcd,239 unsigned int irqnum, unsigned long irqflags);240extern void usb_remove_hcd(struct usb_hcd *hcd);241242struct platform_device;243-extern void usb_hcd_platform_shutdown(struct platform_device* dev);244245#ifdef CONFIG_PCI246struct pci_dev;247struct pci_device_id;248-extern int usb_hcd_pci_probe (struct pci_dev *dev,249 const struct pci_device_id *id);250-extern void usb_hcd_pci_remove (struct pci_dev *dev);251252#ifdef CONFIG_PM253-extern int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t state);254-extern int usb_hcd_pci_resume (struct pci_dev *dev);255#endif /* CONFIG_PM */256257-extern void usb_hcd_pci_shutdown (struct pci_dev *dev);258259#endif /* CONFIG_PCI */260261/* pci-ish (pdev null is ok) buffer alloc/mapping support */262-int hcd_buffer_create (struct usb_hcd *hcd);263-void hcd_buffer_destroy (struct usb_hcd *hcd);264265-void *hcd_buffer_alloc (struct usb_bus *bus, size_t size,266 gfp_t mem_flags, dma_addr_t *dma);267-void hcd_buffer_free (struct usb_bus *bus, size_t size,268 void *addr, dma_addr_t dma);269270/* generic bus glue, needed for host controllers that don't use PCI */271-extern irqreturn_t usb_hcd_irq (int irq, void *__hcd);272273-extern void usb_hc_died (struct usb_hcd *hcd);274extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);275276/* -------------------------------------------------------------------------- */···323 * Generic bandwidth allocation constants/support324 */325#define FRAME_TIME_USECS 1000L326-#define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */327 /* Trying not to use worst-case bit-stuffing328- of (7/6 * 8 * bytecount) = 9.33 * bytecount */329 /* bytecount = data payload byte count */330331#define NS_TO_US(ns) ((ns + 500L) / 1000L)···337 */338#define BW_HOST_DELAY 1000L /* nanoseconds */339#define BW_HUB_LS_SETUP 333L /* nanoseconds */340- /* 4 full-speed bit times (est.) */341342-#define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */343#define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L)344#define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L)345···349 * to preallocate bandwidth)350 */351#define USB2_HOST_DELAY 5 /* nsec, guess */352-#define HS_NSECS(bytes) ( ((55 * 8 * 2083) \353 + (2083UL * (3 + BitTime(bytes))))/1000 \354 + USB2_HOST_DELAY)355-#define HS_NSECS_ISO(bytes) ( ((38 * 8 * 2083) \356 + (2083UL * (3 + BitTime(bytes))))/1000 \357 + USB2_HOST_DELAY)358#define HS_USECS(bytes) NS_TO_US (HS_NSECS(bytes))359#define HS_USECS_ISO(bytes) NS_TO_US (HS_NSECS_ISO(bytes))360361-extern long usb_calc_bus_time (int speed, int is_input,362 int isoc, int bytecount);363364/*-------------------------------------------------------------------------*/···374extern struct mutex usb_bus_list_lock;375extern wait_queue_head_t usb_kill_urb_queue;376377-extern void usb_enable_root_hub_irq (struct usb_bus *bus);378379-extern int usb_find_interface_driver (struct usb_device *dev,380 struct usb_interface *interface);381382#define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN))383384#ifdef CONFIG_PM385-extern void usb_hcd_resume_root_hub (struct usb_hcd *hcd);386-extern void usb_root_hub_lost_power (struct usb_device *rhdev);387extern int hcd_bus_suspend(struct usb_device *rhdev);388extern int hcd_bus_resume(struct usb_device *rhdev);389#else···403 * these are expected to be called from the USB core/hub thread404 * with the kernel lock held405 */406-extern void usbfs_update_special (void);407extern int usbfs_init(void);408extern void usbfs_cleanup(void);409410#else /* CONFIG_USB_DEVICEFS */411412-static inline void usbfs_update_special (void) {}413static inline int usbfs_init(void) { return 0; }414static inline void usbfs_cleanup(void) { }415···464/*-------------------------------------------------------------------------*/465466/* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */467-// bleech -- resurfaced in 2.4.11 or 2.4.12468#define bitmap DeviceRemovable469470···472473/* random stuff */474475-#define RUN_CONTEXT (in_irq () ? "in_irq" \476- : (in_interrupt () ? "in_interrupt" : "can sleep"))477478479/* This rwsem is for use only by the hub driver and ehci-hcd.
···125126 /* more shared queuing code would be good; it should support127 * smarter scheduling, handle transaction translators, etc;128+ * input size of periodic table to an interrupt scheduler.129 * (ohci 32, uhci 1024, ehci 256/512/1024).130 */131···133 * this structure.134 */135 unsigned long hcd_priv[0]136+ __attribute__ ((aligned(sizeof(unsigned long))));137};138139/* 2.4 does this a bit differently ... */140+static inline struct usb_bus *hcd_to_bus(struct usb_hcd *hcd)141{142 return &hcd->self;143}144145+static inline struct usb_hcd *bus_to_hcd(struct usb_bus *bus)146{147 return container_of(bus, struct usb_hcd, self);148}···202 struct usb_host_endpoint *ep);203204 /* root hub support */205+ int (*hub_status_data) (struct usb_hcd *hcd, char *buf);206+ int (*hub_control) (struct usb_hcd *hcd,207 u16 typeReq, u16 wValue, u16 wIndex,208 char *buf, u16 wLength);209+ int (*bus_suspend)(struct usb_hcd *);210+ int (*bus_resume)(struct usb_hcd *);211+ int (*start_port_reset)(struct usb_hcd *, unsigned port_num);212+ void (*hub_irq_enable)(struct usb_hcd *);213 /* Needed only if port-change IRQs are level-triggered */214215 /* force handover of high-speed port to full-speed companion */216+ void (*relinquish_port)(struct usb_hcd *, int);217};218219extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);···221 int status);222extern void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb);223224+extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags);225+extern int usb_hcd_unlink_urb(struct urb *urb, int status);226extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,227 int status);228extern void usb_hcd_flush_endpoint(struct usb_device *udev,229 struct usb_host_endpoint *ep);230extern void usb_hcd_disable_endpoint(struct usb_device *udev,231 struct usb_host_endpoint *ep);232+extern int usb_hcd_get_frame_number(struct usb_device *udev);233234+extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,235 struct device *dev, char *bus_name);236+extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd);237+extern void usb_put_hcd(struct usb_hcd *hcd);238extern int usb_add_hcd(struct usb_hcd *hcd,239 unsigned int irqnum, unsigned long irqflags);240extern void usb_remove_hcd(struct usb_hcd *hcd);241242struct platform_device;243+extern void usb_hcd_platform_shutdown(struct platform_device *dev);244245#ifdef CONFIG_PCI246struct pci_dev;247struct pci_device_id;248+extern int usb_hcd_pci_probe(struct pci_dev *dev,249 const struct pci_device_id *id);250+extern void usb_hcd_pci_remove(struct pci_dev *dev);251252#ifdef CONFIG_PM253+extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t state);254+extern int usb_hcd_pci_resume(struct pci_dev *dev);255#endif /* CONFIG_PM */256257+extern void usb_hcd_pci_shutdown(struct pci_dev *dev);258259#endif /* CONFIG_PCI */260261/* pci-ish (pdev null is ok) buffer alloc/mapping support */262+int hcd_buffer_create(struct usb_hcd *hcd);263+void hcd_buffer_destroy(struct usb_hcd *hcd);264265+void *hcd_buffer_alloc(struct usb_bus *bus, size_t size,266 gfp_t mem_flags, dma_addr_t *dma);267+void hcd_buffer_free(struct usb_bus *bus, size_t size,268 void *addr, dma_addr_t dma);269270/* generic bus glue, needed for host controllers that don't use PCI */271+extern irqreturn_t usb_hcd_irq(int irq, void *__hcd);272273+extern void usb_hc_died(struct usb_hcd *hcd);274extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);275276/* -------------------------------------------------------------------------- */···323 * Generic bandwidth allocation constants/support324 */325#define FRAME_TIME_USECS 1000L326+#define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */327 /* Trying not to use worst-case bit-stuffing328+ * of (7/6 * 8 * bytecount) = 9.33 * bytecount */329 /* bytecount = data payload byte count */330331#define NS_TO_US(ns) ((ns + 500L) / 1000L)···337 */338#define BW_HOST_DELAY 1000L /* nanoseconds */339#define BW_HUB_LS_SETUP 333L /* nanoseconds */340+ /* 4 full-speed bit times (est.) */341342+#define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */343#define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L)344#define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L)345···349 * to preallocate bandwidth)350 */351#define USB2_HOST_DELAY 5 /* nsec, guess */352+#define HS_NSECS(bytes) (((55 * 8 * 2083) \353 + (2083UL * (3 + BitTime(bytes))))/1000 \354 + USB2_HOST_DELAY)355+#define HS_NSECS_ISO(bytes) (((38 * 8 * 2083) \356 + (2083UL * (3 + BitTime(bytes))))/1000 \357 + USB2_HOST_DELAY)358#define HS_USECS(bytes) NS_TO_US (HS_NSECS(bytes))359#define HS_USECS_ISO(bytes) NS_TO_US (HS_NSECS_ISO(bytes))360361+extern long usb_calc_bus_time(int speed, int is_input,362 int isoc, int bytecount);363364/*-------------------------------------------------------------------------*/···374extern struct mutex usb_bus_list_lock;375extern wait_queue_head_t usb_kill_urb_queue;376377+extern void usb_enable_root_hub_irq(struct usb_bus *bus);378379+extern int usb_find_interface_driver(struct usb_device *dev,380 struct usb_interface *interface);381382#define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN))383384#ifdef CONFIG_PM385+extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd);386+extern void usb_root_hub_lost_power(struct usb_device *rhdev);387extern int hcd_bus_suspend(struct usb_device *rhdev);388extern int hcd_bus_resume(struct usb_device *rhdev);389#else···403 * these are expected to be called from the USB core/hub thread404 * with the kernel lock held405 */406+extern void usbfs_update_special(void);407extern int usbfs_init(void);408extern void usbfs_cleanup(void);409410#else /* CONFIG_USB_DEVICEFS */411412+static inline void usbfs_update_special(void) {}413static inline int usbfs_init(void) { return 0; }414static inline void usbfs_cleanup(void) { }415···464/*-------------------------------------------------------------------------*/465466/* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */467+/* bleech -- resurfaced in 2.4.11 or 2.4.12 */468#define bitmap DeviceRemovable469470···472473/* random stuff */474475+#define RUN_CONTEXT (in_irq() ? "in_irq" \476+ : (in_interrupt() ? "in_interrupt" : "can sleep"))477478479/* This rwsem is for use only by the hub driver and ehci-hcd.
+9-9
drivers/usb/core/hub.h
···55#define USB_PORT_FEAT_TEST 2156#define USB_PORT_FEAT_INDICATOR 225758-/* 59 * Hub Status and Hub Change results60 * See USB 2.0 spec Table 11-19 and Table 11-2061 */62struct usb_port_status {63 __le16 wPortStatus;64- __le16 wPortChange; 65} __attribute__ ((packed));6667-/* 68 * wPortStatus bit field69 * See USB 2.0 spec Table 11-2170 */···81#define USB_PORT_STAT_INDICATOR 0x100082/* bits 13 to 15 are reserved */8384-/* 85 * wPortChange bit field86 * See USB 2.0 spec Table 11-2287 * Bits 0 to 4 shown, bits 5 to 15 are reserved···93#define USB_PORT_STAT_C_RESET 0x00109495/*96- * wHubCharacteristics (masks) 97 * See USB 2.0 spec Table 11-13, offset 398 */99#define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */···119#define HUB_CHANGE_OVERCURRENT 0x0002120121122-/* 123- * Hub descriptor 124 * See USB 2.0 spec Table 11-13125 */126···134 __le16 wHubCharacteristics;135 __u8 bPwrOn2PwrGood;136 __u8 bHubContrCurrent;137- /* add 1 bit for hub status change; round to bytes */138 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];139 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];140} __attribute__ ((packed));···190 u16 devinfo;191};192193-extern void usb_hub_tt_clear_buffer (struct usb_device *dev, int pipe);194195#endif /* __LINUX_HUB_H */
···55#define USB_PORT_FEAT_TEST 2156#define USB_PORT_FEAT_INDICATOR 225758+/*59 * Hub Status and Hub Change results60 * See USB 2.0 spec Table 11-19 and Table 11-2061 */62struct usb_port_status {63 __le16 wPortStatus;64+ __le16 wPortChange;65} __attribute__ ((packed));6667+/*68 * wPortStatus bit field69 * See USB 2.0 spec Table 11-2170 */···81#define USB_PORT_STAT_INDICATOR 0x100082/* bits 13 to 15 are reserved */8384+/*85 * wPortChange bit field86 * See USB 2.0 spec Table 11-2287 * Bits 0 to 4 shown, bits 5 to 15 are reserved···93#define USB_PORT_STAT_C_RESET 0x00109495/*96+ * wHubCharacteristics (masks)97 * See USB 2.0 spec Table 11-13, offset 398 */99#define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */···119#define HUB_CHANGE_OVERCURRENT 0x0002120121122+/*123+ * Hub descriptor124 * See USB 2.0 spec Table 11-13125 */126···134 __le16 wHubCharacteristics;135 __u8 bPwrOn2PwrGood;136 __u8 bHubContrCurrent;137+ /* add 1 bit for hub status change; round to bytes */138 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];139 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];140} __attribute__ ((packed));···190 u16 devinfo;191};192193+extern void usb_hub_tt_clear_buffer(struct usb_device *dev, int pipe);194195#endif /* __LINUX_HUB_H */
+3-3
drivers/usb/core/otg_whitelist.h
···14 * mostly use of USB_DEVICE() or USB_DEVICE_VER() entries..15 *16 * YOU _SHOULD_ CHANGE THIS LIST TO MATCH YOUR PRODUCT AND ITS TESTING!17- */ 1819static struct usb_device_id whitelist_table [] = {20···55 return 1;5657 /* HNP test device is _never_ targeted (see OTG spec 6.6.6) */58- if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1a0a && 59 le16_to_cpu(dev->descriptor.idProduct) == 0xbadd))60 return 0;61···86 continue;8788 if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) &&89- (id->bDeviceSubClass!= dev->descriptor.bDeviceSubClass))90 continue;9192 if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) &&
···14 * mostly use of USB_DEVICE() or USB_DEVICE_VER() entries..15 *16 * YOU _SHOULD_ CHANGE THIS LIST TO MATCH YOUR PRODUCT AND ITS TESTING!17+ */1819static struct usb_device_id whitelist_table [] = {20···55 return 1;5657 /* HNP test device is _never_ targeted (see OTG spec 6.6.6) */58+ if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1a0a &&59 le16_to_cpu(dev->descriptor.idProduct) == 0xbadd))60 return 0;61···86 continue;8788 if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) &&89+ (id->bDeviceSubClass != dev->descriptor.bDeviceSubClass))90 continue;9192 if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) &&
+11-10
drivers/usb/core/usb.h
···1/* Functions local to drivers/usb/core/ */23-extern int usb_create_sysfs_dev_files (struct usb_device *dev);4-extern void usb_remove_sysfs_dev_files (struct usb_device *dev);5-extern int usb_create_sysfs_intf_files (struct usb_interface *intf);6-extern void usb_remove_sysfs_intf_files (struct usb_interface *intf);7-extern int usb_create_ep_files(struct device *parent, struct usb_host_endpoint *endpoint,08 struct usb_device *udev);9extern void usb_remove_ep_files(struct usb_host_endpoint *endpoint);1011extern void usb_enable_endpoint(struct usb_device *dev,12 struct usb_host_endpoint *ep);13-extern void usb_disable_endpoint (struct usb_device *dev, unsigned int epaddr);14-extern void usb_disable_interface (struct usb_device *dev,15 struct usb_interface *intf);16extern void usb_release_interface_cache(struct kref *ref);17-extern void usb_disable_device (struct usb_device *dev, int skip_ep0);18-extern int usb_deauthorize_device (struct usb_device *);19-extern int usb_authorize_device (struct usb_device *);20extern void usb_detect_quirks(struct usb_device *udev);2122extern int usb_get_device_descriptor(struct usb_device *dev,
···1/* Functions local to drivers/usb/core/ */23+extern int usb_create_sysfs_dev_files(struct usb_device *dev);4+extern void usb_remove_sysfs_dev_files(struct usb_device *dev);5+extern int usb_create_sysfs_intf_files(struct usb_interface *intf);6+extern void usb_remove_sysfs_intf_files(struct usb_interface *intf);7+extern int usb_create_ep_files(struct device *parent,8+ struct usb_host_endpoint *endpoint,9 struct usb_device *udev);10extern void usb_remove_ep_files(struct usb_host_endpoint *endpoint);1112extern void usb_enable_endpoint(struct usb_device *dev,13 struct usb_host_endpoint *ep);14+extern void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr);15+extern void usb_disable_interface(struct usb_device *dev,16 struct usb_interface *intf);17extern void usb_release_interface_cache(struct kref *ref);18+extern void usb_disable_device(struct usb_device *dev, int skip_ep0);19+extern int usb_deauthorize_device(struct usb_device *);20+extern int usb_authorize_device(struct usb_device *);21extern void usb_detect_quirks(struct usb_device *udev);2223extern int usb_get_device_descriptor(struct usb_device *dev,