ksz8873.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Micrel KSZ8873 PHY Driver for TI DaVinci
  4. * (TMS320DM644x) based boards.
  5. *
  6. * Copyright (C) 2011 Heiko Schocher <hsdenx.de>
  7. *
  8. * based on:
  9. * National Semiconductor DP83848 PHY Driver for TI DaVinci
  10. * (TMS320DM644x) based boards.
  11. *
  12. * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
  13. *
  14. * --------------------------------------------------------
  15. */
  16. #include <common.h>
  17. #include <miiphy.h>
  18. #include <net.h>
  19. #include <asm/arch/emac_defs.h>
  20. #include <asm/io.h>
  21. #include "../../../drivers/net/ti/davinci_emac.h"
  22. int ksz8873_is_phy_connected(int phy_addr)
  23. {
  24. u_int16_t dummy;
  25. return davinci_eth_phy_read(phy_addr, MII_PHYSID1, &dummy);
  26. }
  27. int ksz8873_get_link_speed(int phy_addr)
  28. {
  29. emac_regs *emac = (emac_regs *)EMAC_BASE_ADDR;
  30. /* we always have a link to the switch, 100 FD */
  31. writel((EMAC_MACCONTROL_MIIEN_ENABLE |
  32. EMAC_MACCONTROL_FULLDUPLEX_ENABLE),
  33. &emac->MACCONTROL);
  34. return 1;
  35. }
  36. int ksz8873_init_phy(int phy_addr)
  37. {
  38. return 1;
  39. }
  40. int ksz8873_auto_negotiate(int phy_addr)
  41. {
  42. return dp83848_get_link_speed(phy_addr);
  43. }