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

powerpc/fsl-pci: Add a workaround for PCI 5 errata

Issue:
As a master, the PCI IP block can combine a memory write to the last PCI
double word (4 bytes) of a cacheline with a 4 byte memory write to the
first PCI double word of the subsequent cacheline. This affects 32-bit
PCI target devices that blindly assert STOP on memory-write transactions,
without detecting that the data beat being transferred is the last data
beat of the transaction. It can cause a hang. PCI-X operation is not
affected by this erratum.

Workaround:
Setting the bit MDS in the PCI Bus Function Register will disable the
combining of crossing cacheline boundary requests into one burst
transaction. Therefore, it can prevent the errata scenario from
occurring.

This errata exists in MPC8543, MPC8543E, MPC8545, MPC8545E, MPC8547,
MPC8547E, MPC8548 and MPC8548E. Refer to PCI 5 in MPC8548 errata
document.

Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
Signed-off-by: Zhiqiang Hou <Zhiqiang.Hou@freescale.com>
[scottwood: whitespace fix]
Signed-off-by: Scott Wood <oss@buserror.net>

authored by

chenhui zhao and committed by
Scott Wood
a8165d42 6a369fa2

+24
+24
arch/powerpc/sysdev/fsl_pci.c
··· 37 37 #include <asm/pci-bridge.h> 38 38 #include <asm/ppc-pci.h> 39 39 #include <asm/machdep.h> 40 + #include <asm/mpc85xx.h> 40 41 #include <asm/disassemble.h> 41 42 #include <asm/ppc-opcode.h> 42 43 #include <sysdev/fsl_soc.h> ··· 528 527 u8 hdr_type, progif; 529 528 struct device_node *dev; 530 529 struct ccsr_pci __iomem *pci; 530 + u16 temp; 531 + u32 svr = mfspr(SPRN_SVR); 531 532 532 533 dev = pdev->dev.of_node; 533 534 ··· 599 596 PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS; 600 597 if (fsl_pcie_check_link(hose)) 601 598 hose->indirect_type |= PPC_INDIRECT_TYPE_NO_PCIE_LINK; 599 + } else { 600 + /* 601 + * Set PBFR(PCI Bus Function Register)[10] = 1 to 602 + * disable the combining of crossing cacheline 603 + * boundary requests into one burst transaction. 604 + * PCI-X operation is not affected. 605 + * Fix erratum PCI 5 on MPC8548 606 + */ 607 + #define PCI_BUS_FUNCTION 0x44 608 + #define PCI_BUS_FUNCTION_MDS 0x400 /* Master disable streaming */ 609 + if (((SVR_SOC_VER(svr) == SVR_8543) || 610 + (SVR_SOC_VER(svr) == SVR_8545) || 611 + (SVR_SOC_VER(svr) == SVR_8547) || 612 + (SVR_SOC_VER(svr) == SVR_8548)) && 613 + !early_find_capability(hose, 0, 0, PCI_CAP_ID_PCIX)) { 614 + early_read_config_word(hose, 0, 0, 615 + PCI_BUS_FUNCTION, &temp); 616 + temp |= PCI_BUS_FUNCTION_MDS; 617 + early_write_config_word(hose, 0, 0, 618 + PCI_BUS_FUNCTION, temp); 619 + } 602 620 } 603 621 604 622 printk(KERN_INFO "Found FSL PCI host bridge at 0x%016llx. "