2 * Copyright 2009 Freescale Semiconductor, Inc.
4 * See file CREDITS for list of people who contributed to this
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.
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.
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,
24 #include <asm/fsl_law.h>
32 /* The agent field is a bit mask in which each bit represents the value of
33 * cfg_host_agt[] signal and the bit is set of the given interface would be
34 * in agent/end-point mode for the given interface.
36 * The same idea is true of the cfg field. The bit will be set if the
37 * interface would be enabled based on the value of cfg_IO_ports[] signal
39 * On MPC86xx/PQ3 based systems:
40 * we extract cfg_host_agt from GUTS register PORBMSR
41 * we extract cfg_IO_ports from GUTS register PORDEVSR
43 * cfg_IO_ports only exist on systems w/PCIe (we set cfg 0 for systems
47 #if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8560)
48 static struct pci_info pci_config_info[] =
51 .agent = (1 << 0) | (1 << 2),
55 #elif defined(CONFIG_MPC8541) || defined(CONFIG_MPC8555)
56 static struct pci_info pci_config_info[] =
63 #elif defined(CONFIG_MPC8536)
64 static struct pci_info pci_config_info[] =
70 [LAW_TRGT_IF_PCIE_1] = {
72 .cfg = (1 << 2) | (1 << 3) | (1 << 5) | (1 << 7),
74 [LAW_TRGT_IF_PCIE_2] = {
76 .cfg = (1 << 5) | (1 << 7),
78 [LAW_TRGT_IF_PCIE_3] = {
83 #elif defined(CONFIG_MPC8544)
84 static struct pci_info pci_config_info[] =
90 [LAW_TRGT_IF_PCIE_1] = {
92 .cfg = (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) |
95 [LAW_TRGT_IF_PCIE_2] = {
97 .cfg = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7),
99 [LAW_TRGT_IF_PCIE_3] = {
101 .cfg = (1 << 6) | (1 << 7),
104 #elif defined(CONFIG_MPC8548)
105 static struct pci_info pci_config_info[] =
107 [LAW_TRGT_IF_PCI_1] = {
108 .agent = (1 << 4) | (1 << 6),
111 [LAW_TRGT_IF_PCI_2] = {
112 .agent = (1 << 4) | (1 << 6),
115 /* PCI_2 is always host and we dont use iosel to determine enable/disable */
116 [LAW_TRGT_IF_PCIE_1] = {
117 .agent = (1 << 0) | (1 << 2),
118 .cfg = (1 << 3) | (1 << 4) | (1 << 7),
121 #elif defined(CONFIG_MPC8568)
122 static struct pci_info pci_config_info[] =
124 [LAW_TRGT_IF_PCI] = {
125 .agent = (1 << 0) | (1 << 4) | (1 << 6),
128 [LAW_TRGT_IF_PCIE_1] = {
129 .agent = (1 << 0) | (1 << 2) | (1 << 4),
130 .cfg = (1 << 3) | (1 << 4) | (1 << 7),
133 #elif defined(CONFIG_MPC8569)
134 static struct pci_info pci_config_info[] =
136 [LAW_TRGT_IF_PCIE_1] = {
137 .agent = (1 << 0) | (1 << 6),
138 .cfg = (1 << 0) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) |
139 (1 << 8) | (1 << 0xc) | (1 << 0xf),
142 #elif defined(CONFIG_MPC8572)
143 static struct pci_info pci_config_info[] =
145 [LAW_TRGT_IF_PCIE_1] = {
146 .agent = (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5),
147 .cfg = (1 << 2) | (1 << 3) | (1 << 7) |
148 (1 << 0xb) | (1 << 0xc) | (1 << 0xf),
150 [LAW_TRGT_IF_PCIE_2] = {
151 .agent = (1 << 0) | (1 << 2) | (1 << 4) | (1 << 6),
152 .cfg = (1 << 3) | (1 << 7),
154 [LAW_TRGT_IF_PCIE_3] = {
155 .agent = (1 << 0) | (1 << 3) | (1 << 5) | (1 << 6),
159 #elif defined(CONFIG_MPC8610)
160 static struct pci_info pci_config_info[] =
162 [LAW_TRGT_IF_PCI_1] = {
163 .agent = (1 << 4) | (1 << 5) | (1 << 6),
166 [LAW_TRGT_IF_PCIE_1] = {
167 .agent = (1 << 0) | (1 << 2) | (1 << 5),
168 .cfg = (1 << 1) | (1 << 4),
170 [LAW_TRGT_IF_PCIE_2] = {
171 .agent = (1 << 0) | (1 << 1) | (1 << 4),
172 .cfg = (1 << 0) | (1 << 4),
175 #elif defined(CONFIG_MPC8641)
176 static struct pci_info pci_config_info[] =
178 [LAW_TRGT_IF_PCIE_1] = {
179 .agent = 0, /* we dont use agent on 8641 */
180 .cfg = (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) |
181 (1 << 7) | (1 << 0xe) | (1 << 0xf),
184 #elif defined(CONFIG_P1011) || defined(CONFIG_P1020)
185 static struct pci_info pci_config_info[] =
187 [LAW_TRGT_IF_PCIE_1] = {
188 .agent = (1 << 0) | (1 << 1),
189 .cfg = (1 << 0) | (1 << 6) | (1 << 0xe) | (1 << 0xf),
191 [LAW_TRGT_IF_PCIE_2] = {
192 .agent = (1 << 0) | (1 << 2),
196 #elif defined(CONFIG_P2010) || defined(CONFIG_P2020)
197 static struct pci_info pci_config_info[] =
199 [LAW_TRGT_IF_PCIE_1] = {
200 .agent = (1 << 0) | (1 << 1) | (1 << 4) | (1 << 5),
201 .cfg = (1 << 0) | (1 << 2) | (1 << 4) | (1 << 6) |
202 (1 << 0xd) | (1 << 0xe) | (1 << 0xf),
204 [LAW_TRGT_IF_PCIE_2] = {
205 .agent = (1 << 0) | (1 << 2) | (1 << 4) | (1 << 6),
206 .cfg = (1 << 2) | (1 << 0xe),
208 [LAW_TRGT_IF_PCIE_3] = {
209 .agent = (1 << 0) | (1 << 3) | (1 << 5) | (1 << 6),
210 .cfg = (1 << 2) | (1 << 4),
214 #error Need to define pci_config_info for processor
217 int is_fsl_pci_agent(enum law_trgt_if trgt, u32 host_agent)
219 return ((1 << host_agent) & pci_config_info[trgt].agent);
222 int is_fsl_pci_cfg(enum law_trgt_if trgt, u32 io_sel)
224 return ((1 << io_sel) & pci_config_info[trgt].cfg);