From: "Heiko Stübner" <heiko@sntech.de>
To: Doug Anderson <dianders@chromium.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Sonny Rao <sonnyrao@chromium.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Chris Zhong <zyw@rock-chips.com>,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] pinctrl: rockchip: Fix enable/disable/mask/unmask
Date: Wed, 19 Nov 2014 20:17:34 +0100 [thread overview]
Message-ID: <1768585.5TrMbB8pvA@diego> (raw)
In-Reply-To: <1416354596-15013-3-git-send-email-dianders@chromium.org>
Am Dienstag, 18. November 2014, 15:49:56 schrieb Doug Anderson:
> The Rockchip pinctrl driver was only implementing the "mask" and
> "unmask" operations though the hardware actually has two distinct
> things: enable/disable and mask/unmask. It was implementing the
> "mask" operations as a hardware enable/disable and always leaving all
> interrupts unmasked.
>
> I believe that the old system had some downsides, specifically:
> - (Untested) if an interrupt went off while interrupts were "masked"
> it would be lost. Now it will be kept track of.
> - If someone wanted to change an interrupt back into a GPIO (is such a
> thing sensible?) by calling irq_disable() it wouldn't actually take
> effect. That's because Linux does some extra optimizations when
> there's no true "disable" function: it does a lazy mask.
>
> Let's actually implement enable/disable/mask/unmask properly.
>
> Signed-off-by: Doug Anderson <dianders@chromium.org>
There is one small issue concerning a personal style-preference below.
Otherwise
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
@LinusW: any preference on how to handle these follow up changes - like
another pull on top of the last, or do you simply want to apply these two
yourself?
> ---
> drivers/pinctrl/pinctrl-rockchip.c | 30 +++++++++++++++++++++++++++---
> 1 file changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c
> b/drivers/pinctrl/pinctrl-rockchip.c index e91e845..60d1a49 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -1562,6 +1562,28 @@ static void rockchip_irq_resume(struct irq_data *d)
> irq_reg_writel(gc, bank->saved_enables, GPIO_INTEN);
> }
>
> +static void rockchip_irq_disable(struct irq_data *d)
> +{
> + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
> + u32 val;
> +
> + irq_gc_lock(gc);
> + val = irq_reg_readl(gc, GPIO_INTEN);
> + irq_reg_writel(gc, val & ~d->mask, GPIO_INTEN);
personally I'd prefer this to be a bit more spread out, i.e.
val = irq_reg_readl(gc, GPIO_INTEN);
val &= ~d->mask;
irq_reg_writel(gc, val, GPIO_INTEN);
makes reading a bit easier
> + irq_gc_unlock(gc);
> +}
> +
> +static void rockchip_irq_enable(struct irq_data *d)
> +{
> + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
> + u32 val;
> +
> + irq_gc_lock(gc);
> + val = irq_reg_readl(gc, GPIO_INTEN);
> + irq_reg_writel(gc, val | d->mask, GPIO_INTEN);
same here
> + irq_gc_unlock(gc);
> +}
> +
> static int rockchip_interrupts_register(struct platform_device *pdev,
> struct rockchip_pinctrl *info)
> {
> @@ -1600,11 +1622,13 @@ static int rockchip_interrupts_register(struct
> platform_device *pdev, gc = irq_get_domain_generic_chip(bank->domain, 0);
> gc->reg_base = bank->reg_base;
> gc->private = bank;
> - gc->chip_types[0].regs.mask = GPIO_INTEN;
> + gc->chip_types[0].regs.mask = GPIO_INTMASK;
> gc->chip_types[0].regs.ack = GPIO_PORTS_EOI;
> gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit;
> - gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;
> - gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;
> + gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
> + gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
> + gc->chip_types[0].chip.irq_enable = rockchip_irq_enable;
> + gc->chip_types[0].chip.irq_disable = rockchip_irq_disable;
> gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake;
> gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend;
> gc->chip_types[0].chip.irq_resume = rockchip_irq_resume;
WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] pinctrl: rockchip: Fix enable/disable/mask/unmask
Date: Wed, 19 Nov 2014 20:17:34 +0100 [thread overview]
Message-ID: <1768585.5TrMbB8pvA@diego> (raw)
In-Reply-To: <1416354596-15013-3-git-send-email-dianders@chromium.org>
Am Dienstag, 18. November 2014, 15:49:56 schrieb Doug Anderson:
> The Rockchip pinctrl driver was only implementing the "mask" and
> "unmask" operations though the hardware actually has two distinct
> things: enable/disable and mask/unmask. It was implementing the
> "mask" operations as a hardware enable/disable and always leaving all
> interrupts unmasked.
>
> I believe that the old system had some downsides, specifically:
> - (Untested) if an interrupt went off while interrupts were "masked"
> it would be lost. Now it will be kept track of.
> - If someone wanted to change an interrupt back into a GPIO (is such a
> thing sensible?) by calling irq_disable() it wouldn't actually take
> effect. That's because Linux does some extra optimizations when
> there's no true "disable" function: it does a lazy mask.
>
> Let's actually implement enable/disable/mask/unmask properly.
>
> Signed-off-by: Doug Anderson <dianders@chromium.org>
There is one small issue concerning a personal style-preference below.
Otherwise
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
@LinusW: any preference on how to handle these follow up changes - like
another pull on top of the last, or do you simply want to apply these two
yourself?
> ---
> drivers/pinctrl/pinctrl-rockchip.c | 30 +++++++++++++++++++++++++++---
> 1 file changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c
> b/drivers/pinctrl/pinctrl-rockchip.c index e91e845..60d1a49 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -1562,6 +1562,28 @@ static void rockchip_irq_resume(struct irq_data *d)
> irq_reg_writel(gc, bank->saved_enables, GPIO_INTEN);
> }
>
> +static void rockchip_irq_disable(struct irq_data *d)
> +{
> + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
> + u32 val;
> +
> + irq_gc_lock(gc);
> + val = irq_reg_readl(gc, GPIO_INTEN);
> + irq_reg_writel(gc, val & ~d->mask, GPIO_INTEN);
personally I'd prefer this to be a bit more spread out, i.e.
val = irq_reg_readl(gc, GPIO_INTEN);
val &= ~d->mask;
irq_reg_writel(gc, val, GPIO_INTEN);
makes reading a bit easier
> + irq_gc_unlock(gc);
> +}
> +
> +static void rockchip_irq_enable(struct irq_data *d)
> +{
> + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
> + u32 val;
> +
> + irq_gc_lock(gc);
> + val = irq_reg_readl(gc, GPIO_INTEN);
> + irq_reg_writel(gc, val | d->mask, GPIO_INTEN);
same here
> + irq_gc_unlock(gc);
> +}
> +
> static int rockchip_interrupts_register(struct platform_device *pdev,
> struct rockchip_pinctrl *info)
> {
> @@ -1600,11 +1622,13 @@ static int rockchip_interrupts_register(struct
> platform_device *pdev, gc = irq_get_domain_generic_chip(bank->domain, 0);
> gc->reg_base = bank->reg_base;
> gc->private = bank;
> - gc->chip_types[0].regs.mask = GPIO_INTEN;
> + gc->chip_types[0].regs.mask = GPIO_INTMASK;
> gc->chip_types[0].regs.ack = GPIO_PORTS_EOI;
> gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit;
> - gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;
> - gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;
> + gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
> + gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
> + gc->chip_types[0].chip.irq_enable = rockchip_irq_enable;
> + gc->chip_types[0].chip.irq_disable = rockchip_irq_disable;
> gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake;
> gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend;
> gc->chip_types[0].chip.irq_resume = rockchip_irq_resume;
next prev parent reply other threads:[~2014-11-19 19:13 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 23:49 [PATCH 0/2] Pinctrl fixes for rockchip Doug Anderson
2014-11-18 23:49 ` Doug Anderson
2014-11-18 23:49 ` [PATCH 1/2] pinctrl: rockchip: Handle wakeup pins Doug Anderson
2014-11-18 23:49 ` Doug Anderson
2014-11-19 17:55 ` Dmitry Torokhov
2014-11-19 17:55 ` Dmitry Torokhov
2014-11-19 18:36 ` Heiko Stübner
2014-11-19 18:36 ` Heiko Stübner
2014-11-18 23:49 ` [PATCH 2/2] pinctrl: rockchip: Fix enable/disable/mask/unmask Doug Anderson
2014-11-18 23:49 ` Doug Anderson
2014-11-19 17:54 ` Doug Anderson
2014-11-19 17:54 ` Doug Anderson
2014-11-19 18:46 ` Heiko Stübner
2014-11-19 18:46 ` Heiko Stübner
2014-11-19 18:48 ` Doug Anderson
2014-11-19 18:48 ` Doug Anderson
2014-11-19 18:48 ` Doug Anderson
2014-11-19 17:56 ` Dmitry Torokhov
2014-11-19 17:56 ` Dmitry Torokhov
2014-11-19 19:17 ` Heiko Stübner [this message]
2014-11-19 19:17 ` Heiko Stübner
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=1768585.5TrMbB8pvA@diego \
--to=heiko@sntech.de \
--cc=dianders@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=sonnyrao@chromium.org \
--cc=zyw@rock-chips.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.