xref: /linux/drivers/net/phy/mscc/mscc_fc_buffer.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1da80aa52SAntoine Tenart /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
2da80aa52SAntoine Tenart /*
30b92f897SAntoine Tenart  * Driver for Microsemi VSC85xx PHYs
4da80aa52SAntoine Tenart  *
5*c7cd2a6aSAntoine Tenart  * Copyright (C) 2020 Microsemi Corporation
6da80aa52SAntoine Tenart  */
7da80aa52SAntoine Tenart 
80b92f897SAntoine Tenart #ifndef _MSCC_PHY_FC_BUFFER_H_
90b92f897SAntoine Tenart #define _MSCC_PHY_FC_BUFFER_H_
10da80aa52SAntoine Tenart 
11da80aa52SAntoine Tenart #define MSCC_FCBUF_ENA_CFG					0x00
12da80aa52SAntoine Tenart #define MSCC_FCBUF_MODE_CFG					0x01
13da80aa52SAntoine Tenart #define MSCC_FCBUF_PPM_RATE_ADAPT_THRESH_CFG			0x02
14da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_CTRL_QUEUE_CFG				0x03
15da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_DATA_QUEUE_CFG				0x04
16da80aa52SAntoine Tenart #define MSCC_FCBUF_RX_DATA_QUEUE_CFG				0x05
17da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_BUFF_XON_XOFF_THRESH_CFG			0x06
18da80aa52SAntoine Tenart #define MSCC_FCBUF_FC_READ_THRESH_CFG				0x07
19da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_FRM_GAP_COMP				0x08
20da80aa52SAntoine Tenart 
21da80aa52SAntoine Tenart #define MSCC_FCBUF_ENA_CFG_TX_ENA				BIT(0)
22da80aa52SAntoine Tenart #define MSCC_FCBUF_ENA_CFG_RX_ENA				BIT(4)
23da80aa52SAntoine Tenart 
24da80aa52SAntoine Tenart #define MSCC_FCBUF_MODE_CFG_DROP_BEHAVIOUR			BIT(4)
25da80aa52SAntoine Tenart #define MSCC_FCBUF_MODE_CFG_PAUSE_REACT_ENA			BIT(8)
26da80aa52SAntoine Tenart #define MSCC_FCBUF_MODE_CFG_RX_PPM_RATE_ADAPT_ENA		BIT(12)
27da80aa52SAntoine Tenart #define MSCC_FCBUF_MODE_CFG_TX_PPM_RATE_ADAPT_ENA		BIT(16)
28da80aa52SAntoine Tenart #define MSCC_FCBUF_MODE_CFG_TX_CTRL_QUEUE_ENA			BIT(20)
29da80aa52SAntoine Tenart #define MSCC_FCBUF_MODE_CFG_PAUSE_GEN_ENA			BIT(24)
30da80aa52SAntoine Tenart #define MSCC_FCBUF_MODE_CFG_INCLUDE_PAUSE_RCVD_IN_PAUSE_GEN	BIT(28)
31da80aa52SAntoine Tenart 
32da80aa52SAntoine Tenart #define MSCC_FCBUF_PPM_RATE_ADAPT_THRESH_CFG_TX_THRESH(x)	(x)
33da80aa52SAntoine Tenart #define MSCC_FCBUF_PPM_RATE_ADAPT_THRESH_CFG_TX_THRESH_M	GENMASK(15, 0)
34da80aa52SAntoine Tenart #define MSCC_FCBUF_PPM_RATE_ADAPT_THRESH_CFG_TX_OFFSET(x)	((x) << 16)
35da80aa52SAntoine Tenart #define MSCC_FCBUF_PPM_RATE_ADAPT_THRESH_CFG_TX_OFFSET_M	GENMASK(19, 16)
36da80aa52SAntoine Tenart #define MSCC_FCBUF_PPM_RATE_ADAPT_THRESH_CFG_RX_THRESH(x)	((x) << 20)
37da80aa52SAntoine Tenart #define MSCC_FCBUF_PPM_RATE_ADAPT_THRESH_CFG_RX_THRESH_M	GENMASK(31, 20)
38da80aa52SAntoine Tenart 
39da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_CTRL_QUEUE_CFG_START(x)			(x)
40da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_CTRL_QUEUE_CFG_START_M			GENMASK(15, 0)
41da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_CTRL_QUEUE_CFG_END(x)			((x) << 16)
42da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_CTRL_QUEUE_CFG_END_M			GENMASK(31, 16)
43da80aa52SAntoine Tenart 
44da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_DATA_QUEUE_CFG_START(x)			(x)
45da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_DATA_QUEUE_CFG_START_M			GENMASK(15, 0)
46da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_DATA_QUEUE_CFG_END(x)			((x) << 16)
47da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_DATA_QUEUE_CFG_END_M			GENMASK(31, 16)
48da80aa52SAntoine Tenart 
49da80aa52SAntoine Tenart #define MSCC_FCBUF_RX_DATA_QUEUE_CFG_START(x)			(x)
50da80aa52SAntoine Tenart #define MSCC_FCBUF_RX_DATA_QUEUE_CFG_START_M			GENMASK(15, 0)
51da80aa52SAntoine Tenart #define MSCC_FCBUF_RX_DATA_QUEUE_CFG_END(x)			((x) << 16)
52da80aa52SAntoine Tenart #define MSCC_FCBUF_RX_DATA_QUEUE_CFG_END_M			GENMASK(31, 16)
53da80aa52SAntoine Tenart 
54da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_BUFF_XON_XOFF_THRESH_CFG_XOFF_THRESH(x)	(x)
55da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_BUFF_XON_XOFF_THRESH_CFG_XOFF_THRESH_M	GENMASK(15, 0)
56da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_BUFF_XON_XOFF_THRESH_CFG_XON_THRESH(x)	((x) << 16)
57da80aa52SAntoine Tenart #define MSCC_FCBUF_TX_BUFF_XON_XOFF_THRESH_CFG_XON_THRESH_M	GENMASK(31, 16)
58da80aa52SAntoine Tenart 
59da80aa52SAntoine Tenart #define MSCC_FCBUF_FC_READ_THRESH_CFG_TX_THRESH(x)		(x)
60da80aa52SAntoine Tenart #define MSCC_FCBUF_FC_READ_THRESH_CFG_TX_THRESH_M		GENMASK(15, 0)
61da80aa52SAntoine Tenart #define MSCC_FCBUF_FC_READ_THRESH_CFG_RX_THRESH(x)		((x) << 16)
62da80aa52SAntoine Tenart #define MSCC_FCBUF_FC_READ_THRESH_CFG_RX_THRESH_M		GENMASK(31, 16)
63da80aa52SAntoine Tenart 
640b92f897SAntoine Tenart #endif /* _MSCC_PHY_FC_BUFFER_H_ */
65