xref: /dpdk/drivers/net/pfe/pfe_mod.h (revision f513f620591370c7b10f43fc7baa2e258d2f428d)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2018-2019 NXP
3  */
4 
5 #ifndef _PFE_MOD_H_
6 #define _PFE_MOD_H_
7 
8 struct pfe;
9 
10 #include <rte_ethdev.h>
11 
12 #include "pfe.h"
13 #include "pfe_hif.h"
14 #include "pfe_hif_lib.h"
15 #include "pfe_eth.h"
16 
17 #define PHYID_MAX_VAL 32
18 
19 /* PFE DPDK driver supports two interfaces.
20  */
21 #define PFE_CDEV_ETH_COUNT 2
22 
23 /* PFE DPDK driver needs a kernel module named "pfe.ko", This module
24  * is required for PHY initialisation and creates a character device
25  * "pfe_us_cdev" for IOCTL support. PFE DPDK driver uses this character
26  * device for link status.
27  */
28 #define PFE_CDEV_PATH		"/dev/pfe_us_cdev"
29 #define PFE_CDEV_INVALID_FD	-1
30 #define PFE_NAME_PMD		net_pfe
31 
32 /* used when 'read' call is issued, returning PFE_CDEV_ETH_COUNT number of
33  * pfe_shared_info as array.
34  */
35 struct pfe_shared_info {
36 	uint32_t phy_id; /* Link phy ID */
37 	uint8_t state;  /* Has either 0 or 1 */
38 };
39 
40 struct pfe_eth {
41 	struct pfe_eth_priv_s *eth_priv[PFE_CDEV_ETH_COUNT];
42 };
43 
44 struct pfe {
45 	uint64_t ddr_phys_baseaddr;
46 	void *ddr_baseaddr;
47 	uint64_t ddr_size;
48 	void *cbus_baseaddr;
49 	uint64_t cbus_size;
50 	struct ls1012a_pfe_platform_data platform_data;
51 	struct pfe_hif hif;
52 	struct pfe_eth eth;
53 	struct hif_client_s *hif_client[HIF_CLIENTS_MAX];
54 	int mdio_muxval[PHYID_MAX_VAL];
55 	uint8_t nb_devs;
56 	uint8_t max_intf;
57 	int cdev_fd;
58 };
59 
60 /* IOCTL Commands */
61 #define PFE_CDEV_ETH0_STATE_GET		_IOR('R', 0, int)
62 #define PFE_CDEV_ETH1_STATE_GET		_IOR('R', 1, int)
63 #define PFE_CDEV_HIF_INTR_EN		_IOWR('R', 2, int)
64 #endif /* _PFE_MOD_H */
65