2013-03-26 12:43:10 +08:00
|
|
|
|
/******************************************************************************
|
|
|
|
|
PTP Header file
|
|
|
|
|
|
|
|
|
|
Copyright (C) 2013 Vayavya Labs Pvt Ltd
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
under the terms and conditions of the GNU General Public License,
|
|
|
|
|
version 2, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
|
more details.
|
|
|
|
|
|
|
|
|
|
The full GNU General Public License is included in this distribution in
|
|
|
|
|
the file called "COPYING".
|
|
|
|
|
|
|
|
|
|
Author: Rayagond Kokatanur <rayagond@vayavyalabs.com>
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
2016-11-14 16:27:28 +08:00
|
|
|
|
#ifndef __STMMAC_PTP_H__
|
|
|
|
|
#define __STMMAC_PTP_H__
|
2013-03-26 12:43:10 +08:00
|
|
|
|
|
2016-11-14 16:27:28 +08:00
|
|
|
|
#define PTP_GMAC4_OFFSET 0xb00
|
|
|
|
|
#define PTP_GMAC3_X_OFFSET 0x700
|
2013-03-26 12:43:10 +08:00
|
|
|
|
|
2016-11-14 16:27:28 +08:00
|
|
|
|
/* IEEE 1588 PTP register offsets */
|
|
|
|
|
#define PTP_TCR 0x00 /* Timestamp Control Reg */
|
|
|
|
|
#define PTP_SSIR 0x04 /* Sub-Second Increment Reg */
|
|
|
|
|
#define PTP_STSR 0x08 /* System Time – Seconds Regr */
|
|
|
|
|
#define PTP_STNSR 0x0c /* System Time – Nanoseconds Reg */
|
|
|
|
|
#define PTP_STSUR 0x10 /* System Time – Seconds Update Reg */
|
|
|
|
|
#define PTP_STNSUR 0x14 /* System Time – Nanoseconds Update Reg */
|
|
|
|
|
#define PTP_TAR 0x18 /* Timestamp Addend Reg */
|
2013-03-26 12:43:10 +08:00
|
|
|
|
|
2016-11-14 16:27:28 +08:00
|
|
|
|
#define PTP_STNSUR_ADDSUB_SHIFT 31
|
|
|
|
|
#define PTP_DIGITAL_ROLLOVER_MODE 0x3B9ACA00 /* 10e9-1 ns */
|
|
|
|
|
#define PTP_BINARY_ROLLOVER_MODE 0x80000000 /* ~0.466 ns */
|
2013-03-26 12:43:10 +08:00
|
|
|
|
|
2016-11-14 16:27:28 +08:00
|
|
|
|
/* PTP Timestamp control register defines */
|
|
|
|
|
#define PTP_TCR_TSENA BIT(0) /* Timestamp Enable */
|
|
|
|
|
#define PTP_TCR_TSCFUPDT BIT(1) /* Timestamp Fine/Coarse Update */
|
|
|
|
|
#define PTP_TCR_TSINIT BIT(2) /* Timestamp Initialize */
|
|
|
|
|
#define PTP_TCR_TSUPDT BIT(3) /* Timestamp Update */
|
|
|
|
|
#define PTP_TCR_TSTRIG BIT(4) /* Timestamp Interrupt Trigger Enable */
|
|
|
|
|
#define PTP_TCR_TSADDREG BIT(5) /* Addend Reg Update */
|
|
|
|
|
#define PTP_TCR_TSENALL BIT(8) /* Enable Timestamp for All Frames */
|
|
|
|
|
#define PTP_TCR_TSCTRLSSR BIT(9) /* Digital or Binary Rollover Control */
|
2013-03-26 12:43:10 +08:00
|
|
|
|
/* Enable PTP packet Processing for Version 2 Format */
|
2016-11-14 16:27:28 +08:00
|
|
|
|
#define PTP_TCR_TSVER2ENA BIT(10)
|
2013-03-26 12:43:10 +08:00
|
|
|
|
/* Enable Processing of PTP over Ethernet Frames */
|
2016-11-14 16:27:28 +08:00
|
|
|
|
#define PTP_TCR_TSIPENA BIT(11)
|
2013-03-26 12:43:10 +08:00
|
|
|
|
/* Enable Processing of PTP Frames Sent over IPv6-UDP */
|
2016-11-14 16:27:28 +08:00
|
|
|
|
#define PTP_TCR_TSIPV6ENA BIT(12)
|
2013-03-26 12:43:10 +08:00
|
|
|
|
/* Enable Processing of PTP Frames Sent over IPv4-UDP */
|
2016-11-14 16:27:28 +08:00
|
|
|
|
#define PTP_TCR_TSIPV4ENA BIT(13)
|
2013-03-26 12:43:10 +08:00
|
|
|
|
/* Enable Timestamp Snapshot for Event Messages */
|
2016-11-14 16:27:28 +08:00
|
|
|
|
#define PTP_TCR_TSEVNTENA BIT(14)
|
2013-03-26 12:43:10 +08:00
|
|
|
|
/* Enable Snapshot for Messages Relevant to Master */
|
2016-11-14 16:27:28 +08:00
|
|
|
|
#define PTP_TCR_TSMSTRENA BIT(15)
|
2013-03-26 12:43:10 +08:00
|
|
|
|
/* Select PTP packets for Taking Snapshots */
|
2017-06-09 04:41:02 +08:00
|
|
|
|
#define PTP_TCR_SNAPTYPSEL_1 BIT(16)
|
|
|
|
|
#define PTP_GMAC4_TCR_SNAPTYPSEL_1 GENMASK(17, 16)
|
2013-03-26 12:43:10 +08:00
|
|
|
|
/* Enable MAC address for PTP Frame Filtering */
|
2016-11-14 16:27:28 +08:00
|
|
|
|
#define PTP_TCR_TSENMACADDR BIT(18)
|
|
|
|
|
|
|
|
|
|
/* SSIR defines */
|
|
|
|
|
#define PTP_SSIR_SSINC_MASK 0xff
|
|
|
|
|
#define GMAC4_PTP_SSIR_SSINC_SHIFT 16
|
2013-03-26 12:43:10 +08:00
|
|
|
|
|
2016-11-14 16:27:28 +08:00
|
|
|
|
#endif /* __STMMAC_PTP_H__ */
|