]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
USB: make hub.h public (drivers dependency)
authorEric Lescouet <Eric.Lescouet@virtuallogix.com>
Sat, 24 Apr 2010 21:34:27 +0000 (23:34 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 20 May 2010 20:21:30 +0000 (13:21 -0700)
The usbcore headers: hcd.h and hub.h are shared between usbcore,
HCDs and a couple of other drivers (e.g. USBIP modules).
So, it makes sense to move them into a more public location and
to cleanup dependency of those modules on kernel internal headers.
This patch moves hub.h from drivers/usb/core into include/linux/usb/

Signed-of-by: Eric Lescouet <eric@lescouet.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hub.h [deleted file]
include/linux/usb/hcd.h
include/linux/usb/hub.h [new file with mode: 0644]

diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
deleted file mode 100644 (file)
index de8081f..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-#ifndef __LINUX_HUB_H
-#define __LINUX_HUB_H
-
-/*
- * Hub protocol and driver data structures.
- *
- * Some of these are known to the "virtual root hub" code
- * in host controller drivers.
- */
-
-#include <linux/list.h>
-#include <linux/workqueue.h>
-#include <linux/compiler.h>    /* likely()/unlikely() */
-
-/*
- * Hub request types
- */
-
-#define USB_RT_HUB     (USB_TYPE_CLASS | USB_RECIP_DEVICE)
-#define USB_RT_PORT    (USB_TYPE_CLASS | USB_RECIP_OTHER)
-
-/*
- * Hub class requests
- * See USB 2.0 spec Table 11-16
- */
-#define HUB_CLEAR_TT_BUFFER    8
-#define HUB_RESET_TT           9
-#define HUB_GET_TT_STATE       10
-#define HUB_STOP_TT            11
-
-/*
- * Hub Class feature numbers
- * See USB 2.0 spec Table 11-17
- */
-#define C_HUB_LOCAL_POWER      0
-#define C_HUB_OVER_CURRENT     1
-
-/*
- * Port feature numbers
- * See USB 2.0 spec Table 11-17
- */
-#define USB_PORT_FEAT_CONNECTION       0
-#define USB_PORT_FEAT_ENABLE           1
-#define USB_PORT_FEAT_SUSPEND          2       /* L2 suspend */
-#define USB_PORT_FEAT_OVER_CURRENT     3
-#define USB_PORT_FEAT_RESET            4
-#define USB_PORT_FEAT_L1               5       /* L1 suspend */
-#define USB_PORT_FEAT_POWER            8
-#define USB_PORT_FEAT_LOWSPEED         9
-/* This value was never in Table 11-17 */
-#define USB_PORT_FEAT_HIGHSPEED                10
-/* This value is also fake */
-#define USB_PORT_FEAT_SUPERSPEED       11
-#define USB_PORT_FEAT_C_CONNECTION     16
-#define USB_PORT_FEAT_C_ENABLE         17
-#define USB_PORT_FEAT_C_SUSPEND                18
-#define USB_PORT_FEAT_C_OVER_CURRENT   19
-#define USB_PORT_FEAT_C_RESET          20
-#define USB_PORT_FEAT_TEST              21
-#define USB_PORT_FEAT_INDICATOR         22
-#define USB_PORT_FEAT_C_PORT_L1         23
-
-/*
- * Hub Status and Hub Change results
- * See USB 2.0 spec Table 11-19 and Table 11-20
- */
-struct usb_port_status {
-       __le16 wPortStatus;
-       __le16 wPortChange;
-} __attribute__ ((packed));
-
-/*
- * wPortStatus bit field
- * See USB 2.0 spec Table 11-21
- */
-#define USB_PORT_STAT_CONNECTION       0x0001
-#define USB_PORT_STAT_ENABLE           0x0002
-#define USB_PORT_STAT_SUSPEND          0x0004
-#define USB_PORT_STAT_OVERCURRENT      0x0008
-#define USB_PORT_STAT_RESET            0x0010
-#define USB_PORT_STAT_L1               0x0020
-/* bits 6 to 7 are reserved */
-#define USB_PORT_STAT_POWER            0x0100
-#define USB_PORT_STAT_LOW_SPEED                0x0200
-#define USB_PORT_STAT_HIGH_SPEED        0x0400
-#define USB_PORT_STAT_TEST              0x0800
-#define USB_PORT_STAT_INDICATOR         0x1000
-/* bits 13 to 15 are reserved */
-
-/*
- * wPortChange bit field
- * See USB 2.0 spec Table 11-22
- * Bits 0 to 4 shown, bits 5 to 15 are reserved
- */
-#define USB_PORT_STAT_C_CONNECTION     0x0001
-#define USB_PORT_STAT_C_ENABLE         0x0002
-#define USB_PORT_STAT_C_SUSPEND                0x0004
-#define USB_PORT_STAT_C_OVERCURRENT    0x0008
-#define USB_PORT_STAT_C_RESET          0x0010
-#define USB_PORT_STAT_C_L1             0x0020
-
-/*
- * wHubCharacteristics (masks)
- * See USB 2.0 spec Table 11-13, offset 3
- */
-#define HUB_CHAR_LPSM          0x0003 /* D1 .. D0 */
-#define HUB_CHAR_COMPOUND      0x0004 /* D2       */
-#define HUB_CHAR_OCPM          0x0018 /* D4 .. D3 */
-#define HUB_CHAR_TTTT           0x0060 /* D6 .. D5 */
-#define HUB_CHAR_PORTIND        0x0080 /* D7       */
-
-struct usb_hub_status {
-       __le16 wHubStatus;
-       __le16 wHubChange;
-} __attribute__ ((packed));
-
-/*
- * Hub Status & Hub Change bit masks
- * See USB 2.0 spec Table 11-19 and Table 11-20
- * Bits 0 and 1 for wHubStatus and wHubChange
- * Bits 2 to 15 are reserved for both
- */
-#define HUB_STATUS_LOCAL_POWER 0x0001
-#define HUB_STATUS_OVERCURRENT 0x0002
-#define HUB_CHANGE_LOCAL_POWER 0x0001
-#define HUB_CHANGE_OVERCURRENT 0x0002
-
-
-/*
- * Hub descriptor
- * See USB 2.0 spec Table 11-13
- */
-
-#define USB_DT_HUB                     (USB_TYPE_CLASS | 0x09)
-#define USB_DT_HUB_NONVAR_SIZE         7
-
-struct usb_hub_descriptor {
-       __u8  bDescLength;
-       __u8  bDescriptorType;
-       __u8  bNbrPorts;
-       __le16 wHubCharacteristics;
-       __u8  bPwrOn2PwrGood;
-       __u8  bHubContrCurrent;
-               /* add 1 bit for hub status change; round to bytes */
-       __u8  DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
-       __u8  PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
-} __attribute__ ((packed));
-
-
-/* port indicator status selectors, tables 11-7 and 11-25 */
-#define HUB_LED_AUTO   0
-#define HUB_LED_AMBER  1
-#define HUB_LED_GREEN  2
-#define HUB_LED_OFF    3
-
-enum hub_led_mode {
-       INDICATOR_AUTO = 0,
-       INDICATOR_CYCLE,
-       /* software blinks for attention:  software, hardware, reserved */
-       INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
-       INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
-       INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
-} __attribute__ ((packed));
-
-struct usb_device;
-
-/* Transaction Translator Think Times, in bits */
-#define HUB_TTTT_8_BITS                0x00
-#define HUB_TTTT_16_BITS       0x20
-#define HUB_TTTT_24_BITS       0x40
-#define HUB_TTTT_32_BITS       0x60
-
-/*
- * As of USB 2.0, full/low speed devices are segregated into trees.
- * One type grows from USB 1.1 host controllers (OHCI, UHCI etc).
- * The other type grows from high speed hubs when they connect to
- * full/low speed devices using "Transaction Translators" (TTs).
- *
- * TTs should only be known to the hub driver, and high speed bus
- * drivers (only EHCI for now).  They affect periodic scheduling and
- * sometimes control/bulk error recovery.
- */
-struct usb_tt {
-       struct usb_device       *hub;   /* upstream highspeed hub */
-       int                     multi;  /* true means one TT per port */
-       unsigned                think_time;     /* think time in ns */
-
-       /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
-       spinlock_t              lock;
-       struct list_head        clear_list;     /* of usb_tt_clear */
-       struct work_struct      clear_work;
-};
-
-struct usb_tt_clear {
-       struct list_head        clear_list;
-       unsigned                tt;
-       u16                     devinfo;
-       struct usb_hcd          *hcd;
-       struct usb_host_endpoint        *ep;
-};
-
-extern int usb_hub_clear_tt_buffer(struct urb *urb);
-extern void usb_ep0_reinit(struct usb_device *);
-
-#endif /* __LINUX_HUB_H */
index c7e575cb31497022ab61eb6ab7fa859ac27af4e0..ca228f00b82643427fe4df8a9af59ceffc18d33d 100644 (file)
@@ -374,7 +374,7 @@ extern void usb_destroy_configuration(struct usb_device *dev);
  * HCD Root Hub support
  */
 
-#include <linux/../../drivers/usb/core/hub.h>
+#include <linux/usb/hub.h>
 
 /* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */
 #define DeviceRequest \
diff --git a/include/linux/usb/hub.h b/include/linux/usb/hub.h
new file mode 100644 (file)
index 0000000..de8081f
--- /dev/null
@@ -0,0 +1,205 @@
+#ifndef __LINUX_HUB_H
+#define __LINUX_HUB_H
+
+/*
+ * Hub protocol and driver data structures.
+ *
+ * Some of these are known to the "virtual root hub" code
+ * in host controller drivers.
+ */
+
+#include <linux/list.h>
+#include <linux/workqueue.h>
+#include <linux/compiler.h>    /* likely()/unlikely() */
+
+/*
+ * Hub request types
+ */
+
+#define USB_RT_HUB     (USB_TYPE_CLASS | USB_RECIP_DEVICE)
+#define USB_RT_PORT    (USB_TYPE_CLASS | USB_RECIP_OTHER)
+
+/*
+ * Hub class requests
+ * See USB 2.0 spec Table 11-16
+ */
+#define HUB_CLEAR_TT_BUFFER    8
+#define HUB_RESET_TT           9
+#define HUB_GET_TT_STATE       10
+#define HUB_STOP_TT            11
+
+/*
+ * Hub Class feature numbers
+ * See USB 2.0 spec Table 11-17
+ */
+#define C_HUB_LOCAL_POWER      0
+#define C_HUB_OVER_CURRENT     1
+
+/*
+ * Port feature numbers
+ * See USB 2.0 spec Table 11-17
+ */
+#define USB_PORT_FEAT_CONNECTION       0
+#define USB_PORT_FEAT_ENABLE           1
+#define USB_PORT_FEAT_SUSPEND          2       /* L2 suspend */
+#define USB_PORT_FEAT_OVER_CURRENT     3
+#define USB_PORT_FEAT_RESET            4
+#define USB_PORT_FEAT_L1               5       /* L1 suspend */
+#define USB_PORT_FEAT_POWER            8
+#define USB_PORT_FEAT_LOWSPEED         9
+/* This value was never in Table 11-17 */
+#define USB_PORT_FEAT_HIGHSPEED                10
+/* This value is also fake */
+#define USB_PORT_FEAT_SUPERSPEED       11
+#define USB_PORT_FEAT_C_CONNECTION     16
+#define USB_PORT_FEAT_C_ENABLE         17
+#define USB_PORT_FEAT_C_SUSPEND                18
+#define USB_PORT_FEAT_C_OVER_CURRENT   19
+#define USB_PORT_FEAT_C_RESET          20
+#define USB_PORT_FEAT_TEST              21
+#define USB_PORT_FEAT_INDICATOR         22
+#define USB_PORT_FEAT_C_PORT_L1         23
+
+/*
+ * Hub Status and Hub Change results
+ * See USB 2.0 spec Table 11-19 and Table 11-20
+ */
+struct usb_port_status {
+       __le16 wPortStatus;
+       __le16 wPortChange;
+} __attribute__ ((packed));
+
+/*
+ * wPortStatus bit field
+ * See USB 2.0 spec Table 11-21
+ */
+#define USB_PORT_STAT_CONNECTION       0x0001
+#define USB_PORT_STAT_ENABLE           0x0002
+#define USB_PORT_STAT_SUSPEND          0x0004
+#define USB_PORT_STAT_OVERCURRENT      0x0008
+#define USB_PORT_STAT_RESET            0x0010
+#define USB_PORT_STAT_L1               0x0020
+/* bits 6 to 7 are reserved */
+#define USB_PORT_STAT_POWER            0x0100
+#define USB_PORT_STAT_LOW_SPEED                0x0200
+#define USB_PORT_STAT_HIGH_SPEED        0x0400
+#define USB_PORT_STAT_TEST              0x0800
+#define USB_PORT_STAT_INDICATOR         0x1000
+/* bits 13 to 15 are reserved */
+
+/*
+ * wPortChange bit field
+ * See USB 2.0 spec Table 11-22
+ * Bits 0 to 4 shown, bits 5 to 15 are reserved
+ */
+#define USB_PORT_STAT_C_CONNECTION     0x0001
+#define USB_PORT_STAT_C_ENABLE         0x0002
+#define USB_PORT_STAT_C_SUSPEND                0x0004
+#define USB_PORT_STAT_C_OVERCURRENT    0x0008
+#define USB_PORT_STAT_C_RESET          0x0010
+#define USB_PORT_STAT_C_L1             0x0020
+
+/*
+ * wHubCharacteristics (masks)
+ * See USB 2.0 spec Table 11-13, offset 3
+ */
+#define HUB_CHAR_LPSM          0x0003 /* D1 .. D0 */
+#define HUB_CHAR_COMPOUND      0x0004 /* D2       */
+#define HUB_CHAR_OCPM          0x0018 /* D4 .. D3 */
+#define HUB_CHAR_TTTT           0x0060 /* D6 .. D5 */
+#define HUB_CHAR_PORTIND        0x0080 /* D7       */
+
+struct usb_hub_status {
+       __le16 wHubStatus;
+       __le16 wHubChange;
+} __attribute__ ((packed));
+
+/*
+ * Hub Status & Hub Change bit masks
+ * See USB 2.0 spec Table 11-19 and Table 11-20
+ * Bits 0 and 1 for wHubStatus and wHubChange
+ * Bits 2 to 15 are reserved for both
+ */
+#define HUB_STATUS_LOCAL_POWER 0x0001
+#define HUB_STATUS_OVERCURRENT 0x0002
+#define HUB_CHANGE_LOCAL_POWER 0x0001
+#define HUB_CHANGE_OVERCURRENT 0x0002
+
+
+/*
+ * Hub descriptor
+ * See USB 2.0 spec Table 11-13
+ */
+
+#define USB_DT_HUB                     (USB_TYPE_CLASS | 0x09)
+#define USB_DT_HUB_NONVAR_SIZE         7
+
+struct usb_hub_descriptor {
+       __u8  bDescLength;
+       __u8  bDescriptorType;
+       __u8  bNbrPorts;
+       __le16 wHubCharacteristics;
+       __u8  bPwrOn2PwrGood;
+       __u8  bHubContrCurrent;
+               /* add 1 bit for hub status change; round to bytes */
+       __u8  DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
+       __u8  PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
+} __attribute__ ((packed));
+
+
+/* port indicator status selectors, tables 11-7 and 11-25 */
+#define HUB_LED_AUTO   0
+#define HUB_LED_AMBER  1
+#define HUB_LED_GREEN  2
+#define HUB_LED_OFF    3
+
+enum hub_led_mode {
+       INDICATOR_AUTO = 0,
+       INDICATOR_CYCLE,
+       /* software blinks for attention:  software, hardware, reserved */
+       INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
+       INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
+       INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
+} __attribute__ ((packed));
+
+struct usb_device;
+
+/* Transaction Translator Think Times, in bits */
+#define HUB_TTTT_8_BITS                0x00
+#define HUB_TTTT_16_BITS       0x20
+#define HUB_TTTT_24_BITS       0x40
+#define HUB_TTTT_32_BITS       0x60
+
+/*
+ * As of USB 2.0, full/low speed devices are segregated into trees.
+ * One type grows from USB 1.1 host controllers (OHCI, UHCI etc).
+ * The other type grows from high speed hubs when they connect to
+ * full/low speed devices using "Transaction Translators" (TTs).
+ *
+ * TTs should only be known to the hub driver, and high speed bus
+ * drivers (only EHCI for now).  They affect periodic scheduling and
+ * sometimes control/bulk error recovery.
+ */
+struct usb_tt {
+       struct usb_device       *hub;   /* upstream highspeed hub */
+       int                     multi;  /* true means one TT per port */
+       unsigned                think_time;     /* think time in ns */
+
+       /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
+       spinlock_t              lock;
+       struct list_head        clear_list;     /* of usb_tt_clear */
+       struct work_struct      clear_work;
+};
+
+struct usb_tt_clear {
+       struct list_head        clear_list;
+       unsigned                tt;
+       u16                     devinfo;
+       struct usb_hcd          *hcd;
+       struct usb_host_endpoint        *ep;
+};
+
+extern int usb_hub_clear_tt_buffer(struct urb *urb);
+extern void usb_ep0_reinit(struct usb_device *);
+
+#endif /* __LINUX_HUB_H */