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 #ifdef CONFIG_SYS_DPAA_QBMAN
28 struct qportal_info qp_info[CONFIG_SYS_QMAN_NUM_PORTALS] = {
29 	/* dqrr liodn, frame data liodn, liodn off, sdest */
30 	SET_QP_INFO(1, 2, 1, 0),
31 	SET_QP_INFO(3, 4, 2, 1),
32 	SET_QP_INFO(5, 6, 3, 2),
33 	SET_QP_INFO(7, 8, 4, 3),
34 	SET_QP_INFO(9, 10, 5, 0),
35 	SET_QP_INFO(11, 12, 6, 1),
36 	SET_QP_INFO(13, 14, 7, 2),
37 	SET_QP_INFO(15, 16, 8, 3),
38 	SET_QP_INFO(17, 18, 9, 0),	/* for now, set sdest to 0 */
39 	SET_QP_INFO(19, 20, 10, 0),	/* for now, set sdest to 0 */
40 };
41 #endif
42 
43 struct liodn_id_table liodn_tbl[] = {
44 #ifdef CONFIG_SYS_DPAA_QBMAN
45 	SET_QMAN_LIODN(31),
46 	SET_BMAN_LIODN(32),
47 #endif
48 
49 	SET_SDHC_LIODN(1, 64),
50 
51 	SET_USB_LIODN(1, "fsl-usb2-mph", 93),
52 	SET_USB_LIODN(2, "fsl-usb2-dr", 94),
53 
54 	SET_SATA_LIODN(1, 95),
55 	SET_SATA_LIODN(2, 96),
56 
57 	SET_PCI_LIODN_BASE(CONFIG_SYS_FSL_PCIE_COMPAT, 1, 195),
58 	SET_PCI_LIODN_BASE(CONFIG_SYS_FSL_PCIE_COMPAT, 2, 196),
59 	SET_PCI_LIODN_BASE(CONFIG_SYS_FSL_PCIE_COMPAT, 3, 197),
60 
61 	SET_DMA_LIODN(1, 193),
62 	SET_DMA_LIODN(2, 194),
63 };
64 int liodn_tbl_sz = ARRAY_SIZE(liodn_tbl);
65 
66 #ifdef CONFIG_SYS_DPAA_FMAN
67 struct liodn_id_table fman1_liodn_tbl[] = {
68 	SET_FMAN_RX_1G_LIODN(1, 0, 6),
69 	SET_FMAN_RX_1G_LIODN(1, 1, 7),
70 	SET_FMAN_RX_1G_LIODN(1, 2, 8),
71 	SET_FMAN_RX_1G_LIODN(1, 3, 9),
72 	SET_FMAN_RX_1G_LIODN(1, 4, 10),
73 	SET_FMAN_RX_10G_LIODN(1, 0, 11),
74 };
75 int fman1_liodn_tbl_sz = ARRAY_SIZE(fman1_liodn_tbl);
76 
77 #if (CONFIG_SYS_NUM_FMAN == 2)
78 struct liodn_id_table fman2_liodn_tbl[] = {
79 	SET_FMAN_RX_1G_LIODN(2, 0, 12),
80 	SET_FMAN_RX_1G_LIODN(2, 1, 13),
81 	SET_FMAN_RX_1G_LIODN(2, 2, 14),
82 	SET_FMAN_RX_1G_LIODN(2, 3, 15),
83 	SET_FMAN_RX_1G_LIODN(2, 4, 16),
84 	SET_FMAN_RX_10G_LIODN(2, 0, 17),
85 };
86 int fman2_liodn_tbl_sz = ARRAY_SIZE(fman2_liodn_tbl);
87 #endif
88 #endif
89 
90 struct liodn_id_table sec_liodn_tbl[] = {
91 	SET_SEC_JR_LIODN_ENTRY(0, 129, 130),
92 	SET_SEC_JR_LIODN_ENTRY(1, 131, 132),
93 	SET_SEC_JR_LIODN_ENTRY(2, 133, 134),
94 	SET_SEC_JR_LIODN_ENTRY(3, 135, 136),
95 	SET_SEC_RTIC_LIODN_ENTRY(a, 89),
96 	SET_SEC_RTIC_LIODN_ENTRY(b, 90),
97 	SET_SEC_RTIC_LIODN_ENTRY(c, 91),
98 	SET_SEC_RTIC_LIODN_ENTRY(d, 92),
99 	SET_SEC_DECO_LIODN_ENTRY(0, 139, 140),
100 	SET_SEC_DECO_LIODN_ENTRY(1, 141, 142),
101 	SET_SEC_DECO_LIODN_ENTRY(2, 143, 144),
102 	SET_SEC_DECO_LIODN_ENTRY(3, 145, 146),
103 };
104 int sec_liodn_tbl_sz = ARRAY_SIZE(sec_liodn_tbl);
105 
106 #ifdef CONFIG_SYS_FSL_RAID_ENGINE
107 struct liodn_id_table raide_liodn_tbl[] = {
108 	SET_RAID_ENGINE_JQ_LIODN_ENTRY(0, 0, 60),
109 	SET_RAID_ENGINE_JQ_LIODN_ENTRY(0, 1, 61),
110 	SET_RAID_ENGINE_JQ_LIODN_ENTRY(1, 0, 62),
111 	SET_RAID_ENGINE_JQ_LIODN_ENTRY(1, 1, 63),
112 };
113 int raide_liodn_tbl_sz = ARRAY_SIZE(raide_liodn_tbl);
114 #endif
115 
116 struct liodn_id_table liodn_bases[] = {
117 	[FSL_HW_PORTAL_SEC]  = SET_LIODN_BASE_2(64, 101),
118 #ifdef CONFIG_SYS_DPAA_FMAN
119 	[FSL_HW_PORTAL_FMAN1] = SET_LIODN_BASE_1(32),
120 #endif
121 #if (CONFIG_SYS_NUM_FMAN == 2)
122 	[FSL_HW_PORTAL_FMAN2] = SET_LIODN_BASE_1(160),
123 #endif
124 #ifdef CONFIG_SYS_FSL_RAID_ENGINE
125 	[FSL_HW_PORTAL_RAID_ENGINE]  = SET_LIODN_BASE_1(49),
126 #endif
127 };
128