|
131 | 131 | #define GEM_RXIPCCNT 0x01a8 /* IP header Checksum Error Counter */
|
132 | 132 | #define GEM_RXTCPCCNT 0x01ac /* TCP Checksum Error Counter */
|
133 | 133 | #define GEM_RXUDPCCNT 0x01b0 /* UDP Checksum Error Counter */
|
| 134 | +#define GEM_TISUBN 0x01bc /* 1588 Timer Increment Sub-ns */ |
| 135 | +#define GEM_TSH 0x01c0 /* 1588 Timer Seconds High */ |
| 136 | +#define GEM_TSL 0x01d0 /* 1588 Timer Seconds Low */ |
| 137 | +#define GEM_TN 0x01d4 /* 1588 Timer Nanoseconds */ |
| 138 | +#define GEM_TA 0x01d8 /* 1588 Timer Adjust */ |
| 139 | +#define GEM_TI 0x01dc /* 1588 Timer Increment */ |
| 140 | +#define GEM_EFTSL 0x01e0 /* PTP Event Frame Tx Seconds Low */ |
| 141 | +#define GEM_EFTN 0x01e4 /* PTP Event Frame Tx Nanoseconds */ |
| 142 | +#define GEM_EFRSL 0x01e8 /* PTP Event Frame Rx Seconds Low */ |
| 143 | +#define GEM_EFRN 0x01ec /* PTP Event Frame Rx Nanoseconds */ |
| 144 | +#define GEM_PEFTSL 0x01f0 /* PTP Peer Event Frame Tx Secs Low */ |
| 145 | +#define GEM_PEFTN 0x01f4 /* PTP Peer Event Frame Tx Ns */ |
| 146 | +#define GEM_PEFRSL 0x01f8 /* PTP Peer Event Frame Rx Sec Low */ |
| 147 | +#define GEM_PEFRN 0x01fc /* PTP Peer Event Frame Rx Ns */ |
134 | 148 | #define GEM_DCFG1 0x0280 /* Design Config 1 */
|
135 | 149 | #define GEM_DCFG2 0x0284 /* Design Config 2 */
|
136 | 150 | #define GEM_DCFG3 0x0288 /* Design Config 3 */
|
|
174 | 188 | #define MACB_NCR_TPF_SIZE 1
|
175 | 189 | #define MACB_TZQ_OFFSET 12 /* Transmit zero quantum pause frame */
|
176 | 190 | #define MACB_TZQ_SIZE 1
|
| 191 | +#define MACB_SRTSM_OFFSET 15 |
177 | 192 |
|
178 | 193 | /* Bitfields in NCFGR */
|
179 | 194 | #define MACB_SPD_OFFSET 0 /* Speed */
|
|
319 | 334 | #define MACB_PTZ_SIZE 1
|
320 | 335 | #define MACB_WOL_OFFSET 14 /* Enable wake-on-lan interrupt */
|
321 | 336 | #define MACB_WOL_SIZE 1
|
| 337 | +#define MACB_DRQFR_OFFSET 18 /* PTP Delay Request Frame Received */ |
| 338 | +#define MACB_DRQFR_SIZE 1 |
| 339 | +#define MACB_SFR_OFFSET 19 /* PTP Sync Frame Received */ |
| 340 | +#define MACB_SFR_SIZE 1 |
| 341 | +#define MACB_DRQFT_OFFSET 20 /* PTP Delay Request Frame Transmitted */ |
| 342 | +#define MACB_DRQFT_SIZE 1 |
| 343 | +#define MACB_SFT_OFFSET 21 /* PTP Sync Frame Transmitted */ |
| 344 | +#define MACB_SFT_SIZE 1 |
| 345 | +#define MACB_PDRQFR_OFFSET 22 /* PDelay Request Frame Received */ |
| 346 | +#define MACB_PDRQFR_SIZE 1 |
| 347 | +#define MACB_PDRSFR_OFFSET 23 /* PDelay Response Frame Received */ |
| 348 | +#define MACB_PDRSFR_SIZE 1 |
| 349 | +#define MACB_PDRQFT_OFFSET 24 /* PDelay Request Frame Transmitted */ |
| 350 | +#define MACB_PDRQFT_SIZE 1 |
| 351 | +#define MACB_PDRSFT_OFFSET 25 /* PDelay Response Frame Transmitted */ |
| 352 | +#define MACB_PDRSFT_SIZE 1 |
| 353 | +#define MACB_SRI_OFFSET 26 /* TSU Seconds Register Increment */ |
| 354 | +#define MACB_SRI_SIZE 1 |
| 355 | + |
| 356 | +/* Timer increment fields */ |
| 357 | +#define MACB_TI_CNS_OFFSET 0 |
| 358 | +#define MACB_TI_CNS_SIZE 8 |
| 359 | +#define MACB_TI_ACNS_OFFSET 8 |
| 360 | +#define MACB_TI_ACNS_SIZE 8 |
| 361 | +#define MACB_TI_NIT_OFFSET 16 |
| 362 | +#define MACB_TI_NIT_SIZE 8 |
322 | 363 |
|
323 | 364 | /* Bitfields in MAN */
|
324 | 365 | #define MACB_DATA_OFFSET 0 /* data */
|
|
386 | 427 | #define GEM_PBUF_LSO_OFFSET 27
|
387 | 428 | #define GEM_PBUF_LSO_SIZE 1
|
388 | 429 |
|
| 430 | +/* Bitfields in TISUBN */ |
| 431 | +#define GEM_SUBNSINCR_OFFSET 0 |
| 432 | +#define GEM_SUBNSINCR_SIZE 16 |
| 433 | + |
| 434 | +/* Bitfields in TI */ |
| 435 | +#define GEM_NSINCR_OFFSET 0 |
| 436 | +#define GEM_NSINCR_SIZE 8 |
| 437 | + |
| 438 | +/* Bitfields in ADJ */ |
| 439 | +#define GEM_ADDSUB_OFFSET 31 |
| 440 | +#define GEM_ADDSUB_SIZE 1 |
389 | 441 | /* Constants for CLK */
|
390 | 442 | #define MACB_CLK_DIV8 0
|
391 | 443 | #define MACB_CLK_DIV16 1
|
|
413 | 465 | #define MACB_CAPS_NO_GIGABIT_HALF 0x00000008
|
414 | 466 | #define MACB_CAPS_USRIO_DISABLED 0x00000010
|
415 | 467 | #define MACB_CAPS_JUMBO 0x00000020
|
| 468 | +#define MACB_CAPS_GEM_HAS_PTP 0x00000040 |
416 | 469 | #define MACB_CAPS_FIFO_MODE 0x10000000
|
417 | 470 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000
|
418 | 471 | #define MACB_CAPS_SG_DISABLED 0x40000000
|
@@ -782,6 +835,20 @@ struct macb_or_gem_ops {
|
782 | 835 | int (*mog_rx)(struct macb *bp, int budget);
|
783 | 836 | };
|
784 | 837 |
|
| 838 | +/* MACB-PTP interface: adapt to platform needs. */ |
| 839 | +struct macb_ptp_info { |
| 840 | + void (*ptp_init)(struct net_device *ndev); |
| 841 | + void (*ptp_remove)(struct net_device *ndev); |
| 842 | + s32 (*get_ptp_max_adj)(void); |
| 843 | + unsigned int (*get_tsu_rate)(struct macb *bp); |
| 844 | + int (*get_ts_info)(struct net_device *dev, |
| 845 | + struct ethtool_ts_info *info); |
| 846 | + int (*get_hwtst)(struct net_device *netdev, |
| 847 | + struct ifreq *ifr); |
| 848 | + int (*set_hwtst)(struct net_device *netdev, |
| 849 | + struct ifreq *ifr, int cmd); |
| 850 | +}; |
| 851 | + |
785 | 852 | struct macb_config {
|
786 | 853 | u32 caps;
|
787 | 854 | unsigned int dma_burst_length;
|
@@ -874,11 +941,18 @@ struct macb {
|
874 | 941 | unsigned int jumbo_max_len;
|
875 | 942 |
|
876 | 943 | u32 wol;
|
| 944 | + |
| 945 | + struct macb_ptp_info *ptp_info; /* macb-ptp interface */ |
877 | 946 | };
|
878 | 947 |
|
879 | 948 | static inline bool macb_is_gem(struct macb *bp)
|
880 | 949 | {
|
881 | 950 | return !!(bp->caps & MACB_CAPS_MACB_IS_GEM);
|
882 | 951 | }
|
883 | 952 |
|
| 953 | +static inline bool gem_has_ptp(struct macb *bp) |
| 954 | +{ |
| 955 | + return !!(bp->caps & MACB_CAPS_GEM_HAS_PTP); |
| 956 | +} |
| 957 | + |
884 | 958 | #endif /* _MACB_H */
|
0 commit comments