xref: /openbmc/u-boot/include/fsl_fman.h (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
28225b2fdSShaohui Xie /*
38225b2fdSShaohui Xie  * MPC85xx Internal Memory Map
48225b2fdSShaohui Xie  *
58225b2fdSShaohui Xie  * Copyright 2010-2011 Freescale Semiconductor, Inc.
68225b2fdSShaohui Xie  */
78225b2fdSShaohui Xie 
88225b2fdSShaohui Xie #ifndef __FSL_FMAN_H__
98225b2fdSShaohui Xie #define __FSL_FMAN_H__
108225b2fdSShaohui Xie 
118225b2fdSShaohui Xie #include <asm/types.h>
128225b2fdSShaohui Xie 
138225b2fdSShaohui Xie typedef struct fm_bmi_common {
148225b2fdSShaohui Xie 	u32	fmbm_init;	/* BMI initialization */
158225b2fdSShaohui Xie 	u32	fmbm_cfg1;	/* BMI configuration1 */
168225b2fdSShaohui Xie 	u32	fmbm_cfg2;	/* BMI configuration2 */
178225b2fdSShaohui Xie 	u32	res0[0x5];
188225b2fdSShaohui Xie 	u32	fmbm_ievr;	/* interrupt event register */
198225b2fdSShaohui Xie 	u32	fmbm_ier;	/* interrupt enable register */
208225b2fdSShaohui Xie 	u32	fmbm_ifr;	/* interrupt force register */
218225b2fdSShaohui Xie 	u32	res1[0x5];
228225b2fdSShaohui Xie 	u32	fmbm_arb[0x8];	/* BMI arbitration */
238225b2fdSShaohui Xie 	u32	res2[0x28];
248225b2fdSShaohui Xie 	u32	fmbm_gde;	/* global debug enable */
258225b2fdSShaohui Xie 	u32	fmbm_pp[0x3f];	/* BMI port parameters */
268225b2fdSShaohui Xie 	u32	res3;
278225b2fdSShaohui Xie 	u32	fmbm_pfs[0x3f];	/* BMI port FIFO size */
288225b2fdSShaohui Xie 	u32	res4;
298225b2fdSShaohui Xie 	u32	fmbm_ppid[0x3f];/* port partition ID */
308225b2fdSShaohui Xie } fm_bmi_common_t;
318225b2fdSShaohui Xie 
328225b2fdSShaohui Xie typedef struct fm_qmi_common {
338225b2fdSShaohui Xie 	u32	fmqm_gc;	/* general configuration register */
348225b2fdSShaohui Xie 	u32	res0;
358225b2fdSShaohui Xie 	u32	fmqm_eie;	/* error interrupt event register */
368225b2fdSShaohui Xie 	u32	fmqm_eien;	/* error interrupt enable register */
378225b2fdSShaohui Xie 	u32	fmqm_eif;	/* error interrupt force register */
388225b2fdSShaohui Xie 	u32	fmqm_ie;	/* interrupt event register */
398225b2fdSShaohui Xie 	u32	fmqm_ien;	/* interrupt enable register */
408225b2fdSShaohui Xie 	u32	fmqm_if;	/* interrupt force register */
418225b2fdSShaohui Xie 	u32	fmqm_gs;	/* global status register */
428225b2fdSShaohui Xie 	u32	fmqm_ts;	/* task status register */
438225b2fdSShaohui Xie 	u32	fmqm_etfc;	/* enqueue total frame counter */
448225b2fdSShaohui Xie 	u32	fmqm_dtfc;	/* dequeue total frame counter */
458225b2fdSShaohui Xie 	u32	fmqm_dc0;	/* dequeue counter 0 */
468225b2fdSShaohui Xie 	u32	fmqm_dc1;	/* dequeue counter 1 */
478225b2fdSShaohui Xie 	u32	fmqm_dc2;	/* dequeue counter 2 */
488225b2fdSShaohui Xie 	u32	fmqm_dc3;	/* dequeue counter 3 */
498225b2fdSShaohui Xie 	u32	fmqm_dfnoc;	/* dequeue FQID not override counter */
508225b2fdSShaohui Xie 	u32	fmqm_dfcc;	/* dequeue FQID from context counter */
518225b2fdSShaohui Xie 	u32	fmqm_dffc;	/* dequeue FQID from FD counter */
528225b2fdSShaohui Xie 	u32	fmqm_dcc;	/* dequeue confirm counter */
538225b2fdSShaohui Xie 	u32	res1[0xc];
548225b2fdSShaohui Xie 	u32	fmqm_dtrc;	/* debug trap configuration register */
558225b2fdSShaohui Xie 	u32	fmqm_efddd;	/* enqueue frame descriptor dynamic debug */
568225b2fdSShaohui Xie 	u32	res3[0x2];
578225b2fdSShaohui Xie 	u32	res4[0xdc];	/* missing debug regs */
588225b2fdSShaohui Xie } fm_qmi_common_t;
598225b2fdSShaohui Xie 
608225b2fdSShaohui Xie typedef struct fm_bmi {
618225b2fdSShaohui Xie 	u8	res[1024];
628225b2fdSShaohui Xie } fm_bmi_t;
638225b2fdSShaohui Xie 
648225b2fdSShaohui Xie typedef struct fm_qmi {
658225b2fdSShaohui Xie 	u8	res[1024];
668225b2fdSShaohui Xie } fm_qmi_t;
678225b2fdSShaohui Xie 
688225b2fdSShaohui Xie struct fm_bmi_rx_port {
698225b2fdSShaohui Xie 	u32 fmbm_rcfg;	/* Rx configuration */
708225b2fdSShaohui Xie 	u32 fmbm_rst;	/* Rx status */
718225b2fdSShaohui Xie 	u32 fmbm_rda;	/* Rx DMA attributes */
728225b2fdSShaohui Xie 	u32 fmbm_rfp;	/* Rx FIFO parameters */
738225b2fdSShaohui Xie 	u32 fmbm_rfed;	/* Rx frame end data */
748225b2fdSShaohui Xie 	u32 fmbm_ricp;	/* Rx internal context parameters */
758225b2fdSShaohui Xie 	u32 fmbm_rim;	/* Rx internal margins */
768225b2fdSShaohui Xie 	u32 fmbm_rebm;	/* Rx external buffer margins */
778225b2fdSShaohui Xie 	u32 fmbm_rfne;	/* Rx frame next engine */
788225b2fdSShaohui Xie 	u32 fmbm_rfca;	/* Rx frame command attributes */
798225b2fdSShaohui Xie 	u32 fmbm_rfpne;	/* Rx frame parser next engine */
808225b2fdSShaohui Xie 	u32 fmbm_rpso;	/* Rx parse start offset */
818225b2fdSShaohui Xie 	u32 fmbm_rpp;	/* Rx policer profile */
828225b2fdSShaohui Xie 	u32 fmbm_rccb;	/* Rx coarse classification base */
838225b2fdSShaohui Xie 	u32 res1[0x2];
848225b2fdSShaohui Xie 	u32 fmbm_rprai[0x8];	/* Rx parse results array Initialization */
858225b2fdSShaohui Xie 	u32 fmbm_rfqid;		/* Rx frame queue ID */
868225b2fdSShaohui Xie 	u32 fmbm_refqid;	/* Rx error frame queue ID */
878225b2fdSShaohui Xie 	u32 fmbm_rfsdm;		/* Rx frame status discard mask */
888225b2fdSShaohui Xie 	u32 fmbm_rfsem;		/* Rx frame status error mask */
898225b2fdSShaohui Xie 	u32 fmbm_rfene;		/* Rx frame enqueue next engine */
908225b2fdSShaohui Xie 	u32 res2[0x23];
918225b2fdSShaohui Xie 	u32 fmbm_ebmpi[0x8];	/* buffer manager pool information */
928225b2fdSShaohui Xie 	u32 fmbm_acnt[0x8];	/* allocate counter */
938225b2fdSShaohui Xie 	u32 res3[0x8];
948225b2fdSShaohui Xie 	u32 fmbm_cgm[0x8];	/* congestion group map */
958225b2fdSShaohui Xie 	u32 fmbm_mpd;		/* BMan pool depletion */
968225b2fdSShaohui Xie 	u32 res4[0x1F];
978225b2fdSShaohui Xie 	u32 fmbm_rstc;		/* Rx statistics counters */
988225b2fdSShaohui Xie 	u32 fmbm_rfrc;		/* Rx frame counters */
998225b2fdSShaohui Xie 	u32 fmbm_rfbc;		/* Rx bad frames counter */
1008225b2fdSShaohui Xie 	u32 fmbm_rlfc;		/* Rx large frames counter */
1018225b2fdSShaohui Xie 	u32 fmbm_rffc;		/* Rx filter frames counter */
1028225b2fdSShaohui Xie 	u32 fmbm_rfdc;		/* Rx frame discard counter */
1038225b2fdSShaohui Xie 	u32 fmbm_rfldec;	/* Rx frames list DMA error counter */
1048225b2fdSShaohui Xie 	u32 fmbm_rodc;		/* Rx out of buffers discard counter */
1058225b2fdSShaohui Xie 	u32 fmbm_rbdc;		/* Rx buffers deallocate counter */
1068225b2fdSShaohui Xie 	u32 res5[0x17];
1078225b2fdSShaohui Xie 	u32 fmbm_rpc;		/* Rx performance counters */
1088225b2fdSShaohui Xie 	u32 fmbm_rpcp;		/* Rx performance count parameters */
1098225b2fdSShaohui Xie 	u32 fmbm_rccn;		/* Rx cycle counter */
1108225b2fdSShaohui Xie 	u32 fmbm_rtuc;		/* Rx tasks utilization counter */
1118225b2fdSShaohui Xie 	u32 fmbm_rrquc;		/* Rx receive queue utilization counter */
1128225b2fdSShaohui Xie 	u32 fmbm_rduc;		/* Rx DMA utilization counter */
1138225b2fdSShaohui Xie 	u32 fmbm_rfuc;		/* Rx FIFO utilization counter */
1148225b2fdSShaohui Xie 	u32 fmbm_rpac;		/* Rx pause activation counter */
1158225b2fdSShaohui Xie 	u32 res6[0x18];
1168225b2fdSShaohui Xie 	u32 fmbm_rdbg;		/* Rx debug configuration */
1178225b2fdSShaohui Xie };
1188225b2fdSShaohui Xie 
1198225b2fdSShaohui Xie /* FMBM_RCFG - Rx configuration */
1208225b2fdSShaohui Xie #define FMBM_RCFG_EN		0x80000000 /* port is enabled to receive data */
1218225b2fdSShaohui Xie #define FMBM_RCFG_FDOVR		0x02000000 /* frame discard override */
1228225b2fdSShaohui Xie #define FMBM_RCFG_IM		0x01000000 /* independent mode */
1238225b2fdSShaohui Xie 
1248225b2fdSShaohui Xie /* FMBM_RST - Rx status */
1258225b2fdSShaohui Xie #define FMBM_RST_BSY		0x80000000 /* Rx port is busy */
1268225b2fdSShaohui Xie 
1278225b2fdSShaohui Xie /* FMBM_RFCA - Rx frame command attributes */
1288225b2fdSShaohui Xie #define FMBM_RFCA_ORDER		0x80000000
1298225b2fdSShaohui Xie #define FMBM_RFCA_MR_MASK	0x003f0000
1308225b2fdSShaohui Xie #define FMBM_RFCA_MR(x)		((x << 16) & FMBM_RFCA_MR_MASK)
1318225b2fdSShaohui Xie 
1328225b2fdSShaohui Xie /* FMBM_RSTC - Rx statistics */
1338225b2fdSShaohui Xie #define FMBM_RSTC_EN		0x80000000 /* statistics counters enable */
1348225b2fdSShaohui Xie 
1358225b2fdSShaohui Xie struct fm_bmi_tx_port {
1368225b2fdSShaohui Xie 	u32 fmbm_tcfg;	/* Tx configuration */
1378225b2fdSShaohui Xie 	u32 fmbm_tst;	/* Tx status */
1388225b2fdSShaohui Xie 	u32 fmbm_tda;	/* Tx DMA attributes */
1398225b2fdSShaohui Xie 	u32 fmbm_tfp;	/* Tx FIFO parameters */
1408225b2fdSShaohui Xie 	u32 fmbm_tfed;	/* Tx frame end data */
1418225b2fdSShaohui Xie 	u32 fmbm_ticp;	/* Tx internal context parameters */
1428225b2fdSShaohui Xie 	u32 fmbm_tfne;	/* Tx frame next engine */
1438225b2fdSShaohui Xie 	u32 fmbm_tfca;	/* Tx frame command attributes */
1448225b2fdSShaohui Xie 	u32 fmbm_tcfqid;/* Tx confirmation frame queue ID */
1458225b2fdSShaohui Xie 	u32 fmbm_tfeqid;/* Tx error frame queue ID */
1468225b2fdSShaohui Xie 	u32 fmbm_tfene;	/* Tx frame enqueue next engine */
1478225b2fdSShaohui Xie 	u32 fmbm_trlmts;/* Tx rate limiter scale */
1488225b2fdSShaohui Xie 	u32 fmbm_trlmt;	/* Tx rate limiter */
1498225b2fdSShaohui Xie 	u32 res0[0x73];
1508225b2fdSShaohui Xie 	u32 fmbm_tstc;	/* Tx statistics counters */
1518225b2fdSShaohui Xie 	u32 fmbm_tfrc;	/* Tx frame counter */
1528225b2fdSShaohui Xie 	u32 fmbm_tfdc;	/* Tx frames discard counter */
1538225b2fdSShaohui Xie 	u32 fmbm_tfledc;/* Tx frame length error discard counter */
1548225b2fdSShaohui Xie 	u32 fmbm_tfufdc;/* Tx frame unsupported format discard counter */
1558225b2fdSShaohui Xie 	u32 fmbm_tbdc;	/* Tx buffers deallocate counter */
1568225b2fdSShaohui Xie 	u32 res1[0x1a];
1578225b2fdSShaohui Xie 	u32 fmbm_tpc;	/* Tx performance counters */
1588225b2fdSShaohui Xie 	u32 fmbm_tpcp;	/* Tx performance count parameters */
1598225b2fdSShaohui Xie 	u32 fmbm_tccn;	/* Tx cycle counter */
1608225b2fdSShaohui Xie 	u32 fmbm_ttuc;	/* Tx tasks utilization counter */
1618225b2fdSShaohui Xie 	u32 fmbm_ttcquc;/* Tx transmit confirm queue utilization counter */
1628225b2fdSShaohui Xie 	u32 fmbm_tduc;	/* Tx DMA utilization counter */
1638225b2fdSShaohui Xie 	u32 fmbm_tfuc;	/* Tx FIFO utilization counter */
1648225b2fdSShaohui Xie 	u32 res2[0x19];
1658225b2fdSShaohui Xie 	u32 fmbm_tdcfg;	/* Tx debug configuration */
1668225b2fdSShaohui Xie };
1678225b2fdSShaohui Xie 
1688225b2fdSShaohui Xie /* FMBM_TCFG - Tx configuration */
1698225b2fdSShaohui Xie #define FMBM_TCFG_EN	0x80000000 /* port is enabled to transmit data */
1708225b2fdSShaohui Xie #define FMBM_TCFG_IM	0x01000000 /* independent mode enable */
1718225b2fdSShaohui Xie 
1728225b2fdSShaohui Xie /* FMBM_TST - Tx status */
1738225b2fdSShaohui Xie #define FMBM_TST_BSY		0x80000000 /* Tx port is busy */
1748225b2fdSShaohui Xie 
1758225b2fdSShaohui Xie /* FMBM_TFCA - Tx frame command attributes */
1768225b2fdSShaohui Xie #define FMBM_TFCA_ORDER		0x80000000
1778225b2fdSShaohui Xie #define FMBM_TFCA_MR_MASK	0x003f0000
1788225b2fdSShaohui Xie #define FMBM_TFCA_MR(x)		((x << 16) & FMBM_TFCA_MR_MASK)
1798225b2fdSShaohui Xie 
1808225b2fdSShaohui Xie /* FMBM_TSTC - Tx statistics counters */
1818225b2fdSShaohui Xie #define FMBM_TSTC_EN		0x80000000
1828225b2fdSShaohui Xie 
1838225b2fdSShaohui Xie /* FMBM_INIT - BMI initialization register */
1848225b2fdSShaohui Xie #define FMBM_INIT_START		0x80000000 /* init internal buffers */
1858225b2fdSShaohui Xie 
1868225b2fdSShaohui Xie /* FMBM_CFG1 - BMI configuration 1 */
1878225b2fdSShaohui Xie #define FMBM_CFG1_FBPS_MASK	0x03ff0000 /* Free buffer pool size */
1888225b2fdSShaohui Xie #define FMBM_CFG1_FBPS_SHIFT	16
1898225b2fdSShaohui Xie #define FMBM_CFG1_FBPO_MASK	0x000003ff /* Free buffer pool offset */
1908225b2fdSShaohui Xie 
1918225b2fdSShaohui Xie /* FMBM_IEVR - interrupt event */
1928225b2fdSShaohui Xie #define FMBM_IEVR_PEC		0x80000000 /* pipeline table ECC err detected */
1938225b2fdSShaohui Xie #define FMBM_IEVR_LEC		0x40000000 /* linked list RAM ECC error */
1948225b2fdSShaohui Xie #define FMBM_IEVR_SEC		0x20000000 /* statistics count RAM ECC error */
1958225b2fdSShaohui Xie #define FMBM_IEVR_CLEAR_ALL	(FMBM_IEVR_PEC | FMBM_IEVR_LEC | FMBM_IEVR_SEC)
1968225b2fdSShaohui Xie 
1978225b2fdSShaohui Xie /* FMBM_IER - interrupt enable */
1988225b2fdSShaohui Xie #define FMBM_IER_PECE		0x80000000 /* PEC interrupt enable */
1998225b2fdSShaohui Xie #define FMBM_IER_LECE		0x40000000 /* LEC interrupt enable */
2008225b2fdSShaohui Xie #define FMBM_IER_SECE		0x20000000 /* SEC interrupt enable */
2018225b2fdSShaohui Xie 
2028225b2fdSShaohui Xie #define FMBM_IER_DISABLE_ALL	0x00000000
2038225b2fdSShaohui Xie 
2048225b2fdSShaohui Xie /* FMBM_PP - BMI Port Parameters */
2058225b2fdSShaohui Xie #define FMBM_PP_MXT_MASK	0x3f000000 /* Max # tasks */
2068225b2fdSShaohui Xie #define FMBM_PP_MXT(x)		(((x-1) << 24) & FMBM_PP_MXT_MASK)
2078225b2fdSShaohui Xie #define FMBM_PP_MXD_MASK	0x00000f00 /* Max DMA */
2088225b2fdSShaohui Xie #define FMBM_PP_MXD(x)		(((x-1) << 8) & FMBM_PP_MXD_MASK)
2098225b2fdSShaohui Xie 
2108225b2fdSShaohui Xie /* FMBM_PFS - BMI Port FIFO Size */
2118225b2fdSShaohui Xie #define FMBM_PFS_IFSZ_MASK	0x000003ff /* Internal Fifo Size */
2128225b2fdSShaohui Xie #define FMBM_PFS_IFSZ(x)	(x & FMBM_PFS_IFSZ_MASK)
2138225b2fdSShaohui Xie 
2148225b2fdSShaohui Xie /* FMQM_GC - global configuration */
2158225b2fdSShaohui Xie #define FMQM_GC_ENQ_EN		0x80000000 /* enqueue enable */
2168225b2fdSShaohui Xie #define FMQM_GC_DEQ_EN		0x40000000 /* dequeue enable */
2178225b2fdSShaohui Xie #define FMQM_GC_STEN		0x10000000 /* enable global stat counters */
2188225b2fdSShaohui Xie #define FMQM_GC_ENQ_THR_MASK	0x00003f00 /* max number of enqueue Tnum */
2198225b2fdSShaohui Xie #define FMQM_GC_ENQ(x)		((x << 8) &  FMQM_GC_ENQ_THR_MAS)
2208225b2fdSShaohui Xie #define FMQM_GC_DEQ_THR_MASK	0x0000003f /* max number of dequeue Tnum */
2218225b2fdSShaohui Xie #define FMQM_GC_DEQ(x)		(x & FMQM_GC_DEQ_THR_MASK)
2228225b2fdSShaohui Xie 
2238225b2fdSShaohui Xie /* FMQM_EIE - error interrupt event register */
2248225b2fdSShaohui Xie #define FMQM_EIE_DEE		0x80000000 /* double-bit ECC error */
2258225b2fdSShaohui Xie #define FMQM_EIE_DFUPE		0x40000000 /* dequeue from unknown PortID */
2268225b2fdSShaohui Xie #define FMQM_EIE_CLEAR_ALL	(FMQM_EIE_DEE | FMQM_EIE_DFUPE)
2278225b2fdSShaohui Xie 
2288225b2fdSShaohui Xie /* FMQM_EIEN - error interrupt enable register */
2298225b2fdSShaohui Xie #define FMQM_EIEN_DEEN		0x80000000 /* double-bit ECC error */
2308225b2fdSShaohui Xie #define FMQM_EIEN_DFUPEN	0x40000000 /* dequeue from unknown PortID */
2318225b2fdSShaohui Xie #define FMQM_EIEN_DISABLE_ALL	0x00000000
2328225b2fdSShaohui Xie 
2338225b2fdSShaohui Xie /* FMQM_IE - interrupt event register */
2348225b2fdSShaohui Xie #define FMQM_IE_SEE		0x80000000 /* single-bit ECC error detected */
2358225b2fdSShaohui Xie #define FMQM_IE_CLEAR_ALL	FMQM_IE_SEE
2368225b2fdSShaohui Xie 
2378225b2fdSShaohui Xie /* FMQM_IEN - interrupt enable register */
2388225b2fdSShaohui Xie #define FMQM_IEN_SEE		0x80000000 /* single-bit ECC err IRQ enable */
2398225b2fdSShaohui Xie #define FMQM_IEN_DISABLE_ALL	0x00000000
2408225b2fdSShaohui Xie 
2418225b2fdSShaohui Xie /* NIA - next invoked action */
2428225b2fdSShaohui Xie #define NIA_ENG_RISC		0x00000000
2438225b2fdSShaohui Xie #define NIA_ENG_MASK		0x007c0000
2448225b2fdSShaohui Xie 
2458225b2fdSShaohui Xie /* action code */
2468225b2fdSShaohui Xie #define NIA_RISC_AC_CC		0x00000006
2478225b2fdSShaohui Xie #define NIA_RISC_AC_IM_TX	0x00000008 /* independent mode Tx */
2488225b2fdSShaohui Xie #define NIA_RISC_AC_IM_RX	0x0000000a /* independent mode Rx */
2498225b2fdSShaohui Xie #define NIA_RISC_AC_HC		0x0000000c
2508225b2fdSShaohui Xie 
2518225b2fdSShaohui Xie typedef struct fm_parser {
2528225b2fdSShaohui Xie 	u8	res[1024];
2538225b2fdSShaohui Xie } fm_parser_t;
2548225b2fdSShaohui Xie 
2558225b2fdSShaohui Xie typedef struct fm_policer {
2568225b2fdSShaohui Xie 	u8	res[4*1024];
2578225b2fdSShaohui Xie } fm_policer_t;
2588225b2fdSShaohui Xie 
2598225b2fdSShaohui Xie typedef struct fm_keygen {
2608225b2fdSShaohui Xie 	u8	res[4*1024];
2618225b2fdSShaohui Xie } fm_keygen_t;
2628225b2fdSShaohui Xie 
2638225b2fdSShaohui Xie typedef struct fm_dma {
2648225b2fdSShaohui Xie 	u32	fmdmsr;		/* status register */
2658225b2fdSShaohui Xie 	u32	fmdmmr;		/* mode register */
2668225b2fdSShaohui Xie 	u32	fmdmtr;		/* bus threshold register */
2678225b2fdSShaohui Xie 	u32	fmdmhy;		/* bus hysteresis register */
2688225b2fdSShaohui Xie 	u32	fmdmsetr;	/* SOS emergency threshold register */
2698225b2fdSShaohui Xie 	u32	fmdmtah;	/* transfer bus address high register */
2708225b2fdSShaohui Xie 	u32	fmdmtal;	/* transfer bus address low register */
2718225b2fdSShaohui Xie 	u32	fmdmtcid;	/* transfer bus communication ID register */
2728225b2fdSShaohui Xie 	u32	fmdmra;		/* DMA bus internal ram address register */
2738225b2fdSShaohui Xie 	u32	fmdmrd;		/* DMA bus internal ram data register */
2748225b2fdSShaohui Xie 	u32	res0[0xb];
2758225b2fdSShaohui Xie 	u32	fmdmdcr;	/* debug counter */
2768225b2fdSShaohui Xie 	u32	fmdmemsr;	/* emrgency smoother register */
2778225b2fdSShaohui Xie 	u32	res1;
2788225b2fdSShaohui Xie 	u32	fmdmplr[32];	/* FM DMA PID-LIODN # register */
2798225b2fdSShaohui Xie 	u32	res[0x3c8];
2808225b2fdSShaohui Xie } fm_dma_t;
2818225b2fdSShaohui Xie 
2828225b2fdSShaohui Xie /* FMDMSR - Fman DMA status register */
2838225b2fdSShaohui Xie #define FMDMSR_CMDQNE		0x10000000 /* command queue not empty */
2848225b2fdSShaohui Xie #define FMDMSR_BER		0x08000000 /* bus err event occurred on bus */
2858225b2fdSShaohui Xie #define FMDMSR_RDB_ECC		0x04000000 /* read buffer ECC error */
2868225b2fdSShaohui Xie #define FMDMSR_WRB_SECC		0x02000000 /* write buf ECC err sys side */
2878225b2fdSShaohui Xie #define FMDMSR_WRB_FECC		0x01000000 /* write buf ECC err Fman side */
2888225b2fdSShaohui Xie #define FMDMSR_DPEXT_SECC	0x00800000 /* DP external ECC err sys side */
2898225b2fdSShaohui Xie #define FMDMSR_DPEXT_FECC	0x00400000 /* DP external ECC err Fman side */
2908225b2fdSShaohui Xie #define FMDMSR_DPDAT_SECC	0x00200000 /* DP data ECC err on sys side */
2918225b2fdSShaohui Xie #define FMDMSR_DPDAT_FECC	0x00100000 /* DP data ECC err on Fman side */
2928225b2fdSShaohui Xie #define FMDMSR_SPDAT_FECC	0x00080000 /* SP data ECC error Fman side */
2938225b2fdSShaohui Xie 
2948225b2fdSShaohui Xie #define FMDMSR_CLEAR_ALL	(FMDMSR_BER | FMDMSR_RDB_ECC \
2958225b2fdSShaohui Xie 				| FMDMSR_WRB_SECC | FMDMSR_WRB_FECC \
2968225b2fdSShaohui Xie 				| FMDMSR_DPEXT_SECC | FMDMSR_DPEXT_FECC \
2978225b2fdSShaohui Xie 				| FMDMSR_DPDAT_SECC | FMDMSR_DPDAT_FECC \
2988225b2fdSShaohui Xie 				| FMDMSR_SPDAT_FECC)
2998225b2fdSShaohui Xie 
3008225b2fdSShaohui Xie /* FMDMMR - FMan DMA mode register */
3018225b2fdSShaohui Xie #define FMDMMR_SBER		0x10000000 /* stop the DMA if a bus error */
3028225b2fdSShaohui Xie 
3038225b2fdSShaohui Xie typedef struct fm_fpm {
3048225b2fdSShaohui Xie 	u32	fpmtnc;		/* TNUM control */
3058225b2fdSShaohui Xie 	u32	fpmprc;		/* Port_ID control */
3068225b2fdSShaohui Xie 	u32	res0;
3078225b2fdSShaohui Xie 	u32	fpmflc;		/* flush control */
3088225b2fdSShaohui Xie 	u32	fpmdis1;	/* dispatch thresholds1 */
3098225b2fdSShaohui Xie 	u32	fpmdis2;	/* dispatch thresholds2 */
3108225b2fdSShaohui Xie 	u32	fmepi;		/* error pending interrupts */
3118225b2fdSShaohui Xie 	u32	fmrie;		/* rams interrupt enable */
3128225b2fdSShaohui Xie 	u32	fpmfcevent[0x4];/* FMan controller event 0-3 */
3138225b2fdSShaohui Xie 	u32	res1[0x4];
3148225b2fdSShaohui Xie 	u32	fpmfcmask[0x4];	/* FMan controller mask 0-3 */
3158225b2fdSShaohui Xie 	u32	res2[0x4];
3168225b2fdSShaohui Xie 	u32	fpmtsc1;	/* timestamp control1 */
3178225b2fdSShaohui Xie 	u32	fpmtsc2;	/* timestamp control2 */
3188225b2fdSShaohui Xie 	u32	fpmtsp;		/* time stamp */
3198225b2fdSShaohui Xie 	u32	fpmtsf;		/* time stamp fraction */
3208225b2fdSShaohui Xie 	u32	fpmrcr;		/* rams control and event */
3218225b2fdSShaohui Xie 	u32	res3[0x3];
3228225b2fdSShaohui Xie 	u32	fpmdrd[0x4];	/* data_ram data 0-3 */
3238225b2fdSShaohui Xie 	u32	res4[0xc];
3248225b2fdSShaohui Xie 	u32	fpmdra;		/* data ram access */
3258225b2fdSShaohui Xie 	u32	fm_ip_rev_1;	/* IP block revision 1 */
3268225b2fdSShaohui Xie 	u32	fm_ip_rev_2;	/* IP block revision 2 */
3278225b2fdSShaohui Xie 	u32	fmrstc;		/* reset command */
3288225b2fdSShaohui Xie 	u32	fmcld;		/* classifier debug control */
3298225b2fdSShaohui Xie 	u32	fmnpi;		/* normal pending interrupts */
3308225b2fdSShaohui Xie 	u32	res5;
3318225b2fdSShaohui Xie 	u32	fmfpee;		/* event and enable */
3328225b2fdSShaohui Xie 	u32	fpmcev[0x4];	/* CPU event 0-3 */
3338225b2fdSShaohui Xie 	u32	res6[0x4];
3348225b2fdSShaohui Xie 	u32	fmfp_ps[0x40];	/* port status */
3358225b2fdSShaohui Xie 	u32	res7[0x260];
3368225b2fdSShaohui Xie 	u32	fpmts[0x80];	/* task status */
3378225b2fdSShaohui Xie 	u32	res8[0xa0];
3388225b2fdSShaohui Xie } fm_fpm_t;
3398225b2fdSShaohui Xie 
3408225b2fdSShaohui Xie /* FMFP_PRC - FPM Port_ID Control Register */
3418225b2fdSShaohui Xie #define FMFPPRC_PORTID_MASK	0x3f000000
3428225b2fdSShaohui Xie #define FMFPPRC_PORTID_SHIFT	24
3438225b2fdSShaohui Xie #define FMFPPRC_ORA_SHIFT	16
3448225b2fdSShaohui Xie #define FMFPPRC_RISC1		0x00000001
3458225b2fdSShaohui Xie #define FMFPPRC_RISC2		0x00000002
3468225b2fdSShaohui Xie #define FMFPPRC_RISC_ALL	(FMFPPRC_RISC1 | FMFPPRC_RSIC2)
3478225b2fdSShaohui Xie 
3488225b2fdSShaohui Xie /* FPM Flush Control Register */
3498225b2fdSShaohui Xie #define FMFP_FLC_DISP_LIM_NONE	0x00000000 /* no dispatch limitation */
3508225b2fdSShaohui Xie 
3518225b2fdSShaohui Xie /* FMFP_EE - FPM event and enable register */
3528225b2fdSShaohui Xie #define FMFPEE_DECC		0x80000000 /* double ECC err on FPM ram */
3538225b2fdSShaohui Xie #define FMFPEE_STL		0x40000000 /* stall of task ... */
3548225b2fdSShaohui Xie #define FMFPEE_SECC		0x20000000 /* single ECC error */
3558225b2fdSShaohui Xie #define FMFPEE_RFM		0x00010000 /* release FMan */
3568225b2fdSShaohui Xie #define FMFPEE_DECC_EN		0x00008000 /* double ECC interrupt enable */
3578225b2fdSShaohui Xie #define FMFPEE_STL_EN		0x00004000 /* stall of task interrupt enable */
3588225b2fdSShaohui Xie #define FMFPEE_SECC_EN		0x00002000 /* single ECC err interrupt enable */
3598225b2fdSShaohui Xie #define FMFPEE_EHM		0x00000008 /* external halt enable */
3608225b2fdSShaohui Xie #define FMFPEE_UEC		0x00000004 /* FMan is not halted */
3618225b2fdSShaohui Xie #define FMFPEE_CER		0x00000002 /* only errornous task stalled */
3628225b2fdSShaohui Xie #define FMFPEE_DER		0x00000001 /* DMA error is just reported */
3638225b2fdSShaohui Xie 
3648225b2fdSShaohui Xie #define FMFPEE_CLEAR_EVENT	(FMFPEE_DECC | FMFPEE_STL | FMFPEE_SECC | \
3658225b2fdSShaohui Xie 				 FMFPEE_EHM | FMFPEE_UEC | FMFPEE_CER | \
3668225b2fdSShaohui Xie 				 FMFPEE_DER | FMFPEE_RFM)
3678225b2fdSShaohui Xie 
3688225b2fdSShaohui Xie /* FMFP_RCR - FMan Rams Control and Event */
3698225b2fdSShaohui Xie #define FMFP_RCR_MDEC		0x00008000 /* double ECC error in muram */
3708225b2fdSShaohui Xie #define FMFP_RCR_IDEC		0x00004000 /* double ECC error in iram */
3718225b2fdSShaohui Xie 
3728225b2fdSShaohui Xie typedef struct fm_imem {
3738225b2fdSShaohui Xie 	u32	iadd;		/* instruction address register */
3748225b2fdSShaohui Xie 	u32	idata;		/* instruction data register */
3758225b2fdSShaohui Xie 	u32	itcfg;		/* timing config register */
3768225b2fdSShaohui Xie 	u32	iready;		/* ready register */
3778225b2fdSShaohui Xie 	u8	res[0xff0];
3788225b2fdSShaohui Xie } fm_imem_t;
3798225b2fdSShaohui Xie #define IRAM_IADD_AIE		0x80000000 /* address auto increase enable */
3808225b2fdSShaohui Xie #define IRAM_READY		0x80000000 /* ready to use */
3818225b2fdSShaohui Xie 
3828225b2fdSShaohui Xie typedef struct fm_soft_parser {
3838225b2fdSShaohui Xie 	u8	res[4*1024];
3848225b2fdSShaohui Xie } fm_soft_parser_t;
3858225b2fdSShaohui Xie 
3868225b2fdSShaohui Xie typedef struct fm_dtesc {
3878225b2fdSShaohui Xie 	u8	res[4*1024];
3888225b2fdSShaohui Xie } fm_dtsec_t;
3898225b2fdSShaohui Xie 
3908225b2fdSShaohui Xie typedef struct fm_mdio {
3918225b2fdSShaohui Xie 	u8	res0[0x120];
3928225b2fdSShaohui Xie 	u32	miimcfg;	/* MII management configuration reg */
3938225b2fdSShaohui Xie 	u32	miimcom;	/* MII management command reg */
3948225b2fdSShaohui Xie 	u32	miimadd;	/* MII management address reg */
3958225b2fdSShaohui Xie 	u32	miimcon;	/* MII management control reg */
3968225b2fdSShaohui Xie 	u32	miimstat;	/* MII management status reg  */
3978225b2fdSShaohui Xie 	u32	miimind;	/* MII management indication reg */
3988225b2fdSShaohui Xie 	u8	res1[0x1000 - 0x138];
3998225b2fdSShaohui Xie } fm_mdio_t;
4008225b2fdSShaohui Xie 
4018225b2fdSShaohui Xie typedef struct fm_10gec {
4028225b2fdSShaohui Xie 	u8	res[4*1024];
4038225b2fdSShaohui Xie } fm_10gec_t;
4048225b2fdSShaohui Xie 
4058225b2fdSShaohui Xie typedef struct fm_10gec_mdio {
4068225b2fdSShaohui Xie 	u8	res[4*1024];
4078225b2fdSShaohui Xie } fm_10gec_mdio_t;
4088225b2fdSShaohui Xie 
4098225b2fdSShaohui Xie typedef struct fm_memac {
4108225b2fdSShaohui Xie 	u8	res[4*1024];
4118225b2fdSShaohui Xie } fm_memac_t;
4128225b2fdSShaohui Xie 
4138225b2fdSShaohui Xie typedef struct fm_memac_mdio {
4148225b2fdSShaohui Xie 	u8	res[4*1024];
4158225b2fdSShaohui Xie } fm_memac_mdio_t;
4168225b2fdSShaohui Xie 
4178225b2fdSShaohui Xie typedef struct fm_1588 {
4188225b2fdSShaohui Xie 	u8	res[4*1024];
4198225b2fdSShaohui Xie } fm_1588_t;
4208225b2fdSShaohui Xie 
4218225b2fdSShaohui Xie typedef struct ccsr_fman {
4228225b2fdSShaohui Xie 	u8			muram[0x80000];
4238225b2fdSShaohui Xie 	fm_bmi_common_t		fm_bmi_common;
4248225b2fdSShaohui Xie 	fm_qmi_common_t		fm_qmi_common;
4258225b2fdSShaohui Xie 	u8			res0[2048];
4268225b2fdSShaohui Xie 	struct {
4278225b2fdSShaohui Xie 		fm_bmi_t	fm_bmi;
4288225b2fdSShaohui Xie 		fm_qmi_t	fm_qmi;
4298225b2fdSShaohui Xie 		fm_parser_t	fm_parser;
4308225b2fdSShaohui Xie 		u8		res[1024];
4318225b2fdSShaohui Xie 	} port[63];
4328225b2fdSShaohui Xie 	fm_policer_t		fm_policer;
4338225b2fdSShaohui Xie 	fm_keygen_t		fm_keygen;
4348225b2fdSShaohui Xie 	fm_dma_t		fm_dma;
4358225b2fdSShaohui Xie 	fm_fpm_t		fm_fpm;
4368225b2fdSShaohui Xie 	fm_imem_t		fm_imem;
4378225b2fdSShaohui Xie 	u8			res1[8*1024];
4388225b2fdSShaohui Xie 	fm_soft_parser_t	fm_soft_parser;
4398225b2fdSShaohui Xie 	u8			res2[96*1024];
4408225b2fdSShaohui Xie #ifdef CONFIG_SYS_FMAN_V3
4418225b2fdSShaohui Xie 	struct {
4428225b2fdSShaohui Xie 		fm_memac_t		fm_memac;
4438225b2fdSShaohui Xie 		fm_memac_mdio_t		fm_memac_mdio;
4448225b2fdSShaohui Xie 	} memac[10];
4458225b2fdSShaohui Xie 	u8			res4[32*1024];
4468225b2fdSShaohui Xie 	fm_memac_mdio_t		fm_dedicated_mdio[2];
4478225b2fdSShaohui Xie #else
4488225b2fdSShaohui Xie 	struct {
4498225b2fdSShaohui Xie 		fm_dtsec_t	fm_dtesc;
4508225b2fdSShaohui Xie 		fm_mdio_t	fm_mdio;
4518225b2fdSShaohui Xie 	} mac_1g[8];		/* support up to 8 1g controllers */
4528225b2fdSShaohui Xie 	struct {
4538225b2fdSShaohui Xie 		fm_10gec_t		fm_10gec;
4548225b2fdSShaohui Xie 		fm_10gec_mdio_t		fm_10gec_mdio;
4558225b2fdSShaohui Xie 	} mac_10g[1];
4568225b2fdSShaohui Xie 	u8			res4[48*1024];
4578225b2fdSShaohui Xie #endif
4588225b2fdSShaohui Xie 	fm_1588_t		fm_1588;
4598225b2fdSShaohui Xie 	u8			res5[4*1024];
4608225b2fdSShaohui Xie } ccsr_fman_t;
4618225b2fdSShaohui Xie 
462075affb1SQianyu Gong void fdt_fixup_fman_firmware(void *blob);
4638225b2fdSShaohui Xie #endif /*__FSL_FMAN_H__*/
464