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 86291C433EF for ; Mon, 4 Apr 2022 17:31:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A0370836B4; Mon, 4 Apr 2022 19:31:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id D36FD83972; Mon, 4 Apr 2022 19:31:28 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 71F85810FC for ; Mon, 4 Apr 2022 19:31:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C8A4BD6E; Mon, 4 Apr 2022 10:31:24 -0700 (PDT) Received: from donnerap.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 28B1B3F718; Mon, 4 Apr 2022 10:31:24 -0700 (PDT) Date: Mon, 4 Apr 2022 15:25:07 +0100 From: Andre Przywara To: Samuel Holland Cc: Heiko Schocher , u-boot@lists.denx.de, Jagan Teki Subject: Re: [PATCH 1/4] i2c: sun6i_p2wi: Initialize chips in .child_pre_probe Message-ID: <20220404152507.4130064b@donnerap.cambridge.arm.com> In-Reply-To: <20220318045237.56237-2-samuel@sholland.org> References: <20220318045237.56237-1-samuel@sholland.org> <20220318045237.56237-2-samuel@sholland.org> Organization: ARM X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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.5 at phobos.denx.de X-Virus-Status: Clean On Thu, 17 Mar 2022 23:52:33 -0500 Samuel Holland wrote: Hi, > Chips attached to the P2WI bus require an initialization command before > they can be used. (Specifically, this switches the chip from I2C mode > to P2WI mode.) The driver does this in its .probe_chip hook, under the > assumption that .probe_chip is called during child probe. This is not > the case; .probe_chip is only called by dm_i2c_probe, which is intended > for use by board-level code, not for chips with OF nodes. Indeed, I see that code path only triggered explicitly by board specific code, none of those places being compiled for sunxi. So without looking too deep or having the ability to test this, it looks alright to me anyway. Acked-by: Andre Przywara Cheers, Andre > Since this initialization command must be run before a child chip can be > used, do it before probing each child. > > Signed-off-by: Samuel Holland > --- > > drivers/i2c/sun6i_p2wi.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/i2c/sun6i_p2wi.c b/drivers/i2c/sun6i_p2wi.c > index c9e1b3fcd5..da7f540509 100644 > --- a/drivers/i2c/sun6i_p2wi.c > +++ b/drivers/i2c/sun6i_p2wi.c > @@ -191,11 +191,12 @@ static int sun6i_p2wi_probe(struct udevice *bus) > static int sun6i_p2wi_child_pre_probe(struct udevice *child) > { > struct dm_i2c_chip *chip = dev_get_parent_plat(child); > + struct udevice *bus = child->parent; > > /* Ensure each transfer is for a single register. */ > chip->flags |= DM_I2C_CHIP_RD_ADDRESS | DM_I2C_CHIP_WR_ADDRESS; > > - return 0; > + return sun6i_p2wi_probe_chip(bus, chip->chip_addr, 0); > } > > static const struct dm_i2c_ops sun6i_p2wi_ops = {