1 /*
2  * Copyright 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 sdest to 0 */
23 	SET_QP_INFO(19, 20, 10, 0), /* for now sdest to 0 */
24 };
25 #endif
26 
27 struct srio_liodn_id_table srio_liodn_tbl[] = {
28 	SET_SRIO_LIODN_2(1, 199, 200),
29 	SET_SRIO_LIODN_2(2, 201, 202),
30 };
31 int srio_liodn_tbl_sz = ARRAY_SIZE(srio_liodn_tbl);
32 
33 struct liodn_id_table liodn_tbl[] = {
34 #ifdef CONFIG_SYS_DPAA_QBMAN
35 	SET_QMAN_LIODN(31),
36 	SET_BMAN_LIODN(32),
37 #endif
38 
39 	SET_SDHC_LIODN(1, 64),
40 
41 	SET_PME_LIODN(117),
42 
43 	SET_USB_LIODN(1, "fsl-usb2-mph", 125),
44 	SET_USB_LIODN(2, "fsl-usb2-dr", 126),
45 
46 	SET_SATA_LIODN(1, 127),
47 	SET_SATA_LIODN(2, 128),
48 
49 	SET_PCI_LIODN(CONFIG_SYS_FSL_PCIE_COMPAT, 1, 193),
50 	SET_PCI_LIODN(CONFIG_SYS_FSL_PCIE_COMPAT, 2, 194),
51 	SET_PCI_LIODN(CONFIG_SYS_FSL_PCIE_COMPAT, 3, 195),
52 
53 	SET_DMA_LIODN(1, "fsl,eloplus-dma", 197),
54 	SET_DMA_LIODN(2, "fsl,eloplus-dma", 198),
55 
56 	SET_GUTS_LIODN("fsl,rapidio-delta", 199, rio1liodnr, 0),
57 	SET_GUTS_LIODN(NULL, 200, rio2liodnr, 0),
58 	SET_GUTS_LIODN(NULL, 201, rio1maintliodnr, 0),
59 	SET_GUTS_LIODN(NULL, 202, rio2maintliodnr, 0),
60 };
61 int liodn_tbl_sz = ARRAY_SIZE(liodn_tbl);
62 
63 #ifdef CONFIG_SYS_DPAA_FMAN
64 struct liodn_id_table fman1_liodn_tbl[] = {
65 	SET_FMAN_RX_1G_LIODN(1, 0, 10),
66 	SET_FMAN_RX_1G_LIODN(1, 1, 11),
67 	SET_FMAN_RX_1G_LIODN(1, 2, 12),
68 	SET_FMAN_RX_1G_LIODN(1, 3, 13),
69 	SET_FMAN_RX_1G_LIODN(1, 4, 14),
70 #if (CONFIG_SYS_NUM_FM1_10GEC == 1)
71 	SET_FMAN_RX_10G_LIODN(1, 0, 15),
72 #endif
73 };
74 int fman1_liodn_tbl_sz = ARRAY_SIZE(fman1_liodn_tbl);
75 #endif
76 
77 struct liodn_id_table sec_liodn_tbl[] = {
78 	SET_SEC_JR_LIODN_ENTRY(0, 129, 130),
79 	SET_SEC_JR_LIODN_ENTRY(1, 131, 132),
80 	SET_SEC_JR_LIODN_ENTRY(2, 133, 134),
81 	SET_SEC_JR_LIODN_ENTRY(3, 135, 136),
82 	SET_SEC_RTIC_LIODN_ENTRY(a, 154),
83 	SET_SEC_RTIC_LIODN_ENTRY(b, 155),
84 	SET_SEC_RTIC_LIODN_ENTRY(c, 156),
85 	SET_SEC_RTIC_LIODN_ENTRY(d, 157),
86 	SET_SEC_DECO_LIODN_ENTRY(0, 97, 98),
87 	SET_SEC_DECO_LIODN_ENTRY(1, 99, 100),
88 };
89 int sec_liodn_tbl_sz = ARRAY_SIZE(sec_liodn_tbl);
90 
91 #ifdef CONFIG_SYS_DPAA_RMAN
92 struct liodn_id_table rman_liodn_tbl[] = {
93 	/* Set RMan block 0-3 liodn offset */
94 	SET_RMAN_LIODN(0, 6),
95 	SET_RMAN_LIODN(1, 7),
96 	SET_RMAN_LIODN(2, 8),
97 	SET_RMAN_LIODN(3, 9),
98 };
99 int rman_liodn_tbl_sz = ARRAY_SIZE(rman_liodn_tbl);
100 #endif
101 
102 struct liodn_id_table liodn_bases[] = {
103 	[FSL_HW_PORTAL_SEC]  = SET_LIODN_BASE_2(64, 100),
104 #ifdef CONFIG_SYS_DPAA_FMAN
105 	[FSL_HW_PORTAL_FMAN1] = SET_LIODN_BASE_1(32),
106 #endif
107 #ifdef CONFIG_SYS_DPAA_PME
108 	[FSL_HW_PORTAL_PME]   = SET_LIODN_BASE_2(136, 172),
109 #endif
110 #ifdef CONFIG_SYS_DPAA_RMAN
111 	[FSL_HW_PORTAL_RMAN] = SET_LIODN_BASE_1(80),
112 #endif
113 };
114