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