aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/usb/anchors.txt50
-rw-r--r--Documentation/usb/callbacks.txt132
-rw-r--r--Documentation/usb/persist.txt43
-rw-r--r--Documentation/usb/usb-serial.txt7
4 files changed, 207 insertions, 25 deletions
diff --git a/Documentation/usb/anchors.txt b/Documentation/usb/anchors.txt
new file mode 100644
index 000000000000..7304bcf5a306
--- /dev/null
+++ b/Documentation/usb/anchors.txt
@@ -0,0 +1,50 @@
1What is anchor?
2===============
3
4A USB driver needs to support some callbacks requiring
5a driver to cease all IO to an interface. To do so, a
6driver has to keep track of the URBs it has submitted
7to know they've all completed or to call usb_kill_urb
8for them. The anchor is a data structure takes care of
9keeping track of URBs and provides methods to deal with
10multiple URBs.
11
12Allocation and Initialisation
13=============================
14
15There's no API to allocate an anchor. It is simply declared
16as struct usb_anchor. init_usb_anchor() must be called to
17initialise the data structure.
18
19Deallocation
20============
21
22Once it has no more URBs associated with it, the anchor can be
23freed with normal memory management operations.
24
25Association and disassociation of URBs with anchors
26===================================================
27
28An association of URBs to an anchor is made by an explicit
29call to usb_anchor_urb(). The association is maintained until
30an URB is finished by (successfull) completion. Thus disassociation
31is automatic. A function is provided to forcibly finish (kill)
32all URBs associated with an anchor.
33Furthermore, disassociation can be made with usb_unanchor_urb()
34
35Operations on multitudes of URBs
36================================
37
38usb_kill_anchored_urbs()
39------------------------
40
41This function kills all URBs associated with an anchor. The URBs
42are called in the reverse temporal order they were submitted.
43This way no data can be reordered.
44
45usb_wait_anchor_empty_timeout()
46-------------------------------
47
48This function waits for all URBs associated with an anchor to finish
49or a timeout, whichever comes first. Its return value will tell you
50whether the timeout was reached.
diff --git a/Documentation/usb/callbacks.txt b/Documentation/usb/callbacks.txt
new file mode 100644
index 000000000000..7c812411945b
--- /dev/null
+++ b/Documentation/usb/callbacks.txt
@@ -0,0 +1,132 @@
1What callbacks will usbcore do?
2===============================
3
4Usbcore will call into a driver through callbacks defined in the driver
5structure and through the completion handler of URBs a driver submits.
6Only the former are in the scope of this document. These two kinds of
7callbacks are completely independent of each other. Information on the
8completion callback can be found in Documentation/usb/URB.txt.
9
10The callbacks defined in the driver structure are:
11
121. Hotplugging callbacks:
13
14 * @probe: Called to see if the driver is willing to manage a particular
15 * interface on a device.
16 * @disconnect: Called when the interface is no longer accessible, usually
17 * because its device has been (or is being) disconnected or the
18 * driver module is being unloaded.
19
202. Odd backdoor through usbfs:
21
22 * @ioctl: Used for drivers that want to talk to userspace through
23 * the "usbfs" filesystem. This lets devices provide ways to
24 * expose information to user space regardless of where they
25 * do (or don't) show up otherwise in the filesystem.
26
273. Power management (PM) callbacks:
28
29 * @suspend: Called when the device is going to be suspended.
30 * @resume: Called when the device is being resumed.
31 * @reset_resume: Called when the suspended device has been reset instead
32 * of being resumed.
33
344. Device level operations:
35
36 * @pre_reset: Called when the device is about to be reset.
37 * @post_reset: Called after the device has been reset
38
39The ioctl interface (2) should be used only if you have a very good
40reason. Sysfs is preferred these days. The PM callbacks are covered
41separately in Documentation/usb/power-management.txt.
42
43Calling conventions
44===================
45
46All callbacks are mutually exclusive. There's no need for locking
47against other USB callbacks. All callbacks are called from a task
48context. You may sleep. However, it is important that all sleeps have a
49small fixed upper limit in time. In particular you must not call out to
50user space and await results.
51
52Hotplugging callbacks
53=====================
54
55These callbacks are intended to associate and disassociate a driver with
56an interface. A driver's bond to an interface is exclusive.
57
58The probe() callback
59--------------------
60
61int (*probe) (struct usb_interface *intf,
62 const struct usb_device_id *id);
63
64Accept or decline an interface. If you accept the device return 0,
65otherwise -ENODEV or -ENXIO. Other error codes should be used only if a
66genuine error occurred during initialisation which prevented a driver
67from accepting a device that would else have been accepted.
68You are strongly encouraged to use usbcore'sfacility,
69usb_set_intfdata(), to associate a data structure with an interface, so
70that you know which internal state and identity you associate with a
71particular interface. The device will not be suspended and you may do IO
72to the interface you are called for and endpoint 0 of the device. Device
73initialisation that doesn't take too long is a good idea here.
74
75The disconnect() callback
76-------------------------
77
78void (*disconnect) (struct usb_interface *intf);
79
80This callback is a signal to break any connection with an interface.
81You are not allowed any IO to a device after returning from this
82callback. You also may not do any other operation that may interfere
83with another driver bound the interface, eg. a power management
84operation.
85If you are called due to a physical disconnection, all your URBs will be
86killed by usbcore. Note that in this case disconnect will be called some
87time after the physical disconnection. Thus your driver must be prepared
88to deal with failing IO even prior to the callback.
89
90Device level callbacks
91======================
92
93pre_reset
94---------
95
96int (*pre_reset)(struct usb_interface *intf);
97
98Another driver or user space is triggering a reset on the device which
99contains the interface passed as an argument. Cease IO and save any
100device state you need to restore.
101
102If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if you
103are in atomic context.
104
105post_reset
106----------
107
108int (*post_reset)(struct usb_interface *intf);
109
110The reset has completed. Restore any saved device state and begin
111using the device again.
112
113If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if you
114are in atomic context.
115
116Call sequences
117==============
118
119No callbacks other than probe will be invoked for an interface
120that isn't bound to your driver.
121
122Probe will never be called for an interface bound to a driver.
123Hence following a successful probe, disconnect will be called
124before there is another probe for the same interface.
125
126Once your driver is bound to an interface, disconnect can be
127called at any time except in between pre_reset and post_reset.
128pre_reset is always followed by post_reset, even if the reset
129failed or the device has been unplugged.
130
131suspend is always followed by one of: resume, reset_resume, or
132disconnect.
diff --git a/Documentation/usb/persist.txt b/Documentation/usb/persist.txt
index df54d645cbb5..d56cb1a11550 100644
--- a/Documentation/usb/persist.txt
+++ b/Documentation/usb/persist.txt
@@ -2,7 +2,7 @@
2 2
3 Alan Stern <stern@rowland.harvard.edu> 3 Alan Stern <stern@rowland.harvard.edu>
4 4
5 September 2, 2006 (Updated May 29, 2007) 5 September 2, 2006 (Updated February 25, 2008)
6 6
7 7
8 What is the problem? 8 What is the problem?
@@ -65,9 +65,10 @@ much better.)
65 65
66 What is the solution? 66 What is the solution?
67 67
68Setting CONFIG_USB_PERSIST will cause the kernel to work around these 68The kernel includes a feature called USB-persist. It tries to work
69issues. It enables a mode in which the core USB device data 69around these issues by allowing the core USB device data structures to
70structures are allowed to persist across a power-session disruption. 70persist across a power-session disruption.
71
71It works like this. If the kernel sees that a USB host controller is 72It works like this. If the kernel sees that a USB host controller is
72not in the expected state during resume (i.e., if the controller was 73not in the expected state during resume (i.e., if the controller was
73reset or otherwise had lost power) then it applies a persistence check 74reset or otherwise had lost power) then it applies a persistence check
@@ -80,28 +81,30 @@ re-enumeration shows that the device now attached to that port has the
80same descriptors as before, including the Vendor and Product IDs, then 81same descriptors as before, including the Vendor and Product IDs, then
81the kernel continues to use the same device structure. In effect, the 82the kernel continues to use the same device structure. In effect, the
82kernel treats the device as though it had merely been reset instead of 83kernel treats the device as though it had merely been reset instead of
83unplugged. 84unplugged. The same thing happens if the host controller is in the
85expected state but a USB device was unplugged and then replugged.
84 86
85If no device is now attached to the port, or if the descriptors are 87If no device is now attached to the port, or if the descriptors are
86different from what the kernel remembers, then the treatment is what 88different from what the kernel remembers, then the treatment is what
87you would expect. The kernel destroys the old device structure and 89you would expect. The kernel destroys the old device structure and
88behaves as though the old device had been unplugged and a new device 90behaves as though the old device had been unplugged and a new device
89plugged in, just as it would without the CONFIG_USB_PERSIST option. 91plugged in.
90 92
91The end result is that the USB device remains available and usable. 93The end result is that the USB device remains available and usable.
92Filesystem mounts and memory mappings are unaffected, and the world is 94Filesystem mounts and memory mappings are unaffected, and the world is
93now a good and happy place. 95now a good and happy place.
94 96
95Note that even when CONFIG_USB_PERSIST is set, the "persist" feature 97Note that the "USB-persist" feature will be applied only to those
96will be applied only to those devices for which it is enabled. You 98devices for which it is enabled. You can enable the feature by doing
97can enable the feature by doing (as root): 99(as root):
98 100
99 echo 1 >/sys/bus/usb/devices/.../power/persist 101 echo 1 >/sys/bus/usb/devices/.../power/persist
100 102
101where the "..." should be filled in the with the device's ID. Disable 103where the "..." should be filled in the with the device's ID. Disable
102the feature by writing 0 instead of 1. For hubs the feature is 104the feature by writing 0 instead of 1. For hubs the feature is
103automatically and permanently enabled, so you only have to worry about 105automatically and permanently enabled and the power/persist file
104setting it for devices where it really matters. 106doesn't even exist, so you only have to worry about setting it for
107devices where it really matters.
105 108
106 109
107 Is this the best solution? 110 Is this the best solution?
@@ -112,19 +115,19 @@ centralized Logical Volume Manager. Such a solution would allow you
112to plug in a USB flash device, create a persistent volume associated 115to plug in a USB flash device, create a persistent volume associated
113with it, unplug the flash device, plug it back in later, and still 116with it, unplug the flash device, plug it back in later, and still
114have the same persistent volume associated with the device. As such 117have the same persistent volume associated with the device. As such
115it would be more far-reaching than CONFIG_USB_PERSIST. 118it would be more far-reaching than USB-persist.
116 119
117On the other hand, writing a persistent volume manager would be a big 120On the other hand, writing a persistent volume manager would be a big
118job and using it would require significant input from the user. This 121job and using it would require significant input from the user. This
119solution is much quicker and easier -- and it exists now, a giant 122solution is much quicker and easier -- and it exists now, a giant
120point in its favor! 123point in its favor!
121 124
122Furthermore, the USB_PERSIST option applies to _all_ USB devices, not 125Furthermore, the USB-persist feature applies to _all_ USB devices, not
123just mass-storage devices. It might turn out to be equally useful for 126just mass-storage devices. It might turn out to be equally useful for
124other device types, such as network interfaces. 127other device types, such as network interfaces.
125 128
126 129
127 WARNING: Using CONFIG_USB_PERSIST can be dangerous!! 130 WARNING: USB-persist can be dangerous!!
128 131
129When recovering an interrupted power session the kernel does its best 132When recovering an interrupted power session the kernel does its best
130to make sure the USB device hasn't been changed; that is, the same 133to make sure the USB device hasn't been changed; that is, the same
@@ -133,10 +136,10 @@ aren't guaranteed to be 100% accurate.
133 136
134If you replace one USB device with another of the same type (same 137If you replace one USB device with another of the same type (same
135manufacturer, same IDs, and so on) there's an excellent chance the 138manufacturer, same IDs, and so on) there's an excellent chance the
136kernel won't detect the change. Serial numbers and other strings are 139kernel won't detect the change. The serial number string and other
137not compared. In many cases it wouldn't help if they were, because 140descriptors are compared with the kernel's stored values, but this
138manufacturers frequently omit serial numbers entirely in their 141might not help since manufacturers frequently omit serial numbers
139devices. 142entirely in their devices.
140 143
141Furthermore it's quite possible to leave a USB device exactly the same 144Furthermore it's quite possible to leave a USB device exactly the same
142while changing its media. If you replace the flash memory card in a 145while changing its media. If you replace the flash memory card in a
@@ -152,5 +155,5 @@ but yourself.
152YOU HAVE BEEN WARNED! USE AT YOUR OWN RISK! 155YOU HAVE BEEN WARNED! USE AT YOUR OWN RISK!
153 156
154That having been said, most of the time there shouldn't be any trouble 157That having been said, most of the time there shouldn't be any trouble
155at all. The "persist" feature can be extremely useful. Make the most 158at all. The USB-persist feature can be extremely useful. Make the
156of it. 159most of it.
diff --git a/Documentation/usb/usb-serial.txt b/Documentation/usb/usb-serial.txt
index 8b077e43eee7..ff2c1ff57ba2 100644
--- a/Documentation/usb/usb-serial.txt
+++ b/Documentation/usb/usb-serial.txt
@@ -192,12 +192,9 @@ Keyspan USA-series Serial Adapters
192 192
193FTDI Single Port Serial Driver 193FTDI Single Port Serial Driver
194 194
195 This is a single port DB-25 serial adapter. More information about this 195 This is a single port DB-25 serial adapter.
196 device and the Linux driver can be found at:
197 http://reality.sgi.com/bryder_wellington/ftdi_sio/
198 196
199 For any questions or problems with this driver, please contact Bill Ryder 197 For any questions or problems with this driver, please contact Bill Ryder.
200 at bryder@sgi.com
201 198
202 199
203ZyXEL omni.net lcd plus ISDN TA 200ZyXEL omni.net lcd plus ISDN TA