octeon-ethernet.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. struct phy_device *phydev;
  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 work_struct port_work; /* may be unused. */
  47. struct device_node *of_node;
  48. };
  49. int cvm_oct_free_work(void *work_queue_entry);
  50. int cvm_oct_rgmii_init(struct net_device *dev);
  51. void cvm_oct_rgmii_uninit(struct net_device *dev);
  52. int cvm_oct_rgmii_open(struct net_device *dev);
  53. int cvm_oct_sgmii_init(struct net_device *dev);
  54. int cvm_oct_sgmii_open(struct net_device *dev);
  55. int cvm_oct_spi_init(struct net_device *dev);
  56. void cvm_oct_spi_uninit(struct net_device *dev);
  57. int cvm_oct_common_init(struct net_device *dev);
  58. void cvm_oct_common_uninit(struct net_device *dev);
  59. void cvm_oct_adjust_link(struct net_device *dev);
  60. int cvm_oct_common_stop(struct net_device *dev);
  61. int cvm_oct_common_open(struct net_device *dev,
  62. void (*link_poll)(struct net_device *));
  63. void cvm_oct_note_carrier(struct octeon_ethernet *priv,
  64. cvmx_helper_link_info_t li);
  65. void cvm_oct_link_poll(struct net_device *dev);
  66. extern int always_use_pow;
  67. extern int pow_send_group;
  68. extern int pow_receive_group;
  69. extern char pow_send_list[];
  70. extern struct net_device *cvm_oct_device[];
  71. extern struct workqueue_struct *cvm_oct_poll_queue;
  72. extern atomic_t cvm_oct_poll_queue_stopping;
  73. extern u64 cvm_oct_tx_poll_interval;
  74. extern int rx_napi_weight;
  75. #endif