mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			50 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From afb1d05657278c16cca2a9fa96ef9a6c7170d07d Mon Sep 17 00:00:00 2001
 | |
| From: Mariusz Bialonczyk <manio@skyboo.net>
 | |
| Date: Thu, 21 Mar 2019 11:52:55 +0100
 | |
| Subject: [PATCH 501/515] w1: fix the resume command API
 | |
| 
 | |
| commit 62909da8aca048ecf9fbd7e484e5100608f40a63 upstream.
 | |
| 
 | |
| >From the DS2408 datasheet [1]:
 | |
| "Resume Command function checks the status of the RC flag and, if it is set,
 | |
|  directly transfers control to the control functions, similar to a Skip ROM
 | |
|  command. The only way to set the RC flag is through successfully executing
 | |
|  the Match ROM, Search ROM, Conditional Search ROM, or Overdrive-Match ROM
 | |
|  command"
 | |
| 
 | |
| The function currently works perfectly fine in a multidrop bus, but when we
 | |
| have only a single slave connected, then only a Skip ROM is used and Match
 | |
| ROM is not called at all. This is leading to problems e.g. with single one
 | |
| DS2408 connected, as the Resume Command is not working properly and the
 | |
| device is responding with failing results after the Resume Command.
 | |
| 
 | |
| This commit is fixing this by using a Skip ROM instead in those cases.
 | |
| The bandwidth / performance advantage is exactly the same.
 | |
| 
 | |
| Refs:
 | |
| [1] https://datasheets.maximintegrated.com/en/ds/DS2408.pdf
 | |
| 
 | |
| Signed-off-by: Mariusz Bialonczyk <manio@skyboo.net>
 | |
| Reviewed-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
 | |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 | |
| ---
 | |
|  drivers/w1/w1_io.c | 3 +--
 | |
|  1 file changed, 1 insertion(+), 2 deletions(-)
 | |
| 
 | |
| diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c
 | |
| index 0364d3329c52..3516ce6718d9 100644
 | |
| --- a/drivers/w1/w1_io.c
 | |
| +++ b/drivers/w1/w1_io.c
 | |
| @@ -432,8 +432,7 @@ int w1_reset_resume_command(struct w1_master *dev)
 | |
|  	if (w1_reset_bus(dev))
 | |
|  		return -1;
 | |
|  
 | |
| -	/* This will make only the last matched slave perform a skip ROM. */
 | |
| -	w1_write_8(dev, W1_RESUME_CMD);
 | |
| +	w1_write_8(dev, dev->slave_count > 1 ? W1_RESUME_CMD : W1_SKIP_ROM);
 | |
|  	return 0;
 | |
|  }
 | |
|  EXPORT_SYMBOL_GPL(w1_reset_resume_command);
 | |
| -- 
 | |
| 2.19.1
 | |
| 
 |