0047-riscv-dts-starfive-visionfive-2-Add-configuration-of.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. From 6fd84cb9cceaa711671500a92dcee5b1072ab95a Mon Sep 17 00:00:00 2001
  2. From: Samin Guo <[email protected]>
  3. Date: Tue, 1 Nov 2022 18:11:02 +0800
  4. Subject: [PATCH 047/122] riscv: dts: starfive: visionfive 2: Add configuration
  5. of gmac and phy
  6. v1.3B:
  7. v1.3B uses motorcomm YT8531(rgmii-id phy) x2, need delay and
  8. inverse configurations.
  9. The tx_clk of v1.3B uses an external clock and needs to be
  10. switched to an external clock source.
  11. v1.2A:
  12. v1.2A gmac0 uses motorcomm YT8531(rgmii-id) PHY, and needs delay
  13. configurations.
  14. v1.2A gmac1 uses motorcomm YT8512(rmii) PHY, and needs to
  15. switch rx and rx to external clock sources.
  16. Tested-by: Tommaso Merciai <[email protected]>
  17. Signed-off-by: Samin Guo <[email protected]>
  18. ---
  19. .../jh7110-starfive-visionfive-2-v1.2a.dts | 13 +++++++
  20. .../jh7110-starfive-visionfive-2-v1.3b.dts | 27 +++++++++++++++
  21. .../jh7110-starfive-visionfive-2.dtsi | 34 +++++++++++++++++++
  22. 3 files changed, 74 insertions(+)
  23. --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.2a.dts
  24. +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.2a.dts
  25. @@ -11,3 +11,16 @@
  26. model = "StarFive VisionFive 2 v1.2A";
  27. compatible = "starfive,visionfive-2-v1.2a", "starfive,jh7110";
  28. };
  29. +
  30. +&gmac1 {
  31. + phy-mode = "rmii";
  32. + assigned-clocks = <&syscrg JH7110_SYSCLK_GMAC1_TX>,
  33. + <&syscrg JH7110_SYSCLK_GMAC1_RX>;
  34. + assigned-clock-parents = <&syscrg JH7110_SYSCLK_GMAC1_RMII_RTX>,
  35. + <&syscrg JH7110_SYSCLK_GMAC1_RMII_RTX>;
  36. +};
  37. +
  38. +&phy0 {
  39. + rx-internal-delay-ps = <1900>;
  40. + tx-internal-delay-ps = <1350>;
  41. +};
  42. --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.3b.dts
  43. +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.3b.dts
  44. @@ -11,3 +11,30 @@
  45. model = "StarFive VisionFive 2 v1.3B";
  46. compatible = "starfive,visionfive-2-v1.3b", "starfive,jh7110";
  47. };
  48. +
  49. +&gmac0 {
  50. + starfive,tx-use-rgmii-clk;
  51. + assigned-clocks = <&aoncrg JH7110_AONCLK_GMAC0_TX>;
  52. + assigned-clock-parents = <&aoncrg JH7110_AONCLK_GMAC0_RMII_RTX>;
  53. +};
  54. +
  55. +&gmac1 {
  56. + starfive,tx-use-rgmii-clk;
  57. + assigned-clocks = <&syscrg JH7110_SYSCLK_GMAC1_TX>;
  58. + assigned-clock-parents = <&syscrg JH7110_SYSCLK_GMAC1_RMII_RTX>;
  59. +};
  60. +
  61. +&phy0 {
  62. + motorcomm,tx-clk-adj-enabled;
  63. + motorcomm,tx-clk-100-inverted;
  64. + motorcomm,tx-clk-1000-inverted;
  65. + rx-internal-delay-ps = <1500>;
  66. + tx-internal-delay-ps = <1500>;
  67. +};
  68. +
  69. +&phy1 {
  70. + motorcomm,tx-clk-adj-enabled;
  71. + motorcomm,tx-clk-100-inverted;
  72. + rx-internal-delay-ps = <300>;
  73. + tx-internal-delay-ps = <0>;
  74. +};
  75. --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
  76. +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
  77. @@ -11,6 +11,8 @@
  78. / {
  79. aliases {
  80. + ethernet0 = &gmac0;
  81. + ethernet1 = &gmac1;
  82. i2c0 = &i2c0;
  83. i2c2 = &i2c2;
  84. i2c5 = &i2c5;
  85. @@ -86,6 +88,38 @@
  86. clock-frequency = <49152000>;
  87. };
  88. +&gmac0 {
  89. + phy-handle = <&phy0>;
  90. + phy-mode = "rgmii-id";
  91. + status = "okay";
  92. +
  93. + mdio {
  94. + #address-cells = <1>;
  95. + #size-cells = <0>;
  96. + compatible = "snps,dwmac-mdio";
  97. +
  98. + phy0: ethernet-phy@0 {
  99. + reg = <0>;
  100. + };
  101. + };
  102. +};
  103. +
  104. +&gmac1 {
  105. + phy-handle = <&phy1>;
  106. + phy-mode = "rgmii-id";
  107. + status = "okay";
  108. +
  109. + mdio {
  110. + #address-cells = <1>;
  111. + #size-cells = <0>;
  112. + compatible = "snps,dwmac-mdio";
  113. +
  114. + phy1: ethernet-phy@1 {
  115. + reg = <0>;
  116. + };
  117. + };
  118. +};
  119. +
  120. &i2c0 {
  121. clock-frequency = <100000>;
  122. i2c-sda-hold-time-ns = <300>;