hwif.h 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093
  1. /*
  2. * TC956X ethernet driver.
  3. *
  4. * hwif.h
  5. *
  6. * Copyright (C) 2018 Synopsys, Inc. and/or its affiliates.
  7. * Copyright (C) 2021 Toshiba Electronic Devices & Storage Corporation
  8. *
  9. * This file has been derived from the STMicro and Synopsys Linux driver,
  10. * and developed or modified for TC956X.
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2, or (at your option)
  15. * any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  25. */
  26. /*! History:
  27. * 20 Jan 2021 : Initial Version
  28. * VERSION : 00-01
  29. *
  30. * 15 Mar 2021 : Base lined
  31. * VERSION : 01-00
  32. * 14 Sep 2021 : 1. Synchronization between ethtool vlan features
  33. * "rx-vlan-offload", "rx-vlan-filter", "tx-vlan-offload" output and register settings.
  34. * 2. Added ethtool support to update "rx-vlan-offload", "rx-vlan-filter",
  35. * and "tx-vlan-offload".
  36. * 3. Removed IOCTL TC956XMAC_VLAN_STRIP_CONFIG.
  37. * 4. Removed "Disable VLAN Filter" option in IOCTL TC956XMAC_VLAN_FILTERING.
  38. * VERSION : 01-00-13
  39. * 04 Nov 2021 : 1. Added separate control functons for MAC TX and RX start/stop
  40. * VERSION : 01-00-20
  41. * 26 Dec 2023 : 1. Added the support for TC commands taprio and flower
  42. * VERSION : 01-03-59
  43. */
  44. #ifndef __TC956XMAC_HWIF_H__
  45. #define __TC956XMAC_HWIF_H__
  46. #include <linux/netdevice.h>
  47. #include "tc956xmac_inc.h"
  48. #include <linux/version.h>
  49. #define tc956xmac_do_void_callback(__priv, __module, __cname, __arg0, __args...) \
  50. ({ \
  51. int __result = -EINVAL; \
  52. if ((__priv)->hw->__module && (__priv)->hw->__module->__cname) { \
  53. (__priv)->hw->__module->__cname(__priv, (__arg0), ##__args); \
  54. __result = 0; \
  55. } \
  56. __result; \
  57. })
  58. #define tc956xmac_do_callback(__priv, __module, __cname, __arg0, __args...) \
  59. ({ \
  60. int __result = -EINVAL; \
  61. if ((__priv)->hw->__module && (__priv)->hw->__module->__cname) \
  62. __result = (__priv)->hw->__module->__cname(__priv, (__arg0), ##__args); \
  63. __result; \
  64. })
  65. #define tc956xmac_do_void_no_param_callback(__priv, __module, __cname) \
  66. ({ \
  67. int __result = -EINVAL; \
  68. if ((__priv)->hw->__module && (__priv)->hw->__module->__cname) { \
  69. (__priv)->hw->__module->__cname(__priv); \
  70. __result = 0; \
  71. } \
  72. __result; \
  73. })
  74. struct tc956xmac_priv;
  75. struct tc956xmac_extra_stats;
  76. struct tc956xmac_safety_stats;
  77. struct dma_desc;
  78. struct dma_extended_desc;
  79. struct dma_edesc;
  80. #if defined(TC956X_SRIOV_PF) | defined(TC956X_SRIOV_VF)
  81. struct fn_id;
  82. enum mbx_msg_fns;
  83. #endif
  84. /* Descriptors helpers */
  85. struct tc956xmac_desc_ops {
  86. /* DMA RX descriptor ring initialization */
  87. void (*init_rx_desc)(struct tc956xmac_priv *priv, struct dma_desc *p, int disable_rx_ic, int mode,
  88. int end, int bfsize);
  89. /* DMA TX descriptor ring initialization */
  90. void (*init_tx_desc)(struct tc956xmac_priv *priv, struct dma_desc *p, int mode, int end);
  91. /* Invoked by the xmit function to prepare the tx descriptor */
  92. void (*prepare_tx_desc)(struct tc956xmac_priv *priv, struct dma_desc *p, int is_fs, int len,
  93. bool csum_flag, u32 crc_pad, int mode, bool tx_own,
  94. bool ls, unsigned int tot_pkt_len);
  95. void (*prepare_tso_tx_desc)(struct tc956xmac_priv *priv, struct dma_desc *p, int is_fs, int len1,
  96. int len2, bool tx_own, bool ls, unsigned int tcphdrlen,
  97. unsigned int tcppayloadlen);
  98. /* Set/get the owner of the descriptor */
  99. void (*set_tx_owner)(struct tc956xmac_priv *priv, struct dma_desc *p);
  100. int (*get_tx_owner)(struct tc956xmac_priv *priv, struct dma_desc *p);
  101. /* Clean the tx descriptor as soon as the tx irq is received */
  102. void (*release_tx_desc)(struct tc956xmac_priv *priv, struct dma_desc *p, int mode);
  103. /*
  104. * Clear interrupt on tx frame completion. When this bit is
  105. * set an interrupt happens as soon as the frame is transmitted
  106. */
  107. void (*set_tx_ic)(struct tc956xmac_priv *priv, struct dma_desc *p);
  108. /* Last tx segment reports the transmit status */
  109. int (*get_tx_ls)(struct tc956xmac_priv *priv, struct dma_desc *p);
  110. /* Return the transmit status looking at the TDES1 */
  111. int (*tx_status)(struct tc956xmac_priv *priv, void *data, struct tc956xmac_extra_stats *x,
  112. struct dma_desc *p, void __iomem *ioaddr);
  113. /* Get the buffer size from the descriptor */
  114. int (*get_tx_len)(struct tc956xmac_priv *priv, struct dma_desc *p);
  115. /* Handle extra events on specific interrupts hw dependent */
  116. void (*set_rx_owner)(struct tc956xmac_priv *priv, struct dma_desc *p, int disable_rx_ic);
  117. /* Get the receive frame size */
  118. int (*get_rx_frame_len)(struct tc956xmac_priv *priv, struct dma_desc *p, int rx_coe_type);
  119. /* Return the reception status looking at the RDES1 */
  120. int (*rx_status)(struct tc956xmac_priv *priv, void *data, struct tc956xmac_extra_stats *x,
  121. struct dma_desc *p);
  122. void (*rx_extended_status)(struct tc956xmac_priv *priv, void *data, struct tc956xmac_extra_stats *x,
  123. struct dma_extended_desc *p);
  124. /* Set tx timestamp enable bit */
  125. void (*enable_tx_timestamp)(struct tc956xmac_priv *priv, struct dma_desc *p);
  126. /* get tx timestamp status */
  127. int (*get_tx_timestamp_status)(struct tc956xmac_priv *priv, struct dma_desc *p);
  128. /* get timestamp value */
  129. void (*get_timestamp)(struct tc956xmac_priv *priv, void *desc, u32 ats, u64 *ts);
  130. /* get rx timestamp status */
  131. int (*get_rx_timestamp_status)(struct tc956xmac_priv *priv, void *desc, void *next_desc, u32 ats);
  132. /* Display ring */
  133. void (*display_ring)(struct tc956xmac_priv *priv, void *head, unsigned int size, bool rx);
  134. /* set MSS via context descriptor */
  135. void (*set_mss)(struct tc956xmac_priv *priv, struct dma_desc *p, unsigned int mss);
  136. /* get descriptor skbuff address */
  137. void (*get_addr)(struct tc956xmac_priv *priv, struct dma_desc *p, unsigned int *addr);
  138. /* set descriptor skbuff address */
  139. void (*set_addr)(struct tc956xmac_priv *priv, struct dma_desc *p, dma_addr_t addr);
  140. /* clear descriptor */
  141. void (*clear)(struct tc956xmac_priv *priv, struct dma_desc *p);
  142. /* RSS */
  143. int (*get_rx_hash)(struct tc956xmac_priv *priv, struct dma_desc *p, u32 *hash,
  144. enum pkt_hash_types *type);
  145. int (*get_rx_header_len)(struct tc956xmac_priv *priv, struct dma_desc *p, unsigned int *len);
  146. void (*set_sec_addr)(struct tc956xmac_priv *priv, struct dma_desc *p, dma_addr_t addr);
  147. void (*set_sarc)(struct tc956xmac_priv *priv, struct dma_desc *p, u32 sarc_type);
  148. void (*set_vlan_tag)(struct tc956xmac_priv *priv, struct dma_desc *p, u16 tag, u16 inner_tag,
  149. u32 inner_type);
  150. void (*set_vlan)(struct tc956xmac_priv *priv, struct dma_desc *p, u32 type);
  151. void (*set_tbs)(struct tc956xmac_priv *priv, struct dma_edesc *p, u32 sec, u32 nsec, bool lt_valid);
  152. void (*set_ostc)(struct tc956xmac_priv *priv, struct dma_desc *p, u32 ttsh, u32 ttsl);
  153. };
  154. #define tc956xmac_init_rx_desc(__priv, __args...) \
  155. tc956xmac_do_void_callback(__priv, desc, init_rx_desc, __args)
  156. #define tc956xmac_init_tx_desc(__priv, __args...) \
  157. tc956xmac_do_void_callback(__priv, desc, init_tx_desc, __args)
  158. #define tc956xmac_prepare_tx_desc(__priv, __args...) \
  159. tc956xmac_do_void_callback(__priv, desc, prepare_tx_desc, __args)
  160. #define tc956xmac_prepare_tso_tx_desc(__priv, __args...) \
  161. tc956xmac_do_void_callback(__priv, desc, prepare_tso_tx_desc, __args)
  162. #define tc956xmac_set_tx_owner(__priv, __args...) \
  163. tc956xmac_do_void_callback(__priv, desc, set_tx_owner, __args)
  164. #define tc956xmac_get_tx_owner(__priv, __args...) \
  165. tc956xmac_do_callback(__priv, desc, get_tx_owner, __args)
  166. #define tc956xmac_release_tx_desc(__priv, __args...) \
  167. tc956xmac_do_void_callback(__priv, desc, release_tx_desc, __args)
  168. #define tc956xmac_set_tx_ic(__priv, __args...) \
  169. tc956xmac_do_void_callback(__priv, desc, set_tx_ic, __args)
  170. #define tc956xmac_get_tx_ls(__priv, __args...) \
  171. tc956xmac_do_callback(__priv, desc, get_tx_ls, __args)
  172. #define tc956xmac_tx_status(__priv, __args...) \
  173. tc956xmac_do_callback(__priv, desc, tx_status, __args)
  174. #define tc956xmac_get_tx_len(__priv, __args...) \
  175. tc956xmac_do_callback(__priv, desc, get_tx_len, __args)
  176. #define tc956xmac_set_rx_owner(__priv, __args...) \
  177. tc956xmac_do_void_callback(__priv, desc, set_rx_owner, __args)
  178. #define tc956xmac_get_rx_frame_len(__priv, __args...) \
  179. tc956xmac_do_callback(__priv, desc, get_rx_frame_len, __args)
  180. #define tc956xmac_rx_status(__priv, __args...) \
  181. tc956xmac_do_callback(__priv, desc, rx_status, __args)
  182. #define tc956xmac_rx_extended_status(__priv, __args...) \
  183. tc956xmac_do_void_callback(__priv, desc, rx_extended_status, __args)
  184. #define tc956xmac_enable_tx_timestamp(__priv, __args...) \
  185. tc956xmac_do_void_callback(__priv, desc, enable_tx_timestamp, __args)
  186. #define tc956xmac_get_tx_timestamp_status(__priv, __args...) \
  187. tc956xmac_do_callback(__priv, desc, get_tx_timestamp_status, __args)
  188. #define tc956xmac_get_timestamp(__priv, __args...) \
  189. tc956xmac_do_void_callback(__priv, desc, get_timestamp, __args)
  190. #define tc956xmac_get_rx_timestamp_status(__priv, __args...) \
  191. tc956xmac_do_callback(__priv, desc, get_rx_timestamp_status, __args)
  192. #define tc956xmac_display_ring(__priv, __args...) \
  193. tc956xmac_do_void_callback(__priv, desc, display_ring, __args)
  194. #define tc956xmac_set_mss(__priv, __args...) \
  195. tc956xmac_do_void_callback(__priv, desc, set_mss, __args)
  196. #define tc956xmac_get_desc_addr(__priv, __args...) \
  197. tc956xmac_do_void_callback(__priv, desc, get_addr, __args)
  198. #define tc956xmac_set_desc_addr(__priv, __args...) \
  199. tc956xmac_do_void_callback(__priv, desc, set_addr, __args)
  200. #define tc956xmac_clear_desc(__priv, __args...) \
  201. tc956xmac_do_void_callback(__priv, desc, clear, __args)
  202. #define tc956xmac_get_rx_hash(__priv, __args...) \
  203. tc956xmac_do_callback(__priv, desc, get_rx_hash, __args)
  204. #define tc956xmac_get_rx_header_len(__priv, __args...) \
  205. tc956xmac_do_callback(__priv, desc, get_rx_header_len, __args)
  206. #define tc956xmac_set_desc_sec_addr(__priv, __args...) \
  207. tc956xmac_do_void_callback(__priv, desc, set_sec_addr, __args)
  208. #define tc956xmac_set_desc_sarc(__priv, __args...) \
  209. tc956xmac_do_void_callback(__priv, desc, set_sarc, __args)
  210. #define tc956xmac_set_desc_vlan_tag(__priv, __args...) \
  211. tc956xmac_do_void_callback(__priv, desc, set_vlan_tag, __args)
  212. #define tc956xmac_set_desc_vlan(__priv, __args...) \
  213. tc956xmac_do_void_callback(__priv, desc, set_vlan, __args)
  214. #define tc956xmac_set_desc_tbs(__priv, __args...) \
  215. tc956xmac_do_void_callback(__priv, desc, set_tbs, __args)
  216. #define tc956xmac_set_desc_ostc(__priv, __args...) \
  217. tc956xmac_do_void_callback(__priv, desc, set_ostc, __args)
  218. struct tc956xmac_dma_cfg;
  219. struct dma_features;
  220. /* Specific DMA helpers */
  221. struct tc956xmac_dma_ops {
  222. /* DMA core initialization */
  223. int (*reset)(struct tc956xmac_priv *priv, void __iomem *ioaddr);
  224. void (*init)(struct tc956xmac_priv *priv, void __iomem *ioaddr, struct tc956xmac_dma_cfg *dma_cfg,
  225. int atds);
  226. void (*init_chan)(struct tc956xmac_priv *priv, void __iomem *ioaddr,
  227. struct tc956xmac_dma_cfg *dma_cfg, u32 chan);
  228. void (*init_rx_chan)(struct tc956xmac_priv *priv, void __iomem *ioaddr,
  229. struct tc956xmac_dma_cfg *dma_cfg,
  230. dma_addr_t phy, u32 chan);
  231. void (*init_tx_chan)(struct tc956xmac_priv *priv, void __iomem *ioaddr,
  232. struct tc956xmac_dma_cfg *dma_cfg,
  233. dma_addr_t phy, u32 chan);
  234. /* Configure the AXI Bus Mode Register */
  235. void (*axi)(struct tc956xmac_priv *priv, void __iomem *ioaddr, struct tc956xmac_axi *axi);
  236. /* Dump DMA registers */
  237. void (*dump_regs)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 *reg_space);
  238. void (*dma_rx_mode)(struct tc956xmac_priv *priv, void __iomem *ioaddr, int mode, u32 channel,
  239. int fifosz, u8 qmode);
  240. void (*dma_tx_mode)(struct tc956xmac_priv *priv, void __iomem *ioaddr, int mode, u32 channel,
  241. int fifosz, u8 qmode);
  242. /* To track extra statistic (if supported) */
  243. void (*dma_diagnostic_fr)(struct tc956xmac_priv *priv, void *data, struct tc956xmac_extra_stats *x,
  244. void __iomem *ioaddr);
  245. void (*enable_dma_transmission)(struct tc956xmac_priv *priv, void __iomem *ioaddr);
  246. void (*enable_dma_irq)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 chan,
  247. bool rx, bool tx);
  248. void (*disable_dma_irq)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 chan,
  249. bool rx, bool tx);
  250. void (*start_tx)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 chan);
  251. void (*stop_tx)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 chan);
  252. void (*start_rx)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 chan);
  253. void (*stop_rx)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 chan);
  254. int (*dma_interrupt)(struct tc956xmac_priv *priv, void __iomem *ioaddr,
  255. struct tc956xmac_extra_stats *x, u32 chan);
  256. /* If supported then get the optional core features */
  257. void (*get_hw_feature)(struct tc956xmac_priv *priv, void __iomem *ioaddr,
  258. struct dma_features *dma_cap);
  259. /* Program the HW RX Watchdog */
  260. void (*rx_watchdog)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 riwt, u32 number_chan);
  261. void (*set_tx_ring_len)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 len, u32 chan);
  262. void (*set_rx_ring_len)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 len, u32 chan);
  263. void (*set_rx_tail_ptr)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 tail_ptr, u32 chan);
  264. void (*set_tx_tail_ptr)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 tail_ptr, u32 chan);
  265. void (*enable_tso)(struct tc956xmac_priv *priv, void __iomem *ioaddr, bool en, u32 chan);
  266. void (*qmode)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 channel, u8 qmode);
  267. void (*set_bfsize)(struct tc956xmac_priv *priv, void __iomem *ioaddr, int bfsize, u32 chan);
  268. void (*enable_sph)(struct tc956xmac_priv *priv, void __iomem *ioaddr, bool en, u32 chan);
  269. int (*enable_tbs)(struct tc956xmac_priv *priv, void __iomem *ioaddr, bool en, u32 chan);
  270. void (*desc_stats)(struct tc956xmac_priv *priv, void __iomem *ioaddr);
  271. };
  272. #define tc956xmac_reset(__priv, __args...) \
  273. tc956xmac_do_callback(__priv, dma, reset, __args)
  274. #define tc956xmac_dma_init(__priv, __args...) \
  275. tc956xmac_do_void_callback(__priv, dma, init, __args)
  276. #define tc956xmac_init_chan(__priv, __args...) \
  277. tc956xmac_do_void_callback(__priv, dma, init_chan, __args)
  278. #define tc956xmac_init_rx_chan(__priv, __args...) \
  279. tc956xmac_do_void_callback(__priv, dma, init_rx_chan, __args)
  280. #define tc956xmac_init_tx_chan(__priv, __args...) \
  281. tc956xmac_do_void_callback(__priv, dma, init_tx_chan, __args)
  282. #define tc956xmac_axi(__priv, __args...) \
  283. tc956xmac_do_void_callback(__priv, dma, axi, __args)
  284. #define tc956xmac_dump_dma_regs(__priv, __args...) \
  285. tc956xmac_do_void_callback(__priv, dma, dump_regs, __args)
  286. #define tc956xmac_dma_rx_mode(__priv, __args...) \
  287. tc956xmac_do_void_callback(__priv, dma, dma_rx_mode, __args)
  288. #ifdef TC956X_SRIOV_PF
  289. #define tc956xmac_dma_tx_mode(__priv, __args...) \
  290. tc956xmac_do_void_callback(__priv, dma, dma_tx_mode, __args)
  291. #elif (defined TC956X_SRIOV_VF)
  292. #define tc956xmac_dma_tx_mode(__priv, __args...) \
  293. tc956xmac_do_void_callback(__priv, mbx_wrapper, dma_tx_mode, __args)
  294. #endif
  295. #define tc956xmac_dma_diagnostic_fr(__priv, __args...) \
  296. tc956xmac_do_void_callback(__priv, dma, dma_diagnostic_fr, __args)
  297. #define tc956xmac_enable_dma_transmission(__priv, __args...) \
  298. tc956xmac_do_void_callback(__priv, dma, enable_dma_transmission, __args)
  299. #define tc956xmac_enable_dma_irq(__priv, __args...) \
  300. tc956xmac_do_void_callback(__priv, dma, enable_dma_irq, __args)
  301. #define tc956xmac_disable_dma_irq(__priv, __args...) \
  302. tc956xmac_do_void_callback(__priv, dma, disable_dma_irq, __args)
  303. #define tc956xmac_start_tx(__priv, __args...) \
  304. tc956xmac_do_void_callback(__priv, dma, start_tx, __args)
  305. #define tc956xmac_stop_tx(__priv, __args...) \
  306. tc956xmac_do_void_callback(__priv, dma, stop_tx, __args)
  307. #define tc956xmac_start_rx(__priv, __args...) \
  308. tc956xmac_do_void_callback(__priv, dma, start_rx, __args)
  309. #define tc956xmac_stop_rx(__priv, __args...) \
  310. tc956xmac_do_void_callback(__priv, dma, stop_rx, __args)
  311. #define tc956xmac_dma_interrupt_status(__priv, __args...) \
  312. tc956xmac_do_callback(__priv, dma, dma_interrupt, __args)
  313. #define tc956xmac_get_hw_feature(__priv, __args...) \
  314. tc956xmac_do_void_callback(__priv, dma, get_hw_feature, __args)
  315. #define tc956xmac_rx_watchdog(__priv, __args...) \
  316. tc956xmac_do_void_callback(__priv, dma, rx_watchdog, __args)
  317. #define tc956xmac_set_tx_ring_len(__priv, __args...) \
  318. tc956xmac_do_void_callback(__priv, dma, set_tx_ring_len, __args)
  319. #define tc956xmac_set_rx_ring_len(__priv, __args...) \
  320. tc956xmac_do_void_callback(__priv, dma, set_rx_ring_len, __args)
  321. #define tc956xmac_set_rx_tail_ptr(__priv, __args...) \
  322. tc956xmac_do_void_callback(__priv, dma, set_rx_tail_ptr, __args)
  323. #define tc956xmac_set_tx_tail_ptr(__priv, __args...) \
  324. tc956xmac_do_void_callback(__priv, dma, set_tx_tail_ptr, __args)
  325. #define tc956xmac_enable_tso(__priv, __args...) \
  326. tc956xmac_do_void_callback(__priv, dma, enable_tso, __args)
  327. #define tc956xmac_dma_qmode(__priv, __args...) \
  328. tc956xmac_do_void_callback(__priv, dma, qmode, __args)
  329. #define tc956xmac_set_dma_bfsize(__priv, __args...) \
  330. tc956xmac_do_void_callback(__priv, dma, set_bfsize, __args)
  331. #define tc956xmac_enable_sph(__priv, __args...) \
  332. tc956xmac_do_void_callback(__priv, dma, enable_sph, __args)
  333. #define tc956xmac_enable_tbs(__priv, __args...) \
  334. tc956xmac_do_callback(__priv, dma, enable_tbs, __args)
  335. #define tc956xmac_dma_desc_stats(__priv, __args...) \
  336. tc956xmac_do_void_callback(__priv, dma, desc_stats, __args)
  337. struct mac_device_info;
  338. struct net_device;
  339. struct rgmii_adv;
  340. struct tc956xmac_safety_stats;
  341. struct tc956xmac_tc_entry;
  342. struct tc956xmac_pps_cfg;
  343. struct tc956xmac_rss;
  344. struct tc956xmac_est;
  345. struct tc956xmac_rx_parser_cfg;
  346. /* Helpers to program the MAC core */
  347. struct tc956xmac_ops {
  348. /* MAC core initialization */
  349. void (*core_init)(struct tc956xmac_priv *priv, struct mac_device_info *hw, struct net_device *dev);
  350. /* Enable the MAC RX/TX */
  351. void (*set_mac)(struct tc956xmac_priv *priv, void __iomem *ioaddr, bool enable);
  352. /* Start/Stop the MAC TX */
  353. void (*set_mac_tx)(struct tc956xmac_priv *priv, void __iomem *ioaddr, bool enable);
  354. /* Start/Stop the MAC RX */
  355. void (*set_mac_rx)(struct tc956xmac_priv *priv, void __iomem *ioaddr, bool enable);
  356. /* Enable and verify that the IPC module is supported */
  357. int (*rx_ipc)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
  358. /* Enable RX Queues */
  359. void (*rx_queue_enable)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u8 mode, u32 queue);
  360. /* RX Queues Priority */
  361. void (*rx_queue_prio)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 prio, u32 queue);
  362. /* TX Queues Priority */
  363. void (*tx_queue_prio)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 prio, u32 queue);
  364. /* RX Queues Routing */
  365. void (*rx_queue_routing)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u8 packet,
  366. u32 queue);
  367. /* Program RX Algorithms */
  368. void (*prog_mtl_rx_algorithms)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 rx_alg);
  369. /* Program TX Algorithms */
  370. void (*prog_mtl_tx_algorithms)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 tx_alg);
  371. /* Set MTL TX queues weight */
  372. void (*set_mtl_tx_queue_weight)(struct tc956xmac_priv *priv, struct mac_device_info *hw,
  373. u32 weight, u32 tc);
  374. /* RX MTL queue to RX dma mapping */
  375. void (*map_mtl_to_dma)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 queue, u32 chan);
  376. /* Configure AV Algorithm */
  377. void (*config_cbs)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 send_slope,
  378. u32 idle_slope, u32 high_credit, u32 low_credit,
  379. u32 queue);
  380. /* Dump MAC registers */
  381. void (*dump_regs)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 *reg_space);
  382. /* Handle extra events on specific interrupts hw dependent */
  383. int (*host_irq_status)(struct tc956xmac_priv *priv, struct mac_device_info *hw,
  384. struct tc956xmac_extra_stats *x);
  385. /* Handle MTL interrupts */
  386. int (*host_mtl_irq_status)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 chan);
  387. /* Multicast filter setting */
  388. void (*set_filter)(struct tc956xmac_priv *priv, struct mac_device_info *hw, struct net_device *dev);
  389. /* Flow control setting */
  390. void (*flow_ctrl)(struct tc956xmac_priv *priv, struct mac_device_info *hw, unsigned int duplex,
  391. unsigned int fc, unsigned int pause_time, u32 tx_cnt);
  392. /* Set power management mode (e.g. magic frame) */
  393. void (*pmt)(struct tc956xmac_priv *priv, struct mac_device_info *hw, unsigned long mode);
  394. /* Set/Get Unicast MAC addresses */
  395. void (*set_umac_addr)(struct tc956xmac_priv *priv, struct mac_device_info *hw, unsigned char *addr,
  396. unsigned int reg_n, unsigned int vf);
  397. void (*get_umac_addr)(struct tc956xmac_priv *priv, struct mac_device_info *hw, unsigned char *addr,
  398. unsigned int reg_n);
  399. void (*set_eee_mode)(struct tc956xmac_priv *priv, struct mac_device_info *hw,
  400. bool en_tx_lpi_clockgating);
  401. void (*reset_eee_mode)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
  402. void (*set_eee_timer)(struct tc956xmac_priv *priv, struct mac_device_info *hw, int ls, int tw);
  403. void (*set_eee_pls)(struct tc956xmac_priv *priv, struct mac_device_info *hw, int link);
  404. void (*debug)(struct tc956xmac_priv *priv, void __iomem *ioaddr, struct tc956xmac_extra_stats *x,
  405. u32 rx_queues, u32 tx_queues);
  406. /* PCS calls */
  407. void (*pcs_ctrl_ane)(struct tc956xmac_priv *priv, void __iomem *ioaddr, bool ane, bool srgmi_ral,
  408. bool loopback);
  409. void (*pcs_rane)(struct tc956xmac_priv *priv, void __iomem *ioaddr, bool restart);
  410. void (*pcs_get_adv_lp)(struct tc956xmac_priv *priv, void __iomem *ioaddr, struct rgmii_adv *adv);
  411. #ifdef TC956X
  412. int (*xpcs_init)(struct tc956xmac_priv *priv, void __iomem *xpcsaddr);
  413. void (*xpcs_ctrl_ane)(struct tc956xmac_priv *priv, bool ane);
  414. #endif
  415. /* Safety Features */
  416. int (*safety_feat_config)(struct tc956xmac_priv *priv, void __iomem *ioaddr, unsigned int asp);
  417. int (*safety_feat_irq_status)(struct tc956xmac_priv *priv, struct net_device *ndev,
  418. void __iomem *ioaddr, unsigned int asp,
  419. struct tc956xmac_safety_stats *stats);
  420. int (*safety_feat_dump)(struct tc956xmac_priv *priv, struct tc956xmac_safety_stats *stats,
  421. int index, unsigned long *count, const char **desc);
  422. /* Flexible RX Parser */
  423. int (*rxp_config)(struct tc956xmac_priv *priv, void __iomem *ioaddr, struct tc956xmac_tc_entry *entries,
  424. unsigned int count);
  425. int (*rx_parser_init)(struct tc956xmac_priv *priv, struct net_device *ndev,
  426. struct mac_device_info *hw, unsigned int spram,
  427. unsigned int frpsel, unsigned int frpes,
  428. struct tc956xmac_rx_parser_cfg *cnf);
  429. /* Flexible PPS */
  430. int (*flex_pps_config)(struct tc956xmac_priv *priv, void __iomem *ioaddr, int index,
  431. struct tc956xmac_pps_cfg *cfg, bool enable,
  432. u32 sub_second_inc, u32 systime_flags);
  433. /* Loopback for selftests */
  434. void (*set_mac_loopback)(struct tc956xmac_priv *priv, void __iomem *ioaddr, bool enable);
  435. /* RSS */
  436. int (*rss_configure)(struct tc956xmac_priv *priv, struct mac_device_info *hw,
  437. struct tc956xmac_rss *cfg, u32 num_rxq);
  438. /* VLAN */
  439. void (*update_vlan_hash)(struct tc956xmac_priv *priv, struct net_device *dev, bool is_double, u16 vid,
  440. u16 vf);
  441. void (*delete_vlan)(struct tc956xmac_priv *priv, struct net_device *dev, u16 vid,
  442. u16 vf);
  443. void (*enable_vlan)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 type);
  444. #ifdef TC956X
  445. void (*disable_tx_vlan)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
  446. void (*enable_rx_vlan_stripping)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
  447. void (*disable_rx_vlan_stripping)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
  448. void (*enable_rx_vlan_filtering)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
  449. void (*disable_rx_vlan_filtering)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
  450. #endif
  451. /* TX Timestamp */
  452. int (*get_mac_tx_timestamp)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u64 *ts);
  453. /* Source Address Insertion / Replacement */
  454. void (*sarc_configure)(struct tc956xmac_priv *priv, void __iomem *ioaddr, int val);
  455. /* Filtering */
  456. int (*config_l3_filter)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 filter_no,
  457. bool en, bool ipv6, bool sa, bool inv,
  458. u32 match);
  459. int (*config_l4_filter)(struct tc956xmac_priv *priv, struct mac_device_info *hw, u32 filter_no,
  460. bool en, bool udp, bool sa, bool inv,
  461. u32 match);
  462. void (*set_arp_offload)(struct tc956xmac_priv *priv, struct mac_device_info *hw, bool en, u32 addr);
  463. int (*est_configure)(struct tc956xmac_priv *priv, void __iomem *ioaddr, struct tc956xmac_est *cfg,
  464. unsigned int ptp_rate);
  465. void (*fpe_configure)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 num_txq, u32 num_rxq,
  466. bool enable);
  467. void (*set_ptp_offload)(struct tc956xmac_priv *priv, void __iomem *ioaddr, bool en);
  468. void (*jumbo_en)(struct tc956xmac_priv *priv, struct net_device *dev, u32 en);
  469. };
  470. #define tc956xmac_core_init(__priv, __args...) \
  471. tc956xmac_do_void_callback(__priv, mac, core_init, __args)
  472. #define tc956xmac_mac_set(__priv, __args...) \
  473. tc956xmac_do_void_callback(__priv, mac, set_mac, __args)
  474. #define tc956xmac_mac_set_tx(__priv, __args...) \
  475. tc956xmac_do_void_callback(__priv, mac, set_mac_tx, __args)
  476. #define tc956xmac_mac_set_rx(__priv, __args...) \
  477. tc956xmac_do_void_callback(__priv, mac, set_mac_rx, __args)
  478. #define tc956xmac_rx_ipc(__priv, __args...) \
  479. tc956xmac_do_callback(__priv, mac, rx_ipc, __args)
  480. #define tc956xmac_rx_queue_enable(__priv, __args...) \
  481. tc956xmac_do_void_callback(__priv, mac, rx_queue_enable, __args)
  482. #define tc956xmac_rx_queue_prio(__priv, __args...) \
  483. tc956xmac_do_void_callback(__priv, mac, rx_queue_prio, __args)
  484. #ifdef TC956X_SRIOV_PF
  485. #define tc956xmac_tx_queue_prio(__priv, __args...) \
  486. tc956xmac_do_void_callback(__priv, mac, tx_queue_prio, __args)
  487. #elif (defined TC956X_SRIOV_VF)
  488. #define tc956xmac_tx_queue_prio(__priv, __args...) \
  489. tc956xmac_do_void_callback(__priv, mbx_wrapper, tx_queue_prio, __args)
  490. #endif
  491. #define tc956xmac_rx_queue_routing(__priv, __args...) \
  492. tc956xmac_do_void_callback(__priv, mac, rx_queue_routing, __args)
  493. #define tc956xmac_prog_mtl_rx_algorithms(__priv, __args...) \
  494. tc956xmac_do_void_callback(__priv, mac, prog_mtl_rx_algorithms, __args)
  495. #define tc956xmac_prog_mtl_tx_algorithms(__priv, __args...) \
  496. tc956xmac_do_void_callback(__priv, mac, prog_mtl_tx_algorithms, __args)
  497. #ifdef TC956X_SRIOV_PF
  498. #define tc956xmac_set_mtl_tx_queue_weight(__priv, __args...) \
  499. tc956xmac_do_void_callback(__priv, mac, set_mtl_tx_queue_weight, __args)
  500. #elif (defined TC956X_SRIOV_VF)
  501. #define tc956xmac_set_mtl_tx_queue_weight(__priv, __args...) \
  502. tc956xmac_do_void_callback(__priv, mbx_wrapper, set_mtl_tx_queue_weight, __args)
  503. #endif
  504. #define tc956xmac_map_mtl_to_dma(__priv, __args...) \
  505. tc956xmac_do_void_callback(__priv, mac, map_mtl_to_dma, __args)
  506. #ifdef TC956X_SRIOV_PF
  507. #define tc956xmac_config_cbs(__priv, __args...) \
  508. tc956xmac_do_void_callback(__priv, mac, config_cbs, __args)
  509. #elif defined TC956X_SRIOV_VF
  510. #define tc956xmac_config_cbs(__priv, __args...) \
  511. tc956xmac_do_void_callback(__priv, mbx_wrapper, config_cbs, __args)
  512. #endif
  513. #ifdef TC956X_SRIOV_VF
  514. #define tc956x_phy_link(__priv, __args...) \
  515. tc956xmac_do_callback(__priv, mbx_wrapper, phy_link, __args)
  516. #define tc956x_setup_mbx_etf(__priv, __args...) \
  517. tc956xmac_do_callback(__priv, mbx_wrapper, setup_mbx_etf, __args)
  518. #define tc956x_get_drv_cap(__priv, __args...) \
  519. tc956xmac_do_void_callback(__priv, mbx_wrapper, get_drv_cap, __args)
  520. #define tc956x_rx_crc(__priv, __args...) \
  521. tc956xmac_do_callback(__priv, mbx_wrapper, rx_crc, __args)
  522. #define tc956x_rx_dma_ch_tlptr(__priv, __args...) \
  523. tc956xmac_do_callback(__priv, mbx_wrapper, rx_dma_ch_tlptr, __args)
  524. #define tc956x_rx_dma_err(__priv, __args...) \
  525. tc956xmac_do_callback(__priv, mbx_wrapper, rx_dma_err, __args)
  526. #define tc956x_rx_csum(__priv, __args...) \
  527. tc956xmac_do_callback(__priv, mbx_wrapper, rx_csum, __args)
  528. #define tc956x_mbx_flr(__priv, __args...) \
  529. tc956xmac_do_callback(__priv, mbx_wrapper, pf_flr, __args)
  530. #endif
  531. #define tc956xmac_dump_mac_regs(__priv, __args...) \
  532. tc956xmac_do_void_callback(__priv, mac, dump_regs, __args)
  533. #define tc956xmac_host_irq_status(__priv, __args...) \
  534. tc956xmac_do_callback(__priv, mac, host_irq_status, __args)
  535. #define tc956xmac_host_mtl_irq_status(__priv, __args...) \
  536. tc956xmac_do_callback(__priv, mac, host_mtl_irq_status, __args)
  537. #define tc956xmac_set_filter(__priv, __args...) \
  538. tc956xmac_do_void_callback(__priv, mac, set_filter, __args)
  539. #define tc956xmac_flow_ctrl(__priv, __args...) \
  540. tc956xmac_do_void_callback(__priv, mac, flow_ctrl, __args)
  541. #define tc956xmac_pmt(__priv, __args...) \
  542. tc956xmac_do_void_callback(__priv, mac, pmt, __args)
  543. #ifdef TC956X_SRIOV_PF
  544. #define tc956xmac_set_umac_addr(__priv, __args...) \
  545. tc956xmac_do_void_callback(__priv, mac, set_umac_addr, __args)
  546. #elif (defined TC956X_SRIOV_VF)
  547. #define tc956xmac_set_umac_addr(__priv, __args...) \
  548. tc956xmac_do_callback(__priv, mbx_wrapper, set_umac_addr, __args)
  549. #endif
  550. #ifdef TC956X_SRIOV_PF
  551. #define tc956xmac_get_umac_addr(__priv, __args...) \
  552. tc956xmac_do_void_callback(__priv, mac, get_umac_addr, __args)
  553. #elif (defined TC956X_SRIOV_VF)
  554. #define tc956xmac_get_umac_addr(__priv, __args...) \
  555. tc956xmac_do_void_callback(__priv, mbx_wrapper, get_umac_addr, __args)
  556. #endif
  557. #define tc956xmac_set_eee_mode(__priv, __args...) \
  558. tc956xmac_do_void_callback(__priv, mac, set_eee_mode, __args)
  559. #ifdef TC956X_SRIOV_VF
  560. #define tc956xmac_reset_eee_mode(__priv, __args...) \
  561. tc956xmac_do_void_callback(__priv, mbx_wrapper, reset_eee_mode, __args)
  562. #else
  563. #define tc956xmac_reset_eee_mode(__priv, __args...) \
  564. tc956xmac_do_void_callback(__priv, mac, reset_eee_mode, __args)
  565. #endif
  566. #define tc956xmac_set_eee_timer(__priv, __args...) \
  567. tc956xmac_do_void_callback(__priv, mac, set_eee_timer, __args)
  568. #define tc956xmac_set_eee_pls(__priv, __args...) \
  569. tc956xmac_do_void_callback(__priv, mac, set_eee_pls, __args)
  570. #define tc956xmac_mac_debug(__priv, __args...) \
  571. tc956xmac_do_void_callback(__priv, mac, debug, __args)
  572. #ifdef TC956X
  573. #define tc956xmac_xpcs_init(__priv, __args...) \
  574. tc956xmac_do_callback(__priv, mac, xpcs_init, __args)
  575. #define tc956xmac_xpcs_ctrl_ane(__priv, __args...) \
  576. tc956xmac_do_void_callback(__priv, mac, xpcs_ctrl_ane, __args)
  577. #endif
  578. #define tc956xmac_pcs_ctrl_ane(__priv, __args...) \
  579. tc956xmac_do_void_callback(__priv, mac, pcs_ctrl_ane, __args)
  580. #define tc956xmac_pcs_rane(__priv, __args...) \
  581. tc956xmac_do_void_callback(__priv, mac, pcs_rane, __args)
  582. #define tc956xmac_pcs_get_adv_lp(__priv, __args...) \
  583. tc956xmac_do_void_callback(__priv, mac, pcs_get_adv_lp, __args)
  584. #define tc956xmac_safety_feat_config(__priv, __args...) \
  585. tc956xmac_do_callback(__priv, mac, safety_feat_config, __args)
  586. #define tc956xmac_safety_feat_irq_status(__priv, __args...) \
  587. tc956xmac_do_callback(__priv, mac, safety_feat_irq_status, __args)
  588. #define tc956xmac_safety_feat_dump(__priv, __args...) \
  589. tc956xmac_do_callback(__priv, mac, safety_feat_dump, __args)
  590. #define tc956xmac_rxp_config(__priv, __args...) \
  591. tc956xmac_do_callback(__priv, mac, rxp_config, __args)
  592. #define tc956xmac_rx_parser_init(__priv, __args...) \
  593. tc956xmac_do_callback(__priv, mac, rx_parser_init, __args)
  594. #define tc956xmac_flex_pps_config(__priv, __args...) \
  595. tc956xmac_do_callback(__priv, mac, flex_pps_config, __args)
  596. #define tc956xmac_set_mac_loopback(__priv, __args...) \
  597. tc956xmac_do_void_callback(__priv, mac, set_mac_loopback, __args)
  598. #define tc956xmac_rss_configure(__priv, __args...) \
  599. tc956xmac_do_callback(__priv, mac, rss_configure, __args)
  600. #define tc956xmac_update_vlan_hash(__priv, __args...) \
  601. tc956xmac_do_void_callback(__priv, mac, update_vlan_hash, __args)
  602. #ifdef TC956X_SRIOV_PF
  603. #define tc956xmac_delete_vlan(__priv, __args...) \
  604. tc956xmac_do_void_callback(__priv, mac, delete_vlan, __args)
  605. #else //TC956X_SRIOV_PF
  606. #define tc956xmac_delete_vlan(__priv, __args...) \
  607. tc956xmac_do_void_callback(__priv, mbx_wrapper, delete_vlan, __args)
  608. #endif
  609. #define tc956xmac_enable_vlan(__priv, __args...) \
  610. tc956xmac_do_void_callback(__priv, mac, enable_vlan, __args)
  611. #ifdef TC956X
  612. #define tc956xmac_disable_tx_vlan(__priv, __args...) \
  613. tc956xmac_do_void_callback(__priv, mac, disable_tx_vlan, __args)
  614. #define tc956xmac_enable_rx_vlan_stripping(__priv, __args...) \
  615. tc956xmac_do_void_callback(__priv, mac, enable_rx_vlan_stripping, __args)
  616. #define tc956xmac_disable_rx_vlan_stripping(__priv, __args...) \
  617. tc956xmac_do_void_callback(__priv, mac, disable_rx_vlan_stripping, __args)
  618. #define tc956xmac_enable_rx_vlan_filtering(__priv, __args...) \
  619. tc956xmac_do_void_callback(__priv, mac, enable_rx_vlan_filtering, __args)
  620. #define tc956xmac_disable_rx_vlan_filtering(__priv, __args...) \
  621. tc956xmac_do_void_callback(__priv, mac, disable_rx_vlan_filtering, __args)
  622. #endif
  623. #define tc956xmac_get_mac_tx_timestamp(__priv, __args...) \
  624. tc956xmac_do_callback(__priv, mac, get_mac_tx_timestamp, __args)
  625. #define tc956xmac_sarc_configure(__priv, __args...) \
  626. tc956xmac_do_void_callback(__priv, mac, sarc_configure, __args)
  627. #define tc956xmac_config_l3_filter(__priv, __args...) \
  628. tc956xmac_do_callback(__priv, mac, config_l3_filter, __args)
  629. #define tc956xmac_config_l4_filter(__priv, __args...) \
  630. tc956xmac_do_callback(__priv, mac, config_l4_filter, __args)
  631. #define tc956xmac_set_arp_offload(__priv, __args...) \
  632. tc956xmac_do_void_callback(__priv, mac, set_arp_offload, __args)
  633. #define tc956xmac_est_configure(__priv, __args...) \
  634. tc956xmac_do_callback(__priv, mac, est_configure, __args)
  635. #define tc956xmac_fpe_configure(__priv, __args...) \
  636. tc956xmac_do_void_callback(__priv, mac, fpe_configure, __args)
  637. #define tc956xmac_set_ptp_offload(__priv, __args...) \
  638. tc956xmac_do_void_callback(__priv, mac, set_ptp_offload, __args)
  639. #define tc956xmac_jumbo_en(__priv, __args...) \
  640. tc956xmac_do_void_callback(__priv, mac, jumbo_en, __args)
  641. #ifdef TC956X_SRIOV_VF
  642. #define tc956xmac_get_speed(__priv, __args...) \
  643. tc956xmac_do_callback(__priv, mbx_wrapper, get_speed, __args)
  644. #define tc956xmac_get_est(__priv, __args...) \
  645. tc956xmac_do_callback(__priv, mbx_wrapper, get_est, __args)
  646. #define tc956xmac_set_est(__priv, __args...) \
  647. tc956xmac_do_callback(__priv, mbx_wrapper, set_est, __args)
  648. #define tc956xmac_get_rxp(__priv, __args...) \
  649. tc956xmac_do_callback(__priv, mbx_wrapper, get_rxp, __args)
  650. #define tc956xmac_set_rxp(__priv, __args...) \
  651. tc956xmac_do_callback(__priv, mbx_wrapper, set_rxp, __args)
  652. #define tc956xmac_get_fpe(__priv, __args...) \
  653. tc956xmac_do_callback(__priv, mbx_wrapper, get_fpe, __args)
  654. #define tc956xmac_set_fpe(__priv, __args...) \
  655. tc956xmac_do_callback(__priv, mbx_wrapper, set_fpe, __args)
  656. #define tc956xmac_reg_wr(__priv, __args...) \
  657. tc956xmac_do_callback(__priv, mbx_wrapper, reg_wr, __args)
  658. #define tc956xmac_get_cbs(__priv, __args...) \
  659. tc956xmac_do_callback(__priv, mbx_wrapper, get_cbs, __args)
  660. #define tc956xmac_set_cbs(__priv, __args...) \
  661. tc956xmac_do_callback(__priv, mbx_wrapper, set_cbs, __args)
  662. #define tc956xmac_ethtool_get_pauseparam(__priv, __args...) \
  663. tc956xmac_do_callback(__priv, mbx_wrapper, get_pause_param, __args)
  664. #define tc956xmac_ethtool_get_eee(__priv, __args...) \
  665. tc956xmac_do_callback(__priv, mbx_wrapper, get_eee, __args)
  666. #define tc956xmac_add_mac(__priv, __args...) \
  667. tc956xmac_do_callback(__priv, mbx_wrapper, add_mac, __args)
  668. #define tc956xmac_delete_mac(__priv, __args...) \
  669. tc956xmac_do_void_callback(__priv, mbx_wrapper, delete_mac, __args)
  670. #define tc956xmac_add_vlan(__priv, __args...) \
  671. tc956xmac_do_void_callback(__priv, mbx_wrapper, add_vlan, __args)
  672. #endif
  673. #ifdef TC956X_SRIOV_VF
  674. #define tc956xmac_get_link_status(__priv, __args...) \
  675. tc956xmac_do_void_callback(__priv, mbx_wrapper, get_link_status, __args)
  676. #define tc956xmac_vf_reset(__priv, __args...) \
  677. tc956xmac_do_void_callback(__priv, mbx_wrapper, vf_reset, __args)
  678. #endif
  679. /* PTP and HW Timer helpers */
  680. struct tc956xmac_hwtimestamp {
  681. void (*config_hw_tstamping)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 data);
  682. void (*config_sub_second_increment)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 ptp_clock,
  683. int gmac4, u32 *ssinc);
  684. int (*init_systime)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 sec, u32 nsec);
  685. int (*config_addend)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 addend);
  686. int (*adjust_systime)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u32 sec, u32 nsec,
  687. int add_sub, int gmac4);
  688. void (*get_systime)(struct tc956xmac_priv *priv, void __iomem *ioaddr, u64 *systime);
  689. };
  690. #define tc956xmac_config_hw_tstamping(__priv, __args...) \
  691. tc956xmac_do_void_callback(__priv, ptp, config_hw_tstamping, __args)
  692. #define tc956xmac_config_sub_second_increment(__priv, __args...) \
  693. tc956xmac_do_void_callback(__priv, ptp, config_sub_second_increment, __args)
  694. #define tc956xmac_init_systime(__priv, __args...) \
  695. tc956xmac_do_callback(__priv, ptp, init_systime, __args)
  696. #define tc956xmac_config_addend(__priv, __args...) \
  697. tc956xmac_do_callback(__priv, ptp, config_addend, __args)
  698. #define tc956xmac_adjust_systime(__priv, __args...) \
  699. tc956xmac_do_callback(__priv, ptp, adjust_systime, __args)
  700. #define tc956xmac_get_systime(__priv, __args...) \
  701. tc956xmac_do_void_callback(__priv, ptp, get_systime, __args)
  702. /* Helpers to manage the descriptors for chain and ring modes */
  703. struct tc956xmac_mode_ops {
  704. void (*init)(struct tc956xmac_priv *priv, void *des, dma_addr_t phy_addr, unsigned int size,
  705. unsigned int extend_desc);
  706. unsigned int (*is_jumbo_frm)(struct tc956xmac_priv *priv, int len, int ehn_desc);
  707. int (*jumbo_frm)(struct tc956xmac_priv *priv, void *priv_ptr, struct sk_buff *skb, int csum);
  708. int (*set_16kib_bfsize)(struct tc956xmac_priv *priv, int mtu);
  709. void (*init_desc3)(struct tc956xmac_priv *priv, struct dma_desc *p);
  710. void (*refill_desc3)(struct tc956xmac_priv *priv, void *priv_ptr, struct dma_desc *p);
  711. void (*clean_desc3)(struct tc956xmac_priv *priv, void *priv_ptr, struct dma_desc *p);
  712. };
  713. #define tc956xmac_mode_init(__priv, __args...) \
  714. tc956xmac_do_void_callback(__priv, mode, init, __args)
  715. #define tc956xmac_is_jumbo_frm(__priv, __args...) \
  716. tc956xmac_do_callback(__priv, mode, is_jumbo_frm, __args)
  717. #define tc956xmac_jumbo_frm(__priv, __args...) \
  718. tc956xmac_do_callback(__priv, mode, jumbo_frm, __args)
  719. #define tc956xmac_set_16kib_bfsize(__priv, __args...) \
  720. tc956xmac_do_callback(__priv, mode, set_16kib_bfsize, __args)
  721. #define tc956xmac_init_desc3(__priv, __args...) \
  722. tc956xmac_do_void_callback(__priv, mode, init_desc3, __args)
  723. #define tc956xmac_refill_desc3(__priv, __args...) \
  724. tc956xmac_do_void_callback(__priv, mode, refill_desc3, __args)
  725. #define tc956xmac_clean_desc3(__priv, __args...) \
  726. tc956xmac_do_void_callback(__priv, mode, clean_desc3, __args)
  727. #ifdef TC956X_SRIOV_PF
  728. struct tc956xmac_priv;
  729. #endif
  730. struct tc_cls_u32_offload;
  731. struct tc_cbs_qopt_offload;
  732. struct flow_cls_offload;
  733. struct tc_taprio_qopt_offload;
  734. struct tc_etf_qopt_offload;
  735. struct tc_query_caps_base;
  736. struct tc956xmac_tc_ops {
  737. int (*init)(struct tc956xmac_priv *priv, void *data);
  738. int (*setup_cls_u32)(struct tc956xmac_priv *priv,
  739. struct tc_cls_u32_offload *cls);
  740. int (*setup_cbs)(struct tc956xmac_priv *priv,
  741. struct tc_cbs_qopt_offload *qopt);
  742. int (*setup_cls)(struct tc956xmac_priv *priv,
  743. struct flow_cls_offload *cls);
  744. int (*setup_taprio)(struct tc956xmac_priv *priv,
  745. struct tc_taprio_qopt_offload *qopt);
  746. int (*setup_etf)(struct tc956xmac_priv *priv,
  747. struct tc_etf_qopt_offload *qopt);
  748. int (*query_caps)(struct tc956xmac_priv *priv,
  749. struct tc_query_caps_base *base);
  750. };
  751. #define tc956xmac_tc_init(__priv, __args...) \
  752. tc956xmac_do_callback(__priv, tc, init, __args)
  753. #define tc956xmac_tc_setup_cls_u32(__priv, __args...) \
  754. tc956xmac_do_callback(__priv, tc, setup_cls_u32, __args)
  755. #ifdef TC956X_SRIOV_PF
  756. #define tc956xmac_tc_setup_cbs(__priv, __args...) \
  757. tc956xmac_do_callback(__priv, tc, setup_cbs, __args)
  758. #elif (defined TC956X_SRIOV_VF)
  759. #define tc956xmac_tc_setup_cbs(__priv, __args...) \
  760. tc956xmac_do_void_callback(__priv, mbx_wrapper, setup_cbs, __args)
  761. #endif
  762. #define tc956xmac_tc_setup_cls(__priv, __args...) \
  763. tc956xmac_do_callback(__priv, tc, setup_cls, __args)
  764. #define tc956xmac_tc_setup_taprio(__priv, __args...) \
  765. tc956xmac_do_callback(__priv, tc, setup_taprio, __args)
  766. #define tc956xmac_tc_setup_etf(__priv, __args...) \
  767. tc956xmac_do_callback(__priv, tc, setup_etf, __args)
  768. #if (LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 16))
  769. #define tc956xmac_tc_setup_query_cap(__priv, __args...) \
  770. tc956xmac_do_callback(__priv, tc, query_caps, __args)
  771. #endif
  772. struct tc956xmac_counters;
  773. struct tc956xmac_mmc_ops {
  774. void (*ctrl)(struct tc956xmac_priv *priv, void __iomem *ioaddr, unsigned int mode);
  775. void (*intr_all_mask)(struct tc956xmac_priv *priv, void __iomem *ioaddr);
  776. void (*read)(struct tc956xmac_priv *priv, void __iomem *ioaddr, struct tc956xmac_counters *mmc);
  777. };
  778. #define tc956xmac_mmc_ctrl(__priv, __args...) \
  779. tc956xmac_do_void_callback(__priv, mmc, ctrl, __args)
  780. #define tc956xmac_mmc_intr_all_mask(__priv, __args...) \
  781. tc956xmac_do_void_callback(__priv, mmc, intr_all_mask, __args)
  782. #define tc956xmac_mmc_read(__priv, __args...) \
  783. tc956xmac_do_void_callback(__priv, mmc, read, __args)
  784. #if defined(TC956X_SRIOV_PF) | defined(TC956X_SRIOV_VF)
  785. struct mac_rsc_mng_ops {
  786. #ifdef TC956X_SRIOV_VF
  787. int (*init)(struct tc956xmac_priv *priv, struct net_device *dev);
  788. #endif
  789. int (*get_fn_id)(struct tc956xmac_priv *priv, void __iomem *reg_pci_bridge_config_addr, struct fn_id *fn_id_info);
  790. /*rscs[4] = {PFx_DMA_bit_pattern, VF0_DMA_bit_pattern, VF1_DMA_bit_pattern, VF2_DMA_bit_pattern}*/
  791. void (*set_rscs)(struct tc956xmac_priv *priv, struct net_device *dev, u8 *rscs);
  792. /*resource allocated rscs - bit pattern [DMA7 bit-7] ... ... ... [DMA0 bit-0]*/
  793. void (*get_rscs)(struct tc956xmac_priv *priv, struct net_device *dev, u8 *rscs);
  794. };
  795. #endif
  796. #ifdef TC956X_SRIOV_VF
  797. #define tc956xmac_rsc_mng_init(__priv, __args...) \
  798. tc956xmac_do_callback(__priv, rsc, init, __args)
  799. #endif
  800. #define tc956xmac_rsc_mng_get_fn_id(__priv, __args...) \
  801. tc956xmac_do_callback(__priv, rsc, get_fn_id, __args)
  802. #define tc956xmac_rsc_mng_set_rscs(__priv, __args...) \
  803. tc956xmac_do_void_callback(__priv, rsc, set_rscs, __args)
  804. #define tc956xmac_rsc_mng_get_rscs(__priv, __args...) \
  805. tc956xmac_do_void_callback(__priv, rsc, get_rscs, __args)
  806. #ifdef TC956X_SRIOV_VF
  807. /* Specific mailbox helpers */
  808. struct tc956xmac_mbx_wrapper_ops {
  809. void (*dma_tx_mode)(struct tc956xmac_priv *priv, int mode, u32 channel,
  810. int fifosz, u8 qmode);
  811. void (*get_umac_addr)(struct tc956xmac_priv *priv, unsigned char *addr,
  812. unsigned int reg_n);
  813. int (*set_umac_addr)(struct tc956xmac_priv *priv, unsigned char *addr,
  814. unsigned int reg_n);
  815. /* Set MTL TX queues weight */
  816. void (*set_mtl_tx_queue_weight)(struct tc956xmac_priv *priv,
  817. u32 weight, u32 traffic_class);
  818. /* Configure AV Algorithm */
  819. void (*config_cbs)(struct tc956xmac_priv *priv, u32 send_slope,
  820. u32 idle_slope, u32 high_credit, u32 low_credit,
  821. u32 queue);
  822. int (*setup_cbs)(struct tc956xmac_priv *priv, struct tc_cbs_qopt_offload *qopt);
  823. /* TX Queues Priority */
  824. void (*tx_queue_prio)(struct tc956xmac_priv *priv, u32 prio, u32 queue);
  825. /* Get PF link status */
  826. void (*get_link_status)(struct tc956xmac_priv *priv, u32 *link_status,
  827. u32 *speed, u32 *duplex);
  828. /* PHY Link state change from PF */
  829. int (*phy_link)(struct tc956xmac_priv *priv, u8 *msg_buf, u8 *ack_msg);
  830. int (*setup_mbx_etf)(struct tc956xmac_priv *priv, u8 *msg_buf, u8 *ack_msg);
  831. /* Get driver Capabilities from PF */
  832. void (*get_drv_cap)(struct tc956xmac_priv *priv, struct tc956xmac_priv *priv1);
  833. void (*reset_eee_mode)(struct tc956xmac_priv *priv, struct mac_device_info *hw);
  834. void (*vf_reset)(struct tc956xmac_priv *priv, u8 vf_status);
  835. /* Rx CRC state update from PF */
  836. int (*rx_crc)(struct tc956xmac_priv *priv, u8 *msg_buf, u8 *ack_msg);
  837. int (*rx_dma_ch_tlptr)(struct tc956xmac_priv *priv, u8 *msg_buf, u8 *ack_msg);
  838. int (*rx_dma_err)(struct tc956xmac_priv *priv, u8 *msg_buf, u8 *ack_msg);
  839. /* Rx checksum state update from PF */
  840. int (*rx_csum)(struct tc956xmac_priv *priv, u8 *msg_buf, u8 *ack_msg);
  841. int (*pf_flr)(struct tc956xmac_priv *priv, u8 *msg_buf, u8 *ack_msg);
  842. int (*get_cbs)(struct tc956xmac_priv *priv, void __user *data);
  843. int (*set_cbs)(struct tc956xmac_priv *priv, void __user *data);
  844. int (*get_est)(struct tc956xmac_priv *priv, void __user *data);
  845. int (*set_est)(struct tc956xmac_priv *priv, void __user *data);
  846. int (*get_rxp)(struct tc956xmac_priv *priv, void __user *data);
  847. int (*set_rxp)(struct tc956xmac_priv *priv, void __user *data);
  848. int (*get_fpe)(struct tc956xmac_priv *priv, void __user *data);
  849. int (*set_fpe)(struct tc956xmac_priv *priv, void __user *data);
  850. int (*get_speed)(struct tc956xmac_priv *priv, void __user *data);
  851. int (*reg_wr)(struct tc956xmac_priv *priv, void __user *data);
  852. int (*get_pause_param)(struct tc956xmac_priv *priv, struct ethtool_pauseparam *pause);
  853. int (*get_eee)(struct tc956xmac_priv *priv, struct ethtool_eee *edata);
  854. int (*get_ts_info)(struct tc956xmac_priv *priv, struct ethtool_ts_info *info);
  855. int (*add_mac)(struct tc956xmac_priv *priv, const u8 *mac);
  856. void (*delete_mac)(struct tc956xmac_priv *priv, const u8 *mac);
  857. void (*delete_vlan)(struct tc956xmac_priv *priv, u16 vid);
  858. void (*add_vlan)(struct tc956xmac_priv *priv, u16 vid);
  859. };
  860. #endif
  861. #if defined(TC956X_SRIOV_PF) | defined(TC956X_SRIOV_VF)
  862. struct mac_mbx_ops {
  863. void (*init)(struct tc956xmac_priv *priv, void *data);
  864. int (*read)(struct tc956xmac_priv *priv, u8 *msg_buff,
  865. enum mbx_msg_fns msg_src, struct fn_id *fn_id_info);
  866. int (*write)(struct tc956xmac_priv *priv, u8 *msg_buff,
  867. enum mbx_msg_fns msg_dst, struct fn_id *fn_id_info);
  868. void (*send_ack)(struct tc956xmac_priv *priv, u8 *msg_buff,
  869. enum mbx_msg_fns msg_dst, struct fn_id *fn_id_info);
  870. /* normally interrupt method is used.
  871. * But for ACK/NACK checking this can be used.
  872. */
  873. int (*poll_for_ack)(struct tc956xmac_priv *priv, enum mbx_msg_fns msg_src);
  874. };
  875. #define tc956xmac_mbx_init(__priv, __args...) \
  876. tc956xmac_do_void_callback(__priv, mbx, init, __args)
  877. #define tc956xmac_mbx_read(__priv, __args...) \
  878. tc956xmac_do_callback(__priv, mbx, read, __args)
  879. #define tc956xmac_mbx_write(__priv, __args...) \
  880. tc956xmac_do_callback(__priv, mbx, write, __args)
  881. #define tc956xmac_mbx_send_ack(__priv, __args...) \
  882. tc956xmac_do_void_callback(__priv, mbx, send_ack, __args)
  883. #define tc956xmac_mbx_poll_for_ack(__priv, __args...) \
  884. tc956xmac_do_callback(__priv, mbx, poll_for_ack, __args)
  885. #endif /* #ifdef TC956X_SRIOV_PF/VF */
  886. #ifdef TC956X_SRIOV_PF
  887. struct tc956x_msi_ops {
  888. void (*init)(struct tc956xmac_priv *priv, struct net_device *dev);
  889. void (*interrupt_en)(struct tc956xmac_priv *priv, struct net_device *dev, u32 en);
  890. void (*interrupt_clr)(struct tc956xmac_priv *priv, struct net_device *dev, u32 vector);
  891. };
  892. #define tc956x_msi_init(__priv, __args...) \
  893. tc956xmac_do_void_callback(__priv, msi, init, __args)
  894. #define tc956x_msi_intr_en(__priv, __args...) \
  895. tc956xmac_do_void_callback(__priv, msi, interrupt_en, __args)
  896. #define tc956x_msi_intr_clr(__priv, __args...) \
  897. tc956xmac_do_void_callback(__priv, msi, interrupt_clr, __args)
  898. /* Specific mailbox helpers */
  899. struct tc956x_mbx_wrapper_ops {
  900. void (*phy_link)(struct tc956xmac_priv *priv);
  901. int (*set_dma_tx_mode)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff);
  902. int (*set_mtl_tx_queue_weight)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff);
  903. int (*config_cbs)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff);
  904. int (*setup_cbs)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff);
  905. int (*setup_mbx_etf)(struct tc956xmac_priv *priv, u32 ch, u8 vf);
  906. int (*tx_queue_prio)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff);
  907. int (*vf_get_link_status)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff);
  908. void (*rx_crc)(struct tc956xmac_priv *priv);
  909. void (*rx_csum)(struct tc956xmac_priv *priv);
  910. void (*pf_flr)(struct tc956xmac_priv *priv);
  911. int (*reset_eee_mode)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff);
  912. int (*get_umac_addr)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff);
  913. int (*set_umac_addr)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff, u8 vf_no);
  914. int (*vf_reset)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff, u8 vf_no);
  915. int (*get_drv_cap)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff);
  916. int (*vf_ioctl)(struct tc956xmac_priv *priv, u8 *mbx_buff, u8 *ack_buff, u8 vf_no);
  917. int (*vf_ethtool)(struct tc956xmac_priv *priv, struct net_device *dev, u8 *mbx_buff, u8 *ack_buff);
  918. int (*add_mac)(struct tc956xmac_priv *priv, struct net_device *dev, u8 *mbx_buff, u8 *ack_buff, u8 vf_no);
  919. int (*delete_mac)(struct tc956xmac_priv *priv, struct net_device *dev, u8 *mbx_buff, u8 *ack_buff, u8 vf_no);
  920. int (*add_vlan)(struct tc956xmac_priv *priv, struct net_device *dev, u8 *mbx_buff, u8 *ack_buff, u8 vf_no);
  921. int (*delete_vlan)(struct tc956xmac_priv *priv, struct net_device *dev, u8 *mbx_buff, u8 *ack_buff, u8 vf_no);
  922. int (*rx_dma_ch_tlptr)(struct tc956xmac_priv *priv, u32 ch, u8 vf_no);
  923. int (*rx_dma_err)(struct tc956xmac_priv *priv, u8 vf_no);
  924. };
  925. #define tc956x_mbx_wrap_phy_link(__priv) \
  926. tc956xmac_do_void_no_param_callback(__priv, mbx_wrapper, phy_link)
  927. #define tc956x_mbx_wrap_set_dma_tx_mode(__priv, __args...) \
  928. tc956xmac_do_callback(__priv, mbx_wrapper, set_dma_tx_mode, __args)
  929. #define tc956x_mbx_wrap_set_mtl_tx_queue_weight(__priv, __args...) \
  930. tc956xmac_do_callback(__priv, mbx_wrapper, set_mtl_tx_queue_weight, __args)
  931. #define tc956x_mbx_wrap_config_cbs(__priv, __args...) \
  932. tc956xmac_do_callback(__priv, mbx_wrapper, config_cbs, __args)
  933. #define tc956x_mbx_wrap_setup_cbs(__priv, __args...) \
  934. tc956xmac_do_callback(__priv, mbx_wrapper, setup_cbs, __args)
  935. #define tc956x_mbx_wrap_setup_etf(__priv, __args...) \
  936. tc956xmac_do_callback(__priv, mbx_wrapper, setup_mbx_etf, __args)
  937. #define tc956x_mbx_wrap_tx_queue_prior(__priv, __args...) \
  938. tc956xmac_do_callback(__priv, mbx_wrapper, tx_queue_prio, __args)
  939. #define tc956x_mbx_wrap_get_link_status(__priv, __args...) \
  940. tc956xmac_do_callback(__priv, mbx_wrapper, vf_get_link_status, __args)
  941. #define tc956x_mbx_wrap_set_rx_crc(__priv, __args...) \
  942. tc956xmac_do_void_no_param_callback(__priv, mbx_wrapper, rx_crc)
  943. #define tc956x_mbx_wrap_set_rx_csum(__priv, __args...) \
  944. tc956xmac_do_void_no_param_callback(__priv, mbx_wrapper, rx_csum)
  945. #define tc956x_mbx_wrap_pf_flr(__priv, __args...) \
  946. tc956xmac_do_void_no_param_callback(__priv, mbx_wrapper, pf_flr)
  947. #define tc956x_mbx_wrap_rx_dma_ch_tlptr(__priv, __args...) \
  948. tc956xmac_do_callback(__priv, mbx_wrapper, rx_dma_ch_tlptr, __args)
  949. #define tc956x_mbx_wrap_rx_dma_err(__priv, __args...) \
  950. tc956xmac_do_callback(__priv, mbx_wrapper, rx_dma_err, __args)
  951. #define tc956x_mbx_wrap_reset_eee_mode(__priv, __args...) \
  952. tc956xmac_do_callback(__priv, mbx_wrapper, reset_eee_mode, __args)
  953. #define tc956x_mbx_wrap_get_umac_addr(__priv, __args...) \
  954. tc956xmac_do_callback(__priv, mbx_wrapper, get_umac_addr, __args)
  955. #define tc956x_mbx_wrap_set_umac_addr(__priv, __args...) \
  956. tc956xmac_do_callback(__priv, mbx_wrapper, set_umac_addr, __args)
  957. #define tc956x_mbx_wrap_get_drv_cap(__priv, __args...) \
  958. tc956xmac_do_callback(__priv, mbx_wrapper, get_drv_cap, __args)
  959. #define tc956x_mbx_wrap_vf_reset(__priv, __args...) \
  960. tc956xmac_do_callback(__priv, mbx_wrapper, vf_reset, __args)
  961. #define tc956xmac_mbx_ioctl_interface(__priv, __args...) \
  962. tc956xmac_do_callback(__priv, mbx_wrapper, vf_ioctl, __args)
  963. #define tc956xmac_mbx_ethtool_interface(__priv, __args...) \
  964. tc956xmac_do_callback(__priv, mbx_wrapper, vf_ethtool, __args)
  965. #define tc956xmac_mbx_add_mac(__priv, __args...) \
  966. tc956xmac_do_callback(__priv, mbx_wrapper, add_mac, __args)
  967. #define tc956xmac_mbx_delete_mac(__priv, __args...) \
  968. tc956xmac_do_callback(__priv, mbx_wrapper, delete_mac, __args)
  969. #define tc956xmac_mbx_add_vlan(__priv, __args...) \
  970. tc956xmac_do_callback(__priv, mbx_wrapper, add_vlan, __args)
  971. #define tc956xmac_mbx_delete_vlan(__priv, __args...) \
  972. tc956xmac_do_callback(__priv, mbx_wrapper, delete_vlan, __args)
  973. #endif /* TC956X_SRIOV_PF */
  974. #ifdef TC956X
  975. /*PMA module*/
  976. struct tc956xmac_pma_ops {
  977. int (*init)(struct tc956xmac_priv *priv, void __iomem *pmaaddr);
  978. };
  979. #define tc956x_pma_setup(__priv, __args...) \
  980. tc956xmac_do_callback(__priv, pma, init, __args)
  981. #endif
  982. struct tc956xmac_regs_off {
  983. u32 ptp_off;
  984. u32 mmc_off;
  985. #ifdef TC956X
  986. u32 xpcs_off;
  987. u32 pma_off;
  988. #endif
  989. };
  990. #ifdef TC956X_SRIOV_VF
  991. struct tc956x_msi_ops {
  992. void (*init)(struct tc956xmac_priv *priv, struct net_device *dev, struct fn_id *fn_id_info);
  993. void (*interrupt_en)(struct tc956xmac_priv *priv, struct net_device *dev, u32 en, struct fn_id *fn_id_info);
  994. void (*interrupt_clr)(struct tc956xmac_priv *priv, struct net_device *dev, u32 vector, struct fn_id *fn_id_info);
  995. };
  996. #define tc956x_msi_init(__priv, __args...) \
  997. tc956xmac_do_void_callback(__priv, msi, init, __args)
  998. #define tc956x_msi_intr_en(__priv, __args...) \
  999. tc956xmac_do_void_callback(__priv, msi, interrupt_en, __args)
  1000. #define tc956x_msi_intr_clr(__priv, __args...) \
  1001. tc956xmac_do_void_callback(__priv, msi, interrupt_clr, __args)
  1002. #endif
  1003. extern const struct tc956xmac_ops dwmac100_ops;
  1004. extern const struct tc956xmac_dma_ops dwmac100_dma_ops;
  1005. extern const struct tc956xmac_ops dwmac1000_ops;
  1006. extern const struct tc956xmac_dma_ops dwmac1000_dma_ops;
  1007. extern const struct tc956xmac_ops dwmac4_ops;
  1008. extern const struct tc956xmac_dma_ops dwmac4_dma_ops;
  1009. extern const struct tc956xmac_ops dwmac410_ops;
  1010. extern const struct tc956xmac_dma_ops dwmac410_dma_ops;
  1011. extern const struct tc956xmac_ops dwmac510_ops;
  1012. extern const struct tc956xmac_tc_ops dwmac510_tc_ops;
  1013. extern const struct tc956xmac_ops dwxgmac210_ops;
  1014. extern const struct tc956xmac_dma_ops dwxgmac210_dma_ops;
  1015. extern const struct tc956xmac_desc_ops dwxgmac210_desc_ops;
  1016. extern const struct tc956xmac_mmc_ops dwmac_mmc_ops;
  1017. extern const struct tc956xmac_mmc_ops dwxgmac_mmc_ops;
  1018. #ifdef TC956X
  1019. extern const struct tc956xmac_pma_ops tc956x_pma_ops;
  1020. #endif
  1021. #if defined(TC956X_SRIOV_PF) | defined(TC956X_SRIOV_VF)
  1022. extern const struct tc956x_msi_ops tc956x_msigen_ops;
  1023. extern const struct mac_rsc_mng_ops tc956xmac_rsc_mng_ops;
  1024. extern const struct mac_mbx_ops tc956xmac_mbx_ops;
  1025. #endif
  1026. #ifdef TC956X_SRIOV_PF
  1027. extern const struct tc956x_mbx_wrapper_ops tc956xmac_mbx_wrapper_ops;
  1028. #elif defined TC956X_SRIOV_VF
  1029. extern const struct tc956xmac_mbx_wrapper_ops tc956xmac_mbx_wrapper_ops;
  1030. #endif
  1031. #define GMAC_VERSION (MAC_OFFSET + 0x00000020) /* GMAC CORE Version */
  1032. #define GMAC4_VERSION (MAC_OFFSET + 0x00000110) /* GMAC4+ CORE Version */
  1033. int tc956xmac_hwif_init(struct tc956xmac_priv *priv);
  1034. #endif /* __TC956XMAC_HWIF_H__ */