cpsw_sl.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Texas Instruments Ethernet Switch media-access-controller (MAC) submodule/
  4. * Ethernet MAC Sliver (CPGMAC_SL) APIs
  5. *
  6. * Copyright (C) 2019 Texas Instruments
  7. *
  8. */
  9. #ifndef __TI_CPSW_SL_H__
  10. #define __TI_CPSW_SL_H__
  11. #include <linux/device.h>
  12. enum cpsw_sl_regs {
  13. CPSW_SL_IDVER,
  14. CPSW_SL_MACCONTROL,
  15. CPSW_SL_MACSTATUS,
  16. CPSW_SL_SOFT_RESET,
  17. CPSW_SL_RX_MAXLEN,
  18. CPSW_SL_BOFFTEST,
  19. CPSW_SL_RX_PAUSE,
  20. CPSW_SL_TX_PAUSE,
  21. CPSW_SL_EMCONTROL,
  22. CPSW_SL_RX_PRI_MAP,
  23. CPSW_SL_TX_GAP,
  24. };
  25. enum {
  26. CPSW_SL_CTL_FULLDUPLEX = BIT(0), /* Full Duplex mode */
  27. CPSW_SL_CTL_LOOPBACK = BIT(1), /* Loop Back Mode */
  28. CPSW_SL_CTL_MTEST = BIT(2), /* Manufacturing Test mode */
  29. CPSW_SL_CTL_RX_FLOW_EN = BIT(3), /* Receive Flow Control Enable */
  30. CPSW_SL_CTL_TX_FLOW_EN = BIT(4), /* Transmit Flow Control Enable */
  31. CPSW_SL_CTL_GMII_EN = BIT(5), /* GMII Enable */
  32. CPSW_SL_CTL_TX_PACE = BIT(6), /* Transmit Pacing Enable */
  33. CPSW_SL_CTL_GIG = BIT(7), /* Gigabit Mode */
  34. CPSW_SL_CTL_XGIG = BIT(8), /* 10 Gigabit Mode */
  35. CPSW_SL_CTL_TX_SHORT_GAP_EN = BIT(10), /* Transmit Short Gap Enable */
  36. CPSW_SL_CTL_CMD_IDLE = BIT(11), /* Command Idle */
  37. CPSW_SL_CTL_CRC_TYPE = BIT(12), /* Port CRC Type */
  38. CPSW_SL_CTL_XGMII_EN = BIT(13), /* XGMII Enable */
  39. CPSW_SL_CTL_IFCTL_A = BIT(15), /* Interface Control A */
  40. CPSW_SL_CTL_IFCTL_B = BIT(16), /* Interface Control B */
  41. CPSW_SL_CTL_GIG_FORCE = BIT(17), /* Gigabit Mode Force */
  42. CPSW_SL_CTL_EXT_EN = BIT(18), /* External Control Enable */
  43. CPSW_SL_CTL_EXT_EN_RX_FLO = BIT(19), /* Ext RX Flow Control Enable */
  44. CPSW_SL_CTL_EXT_EN_TX_FLO = BIT(20), /* Ext TX Flow Control Enable */
  45. CPSW_SL_CTL_TX_SG_LIM_EN = BIT(21), /* TXt Short Gap Limit Enable */
  46. CPSW_SL_CTL_RX_CEF_EN = BIT(22), /* RX Copy Error Frames Enable */
  47. CPSW_SL_CTL_RX_CSF_EN = BIT(23), /* RX Copy Short Frames Enable */
  48. CPSW_SL_CTL_RX_CMF_EN = BIT(24), /* RX Copy MAC Control Frames Enable */
  49. CPSW_SL_CTL_EXT_EN_XGIG = BIT(25), /* Ext XGIG Control En, k3 only */
  50. CPSW_SL_CTL_FUNCS_COUNT
  51. };
  52. struct cpsw_sl;
  53. struct cpsw_sl *cpsw_sl_get(const char *device_id, struct device *dev,
  54. void __iomem *sl_base);
  55. void cpsw_sl_reset(struct cpsw_sl *sl, unsigned long tmo);
  56. u32 cpsw_sl_ctl_set(struct cpsw_sl *sl, u32 ctl_funcs);
  57. u32 cpsw_sl_ctl_clr(struct cpsw_sl *sl, u32 ctl_funcs);
  58. void cpsw_sl_ctl_reset(struct cpsw_sl *sl);
  59. int cpsw_sl_wait_for_idle(struct cpsw_sl *sl, unsigned long tmo);
  60. u32 cpsw_sl_reg_read(struct cpsw_sl *sl, enum cpsw_sl_regs reg);
  61. void cpsw_sl_reg_write(struct cpsw_sl *sl, enum cpsw_sl_regs reg, u32 val);
  62. #endif /* __TI_CPSW_SL_H__ */