Commit 5ae8cf79 authored by Doug Anderson's avatar Doug Anderson Committed by Linus Walleij

pinctrl: exynos: Add spinlocks to irq_mask and irq_unmask

The patch:
  19846950 pinctrl: samsung: Protect bank registers with a spinlock

...added spinlocks to protect many accesses.  However, the irq_mask
and irq_unmask functions still do an unprotected read/modify/write.
Add the spinlock there.
Signed-off-by: default avatarDoug Anderson <dianders@chromium.org>
Acked-by: default avatarTomasz Figa <t.figa@samsung.com>
Acked-by: default avatarKukjin Kim <kgene.kim@samsung.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent ce06f407
...@@ -56,10 +56,15 @@ static void exynos_gpio_irq_unmask(struct irq_data *irqd) ...@@ -56,10 +56,15 @@ static void exynos_gpio_irq_unmask(struct irq_data *irqd)
struct samsung_pinctrl_drv_data *d = bank->drvdata; struct samsung_pinctrl_drv_data *d = bank->drvdata;
unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset; unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset;
unsigned long mask; unsigned long mask;
unsigned long flags;
spin_lock_irqsave(&bank->slock, flags);
mask = readl(d->virt_base + reg_mask); mask = readl(d->virt_base + reg_mask);
mask &= ~(1 << irqd->hwirq); mask &= ~(1 << irqd->hwirq);
writel(mask, d->virt_base + reg_mask); writel(mask, d->virt_base + reg_mask);
spin_unlock_irqrestore(&bank->slock, flags);
} }
static void exynos_gpio_irq_mask(struct irq_data *irqd) static void exynos_gpio_irq_mask(struct irq_data *irqd)
...@@ -68,10 +73,15 @@ static void exynos_gpio_irq_mask(struct irq_data *irqd) ...@@ -68,10 +73,15 @@ static void exynos_gpio_irq_mask(struct irq_data *irqd)
struct samsung_pinctrl_drv_data *d = bank->drvdata; struct samsung_pinctrl_drv_data *d = bank->drvdata;
unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset; unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset;
unsigned long mask; unsigned long mask;
unsigned long flags;
spin_lock_irqsave(&bank->slock, flags);
mask = readl(d->virt_base + reg_mask); mask = readl(d->virt_base + reg_mask);
mask |= 1 << irqd->hwirq; mask |= 1 << irqd->hwirq;
writel(mask, d->virt_base + reg_mask); writel(mask, d->virt_base + reg_mask);
spin_unlock_irqrestore(&bank->slock, flags);
} }
static void exynos_gpio_irq_ack(struct irq_data *irqd) static void exynos_gpio_irq_ack(struct irq_data *irqd)
...@@ -264,10 +274,15 @@ static void exynos_wkup_irq_unmask(struct irq_data *irqd) ...@@ -264,10 +274,15 @@ static void exynos_wkup_irq_unmask(struct irq_data *irqd)
struct samsung_pinctrl_drv_data *d = b->drvdata; struct samsung_pinctrl_drv_data *d = b->drvdata;
unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset; unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset;
unsigned long mask; unsigned long mask;
unsigned long flags;
spin_lock_irqsave(&b->slock, flags);
mask = readl(d->virt_base + reg_mask); mask = readl(d->virt_base + reg_mask);
mask &= ~(1 << irqd->hwirq); mask &= ~(1 << irqd->hwirq);
writel(mask, d->virt_base + reg_mask); writel(mask, d->virt_base + reg_mask);
spin_unlock_irqrestore(&b->slock, flags);
} }
static void exynos_wkup_irq_mask(struct irq_data *irqd) static void exynos_wkup_irq_mask(struct irq_data *irqd)
...@@ -276,10 +291,15 @@ static void exynos_wkup_irq_mask(struct irq_data *irqd) ...@@ -276,10 +291,15 @@ static void exynos_wkup_irq_mask(struct irq_data *irqd)
struct samsung_pinctrl_drv_data *d = b->drvdata; struct samsung_pinctrl_drv_data *d = b->drvdata;
unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset; unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset;
unsigned long mask; unsigned long mask;
unsigned long flags;
spin_lock_irqsave(&b->slock, flags);
mask = readl(d->virt_base + reg_mask); mask = readl(d->virt_base + reg_mask);
mask |= 1 << irqd->hwirq; mask |= 1 << irqd->hwirq;
writel(mask, d->virt_base + reg_mask); writel(mask, d->virt_base + reg_mask);
spin_unlock_irqrestore(&b->slock, flags);
} }
static void exynos_wkup_irq_ack(struct irq_data *irqd) static void exynos_wkup_irq_ack(struct irq_data *irqd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment