ops-landisk.c 1.6 KB

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