chip.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. /*
  2. * Marvell 88E6xxx Ethernet switch single-chip definition
  3. *
  4. * Copyright (c) 2008 Marvell Semiconductor
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #ifndef _MV88E6XXX_CHIP_H
  12. #define _MV88E6XXX_CHIP_H
  13. #include <linux/if_vlan.h>
  14. #include <linux/irq.h>
  15. #include <linux/gpio/consumer.h>
  16. #include <linux/kthread.h>
  17. #include <linux/phy.h>
  18. #include <linux/ptp_clock_kernel.h>
  19. #include <linux/timecounter.h>
  20. #include <net/dsa.h>
  21. #define SMI_CMD 0x00
  22. #define SMI_CMD_BUSY BIT(15)
  23. #define SMI_CMD_CLAUSE_22 BIT(12)
  24. #define SMI_CMD_OP_22_WRITE ((1 << 10) | SMI_CMD_BUSY | SMI_CMD_CLAUSE_22)
  25. #define SMI_CMD_OP_22_READ ((2 << 10) | SMI_CMD_BUSY | SMI_CMD_CLAUSE_22)
  26. #define SMI_CMD_OP_45_WRITE_ADDR ((0 << 10) | SMI_CMD_BUSY)
  27. #define SMI_CMD_OP_45_WRITE_DATA ((1 << 10) | SMI_CMD_BUSY)
  28. #define SMI_CMD_OP_45_READ_DATA ((2 << 10) | SMI_CMD_BUSY)
  29. #define SMI_CMD_OP_45_READ_DATA_INC ((3 << 10) | SMI_CMD_BUSY)
  30. #define SMI_DATA 0x01
  31. #define MV88E6XXX_N_FID 4096
  32. /* PVT limits for 4-bit port and 5-bit switch */
  33. #define MV88E6XXX_MAX_PVT_SWITCHES 32
  34. #define MV88E6XXX_MAX_PVT_PORTS 16
  35. #define MV88E6XXX_MAX_GPIO 16
  36. enum mv88e6xxx_egress_mode {
  37. MV88E6XXX_EGRESS_MODE_UNMODIFIED,
  38. MV88E6XXX_EGRESS_MODE_UNTAGGED,
  39. MV88E6XXX_EGRESS_MODE_TAGGED,
  40. MV88E6XXX_EGRESS_MODE_ETHERTYPE,
  41. };
  42. enum mv88e6xxx_frame_mode {
  43. MV88E6XXX_FRAME_MODE_NORMAL,
  44. MV88E6XXX_FRAME_MODE_DSA,
  45. MV88E6XXX_FRAME_MODE_PROVIDER,
  46. MV88E6XXX_FRAME_MODE_ETHERTYPE,
  47. };
  48. /* List of supported models */
  49. enum mv88e6xxx_model {
  50. MV88E6085,
  51. MV88E6095,
  52. MV88E6097,
  53. MV88E6123,
  54. MV88E6131,
  55. MV88E6141,
  56. MV88E6161,
  57. MV88E6165,
  58. MV88E6171,
  59. MV88E6172,
  60. MV88E6175,
  61. MV88E6176,
  62. MV88E6185,
  63. MV88E6190,
  64. MV88E6190X,
  65. MV88E6191,
  66. MV88E6240,
  67. MV88E6290,
  68. MV88E6320,
  69. MV88E6321,
  70. MV88E6341,
  71. MV88E6350,
  72. MV88E6351,
  73. MV88E6352,
  74. MV88E6390,
  75. MV88E6390X,
  76. };
  77. enum mv88e6xxx_family {
  78. MV88E6XXX_FAMILY_NONE,
  79. MV88E6XXX_FAMILY_6065, /* 6031 6035 6061 6065 */
  80. MV88E6XXX_FAMILY_6095, /* 6092 6095 */
  81. MV88E6XXX_FAMILY_6097, /* 6046 6085 6096 6097 */
  82. MV88E6XXX_FAMILY_6165, /* 6123 6161 6165 */
  83. MV88E6XXX_FAMILY_6185, /* 6108 6121 6122 6131 6152 6155 6182 6185 */
  84. MV88E6XXX_FAMILY_6320, /* 6320 6321 */
  85. MV88E6XXX_FAMILY_6341, /* 6141 6341 */
  86. MV88E6XXX_FAMILY_6351, /* 6171 6175 6350 6351 */
  87. MV88E6XXX_FAMILY_6352, /* 6172 6176 6240 6352 */
  88. MV88E6XXX_FAMILY_6390, /* 6190 6190X 6191 6290 6390 6390X */
  89. };
  90. struct mv88e6xxx_ops;
  91. struct mv88e6xxx_info {
  92. enum mv88e6xxx_family family;
  93. u16 prod_num;
  94. const char *name;
  95. unsigned int num_databases;
  96. unsigned int num_ports;
  97. unsigned int num_internal_phys;
  98. unsigned int num_gpio;
  99. unsigned int max_vid;
  100. unsigned int port_base_addr;
  101. unsigned int phy_base_addr;
  102. unsigned int global1_addr;
  103. unsigned int global2_addr;
  104. unsigned int age_time_coeff;
  105. unsigned int g1_irqs;
  106. unsigned int g2_irqs;
  107. bool pvt;
  108. /* Multi-chip Addressing Mode.
  109. * Some chips respond to only 2 registers of its own SMI device address
  110. * when it is non-zero, and use indirect access to internal registers.
  111. */
  112. bool multi_chip;
  113. enum dsa_tag_protocol tag_protocol;
  114. /* Mask for FromPort and ToPort value of PortVec used in ATU Move
  115. * operation. 0 means that the ATU Move operation is not supported.
  116. */
  117. u8 atu_move_port_mask;
  118. const struct mv88e6xxx_ops *ops;
  119. /* Supports PTP */
  120. bool ptp_support;
  121. };
  122. struct mv88e6xxx_atu_entry {
  123. u8 state;
  124. bool trunk;
  125. u16 portvec;
  126. u8 mac[ETH_ALEN];
  127. };
  128. struct mv88e6xxx_vtu_entry {
  129. u16 vid;
  130. u16 fid;
  131. u8 sid;
  132. bool valid;
  133. u8 member[DSA_MAX_PORTS];
  134. u8 state[DSA_MAX_PORTS];
  135. };
  136. struct mv88e6xxx_bus_ops;
  137. struct mv88e6xxx_irq_ops;
  138. struct mv88e6xxx_gpio_ops;
  139. struct mv88e6xxx_avb_ops;
  140. struct mv88e6xxx_ptp_ops;
  141. struct mv88e6xxx_irq {
  142. u16 masked;
  143. struct irq_chip chip;
  144. struct irq_domain *domain;
  145. unsigned int nirqs;
  146. };
  147. /* state flags for mv88e6xxx_port_hwtstamp::state */
  148. enum {
  149. MV88E6XXX_HWTSTAMP_ENABLED,
  150. MV88E6XXX_HWTSTAMP_TX_IN_PROGRESS,
  151. };
  152. struct mv88e6xxx_port_hwtstamp {
  153. /* Port index */
  154. int port_id;
  155. /* Timestamping state */
  156. unsigned long state;
  157. /* Resources for receive timestamping */
  158. struct sk_buff_head rx_queue;
  159. struct sk_buff_head rx_queue2;
  160. /* Resources for transmit timestamping */
  161. unsigned long tx_tstamp_start;
  162. struct sk_buff *tx_skb;
  163. u16 tx_seq_id;
  164. /* Current timestamp configuration */
  165. struct hwtstamp_config tstamp_config;
  166. };
  167. struct mv88e6xxx_port {
  168. struct mv88e6xxx_chip *chip;
  169. int port;
  170. u64 serdes_stats[2];
  171. u64 atu_member_violation;
  172. u64 atu_miss_violation;
  173. u64 atu_full_violation;
  174. u64 vtu_member_violation;
  175. u64 vtu_miss_violation;
  176. u8 cmode;
  177. int serdes_irq;
  178. };
  179. struct mv88e6xxx_chip {
  180. const struct mv88e6xxx_info *info;
  181. /* The dsa_switch this private structure is related to */
  182. struct dsa_switch *ds;
  183. /* The device this structure is associated to */
  184. struct device *dev;
  185. /* This mutex protects the access to the switch registers */
  186. struct mutex reg_lock;
  187. /* The MII bus and the address on the bus that is used to
  188. * communication with the switch
  189. */
  190. const struct mv88e6xxx_bus_ops *smi_ops;
  191. struct mii_bus *bus;
  192. int sw_addr;
  193. /* Handles automatic disabling and re-enabling of the PHY
  194. * polling unit.
  195. */
  196. const struct mv88e6xxx_bus_ops *phy_ops;
  197. struct mutex ppu_mutex;
  198. int ppu_disabled;
  199. struct work_struct ppu_work;
  200. struct timer_list ppu_timer;
  201. /* This mutex serialises access to the statistics unit.
  202. * Hold this mutex over snapshot + dump sequences.
  203. */
  204. struct mutex stats_mutex;
  205. /* A switch may have a GPIO line tied to its reset pin. Parse
  206. * this from the device tree, and use it before performing
  207. * switch soft reset.
  208. */
  209. struct gpio_desc *reset;
  210. /* set to size of eeprom if supported by the switch */
  211. u32 eeprom_len;
  212. /* List of mdio busses */
  213. struct list_head mdios;
  214. /* There can be two interrupt controllers, which are chained
  215. * off a GPIO as interrupt source
  216. */
  217. struct mv88e6xxx_irq g1_irq;
  218. struct mv88e6xxx_irq g2_irq;
  219. int irq;
  220. int device_irq;
  221. int watchdog_irq;
  222. int atu_prob_irq;
  223. int vtu_prob_irq;
  224. struct kthread_worker *kworker;
  225. struct kthread_delayed_work irq_poll_work;
  226. /* GPIO resources */
  227. u8 gpio_data[2];
  228. /* This cyclecounter abstracts the switch PTP time.
  229. * reg_lock must be held for any operation that read()s.
  230. */
  231. struct cyclecounter tstamp_cc;
  232. struct timecounter tstamp_tc;
  233. struct delayed_work overflow_work;
  234. struct ptp_clock *ptp_clock;
  235. struct ptp_clock_info ptp_clock_info;
  236. struct delayed_work tai_event_work;
  237. struct ptp_pin_desc pin_config[MV88E6XXX_MAX_GPIO];
  238. u16 trig_config;
  239. u16 evcap_config;
  240. u16 enable_count;
  241. /* Per-port timestamping resources. */
  242. struct mv88e6xxx_port_hwtstamp port_hwtstamp[DSA_MAX_PORTS];
  243. /* Array of port structures. */
  244. struct mv88e6xxx_port ports[DSA_MAX_PORTS];
  245. };
  246. struct mv88e6xxx_bus_ops {
  247. int (*read)(struct mv88e6xxx_chip *chip, int addr, int reg, u16 *val);
  248. int (*write)(struct mv88e6xxx_chip *chip, int addr, int reg, u16 val);
  249. };
  250. struct mv88e6xxx_mdio_bus {
  251. struct mii_bus *bus;
  252. struct mv88e6xxx_chip *chip;
  253. struct list_head list;
  254. bool external;
  255. };
  256. struct mv88e6xxx_ops {
  257. int (*ieee_pri_map)(struct mv88e6xxx_chip *chip);
  258. int (*ip_pri_map)(struct mv88e6xxx_chip *chip);
  259. /* Ingress Rate Limit unit (IRL) operations */
  260. int (*irl_init_all)(struct mv88e6xxx_chip *chip, int port);
  261. int (*get_eeprom)(struct mv88e6xxx_chip *chip,
  262. struct ethtool_eeprom *eeprom, u8 *data);
  263. int (*set_eeprom)(struct mv88e6xxx_chip *chip,
  264. struct ethtool_eeprom *eeprom, u8 *data);
  265. int (*set_switch_mac)(struct mv88e6xxx_chip *chip, u8 *addr);
  266. int (*phy_read)(struct mv88e6xxx_chip *chip,
  267. struct mii_bus *bus,
  268. int addr, int reg, u16 *val);
  269. int (*phy_write)(struct mv88e6xxx_chip *chip,
  270. struct mii_bus *bus,
  271. int addr, int reg, u16 val);
  272. /* Priority Override Table operations */
  273. int (*pot_clear)(struct mv88e6xxx_chip *chip);
  274. /* PHY Polling Unit (PPU) operations */
  275. int (*ppu_enable)(struct mv88e6xxx_chip *chip);
  276. int (*ppu_disable)(struct mv88e6xxx_chip *chip);
  277. /* Switch Software Reset */
  278. int (*reset)(struct mv88e6xxx_chip *chip);
  279. /* RGMII Receive/Transmit Timing Control
  280. * Add delay on PHY_INTERFACE_MODE_RGMII_*ID, no delay otherwise.
  281. */
  282. int (*port_set_rgmii_delay)(struct mv88e6xxx_chip *chip, int port,
  283. phy_interface_t mode);
  284. #define LINK_FORCED_DOWN 0
  285. #define LINK_FORCED_UP 1
  286. #define LINK_UNFORCED -2
  287. /* Port's MAC link state
  288. * Use LINK_FORCED_UP or LINK_FORCED_DOWN to force link up or down,
  289. * or LINK_UNFORCED for normal link detection.
  290. */
  291. int (*port_set_link)(struct mv88e6xxx_chip *chip, int port, int link);
  292. #define DUPLEX_UNFORCED -2
  293. /* Port's MAC duplex mode
  294. *
  295. * Use DUPLEX_HALF or DUPLEX_FULL to force half or full duplex,
  296. * or DUPLEX_UNFORCED for normal duplex detection.
  297. */
  298. int (*port_set_duplex)(struct mv88e6xxx_chip *chip, int port, int dup);
  299. #define PAUSE_ON 1
  300. #define PAUSE_OFF 0
  301. /* Enable/disable sending Pause */
  302. int (*port_set_pause)(struct mv88e6xxx_chip *chip, int port,
  303. int pause);
  304. #define SPEED_MAX INT_MAX
  305. #define SPEED_UNFORCED -2
  306. /* Port's MAC speed (in Mbps)
  307. *
  308. * Depending on the chip, 10, 100, 200, 1000, 2500, 10000 are valid.
  309. * Use SPEED_UNFORCED for normal detection, SPEED_MAX for max value.
  310. */
  311. int (*port_set_speed)(struct mv88e6xxx_chip *chip, int port, int speed);
  312. int (*port_tag_remap)(struct mv88e6xxx_chip *chip, int port);
  313. int (*port_set_frame_mode)(struct mv88e6xxx_chip *chip, int port,
  314. enum mv88e6xxx_frame_mode mode);
  315. int (*port_set_egress_floods)(struct mv88e6xxx_chip *chip, int port,
  316. bool unicast, bool multicast);
  317. int (*port_set_ether_type)(struct mv88e6xxx_chip *chip, int port,
  318. u16 etype);
  319. int (*port_set_jumbo_size)(struct mv88e6xxx_chip *chip, int port,
  320. size_t size);
  321. int (*port_egress_rate_limiting)(struct mv88e6xxx_chip *chip, int port);
  322. int (*port_pause_limit)(struct mv88e6xxx_chip *chip, int port, u8 in,
  323. u8 out);
  324. int (*port_disable_learn_limit)(struct mv88e6xxx_chip *chip, int port);
  325. int (*port_disable_pri_override)(struct mv88e6xxx_chip *chip, int port);
  326. /* CMODE control what PHY mode the MAC will use, eg. SGMII, RGMII, etc.
  327. * Some chips allow this to be configured on specific ports.
  328. */
  329. int (*port_set_cmode)(struct mv88e6xxx_chip *chip, int port,
  330. phy_interface_t mode);
  331. int (*port_get_cmode)(struct mv88e6xxx_chip *chip, int port, u8 *cmode);
  332. /* Some devices have a per port register indicating what is
  333. * the upstream port this port should forward to.
  334. */
  335. int (*port_set_upstream_port)(struct mv88e6xxx_chip *chip, int port,
  336. int upstream_port);
  337. /* Return the port link state, as required by phylink */
  338. int (*port_link_state)(struct mv88e6xxx_chip *chip, int port,
  339. struct phylink_link_state *state);
  340. /* Snapshot the statistics for a port. The statistics can then
  341. * be read back a leisure but still with a consistent view.
  342. */
  343. int (*stats_snapshot)(struct mv88e6xxx_chip *chip, int port);
  344. /* Set the histogram mode for statistics, when the control registers
  345. * are separated out of the STATS_OP register.
  346. */
  347. int (*stats_set_histogram)(struct mv88e6xxx_chip *chip);
  348. /* Return the number of strings describing statistics */
  349. int (*stats_get_sset_count)(struct mv88e6xxx_chip *chip);
  350. int (*stats_get_strings)(struct mv88e6xxx_chip *chip, uint8_t *data);
  351. int (*stats_get_stats)(struct mv88e6xxx_chip *chip, int port,
  352. uint64_t *data);
  353. int (*set_cpu_port)(struct mv88e6xxx_chip *chip, int port);
  354. int (*set_egress_port)(struct mv88e6xxx_chip *chip, int port);
  355. #define MV88E6XXX_CASCADE_PORT_NONE 0xe
  356. #define MV88E6XXX_CASCADE_PORT_MULTIPLE 0xf
  357. int (*set_cascade_port)(struct mv88e6xxx_chip *chip, int port);
  358. const struct mv88e6xxx_irq_ops *watchdog_ops;
  359. int (*mgmt_rsvd2cpu)(struct mv88e6xxx_chip *chip);
  360. /* Power on/off a SERDES interface */
  361. int (*serdes_power)(struct mv88e6xxx_chip *chip, int port, bool on);
  362. /* SERDES interrupt handling */
  363. int (*serdes_irq_setup)(struct mv88e6xxx_chip *chip, int port);
  364. void (*serdes_irq_free)(struct mv88e6xxx_chip *chip, int port);
  365. /* Statistics from the SERDES interface */
  366. int (*serdes_get_sset_count)(struct mv88e6xxx_chip *chip, int port);
  367. int (*serdes_get_strings)(struct mv88e6xxx_chip *chip, int port,
  368. uint8_t *data);
  369. int (*serdes_get_stats)(struct mv88e6xxx_chip *chip, int port,
  370. uint64_t *data);
  371. /* VLAN Translation Unit operations */
  372. int (*vtu_getnext)(struct mv88e6xxx_chip *chip,
  373. struct mv88e6xxx_vtu_entry *entry);
  374. int (*vtu_loadpurge)(struct mv88e6xxx_chip *chip,
  375. struct mv88e6xxx_vtu_entry *entry);
  376. /* GPIO operations */
  377. const struct mv88e6xxx_gpio_ops *gpio_ops;
  378. /* Interface to the AVB/PTP registers */
  379. const struct mv88e6xxx_avb_ops *avb_ops;
  380. /* Remote Management Unit operations */
  381. int (*rmu_disable)(struct mv88e6xxx_chip *chip);
  382. /* Precision Time Protocol operations */
  383. const struct mv88e6xxx_ptp_ops *ptp_ops;
  384. /* Phylink */
  385. void (*phylink_validate)(struct mv88e6xxx_chip *chip, int port,
  386. unsigned long *mask,
  387. struct phylink_link_state *state);
  388. };
  389. struct mv88e6xxx_irq_ops {
  390. /* Action to be performed when the interrupt happens */
  391. int (*irq_action)(struct mv88e6xxx_chip *chip, int irq);
  392. /* Setup the hardware to generate the interrupt */
  393. int (*irq_setup)(struct mv88e6xxx_chip *chip);
  394. /* Reset the hardware to stop generating the interrupt */
  395. void (*irq_free)(struct mv88e6xxx_chip *chip);
  396. };
  397. struct mv88e6xxx_gpio_ops {
  398. /* Get/set data on GPIO pin */
  399. int (*get_data)(struct mv88e6xxx_chip *chip, unsigned int pin);
  400. int (*set_data)(struct mv88e6xxx_chip *chip, unsigned int pin,
  401. int value);
  402. /* get/set GPIO direction */
  403. int (*get_dir)(struct mv88e6xxx_chip *chip, unsigned int pin);
  404. int (*set_dir)(struct mv88e6xxx_chip *chip, unsigned int pin,
  405. bool input);
  406. /* get/set GPIO pin control */
  407. int (*get_pctl)(struct mv88e6xxx_chip *chip, unsigned int pin,
  408. int *func);
  409. int (*set_pctl)(struct mv88e6xxx_chip *chip, unsigned int pin,
  410. int func);
  411. };
  412. struct mv88e6xxx_avb_ops {
  413. /* Access port-scoped Precision Time Protocol registers */
  414. int (*port_ptp_read)(struct mv88e6xxx_chip *chip, int port, int addr,
  415. u16 *data, int len);
  416. int (*port_ptp_write)(struct mv88e6xxx_chip *chip, int port, int addr,
  417. u16 data);
  418. /* Access global Precision Time Protocol registers */
  419. int (*ptp_read)(struct mv88e6xxx_chip *chip, int addr, u16 *data,
  420. int len);
  421. int (*ptp_write)(struct mv88e6xxx_chip *chip, int addr, u16 data);
  422. /* Access global Time Application Interface registers */
  423. int (*tai_read)(struct mv88e6xxx_chip *chip, int addr, u16 *data,
  424. int len);
  425. int (*tai_write)(struct mv88e6xxx_chip *chip, int addr, u16 data);
  426. };
  427. struct mv88e6xxx_ptp_ops {
  428. u64 (*clock_read)(const struct cyclecounter *cc);
  429. int (*ptp_enable)(struct ptp_clock_info *ptp,
  430. struct ptp_clock_request *rq, int on);
  431. int (*ptp_verify)(struct ptp_clock_info *ptp, unsigned int pin,
  432. enum ptp_pin_function func, unsigned int chan);
  433. void (*event_work)(struct work_struct *ugly);
  434. int (*port_enable)(struct mv88e6xxx_chip *chip, int port);
  435. int (*port_disable)(struct mv88e6xxx_chip *chip, int port);
  436. int (*global_enable)(struct mv88e6xxx_chip *chip);
  437. int (*global_disable)(struct mv88e6xxx_chip *chip);
  438. int n_ext_ts;
  439. int arr0_sts_reg;
  440. int arr1_sts_reg;
  441. int dep_sts_reg;
  442. u32 rx_filters;
  443. };
  444. #define STATS_TYPE_PORT BIT(0)
  445. #define STATS_TYPE_BANK0 BIT(1)
  446. #define STATS_TYPE_BANK1 BIT(2)
  447. struct mv88e6xxx_hw_stat {
  448. char string[ETH_GSTRING_LEN];
  449. size_t size;
  450. int reg;
  451. int type;
  452. };
  453. static inline bool mv88e6xxx_has_pvt(struct mv88e6xxx_chip *chip)
  454. {
  455. return chip->info->pvt;
  456. }
  457. static inline unsigned int mv88e6xxx_num_databases(struct mv88e6xxx_chip *chip)
  458. {
  459. return chip->info->num_databases;
  460. }
  461. static inline unsigned int mv88e6xxx_num_ports(struct mv88e6xxx_chip *chip)
  462. {
  463. return chip->info->num_ports;
  464. }
  465. static inline u16 mv88e6xxx_port_mask(struct mv88e6xxx_chip *chip)
  466. {
  467. return GENMASK(mv88e6xxx_num_ports(chip) - 1, 0);
  468. }
  469. static inline unsigned int mv88e6xxx_num_gpio(struct mv88e6xxx_chip *chip)
  470. {
  471. return chip->info->num_gpio;
  472. }
  473. int mv88e6xxx_read(struct mv88e6xxx_chip *chip, int addr, int reg, u16 *val);
  474. int mv88e6xxx_write(struct mv88e6xxx_chip *chip, int addr, int reg, u16 val);
  475. int mv88e6xxx_update(struct mv88e6xxx_chip *chip, int addr, int reg,
  476. u16 update);
  477. int mv88e6xxx_wait(struct mv88e6xxx_chip *chip, int addr, int reg, u16 mask);
  478. struct mii_bus *mv88e6xxx_default_mdio_bus(struct mv88e6xxx_chip *chip);
  479. #endif /* _MV88E6XXX_CHIP_H */