frv: insert PCI root bus resources for the MB93090 devel motherboard

Insert PCI root bus resources for the FRV-based MB93090 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.

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 77e38a55 6d029b64

+50 -13
+50 -13
arch/frv/mb93090-mb00/pci-vdk.c
··· 31 struct pci_ops *__nongpreldata pci_root_ops; 32 33 /* 34 * Functions for accessing PCI configuration space 35 */ 36 ··· 327 #if 0 328 printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); 329 #endif 330 pci_read_bridge_bases(bus); 331 332 if (bus->number == 0) { ··· 379 /* enable PCI arbitration */ 380 __reg_MB86943_pci_arbiter = MB86943_PCIARB_EN; 381 382 - ioport_resource.start = (__reg_MB86943_sl_pci_io_base << 9) & 0xfffffc00; 383 - ioport_resource.end = (__reg_MB86943_sl_pci_io_range << 9) | 0x3ff; 384 - ioport_resource.end += ioport_resource.start; 385 386 printk("PCI IO window: %08llx-%08llx\n", 387 - (unsigned long long) ioport_resource.start, 388 - (unsigned long long) ioport_resource.end); 389 390 - iomem_resource.start = (__reg_MB86943_sl_pci_mem_base << 9) & 0xfffffc00; 391 392 - /* Reserve somewhere to write to flush posted writes. */ 393 - iomem_resource.start += 0x400; 394 - 395 - iomem_resource.end = (__reg_MB86943_sl_pci_mem_range << 9) | 0x3ff; 396 - iomem_resource.end += iomem_resource.start; 397 398 printk("PCI MEM window: %08llx-%08llx\n", 399 - (unsigned long long) iomem_resource.start, 400 - (unsigned long long) iomem_resource.end); 401 printk("PCI DMA memory: %08lx-%08lx\n", 402 dma_coherent_mem_start, dma_coherent_mem_end); 403 404 if (!pci_probe) 405 return -ENXIO;
··· 31 struct pci_ops *__nongpreldata pci_root_ops; 32 33 /* 34 + * The accessible PCI window does not cover the entire CPU address space, but 35 + * there are devices we want to access outside of that window, so we need to 36 + * insert specific PCI bus resources instead of using the platform-level bus 37 + * resources directly for the PCI root bus. 38 + * 39 + * These are configured and inserted by pcibios_init() and are attached to the 40 + * root bus by pcibios_fixup_bus(). 41 + */ 42 + static struct resource pci_ioport_resource = { 43 + .name = "PCI IO", 44 + .start = 0, 45 + .end = IO_SPACE_LIMIT, 46 + .flags = IORESOURCE_IO, 47 + }; 48 + 49 + static struct resource pci_iomem_resource = { 50 + .name = "PCI mem", 51 + .start = 0, 52 + .end = -1, 53 + .flags = IORESOURCE_MEM, 54 + }; 55 + 56 + /* 57 * Functions for accessing PCI configuration space 58 */ 59 ··· 304 #if 0 305 printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); 306 #endif 307 + 308 + if (bus->number == 0) { 309 + bus->resource[0] = &pci_ioport_resource; 310 + bus->resource[1] = &pci_iomem_resource; 311 + } 312 + 313 pci_read_bridge_bases(bus); 314 315 if (bus->number == 0) { ··· 350 /* enable PCI arbitration */ 351 __reg_MB86943_pci_arbiter = MB86943_PCIARB_EN; 352 353 + pci_ioport_resource.start = (__reg_MB86943_sl_pci_io_base << 9) & 0xfffffc00; 354 + pci_ioport_resource.end = (__reg_MB86943_sl_pci_io_range << 9) | 0x3ff; 355 + pci_ioport_resource.end += pci_ioport_resource.start; 356 357 printk("PCI IO window: %08llx-%08llx\n", 358 + (unsigned long long) pci_ioport_resource.start, 359 + (unsigned long long) pci_ioport_resource.end); 360 361 + pci_iomem_resource.start = (__reg_MB86943_sl_pci_mem_base << 9) & 0xfffffc00; 362 + pci_iomem_resource.end = (__reg_MB86943_sl_pci_mem_range << 9) | 0x3ff; 363 + pci_iomem_resource.end += pci_iomem_resource.start; 364 365 + /* Reserve somewhere to write to flush posted writes. This is used by 366 + * __flush_PCI_writes() from asm/io.h to force the write FIFO in the 367 + * CPU-PCI bridge to flush as this doesn't happen automatically when a 368 + * read is performed on the MB93090 development kit motherboard. 369 + */ 370 + pci_iomem_resource.start += 0x400; 371 372 printk("PCI MEM window: %08llx-%08llx\n", 373 + (unsigned long long) pci_iomem_resource.start, 374 + (unsigned long long) pci_iomem_resource.end); 375 printk("PCI DMA memory: %08lx-%08lx\n", 376 dma_coherent_mem_start, dma_coherent_mem_end); 377 + 378 + if (insert_resource(&iomem_resource, &pci_iomem_resource) < 0) 379 + panic("Unable to insert PCI IOMEM resource\n"); 380 + if (insert_resource(&ioport_resource, &pci_ioport_resource) < 0) 381 + panic("Unable to insert PCI IOPORT resource\n"); 382 383 if (!pci_probe) 384 return -ENXIO;