fsl_mdio.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright 2009-2012 Freescale Semiconductor, Inc.
  3. * Jun-jie Zhang <b18070@freescale.com>
  4. * Mingkai Hu <Mingkai.hu@freescale.com>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation; either version 2 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  19. * MA 02111-1307 USA
  20. */
  21. #ifndef __FSL_PHY_H__
  22. #define __FSL_PHY_H__
  23. #include <net.h>
  24. #include <miiphy.h>
  25. #include <asm/fsl_enet.h>
  26. /* PHY register offsets */
  27. #define PHY_EXT_PAGE_ACCESS 0x1f
  28. /* MII Management Configuration Register */
  29. #define MIIMCFG_RESET_MGMT 0x80000000
  30. #define MIIMCFG_MGMT_CLOCK_SELECT 0x00000007
  31. #define MIIMCFG_INIT_VALUE 0x00000003
  32. /* MII Management Command Register */
  33. #define MIIMCOM_READ_CYCLE 0x00000001
  34. #define MIIMCOM_SCAN_CYCLE 0x00000002
  35. /* MII Management Address Register */
  36. #define MIIMADD_PHY_ADDR_SHIFT 8
  37. /* MII Management Indicator Register */
  38. #define MIIMIND_BUSY 0x00000001
  39. #define MIIMIND_NOTVALID 0x00000004
  40. void tsec_local_mdio_write(struct tsec_mii_mng *phyregs, int port_addr,
  41. int dev_addr, int reg, int value);
  42. int tsec_local_mdio_read(struct tsec_mii_mng *phyregs, int port_addr,
  43. int dev_addr, int regnum);
  44. int tsec_phy_read(struct mii_dev *bus, int addr, int dev_addr, int regnum);
  45. int tsec_phy_write(struct mii_dev *bus, int addr, int dev_addr, int regnum,
  46. u16 value);
  47. int memac_mdio_write(struct mii_dev *bus, int port_addr, int dev_addr,
  48. int regnum, u16 value);
  49. int memac_mdio_read(struct mii_dev *bus, int port_addr, int dev_addr,
  50. int regnum);
  51. struct fsl_pq_mdio_info {
  52. struct tsec_mii_mng *regs;
  53. char *name;
  54. };
  55. int fsl_pq_mdio_init(bd_t *bis, struct fsl_pq_mdio_info *info);
  56. #endif /* __FSL_PHY_H__ */