1 /*
2  * Copyright 2010-2011 Freescale Semiconductor, Inc.
3  *
4  * See file CREDITS for list of people who contributed to this
5  * project.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20  * MA 02111-1307 USA
21  */
22 
23 #include <common.h>
24 #include <asm/fsl_portals.h>
25 #include <asm/fsl_liodn.h>
26 
27 struct qportal_info qp_info[CONFIG_SYS_QMAN_NUM_PORTALS] = {
28 	/* dqrr liodn, frame data liodn, liodn off, sdest */
29 	SET_QP_INFO( 1,  2,  1, 0),
30 	SET_QP_INFO( 3,  4,  2, 1),
31 	SET_QP_INFO( 5,  6,  3, 2),
32 	SET_QP_INFO( 7,  8,  4, 3),
33 	SET_QP_INFO( 9, 10,  5, 4),
34 	SET_QP_INFO(11, 12,  6, 5),
35 	SET_QP_INFO(13, 14,  7, 6),
36 	SET_QP_INFO(15, 16,  8, 7),
37 	SET_QP_INFO(17, 18,  9, 0), /* for now sdest to 0 */
38 	SET_QP_INFO(19, 20, 10, 0), /* for now sdest to 0 */
39 };
40 
41 struct liodn_id_table liodn_tbl[] = {
42 	SET_USB_LIODN(1, "fsl-usb2-mph", 127),
43 	SET_USB_LIODN(2, "fsl-usb2-dr", 157),
44 
45 	SET_SDHC_LIODN(1, 156),
46 
47 	SET_PCI_LIODN("fsl,p4080-pcie", 1, 193),
48 	SET_PCI_LIODN("fsl,p4080-pcie", 2, 194),
49 	SET_PCI_LIODN("fsl,p4080-pcie", 3, 195),
50 
51 	SET_DMA_LIODN(1, 196),
52 	SET_DMA_LIODN(2, 197),
53 
54 	SET_GUTS_LIODN("fsl,rapidio-delta", 198, rio1liodnr, 0),
55 	SET_GUTS_LIODN(NULL, 199, rio2liodnr, 0),
56 	SET_GUTS_LIODN(NULL, 200, rmuliodnr, 0),
57 
58 	SET_QMAN_LIODN(31),
59 	SET_BMAN_LIODN(32),
60 	SET_PME_LIODN(128),
61 };
62 
63 #ifdef CONFIG_SYS_DPAA_FMAN
64 struct liodn_id_table fman1_liodn_tbl[] = {
65 	SET_FMAN_RX_1G_LIODN(1, 0, 11),
66 	SET_FMAN_RX_1G_LIODN(1, 1, 12),
67 	SET_FMAN_RX_1G_LIODN(1, 2, 13),
68 	SET_FMAN_RX_1G_LIODN(1, 3, 14),
69 	SET_FMAN_RX_10G_LIODN(1, 0, 15),
70 };
71 
72 #if (CONFIG_SYS_NUM_FMAN == 2)
73 struct liodn_id_table fman2_liodn_tbl[] = {
74 	SET_FMAN_RX_1G_LIODN(2, 0, 16),
75 	SET_FMAN_RX_1G_LIODN(2, 1, 17),
76 	SET_FMAN_RX_1G_LIODN(2, 2, 18),
77 	SET_FMAN_RX_1G_LIODN(2, 3, 19),
78 	SET_FMAN_RX_10G_LIODN(2, 0, 20),
79 };
80 #endif
81 #endif
82 
83 struct liodn_id_table sec_liodn_tbl[] = {
84 	/*
85 	 * We assume currently that all JR are in the same partition
86 	 * and as such they need to represent the same LIODN due to
87 	 * a 4080 rev.2 h/w requirement that DECOs sharing from themselves
88 	 * or from another DECO have the two Non-SEQ LIODN values equal
89 	 */
90 	SET_SEC_JR_LIODN_ENTRY(0, 146, 154), /* (0, 146, 154), */
91 	SET_SEC_JR_LIODN_ENTRY(1, 146, 154), /* (1, 147, 155), */
92 	SET_SEC_JR_LIODN_ENTRY(2, 146, 154), /* (2, 178, 186), */
93 	SET_SEC_JR_LIODN_ENTRY(3, 146, 154), /* (3, 179, 187), */
94 	SET_SEC_RTIC_LIODN_ENTRY(a, 144),
95 	SET_SEC_RTIC_LIODN_ENTRY(b, 145),
96 	SET_SEC_RTIC_LIODN_ENTRY(c, 176),
97 	SET_SEC_RTIC_LIODN_ENTRY(d, 177),
98 	SET_SEC_DECO_LIODN_ENTRY(0, 129, 161),
99 	SET_SEC_DECO_LIODN_ENTRY(1, 130, 162),
100 	SET_SEC_DECO_LIODN_ENTRY(2, 131, 163),
101 	SET_SEC_DECO_LIODN_ENTRY(3, 132, 164),
102 	SET_SEC_DECO_LIODN_ENTRY(4, 133, 165),
103 };
104 
105 struct liodn_id_table liodn_bases[] = {
106 	[FSL_HW_PORTAL_SEC]  = SET_LIODN_BASE_2(96, 106),
107 #ifdef CONFIG_SYS_DPAA_FMAN
108 	[FSL_HW_PORTAL_FMAN1] = SET_LIODN_BASE_1(32),
109 #if (CONFIG_SYS_NUM_FMAN == 2)
110 	[FSL_HW_PORTAL_FMAN2] = SET_LIODN_BASE_1(64),
111 #endif
112 #endif
113 #ifdef CONFIG_SYS_DPAA_PME
114 	[FSL_HW_PORTAL_PME]   = SET_LIODN_BASE_2(116, 133),
115 #endif
116 };
117 
118 int liodn_tbl_sz = ARRAY_SIZE(liodn_tbl);
119 int fman1_liodn_tbl_sz = ARRAY_SIZE(fman1_liodn_tbl);
120 int fman2_liodn_tbl_sz = ARRAY_SIZE(fman2_liodn_tbl);
121 int sec_liodn_tbl_sz = ARRAY_SIZE(sec_liodn_tbl);
122