aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/ABI/testing/sysfs-bus-umc28
-rw-r--r--Documentation/ABI/testing/sysfs-bus-usb43
-rw-r--r--Documentation/ABI/testing/sysfs-class-usb_host25
-rw-r--r--Documentation/ABI/testing/sysfs-class-uwb_rc144
-rw-r--r--Documentation/ABI/testing/sysfs-wusb_cbaf100
-rw-r--r--Documentation/feature-removal-schedule.txt8
-rw-r--r--Documentation/i2c/busses/i2c-i8017
-rw-r--r--Documentation/i2c/porting-clients160
-rw-r--r--Documentation/i2c/writing-clients491
-rw-r--r--Documentation/ia64/xen.txt183
-rw-r--r--Documentation/kdump/kdump.txt14
-rw-r--r--Documentation/powerpc/booting-without-of.txt2
-rw-r--r--Documentation/powerpc/dts-bindings/fsl/board.txt4
-rw-r--r--Documentation/usb/WUSB-Design-overview.txt448
-rw-r--r--Documentation/usb/wusb-cbaf139
15 files changed, 1253 insertions, 543 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-umc b/Documentation/ABI/testing/sysfs-bus-umc
new file mode 100644
index 000000000000..948fec412446
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-umc
@@ -0,0 +1,28 @@
1What: /sys/bus/umc/
2Date: July 2008
3KernelVersion: 2.6.27
4Contact: David Vrabel <david.vrabel@csr.com>
5Description:
6 The Wireless Host Controller Interface (WHCI)
7 specification describes a PCI-based device with
8 multiple capabilities; the UWB Multi-interface
9 Controller (UMC).
10
11 The umc bus presents each of the individual
12 capabilties as a device.
13
14What: /sys/bus/umc/devices/.../capability_id
15Date: July 2008
16KernelVersion: 2.6.27
17Contact: David Vrabel <david.vrabel@csr.com>
18Description:
19 The ID of this capability, with 0 being the radio
20 controller capability.
21
22What: /sys/bus/umc/devices/.../version
23Date: July 2008
24KernelVersion: 2.6.27
25Contact: David Vrabel <david.vrabel@csr.com>
26Description:
27 The specification version this capability's hardware
28 interface complies with.
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb
index df6c8a0159f1..7772928ee48f 100644
--- a/Documentation/ABI/testing/sysfs-bus-usb
+++ b/Documentation/ABI/testing/sysfs-bus-usb
@@ -101,3 +101,46 @@ Description:
101Users: 101Users:
102 USB PM tool 102 USB PM tool
103 git://git.moblin.org/users/sarah/usb-pm-tool/ 103 git://git.moblin.org/users/sarah/usb-pm-tool/
104
105What: /sys/bus/usb/device/.../authorized
106Date: July 2008
107KernelVersion: 2.6.26
108Contact: David Vrabel <david.vrabel@csr.com>
109Description:
110 Authorized devices are available for use by device
111 drivers, non-authorized one are not. By default, wired
112 USB devices are authorized.
113
114 Certified Wireless USB devices are not authorized
115 initially and should be (by writing 1) after the
116 device has been authenticated.
117
118What: /sys/bus/usb/device/.../wusb_cdid
119Date: July 2008
120KernelVersion: 2.6.27
121Contact: David Vrabel <david.vrabel@csr.com>
122Description:
123 For Certified Wireless USB devices only.
124
125 A devices's CDID, as 16 space-separated hex octets.
126
127What: /sys/bus/usb/device/.../wusb_ck
128Date: July 2008
129KernelVersion: 2.6.27
130Contact: David Vrabel <david.vrabel@csr.com>
131Description:
132 For Certified Wireless USB devices only.
133
134 Write the device's connection key (CK) to start the
135 authentication of the device. The CK is 16
136 space-separated hex octets.
137
138What: /sys/bus/usb/device/.../wusb_disconnect
139Date: July 2008
140KernelVersion: 2.6.27
141Contact: David Vrabel <david.vrabel@csr.com>
142Description:
143 For Certified Wireless USB devices only.
144
145 Write a 1 to force the device to disconnect
146 (equivalent to unplugging a wired USB device).
diff --git a/Documentation/ABI/testing/sysfs-class-usb_host b/Documentation/ABI/testing/sysfs-class-usb_host
new file mode 100644
index 000000000000..46b66ad1f1b4
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-usb_host
@@ -0,0 +1,25 @@
1What: /sys/class/usb_host/usb_hostN/wusb_chid
2Date: July 2008
3KernelVersion: 2.6.27
4Contact: David Vrabel <david.vrabel@csr.com>
5Description:
6 Write the CHID (16 space-separated hex octets) for this host controller.
7 This starts the host controller, allowing it to accept connection from
8 WUSB devices.
9
10 Set an all zero CHID to stop the host controller.
11
12What: /sys/class/usb_host/usb_hostN/wusb_trust_timeout
13Date: July 2008
14KernelVersion: 2.6.27
15Contact: David Vrabel <david.vrabel@csr.com>
16Description:
17 Devices that haven't sent a WUSB packet to the host
18 within 'wusb_trust_timeout' ms are considered to have
19 disconnected and are removed. The default value of
20 4000 ms is the value required by the WUSB
21 specification.
22
23 Since this relates to security (specifically, the
24 lifetime of PTKs and GTKs) it should not be changed
25 from the default.
diff --git a/Documentation/ABI/testing/sysfs-class-uwb_rc b/Documentation/ABI/testing/sysfs-class-uwb_rc
new file mode 100644
index 000000000000..a0d18dbeb7a9
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-uwb_rc
@@ -0,0 +1,144 @@
1What: /sys/class/uwb_rc
2Date: July 2008
3KernelVersion: 2.6.27
4Contact: linux-usb@vger.kernel.org
5Description:
6 Interfaces for WiMedia Ultra Wideband Common Radio
7 Platform (UWB) radio controllers.
8
9 Familiarity with the ECMA-368 'High Rate Ultra
10 Wideband MAC and PHY Specification' is assumed.
11
12What: /sys/class/uwb_rc/beacon_timeout_ms
13Date: July 2008
14KernelVersion: 2.6.27
15Description:
16 If no beacons are received from a device for at least
17 this time, the device will be considered to have gone
18 and it will be removed. The default is 3 superframes
19 (~197 ms) as required by the specification.
20
21What: /sys/class/uwb_rc/uwbN/
22Date: July 2008
23KernelVersion: 2.6.27
24Contact: linux-usb@vger.kernel.org
25Description:
26 An individual UWB radio controller.
27
28What: /sys/class/uwb_rc/uwbN/beacon
29Date: July 2008
30KernelVersion: 2.6.27
31Contact: linux-usb@vger.kernel.org
32Description:
33 Write:
34
35 <channel> [<bpst offset>]
36
37 to start beaconing on a specific channel, or stop
38 beaconing if <channel> is -1. Valid channels depends
39 on the radio controller's supported band groups.
40
41 <bpst offset> may be used to try and join a specific
42 beacon group if more than one was found during a scan.
43
44What: /sys/class/uwb_rc/uwbN/scan
45Date: July 2008
46KernelVersion: 2.6.27
47Contact: linux-usb@vger.kernel.org
48Description:
49 Write:
50
51 <channel> <type> [<bpst offset>]
52
53 to start (or stop) scanning on a channel. <type> is one of:
54 0 - scan
55 1 - scan outside BP
56 2 - scan while inactive
57 3 - scanning disabled
58 4 - scan (with start time of <bpst offset>)
59
60What: /sys/class/uwb_rc/uwbN/mac_address
61Date: July 2008
62KernelVersion: 2.6.27
63Contact: linux-usb@vger.kernel.org
64Description:
65 The EUI-48, in colon-separated hex octets, for this
66 radio controller. A write will change the radio
67 controller's EUI-48 but only do so while the device is
68 not beaconing or scanning.
69
70What: /sys/class/uwb_rc/uwbN/wusbhc
71Date: July 2008
72KernelVersion: 2.6.27
73Contact: linux-usb@vger.kernel.org
74Description:
75 A symlink to the device (if any) of the WUSB Host
76 Controller PAL using this radio controller.
77
78What: /sys/class/uwb_rc/uwbN/<EUI-48>/
79Date: July 2008
80KernelVersion: 2.6.27
81Contact: linux-usb@vger.kernel.org
82Description:
83 A neighbour UWB device that has either been detected
84 as part of a scan or is a member of the radio
85 controllers beacon group.
86
87What: /sys/class/uwb_rc/uwbN/<EUI-48>/BPST
88Date: July 2008
89KernelVersion: 2.6.27
90Contact: linux-usb@vger.kernel.org
91Description:
92 The time (using the radio controllers internal 1 ms
93 interval superframe timer) of the last beacon from
94 this device was received.
95
96What: /sys/class/uwb_rc/uwbN/<EUI-48>/DevAddr
97Date: July 2008
98KernelVersion: 2.6.27
99Contact: linux-usb@vger.kernel.org
100Description:
101 The current DevAddr of this device in colon separated
102 hex octets.
103
104What: /sys/class/uwb_rc/uwbN/<EUI-48>/EUI_48
105Date: July 2008
106KernelVersion: 2.6.27
107Contact: linux-usb@vger.kernel.org
108Description:
109
110 The EUI-48 of this device in colon separated hex
111 octets.
112
113What: /sys/class/uwb_rc/uwbN/<EUI-48>/BPST
114Date: July 2008
115KernelVersion: 2.6.27
116Contact: linux-usb@vger.kernel.org
117Description:
118
119What: /sys/class/uwb_rc/uwbN/<EUI-48>/IEs
120Date: July 2008
121KernelVersion: 2.6.27
122Contact: linux-usb@vger.kernel.org
123Description:
124 The latest IEs included in this device's beacon, in
125 space separated hex octets with one IE per line.
126
127What: /sys/class/uwb_rc/uwbN/<EUI-48>/LQE
128Date: July 2008
129KernelVersion: 2.6.27
130Contact: linux-usb@vger.kernel.org
131Description:
132 Link Quality Estimate - the Signal to Noise Ratio
133 (SNR) of all packets received from this device in dB.
134 This gives an estimate on a suitable PHY rate. Refer
135 to [ECMA-368] section 13.3 for more details.
136
137What: /sys/class/uwb_rc/uwbN/<EUI-48>/RSSI
138Date: July 2008
139KernelVersion: 2.6.27
140Contact: linux-usb@vger.kernel.org
141Description:
142 Received Signal Strength Indication - the strength of
143 the received signal in dB. LQE is a more useful
144 measure of the radio link quality.
diff --git a/Documentation/ABI/testing/sysfs-wusb_cbaf b/Documentation/ABI/testing/sysfs-wusb_cbaf
new file mode 100644
index 000000000000..a99c5f86a37a
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-wusb_cbaf
@@ -0,0 +1,100 @@
1What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_*
2Date: August 2008
3KernelVersion: 2.6.27
4Contact: David Vrabel <david.vrabel@csr.com>
5Description:
6 Various files for managing Cable Based Association of
7 (wireless) USB devices.
8
9 The sequence of operations should be:
10
11 1. Device is plugged in.
12
13 2. The connection manager (CM) sees a device with CBA capability.
14 (the wusb_chid etc. files in /sys/devices/blah/OURDEVICE).
15
16 3. The CM writes the host name, supported band groups,
17 and the CHID (host ID) into the wusb_host_name,
18 wusb_host_band_groups and wusb_chid files. These
19 get sent to the device and the CDID (if any) for
20 this host is requested.
21
22 4. The CM can verify that the device's supported band
23 groups (wusb_device_band_groups) are compatible
24 with the host.
25
26 5. The CM reads the wusb_cdid file.
27
28 6. The CM looks it up its database.
29
30 - If it has a matching CHID,CDID entry, the device
31 has been authorized before and nothing further
32 needs to be done.
33
34 - If the CDID is zero (or the CM doesn't find a
35 matching CDID in its database), the device is
36 assumed to be not known. The CM may associate
37 the host with device by: writing a randomly
38 generated CDID to wusb_cdid and then a random CK
39 to wusb_ck (this uploads the new CC to the
40 device).
41
42 CMD may choose to prompt the user before
43 associating with a new device.
44
45 7. Device is unplugged.
46
47 References:
48 [WUSB-AM] Association Models Supplement to the
49 Certified Wireless Universal Serial Bus
50 Specification, version 1.0.
51
52What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_chid
53Date: August 2008
54KernelVersion: 2.6.27
55Contact: David Vrabel <david.vrabel@csr.com>
56Description:
57 The CHID of the host formatted as 16 space-separated
58 hex octets.
59
60 Writes fetches device's supported band groups and the
61 the CDID for any existing association with this host.
62
63What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_host_name
64Date: August 2008
65KernelVersion: 2.6.27
66Contact: David Vrabel <david.vrabel@csr.com>
67Description:
68 A friendly name for the host as a UTF-8 encoded string.
69
70What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_host_band_groups
71Date: August 2008
72KernelVersion: 2.6.27
73Contact: David Vrabel <david.vrabel@csr.com>
74Description:
75 The band groups supported by the host, in the format
76 defined in [WUSB-AM].
77
78What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_device_band_groups
79Date: August 2008
80KernelVersion: 2.6.27
81Contact: David Vrabel <david.vrabel@csr.com>
82Description:
83 The band groups supported by the device, in the format
84 defined in [WUSB-AM].
85
86What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_cdid
87Date: August 2008
88KernelVersion: 2.6.27
89Contact: David Vrabel <david.vrabel@csr.com>
90Description:
91 The device's CDID formatted as 16 space-separated hex
92 octets.
93
94What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_ck
95Date: August 2008
96KernelVersion: 2.6.27
97Contact: David Vrabel <david.vrabel@csr.com>
98Description:
99 Write 16 space-separated random, hex octets to
100 associate with the device.
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index f5f812daf9f4..05d71b4b9430 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -359,3 +359,11 @@ Why: The 2.6 kernel supports direct writing to ide CD drives, which
359 eliminates the need for ide-scsi. The new method is more 359 eliminates the need for ide-scsi. The new method is more
360 efficient in every way. 360 efficient in every way.
361Who: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> 361Who: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
362
363---------------------------
364
365What: i2c_attach_client(), i2c_detach_client(), i2c_driver->detach_client()
366When: 2.6.29 (ideally) or 2.6.30 (more likely)
367Why: Deprecated by the new (standard) device driver binding model. Use
368 i2c_driver->probe() and ->remove() instead.
369Who: Jean Delvare <khali@linux-fr.org>
diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801
index c31e0291e167..81c0c59a60ea 100644
--- a/Documentation/i2c/busses/i2c-i801
+++ b/Documentation/i2c/busses/i2c-i801
@@ -13,8 +13,9 @@ Supported adapters:
13 * Intel 631xESB/632xESB (ESB2) 13 * Intel 631xESB/632xESB (ESB2)
14 * Intel 82801H (ICH8) 14 * Intel 82801H (ICH8)
15 * Intel 82801I (ICH9) 15 * Intel 82801I (ICH9)
16 * Intel Tolapai 16 * Intel EP80579 (Tolapai)
17 * Intel ICH10 17 * Intel 82801JI (ICH10)
18 * Intel PCH
18 Datasheets: Publicly available at the Intel website 19 Datasheets: Publicly available at the Intel website
19 20
20Authors: 21Authors:
@@ -32,7 +33,7 @@ Description
32----------- 33-----------
33 34
34The ICH (properly known as the 82801AA), ICH0 (82801AB), ICH2 (82801BA), 35The ICH (properly known as the 82801AA), ICH0 (82801AB), ICH2 (82801BA),
35ICH3 (82801CA/CAM) and later devices are Intel chips that are a part of 36ICH3 (82801CA/CAM) and later devices (PCH) are Intel chips that are a part of
36Intel's '810' chipset for Celeron-based PCs, '810E' chipset for 37Intel's '810' chipset for Celeron-based PCs, '810E' chipset for
37Pentium-based PCs, '815E' chipset, and others. 38Pentium-based PCs, '815E' chipset, and others.
38 39
diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients
deleted file mode 100644
index 7bf82c08f6ca..000000000000
--- a/Documentation/i2c/porting-clients
+++ /dev/null
@@ -1,160 +0,0 @@
1Revision 7, 2007-04-19
2Jean Delvare <khali@linux-fr.org>
3Greg KH <greg@kroah.com>
4
5This is a guide on how to convert I2C chip drivers from Linux 2.4 to
6Linux 2.6. I have been using existing drivers (lm75, lm78) as examples.
7Then I converted a driver myself (lm83) and updated this document.
8Note that this guide is strongly oriented towards hardware monitoring
9drivers. Many points are still valid for other type of drivers, but
10others may be irrelevant.
11
12There are two sets of points below. The first set concerns technical
13changes. The second set concerns coding policy. Both are mandatory.
14
15Although reading this guide will help you porting drivers, I suggest
16you keep an eye on an already ported driver while porting your own
17driver. This will help you a lot understanding what this guide
18exactly means. Choose the chip driver that is the more similar to
19yours for best results.
20
21Technical changes:
22
23* [Driver type] Any driver that was relying on i2c-isa has to be
24 converted to a proper isa, platform or pci driver. This is not
25 covered by this guide.
26
27* [Includes] Get rid of "version.h" and <linux/i2c-proc.h>.
28 Includes typically look like that:
29 #include <linux/module.h>
30 #include <linux/init.h>
31 #include <linux/slab.h>
32 #include <linux/jiffies.h>
33 #include <linux/i2c.h>
34 #include <linux/hwmon.h> /* for hardware monitoring drivers */
35 #include <linux/hwmon-sysfs.h>
36 #include <linux/hwmon-vid.h> /* if you need VRM support */
37 #include <linux/err.h> /* for class registration */
38 Please respect this inclusion order. Some extra headers may be
39 required for a given driver (e.g. "lm75.h").
40
41* [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses
42 are no more handled by the i2c core. Address ranges are no more
43 supported either, define each individual address separately.
44 SENSORS_INSMOD_<n> becomes I2C_CLIENT_INSMOD_<n>.
45
46* [Client data] Get rid of sysctl_id. Try using standard names for
47 register values (for example, temp_os becomes temp_max). You're
48 still relatively free here, but you *have* to follow the standard
49 names for sysfs files (see the Sysctl section below).
50
51* [Function prototypes] The detect functions loses its flags
52 parameter. Sysctl (e.g. lm75_temp) and miscellaneous functions
53 are off the list of prototypes. This usually leaves five
54 prototypes:
55 static int lm75_attach_adapter(struct i2c_adapter *adapter);
56 static int lm75_detect(struct i2c_adapter *adapter, int address,
57 int kind);
58 static void lm75_init_client(struct i2c_client *client);
59 static int lm75_detach_client(struct i2c_client *client);
60 static struct lm75_data lm75_update_device(struct device *dev);
61
62* [Sysctl] All sysctl stuff is of course gone (defines, ctl_table
63 and functions). Instead, you have to define show and set functions for
64 each sysfs file. Only define set for writable values. Take a look at an
65 existing 2.6 driver for details (it87 for example). Don't forget
66 to define the attributes for each file (this is that step that
67 links callback functions). Use the file names specified in
68 Documentation/hwmon/sysfs-interface for the individual files. Also
69 convert the units these files read and write to the specified ones.
70 If you need to add a new type of file, please discuss it on the
71 sensors mailing list <lm-sensors@lm-sensors.org> by providing a
72 patch to the Documentation/hwmon/sysfs-interface file.
73
74* [Attach] The attach function should make sure that the adapter's
75 class has I2C_CLASS_HWMON (or whatever class is suitable for your
76 driver), using the following construct:
77 if (!(adapter->class & I2C_CLASS_HWMON))
78 return 0;
79 Call i2c_probe() instead of i2c_detect().
80
81* [Detect] As mentioned earlier, the flags parameter is gone.
82 The type_name and client_name strings are replaced by a single
83 name string, which will be filled with a lowercase, short string.
84 The labels used for error paths are reduced to the number needed.
85 It is advised that the labels are given descriptive names such as
86 exit and exit_free. Don't forget to properly set err before
87 jumping to error labels. By the way, labels should be left-aligned.
88 Use kzalloc instead of kmalloc.
89 Use i2c_set_clientdata to set the client data (as opposed to
90 a direct access to client->data).
91 Use strlcpy instead of strcpy or snprintf to copy the client name.
92 Replace the sysctl directory registration by calls to
93 device_create_file. Move the driver initialization before any
94 sysfs file creation.
95 Register the client with the hwmon class (using hwmon_device_register)
96 if applicable.
97 Drop client->id.
98 Drop any 24RF08 corruption prevention you find, as this is now done
99 at the i2c-core level, and doing it twice voids it.
100 Don't add I2C_CLIENT_ALLOW_USE to client->flags, it's the default now.
101
102* [Init] Limits must not be set by the driver (can be done later in
103 user-space). Chip should not be reset default (although a module
104 parameter may be used to force it), and initialization should be
105 limited to the strictly necessary steps.
106
107* [Detach] Remove the call to i2c_deregister_entry. Do not log an
108 error message if i2c_detach_client fails, as i2c-core will now do
109 it for you.
110 Unregister from the hwmon class if applicable.
111
112* [Update] The function prototype changed, it is now
113 passed a device structure, which you have to convert to a client
114 using to_i2c_client(dev). The update function should return a
115 pointer to the client data.
116 Don't access client->data directly, use i2c_get_clientdata(client)
117 instead.
118 Use time_after() instead of direct jiffies comparison.
119
120* [Interface] Make sure there is a MODULE_LICENSE() line, at the bottom
121 of the file (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this
122 order).
123
124* [Driver] The flags field of the i2c_driver structure is gone.
125 I2C_DF_NOTIFY is now the default behavior.
126 The i2c_driver structure has a driver member, which is itself a
127 structure, those name member should be initialized to a driver name
128 string. i2c_driver itself has no name member anymore.
129
130* [Driver model] Instead of shutdown or reboot notifiers, provide a
131 shutdown() method in your driver.
132
133* [Power management] Use the driver model suspend() and resume()
134 callbacks instead of the obsolete pm_register() calls.
135
136Coding policy:
137
138* [Copyright] Use (C), not (c), for copyright.
139
140* [Debug/log] Get rid of #ifdef DEBUG/#endif constructs whenever you
141 can. Calls to printk for debugging purposes are replaced by calls to
142 dev_dbg where possible, else to pr_debug. Here is an example of how
143 to call it (taken from lm75_detect):
144 dev_dbg(&client->dev, "Starting lm75 update\n");
145 Replace other printk calls with the dev_info, dev_err or dev_warn
146 function, as appropriate.
147
148* [Constants] Constants defines (registers, conversions) should be
149 aligned. This greatly improves readability.
150 Alignments are achieved by the means of tabs, not spaces. Remember
151 that tabs are set to 8 in the Linux kernel code.
152
153* [Layout] Avoid extra empty lines between comments and what they
154 comment. Respect the coding style (see Documentation/CodingStyle),
155 in particular when it comes to placing curly braces.
156
157* [Comments] Make sure that no comment refers to a file that isn't
158 part of the Linux source tree (typically doc/chips/<chip name>),
159 and that remaining comments still match the code. Merging comment
160 lines when possible is encouraged.
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
index d73ee117a8ca..6b9af7d479c2 100644
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -10,23 +10,21 @@ General remarks
10=============== 10===============
11 11
12Try to keep the kernel namespace as clean as possible. The best way to 12Try to keep the kernel namespace as clean as possible. The best way to
13do this is to use a unique prefix for all global symbols. This is 13do this is to use a unique prefix for all global symbols. This is
14especially important for exported symbols, but it is a good idea to do 14especially important for exported symbols, but it is a good idea to do
15it for non-exported symbols too. We will use the prefix `foo_' in this 15it for non-exported symbols too. We will use the prefix `foo_' in this
16tutorial, and `FOO_' for preprocessor variables. 16tutorial.
17 17
18 18
19The driver structure 19The driver structure
20==================== 20====================
21 21
22Usually, you will implement a single driver structure, and instantiate 22Usually, you will implement a single driver structure, and instantiate
23all clients from it. Remember, a driver structure contains general access 23all clients from it. Remember, a driver structure contains general access
24routines, and should be zero-initialized except for fields with data you 24routines, and should be zero-initialized except for fields with data you
25provide. A client structure holds device-specific information like the 25provide. A client structure holds device-specific information like the
26driver model device node, and its I2C address. 26driver model device node, and its I2C address.
27 27
28/* iff driver uses driver model ("new style") binding model: */
29
30static struct i2c_device_id foo_idtable[] = { 28static struct i2c_device_id foo_idtable[] = {
31 { "foo", my_id_for_foo }, 29 { "foo", my_id_for_foo },
32 { "bar", my_id_for_bar }, 30 { "bar", my_id_for_bar },
@@ -40,7 +38,6 @@ static struct i2c_driver foo_driver = {
40 .name = "foo", 38 .name = "foo",
41 }, 39 },
42 40
43 /* iff driver uses driver model ("new style") binding model: */
44 .id_table = foo_ids, 41 .id_table = foo_ids,
45 .probe = foo_probe, 42 .probe = foo_probe,
46 .remove = foo_remove, 43 .remove = foo_remove,
@@ -49,24 +46,19 @@ static struct i2c_driver foo_driver = {
49 .detect = foo_detect, 46 .detect = foo_detect,
50 .address_data = &addr_data, 47 .address_data = &addr_data,
51 48
52 /* else, driver uses "legacy" binding model: */
53 .attach_adapter = foo_attach_adapter,
54 .detach_client = foo_detach_client,
55
56 /* these may be used regardless of the driver binding model */
57 .shutdown = foo_shutdown, /* optional */ 49 .shutdown = foo_shutdown, /* optional */
58 .suspend = foo_suspend, /* optional */ 50 .suspend = foo_suspend, /* optional */
59 .resume = foo_resume, /* optional */ 51 .resume = foo_resume, /* optional */
60 .command = foo_command, /* optional */ 52 .command = foo_command, /* optional, deprecated */
61} 53}
62 54
63The name field is the driver name, and must not contain spaces. It 55The name field is the driver name, and must not contain spaces. It
64should match the module name (if the driver can be compiled as a module), 56should match the module name (if the driver can be compiled as a module),
65although you can use MODULE_ALIAS (passing "foo" in this example) to add 57although you can use MODULE_ALIAS (passing "foo" in this example) to add
66another name for the module. If the driver name doesn't match the module 58another name for the module. If the driver name doesn't match the module
67name, the module won't be automatically loaded (hotplug/coldplug). 59name, the module won't be automatically loaded (hotplug/coldplug).
68 60
69All other fields are for call-back functions which will be explained 61All other fields are for call-back functions which will be explained
70below. 62below.
71 63
72 64
@@ -74,34 +66,13 @@ Extra client data
74================= 66=================
75 67
76Each client structure has a special `data' field that can point to any 68Each client structure has a special `data' field that can point to any
77structure at all. You should use this to keep device-specific data, 69structure at all. You should use this to keep device-specific data.
78especially in drivers that handle multiple I2C or SMBUS devices. You
79do not always need this, but especially for `sensors' drivers, it can
80be very useful.
81 70
82 /* store the value */ 71 /* store the value */
83 void i2c_set_clientdata(struct i2c_client *client, void *data); 72 void i2c_set_clientdata(struct i2c_client *client, void *data);
84 73
85 /* retrieve the value */ 74 /* retrieve the value */
86 void *i2c_get_clientdata(struct i2c_client *client); 75 void *i2c_get_clientdata(const struct i2c_client *client);
87
88An example structure is below.
89
90 struct foo_data {
91 struct i2c_client client;
92 enum chips type; /* To keep the chips type for `sensors' drivers. */
93
94 /* Because the i2c bus is slow, it is often useful to cache the read
95 information of a chip for some time (for example, 1 or 2 seconds).
96 It depends of course on the device whether this is really worthwhile
97 or even sensible. */
98 struct mutex update_lock; /* When we are reading lots of information,
99 another process should not update the
100 below information */
101 char valid; /* != 0 if the following fields are valid. */
102 unsigned long last_updated; /* In jiffies */
103 /* Add the read information here too */
104 };
105 76
106 77
107Accessing the client 78Accessing the client
@@ -109,11 +80,9 @@ Accessing the client
109 80
110Let's say we have a valid client structure. At some time, we will need 81Let's say we have a valid client structure. At some time, we will need
111to gather information from the client, or write new information to the 82to gather information from the client, or write new information to the
112client. How we will export this information to user-space is less 83client.
113important at this moment (perhaps we do not need to do this at all for
114some obscure clients). But we need generic reading and writing routines.
115 84
116I have found it useful to define foo_read and foo_write function for this. 85I have found it useful to define foo_read and foo_write functions for this.
117For some cases, it will be easier to call the i2c functions directly, 86For some cases, it will be easier to call the i2c functions directly,
118but many chips have some kind of register-value idea that can easily 87but many chips have some kind of register-value idea that can easily
119be encapsulated. 88be encapsulated.
@@ -121,33 +90,33 @@ be encapsulated.
121The below functions are simple examples, and should not be copied 90The below functions are simple examples, and should not be copied
122literally. 91literally.
123 92
124 int foo_read_value(struct i2c_client *client, u8 reg) 93int foo_read_value(struct i2c_client *client, u8 reg)
125 { 94{
126 if (reg < 0x10) /* byte-sized register */ 95 if (reg < 0x10) /* byte-sized register */
127 return i2c_smbus_read_byte_data(client,reg); 96 return i2c_smbus_read_byte_data(client, reg);
128 else /* word-sized register */ 97 else /* word-sized register */
129 return i2c_smbus_read_word_data(client,reg); 98 return i2c_smbus_read_word_data(client, reg);
130 } 99}
131 100
132 int foo_write_value(struct i2c_client *client, u8 reg, u16 value) 101int foo_write_value(struct i2c_client *client, u8 reg, u16 value)
133 { 102{
134 if (reg == 0x10) /* Impossible to write - driver error! */ { 103 if (reg == 0x10) /* Impossible to write - driver error! */
135 return -1; 104 return -EINVAL;
136 else if (reg < 0x10) /* byte-sized register */ 105 else if (reg < 0x10) /* byte-sized register */
137 return i2c_smbus_write_byte_data(client,reg,value); 106 return i2c_smbus_write_byte_data(client, reg, value);
138 else /* word-sized register */ 107 else /* word-sized register */
139 return i2c_smbus_write_word_data(client,reg,value); 108 return i2c_smbus_write_word_data(client, reg, value);
140 } 109}
141 110
142 111
143Probing and attaching 112Probing and attaching
144===================== 113=====================
145 114
146The Linux I2C stack was originally written to support access to hardware 115The Linux I2C stack was originally written to support access to hardware
147monitoring chips on PC motherboards, and thus it embeds some assumptions 116monitoring chips on PC motherboards, and thus used to embed some assumptions
148that are more appropriate to SMBus (and PCs) than to I2C. One of these 117that were more appropriate to SMBus (and PCs) than to I2C. One of these
149assumptions is that most adapters and devices drivers support the SMBUS_QUICK 118assumptions was that most adapters and devices drivers support the SMBUS_QUICK
150protocol to probe device presence. Another is that devices and their drivers 119protocol to probe device presence. Another was that devices and their drivers
151can be sufficiently configured using only such probe primitives. 120can be sufficiently configured using only such probe primitives.
152 121
153As Linux and its I2C stack became more widely used in embedded systems 122As Linux and its I2C stack became more widely used in embedded systems
@@ -164,6 +133,9 @@ since the "legacy" model requires drivers to create "i2c_client" device
164objects after SMBus style probing, while the Linux driver model expects 133objects after SMBus style probing, while the Linux driver model expects
165drivers to be given such device objects in their probe() routines. 134drivers to be given such device objects in their probe() routines.
166 135
136The legacy model is deprecated now and will soon be removed, so we no
137longer document it here.
138
167 139
168Standard Driver Model Binding ("New Style") 140Standard Driver Model Binding ("New Style")
169------------------------------------------- 141-------------------------------------------
@@ -193,8 +165,8 @@ matches the device's name. It is passed the entry that was matched so
193the driver knows which one in the table matched. 165the driver knows which one in the table matched.
194 166
195 167
196Device Creation (Standard driver model) 168Device Creation
197--------------------------------------- 169---------------
198 170
199If you know for a fact that an I2C device is connected to a given I2C bus, 171If you know for a fact that an I2C device is connected to a given I2C bus,
200you can instantiate that device by simply filling an i2c_board_info 172you can instantiate that device by simply filling an i2c_board_info
@@ -221,8 +193,8 @@ in the I2C bus driver. You may want to save the returned i2c_client
221reference for later use. 193reference for later use.
222 194
223 195
224Device Detection (Standard driver model) 196Device Detection
225---------------------------------------- 197----------------
226 198
227Sometimes you do not know in advance which I2C devices are connected to 199Sometimes you do not know in advance which I2C devices are connected to
228a given I2C bus. This is for example the case of hardware monitoring 200a given I2C bus. This is for example the case of hardware monitoring
@@ -246,8 +218,8 @@ otherwise misdetections are likely to occur and things can get wrong
246quickly. 218quickly.
247 219
248 220
249Device Deletion (Standard driver model) 221Device Deletion
250--------------------------------------- 222---------------
251 223
252Each I2C device which has been created using i2c_new_device() or 224Each I2C device which has been created using i2c_new_device() or
253i2c_new_probed_device() can be unregistered by calling 225i2c_new_probed_device() can be unregistered by calling
@@ -256,264 +228,37 @@ called automatically before the underlying I2C bus itself is removed, as a
256device can't survive its parent in the device driver model. 228device can't survive its parent in the device driver model.
257 229
258 230
259Legacy Driver Binding Model 231Initializing the driver
260--------------------------- 232=======================
233
234When the kernel is booted, or when your foo driver module is inserted,
235you have to do some initializing. Fortunately, just registering the
236driver module is usually enough.
261 237
262Most i2c devices can be present on several i2c addresses; for some this 238static int __init foo_init(void)
263is determined in hardware (by soldering some chip pins to Vcc or Ground), 239{
264for others this can be changed in software (by writing to specific client 240 return i2c_add_driver(&foo_driver);
265registers). Some devices are usually on a specific address, but not always; 241}
266and some are even more tricky. So you will probably need to scan several 242
267i2c addresses for your clients, and do some sort of detection to see 243static void __exit foo_cleanup(void)
268whether it is actually a device supported by your driver. 244{
245 i2c_del_driver(&foo_driver);
246}
247
248/* Substitute your own name and email address */
249MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>"
250MODULE_DESCRIPTION("Driver for Barf Inc. Foo I2C devices");
269 251
270To give the user a maximum of possibilities, some default module parameters 252/* a few non-GPL license types are also allowed */
271are defined to help determine what addresses are scanned. Several macros 253MODULE_LICENSE("GPL");
272are defined in i2c.h to help you support them, as well as a generic 254
273detection algorithm. 255module_init(foo_init);
274 256module_exit(foo_cleanup);
275You do not have to use this parameter interface; but don't try to use 257
276function i2c_probe() if you don't. 258Note that some functions are marked by `__init'. These functions can
277 259be removed after kernel booting (or module loading) is completed.
278 260Likewise, functions marked by `__exit' are dropped by the compiler when
279Probing classes (Legacy model) 261the code is built into the kernel, as they would never be called.
280------------------------------
281
282All parameters are given as lists of unsigned 16-bit integers. Lists are
283terminated by I2C_CLIENT_END.
284The following lists are used internally:
285
286 normal_i2c: filled in by the module writer.
287 A list of I2C addresses which should normally be examined.
288 probe: insmod parameter.
289 A list of pairs. The first value is a bus number (-1 for any I2C bus),
290 the second is the address. These addresses are also probed, as if they
291 were in the 'normal' list.
292 ignore: insmod parameter.
293 A list of pairs. The first value is a bus number (-1 for any I2C bus),
294 the second is the I2C address. These addresses are never probed.
295 This parameter overrules the 'normal_i2c' list only.
296 force: insmod parameter.
297 A list of pairs. The first value is a bus number (-1 for any I2C bus),
298 the second is the I2C address. A device is blindly assumed to be on
299 the given address, no probing is done.
300
301Additionally, kind-specific force lists may optionally be defined if
302the driver supports several chip kinds. They are grouped in a
303NULL-terminated list of pointers named forces, those first element if the
304generic force list mentioned above. Each additional list correspond to an
305insmod parameter of the form force_<kind>.
306
307Fortunately, as a module writer, you just have to define the `normal_i2c'
308parameter. The complete declaration could look like this:
309
310 /* Scan 0x4c to 0x4f */
311 static const unsigned short normal_i2c[] = { 0x4c, 0x4d, 0x4e, 0x4f,
312 I2C_CLIENT_END };
313
314 /* Magic definition of all other variables and things */
315 I2C_CLIENT_INSMOD;
316 /* Or, if your driver supports, say, 2 kind of devices: */
317 I2C_CLIENT_INSMOD_2(foo, bar);
318
319If you use the multi-kind form, an enum will be defined for you:
320 enum chips { any_chip, foo, bar, ... }
321You can then (and certainly should) use it in the driver code.
322
323Note that you *have* to call the defined variable `normal_i2c',
324without any prefix!
325
326
327Attaching to an adapter (Legacy model)
328--------------------------------------
329
330Whenever a new adapter is inserted, or for all adapters if the driver is
331being registered, the callback attach_adapter() is called. Now is the
332time to determine what devices are present on the adapter, and to register
333a client for each of them.
334
335The attach_adapter callback is really easy: we just call the generic
336detection function. This function will scan the bus for us, using the
337information as defined in the lists explained above. If a device is
338detected at a specific address, another callback is called.
339
340 int foo_attach_adapter(struct i2c_adapter *adapter)
341 {
342 return i2c_probe(adapter,&addr_data,&foo_detect_client);
343 }
344
345Remember, structure `addr_data' is defined by the macros explained above,
346so you do not have to define it yourself.
347
348The i2c_probe function will call the foo_detect_client
349function only for those i2c addresses that actually have a device on
350them (unless a `force' parameter was used). In addition, addresses that
351are already in use (by some other registered client) are skipped.
352
353
354The detect client function (Legacy model)
355-----------------------------------------
356
357The detect client function is called by i2c_probe. The `kind' parameter
358contains -1 for a probed detection, 0 for a forced detection, or a positive
359number for a forced detection with a chip type forced.
360
361Returning an error different from -ENODEV in a detect function will cause
362the detection to stop: other addresses and adapters won't be scanned.
363This should only be done on fatal or internal errors, such as a memory
364shortage or i2c_attach_client failing.
365
366For now, you can ignore the `flags' parameter. It is there for future use.
367
368 int foo_detect_client(struct i2c_adapter *adapter, int address,
369 int kind)
370 {
371 int err = 0;
372 int i;
373 struct i2c_client *client;
374 struct foo_data *data;
375 const char *name = "";
376
377 /* Let's see whether this adapter can support what we need.
378 Please substitute the things you need here! */
379 if (!i2c_check_functionality(adapter,I2C_FUNC_SMBUS_WORD_DATA |
380 I2C_FUNC_SMBUS_WRITE_BYTE))
381 goto ERROR0;
382
383 /* OK. For now, we presume we have a valid client. We now create the
384 client structure, even though we cannot fill it completely yet.
385 But it allows us to access several i2c functions safely */
386
387 if (!(data = kzalloc(sizeof(struct foo_data), GFP_KERNEL))) {
388 err = -ENOMEM;
389 goto ERROR0;
390 }
391
392 client = &data->client;
393 i2c_set_clientdata(client, data);
394
395 client->addr = address;
396 client->adapter = adapter;
397 client->driver = &foo_driver;
398
399 /* Now, we do the remaining detection. If no `force' parameter is used. */
400
401 /* First, the generic detection (if any), that is skipped if any force
402 parameter was used. */
403 if (kind < 0) {
404 /* The below is of course bogus */
405 if (foo_read(client, FOO_REG_GENERIC) != FOO_GENERIC_VALUE)
406 goto ERROR1;
407 }
408
409 /* Next, specific detection. This is especially important for `sensors'
410 devices. */
411
412 /* Determine the chip type. Not needed if a `force_CHIPTYPE' parameter
413 was used. */
414 if (kind <= 0) {
415 i = foo_read(client, FOO_REG_CHIPTYPE);
416 if (i == FOO_TYPE_1)
417 kind = chip1; /* As defined in the enum */
418 else if (i == FOO_TYPE_2)
419 kind = chip2;
420 else {
421 printk("foo: Ignoring 'force' parameter for unknown chip at "
422 "adapter %d, address 0x%02x\n",i2c_adapter_id(adapter),address);
423 goto ERROR1;
424 }
425 }
426
427 /* Now set the type and chip names */
428 if (kind == chip1) {
429 name = "chip1";
430 } else if (kind == chip2) {
431 name = "chip2";
432 }
433
434 /* Fill in the remaining client fields. */
435 strlcpy(client->name, name, I2C_NAME_SIZE);
436 data->type = kind;
437 mutex_init(&data->update_lock); /* Only if you use this field */
438
439 /* Any other initializations in data must be done here too. */
440
441 /* This function can write default values to the client registers, if
442 needed. */
443 foo_init_client(client);
444
445 /* Tell the i2c layer a new client has arrived */
446 if ((err = i2c_attach_client(client)))
447 goto ERROR1;
448
449 return 0;
450
451 /* OK, this is not exactly good programming practice, usually. But it is
452 very code-efficient in this case. */
453
454 ERROR1:
455 kfree(data);
456 ERROR0:
457 return err;
458 }
459
460
461Removing the client (Legacy model)
462==================================
463
464The detach_client call back function is called when a client should be
465removed. It may actually fail, but only when panicking. This code is
466much simpler than the attachment code, fortunately!
467
468 int foo_detach_client(struct i2c_client *client)
469 {
470 int err;
471
472 /* Try to detach the client from i2c space */
473 if ((err = i2c_detach_client(client)))
474 return err;
475
476 kfree(i2c_get_clientdata(client));
477 return 0;
478 }
479
480
481Initializing the module or kernel
482=================================
483
484When the kernel is booted, or when your foo driver module is inserted,
485you have to do some initializing. Fortunately, just attaching (registering)
486the driver module is usually enough.
487
488 static int __init foo_init(void)
489 {
490 int res;
491
492 if ((res = i2c_add_driver(&foo_driver))) {
493 printk("foo: Driver registration failed, module not inserted.\n");
494 return res;
495 }
496 return 0;
497 }
498
499 static void __exit foo_cleanup(void)
500 {
501 i2c_del_driver(&foo_driver);
502 }
503
504 /* Substitute your own name and email address */
505 MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>"
506 MODULE_DESCRIPTION("Driver for Barf Inc. Foo I2C devices");
507
508 /* a few non-GPL license types are also allowed */
509 MODULE_LICENSE("GPL");
510
511 module_init(foo_init);
512 module_exit(foo_cleanup);
513
514Note that some functions are marked by `__init', and some data structures
515by `__initdata'. These functions and structures can be removed after
516kernel booting (or module loading) is completed.
517 262
518 263
519Power Management 264Power Management
@@ -548,33 +293,35 @@ Command function
548 293
549A generic ioctl-like function call back is supported. You will seldom 294A generic ioctl-like function call back is supported. You will seldom
550need this, and its use is deprecated anyway, so newer design should not 295need this, and its use is deprecated anyway, so newer design should not
551use it. Set it to NULL. 296use it.
552 297
553 298
554Sending and receiving 299Sending and receiving
555===================== 300=====================
556 301
557If you want to communicate with your device, there are several functions 302If you want to communicate with your device, there are several functions
558to do this. You can find all of them in i2c.h. 303to do this. You can find all of them in <linux/i2c.h>.
559 304
560If you can choose between plain i2c communication and SMBus level 305If you can choose between plain I2C communication and SMBus level
561communication, please use the last. All adapters understand SMBus level 306communication, please use the latter. All adapters understand SMBus level
562commands, but only some of them understand plain i2c! 307commands, but only some of them understand plain I2C!
563 308
564 309
565Plain i2c communication 310Plain I2C communication
566----------------------- 311-----------------------
567 312
568 extern int i2c_master_send(struct i2c_client *,const char* ,int); 313 int i2c_master_send(struct i2c_client *client, const char *buf,
569 extern int i2c_master_recv(struct i2c_client *,char* ,int); 314 int count);
315 int i2c_master_recv(struct i2c_client *client, char *buf, int count);
570 316
571These routines read and write some bytes from/to a client. The client 317These routines read and write some bytes from/to a client. The client
572contains the i2c address, so you do not have to include it. The second 318contains the i2c address, so you do not have to include it. The second
573parameter contains the bytes the read/write, the third the length of the 319parameter contains the bytes to read/write, the third the number of bytes
574buffer. Returned is the actual number of bytes read/written. 320to read/write (must be less than the length of the buffer.) Returned is
575 321the actual number of bytes read/written.
576 extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg, 322
577 int num); 323 int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg,
324 int num);
578 325
579This sends a series of messages. Each message can be a read or write, 326This sends a series of messages. Each message can be a read or write,
580and they can be mixed in any way. The transactions are combined: no 327and they can be mixed in any way. The transactions are combined: no
@@ -583,49 +330,45 @@ for each message the client address, the number of bytes of the message
583and the message data itself. 330and the message data itself.
584 331
585You can read the file `i2c-protocol' for more information about the 332You can read the file `i2c-protocol' for more information about the
586actual i2c protocol. 333actual I2C protocol.
587 334
588 335
589SMBus communication 336SMBus communication
590------------------- 337-------------------
591 338
592 extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, 339 s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
593 unsigned short flags, 340 unsigned short flags, char read_write, u8 command,
594 char read_write, u8 command, int size, 341 int size, union i2c_smbus_data *data);
595 union i2c_smbus_data * data); 342
596 343This is the generic SMBus function. All functions below are implemented
597 This is the generic SMBus function. All functions below are implemented 344in terms of it. Never use this function directly!
598 in terms of it. Never use this function directly! 345
599 346 s32 i2c_smbus_read_byte(struct i2c_client *client);
600 347 s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value);
601 extern s32 i2c_smbus_read_byte(struct i2c_client * client); 348 s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command);
602 extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value); 349 s32 i2c_smbus_write_byte_data(struct i2c_client *client,
603 extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command); 350 u8 command, u8 value);
604 extern s32 i2c_smbus_write_byte_data(struct i2c_client * client, 351 s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command);
605 u8 command, u8 value); 352 s32 i2c_smbus_write_word_data(struct i2c_client *client,
606 extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); 353 u8 command, u16 value);
607 extern s32 i2c_smbus_write_word_data(struct i2c_client * client, 354 s32 i2c_smbus_process_call(struct i2c_client *client,
608 u8 command, u16 value); 355 u8 command, u16 value);
609 extern s32 i2c_smbus_process_call(struct i2c_client *client, 356 s32 i2c_smbus_read_block_data(struct i2c_client *client,
610 u8 command, u16 value); 357 u8 command, u8 *values);
611 extern s32 i2c_smbus_read_block_data(struct i2c_client * client, 358 s32 i2c_smbus_write_block_data(struct i2c_client *client,
612 u8 command, u8 *values); 359 u8 command, u8 length, const u8 *values);
613 extern s32 i2c_smbus_write_block_data(struct i2c_client * client, 360 s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client,
614 u8 command, u8 length, 361 u8 command, u8 length, u8 *values);
615 u8 *values); 362 s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
616 extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, 363 u8 command, u8 length,
617 u8 command, u8 length, u8 *values); 364 const u8 *values);
618 extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
619 u8 command, u8 length,
620 u8 *values);
621 365
622These ones were removed from i2c-core because they had no users, but could 366These ones were removed from i2c-core because they had no users, but could
623be added back later if needed: 367be added back later if needed:
624 368
625 extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value); 369 s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value);
626 extern s32 i2c_smbus_block_process_call(struct i2c_client *client, 370 s32 i2c_smbus_block_process_call(struct i2c_client *client,
627 u8 command, u8 length, 371 u8 command, u8 length, u8 *values);
628 u8 *values)
629 372
630All these transactions return a negative errno value on failure. The 'write' 373All these transactions return a negative errno value on failure. The 'write'
631transactions return 0 on success; the 'read' transactions return the read 374transactions return 0 on success; the 'read' transactions return the read
@@ -642,7 +385,5 @@ General purpose routines
642Below all general purpose routines are listed, that were not mentioned 385Below all general purpose routines are listed, that were not mentioned
643before. 386before.
644 387
645 /* This call returns a unique low identifier for each registered adapter. 388 /* Return the adapter number for a specific adapter */
646 */ 389 int i2c_adapter_id(struct i2c_adapter *adap);
647 extern int i2c_adapter_id(struct i2c_adapter *adap);
648
diff --git a/Documentation/ia64/xen.txt b/Documentation/ia64/xen.txt
new file mode 100644
index 000000000000..c61a99f7c8bb
--- /dev/null
+++ b/Documentation/ia64/xen.txt
@@ -0,0 +1,183 @@
1 Recipe for getting/building/running Xen/ia64 with pv_ops
2 --------------------------------------------------------
3
4This recipe describes how to get xen-ia64 source and build it,
5and run domU with pv_ops.
6
7============
8Requirements
9============
10
11 - python
12 - mercurial
13 it (aka "hg") is an open-source source code
14 management software. See the below.
15 http://www.selenic.com/mercurial/wiki/
16 - git
17 - bridge-utils
18
19=================================
20Getting and Building Xen and Dom0
21=================================
22
23 My environment is;
24 Machine : Tiger4
25 Domain0 OS : RHEL5
26 DomainU OS : RHEL5
27
28 1. Download source
29 # hg clone http://xenbits.xensource.com/ext/ia64/xen-unstable.hg
30 # cd xen-unstable.hg
31 # hg clone http://xenbits.xensource.com/ext/ia64/linux-2.6.18-xen.hg
32
33 2. # make world
34
35 3. # make install-tools
36
37 4. copy kernels and xen
38 # cp xen/xen.gz /boot/efi/efi/redhat/
39 # cp build-linux-2.6.18-xen_ia64/vmlinux.gz \
40 /boot/efi/efi/redhat/vmlinuz-2.6.18.8-xen
41
42 5. make initrd for Dom0/DomU
43 # make -C linux-2.6.18-xen.hg ARCH=ia64 modules_install \
44 O=$(/bin/pwd)/build-linux-2.6.18-xen_ia64
45 # mkinitrd -f /boot/efi/efi/redhat/initrd-2.6.18.8-xen.img \
46 2.6.18.8-xen --builtin mptspi --builtin mptbase \
47 --builtin mptscsih --builtin uhci-hcd --builtin ohci-hcd \
48 --builtin ehci-hcd
49
50================================
51Making a disk image for guest OS
52================================
53
54 1. make file
55 # dd if=/dev/zero of=/root/rhel5.img bs=1M seek=4096 count=0
56 # mke2fs -F -j /root/rhel5.img
57 # mount -o loop /root/rhel5.img /mnt
58 # cp -ax /{dev,var,etc,usr,bin,sbin,lib} /mnt
59 # mkdir /mnt/{root,proc,sys,home,tmp}
60
61 Note: You may miss some device files. If so, please create them
62 with mknod. Or you can use tar instead of cp.
63
64 2. modify DomU's fstab
65 # vi /mnt/etc/fstab
66 /dev/xvda1 / ext3 defaults 1 1
67 none /dev/pts devpts gid=5,mode=620 0 0
68 none /dev/shm tmpfs defaults 0 0
69 none /proc proc defaults 0 0
70 none /sys sysfs defaults 0 0
71
72 3. modify inittab
73 set runlevel to 3 to avoid X trying to start
74 # vi /mnt/etc/inittab
75 id:3:initdefault:
76 Start a getty on the hvc0 console
77 X0:2345:respawn:/sbin/mingetty hvc0
78 tty1-6 mingetty can be commented out
79
80 4. add hvc0 into /etc/securetty
81 # vi /mnt/etc/securetty (add hvc0)
82
83 5. umount
84 # umount /mnt
85
86FYI, virt-manager can also make a disk image for guest OS.
87It's GUI tools and easy to make it.
88
89==================
90Boot Xen & Domain0
91==================
92
93 1. replace elilo
94 elilo of RHEL5 can boot Xen and Dom0.
95 If you use old elilo (e.g RHEL4), please download from the below
96 http://elilo.sourceforge.net/cgi-bin/blosxom
97 and copy into /boot/efi/efi/redhat/
98 # cp elilo-3.6-ia64.efi /boot/efi/efi/redhat/elilo.efi
99
100 2. modify elilo.conf (like the below)
101 # vi /boot/efi/efi/redhat/elilo.conf
102 prompt
103 timeout=20
104 default=xen
105 relocatable
106
107 image=vmlinuz-2.6.18.8-xen
108 label=xen
109 vmm=xen.gz
110 initrd=initrd-2.6.18.8-xen.img
111 read-only
112 append=" -- rhgb root=/dev/sda2"
113
114The append options before "--" are for xen hypervisor,
115the options after "--" are for dom0.
116
117FYI, your machine may need console options like
118"com1=19200,8n1 console=vga,com1". For example,
119append="com1=19200,8n1 console=vga,com1 -- rhgb console=tty0 \
120console=ttyS0 root=/dev/sda2"
121
122=====================================
123Getting and Building domU with pv_ops
124=====================================
125
126 1. get pv_ops tree
127 # git clone http://people.valinux.co.jp/~yamahata/xen-ia64/linux-2.6-xen-ia64.git/
128
129 2. git branch (if necessary)
130 # cd linux-2.6-xen-ia64/
131 # git checkout -b your_branch origin/xen-ia64-domu-minimal-2008may19
132 (Note: The current branch is xen-ia64-domu-minimal-2008may19.
133 But you would find the new branch. You can see with
134 "git branch -r" to get the branch lists.
135 http://people.valinux.co.jp/~yamahata/xen-ia64/for_eagl/linux-2.6-ia64-pv-ops.git/
136 is also available. The tree is based on
137 git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 test)
138
139
140 3. copy .config for pv_ops of domU
141 # cp arch/ia64/configs/xen_domu_wip_defconfig .config
142
143 4. make kernel with pv_ops
144 # make oldconfig
145 # make
146
147 5. install the kernel and initrd
148 # cp vmlinux.gz /boot/efi/efi/redhat/vmlinuz-2.6-pv_ops-xenU
149 # make modules_install
150 # mkinitrd -f /boot/efi/efi/redhat/initrd-2.6-pv_ops-xenU.img \
151 2.6.26-rc3xen-ia64-08941-g1b12161 --builtin mptspi \
152 --builtin mptbase --builtin mptscsih --builtin uhci-hcd \
153 --builtin ohci-hcd --builtin ehci-hcd
154
155========================
156Boot DomainU with pv_ops
157========================
158
159 1. make config of DomU
160 # vi /etc/xen/rhel5
161 kernel = "/boot/efi/efi/redhat/vmlinuz-2.6-pv_ops-xenU"
162 ramdisk = "/boot/efi/efi/redhat/initrd-2.6-pv_ops-xenU.img"
163 vcpus = 1
164 memory = 512
165 name = "rhel5"
166 disk = [ 'file:/root/rhel5.img,xvda1,w' ]
167 root = "/dev/xvda1 ro"
168 extra= "rhgb console=hvc0"
169
170 2. After boot xen and dom0, start xend
171 # /etc/init.d/xend start
172 ( In the debugging case, # XEND_DEBUG=1 xend trace_start )
173
174 3. start domU
175 # xm create -c rhel5
176
177=========
178Reference
179=========
180- Wiki of Xen/IA64 upstream merge
181 http://wiki.xensource.com/xenwiki/XenIA64/UpstreamMerge
182
183Written by Akio Takebe <takebe_akio@jp.fujitsu.com> on 28 May 2008
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
index 0705040531a5..3f4bc840da8b 100644
--- a/Documentation/kdump/kdump.txt
+++ b/Documentation/kdump/kdump.txt
@@ -109,7 +109,8 @@ There are two possible methods of using Kdump.
1092) Or use the system kernel binary itself as dump-capture kernel and there is 1092) Or use the system kernel binary itself as dump-capture kernel and there is
110 no need to build a separate dump-capture kernel. This is possible 110 no need to build a separate dump-capture kernel. This is possible
111 only with the architecutres which support a relocatable kernel. As 111 only with the architecutres which support a relocatable kernel. As
112 of today, i386, x86_64 and ia64 architectures support relocatable kernel. 112 of today, i386, x86_64, ppc64 and ia64 architectures support relocatable
113 kernel.
113 114
114Building a relocatable kernel is advantageous from the point of view that 115Building a relocatable kernel is advantageous from the point of view that
115one does not have to build a second kernel for capturing the dump. But 116one does not have to build a second kernel for capturing the dump. But
@@ -207,8 +208,15 @@ Dump-capture kernel config options (Arch Dependent, i386 and x86_64)
207Dump-capture kernel config options (Arch Dependent, ppc64) 208Dump-capture kernel config options (Arch Dependent, ppc64)
208---------------------------------------------------------- 209----------------------------------------------------------
209 210
210* Make and install the kernel and its modules. DO NOT add this kernel 2111) Enable "Build a kdump crash kernel" support under "Kernel" options:
211 to the boot loader configuration files. 212
213 CONFIG_CRASH_DUMP=y
214
2152) Enable "Build a relocatable kernel" support
216
217 CONFIG_RELOCATABLE=y
218
219 Make and install the kernel and its modules.
212 220
213Dump-capture kernel config options (Arch Dependent, ia64) 221Dump-capture kernel config options (Arch Dependent, ia64)
214---------------------------------------------------------- 222----------------------------------------------------------
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index de4063cb4fdc..02ea9a971b8e 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1917,6 +1917,8 @@ platforms are moved over to use the flattened-device-tree model.
1917 inverse clock polarity (CPOL) mode 1917 inverse clock polarity (CPOL) mode
1918 - spi-cpha - (optional) Empty property indicating device requires 1918 - spi-cpha - (optional) Empty property indicating device requires
1919 shifted clock phase (CPHA) mode 1919 shifted clock phase (CPHA) mode
1920 - spi-cs-high - (optional) Empty property indicating device requires
1921 chip select active high
1920 1922
1921 SPI example for an MPC5200 SPI bus: 1923 SPI example for an MPC5200 SPI bus:
1922 spi@f00 { 1924 spi@f00 {
diff --git a/Documentation/powerpc/dts-bindings/fsl/board.txt b/Documentation/powerpc/dts-bindings/fsl/board.txt
index 74ae6f1cd2d6..81a917ef96e9 100644
--- a/Documentation/powerpc/dts-bindings/fsl/board.txt
+++ b/Documentation/powerpc/dts-bindings/fsl/board.txt
@@ -2,13 +2,13 @@
2 2
3Required properties: 3Required properties:
4 4
5 - device_type : Should be "board-control" 5 - compatible : Should be "fsl,<board>-bcsr"
6 - reg : Offset and length of the register set for the device 6 - reg : Offset and length of the register set for the device
7 7
8Example: 8Example:
9 9
10 bcsr@f8000000 { 10 bcsr@f8000000 {
11 device_type = "board-control"; 11 compatible = "fsl,mpc8360mds-bcsr";
12 reg = <f8000000 8000>; 12 reg = <f8000000 8000>;
13 }; 13 };
14 14
diff --git a/Documentation/usb/WUSB-Design-overview.txt b/Documentation/usb/WUSB-Design-overview.txt
new file mode 100644
index 000000000000..4c3d62c7843a
--- /dev/null
+++ b/Documentation/usb/WUSB-Design-overview.txt
@@ -0,0 +1,448 @@
1
2Linux UWB + Wireless USB + WiNET
3
4 (C) 2005-2006 Intel Corporation
5 Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License version
9 2 as published by the Free Software Foundation.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301, USA.
20
21
22Please visit http://bughost.org/thewiki/Design-overview.txt-1.8 for
23updated content.
24
25 * Design-overview.txt-1.8
26
27This code implements a Ultra Wide Band stack for Linux, as well as
28drivers for the the USB based UWB radio controllers defined in the
29Wireless USB 1.0 specification (including Wireless USB host controller
30and an Intel WiNET controller).
31
32 1. Introduction
33 1. HWA: Host Wire adapters, your Wireless USB dongle
34
35 2. DWA: Device Wired Adaptor, a Wireless USB hub for wired
36 devices
37 3. WHCI: Wireless Host Controller Interface, the PCI WUSB host
38 adapter
39 2. The UWB stack
40 1. Devices and hosts: the basic structure
41
42 2. Host Controller life cycle
43
44 3. On the air: beacons and enumerating the radio neighborhood
45
46 4. Device lists
47 5. Bandwidth allocation
48
49 3. Wireless USB Host Controller drivers
50
51 4. Glossary
52
53
54 Introduction
55
56UWB is a wide-band communication protocol that is to serve also as the
57low-level protocol for others (much like TCP sits on IP). Currently
58these others are Wireless USB and TCP/IP, but seems Bluetooth and
59Firewire/1394 are coming along.
60
61UWB uses a band from roughly 3 to 10 GHz, transmitting at a max of
62~-41dB (or 0.074 uW/MHz--geography specific data is still being
63negotiated w/ regulators, so watch for changes). That band is divided in
64a bunch of ~1.5 GHz wide channels (or band groups) composed of three
65subbands/subchannels (528 MHz each). Each channel is independent of each
66other, so you could consider them different "busses". Initially this
67driver considers them all a single one.
68
69Radio time is divided in 65536 us long /superframes/, each one divided
70in 256 256us long /MASs/ (Media Allocation Slots), which are the basic
71time/media allocation units for transferring data. At the beginning of
72each superframe there is a Beacon Period (BP), where every device
73transmit its beacon on a single MAS. The length of the BP depends on how
74many devices are present and the length of their beacons.
75
76Devices have a MAC (fixed, 48 bit address) and a device (changeable, 16
77bit address) and send periodic beacons to advertise themselves and pass
78info on what they are and do. They advertise their capabilities and a
79bunch of other stuff.
80
81The different logical parts of this driver are:
82
83 *
84
85 *UWB*: the Ultra-Wide-Band stack -- manages the radio and
86 associated spectrum to allow for devices sharing it. Allows to
87 control bandwidth assingment, beaconing, scanning, etc
88
89 *
90
91 *WUSB*: the layer that sits on top of UWB to provide Wireless USB.
92 The Wireless USB spec defines means to control a UWB radio and to
93 do the actual WUSB.
94
95
96 HWA: Host Wire adapters, your Wireless USB dongle
97
98WUSB also defines a device called a Host Wire Adaptor (HWA), which in
99mere terms is a USB dongle that enables your PC to have UWB and Wireless
100USB. The Wireless USB Host Controller in a HWA looks to the host like a
101[Wireless] USB controller connected via USB (!)
102
103The HWA itself is broken in two or three main interfaces:
104
105 *
106
107 *RC*: Radio control -- this implements an interface to the
108 Ultra-Wide-Band radio controller. The driver for this implements a
109 USB-based UWB Radio Controller to the UWB stack.
110
111 *
112
113 *HC*: the wireless USB host controller. It looks like a USB host
114 whose root port is the radio and the WUSB devices connect to it.
115 To the system it looks like a separate USB host. The driver (will)
116 implement a USB host controller (similar to UHCI, OHCI or EHCI)
117 for which the root hub is the radio...To reiterate: it is a USB
118 controller that is connected via USB instead of PCI.
119
120 *
121
122 *WINET*: some HW provide a WiNET interface (IP over UWB). This
123 package provides a driver for it (it looks like a network
124 interface, winetX). The driver detects when there is a link up for
125 their type and kick into gear.
126
127
128 DWA: Device Wired Adaptor, a Wireless USB hub for wired devices
129
130These are the complement to HWAs. They are a USB host for connecting
131wired devices, but it is connected to your PC connected via Wireless
132USB. To the system it looks like yet another USB host. To the untrained
133eye, it looks like a hub that connects upstream wirelessly.
134
135We still offer no support for this; however, it should share a lot of
136code with the HWA-RC driver; there is a bunch of factorization work that
137has been done to support that in upcoming releases.
138
139
140 WHCI: Wireless Host Controller Interface, the PCI WUSB host adapter
141
142This is your usual PCI device that implements WHCI. Similar in concept
143to EHCI, it allows your wireless USB devices (including DWAs) to connect
144to your host via a PCI interface. As in the case of the HWA, it has a
145Radio Control interface and the WUSB Host Controller interface per se.
146
147There is still no driver support for this, but will be in upcoming
148releases.
149
150
151 The UWB stack
152
153The main mission of the UWB stack is to keep a tally of which devices
154are in radio proximity to allow drivers to connect to them. As well, it
155provides an API for controlling the local radio controllers (RCs from
156now on), such as to start/stop beaconing, scan, allocate bandwidth, etc.
157
158
159 Devices and hosts: the basic structure
160
161The main building block here is the UWB device (struct uwb_dev). For
162each device that pops up in radio presence (ie: the UWB host receives a
163beacon from it) you get a struct uwb_dev that will show up in
164/sys/class/uwb and in /sys/bus/uwb/devices.
165
166For each RC that is detected, a new struct uwb_rc is created. In turn, a
167RC is also a device, so they also show in /sys/class/uwb and
168/sys/bus/uwb/devices, but at the same time, only radio controllers show
169up in /sys/class/uwb_rc.
170
171 *
172
173 [*] The reason for RCs being also devices is that not only we can
174 see them while enumerating the system device tree, but also on the
175 radio (their beacons and stuff), so the handling has to be
176 likewise to that of a device.
177
178Each RC driver is implemented by a separate driver that plugs into the
179interface that the UWB stack provides through a struct uwb_rc_ops. The
180spec creators have been nice enough to make the message format the same
181for HWA and WHCI RCs, so the driver is really a very thin transport that
182moves the requests from the UWB API to the device [/uwb_rc_ops->cmd()/]
183and sends the replies and notifications back to the API
184[/uwb_rc_neh_grok()/]. Notifications are handled to the UWB daemon, that
185is chartered, among other things, to keep the tab of how the UWB radio
186neighborhood looks, creating and destroying devices as they show up or
187dissapear.
188
189Command execution is very simple: a command block is sent and a event
190block or reply is expected back. For sending/receiving command/events, a
191handle called /neh/ (Notification/Event Handle) is opened with
192/uwb_rc_neh_open()/.
193
194The HWA-RC (USB dongle) driver (drivers/uwb/hwa-rc.c) does this job for
195the USB connected HWA. Eventually, drivers/whci-rc.c will do the same
196for the PCI connected WHCI controller.
197
198
199 Host Controller life cycle
200
201So let's say we connect a dongle to the system: it is detected and
202firmware uploaded if needed [for Intel's i1480
203/drivers/uwb/ptc/usb.c:ptc_usb_probe()/] and then it is reenumerated.
204Now we have a real HWA device connected and
205/drivers/uwb/hwa-rc.c:hwarc_probe()/ picks it up, that will set up the
206Wire-Adaptor environment and then suck it into the UWB stack's vision of
207the world [/drivers/uwb/lc-rc.c:uwb_rc_add()/].
208
209 *
210
211 [*] The stack should put a new RC to scan for devices
212 [/uwb_rc_scan()/] so it finds what's available around and tries to
213 connect to them, but this is policy stuff and should be driven
214 from user space. As of now, the operator is expected to do it
215 manually; see the release notes for documentation on the procedure.
216
217When a dongle is disconnected, /drivers/uwb/hwa-rc.c:hwarc_disconnect()/
218takes time of tearing everything down safely (or not...).
219
220
221 On the air: beacons and enumerating the radio neighborhood
222
223So assuming we have devices and we have agreed for a channel to connect
224on (let's say 9), we put the new RC to beacon:
225
226 *
227
228 $ echo 9 0 > /sys/class/uwb_rc/uwb0/beacon
229
230Now it is visible. If there were other devices in the same radio channel
231and beacon group (that's what the zero is for), the dongle's radio
232control interface will send beacon notifications on its
233notification/event endpoint (NEEP). The beacon notifications are part of
234the event stream that is funneled into the API with
235/drivers/uwb/neh.c:uwb_rc_neh_grok()/ and delivered to the UWBD, the UWB
236daemon through a notification list.
237
238UWBD wakes up and scans the event list; finds a beacon and adds it to
239the BEACON CACHE (/uwb_beca/). If he receives a number of beacons from
240the same device, he considers it to be 'onair' and creates a new device
241[/drivers/uwb/lc-dev.c:uwbd_dev_onair()/]. Similarly, when no beacons
242are received in some time, the device is considered gone and wiped out
243[uwbd calls periodically /uwb/beacon.c:uwb_beca_purge()/ that will purge
244the beacon cache of dead devices].
245
246
247 Device lists
248
249All UWB devices are kept in the list of the struct bus_type uwb_bus.
250
251
252 Bandwidth allocation
253
254The UWB stack maintains a local copy of DRP availability through
255processing of incoming *DRP Availability Change* notifications. This
256local copy is currently used to present the current bandwidth
257availability to the user through the sysfs file
258/sys/class/uwb_rc/uwbx/bw_avail. In the future the bandwidth
259availability information will be used by the bandwidth reservation
260routines.
261
262The bandwidth reservation routines are in progress and are thus not
263present in the current release. When completed they will enable a user
264to initiate DRP reservation requests through interaction with sysfs. DRP
265reservation requests from remote UWB devices will also be handled. The
266bandwidth management done by the UWB stack will include callbacks to the
267higher layers will enable the higher layers to use the reservations upon
268completion. [Note: The bandwidth reservation work is in progress and
269subject to change.]
270
271
272 Wireless USB Host Controller drivers
273
274*WARNING* This section needs a lot of work!
275
276As explained above, there are three different types of HCs in the WUSB
277world: HWA-HC, DWA-HC and WHCI-HC.
278
279HWA-HC and DWA-HC share that they are Wire-Adapters (USB or WUSB
280connected controllers), and their transfer management system is almost
281identical. So is their notification delivery system.
282
283HWA-HC and WHCI-HC share that they are both WUSB host controllers, so
284they have to deal with WUSB device life cycle and maintenance, wireless
285root-hub
286
287HWA exposes a Host Controller interface (HWA-HC 0xe0/02/02). This has
288three endpoints (Notifications, Data Transfer In and Data Transfer
289Out--known as NEP, DTI and DTO in the code).
290
291We reserve UWB bandwidth for our Wireless USB Cluster, create a Cluster
292ID and tell the HC to use all that. Then we start it. This means the HC
293starts sending MMCs.
294
295 *
296
297 The MMCs are blocks of data defined somewhere in the WUSB1.0 spec
298 that define a stream in the UWB channel time allocated for sending
299 WUSB IEs (host to device commands/notifications) and Device
300 Notifications (device initiated to host). Each host defines a
301 unique Wireless USB cluster through MMCs. Devices can connect to a
302 single cluster at the time. The IEs are Information Elements, and
303 among them are the bandwidth allocations that tell each device
304 when can they transmit or receive.
305
306Now it all depends on external stimuli.
307
308*New device connection*
309
310A new device pops up, it scans the radio looking for MMCs that give out
311the existence of Wireless USB channels. Once one (or more) are found,
312selects which one to connect to. Sends a /DN_Connect/ (device
313notification connect) during the DNTS (Device Notification Time
314Slot--announced in the MMCs
315
316HC picks the /DN_Connect/ out (nep module sends to notif.c for delivery
317into /devconnect/). This process starts the authentication process for
318the device. First we allocate a /fake port/ and assign an
319unauthenticated address (128 to 255--what we really do is
3200x80 | fake_port_idx). We fiddle with the fake port status and /khubd/
321sees a new connection, so he moves on to enable the fake port with a reset.
322
323So now we are in the reset path -- we know we have a non-yet enumerated
324device with an unauthorized address; we ask user space to authenticate
325(FIXME: not yet done, similar to bluetooth pairing), then we do the key
326exchange (FIXME: not yet done) and issue a /set address 0/ to bring the
327device to the default state. Device is authenticated.
328
329From here, the USB stack takes control through the usb_hcd ops. khubd
330has seen the port status changes, as we have been toggling them. It will
331start enumerating and doing transfers through usb_hcd->urb_enqueue() to
332read descriptors and move our data.
333
334*Device life cycle and keep alives*
335
336Everytime there is a succesful transfer to/from a device, we update a
337per-device activity timestamp. If not, every now and then we check and
338if the activity timestamp gets old, we ping the device by sending it a
339Keep Alive IE; it responds with a /DN_Alive/ pong during the DNTS (this
340arrives to us as a notification through
341devconnect.c:wusb_handle_dn_alive(). If a device times out, we
342disconnect it from the system (cleaning up internal information and
343toggling the bits in the fake hub port, which kicks khubd into removing
344the rest of the stuff).
345
346This is done through devconnect:__wusb_check_devs(), which will scan the
347device list looking for whom needs refreshing.
348
349If the device wants to disconnect, it will either die (ugly) or send a
350/DN_Disconnect/ that will prompt a disconnection from the system.
351
352*Sending and receiving data*
353
354Data is sent and received through /Remote Pipes/ (rpipes). An rpipe is
355/aimed/ at an endpoint in a WUSB device. This is the same for HWAs and
356DWAs.
357
358Each HC has a number of rpipes and buffers that can be assigned to them;
359when doing a data transfer (xfer), first the rpipe has to be aimed and
360prepared (buffers assigned), then we can start queueing requests for
361data in or out.
362
363Data buffers have to be segmented out before sending--so we send first a
364header (segment request) and then if there is any data, a data buffer
365immediately after to the DTI interface (yep, even the request). If our
366buffer is bigger than the max segment size, then we just do multiple
367requests.
368
369[This sucks, because doing USB scatter gatter in Linux is resource
370intensive, if any...not that the current approach is not. It just has to
371be cleaned up a lot :)].
372
373If reading, we don't send data buffers, just the segment headers saying
374we want to read segments.
375
376When the xfer is executed, we receive a notification that says data is
377ready in the DTI endpoint (handled through
378xfer.c:wa_handle_notif_xfer()). In there we read from the DTI endpoint a
379descriptor that gives us the status of the transfer, its identification
380(given when we issued it) and the segment number. If it was a data read,
381we issue another URB to read into the destination buffer the chunk of
382data coming out of the remote endpoint. Done, wait for the next guy. The
383callbacks for the URBs issued from here are the ones that will declare
384the xfer complete at some point and call it's callback.
385
386Seems simple, but the implementation is not trivial.
387
388 *
389
390 *WARNING* Old!!
391
392The main xfer descriptor, wa_xfer (equivalent to a URB) contains an
393array of segments, tallys on segments and buffers and callback
394information. Buried in there is a lot of URBs for executing the segments
395and buffer transfers.
396
397For OUT xfers, there is an array of segments, one URB for each, another
398one of buffer URB. When submitting, we submit URBs for segment request
3991, buffer 1, segment 2, buffer 2...etc. Then we wait on the DTI for xfer
400result data; when all the segments are complete, we call the callback to
401finalize the transfer.
402
403For IN xfers, we only issue URBs for the segments we want to read and
404then wait for the xfer result data.
405
406*URB mapping into xfers*
407
408This is done by hwahc_op_urb_[en|de]queue(). In enqueue() we aim an
409rpipe to the endpoint where we have to transmit, create a transfer
410context (wa_xfer) and submit it. When the xfer is done, our callback is
411called and we assign the status bits and release the xfer resources.
412
413In dequeue() we are basically cancelling/aborting the transfer. We issue
414a xfer abort request to the HC, cancell all the URBs we had submitted
415and not yet done and when all that is done, the xfer callback will be
416called--this will call the URB callback.
417
418
419 Glossary
420
421*DWA* -- Device Wire Adapter
422
423USB host, wired for downstream devices, upstream connects wirelessly
424with Wireless USB.
425
426*EVENT* -- Response to a command on the NEEP
427
428*HWA* -- Host Wire Adapter / USB dongle for UWB and Wireless USB
429
430*NEH* -- Notification/Event Handle
431
432Handle/file descriptor for receiving notifications or events. The WA
433code requires you to get one of this to listen for notifications or
434events on the NEEP.
435
436*NEEP* -- Notification/Event EndPoint
437
438Stuff related to the management of the first endpoint of a HWA USB
439dongle that is used to deliver an stream of events and notifications to
440the host.
441
442*NOTIFICATION* -- Message coming in the NEEP as response to something.
443
444*RC* -- Radio Control
445
446Design-overview.txt-1.8 (last edited 2006-11-04 12:22:24 by
447InakyPerezGonzalez)
448
diff --git a/Documentation/usb/wusb-cbaf b/Documentation/usb/wusb-cbaf
new file mode 100644
index 000000000000..2e78b70f3adc
--- /dev/null
+++ b/Documentation/usb/wusb-cbaf
@@ -0,0 +1,139 @@
1#! /bin/bash
2#
3
4set -e
5
6progname=$(basename $0)
7function help
8{
9 cat <<EOF
10Usage: $progname COMMAND DEVICEs [ARGS]
11
12Command for manipulating the pairing/authentication credentials of a
13Wireless USB device that supports wired-mode Cable-Based-Association.
14
15Works in conjunction with the wusb-cba.ko driver from http://linuxuwb.org.
16
17
18DEVICE
19
20 sysfs path to the device to authenticate; for example, both this
21 guys are the same:
22
23 /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4.4/1-4.4:1.1
24 /sys/bus/usb/drivers/wusb-cbaf/1-4.4:1.1
25
26COMMAND/ARGS are
27
28 start
29
30 Start a WUSB host controller (by setting up a CHID)
31
32 set-chid DEVICE HOST-CHID HOST-BANDGROUP HOST-NAME
33
34 Sets host information in the device; after this you can call the
35 get-cdid to see how does this device report itself to us.
36
37 get-cdid DEVICE
38
39 Get the device ID associated to the HOST-CHDI we sent with
40 'set-chid'. We might not know about it.
41
42 set-cc DEVICE
43
44 If we allow the device to connect, set a random new CDID and CK
45 (connection key). Device saves them for the next time it wants to
46 connect wireless. We save them for that next time also so we can
47 authenticate the device (when we see the CDID he uses to id
48 itself) and the CK to crypto talk to it.
49
50CHID is always 16 hex bytes in 'XX YY ZZ...' form
51BANDGROUP is almost always 0001
52
53Examples:
54
55 You can default most arguments to '' to get a sane value:
56
57 $ $progname set-chid '' '' '' "My host name"
58
59 A full sequence:
60
61 $ $progname set-chid '' '' '' "My host name"
62 $ $progname get-cdid ''
63 $ $progname set-cc ''
64
65EOF
66}
67
68
69# Defaults
70# FIXME: CHID should come from a database :), band group from the host
71host_CHID="00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff"
72host_band_group="0001"
73host_name=$(hostname)
74
75devs="$(echo /sys/bus/usb/drivers/wusb-cbaf/[0-9]*)"
76hdevs="$(for h in /sys/class/uwb_rc/*/wusbhc; do readlink -f $h; done)"
77
78result=0
79case $1 in
80 start)
81 for dev in ${2:-$hdevs}
82 do
83 uwb_rc=$(readlink -f $dev/uwb_rc)
84 if cat $uwb_rc/beacon | grep -q -- "-1"
85 then
86 echo 13 0 > $uwb_rc/beacon
87 echo I: started beaconing on ch 13 on $(basename $uwb_rc) >&2
88 fi
89 echo $host_CHID > $dev/wusb_chid
90 echo I: started host $(basename $dev) >&2
91 done
92 ;;
93 stop)
94 for dev in ${2:-$hdevs}
95 do
96 echo 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > $dev/wusb_chid
97 echo I: stopped host $(basename $dev) >&2
98 uwb_rc=$(readlink -f $dev/uwb_rc)
99 echo -1 | cat > $uwb_rc/beacon
100 echo I: stopped beaconing on $(basename $uwb_rc) >&2
101 done
102 ;;
103 set-chid)
104 shift
105 for dev in ${2:-$devs}; do
106 echo "${4:-$host_name}" > $dev/wusb_host_name
107 echo "${3:-$host_band_group}" > $dev/wusb_host_band_groups
108 echo ${2:-$host_CHID} > $dev/wusb_chid
109 done
110 ;;
111 get-cdid)
112 for dev in ${2:-$devs}
113 do
114 cat $dev/wusb_cdid
115 done
116 ;;
117 set-cc)
118 for dev in ${2:-$devs}; do
119 shift
120 CDID="$(head --bytes=16 /dev/urandom | od -tx1 -An)"
121 CK="$(head --bytes=16 /dev/urandom | od -tx1 -An)"
122 echo "$CDID" > $dev/wusb_cdid
123 echo "$CK" > $dev/wusb_ck
124
125 echo I: CC set >&2
126 echo "CHID: $(cat $dev/wusb_chid)"
127 echo "CDID:$CDID"
128 echo "CK: $CK"
129 done
130 ;;
131 help|h|--help|-h)
132 help
133 ;;
134 *)
135 echo "E: Unknown usage" 1>&2
136 help 1>&2
137 result=1
138esac
139exit $result