ksz8873.c 1.1 KB

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