aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2017-01-26 12:24:08 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-09 02:08:28 -0500
commit2cf6c49264e40e395e73fef11f487b10b05548b4 (patch)
tree54f5ce2cb5d247b1e31806a900ae46faa56075fb
parent449d3ecfbd7640dc763dbf333131858ead6c3f11 (diff)
pinctrl: baytrail: Debounce register is one per community
commit 1b89970d81bbd52720fc64a3fe9572ee33588363 upstream. Debounce value is set globally per community. Otherwise user will easily get a kernel crash when they start using the feature: BUG: unable to handle kernel paging request at ffffc900003be000 IP: byt_gpio_dbg_show+0xa9/0x430 Make it clear in byt_gpio_reg(). Note that this fix just prevents kernel to crash, but doesn't make any difference to the existing logic. It means the last caller will win the trade and debounce value will be configured accordingly. The actual logic fix needs to be thought about and it's not as important as crash fix. That's why the latter goes separately and right now. Fixes: 658b476c742f ("pinctrl: baytrail: Add debounce configuration") Cc: Cristina Ciocan <cristina.ciocan@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/pinctrl/intel/pinctrl-baytrail.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 7f2263d61063..583ae3f38fc0 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -731,16 +731,23 @@ static void __iomem *byt_gpio_reg(struct byt_gpio *vg, unsigned int offset,
731 int reg) 731 int reg)
732{ 732{
733 struct byt_community *comm = byt_get_community(vg, offset); 733 struct byt_community *comm = byt_get_community(vg, offset);
734 u32 reg_offset = 0; 734 u32 reg_offset;
735 735
736 if (!comm) 736 if (!comm)
737 return NULL; 737 return NULL;
738 738
739 offset -= comm->pin_base; 739 offset -= comm->pin_base;
740 if (reg == BYT_INT_STAT_REG) 740 switch (reg) {
741 case BYT_INT_STAT_REG:
741 reg_offset = (offset / 32) * 4; 742 reg_offset = (offset / 32) * 4;
742 else 743 break;
744 case BYT_DEBOUNCE_REG:
745 reg_offset = 0;
746 break;
747 default:
743 reg_offset = comm->pad_map[offset] * 16; 748 reg_offset = comm->pad_map[offset] * 16;
749 break;
750 }
744 751
745 return comm->reg_base + reg_offset + reg; 752 return comm->reg_base + reg_offset + reg;
746} 753}