1891434b1SRayagond Kokatanur /******************************************************************************
2891434b1SRayagond Kokatanur   PTP Header file
3891434b1SRayagond Kokatanur 
4891434b1SRayagond Kokatanur   Copyright (C) 2013  Vayavya Labs Pvt Ltd
5891434b1SRayagond Kokatanur 
6891434b1SRayagond Kokatanur   This program is free software; you can redistribute it and/or modify it
7891434b1SRayagond Kokatanur   under the terms and conditions of the GNU General Public License,
8891434b1SRayagond Kokatanur   version 2, as published by the Free Software Foundation.
9891434b1SRayagond Kokatanur 
10891434b1SRayagond Kokatanur   This program is distributed in the hope it will be useful, but WITHOUT
11891434b1SRayagond Kokatanur   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12891434b1SRayagond Kokatanur   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13891434b1SRayagond Kokatanur   more details.
14891434b1SRayagond Kokatanur 
15891434b1SRayagond Kokatanur   You should have received a copy of the GNU General Public License along with
16891434b1SRayagond Kokatanur   this program; if not, write to the Free Software Foundation, Inc.,
17891434b1SRayagond Kokatanur   51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18891434b1SRayagond Kokatanur 
19891434b1SRayagond Kokatanur   The full GNU General Public License is included in this distribution in
20891434b1SRayagond Kokatanur   the file called "COPYING".
21891434b1SRayagond Kokatanur 
22891434b1SRayagond Kokatanur   Author: Rayagond Kokatanur <rayagond@vayavyalabs.com>
23891434b1SRayagond Kokatanur ******************************************************************************/
24891434b1SRayagond Kokatanur 
25891434b1SRayagond Kokatanur #ifndef __STMMAC_PTP_H__
26891434b1SRayagond Kokatanur #define __STMMAC_PTP_H__
27891434b1SRayagond Kokatanur 
28891434b1SRayagond Kokatanur #define STMMAC_SYSCLOCK 62500000
29891434b1SRayagond Kokatanur 
30891434b1SRayagond Kokatanur /* IEEE 1588 PTP register offsets */
31891434b1SRayagond Kokatanur #define PTP_TCR		0x0700	/* Timestamp Control Reg */
32891434b1SRayagond Kokatanur #define PTP_SSIR	0x0704	/* Sub-Second Increment Reg */
33891434b1SRayagond Kokatanur #define PTP_STSR	0x0708	/* System Time – Seconds Regr */
34891434b1SRayagond Kokatanur #define PTP_STNSR	0x070C	/* System Time – Nanoseconds Reg */
35891434b1SRayagond Kokatanur #define PTP_STSUR	0x0710	/* System Time – Seconds Update Reg */
36891434b1SRayagond Kokatanur #define PTP_STNSUR	0x0714	/* System Time – Nanoseconds Update Reg */
37891434b1SRayagond Kokatanur #define PTP_TAR		0x0718	/* Timestamp Addend Reg */
38891434b1SRayagond Kokatanur #define PTP_TTSR	0x071C	/* Target Time Seconds Reg */
39891434b1SRayagond Kokatanur #define PTP_TTNSR	0x0720	/* Target Time Nanoseconds Reg */
40891434b1SRayagond Kokatanur #define	PTP_STHWSR	0x0724	/* System Time - Higher Word Seconds Reg */
41891434b1SRayagond Kokatanur #define PTP_TSR		0x0728	/* Timestamp Status */
42891434b1SRayagond Kokatanur 
43891434b1SRayagond Kokatanur #define PTP_STNSUR_ADDSUB_SHIFT 31
44891434b1SRayagond Kokatanur 
45891434b1SRayagond Kokatanur /* PTP TCR defines */
46891434b1SRayagond Kokatanur #define PTP_TCR_TSENA		0x00000001 /* Timestamp Enable */
47891434b1SRayagond Kokatanur #define PTP_TCR_TSCFUPDT	0x00000002 /* Timestamp Fine/Coarse Update */
48891434b1SRayagond Kokatanur #define PTP_TCR_TSINIT		0x00000004 /* Timestamp Initialize */
49891434b1SRayagond Kokatanur #define PTP_TCR_TSUPDT		0x00000008 /* Timestamp Update */
50891434b1SRayagond Kokatanur /* Timestamp Interrupt Trigger Enable */
51891434b1SRayagond Kokatanur #define PTP_TCR_TSTRIG		0x00000010
52891434b1SRayagond Kokatanur #define PTP_TCR_TSADDREG	0x00000020 /* Addend Reg Update */
53891434b1SRayagond Kokatanur #define PTP_TCR_TSENALL		0x00000100 /* Enable Timestamp for All Frames */
54891434b1SRayagond Kokatanur /* Timestamp Digital or Binary Rollover Control */
55891434b1SRayagond Kokatanur #define PTP_TCR_TSCTRLSSR	0x00000200
56891434b1SRayagond Kokatanur 
57891434b1SRayagond Kokatanur /* Enable PTP packet Processing for Version 2 Format */
58891434b1SRayagond Kokatanur #define PTP_TCR_TSVER2ENA	0x00000400
59891434b1SRayagond Kokatanur /* Enable Processing of PTP over Ethernet Frames */
60891434b1SRayagond Kokatanur #define PTP_TCR_TSIPENA		0x00000800
61891434b1SRayagond Kokatanur /* Enable Processing of PTP Frames Sent over IPv6-UDP */
62891434b1SRayagond Kokatanur #define PTP_TCR_TSIPV6ENA	0x00001000
63891434b1SRayagond Kokatanur /* Enable Processing of PTP Frames Sent over IPv4-UDP */
64891434b1SRayagond Kokatanur #define PTP_TCR_TSIPV4ENA	0x00002000
65891434b1SRayagond Kokatanur /* Enable Timestamp Snapshot for Event Messages */
66891434b1SRayagond Kokatanur #define PTP_TCR_TSEVNTENA	0x00004000
67891434b1SRayagond Kokatanur /* Enable Snapshot for Messages Relevant to Master */
68891434b1SRayagond Kokatanur #define PTP_TCR_TSMSTRENA	0x00008000
69891434b1SRayagond Kokatanur /* Select PTP packets for Taking Snapshots */
70891434b1SRayagond Kokatanur #define PTP_TCR_SNAPTYPSEL_1	0x00010000
71891434b1SRayagond Kokatanur /* Enable MAC address for PTP Frame Filtering */
72891434b1SRayagond Kokatanur #define PTP_TCR_TSENMACADDR	0x00040000
73891434b1SRayagond Kokatanur 
74891434b1SRayagond Kokatanur #endif /* __STMMAC_PTP_H__ */
75