Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b6f93ab authored by Siddartha Mohanadoss's avatar Siddartha Mohanadoss Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarSiddartha Mohanadoss <smohanad@codeaurora.org>
parent 0dab3364
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -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)
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;
	static u32 changes;


	if (ep_pcie_dev.link_status == EP_PCIE_LINK_DISABLED) {
	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);
	lower = readl_relaxed(ep_pcie_dev.dm_core + PCIE20_MSI_LOWER);
	upper = readl_relaxed(ep_pcie_dev.dm_core + PCIE20_MSI_UPPER);
	upper = readl_relaxed(ep_pcie_dev.dm_core + PCIE20_MSI_UPPER);
	data = readl_relaxed(ep_pcie_dev.dm_core + PCIE20_MSI_DATA);
	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,
	EP_PCIE_DBG(&ep_pcie_dev,
		"PCIe V%d: MSI info: lower:0x%x; upper:0x%x; data:0x%x.\n",
		"PCIe V%d: MSI info: lower:0x%x; upper:0x%x; data:0x%x.\n",
		ep_pcie_dev.rev, lower, upper, data);
		ep_pcie_dev.rev, lower, upper, data);


	if (lower && data) {
	if (ctrl_reg & BIT(16)) {
		struct resource *msi =
		struct resource *msi =
				ep_pcie_dev.res[EP_PCIE_RES_MSI].resource;
				ep_pcie_dev.res[EP_PCIE_RES_MSI].resource;
		ep_pcie_config_outbound_iatu_entry(&ep_pcie_dev,
		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)
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) {
	if (ep_pcie_dev.link_status == EP_PCIE_LINK_DISABLED) {
		EP_PCIE_ERR(&ep_pcie_dev,
		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);
	addr = readl_relaxed(ep_pcie_dev.dm_core + PCIE20_MSI_LOWER);
	data = readl_relaxed(ep_pcie_dev.dm_core + PCIE20_MSI_DATA);
	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_dev.msi_counter++;
		EP_PCIE_DUMP(&ep_pcie_dev,
		EP_PCIE_DUMP(&ep_pcie_dev,
			"PCIe V%d: No. %ld MSI fired for IRQ %d; index from client:%d\n",
			"PCIe V%d: No. %ld MSI fired for IRQ %d; index from client:%d\n",