b53_priv.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. /*
  2. * B53 common definitions
  3. *
  4. * Copyright (C) 2011-2013 Jonas Gorski <jogo@openwrt.org>
  5. *
  6. * Permission to use, copy, modify, and/or distribute this software for any
  7. * purpose with or without fee is hereby granted, provided that the above
  8. * copyright notice and this permission notice appear in all copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #ifndef __B53_PRIV_H
  19. #define __B53_PRIV_H
  20. #include <linux/kernel.h>
  21. #include <linux/mutex.h>
  22. #include <linux/phylink.h>
  23. #include <linux/etherdevice.h>
  24. #include <net/dsa.h>
  25. #include "b53_regs.h"
  26. struct b53_device;
  27. struct net_device;
  28. struct b53_io_ops {
  29. int (*read8)(struct b53_device *dev, u8 page, u8 reg, u8 *value);
  30. int (*read16)(struct b53_device *dev, u8 page, u8 reg, u16 *value);
  31. int (*read32)(struct b53_device *dev, u8 page, u8 reg, u32 *value);
  32. int (*read48)(struct b53_device *dev, u8 page, u8 reg, u64 *value);
  33. int (*read64)(struct b53_device *dev, u8 page, u8 reg, u64 *value);
  34. int (*write8)(struct b53_device *dev, u8 page, u8 reg, u8 value);
  35. int (*write16)(struct b53_device *dev, u8 page, u8 reg, u16 value);
  36. int (*write32)(struct b53_device *dev, u8 page, u8 reg, u32 value);
  37. int (*write48)(struct b53_device *dev, u8 page, u8 reg, u64 value);
  38. int (*write64)(struct b53_device *dev, u8 page, u8 reg, u64 value);
  39. int (*phy_read16)(struct b53_device *dev, int addr, int reg, u16 *value);
  40. int (*phy_write16)(struct b53_device *dev, int addr, int reg, u16 value);
  41. int (*irq_enable)(struct b53_device *dev, int port);
  42. void (*irq_disable)(struct b53_device *dev, int port);
  43. void (*phy_enable)(struct b53_device *dev, int port);
  44. void (*phy_disable)(struct b53_device *dev, int port);
  45. void (*phylink_get_caps)(struct b53_device *dev, int port,
  46. struct phylink_config *config);
  47. struct phylink_pcs *(*phylink_mac_select_pcs)(struct b53_device *dev,
  48. int port,
  49. phy_interface_t interface);
  50. u8 (*serdes_map_lane)(struct b53_device *dev, int port);
  51. void (*serdes_link_set)(struct b53_device *dev, int port,
  52. unsigned int mode, phy_interface_t interface,
  53. bool link_up);
  54. };
  55. struct b53_arl_entry;
  56. struct b53_arl_ops {
  57. void (*arl_read_entry)(struct b53_device *dev,
  58. struct b53_arl_entry *ent, u8 idx);
  59. void (*arl_write_entry)(struct b53_device *dev,
  60. const struct b53_arl_entry *ent, u8 idx);
  61. void (*arl_search_read)(struct b53_device *dev, u8 idx,
  62. struct b53_arl_entry *ent);
  63. };
  64. #define B53_INVALID_LANE 0xff
  65. enum {
  66. BCM4908_DEVICE_ID = 0x4908,
  67. BCM5325_DEVICE_ID = 0x25,
  68. BCM5365_DEVICE_ID = 0x65,
  69. BCM5389_DEVICE_ID = 0x89,
  70. BCM5395_DEVICE_ID = 0x95,
  71. BCM5397_DEVICE_ID = 0x97,
  72. BCM5398_DEVICE_ID = 0x98,
  73. BCM53101_DEVICE_ID = 0x53101,
  74. BCM53115_DEVICE_ID = 0x53115,
  75. BCM53125_DEVICE_ID = 0x53125,
  76. BCM53128_DEVICE_ID = 0x53128,
  77. BCM63XX_DEVICE_ID = 0x6300,
  78. BCM6318_DEVICE_ID = 0x6318,
  79. BCM6328_DEVICE_ID = 0x6328,
  80. BCM6362_DEVICE_ID = 0x6362,
  81. BCM6368_DEVICE_ID = 0x6368,
  82. BCM63268_DEVICE_ID = 0x63268,
  83. BCM53010_DEVICE_ID = 0x53010,
  84. BCM53011_DEVICE_ID = 0x53011,
  85. BCM53012_DEVICE_ID = 0x53012,
  86. BCM53018_DEVICE_ID = 0x53018,
  87. BCM53019_DEVICE_ID = 0x53019,
  88. BCM58XX_DEVICE_ID = 0x5800,
  89. BCM583XX_DEVICE_ID = 0x58300,
  90. BCM7445_DEVICE_ID = 0x7445,
  91. BCM7278_DEVICE_ID = 0x7278,
  92. BCM53134_DEVICE_ID = 0x5075,
  93. };
  94. enum b53_variant_id {
  95. B53_VARIANT_NONE = 0,
  96. B53_VARIANT_5325E,
  97. B53_VARIANT_5325M,
  98. };
  99. struct b53_pcs {
  100. struct phylink_pcs pcs;
  101. struct b53_device *dev;
  102. u8 lane;
  103. };
  104. #define B53_N_PORTS 9
  105. #define B53_N_PORTS_25 6
  106. #define B53_N_PCS 2
  107. struct b53_port {
  108. u16 vlan_ctl_mask;
  109. u16 pvid;
  110. struct ethtool_keee eee;
  111. };
  112. struct b53_vlan {
  113. u16 members;
  114. u16 untag;
  115. bool valid;
  116. };
  117. struct b53_device {
  118. struct dsa_switch *ds;
  119. struct b53_platform_data *pdata;
  120. const char *name;
  121. struct mutex reg_mutex;
  122. struct mutex stats_mutex;
  123. struct mutex arl_mutex;
  124. const struct b53_io_ops *ops;
  125. const struct b53_arl_ops *arl_ops;
  126. /* chip specific data */
  127. u32 chip_id;
  128. enum b53_variant_id variant_id;
  129. u8 core_rev;
  130. u8 vta_regs[3];
  131. u8 duplex_reg;
  132. u8 jumbo_pm_reg;
  133. u8 jumbo_size_reg;
  134. int reset_gpio;
  135. u8 num_arl_bins;
  136. u16 num_arl_buckets;
  137. enum dsa_tag_protocol tag_protocol;
  138. /* used ports mask */
  139. u16 enabled_ports;
  140. unsigned int imp_port;
  141. /* connect specific data */
  142. u8 current_page;
  143. struct device *dev;
  144. u8 serdes_lane;
  145. /* Master MDIO bus we got probed from */
  146. struct mii_bus *bus;
  147. void *priv;
  148. /* run time configuration */
  149. bool enable_jumbo;
  150. unsigned int num_vlans;
  151. struct b53_vlan *vlans;
  152. bool vlan_enabled;
  153. bool vlan_filtering;
  154. unsigned int num_ports;
  155. struct b53_port *ports;
  156. struct b53_pcs pcs[B53_N_PCS];
  157. };
  158. #define b53_for_each_port(dev, i) \
  159. for (i = 0; i < B53_N_PORTS; i++) \
  160. if (dev->enabled_ports & BIT(i))
  161. static inline int is5325(struct b53_device *dev)
  162. {
  163. return dev->chip_id == BCM5325_DEVICE_ID;
  164. }
  165. static inline int is5325e(struct b53_device *dev)
  166. {
  167. return is5325(dev) &&
  168. dev->variant_id == B53_VARIANT_5325E;
  169. }
  170. static inline int is5325m(struct b53_device *dev)
  171. {
  172. return is5325(dev) &&
  173. dev->variant_id == B53_VARIANT_5325M;
  174. }
  175. static inline int is5365(struct b53_device *dev)
  176. {
  177. #ifdef CONFIG_BCM47XX
  178. return dev->chip_id == BCM5365_DEVICE_ID;
  179. #else
  180. return 0;
  181. #endif
  182. }
  183. static inline int is5397_98(struct b53_device *dev)
  184. {
  185. return dev->chip_id == BCM5397_DEVICE_ID ||
  186. dev->chip_id == BCM5398_DEVICE_ID;
  187. }
  188. static inline int is539x(struct b53_device *dev)
  189. {
  190. return dev->chip_id == BCM5395_DEVICE_ID ||
  191. dev->chip_id == BCM5397_DEVICE_ID ||
  192. dev->chip_id == BCM5398_DEVICE_ID;
  193. }
  194. static inline int is531x5(struct b53_device *dev)
  195. {
  196. return dev->chip_id == BCM53115_DEVICE_ID ||
  197. dev->chip_id == BCM53125_DEVICE_ID ||
  198. dev->chip_id == BCM53101_DEVICE_ID ||
  199. dev->chip_id == BCM53128_DEVICE_ID ||
  200. dev->chip_id == BCM53134_DEVICE_ID;
  201. }
  202. static inline int is63xx(struct b53_device *dev)
  203. {
  204. return dev->chip_id == BCM63XX_DEVICE_ID ||
  205. dev->chip_id == BCM6318_DEVICE_ID ||
  206. dev->chip_id == BCM6328_DEVICE_ID ||
  207. dev->chip_id == BCM6362_DEVICE_ID ||
  208. dev->chip_id == BCM6368_DEVICE_ID ||
  209. dev->chip_id == BCM63268_DEVICE_ID;
  210. }
  211. static inline int is6318_268(struct b53_device *dev)
  212. {
  213. return dev->chip_id == BCM6318_DEVICE_ID ||
  214. dev->chip_id == BCM63268_DEVICE_ID;
  215. }
  216. static inline int is5301x(struct b53_device *dev)
  217. {
  218. return dev->chip_id == BCM53010_DEVICE_ID ||
  219. dev->chip_id == BCM53011_DEVICE_ID ||
  220. dev->chip_id == BCM53012_DEVICE_ID ||
  221. dev->chip_id == BCM53018_DEVICE_ID ||
  222. dev->chip_id == BCM53019_DEVICE_ID;
  223. }
  224. static inline int is58xx(struct b53_device *dev)
  225. {
  226. return dev->chip_id == BCM58XX_DEVICE_ID ||
  227. dev->chip_id == BCM583XX_DEVICE_ID ||
  228. dev->chip_id == BCM7445_DEVICE_ID ||
  229. dev->chip_id == BCM7278_DEVICE_ID ||
  230. dev->chip_id == BCM53134_DEVICE_ID;
  231. }
  232. #define B53_63XX_RGMII0 4
  233. #define B53_CPU_PORT_25 5
  234. #define B53_CPU_PORT 8
  235. static inline unsigned int b53_max_arl_entries(struct b53_device *dev)
  236. {
  237. return dev->num_arl_buckets * dev->num_arl_bins;
  238. }
  239. struct b53_device *b53_switch_alloc(struct device *base,
  240. const struct b53_io_ops *ops,
  241. void *priv);
  242. int b53_switch_detect(struct b53_device *dev);
  243. int b53_switch_register(struct b53_device *dev);
  244. static inline void b53_switch_remove(struct b53_device *dev)
  245. {
  246. dsa_unregister_switch(dev->ds);
  247. }
  248. static inline void b53_switch_shutdown(struct b53_device *dev)
  249. {
  250. dsa_switch_shutdown(dev->ds);
  251. }
  252. #define b53_build_op(type_op_size, val_type) \
  253. static inline int b53_##type_op_size(struct b53_device *dev, u8 page, \
  254. u8 reg, val_type val) \
  255. { \
  256. int ret; \
  257. \
  258. mutex_lock(&dev->reg_mutex); \
  259. ret = dev->ops->type_op_size(dev, page, reg, val); \
  260. mutex_unlock(&dev->reg_mutex); \
  261. \
  262. return ret; \
  263. }
  264. b53_build_op(read8, u8 *);
  265. b53_build_op(read16, u16 *);
  266. b53_build_op(read32, u32 *);
  267. b53_build_op(read48, u64 *);
  268. b53_build_op(read64, u64 *);
  269. b53_build_op(write8, u8);
  270. b53_build_op(write16, u16);
  271. b53_build_op(write32, u32);
  272. b53_build_op(write48, u64);
  273. b53_build_op(write64, u64);
  274. struct b53_arl_entry {
  275. u16 port;
  276. u8 mac[ETH_ALEN];
  277. u16 vid;
  278. u8 is_valid:1;
  279. u8 is_age:1;
  280. u8 is_static:1;
  281. };
  282. static inline void b53_arl_to_entry(struct b53_arl_entry *ent,
  283. u64 mac_vid, u32 fwd_entry)
  284. {
  285. memset(ent, 0, sizeof(*ent));
  286. ent->port = fwd_entry & ARLTBL_DATA_PORT_ID_MASK;
  287. ent->is_valid = !!(fwd_entry & ARLTBL_VALID);
  288. ent->is_age = !!(fwd_entry & ARLTBL_AGE);
  289. ent->is_static = !!(fwd_entry & ARLTBL_STATIC);
  290. u64_to_ether_addr(mac_vid, ent->mac);
  291. ent->vid = mac_vid >> ARLTBL_VID_S;
  292. }
  293. static inline void b53_arl_to_entry_25(struct b53_arl_entry *ent,
  294. u64 mac_vid, u8 vid_entry)
  295. {
  296. memset(ent, 0, sizeof(*ent));
  297. ent->is_valid = !!(mac_vid & ARLTBL_VALID_25);
  298. ent->is_age = !!(mac_vid & ARLTBL_AGE_25);
  299. ent->is_static = !!(mac_vid & ARLTBL_STATIC_25);
  300. u64_to_ether_addr(mac_vid, ent->mac);
  301. ent->port = (mac_vid & ARLTBL_DATA_PORT_ID_MASK_25) >>
  302. ARLTBL_DATA_PORT_ID_S_25;
  303. if (is_unicast_ether_addr(ent->mac) && ent->port == B53_CPU_PORT)
  304. ent->port = B53_CPU_PORT_25;
  305. ent->vid = vid_entry;
  306. }
  307. static inline void b53_arl_to_entry_89(struct b53_arl_entry *ent,
  308. u64 mac_vid, u16 fwd_entry)
  309. {
  310. memset(ent, 0, sizeof(*ent));
  311. ent->port = fwd_entry & ARLTBL_DATA_PORT_ID_MASK_89;
  312. ent->is_valid = !!(fwd_entry & ARLTBL_VALID_89);
  313. ent->is_age = !!(fwd_entry & ARLTBL_AGE_89);
  314. ent->is_static = !!(fwd_entry & ARLTBL_STATIC_89);
  315. u64_to_ether_addr(mac_vid, ent->mac);
  316. ent->vid = mac_vid >> ARLTBL_VID_S;
  317. }
  318. static inline void b53_arl_from_entry(u64 *mac_vid, u32 *fwd_entry,
  319. const struct b53_arl_entry *ent)
  320. {
  321. *mac_vid = ether_addr_to_u64(ent->mac);
  322. *mac_vid |= (u64)(ent->vid & ARLTBL_VID_MASK) << ARLTBL_VID_S;
  323. *fwd_entry = ent->port & ARLTBL_DATA_PORT_ID_MASK;
  324. if (ent->is_valid)
  325. *fwd_entry |= ARLTBL_VALID;
  326. if (ent->is_static)
  327. *fwd_entry |= ARLTBL_STATIC;
  328. if (ent->is_age)
  329. *fwd_entry |= ARLTBL_AGE;
  330. }
  331. static inline void b53_arl_from_entry_25(u64 *mac_vid, u8 *vid_entry,
  332. const struct b53_arl_entry *ent)
  333. {
  334. *mac_vid = ether_addr_to_u64(ent->mac);
  335. if (is_unicast_ether_addr(ent->mac) && ent->port == B53_CPU_PORT_25)
  336. *mac_vid |= (u64)B53_CPU_PORT << ARLTBL_DATA_PORT_ID_S_25;
  337. else
  338. *mac_vid |= ((u64)ent->port << ARLTBL_DATA_PORT_ID_S_25) &
  339. ARLTBL_DATA_PORT_ID_MASK_25;
  340. if (ent->is_valid)
  341. *mac_vid |= ARLTBL_VALID_25;
  342. if (ent->is_static)
  343. *mac_vid |= ARLTBL_STATIC_25;
  344. if (ent->is_age)
  345. *mac_vid |= ARLTBL_AGE_25;
  346. *vid_entry = ent->vid;
  347. }
  348. static inline void b53_arl_from_entry_89(u64 *mac_vid, u32 *fwd_entry,
  349. const struct b53_arl_entry *ent)
  350. {
  351. *mac_vid = ether_addr_to_u64(ent->mac);
  352. *mac_vid |= (u64)(ent->vid & ARLTBL_VID_MASK) << ARLTBL_VID_S;
  353. *fwd_entry = ent->port & ARLTBL_DATA_PORT_ID_MASK_89;
  354. if (ent->is_valid)
  355. *fwd_entry |= ARLTBL_VALID_89;
  356. if (ent->is_static)
  357. *fwd_entry |= ARLTBL_STATIC_89;
  358. if (ent->is_age)
  359. *fwd_entry |= ARLTBL_AGE_89;
  360. }
  361. static inline void b53_arl_search_to_entry_25(struct b53_arl_entry *ent,
  362. u64 mac_vid, u8 ext)
  363. {
  364. memset(ent, 0, sizeof(*ent));
  365. ent->is_valid = !!(mac_vid & ARLTBL_VALID_25);
  366. ent->is_age = !!(mac_vid & ARLTBL_AGE_25);
  367. ent->is_static = !!(mac_vid & ARLTBL_STATIC_25);
  368. u64_to_ether_addr(mac_vid, ent->mac);
  369. ent->vid = (mac_vid & ARL_SRCH_RSLT_VID_MASK_25) >>
  370. ARL_SRCH_RSLT_VID_S_25;
  371. ent->port = (mac_vid & ARL_SRCH_RSLT_PORT_ID_MASK_25) >>
  372. ARL_SRCH_RSLT_PORT_ID_S_25;
  373. if (is_multicast_ether_addr(ent->mac) && (ext & ARL_SRCH_RSLT_EXT_MC_MII))
  374. ent->port |= BIT(B53_CPU_PORT_25);
  375. else if (!is_multicast_ether_addr(ent->mac) && ent->port == B53_CPU_PORT)
  376. ent->port = B53_CPU_PORT_25;
  377. }
  378. static inline void b53_arl_search_to_entry_63xx(struct b53_arl_entry *ent,
  379. u64 mac_vid, u16 fwd_entry)
  380. {
  381. memset(ent, 0, sizeof(*ent));
  382. u64_to_ether_addr(mac_vid, ent->mac);
  383. ent->vid = mac_vid >> ARLTBL_VID_S;
  384. ent->port = fwd_entry & ARL_SRST_PORT_ID_MASK_63XX;
  385. ent->port >>= 1;
  386. ent->is_age = !!(fwd_entry & ARL_SRST_AGE_63XX);
  387. ent->is_static = !!(fwd_entry & ARL_SRST_STATIC_63XX);
  388. ent->is_valid = 1;
  389. }
  390. static inline void b53_arl_read_entry(struct b53_device *dev,
  391. struct b53_arl_entry *ent, u8 idx)
  392. {
  393. dev->arl_ops->arl_read_entry(dev, ent, idx);
  394. }
  395. static inline void b53_arl_write_entry(struct b53_device *dev,
  396. const struct b53_arl_entry *ent, u8 idx)
  397. {
  398. dev->arl_ops->arl_write_entry(dev, ent, idx);
  399. }
  400. static inline void b53_arl_search_read(struct b53_device *dev, u8 idx,
  401. struct b53_arl_entry *ent)
  402. {
  403. dev->arl_ops->arl_search_read(dev, idx, ent);
  404. }
  405. #ifdef CONFIG_BCM47XX
  406. #include <linux/bcm47xx_nvram.h>
  407. #include <bcm47xx_board.h>
  408. static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
  409. {
  410. enum bcm47xx_board board = bcm47xx_board_get();
  411. switch (board) {
  412. case BCM47XX_BOARD_LINKSYS_WRT300NV11:
  413. case BCM47XX_BOARD_LINKSYS_WRT310NV1:
  414. return 8;
  415. default:
  416. return bcm47xx_nvram_gpio_pin("robo_reset");
  417. }
  418. }
  419. #else
  420. static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
  421. {
  422. return -ENOENT;
  423. }
  424. #endif
  425. /* Exported functions towards other drivers */
  426. void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port);
  427. int b53_configure_vlan(struct dsa_switch *ds);
  428. void b53_get_strings(struct dsa_switch *ds, int port, u32 stringset,
  429. uint8_t *data);
  430. void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
  431. int b53_get_sset_count(struct dsa_switch *ds, int port, int sset);
  432. void b53_get_ethtool_phy_stats(struct dsa_switch *ds, int port, uint64_t *data);
  433. int b53_set_ageing_time(struct dsa_switch *ds, unsigned int msecs);
  434. int b53_br_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge,
  435. bool *tx_fwd_offload, struct netlink_ext_ack *extack);
  436. void b53_br_leave(struct dsa_switch *ds, int port, struct dsa_bridge bridge);
  437. void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state);
  438. void b53_br_fast_age(struct dsa_switch *ds, int port);
  439. int b53_br_flags_pre(struct dsa_switch *ds, int port,
  440. struct switchdev_brport_flags flags,
  441. struct netlink_ext_ack *extack);
  442. int b53_br_flags(struct dsa_switch *ds, int port,
  443. struct switchdev_brport_flags flags,
  444. struct netlink_ext_ack *extack);
  445. int b53_setup_devlink_resources(struct dsa_switch *ds);
  446. void b53_port_event(struct dsa_switch *ds, int port);
  447. int b53_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering,
  448. struct netlink_ext_ack *extack);
  449. int b53_vlan_add(struct dsa_switch *ds, int port,
  450. const struct switchdev_obj_port_vlan *vlan,
  451. struct netlink_ext_ack *extack);
  452. int b53_vlan_del(struct dsa_switch *ds, int port,
  453. const struct switchdev_obj_port_vlan *vlan);
  454. int b53_fdb_add(struct dsa_switch *ds, int port,
  455. const unsigned char *addr, u16 vid,
  456. struct dsa_db db);
  457. int b53_fdb_del(struct dsa_switch *ds, int port,
  458. const unsigned char *addr, u16 vid,
  459. struct dsa_db db);
  460. int b53_fdb_dump(struct dsa_switch *ds, int port,
  461. dsa_fdb_dump_cb_t *cb, void *data);
  462. int b53_mdb_add(struct dsa_switch *ds, int port,
  463. const struct switchdev_obj_port_mdb *mdb,
  464. struct dsa_db db);
  465. int b53_mdb_del(struct dsa_switch *ds, int port,
  466. const struct switchdev_obj_port_mdb *mdb,
  467. struct dsa_db db);
  468. int b53_mirror_add(struct dsa_switch *ds, int port,
  469. struct dsa_mall_mirror_tc_entry *mirror, bool ingress,
  470. struct netlink_ext_ack *extack);
  471. enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
  472. enum dsa_tag_protocol mprot);
  473. void b53_mirror_del(struct dsa_switch *ds, int port,
  474. struct dsa_mall_mirror_tc_entry *mirror);
  475. int b53_setup_port(struct dsa_switch *ds, int port);
  476. int b53_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
  477. void b53_disable_port(struct dsa_switch *ds, int port);
  478. void b53_brcm_hdr_setup(struct dsa_switch *ds, int port);
  479. int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy);
  480. bool b53_support_eee(struct dsa_switch *ds, int port);
  481. int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e);
  482. #endif