octeon-ethernet.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * This file is based on code from OCTEON SDK by Cavium Networks.
  4. *
  5. * Copyright (c) 2003-2010 Cavium Networks
  6. */
  7. /*
  8. * External interface for the Cavium Octeon ethernet driver.
  9. */
  10. #ifndef OCTEON_ETHERNET_H
  11. #define OCTEON_ETHERNET_H
  12. #include <linux/of.h>
  13. #include <asm/octeon/cvmx-helper-board.h>
  14. /**
  15. * This is the definition of the Ethernet driver's private
  16. * driver state stored in netdev_priv(dev).
  17. */
  18. struct octeon_ethernet {
  19. /* PKO hardware output port */
  20. int port;
  21. /* PKO hardware queue for the port */
  22. int queue;
  23. /* Hardware fetch and add to count outstanding tx buffers */
  24. int fau;
  25. /* My netdev. */
  26. struct net_device *netdev;
  27. /*
  28. * Type of port. This is one of the enums in
  29. * cvmx_helper_interface_mode_t
  30. */
  31. int imode;
  32. /* List of outstanding tx buffers per queue */
  33. struct sk_buff_head tx_free_list[16];
  34. unsigned int last_speed;
  35. unsigned int last_link;
  36. /* Last negotiated link state */
  37. u64 link_info;
  38. /* Called periodically to check link status */
  39. void (*poll)(struct net_device *dev);
  40. struct delayed_work port_periodic_work;
  41. struct device_node *of_node;
  42. };
  43. int cvm_oct_free_work(void *work_queue_entry);
  44. int cvm_oct_rgmii_open(struct net_device *dev);
  45. int cvm_oct_sgmii_init(struct net_device *dev);
  46. int cvm_oct_sgmii_open(struct net_device *dev);
  47. int cvm_oct_spi_init(struct net_device *dev);
  48. void cvm_oct_spi_uninit(struct net_device *dev);
  49. int cvm_oct_common_init(struct net_device *dev);
  50. void cvm_oct_common_uninit(struct net_device *dev);
  51. void cvm_oct_adjust_link(struct net_device *dev);
  52. int cvm_oct_common_stop(struct net_device *dev);
  53. int cvm_oct_common_open(struct net_device *dev,
  54. void (*link_poll)(struct net_device *));
  55. void cvm_oct_note_carrier(struct octeon_ethernet *priv,
  56. cvmx_helper_link_info_t li);
  57. void cvm_oct_link_poll(struct net_device *dev);
  58. extern int always_use_pow;
  59. extern int pow_send_group;
  60. extern int pow_receive_groups;
  61. extern char pow_send_list[];
  62. extern struct net_device *cvm_oct_device[];
  63. extern atomic_t cvm_oct_poll_queue_stopping;
  64. extern u64 cvm_oct_tx_poll_interval;
  65. extern int rx_napi_weight;
  66. #endif