From patchwork Fri Dec 16 07:06:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yanhong wang X-Patchwork-Id: 13074813 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6DCDAC4167B for ; Fri, 16 Dec 2022 07:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EdkZymSYEGQyF9KCN9j4FltqdJrK6kdWax0YaLs+abI=; b=G0VLczPrLc5fiV JUQVZ5P60x6dtXgTgoNXV9cNr61XjBID2bGKv6NczxPXgSpff/Qm1Vm+1OYNXHzB/91YQfpNyc/YN ye/NOycmSr+ub3Y6GMD4MG8/es3AJ3grbsOONOGFC5YAj8FYFS3b8en12g23fqCPZUmOKFLz2Mwre r7CRNu0RRyeLUgdDjoIIJibiykc8h4xEzl0BxLFZ1aiAtHe7jlv2TDcD1ohFmBKX5JT3FldnR6CpT RPq4XPxS9kWbJmhyNOa4mLHZV6vitvKR7YVyineHDpmYp49I+8Wd0SFYZn1RORzfvnAgkMkUPHWPp TbGBOpbsNZNLT1WH2iHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nc-00DJRS-21; Fri, 16 Dec 2022 07:06:28 +0000 Received: from ex01.ufhost.com ([61.152.239.75]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nZ-00DJDf-1t for linux-riscv@lists.infradead.org; Fri, 16 Dec 2022 07:06:26 +0000 Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id EA1D124E24B; Fri, 16 Dec 2022 15:05:38 +0800 (CST) Received: from EXMBX173.cuchost.com (172.16.6.93) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:39 +0800 Received: from wyh-VirtualBox.starfivetech.com (171.223.208.138) by EXMBX173.cuchost.com (172.16.6.93) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:37 +0800 From: Yanhong Wang To: , , , CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Richard Cochran , Andrew Lunn , Heiner Kallweit , Peter Geis , Yanhong Wang Subject: [PATCH v2 1/9] dt-bindings: net: snps,dwmac: Add dwmac-5.20 version Date: Fri, 16 Dec 2022 15:06:24 +0800 Message-ID: <20221216070632.11444-2-yanhong.wang@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221216070632.11444-1-yanhong.wang@starfivetech.com> References: <20221216070632.11444-1-yanhong.wang@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS064.cuchost.com (172.16.6.24) To EXMBX173.cuchost.com (172.16.6.93) X-YovoleRuleAgent: yovoleflag X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221215_230625_262414_ADE6DD12 X-CRM114-Status: UNSURE ( 8.24 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Emil Renner Berthing Add dwmac-5.20 IP version to snps.dwmac.yaml Signed-off-by: Emil Renner Berthing Signed-off-by: Yanhong Wang --- Documentation/devicetree/bindings/net/snps,dwmac.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index 13b984076af5..e26c3e76ebb7 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -30,6 +30,7 @@ select: - snps,dwmac-4.10a - snps,dwmac-4.20a - snps,dwmac-5.10a + - snps,dwmac-5.20 - snps,dwxgmac - snps,dwxgmac-2.10 @@ -87,6 +88,7 @@ properties: - snps,dwmac-4.10a - snps,dwmac-4.20a - snps,dwmac-5.10a + - snps,dwmac-5.20 - snps,dwxgmac - snps,dwxgmac-2.10 @@ -393,6 +395,7 @@ allOf: - snps,dwmac-3.50a - snps,dwmac-4.10a - snps,dwmac-4.20a + - snps,dwmac-5.20 - snps,dwxgmac - snps,dwxgmac-2.10 - st,spear600-gmac @@ -447,6 +450,7 @@ allOf: - snps,dwmac-4.10a - snps,dwmac-4.20a - snps,dwmac-5.10a + - snps,dwmac-5.20 - snps,dwxgmac - snps,dwxgmac-2.10 - st,spear600-gmac From patchwork Fri Dec 16 07:06:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yanhong wang X-Patchwork-Id: 13074812 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B4DCC4332F for ; Fri, 16 Dec 2022 07:06:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DhcaTFSuS9gnobgTOhKMspvfjNWqvgAf2w2Xpck7bFM=; b=u9luoI38QHMJpf i/DXy5K5lZhBNw3N8wWr11gUNeI3Gk5XGacr1930JsoPvOUgJ/ojkdwwCJmlPFWkCkL4Nq8FEWgb9 Og1Ej6um0uIvctJ83EoWua9Ns3Mf18fQ8iaIVLYSpq3tExzUi6LeJKJUPUzLu1D77SVXFA2EcbyOI aBnFskW62w2p+SiaHgZYcKx1bcf21DvPy00K9Vmc9He5i9EWTuff07S92EqsnR1H5YykY8r6wAs9a Si/1dOihP+UUiXYo75gwp1288FuESftrZxRixTsH20Vtu/HXwNMK+rZHK+QptIntCB+CHyU8Ig47K drvmSxLVLRf0MC5v51yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64na-00DJPj-0K; Fri, 16 Dec 2022 07:06:26 +0000 Received: from ex01.ufhost.com ([61.152.239.75]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nU-00DJDc-Cj for linux-riscv@lists.infradead.org; Fri, 16 Dec 2022 07:06:22 +0000 Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id DEDCD24E250; Fri, 16 Dec 2022 15:05:39 +0800 (CST) Received: from EXMBX173.cuchost.com (172.16.6.93) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:40 +0800 Received: from wyh-VirtualBox.starfivetech.com (171.223.208.138) by EXMBX173.cuchost.com (172.16.6.93) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:38 +0800 From: Yanhong Wang To: , , , CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Richard Cochran , Andrew Lunn , Heiner Kallweit , Peter Geis , Yanhong Wang Subject: [PATCH v2 2/9] dt-bindings: net: snps,dwmac: Update the maxitems number of resets and reset-names Date: Fri, 16 Dec 2022 15:06:25 +0800 Message-ID: <20221216070632.11444-3-yanhong.wang@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221216070632.11444-1-yanhong.wang@starfivetech.com> References: <20221216070632.11444-1-yanhong.wang@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS064.cuchost.com (172.16.6.24) To EXMBX173.cuchost.com (172.16.6.93) X-YovoleRuleAgent: yovoleflag X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221215_230620_604712_E9960EBB X-CRM114-Status: UNSURE ( 8.94 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Some boards(such as StarFive VisionFive v2) require more than one value which defined by resets property, so the original definition can not meet the requirements. In order to adapt to different requirements, adjust the maxitems number from 1 to 3.. Signed-off-by: Yanhong Wang --- .../devicetree/bindings/net/snps,dwmac.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index e26c3e76ebb7..7870228b4cd3 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -133,12 +133,19 @@ properties: - ptp_ref resets: - maxItems: 1 - description: - MAC Reset signal. + minItems: 1 + maxItems: 3 + additionalItems: true + items: + - description: MAC Reset signal reset-names: - const: stmmaceth + minItems: 1 + maxItems: 3 + additionalItems: true + contains: + enum: + - stmmaceth power-domains: maxItems: 1 From patchwork Fri Dec 16 07:06:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yanhong wang X-Patchwork-Id: 13074811 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42500C4167B for ; Fri, 16 Dec 2022 07:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UZn/QnVW8m2Xm5hmGuyinaSfs5BiX9hcKeQXqBajdt4=; b=J16HFe+t6JPnTA 6CcI2gqXbUMxW37Id7AU7eknREDMjk2Hr5UuJK94VPzSbbq0xo1x48V0x01tM1c5Oi9oi7xvajFEr 6LdAlPt5pKclE6IvLAFqls2TOwFmQpevqxgsDUYVC+iqVNl2D/FBaPZJzxDBe4vdd1dgICmQqS16F KJmzAQXo8MhThxzzru/xV2uaQHVTb4fetzBqETcqe82skXAIDV0fktvIPA6wWchKbtnhaXox0qRD2 R3Du5zG6Zo6pXK1t72m3fJ4rv0tF071wINlY1iZEOfzQt7LetCuYNBmb+1axPbV0ov23XEH7izWh8 8cl6UL7QXuIrUAMvIUkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nY-00DJOJ-6m; Fri, 16 Dec 2022 07:06:24 +0000 Received: from fd01.gateway.ufhost.com ([61.152.239.71]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nT-00DJDM-J5 for linux-riscv@lists.infradead.org; Fri, 16 Dec 2022 07:06:20 +0000 Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id B694924E355; Fri, 16 Dec 2022 15:05:40 +0800 (CST) Received: from EXMBX173.cuchost.com (172.16.6.93) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:40 +0800 Received: from wyh-VirtualBox.starfivetech.com (171.223.208.138) by EXMBX173.cuchost.com (172.16.6.93) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:39 +0800 From: Yanhong Wang To: , , , CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Richard Cochran , Andrew Lunn , Heiner Kallweit , Peter Geis , Yanhong Wang Subject: [PATCH v2 3/9] net: stmmac: platform: Add snps,dwmac-5.20 IP compatible string Date: Fri, 16 Dec 2022 15:06:26 +0800 Message-ID: <20221216070632.11444-4-yanhong.wang@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221216070632.11444-1-yanhong.wang@starfivetech.com> References: <20221216070632.11444-1-yanhong.wang@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS064.cuchost.com (172.16.6.24) To EXMBX173.cuchost.com (172.16.6.93) X-YovoleRuleAgent: yovoleflag X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221215_230619_838982_B3328BD7 X-CRM114-Status: GOOD ( 10.64 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Emil Renner Berthing Add "snps,dwmac-5.20" compatible string for 5.20 version that can avoid to define some platform data in the glue layer. Signed-off-by: Emil Renner Berthing Signed-off-by: Yanhong Wang --- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 50f6b4a14be4..cc3b701af802 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -519,7 +519,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) if (of_device_is_compatible(np, "snps,dwmac-4.00") || of_device_is_compatible(np, "snps,dwmac-4.10a") || of_device_is_compatible(np, "snps,dwmac-4.20a") || - of_device_is_compatible(np, "snps,dwmac-5.10a")) { + of_device_is_compatible(np, "snps,dwmac-5.10a") || + of_device_is_compatible(np, "snps,dwmac-5.20")) { plat->has_gmac4 = 1; plat->has_gmac = 0; plat->pmt = 1; From patchwork Fri Dec 16 07:06:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yanhong wang X-Patchwork-Id: 13074809 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6033C4332F for ; Fri, 16 Dec 2022 07:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dls4mGQ4aZ4Bk6Xg/SJT3Eal8M762uQ2v7VUMpIBSnM=; b=xEcdfX+HFjVOow spCUzyOyx3dbqXzGbdUwop9Mvx3RX9FplueUXnLoM3++sxAtc2TZ62mTuEzF16eQoy4yHUQqpaNOz ucRbIN83a9Vq8cw7JYKX5aCQYSSEk43b2OXUAnLqNx/n3O1aHfQc0cKLUPlBpVydHDz9zPeYNZOyd RP+SxQSXNWEYzTbSFNfwYHVHxwSBt8CjmdnWlLGl9qVRZh0U1j01lhDEpmk/w5/qqlhw/T4FJgLxs Oxa12MJ6FiayZpASD+xnzV8PQc/ZiVjm15ySY3mYnZ6uX4fO8V5GjFxDts3dvhiRuTjea8yZ1TbvH dhZwqSh1uZlQLHw7c02g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nS-00DJL6-TN; Fri, 16 Dec 2022 07:06:18 +0000 Received: from fd01.gateway.ufhost.com ([61.152.239.71]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nL-00DJDG-6M for linux-riscv@lists.infradead.org; Fri, 16 Dec 2022 07:06:14 +0000 Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id AED8C24E38B; Fri, 16 Dec 2022 15:05:41 +0800 (CST) Received: from EXMBX173.cuchost.com (172.16.6.93) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:41 +0800 Received: from wyh-VirtualBox.starfivetech.com (171.223.208.138) by EXMBX173.cuchost.com (172.16.6.93) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:40 +0800 From: Yanhong Wang To: , , , CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Richard Cochran , Andrew Lunn , Heiner Kallweit , Peter Geis , Yanhong Wang Subject: [PATCH v2 4/9] dt-bindings: net: Add bindings for StarFive dwmac Date: Fri, 16 Dec 2022 15:06:27 +0800 Message-ID: <20221216070632.11444-5-yanhong.wang@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221216070632.11444-1-yanhong.wang@starfivetech.com> References: <20221216070632.11444-1-yanhong.wang@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS064.cuchost.com (172.16.6.24) To EXMBX173.cuchost.com (172.16.6.93) X-YovoleRuleAgent: yovoleflag X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221215_230611_574994_E0153C6C X-CRM114-Status: GOOD ( 14.34 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add documentation to describe StarFive dwmac driver(GMAC). Signed-off-by: Yanhong Wang --- .../devicetree/bindings/net/snps,dwmac.yaml | 1 + .../bindings/net/starfive,jh71x0-dwmac.yaml | 103 ++++++++++++++++++ MAINTAINERS | 5 + 3 files changed, 109 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/starfive,jh71x0-dwmac.yaml diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index 7870228b4cd3..cdb045d1c618 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -91,6 +91,7 @@ properties: - snps,dwmac-5.20 - snps,dwxgmac - snps,dwxgmac-2.10 + - starfive,jh7110-dwmac reg: minItems: 1 diff --git a/Documentation/devicetree/bindings/net/starfive,jh71x0-dwmac.yaml b/Documentation/devicetree/bindings/net/starfive,jh71x0-dwmac.yaml new file mode 100644 index 000000000000..5cb1272fe959 --- /dev/null +++ b/Documentation/devicetree/bindings/net/starfive,jh71x0-dwmac.yaml @@ -0,0 +1,103 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2022 StarFive Technology Co., Ltd. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/starfive,jh71x0-dwmac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: StarFive JH71x0 DWMAC glue layer + +maintainers: + - Yanhong Wang + +select: + properties: + compatible: + contains: + enum: + - starfive,jh7110-dwmac + required: + - compatible + +allOf: + - $ref: snps,dwmac.yaml# + +properties: + compatible: + items: + - enum: + - starfive,jh7110-dwmac + - const: snps,dwmac-5.20 + + clocks: + items: + - description: GMAC main clock + - description: GMAC AHB clock + - description: PTP clock + - description: TX clock + - description: GTXC clock + - description: GTX clock + + clock-names: + items: + - const: stmmaceth + - const: pclk + - const: ptp_ref + - const: tx + - const: gtxc + - const: gtx + +required: + - compatible + - clocks + - clock-names + - resets + - reset-names + +unevaluatedProperties: false + +examples: + - | + stmmac_axi_setup: stmmac-axi-config { + snps,lpi_en; + snps,wr_osr_lmt = <4>; + snps,rd_osr_lmt = <4>; + snps,blen = <256 128 64 32 0 0 0>; + }; + + gmac0: ethernet@16030000 { + compatible = "starfive,jh7110-dwmac", "snps,dwmac-5.20"; + reg = <0x16030000 0x10000>; + clocks = <&clk 3>, <&clk 2>, <&clk 109>, + <&clk 5>, <&clk 111>, <&clk 108>; + clock-names = "stmmaceth", "pclk", "ptp_ref", + "tx", "gtxc", "gtx"; + resets = <&rst 1>, <&rst 2>; + reset-names = "stmmaceth", "ahb"; + interrupts = <7>, <6>, <5>; + interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; + phy-mode = "rgmii-id"; + snps,multicast-filter-bins = <64>; + snps,perfect-filter-entries = <8>; + rx-fifo-depth = <2048>; + tx-fifo-depth = <2048>; + snps,fixed-burst; + snps,no-pbl-x8; + snps,tso; + snps,force_thresh_dma_mode; + snps,axi-config = <&stmmac_axi_setup>; + snps,en-tx-lpi-clockgating; + snps,txpbl = <16>; + snps,rxpbl = <16>; + phy-handle = <&phy0>; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + compatible = "snps,dwmac-mdio"; + + phy0: ethernet-phy@0 { + reg = <0>; + }; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index a70c1d0f303e..166b0009f63c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19606,6 +19606,11 @@ F: Documentation/devicetree/bindings/clock/starfive* F: drivers/clk/starfive/ F: include/dt-bindings/clock/starfive* +STARFIVE DWMAC GLUE LAYER +M: Yanhong Wang +S: Maintained +F: Documentation/devicetree/bindings/net/starfive,jh71x0-dwmac.yaml + STARFIVE PINCTRL DRIVER M: Emil Renner Berthing M: Jianlong Huang From patchwork Fri Dec 16 07:06:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yanhong wang X-Patchwork-Id: 13074810 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E9EDC001B2 for ; Fri, 16 Dec 2022 07:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aORsrjSNcfpOJrFIJ77h5FbfgEY26SoAIELYCZpmIQw=; b=fNxDm3+JF4mO9V rZrYWgtG2igqjkDhBNYIrRUmfJMu+0FSGvaTXiIcpaKJszQqHUKvlsYFfxyWPVjzCyKyP6btcWFno l97npG7PVTXROaqej2nTObFW/7HxdJScxee3HwAr4dbI6sqBvlVtMSjpSi/kgdXVxNnnqNuZ/6ob4 ++LISCEj7skK7cKw1VQHmuj+V8BWwpRvX9VrkUZRtI5HEp06tDBxN71OQg3nG9GGlAjTMV5aH/HYc JPEfbE8vRdKCqZL+IuW4uWSYjZh6In6Wfrc9UPCam5V8K1VZnoV1HwJwgxEedBkVoiMsSRCJTQjj5 4mWmuffYQP6HyAPXK46A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nW-00DJNU-Nv; Fri, 16 Dec 2022 07:06:22 +0000 Received: from ex01.ufhost.com ([61.152.239.75]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nS-00DJDb-M4 for linux-riscv@lists.infradead.org; Fri, 16 Dec 2022 07:06:20 +0000 Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 9958224E205; Fri, 16 Dec 2022 15:05:42 +0800 (CST) Received: from EXMBX173.cuchost.com (172.16.6.93) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:42 +0800 Received: from wyh-VirtualBox.starfivetech.com (171.223.208.138) by EXMBX173.cuchost.com (172.16.6.93) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:41 +0800 From: Yanhong Wang To: , , , CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Richard Cochran , Andrew Lunn , Heiner Kallweit , Peter Geis , Yanhong Wang Subject: [PATCH v2 5/9] dt-bindings: net: motorcomm: add support for Motorcomm YT8531 Date: Fri, 16 Dec 2022 15:06:28 +0800 Message-ID: <20221216070632.11444-6-yanhong.wang@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221216070632.11444-1-yanhong.wang@starfivetech.com> References: <20221216070632.11444-1-yanhong.wang@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS064.cuchost.com (172.16.6.24) To EXMBX173.cuchost.com (172.16.6.93) X-YovoleRuleAgent: yovoleflag X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221215_230619_084271_B94D2BF2 X-CRM114-Status: GOOD ( 17.69 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add support for Motorcomm Technology YT8531 10/100/1000 Ethernet PHY. The document describe details of clock delay train configuration. Signed-off-by: Yanhong Wang --- .../bindings/net/motorcomm,yt8531.yaml | 111 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 112 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/motorcomm,yt8531.yaml diff --git a/Documentation/devicetree/bindings/net/motorcomm,yt8531.yaml b/Documentation/devicetree/bindings/net/motorcomm,yt8531.yaml new file mode 100644 index 000000000000..c5b8a09a78bb --- /dev/null +++ b/Documentation/devicetree/bindings/net/motorcomm,yt8531.yaml @@ -0,0 +1,111 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/motorcomm,yt8531.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Motorcomm YT8531 Gigabit Ethernet PHY + +maintainers: + - Yanhong Wang + +select: + properties: + $nodename: + pattern: "^ethernet-phy(@[a-f0-9]+)?$" + + required: + - $nodename + +properties: + $nodename: + pattern: "^ethernet-phy(@[a-f0-9]+)?$" + + reg: + minimum: 0 + maximum: 31 + description: + The ID number for the PHY. + + rxc_dly_en: + description: | + RGMII Receive PHY Clock Delay defined with fixed 2ns.This is used for + PHY that have configurable RX internal delays. If this property set + to 1, then automatically add 2ns delay pad for Receive PHY clock. + enum: [0, 1] + default: 0 + + rx_delay_sel: + description: | + This is supplement to rxc_dly_en property,and it can + be specified in 150ps(pico seconds) steps. The effective + delay is: 150ps * N. + minimum: 0 + maximum: 15 + default: 0 + + tx_delay_sel_fe: + description: | + RGMII Transmit PHY Clock Delay defined in pico seconds.This is used for + PHY's that have configurable TX internal delays when speed is 100Mbps + or 10Mbps. It can be specified in 150ps steps, the effective delay + is: 150ps * N. + minimum: 0 + maximum: 15 + default: 15 + + tx_delay_sel: + description: | + RGMII Transmit PHY Clock Delay defined in pico seconds.This is used for + PHY's that have configurable TX internal delays when speed is 1000Mbps. + It can be specified in 150ps steps, the effective delay is: 150ps * N. + minimum: 0 + maximum: 15 + default: 1 + + tx_inverted_10: + description: | + Use original or inverted RGMII Transmit PHY Clock to drive the RGMII + Transmit PHY Clock delay train configuration when speed is 10Mbps. + 0: original 1: inverted + enum: [0, 1] + default: 0 + + tx_inverted_100: + description: | + Use original or inverted RGMII Transmit PHY Clock to drive the RGMII + Transmit PHY Clock delay train configuration when speed is 100Mbps. + 0: original 1: inverted + enum: [0, 1] + default: 0 + + tx_inverted_1000: + description: | + Use original or inverted RGMII Transmit PHY Clock to drive the RGMII + Transmit PHY Clock delay train configuration when speed is 1000Mbps. + 0: original 1: inverted + enum: [0, 1] + default: 0 + +required: + - reg + +additionalProperties: true + +examples: + - | + ethernet { + #address-cells = <1>; + #size-cells = <0>; + + ethernet-phy@0 { + reg = <0>; + + rxc_dly_en = <1>; + tx_delay_sel_fe = <5>; + tx_delay_sel = <0xa>; + tx_inverted_10 = <0x1>; + tx_inverted_100 = <0x1>; + tx_inverted_1000 = <0x1>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 166b0009f63c..1ff68b8524d2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19609,6 +19609,7 @@ F: include/dt-bindings/clock/starfive* STARFIVE DWMAC GLUE LAYER M: Yanhong Wang S: Maintained +F: Documentation/devicetree/bindings/net/motorcomm,yt8531.yaml F: Documentation/devicetree/bindings/net/starfive,jh71x0-dwmac.yaml STARFIVE PINCTRL DRIVER From patchwork Fri Dec 16 07:06:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yanhong wang X-Patchwork-Id: 13074816 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DE6A8C4167B for ; Fri, 16 Dec 2022 07:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LJ6NRw/mNC1VzsaDUiHAZdyCAWeUvbTfOt7MQNTuHc8=; b=jiAS5/vi6mWIR8 5667yRFhv4pWSuFO3ul0VkrLEEFoQuYW0Ye4H5p0g23H+KM9ZMiQQz8X6veM32sigwsB5EqMSMfE9 ZxXXHC/kq8m3UMqWDWBCoNc3D8Y7SvGM2VBHpgTcf41t5npnQqpsRkC+pgRS9UL0WWA/uHlQvCmcI pb/eylkl9Maq4b+Cp5crYmShTFBpk0AxC5BAD4i/8q8/CNghQl37Cf9T70t4RS8D/6IuChdUI+Hch Gz/6gYnSZxS9RuQywnOOJ2SsTLVOR3YvIiUwgs0s/e4H3kiNH6Zk4OWrerFQB53zFYjmy42q2tVkQ OP/HCiYr/hbXu65Hur3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64ni-00DJX0-NS; Fri, 16 Dec 2022 07:06:34 +0000 Received: from ex01.ufhost.com ([61.152.239.75]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nZ-00DJDe-0y for linux-riscv@lists.infradead.org; Fri, 16 Dec 2022 07:06:28 +0000 Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 8F59024E251; Fri, 16 Dec 2022 15:05:43 +0800 (CST) Received: from EXMBX173.cuchost.com (172.16.6.93) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:43 +0800 Received: from wyh-VirtualBox.starfivetech.com (171.223.208.138) by EXMBX173.cuchost.com (172.16.6.93) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:42 +0800 From: Yanhong Wang To: , , , CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Richard Cochran , Andrew Lunn , Heiner Kallweit , Peter Geis , Yanhong Wang Subject: [PATCH v2 6/9] net: phy: motorcomm: Add YT8531 phy support Date: Fri, 16 Dec 2022 15:06:29 +0800 Message-ID: <20221216070632.11444-7-yanhong.wang@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221216070632.11444-1-yanhong.wang@starfivetech.com> References: <20221216070632.11444-1-yanhong.wang@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS064.cuchost.com (172.16.6.24) To EXMBX173.cuchost.com (172.16.6.93) X-YovoleRuleAgent: yovoleflag X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221215_230625_385677_E4211313 X-CRM114-Status: GOOD ( 22.32 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org This adds basic support for the Motorcomm YT8531 Gigabit Ethernet PHY. Signed-off-by: Yanhong Wang --- drivers/net/phy/Kconfig | 3 +- drivers/net/phy/motorcomm.c | 202 ++++++++++++++++++++++++++++++++++++ 2 files changed, 204 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index c57a0262fb64..86399254d9ff 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -258,9 +258,10 @@ config MICROSEMI_PHY config MOTORCOMM_PHY tristate "Motorcomm PHYs" + default SOC_STARFIVE help Enables support for Motorcomm network PHYs. - Currently supports the YT8511 gigabit PHY. + Currently supports the YT8511 and YT8531 gigabit PHYs. config NATIONAL_PHY tristate "National Semiconductor PHYs" diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c index 7e6ac2c5e27e..bca03185b338 100644 --- a/drivers/net/phy/motorcomm.c +++ b/drivers/net/phy/motorcomm.c @@ -3,13 +3,17 @@ * Driver for Motorcomm PHYs * * Author: Peter Geis + * */ +#include #include #include +#include #include #define PHY_ID_YT8511 0x0000010a +#define PHY_ID_YT8531 0x4f51e91b #define YT8511_PAGE_SELECT 0x1e #define YT8511_PAGE 0x1f @@ -17,6 +21,10 @@ #define YT8511_EXT_DELAY_DRIVE 0x0d #define YT8511_EXT_SLEEP_CTRL 0x27 +#define YTPHY_EXT_SMI_SDS_PHY 0xa000 +#define YTPHY_EXT_CHIP_CONFIG 0xa001 +#define YTPHY_EXT_RGMII_CONFIG1 0xa003 + /* 2b00 25m from pll * 2b01 25m from xtl *default* * 2b10 62.m from pll @@ -38,6 +46,51 @@ #define YT8511_DELAY_FE_TX_EN (0xf << 12) #define YT8511_DELAY_FE_TX_DIS (0x2 << 12) +struct ytphy_reg_field { + char *name; + u32 mask; + u8 dflt; /* Default value */ +}; + +struct ytphy_priv_t { + u32 tx_inverted_1000; + u32 tx_inverted_100; + u32 tx_inverted_10; +}; + +/* rx_delay_sel: RGMII rx clock delay train configuration, about 150ps per + * step. Delay = 150ps * N + * + * tx_delay_sel_fe: RGMII tx clock delay train configuration when speed is + * 100Mbps or 10Mbps, it's 150ps per step. Delay = 150ps * N + * + * tx_delay_sel: RGMII tx clock delay train configuration when speed is + * 1000Mbps, it's 150ps per step. Delay = 150ps * N + */ +static const struct ytphy_reg_field ytphy_rxtxd_grp[] = { + { "rx_delay_sel", GENMASK(13, 10), 0x0 }, + { "tx_delay_sel_fe", GENMASK(7, 4), 0xf }, + { "tx_delay_sel", GENMASK(3, 0), 0x1 } +}; + +/* tx_inverted_x: Use original or inverted RGMII TX_CLK to drive the RGMII + * TX_CLK delay train configuration when speed is + * xMbps(10/100/1000Mbps). + * 0: original, 1: inverted + */ +static const struct ytphy_reg_field ytphy_txinver_grp[] = { + { "tx_inverted_1000", BIT(14), 0x0 }, + { "tx_inverted_100", BIT(14), 0x0 }, + { "tx_inverted_10", BIT(14), 0x0 } +}; + +/* rxc_dly_en: RGMII clk 2ns delay control bit. + * 0: disable 1: enable + */ +static const struct ytphy_reg_field ytphy_rxden_grp[] = { + { "rxc_dly_en", BIT(8), 0x1 } +}; + static int yt8511_read_page(struct phy_device *phydev) { return __phy_read(phydev, YT8511_PAGE_SELECT); @@ -48,6 +101,33 @@ static int yt8511_write_page(struct phy_device *phydev, int page) return __phy_write(phydev, YT8511_PAGE_SELECT, page); }; +static int ytphy_read_ext(struct phy_device *phydev, u32 regnum) +{ + int ret; + int val; + + ret = __phy_write(phydev, YT8511_PAGE_SELECT, regnum); + if (ret < 0) + return ret; + + val = __phy_read(phydev, YT8511_PAGE); + + return val; +} + +static int ytphy_write_ext(struct phy_device *phydev, u32 regnum, u16 val) +{ + int ret; + + ret = __phy_write(phydev, YT8511_PAGE_SELECT, regnum); + if (ret < 0) + return ret; + + ret = __phy_write(phydev, YT8511_PAGE, val); + + return ret; +} + static int yt8511_config_init(struct phy_device *phydev) { int oldpage, ret = 0; @@ -111,6 +191,116 @@ static int yt8511_config_init(struct phy_device *phydev) return phy_restore_page(phydev, oldpage, ret); } +static int ytphy_config_init(struct phy_device *phydev) +{ + struct device_node *of_node; + u32 val; + u32 mask; + u32 cfg; + int ret; + int i = 0; + + of_node = phydev->mdio.dev.of_node; + if (of_node) { + ret = of_property_read_u32(of_node, ytphy_rxden_grp[0].name, &cfg); + if (!ret) { + mask = ytphy_rxden_grp[0].mask; + val = ytphy_read_ext(phydev, YTPHY_EXT_CHIP_CONFIG); + + /* check the cfg overflow or not */ + cfg = cfg > mask >> (ffs(mask) - 1) ? mask : cfg; + + val &= ~mask; + val |= FIELD_PREP(mask, cfg); + ytphy_write_ext(phydev, YTPHY_EXT_CHIP_CONFIG, val); + } + + val = ytphy_read_ext(phydev, YTPHY_EXT_RGMII_CONFIG1); + for (i = 0; i < ARRAY_SIZE(ytphy_rxtxd_grp); i++) { + ret = of_property_read_u32(of_node, ytphy_rxtxd_grp[i].name, &cfg); + if (!ret) { + mask = ytphy_rxtxd_grp[i].mask; + + /* check the cfg overflow or not */ + cfg = cfg > mask >> (ffs(mask) - 1) ? mask : cfg; + + val &= ~mask; + val |= cfg << (ffs(mask) - 1); + } + } + return ytphy_write_ext(phydev, YTPHY_EXT_RGMII_CONFIG1, val); + } + + phydev_err(phydev, "Get of node fail\n"); + + return -EINVAL; +} + +static void ytphy_link_change_notify(struct phy_device *phydev) +{ + u32 val; + struct ytphy_priv_t *ytphy_priv = phydev->priv; + + if (phydev->speed < 0) + return; + + val = ytphy_read_ext(phydev, YTPHY_EXT_RGMII_CONFIG1); + switch (phydev->speed) { + case SPEED_1000: + val &= ~ytphy_txinver_grp[0].mask; + val |= FIELD_PREP(ytphy_txinver_grp[0].mask, + ytphy_priv->tx_inverted_1000); + break; + + case SPEED_100: + val &= ~ytphy_txinver_grp[1].mask; + val |= FIELD_PREP(ytphy_txinver_grp[1].mask, + ytphy_priv->tx_inverted_100); + break; + + case SPEED_10: + val &= ~ytphy_txinver_grp[2].mask; + val |= FIELD_PREP(ytphy_txinver_grp[2].mask, + ytphy_priv->tx_inverted_10); + break; + + default: + break; + } + + ytphy_write_ext(phydev, YTPHY_EXT_RGMII_CONFIG1, val); +} + +static int yt8531_probe(struct phy_device *phydev) +{ + struct ytphy_priv_t *priv; + const struct device_node *of_node; + u32 val; + int ret; + + priv = devm_kzalloc(&phydev->mdio.dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + of_node = phydev->mdio.dev.of_node; + if (of_node) { + ret = of_property_read_u32(of_node, ytphy_txinver_grp[0].name, &val); + if (!ret) + priv->tx_inverted_1000 = val; + + ret = of_property_read_u32(of_node, ytphy_txinver_grp[1].name, &val); + if (!ret) + priv->tx_inverted_100 = val; + + ret = of_property_read_u32(of_node, ytphy_txinver_grp[2].name, &val); + if (!ret) + priv->tx_inverted_10 = val; + } + phydev->priv = priv; + + return 0; +} + static struct phy_driver motorcomm_phy_drvs[] = { { PHY_ID_MATCH_EXACT(PHY_ID_YT8511), @@ -120,6 +310,17 @@ static struct phy_driver motorcomm_phy_drvs[] = { .resume = genphy_resume, .read_page = yt8511_read_page, .write_page = yt8511_write_page, + }, { + PHY_ID_MATCH_EXACT(PHY_ID_YT8531), + .name = "YT8531 Gigabit Ethernet", + .probe = yt8531_probe, + .config_init = ytphy_config_init, + .read_status = genphy_read_status, + .suspend = genphy_suspend, + .resume = genphy_resume, + .read_page = yt8511_read_page, + .write_page = yt8511_write_page, + .link_change_notify = ytphy_link_change_notify, }, }; @@ -131,6 +332,7 @@ MODULE_LICENSE("GPL"); static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = { { PHY_ID_MATCH_EXACT(PHY_ID_YT8511) }, + { PHY_ID_MATCH_EXACT(PHY_ID_YT8531) }, { /* sentinal */ } }; From patchwork Fri Dec 16 07:06:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: yanhong wang X-Patchwork-Id: 13074817 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD371C4167B for ; Fri, 16 Dec 2022 07:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5mZ77CMiNhEYkd3wptZRleFe3CBCzalPJee+T6kdyoo=; b=vxydKkyf6IegONUS+ycaDA2MsO aOu/NUHtSiGoL8PlzElqVZjYN4nTpA32AJD0dBCe0GRANt5/Wbw8O9WhVe3pCq9W48HTMwSM6vo+F XC5EtRVxZcMJstSebllAO8FLzafnPYROeUN6jYkVLai7jVW+sFwoLC4d/rNxIjYVnrY74+wQAhuhj ockeOBT9eafQGxIFOWgh/sLX0w0DzoaZGOrX2UDcib0r1hpQUwKYWV/QTgvsfjKFb3MlUqSDPh4dl PRRbeLQmBzotWC1Uc6K4AzQYm+Pg9EuBN+8D/SzWcnzPR8NAZwukdWHDztU+pcjzMZkTcIpKM3hH1 zsvDPaxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nl-00DJYr-2B; Fri, 16 Dec 2022 07:06:37 +0000 Received: from fd01.gateway.ufhost.com ([61.152.239.71]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nf-00DJDF-8y for linux-riscv@lists.infradead.org; Fri, 16 Dec 2022 07:06:33 +0000 Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 5823024E39B; Fri, 16 Dec 2022 15:05:44 +0800 (CST) Received: from EXMBX173.cuchost.com (172.16.6.93) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:44 +0800 Received: from wyh-VirtualBox.starfivetech.com (171.223.208.138) by EXMBX173.cuchost.com (172.16.6.93) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:43 +0800 From: Yanhong Wang To: , , , CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Richard Cochran , Andrew Lunn , Heiner Kallweit , Peter Geis , Yanhong Wang Subject: [PATCH v2 7/9] net: stmmac: Add glue layer for StarFive JH71x0 SoCs Date: Fri, 16 Dec 2022 15:06:30 +0800 Message-ID: <20221216070632.11444-8-yanhong.wang@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221216070632.11444-1-yanhong.wang@starfivetech.com> References: <20221216070632.11444-1-yanhong.wang@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS064.cuchost.com (172.16.6.24) To EXMBX173.cuchost.com (172.16.6.93) X-YovoleRuleAgent: yovoleflag X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221215_230631_657082_331BA184 X-CRM114-Status: GOOD ( 22.18 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org This adds StarFive dwmac driver support on the StarFive JH71x0 SoCs. Signed-off-by: Yanhong Wang Co-developed-by: Emil Renner Berthing Signed-off-by: Emil Renner Berthing --- MAINTAINERS | 1 + drivers/net/ethernet/stmicro/stmmac/Kconfig | 12 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../stmicro/stmmac/dwmac-starfive-plat.c | 167 ++++++++++++++++++ 4 files changed, 181 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c diff --git a/MAINTAINERS b/MAINTAINERS index 1ff68b8524d2..c7d3229330aa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19609,6 +19609,7 @@ F: include/dt-bindings/clock/starfive* STARFIVE DWMAC GLUE LAYER M: Yanhong Wang S: Maintained +F: Documentation/devicetree/bindings/net/dwmac-starfive-plat.c F: Documentation/devicetree/bindings/net/motorcomm,yt8531.yaml F: Documentation/devicetree/bindings/net/starfive,jh71x0-dwmac.yaml diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index 31ff35174034..ca3d4dd95a95 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -235,6 +235,18 @@ config DWMAC_INTEL_PLAT the stmmac device driver. This driver is used for the Intel Keem Bay SoC. +config DWMAC_STARFIVE_PLAT + tristate "StarFive dwmac support" + depends on OF && COMMON_CLK + depends on STMMAC_ETH + default SOC_STARFIVE + help + Support for ethernet controllers on StarFive RISC-V SoCs + + This selects the StarFive platform specific glue layer support for + the stmmac device driver. This driver is used for StarFive JH71x0 + ethernet controller. + config DWMAC_VISCONTI tristate "Toshiba Visconti DWMAC support" default ARCH_VISCONTI diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index d4e12e9ace4f..a63ab0ab5071 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.o obj-$(CONFIG_DWMAC_INTEL_PLAT) += dwmac-intel-plat.o obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o obj-$(CONFIG_DWMAC_IMX8) += dwmac-imx.o +obj-$(CONFIG_DWMAC_STARFIVE_PLAT) += dwmac-starfive-plat.o obj-$(CONFIG_DWMAC_VISCONTI) += dwmac-visconti.o stmmac-platform-objs:= stmmac_platform.o dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file mode 100644 index 000000000000..f8b68dd53c91 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c @@ -0,0 +1,167 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * StarFive DWMAC platform driver + * + * Copyright(C) 2022 StarFive Technology Co., Ltd. + * + */ + +#include +#include +#include +#include "stmmac_platform.h" + +struct starfive_dwmac { + struct device *dev; + struct clk *clk_tx; + struct clk *clk_gtx; + struct clk *clk_gtxc; +}; + +#define JH7100_SYSMAIN_REGISTER28 0x70 +/* The value below is not a typo, just really bad naming by StarFive ¯\_(ツ)_/¯ */ +#define JH7100_SYSMAIN_REGISTER49 0xc8 + +static int starfive_eth_plat_jh7100_syscon_init(struct device *dev) +{ + struct device_node *np = dev->of_node; + struct regmap *sysmain; + u32 gtxclk_dlychain; + int ret; + + sysmain = syscon_regmap_lookup_by_phandle(np, "starfive,syscon"); + if (IS_ERR(sysmain)) + return dev_err_probe(dev, PTR_ERR(sysmain), + "error getting sysmain registers\n"); + + /* Choose RGMII interface to the phy. + * TODO: support other interfaces once we know the meaning of other + * values in the register + */ + ret = regmap_update_bits(sysmain, JH7100_SYSMAIN_REGISTER28, 0x7, 1); + if (ret) + return dev_err_probe(dev, ret, "error selecting gmac interface\n"); + + if (!of_property_read_u32(np, "starfive,gtxclk-dlychain", >xclk_dlychain)) { + ret = regmap_write(sysmain, JH7100_SYSMAIN_REGISTER49, gtxclk_dlychain); + if (ret) + return dev_err_probe(dev, ret, "error selecting gtxclk delay chain\n"); + } + + return 0; +} + +static void starfive_eth_plat_fix_mac_speed(void *priv, unsigned int speed) +{ + struct starfive_dwmac *dwmac = priv; + unsigned long rate; + int err; + + switch (speed) { + case SPEED_1000: + rate = 125000000; + break; + case SPEED_100: + rate = 25000000; + break; + case SPEED_10: + rate = 2500000; + break; + default: + dev_err(dwmac->dev, "invalid speed %u\n", speed); + return; + } + + err = clk_set_rate(dwmac->clk_gtx, rate); + if (err) + dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); +} + +static int starfive_eth_plat_probe(struct platform_device *pdev) +{ + struct plat_stmmacenet_data *plat_dat; + struct stmmac_resources stmmac_res; + struct starfive_dwmac *dwmac; + int (*syscon_init)(struct device *dev); + int err; + + err = stmmac_get_platform_resources(pdev, &stmmac_res); + if (err) + return err; + + plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac); + if (IS_ERR(plat_dat)) { + dev_err(&pdev->dev, "dt configuration failed\n"); + return PTR_ERR(plat_dat); + } + + dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); + if (!dwmac) + return -ENOMEM; + + syscon_init = of_device_get_match_data(&pdev->dev); + if (syscon_init) { + err = syscon_init(&pdev->dev); + if (err) + return err; + } + + dwmac->clk_tx = devm_clk_get_enabled(&pdev->dev, "tx"); + if (IS_ERR(dwmac->clk_tx)) + return dev_err_probe(&pdev->dev, PTR_ERR(dwmac->clk_tx), + "error getting tx clock\n"); + + dwmac->clk_gtx = devm_clk_get_enabled(&pdev->dev, "gtx"); + if (IS_ERR(dwmac->clk_gtx)) + return dev_err_probe(&pdev->dev, PTR_ERR(dwmac->clk_gtx), + "error getting gtx clock\n"); + + /* Only StarFive JH7110 SoC support gtxc clock */ + if (of_device_is_compatible(pdev->dev.of_node, "starfive,jh7110-dwmac")) { + dwmac->clk_gtxc = devm_clk_get_enabled(&pdev->dev, "gtxc"); + if (IS_ERR(dwmac->clk_gtxc)) + return dev_err_probe(&pdev->dev, PTR_ERR(dwmac->clk_gtxc), + "error getting gtxc clock\n"); + } + + dwmac->dev = &pdev->dev; + plat_dat->fix_mac_speed = starfive_eth_plat_fix_mac_speed; + plat_dat->init = NULL; + plat_dat->bsp_priv = dwmac; + plat_dat->dma_cfg->dche = true; + + err = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); + if (err) { + stmmac_remove_config_dt(pdev, plat_dat); + return err; + } + + return 0; +} + +static const struct of_device_id starfive_eth_plat_match[] = { + { + .compatible = "starfive,jh7110-dwmac" + }, + { + .compatible = "starfive,jh7100-dwmac", + .data = starfive_eth_plat_jh7100_syscon_init, + }, + { } +}; + +static struct platform_driver starfive_eth_plat_driver = { + .probe = starfive_eth_plat_probe, + .remove = stmmac_pltfr_remove, + .driver = { + .name = "starfive-eth-plat", + .pm = &stmmac_pltfr_pm_ops, + .of_match_table = starfive_eth_plat_match, + }, +}; + +module_platform_driver(starfive_eth_plat_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("StarFive DWMAC platform driver"); +MODULE_AUTHOR("Yanhong Wang "); From patchwork Fri Dec 16 07:06:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yanhong wang X-Patchwork-Id: 13074808 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E83BC001B2 for ; Fri, 16 Dec 2022 07:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=279iMdi0fMlBUbZ7aETboKjCv5RzLIHTJ0alI4r1+bk=; b=zn8iI+QBuoyn9g BrSYfhVln+y4vHL3TpjHflAMS1y+0a11RcQ9qx1OBGtTGarwzqm0R7lECjhyjC8YhFvWin9DrWMsL GJq6lkwsFNZht/WdB5GWeg4X8i1A9RnS1zjpyZFBnL8CA2KbZ3CxwclrrRkTAL3XC1TU+eLpKD9rY qj2ywojHj5yjOjAjsXzkxJn69UFR/tArHkplJsxuzFD1qVWnqXWFcXwDC/5Pik5nNHWtA0VY+kh3e 6iqSggUJ0cuftP1BbI0BPf7lBFSFqvb882ujWtG8nd0k8A1/iSYLaLnYJAmUQSVjOuG7f00gmla8u xTFNWLuhnrrLPoh8mfxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nP-00DJK9-GZ; Fri, 16 Dec 2022 07:06:15 +0000 Received: from fd01.gateway.ufhost.com ([61.152.239.71]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nL-00DJDJ-3d for linux-riscv@lists.infradead.org; Fri, 16 Dec 2022 07:06:14 +0000 Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 478D824E346; Fri, 16 Dec 2022 15:05:45 +0800 (CST) Received: from EXMBX173.cuchost.com (172.16.6.93) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:45 +0800 Received: from wyh-VirtualBox.starfivetech.com (171.223.208.138) by EXMBX173.cuchost.com (172.16.6.93) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:44 +0800 From: Yanhong Wang To: , , , CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Richard Cochran , Andrew Lunn , Heiner Kallweit , Peter Geis , Yanhong Wang Subject: [PATCH v2 8/9] riscv: dts: starfive: jh7110: Add ethernet device node Date: Fri, 16 Dec 2022 15:06:31 +0800 Message-ID: <20221216070632.11444-9-yanhong.wang@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221216070632.11444-1-yanhong.wang@starfivetech.com> References: <20221216070632.11444-1-yanhong.wang@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS064.cuchost.com (172.16.6.24) To EXMBX173.cuchost.com (172.16.6.93) X-YovoleRuleAgent: yovoleflag X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221215_230611_466754_318410A6 X-CRM114-Status: UNSURE ( 9.37 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add JH7110 ethernet device node to support gmac driver for the JH7110 RISC-V SoC. Signed-off-by: Yanhong Wang --- arch/riscv/boot/dts/starfive/jh7110.dtsi | 93 ++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/arch/riscv/boot/dts/starfive/jh7110.dtsi b/arch/riscv/boot/dts/starfive/jh7110.dtsi index c22e8f1d2640..c6de6e3b1a25 100644 --- a/arch/riscv/boot/dts/starfive/jh7110.dtsi +++ b/arch/riscv/boot/dts/starfive/jh7110.dtsi @@ -433,5 +433,98 @@ reg-shift = <2>; status = "disabled"; }; + + stmmac_axi_setup: stmmac-axi-config { + snps,lpi_en; + snps,wr_osr_lmt = <4>; + snps,rd_osr_lmt = <4>; + snps,blen = <256 128 64 32 0 0 0>; + }; + + gmac0: ethernet@16030000 { + compatible = "starfive,jh7110-dwmac", "snps,dwmac-5.20"; + reg = <0x0 0x16030000 0x0 0x10000>; + clocks = <&aoncrg JH7110_AONCLK_GMAC0_AXI>, + <&aoncrg JH7110_AONCLK_GMAC0_AHB>, + <&syscrg JH7110_SYSCLK_GMAC0_PTP>, + <&aoncrg JH7110_AONCLK_GMAC0_TX>, + <&syscrg JH7110_SYSCLK_GMAC0_GTXC>, + <&syscrg JH7110_SYSCLK_GMAC0_GTXCLK>; + clock-names = "stmmaceth", "pclk", "ptp_ref", + "tx", "gtxc", "gtx"; + resets = <&aoncrg JH7110_AONRST_GMAC0_AXI>, + <&aoncrg JH7110_AONRST_GMAC0_AHB>; + reset-names = "stmmaceth", "ahb"; + interrupts = <7>, <6>, <5>; + interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; + phy-mode = "rgmii-id"; + snps,multicast-filter-bins = <64>; + snps,perfect-filter-entries = <8>; + rx-fifo-depth = <2048>; + tx-fifo-depth = <2048>; + snps,fixed-burst; + snps,no-pbl-x8; + snps,force_thresh_dma_mode; + snps,axi-config = <&stmmac_axi_setup>; + snps,tso; + snps,en-tx-lpi-clockgating; + snps,txpbl = <16>; + snps,rxpbl = <16>; + status = "disabled"; + phy-handle = <&phy0>; + + mdio0: mdio { + #address-cells = <1>; + #size-cells = <0>; + compatible = "snps,dwmac-mdio"; + + phy0: ethernet-phy@0 { + reg = <0>; + }; + }; + }; + + gmac1: ethernet@16040000 { + compatible = "starfive,jh7110-dwmac", "snps,dwmac-5.20"; + reg = <0x0 0x16040000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_GMAC1_AXI>, + <&syscrg JH7110_SYSCLK_GMAC1_AHB>, + <&syscrg JH7110_SYSCLK_GMAC1_PTP>, + <&syscrg JH7110_SYSCLK_GMAC1_TX>, + <&syscrg JH7110_SYSCLK_GMAC1_GTXC>, + <&syscrg JH7110_SYSCLK_GMAC1_GTXCLK>; + clock-names = "stmmaceth", "pclk", "ptp_ref", + "tx", "gtxc", "gtx"; + resets = <&syscrg JH7110_SYSRST_GMAC1_AXI>, + <&syscrg JH7110_SYSRST_GMAC1_AHB>; + reset-names = "stmmaceth", "ahb"; + interrupts = <78>, <77>, <76>; + interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; + phy-mode = "rgmii-id"; + snps,multicast-filter-bins = <64>; + snps,perfect-filter-entries = <8>; + rx-fifo-depth = <2048>; + tx-fifo-depth = <2048>; + snps,fixed-burst; + snps,no-pbl-x8; + snps,force_thresh_dma_mode; + snps,axi-config = <&stmmac_axi_setup>; + snps,tso; + snps,en-tx-lpi-clockgating; + snps,txpbl = <16>; + snps,rxpbl = <16>; + status = "disabled"; + phy-handle = <&phy1>; + + mdio1: mdio { + #address-cells = <1>; + #size-cells = <0>; + compatible = "snps,dwmac-mdio"; + + phy1: ethernet-phy@1 { + reg = <1>; + }; + }; + }; }; }; From patchwork Fri Dec 16 07:06:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yanhong wang X-Patchwork-Id: 13074815 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 035FEC4332F for ; Fri, 16 Dec 2022 07:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FdUB3tSju9D5lt1h2waKzziSJYIUH0SwIZejfgI3tQY=; b=PBk7X5fNDXpqaW cBXn3EFqpckSqBU3C7/CZct0aGipPrBu1Xbpx3exYrFKF3UX0h1ZSX1oKpbcUYscoxTcraFoypf5i Sh6jSbrGLz3XiQh+Rb3V0bpoIpeY8WNXZezulht+hO4h9z2KX+8YVyhcIJsGo8gi7Zk5eF3Srl5J2 Pw+8fyO5Pu4lK4gOOqozfOqqnvADSoEnWbv8WWXLYmv5PFSrNUVpPS6J8GYPZvJacCzF/ZDOY5YIZ tNyr2oNkQtU4Ma83desITey7H2EtGBV8RENvyQQgFUpqt2czmgp30d0FAEvUWiJ7568pg01U4SUAF eBR38rxYIHUp7x0FcAjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64ng-00DJUw-EB; Fri, 16 Dec 2022 07:06:32 +0000 Received: from ex01.ufhost.com ([61.152.239.75]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p64nZ-00DJDd-So for linux-riscv@lists.infradead.org; Fri, 16 Dec 2022 07:06:27 +0000 Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 3687D24E275; Fri, 16 Dec 2022 15:05:46 +0800 (CST) Received: from EXMBX173.cuchost.com (172.16.6.93) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:46 +0800 Received: from wyh-VirtualBox.starfivetech.com (171.223.208.138) by EXMBX173.cuchost.com (172.16.6.93) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 16 Dec 2022 15:05:44 +0800 From: Yanhong Wang To: , , , CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Emil Renner Berthing , Richard Cochran , Andrew Lunn , Heiner Kallweit , Peter Geis , Yanhong Wang Subject: [PATCH v2 9/9] riscv: dts: starfive: visionfive-v2: Add phy clock delay train configuration Date: Fri, 16 Dec 2022 15:06:32 +0800 Message-ID: <20221216070632.11444-10-yanhong.wang@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221216070632.11444-1-yanhong.wang@starfivetech.com> References: <20221216070632.11444-1-yanhong.wang@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [171.223.208.138] X-ClientProxiedBy: EXCAS064.cuchost.com (172.16.6.24) To EXMBX173.cuchost.com (172.16.6.93) X-YovoleRuleAgent: yovoleflag X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221215_230626_127355_FB7857C7 X-CRM114-Status: UNSURE ( 8.30 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org In view of the particularity of StarFive JH7110 SoC, the PHY clock delay train configuration parameters must be adjusted for StarFive VisionFive v2 board. Signed-off-by: Yanhong Wang --- .../jh7110-starfive-visionfive-v2.dts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts index c8946cf3a268..81329d67ef0f 100644 --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts @@ -15,6 +15,8 @@ aliases { serial0 = &uart0; + ethernet0 = &gmac0; + ethernet1 = &gmac1; }; chosen { @@ -114,3 +116,29 @@ pinctrl-0 = <&uart0_pins>; status = "okay"; }; + +&gmac0 { + status = "okay"; +}; + +&phy0 { + rxc_dly_en = <1>; + tx_delay_sel_fe = <5>; + tx_delay_sel = <0xa>; + tx_inverted_10 = <0x1>; + tx_inverted_100 = <0x1>; + tx_inverted_1000 = <0x1>; +}; + +&gmac1 { + status = "okay"; +}; + +&phy1 { + rxc_dly_en = <0>; + tx_delay_sel_fe = <5>; + tx_delay_sel = <0>; + tx_inverted_10 = <0x1>; + tx_inverted_100 = <0x1>; + tx_inverted_1000 = <0x0>; +};