fixups-landisk.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * arch/sh/drivers/pci/fixups-landisk.c
  4. *
  5. * PCI initialization for the I-O DATA Device, Inc. LANDISK board
  6. *
  7. * Copyright (C) 2006 kogiidena
  8. * Copyright (C) 2010 Nobuhiro Iwamatsu
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/types.h>
  12. #include <linux/init.h>
  13. #include <linux/delay.h>
  14. #include <linux/pci.h>
  15. #include <linux/sh_intc.h>
  16. #include "pci-sh4.h"
  17. #define PCIMCR_MRSET_OFF 0xBFFFFFFF
  18. #define PCIMCR_RFSH_OFF 0xFFFFFFFB
  19. int pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin)
  20. {
  21. /*
  22. * slot0: pin1-4 = irq5,6,7,8
  23. * slot1: pin1-4 = irq6,7,8,5
  24. * slot2: pin1-4 = irq7,8,5,6
  25. * slot3: pin1-4 = irq8,5,6,7
  26. */
  27. int irq = ((slot + pin - 1) & 0x3) + evt2irq(0x2a0);
  28. if ((slot | (pin - 1)) > 0x3) {
  29. printk(KERN_WARNING "PCI: Bad IRQ mapping request for slot %d pin %c\n",
  30. slot, pin - 1 + 'A');
  31. return -1;
  32. }
  33. return irq;
  34. }
  35. int pci_fixup_pcic(struct pci_channel *chan)
  36. {
  37. unsigned long bcr1, mcr;
  38. bcr1 = __raw_readl(SH7751_BCR1);
  39. bcr1 |= 0x40080000; /* Enable Bit 19 BREQEN, set PCIC to slave */
  40. pci_write_reg(chan, bcr1, SH4_PCIBCR1);
  41. mcr = __raw_readl(SH7751_MCR);
  42. mcr = (mcr & PCIMCR_MRSET_OFF) & PCIMCR_RFSH_OFF;
  43. pci_write_reg(chan, mcr, SH4_PCIMCR);
  44. pci_write_reg(chan, 0x0c000000, SH7751_PCICONF5);
  45. pci_write_reg(chan, 0xd0000000, SH7751_PCICONF6);
  46. pci_write_reg(chan, 0x0c000000, SH4_PCILAR0);
  47. pci_write_reg(chan, 0x00000000, SH4_PCILAR1);
  48. return 0;
  49. }