ixp46x_ts.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * PTP 1588 clock using the IXP46X
  3. *
  4. * Copyright (C) 2010 OMICRON electronics GmbH
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (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., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20. #ifndef _IXP46X_TS_H_
  21. #define _IXP46X_TS_H_
  22. #define DEFAULT_ADDEND 0xF0000029
  23. #define TICKS_NS_SHIFT 4
  24. struct ixp46x_channel_ctl {
  25. u32 ch_control; /* 0x40 Time Synchronization Channel Control */
  26. u32 ch_event; /* 0x44 Time Synchronization Channel Event */
  27. u32 tx_snap_lo; /* 0x48 Transmit Snapshot Low Register */
  28. u32 tx_snap_hi; /* 0x4C Transmit Snapshot High Register */
  29. u32 rx_snap_lo; /* 0x50 Receive Snapshot Low Register */
  30. u32 rx_snap_hi; /* 0x54 Receive Snapshot High Register */
  31. u32 src_uuid_lo; /* 0x58 Source UUID0 Low Register */
  32. u32 src_uuid_hi; /* 0x5C Sequence Identifier/Source UUID0 High */
  33. };
  34. struct ixp46x_ts_regs {
  35. u32 control; /* 0x00 Time Sync Control Register */
  36. u32 event; /* 0x04 Time Sync Event Register */
  37. u32 addend; /* 0x08 Time Sync Addend Register */
  38. u32 accum; /* 0x0C Time Sync Accumulator Register */
  39. u32 test; /* 0x10 Time Sync Test Register */
  40. u32 unused; /* 0x14 */
  41. u32 rsystime_lo; /* 0x18 RawSystemTime_Low Register */
  42. u32 rsystime_hi; /* 0x1C RawSystemTime_High Register */
  43. u32 systime_lo; /* 0x20 SystemTime_Low Register */
  44. u32 systime_hi; /* 0x24 SystemTime_High Register */
  45. u32 trgt_lo; /* 0x28 TargetTime_Low Register */
  46. u32 trgt_hi; /* 0x2C TargetTime_High Register */
  47. u32 asms_lo; /* 0x30 Auxiliary Slave Mode Snapshot Low */
  48. u32 asms_hi; /* 0x34 Auxiliary Slave Mode Snapshot High */
  49. u32 amms_lo; /* 0x38 Auxiliary Master Mode Snapshot Low */
  50. u32 amms_hi; /* 0x3C Auxiliary Master Mode Snapshot High */
  51. struct ixp46x_channel_ctl channel[3];
  52. };
  53. /* 0x00 Time Sync Control Register Bits */
  54. #define TSCR_AMM (1<<3)
  55. #define TSCR_ASM (1<<2)
  56. #define TSCR_TTM (1<<1)
  57. #define TSCR_RST (1<<0)
  58. /* 0x04 Time Sync Event Register Bits */
  59. #define TSER_SNM (1<<3)
  60. #define TSER_SNS (1<<2)
  61. #define TTIPEND (1<<1)
  62. /* 0x40 Time Synchronization Channel Control Register Bits */
  63. #define MASTER_MODE (1<<0)
  64. #define TIMESTAMP_ALL (1<<1)
  65. /* 0x44 Time Synchronization Channel Event Register Bits */
  66. #define TX_SNAPSHOT_LOCKED (1<<0)
  67. #define RX_SNAPSHOT_LOCKED (1<<1)
  68. /* The ptp_ixp46x module will set this variable */
  69. extern int ixp46x_phc_index;
  70. #endif