octeon-ethernet.h 2.3 KB

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