002-powerpc_ibm_phy_add_ar8035.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 0c13957a43a90b1522eb616f3c9967ec44e4da1d Mon Sep 17 00:00:00 2001
  2. From: Christian Lamparter <[email protected]>
  3. Date: Tue, 3 May 2016 13:58:24 +0200
  4. Subject: [PATCH] drivers: net: emac: add Atheros AR8035 phy initialization
  5. code
  6. To: [email protected]
  7. This patch adds the phy initialization code for Qualcomm
  8. Atheros AR8035 phy. This configuration is found in the
  9. Cisco Meraki MR24.
  10. Signed-off-by: Christian Lamparter <[email protected]>
  11. ---
  12. drivers/net/ethernet/ibm/emac/phy.c | 26 ++++++++++++++++++++++++++
  13. 1 file changed, 26 insertions(+)
  14. diff --git a/drivers/net/ethernet/ibm/emac/phy.c b/drivers/net/ethernet/ibm/emac/phy.c
  15. index d3b9d10..5b88cc6 100644
  16. --- a/drivers/net/ethernet/ibm/emac/phy.c
  17. +++ b/drivers/net/ethernet/ibm/emac/phy.c
  18. @@ -470,12 +470,38 @@ static struct mii_phy_def m88e1112_phy_def = {
  19. .ops = &m88e1112_phy_ops,
  20. };
  21. +static int ar8035_init(struct mii_phy *phy)
  22. +{
  23. + phy_write(phy, 0x1d, 0x5); /* Address debug register 5 */
  24. + phy_write(phy, 0x1e, 0x2d47); /* Value copied from u-boot */
  25. + phy_write(phy, 0x1d, 0xb); /* Address hib ctrl */
  26. + phy_write(phy, 0x1e, 0xbc20); /* Value copied from u-boot */
  27. +
  28. + return 0;
  29. +}
  30. +
  31. +static struct mii_phy_ops ar8035_phy_ops = {
  32. + .init = ar8035_init,
  33. + .setup_aneg = genmii_setup_aneg,
  34. + .setup_forced = genmii_setup_forced,
  35. + .poll_link = genmii_poll_link,
  36. + .read_link = genmii_read_link,
  37. +};
  38. +
  39. +static struct mii_phy_def ar8035_phy_def = {
  40. + .phy_id = 0x004dd070,
  41. + .phy_id_mask = 0xfffffff0,
  42. + .name = "Atheros 8035 Gigabit Ethernet",
  43. + .ops = &ar8035_phy_ops,
  44. +};
  45. +
  46. static struct mii_phy_def *mii_phy_table[] = {
  47. &et1011c_phy_def,
  48. &cis8201_phy_def,
  49. &bcm5248_phy_def,
  50. &m88e1111_phy_def,
  51. &m88e1112_phy_def,
  52. + &ar8035_phy_def,
  53. &genmii_phy_def,
  54. NULL
  55. };
  56. --
  57. 2.8.1