diff options
author | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2014-11-21 06:29:25 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-12-27 20:19:16 -0500 |
commit | c88d54ba0c3d89b925bfb8e98b13a3f55b55cde4 (patch) | |
tree | 35d6acc2072315c98b30d9fe23c3ef746815a64c /arch/arm | |
parent | 7c674700098c87b305b99652e3c694c4ef195866 (diff) |
CNS3xxx: Remove artificial dependency on pci_sys_data domain.
On cns3xxx platforms the PCI controller probing code relies on an
artificial dependency on the domain number to look-up the internal data
structures.
This patch reworks the host controller control data structure and adds a
domain equivalent field named port in it so that the dependency on
pci_sys_data domain field can be eventually removed.
Acked-by: Krzysztof HaĆasa <khalasa@piap.pl>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[lp: added commit log, removed pci_sys_data domain references]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-cns3xxx/pcie.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c index 45d6bd09e6ef..f6bf9f623d70 100644 --- a/arch/arm/mach-cns3xxx/pcie.c +++ b/arch/arm/mach-cns3xxx/pcie.c | |||
@@ -30,18 +30,15 @@ struct cns3xxx_pcie { | |||
30 | unsigned int irqs[2]; | 30 | unsigned int irqs[2]; |
31 | struct resource res_io; | 31 | struct resource res_io; |
32 | struct resource res_mem; | 32 | struct resource res_mem; |
33 | struct hw_pci hw_pci; | 33 | int port; |
34 | |||
35 | bool linked; | 34 | bool linked; |
36 | }; | 35 | }; |
37 | 36 | ||
38 | static struct cns3xxx_pcie cns3xxx_pcie[]; /* forward decl. */ | ||
39 | |||
40 | static struct cns3xxx_pcie *sysdata_to_cnspci(void *sysdata) | 37 | static struct cns3xxx_pcie *sysdata_to_cnspci(void *sysdata) |
41 | { | 38 | { |
42 | struct pci_sys_data *root = sysdata; | 39 | struct pci_sys_data *root = sysdata; |
43 | 40 | ||
44 | return &cns3xxx_pcie[root->domain]; | 41 | return root->private_data; |
45 | } | 42 | } |
46 | 43 | ||
47 | static struct cns3xxx_pcie *pdev_to_cnspci(const struct pci_dev *dev) | 44 | static struct cns3xxx_pcie *pdev_to_cnspci(const struct pci_dev *dev) |
@@ -192,13 +189,7 @@ static struct cns3xxx_pcie cns3xxx_pcie[] = { | |||
192 | .flags = IORESOURCE_MEM, | 189 | .flags = IORESOURCE_MEM, |
193 | }, | 190 | }, |
194 | .irqs = { IRQ_CNS3XXX_PCIE0_RC, IRQ_CNS3XXX_PCIE0_DEVICE, }, | 191 | .irqs = { IRQ_CNS3XXX_PCIE0_RC, IRQ_CNS3XXX_PCIE0_DEVICE, }, |
195 | .hw_pci = { | 192 | .port = 0, |
196 | .domain = 0, | ||
197 | .nr_controllers = 1, | ||
198 | .ops = &cns3xxx_pcie_ops, | ||
199 | .setup = cns3xxx_pci_setup, | ||
200 | .map_irq = cns3xxx_pcie_map_irq, | ||
201 | }, | ||
202 | }, | 193 | }, |
203 | [1] = { | 194 | [1] = { |
204 | .host_regs = (void __iomem *)CNS3XXX_PCIE1_HOST_BASE_VIRT, | 195 | .host_regs = (void __iomem *)CNS3XXX_PCIE1_HOST_BASE_VIRT, |
@@ -217,19 +208,13 @@ static struct cns3xxx_pcie cns3xxx_pcie[] = { | |||
217 | .flags = IORESOURCE_MEM, | 208 | .flags = IORESOURCE_MEM, |
218 | }, | 209 | }, |
219 | .irqs = { IRQ_CNS3XXX_PCIE1_RC, IRQ_CNS3XXX_PCIE1_DEVICE, }, | 210 | .irqs = { IRQ_CNS3XXX_PCIE1_RC, IRQ_CNS3XXX_PCIE1_DEVICE, }, |
220 | .hw_pci = { | 211 | .port = 1, |
221 | .domain = 1, | ||
222 | .nr_controllers = 1, | ||
223 | .ops = &cns3xxx_pcie_ops, | ||
224 | .setup = cns3xxx_pci_setup, | ||
225 | .map_irq = cns3xxx_pcie_map_irq, | ||
226 | }, | ||
227 | }, | 212 | }, |
228 | }; | 213 | }; |
229 | 214 | ||
230 | static void __init cns3xxx_pcie_check_link(struct cns3xxx_pcie *cnspci) | 215 | static void __init cns3xxx_pcie_check_link(struct cns3xxx_pcie *cnspci) |
231 | { | 216 | { |
232 | int port = cnspci->hw_pci.domain; | 217 | int port = cnspci->port; |
233 | u32 reg; | 218 | u32 reg; |
234 | unsigned long time; | 219 | unsigned long time; |
235 | 220 | ||
@@ -260,9 +245,9 @@ static void __init cns3xxx_pcie_check_link(struct cns3xxx_pcie *cnspci) | |||
260 | 245 | ||
261 | static void __init cns3xxx_pcie_hw_init(struct cns3xxx_pcie *cnspci) | 246 | static void __init cns3xxx_pcie_hw_init(struct cns3xxx_pcie *cnspci) |
262 | { | 247 | { |
263 | int port = cnspci->hw_pci.domain; | 248 | int port = cnspci->port; |
264 | struct pci_sys_data sd = { | 249 | struct pci_sys_data sd = { |
265 | .domain = port, | 250 | .private_data = cnspci, |
266 | }; | 251 | }; |
267 | struct pci_bus bus = { | 252 | struct pci_bus bus = { |
268 | .number = 0, | 253 | .number = 0, |
@@ -323,6 +308,14 @@ static int cns3xxx_pcie_abort_handler(unsigned long addr, unsigned int fsr, | |||
323 | void __init cns3xxx_pcie_init_late(void) | 308 | void __init cns3xxx_pcie_init_late(void) |
324 | { | 309 | { |
325 | int i; | 310 | int i; |
311 | void *private_data; | ||
312 | struct hw_pci hw_pci = { | ||
313 | .nr_controllers = 1, | ||
314 | .ops = &cns3xxx_pcie_ops, | ||
315 | .setup = cns3xxx_pci_setup, | ||
316 | .map_irq = cns3xxx_pcie_map_irq, | ||
317 | .private_data = &private_data, | ||
318 | }; | ||
326 | 319 | ||
327 | pcibios_min_io = 0; | 320 | pcibios_min_io = 0; |
328 | pcibios_min_mem = 0; | 321 | pcibios_min_mem = 0; |
@@ -335,7 +328,8 @@ void __init cns3xxx_pcie_init_late(void) | |||
335 | cns3xxx_pwr_soft_rst(0x1 << PM_SOFT_RST_REG_OFFST_PCIE(i)); | 328 | cns3xxx_pwr_soft_rst(0x1 << PM_SOFT_RST_REG_OFFST_PCIE(i)); |
336 | cns3xxx_pcie_check_link(&cns3xxx_pcie[i]); | 329 | cns3xxx_pcie_check_link(&cns3xxx_pcie[i]); |
337 | cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]); | 330 | cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]); |
338 | pci_common_init(&cns3xxx_pcie[i].hw_pci); | 331 | private_data = &cns3xxx_pcie[i]; |
332 | pci_common_init(&hw_pci); | ||
339 | } | 333 | } |
340 | 334 | ||
341 | pci_assign_unassigned_resources(); | 335 | pci_assign_unassigned_resources(); |