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 EA75EEB64DD for ; Tue, 1 Aug 2023 09:13:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F2D4B86B5A; Tue, 1 Aug 2023 11:13:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1690881225; bh=/xDGYlRr98dXyeVmKzXEBzmFDKslA6iQ2CBHpJ9S5P4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ccsxkEsUM+TQo3fM+PW7/6WeVsDKZAFSIYOGBj9Sg+pEre/mF2UzI9FnmE5qdXUWW wEYJ0fKk31Zj0eIeH5ayc9kycD2oLTQyOmiXcuOigG9B/peVj7TFPywQfRpu1B+P6Y niqblBeVweHopjTpKUpeKbO6fzNSOCwlXhWFcJLrxZ74lgqt2P4nnb2jAOUOtBohzv sIDGFxtbH7D6zRlV1UopahgXX7H7t1qFCPaX0J76mDOVICZhWRF3tZTqqY8SCysqtY tG5I1DoT9smW5WiupHfc1KVY4S0vi0ec+gmoTd73DkSlO/XwuoX3fTHkvoJOAKvB0t QA4EqftTqtwTA== Received: by phobos.denx.de (Postfix, from userid 109) id B2C9686BB1; Tue, 1 Aug 2023 11:13:43 +0200 (CEST) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [80.241.59.207]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 93C0B86B53 for ; Tue, 1 Aug 2023 11:13:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4RFTtW47hqz9sV1; Tue, 1 Aug 2023 11:13:39 +0200 (CEST) Message-ID: Date: Tue, 1 Aug 2023 11:13:38 +0200 MIME-Version: 1.0 Subject: Re: [PATCH v2 2/2] arm: mvebu: x240: Use i2c-gpio instead of built in controller Content-Language: en-US To: Chris Packham , u-boot@lists.denx.de Cc: Chris Packham , Tom Rini References: <20230725231322.1375303-1-judge.packham@gmail.com> <20230725231322.1375303-2-judge.packham@gmail.com> From: Stefan Roese In-Reply-To: <20230725231322.1375303-2-judge.packham@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed 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.8 at phobos.denx.de X-Virus-Status: Clean On 7/26/23 01:13, Chris Packham wrote: > 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 Applied to u-boot-marvell/master Thanks, Stefan > --- > > Changes in v2: > - Update i2c0 alias > - Move i2c-gpio definition to root of device tree > - Remove &i2c0 instead of just disabling it > - Add r-by from Stefan > > arch/arm/dts/ac5-98dx35xx-atl-x240.dts | 30 ++++++++++++++++++++------ > configs/x240_defconfig | 1 + > 2 files changed, 24 insertions(+), 7 deletions(-) > > diff --git a/arch/arm/dts/ac5-98dx35xx-atl-x240.dts b/arch/arm/dts/ac5-98dx35xx-atl-x240.dts > index 820ec18b4355..c19b25925ba2 100644 > --- a/arch/arm/dts/ac5-98dx35xx-atl-x240.dts > +++ b/arch/arm/dts/ac5-98dx35xx-atl-x240.dts > @@ -16,7 +16,7 @@ > gpio0 = &gpio0; > gpio1 = &gpio1; > spi0 = &spi0; > - i2c0 = &i2c0; > + i2c0 = &i2cgpio; > usb0 = &usb0; > pinctrl0 = &pinctrl0; > }; > @@ -40,6 +40,19 @@ > default-state = "on"; > }; > }; > + > + 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"; > + }; > }; > > &nand { > @@ -70,9 +83,7 @@ > status = "okay"; > }; > > -&i2c0 { > - status = "okay"; > - > +&i2cgpio { > mux@71 { > #address-cells = <1>; > #size-cells = <0>; > @@ -177,8 +188,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 +212,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 +220,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 a78cb3ce6cbf..7d2b8603e6f4 100644 > --- a/configs/x240_defconfig > +++ b/configs/x240_defconfig > @@ -42,6 +42,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 Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de