From 2034addc7e193dc81d7ca60d8884832751b76758 Mon Sep 17 00:00:00 2001 From: Ajay Kishore Date: Tue, 24 Jan 2017 14:14:16 +0530 Subject: pinctrl: qcom: use scm_call to route GPIO irq to Apps For IPQ806x targets, TZ protects the registers that are used to configure the routing of interrupts to a target processor. To resolve this, this patch uses scm call to route GPIO interrupts to application processor. Also the scm call interface is changed. Change-Id: Ib6c06829d04bc8c20483c36e63da92e26cdef9ce Signed-off-by: Ajay Kishore --- --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -22,7 +22,8 @@ #include #include #include - +#include +#include #include "../core.h" #include "../pinconf.h" #include "pinctrl-msm.h" @@ -706,6 +707,9 @@ static void msm_gpio_irq_mask(struct irq const struct msm_pingroup *g; unsigned long flags; u32 val; + u32 addr; + int ret; + const __be32 *reg; g = &pctrl->soc->groups[d->hwirq]; @@ -819,6 +823,7 @@ static int msm_gpio_irq_set_type(struct const struct msm_pingroup *g; unsigned long flags; u32 val; + int ret; g = &pctrl->soc->groups[d->hwirq]; @@ -832,11 +837,30 @@ static int msm_gpio_irq_set_type(struct else clear_bit(d->hwirq, pctrl->dual_edge_irqs); + ret = of_device_is_compatible(pctrl->dev->of_node, + "qcom,ipq8064-pinctrl"); /* Route interrupts to application cpu */ - val = msm_readl_intr_target(pctrl, g); - val &= ~(7 << g->intr_target_bit); - val |= g->intr_target_kpss_val << g->intr_target_bit; - msm_writel_intr_target(val, pctrl, g); + if (!ret) { + val = msm_readl_intr_target(pctrl, g); + val &= ~(7 << g->intr_target_bit); + val |= g->intr_target_kpss_val << g->intr_target_bit; + msm_writel_intr_target(val, pctrl, g); + } else { + const __be32 *reg = of_get_property(pctrl->dev->of_node, "reg", NULL); + if (reg) { + u32 addr = be32_to_cpup(reg) + g->intr_target_reg; + qcom_scm_io_readl(addr, &val); + __iormb(); + + val &= ~(7 << g->intr_target_bit); + val |= g->intr_target_kpss_val << g->intr_target_bit; + + __iowmb(); + ret = qcom_scm_io_writel(addr, val); + if (ret) + pr_err("\n Routing interrupts to Apps proc failed"); + } + } /* Update configuration for gpio. * RAW_STATUS_EN is left on for all gpio irqs. Due to the