1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2014-2016 Freescale Semiconductor, Inc.
4  * Copyright 2017-2018 NXP
5  */
6 
7 #ifndef _FSL_MC_PRIVATE_H_
8 #define _FSL_MC_PRIVATE_H_
9 
10 #include <errno.h>
11 #include <malloc.h>
12 #include <asm/io.h>
13 #include <linux/compat.h>
14 #include <linux/types.h>
15 #include <linux/stringify.h>
16 #include <phy.h>
17 
18 #include <fsl-mc/fsl_mc_sys.h>
19 #include <fsl-mc/fsl_mc_cmd.h>
20 #include <fsl-mc/fsl_dprc.h>
21 #include <fsl-mc/fsl_dpbp.h>
22 #include <fsl-mc/fsl_dpni.h>
23 
24 extern struct fsl_mc_io *dflt_mc_io;
25 
26 /**
27  * struct dpbp_node - DPBP strucuture
28  * @uint16_t handle: DPBP object handle
29  * @struct dpbp_attr: DPBP attribute
30  */
31 struct fsl_dpbp_obj {
32 	uint32_t dpbp_id;
33 	uint16_t dpbp_handle;
34 	struct dpbp_attr dpbp_attr;
35 };
36 
37 extern struct fsl_dpbp_obj *dflt_dpbp;
38 
39 /**
40  * struct fsl_dpio_obj - DPIO strucuture
41  * @int dpio_id: DPIO id
42  * @struct qbman_swp *sw_portal: SW portal object
43  */
44 struct fsl_dpio_obj {
45 	uint32_t dpio_id;
46 	uint16_t dpio_handle;
47 	struct qbman_swp *sw_portal; /** SW portal object */
48 };
49 
50 extern struct fsl_dpio_obj *dflt_dpio;
51 
52 /**
53  * struct dpni_node - DPNI strucuture
54  * @int dpni_id: DPNI id
55  * @uint16_t handle: DPNI object handle
56  * @struct dpni_attr: DPNI attributes
57  * @struct dpni_buffer_layout: DPNI buffer layout
58  */
59 struct fsl_dpni_obj {
60 	uint32_t dpni_id;
61 	uint16_t dpni_handle;
62 	struct dpni_attr dpni_attrs;
63 	struct dpni_buffer_layout buf_layout;
64 };
65 
66 extern struct fsl_dpni_obj *dflt_dpni;
67 
68 /**
69  * struct sp_blob_header - SP Blob header structure
70  * @magic: SP Blob magic number
71  * @blob_ver: SP Blob version
72  * @ip_rev: SP IP revision
73  * @length: Length of the SP Blob
74  */
75 struct sp_blob_header {
76 	u32 magic;
77 	u32 blob_ver;
78 	u32 ip_rev;
79 	u32 length;
80 };
81 
82 int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr);
83 int ldpaa_eth_init(int dpmac_id, phy_interface_t enet_if);
84 int mc_apply_dpl(u64 mc_dpl_addr);
85 int mc_apply_spb(u64 mc_spb_addr);
86 #endif /* _FSL_MC_PRIVATE_H_ */
87