184972ec0SPaul Mundt /* 29ca04434SNobuhiro Iwamatsu * arch/sh/drivers/pci/fixups-landisk.c 384972ec0SPaul Mundt * 484972ec0SPaul Mundt * PCI initialization for the I-O DATA Device, Inc. LANDISK board 584972ec0SPaul Mundt * 684972ec0SPaul Mundt * Copyright (C) 2006 kogiidena 79ca04434SNobuhiro Iwamatsu * Copyright (C) 2010 Nobuhiro Iwamatsu 884972ec0SPaul Mundt * 984972ec0SPaul Mundt * May be copied or modified under the terms of the GNU General Public 1084972ec0SPaul Mundt * License. See linux/COPYING for more information. 1184972ec0SPaul Mundt */ 1284972ec0SPaul Mundt #include <linux/kernel.h> 1384972ec0SPaul Mundt #include <linux/types.h> 1484972ec0SPaul Mundt #include <linux/init.h> 1584972ec0SPaul Mundt #include <linux/delay.h> 1684972ec0SPaul Mundt #include <linux/pci.h> 17*58796ce6SPaul Mundt #include <linux/sh_intc.h> 1884972ec0SPaul Mundt #include "pci-sh4.h" 1984972ec0SPaul Mundt 209ca04434SNobuhiro Iwamatsu #define PCIMCR_MRSET_OFF 0xBFFFFFFF 219ca04434SNobuhiro Iwamatsu #define PCIMCR_RFSH_OFF 0xFFFFFFFB 229ca04434SNobuhiro Iwamatsu 23d5341942SRalf Baechle int pcibios_map_platform_irq(const struct pci_dev *pdev, u8 slot, u8 pin) 2484972ec0SPaul Mundt { 2584972ec0SPaul Mundt /* 2684972ec0SPaul Mundt * slot0: pin1-4 = irq5,6,7,8 2784972ec0SPaul Mundt * slot1: pin1-4 = irq6,7,8,5 2884972ec0SPaul Mundt * slot2: pin1-4 = irq7,8,5,6 2984972ec0SPaul Mundt * slot3: pin1-4 = irq8,5,6,7 3084972ec0SPaul Mundt */ 31*58796ce6SPaul Mundt int irq = ((slot + pin - 1) & 0x3) + evt2irq(0x2a0); 3284972ec0SPaul Mundt 3384972ec0SPaul Mundt if ((slot | (pin - 1)) > 0x3) { 349ca04434SNobuhiro Iwamatsu printk(KERN_WARNING "PCI: Bad IRQ mapping request for slot %d pin %c\n", 3584972ec0SPaul Mundt slot, pin - 1 + 'A'); 3684972ec0SPaul Mundt return -1; 3784972ec0SPaul Mundt } 3884972ec0SPaul Mundt return irq; 3984972ec0SPaul Mundt } 409ca04434SNobuhiro Iwamatsu 419ca04434SNobuhiro Iwamatsu int pci_fixup_pcic(struct pci_channel *chan) 429ca04434SNobuhiro Iwamatsu { 439ca04434SNobuhiro Iwamatsu unsigned long bcr1, mcr; 449ca04434SNobuhiro Iwamatsu 459ca04434SNobuhiro Iwamatsu bcr1 = __raw_readl(SH7751_BCR1); 469ca04434SNobuhiro Iwamatsu bcr1 |= 0x40080000; /* Enable Bit 19 BREQEN, set PCIC to slave */ 479ca04434SNobuhiro Iwamatsu pci_write_reg(chan, bcr1, SH4_PCIBCR1); 489ca04434SNobuhiro Iwamatsu 499ca04434SNobuhiro Iwamatsu mcr = __raw_readl(SH7751_MCR); 509ca04434SNobuhiro Iwamatsu mcr = (mcr & PCIMCR_MRSET_OFF) & PCIMCR_RFSH_OFF; 519ca04434SNobuhiro Iwamatsu pci_write_reg(chan, mcr, SH4_PCIMCR); 529ca04434SNobuhiro Iwamatsu 539ca04434SNobuhiro Iwamatsu pci_write_reg(chan, 0x0c000000, SH7751_PCICONF5); 549ca04434SNobuhiro Iwamatsu pci_write_reg(chan, 0xd0000000, SH7751_PCICONF6); 559ca04434SNobuhiro Iwamatsu pci_write_reg(chan, 0x0c000000, SH4_PCILAR0); 569ca04434SNobuhiro Iwamatsu pci_write_reg(chan, 0x00000000, SH4_PCILAR1); 579ca04434SNobuhiro Iwamatsu 589ca04434SNobuhiro Iwamatsu return 0; 599ca04434SNobuhiro Iwamatsu } 60