linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Ansuel Smith <ansuelsmth@gmail.com>
Cc: Andy Gross <agross@kernel.org>,
	Ajay Kishore <akisho@codeaurora.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	MSM <linux-arm-msm@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pinctrl: qcom: use scm_call to route GPIO irq to Apps
Date: Thu, 26 Mar 2020 00:31:57 +0100	[thread overview]
Message-ID: <CACRpkdYvCHB_1FkHft3875iNZm9cGizFVLQQR56Lr95tEB_kwg@mail.gmail.com> (raw)
In-Reply-To: <20200313191513.11365-1-ansuelsmth@gmail.com>

On Fri, Mar 13, 2020 at 8:15 PM Ansuel Smith <ansuelsmth@gmail.com> wrote:

> 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.
>
> Signed-off-by: Ajay Kishore <akisho@codeaurora.org>
> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>

That's advanced. I'd really like Bjorn's review on this.

> +       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) {

Can't you just:

if (!of_device_is_compatible(pctrl->dev->of_node, "qcom,ipq8064-pinctrl")) {

OK maybe nitpicky.

> +               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");
> +               }

Can we at least put a little comment on top here and explain what is
going on?

Yours,
Linus Walleij

  reply	other threads:[~2020-03-25 23:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-13 19:15 [PATCH] pinctrl: qcom: use scm_call to route GPIO irq to Apps Ansuel Smith
2020-03-25 23:31 ` Linus Walleij [this message]
2020-03-26  0:48 ` Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACRpkdYvCHB_1FkHft3875iNZm9cGizFVLQQR56Lr95tEB_kwg@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=agross@kernel.org \
    --cc=akisho@codeaurora.org \
    --cc=ansuelsmth@gmail.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).