diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2013-08-01 11:36:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-01 17:35:51 -0400 |
commit | 9ab5ec59c8a9cc0e4b94252b48200b6023c716aa (patch) | |
tree | fa9084e9bbb9eaf85689723d1b6e2c957f095a57 /arch | |
parent | 84e181ba3607a4e1175d929c346c72f9bfa1ab02 (diff) |
tile: support PTP using the tilegx mPIPE (IEEE 1588)
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/tile/gxio/iorpc_mpipe.c | 19 | ||||
-rw-r--r-- | arch/tile/include/gxio/iorpc_mpipe.h | 10 | ||||
-rw-r--r-- | arch/tile/include/gxio/mpipe.h | 14 |
3 files changed, 40 insertions, 3 deletions
diff --git a/arch/tile/gxio/iorpc_mpipe.c b/arch/tile/gxio/iorpc_mpipe.c index c2fb15167aee..4f8f3d619c4a 100644 --- a/arch/tile/gxio/iorpc_mpipe.c +++ b/arch/tile/gxio/iorpc_mpipe.c | |||
@@ -475,6 +475,25 @@ int gxio_mpipe_adjust_timestamp_aux(gxio_mpipe_context_t * context, | |||
475 | 475 | ||
476 | EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_aux); | 476 | EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_aux); |
477 | 477 | ||
478 | struct adjust_timestamp_freq_param { | ||
479 | int32_t ppb; | ||
480 | }; | ||
481 | |||
482 | int gxio_mpipe_adjust_timestamp_freq(gxio_mpipe_context_t * context, | ||
483 | int32_t ppb) | ||
484 | { | ||
485 | struct adjust_timestamp_freq_param temp; | ||
486 | struct adjust_timestamp_freq_param *params = &temp; | ||
487 | |||
488 | params->ppb = ppb; | ||
489 | |||
490 | return hv_dev_pwrite(context->fd, 0, (HV_VirtAddr) params, | ||
491 | sizeof(*params), | ||
492 | GXIO_MPIPE_OP_ADJUST_TIMESTAMP_FREQ); | ||
493 | } | ||
494 | |||
495 | EXPORT_SYMBOL(gxio_mpipe_adjust_timestamp_freq); | ||
496 | |||
478 | struct config_edma_ring_blks_param { | 497 | struct config_edma_ring_blks_param { |
479 | unsigned int ering; | 498 | unsigned int ering; |
480 | unsigned int max_blks; | 499 | unsigned int max_blks; |
diff --git a/arch/tile/include/gxio/iorpc_mpipe.h b/arch/tile/include/gxio/iorpc_mpipe.h index eef60fdd8525..fdd07f88cfd7 100644 --- a/arch/tile/include/gxio/iorpc_mpipe.h +++ b/arch/tile/include/gxio/iorpc_mpipe.h | |||
@@ -46,10 +46,11 @@ | |||
46 | #define GXIO_MPIPE_OP_LINK_CLOSE_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1212) | 46 | #define GXIO_MPIPE_OP_LINK_CLOSE_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1212) |
47 | #define GXIO_MPIPE_OP_LINK_SET_ATTR_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1213) | 47 | #define GXIO_MPIPE_OP_LINK_SET_ATTR_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1213) |
48 | 48 | ||
49 | #define GXIO_MPIPE_OP_GET_TIMESTAMP_AUX IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x121e) | 49 | #define GXIO_MPIPE_OP_GET_TIMESTAMP_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x121e) |
50 | #define GXIO_MPIPE_OP_SET_TIMESTAMP_AUX IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x121f) | 50 | #define GXIO_MPIPE_OP_SET_TIMESTAMP_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x121f) |
51 | #define GXIO_MPIPE_OP_ADJUST_TIMESTAMP_AUX IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x1220) | 51 | #define GXIO_MPIPE_OP_ADJUST_TIMESTAMP_AUX IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1220) |
52 | #define GXIO_MPIPE_OP_CONFIG_EDMA_RING_BLKS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1221) | 52 | #define GXIO_MPIPE_OP_CONFIG_EDMA_RING_BLKS IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1221) |
53 | #define GXIO_MPIPE_OP_ADJUST_TIMESTAMP_FREQ IORPC_OPCODE(IORPC_FORMAT_NONE, 0x1222) | ||
53 | #define GXIO_MPIPE_OP_ARM_POLLFD IORPC_OPCODE(IORPC_FORMAT_KERNEL_POLLFD, 0x9000) | 54 | #define GXIO_MPIPE_OP_ARM_POLLFD IORPC_OPCODE(IORPC_FORMAT_KERNEL_POLLFD, 0x9000) |
54 | #define GXIO_MPIPE_OP_CLOSE_POLLFD IORPC_OPCODE(IORPC_FORMAT_KERNEL_POLLFD, 0x9001) | 55 | #define GXIO_MPIPE_OP_CLOSE_POLLFD IORPC_OPCODE(IORPC_FORMAT_KERNEL_POLLFD, 0x9001) |
55 | #define GXIO_MPIPE_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000) | 56 | #define GXIO_MPIPE_OP_GET_MMIO_BASE IORPC_OPCODE(IORPC_FORMAT_NONE_NOUSER, 0x8000) |
@@ -128,6 +129,9 @@ int gxio_mpipe_set_timestamp_aux(gxio_mpipe_context_t * context, uint64_t sec, | |||
128 | int gxio_mpipe_adjust_timestamp_aux(gxio_mpipe_context_t * context, | 129 | int gxio_mpipe_adjust_timestamp_aux(gxio_mpipe_context_t * context, |
129 | int64_t nsec); | 130 | int64_t nsec); |
130 | 131 | ||
132 | int gxio_mpipe_adjust_timestamp_freq(gxio_mpipe_context_t * context, | ||
133 | int32_t ppb); | ||
134 | |||
131 | int gxio_mpipe_arm_pollfd(gxio_mpipe_context_t * context, int pollfd_cookie); | 135 | int gxio_mpipe_arm_pollfd(gxio_mpipe_context_t * context, int pollfd_cookie); |
132 | 136 | ||
133 | int gxio_mpipe_close_pollfd(gxio_mpipe_context_t * context, int pollfd_cookie); | 137 | int gxio_mpipe_close_pollfd(gxio_mpipe_context_t * context, int pollfd_cookie); |
diff --git a/arch/tile/include/gxio/mpipe.h b/arch/tile/include/gxio/mpipe.h index eb7fee41c9b6..e37cf4f0cffd 100644 --- a/arch/tile/include/gxio/mpipe.h +++ b/arch/tile/include/gxio/mpipe.h | |||
@@ -1854,4 +1854,18 @@ extern int gxio_mpipe_set_timestamp(gxio_mpipe_context_t *context, | |||
1854 | extern int gxio_mpipe_adjust_timestamp(gxio_mpipe_context_t *context, | 1854 | extern int gxio_mpipe_adjust_timestamp(gxio_mpipe_context_t *context, |
1855 | int64_t delta); | 1855 | int64_t delta); |
1856 | 1856 | ||
1857 | /** Adjust the mPIPE timestamp clock frequency. | ||
1858 | * | ||
1859 | * @param context An initialized mPIPE context. | ||
1860 | * @param ppb A 32-bit signed PPB (Parts Per Billion) value to adjust. | ||
1861 | * The absolute value of ppb must be less than or equal to 1000000000. | ||
1862 | * Values less than about 30000 will generally cause a GXIO_ERR_INVAL | ||
1863 | * return due to the granularity of the hardware that converts reference | ||
1864 | * clock cycles into seconds and nanoseconds. | ||
1865 | * @return If the call was successful, zero; otherwise, a negative error | ||
1866 | * code. | ||
1867 | */ | ||
1868 | extern int gxio_mpipe_adjust_timestamp_freq(gxio_mpipe_context_t* context, | ||
1869 | int32_t ppb); | ||
1870 | |||
1857 | #endif /* !_GXIO_MPIPE_H_ */ | 1871 | #endif /* !_GXIO_MPIPE_H_ */ |