From mboxrd@z Thu Jan 1 00:00:00 1970 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 167E0C433F5 for ; Sat, 18 Dec 2021 13:44:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EEBBF8309E; Sat, 18 Dec 2021 14:44:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (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=1639835060; bh=aoN8WinwY63H9In6YpGYFAuIv5RajdlbtoI4dwSJGPo=; h=Date:Subject:From:To:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iFTPxTEJaJANBBbo+Q/aOKDUEAnIvVL/MkAnU+nYH9QGiPMM9Np4HIYFlt9CxV2/L /60gQq8W68cCo0aODsB25qK/HXdt7mcj83DqcodErzR1/2HscwP6hj9GaP60WTft4f Q6PWM6k+e4+Aqs8T3hdNpoUGZchIxp+Yyng5I/m1UryuzipnKjKIuo585rkhnwQ7YZ bCUsZE+t1J4fOPXCOcMUaUl3rJoCE5zc1UZdN7o9ZFOS0JMX91219h4paqLiT2L0BW Zgw62ecT3MEL1BjcdXigRgt3CpvE8PQDTZ8RslryoWg7gIeF77kwVii5/vt6sZOv3q qKQWH59f5Isvw== Received: by phobos.denx.de (Postfix, from userid 109) id 827CD8309E; Sat, 18 Dec 2021 14:44:16 +0100 (CET) Received: from mout-u-204.mailbox.org (mout-u-204.mailbox.org [IPv6:2001:67c:2050:1::465:204]) (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 C5C7A830A2 for ; Sat, 18 Dec 2021 14:44:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:105:465:1:4:0]) (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-204.mailbox.org (Postfix) with ESMTPS id 4JGRsS2rcrzQjbj for ; Sat, 18 Dec 2021 14:44:12 +0100 (CET) Message-ID: Date: Sat, 18 Dec 2021 14:44:08 +0100 MIME-Version: 1.0 Subject: Re: [PATCH 5/9] arm: mvebu: theadorable: Switch to using DM I2C API Content-Language: en-US From: Stefan Roese To: u-boot@lists.denx.de References: <20211118081939.861407-1-sr@denx.de> <20211118081939.861407-5-sr@denx.de> In-Reply-To: <20211118081939.861407-5-sr@denx.de> 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.38 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.2 at phobos.denx.de X-Virus-Status: Clean On 11/18/21 09:19, Stefan Roese wrote: > No functional change intended. This patch switches from the legacy I2C > API to the DM I2C API, so that this code can be used with DM I2C > enabled. > > Signed-off-by: Stefan Roese Applied to u-boot-marvell/next Thanks, Stefan > --- > board/theadorable/theadorable.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/board/theadorable/theadorable.c b/board/theadorable/theadorable.c > index bb2d51495638..6e41ca239919 100644 > --- a/board/theadorable/theadorable.c > +++ b/board/theadorable/theadorable.c > @@ -298,10 +298,19 @@ int board_late_init(void) > bootcount_inc(); > > if (bootcount > PEX_SWITCH_NOT_FOUNT_LIMIT) { > - printf("Issuing power-switch via uC!\n"); > + struct udevice *dev; > > printf("Issuing power-switch via uC!\n"); > - i2c_set_bus_num(STM_I2C_BUS); > + ret = i2c_get_chip_for_busnum(STM_I2C_BUS, STM_I2C_ADDR, > + 1, &dev); > + if (ret) { > + printf("Error selecting STM on I2C bus (ret=%d)\n", > + ret); > + printf("Issuing soft-reset...\n"); > + /* default handling: SOFT reset */ > + do_reset(NULL, 0, 0, NULL); > + } > + > i2c_buf[0] = STM_I2C_ADDR << 1; > i2c_buf[1] = 0xc5; /* cmd */ > i2c_buf[2] = 0x01; /* enable */ > @@ -313,7 +322,7 @@ int board_late_init(void) > i2c_buf[6] = 0x00; > i2c_buf[7] = crc8(0x72, &i2c_buf[0], 7); > > - ret = i2c_write(STM_I2C_ADDR, 0, 0, &i2c_buf[1], 7); > + ret = dm_i2c_write(dev, 0, &i2c_buf[1], 7); > if (ret) { > printf("I2C write error (ret=%d)\n", ret); > printf("Issuing soft-reset...\n"); > Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de