fixups-landisk.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * arch/sh/drivers/pci/fixups-landisk.c
  3. *
  4. * PCI initialization for the I-O DATA Device, Inc. LANDISK board
  5. *
  6. * Copyright (C) 2006 kogiidena
  7. * Copyright (C) 2010 Nobuhiro Iwamatsu
  8. *
  9. * May be copied or modified under the terms of the GNU General Public
  10. * License. See linux/COPYING for more information.
  11. */
  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. #define PCIMCR_MRSET_OFF 0xBFFFFFFF
  19. #define PCIMCR_RFSH_OFF 0xFFFFFFFB
  20. int pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
  21. {
  22. /*
  23. * slot0: pin1-4 = irq5,6,7,8
  24. * slot1: pin1-4 = irq6,7,8,5
  25. * slot2: pin1-4 = irq7,8,5,6
  26. * slot3: pin1-4 = irq8,5,6,7
  27. */
  28. int irq = ((slot + pin - 1) & 0x3) + 5;
  29. if ((slot | (pin - 1)) > 0x3) {
  30. printk(KERN_WARNING "PCI: Bad IRQ mapping request for slot %d pin %c\n",
  31. slot, pin - 1 + 'A');
  32. return -1;
  33. }
  34. return irq;
  35. }
  36. int pci_fixup_pcic(struct pci_channel *chan)
  37. {
  38. unsigned long bcr1, mcr;
  39. bcr1 = __raw_readl(SH7751_BCR1);
  40. bcr1 |= 0x40080000; /* Enable Bit 19 BREQEN, set PCIC to slave */
  41. pci_write_reg(chan, bcr1, SH4_PCIBCR1);
  42. mcr = __raw_readl(SH7751_MCR);
  43. mcr = (mcr & PCIMCR_MRSET_OFF) & PCIMCR_RFSH_OFF;
  44. pci_write_reg(chan, mcr, SH4_PCIMCR);
  45. pci_write_reg(chan, 0x0c000000, SH7751_PCICONF5);
  46. pci_write_reg(chan, 0xd0000000, SH7751_PCICONF6);
  47. pci_write_reg(chan, 0x0c000000, SH4_PCILAR0);
  48. pci_write_reg(chan, 0x00000000, SH4_PCILAR1);
  49. return 0;
  50. }