From patchwork Thu Jul 20 03:03:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 1810218 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=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=QBC493lo; 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 4R5yFn17fpz20FK for ; Thu, 20 Jul 2023 13:04:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7C26186791; Thu, 20 Jul 2023 05:04:06 +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=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QBC493lo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5BDAB86791; Thu, 20 Jul 2023 05:04:05 +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-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) (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 86587867B9 for ; Thu, 20 Jul 2023 05:04:02 +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-x633.google.com with SMTP id d9443c01a7336-1b8c81e36c0so2017785ad.0 for ; Wed, 19 Jul 2023 20:04:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689822240; x=1692414240; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=w74LS4anrNpP/doq9cFNksEMGiYbFO0MYSWgzY/CVX4=; b=QBC493loLZCiZAjWP4ouD58bXTZE5BCF2Un8iVIMGuUWDXTzXVtiH48NleqAMEoCD7 6h0UfniizcZh3X/6LKtjrKztfc4arGrOG4euwGuskONPu7wQmC28yKNi0dab27ur74Ut q8OhX+ATpQCyLd4qjd2uU9glnJ92/Rt6Z4PJz8zb9aiEhu6MImrVgiJfj97++wxnVgS2 44bTIzAVqGZSdZwnw6yWa/3iSXd9zSMdrWhKxJKMRfSSGDjuwluhbHfkVStXF7O442on uqG9/d/gnKYfNk+bhsi2CtP6teD0ZL8bCHhTKvR8ChpNxKN0wV7bI/zKvM1WQWfHd1W2 +5QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689822240; x=1692414240; 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=w74LS4anrNpP/doq9cFNksEMGiYbFO0MYSWgzY/CVX4=; b=Js+I7vVQomvU7cIU4T1X/R0kWEL80HODsigQL1RdBCsN/swmj4Se1JqVWFIIyxZKZy usZlCjWMLxVARpn48LvY88D9YtD+rp6iwfIHQIMDx8K0DsoXVHX9HGnR85rlPHmwIVko aO3qm+Rho7PPsJWOc1V92Kwn4TUkpT8vBvv6CPLKBW3L67h4zhSITDFOw9cAkyRLlHJA 4LhS/lh685waNbLFcuGYPrEtAEkwnAkDakWQe9NFieF7eTXtdIBJJ4bH5d3tlHI1ata/ /ntvWFQRJjHBEh8OdVQAUR9uKWmNWYsF9Xdg8dl63y90ZBFh4qALHLRDNsG1xADyqRIj 4YXA== X-Gm-Message-State: ABy/qLZ7OlRObr3mCl/NDPGEi3l2XfPY26MehEJabFYuD1MYRvtaGuJ1 fGkSIfzSflcd46Wp0JyBgN6C4f1/annD1Q== X-Google-Smtp-Source: APBJJlG+8EYs4owXfkRrmiL2HCL9V+szQ8itEqlxOdzp2JCLWM2NjbUunAu66AvTc5oQezaVT+oiBw== X-Received: by 2002:a17:902:ed8c:b0:1b8:78e:7c1 with SMTP id e12-20020a170902ed8c00b001b8078e07c1mr664450plj.51.1689822239552; Wed, 19 Jul 2023 20:03:59 -0700 (PDT) Received: from chrisp-dl.atlnz.lc ([2001:df5:b000:22:3db4:2b01:2131:de21]) by smtp.gmail.com with ESMTPSA id c9-20020a170902b68900b001b8761c739csm4717387pls.271.2023.07.19.20.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 20:03:56 -0700 (PDT) From: Chris Packham To: u-boot@lists.denx.de Cc: Chris Packham , Chris Packham , Stefan Roese , Tom Rini Subject: [PATCH] arm: mvebu: x240: Use i2c-gpio instead of built in controller Date: Thu, 20 Jul 2023 15:03:37 +1200 Message-ID: <20230720030349.1200940-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 There is an Errata with the built-in I2C controller where various I2C hardware errors cause a complete lockup of the CPU (which eventually results in an watchdog reset). Put the I2C MPP pins into GPIO mode and use the i2c-gpio driver instead. This uses a bit-banged implementation of an I2C controller and avoids triggering the Errata. Signed-off-by: Chris Packham Reviewed-by: Stefan Roese --- This is dependent on a bug-fix for the i2c-gpio driver I just sent out[1] (sorry I should have sent them as a series but I thought this would take me longer to test than it did). [1] - https://lore.kernel.org/u-boot/20230720023107.1184147-1-judge.packham@gmail.com/ arch/arm/dts/ac5-98dx35xx-atl-x240.dts | 30 ++++++++++++++++++++++---- configs/x240_defconfig | 1 + 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/arch/arm/dts/ac5-98dx35xx-atl-x240.dts b/arch/arm/dts/ac5-98dx35xx-atl-x240.dts index 820ec18b4355..d47220520b9e 100644 --- a/arch/arm/dts/ac5-98dx35xx-atl-x240.dts +++ b/arch/arm/dts/ac5-98dx35xx-atl-x240.dts @@ -71,8 +71,25 @@ }; &i2c0 { - status = "okay"; + status = "disabled"; +}; +&{/} { + i2cgpio: i2c-gpio-0 { + compatible = "i2c-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_gpio>; + scl-gpios = <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + sda-gpios = <&gpio0 27 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + status = "okay"; + }; +}; + +&i2cgpio { mux@71 { #address-cells = <1>; #size-cells = <0>; @@ -177,8 +194,8 @@ * LED_OE_N [23] * USB_PWR_FLT_N [24] * SFP_INT_N [25] - * I2C0_SCL [26] - * I2C0_SDA [27] + * I2C0_SCL [26] (GPIO) + * I2C0_SDA [27] (GPIO) * USB_EN [28] * MONITOR_INT_N [29] * XM1_MDC [30] @@ -201,7 +218,7 @@ /* 0 1 2 3 4 5 6 7 8 9 */ pin-func = < 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 1 1 1 1 0xff 0xff 0 0 - 0 0 0 0 0 0 1 1 0 0 + 0 0 0 0 0 0 0xff 0xff 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 >; @@ -209,4 +226,9 @@ marvell,pins = <0 1 2 3 4 5 6 7 8 9 10 11 16 17>; marvell,function = <2>; }; + + i2c0_gpio: i2c0-gpio-pins { + marvell,pins = <26 27>; + marvell,function = <0>; + }; }; diff --git a/configs/x240_defconfig b/configs/x240_defconfig index 6d25c5ae3fcf..e8589d636081 100644 --- a/configs/x240_defconfig +++ b/configs/x240_defconfig @@ -43,6 +43,7 @@ CONFIG_CLK_MVEBU=y CONFIG_GPIO_HOG=y CONFIG_DM_PCA953X=y CONFIG_DM_I2C=y +CONFIG_DM_I2C_GPIO=y CONFIG_SYS_I2C_MVTWSI=y CONFIG_I2C_MUX=y CONFIG_I2C_MUX_PCA954x=y