Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D816AC00140 for ; Mon, 15 Aug 2022 11:19:28 +0000 (UTC) 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) 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 Content-Transfer-Encoding: 8bit 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 --- 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); } -- 2.34.1