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>

authored by David Howells and committed by Linus Torvalds 112b4a0b 126cda50

+35 -22
+35 -22
arch/mn10300/unit-asb2305/pci.c
··· 27 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 53 * Functions for accessing PCI configuration space 31 54 */ 32 55 ··· 320 297 printk(KERN_INFO "PCI: Using configuration ampci\n"); 321 298 request_mem_region(0xBE040000, 256, "AMPCI bridge"); 322 299 request_mem_region(0xBFFFFFF4, 12, "PCI ampci"); 300 + request_mem_region(0xBC000000, 32 * 1024 * 1024, "PCI SRAM"); 323 301 return 0; 324 302 } 325 303 ··· 382 358 { 383 359 struct pci_dev *dev; 384 360 361 + if (bus->number == 0) { 362 + bus->resource[0] = &pci_ioport_resource; 363 + bus->resource[1] = &pci_iomem_resource; 364 + } 365 + 385 366 if (bus->self) { 386 367 pci_read_bridge_bases(bus); 387 368 pcibios_fixup_device_resources(bus->self); ··· 409 380 iomem_resource.start = 0xA0000000; 410 381 iomem_resource.end = 0xDFFFFFFF; 411 382 383 + if (insert_resource(&iomem_resource, &pci_iomem_resource) < 0) 384 + panic("Unable to insert PCI IOMEM resource\n"); 385 + if (insert_resource(&ioport_resource, &pci_ioport_resource) < 0) 386 + panic("Unable to insert PCI IOPORT resource\n"); 387 + 412 388 if (!pci_probe) 413 389 return 0; 414 390 ··· 425 391 printk(KERN_INFO "PCI: Probing PCI hardware [mempage %08x]\n", 426 392 MEM_PAGING_REG); 427 393 428 - { 429 - #if 0 430 - static struct pci_bus am33_root_bus = { 431 - .children = LIST_HEAD_INIT(am33_root_bus.children), 432 - .devices = LIST_HEAD_INIT(am33_root_bus.devices), 433 - .number = 0, 434 - .secondary = 0, 435 - .resource = { &ioport_resource, &iomem_resource }, 436 - }; 437 - 438 - am33_root_bus.ops = pci_root_ops; 439 - list_add_tail(&am33_root_bus.node, &pci_root_buses); 440 - 441 - am33_root_bus.subordinate = pci_do_scan_bus(0); 442 - 443 - pci_root_bus = &am33_root_bus; 444 - #else 445 - pci_root_bus = pci_scan_bus(0, &pci_direct_ampci, NULL); 446 - #endif 447 - } 394 + pci_root_bus = pci_scan_bus(0, &pci_direct_ampci, NULL); 448 395 449 396 pcibios_irq_init(); 450 397 pcibios_fixup_irqs(); 451 - #if 0 452 398 pcibios_resource_survey(); 453 - #endif 454 399 return 0; 455 400 } 456 401