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

powerpc/85xx: workaround for chips with MSI hardware errata

The MPIC version 2.0 has a MSI errata (errata PIC1 of mpc8544), It causes
that neither MSI nor MSI-X can work fine. This is a workaround to allow
MSI-X to function properly.

Signed-off-by: Liu Shuo <soniccat.liu@gmail.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Jia Hongtao <hongtao.jia@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>

authored by

Hongtao Jia and committed by
Scott Wood
ff015659 807d38b7

+28 -3
+26 -3
arch/powerpc/sysdev/fsl_msi.c
··· 162 162 msg->address_lo = lower_32_bits(address); 163 163 msg->address_hi = upper_32_bits(address); 164 164 165 - msg->data = hwirq; 165 + /* 166 + * MPIC version 2.0 has erratum PIC1. It causes 167 + * that neither MSI nor MSI-X can work fine. 168 + * This is a workaround to allow MSI-X to function 169 + * properly. It only works for MSI-X, we prevent 170 + * MSI on buggy chips in fsl_setup_msi_irqs(). 171 + */ 172 + if (msi_data->feature & MSI_HW_ERRATA_ENDIAN) 173 + msg->data = __swab32(hwirq); 174 + else 175 + msg->data = hwirq; 166 176 167 177 pr_debug("%s: allocated srs: %d, ibs: %d\n", __func__, 168 178 (hwirq >> msi_data->srs_shift) & MSI_SRS_MASK, ··· 190 180 struct msi_msg msg; 191 181 struct fsl_msi *msi_data; 192 182 193 - if (type == PCI_CAP_ID_MSIX) 194 - pr_debug("fslmsi: MSI-X untested, trying anyway.\n"); 183 + if (type == PCI_CAP_ID_MSI) { 184 + /* 185 + * MPIC version 2.0 has erratum PIC1. For now MSI 186 + * could not work. So check to prevent MSI from 187 + * being used on the board with this erratum. 188 + */ 189 + list_for_each_entry(msi_data, &msi_head, list) 190 + if (msi_data->feature & MSI_HW_ERRATA_ENDIAN) 191 + return -EINVAL; 192 + } 195 193 196 194 /* 197 195 * If the PCI node has an fsl,msi property, then we need to use it ··· 463 445 } 464 446 465 447 msi->feature = features->fsl_pic_ip; 448 + 449 + /* For erratum PIC1 on MPIC version 2.0*/ 450 + if ((features->fsl_pic_ip & FSL_PIC_IP_MASK) == FSL_PIC_IP_MPIC 451 + && (fsl_mpic_primary_get_version() == 0x0200)) 452 + msi->feature |= MSI_HW_ERRATA_ENDIAN; 466 453 467 454 /* 468 455 * Remember the phandle, so that we can match with any PCI nodes
+2
arch/powerpc/sysdev/fsl_msi.h
··· 27 27 #define FSL_PIC_IP_IPIC 0x00000002 28 28 #define FSL_PIC_IP_VMPIC 0x00000003 29 29 30 + #define MSI_HW_ERRATA_ENDIAN 0x00000010 31 + 30 32 struct fsl_msi_cascade_data; 31 33 32 34 struct fsl_msi {