0041-ar71xx-fix-qca956x-ethernet-initialization.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Fri, 13 May 2016 21:01:19 +0200
  3. Subject: ar71xx: fix qca956x ethernet initialization
  4. Complete internal switch initialization for QCA956X.
  5. Set default mdio device if the interface mode of GE0 is not SGMII (fix ticket #21520).
  6. Signed-off-by: Weijie Gao <hackpascal@gmail.com>
  7. Backport of OpenWrt r48937
  8. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
  9. index 12a376e..b43c80a 100644
  10. --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
  11. +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
  12. @@ -271,6 +271,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask)
  13. case ATH79_SOC_QCA956X:
  14. if (id == 1)
  15. mdio_data->builtin_switch = 1;
  16. + mdio_data->is_ar934x = 1;
  17. break;
  18. default:
  19. @@ -1123,16 +1124,25 @@ void __init ath79_register_eth(unsigned int id)
  20. if (id == 0) {
  21. pdata->reset_bit = QCA955X_RESET_GE0_MAC |
  22. QCA955X_RESET_GE0_MDIO;
  23. +
  24. if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII)
  25. pdata->set_speed = qca956x_set_speed_sgmii;
  26. else
  27. - /* FIXME */
  28. - pdata->set_speed = ath79_set_speed_dummy;
  29. + pdata->set_speed = ath79_set_speed_ge0;
  30. } else {
  31. pdata->reset_bit = QCA955X_RESET_GE1_MAC |
  32. QCA955X_RESET_GE1_MDIO;
  33. - /* FIXME */
  34. +
  35. pdata->set_speed = ath79_set_speed_dummy;
  36. +
  37. + pdata->switch_data = &ath79_switch_data;
  38. +
  39. + pdata->speed = SPEED_1000;
  40. + pdata->duplex = DUPLEX_FULL;
  41. +
  42. + /* reset the built-in switch */
  43. + ath79_device_reset_set(AR934X_RESET_ETH_SWITCH);
  44. + ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH);
  45. }
  46. pdata->ddr_flush = ath79_ddr_no_flush;
  47. @@ -1196,6 +1206,11 @@ void __init ath79_register_eth(unsigned int id)
  48. /* don't assign any MDIO device by default */
  49. break;
  50. + case ATH79_SOC_QCA956X:
  51. + if (pdata->phy_if_mode != PHY_INTERFACE_MODE_SGMII)
  52. + pdata->mii_bus_dev = &ath79_mdio1_device.dev;
  53. + break;
  54. +
  55. default:
  56. pdata->mii_bus_dev = &ath79_mdio0_device.dev;
  57. break;