From: Linus Walleij <linus.walleij@linaro.org>
To: Yinbo Zhu <zhuyinbo@loongson.cn>
Cc: Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
zhanghongchen <zhanghongchen@loongson.cn>
Subject: Re: [PATCH v1 1/2] pinctrl: pinctrl-loongson2: add pinctrl driver support
Date: Fri, 21 Oct 2022 11:45:49 +0200 [thread overview]
Message-ID: <CACRpkdbBW1YNGfec2jEPsUGwqosc8TwwSP9ft+he5KWPf0otvw@mail.gmail.com> (raw)
In-Reply-To: <20221021012728.22373-1-zhuyinbo@loongson.cn>
Hi Yinbo,
thanks for your patch!
On Fri, Oct 21, 2022 at 3:27 AM Yinbo Zhu <zhuyinbo@loongson.cn> wrote:
> The loongson2 SoC has a few pins that can be used as GPIOs or take
> multiple other functions. Add a driver for the pinmuxing.
>
> There is currently no support for GPIO pin pull-up and pull-down.
>
> Signed-off-by: zhanghongchen <zhanghongchen@loongson.cn>
> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
(...)
> +static int loongson2_pmx_set_mux(struct pinctrl_dev *pcdev, unsigned int func_num,
> + unsigned int group_num)
> +{
> + struct loongson2_pinctrl *pctrl = pinctrl_dev_get_drvdata(pcdev);
> + unsigned long reg = (unsigned long)pctrl->reg_base +
> + loongson2_pmx_groups[group_num].reg;
> + unsigned int mux_bit = loongson2_pmx_groups[group_num].bit;
> + unsigned int val;
> + unsigned long flags;
> +
> + raw_spin_lock_irqsave(&pctrl->lock, flags);
> + val = readl((void *)reg);
> + if (func_num == 0)
> + val &= ~(1<<mux_bit);
> + else
> + val |= (1<<mux_bit);
> + writel(val, (void *)reg);
> + raw_spin_unlock_irqrestore(&pctrl->lock, flags);
Can you explain in the commit message or with a comment in the code
why you have to use a raw spinlock for this?
We usually only use raw spinlocks for things like low level
interrupt handlers...
My guess is that you can replace this with an ordinary spinlock.
Yours,
Linus Walleij
next prev parent reply other threads:[~2022-10-21 9:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 1:27 [PATCH v1 1/2] pinctrl: pinctrl-loongson2: add pinctrl driver support Yinbo Zhu
2022-10-21 1:27 ` [PATCH v1 2/2] dt-bindings: pinctrl: add loongson2 pinctrl Yinbo Zhu
2022-10-21 1:49 ` Krzysztof Kozlowski
2022-10-21 1:44 ` [PATCH v1 1/2] pinctrl: pinctrl-loongson2: add pinctrl driver support Krzysztof Kozlowski
2022-10-21 9:45 ` Linus Walleij [this message]
2022-10-22 1:55 ` Yinbo Zhu
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=CACRpkdbBW1YNGfec2jEPsUGwqosc8TwwSP9ft+he5KWPf0otvw@mail.gmail.com \
--to=linus.walleij@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=zhanghongchen@loongson.cn \
--cc=zhuyinbo@loongson.cn \
/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).