diff options
author | David Howells <dhowells@redhat.com> | 2010-01-08 17:43:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-01-11 12:34:10 -0500 |
commit | 112b4a0bf1080b3d40a2d3b3982361229b25e72d (patch) | |
tree | e9b49ac3df442cc469b0823378961d4d46b88bc5 /arch/mn10300 | |
parent | 126cda50468d26c4c67f20c51a800685d42d1c61 (diff) |
mn10300: insert PCI root bus resources for the ASB2305 devel motherboard
Insert PCI root bus resources for the MN10300-based ASB2305 development
kit motherboard. This is required because the CPU's window onto the PCI
bus address space is considerably smaller than the CPU's full address
space and non-PCI devices lie outside of the PCI window that we might want
to access.
Without this patch, the PCI root bus uses the platform-level bus
resources, and these are then confined to the PCI window, thus making
platform_device_add() reject devices outside of this window.
We also add a reservation for the PCI SRAM region.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mn10300')
-rw-r--r-- | arch/mn10300/unit-asb2305/pci.c | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c index 02527ce10cb2..2cb7e75ba1c0 100644 --- a/arch/mn10300/unit-asb2305/pci.c +++ b/arch/mn10300/unit-asb2305/pci.c | |||
@@ -27,6 +27,29 @@ struct pci_bus *pci_root_bus; | |||
27 | struct pci_ops *pci_root_ops; | 27 | struct pci_ops *pci_root_ops; |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * The accessible PCI window does not cover the entire CPU address space, but | ||
31 | * there are devices we want to access outside of that window, so we need to | ||
32 | * insert specific PCI bus resources instead of using the platform-level bus | ||
33 | * resources directly for the PCI root bus. | ||
34 | * | ||
35 | * These are configured and inserted by pcibios_init() and are attached to the | ||
36 | * root bus by pcibios_fixup_bus(). | ||
37 | */ | ||
38 | static struct resource pci_ioport_resource = { | ||
39 | .name = "PCI IO", | ||
40 | .start = 0xbe000000, | ||
41 | .end = 0xbe03ffff, | ||
42 | .flags = IORESOURCE_IO, | ||
43 | }; | ||
44 | |||
45 | static struct resource pci_iomem_resource = { | ||
46 | .name = "PCI mem", | ||
47 | .start = 0xb8000000, | ||
48 | .end = 0xbbffffff, | ||
49 | .flags = IORESOURCE_MEM, | ||
50 | }; | ||
51 | |||
52 | /* | ||
30 | * Functions for accessing PCI configuration space | 53 | * Functions for accessing PCI configuration space |
31 | */ | 54 | */ |
32 | 55 | ||
@@ -297,6 +320,7 @@ static int __init pci_check_direct(void) | |||
297 | printk(KERN_INFO "PCI: Using configuration ampci\n"); | 320 | printk(KERN_INFO "PCI: Using configuration ampci\n"); |
298 | request_mem_region(0xBE040000, 256, "AMPCI bridge"); | 321 | request_mem_region(0xBE040000, 256, "AMPCI bridge"); |
299 | request_mem_region(0xBFFFFFF4, 12, "PCI ampci"); | 322 | request_mem_region(0xBFFFFFF4, 12, "PCI ampci"); |
323 | request_mem_region(0xBC000000, 32 * 1024 * 1024, "PCI SRAM"); | ||
300 | return 0; | 324 | return 0; |
301 | } | 325 | } |
302 | 326 | ||
@@ -358,6 +382,11 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus) | |||
358 | { | 382 | { |
359 | struct pci_dev *dev; | 383 | struct pci_dev *dev; |
360 | 384 | ||
385 | if (bus->number == 0) { | ||
386 | bus->resource[0] = &pci_ioport_resource; | ||
387 | bus->resource[1] = &pci_iomem_resource; | ||
388 | } | ||
389 | |||
361 | if (bus->self) { | 390 | if (bus->self) { |
362 | pci_read_bridge_bases(bus); | 391 | pci_read_bridge_bases(bus); |
363 | pcibios_fixup_device_resources(bus->self); | 392 | pcibios_fixup_device_resources(bus->self); |
@@ -380,6 +409,11 @@ static int __init pcibios_init(void) | |||
380 | iomem_resource.start = 0xA0000000; | 409 | iomem_resource.start = 0xA0000000; |
381 | iomem_resource.end = 0xDFFFFFFF; | 410 | iomem_resource.end = 0xDFFFFFFF; |
382 | 411 | ||
412 | if (insert_resource(&iomem_resource, &pci_iomem_resource) < 0) | ||
413 | panic("Unable to insert PCI IOMEM resource\n"); | ||
414 | if (insert_resource(&ioport_resource, &pci_ioport_resource) < 0) | ||
415 | panic("Unable to insert PCI IOPORT resource\n"); | ||
416 | |||
383 | if (!pci_probe) | 417 | if (!pci_probe) |
384 | return 0; | 418 | return 0; |
385 | 419 | ||
@@ -391,32 +425,11 @@ static int __init pcibios_init(void) | |||
391 | printk(KERN_INFO "PCI: Probing PCI hardware [mempage %08x]\n", | 425 | printk(KERN_INFO "PCI: Probing PCI hardware [mempage %08x]\n", |
392 | MEM_PAGING_REG); | 426 | MEM_PAGING_REG); |
393 | 427 | ||
394 | { | 428 | pci_root_bus = pci_scan_bus(0, &pci_direct_ampci, NULL); |
395 | #if 0 | ||
396 | static struct pci_bus am33_root_bus = { | ||
397 | .children = LIST_HEAD_INIT(am33_root_bus.children), | ||
398 | .devices = LIST_HEAD_INIT(am33_root_bus.devices), | ||
399 | .number = 0, | ||
400 | .secondary = 0, | ||
401 | .resource = { &ioport_resource, &iomem_resource }, | ||
402 | }; | ||
403 | |||
404 | am33_root_bus.ops = pci_root_ops; | ||
405 | list_add_tail(&am33_root_bus.node, &pci_root_buses); | ||
406 | |||
407 | am33_root_bus.subordinate = pci_do_scan_bus(0); | ||
408 | |||
409 | pci_root_bus = &am33_root_bus; | ||
410 | #else | ||
411 | pci_root_bus = pci_scan_bus(0, &pci_direct_ampci, NULL); | ||
412 | #endif | ||
413 | } | ||
414 | 429 | ||
415 | pcibios_irq_init(); | 430 | pcibios_irq_init(); |
416 | pcibios_fixup_irqs(); | 431 | pcibios_fixup_irqs(); |
417 | #if 0 | ||
418 | pcibios_resource_survey(); | 432 | pcibios_resource_survey(); |
419 | #endif | ||
420 | return 0; | 433 | return 0; |
421 | } | 434 | } |
422 | 435 | ||