Thomas Gleixner | 1ccea77 | 2019-05-19 15:51:43 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Iyappan Subramanian | 384fe7a | 2017-03-07 17:08:40 -0800 | [diff] [blame] | 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> |
Iyappan Subramanian | 384fe7a | 2017-03-07 17:08:40 -0800 | [diff] [blame] | 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" |
Iyappan Subramanian | e05ddaf | 2017-04-17 16:47:55 -0700 | [diff] [blame] | 29 | #include "ethtool.h" |
Iyappan Subramanian | 384fe7a | 2017-03-07 17:08:40 -0800 | [diff] [blame] | 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; |
Iyappan Subramanian | b105bcd | 2017-03-07 17:08:44 -0800 | [diff] [blame] | 47 | u64 rx_errors; |
Iyappan Subramanian | 384fe7a | 2017-03-07 17:08:40 -0800 | [diff] [blame] | 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]; |
Iyappan Subramanian | ea8ab16 | 2017-03-21 18:18:02 -0700 | [diff] [blame] | 57 | struct mii_bus *mdio_bus; |
Iyappan Subramanian | 384fe7a | 2017-03-07 17:08:40 -0800 | [diff] [blame] | 58 | struct net_device *ndev; |
| 59 | struct napi_struct napi; |
| 60 | struct xge_stats stats; |
| 61 | int phy_speed; |
| 62 | u8 nbufs; |
| 63 | }; |
| 64 | |
Iyappan Subramanian | ea8ab16 | 2017-03-21 18:18:02 -0700 | [diff] [blame] | 65 | int xge_mdio_config(struct net_device *ndev); |
| 66 | void xge_mdio_remove(struct net_device *ndev); |
| 67 | |
Iyappan Subramanian | 384fe7a | 2017-03-07 17:08:40 -0800 | [diff] [blame] | 68 | #endif /* __XGENE_ENET_V2_MAIN_H__ */ |