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 The full GNU General Public License is included in this distribution in 16891434b1SRayagond Kokatanur the file called "COPYING". 17891434b1SRayagond Kokatanur 18891434b1SRayagond Kokatanur Author: Rayagond Kokatanur <rayagond@vayavyalabs.com> 19891434b1SRayagond Kokatanur ******************************************************************************/ 20891434b1SRayagond Kokatanur 21891434b1SRayagond Kokatanur #ifndef __STMMAC_PTP_H__ 22891434b1SRayagond Kokatanur #define __STMMAC_PTP_H__ 23891434b1SRayagond Kokatanur 24d2042052SGiuseppe CAVALLARO #define PTP_GMAC4_OFFSET 0xb00 25d2042052SGiuseppe CAVALLARO #define PTP_GMAC3_X_OFFSET 0x700 26d2042052SGiuseppe CAVALLARO 27891434b1SRayagond Kokatanur /* IEEE 1588 PTP register offsets */ 28d2042052SGiuseppe CAVALLARO #define PTP_TCR 0x00 /* Timestamp Control Reg */ 29d2042052SGiuseppe CAVALLARO #define PTP_SSIR 0x04 /* Sub-Second Increment Reg */ 30d2042052SGiuseppe CAVALLARO #define PTP_STSR 0x08 /* System Time – Seconds Regr */ 31d2042052SGiuseppe CAVALLARO #define PTP_STNSR 0x0c /* System Time – Nanoseconds Reg */ 32d2042052SGiuseppe CAVALLARO #define PTP_STSUR 0x10 /* System Time – Seconds Update Reg */ 33d2042052SGiuseppe CAVALLARO #define PTP_STNSUR 0x14 /* System Time – Nanoseconds Update Reg */ 34d2042052SGiuseppe CAVALLARO #define PTP_TAR 0x18 /* Timestamp Addend Reg */ 35891434b1SRayagond Kokatanur 36891434b1SRayagond Kokatanur #define PTP_STNSUR_ADDSUB_SHIFT 31 37d2042052SGiuseppe CAVALLARO #define PTP_DIGITAL_ROLLOVER_MODE 0x3B9ACA00 /* 10e9-1 ns */ 38d2042052SGiuseppe CAVALLARO #define PTP_BINARY_ROLLOVER_MODE 0x80000000 /* ~0.466 ns */ 39891434b1SRayagond Kokatanur 40d2042052SGiuseppe CAVALLARO /* PTP Timestamp control register defines */ 41d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSENA BIT(0) /* Timestamp Enable */ 42d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSCFUPDT BIT(1) /* Timestamp Fine/Coarse Update */ 43d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSINIT BIT(2) /* Timestamp Initialize */ 44d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSUPDT BIT(3) /* Timestamp Update */ 45d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSTRIG BIT(4) /* Timestamp Interrupt Trigger Enable */ 46d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSADDREG BIT(5) /* Addend Reg Update */ 47d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSENALL BIT(8) /* Enable Timestamp for All Frames */ 48d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSCTRLSSR BIT(9) /* Digital or Binary Rollover Control */ 49891434b1SRayagond Kokatanur /* Enable PTP packet Processing for Version 2 Format */ 50d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSVER2ENA BIT(10) 51891434b1SRayagond Kokatanur /* Enable Processing of PTP over Ethernet Frames */ 52d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSIPENA BIT(11) 53891434b1SRayagond Kokatanur /* Enable Processing of PTP Frames Sent over IPv6-UDP */ 54d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSIPV6ENA BIT(12) 55891434b1SRayagond Kokatanur /* Enable Processing of PTP Frames Sent over IPv4-UDP */ 56d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSIPV4ENA BIT(13) 57891434b1SRayagond Kokatanur /* Enable Timestamp Snapshot for Event Messages */ 58d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSEVNTENA BIT(14) 59891434b1SRayagond Kokatanur /* Enable Snapshot for Messages Relevant to Master */ 60d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSMSTRENA BIT(15) 61891434b1SRayagond Kokatanur /* Select PTP packets for Taking Snapshots */ 62fd6720aeSMario Molitor #define PTP_TCR_SNAPTYPSEL_1 BIT(16) 63fd6720aeSMario Molitor #define PTP_GMAC4_TCR_SNAPTYPSEL_1 GENMASK(17, 16) 64891434b1SRayagond Kokatanur /* Enable MAC address for PTP Frame Filtering */ 65d2042052SGiuseppe CAVALLARO #define PTP_TCR_TSENMACADDR BIT(18) 66d2042052SGiuseppe CAVALLARO 67d2042052SGiuseppe CAVALLARO /* SSIR defines */ 68d2042052SGiuseppe CAVALLARO #define PTP_SSIR_SSINC_MASK 0xff 69d2042052SGiuseppe CAVALLARO #define GMAC4_PTP_SSIR_SSINC_SHIFT 16 70891434b1SRayagond Kokatanur 71891434b1SRayagond Kokatanur #endif /* __STMMAC_PTP_H__ */ 72