From 980cf128c7db5e2f6ad7f7922bfd9c7c7258958b Mon Sep 17 00:00:00 2001 From: Siddartha Mohanadoss Date: Wed, 19 Aug 2015 17:34:13 -0700 Subject: [PATCH] msm: ep_pcie: Update MSI configuration Update check for valid MSI enable and setting using MSI_ENABLE bit instead of address and data. Host can set address and data to 0 therefore check if MSI_ENABLE is set. Change-Id: I686c3ed155b8c5c843d12a49218f4720655dcc18 Signed-off-by: Siddartha Mohanadoss --- drivers/platform/msm/ep_pcie/ep_pcie_core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/platform/msm/ep_pcie/ep_pcie_core.c b/drivers/platform/msm/ep_pcie/ep_pcie_core.c index 021a5eba29b8..a72b0eb4b36c 100644 --- a/drivers/platform/msm/ep_pcie/ep_pcie_core.c +++ b/drivers/platform/msm/ep_pcie/ep_pcie_core.c @@ -1562,7 +1562,7 @@ int ep_pcie_core_config_outbound_iatu(struct ep_pcie_iatu entries[], int ep_pcie_core_get_msi_config(struct ep_pcie_msi_config *cfg) { - u32 cap, lower, upper, data; + u32 cap, lower, upper, data, ctrl_reg; static u32 changes; if (ep_pcie_dev.link_status == EP_PCIE_LINK_DISABLED) { @@ -1586,12 +1586,14 @@ int ep_pcie_core_get_msi_config(struct ep_pcie_msi_config *cfg) lower = readl_relaxed(ep_pcie_dev.dm_core + PCIE20_MSI_LOWER); upper = readl_relaxed(ep_pcie_dev.dm_core + PCIE20_MSI_UPPER); data = readl_relaxed(ep_pcie_dev.dm_core + PCIE20_MSI_DATA); + ctrl_reg = readl_relaxed(ep_pcie_dev.dm_core + + PCIE20_MSI_CAP_ID_NEXT_CTRL); EP_PCIE_DBG(&ep_pcie_dev, "PCIe V%d: MSI info: lower:0x%x; upper:0x%x; data:0x%x.\n", ep_pcie_dev.rev, lower, upper, data); - if (lower && data) { + if (ctrl_reg & BIT(16)) { struct resource *msi = ep_pcie_dev.res[EP_PCIE_RES_MSI].resource; ep_pcie_config_outbound_iatu_entry(&ep_pcie_dev, @@ -1632,7 +1634,7 @@ int ep_pcie_core_get_msi_config(struct ep_pcie_msi_config *cfg) int ep_pcie_core_trigger_msi(u32 idx) { - u32 addr, data; + u32 addr, data, ctrl_reg; if (ep_pcie_dev.link_status == EP_PCIE_LINK_DISABLED) { EP_PCIE_ERR(&ep_pcie_dev, @@ -1643,8 +1645,10 @@ int ep_pcie_core_trigger_msi(u32 idx) addr = readl_relaxed(ep_pcie_dev.dm_core + PCIE20_MSI_LOWER); data = readl_relaxed(ep_pcie_dev.dm_core + PCIE20_MSI_DATA); + ctrl_reg = readl_relaxed(ep_pcie_dev.dm_core + + PCIE20_MSI_CAP_ID_NEXT_CTRL); - if (addr && data) { + if (ctrl_reg & BIT(16)) { ep_pcie_dev.msi_counter++; EP_PCIE_DUMP(&ep_pcie_dev, "PCIe V%d: No. %ld MSI fired for IRQ %d; index from client:%d\n",