From patchwork Mon Aug 15 11:19:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jorge Ramirez-Ortiz, Foundries" X-Patchwork-Id: 1666422 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=fhNLfI95; dkim-atps=neutral Received: from legolas.ozlabs.org (legolas.ozlabs.org [150.107.73.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M5sHq0zfcz9s07 for ; Mon, 15 Aug 2022 21:19:35 +1000 (AEST) Received: by legolas.ozlabs.org (Postfix) id 4M5sHp3c7sz1ygN; Mon, 15 Aug 2022 21:19:34 +1000 (AEST) Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=fhNLfI95; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4M5sHn6YJHz1yfq for ; Mon, 15 Aug 2022 21:19:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 24338848A1; Mon, 15 Aug 2022 13:19:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.b="fhNLfI95"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0FC0D845F3; Mon, 15 Aug 2022 13:19:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 486F7848A1 for ; Mon, 15 Aug 2022 13:19:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jorge@foundries.io Received: by mail-wr1-x435.google.com with SMTP id h13so8707647wrf.6 for ; Mon, 15 Aug 2022 04:19:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=q9U2TW0e/frdyYfbR2WnwVv2Dl/KqCNwmzRTIzSwHcc=; b=fhNLfI95VJ4hXHUbdz+02CffloFuJijcnDILziP9K2PCfQ1FbhlxXGELYVFOfF/GJ3 sCtIxNW4HxNxJ/0NTpUGNEM/DEzlaWHLwFEEkA96BjksdMpLAgfPGTeQwmY52HCISc0E swmyWJdInt9XgVKKGGUo3aJEH6CvbllN00YmdHB5rHYQF23e4JDDSs80/cumFLLb8t7n Sk9Q4SzopYjqKQKMsQCrkTjCi4O1AylYk3BejxdNPv8PnScKZ79nJSFfpxRqn5g95MjP MRXDOVgQX1CHvYFypgETQfil5c0TImsRHSDeYwGAbkwjU7c4m/oK72RgcR75DdBtQjgH d6eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=q9U2TW0e/frdyYfbR2WnwVv2Dl/KqCNwmzRTIzSwHcc=; b=XbFn4iT9FiMn6SRknTPnfv6v8aW+9TndTfS0xaFTCLsET65CYYl8aWsJ7dOUDJQ50d vFidYc+R6lbK49KxVopbahhqQjIkyuR8tBTrIA1ZwdlIRUnjlBuyQLaId+gAoj+0X+Dq 82B6Qos7rtXTg2ezJZzcgIhyJCbO1njKNrwppw2unsEhDpWqzVSYrXg8Axj1Lrv3mbXu bkgAGskCBI+X+1O5MVnIRMNFMNkhjYbyJmX+n5eMPnPcGxQ+2U60lbSQfDaxqVr9kPAS 4MaDHQILCr/ZxPFjBBPzEQkSlBONs84NEvPkYNKLEPRcQzG31G4ygGfImdGlWoOZeHMP EKMw== X-Gm-Message-State: ACgBeo02zY4oiWZ1lN/hcb+uaaYxXHZ/FPAjo4CmRCMcs4Pawa+MabWC 9laa/H0M09yXc4SI3staDkne2w== X-Google-Smtp-Source: AA6agR6LFhQYzjGTUbuG25Kv3Nad60tNau8NWHKD6iiDdgHBfJR2Rop0ULj2yZhio8fUgpkDOLm9dQ== X-Received: by 2002:a05:6000:4083:b0:21f:fb6:9293 with SMTP id da3-20020a056000408300b0021f0fb69293mr8316496wrb.303.1660562350757; Mon, 15 Aug 2022 04:19:10 -0700 (PDT) Received: from localhost.localdomain (78.red-83-60-92.dynamicip.rima-tde.net. [83.60.92.78]) by smtp.gmail.com with ESMTPSA id p15-20020adf9d8f000000b00223654e0eccsm9100656wre.9.2022.08.15.04.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 04:19:10 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge@foundries.io, hs@denx.de, patrick.delaunay@foss.st.com, patrice.chotard@foss.st.com Cc: uboot-stm32@st-md-mailman.stormreply.com, u-boot@lists.denx.de Subject: [PATCH 2/2] i2c: stm32f7: do not set the STOP condition on error Date: Mon, 15 Aug 2022 13:19:05 +0200 Message-Id: <20220815111905.4090289-2-jorge@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220815111905.4090289-1-jorge@foundries.io> References: <20220815111905.4090289-1-jorge@foundries.io> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Sending the stop condition without waiting for TC has been found to lock the bus. Tested accessing the the NXP SE05X I2C device. Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Oleksandr Suvorov --- drivers/i2c/stm32f7_i2c.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index 3a727e68ac..14827e5cec 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -485,9 +485,11 @@ static int stm32_i2c_message_xfer(struct stm32_i2c_priv *i2c_priv, } } - /* End of transfer, send stop condition */ - mask = STM32_I2C_CR2_STOP; - setbits_le32(®s->cr2, mask); + if (!ret) { + /* End of transfer, send stop condition */ + mask = STM32_I2C_CR2_STOP; + setbits_le32(®s->cr2, mask); + } return stm32_i2c_check_end_of_message(i2c_priv); }