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_V2_VERSION	"v1.0"
32 #define XGENE_ENET_STD_MTU	1536
33 #define XGENE_ENET_MIN_FRAME	60
34 #define IRQ_ID_SIZE             16
35 
36 struct xge_resource {
37 	void __iomem *base_addr;
38 	int phy_mode;
39 	u32 irq;
40 };
41 
42 struct xge_stats {
43 	u64 tx_packets;
44 	u64 tx_bytes;
45 	u64 rx_packets;
46 	u64 rx_bytes;
47 	u64 rx_errors;
48 };
49 
50 /* ethernet private data */
51 struct xge_pdata {
52 	struct xge_resource resources;
53 	struct xge_desc_ring *tx_ring;
54 	struct xge_desc_ring *rx_ring;
55 	struct platform_device *pdev;
56 	char irq_name[IRQ_ID_SIZE];
57 	struct mii_bus *mdio_bus;
58 	struct net_device *ndev;
59 	struct napi_struct napi;
60 	struct xge_stats stats;
61 	int phy_speed;
62 	u8 nbufs;
63 };
64 
65 int xge_mdio_config(struct net_device *ndev);
66 void xge_mdio_remove(struct net_device *ndev);
67 
68 #endif /* __XGENE_ENET_V2_MAIN_H__ */
69