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 D263AC433F5 for ; Fri, 18 Mar 2022 04:52:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0E9F683AFD; Fri, 18 Mar 2022 05:52:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org 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=sholland.org header.i=@sholland.org header.b="rlKASDDv"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="ClgDHReT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 931C883D16; Fri, 18 Mar 2022 05:52:48 +0100 (CET) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (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 20DA383CF7 for ; Fri, 18 Mar 2022 05:52:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 4DCC73200F9C; Fri, 18 Mar 2022 00:52:42 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 18 Mar 2022 00:52:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; bh=7N/OdSUrI1xsamNMeyD5bJmWYZYnLZ ghQ8dbVYUVRi8=; b=rlKASDDvqnrZaaIGDao0H4Poco4Bhlt0wRqTPcEX5kPkIX Gkz7og3Wh9/upqLaUHHANEFPYHSLEjFSE7mbQ1l5uCZvI6a9k5qNQ0RnGQU9g+ns RvVvzm3NAopEoqbtO0LV4bP9juYK0y03qKmfDZf4iE5YI4PAnO4vXYEvTkY4SW4/ CxPb0wrXYFANfz4IaE13F2D1YcIncWeTR6B7/xX0KT2GLGG3aKhyCrAh0dpmbx1C 8R7ZGt3ZKMddctm2ee5tRI4sBv7+PY3chC7d3Db28J12K/XzlMnEo027FKvoB5pQ EERvGT4fnMENpuwVFr7WRF5SJh5RlJajh47F1Tsg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=7N/OdS UrI1xsamNMeyD5bJmWYZYnLZghQ8dbVYUVRi8=; b=ClgDHReTZcmam3KsirNzSb 0+UrACcWEbaSwbI7mU4ECurE5RUH2r0uw/hi7YGHwvyN/X/d7nokN/4l0SoxMCXb BDKNX1z6T3piUQ/m/bv9+9mKLG8MJArBbd7XLylyEAd1ZjyBM+uv+sH954rU/hqY yaaQP+h/MRMbp0+Wf/d6ucpgebPC+H8eqiotgv6qlYkLBOSiybWeRtXiPjxPBW2c wxd5Si2qxG7jEey9d/1byIuPW0uvOIpyBDNgHzYgcS29hUZvgYcx32KDmDWnGnDb DmjdBiN5rMQITssvxTZMLJQO/2ngvcyBCdW55j7a5PU7XwBxoyfLxlSeFj9lYxXQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudefhedgjeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 18 Mar 2022 00:52:41 -0400 (EDT) From: Samuel Holland To: Heiko Schocher , u-boot@lists.denx.de, Jagan Teki , Andre Przywara Cc: Samuel Holland Subject: [PATCH 1/4] i2c: sun6i_p2wi: Initialize chips in .child_pre_probe Date: Thu, 17 Mar 2022 23:52:33 -0500 Message-Id: <20220318045237.56237-2-samuel@sholland.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220318045237.56237-1-samuel@sholland.org> References: <20220318045237.56237-1-samuel@sholland.org> MIME-Version: 1.0 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.5 at phobos.denx.de X-Virus-Status: Clean 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. 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 = { -- 2.33.1