From patchwork Mon Aug 15 14:52:10 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: 1666481 X-Patchwork-Delegate: patrick.delaunay73@gmail.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=UMLpyIpy; 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 4M5y1Q4XjMz9s07 for ; Tue, 16 Aug 2022 00:52:26 +1000 (AEST) Received: by legolas.ozlabs.org (Postfix) id 4M5y1Q02Tlz1ygN; Tue, 16 Aug 2022 00:52:26 +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=UMLpyIpy; 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4M5y1P2mdZz1yf9 for ; Tue, 16 Aug 2022 00:52:25 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4301184867; Mon, 15 Aug 2022 16:52:20 +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="UMLpyIpy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3AAB2849A5; Mon, 15 Aug 2022 16:52:18 +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=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (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 D882C8459D for ; Mon, 15 Aug 2022 16:52:15 +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-x42e.google.com with SMTP id n4so9314481wrp.10 for ; Mon, 15 Aug 2022 07:52:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=Zzw0tD28lKrfnnhC+ucdnirdxcYSjaljiNw88J/r6bU=; b=UMLpyIpyUDybuYEvC9FJhrDVyfr7gjc7PRzlJvOGcjEC3w/3dIxanyi/ggeyaaqDwW vWZfwnmU+xrLPtLuT3k7y+VFfl0iIu5dhfyH61xO6R8ZEzq7F1J3Egr82YtTN6F52bs5 R4kOR7J5yfBA1Yec1WMLz0JeAkurl/Vr7VizZ7JUxwETaHalXuQH377hiCf6He+di1o6 vWQ4zpQGFpqjwpOGH1rCiLEotjyPsjlGxvef20LB4nCplZZIKqcf2QxlVMQg0hIrFWuj 22laDMMOXmsx/YWGzuOcFUhCq9kXVP2kY4YwRWf1DPWzOUqqCJDtm9IITvESUXwjjjX+ NoJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=Zzw0tD28lKrfnnhC+ucdnirdxcYSjaljiNw88J/r6bU=; b=4f5Kyrj8SRo2qmXD62nM9GEeFeBGE2PSahkYt6dCLvSaP+ytQx2tmgsw7oqQRDNCVR hEDcv3r77xcmbEh4kFOiozA17VR8sTyXOEAG8Pzs5bs5PKEhIu7fAKq0BI8D8tN3f8OL FOqHLXBcXNVL4McDE8gDD0eIzU9DKxGU7wMWa1dBF06m67b+QkzM+3O3wz0ip0XBo5rp j1jRknlyuV6Q9RoEx3h119BMS0VaL0ZXO4Tsr4InbaVV6hLmiugJP/3fHc0lClQBx+JM FyTeTNAUD+n1jXiw7/zw7TOkovFou6QMDhM/kwdaja0ogLvVV3ceklYCPlIJcNkwsfzZ ubXg== X-Gm-Message-State: ACgBeo2qwckH2xSYm6EVcXw8R7IyupoiMAkm9P6g8E3xIHkUL0hTtjzh QAtschhuzXgwewJij6ZXf+LsBw== X-Google-Smtp-Source: AA6agR7wgtB6kl9T7DPiY1Wa1KP5zEELO9bN5fIkIsCyorqMJpM5J7QAJ4JosVE0uxJaW2iNOhBGmg== X-Received: by 2002:a5d:6a06:0:b0:224:f83a:b30f with SMTP id m6-20020a5d6a06000000b00224f83ab30fmr4666551wru.282.1660575135323; Mon, 15 Aug 2022 07:52:15 -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 g6-20020a5d4886000000b0021e9fafa601sm7502114wrq.22.2022.08.15.07.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:52:14 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge@foundries.io, hs@denx.de, patrick.delaunay@foss.st.com, patrice.chotard@foss.st.com, oleksandr.suvorov@foundries.io Cc: uboot-stm32@st-md-mailman.stormreply.com, u-boot@lists.denx.de Subject: [PATCHv2 1/2] i2c: stm32f7: fix clearing the control register Date: Mon, 15 Aug 2022 16:52:10 +0200 Message-Id: <20220815145211.31342-1-jorge@foundries.io> X-Mailer: git-send-email 2.34.1 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 Bits should be set to 0, not 1. Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Patrice Chotard Reviewed-by: Patrick Delaunay --- drivers/i2c/stm32f7_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index bf2a6c9b4b..3a727e68ac 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -413,7 +413,7 @@ static int stm32_i2c_check_end_of_message(struct stm32_i2c_priv *i2c_priv) setbits_le32(®s->icr, STM32_I2C_ICR_STOPCF); /* Clear control register 2 */ - setbits_le32(®s->cr2, STM32_I2C_CR2_RESET_MASK); + clrbits_le32(®s->cr2, STM32_I2C_CR2_RESET_MASK); } return ret; From patchwork Mon Aug 15 14:52:11 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: 1666482 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=Lm6qjlSD; dkim-atps=neutral Received: from legolas.ozlabs.org (legolas.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee2:8c49]) (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 4M5y1c6rxDz9s07 for ; Tue, 16 Aug 2022 00:52:36 +1000 (AEST) Received: by legolas.ozlabs.org (Postfix) id 4M5y1c2Kydz1ygN; Tue, 16 Aug 2022 00:52:36 +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=Lm6qjlSD; 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)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4M5y1b5Gwdz1yf9 for ; Tue, 16 Aug 2022 00:52:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 48FD984965; Mon, 15 Aug 2022 16:52:25 +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="Lm6qjlSD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D0AD48459D; Mon, 15 Aug 2022 16:52:22 +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-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (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 D3B2D84965 for ; Mon, 15 Aug 2022 16:52:16 +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-x430.google.com with SMTP id e27so4635465wra.11 for ; Mon, 15 Aug 2022 07:52:16 -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=vQ6O8+7cXkxjpGaa2UKlRXQwGR4xK1zKxtcGOYvx+tY=; b=Lm6qjlSDeeday8vFVLmM9yQj4TKFPjoZX/ds8lNYiMFURRjuBqZvStYJ1DmLp/PCcx fq1ehT2/eTQSlmKstw8Ft0wmFUXqpLztqmbOH4Rpxn6b1Mi/KHzAoUJS0UgJ3CrDxNds HdBZ+Z7+YOxRR0NKGeucjQOMc7DlZMq6oeCS/bGk1O+NjePZtvav2KWW3GAcIXjctBzo sYxjSivja2b0VU43kZ2i1Bci95CXWN0+2uZjaURrgD29K/vEbTNRFMktF7JhMUgv9wHv 7u5dwCUkIty/weDhRMgHTw2XHMVblfvo6auI+1wHZwg8yfDZ8phH1J/IMpVIAMrN19BJ U4pw== 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=vQ6O8+7cXkxjpGaa2UKlRXQwGR4xK1zKxtcGOYvx+tY=; b=eYvg7qBuJlR7BuRG7dzM/ii6q2LQPmkOppXctDulPxqGQjGu+QfUgtvw38PV4Vx5xs mVkrGdNO0ltPTRcgiV0eqfM31uU576Ax5kSUEYLtv8lBeqKWgE/sixnnL8he0amOqlBA E7c6gg2y8fM40KmdoUNMfmWlNIjLQ8D2KAQY9XoNvckIzc0RobSU5bWGt9pA96ZcI+Gu mAg6H8AwAd1C5WkstS94P1V6NYIXyROmbCUBFPGNS5t5lA8ari41UaK1s6WV+PC3O+Gy ku5x7kyW20BhGPrBW7uzsFsSk8brqh6NAc98Pf0opc0zJ5c7juEacpx5c2mL2CYUM59J e8EQ== X-Gm-Message-State: ACgBeo3PN10tz5HCYrwYOlOqoWpisMEfaKP/KFWX9YRJ4PkpjYyaafdU gZDKPKmHTsp7kVtx3UEkX9/H3Q== X-Google-Smtp-Source: AA6agR7OIHVOSCdFtktRWa9KjLAjNlH4k3RFI7nVa3QzLNMKEyAsy/kU7G6zmwTs+Ru189lHcWllAw== X-Received: by 2002:a05:6000:184a:b0:222:cdc3:257c with SMTP id c10-20020a056000184a00b00222cdc3257cmr8817858wri.604.1660575136360; Mon, 15 Aug 2022 07:52:16 -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 g6-20020a5d4886000000b0021e9fafa601sm7502114wrq.22.2022.08.15.07.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:52:15 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge@foundries.io, hs@denx.de, patrick.delaunay@foss.st.com, patrice.chotard@foss.st.com, oleksandr.suvorov@foundries.io Cc: uboot-stm32@st-md-mailman.stormreply.com, u-boot@lists.denx.de Subject: [PATCHv2 2/2] i2c: stm32f7: do not set the STOP condition on error Date: Mon, 15 Aug 2022 16:52:11 +0200 Message-Id: <20220815145211.31342-2-jorge@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220815145211.31342-1-jorge@foundries.io> References: <20220815145211.31342-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 transfer complete has been found to lock the bus (BUSY) when NACKF is raised. Tested accessing the NXP SE05X I2C device. https://www.nxp.com/docs/en/application-note/AN12399.pdf 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); }