pci-yosemite.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #include <linux/init.h>
  9. #include <linux/kernel.h>
  10. #include <linux/types.h>
  11. #include <linux/pci.h>
  12. #include <asm/titan_dep.h>
  13. extern struct pci_ops titan_pci_ops;
  14. static struct resource py_mem_resource = {
  15. .start = 0xe0000000UL,
  16. .end = 0xe3ffffffUL,
  17. .name = "Titan PCI MEM",
  18. .flags = IORESOURCE_MEM
  19. };
  20. /*
  21. * PMON really reserves 16MB of I/O port space but that's stupid, nothing
  22. * needs that much since allocations are limited to 256 bytes per device
  23. * anyway. So we just claim 64kB here.
  24. */
  25. #define TITAN_IO_SIZE 0x0000ffffUL
  26. #define TITAN_IO_BASE 0xe8000000UL
  27. static struct resource py_io_resource = {
  28. .start = 0x00001000UL,
  29. .end = TITAN_IO_SIZE - 1,
  30. .name = "Titan IO MEM",
  31. .flags = IORESOURCE_IO,
  32. };
  33. static struct pci_controller py_controller = {
  34. .pci_ops = &titan_pci_ops,
  35. .mem_resource = &py_mem_resource,
  36. .mem_offset = 0x00000000UL,
  37. .io_resource = &py_io_resource,
  38. .io_offset = 0x00000000UL
  39. };
  40. static char ioremap_failed[] __initdata = "Could not ioremap I/O port range";
  41. static int __init pmc_yosemite_setup(void)
  42. {
  43. unsigned long io_v_base;
  44. io_v_base = (unsigned long) ioremap(TITAN_IO_BASE, TITAN_IO_SIZE);
  45. if (!io_v_base)
  46. panic(ioremap_failed);
  47. set_io_port_base(io_v_base);
  48. py_controller.io_map_base = io_v_base;
  49. TITAN_WRITE(RM9000x2_OCD_LKM7, TITAN_READ(RM9000x2_OCD_LKM7) | 1);
  50. ioport_resource.end = TITAN_IO_SIZE - 1;
  51. register_pci_controller(&py_controller);
  52. return 0;
  53. }
  54. arch_initcall(pmc_yosemite_setup);