0060-ar71xx-Use-private-version-of-ath79_setup_qca955x_eth_cfg-for-MR900.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  2. Date: Wed, 23 Mar 2016 12:52:09 +0000
  3. Subject: ar71xx: Use private version of ath79_setup_qca955x_eth_cfg for MR900
  4. The MR900 must unset some bits in ETH_CFG which were set by u-boot to work
  5. correctly under OpenWrt. But the global function
  6. ath79_setup_qca955x_eth_cfg will not unset all of them to increase the
  7. backward compatiblity with older mach-* files. A private (simplified)
  8. version for MR900 can be used instead.
  9. Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  10. Backport of r49069
  11. Forwarded: https://patchwork.ozlabs.org/patch/624187/
  12. diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c
  13. index 3634bf0..b439f58 100644
  14. --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c
  15. +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mr900.c
  16. @@ -110,6 +110,28 @@ static struct mdio_board_info mr900_mdio0_info[] = {
  17. },
  18. };
  19. +static void __init mr900_setup_qca955x_eth_cfg(u32 mask,
  20. + unsigned int rxd,
  21. + unsigned int rxdv,
  22. + unsigned int txd,
  23. + unsigned int txe)
  24. +{
  25. + void __iomem *base;
  26. + u32 t;
  27. +
  28. + base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
  29. +
  30. + t = mask;
  31. + t |= rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT;
  32. + t |= rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT;
  33. + t |= txd << QCA955X_ETH_CFG_TXD_DELAY_SHIFT;
  34. + t |= txe << QCA955X_ETH_CFG_TXE_DELAY_SHIFT;
  35. +
  36. + __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG);
  37. +
  38. + iounmap(base);
  39. +}
  40. +
  41. static void __init mr900_setup(void)
  42. {
  43. u8 *art = (u8 *)KSEG1ADDR(0x1fff0000);
  44. @@ -139,7 +161,7 @@ static void __init mr900_setup(void)
  45. }
  46. pdata->use_eeprom = true;
  47. - ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
  48. + mr900_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN, 3, 3, 0, 0);
  49. ath79_register_mdio(0, 0x0);
  50. mdiobus_register_board_info(mr900_mdio0_info,