Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4612670rdb; Tue, 12 Dec 2023 04:50:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjKVLp7vVBMhZCT1ar/wP396ZdYV3uo9ubkAB9tYA+QMQdEeB01D+60UQWbrbLpvUaSVTk X-Received: by 2002:a05:6a20:8e14:b0:18f:97c:8a23 with SMTP id y20-20020a056a208e1400b0018f097c8a23mr8594788pzj.78.1702385428089; Tue, 12 Dec 2023 04:50:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702385428; cv=none; d=google.com; s=arc-20160816; b=rOvHUijAeyfJBBi7ZhNjEHSnPhj5z5+VEmTqRKLKsfaoba2nEZy3Hu2BO2+9g2rMb6 PNLxhkS0u+79dreawridrpdSAVYjsWOIeOrHxtCA+OhnA/0HSIJZvK/ZXhVC7k2GSzVz zP4sNNziVZiXJUhmyul5aFkxcaaphJzzjCiQFuWWyw5cnxonQubG/Jjb9KD3CXMZd/Ft edTUKRcZQcFVaA0h3PD5dCDONvhyJtkdOMl2hLVfRC3+HbuU7i0jVNKz2Bui0WJhKZEI 28eKsKO9ZeMBOgNummEJouTpYK+Nmh279KS3IFuZ2rErjn8p8LTPCzopiGl3IKzGyfQX phCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=GGg92Ioc3V3p1OkpBwikbksUY+03mtQ2MEb/MlWZQlU=; fh=NacFT00Flex3V9srurNu5Mg1ktNOLUllvwsK2y7VrOE=; b=Zv2LTXeunTTVhekWdfn+OKXTtuJC+0FRWISpUskvXoMhrTPcmMzdFxQyPUGiAkDIZc 1oqtYQkPzYh76N8ibiveElra4XN9w+8Jb35xLsUkNk5ZAys+qSmpHGh8D5NBoyNXdxkF TVKy/XN0wOh3fL2Ia5sZssPxLAGttwRlpvbiG9d3qlL+1F4G+v2bTU9jInXYKA+HbDWp oaVEc6q/ZFVX3FagBmtt6RPklL9+QBatJ3om58en0CHuwjtAvZUKO7fIQLYZGwLa3gS2 NZTCksidLN/vgpaAF/+rog97HHuvDl+Qo123TPjkCUTsaFnzA/aTOUQrQF6k6O/HsgQP YZWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VK19KfB5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id b12-20020a63eb4c000000b005be1ee5be76si7562161pgk.373.2023.12.12.04.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 04:50:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VK19KfB5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 8570C809379A; Tue, 12 Dec 2023 04:50:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376323AbjLLMuJ (ORCPT + 99 others); Tue, 12 Dec 2023 07:50:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376275AbjLLMuD (ORCPT ); Tue, 12 Dec 2023 07:50:03 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0315E110; Tue, 12 Dec 2023 04:50:07 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id C0B3E2000B; Tue, 12 Dec 2023 12:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1702385405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GGg92Ioc3V3p1OkpBwikbksUY+03mtQ2MEb/MlWZQlU=; b=VK19KfB5kxoJI9py7HhGYw3rJ7t7LIcC1Jx6E7OpWQkTbVGKrne+w34ilVX9q3rHM3rmZH x/1JIsHy6SrrS1TE2HqfjEYJADvAPAW+HXCkmlDw2lDiDM0dhHpiYdPSil9SIu9sF3+aXb tUDEGc3jcZzrTg4ArATw9pNozpCcKmnW3Jw5UeQ+ikeetb7CbP4vuyAT3gHKAzcieqQSkB ieDImgiybOGlkX0bTNjiP36hxvJfgKJI54h0Hb4htJF7XatSAmolg6dR+JVq1kooTQQwaw y/V5d9M+2SI58H5QzNUn7qHmMjshnjOYFQvuizt1nort9NlKx0j39BFRg1cIkg== Date: Tue, 12 Dec 2023 13:50:01 +0100 From: Maxime Chevallier To: Luo Jie Cc: , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v2 1/5] net: mdio: ipq4019: move eth_ldo_rdy before MDIO bus register Message-ID: <20231212135001.6bf40e4d@device.home> In-Reply-To: <20231212115151.20016-2-quic_luoj@quicinc.com> References: <20231212115151.20016-1-quic_luoj@quicinc.com> <20231212115151.20016-2-quic_luoj@quicinc.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-Sasl: maxime.chevallier@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Dec 2023 04:50:25 -0800 (PST) Hello, On Tue, 12 Dec 2023 19:51:46 +0800 Luo Jie wrote: > The ethernet LDO provides the clock for the ethernet PHY that > is connected with PCS, each LDO enables the clock output to > each PCS, after the clock output enablement, the PHY GPIO reset > can take effect. > > For the PHY taking the MDIO bus level GPIO reset, the ethernet > LDO should be enabled before the MDIO bus register. > > For example, the qca8084 PHY takes the MDIO bus level GPIO > reset for quad PHYs, there is another reason for qca8084 PHY > using MDIO bus level GPIO reset instead of PHY level GPIO > reset as below. > > The work sequence of qca8084: > 1. enable ethernet LDO. > 2. GPIO reset on quad PHYs. > 3. register clock provider based on MDIO device of qca8084. > 4. PHY probe function called for initializing common clocks. > 5. PHY capabilities acquirement. > > If qca8084 takes PHY level GPIO reset in the step 4, the clock > provider of qca8084 can't be registered correctly, since the > clock parent(reading the current qca8084 hardware registers in > step 3) of the registered clocks is deserted after GPIO reset. > > There are two PCS(UNIPHY) supported in SOC side on ipq5332, > and three PCS(UNIPHY) supported on ipq9574. > > Signed-off-by: Luo Jie > --- [...] > @@ -252,11 +244,32 @@ static int ipq4019_mdio_probe(struct platform_device *pdev) > if (IS_ERR(priv->mdio_clk)) > return PTR_ERR(priv->mdio_clk); > > - /* The platform resource is provided on the chipset IPQ5018 */ > - /* This resource is optional */ > - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > - if (res) > - priv->eth_ldo_rdy = devm_ioremap_resource(&pdev->dev, res); > + /* These platform resources are provided on the chipset IPQ5018 or > + * IPQ5332. > + */ > + /* This resource are optional */ > + for (index = 0; index < ETH_LDO_RDY_CNT; index++) { > + res = platform_get_resource(pdev, IORESOURCE_MEM, index + 1); > + if (res) { > + priv->eth_ldo_rdy[index] = devm_ioremap(&pdev->dev, > + res->start, > + resource_size(res)); You can simplify that sequence by using devm_platform_get_and_ioremap_resource(), which will do both the platform_get_resource and the devm_ioremap at once for you. Thanks, Maxime