Skip to content

Commit ff01565

Browse files
Hongtao JiaScott Wood
authored andcommitted
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>
1 parent 807d38b commit ff01565

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

‎arch/powerpc/sysdev/fsl_msi.c‎

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,17 @@ static void fsl_compose_msi_msg(struct pci_dev *pdev, int hwirq,
162162
msg->address_lo = lower_32_bits(address);
163163
msg->address_hi = upper_32_bits(address);
164164

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;
166176

167177
pr_debug("%s: allocated srs: %d, ibs: %d\n", __func__,
168178
(hwirq >> msi_data->srs_shift) & MSI_SRS_MASK,
@@ -180,8 +190,16 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
180190
struct msi_msg msg;
181191
struct fsl_msi *msi_data;
182192

183-
if (type == PCI_CAP_ID_MSIX)
184-
pr_debug("fslmsi: MSI-X untested, trying anyway.\n");
193+
if (type == PCI_CAP_ID_MSI) {
194+
/*
195+
* MPIC version 2.0 has erratum PIC1. For now MSI
196+
* could not work. So check to prevent MSI from
197+
* being used on the board with this erratum.
198+
*/
199+
list_for_each_entry(msi_data, &msi_head, list)
200+
if (msi_data->feature & MSI_HW_ERRATA_ENDIAN)
201+
return -EINVAL;
202+
}
185203

186204
/*
187205
* If the PCI node has an fsl,msi property, then we need to use it
@@ -446,6 +464,11 @@ static int fsl_of_msi_probe(struct platform_device *dev)
446464

447465
msi->feature = features->fsl_pic_ip;
448466

467+
/* For erratum PIC1 on MPIC version 2.0*/
468+
if ((features->fsl_pic_ip & FSL_PIC_IP_MASK) == FSL_PIC_IP_MPIC
469+
&& (fsl_mpic_primary_get_version() == 0x0200))
470+
msi->feature |= MSI_HW_ERRATA_ENDIAN;
471+
449472
/*
450473
* Remember the phandle, so that we can match with any PCI nodes
451474
* that have an "fsl,msi" property.

‎arch/powerpc/sysdev/fsl_msi.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#define FSL_PIC_IP_IPIC 0x00000002
2828
#define FSL_PIC_IP_VMPIC 0x00000003
2929

30+
#define MSI_HW_ERRATA_ENDIAN 0x00000010
31+
3032
struct fsl_msi_cascade_data;
3133

3234
struct fsl_msi {

0 commit comments

Comments
 (0)