Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MIPS] TXx9: PCI fixes for tx3927/tx4927

* Fix tx3927 pci ops for Type-1 configuration
* Fix abort checking of tx3927 pci ops
* Flush write buffer to avoid spurious PCI error interrupt
* Add a quirk for FPCIB backplane

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Atsushi Nemoto and committed by
Ralf Baechle
32d00d0f a0e31fb0

+53 -27
+19 -27
arch/mips/pci/ops-tx3927.c
··· 41 41 #include <asm/addrspace.h> 42 42 #include <asm/txx9/tx3927.h> 43 43 44 - static inline int mkaddr(unsigned char bus, unsigned char dev_fn, 45 - unsigned char where) 44 + static int mkaddr(struct pci_bus *bus, unsigned char devfn, unsigned char where) 46 45 { 47 - if (bus == 0 && dev_fn >= PCI_DEVFN(TX3927_PCIC_MAX_DEVNU, 0)) 48 - return PCIBIOS_DEVICE_NOT_FOUND; 49 - 50 - tx3927_pcicptr->ica = ((bus & 0xff) << 0x10) | 51 - ((dev_fn & 0xff) << 0x08) | 52 - (where & 0xfc); 46 + if (bus->parent == NULL && 47 + devfn >= PCI_DEVFN(TX3927_PCIC_MAX_DEVNU, 0)) 48 + return -1; 49 + tx3927_pcicptr->ica = 50 + ((bus->number & 0xff) << 0x10) | 51 + ((devfn & 0xff) << 0x08) | 52 + (where & 0xfc) | (bus->parent ? 1 : 0); 53 53 54 54 /* clear M_ABORT and Disable M_ABORT Int. */ 55 55 tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT; 56 56 tx3927_pcicptr->pcistatim &= ~PCI_STATUS_REC_MASTER_ABORT; 57 - 58 - return PCIBIOS_SUCCESSFUL; 57 + return 0; 59 58 } 60 59 61 60 static inline int check_abort(void) 62 61 { 63 - if (tx3927_pcicptr->pcistat & PCI_STATUS_REC_MASTER_ABORT) 62 + if (tx3927_pcicptr->pcistat & PCI_STATUS_REC_MASTER_ABORT) { 64 63 tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT; 65 64 tx3927_pcicptr->pcistatim |= PCI_STATUS_REC_MASTER_ABORT; 65 + /* flush write buffer */ 66 + iob(); 66 67 return PCIBIOS_DEVICE_NOT_FOUND; 67 - 68 + } 68 69 return PCIBIOS_SUCCESSFUL; 69 70 } 70 71 71 72 static int tx3927_pci_read_config(struct pci_bus *bus, unsigned int devfn, 72 73 int where, int size, u32 * val) 73 74 { 74 - int ret; 75 - 76 - ret = mkaddr(bus->number, devfn, where); 77 - if (ret) 78 - return ret; 75 + if (mkaddr(bus, devfn, where)) { 76 + *val = 0xffffffff; 77 + return PCIBIOS_DEVICE_NOT_FOUND; 78 + } 79 79 80 80 switch (size) { 81 81 case 1: ··· 97 97 static int tx3927_pci_write_config(struct pci_bus *bus, unsigned int devfn, 98 98 int where, int size, u32 val) 99 99 { 100 - int ret; 101 - 102 - ret = mkaddr(bus->number, devfn, where); 103 - if (ret) 104 - return ret; 100 + if (mkaddr(bus, devfn, where)) 101 + return PCIBIOS_DEVICE_NOT_FOUND; 105 102 106 103 switch (size) { 107 104 case 1: ··· 113 116 case 4: 114 117 tx3927_pcicptr->icd = cpu_to_le32(val); 115 118 } 116 - 117 - if (tx3927_pcicptr->pcistat & PCI_STATUS_REC_MASTER_ABORT) 118 - tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT; 119 - tx3927_pcicptr->pcistatim |= PCI_STATUS_REC_MASTER_ABORT; 120 - return PCIBIOS_DEVICE_NOT_FOUND; 121 119 122 120 return check_abort(); 123 121 }
+34
arch/mips/pci/ops-tx4927.c
··· 85 85 __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff) 86 86 | (PCI_STATUS_REC_MASTER_ABORT << 16), 87 87 &pcicptr->pcistatus); 88 + /* flush write buffer */ 89 + iob(); 88 90 code = PCIBIOS_DEVICE_NOT_FOUND; 89 91 } 90 92 return code; ··· 408 406 tx4927_report_pcic_status1(pcicptrs[i].pcicptr); 409 407 } 410 408 } 409 + 410 + #ifdef CONFIG_TOSHIBA_FPCIB0 411 + static void __init tx4927_quirk_slc90e66_bridge(struct pci_dev *dev) 412 + { 413 + struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(dev->bus); 414 + 415 + if (!pcicptr) 416 + return; 417 + if (__raw_readl(&pcicptr->pbacfg) & TX4927_PCIC_PBACFG_PBAEN) { 418 + /* Reset Bus Arbiter */ 419 + __raw_writel(TX4927_PCIC_PBACFG_RPBA, &pcicptr->pbacfg); 420 + /* 421 + * swap reqBP and reqXP (raise priority of SLC90E66). 422 + * SLC90E66(PCI-ISA bridge) is connected to REQ2 on 423 + * PCI Backplane board. 424 + */ 425 + __raw_writel(0x72543610, &pcicptr->pbareqport); 426 + __raw_writel(0, &pcicptr->pbabm); 427 + /* Use Fixed ParkMaster (required by SLC90E66) */ 428 + __raw_writel(TX4927_PCIC_PBACFG_FIXPA, &pcicptr->pbacfg); 429 + /* Enable Bus Arbiter */ 430 + __raw_writel(TX4927_PCIC_PBACFG_FIXPA | 431 + TX4927_PCIC_PBACFG_PBAEN, 432 + &pcicptr->pbacfg); 433 + printk(KERN_INFO "PCI: Use Fixed Park Master (REQPORT %08x)\n", 434 + __raw_readl(&pcicptr->pbareqport)); 435 + } 436 + } 437 + #define PCI_DEVICE_ID_EFAR_SLC90E66_0 0x9460 438 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_0, 439 + tx4927_quirk_slc90e66_bridge); 440 + #endif