xref: /linux/drivers/net/ethernet/apm/xgene-v2/main.h (revision 24bce201d79807b668bf9d9e0aca801c5c0d5f78)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Applied Micro X-Gene SoC Ethernet v2 Driver
4  *
5  * Copyright (c) 2017, Applied Micro Circuits Corporation
6  * Author(s): Iyappan Subramanian <isubramanian@apm.com>
7  *	      Keyur Chudgar <kchudgar@apm.com>
8  */
9 
10 #ifndef __XGENE_ENET_V2_MAIN_H__
11 #define __XGENE_ENET_V2_MAIN_H__
12 
13 #include <linux/acpi.h>
14 #include <linux/clk.h>
15 #include <linux/efi.h>
16 #include <linux/if_vlan.h>
17 #include <linux/irq.h>
18 #include <linux/io.h>
19 #include <linux/module.h>
20 #include <linux/of_platform.h>
21 #include <linux/of_net.h>
22 #include <linux/of_mdio.h>
23 #include <linux/prefetch.h>
24 #include <linux/phy.h>
25 #include <net/ip.h>
26 #include "mac.h"
27 #include "enet.h"
28 #include "ring.h"
29 #include "ethtool.h"
30 
31 #define XGENE_ENET_STD_MTU	1536
32 #define XGENE_ENET_MIN_FRAME	60
33 #define IRQ_ID_SIZE             16
34 
35 struct xge_resource {
36 	void __iomem *base_addr;
37 	int phy_mode;
38 	u32 irq;
39 };
40 
41 struct xge_stats {
42 	u64 tx_packets;
43 	u64 tx_bytes;
44 	u64 rx_packets;
45 	u64 rx_bytes;
46 	u64 rx_errors;
47 };
48 
49 /* ethernet private data */
50 struct xge_pdata {
51 	struct xge_resource resources;
52 	struct xge_desc_ring *tx_ring;
53 	struct xge_desc_ring *rx_ring;
54 	struct platform_device *pdev;
55 	char irq_name[IRQ_ID_SIZE];
56 	struct mii_bus *mdio_bus;
57 	struct net_device *ndev;
58 	struct napi_struct napi;
59 	struct xge_stats stats;
60 	int phy_speed;
61 	u8 nbufs;
62 };
63 
64 int xge_mdio_config(struct net_device *ndev);
65 void xge_mdio_remove(struct net_device *ndev);
66 
67 #endif /* __XGENE_ENET_V2_MAIN_H__ */
68