ops-bigsur.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * linux/arch/sh/kernel/pci-bigsur.c
  3. *
  4. * By Dustin McIntire (dustin@sensoria.com) (c)2001
  5. *
  6. * Ported to new API by Paul Mundt <lethal@linux-sh.org>.
  7. *
  8. * May be copied or modified under the terms of the GNU General Public
  9. * License. See linux/COPYING for more information.
  10. *
  11. * PCI initialization for the Hitachi Big Sur Evaluation Board
  12. */
  13. #include <linux/config.h>
  14. #include <linux/kernel.h>
  15. #include <linux/types.h>
  16. #include <linux/init.h>
  17. #include <linux/delay.h>
  18. #include <linux/pci.h>
  19. #include <asm/io.h>
  20. #include "pci-sh7751.h"
  21. #include <asm/bigsur/bigsur.h>
  22. #define BIGSUR_PCI_IO 0x4000
  23. #define BIGSUR_PCI_MEM 0xfd000000
  24. static struct resource sh7751_io_resource = {
  25. .name = "SH7751 IO",
  26. .start = BIGSUR_PCI_IO,
  27. .end = BIGSUR_PCI_IO + (64*1024) - 1,
  28. .flags = IORESOURCE_IO,
  29. };
  30. static struct resource sh7751_mem_resource = {
  31. .name = "SH7751 mem",
  32. .start = BIGSUR_PCI_MEM,
  33. .end = BIGSUR_PCI_MEM + (64*1024*1024) - 1,
  34. .flags = IORESOURCE_MEM,
  35. };
  36. extern struct pci_ops sh7751_pci_ops;
  37. struct pci_channel board_pci_channels[] = {
  38. { &sh7751_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
  39. { 0, }
  40. };
  41. static struct sh7751_pci_address_map sh7751_pci_map = {
  42. .window0 = {
  43. .base = SH7751_CS3_BASE_ADDR,
  44. .size = BIGSUR_LSR0_SIZE,
  45. },
  46. .window1 = {
  47. .base = SH7751_CS3_BASE_ADDR,
  48. .size = BIGSUR_LSR1_SIZE,
  49. },
  50. };
  51. /*
  52. * Initialize the Big Sur PCI interface
  53. * Setup hardware to be Central Funtion
  54. * Copy the BSR regs to the PCI interface
  55. * Setup PCI windows into local RAM
  56. */
  57. int __init pcibios_init_platform(void)
  58. {
  59. return sh7751_pcic_init(&sh7751_pci_map);
  60. }
  61. int pcibios_map_platform_irq(u8 slot, u8 pin)
  62. {
  63. /*
  64. * The Big Sur can be used in a CPCI chassis, but the SH7751 PCI
  65. * interface is on the wrong end of the board so that it can also
  66. * support a V320 CPI interface chip... Therefor the IRQ mapping is
  67. * somewhat use dependent... I'l assume a linear map for now, i.e.
  68. * INTA=slot0,pin0... INTD=slot3,pin0...
  69. */
  70. int irq = (slot + pin-1) % 4 + BIGSUR_SH7751_PCI_IRQ_BASE;
  71. PCIDBG(2, "PCI: Mapping Big Sur IRQ for slot %d, pin %c to irq %d\n",
  72. slot, pin-1+'A', irq);
  73. return irq;
  74. }