Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp256193ybi; Wed, 29 May 2019 20:46:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxniWZkwgwwNYdgUEBfvGR0NizJqDta4tzXnDE5oN4Im2Gv1o8+wnKFVvwFCuWYUdr1jzx+ X-Received: by 2002:a17:902:24d:: with SMTP id 71mr1802121plc.166.1559188000027; Wed, 29 May 2019 20:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559188000; cv=none; d=google.com; s=arc-20160816; b=UJHWYIqKfFQGncH2YOsfOIi7NAmN7F9wFIHM2RAbbXTj0SSuEUTF5QAycAsyw9WC7H ADeAhQ7MutWH0GxdZD0FChDNMrT2ZioIIQFCh/U4ZLdM5mz3M7mLFIg7qHVHCaAbP/vb jrSeVe3AEWuruHXDlKNXhQDKVSmG58OivowCTL/MbZ9wwXxcjjnX9LQnrReRDl9FFjxv Gc6206bGZ9oOrw1j52RTu/YjAlts2qInjE3wQ/4XObFEgmLYoA/bNMPGyr74DSC+GU3l DXmqy0cE8Bz3KsaUOpy8aGwY2Ru69xx8kY+Zggx2LtsWKOgjXSzACNPjt0oYfp1FUB30 k0yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lMi4Qy92FjU8H04iDd8q3GJdp4dwuyLDq4tT0F4jqgk=; b=REFq53fbExEPL6QbIQaT8xUKa4xF1lV4bo3ouG9o/oS8CnNRJvpW2Pm88jcCOrSRfj KGhDo4HT95v7Hf7sc0Y7dc9WRDpDiK6YcLU4HNEJWiG4rcqgJEZ81Bdil6BlzLiYZ/D9 Zu+SLBu/hPBuH4xzWESFb76+xdpmSOLnFUPuzb39B62S+pH3M+ywEwwAf3GUnjTS2rAi ra+ZAetMbC6EP6/pIaR0N6QiQ0Zxi9XKGxTcQ19Q2HEcu5E8BOckz4iii9sY/lUqI0vs wEsmivF2LEeNKv7dsd0mYhvDvsaLcB1UE2f+x7zujC+vj416/+fOHm14XtBWSB4/mCXO 7JSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IivxnyFW; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bo10si1621038pjb.59.2019.05.29.20.46.23; Wed, 29 May 2019 20:46:40 -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; dkim=pass header.i=@kernel.org header.s=default header.b=IivxnyFW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732822AbfE3DoJ (ORCPT + 99 others); Wed, 29 May 2019 23:44:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:60756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732399AbfE3DU7 (ORCPT ); Wed, 29 May 2019 23:20:59 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 076D2249A3; Thu, 30 May 2019 03:20:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186459; bh=HkH4ufft1e+AwPuafmpxUftWAu+HKVxTA7Pt6dpLcFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IivxnyFWr3jCXPf3+7IEiNIu3CACVBOvr9F1n2lfcwzSIgWLpIxxxEsiyhw2Yhdxs Hy1G5UKV716GJA+Mx3ZGDPT2eWeoK8bvbdnScHPYi6j21RE/IdgdFuZi7TaBvC9316 DI5B8xPiB5LHILQuLVhBhxXEk0G+iEJ7bhpDm+9A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mariusz Bialonczyk , Jean-Francois Dagenais , Sasha Levin Subject: [PATCH 4.9 039/128] w1: fix the resume command API Date: Wed, 29 May 2019 20:06:11 -0700 Message-Id: <20190530030441.183162785@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030432.977908967@linuxfoundation.org> References: <20190530030432.977908967@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 62909da8aca048ecf9fbd7e484e5100608f40a63 ] >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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 f4bc8c100a01b..a3ac582420ec4 100644 --- a/drivers/w1/w1_io.c +++ b/drivers/w1/w1_io.c @@ -437,8 +437,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.20.1