aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
diff options
context:
space:
mode:
authorRayagond Kokatanur <rayagond@vayavyalabs.com>2013-03-26 00:43:10 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-26 12:53:37 -0400
commit891434b18ec0a21cfa4788695165b74e8d4c0474 (patch)
tree1b052da23d5f4b86efdf0cf45330bf64958e9b62 /drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
parentcf32deec16e4e8d47305bdc638fd108c88e06081 (diff)
stmmac: add IEEE PTPv1 and PTPv2 support.
This patch enhances the stmmac driver to support IEEE 1588-2002 PTP (Precision Time Protocol) version 1 and IEEE 1588-2008 PPT version 2. Precision Time Protocol(PTP),which enables precise synchronization of clocks in measurement and control systems implemented with technologies such as network communication,local computing, & distributed objects. Both PTPv1 and PTPv2 is selected at run-time using the HW capability register. The PTPv1 TimeStamp support can be used on chips that have the normal descriptor structures and PTPv2 TimeStamp support can be used on chips that have the Extended descriptors(DES4-5-6-7). All such sanity checks are done and verified by using HW capability register. V2: in this version the ethtool support has been included in this patch; Koptions have been completely removed (previously added to select PTP and PTPv2). PTPv1 and PTPv2 is now added in a single patch instead of two patches. get_timestamp() and get_systemtime() L/H have been combined into single APIs. Signed-off-by: Rayagond Kokatanur <rayagond@vayavyalabs.com> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Cc: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
new file mode 100644
index 000000000000..3dbc047622fa
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h
@@ -0,0 +1,74 @@
1/******************************************************************************
2 PTP Header file
3
4 Copyright (C) 2013 Vayavya Labs Pvt Ltd
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Author: Rayagond Kokatanur <rayagond@vayavyalabs.com>
23******************************************************************************/
24
25#ifndef __STMMAC_PTP_H__
26#define __STMMAC_PTP_H__
27
28#define STMMAC_SYSCLOCK 62500000
29
30/* IEEE 1588 PTP register offsets */
31#define PTP_TCR 0x0700 /* Timestamp Control Reg */
32#define PTP_SSIR 0x0704 /* Sub-Second Increment Reg */
33#define PTP_STSR 0x0708 /* System Time – Seconds Regr */
34#define PTP_STNSR 0x070C /* System Time – Nanoseconds Reg */
35#define PTP_STSUR 0x0710 /* System Time – Seconds Update Reg */
36#define PTP_STNSUR 0x0714 /* System Time – Nanoseconds Update Reg */
37#define PTP_TAR 0x0718 /* Timestamp Addend Reg */
38#define PTP_TTSR 0x071C /* Target Time Seconds Reg */
39#define PTP_TTNSR 0x0720 /* Target Time Nanoseconds Reg */
40#define PTP_STHWSR 0x0724 /* System Time - Higher Word Seconds Reg */
41#define PTP_TSR 0x0728 /* Timestamp Status */
42
43#define PTP_STNSUR_ADDSUB_SHIFT 31
44
45/* PTP TCR defines */
46#define PTP_TCR_TSENA 0x00000001 /* Timestamp Enable */
47#define PTP_TCR_TSCFUPDT 0x00000002 /* Timestamp Fine/Coarse Update */
48#define PTP_TCR_TSINIT 0x00000004 /* Timestamp Initialize */
49#define PTP_TCR_TSUPDT 0x00000008 /* Timestamp Update */
50/* Timestamp Interrupt Trigger Enable */
51#define PTP_TCR_TSTRIG 0x00000010
52#define PTP_TCR_TSADDREG 0x00000020 /* Addend Reg Update */
53#define PTP_TCR_TSENALL 0x00000100 /* Enable Timestamp for All Frames */
54/* Timestamp Digital or Binary Rollover Control */
55#define PTP_TCR_TSCTRLSSR 0x00000200
56
57/* Enable PTP packet Processing for Version 2 Format */
58#define PTP_TCR_TSVER2ENA 0x00000400
59/* Enable Processing of PTP over Ethernet Frames */
60#define PTP_TCR_TSIPENA 0x00000800
61/* Enable Processing of PTP Frames Sent over IPv6-UDP */
62#define PTP_TCR_TSIPV6ENA 0x00001000
63/* Enable Processing of PTP Frames Sent over IPv4-UDP */
64#define PTP_TCR_TSIPV4ENA 0x00002000
65/* Enable Timestamp Snapshot for Event Messages */
66#define PTP_TCR_TSEVNTENA 0x00004000
67/* Enable Snapshot for Messages Relevant to Master */
68#define PTP_TCR_TSMSTRENA 0x00008000
69/* Select PTP packets for Taking Snapshots */
70#define PTP_TCR_SNAPTYPSEL_1 0x00010000
71/* Enable MAC address for PTP Frame Filtering */
72#define PTP_TCR_TSENMACADDR 0x00040000
73
74#endif /* __STMMAC_PTP_H__ */