mv88e61xx.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * (C) Copyright 2009
  3. * Marvell Semiconductor <www.marvell.com>
  4. * Prafulla Wadaskar <prafulla@marvell.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  22. * MA 02110-1301 USA
  23. */
  24. #ifndef _MV88E61XX_H
  25. #define _MV88E61XX_H
  26. #include <miiphy.h>
  27. #define MV88E61XX_CPU_PORT 0x5
  28. #define MV88E61XX_PHY_TIMEOUT 100000
  29. /* port dev-addr (= port + 0x10) */
  30. #define MV88E61XX_PRT_OFST 0x10
  31. /* port registers */
  32. #define MV88E61XX_PCS_CTRL_REG 0x1
  33. #define MV88E61XX_PRT_CTRL_REG 0x4
  34. #define MV88E61XX_PRT_VMAP_REG 0x6
  35. #define MV88E61XX_PRT_VID_REG 0x7
  36. #define MV88E61XX_RGMII_TIMECTRL_REG 0x1A
  37. /* global registers dev-addr */
  38. #define MV88E61XX_GLBREG_DEVADR 0x1B
  39. /* global registers */
  40. #define MV88E61XX_SGSR 0x00
  41. #define MV88E61XX_SGCR 0x04
  42. /* global 2 registers dev-addr */
  43. #define MV88E61XX_GLB2REG_DEVADR 0x1C
  44. /* global 2 registers */
  45. #define MV88E61XX_PHY_CMD 0x18
  46. #define MV88E61XX_PHY_DATA 0x19
  47. /* global 2 phy commands */
  48. #define MV88E61XX_PHY_WRITE_CMD 0x9400
  49. #define MV88E61XX_PHY_READ_CMD 0x9800
  50. #define MV88E61XX_BUSY_OFST 15
  51. #define MV88E61XX_MODE_OFST 12
  52. #define MV88E61XX_OP_OFST 10
  53. #define MV88E61XX_ADDR_OFST 5
  54. #ifdef CONFIG_MV88E61XX_MULTICHIP_ADRMODE
  55. static int mv88e61xx_busychk_multic(char *name, u32 devaddr);
  56. static void mv88e61xx_switch_write(char *name, u32 phy_adr,
  57. u32 reg_ofs, u16 data);
  58. static void mv88e61xx_switch_read(char *name, u32 phy_adr,
  59. u32 reg_ofs, u16 *data);
  60. #define wr_switch_reg mv88e61xx_switch_write
  61. #define rd_switch_reg mv88e61xx_switch_read
  62. #else
  63. /* switch appears a s simple PHY and can thus use miiphy */
  64. #define wr_switch_reg miiphy_write
  65. #define rd_switch_reg miiphy_read
  66. #endif /* CONFIG_MV88E61XX_MULTICHIP_ADRMODE */
  67. #endif /* _MV88E61XX_H */