]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.181/w1-fix-the-resume-command-api.patch
Linux 4.9.181
[thirdparty/kernel/stable-queue.git] / releases / 4.4.181 / w1-fix-the-resume-command-api.patch
1 From afd945d03251787e8d3b97d8ae4f90f484ad6ffc Mon Sep 17 00:00:00 2001
2 From: Mariusz Bialonczyk <manio@skyboo.net>
3 Date: Thu, 21 Mar 2019 11:52:55 +0100
4 Subject: w1: fix the resume command API
5
6 [ Upstream commit 62909da8aca048ecf9fbd7e484e5100608f40a63 ]
7
8 >From the DS2408 datasheet [1]:
9 "Resume Command function checks the status of the RC flag and, if it is set,
10 directly transfers control to the control functions, similar to a Skip ROM
11 command. The only way to set the RC flag is through successfully executing
12 the Match ROM, Search ROM, Conditional Search ROM, or Overdrive-Match ROM
13 command"
14
15 The function currently works perfectly fine in a multidrop bus, but when we
16 have only a single slave connected, then only a Skip ROM is used and Match
17 ROM is not called at all. This is leading to problems e.g. with single one
18 DS2408 connected, as the Resume Command is not working properly and the
19 device is responding with failing results after the Resume Command.
20
21 This commit is fixing this by using a Skip ROM instead in those cases.
22 The bandwidth / performance advantage is exactly the same.
23
24 Refs:
25 [1] https://datasheets.maximintegrated.com/en/ds/DS2408.pdf
26
27 Signed-off-by: Mariusz Bialonczyk <manio@skyboo.net>
28 Reviewed-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30 Signed-off-by: Sasha Levin <sashal@kernel.org>
31 ---
32 drivers/w1/w1_io.c | 3 +--
33 1 file changed, 1 insertion(+), 2 deletions(-)
34
35 diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
36 index 282092421cc9e..1a9d9ec8db4df 100644
37 --- a/drivers/w1/w1_io.c
38 +++ b/drivers/w1/w1_io.c
39 @@ -437,8 +437,7 @@ int w1_reset_resume_command(struct w1_master *dev)
40 if (w1_reset_bus(dev))
41 return -1;
42
43 - /* This will make only the last matched slave perform a skip ROM. */
44 - w1_write_8(dev, W1_RESUME_CMD);
45 + w1_write_8(dev, dev->slave_count > 1 ? W1_RESUME_CMD : W1_SKIP_ROM);
46 return 0;
47 }
48 EXPORT_SYMBOL_GPL(w1_reset_resume_command);
49 --
50 2.20.1
51