Add Ethernet driver for StarFive JH7110 SoC
Subsystems (8)
v3 cover Add Ethernet driver for StarFive JH7110 SoC
This series adds ethernet support for the StarFive JH7110 RISC-V SoC. The series includes MAC driver. The MAC version is dwmac-5.20 (from Synopsys DesignWare). For more information and support, you can visit RVspace wiki[1].
This patchset should be applied after the patchset [2], [3], [4].
[1] https://wiki.rvspace.org/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/
[4] https://lore.kernel.org/all/[email protected]/
Changes in v3:
- Renamed the dt-bindings 'starfive,jh71x0-dwmac.yaml' to 'starfive,jh7110-dwmac.yaml'.
- Reworded the commit messages.
- Reworded the example context in the dt-binding 'starfive,jh7110-dwmac.yaml'.
- Removed "starfive,jh7100-dwmac" compatible string and special initialization of jh7100.
- Removed the parts of YT8531,so dropped patch 5 and 6.
- Reworded the maxitems number of resets property in 'snps,dwmac.yaml'.
Previous versions:
v1 - https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/
v2 - https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/
Emil Renner Berthing (2):
dt-bindings: net: snps,dwmac: Add dwmac-5.20 version
net: stmmac: platform: Add snps,dwmac-5.20 IP compatible string
Yanhong Wang (5):
dt-bindings: net: snps,dwmac: Update the maxitems number of resets and
reset-names
dt-bindings: net: Add support StarFive dwmac
net: stmmac: Add glue layer for StarFive JH7110 SoCs
riscv: dts: starfive: jh7110: Add ethernet device node
riscv: dts: starfive: visionfive-v2: Enable gmac device tree node
.../devicetree/bindings/net/snps,dwmac.yaml | 41 ++++-- .../bindings/net/starfive,jh7110-dwmac.yaml | 113 ++++++++++++++++ MAINTAINERS | 6 + .../jh7110-starfive-visionfive-v2.dts | 10 ++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 93 +++++++++++++ drivers/net/ethernet/stmicro/stmmac/Kconfig | 12 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../stmicro/stmmac/dwmac-starfive-plat.c | 123 ++++++++++++++++++ .../ethernet/stmicro/stmmac/stmmac_platform.c | 3 +- 9 files changed, 393 insertions(+), 9 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c
base-commit: 094226ad94f471a9f19e8f8e7140a09c2625abaa
prerequisite-patch-id: 8ebfffa09b478904bf7c516f76e2d824ddb60140
prerequisite-patch-id: e8dd8258a4c4062eee2cf07c4607d52baea71f3a
prerequisite-patch-id: d050d884d7b091ff30508a70f5ce5164bb3b72e5
prerequisite-patch-id: 0e41f8cfd4861fcbf6f2e6a2559ce28f0450299e
prerequisite-patch-id: 6e1652501859b85f101ff3b15ced585d43c71c1b
prerequisite-patch-id: 587628a67adad5c655e5f998bf6c4a368ec07d3c
prerequisite-patch-id: 596490c0e397df6c0249c1306fbb1d5bf00b5b83
prerequisite-patch-id: dc873317826b50364344b25ac5cd74e811403f3d
prerequisite-patch-id: a50150f41d8e874553023187e22eb24dffae8d16
prerequisite-patch-id: 735e62255c75801bdc4c0b4107850bce821ff7f5
prerequisite-patch-id: 9d2e83a2dd43e193f534283fab73e90b4f435043
prerequisite-patch-id: 7a43e0849a9afa3c6f83547fd16d9271b07619e5
prerequisite-patch-id: e7aa6fb05314bad6d94c465f3f59969871bf3d2e
prerequisite-patch-id: 6276b2a23818c65ff2ad3d65b562615690cffee9
prerequisite-patch-id: d834ece14ffb525b8c3e661e78736692f33fca9b
prerequisite-patch-id: 4c17a3ce4dae9b788795d915bf775630f5c43c53
prerequisite-patch-id: dabb913fd478e97593e45c23fee4be9fd807f851
prerequisite-patch-id: ba61df106fbe2ada21e8f22c3d2cfaf7809c84b6
prerequisite-patch-id: 287572fb64f83f5d931034f7c75674907584a087
prerequisite-patch-id: 536114f0732646095ef5302a165672b3290d4c75
prerequisite-patch-id: 258ea5f9b8bf41b6981345dcc81795f25865d38f
prerequisite-patch-id: 8b6f2c9660c0ac0ee4e73e4c21aca8e6b75e81b9
prerequisite-patch-id: e09e995700a814a763aa304ad3881a7222acf556
prerequisite-patch-id: 841cd71b556b480d6a5a5e332eeca70d6a76ec3f
prerequisite-patch-id: d074c7ffa2917a9f754d5801e3f67bc980f9de4c
prerequisite-patch-id: 5f59bc7cbbf1230e5ff4761fa7c1116d4e6e5d71
prerequisite-patch-id: d5da3475c6a3588e11a1678feb565bdd459b548e
Signature · 1 line
2.17.1
PATCH v3 1/7 dt-bindings: net: snps,dwmac: Add dwmac-5.20 version
From: Emil Renner Berthing <[email protected]>
Add dwmac-5.20 IP version to snps.dwmac.yaml
--- Documentation/devicetree/bindings/net/snps,dwmac.yaml | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/net/snps,dwmac.yaml +4 -0
@@ -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
Signature · 1 line
2.17.1
Re: [PATCH v3 1/7] dt-bindings: net: snps,dwmac: Add dwmac-5.20 version
Quoted 7 lines · Yanhong Wang
From: Emil Renner Berthing <[email protected]>
Add dwmac-5.20 IP version to
snps.dwmac.yamlSigned-off-by Emil Renner Berthing <[email protected]>Signed-off-by Yanhong Wang <[email protected]>---
Best regards,
Krzysztof
PATCH v3 2/7 dt-bindings: net: snps,dwmac: Update the maxitems number of resets and reset-names
In reply to Yanhong WangSome 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 definition.
--- .../devicetree/bindings/net/snps,dwmac.yaml | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/net/snps,dwmac.yaml +28 -8
@@ -132,14 +132,6 @@ properties: - pclk - ptp_ref - resets: - maxItems: 1 - description: - MAC Reset signal. - - reset-names: - const: stmmaceth - power-domains: maxItems: 1
@@ -463,6 +455,34 @@ allOf: Enables the TSO feature otherwise it will be managed by MAC HW capability register. + - if: + properties: + compatible: + contains: + const: starfive,jh7110-dwmac + + then: + properties: + resets: + minItems: 2 + maxItems: 2 + reset-names: + items: + - const: stmmaceth + - const: ahb + required: + - resets + - reset-names + else: + properties: + resets: + maxItems: 1 + description: + MAC Reset signal. + + reset-names: + const: stmmaceth + additionalProperties: true examples:
Signature · 1 line
2.17.1
Re: [PATCH v3 2/7] dt-bindings: net: snps,dwmac: Update the maxitems number of resets and reset-names
Quoted 15 lines · Yanhong Wang
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 definition.
Signed-off-by Yanhong Wang <[email protected]>--- .../devicetree/bindings/net/snps,dwmac.yaml | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-)Documentation/devicetree/bindings/net/snps,dwmac.yaml +0
-0
Documentation/devicetree/bindings/net/snps,dwmac.yaml properties: · line 141
Quoted 10 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +0
-7@@ -132,14 +132,6 @@ properties: - pclk - ptp_ref - resets: - maxItems: 1 - description: - MAC Reset signal. - - reset-names: - const: stmmaceth
Do not remove properties from top-level properties. Instead these should have widest constraints which are further constrain in allOf:if:then.
Here you should list items with minItems: 1.
Documentation/devicetree/bindings/net/snps,dwmac.yaml properties: · line 142
Quoted 1 line
Documentation/devicetree/bindings/net/snps,dwmac.yaml +0
-1-
Best regards,
Krzysztof
Re: [PATCH v3 2/7] dt-bindings: net: snps,dwmac: Update the maxitems number of resets and reset-names
In reply to Yanhong WangQuoted 30 lines · Yanhong Wang
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 definition.
Signed-off-by Yanhong Wang <[email protected]>--- .../devicetree/bindings/net/snps,dwmac.yaml | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-)Documentation/devicetree/bindings/net/snps,dwmac.yaml +0
-8@@ -132,14 +132,6 @@ properties: - pclk - ptp_ref - resets: - maxItems: 1 - description: - MAC Reset signal. - - reset-names: - const: stmmaceth - power-domains: maxItems: 1
Documentation/devicetree/bindings/net/snps,dwmac.yaml allOf: · line 463
Quoted 9 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +6
-0@@ -463,6 +455,34 @@ allOf: Enables the TSO feature otherwise it will be managed by MAC HW capability register. + - if: + properties: + compatible: + contains: + const: starfive,jh7110-dwmac +
Looking at your next binding patch, this seems a bit clearer. First of all, this patch on itself has little sense. It's not usable on its own, because you need the next one.
Probably the snps,dwmac should be just split into common parts used by devices. It makes code much less readable and unnecessary complicated to support in one schema both devices and re-usability.
Otherwise I propose to make the resets/reset-names just like clocks are
made: define here wide constraints and update all other users of this binding to explicitly restrict resets.
Best regards,
Krzysztof
Re: [PATCH v3 2/7] dt-bindings: net: snps,dwmac: Update the maxitems number of resets and reset-names
Quoted 45 lines · Krzysztof Kozlowski
Quoted 30 lines · Yanhong Wang
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 definition.
Signed-off-by Yanhong Wang <[email protected]>--- .../devicetree/bindings/net/snps,dwmac.yaml | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-)Documentation/devicetree/bindings/net/snps,dwmac.yaml +0
-8@@ -132,14 +132,6 @@ properties: - pclk - ptp_ref - resets: - maxItems: 1 - description: - MAC Reset signal. - - reset-names: - const: stmmaceth - power-domains: maxItems: 1Documentation/devicetree/bindings/net/snps,dwmac.yaml allOf: · line 463
Quoted 9 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +6
-0@@ -463,6 +455,34 @@ allOf: Enables the TSO feature otherwise it will be managed by MAC HW capability register. + - if: + properties: + compatible: + contains: + const: starfive,jh7110-dwmac +Looking at your next binding patch, this seems a bit clearer. First of all, this patch on itself has little sense. It's not usable on its own, because you need the next one.
Quoted 9 lines
Probably the snps,dwmac should be just split into common parts used by devices. It makes code much less readable and unnecessary complicated to support in one schema both devices and re-usability.
Otherwise I propose to make the resets/reset-names just like clocks are
made: define here wide constraints and update all other users of this binding to explicitly restrict resets.
Thanks, refer to the definition of clocks. If it is defined as follows, is it OK?
properties:
resets:
minItems: 1
maxItems: 3
additionalItems: true
items:
- description: MAC Reset signal.
reset-names:
minItems: 1
maxItems: 3
additionalItems: true
contains:
enum:
- stmmaceth
allOf:
- if:
properties:
compatible:
contains:
const: starfive,jh7110-dwmac
then:
properties:
resets:
minItems: 2
maxItems: 2
reset-names:
items:
- const: stmmaceth
- const: ahb
required:
- resets
- reset-names
else:
properties:
resets:
maxItems: 1
description:
MAC Reset signal.
reset-names:
const: stmmaceth
Do you have any other better suggestions?
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH v3 2/7] dt-bindings: net: snps,dwmac: Update the maxitems number of resets and reset-names
Quoted 58 lines · yanhong wang
Quoted 45 lines · Krzysztof Kozlowski
Quoted 30 lines · Yanhong Wang
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 definition.
Signed-off-by Yanhong Wang <[email protected]>--- .../devicetree/bindings/net/snps,dwmac.yaml | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-)Documentation/devicetree/bindings/net/snps,dwmac.yaml +0
-8@@ -132,14 +132,6 @@ properties: - pclk - ptp_ref - resets: - maxItems: 1 - description: - MAC Reset signal. - - reset-names: - const: stmmaceth - power-domains: maxItems: 1Documentation/devicetree/bindings/net/snps,dwmac.yaml allOf: · line 463
Quoted 9 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +6
-0@@ -463,6 +455,34 @@ allOf: Enables the TSO feature otherwise it will be managed by MAC HW capability register. + - if: + properties: + compatible: + contains: + const: starfive,jh7110-dwmac +Looking at your next binding patch, this seems a bit clearer. First of all, this patch on itself has little sense. It's not usable on its own, because you need the next one.
Quoted 9 lines
Probably the snps,dwmac should be just split into common parts used by devices. It makes code much less readable and unnecessary complicated to support in one schema both devices and re-usability.
Otherwise I propose to make the resets/reset-names just like clocks are
made: define here wide constraints and update all other users of this binding to explicitly restrict resets.
Quoted 7 lines
Thanks, refer to the definition of clocks. If it is defined as follows, is it OK?
properties:
resets:
minItems: 1
maxItems: 3
additionalItems: true
Drop
Quoted 2 lines
items:
- description: MAC Reset signal.
Drop both
Quoted 5 lines
reset-names:
minItems: 1
maxItems: 3
additionalItems: true
Drop
Quoted 3 lines
contains:
enum:
- stmmaceth
Drop all
Quoted 27 lines
allOf:
- if:
properties:
compatible:
contains:
const: starfive,jh7110-dwmac
then:
properties:
resets:
minItems: 2
maxItems: 2
reset-names:
items:
- const: stmmaceth
- const: ahb
required:
- resets
- reset-names
else:
properties:
resets:
maxItems: 1
description:
MAC Reset signal.
Quoted 4 lines
reset-names:
const: stmmacethDo you have any other better suggestions?
More or less like this but the allOf should not be in snps,dwmac schema but in individual schemas. The snps,dwmac is growing unmaintainable...
Best regards,
Krzysztof
Re: [PATCH v3 2/7] dt-bindings: net: snps,dwmac: Update the maxitems number of resets and reset-names
Quoted 115 lines · Krzysztof Kozlowski
Quoted 58 lines · yanhong wang
Quoted 45 lines · Krzysztof Kozlowski
Quoted 30 lines · Yanhong Wang
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 definition.
Signed-off-by Yanhong Wang <[email protected]>--- .../devicetree/bindings/net/snps,dwmac.yaml | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-)Documentation/devicetree/bindings/net/snps,dwmac.yaml +0
-8@@ -132,14 +132,6 @@ properties: - pclk - ptp_ref - resets: - maxItems: 1 - description: - MAC Reset signal. - - reset-names: - const: stmmaceth - power-domains: maxItems: 1Documentation/devicetree/bindings/net/snps,dwmac.yaml allOf: · line 463
Quoted 9 lines
Documentation/devicetree/bindings/net/snps,dwmac.yaml +6
-0@@ -463,6 +455,34 @@ allOf: Enables the TSO feature otherwise it will be managed by MAC HW capability register. + - if: + properties: + compatible: + contains: + const: starfive,jh7110-dwmac +Looking at your next binding patch, this seems a bit clearer. First of all, this patch on itself has little sense. It's not usable on its own, because you need the next one.
Quoted 9 lines
Probably the snps,dwmac should be just split into common parts used by devices. It makes code much less readable and unnecessary complicated to support in one schema both devices and re-usability.
Otherwise I propose to make the resets/reset-names just like clocks are
made: define here wide constraints and update all other users of this binding to explicitly restrict resets.Quoted 7 lines
Thanks, refer to the definition of clocks. If it is defined as follows, is it OK?
properties:
resets:
minItems: 1
maxItems: 3
additionalItems: trueDrop
Quoted 2 lines
items:
- description: MAC Reset signal.Drop both
Quoted 5 lines
reset-names:
minItems: 1
maxItems: 3
additionalItems: trueDrop
Quoted 3 lines
contains:
enum:
- stmmacethDrop all
Quoted 27 lines
allOf:
- if:
properties:
compatible:
contains:
const: starfive,jh7110-dwmac
then:
properties:
resets:
minItems: 2
maxItems: 2
reset-names:
items:
- const: stmmaceth
- const: ahb
required:
- resets
- reset-names
else:
properties:
resets:
maxItems: 1
description:
MAC Reset signal.
Quoted 8 lines
Quoted 4 lines
reset-names:
const: stmmacethDo you have any other better suggestions?
More or less like this but the allOf should not be in snps,dwmac schema but in individual schemas. The snps,dwmac is growing unmaintainable...
Thanks, it is defined as follows, is it right?
properties:
resets:
minItems: 1
maxItems: 3
additionalItems: true
reset-names:
minItems: 1
maxItems: 3
additionalItems: true
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH v3 2/7] dt-bindings: net: snps,dwmac: Update the maxitems number of resets and reset-names
Quoted 65 lines · yanhong wang
Quoted 56 lines
Quoted 7 lines
Thanks, refer to the definition of clocks. If it is defined as follows, is it OK?
properties:
resets:
minItems: 1
maxItems: 3
additionalItems: trueDrop
Quoted 2 lines
items:
- description: MAC Reset signal.Drop both
Quoted 5 lines
reset-names:
minItems: 1
maxItems: 3
additionalItems: trueDrop
Quoted 3 lines
contains:
enum:
- stmmacethDrop all
Quoted 27 lines
allOf:
- if:
properties:
compatible:
contains:
const: starfive,jh7110-dwmac
then:
properties:
resets:
minItems: 2
maxItems: 2
reset-names:
items:
- const: stmmaceth
- const: ahb
required:
- resets
- reset-names
else:
properties:
resets:
maxItems: 1
description:
MAC Reset signal.Quoted 8 lines
Quoted 4 lines
reset-names:
const: stmmacethDo you have any other better suggestions?
More or less like this but the allOf should not be in snps,dwmac schema but in individual schemas. The snps,dwmac is growing unmaintainable...
Quoted 8 lines
Thanks, it is defined as follows, is it right?
properties:
resets:
minItems: 1
maxItems: 3
additionalItems: true
Read my comments above. Drop.
Best regards,
Krzysztof
PATCH v3 3/7 net: stmmac: platform: Add snps,dwmac-5.20 IP compatible string
In reply to Yanhong WangFrom: Emil Renner Berthing <[email protected]>
Add "snps,dwmac-5.20" compatible string for 5.20 version that can avoid to define some platform data in the glue layer.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +2 -1
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v3 4/7 dt-bindings: net: Add support StarFive dwmac
In reply to Yanhong WangAdd documentation to describe StarFive dwmac driver(GMAC).
--- .../devicetree/bindings/net/snps,dwmac.yaml | 1 + .../bindings/net/starfive,jh7110-dwmac.yaml | 113 ++++++++++++++++++ MAINTAINERS | 5 + 3 files changed, 119 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml
Documentation/devicetree/bindings/net/snps,dwmac.yaml +1 -0
@@ -91,6 +91,7 @@ properties: - snps,dwmac-5.20 - snps,dwxgmac - snps,dwxgmac-2.10 + - starfive,jh7110-dwmac reg: minItems: 1
Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml new file +113 -0
113 lines not on this page · raw message
MAINTAINERS +5 -0
@@ -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 <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml + STARFIVE PINCTRL DRIVER M: Emil Renner Berthing <[email protected]> M: Jianlong Huang <[email protected]>
Signature · 1 line
2.17.1
Re: [PATCH v3 4/7] dt-bindings: net: Add support StarFive dwmac
Quoted 7 lines · Yanhong Wang
Add documentation to describe StarFive dwmac driver(GMAC).
Signed-off-by Yanhong Wang <[email protected]>--- .../devicetree/bindings/net/snps,dwmac.yaml | 1 + .../bindings/net/starfive,jh7110-dwmac.yaml | 113 ++++++++++++++++++ MAINTAINERS | 5 +
Order the patches correctly. Why this binding patch is split from previous?
Best regards,
Krzysztof
Re: [PATCH v3 4/7] dt-bindings: net: Add support StarFive dwmac
Quoted 11 lines · Krzysztof Kozlowski
Quoted 7 lines · Yanhong Wang
Add documentation to describe StarFive dwmac driver(GMAC).
Signed-off-by Yanhong Wang <[email protected]>--- .../devicetree/bindings/net/snps,dwmac.yaml | 1 + .../bindings/net/starfive,jh7110-dwmac.yaml | 113 ++++++++++++++++++ MAINTAINERS | 5 +Order the patches correctly. Why this binding patch is split from previous?
The previous binding patch was considered to be compatible with JH7100, but after discussion, it is not compatible with JH7100 for the time being, so the name of binding has been modified in this patch.
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH v3 4/7] dt-bindings: net: Add support StarFive dwmac
Quoted 12 lines · yanhong wang
Quoted 9 lines · Krzysztof Kozlowski
Quoted 7 lines · Yanhong Wang
Add documentation to describe StarFive dwmac driver(GMAC).
Signed-off-by Yanhong Wang <[email protected]>--- .../devicetree/bindings/net/snps,dwmac.yaml | 1 + .../bindings/net/starfive,jh7110-dwmac.yaml | 113 ++++++++++++++++++ MAINTAINERS | 5 +
Quoted 6 lines
Quoted 2 lines
Order the patches correctly. Why this binding patch is split from previous?
The previous binding patch was considered to be compatible with JH7100, but after discussion, it is not compatible with JH7100 for the time being, so the name of binding has been modified in this patch.
I am not asking about name, but why this was split from the patch using the compatible in the first time. This does not make any sense. Please squash.
Best regards,
Krzysztof
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
PATCH v3 5/7 net: stmmac: Add glue layer for StarFive JH7110 SoCs
In reply to Yanhong WangThis adds StarFive dwmac driver support on the StarFive JH7110 SoCs.
--- MAINTAINERS | 1 + drivers/net/ethernet/stmicro/stmmac/Kconfig | 12 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../stmicro/stmmac/dwmac-starfive-plat.c | 123 ++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c
MAINTAINERS +1 -0
@@ -19609,6 +19609,7 @@ F: include/dt-bindings/clock/starfive* STARFIVE DWMAC GLUE LAYER M: Yanhong Wang <[email protected]> S: Maintained +F: Documentation/devicetree/bindings/net/dwmac-starfive-plat.c F: Documentation/devicetree/bindings/net/starfive,jh7110-dwmac.yaml STARFIVE PINCTRL DRIVER
drivers/net/ethernet/stmicro/stmmac/Kconfig +12 -0
@@ -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 JH7110 + ethernet controller. + config DWMAC_VISCONTI tristate "Toshiba Visconti DWMAC support" default ARCH_VISCONTI
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
@@ -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
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +123 -0
123 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v3 5/7] net: stmmac: Add glue layer for StarFive JH7110 SoCs
Hi Yanhong,
Quoted 24 lines · Yanhong Wang
This adds StarFive dwmac driver support on the StarFive JH7110 SoCs.
Signed-off-by Yanhong Wang <[email protected]>Co-developed-by Emil Renner Berthing <[email protected]>Signed-off-by Emil Renner Berthing <[email protected]>--- MAINTAINERS | 1 + drivers/net/ethernet/stmicro/stmmac/Kconfig | 12 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../stmicro/stmmac/dwmac-starfive-plat.c | 123 ++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-
starfive-plat.c(quoted diff) +0
-0
plat.cb/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.cnew file mode 100644
index 000000000000..910095b10fe4
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c line 9
Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +9
-0@@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* StarFive DWMAC platform driver +* +* Copyright(C) 2022 StarFive Technology Co., Ltd. +* +*/ + +#include <linux/of_device.h>
Blank line between header with < > and " "
Quoted 19 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +10
-0+#include "stmmac_platform.h" + +struct starfive_dwmac { +struct device *dev; +struct clk *clk_tx; +struct clk *clk_gtx; +struct clk *clk_gtxc; +}; + +static void starfive_eth_plat_fix_mac_speed(void *priv, unsigned intspeed)
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +8
-0+{ +struct starfive_dwmac *dwmac = priv; +unsigned long rate; +int err; + +switch (speed) { +case SPEED_1000 : + rate =125000000 ;
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c line 37
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +10
-0+break ; +case SPEED_100 : + rate =25000000 ; +break ; +case SPEED_10 : + rate =2500000 ; +break ; +default : +dev_err (dwmac->dev,"invalid speed %u\n" , speed); +return ;
Do we need to return value, since it is invalid speed. But the return value of function is void.
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +5
-0+ } + + err =clk_set_rate (dwmac->clk_gtx, rate); +if (err) + dev_err(dwmac->dev, "failed to set tx rate %lu\n",rate);
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c line 50
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +8
-0+} + +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);
Reverse christmas tree.
Quoted 49 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +26
-0+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-Quoted 1 line
clk_tx),drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +1
-0+ "error getting txclock\n");
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +4
-0+ + 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-Quoted 1 line
clk_gtx),drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +1
-0+ "error getting gtxclock\n");
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +4
-0+ + 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-Quoted 1 line
clk_gtxc),drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +1
-0+ "error getting gtxcclock\n");
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +6
-0+ + 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;
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c line 103
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +10
-0+ + err =stmmac_dvr_probe (&pdev->dev, plat_dat, &stmmac_res); +if (err) { +stmmac_remove_config_dt (pdev, plat_dat); +return err; + } + +return 0 ; +} +
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Re: [PATCH v3 5/7] net: stmmac: Add glue layer for StarFive JH7110 SoCs
Quoted 30 lines · On 2023/1/8 19:11, [email protected] wrote:
Hi Yanhong,
Quoted 27 lines · Yanhong Wang
This adds StarFive dwmac driver support on the StarFive JH7110 SoCs.
Signed-off-by Yanhong Wang <[email protected]>Co-developed-by Emil Renner Berthing <[email protected]>Signed-off-by Emil Renner Berthing <[email protected]>--- MAINTAINERS | 1 + drivers/net/ethernet/stmicro/stmmac/Kconfig | 12 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../stmicro/stmmac/dwmac-starfive-plat.c | 123 ++++++++++++++++++ 4 files changed, 137 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-
starfive-plat.c(quoted diff) +0
-0
plat.cb/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.cnew file mode 100644
index 000000000000..910095b10fe4drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +3
-0@@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* StarFive DWMAC platform driver
Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c line 9
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +6
-0+* +* Copyright(C) 2022 StarFive Technology Co., Ltd. +* +*/ + +#include <linux/of_device.h> Blank line between header with < > and " "
Thanks, i will fix.
Quoted 24 lines
Quoted 24 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +10
-0+#include "stmmac_platform.h" + +struct starfive_dwmac { +struct device *dev; +struct clk *clk_tx; +struct clk *clk_gtx; +struct clk *clk_gtxc; +}; + +static void starfive_eth_plat_fix_mac_speed(void *priv, unsigned intspeed)
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +13
-0+{ +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 :
Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c line 37
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +5
-0+ rate =2500000 ; +break ; +default : +dev_err (dwmac->dev,"invalid speed %u\n" , speed); +return ;Do we need to return value, since it is invalid speed. But the return value of function is void.
I will fix.
Quoted 8 lines
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +5
-0+ } + + err =clk_set_rate (dwmac->clk_gtx, rate); +if (err) + dev_err(dwmac->dev, "failed to set tx rate %lu\n",rate);
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +2
-0+} +
Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c line 50
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +6
-0+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);Reverse christmas tree.
I will delete the unused variable syscon_init.
Quoted 59 lines
Quoted 59 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +26
-0+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-Quoted 1 line
clk_tx),drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +1
-0+ "error getting txclock\n");
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +4
-0+ + 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-Quoted 1 line
clk_gtx),drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +1
-0+ "error getting gtxclock\n");
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +4
-0+ + 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-Quoted 1 line
clk_gtxc),drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +1
-0+ "error getting gtxcclock\n");
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive-plat.c new file +16
-0+ + 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 ; +} +
PATCH v3 6/7 riscv: dts: starfive: jh7110: Add ethernet device node
In reply to Yanhong WangAdd JH7110 ethernet device node to support gmac driver for the JH7110 RISC-V SoC.
--- arch/riscv/boot/dts/starfive/jh7110.dtsi | 93 ++++++++++++++++++++++++ 1 file changed, 93 insertions(+)
arch/riscv/boot/dts/starfive/jh7110.dtsi +93 -0
@@ -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>; + }; + }; + }; }; };
Signature · 1 line
2.17.1
PATCH v3 7/7 riscv: dts: starfive: visionfive-v2: Enable gmac device tree node
In reply to Yanhong WangUpdate gmac device tree node status to okay.
--- .../dts/starfive/jh7110-starfive-visionfive-v2.dts | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-v2.dts +10 -0
@@ -15,6 +15,8 @@ aliases { serial0 = &uart0; + ethernet0 = &gmac0; + ethernet1 = &gmac1; }; chosen {
@@ -114,3 +116,11 @@ pinctrl-0 = <&uart0_pins>; status = "okay"; }; + +&gmac0 { + status = "okay"; +}; + +&gmac1 { + status = "okay"; +};
Signature · 1 line
2.17.1