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

Commit 736eeab8 authored by Yuanyuan Liu's avatar Yuanyuan Liu Committed by Matt Wagantall
Browse files

icnss: Add suppport of reading membase from dts file



Add support of reading membase from dts file. This base address will
be passed to WLAN driver.

Change-Id: I7d6c2b5dfb3df95c2b41a4c2bb782d0db36c0762
Signed-off-by: default avatarYuanyuan Liu <yuanliu@codeaurora.org>
parent 7235cf3e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -8,14 +8,18 @@ WLAN PD restart notifications.

Required properties:
  - compatible: "qcom,icnss"
  - reg: Memory regions defined as starting address and size
  - reg-names: Names of the memory regions defined in reg entry
  - qcom,ce-irq-tbl: Copy engine interrupt table

Optional properties:

Example:

    qcom,icnss {
    qcom,icnss@0a000000 {
        compatible = "qcom,icnss";
        reg = <0x0a000000 0x1000000>;
        reg-names = "membase";
        qcom,ce-irq-tbl =
			<  120  /* CE0 */ >,
			<  121  /* CE1 */ >,
+30 −9
Original line number Diff line number Diff line
@@ -22,8 +22,6 @@
#include <soc/qcom/memory_dump.h>
#include <soc/qcom/icnss.h>

#define ICNSS_NUM_OF_CE_IRQS 12

struct ce_irq_list {
	int irq;
	irqreturn_t (*handler)(int, void *);
@@ -32,8 +30,10 @@ struct ce_irq_list {
static struct {
	struct platform_device *pdev;
	struct icnss_driver_ops *ops;
	struct ce_irq_list ce_irq_list[ICNSS_NUM_OF_CE_IRQS];
	u32 ce_irqs[ICNSS_NUM_OF_CE_IRQS];
	struct ce_irq_list ce_irq_list[ICNSS_MAX_IRQ_REGISTRATIONS];
	u32 ce_irqs[ICNSS_MAX_IRQ_REGISTRATIONS];
	phys_addr_t mem_base_pa;
	void __iomem *mem_base_va;
} *penv;

int icnss_register_driver(struct icnss_driver_ops *ops)
@@ -109,7 +109,7 @@ int icnss_register_ce_irq(unsigned int ce_id,
		ret = -ENODEV;
		goto out;
	}
	if (ce_id >= ICNSS_NUM_OF_CE_IRQS) {
	if (ce_id >= ICNSS_MAX_IRQ_REGISTRATIONS) {
		pr_err("icnss: Invalid CE ID %d\n", ce_id);
		ret = -EINVAL;
		goto out;
@@ -191,9 +191,15 @@ EXPORT_SYMBOL(icnss_disable_irq);

int icnss_get_soc_info(struct icnss_soc_info *info)
{
	int ret = 0;
	if (!penv) {
		pr_err("icnss: platform driver not initialized\n");
		return -EINVAL;
	}

	return ret;
	info->v_addr = penv->mem_base_va;
	info->p_addr = penv->mem_base_pa;

	return 0;
}
EXPORT_SYMBOL(icnss_get_soc_info);

@@ -214,6 +220,7 @@ static int icnss_probe(struct platform_device *pdev)
{
	int ret = 0;
	int len = 0;
	struct resource *res;

	if (penv)
		return -EEXIST;
@@ -224,19 +231,33 @@ static int icnss_probe(struct platform_device *pdev)

	penv->pdev = pdev;

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "membase");
	if (!res) {
		pr_err("icnss: Memory base not found\n");
		ret = -EINVAL;
		goto out;
	}
	penv->mem_base_pa = res->start;
	penv->mem_base_va = ioremap(penv->mem_base_pa, resource_size(res));
	if (!penv->mem_base_va) {
		pr_err("icnss: ioremap failed\n");
		ret = -EINVAL;
		goto out;
	}

	if (!of_find_property(pdev->dev.of_node, "qcom,ce-irq-tbl", &len)) {
		pr_err("icnss: CE IRQ table not found\n");
		ret = -EINVAL;
		goto out;
	}
	if (len != ICNSS_NUM_OF_CE_IRQS * sizeof(u32)) {
	if (len != ICNSS_MAX_IRQ_REGISTRATIONS * sizeof(u32)) {
		pr_err("icnss: invalid CE IRQ table %d\n", len);
		ret = -EINVAL;
		goto out;
	}

	ret = of_property_read_u32_array(pdev->dev.of_node,
		"qcom,ce-irq-tbl", penv->ce_irqs, ICNSS_NUM_OF_CE_IRQS);
		"qcom,ce-irq-tbl", penv->ce_irqs, ICNSS_MAX_IRQ_REGISTRATIONS);
	if (ret) {
		pr_err("icnss: IRQ table not read ret = %d\n", ret);
		goto out;
+6 −4
Original line number Diff line number Diff line
@@ -12,6 +12,8 @@
#ifndef _ICNSS_WLAN_H_
#define _ICNSS_WLAN_H_

#define ICNSS_MAX_IRQ_REGISTRATIONS    12

struct icnss_driver_ops {
	char *name;
	int (*probe)(struct device *dev);
@@ -19,8 +21,8 @@ struct icnss_driver_ops {
	void (*shutdown)(struct device *dev);
	int (*reinit)(struct device *dev);
	void (*crash_shutdown)(void *pdev);
	void (*suspend)(struct device *dev, pm_message_t state);
	void (*resume)(struct device *dev);
	int (*suspend)(struct device *dev, pm_message_t state);
	int (*resume)(struct device *dev);
};


@@ -55,8 +57,8 @@ enum icnss_driver_mode {
};

struct icnss_soc_info {
	u64 v_addr;
	u64 p_addr;
	void __iomem *v_addr;
	phys_addr_t p_addr;
	u32 version;
};