Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
gianfar_ptp.c File Reference
#include <linux/device.h>
#include <linux/hrtimer.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/timex.h>
#include <linux/io.h>
#include <linux/ptp_clock_kernel.h>
#include "gianfar.h"

Go to the source code of this file.

Data Structures

struct  gianfar_ptp_registers
 
struct  etsects
 

Macros

#define ALM1P   (1<<31) /* Alarm1 output polarity */
 
#define ALM2P   (1<<30) /* Alarm2 output polarity */
 
#define FS   (1<<28) /* FIPER start indication */
 
#define PP1L   (1<<27) /* Fiper1 pulse loopback mode enabled. */
 
#define PP2L   (1<<26) /* Fiper2 pulse loopback mode enabled. */
 
#define TCLK_PERIOD_SHIFT   (16) /* 1588 timer reference clock period. */
 
#define TCLK_PERIOD_MASK   (0x3ff)
 
#define RTPE   (1<<15) /* Record Tx Timestamp to PAL Enable. */
 
#define FRD   (1<<14) /* FIPER Realignment Disable */
 
#define ESFDP   (1<<11) /* External Tx/Rx SFD Polarity. */
 
#define ESFDE   (1<<10) /* External Tx/Rx SFD Enable. */
 
#define ETEP2   (1<<9) /* External trigger 2 edge polarity */
 
#define ETEP1   (1<<8) /* External trigger 1 edge polarity */
 
#define COPH   (1<<7) /* Generated clock output phase. */
 
#define CIPH   (1<<6) /* External oscillator input clock phase */
 
#define TMSR   (1<<5) /* Timer soft reset. */
 
#define BYP   (1<<3) /* Bypass drift compensated clock */
 
#define TE   (1<<2) /* 1588 timer enable. */
 
#define CKSEL_SHIFT   (0) /* 1588 Timer reference clock source */
 
#define CKSEL_MASK   (0x3)
 
#define ETS2   (1<<25) /* External trigger 2 timestamp sampled */
 
#define ETS1   (1<<24) /* External trigger 1 timestamp sampled */
 
#define ALM2   (1<<17) /* Current time = alarm time register 2 */
 
#define ALM1   (1<<16) /* Current time = alarm time register 1 */
 
#define PP1   (1<<7) /* periodic pulse generated on FIPER1 */
 
#define PP2   (1<<6) /* periodic pulse generated on FIPER2 */
 
#define PP3   (1<<5) /* periodic pulse generated on FIPER3 */
 
#define ETS2EN   (1<<25) /* External trigger 2 timestamp enable */
 
#define ETS1EN   (1<<24) /* External trigger 1 timestamp enable */
 
#define ALM2EN   (1<<17) /* Timer ALM2 event enable */
 
#define ALM1EN   (1<<16) /* Timer ALM1 event enable */
 
#define PP1EN   (1<<7) /* Periodic pulse event 1 enable */
 
#define PP2EN   (1<<6) /* Periodic pulse event 2 enable */
 
#define TXP2   (1<<9) /* PTP transmitted timestamp im TXTS2 */
 
#define TXP1   (1<<8) /* PTP transmitted timestamp in TXTS1 */
 
#define RXP   (1<<0) /* PTP frame has been received */
 
#define TXP2EN   (1<<9) /* Transmit PTP packet event 2 enable */
 
#define TXP1EN   (1<<8) /* Transmit PTP packet event 1 enable */
 
#define RXPEN   (1<<0) /* Receive PTP packet event enable */
 
#define STAT_VEC_SHIFT   (0) /* Timer general purpose status vector */
 
#define STAT_VEC_MASK   (0x3f)
 
#define PRSC_OCK_SHIFT   (0) /* Output clock division/prescale factor. */
 
#define PRSC_OCK_MASK   (0xffff)
 
#define DRIVER   "gianfar_ptp"
 
#define DEFAULT_CKSEL   1
 
#define N_ALARM   1 /* first alarm is used internally to reset fipers */
 
#define N_EXT_TS   2
 
#define REG_SIZE   sizeof(struct gianfar_ptp_registers)
 

Functions

 module_platform_driver (gianfar_ptp_driver)
 
 MODULE_AUTHOR ("Richard Cochran <[email protected]>")
 
 MODULE_DESCRIPTION ("PTP clock using the eTSEC")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define ALM1   (1<<16) /* Current time = alarm time register 1 */

Definition at line 96 of file gianfar_ptp.c.

#define ALM1EN   (1<<16) /* Timer ALM1 event enable */

Definition at line 105 of file gianfar_ptp.c.

#define ALM1P   (1<<31) /* Alarm1 output polarity */

Definition at line 71 of file gianfar_ptp.c.

#define ALM2   (1<<17) /* Current time = alarm time register 2 */

Definition at line 95 of file gianfar_ptp.c.

#define ALM2EN   (1<<17) /* Timer ALM2 event enable */

Definition at line 104 of file gianfar_ptp.c.

#define ALM2P   (1<<30) /* Alarm2 output polarity */

Definition at line 72 of file gianfar_ptp.c.

#define BYP   (1<<3) /* Bypass drift compensated clock */

Definition at line 87 of file gianfar_ptp.c.

#define CIPH   (1<<6) /* External oscillator input clock phase */

Definition at line 85 of file gianfar_ptp.c.

