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