Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp541428img; Thu, 21 Mar 2019 03:54:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKd+GjRMJnu2E72CN4VMNI7Am7KAo4ad9fN86juOn1htkHgA7tPqEZvSuJD6L+NqfBloUj X-Received: by 2002:a63:490f:: with SMTP id w15mr1799638pga.247.1553165650651; Thu, 21 Mar 2019 03:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553165650; cv=none; d=google.com; s=arc-20160816; b=0sWwaaIzX58DUQ+83SrG8hxEXZmJqsG1bA7VACsaSLJLVODKH3EeLF+OoPuOZmI8XK 39ywbvxzXDJd1z7unzmZIVuhPj35dvT8zpMZMDEkTbbsTO6UpepnDTMhcd7PJ6xmCzMT 5PxhMyYva5wfhjrXNNF1rBiwrhszUkYVyMCO1h87pPrwyirPyoNT0MdfirDrClnVOHac 9u1ySYtg5ZWp+H0hwVEqfWSV0V4cvQBlRWQCmn4HasdJLt1vlVMeIF8OBIdRlCVbEBTN BgErYm+PW4pYSbNqH8pPQP1q7e3K7Obh1YrzbZvVslIsg00wSN7TL1ANETFtT5s6X6s8 zoPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:cc:to:from; bh=nmhq62b5Brect71PiK+VCjcwP4o52dC8yVsM7M2A5jU=; b=irE9uDb1RRT7oF0CR4Iix+I7iY3PSTR9Y22vuSa32/h+fTYudygWufEJVIdjplwp9H slkx5c7JjtITm+aBrvPLcyWCOs/HXYjv0DZ7Ur5SyaBJmnA9D83iUj8GmEw2Ysb8FDY0 wuuSvbRHicAmtvAkT50jEOrOYrT9If4OXYmBspPIy9mtXkr0Z8tkkzTEEBU80KT4gMsr heIqbGmXxKhea1oxccCAQkV8ARhPa/33nSxZPJ7qUoI9JaRm4A5RqMUoqiIO/bvsV/b4 GWp9vDWb1/bBi/HWUUvntZARgkowInZJhs67VXH98iYe4QUXJWZdP4WNLc884GLvTneQ Jk9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=REJECT dis=NONE) header.from=skyboo.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cm3si4474942plb.166.2019.03.21.03.53.52; Thu, 21 Mar 2019 03:54:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=REJECT dis=NONE) header.from=skyboo.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727931AbfCUKxD (ORCPT + 99 others); Thu, 21 Mar 2019 06:53:03 -0400 Received: from skyboo.net ([94.40.87.198]:33896 "EHLO skyboo.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727823AbfCUKxD (ORCPT ); Thu, 21 Mar 2019 06:53:03 -0400 Received: from manio by skyboo.net with local (Exim 4.91) (envelope-from ) id 1h6vJj-0005C0-Ma; Thu, 21 Mar 2019 11:53:00 +0100 From: Mariusz Bialonczyk To: linux-kernel@vger.kernel.org, Evgeniy Polyakov , Greg Kroah-Hartman , Jean-Francois Dagenais Cc: Mariusz Bialonczyk Date: Thu, 21 Mar 2019 11:52:55 +0100 Message-Id: <20190321105255.19126-1-manio@skyboo.net> X-Mailer: git-send-email 2.19.0.rc1 In-Reply-To: <20190318092737.8170-1-manio@skyboo.net> References: <20190318092737.8170-1-manio@skyboo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, zbr@ioremap.net, greg@kroah.com, jeff.dagenais@gmail.com, manio@skyboo.net X-SA-Exim-Mail-From: manio@skyboo.net X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on nemesis.skyboo.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_RELAYS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.1 Subject: [PATCH v2] w1: fix the resume command API X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on skyboo.net) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Jean-Francois Dagenais --- 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.0.rc1