diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-22 18:08:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-22 18:08:34 -0400 |
commit | eaa8568901b3164197ce727c4c9b4067383e526c (patch) | |
tree | 6dc48f016cfff6e1e5ce9278be819e1b651027b0 /Documentation | |
parent | 6c763eb9ead86c612492b59287b36c0dcf7d09b1 (diff) | |
parent | c6976a4eb3c9ead165de950899b45db0840b8e30 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/w1-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/w1-2.6:
[PATCH] w1: warning fix
[PATCH] w1: clean up W1_CON dependency.
[PATCH] drivers/w1/w1.c: fix a compile error
[PATCH] W1: fix dependencies of W1_SLAVE_DS2433_CRC
[PATCH] W1: possible cleanups
[PATCH] W1: cleanups
[PATCH] w1 exports
[PATCH] w1: Use mutexes instead of semaphores.
[PATCH] w1: Make w1 connector notifications depend on connector.
[PATCH] w1: netlink: Mark netlink group 1 as unused.
[PATCH] w1: Move w1-connector definitions into linux/include/connector.h
[PATCH] w1: Userspace communication protocol over connector.
[PATCH] w1: Replace dscore and ds_w1_bridge with ds2490 driver.
[PATCH] w1: Added default generic read/write operations.
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/w1/masters/ds2490 | 18 | ||||
-rw-r--r-- | Documentation/w1/w1.generic | 18 | ||||
-rw-r--r-- | Documentation/w1/w1.netlink | 98 |
3 files changed, 131 insertions, 3 deletions
diff --git a/Documentation/w1/masters/ds2490 b/Documentation/w1/masters/ds2490 new file mode 100644 index 000000000000..44a4918bd7f2 --- /dev/null +++ b/Documentation/w1/masters/ds2490 | |||
@@ -0,0 +1,18 @@ | |||
1 | Kernel driver ds2490 | ||
2 | ==================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Maxim DS2490 based | ||
6 | |||
7 | Author: Evgeniy Polyakov <johnpol@2ka.mipt.ru> | ||
8 | |||
9 | |||
10 | Description | ||
11 | ----------- | ||
12 | |||
13 | The Maixm/Dallas Semiconductor DS2490 is a chip | ||
14 | which allows to build USB <-> W1 bridges. | ||
15 | |||
16 | DS9490(R) is a USB <-> W1 bus master device | ||
17 | which has 0x81 family ID integrated chip and DS2490 | ||
18 | low-level operational chip. | ||
diff --git a/Documentation/w1/w1.generic b/Documentation/w1/w1.generic index f937fbe1cacb..4c6509dd4789 100644 --- a/Documentation/w1/w1.generic +++ b/Documentation/w1/w1.generic | |||
@@ -27,8 +27,19 @@ When a w1 master driver registers with the w1 subsystem, the following occurs: | |||
27 | 27 | ||
28 | When a device is found on the bus, w1 core checks if driver for it's family is | 28 | When a device is found on the bus, w1 core checks if driver for it's family is |
29 | loaded. If so, the family driver is attached to the slave. | 29 | loaded. If so, the family driver is attached to the slave. |
30 | If there is no driver for the family, a simple sysfs entry is created | 30 | If there is no driver for the family, default one is assigned, which allows to perform |
31 | for the slave device. | 31 | almost any kind of operations. Each logical operation is a transaction |
32 | in nature, which can contain several (two or one) low-level operations. | ||
33 | Let's see how one can read EEPROM context: | ||
34 | 1. one must write control buffer, i.e. buffer containing command byte | ||
35 | and two byte address. At this step bus is reset and appropriate device | ||
36 | is selected using either W1_SKIP_ROM or W1_MATCH_ROM command. | ||
37 | Then provided control buffer is being written to the wire. | ||
38 | 2. reading. This will issue reading eeprom response. | ||
39 | |||
40 | It is possible that between 1. and 2. w1 master thread will reset bus for searching | ||
41 | and slave device will be even removed, but in this case 0xff will | ||
42 | be read, since no device was selected. | ||
32 | 43 | ||
33 | 44 | ||
34 | W1 device families | 45 | W1 device families |
@@ -89,4 +100,5 @@ driver - (standard) symlink to the w1 driver | |||
89 | name - the device name, usually the same as the directory name | 100 | name - the device name, usually the same as the directory name |
90 | w1_slave - (optional) a binary file whose meaning depends on the | 101 | w1_slave - (optional) a binary file whose meaning depends on the |
91 | family driver | 102 | family driver |
92 | 103 | rw - (optional) created for slave devices which do not have | |
104 | appropriate family driver. Allows to read/write binary data. | ||
diff --git a/Documentation/w1/w1.netlink b/Documentation/w1/w1.netlink new file mode 100644 index 000000000000..3640c7c87d45 --- /dev/null +++ b/Documentation/w1/w1.netlink | |||
@@ -0,0 +1,98 @@ | |||
1 | Userspace communication protocol over connector [1]. | ||
2 | |||
3 | |||
4 | Message types. | ||
5 | ============= | ||
6 | |||
7 | There are three types of messages between w1 core and userspace: | ||
8 | 1. Events. They are generated each time new master or slave device found | ||
9 | either due to automatic or requested search. | ||
10 | 2. Userspace commands. Includes read/write and search/alarm search comamnds. | ||
11 | 3. Replies to userspace commands. | ||
12 | |||
13 | |||
14 | Protocol. | ||
15 | ======== | ||
16 | |||
17 | [struct cn_msg] - connector header. It's length field is equal to size of the attached data. | ||
18 | [struct w1_netlink_msg] - w1 netlink header. | ||
19 | __u8 type - message type. | ||
20 | W1_SLAVE_ADD/W1_SLAVE_REMOVE - slave add/remove events. | ||
21 | W1_MASTER_ADD/W1_MASTER_REMOVE - master add/remove events. | ||
22 | W1_MASTER_CMD - userspace command for bus master device (search/alarm search). | ||
23 | W1_SLAVE_CMD - userspace command for slave device (read/write/ search/alarm search | ||
24 | for bus master device where given slave device found). | ||
25 | __u8 res - reserved | ||
26 | __u16 len - size of attached to this header data. | ||
27 | union { | ||
28 | __u8 id; - slave unique device id | ||
29 | struct w1_mst { | ||
30 | __u32 id; - master's id. | ||
31 | __u32 res; - reserved | ||
32 | } mst; | ||
33 | } id; | ||
34 | |||
35 | [strucrt w1_netlink_cmd] - command for gived master or slave device. | ||
36 | __u8 cmd - command opcode. | ||
37 | W1_CMD_READ - read command. | ||
38 | W1_CMD_WRITE - write command. | ||
39 | W1_CMD_SEARCH - search command. | ||
40 | W1_CMD_ALARM_SEARCH - alarm search command. | ||
41 | __u8 res - reserved | ||
42 | __u16 len - length of data for this command. | ||
43 | For read command data must be allocated like for write command. | ||
44 | __u8 data[0] - data for this command. | ||
45 | |||
46 | |||
47 | Each connector message can include one or more w1_netlink_msg with zero of more attached w1_netlink_cmd messages. | ||
48 | |||
49 | For event messages there are no w1_netlink_cmd embedded structures, only connector header | ||
50 | and w1_netlink_msg strucutre with "len" field being zero and filled type (one of event types) | ||
51 | and id - either 8 bytes of slave unique id in host order, or master's id, which is assigned | ||
52 | to bus master device when it is added to w1 core. | ||
53 | |||
54 | Currently replies to userspace commands are only generated for read command request. | ||
55 | One reply is generated exactly for one w1_netlink_cmd read request. | ||
56 | Replies are not combined when sent - i.e. typical reply messages looks like the following: | ||
57 | [cn_msg][w1_netlink_msg][w1_netlink_cmd] | ||
58 | cn_msg.len = sizeof(struct w1_netlink_msg) + sizeof(struct w1_netlink_cmd) + cmd->len; | ||
59 | w1_netlink_msg.len = sizeof(struct w1_netlink_cmd) + cmd->len; | ||
60 | w1_netlink_cmd.len = cmd->len; | ||
61 | |||
62 | |||
63 | Operation steps in w1 core when new command is received. | ||
64 | ======================================================= | ||
65 | |||
66 | When new message (w1_netlink_msg) is received w1 core detects if it is master of slave request, | ||
67 | according to w1_netlink_msg.type field. | ||
68 | Then master or slave device is searched for. | ||
69 | When found, master device (requested or those one on where slave device is found) is locked. | ||
70 | If slave command is requested, then reset/select procedure is started to select given device. | ||
71 | |||
72 | Then all requested in w1_netlink_msg operations are performed one by one. | ||
73 | If command requires reply (like read command) it is sent on command completion. | ||
74 | |||
75 | When all commands (w1_netlink_cmd) are processed muster device is unlocked | ||
76 | and next w1_netlink_msg header processing started. | ||
77 | |||
78 | |||
79 | Connector [1] specific documentation. | ||
80 | ==================================== | ||
81 | |||
82 | Each connector message includes two u32 fields as "address". | ||
83 | w1 uses CN_W1_IDX and CN_W1_VAL defined in include/linux/connector.h header. | ||
84 | Each message also includes sequence and acknowledge numbers. | ||
85 | Sequence number for event messages is appropriate bus master sequence number increased with | ||
86 | each event message sent "through" this master. | ||
87 | Sequence number for userspace requests is set by userspace application. | ||
88 | Sequence number for reply is the same as was in request, and | ||
89 | acknowledge number is set to seq+1. | ||
90 | |||
91 | |||
92 | Additional documantion, source code examples. | ||
93 | ============================================ | ||
94 | |||
95 | 1. Documentation/connector | ||
96 | 2. http://tservice.net.ru/~s0mbre/archive/w1 | ||
97 | This archive includes userspace application w1d.c which | ||
98 | uses read/write/search commands for all master/slave devices found on the bus. | ||