From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Boris BREZILLON <b.brezillon@overkiz.com>
Cc: Rob Herring <rob.herring@calxeda.com>,
Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Stephen Warren <swarren@wwwdotorg.org>,
Ian Campbell <ian.campbell@citrix.com>,
Rob Landley <rob@landley.net>,
Linus Walleij <linus.walleij@linaro.org>,
Grant Likely <grant.likely@linaro.org>,
Nicolas Ferre <nicolas.ferre@atmel.com>,
Richard Genoud <richard.genoud@gmail.com>,
Jiri Kosina <jkosina@suse.cz>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org
Subject: Re: [RFC PATCH 2/4] pinctrl: at91: fix sam9x5 debounce/deglitch functions
Date: Sat, 14 Sep 2013 18:49:08 +0200 [thread overview]
Message-ID: <20130914164908.GD11420@ns203013.ovh.net> (raw)
In-Reply-To: <1379058442-3321-1-git-send-email-b.brezillon@overkiz.com>
On 09:47 Fri 13 Sep , Boris BREZILLON wrote:
> Replace at91_mux_get_deglitch with at91_mux_pio3_get_deglitch when using
> sam9x5 (pio3) IP.
> at91_mux_get_deglitch only test the activation of the "Input Filter" which
> may be overloaded by the activation of the "Input Filter Slow Clock" to use
> the input filter as a debounce filter instead of a deglitch filter.
>
> Fix at91_mux_pio3_get_debounce to test the activation of the Input Filter
> before testing the activation of the debounce filter (Input Filter Slow
> Clock depends on Input Filter).
>
> Fix at91_mux_pio3_set_debounce function to avoid disabling the deglitch
> filter ("Input Filter") when debounce filter is disabled.
>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
> ---
> drivers/pinctrl/pinctrl-at91.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
> index 50b555a..6624bce 100644
> --- a/drivers/pinctrl/pinctrl-at91.c
> +++ b/drivers/pinctrl/pinctrl-at91.c
> @@ -417,6 +417,14 @@ static void at91_mux_set_deglitch(void __iomem *pio, unsigned mask, bool is_on)
> __raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR));
> }
>
> +static bool at91_mux_pio3_get_deglitch(void __iomem *pio, unsigned pin)
> +{
> + if ((__raw_readl(pio + PIO_IFSR) >> pin) & 0x1)
> + return !((__raw_readl(pio + PIO_IFSCSR) >> pin) & 0x1);
> +
> + return false;
> +}
> +
> static void at91_mux_pio3_set_deglitch(void __iomem *pio, unsigned mask, bool is_on)
> {
> if (is_on)
> @@ -428,7 +436,8 @@ static bool at91_mux_pio3_get_debounce(void __iomem *pio, unsigned pin, u32 *div
> {
> *div = __raw_readl(pio + PIO_SCDR);
>
> - return (__raw_readl(pio + PIO_IFSCSR) >> pin) & 0x1;
> + return ((__raw_readl(pio + PIO_IFSR) >> pin) & 0x1) &&
> + ((__raw_readl(pio + PIO_IFSCSR) >> pin) & 0x1);
> }
>
> static void at91_mux_pio3_set_debounce(void __iomem *pio, unsigned mask,
> @@ -438,9 +447,8 @@ static void at91_mux_pio3_set_debounce(void __iomem *pio, unsigned mask,
> __raw_writel(mask, pio + PIO_IFSCER);
> __raw_writel(div & PIO_SCDR_DIV, pio + PIO_SCDR);
> __raw_writel(mask, pio + PIO_IFER);
> - } else {
> - __raw_writel(mask, pio + PIO_IFDR);
> - }
> + } else
> + __raw_writel(mask, pio + PIO_IFSCDR);
> }
>
> static bool at91_mux_pio3_get_pulldown(void __iomem *pio, unsigned pin)
> @@ -478,7 +486,7 @@ static struct at91_pinctrl_mux_ops at91sam9x5_ops = {
> .mux_B_periph = at91_mux_pio3_set_B_periph,
> .mux_C_periph = at91_mux_pio3_set_C_periph,
> .mux_D_periph = at91_mux_pio3_set_D_periph,
> - .get_deglitch = at91_mux_get_deglitch,
> + .get_deglitch = at91_mux_pio3_get_deglitch,
> .set_deglitch = at91_mux_pio3_set_deglitch,
> .get_debounce = at91_mux_pio3_get_debounce,
> .set_debounce = at91_mux_pio3_set_debounce,
> --
> 1.7.9.5
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2013-09-14 17:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-13 7:43 [RFC PATCH 0/4] pinctrl: at91: various fixes Boris BREZILLON
2013-09-13 7:45 ` [RFC PATCH 1/4] pinctrl: at91: fix typos Boris BREZILLON
2013-09-14 16:45 ` Jean-Christophe PLAGNIOL-VILLARD
2013-09-27 12:10 ` Linus Walleij
2013-09-13 7:47 ` [RFC PATCH 2/4] pinctrl: at91: fix sam9x5 debounce/deglitch functions Boris BREZILLON
2013-09-14 16:49 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-09-27 12:12 ` Linus Walleij
2013-09-13 7:49 ` [RFC PATCH 3/4] pinctrl: at91: improve pinconf_set/get function robustness Boris BREZILLON
2013-09-14 16:55 ` Jean-Christophe PLAGNIOL-VILLARD
2013-09-13 7:51 ` [RFC PATCH 4/4] pinctrl: at91: check for debounce time conflicts Boris BREZILLON
2013-09-13 7:53 ` [RFC PATCH alt 4/4] pinctrl: at91: rework debounce configuration Boris BREZILLON
2013-09-13 22:40 ` Stephen Warren
2013-09-14 7:08 ` boris brezillon
2013-09-16 16:41 ` Stephen Warren
2013-09-16 17:18 ` boris brezillon
2013-09-16 18:14 ` Stephen Warren
2013-09-14 16:31 ` Jean-Christophe PLAGNIOL-VILLARD
2013-09-14 16:37 ` Jean-Christophe PLAGNIOL-VILLARD
2013-09-15 6:21 ` boris brezillon
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=20130914164908.GD11420@ns203013.ovh.net \
--to=plagnioj@jcrosoft.com \
--cc=b.brezillon@overkiz.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=jkosina@suse.cz \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=nicolas.ferre@atmel.com \
--cc=pawel.moll@arm.com \
--cc=richard.genoud@gmail.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=swarren@wwwdotorg.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
all inboxes | Powered by JetHome®