spacepaste

  1.  
  2. diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
  3. index 4b599b5d26f6..119eed7f51d4 100644
  4. --- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi
  5. +++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
  6. @@ -420,11 +420,29 @@
  7. mdio: mdio {
  8. #address-cells = <1>;
  9. #size-cells = <0>;
  10. - int_mii_phy: ethernet-phy@1 {
  11. - compatible = "ethernet-phy-ieee802.3-c22";
  12. + };
  13. + mdio-mux {
  14. + compatible = "allwinner,sun8i-h3-mdio-switch";
  15. + mdio-parent-bus = <&mdio>;
  16. + #address-cells = <1>;
  17. + #size-cells = <0>;
  18. +
  19. + int_mdio: mdio@1 {
  20. reg = <1>;
  21. - clocks = <&ccu CLK_BUS_EPHY>;
  22. - resets = <&ccu RST_BUS_EPHY>;
  23. + #address-cells = <1>;
  24. + #size-cells = <0>;
  25. + int_mii_phy: ethernet-phy@1 {
  26. + compatible = "ethernet-phy-ieee802.3-c22";
  27. + reg = <1>;
  28. + clocks = <&ccu CLK_BUS_EPHY>;
  29. + resets = <&ccu RST_BUS_EPHY>;
  30. + phy-is-integrated;
  31. + };
  32. + };
  33. + ext_mdio: mdio@0 {
  34. + reg = <0>;
  35. + #address-cells = <1>;
  36. + #size-cells = <0>;
  37. };
  38. };
  39. };
  40. diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
  41. index a366b3747eeb..4d5e164c830c 100644
  42. --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
  43. +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
  44. @@ -312,10 +312,12 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
  45. static const struct of_device_id need_mdio_ids[] = {
  46. { .compatible = "snps,dwc-qos-ethernet-4.10" },
  47. { .compatible = "allwinner,sun8i-a83t-emac" },
  48. - { .compatible = "allwinner,sun8i-h3-emac" },
  49. { .compatible = "allwinner,sun8i-v3s-emac" },
  50. { .compatible = "allwinner,sun50i-a64-emac" },
  51. };
  52. + static const struct of_device_id need_mdio_mux_ids[] = {
  53. + { .compatible = "allwinner,sun8i-h3-emac" },
  54. + };
  55. /* If phy-handle property is passed from DT, use it as the PHY */
  56. plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
  57. @@ -332,7 +334,9 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
  58. mdio = false;
  59. }
  60. - if (of_match_node(need_mdio_ids, np)) {
  61. + if (of_match_node(need_mdio_mux_ids, np)) {
  62. + plat->mdio_node = of_get_parent(plat->phy_node);
  63. + } else if (of_match_node(need_mdio_ids, np)) {
  64. plat->mdio_node = of_get_child_by_name(np, "mdio");
  65. } else {
  66. /**
  67.