aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-exynos.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 14:48:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 14:48:03 -0400
commit3dbde57ad941c55345fd7fac0ee3f70f204b02d8 (patch)
tree237c6de64d05da3f61b9ac1724e37a5c1f014b71 /drivers/pinctrl/pinctrl-exynos.c
parenta6e6d863cf68bba886acfe47dbdc8f245cce588f (diff)
parent2207a4e1ca6a1bb126360b6d0c236af6664532f2 (diff)
Merge tag 'pinctrl-for-v3.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control changes from Linus Walleij: - A large slew of improvements of the Genric pin configuration support, and deployment in four different platforms: Rockchip, Super-H PFC, ABx500 and TZ1090. Support BIAS_BUS_HOLD, get device tree parsing and debugfs support into shape. - We also have device tree support with generic naming conventions for the generic pin configuration. - Delete the unused and confusing direct pinconf API. Now state transitions is *the* way to control pins and multiplexing. - New drivers for Rockchip, TZ1090, and TZ1090 PDC. - Two pin control states related to power management are now handled in the device core: "sleep" and "idle", removing a lot of boilerplate code in drivers. We do not yet know if this is the final word for pin PM, but it already make things a lot easier to handle. - Handle sparse GPIO ranges passing a list of disparate pins, and utilize these in the new BayTrail (x86 Atom SoC) driver. - Make the sunxi (AllWinner) driver handle external interrupts. - Make it possible for pinctrl-single to handle the case where several pins are managed by a single register, and augment it to handle sleep modes. - Cleanups and improvements for the abx500 drivers. - Move Sirf pin control drivers to their own directory, support save/restore of context and add support for the SiRFatlas6 SoC. - PMU muxing for the Dove pinctrl driver. - Finalization and support for VF610 in the i.MX6 pinctrl driver. - Smoothen out various Exynos rough edges. - Generic cleanups of various kinds. * tag 'pinctrl-for-v3.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (82 commits) pinctrl: vt8500: wmt: remove redundant dev_err call in wmt_pinctrl_probe() pinctrl: remove bindings for pinconf options needing more thought pinctrl: remove slew-rate parameter from tz1090 pinctrl: set unit for debounce time pinconfig to usec pinctrl: more clarifications for generic pull configs pinctrl: rip out the direct pinconf API pinctrl-tz1090-pdc: add TZ1090 PDC pinctrl driver pinctrl-tz1090: add TZ1090 pinctrl driver pinctrl: samsung: Staticize drvdata_list pinctrl: rockchip: Add missing irq_gc_unlock() call before return error pinctrl: abx500: rework error path pinctrl: abx500: suppress hardcoded value pinctrl: abx500: factorize code pinctrl: abx500: fix abx500_gpio_get() pinctrl: abx500: fix abx500_pin_config_set() pinctrl: abx500: Add device tree support sh-pfc: Guard DT parsing with #ifdef CONFIG_OF pinctrl: add Intel BayTrail GPIO/pinctrl support pinctrl: fix pinconf_ops::pin_config_dbg_parse_modify kerneldoc pinctrl: Staticize local symbols ... Conflicts: drivers/net/ethernet/ti/davinci_mdio.c drivers/pinctrl/Makefile
Diffstat (limited to 'drivers/pinctrl/pinctrl-exynos.c')
-rw-r--r--drivers/pinctrl/pinctrl-exynos.c86
1 files changed, 64 insertions, 22 deletions
diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c
index 5f58cf0e96e2..a74b3cbd7451 100644
--- a/drivers/pinctrl/pinctrl-exynos.c
+++ b/drivers/pinctrl/pinctrl-exynos.c
@@ -50,37 +50,58 @@ static const struct of_device_id exynos_wkup_irq_ids[] = {
50 { } 50 { }
51}; 51};
52 52
53static void exynos_gpio_irq_unmask(struct irq_data *irqd) 53static void exynos_gpio_irq_mask(struct irq_data *irqd)
54{ 54{
55 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); 55 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
56 struct samsung_pinctrl_drv_data *d = bank->drvdata; 56 struct samsung_pinctrl_drv_data *d = bank->drvdata;
57 unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset; 57 unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset;
58 unsigned long mask; 58 unsigned long mask;
59 unsigned long flags;
60
61 spin_lock_irqsave(&bank->slock, flags);
59 62
60 mask = readl(d->virt_base + reg_mask); 63 mask = readl(d->virt_base + reg_mask);
61 mask &= ~(1 << irqd->hwirq); 64 mask |= 1 << irqd->hwirq;
62 writel(mask, d->virt_base + reg_mask); 65 writel(mask, d->virt_base + reg_mask);
66
67 spin_unlock_irqrestore(&bank->slock, flags);
63} 68}
64 69
65static void exynos_gpio_irq_mask(struct irq_data *irqd) 70static void exynos_gpio_irq_ack(struct irq_data *irqd)
66{ 71{
67 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); 72 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
68 struct samsung_pinctrl_drv_data *d = bank->drvdata; 73 struct samsung_pinctrl_drv_data *d = bank->drvdata;
69 unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset; 74 unsigned long reg_pend = d->ctrl->geint_pend + bank->eint_offset;
70 unsigned long mask;
71 75
72 mask = readl(d->virt_base + reg_mask); 76 writel(1 << irqd->hwirq, d->virt_base + reg_pend);
73 mask |= 1 << irqd->hwirq;
74 writel(mask, d->virt_base + reg_mask);
75} 77}
76 78
77static void exynos_gpio_irq_ack(struct irq_data *irqd) 79static void exynos_gpio_irq_unmask(struct irq_data *irqd)
78{ 80{
79 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); 81 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
80 struct samsung_pinctrl_drv_data *d = bank->drvdata; 82 struct samsung_pinctrl_drv_data *d = bank->drvdata;
81 unsigned long reg_pend = d->ctrl->geint_pend + bank->eint_offset; 83 unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset;
84 unsigned long mask;
85 unsigned long flags;
82 86
83 writel(1 << irqd->hwirq, d->virt_base + reg_pend); 87 /*
88 * Ack level interrupts right before unmask
89 *
90 * If we don't do this we'll get a double-interrupt. Level triggered
91 * interrupts must not fire an interrupt if the level is not
92 * _currently_ active, even if it was active while the interrupt was
93 * masked.
94 */
95 if (irqd_get_trigger_type(irqd) & IRQ_TYPE_LEVEL_MASK)
96 exynos_gpio_irq_ack(irqd);
97
98 spin_lock_irqsave(&bank->slock, flags);
99
100 mask = readl(d->virt_base + reg_mask);
101 mask &= ~(1 << irqd->hwirq);
102 writel(mask, d->virt_base + reg_mask);
103
104 spin_unlock_irqrestore(&bank->slock, flags);
84} 105}
85 106
86static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type) 107static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
@@ -258,37 +279,58 @@ err_domains:
258 return ret; 279 return ret;
259} 280}
260 281
261static void exynos_wkup_irq_unmask(struct irq_data *irqd) 282static void exynos_wkup_irq_mask(struct irq_data *irqd)
262{ 283{
263 struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd); 284 struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd);
264 struct samsung_pinctrl_drv_data *d = b->drvdata; 285 struct samsung_pinctrl_drv_data *d = b->drvdata;
265 unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset; 286 unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset;
266 unsigned long mask; 287 unsigned long mask;
288 unsigned long flags;
289
290 spin_lock_irqsave(&b->slock, flags);
267 291
268 mask = readl(d->virt_base + reg_mask); 292 mask = readl(d->virt_base + reg_mask);
269 mask &= ~(1 << irqd->hwirq); 293 mask |= 1 << irqd->hwirq;
270 writel(mask, d->virt_base + reg_mask); 294 writel(mask, d->virt_base + reg_mask);
295
296 spin_unlock_irqrestore(&b->slock, flags);
271} 297}
272 298
273static void exynos_wkup_irq_mask(struct irq_data *irqd) 299static void exynos_wkup_irq_ack(struct irq_data *irqd)
274{ 300{
275 struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd); 301 struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd);
276 struct samsung_pinctrl_drv_data *d = b->drvdata; 302 struct samsung_pinctrl_drv_data *d = b->drvdata;
277 unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset; 303 unsigned long pend = d->ctrl->weint_pend + b->eint_offset;
278 unsigned long mask;
279 304
280 mask = readl(d->virt_base + reg_mask); 305 writel(1 << irqd->hwirq, d->virt_base + pend);
281 mask |= 1 << irqd->hwirq;
282 writel(mask, d->virt_base + reg_mask);
283} 306}
284 307
285static void exynos_wkup_irq_ack(struct irq_data *irqd) 308static void exynos_wkup_irq_unmask(struct irq_data *irqd)
286{ 309{
287 struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd); 310 struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd);
288 struct samsung_pinctrl_drv_data *d = b->drvdata; 311 struct samsung_pinctrl_drv_data *d = b->drvdata;
289 unsigned long pend = d->ctrl->weint_pend + b->eint_offset; 312 unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset;
313 unsigned long mask;
314 unsigned long flags;
290 315
291 writel(1 << irqd->hwirq, d->virt_base + pend); 316 /*
317 * Ack level interrupts right before unmask
318 *
319 * If we don't do this we'll get a double-interrupt. Level triggered
320 * interrupts must not fire an interrupt if the level is not
321 * _currently_ active, even if it was active while the interrupt was
322 * masked.
323 */
324 if (irqd_get_trigger_type(irqd) & IRQ_TYPE_LEVEL_MASK)
325 exynos_wkup_irq_ack(irqd);
326
327 spin_lock_irqsave(&b->slock, flags);
328
329 mask = readl(d->virt_base + reg_mask);
330 mask &= ~(1 << irqd->hwirq);
331 writel(mask, d->virt_base + reg_mask);
332
333 spin_unlock_irqrestore(&b->slock, flags);
292} 334}
293 335
294static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type) 336static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type)