ksz8873.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. * See file CREDITS for list of people who contributed to this
  16. * project.
  17. *
  18. * This program is free software; you can redistribute it and/or
  19. * modify it under the terms of the GNU General Public License as
  20. * published by the Free Software Foundation; either version 2 of
  21. * the License, or (at your option) any later version.
  22. *
  23. * This program is distributed in the hope that it will be useful,
  24. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. * GNU General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU General Public License
  29. * along with this program; if not, write to the Free Software
  30. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  31. * MA 02111-1307 USA
  32. */
  33. #include <common.h>
  34. #include <miiphy.h>
  35. #include <net.h>
  36. #include <asm/arch/emac_defs.h>
  37. #include <asm/io.h>
  38. int ksz8873_is_phy_connected(int phy_addr)
  39. {
  40. u_int16_t dummy;
  41. return davinci_eth_phy_read(phy_addr, MII_PHYSID1, &dummy);
  42. }
  43. int ksz8873_get_link_speed(int phy_addr)
  44. {
  45. emac_regs *emac = (emac_regs *)EMAC_BASE_ADDR;
  46. /* we always have a link to the switch, 100 FD */
  47. writel((EMAC_MACCONTROL_MIIEN_ENABLE |
  48. EMAC_MACCONTROL_FULLDUPLEX_ENABLE),
  49. &emac->MACCONTROL);
  50. return 1;
  51. }
  52. int ksz8873_init_phy(int phy_addr)
  53. {
  54. return 1;
  55. }
  56. int ksz8873_auto_negotiate(int phy_addr)
  57. {
  58. return dp83848_get_link_speed(phy_addr);
  59. }