ucc_geth_mii.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * drivers/net/ucc_geth_mii.h
  3. *
  4. * QE UCC Gigabit Ethernet Driver -- MII Management Bus Implementation
  5. * Provides Bus interface for MII Management regs in the UCC register space
  6. *
  7. * Copyright (C) 2007 Freescale Semiconductor, Inc.
  8. *
  9. * Authors: Li Yang <leoli@freescale.com>
  10. * Kim Phillips <kim.phillips@freescale.com>
  11. *
  12. * This program is free software; you can redistribute it and/or modify it
  13. * under the terms of the GNU General Public License as published by the
  14. * Free Software Foundation; either version 2 of the License, or (at your
  15. * option) any later version.
  16. *
  17. */
  18. #ifndef __UEC_MII_H
  19. #define __UEC_MII_H
  20. /* UCC GETH MIIMCFG (MII Management Configuration Register) */
  21. #define MIIMCFG_RESET_MANAGEMENT 0x80000000 /* Reset
  22. management */
  23. #define MIIMCFG_NO_PREAMBLE 0x00000010 /* Preamble
  24. suppress */
  25. #define MIIMCFG_CLOCK_DIVIDE_SHIFT (31 - 31) /* clock divide
  26. << shift */
  27. #define MIIMCFG_CLOCK_DIVIDE_MAX 0xf /* max clock divide */
  28. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_2 0x00000000
  29. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_4 0x00000001
  30. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_6 0x00000002
  31. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_8 0x00000003
  32. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_10 0x00000004
  33. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_14 0x00000005
  34. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_16 0x00000008
  35. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_20 0x00000006
  36. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_28 0x00000007
  37. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_32 0x00000009
  38. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_48 0x0000000a
  39. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_64 0x0000000b
  40. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_80 0x0000000c
  41. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_112 0x0000000d
  42. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_160 0x0000000e
  43. #define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_224 0x0000000f
  44. /* UCC GETH MIIMCOM (MII Management Command Register) */
  45. #define MIIMCOM_SCAN_CYCLE 0x00000002 /* Scan cycle */
  46. #define MIIMCOM_READ_CYCLE 0x00000001 /* Read cycle */
  47. /* UCC GETH MIIMADD (MII Management Address Register) */
  48. #define MIIMADD_PHY_ADDRESS_SHIFT (31 - 23) /* PHY Address
  49. << shift */
  50. #define MIIMADD_PHY_REGISTER_SHIFT (31 - 31) /* PHY Register
  51. << shift */
  52. /* UCC GETH MIIMCON (MII Management Control Register) */
  53. #define MIIMCON_PHY_CONTROL_SHIFT (31 - 31) /* PHY Control
  54. << shift */
  55. #define MIIMCON_PHY_STATUS_SHIFT (31 - 31) /* PHY Status
  56. << shift */
  57. /* UCC GETH MIIMIND (MII Management Indicator Register) */
  58. #define MIIMIND_NOT_VALID 0x00000004 /* Not valid */
  59. #define MIIMIND_SCAN 0x00000002 /* Scan in
  60. progress */
  61. #define MIIMIND_BUSY 0x00000001
  62. /* Initial TBI Physical Address */
  63. #define UTBIPAR_INIT_TBIPA 0x1f
  64. struct ucc_mii_mng {
  65. u32 miimcfg; /* MII management configuration reg */
  66. u32 miimcom; /* MII management command reg */
  67. u32 miimadd; /* MII management address reg */
  68. u32 miimcon; /* MII management control reg */
  69. u32 miimstat; /* MII management status reg */
  70. u32 miimind; /* MII management indication reg */
  71. u8 notcare[28]; /* Space holder */
  72. u32 utbipar; /* TBI phy address reg */
  73. } __attribute__ ((packed));
  74. /* TBI / MII Set Register */
  75. enum enet_tbi_mii_reg {
  76. ENET_TBI_MII_CR = 0x00, /* Control */
  77. ENET_TBI_MII_SR = 0x01, /* Status */
  78. ENET_TBI_MII_ANA = 0x04, /* AN advertisement */
  79. ENET_TBI_MII_ANLPBPA = 0x05, /* AN link partner base page ability */
  80. ENET_TBI_MII_ANEX = 0x06, /* AN expansion */
  81. ENET_TBI_MII_ANNPT = 0x07, /* AN next page transmit */
  82. ENET_TBI_MII_ANLPANP = 0x08, /* AN link partner ability next page */
  83. ENET_TBI_MII_EXST = 0x0F, /* Extended status */
  84. ENET_TBI_MII_JD = 0x10, /* Jitter diagnostics */
  85. ENET_TBI_MII_TBICON = 0x11 /* TBI control */
  86. };
  87. int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
  88. int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
  89. int __init uec_mdio_init(void);
  90. void uec_mdio_exit(void);
  91. #endif /* __UEC_MII_H */