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

Commit 1acc845b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa3: make ipa3 compile for corbalt rumi"

parents 8fa93297 dcb0754b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2669,6 +2669,7 @@ static int ipa_generic_plat_drv_probe(struct platform_device *pdev_p)
		}
		break;
	case IPA_HW_v3_0:
	case IPA_HW_v3_1:
		result = ipa3_plat_drv_probe(pdev_p, ipa_api_ctrl,
			ipa_plat_drv_match);
		if (result) {
+9 −28
Original line number Diff line number Diff line
@@ -361,25 +361,6 @@ enum ipa_smmu_cb_type {

static struct ipa_smmu_cb_ctx smmu_cb[IPA_SMMU_CB_MAX];

#if !defined(CONFIG_ARM_DMA_USE_IOMMU) && !defined(CONFIG_ARM64_DMA_USE_IOMMU)
struct dma_iommu_mapping *ipa3_arm_iommu_create_mapping(struct bus_type *bus,
		dma_addr_t base, size_t size)
{
	return NULL;
}

void ipa3_arm_iommu_release_mapping(struct dma_iommu_mapping *mapping) { }

int ipa3_arm_iommu_attach_device(struct device *dev,
		struct dma_iommu_mapping *mapping)
{
	return 0;
}

void ipa3_arm_iommu_detach_device(struct device *dev) { }
#endif


struct iommu_domain *ipa3_get_smmu_domain(void)
{
	if (smmu_cb[IPA_SMMU_CB_AP].valid)
@@ -4043,8 +4024,8 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
	}
	if (ipa3_ctx->empty_rt_tbl_mem.phys_base &
		IPA_HW_TBL_SYSADDR_ALIGNMENT) {
		IPAERR("Empty routing table buf is not address aligned 0x%x\n",
				ipa3_ctx->empty_rt_tbl_mem.phys_base);
		IPAERR("Empty rt-table buf is not address aligned 0x%pad\n",
				&ipa3_ctx->empty_rt_tbl_mem.phys_base);
		result = -EFAULT;
		goto fail_empty_rt_tbl;
	}
@@ -4466,7 +4447,7 @@ static int ipa_smmu_uc_cb_probe(struct device *dev)
	}

	cb->dev = dev;
	cb->mapping = ipa3_arm_iommu_create_mapping(msm_iommu_get_bus(dev),
	cb->mapping = arm_iommu_create_mapping(msm_iommu_get_bus(dev),
			IPA_SMMU_UC_VA_START, IPA_SMMU_UC_VA_SIZE);
	if (IS_ERR(cb->mapping)) {
		IPADBG("Fail to create mapping\n");
@@ -4484,7 +4465,7 @@ static int ipa_smmu_uc_cb_probe(struct device *dev)
	}


	ret = ipa3_arm_iommu_attach_device(cb->dev, cb->mapping);
	ret = arm_iommu_attach_device(cb->dev, cb->mapping);
	if (ret) {
		IPAERR("could not attach device ret=%d\n", ret);
		return ret;
@@ -4513,7 +4494,7 @@ static int ipa_smmu_ap_cb_probe(struct device *dev)
	}

	cb->dev = dev;
	cb->mapping = ipa3_arm_iommu_create_mapping(msm_iommu_get_bus(dev),
	cb->mapping = arm_iommu_create_mapping(msm_iommu_get_bus(dev),
			IPA_SMMU_AP_VA_START, IPA_SMMU_AP_VA_SIZE);
	if (IS_ERR(cb->mapping)) {
		IPADBG("Fail to create mapping\n");
@@ -4526,7 +4507,7 @@ static int ipa_smmu_ap_cb_probe(struct device *dev)
				DOMAIN_ATTR_COHERENT_HTW_DISABLE,
				 &disable_htw)) {
			IPAERR("couldn't disable coherent HTW\n");
			ipa3_arm_iommu_detach_device(cb->dev);
			arm_iommu_detach_device(cb->dev);
			return -EIO;
		}
	}
@@ -4535,11 +4516,11 @@ static int ipa_smmu_ap_cb_probe(struct device *dev)
				  DOMAIN_ATTR_ATOMIC,
				  &atomic_ctx)) {
		IPAERR("couldn't set domain as atomic\n");
		ipa3_arm_iommu_detach_device(cb->dev);
		arm_iommu_detach_device(cb->dev);
		return -EIO;
	}

	result = ipa3_arm_iommu_attach_device(cb->dev, cb->mapping);
	result = arm_iommu_attach_device(cb->dev, cb->mapping);
	if (result) {
		IPAERR("couldn't attach to IOMMU ret=%d\n", result);
		return result;
@@ -4555,7 +4536,7 @@ static int ipa_smmu_ap_cb_probe(struct device *dev)
	result = ipa3_pre_init(&ipa3_res, dev);
	if (result) {
		IPAERR("ipa_init failed\n");
		ipa3_arm_iommu_detach_device(cb->dev);
		arm_iommu_detach_device(cb->dev);
		arm_iommu_release_mapping(cb->mapping);
		return result;
	}
+28 −6
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@ static int ipa_handle_rx_core_gsi(struct ipa3_sys_context *sys,
	bool process_all, bool in_poll_state);
static int ipa_handle_rx_core_sps(struct ipa3_sys_context *sys,
	bool process_all, bool in_poll_state);
static unsigned long tag_to_pointer_wa(uint64_t tag);
static uint64_t pointer_to_tag_wa(struct ipa3_tx_pkt_wrapper *tx_pkt);

static void ipa3_wq_write_done_common(struct ipa3_sys_context *sys,
				struct ipa3_tx_pkt_wrapper *tx_pkt)
@@ -2079,7 +2081,7 @@ static int ipa3_lan_rx_pyld_hdlr(struct sk_buff *skb,
	unsigned int used_align = ALIGN(used, 32);
	unsigned long unused = IPA_GENERIC_RX_BUFF_BASE_SZ - used;
	struct ipa3_tx_pkt_wrapper *tx_pkt = NULL;
	u32 ptr;
	unsigned long ptr;

	IPA_DUMP_BUFF(skb->data, 0, skb->len);

@@ -2207,9 +2209,9 @@ begin:
					kfree(comp);
				continue;
			} else {
				ptr = (u32)status->tag;
				ptr = tag_to_pointer_wa(status->tag);
				tx_pkt = (struct ipa3_tx_pkt_wrapper *)ptr;
				IPADBG("tx_pkt recv = %08x\n", (u32)tx_pkt);
				IPADBG("tx_pkt recv = %p\n", tx_pkt);
			}
		}
		if (status->pkt_len == 0) {
@@ -3501,9 +3503,8 @@ static int ipa_populate_tag_field(struct ipa3_desc *desc,
		 * This is for 32-bit pointer, will need special
		 * handling if 64-bit pointer is used
		 */
		tag->tag = (u32)tx_pkt;
		IPADBG("tx_pkt sent in tag: 0x%08x\n",
			(u32)tx_pkt);
		tag->tag = pointer_to_tag_wa(tx_pkt);
		IPADBG("tx_pkt sent in tag: 0x%p\n", tx_pkt);
		desc->pyld = tag;
		desc->len = sizeof(*tag);
		desc->user1 = tag;
@@ -3606,3 +3607,24 @@ static int ipa_handle_rx_core_sps(struct ipa3_sys_context *sys,
	}
	return cnt;
}

static unsigned long tag_to_pointer_wa(uint64_t tag)
{
	return 0xFFFF000000000000 | (unsigned long) tag;
}

static uint64_t pointer_to_tag_wa(struct ipa3_tx_pkt_wrapper *tx_pkt)
{
	u16 temp;
	/* Add the check but it might have throughput issue */
	if (ipa3_ctx->ipa_hw_type == IPA_HW_v3_1) {
		temp = (u16) (~((unsigned long) tx_pkt &
			0xFFFF000000000000) >> 48);
		if (temp) {
			IPAERR("The 16 prefix is not all 1s (%p)\n",
			tx_pkt);
			BUG();
		}
	}
	return (unsigned long)tx_pkt & 0x0000FFFFFFFFFFFF;
}
+51 −4
Original line number Diff line number Diff line
@@ -113,8 +113,19 @@ static int ipa3_handle_interrupt(int irq_num, bool isr_context)
	case IPA_TX_SUSPEND_IRQ:
		IPADBG("processing TX_SUSPEND interrupt work-around\n");
		ipa3_tx_suspend_interrupt_wa();
		if (ipa3_ctx->ipa_hw_type == IPA_HW_v3_0) {
			suspend_data = ipa_read_reg(ipa3_ctx->mmio,
					IPA_IRQ_SUSPEND_INFO_EE_n_ADDR(ipa_ee));
				IPA_IRQ_SUSPEND_INFO_EE_n_ADDR_v3_0(ipa_ee));
			IPADBG("get interrupt %d\n", suspend_data);
		} else {
			suspend_data = ipa_read_reg(ipa3_ctx->mmio,
				IPA_IRQ_SUSPEND_INFO_EE_n_ADDR_v3_1(ipa_ee));
			IPADBG("get interrupt %d\n", suspend_data);
			/* Clearing L2 interrupts status */
			ipa_write_reg(ipa3_ctx->mmio,
				IPA_SUSPEND_IRQ_CLR_EE_n_ADDR(ipa_ee),
				suspend_data);
		}
		if (!ipa3_is_valid_ep(suspend_data))
			return 0;