#define CKSEL_MASK   (0x3)

Definition at line 90 of file gianfar_ptp.c.

#define CKSEL_SHIFT   (0) /* 1588 Timer reference clock source */

Definition at line 89 of file gianfar_ptp.c.

#define COPH   (1<<7) /* Generated clock output phase. */

Definition at line 84 of file gianfar_ptp.c.

#define DEFAULT_CKSEL   1

Definition at line 129 of file gianfar_ptp.c.

#define DRIVER   "gianfar_ptp"

Definition at line 128 of file gianfar_ptp.c.

#define ESFDE   (1<<10) /* External Tx/Rx SFD Enable. */

Definition at line 81 of file gianfar_ptp.c.

#define ESFDP   (1<<11) /* External Tx/Rx SFD Polarity. */

Definition at line 80 of file gianfar_ptp.c.

#define ETEP1   (1<<8) /* External trigger 1 edge polarity */

Definition at line 83 of file gianfar_ptp.c.

#define ETEP2   (1<<9) /* External trigger 2 edge polarity */

Definition at line 82 of file gianfar_ptp.c.

#define ETS1   (1<<24) /* External trigger 1 timestamp sampled */

Definition at line 94 of file gianfar_ptp.c.

#define ETS1EN   (1<<24) /* External trigger 1 timestamp enable */

Definition at line 103 of file gianfar_ptp.c.

#define ETS2   (1<<25) /* External trigger 2 timestamp sampled */

Definition at line 93 of file gianfar_ptp.c.

#define ETS2EN   (1<<25) /* External trigger 2 timestamp enable */

Definition at line 102 of file gianfar_ptp.c.

#define FRD   (1<<14) /* FIPER Realignment Disable */

Definition at line 79 of file gianfar_ptp.c.

#define FS   (1<<28) /* FIPER start indication */

Definition at line 73 of file gianfar_ptp.c.

#define N_ALARM   1 /* first alarm is used internally to reset fipers */

Definition at line 130 of file gianfar_ptp.c.

#define N_EXT_TS   2

Definition at line 131 of file gianfar_ptp.c.

#define PP1   (1<<7) /* periodic pulse generated on FIPER1 */

Definition at line 97 of file gianfar_ptp.c.

#define PP1EN   (1<<7) /* Periodic pulse event 1 enable */

Definition at line 106 of file gianfar_ptp.c.

#define PP1L   (1<<27) /* Fiper1 pulse loopback mode enabled. */

Definition at line 74 of file gianfar_ptp.c.

#define PP2   (1<<6) /* periodic pulse generated on FIPER2 */

Definition at line 98 of file gianfar_ptp.c.

#define PP2EN   (1<<6) /* Periodic pulse event 2 enable */

Definition at line 107 of file gianfar_ptp.c.

#define PP2L   (1<<26) /* Fiper2 pulse loopback mode enabled. */

Definition at line 75 of file gianfar_ptp.c.

#define PP3   (1<<5) /* periodic pulse generated on FIPER3 */

Definition at line 99 of file gianfar_ptp.c.

#define PRSC_OCK_MASK   (0xffff)

Definition at line 125 of file gianfar_ptp.c.

#define PRSC_OCK_SHIFT   (0) /* Output clock division/prescale factor. */

Definition at line 124 of file gianfar_ptp.c.

#define REG_SIZE   sizeof(struct gianfar_ptp_registers)

Definition at line 132 of file gianfar_ptp.c.

#define RTPE   (1<<15) /* Record Tx Timestamp to PAL Enable. */

Definition at line 78 of file gianfar_ptp.c.

#define RXP   (1<<0) /* PTP frame has been received */

Definition at line 112 of file gianfar_ptp.c.

#define RXPEN   (1<<0) /* Receive PTP packet event enable */

Definition at line 117 of file gianfar_ptp.c.

#define STAT_VEC_MASK   (0x3f)

Definition at line 121 of file gianfar_ptp.c.

#define STAT_VEC_SHIFT   (0) /* Timer general purpose status vector */

Definition at line 120 of file gianfar_ptp.c.

#define TCLK_PERIOD_MASK   (0x3ff)

Definition at line 77 of file gianfar_ptp.c.

#define TCLK_PERIOD_SHIFT   (16) /* 1588 timer reference clock period. */

Definition at line 76 of file gianfar_ptp.c.

#define TE   (1<<2) /* 1588 timer enable. */

Definition at line 88 of file gianfar_ptp.c.

#define TMSR   (1<<5) /* Timer soft reset. */

Definition at line 86 of file gianfar_ptp.c.

#define TXP1   (1<<8) /* PTP transmitted timestamp in TXTS1 */

Definition at line 111 of file gianfar_ptp.c.

#define TXP1EN   (1<<8) /* Transmit PTP packet event 1 enable */

Definition at line 116 of file gianfar_ptp.c.

#define TXP2   (1<<9) /* PTP transmitted timestamp im TXTS2 */

Definition at line 110 of file gianfar_ptp.c.

#define TXP2EN   (1<<9) /* Transmit PTP packet event 2 enable */

Definition at line 115 of file gianfar_ptp.c.

Function Documentation

MODULE_AUTHOR ( "Richard Cochran <[email protected]>"  )
MODULE_DESCRIPTION ( "PTP clock using the eTSEC"  )
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( gianfar_ptp_driver  )