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