@@ -313,8 +324,9 @@ int ipa3_add_interrupt_handler(enum ipa_irq_type interrupt,
	u32 val;
	u32 bmsk;
	int irq_num;
	int client_idx, ep_idx;

	IPADBG("in ipa3_add_interrupt_handler\n");
	IPADBG("in ipa3_add_interrupt_handler interrupt_enum(%d)\n", interrupt);
	if (interrupt < IPA_BAD_SNOC_ACCESS_IRQ ||
		interrupt >= IPA_IRQ_MAX) {
		IPAERR("invalid interrupt number %d\n", interrupt);
@@ -327,6 +339,7 @@ int ipa3_add_interrupt_handler(enum ipa_irq_type interrupt,
		WARN_ON(1);
		return -EFAULT;
	}
	IPADBG("ipa_interrupt_to_cb irq_num(%d)\n", irq_num);

	ipa_interrupt_to_cb[irq_num].deferred_flag = deferred_flag;
	ipa_interrupt_to_cb[irq_num].handler = handler;
@@ -340,6 +353,27 @@ int ipa3_add_interrupt_handler(enum ipa_irq_type interrupt,
	ipa3_uc_rg10_write_reg(ipa3_ctx->mmio,
		IPA_IRQ_EN_EE_n_ADDR(ipa_ee), val);
	IPADBG("wrote IPA_IRQ_EN_EE_n_ADDR register. reg = %d\n", val);

	/* register SUSPEND_IRQ_EN_EE_n_ADDR for L2 interrupt*/
	if ((interrupt == IPA_TX_SUSPEND_IRQ) &&
		(ipa3_ctx->ipa_hw_type == IPA_HW_v3_1)) {
		val = ~0;
		for (client_idx = 0; client_idx < IPA_CLIENT_MAX; client_idx++)
			if (IPA_CLIENT_IS_Q6_CONS(client_idx) ||
				IPA_CLIENT_IS_Q6_PROD(client_idx)) {
				ep_idx = ipa3_get_ep_mapping(client_idx);
				IPADBG("modem ep_idx(%d) client_idx = %d\n",
					ep_idx, client_idx);
			if (ep_idx == -1)
				IPADBG("Invalid IPA client\n");
			else
				val &= ~(1 << ep_idx);
		}

		ipa_write_reg(ipa3_ctx->mmio,
			IPA_SUSPEND_IRQ_EN_EE_n_ADDR(ipa_ee), val);
		IPADBG("wrote IPA_SUSPEND_IRQ_EN_EE_n_ADDR reg = %d\n", val);
	}
	return 0;
}

@@ -374,6 +408,14 @@ int ipa3_remove_interrupt_handler(enum ipa_irq_type interrupt)
	ipa_interrupt_to_cb[irq_num].private_data = NULL;
	ipa_interrupt_to_cb[irq_num].interrupt = -1;

	/* clean SUSPEND_IRQ_EN_EE_n_ADDR for L2 interrupt */
	if ((interrupt == IPA_TX_SUSPEND_IRQ) &&
		(ipa3_ctx->ipa_hw_type == IPA_HW_v3_1)) {
		ipa_write_reg(ipa3_ctx->mmio,
			IPA_SUSPEND_IRQ_EN_EE_n_ADDR(ipa_ee), 0);
		IPADBG("wrote IPA_SUSPEND_IRQ_EN_EE_n_ADDR reg = %d\n", 0);
	}

	val = ipa_read_reg(ipa3_ctx->mmio, IPA_IRQ_EN_EE_n_ADDR(ipa_ee));
	bmsk = 1 << irq_num;
	val &= ~bmsk;
@@ -419,6 +461,11 @@ int ipa3_interrupts_init(u32 ipa_irq, u32 ee, struct device *ipa_dev)
	ipa3_uc_rg10_write_reg(ipa3_ctx->mmio,
		IPA_IRQ_CLR_EE_n_ADDR(ipa_ee), reg);

	/* Clearing L2 interrupts status */
	if (ipa3_ctx->ipa_hw_type == IPA_HW_v3_1)
		ipa_write_reg(ipa3_ctx->mmio,
			IPA_SUSPEND_IRQ_CLR_EE_n_ADDR(ipa_ee), reg);

	res = request_irq(ipa_irq, (irq_handler_t) ipa3_isr,
				IRQF_TRIGGER_RISING, "ipa", ipa_dev);
	if (res) {
+15 −3
Original line number Diff line number Diff line
@@ -13,13 +13,25 @@
#ifndef __IPA_REG_H__
#define __IPA_REG_H__

#define IPA_IRQ_STTS_EE_n_ADDR(n) (0x00003008 + 0x1000 * (n))
/*
 * IPA HW 3.1 Registers
 */
#define IPA_SUSPEND_IRQ_EN_EE_n_ADDR(n) (0x00003034 + 0x1000 * (n))
#define IPA_SUSPEND_IRQ_CLR_EE_n_ADDR(n) (0x00003038 + 0x1000 * (n))
/*
 * End of IPA 3.1 Registers
 */

#define IPA_IRQ_EN_EE_n_ADDR(n) (0x0000300c + 0x1000 * (n))
/*
Common Registers
*/

#define IPA_IRQ_STTS_EE_n_ADDR(n) (0x00003008 + 0x1000 * (n))
#define IPA_IRQ_EN_EE_n_ADDR(n) (0x0000300c + 0x1000 * (n))
#define IPA_IRQ_CLR_EE_n_ADDR(n) (0x00003010 + 0x1000 * (n))

#define IPA_IRQ_SUSPEND_INFO_EE_n_ADDR(n) (0x00003098 + 0x1000 * (n))
#define IPA_IRQ_SUSPEND_INFO_EE_n_ADDR_v3_0(n) (0x00003098 + 0x1000 * (n))
#define IPA_IRQ_SUSPEND_INFO_EE_n_ADDR_v3_1(n) (0x00003030 + 0x1000 * (n))

#define IPA_BCR_OFST 0x000001D0
#define IPA_COUNTER_CFG_OFST 0x000001f0
Loading