diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2013-08-04 12:38:47 +0200 |
---|---|---|
committer | Linus Walleij <linus.walleij@stericsson.com> | 2013-08-07 20:39:25 +0200 |
commit | 2aaaddff8df6cdb06b17c739e8e6be5c92665962 (patch) | |
tree | 2358d60d1349b58e7ac08a2f07f0bc5f638d154f /drivers/pinctrl | |
parent | c095ba7224d8edc71dcef0d655911399a8bd4a3f (diff) | |
download | blackbird-op-linux-2aaaddff8df6cdb06b17c739e8e6be5c92665962.tar.gz blackbird-op-linux-2aaaddff8df6cdb06b17c739e8e6be5c92665962.zip |
pinctrl: sunxi: Read register before writing to it in irq_set_type
The current irq_set_type code doesn't read the current register value
before writing to it, leading to the older programmed values being
overwritten and everything but the latest value being reset.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/pinctrl-sunxi.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c index c47fd1e5450b..7b3a56c0bccd 100644 --- a/drivers/pinctrl/pinctrl-sunxi.c +++ b/drivers/pinctrl/pinctrl-sunxi.c @@ -526,6 +526,7 @@ static int sunxi_pinctrl_irq_set_type(struct irq_data *d, struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d); u32 reg = sunxi_irq_cfg_reg(d->hwirq); u8 index = sunxi_irq_cfg_offset(d->hwirq); + u32 regval; u8 mode; switch (type) { @@ -548,7 +549,9 @@ static int sunxi_pinctrl_irq_set_type(struct irq_data *d, return -EINVAL; } - writel((mode & IRQ_CFG_IRQ_MASK) << index, pctl->membase + reg); + regval = readl(pctl->membase + reg); + regval &= ~IRQ_CFG_IRQ_MASK; + writel(regval | (mode << index), pctl->membase + reg); return 0; } |