0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __TI_CPSW_SL_H__
0011 #define __TI_CPSW_SL_H__
0012
0013 #include <linux/device.h>
0014
0015 enum cpsw_sl_regs {
0016 CPSW_SL_IDVER,
0017 CPSW_SL_MACCONTROL,
0018 CPSW_SL_MACSTATUS,
0019 CPSW_SL_SOFT_RESET,
0020 CPSW_SL_RX_MAXLEN,
0021 CPSW_SL_BOFFTEST,
0022 CPSW_SL_RX_PAUSE,
0023 CPSW_SL_TX_PAUSE,
0024 CPSW_SL_EMCONTROL,
0025 CPSW_SL_RX_PRI_MAP,
0026 CPSW_SL_TX_GAP,
0027 };
0028
0029 enum {
0030 CPSW_SL_CTL_FULLDUPLEX = BIT(0),
0031 CPSW_SL_CTL_LOOPBACK = BIT(1),
0032 CPSW_SL_CTL_MTEST = BIT(2),
0033 CPSW_SL_CTL_RX_FLOW_EN = BIT(3),
0034 CPSW_SL_CTL_TX_FLOW_EN = BIT(4),
0035 CPSW_SL_CTL_GMII_EN = BIT(5),
0036 CPSW_SL_CTL_TX_PACE = BIT(6),
0037 CPSW_SL_CTL_GIG = BIT(7),
0038 CPSW_SL_CTL_XGIG = BIT(8),
0039 CPSW_SL_CTL_TX_SHORT_GAP_EN = BIT(10),
0040 CPSW_SL_CTL_CMD_IDLE = BIT(11),
0041 CPSW_SL_CTL_CRC_TYPE = BIT(12),
0042 CPSW_SL_CTL_XGMII_EN = BIT(13),
0043 CPSW_SL_CTL_IFCTL_A = BIT(15),
0044 CPSW_SL_CTL_IFCTL_B = BIT(16),
0045 CPSW_SL_CTL_GIG_FORCE = BIT(17),
0046 CPSW_SL_CTL_EXT_EN = BIT(18),
0047 CPSW_SL_CTL_EXT_EN_RX_FLO = BIT(19),
0048 CPSW_SL_CTL_EXT_EN_TX_FLO = BIT(20),
0049 CPSW_SL_CTL_TX_SG_LIM_EN = BIT(21),
0050 CPSW_SL_CTL_RX_CEF_EN = BIT(22),
0051 CPSW_SL_CTL_RX_CSF_EN = BIT(23),
0052 CPSW_SL_CTL_RX_CMF_EN = BIT(24),
0053 CPSW_SL_CTL_EXT_EN_XGIG = BIT(25),
0054
0055 CPSW_SL_CTL_FUNCS_COUNT
0056 };
0057
0058 struct cpsw_sl;
0059
0060 struct cpsw_sl *cpsw_sl_get(const char *device_id, struct device *dev,
0061 void __iomem *sl_base);
0062
0063 void cpsw_sl_reset(struct cpsw_sl *sl, unsigned long tmo);
0064
0065 u32 cpsw_sl_ctl_set(struct cpsw_sl *sl, u32 ctl_funcs);
0066 u32 cpsw_sl_ctl_clr(struct cpsw_sl *sl, u32 ctl_funcs);
0067 void cpsw_sl_ctl_reset(struct cpsw_sl *sl);
0068 int cpsw_sl_wait_for_idle(struct cpsw_sl *sl, unsigned long tmo);
0069
0070 u32 cpsw_sl_reg_read(struct cpsw_sl *sl, enum cpsw_sl_regs reg);
0071 void cpsw_sl_reg_write(struct cpsw_sl *sl, enum cpsw_sl_regs reg, u32 val);
0072
0073 #endif