From patchwork Tue Jul 25 23:13:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 1812919 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org 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=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=HXEim5Jw; 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 4R9XsM6nqwz1yY5 for ; Wed, 26 Jul 2023 09:13:59 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7469386768; Wed, 26 Jul 2023 01:13:45 +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="HXEim5Jw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 295408683A; Wed, 26 Jul 2023 01:13:38 +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,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) (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 D455786852 for ; Wed, 26 Jul 2023 01:13:34 +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=judge.packham@gmail.com Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1bbc64f9a91so5901345ad.0 for ; Tue, 25 Jul 2023 16:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690326812; x=1690931612; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HgG98WJ06KKG/JgHkA2sbNiS779z0Zf4DGy5paKilyg=; b=HXEim5Jw6zttLRQ/kcGqKgER8cWIupU33WBrhNGPpPSJllBUdJrBYK+sNDXulMD3UF T0S6QH+CwX7Czb5cNM9Q8oCMaCXxsmhl5PIpxyfvKbRl+AI5lhnkAoDlAYJSyAEdteY+ g6TGiiUBxWyx+3tZExvnbPGmlvcW/QKaaOTRhvcwhQoC2tBx/ijd7BS/voMLVRxGoHt4 6uPsi7k9bfQ5ONF/r5jhErn+gy7FDI/PMO1IVO8NCNwmuZyvhaiS9guN5vwIZ6ESHkvv Kq2RJrE65StZpFhyMI6VtTUArOrhDnPE3Eful7Yhrkak97InFO3KOiuQBDwBG/4m2bNX Nucw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690326812; x=1690931612; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HgG98WJ06KKG/JgHkA2sbNiS779z0Zf4DGy5paKilyg=; b=SGYIN3M5Gk3eAp3GNQXFJCZDYf7u+hiCFf5KX3bWVS9faAiC1NqathM41R+7wiohls mZyfFnilSX9k0JmzgFaEL8blBWcJJGgqApRMApRgUBKivSodkjRh8htuU4rsyMERquLh 3gcJ5av+RMdCOmcPWVTQYuSAipm0TDrI1paq0klhE0nDYNwH4KF+DCyAToZfCf50Rbgp m/shXvIQzAoLJ30GsAwpzAK49NzbQYosbNWKMTAYxAkb9SLuWHEY9uOpgbsU/5yQcDDk gI2m228ztHX4SauPGbwxz259StY8JXZK0BinphxTL2c4jV8Z5Yuy25bAhjHdCq2+pQBW 6+/A== X-Gm-Message-State: ABy/qLaOVOsxrLP1zC0nTbMlkY2FOc+c1f3FZcSELL7YrOX4SW0Aq3D6 WtFaRtbYNYXI9ylQaF9pHG201p+QoD6+4A== X-Google-Smtp-Source: APBJJlFnUFpLe0VzFNpq3TLrAd5VrLgTU14q/5xMqAkrhikZWyEaWzHIuecOEabqR2VbzPLW9GvRRQ== X-Received: by 2002:a17:902:ea06:b0:1b8:4e00:96b with SMTP id s6-20020a170902ea0600b001b84e00096bmr777193plg.9.1690326812299; Tue, 25 Jul 2023 16:13:32 -0700 (PDT) Received: from chrisp-dl.atlnz.lc ([2001:df5:b000:22:505b:9968:7c0f:8cf6]) by smtp.gmail.com with ESMTPSA id a2-20020a170902ee8200b001b7f40a8959sm2529593pld.76.2023.07.25.16.13.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 16:13:31 -0700 (PDT) From: Chris Packham To: u-boot@lists.denx.de Cc: Chris Packham , Heiko Schocher Subject: [PATCH v2 1/2] i2c: i2c-gpio: Correctly handle new {sda, scl}-gpios bindings Date: Wed, 26 Jul 2023 11:13:08 +1200 Message-ID: <20230725231322.1375303-1-judge.packham@gmail.com> X-Mailer: git-send-email 2.41.0 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.8 at phobos.denx.de X-Virus-Status: Clean gpio_request_list_by_name() returns the number of gpios requested. Notably it swallows the underlying -ENOENT when the "gpios" property does not exist. Update the i2c-gpio driver to check for ret == 0 before trying the new sda-gpios/scl-gpios properties. Signed-off-by: Chris Packham Reviewed-by: Heiko Schocher --- This was originally sent as a single patch[1]. I've rolled it into this series as the board change is dependent on it. [1] - https://lore.kernel.org/u-boot/20230720023107.1184147-1-judge.packham@gmail.com/ (no changes since v1) drivers/i2c/i2c-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c index 4ed9e9e7cddd..c1fc290bd253 100644 --- a/drivers/i2c/i2c-gpio.c +++ b/drivers/i2c/i2c-gpio.c @@ -339,7 +339,7 @@ static int i2c_gpio_of_to_plat(struct udevice *dev) /* "gpios" is deprecated and replaced by "sda-gpios" + "scl-gpios". */ ret = gpio_request_list_by_name(dev, "gpios", bus->gpios, ARRAY_SIZE(bus->gpios), 0); - if (ret == -ENOENT) { + if (ret == 0) { ret = gpio_request_by_name(dev, "sda-gpios", 0, &bus->gpios[PIN_SDA], 0); if (ret < 0)