pci-ocelot-g.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
  7. *
  8. * This doesn't really fly - but I don't have a GT64240 system for testing.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/kernel.h>
  12. #include <linux/types.h>
  13. #include <linux/pci.h>
  14. #include <asm/gt64240.h>
  15. /*
  16. * We assume these address ranges have been programmed into the GT-64240 by
  17. * the firmware. PMON in case of the Ocelot G does that. Note the size of
  18. * the I/O range is completly stupid; I/O mappings are limited to at most
  19. * 256 bytes by the PCI spec and deprecated; and just to make things worse
  20. * apparently many devices don't decode more than 64k of I/O space.
  21. */
  22. #define gt_io_size 0x20000000UL
  23. #define gt_io_base 0xe0000000UL
  24. static struct resource gt_pci_mem0_resource = {
  25. .name = "MV64240 PCI0 MEM",
  26. .start = 0xc0000000UL,
  27. .end = 0xcfffffffUL,
  28. .flags = IORESOURCE_MEM
  29. };
  30. static struct resource gt_pci_io_mem0_resource = {
  31. .name = "MV64240 PCI0 IO MEM",
  32. .start = 0xe0000000UL,
  33. .end = 0xefffffffUL,
  34. .flags = IORESOURCE_IO
  35. };
  36. static struct mv_pci_controller gt_bus0_controller = {
  37. .pcic = {
  38. .pci_ops = &mv_pci_ops,
  39. .mem_resource = &gt_pci_mem0_resource,
  40. .mem_offset = 0xc0000000UL,
  41. .io_resource = &gt_pci_io_mem0_resource,
  42. .io_offset = 0x00000000UL
  43. },
  44. .config_addr = PCI_0CONFIGURATION_ADDRESS,
  45. .config_vreg = PCI_0CONFIGURATION_DATA_VIRTUAL_REGISTER,
  46. };
  47. static struct resource gt_pci_mem1_resource = {
  48. .name = "MV64240 PCI1 MEM",
  49. .start = 0xd0000000UL,
  50. .end = 0xdfffffffUL,
  51. .flags = IORESOURCE_MEM
  52. };
  53. static struct resource gt_pci_io_mem1_resource = {
  54. .name = "MV64240 PCI1 IO MEM",
  55. .start = 0xf0000000UL,
  56. .end = 0xffffffffUL,
  57. .flags = IORESOURCE_IO
  58. };
  59. static struct mv_pci_controller gt_bus1_controller = {
  60. .pcic = {
  61. .pci_ops = &mv_pci_ops,
  62. .mem_resource = &gt_pci_mem1_resource,
  63. .mem_offset = 0xd0000000UL,
  64. .io_resource = &gt_pci_io_mem1_resource,
  65. .io_offset = 0x10000000UL
  66. },
  67. .config_addr = PCI_1CONFIGURATION_ADDRESS,
  68. .config_vreg = PCI_1CONFIGURATION_DATA_VIRTUAL_REGISTER,
  69. };
  70. static __init int __init ocelot_g_pci_init(void)
  71. {
  72. unsigned long io_v_base;
  73. if (gt_io_size) {
  74. io_v_base = (unsigned long) ioremap(gt_io_base, gt_io_size);
  75. if (!io_v_base)
  76. panic("Could not ioremap I/O port range");
  77. set_io_port_base(io_v_base);
  78. }
  79. register_pci_controller(&gt_bus0_controller.pcic);
  80. register_pci_controller(&gt_bus1_controller.pcic);
  81. return 0;
  82. }
  83. arch_initcall(ocelot_g_pci_init);