main.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Applied Micro X-Gene SoC Ethernet v2 Driver
  3. *
  4. * Copyright (c) 2017, Applied Micro Circuits Corporation
  5. * Author(s): Iyappan Subramanian <isubramanian@apm.com>
  6. * Keyur Chudgar <kchudgar@apm.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef __XGENE_ENET_V2_MAIN_H__
  22. #define __XGENE_ENET_V2_MAIN_H__
  23. #include <linux/acpi.h>
  24. #include <linux/clk.h>
  25. #include <linux/efi.h>
  26. #include <linux/if_vlan.h>
  27. #include <linux/irq.h>
  28. #include <linux/io.h>
  29. #include <linux/module.h>
  30. #include <linux/of_platform.h>
  31. #include <linux/of_net.h>
  32. #include <linux/of_mdio.h>
  33. #include <linux/prefetch.h>
  34. #include <linux/phy.h>
  35. #include <net/ip.h>
  36. #include "mac.h"
  37. #include "enet.h"
  38. #include "ring.h"
  39. #include "ethtool.h"
  40. #define XGENE_ENET_V2_VERSION "v1.0"
  41. #define XGENE_ENET_STD_MTU 1536
  42. #define XGENE_ENET_MIN_FRAME 60
  43. #define IRQ_ID_SIZE 16
  44. struct xge_resource {
  45. void __iomem *base_addr;
  46. int phy_mode;
  47. u32 irq;
  48. };
  49. struct xge_stats {
  50. u64 tx_packets;
  51. u64 tx_bytes;
  52. u64 rx_packets;
  53. u64 rx_bytes;
  54. u64 rx_errors;
  55. };
  56. /* ethernet private data */
  57. struct xge_pdata {
  58. struct xge_resource resources;
  59. struct xge_desc_ring *tx_ring;
  60. struct xge_desc_ring *rx_ring;
  61. struct platform_device *pdev;
  62. char irq_name[IRQ_ID_SIZE];
  63. struct mii_bus *mdio_bus;
  64. struct net_device *ndev;
  65. struct napi_struct napi;
  66. struct xge_stats stats;
  67. int phy_speed;
  68. u8 nbufs;
  69. };
  70. int xge_mdio_config(struct net_device *ndev);
  71. void xge_mdio_remove(struct net_device *ndev);
  72. #endif /* __XGENE_ENET_V2_MAIN_H__ */