From patchwork Tue Sep 1 15:09:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 310317 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=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 0013BC433E7 for ; Tue, 1 Sep 2020 16:34:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6E4F208CA for ; Tue, 1 Sep 2020 16:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598978073; bh=8o1ia7Fk7UU6QLPzZBMU8sFpEz/+iYGN44b6+wNdW9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=yba8x99NuURYwB8p8IGNv+OExj0LCkI/rVxoizjcbBfAteUyZL1zJWjDxqTtMW9f6 CZqeswLvBCWMZr5NYIdZlG0llQN6qhcuU6qxd4Ujnda4GXLXDeyBkdUUCHeTDKfNbM EMj45bs7DimJ5rYpSTJytsRqRRwY8vGwhRR/ZQcY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730687AbgIAQeb (ORCPT ); Tue, 1 Sep 2020 12:34:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:33810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730479AbgIAPbI (ORCPT ); Tue, 1 Sep 2020 11:31:08 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 8033020866; Tue, 1 Sep 2020 15:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974268; bh=8o1ia7Fk7UU6QLPzZBMU8sFpEz/+iYGN44b6+wNdW9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BvO4/qB+oEVeoXcHRtPy+hyluIkvKsQzSqkGFz4MEehKTjq9TITH88l7aofY+1obF JnaSzdl5YzK65SGdIzDNIw39CxFWpQvsFcjkycBOOiOQcgqjEMSm0pILYfDC5dYk2T FcJ8v2b34ckeJPX+jIq7yFQA42ceayNTaYa7u+Os= 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 5.4 111/214] i2c: rcar: in slave mode, clear NACK earlier Date: Tue, 1 Sep 2020 17:09:51 +0200 Message-Id: <20200901150958.301557647@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150952.963606936@linuxfoundation.org> References: <20200901150952.963606936@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Wolfram Sang [ Upstream commit 914a7b3563b8fb92f976619bbd0fa3a4a708baae ] Currently, a NACK in slave mode is set/cleared when SCL is held low by the IP core right before the bit is about to be pushed out. This is too late for clearing and then a NACK from the previous byte is still used for the current one. Now, let's clear the NACK right after we detected the STOP condition following the NACK. 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 0b90aa0318df3..9c162a01a5849 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -587,6 +587,7 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv) /* master sent stop */ if (ssr_filtered & SSR) { i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value); + rcar_i2c_write(priv, ICSCR, SIE | SDBS); /* clear our NACK */ rcar_i2c_write(priv, ICSIER, SAR); rcar_i2c_write(priv, ICSSR, ~SSR & 0xff); }