diff options
Diffstat (limited to 'arch/mn10300/unit-asb2305/pci.c')
-rw-r--r-- | arch/mn10300/unit-asb2305/pci.c | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c index 07dbbcda3b2e..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 | ||
@@ -279,7 +302,7 @@ static int __init pci_sanity_check(struct pci_ops *o) | |||
279 | (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ))) | 302 | (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ))) |
280 | return 1; | 303 | return 1; |
281 | 304 | ||
282 | printk(KERN_ERROR "PCI: Sanity check failed\n"); | 305 | printk(KERN_ERR "PCI: Sanity check failed\n"); |
283 | return 0; | 306 | return 0; |
284 | } | 307 | } |
285 | 308 | ||
@@ -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 | ||
@@ -440,7 +453,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
440 | { | 453 | { |
441 | int err; | 454 | int err; |
442 | 455 | ||
443 | err = pcibios_enable_resources(dev, mask); | 456 | err = pci_enable_resources(dev, mask); |
444 | if (err == 0) | 457 | if (err == 0) |
445 | pcibios_enable_irq(dev); | 458 | pcibios_enable_irq(dev); |
446 | return err; | 459 | return err; |
@@ -455,6 +468,7 @@ static void __init unit_disable_pcnet(struct pci_bus *bus, struct pci_ops *o) | |||
455 | 468 | ||
456 | bus->number = 0; | 469 | bus->number = 0; |
457 | 470 | ||
471 | o->read (bus, PCI_DEVFN(2, 0), PCI_VENDOR_ID, 4, &x); | ||
458 | o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); | 472 | o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); |
459 | x |= PCI_COMMAND_MASTER | | 473 | x |= PCI_COMMAND_MASTER | |
460 | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | | 474 | PCI_COMMAND_IO | PCI_COMMAND_MEMORY | |