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 3DAF7C7619A for ; Mon, 27 Mar 2023 11:32:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1C19E85E45; Mon, 27 Mar 2023 13:32:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZAkYPnI6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 41FBB86098; Mon, 27 Mar 2023 13:32:29 +0200 (CEST) Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) (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 7BBD485E45 for ; Mon, 27 Mar 2023 13:32:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=al.kochet@gmail.com Received: by mail-lj1-x22b.google.com with SMTP id x20so8605023ljq.9 for ; Mon, 27 Mar 2023 04:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679916746; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=q2jREwUUcybRgNtYvCRtcXkOTdSLcY5ffVnmDJ1/uwY=; b=ZAkYPnI6iVRBzyF+S/6LZBchZx3kJpoXhtxvcG3wJWrk1aH/QkCrTkHuw+szIJgLk7 WlORdKGC29loyQC+x86yRD4BEbv6kCme2qp9RZwC1rw2yj4GapG83LuB4SWpP3taULLW oP9nKrUDOvn3TDGIyWh7wTOIFY+XUS/lkg3Hh38hp1BdHRWBxnPzl6S/kepGoYCQH/mJ qcfsFQcR4kySDHGckscCqSWkKTATC12buffWscq3mp1/h2gaVvKCspi036qm5u6DYlaI gKjv3DpqljN0hVKoLj+1QIGU3LAItNrYryewJz3RdOlbm9j7H791fxLb3MMsj6+qilBH xTBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679916746; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=q2jREwUUcybRgNtYvCRtcXkOTdSLcY5ffVnmDJ1/uwY=; b=ZFTdqKffcA/0jaZlDZ7YjvB5zLdefy8QtxRsXSufl28/DXVIkq4Qnonrai+iAgNPUv Oh6oghd4LDMcONK2oCDejB4x45OxyuEzrS5q+ySJDN1kRl8fDRhFRpnZ2ykr2pnputXX L8GfQADsWAYU1McMLxwWSN0klViXZSQWiD5IwWwbXcuu+Eoumi5y+H2vbdTPhkTKBfd9 +/r2qImSN1BSEWra1JQqYeG97K7Pqo8hSxG9y9CyOqy8SiQtcJ4OfIgv+1CdE+mrXO+s LreTTZmgOgYH9d7sVUXjz8bixgwyrMpxaxnrxvvLZ/APIVwjqXy9nADBhbGwRohkP0jO hAQw== X-Gm-Message-State: AAQBX9dZP/E5m2KKu2wv+Cr4C1WORhVqXmr8zvrjuDSOvGWqb4Dfl/Qu ntnMCp+x7N/hMxL0dXRPDxw= X-Google-Smtp-Source: AKy350aCOya7bR9C6G/IN4SACNnlZKTQtPU90/yY50FNtGoc3Aizy7WwFQ+8i+peO6ZfaibBJlM0pg== X-Received: by 2002:a2e:9005:0:b0:294:697a:d6af with SMTP id h5-20020a2e9005000000b00294697ad6afmr3535986ljg.39.1679916745587; Mon, 27 Mar 2023 04:32:25 -0700 (PDT) Received: from smtpclient.apple ([80.87.144.137]) by smtp.gmail.com with ESMTPSA id 2-20020a05651c008200b00295b59fba40sm4587757ljq.25.2023.03.27.04.32.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Mar 2023 04:32:25 -0700 (PDT) From: Alexander Kochetkov Message-Id: <90927F42-4BAE-41F4-B331-4E57F31B8738@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: [PATCH v3] i2c: correct I2C deblock logic Date: Mon, 27 Mar 2023 14:32:13 +0300 In-Reply-To: <20230327112143.4029840-1-haibo.chen@nxp.com> Cc: hs@denx.de, patrick.delaunay@foss.st.com, u-boot@lists.denx.de, uboot-imx@nxp.com To: Bough Chen References: <20230327112143.4029840-1-haibo.chen@nxp.com> X-Mailer: Apple Mail (2.3731.400.51.1.1) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Hello Haibo Chen. The patch looks fine! Reviewed-by: Alexander Kochetkov > > 27 =D0=BC=D0=B0=D1=80=D1=82=D0=B0 2023 =D0=B3., =D0=B2 14:21, = haibo.chen@nxp.com =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0): >=20 > From: Haibo Chen >=20 > Current code use dm_gpio_get_value() to get SDA and SCL value, and the > value depends on whether DTS file config the GPIO_ACTIVE_LOW. In = ususal > case for i2c GPIO, DTS need to set GPIO_ACTIVE_LOW for SCL/SDA pins. = So > here the logic is not correct. >=20 > And we must not use GPIOD_ACTIVE_LOW in client code include the > dm_gpio_set_dir_flags(), it is DTS's responsibility for this flag. So > remove GPIOD_ACTIVE_LOW here. >=20 > Fixes: aa54192d4a87 ("dm: i2c: implement gpio-based I2C deblock") > Signed-off-by: Haibo Chen > --- > drivers/i2c/i2c-uclass.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c > index 8d9a89ed89..8867a560bd 100644 > --- a/drivers/i2c/i2c-uclass.c > +++ b/drivers/i2c/i2c-uclass.c > @@ -508,13 +508,13 @@ static void i2c_gpio_set_pin(struct gpio_desc = *pin, int bit) > dm_gpio_set_dir_flags(pin, GPIOD_IS_IN); > else > dm_gpio_set_dir_flags(pin, GPIOD_IS_OUT | > - GPIOD_ACTIVE_LOW | > GPIOD_IS_OUT_ACTIVE); > } >=20 > static int i2c_gpio_get_pin(struct gpio_desc *pin) > { > - return dm_gpio_get_value(pin); > + /* DTS need config GPIO_ACTIVE_LOW */ > + return !dm_gpio_get_value(pin); > } >=20 > int i2c_deblock_gpio_loop(struct gpio_desc *sda_pin, > --=20 > 2.34.1 >=20