pci-ddb5476.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #include <linux/kernel.h>
  2. #include <linux/init.h>
  3. #include <linux/types.h>
  4. #include <linux/pci.h>
  5. #include <asm/debug.h>
  6. #include <asm/ddb5xxx/ddb5xxx.h>
  7. static struct resource extpci_io_resource = {
  8. "pci IO space",
  9. 0x1000, /* leave some room for ISA bus */
  10. DDB_PCI_IO_SIZE - 1,
  11. IORESOURCE_IO
  12. };
  13. static struct resource extpci_mem_resource = {
  14. "pci memory space",
  15. DDB_PCI_MEM_BASE + 0x00100000, /* leave 1 MB for RTC */
  16. DDB_PCI_MEM_BASE + DDB_PCI_MEM_SIZE - 1,
  17. IORESOURCE_MEM
  18. };
  19. extern struct pci_ops ddb5476_ext_pci_ops;
  20. struct pci_controller ddb5476_controller = {
  21. .pci_ops = &ddb5476_ext_pci_ops,
  22. .io_resource = &extpci_io_resource,
  23. .mem_resource = &extpci_mem_resource
  24. };
  25. /*
  26. * we fix up irqs based on the slot number.
  27. * The first entry is at AD:11.
  28. *
  29. * This does not work for devices on sub-buses yet.
  30. */
  31. /*
  32. * temporary
  33. */
  34. #define PCI_EXT_INTA 8
  35. #define PCI_EXT_INTB 9
  36. #define PCI_EXT_INTC 10
  37. #define PCI_EXT_INTD 11
  38. #define PCI_EXT_INTE 12
  39. /*
  40. * based on ddb5477 manual page 11
  41. */
  42. #define MAX_SLOT_NUM 21
  43. static unsigned char irq_map[MAX_SLOT_NUM] = {
  44. [ 2] = 9, /* AD:13 USB */
  45. [ 3] = 10, /* AD:14 PMU */
  46. [ 5] = 0, /* AD:16 P2P bridge */
  47. [ 6] = nile4_to_irq(PCI_EXT_INTB), /* AD:17 */
  48. [ 7] = nile4_to_irq(PCI_EXT_INTC), /* AD:18 */
  49. [ 8] = nile4_to_irq(PCI_EXT_INTD), /* AD:19 */
  50. [ 9] = nile4_to_irq(PCI_EXT_INTA), /* AD:20 */
  51. [13] = 14, /* AD:24 HD controller, M5229 */
  52. };
  53. int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  54. {
  55. return irq_map[slot];
  56. }
  57. /* Do platform specific device initialization at pci_enable_device() time */
  58. int pcibios_plat_dev_init(struct pci_dev *dev)
  59. {
  60. return 0;
  61. }
  62. void __init ddb_pci_reset_bus(void)
  63. {
  64. u32 temp;
  65. /*
  66. * I am not sure about the "official" procedure, the following
  67. * steps work as far as I know:
  68. * We first set PCI cold reset bit (bit 31) in PCICTRL-H.
  69. * Then we clear the PCI warm reset bit (bit 30) to 0 in PCICTRL-H.
  70. * The same is true for both PCI channels.
  71. */
  72. temp = ddb_in32(DDB_PCICTRL + 4);
  73. temp |= 0x80000000;
  74. ddb_out32(DDB_PCICTRL + 4, temp);
  75. temp &= ~0xc0000000;
  76. ddb_out32(DDB_PCICTRL + 4, temp);
  77. }