You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lan78xx.h 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #ifndef _LAN78XX_H
  2. #define _LAN78XX_H
  3. /** @file
  4. *
  5. * Microchip LAN78xx USB Ethernet driver
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include "smscusb.h"
  10. #include "smsc75xx.h"
  11. /** Hardware configuration register */
  12. #define LAN78XX_HW_CFG 0x0010
  13. #define LAN78XX_HW_CFG_LED1_EN 0x00200000UL /**< LED1 enable */
  14. #define LAN78XX_HW_CFG_LED0_EN 0x00100000UL /**< LED1 enable */
  15. #define LAN78XX_HW_CFG_LRST 0x00000002UL /**< Soft lite reset */
  16. /** Interrupt endpoint control register */
  17. #define LAN78XX_INT_EP_CTL 0x0098
  18. #define LAN78XX_INT_EP_CTL_RDFO_EN 0x00400000UL /**< RX FIFO overflow */
  19. #define LAN78XX_INT_EP_CTL_PHY_EN 0x00020000UL /**< PHY interrupt */
  20. /** Bulk IN delay register */
  21. #define LAN78XX_BULK_IN_DLY 0x0094
  22. #define LAN78XX_BULK_IN_DLY_SET(ticks) ( (ticks) << 0 ) /**< Delay / 16.7ns */
  23. /** EEPROM register base */
  24. #define LAN78XX_E2P_BASE 0x0040
  25. /** USB configuration register 0 */
  26. #define LAN78XX_USB_CFG0 0x0080
  27. #define LAN78XX_USB_CFG0_BIR 0x00000040UL /**< Bulk IN use NAK */
  28. /** Receive filtering engine control register */
  29. #define LAN78XX_RFE_CTL 0x00b0
  30. #define LAN78XX_RFE_CTL_AB 0x00000400UL /**< Accept broadcast */
  31. #define LAN78XX_RFE_CTL_AM 0x00000200UL /**< Accept multicast */
  32. #define LAN78XX_RFE_CTL_AU 0x00000100UL /**< Accept unicast */
  33. /** FIFO controller RX FIFO control register */
  34. #define LAN78XX_FCT_RX_CTL 0x00c0
  35. #define LAN78XX_FCT_RX_CTL_EN 0x80000000UL /**< FCT RX enable */
  36. #define LAN78XX_FCT_RX_CTL_BAD 0x02000000UL /**< Store bad frames */
  37. /** FIFO controller TX FIFO control register */
  38. #define LAN78XX_FCT_TX_CTL 0x00c4
  39. #define LAN78XX_FCT_TX_CTL_EN 0x80000000UL /**< FCT TX enable */
  40. /** MAC control register */
  41. #define LAN78XX_MAC_CR 0x0100
  42. #define LAN78XX_MAC_CR_ADP 0x00002000UL /**< Duplex polarity */
  43. #define LAN78XX_MAC_CR_ADD 0x00001000UL /**< Auto duplex */
  44. #define LAN78XX_MAC_CR_ASD 0x00000800UL /**< Auto speed */
  45. /** MAC receive register */
  46. #define LAN78XX_MAC_RX 0x0104
  47. #define LAN78XX_MAC_RX_MAX_SIZE(mtu) ( (mtu) << 16 ) /**< Max frame size */
  48. #define LAN78XX_MAC_RX_MAX_SIZE_DEFAULT \
  49. LAN78XX_MAC_RX_MAX_SIZE ( ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* CRC */ )
  50. #define LAN78XX_MAC_RX_FCS 0x00000010UL /**< FCS stripping */
  51. #define LAN78XX_MAC_RX_EN 0x00000001UL /**< RX enable */
  52. /** MAC transmit register */
  53. #define LAN78XX_MAC_TX 0x0108
  54. #define LAN78XX_MAC_TX_EN 0x00000001UL /**< TX enable */
  55. /** MAC receive address register base */
  56. #define LAN78XX_RX_ADDR_BASE 0x0118
  57. /** MII register base */
  58. #define LAN78XX_MII_BASE 0x0120
  59. /** PHY interrupt mask MII register */
  60. #define LAN78XX_MII_PHY_INTR_MASK 25
  61. /** PHY interrupt source MII register */
  62. #define LAN78XX_MII_PHY_INTR_SOURCE 26
  63. /** PHY interrupt: global enable */
  64. #define LAN78XX_PHY_INTR_ENABLE 0x8000
  65. /** PHY interrupt: link state change */
  66. #define LAN78XX_PHY_INTR_LINK 0x2000
  67. /** PHY interrupt: auto-negotiation failure */
  68. #define LAN78XX_PHY_INTR_ANEG_ERR 0x0800
  69. /** PHY interrupt: auto-negotiation complete */
  70. #define LAN78XX_PHY_INTR_ANEG_DONE 0x0400
  71. /** MAC address perfect filter register base */
  72. #define LAN78XX_ADDR_FILT_BASE 0x0400
  73. /** OTP register base */
  74. #define LAN78XX_OTP_BASE 0x1000
  75. /** Maximum time to wait for reset (in milliseconds) */
  76. #define LAN78XX_RESET_MAX_WAIT_MS 100
  77. #endif /* _LAN78XX_H */