Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4868655pjb; Mon, 27 Jul 2020 07:13:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy08xo4OQbTEZJ6gg8UCt08YBb2wN/Fr+gM3dD2cHCUrfYTbci6GAzz3qrtTpQJGr+ORI/W X-Received: by 2002:a17:906:1db1:: with SMTP id u17mr20615441ejh.72.1595859217119; Mon, 27 Jul 2020 07:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595859217; cv=none; d=google.com; s=arc-20160816; b=uGVU2uYpVgl2aWmlYsbmc9T/JGU5/0vnaun9S81+QTfwMzL+MVRneYWPJhjNRVt9K6 y5Cwiil8+qgB5gqwzZisb9+oMBcbQeq0k/UQ+CzzaTRMZFD+y9FhuNDd4sexBSQzLiwi dDMS+1ovvmf4ZuYgOTNk2s3gBvk1S7vXW6yByoNB4LThKAW+QIbvp5l1l/wXO2nlq9Ry hULgaH7Xmh3tc7CUxMmta1Yjvhs6Yg8G17Z8uFQ+y4xHw3JjcPthHCmL5GsP7I+/KKy+ FaRa5X/DQqJOA/eG3FtE/m/zZvEEenVk6LUbZZGKosAqWDiiWWc7yJbqKHuOkJh+yY2x YAlg== 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=jtgABAtYQkHdkw5wnv+Q4mwghCgL46frBoZvIFItwCw=; b=xNdC5gN8o+9m6Mc9w8Y65HJ29f7DpbJyhVUJsUcGZfPaVMgFSBg1sZoGQYdZeru58t W76aO3X+NMPMbF0GcGrE1SJoQ3Yxaq7IFP/+4qgAP1SZ3sqrQ2W0QKyCN56v5CM3LpI6 vjRJmao4XKuV5Ph/lPqzph2KAYEp3FsBMTUezpU2Ppjhp4QrpD772jsX4LDraH48OHGW qb/1ybtPvJKLXG7JTvCRZ9jnjJ7UZ1uJHzbmlBcVCsr5CnAOY5zAotpxh5u7QyKd3e9C nHV2At9yl16YBLt6nZ8wJoxyXvrldcKkXzWl4hqME2yOodYO/eHNm6J0YOAtE38UQh7Q 5Ciw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oJYNlBhT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q11si6073867edh.154.2020.07.27.07.13.14; Mon, 27 Jul 2020 07:13:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oJYNlBhT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730084AbgG0OLv (ORCPT + 99 others); Mon, 27 Jul 2020 10:11:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:35646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729274AbgG0OLs (ORCPT ); Mon, 27 Jul 2020 10:11:48 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 9010220838; Mon, 27 Jul 2020 14:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859108; bh=qmXlgezNpQKuP8n/7StkfuYTAZhuauIEOMDNJw9/43o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oJYNlBhT27NT825dVO9wD5dNFXJL2zyuKsD7YN7I93bG7ld5gLFES/0LV8bw9yDHz mUPXOmVMNKd4teqQfhDSzV69SkpzLkJ0+O26FRNbpgF7tU4nPjYOWGZRdT2Lzlp65t OVHVC9zOeKvPOwMV6OJwhi/K85Sqbw6ObEqHDjYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , Wolfram Sang , Sasha Levin Subject: [PATCH 4.19 38/86] i2c: rcar: always clear ICSAR to avoid side effects Date: Mon, 27 Jul 2020 16:04:12 +0200 Message-Id: <20200727134916.341859287@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134914.312934924@linuxfoundation.org> References: <20200727134914.312934924@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 From: Wolfram Sang [ Upstream commit eb01597158ffb1853a7a7fc2c57d4c844640f75e ] On R-Car Gen2, we get a timeout when reading from the address set in ICSAR, even though the slave interface is disabled. Clearing it fixes this situation. Note that Gen3 is not affected. To reproduce: bind and undbind an I2C slave on some bus, run 'i2cdetect' on that bus. Fixes: de20d1857dd6 ("i2c: rcar: add slave support") Signed-off-by: Wolfram Sang Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-rcar.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 2c29f901d3090..6e49e438ef5a5 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -863,6 +863,7 @@ static int rcar_unreg_slave(struct i2c_client *slave) /* disable irqs and ensure none is running before clearing ptr */ rcar_i2c_write(priv, ICSIER, 0); rcar_i2c_write(priv, ICSCR, 0); + rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */ synchronize_irq(priv->irq); priv->slave = NULL; @@ -966,6 +967,8 @@ static int rcar_i2c_probe(struct platform_device *pdev) if (ret < 0) goto out_pm_put; + rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */ + if (priv->devtype == I2C_RCAR_GEN3) { priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); if (!IS_ERR(priv->rstc)) { -- 2.25.1