xref: /freebsd/sys/contrib/ncsw/inc/flib/fsl_fman_prs.h (revision c2c014f24c10f90d85126ac5fbd4d8524de32b1c)
1*852ba100SJustin Hibbits /*
2*852ba100SJustin Hibbits  * Copyright 2008-2012 Freescale Semiconductor Inc.
3*852ba100SJustin Hibbits  *
4*852ba100SJustin Hibbits  * Redistribution and use in source and binary forms, with or without
5*852ba100SJustin Hibbits  * modification, are permitted provided that the following conditions are met:
6*852ba100SJustin Hibbits  *     * Redistributions of source code must retain the above copyright
7*852ba100SJustin Hibbits  *       notice, this list of conditions and the following disclaimer.
8*852ba100SJustin Hibbits  *     * Redistributions in binary form must reproduce the above copyright
9*852ba100SJustin Hibbits  *       notice, this list of conditions and the following disclaimer in the
10*852ba100SJustin Hibbits  *       documentation and/or other materials provided with the distribution.
11*852ba100SJustin Hibbits  *     * Neither the name of Freescale Semiconductor nor the
12*852ba100SJustin Hibbits  *       names of its contributors may be used to endorse or promote products
13*852ba100SJustin Hibbits  *       derived from this software without specific prior written permission.
14*852ba100SJustin Hibbits  *
15*852ba100SJustin Hibbits  *
16*852ba100SJustin Hibbits  * ALTERNATIVELY, this software may be distributed under the terms of the
17*852ba100SJustin Hibbits  * GNU General Public License ("GPL") as published by the Free Software
18*852ba100SJustin Hibbits  * Foundation, either version 2 of that License or (at your option) any
19*852ba100SJustin Hibbits  * later version.
20*852ba100SJustin Hibbits  *
21*852ba100SJustin Hibbits  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22*852ba100SJustin Hibbits  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23*852ba100SJustin Hibbits  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24*852ba100SJustin Hibbits  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25*852ba100SJustin Hibbits  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26*852ba100SJustin Hibbits  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27*852ba100SJustin Hibbits  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28*852ba100SJustin Hibbits  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29*852ba100SJustin Hibbits  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30*852ba100SJustin Hibbits  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31*852ba100SJustin Hibbits  */
32*852ba100SJustin Hibbits 
33*852ba100SJustin Hibbits #ifndef __FSL_FMAN_PRS_H
34*852ba100SJustin Hibbits #define __FSL_FMAN_PRS_H
35*852ba100SJustin Hibbits 
36*852ba100SJustin Hibbits #include "common/general.h"
37*852ba100SJustin Hibbits 
38*852ba100SJustin Hibbits #define FM_PCD_EX_PRS_DOUBLE_ECC	0x02000000
39*852ba100SJustin Hibbits #define FM_PCD_EX_PRS_SINGLE_ECC	0x01000000
40*852ba100SJustin Hibbits 
41*852ba100SJustin Hibbits #define FM_PCD_PRS_PPSC_ALL_PORTS	0xffff0000
42*852ba100SJustin Hibbits #define FM_PCD_PRS_RPIMAC_EN		0x00000001
43*852ba100SJustin Hibbits #define FM_PCD_PRS_PORT_IDLE_STS	0xffff0000
44*852ba100SJustin Hibbits #define FM_PCD_PRS_SINGLE_ECC		0x00004000
45*852ba100SJustin Hibbits #define FM_PCD_PRS_DOUBLE_ECC		0x00004000
46*852ba100SJustin Hibbits #define PRS_MAX_CYCLE_LIMIT		8191
47*852ba100SJustin Hibbits 
48*852ba100SJustin Hibbits #define DEFAULT_MAX_PRS_CYC_LIM		0
49*852ba100SJustin Hibbits 
50*852ba100SJustin Hibbits struct fman_prs_regs {
51*852ba100SJustin Hibbits 	uint32_t fmpr_rpclim;
52*852ba100SJustin Hibbits 	uint32_t fmpr_rpimac;
53*852ba100SJustin Hibbits 	uint32_t pmeec;
54*852ba100SJustin Hibbits 	uint32_t res00c[5];
55*852ba100SJustin Hibbits 	uint32_t fmpr_pevr;
56*852ba100SJustin Hibbits 	uint32_t fmpr_pever;
57*852ba100SJustin Hibbits 	uint32_t res028;
58*852ba100SJustin Hibbits 	uint32_t fmpr_perr;
59*852ba100SJustin Hibbits 	uint32_t fmpr_perer;
60*852ba100SJustin Hibbits 	uint32_t res034;
61*852ba100SJustin Hibbits 	uint32_t res038[10];
62*852ba100SJustin Hibbits 	uint32_t fmpr_ppsc;
63*852ba100SJustin Hibbits 	uint32_t res064;
64*852ba100SJustin Hibbits 	uint32_t fmpr_pds;
65*852ba100SJustin Hibbits 	uint32_t fmpr_l2rrs;
66*852ba100SJustin Hibbits 	uint32_t fmpr_l3rrs;
67*852ba100SJustin Hibbits 	uint32_t fmpr_l4rrs;
68*852ba100SJustin Hibbits 	uint32_t fmpr_srrs;
69*852ba100SJustin Hibbits 	uint32_t fmpr_l2rres;
70*852ba100SJustin Hibbits 	uint32_t fmpr_l3rres;
71*852ba100SJustin Hibbits 	uint32_t fmpr_l4rres;
72*852ba100SJustin Hibbits 	uint32_t fmpr_srres;
73*852ba100SJustin Hibbits 	uint32_t fmpr_spcs;
74*852ba100SJustin Hibbits 	uint32_t fmpr_spscs;
75*852ba100SJustin Hibbits 	uint32_t fmpr_hxscs;
76*852ba100SJustin Hibbits 	uint32_t fmpr_mrcs;
77*852ba100SJustin Hibbits 	uint32_t fmpr_mwcs;
78*852ba100SJustin Hibbits 	uint32_t fmpr_mrscs;
79*852ba100SJustin Hibbits 	uint32_t fmpr_mwscs;
80*852ba100SJustin Hibbits 	uint32_t fmpr_fcscs;
81*852ba100SJustin Hibbits };
82*852ba100SJustin Hibbits 
83*852ba100SJustin Hibbits struct fman_prs_cfg {
84*852ba100SJustin Hibbits 	uint32_t	port_id_stat;
85*852ba100SJustin Hibbits 	uint16_t	max_prs_cyc_lim;
86*852ba100SJustin Hibbits 	uint32_t	prs_exceptions;
87*852ba100SJustin Hibbits };
88*852ba100SJustin Hibbits 
89*852ba100SJustin Hibbits uint32_t fman_prs_get_err_event(struct fman_prs_regs *regs, uint32_t ev_mask);
90*852ba100SJustin Hibbits uint32_t fman_prs_get_err_ev_mask(struct fman_prs_regs *regs);
91*852ba100SJustin Hibbits void fman_prs_ack_err_event(struct fman_prs_regs *regs, uint32_t event);
92*852ba100SJustin Hibbits uint32_t fman_prs_get_expt_event(struct fman_prs_regs *regs, uint32_t ev_mask);
93*852ba100SJustin Hibbits uint32_t fman_prs_get_expt_ev_mask(struct fman_prs_regs *regs);
94*852ba100SJustin Hibbits void fman_prs_ack_expt_event(struct fman_prs_regs *regs, uint32_t event);
95*852ba100SJustin Hibbits void fman_prs_defconfig(struct fman_prs_cfg *cfg);
96*852ba100SJustin Hibbits int fman_prs_init(struct fman_prs_regs *regs, struct fman_prs_cfg *cfg);
97*852ba100SJustin Hibbits void fman_prs_enable(struct fman_prs_regs *regs);
98*852ba100SJustin Hibbits void fman_prs_disable(struct fman_prs_regs *regs);
99*852ba100SJustin Hibbits int fman_prs_is_enabled(struct fman_prs_regs *regs);
100*852ba100SJustin Hibbits void fman_prs_set_stst_port_msk(struct fman_prs_regs *regs, uint32_t pid_msk);
101*852ba100SJustin Hibbits void fman_prs_set_stst(struct fman_prs_regs *regs, bool enable);
102*852ba100SJustin Hibbits #endif /* __FSL_FMAN_PRS_H */
103