aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorBoris BREZILLON <b.brezillon@overkiz.com>2013-09-13 03:47:22 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-09-27 08:11:34 -0400
commitc8dba02e7d5552a360ee5839f828856dd3a827cd (patch)
tree3985fd90faa5b1e914dbb055f544c4d8e593dcf9 /drivers/pinctrl
parent77966ad7b68112b1a536f994d78d88a9eaca25bc (diff)
pinctrl: at91: fix sam9x5 debounce/deglitch functions
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. Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl-at91.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index fae1b4d1d692..8ed9be8b96b5 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)
417 __raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR)); 417 __raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR));
418} 418}
419 419
420static bool at91_mux_pio3_get_deglitch(void __iomem *pio, unsigned pin)
421{
422 if ((__raw_readl(pio + PIO_IFSR) >> pin) & 0x1)
423 return !((__raw_readl(pio + PIO_IFSCSR) >> pin) & 0x1);
424
425 return false;
426}
427
420static void at91_mux_pio3_set_deglitch(void __iomem *pio, unsigned mask, bool is_on) 428static void at91_mux_pio3_set_deglitch(void __iomem *pio, unsigned mask, bool is_on)
421{ 429{
422 if (is_on) 430 if (is_on)
@@ -428,7 +436,8 @@ static bool at91_mux_pio3_get_debounce(void __iomem *pio, unsigned pin, u32 *div
428{ 436{
429 *div = __raw_readl(pio + PIO_SCDR); 437 *div = __raw_readl(pio + PIO_SCDR);
430 438
431 return (__raw_readl(pio + PIO_IFSCSR) >> pin) & 0x1; 439 return ((__raw_readl(pio + PIO_IFSR) >> pin) & 0x1) &&
440 ((__raw_readl(pio + PIO_IFSCSR) >> pin) & 0x1);
432} 441}
433 442
434static void at91_mux_pio3_set_debounce(void __iomem *pio, unsigned mask, 443static 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,
438 __raw_writel(mask, pio + PIO_IFSCER); 447 __raw_writel(mask, pio + PIO_IFSCER);
439 __raw_writel(div & PIO_SCDR_DIV, pio + PIO_SCDR); 448 __raw_writel(div & PIO_SCDR_DIV, pio + PIO_SCDR);
440 __raw_writel(mask, pio + PIO_IFER); 449 __raw_writel(mask, pio + PIO_IFER);
441 } else { 450 } else
442 __raw_writel(mask, pio + PIO_IFDR); 451 __raw_writel(mask, pio + PIO_IFSCDR);
443 }
444} 452}
445 453
446static bool at91_mux_pio3_get_pulldown(void __iomem *pio, unsigned pin) 454static bool at91_mux_pio3_get_pulldown(void __iomem *pio, unsigned pin)
@@ -478,7 +486,7 @@ static struct at91_pinctrl_mux_ops at91sam9x5_ops = {
478 .mux_B_periph = at91_mux_pio3_set_B_periph, 486 .mux_B_periph = at91_mux_pio3_set_B_periph,
479 .mux_C_periph = at91_mux_pio3_set_C_periph, 487 .mux_C_periph = at91_mux_pio3_set_C_periph,
480 .mux_D_periph = at91_mux_pio3_set_D_periph, 488 .mux_D_periph = at91_mux_pio3_set_D_periph,
481 .get_deglitch = at91_mux_get_deglitch, 489 .get_deglitch = at91_mux_pio3_get_deglitch,
482 .set_deglitch = at91_mux_pio3_set_deglitch, 490 .set_deglitch = at91_mux_pio3_set_deglitch,
483 .get_debounce = at91_mux_pio3_get_debounce, 491 .get_debounce = at91_mux_pio3_get_debounce,
484 .set_debounce = at91_mux_pio3_set_debounce, 492 .set_debounce = at91_mux_pio3_set_debounce,