pci-ddb5074.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #define PCI_EXT_INTA 8
  26. #define PCI_EXT_INTB 9
  27. #define PCI_EXT_INTC 10
  28. #define PCI_EXT_INTD 11
  29. #define PCI_EXT_INTE 12
  30. #define MAX_SLOT_NUM 14
  31. static unsigned char irq_map[MAX_SLOT_NUM] = {
  32. [ 0] = nile4_to_irq(PCI_EXT_INTE),
  33. [ 1] = nile4_to_irq(PCI_EXT_INTA),
  34. [ 2] = nile4_to_irq(PCI_EXT_INTA),
  35. [ 3] = nile4_to_irq(PCI_EXT_INTB),
  36. [ 4] = nile4_to_irq(PCI_EXT_INTC),
  37. [ 5] = nile4_to_irq(NILE4_INT_UART),
  38. [10] = nile4_to_irq(PCI_EXT_INTE),
  39. [13] = nile4_to_irq(PCI_EXT_INTE),
  40. };
  41. int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  42. {
  43. return irq_map[slot];
  44. }
  45. /* Do platform specific device initialization at pci_enable_device() time */
  46. int pcibios_plat_dev_init(struct pci_dev *dev)
  47. {
  48. return 0;
  49. }
  50. void __init ddb_pci_reset_bus(void)
  51. {
  52. u32 temp;
  53. /*
  54. * I am not sure about the "official" procedure, the following
  55. * steps work as far as I know:
  56. * We first set PCI cold reset bit (bit 31) in PCICTRL-H.
  57. * Then we clear the PCI warm reset bit (bit 30) to 0 in PCICTRL-H.
  58. * The same is true for both PCI channels.
  59. */
  60. temp = ddb_in32(DDB_PCICTRL + 4);
  61. temp |= 0x80000000;
  62. ddb_out32(DDB_PCICTRL + 4, temp);
  63. temp &= ~0xc0000000;
  64. ddb_out32(DDB_PCICTRL + 4, temp);
  65. }