stmmac_ptp.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /******************************************************************************
  2. PTP Header file
  3. Copyright (C) 2013 Vayavya Labs Pvt Ltd
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc.,
  13. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  14. The full GNU General Public License is included in this distribution in
  15. the file called "COPYING".
  16. Author: Rayagond Kokatanur <rayagond@vayavyalabs.com>
  17. ******************************************************************************/
  18. #ifndef __STMMAC_PTP_H__
  19. #define __STMMAC_PTP_H__
  20. #define PTP_GMAC4_OFFSET 0xb00
  21. #define PTP_GMAC3_X_OFFSET 0x700
  22. /* IEEE 1588 PTP register offsets */
  23. #define PTP_TCR 0x00 /* Timestamp Control Reg */
  24. #define PTP_SSIR 0x04 /* Sub-Second Increment Reg */
  25. #define PTP_STSR 0x08 /* System Time – Seconds Regr */
  26. #define PTP_STNSR 0x0c /* System Time – Nanoseconds Reg */
  27. #define PTP_STSUR 0x10 /* System Time – Seconds Update Reg */
  28. #define PTP_STNSUR 0x14 /* System Time – Nanoseconds Update Reg */
  29. #define PTP_TAR 0x18 /* Timestamp Addend Reg */
  30. #define PTP_STNSUR_ADDSUB_SHIFT 31
  31. #define PTP_DIGITAL_ROLLOVER_MODE 0x3B9ACA00 /* 10e9-1 ns */
  32. #define PTP_BINARY_ROLLOVER_MODE 0x80000000 /* ~0.466 ns */
  33. /* PTP Timestamp control register defines */
  34. #define PTP_TCR_TSENA BIT(0) /* Timestamp Enable */
  35. #define PTP_TCR_TSCFUPDT BIT(1) /* Timestamp Fine/Coarse Update */
  36. #define PTP_TCR_TSINIT BIT(2) /* Timestamp Initialize */
  37. #define PTP_TCR_TSUPDT BIT(3) /* Timestamp Update */
  38. #define PTP_TCR_TSTRIG BIT(4) /* Timestamp Interrupt Trigger Enable */
  39. #define PTP_TCR_TSADDREG BIT(5) /* Addend Reg Update */
  40. #define PTP_TCR_TSENALL BIT(8) /* Enable Timestamp for All Frames */
  41. #define PTP_TCR_TSCTRLSSR BIT(9) /* Digital or Binary Rollover Control */
  42. /* Enable PTP packet Processing for Version 2 Format */
  43. #define PTP_TCR_TSVER2ENA BIT(10)
  44. /* Enable Processing of PTP over Ethernet Frames */
  45. #define PTP_TCR_TSIPENA BIT(11)
  46. /* Enable Processing of PTP Frames Sent over IPv6-UDP */
  47. #define PTP_TCR_TSIPV6ENA BIT(12)
  48. /* Enable Processing of PTP Frames Sent over IPv4-UDP */
  49. #define PTP_TCR_TSIPV4ENA BIT(13)
  50. /* Enable Timestamp Snapshot for Event Messages */
  51. #define PTP_TCR_TSEVNTENA BIT(14)
  52. /* Enable Snapshot for Messages Relevant to Master */
  53. #define PTP_TCR_TSMSTRENA BIT(15)
  54. /* Select PTP packets for Taking Snapshots */
  55. #define PTP_TCR_SNAPTYPSEL_1 BIT(16)
  56. #define PTP_GMAC4_TCR_SNAPTYPSEL_1 GENMASK(17, 16)
  57. /* Enable MAC address for PTP Frame Filtering */
  58. #define PTP_TCR_TSENMACADDR BIT(18)
  59. /* SSIR defines */
  60. #define PTP_SSIR_SSINC_MASK 0xff
  61. #define GMAC4_PTP_SSIR_SSINC_SHIFT 16
  62. #endif /* __STMMAC_PTP_H__ */