1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* 10G controller driver for Samsung SoCs
4 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
7 * Author: Siva Reddy Kallam <siva.kallam@samsung.com>
9 #ifndef __SXGBE_MTL_H__
10 #define __SXGBE_MTL_H__
12 #define SXGBE_MTL_OPMODE_ESTMASK 0x3
13 #define SXGBE_MTL_OPMODE_RAAMASK 0x1
14 #define SXGBE_MTL_FCMASK 0x7
15 #define SXGBE_MTL_TX_FIFO_DIV 256
16 #define SXGBE_MTL_RX_FIFO_DIV 256
18 #define SXGBE_MTL_RXQ_OP_FEP BIT(4)
19 #define SXGBE_MTL_RXQ_OP_FUP BIT(3)
20 #define SXGBE_MTL_ENABLE_FC 0x80
22 #define ETS_WRR 0xFFFFFF9F
23 #define ETS_RST 0xFFFFFF9F
24 #define ETS_WFQ 0x00000020
25 #define ETS_DWRR 0x00000040
26 #define RAA_SP 0xFFFFFFFB
27 #define RAA_WSP 0x00000004
29 #define RX_QUEUE_DYNAMIC 0x80808080
30 #define RX_FC_ACTIVE 8
31 #define RX_FC_DEACTIVE 13
34 MTL_CONTROL_TTC_64
= 0x00000000,
35 MTL_CONTROL_TTC_96
= 0x00000020,
36 MTL_CONTROL_TTC_128
= 0x00000030,
37 MTL_CONTROL_TTC_192
= 0x00000040,
38 MTL_CONTROL_TTC_256
= 0x00000050,
39 MTL_CONTROL_TTC_384
= 0x00000060,
40 MTL_CONTROL_TTC_512
= 0x00000070,
44 MTL_CONTROL_RTC_64
= 0x00000000,
45 MTL_CONTROL_RTC_96
= 0x00000002,
46 MTL_CONTROL_RTC_128
= 0x00000003,
49 enum flow_control_th
{
50 MTL_FC_FULL_1K
= 0x00000000,
51 MTL_FC_FULL_2K
= 0x00000001,
52 MTL_FC_FULL_4K
= 0x00000002,
53 MTL_FC_FULL_5K
= 0x00000003,
54 MTL_FC_FULL_6K
= 0x00000004,
55 MTL_FC_FULL_8K
= 0x00000005,
56 MTL_FC_FULL_16K
= 0x00000006,
57 MTL_FC_FULL_24K
= 0x00000007,
60 struct sxgbe_mtl_ops
{
61 void (*mtl_init
)(void __iomem
*ioaddr
, unsigned int etsalg
,
64 void (*mtl_set_txfifosize
)(void __iomem
*ioaddr
, int queue_num
,
67 void (*mtl_set_rxfifosize
)(void __iomem
*ioaddr
, int queue_num
,
70 void (*mtl_enable_txqueue
)(void __iomem
*ioaddr
, int queue_num
);
72 void (*mtl_disable_txqueue
)(void __iomem
*ioaddr
, int queue_num
);
74 void (*set_tx_mtl_mode
)(void __iomem
*ioaddr
, int queue_num
,
77 void (*set_rx_mtl_mode
)(void __iomem
*ioaddr
, int queue_num
,
80 void (*mtl_dynamic_dma_rxqueue
)(void __iomem
*ioaddr
);
82 void (*mtl_fc_active
)(void __iomem
*ioaddr
, int queue_num
,
85 void (*mtl_fc_deactive
)(void __iomem
*ioaddr
, int queue_num
,
88 void (*mtl_fc_enable
)(void __iomem
*ioaddr
, int queue_num
);
90 void (*mtl_fep_enable
)(void __iomem
*ioaddr
, int queue_num
);
92 void (*mtl_fep_disable
)(void __iomem
*ioaddr
, int queue_num
);
94 void (*mtl_fup_enable
)(void __iomem
*ioaddr
, int queue_num
);
96 void (*mtl_fup_disable
)(void __iomem
*ioaddr
, int queue_num
);
99 const struct sxgbe_mtl_ops
*sxgbe_get_mtl_ops(void);
101 #endif /* __SXGBE_MTL_H__ */