ops-landisk.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * arch/sh/drivers/pci/ops-landisk.c
  3. *
  4. * PCI initialization for the I-O DATA Device, Inc. LANDISK board
  5. *
  6. * Copyright (C) 2006 kogiidena
  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. #include <linux/kernel.h>
  12. #include <linux/types.h>
  13. #include <linux/init.h>
  14. #include <linux/delay.h>
  15. #include <linux/pci.h>
  16. #include "pci-sh4.h"
  17. static struct resource sh7751_io_resource = {
  18. .name = "SH7751 IO",
  19. .start = 0x4000,
  20. .end = 0x4000 + SH7751_PCI_IO_SIZE - 1,
  21. .flags = IORESOURCE_IO
  22. };
  23. static struct resource sh7751_mem_resource = {
  24. .name = "SH7751 mem",
  25. .start = SH7751_PCI_MEMORY_BASE,
  26. .end = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1,
  27. .flags = IORESOURCE_MEM
  28. };
  29. struct pci_channel board_pci_channels[] = {
  30. {&sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0x3ff},
  31. {NULL, NULL, NULL, 0, 0},
  32. };
  33. static struct sh4_pci_address_map sh7751_pci_map = {
  34. .window0 = {
  35. .base = SH7751_CS3_BASE_ADDR,
  36. .size = (64 << 20), /* 64MB */
  37. },
  38. .flags = SH4_PCIC_NO_RESET,
  39. };
  40. int __init pcibios_init_platform(void)
  41. {
  42. return sh7751_pcic_init(&sh7751_pci_map);
  43. }
  44. int pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
  45. {
  46. /*
  47. * slot0: pin1-4 = irq5,6,7,8
  48. * slot1: pin1-4 = irq6,7,8,5
  49. * slot2: pin1-4 = irq7,8,5,6
  50. * slot3: pin1-4 = irq8,5,6,7
  51. */
  52. int irq = ((slot + pin - 1) & 0x3) + 5;
  53. if ((slot | (pin - 1)) > 0x3) {
  54. printk("PCI: Bad IRQ mapping request for slot %d pin %c\n",
  55. slot, pin - 1 + 'A');
  56. return -1;
  57. }
  58. return irq;
  59. }