From patchwork Mon Feb 19 19:57:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xiwen via B4 Relay X-Patchwork-Id: 13563060 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22E5151C47; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; cv=none; b=kXVhJ5yuM3IAEef6kz2IRymzqDHA7AHYBQIvObpFCadGm68WQPtKb0upLZxXoSRFNPbfnvKV5IwtKvFqa5LXnWgAA75X7/CJ7iFKfQNqAvF9CRbr7JiOWqxRpUMdfSW6cIzq+ucOKSK2nWDw1Qw7ZqWmtU3BCCD8pOJdtJueeMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; c=relaxed/simple; bh=V1KomR4EYfJ5rWH5vbpqFhkkFyp2l4Yik0iVHegn1sc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mHaF6TVNAIzo3SNgmoZHipgvAHUQde841jDfr7VpQqnuEjMPe8h1IF2HKBk3/3unMvRDHyva78dYSBl6gPn0FaPc//kxBAAdBEV8jscGVC3s0vyVFF+fvUyJs27pjKSRf44TQKT5Pq02UEeCZkqAPXGuSqT9RxzsyJlaI27QyCw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NIYYv6fO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NIYYv6fO" Received: by smtp.kernel.org (Postfix) with ESMTPS id A7386C433C7; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708372656; bh=V1KomR4EYfJ5rWH5vbpqFhkkFyp2l4Yik0iVHegn1sc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=NIYYv6fOX7C78iccCoMfSOyFTYYaY9v8MlsvSNNCjF61+D57pLTMNJenR5Wlzz+oh xX0KjmmRcpzkZs41qVidP2qfTilYN+/gr4wDBJ3QdpMF0B8pc27pqhO7yOxj4bnznv ZzG3QfW6yf8CjLBSHjFhJBr4wexskuJTxfBLiihPtTp/kx3eTJQJXqe5Cbua9jEd46 b8c7Ug3a+S66cePO3Fvpyt+FkqOQcR+2OtmjMDTAuzT0sr/AnQP/4ypl9XN1nWCSNA vhwchxxyOSntWskNEWsLEV0DX8ucMdcWep3Y9kWeUX34JB5jSSDtlYm5q5KXfx3cyC 8BIYovOBuDRBg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B1C0C54788; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Tue, 20 Feb 2024 03:57:36 +0800 Subject: [PATCH net-next v3 1/6] net: mdio: hisi-femac: make clock optional Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-net-v3-1-b68e5b75e765@outlook.com> References: <20240220-net-v3-0-b68e5b75e765@outlook.com> In-Reply-To: <20240220-net-v3-0-b68e5b75e765@outlook.com> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Yang Xiwen X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708372656; l=720; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=RxVNNMcUcOL8zwGYeNVp22tshMMwMwhDPBBRMx/bOA4=; b=QWnp8vXIvEWNQsFkYpybTyS4CueV5P2ocmQp+rpM8gO/MOJ7eUrbcJ7WOKB/E6zOZoJRTGhvC k7ZhNuV9xxjAdXlEfVk9tD3gFbUtvtZSwi27S8xqJ2cgUP0CKSYT57b X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=qOD5jhp891/Xzc+H/PZ8LWVSWE3O/XCQnAg+5vdU2IU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20230724 with auth_id=67 X-Original-From: Yang Xiwen Reply-To: X-Patchwork-Delegate: kuba@kernel.org From: Yang Xiwen The clocks are optional. Signed-off-by: Yang Xiwen --- drivers/net/mdio/mdio-hisi-femac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mdio/mdio-hisi-femac.c b/drivers/net/mdio/mdio-hisi-femac.c index 6703f626ee83..a2620b200381 100644 --- a/drivers/net/mdio/mdio-hisi-femac.c +++ b/drivers/net/mdio/mdio-hisi-femac.c @@ -93,7 +93,7 @@ static int hisi_femac_mdio_probe(struct platform_device *pdev) goto err_out_free_mdiobus; } - data->clk = devm_clk_get(&pdev->dev, NULL); + data->clk = devm_clk_get_optional(&pdev->dev, NULL); if (IS_ERR(data->clk)) { ret = PTR_ERR(data->clk); goto err_out_free_mdiobus; From patchwork Mon Feb 19 19:57:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xiwen via B4 Relay X-Patchwork-Id: 13563059 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22E1351C3B; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; cv=none; b=qqxy+/ToBnpmYEq6wTtlP7ZbvxDRobctJkYjxOXEJCENSvC7EPmbLj8dinRuTuxVoKVEmW3KRdV5O1ZqhwZSMp2t2YZnsuvQKzJD+SIcfCfqeyWEE0wy2pHaEMHaCEWecg1s9F+uFgz456CJN1LlGJq3L9TfT6MHwujXSz4CQ8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; c=relaxed/simple; bh=nop/OiGp844/xYKXXVQI+2hWwg8MMGvYavV5eOdNyP4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=vC2Td63+s7C4Dr6XootBsUlL/UpXoTzBEcDsi9QCERlZOx6O2bktHhigqpLLCjeZ03sxlNT5bbo7lFMYp9Q5GHESEG23QaSPt93m64e8xOoKQzePQLvT8DBnUbyNa4aeliyLpw5GtBgA9o0QPO4pSvS3SHunQoOAN5RMfgFscPc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BG7nX7GH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BG7nX7GH" Received: by smtp.kernel.org (Postfix) with ESMTPS id B1976C43399; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708372656; bh=nop/OiGp844/xYKXXVQI+2hWwg8MMGvYavV5eOdNyP4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=BG7nX7GHEgjsHqlTeqi/yRJC+4RErti0x+S5kJYkVXJcxzjJIKSqcKBmEd6dIEIxh +xzo/n/nKL5DWb9x2dJBGb73qbrMui/9upAZ/Ly1fJMJbbXluLjiMiAvfje/TnV+Sn J/l3ksgnqvAu8RHhIhcSXCDVSat3Xk/lYoMWPkUIABkcuYVUlM4nhd3gxtYd2Te0B7 HlErm/2B6xVdo7oXq39/f6dvOjUk75AglAnwgSN2S67xuYjAa9X3MQqvOULM1d54L5 MYLmtFypgqCmUEytKG3Dhg/kOX+xTmu4S+Gie0WbyNXzYxLrptjFxPaKDCPTxSpxao z46ORRCFFTOdA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99E28C54764; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Tue, 20 Feb 2024 03:57:37 +0800 Subject: [PATCH net-next v3 2/6] dt-bindings: net: hisilicon-femac-mdio: convert to YAML Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-net-v3-2-b68e5b75e765@outlook.com> References: <20240220-net-v3-0-b68e5b75e765@outlook.com> In-Reply-To: <20240220-net-v3-0-b68e5b75e765@outlook.com> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Yang Xiwen X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708372656; l=2430; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=iR9T/nPDOpVW3CABLZDGaiOeC7P5ZbMOoE+OAc1rwbA=; b=NdCawbGp2t76JUPylwDvThvzqdBGKVRdFCSkBeLmKz9L6dcqjLFKFKHlCFYlV4UH7xmGv/GXX Ud9aNyhBaRlCY9y6DqLuOL55qbV8XAp/cMHuYYlwMT3iIhX4qP1GKqt X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=qOD5jhp891/Xzc+H/PZ8LWVSWE3O/XCQnAg+5vdU2IU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20230724 with auth_id=67 X-Original-From: Yang Xiwen Reply-To: X-Patchwork-Delegate: kuba@kernel.org From: Yang Xiwen Also mark the clock optional Signed-off-by: Yang Xiwen --- .../bindings/net/hisilicon,hisi-femac-mdio.yaml | 48 ++++++++++++++++++++++ .../bindings/net/hisilicon-femac-mdio.txt | 22 ---------- 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/Documentation/devicetree/bindings/net/hisilicon,hisi-femac-mdio.yaml b/Documentation/devicetree/bindings/net/hisilicon,hisi-femac-mdio.yaml new file mode 100644 index 000000000000..1c85e6e7f8f6 --- /dev/null +++ b/Documentation/devicetree/bindings/net/hisilicon,hisi-femac-mdio.yaml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/hisilicon,hisi-femac-mdio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: HiSilicon FEMAC MDIO bus + +maintainers: + - Yang Xiwen + +allOf: + - $ref: mdio.yaml# + +properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + compatible: + const: hisilicon,hisi-femac-mdio + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + mdio@10091100 { + compatible = "hisilicon,hisi-femac-mdio"; + reg = <0x10091100 0x20>; + #address-cells = <1>; + #size-cells = <0>; + + phy@1 { + reg = <1>; + }; + }; diff --git a/Documentation/devicetree/bindings/net/hisilicon-femac-mdio.txt b/Documentation/devicetree/bindings/net/hisilicon-femac-mdio.txt deleted file mode 100644 index 23a39a309d17..000000000000 --- a/Documentation/devicetree/bindings/net/hisilicon-femac-mdio.txt +++ /dev/null @@ -1,22 +0,0 @@ -Hisilicon Fast Ethernet MDIO Controller interface - -Required properties: -- compatible: should be "hisilicon,hisi-femac-mdio". -- reg: address and length of the register set for the device. -- clocks: A phandle to the reference clock for this device. - -- PHY subnode: inherits from phy binding [1] -[1] Documentation/devicetree/bindings/net/phy.txt - -Example: -mdio: mdio@10091100 { - compatible = "hisilicon,hisi-femac-mdio"; - reg = <0x10091100 0x10>; - clocks = <&crg HI3516CV300_MDIO_CLK>; - #address-cells = <1>; - #size-cells = <0>; - - phy0: phy@1 { - reg = <1>; - }; -}; From patchwork Mon Feb 19 19:57:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xiwen via B4 Relay X-Patchwork-Id: 13563063 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 353AC51C59; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; cv=none; b=cu7TJc3OsTXu+3yuR/dgQjO9+k1J+85ie5ngC5gp7qggsvqxLKmhMEixgKqMubPJbyDXWPY+NhC6NtbnB0BRsnNkjgZXphOt44pMXRvNFM69DerXCv8T6BNWUMuu5+teqJdD2zmzkOCWIhxSVYCgv0qkPphiVYkchycT+J0xr0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; c=relaxed/simple; bh=lkE+nJafSbSS+sWJQAO8lM1Z0gsqsKJ4xjPAvAQp9Po=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eMka27swcVwbb259PewTV7kb5WHx7kSuGKhJXJXC9yubRkc5+kqijhRIwjjgZz+TWjAm0cn8kFL4AWI9r3T5wMjazAoRlf342xq689DJsxPwjm/n2ZXQbp7ygeAu6+u9Tx2+8Ya8ey7mlg6/HuS4tc/dQMNmGavTtyQqTWjxrcM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SyJVSckQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SyJVSckQ" Received: by smtp.kernel.org (Postfix) with ESMTPS id C0318C43330; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708372656; bh=lkE+nJafSbSS+sWJQAO8lM1Z0gsqsKJ4xjPAvAQp9Po=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=SyJVSckQVuTitcoJXdrsyw0c8wTwkWCMQc+5cmFn6PD/ZV94ozZVdmm+ot6axGVSi uD4oP5Kz8/LliTOdQ6tBOkoKHDMeswGsOBmfIfqB5M0o8rAMz5cGrhlmc+nQB0eO57 zBaWy1hYnIVc9d0pWwz+kQNw0RAKkAuJmlB8v9Jg4lwhmBpkgRX8fiaiWBFz/Q8LiQ 5SPVm0nw6Q+df1gRvfLKFur+s2CaFweSeDrwKU9I8/GpVNQDDNSPmI5nP4iTxGnpuo Njf1q/6PrI3GcBG4RABTj48iwZBh0X1fTCjJAKduRtR3M2Zkqdbf/+OW4+PWKiuDJO 0lXJA6zSM5ntw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A99F0C5478B; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Tue, 20 Feb 2024 03:57:38 +0800 Subject: [PATCH net-next v3 3/6] net: hisilicon: add support for hisi_femac core on Hi3798MV200 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-net-v3-3-b68e5b75e765@outlook.com> References: <20240220-net-v3-0-b68e5b75e765@outlook.com> In-Reply-To: <20240220-net-v3-0-b68e5b75e765@outlook.com> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Yang Xiwen X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708372656; l=7437; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=Pnrm52kA78VWruPcIH3FwKYMhoBNHxMHWexU8vqTlc8=; b=Aw8ZpT4GtvEBPmkyonppHyzMAB5wJvp+iVnUz5LRzuMrAasJaLe+Wlj7xz9f6YPQcSxPcjljP REJAIlx3YSvDbtcu1jl06/knD4QJUE3ZwKYPe0+a4F8gCPwpHKBKGTW X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=qOD5jhp891/Xzc+H/PZ8LWVSWE3O/XCQnAg+5vdU2IU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20230724 with auth_id=67 X-Original-From: Yang Xiwen Reply-To: X-Patchwork-Delegate: kuba@kernel.org From: Yang Xiwen Register the sub MDIO bus if it is found. Also implement the internal PHY reset procedure as needed. Note it's unable to put the MDIO bus node outside of MAC controller (i.e. at the same level in the parent bus node). Because we need to control all clocks and resets in FEMAC driver due to the phy reset procedure. So the clocks can't be assigned to MDIO bus device, which is an essential resource for the MDIO bus to work. No backward compatibility is maintained since the only existing user(Hi3516DV300) has not received any updates from HiSilicon for about 8 years already. And till today, no mainline dts for this SoC is found. It seems unlikely that there are still existing mainline Hi3516DV300 users. The effort to maintain the old binding seems gain a little. Signed-off-by: Yang Xiwen --- drivers/net/ethernet/hisilicon/hisi_femac.c | 77 +++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c index 2406263c9dd3..fedfc7219fad 100644 --- a/drivers/net/ethernet/hisilicon/hisi_femac.c +++ b/drivers/net/ethernet/hisilicon/hisi_femac.c @@ -10,8 +10,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -97,6 +99,13 @@ enum phy_reset_delays { DELAYS_NUM, }; +enum clk_type { + CLK_MAC, + CLK_MACIF, + CLK_PHY, + CLK_NUM, +}; + struct hisi_femac_queue { struct sk_buff **skb; dma_addr_t *dma_phys; @@ -108,7 +117,7 @@ struct hisi_femac_queue { struct hisi_femac_priv { void __iomem *port_base; void __iomem *glb_base; - struct clk *clk; + struct clk_bulk_data *clks; struct reset_control *mac_rst; struct reset_control *phy_rst; u32 phy_reset_delays[DELAYS_NUM]; @@ -116,6 +125,7 @@ struct hisi_femac_priv { struct device *dev; struct net_device *ndev; + struct platform_device *mdio_pdev; struct hisi_femac_queue txq; struct hisi_femac_queue rxq; @@ -693,6 +703,7 @@ static const struct net_device_ops hisi_femac_netdev_ops = { static void hisi_femac_core_reset(struct hisi_femac_priv *priv) { reset_control_assert(priv->mac_rst); + usleep_range(200, 300); reset_control_deassert(priv->mac_rst); } @@ -712,6 +723,10 @@ static void hisi_femac_sleep_us(u32 time_us) static void hisi_femac_phy_reset(struct hisi_femac_priv *priv) { + /* MAC clock must be disabled before PHY reset + */ + clk_disable(priv->clks[CLK_MAC].clk); + clk_disable(priv->clks[CLK_MACIF].clk); /* To make sure PHY hardware reset success, * we must keep PHY in deassert state first and * then complete the hardware reset operation @@ -727,6 +742,9 @@ static void hisi_femac_phy_reset(struct hisi_femac_priv *priv) reset_control_deassert(priv->phy_rst); /* delay some time to ensure later MDIO access */ hisi_femac_sleep_us(priv->phy_reset_delays[POST_DELAY]); + + clk_enable(priv->clks[CLK_MAC].clk); + clk_enable(priv->clks[CLK_MACIF].clk); } static void hisi_femac_port_init(struct hisi_femac_priv *priv) @@ -768,11 +786,12 @@ static void hisi_femac_port_init(struct hisi_femac_priv *priv) static int hisi_femac_drv_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *node = dev->of_node; + struct device_node *node = dev->of_node, *mdio_np; struct net_device *ndev; struct hisi_femac_priv *priv; struct phy_device *phy; int ret; + bool mdio_registered = false; ndev = alloc_etherdev(sizeof(*priv)); if (!ndev) @@ -797,23 +816,22 @@ static int hisi_femac_drv_probe(struct platform_device *pdev) goto out_free_netdev; } - priv->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(priv->clk)) { - dev_err(dev, "failed to get clk\n"); - ret = -ENODEV; + ret = devm_clk_bulk_get_all(&pdev->dev, &priv->clks); + if (ret < 0 || ret != CLK_NUM) { + dev_err(dev, "failed to get clk bulk: %d\n", ret); goto out_free_netdev; } - ret = clk_prepare_enable(priv->clk); + ret = clk_bulk_prepare_enable(CLK_NUM, priv->clks); if (ret) { - dev_err(dev, "failed to enable clk %d\n", ret); + dev_err(dev, "failed to enable clk bulk: %d\n", ret); goto out_free_netdev; } priv->mac_rst = devm_reset_control_get(dev, "mac"); if (IS_ERR(priv->mac_rst)) { ret = PTR_ERR(priv->mac_rst); - goto out_disable_clk; + goto out_free_netdev; } hisi_femac_core_reset(priv); @@ -826,15 +844,34 @@ static int hisi_femac_drv_probe(struct platform_device *pdev) priv->phy_reset_delays, DELAYS_NUM); if (ret) - goto out_disable_clk; + goto out_free_netdev; hisi_femac_phy_reset(priv); } + // Register the optional MDIO bus + for_each_available_child_of_node(node, mdio_np) { + if (of_node_name_prefix(mdio_np, "mdio")) { + priv->mdio_pdev = of_platform_device_create(mdio_np, NULL, dev); + of_node_put(mdio_np); + if (!priv->mdio_pdev) { + dev_err(dev, "failed to register MDIO bus device\n"); + ret = -ENODEV; + goto out_free_netdev; + } + mdio_registered = true; + break; + } + of_node_put(mdio_np); + } + + if (!mdio_registered) + dev_warn(dev, "MDIO subnode not found. This is usually a bug.\n"); + phy = of_phy_get_and_connect(ndev, node, hisi_femac_adjust_link); if (!phy) { dev_err(dev, "connect to PHY failed!\n"); ret = -ENODEV; - goto out_disable_clk; + goto out_unregister_mdio_bus; } phy_attached_print(phy, "phy_id=0x%.8lx, phy_mode=%s\n", @@ -885,8 +922,8 @@ static int hisi_femac_drv_probe(struct platform_device *pdev) out_disconnect_phy: netif_napi_del(&priv->napi); phy_disconnect(phy); -out_disable_clk: - clk_disable_unprepare(priv->clk); +out_unregister_mdio_bus: + platform_device_unregister(priv->mdio_pdev); out_free_netdev: free_netdev(ndev); @@ -902,7 +939,8 @@ static void hisi_femac_drv_remove(struct platform_device *pdev) unregister_netdev(ndev); phy_disconnect(ndev->phydev); - clk_disable_unprepare(priv->clk); + platform_device_unregister(priv->mdio_pdev); + clk_bulk_disable_unprepare(CLK_NUM, priv->clks); free_netdev(ndev); } @@ -919,7 +957,7 @@ static int hisi_femac_drv_suspend(struct platform_device *pdev, netif_device_detach(ndev); } - clk_disable_unprepare(priv->clk); + clk_bulk_disable_unprepare(CLK_NUM, priv->clks); return 0; } @@ -928,8 +966,14 @@ static int hisi_femac_drv_resume(struct platform_device *pdev) { struct net_device *ndev = platform_get_drvdata(pdev); struct hisi_femac_priv *priv = netdev_priv(ndev); + int ret; + + ret = clk_bulk_prepare_enable(CLK_NUM, priv->clks); + if (ret) { + dev_err(&pdev->dev, "failed to enable clk bulk: %d\n", ret); + return ret; + } - clk_prepare_enable(priv->clk); if (priv->phy_rst) hisi_femac_phy_reset(priv); @@ -948,6 +992,7 @@ static const struct of_device_id hisi_femac_match[] = { {.compatible = "hisilicon,hisi-femac-v1",}, {.compatible = "hisilicon,hisi-femac-v2",}, {.compatible = "hisilicon,hi3516cv300-femac",}, + {.compatible = "hisilicon,hi3798mv200-femac",}, {}, }; From patchwork Mon Feb 19 19:57:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xiwen via B4 Relay X-Patchwork-Id: 13563061 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3537251C58; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; cv=none; b=JCRcDVkoijOgMcyBrtlDa1k/mbcyUEWNTItvRL/5hMAWmgYu9VdsDeGGRlJtg/3VrFKCg63SQUVTUZgFl0kM5qkFiaKo2wqdkLgTh8so7Tg5g+TJD105dgYaa8lM5rRtaVUrmI8AKheT8zSUEigbb1tRT1iLdJhOwkLz6aRImTo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; c=relaxed/simple; bh=NKxyV19gwbx9qhToYre9J+jdVoGdX5i6pOifxN9cB7I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=s+2keNflEmeRutnQFd0UEmLhrJEEjltowej7Iy09noRtOC1NDVmhyAox0+AYzRyw6mNjlb7zMr9W3rVYl5H+WyByuS6xV3a/vQlS+URa/F08YVGwDU3OYCZT5jiU7Vwao4iNPZRZqLc1ZggPOxdfHGR2ZqO7FPY9GTByhVmSaS4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nSxgunJz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nSxgunJz" Received: by smtp.kernel.org (Postfix) with ESMTPS id CC4B2C43601; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708372656; bh=NKxyV19gwbx9qhToYre9J+jdVoGdX5i6pOifxN9cB7I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=nSxgunJzHkGo+TJhaIF8YAM5rBRJgxSVX39h9kh7X+nX5kB3QvmLIfOhiP6vOO5Gi hYFK9oL/52gPXdeQtrG2giHqXZBDsi7NPQMLrgBAva+cuCtYpuwF6dzQKdvOzGoIYF hqwcIwAQdWlXoFGrNuSORRpEHSXkIbj+jPOxsXr40G8MjxDMIkSY5p3e2vM8wyKWb8 RNAi9bP0JhFQFg8Mncaf3uDtVQuqwAdUDfpqta4qbt2uM+8MyWXbfAXcxcAsheLCb0 jCXiEkeeZiZSWuM4SoGR519yuDo1pmngGxvKswXafhmkoBTn1GqXG2i/APFWFlAmuR FnuYsFnCI0RGQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB7ECC5478A; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Tue, 20 Feb 2024 03:57:39 +0800 Subject: [PATCH net-next v3 4/6] net: hisi_femac: remove unused compatible strings Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-net-v3-4-b68e5b75e765@outlook.com> References: <20240220-net-v3-0-b68e5b75e765@outlook.com> In-Reply-To: <20240220-net-v3-0-b68e5b75e765@outlook.com> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Yang Xiwen X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708372656; l=1155; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=RJSzDAXs9gtmFQJrfvTCrO3aV7+qGbUSblDkcyuUubM=; b=m1oOPiZMcNEKky8GmEBCPkQ9kS3ZNzv7XNMAW87uVjK/yXDfvEUVVLlm4TUqyAvaZePjNQ4Z+ akmdulXx66dCMC7KDjgzC7ZHSnQO//XrrX4kRI1XzHpM03pi5GQbZi5 X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=qOD5jhp891/Xzc+H/PZ8LWVSWE3O/XCQnAg+5vdU2IU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20230724 with auth_id=67 X-Original-From: Yang Xiwen Reply-To: X-Patchwork-Delegate: kuba@kernel.org From: Yang Xiwen The only documented SoC Hi3516DV300 does not receive any updates from 8 years ago. With the recent driver changes, it unlikely works for this SoC anymore. Remove the binding for this SoC. Also it's hard to get the version number and it's unknown how the version can be used. Remove them until it's really needed. Signed-off-by: Yang Xiwen --- drivers/net/ethernet/hisilicon/hisi_femac.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c index fedfc7219fad..a5a7e0f5eb59 100644 --- a/drivers/net/ethernet/hisilicon/hisi_femac.c +++ b/drivers/net/ethernet/hisilicon/hisi_femac.c @@ -989,9 +989,7 @@ static int hisi_femac_drv_resume(struct platform_device *pdev) #endif static const struct of_device_id hisi_femac_match[] = { - {.compatible = "hisilicon,hisi-femac-v1",}, - {.compatible = "hisilicon,hisi-femac-v2",}, - {.compatible = "hisilicon,hi3516cv300-femac",}, + {.compatible = "hisilicon,hisi-femac",}, {.compatible = "hisilicon,hi3798mv200-femac",}, {}, }; From patchwork Mon Feb 19 19:57:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xiwen via B4 Relay X-Patchwork-Id: 13563062 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40AB851C5F; Mon, 19 Feb 2024 19:57:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; cv=none; b=GXhLBVTxCXWW4pDE/tmqwPmUexmrI8Uy5ZluPhZhmnVo471a7Jh8olanSk97z7z1LMum4F+ZYgSJ4iEOx4hQKPVBMwyHYsFdnq87vNcl1SXJ5up+nm3+TtNPex0q0eKN5OYTjyt0jkBXTjisZhdrW4m73m+402jVt9T31ClbzwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; c=relaxed/simple; bh=q5PGMNCy5OeIZklkcuyegUf5HBFFBndhdfq9OggdzzY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YOP2Z5G1sWEjkRDKNTyFhbwVemtpHJvDEcTju8lrxRPuLaIPV8NfLyeXABkwZjLmLM6YsPuNN3LAQsWYD6KVUQzVCwdkFYRMuq7hV7rLaxz/jQ19A9nenyj4N3MZe9E/oVmtgzYDOtk/ctt0OoZqVOab2gRdNucQipgIbf/lCac= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nkVEY9La; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nkVEY9La" Received: by smtp.kernel.org (Postfix) with ESMTPS id DBA58C4166D; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708372656; bh=q5PGMNCy5OeIZklkcuyegUf5HBFFBndhdfq9OggdzzY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=nkVEY9LaIlxS3WVeu0G4M0B2XB2sb9rcWc0rHZ2FUPfrB3tdmlWbvePsXSsKH+zDe 4+C6zXVv3KPJMmwI4eyNuE2iNMdUsPa67gtJzdf+J5bbWp9ZF/YBnGCYiufnj7Ga94 ohT76MOfH9xN/Bc2LO+WymM56Bu2bEE55/r3hdS/jT8oxqFP40c0biS+frpETmIW0p vv7mYrrxbTGkWrV1TtEzH+NPgHYs5rJzeUTzdXD/3tkB7OYDs4tMKeYgoehA+HuHGh xvY/HGzTTIsH0EQ4PeS2cHr14VEdJFSILGpqYrImu6bmUqBDATzDD2iJnuZPVoELSK GSIL0Mnc51DUQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAAF6C54788; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Tue, 20 Feb 2024 03:57:40 +0800 Subject: [PATCH net-next v3 5/6] dt-bindings: net: remove outdated hisilicon-femac Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-net-v3-5-b68e5b75e765@outlook.com> References: <20240220-net-v3-0-b68e5b75e765@outlook.com> In-Reply-To: <20240220-net-v3-0-b68e5b75e765@outlook.com> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Yang Xiwen X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708372656; l=2357; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=8ICAnSLBv8dPhcTYWVHR0AJKAQbZebLk5c3PYvX8hqQ=; b=VrZqYesFvqdVmS6WFK2JcWZQo4rtXK9rFtnmfdbnzM4xi7kqzWIE0VDBc90WLdXXGoMkBBhYt jSj2+nKJNDjBYBnH1z7ZaEmhNTrnScBiyHlabDtZQkgMgEy6iAlQRQh X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=qOD5jhp891/Xzc+H/PZ8LWVSWE3O/XCQnAg+5vdU2IU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20230724 with auth_id=67 X-Original-From: Yang Xiwen Reply-To: X-Patchwork-Delegate: kuba@kernel.org From: Yang Xiwen The user documented(Hi3516) is not found in current kernel anymore. And it seems this SoC has been EOL for a long time. While at it, Remove this binding entirely due to recent driver changes. Signed-off-by: Yang Xiwen --- .../devicetree/bindings/net/hisilicon-femac.txt | 41 ---------------------- 1 file changed, 41 deletions(-) diff --git a/Documentation/devicetree/bindings/net/hisilicon-femac.txt b/Documentation/devicetree/bindings/net/hisilicon-femac.txt deleted file mode 100644 index 5f96976f3cea..000000000000 --- a/Documentation/devicetree/bindings/net/hisilicon-femac.txt +++ /dev/null @@ -1,41 +0,0 @@ -Hisilicon Fast Ethernet MAC controller - -Required properties: -- compatible: should contain one of the following version strings: - * "hisilicon,hisi-femac-v1" - * "hisilicon,hisi-femac-v2" - and the soc string "hisilicon,hi3516cv300-femac". -- reg: specifies base physical address(s) and size of the device registers. - The first region is the MAC core register base and size. - The second region is the global MAC control register. -- interrupts: should contain the MAC interrupt. -- clocks: A phandle to the MAC main clock. -- resets: should contain the phandle to the MAC reset signal(required) and - the PHY reset signal(optional). -- reset-names: should contain the reset signal name "mac"(required) - and "phy"(optional). -- phy-mode: see ethernet.txt [1]. -- phy-handle: see ethernet.txt [1]. -- hisilicon,phy-reset-delays-us: triplet of delays if PHY reset signal given. - The 1st cell is reset pre-delay in micro seconds. - The 2nd cell is reset pulse in micro seconds. - The 3rd cell is reset post-delay in micro seconds. - -The MAC address will be determined using the optional properties -defined in ethernet.txt[1]. - -[1] Documentation/devicetree/bindings/net/ethernet.txt - -Example: - hisi_femac: ethernet@10090000 { - compatible = "hisilicon,hi3516cv300-femac","hisilicon,hisi-femac-v2"; - reg = <0x10090000 0x1000>,<0x10091300 0x200>; - interrupts = <12>; - clocks = <&crg HI3518EV200_ETH_CLK>; - resets = <&crg 0xec 0>,<&crg 0xec 3>; - reset-names = "mac","phy"; - mac-address = [00 00 00 00 00 00]; - phy-mode = "mii"; - phy-handle = <&phy0>; - hisilicon,phy-reset-delays-us = <10000 20000 20000>; - }; From patchwork Mon Feb 19 19:57:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xiwen via B4 Relay X-Patchwork-Id: 13563058 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E3DC51C2C; Mon, 19 Feb 2024 19:57:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; cv=none; b=HdIANu/hHrAt/b++nUir8TlXFvT21xv6ia7Kpm+jRm57/4teHL5njZvxE+GkkPHl9mX6OYoxNQhaoWM7kr0scXXmNT/P8uMcobIpu7o/rhvXdhQlorgUArzw6ixWYQIAV97MnwA1iQFrT78pE0kfRip/fZHN3ulpgzncpEoJE1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708372657; c=relaxed/simple; bh=9aIghlxeqzChANrPfA2YpDKFNRonntQEBzqWAmC5jDk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Gs/h0kGvtNJco0uK29OOJqXI36zg4G7CeHwsJ5oWLtQoZ/grU8mkIRaQAwdBRzfwX1eB5bzLqTdLh0ZUojKKPc4aJof1JaWOKbRiwyqPxPYjLkr74mPViMawaqUUNDKCD68zPGvK1tfvUj3vCbf5vfYkC5KwhThiTY4SZ0hWNng= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lqCbaPoA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lqCbaPoA" Received: by smtp.kernel.org (Postfix) with ESMTPS id E78E0C41674; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708372657; bh=9aIghlxeqzChANrPfA2YpDKFNRonntQEBzqWAmC5jDk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=lqCbaPoAsBp7fxpk86/VA5iNC0rEGT556w8oekvxYWdDM7oHHpLEA8i2dL6pb6+Oy f4NuVo7qLCGN3thw4a2otJShagKtKpODFZ87ZcSTI/MnUyR3XSxNJ9wkZuydTV3ERn H1QnbQpAS/FD7PSF134YSu73Qtz5Tk6RibjF6KE/wXY7DvLGWVtMvbx40qFWiu4UqL Ma371OHwdw2sCBVvXoa90L8dsgYy3w8ffILLRB5ssoJDUDk9/hH4B0slVGLRi6ZbXP Le/Bp6+Sx6NESFkOhdmwO0MRcCS8WrCLmEwDXBiHx/A43n2i3Yq0pLzkj3vVZmRH1W RfuG4GpTrmA2w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D67B8C54764; Mon, 19 Feb 2024 19:57:36 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Tue, 20 Feb 2024 03:57:41 +0800 Subject: [PATCH net-next v3 6/6] dt-bindings: net: add hisilicon,hisi-femac Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240220-net-v3-6-b68e5b75e765@outlook.com> References: <20240220-net-v3-0-b68e5b75e765@outlook.com> In-Reply-To: <20240220-net-v3-0-b68e5b75e765@outlook.com> To: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrew Lunn , Heiner Kallweit , Russell King Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Yang Xiwen X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708372656; l=3915; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=Nts7rFC7ZJnOR4Zjj/ZOJP7dSjglr6qAZxoBphrP6Qs=; b=lKbGXB7F16qjB+dIqsrXXeb6lpS0Agnowg7HTPRq4IHnFat3Yje5aVFPHgw61R88LAwRCaNnM ja1UYPt7E14ArZynJWqZuu7lW4blGojCXiQ12R1FNXhO0aI5xCEgMMx X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=qOD5jhp891/Xzc+H/PZ8LWVSWE3O/XCQnAg+5vdU2IU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20230724 with auth_id=67 X-Original-From: Yang Xiwen Reply-To: X-Patchwork-Delegate: kuba@kernel.org From: Yang Xiwen Compared to previous txt based binding doc, the following changes are made according to the TRM: - Remove unmaintained Hi3516 SoC, add Hi3798MV200 - add MDIO subnode, because MDIO bus is integrated - add ahb bus clock, phy clock and reset Also remove "hisi-femac-v1/2" binding. The difference between versions is unknown and not documented anywhere. Nor is it used in driver. Remove it until it's needed in the future. Signed-off-by: Yang Xiwen --- .../bindings/net/hisilicon,hisi-femac.yaml | 117 +++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/Documentation/devicetree/bindings/net/hisilicon,hisi-femac.yaml b/Documentation/devicetree/bindings/net/hisilicon,hisi-femac.yaml new file mode 100644 index 000000000000..08158118c9c4 --- /dev/null +++ b/Documentation/devicetree/bindings/net/hisilicon,hisi-femac.yaml @@ -0,0 +1,117 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/hisilicon,hisi-femac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Hisilicon Fast Ethernet MAC controller + +maintainers: + - Yang Xiwen + +allOf: + - $ref: ethernet-controller.yaml + +properties: + compatible: + items: + - enum: + - hisilicon,hi3798mv200-femac + - const: hisilicon,hisi-femac + + reg: + items: + - description: The first region is the MAC core register base and size. + - description: The second region is the global MAC control register. + + ranges: + maxItems: 1 + + '#address-cells': + const: 1 + + '#size-cells': + const: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 3 + + clock-names: + items: + - const: mac + - const: macif + - const: phy + + resets: + maxItems: 2 + + reset-names: + items: + - const: mac + - const: phy + + hisilicon,phy-reset-delays-us: + items: + - description: The 1st cell is reset pre-delay in micro seconds. + - description: The 2nd cell is reset pulse in micro seconds. + - description: The 3rd cell is reset post-delay in micro seconds. + +patternProperties: + '^mdio@[0-9a-f]+$': + $ref: hisilicon,hisi-femac-mdio.yaml# + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - resets + - reset-names + - phy-connection-type + - phy-handle + - hisilicon,phy-reset-delays-us + +unevaluatedProperties: false + +examples: + - | + #include + #include + + ethernet@9c30000 { + compatible = "hisilicon,hi3798mv200-femac", "hisilicon,hisi-femac"; + reg = <0x9c30000 0x1000>, <0x9c31300 0x200>; + ranges = <0x0 0x9c30000 0x10000>; + #address-cells = <1>; + #size-cells = <1>; + interrupts = ; + clocks = <&crg HISTB_ETH0_MAC_CLK>, + <&crg HISTB_ETH0_MACIF_CLK>, + <&crg 62>; + clock-names = "mac", "macif", "phy"; + resets = <&crg 0xd0 3>, <&crg 0x388 4>; + reset-names = "mac", "phy"; + phy-handle = <&fephy>; + phy-connection-type = "mii"; + // To be filled by bootloader + mac-address = [00 00 00 00 00 00]; + hisilicon,phy-reset-delays-us = <10000 10000 500000>; + status = "okay"; + + mdio@1100 { + compatible = "hisilicon,hisi-femac-mdio"; + reg = <0x1100 0x20>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + ethernet-phy@1 { + reg = <1>; + #phy-cells = <0>; + }; + }; + };