Message ID | 20231115032515.4249-4-quic_luoj@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a59:b0:164:83eb:24d7 with SMTP id 25csp2363086rwb; Tue, 14 Nov 2023 19:27:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZjseMPtwVb/IwvWkIXmz8JMaFRm2Ubd9fXp/BVLWY9ho5KWYN8FIR5ZoAgELNOSTA9g+U X-Received: by 2002:a05:6871:430d:b0:1ef:f14e:6f0a with SMTP id lu13-20020a056871430d00b001eff14e6f0amr14888353oab.0.1700018824543; Tue, 14 Nov 2023 19:27:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700018824; cv=none; d=google.com; s=arc-20160816; b=BGbSIVChyOqOSOqWGoq7jssCijLBhvor30t9+lclLnO28GdZgEZmZoRVISIQ4/Ib/c hhkpuGuHIVdtKWu8poX+ZfIdKN8TyFpu+P/Gw7fVMEjkE682cHID31EXCUZamWgE6pdb WIhvoKCN8HcDKQ8vdrKq+rFJxiGkNRVpUKJ7Owmg/WmSRi9uqd+nmzIAI2MRWbzn27gu ZfOUh63jJ8P4tl/j5JJIGal4l/iFGU+mq+/krs14Ufp+mKaJUCkokbyjGBFKPVsOYOAy 7X6aw7D3yRiVw9U+re/VHllPepnuKW5rS1nml0M6N7X8JZBjQCBXEOy3xbpQpbdV5CbX Mlyg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cu5mYA5gW8y3sRa2MF+nXeNHnKrrLIUUFeVbpaiUyy0=; fh=+g5tGayWdOm7NVf+9R7F5Bp+AAhjebsKXKT3IUU1ti0=; b=YVGhAaI+UDJ4wE6f0CuanLcmnFx2jCmZzxfhdQU4fHlUV+Wq7wsTM7x86j+oH6XyV2 E6pQ44wR5MVmOpJ9d8l0Dl2ffRaP/3H7a9JAGpQ5qCNSrppo0erO4FSE36hou6WsNAKy o9jTepfM8025Jp12ghAEnw44+ogw/jIBC9/vSz6KccDfVYOkV3C2EJK3OtJIasQpVxg4 0Jxla2aQgJ2OlEVwsEQjJugx4zk9nihF7spDqfWoe/twEPkakyeUj4tWHxVU1m61Fan0 KV5eHhb1+h0G2R+Dclfwe5qgrFE574kGVbGT3WcbvVt1k+FHitio+KjA6NAVh2obd4Ei Wy1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=X7tSIR1I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ca14-20020a056a00418e00b006c2d616b09bsi9410067pfb.346.2023.11.14.19.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 19:27:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=X7tSIR1I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F187A809501D; Tue, 14 Nov 2023 19:26:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234395AbjKOD0D (ORCPT <rfc822;heyuhang3455@gmail.com> + 28 others); Tue, 14 Nov 2023 22:26:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234380AbjKOD0A (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 14 Nov 2023 22:26:00 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1ACDFB; Tue, 14 Nov 2023 19:25:56 -0800 (PST) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AF3L5sX014969; Wed, 15 Nov 2023 03:25:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=cu5mYA5gW8y3sRa2MF+nXeNHnKrrLIUUFeVbpaiUyy0=; b=X7tSIR1I1IwnlQdwVhLd6wgBGIhRVhJEsmkeCiqTsVEPSjXlbiG6ie69ON6TmJQG+ARe 1RNVeJstzUB+lvNTIOOEFjue2e/XEMpohk7VgUPhzpNd8l74GxcuGsi0VdTacDkEWfeT 6VYGnABa1odpAjXCSyjDJLaKmbplw7pW9GJAzNgYKBlITsCZAt8ANhVdkmcEch92yxkV waQ3oUAVjdhCK9jr1zpz0NmNpCEN6o2ItDqxnSjveOl7xzVUqNzKbVU0DDV7V/WwSPOC 0c2leb5U+RbyZafvvZcThS3JTeHc0J5hSDDALfakzSiiUMXAcx4YgZ3QURZExjvHJoRc rg== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ucg2u8sh7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 03:25:44 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AF3PhHa016232 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 03:25:43 GMT Received: from akronite-sh-dev02.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Tue, 14 Nov 2023 19:25:39 -0800 From: Luo Jie <quic_luoj@quicinc.com> To: <agross@kernel.org>, <andersson@kernel.org>, <konrad.dybcio@linaro.org>, <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>, <andrew@lunn.ch>, <hkallweit1@gmail.com>, <linux@armlinux.org.uk>, <robert.marko@sartura.hr> CC: <linux-arm-msm@vger.kernel.org>, <netdev@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <quic_srichara@quicinc.com> Subject: [PATCH 3/9] net: mdio: ipq4019: Enable GPIO reset for ipq5332 platform Date: Wed, 15 Nov 2023 11:25:09 +0800 Message-ID: <20231115032515.4249-4-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231115032515.4249-1-quic_luoj@quicinc.com> References: <20231115032515.4249-1-quic_luoj@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: dMWqGeS7OtRSWS9hgAccMs904vHfMNvj X-Proofpoint-GUID: dMWqGeS7OtRSWS9hgAccMs904vHfMNvj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_01,2023-11-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 bulkscore=0 spamscore=0 impostorscore=0 mlxscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150027 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 14 Nov 2023 19:26:11 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782598939030964639 X-GMAIL-MSGID: 1782598939030964639 |
Series |
add MDIO changes on ipq5332 platform
|
|
Commit Message
Jie Luo
Nov. 15, 2023, 3:25 a.m. UTC
Before doing GPIO reset on the MDIO slave devices, the common clock
output to MDIO slave device should be enabled, and the related GCC
clocks also need to be configured.
Because of these extra configurations, the MDIO bus level GPIO and
PHY device level GPIO can't be leveraged. Need to add the device
tree property "phy-reset-gpio" of MDIO node to enable this special
GPIO reset.
Signed-off-by: Luo Jie <quic_luoj@quicinc.com>
---
drivers/net/mdio/mdio-ipq4019.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
Comments
On Wed, Nov 15, 2023 at 11:25:09AM +0800, Luo Jie wrote: > Before doing GPIO reset on the MDIO slave devices, the common clock > output to MDIO slave device should be enabled, and the related GCC > clocks also need to be configured. > > Because of these extra configurations, the MDIO bus level GPIO and > PHY device level GPIO can't be leveraged. Its not clear to me why the normal reset cannot be used. The MBIO bus driver can probe, setup the clocks, and then register the MDIO bus to the core. The core can then use the GPIO resets. What am i missing? Andrew
On 11/15/2023 11:11 PM, Andrew Lunn wrote: > On Wed, Nov 15, 2023 at 11:25:09AM +0800, Luo Jie wrote: >> Before doing GPIO reset on the MDIO slave devices, the common clock >> output to MDIO slave device should be enabled, and the related GCC >> clocks also need to be configured. >> >> Because of these extra configurations, the MDIO bus level GPIO and >> PHY device level GPIO can't be leveraged. > > Its not clear to me why the normal reset cannot be used. The MBIO bus > driver can probe, setup the clocks, and then register the MDIO bus to > the core. The core can then use the GPIO resets. > > What am i missing? > > Andrew Hi Andrew, Looks we can leverage the MDIO bus GPIO to reset qca8084 PHY, but the mdio bus gpio only supports one GPIO number. Here are the reasons i put the GPIO reset here. 1. Currently one MDIO bus instance only connects one qca8084 PHY as MDIO slave device on IPQ5332 platform, since the MDIO address occupied by qca8084. if the other type PHY also needs to use MDIO bus GPIO reset, then we can't cover this case. 2. Before doing the GPIO reset on qca8084, we need to enable the clock output to qca8084 by configuring eth_ldo_rdy register, and the mdio bus->reset is called after the mdio bus level reset. 3. program the mdio address of qca8084 PHY and the initialization configurations needed before the registers of qca8084 can be accessed. if we take the PHY level GPIO reset for qca8084, there is no call point to do the initialization configurations and programing PHY address in the MDIO driver code. i will check the feasibility of taking the PHY level GPIO reset and do the initial configurations in the PHY probe function. FYI, here is the sequence to bring up qca8084. a. enable clock output to qca8084. b. do gpio reset of qca8084. c. customize MDIO address and initialization configurations. d. the PHY ID can be acquired. Thanks, Jie.
On Thu, Nov 16, 2023 at 12:14 PM Jie Luo <quic_luoj@quicinc.com> wrote: > > > > On 11/15/2023 11:11 PM, Andrew Lunn wrote: > > On Wed, Nov 15, 2023 at 11:25:09AM +0800, Luo Jie wrote: > >> Before doing GPIO reset on the MDIO slave devices, the common clock > >> output to MDIO slave device should be enabled, and the related GCC > >> clocks also need to be configured. > >> > >> Because of these extra configurations, the MDIO bus level GPIO and > >> PHY device level GPIO can't be leveraged. > > > > Its not clear to me why the normal reset cannot be used. The MBIO bus > > driver can probe, setup the clocks, and then register the MDIO bus to > > the core. The core can then use the GPIO resets. > > > > What am i missing? > > > > Andrew > > Hi Andrew, > Looks we can leverage the MDIO bus GPIO to reset qca8084 PHY, but the > mdio bus gpio only supports one GPIO number. But, you can specify a PHY specific reset-gpio under the PHY subnode. However, you must specify the PHY ID via compatible then, please look at: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/net/ethernet-phy.yaml?h=next-20231116#n36 I do this commonly when there are multiple reset GPIO-s for different ethernet PHY-s. Regards, Robert > > Here are the reasons i put the GPIO reset here. > 1. Currently one MDIO bus instance only connects one qca8084 PHY as > MDIO slave device on IPQ5332 platform, since the MDIO address > occupied by qca8084. if the other type PHY also needs to use MDIO > bus GPIO reset, then we can't cover this case. > > 2. Before doing the GPIO reset on qca8084, we need to enable the clock > output to qca8084 by configuring eth_ldo_rdy register, and the mdio > bus->reset is called after the mdio bus level reset. > > 3. program the mdio address of qca8084 PHY and the initialization > configurations needed before the registers of qca8084 can be accessed. > if we take the PHY level GPIO reset for qca8084, there is no call point > to do the initialization configurations and programing PHY address in > the MDIO driver code. > > i will check the feasibility of taking the PHY level GPIO reset and do > the initial configurations in the PHY probe function. > > FYI, here is the sequence to bring up qca8084. > a. enable clock output to qca8084. > b. do gpio reset of qca8084. > c. customize MDIO address and initialization configurations. > d. the PHY ID can be acquired. > > > Thanks, > Jie.
On 11/16/2023 7:19 PM, Robert Marko wrote: > On Thu, Nov 16, 2023 at 12:14 PM Jie Luo <quic_luoj@quicinc.com> wrote: >> >> >> >> On 11/15/2023 11:11 PM, Andrew Lunn wrote: >>> On Wed, Nov 15, 2023 at 11:25:09AM +0800, Luo Jie wrote: >>>> Before doing GPIO reset on the MDIO slave devices, the common clock >>>> output to MDIO slave device should be enabled, and the related GCC >>>> clocks also need to be configured. >>>> >>>> Because of these extra configurations, the MDIO bus level GPIO and >>>> PHY device level GPIO can't be leveraged. >>> >>> Its not clear to me why the normal reset cannot be used. The MBIO bus >>> driver can probe, setup the clocks, and then register the MDIO bus to >>> the core. The core can then use the GPIO resets. >>> >>> What am i missing? >>> >>> Andrew >> >> Hi Andrew, >> Looks we can leverage the MDIO bus GPIO to reset qca8084 PHY, but the >> mdio bus gpio only supports one GPIO number. > > But, you can specify a PHY specific reset-gpio under the PHY subnode. > However, you must specify the PHY ID via compatible then, please look at: > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/net/ethernet-phy.yaml?h=next-20231116#n36 > > I do this commonly when there are multiple reset GPIO-s for different ethernet > PHY-s. > > Regards, > Robert Got it, thanks Robert for the information, i will try the GPIO reset of PHY DT node, and update it in the next patch set. >> >> Here are the reasons i put the GPIO reset here. >> 1. Currently one MDIO bus instance only connects one qca8084 PHY as >> MDIO slave device on IPQ5332 platform, since the MDIO address >> occupied by qca8084. if the other type PHY also needs to use MDIO >> bus GPIO reset, then we can't cover this case. >> >> 2. Before doing the GPIO reset on qca8084, we need to enable the clock >> output to qca8084 by configuring eth_ldo_rdy register, and the mdio >> bus->reset is called after the mdio bus level reset. >> >> 3. program the mdio address of qca8084 PHY and the initialization >> configurations needed before the registers of qca8084 can be accessed. >> if we take the PHY level GPIO reset for qca8084, there is no call point >> to do the initialization configurations and programing PHY address in >> the MDIO driver code. >> >> i will check the feasibility of taking the PHY level GPIO reset and do >> the initial configurations in the PHY probe function. >> >> FYI, here is the sequence to bring up qca8084. >> a. enable clock output to qca8084. >> b. do gpio reset of qca8084. >> c. customize MDIO address and initialization configurations. >> d. the PHY ID can be acquired. >> >> >> Thanks, >> Jie. > > >
> FYI, here is the sequence to bring up qca8084. > a. enable clock output to qca8084. > b. do gpio reset of qca8084. > c. customize MDIO address and initialization configurations. > d. the PHY ID can be acquired. This all sounds like it is specific to the qca8084, so it should be in the driver for the qca8084. Its been pointed out you can get the driver to load by using the PHY ID in the compatible. You want the SoC clock driver to export a CCF clock, which the PHY driver can use. The PHY driver should also be able to get the GPIO. So i think the PHY driver can do all this. Andrew
On 11/17/2023 1:20 AM, Andrew Lunn wrote: >> FYI, here is the sequence to bring up qca8084. >> a. enable clock output to qca8084. >> b. do gpio reset of qca8084. >> c. customize MDIO address and initialization configurations. >> d. the PHY ID can be acquired. > > This all sounds like it is specific to the qca8084, so it should be in > the driver for the qca8084. > > Its been pointed out you can get the driver to load by using the PHY > ID in the compatible. You want the SoC clock driver to export a CCF > clock, which the PHY driver can use. The PHY driver should also be > able to get the GPIO. So i think the PHY driver can do all this. > > Andrew Yes, Andrew, that is feasible, i will update the patches to move the initialized clock configs in the PHY probe function.
On 11/17/2023 1:20 AM, Andrew Lunn wrote: >> FYI, here is the sequence to bring up qca8084. >> a. enable clock output to qca8084. >> b. do gpio reset of qca8084. >> c. customize MDIO address and initialization configurations. >> d. the PHY ID can be acquired. > > This all sounds like it is specific to the qca8084, so it should be in > the driver for the qca8084. > > Its been pointed out you can get the driver to load by using the PHY > ID in the compatible. You want the SoC clock driver to export a CCF > clock, which the PHY driver can use. The PHY driver should also be > able to get the GPIO. So i think the PHY driver can do all this. > > Andrew Hi Andrew, If i put the GPIO reset in the PHY device tree node, the PHY probe function will be postponed to be called instead of being called during the MDIO bus register, which leads to the PCS can't be created correctly because of reading PHY capability failed before the PHY probe function called. my device tree nodes are as below. ethernet_device { phy-handle = <&phy3>; phy-mode = "2500base-x"; ... }; mdio@90000 { phy3: ethernet-phy@3 { compatible = "ethernet-phy-id004d.d180"; reg = <4>; reset-gpios = <&tlmm 51 GPIO_ACTIVE_LOW>; reset-assert-us = <100000>; reset-deassert-us = <100000>; clocks = <...>; clock-names = "..."; }; }; Since the PHY probe function of phy3 is postponed instead of called during the MDIO bus driver register, and the initialization of qca8084 is not called when the ethernet_device driver is called to create PCS, where the phy3 capability is checked, which is failed since the qca8084 PHY probe is not called. Any idea to resolve this call sequence issue? Thanks.
diff --git a/drivers/net/mdio/mdio-ipq4019.c b/drivers/net/mdio/mdio-ipq4019.c index a77982a1a1e1..93ae4684de31 100644 --- a/drivers/net/mdio/mdio-ipq4019.c +++ b/drivers/net/mdio/mdio-ipq4019.c @@ -12,6 +12,7 @@ #include <linux/phy.h> #include <linux/platform_device.h> #include <linux/clk.h> +#include <linux/gpio/consumer.h> #define MDIO_MODE_REG 0x40 #define MDIO_ADDR_REG 0x44 @@ -55,6 +56,7 @@ struct ipq4019_mdio_data { void __iomem *membase; void __iomem *eth_ldo_rdy[ETH_LDO_RDY_CNT]; struct clk *clk[MDIO_CLK_CNT]; + struct gpio_descs *reset_gpios; }; const char *const mdio_clk_name[] = { @@ -275,6 +277,24 @@ static int ipq_mdio_reset(struct mii_bus *bus) } } + /* Do the optional reset on the devices connected with MDIO bus */ + if (priv->reset_gpios) { + unsigned long *values = bitmap_zalloc(priv->reset_gpios->ndescs, GFP_KERNEL); + + if (!values) + return -ENOMEM; + + bitmap_fill(values, priv->reset_gpios->ndescs); + gpiod_set_array_value_cansleep(priv->reset_gpios->ndescs, priv->reset_gpios->desc, + priv->reset_gpios->info, values); + + fsleep(IPQ_PHY_SET_DELAY_US); + bitmap_zero(values, priv->reset_gpios->ndescs); + gpiod_set_array_value_cansleep(priv->reset_gpios->ndescs, priv->reset_gpios->desc, + priv->reset_gpios->info, values); + bitmap_free(values); + } + /* Configure MDIO clock source frequency if clock is specified in the device tree */ ret = clk_set_rate(priv->clk[MDIO_CLK_MDIO_AHB], IPQ_MDIO_CLK_RATE); if (ret) @@ -319,6 +339,19 @@ static int ipq4019_mdio_probe(struct platform_device *pdev) return PTR_ERR(priv->clk[ret]); } + /* This GPIO reset is for qca8084 PHY, which is only probeable by MDIO bus + * after the following steps completed. + * + * 1. Enable LDO to provide clock for qca8084 and enable SoC GCC uniphy related clocks. + * 2. Do GPIO reset on the qca8084 PHY. + * 3. Configure the PHY address that is customized according to device treee. + * 4. Configure the related qca8084 GCC clock & reset. + */ + priv->reset_gpios = devm_gpiod_get_array_optional(&pdev->dev, "phy-reset", GPIOD_OUT_LOW); + if (IS_ERR(priv->reset_gpios)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->reset_gpios), + "mii_bus %s couldn't get reset GPIO\n", bus->id); + bus->name = "ipq4019_mdio"; bus->read = ipq4019_mdio_read_c22; bus->write = ipq4019_mdio_write_c22;