From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7680DC282DD for ; Wed, 22 May 2019 19:40:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42A9E20862 for ; Wed, 22 May 2019 19:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558554008; bh=x6bQV7iNWo3xutZM9ZnlhS0sVGxlqe649MMkWi5oFbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nHf6qd9yHUwAwyh2LkW89ovijvVYSA1qoCWMRrDL2x5FXpJXg3VkBpEhFqJe9PptR B3Hb5ijnZq/Xt2mf72xHlN6oSWJFTlp1s+9GAtCNWnYW4S4kbrOQq/ElVs9tEtIwNk Ii0Jy8hOn0UpHy2gwRfDGEnxAVb+jaD1e7DXkhBg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732926AbfEVT3d (ORCPT ); Wed, 22 May 2019 15:29:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:52648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732915AbfEVT3c (ORCPT ); Wed, 22 May 2019 15:29:32 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A87A3217F9; Wed, 22 May 2019 19:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558553372; bh=x6bQV7iNWo3xutZM9ZnlhS0sVGxlqe649MMkWi5oFbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eJ4hfXWnVFTPiHat32cciseenoHZaPM+dupv2Nr0SICo7s1RBf1LR3q2MiPV9Y1vS ErVkiKpEJUj1S5vUpcMdl1eqCr6qDEiAXbOf2t7C7z+xeiNeuol2faDzsinMsn0gbQ 2OMcKvTfGg4EgfGHx0ZM/0wpLw4czVixL4mhd/ko= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mariusz Bialonczyk , Jean-Francois Dagenais , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL 4.14 032/167] w1: fix the resume command API Date: Wed, 22 May 2019 15:26:27 -0400 Message-Id: <20190522192842.25858-32-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190522192842.25858-1-sashal@kernel.org> References: <20190522192842.25858-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mariusz Bialonczyk [ 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 d191e1f805799..661551c4ffa25 100644 --- a/drivers/w1/w1_io.c +++ b/drivers/w1/w1_io.c @@ -430,8 +430,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