aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-09-22 01:56:52 -0400
committerOlof Johansson <olof@lixom.net>2012-09-22 01:56:52 -0400
commit04ef037c926ddb31088c976538e29eada4fd1490 (patch)
tree763e287ee2e7203d3b5e7e6b4d696e7989008a51
parent78901d05e727a0eb28209e9210a92078af3117f2 (diff)
parentd3c977927bd6320f1e9d4098989d6001bdcefc09 (diff)
Merge branch 'samsung/pinctrl' into next/drivers
A few fixups for the samsung pinctrl series * samsung/pinctrl: pinctrl: exynos: Fix wakeup IRQ domain registration check pinctrl: samsung: Uninline samsung_pinctrl_get_soc_data pinctrl: exynos: Correct the detection of wakeup-eint node pinctrl: exynos: Mark exynos_irq_demux_eint as inline pinctrl: exynos: Handle only unmasked wakeup interrupts pinctrl: exynos: Fix typos in gpio/wkup _irq_mask pinctrl: exynos: Set pin function to EINT in irq_set_type of GPIO EINTa
-rw-r--r--drivers/pinctrl/pinctrl-exynos.c41
-rw-r--r--drivers/pinctrl/pinctrl-exynos.h1
-rw-r--r--drivers/pinctrl/pinctrl-samsung.c2
3 files changed, 32 insertions, 12 deletions
diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c
index 447818d9851b..21362f48d370 100644
--- a/drivers/pinctrl/pinctrl-exynos.c
+++ b/drivers/pinctrl/pinctrl-exynos.c
@@ -58,7 +58,7 @@ static void exynos_gpio_irq_mask(struct irq_data *irqd)
58 unsigned long mask; 58 unsigned long mask;
59 59
60 mask = readl(d->virt_base + reg_mask); 60 mask = readl(d->virt_base + reg_mask);
61 mask |= ~(1 << edata->pin); 61 mask |= 1 << edata->pin;
62 writel(mask, d->virt_base + reg_mask); 62 writel(mask, d->virt_base + reg_mask);
63} 63}
64 64
@@ -76,9 +76,11 @@ static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
76 struct samsung_pinctrl_drv_data *d = irqd->domain->host_data; 76 struct samsung_pinctrl_drv_data *d = irqd->domain->host_data;
77 struct samsung_pin_ctrl *ctrl = d->ctrl; 77 struct samsung_pin_ctrl *ctrl = d->ctrl;
78 struct exynos_geint_data *edata = irq_data_get_irq_handler_data(irqd); 78 struct exynos_geint_data *edata = irq_data_get_irq_handler_data(irqd);
79 struct samsung_pin_bank *bank = edata->bank;
79 unsigned int shift = EXYNOS_EINT_CON_LEN * edata->pin; 80 unsigned int shift = EXYNOS_EINT_CON_LEN * edata->pin;
80 unsigned int con, trig_type; 81 unsigned int con, trig_type;
81 unsigned long reg_con = ctrl->geint_con + edata->eint_offset; 82 unsigned long reg_con = ctrl->geint_con + edata->eint_offset;
83 unsigned int mask;
82 84
83 switch (type) { 85 switch (type) {
84 case IRQ_TYPE_EDGE_RISING: 86 case IRQ_TYPE_EDGE_RISING:
@@ -110,6 +112,16 @@ static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
110 con &= ~(EXYNOS_EINT_CON_MASK << shift); 112 con &= ~(EXYNOS_EINT_CON_MASK << shift);
111 con |= trig_type << shift; 113 con |= trig_type << shift;
112 writel(con, d->virt_base + reg_con); 114 writel(con, d->virt_base + reg_con);
115
116 reg_con = bank->pctl_offset;
117 shift = edata->pin * bank->func_width;
118 mask = (1 << bank->func_width) - 1;
119
120 con = readl(d->virt_base + reg_con);
121 con &= ~(mask << shift);
122 con |= EXYNOS_EINT_FUNC << shift;
123 writel(con, d->virt_base + reg_con);
124
113 return 0; 125 return 0;
114} 126}
115 127
@@ -278,7 +290,7 @@ static void exynos_wkup_irq_mask(struct irq_data *irqd)
278 unsigned long mask; 290 unsigned long mask;
279 291
280 mask = readl(d->virt_base + reg_mask); 292 mask = readl(d->virt_base + reg_mask);
281 mask &= ~(1 << pin); 293 mask |= 1 << pin;
282 writel(mask, d->virt_base + reg_mask); 294 writel(mask, d->virt_base + reg_mask);
283} 295}
284 296
@@ -364,7 +376,7 @@ static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
364 chained_irq_exit(chip, desc); 376 chained_irq_exit(chip, desc);
365} 377}
366 378
367static void exynos_irq_demux_eint(int irq_base, unsigned long pend, 379static inline void exynos_irq_demux_eint(int irq_base, unsigned long pend,
368 struct irq_domain *domain) 380 struct irq_domain *domain)
369{ 381{
370 unsigned int irq; 382 unsigned int irq;
@@ -383,12 +395,15 @@ static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
383 struct exynos_weint_data *eintd = irq_get_handler_data(irq); 395 struct exynos_weint_data *eintd = irq_get_handler_data(irq);
384 struct samsung_pinctrl_drv_data *d = eintd->domain->host_data; 396 struct samsung_pinctrl_drv_data *d = eintd->domain->host_data;
385 unsigned long pend; 397 unsigned long pend;
398 unsigned long mask;
386 399
387 chained_irq_enter(chip, desc); 400 chained_irq_enter(chip, desc);
388 pend = readl(d->virt_base + d->ctrl->weint_pend + 0x8); 401 pend = readl(d->virt_base + d->ctrl->weint_pend + 0x8);
389 exynos_irq_demux_eint(16, pend, eintd->domain); 402 mask = readl(d->virt_base + d->ctrl->weint_mask + 0x8);
403 exynos_irq_demux_eint(16, pend & ~mask, eintd->domain);
390 pend = readl(d->virt_base + d->ctrl->weint_pend + 0xC); 404 pend = readl(d->virt_base + d->ctrl->weint_pend + 0xC);
391 exynos_irq_demux_eint(24, pend, eintd->domain); 405 mask = readl(d->virt_base + d->ctrl->weint_mask + 0xC);
406 exynos_irq_demux_eint(24, pend & ~mask, eintd->domain);
392 chained_irq_exit(chip, desc); 407 chained_irq_exit(chip, desc);
393} 408}
394 409
@@ -416,19 +431,23 @@ static const struct irq_domain_ops exynos_wkup_irqd_ops = {
416static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) 431static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
417{ 432{
418 struct device *dev = d->dev; 433 struct device *dev = d->dev;
419 struct device_node *wkup_np; 434 struct device_node *wkup_np = NULL;
435 struct device_node *np;
420 struct exynos_weint_data *weint_data; 436 struct exynos_weint_data *weint_data;
421 int idx, irq; 437 int idx, irq;
422 438
423 wkup_np = of_find_matching_node(dev->of_node, exynos_wkup_irq_ids); 439 for_each_child_of_node(dev->of_node, np) {
424 if (!wkup_np) { 440 if (of_match_node(exynos_wkup_irq_ids, np)) {
425 dev_err(dev, "wakeup controller node not found\n"); 441 wkup_np = np;
426 return -ENODEV; 442 break;
443 }
427 } 444 }
445 if (!wkup_np)
446 return -ENODEV;
428 447
429 d->wkup_irqd = irq_domain_add_linear(wkup_np, d->ctrl->nr_wint, 448 d->wkup_irqd = irq_domain_add_linear(wkup_np, d->ctrl->nr_wint,
430 &exynos_wkup_irqd_ops, d); 449 &exynos_wkup_irqd_ops, d);
431 if (!d->gpio_irqd) { 450 if (!d->wkup_irqd) {
432 dev_err(dev, "wakeup irq domain allocation failed\n"); 451 dev_err(dev, "wakeup irq domain allocation failed\n");
433 return -ENXIO; 452 return -ENXIO;
434 } 453 }
diff --git a/drivers/pinctrl/pinctrl-exynos.h b/drivers/pinctrl/pinctrl-exynos.h
index 5f27ba974a3a..31d0a06174e4 100644
--- a/drivers/pinctrl/pinctrl-exynos.h
+++ b/drivers/pinctrl/pinctrl-exynos.h
@@ -144,6 +144,7 @@ enum exynos4210_gpio_xc_start {
144#define EXYNOS_WKUP_EMASK_OFFSET 0xF00 144#define EXYNOS_WKUP_EMASK_OFFSET 0xF00
145#define EXYNOS_WKUP_EPEND_OFFSET 0xF40 145#define EXYNOS_WKUP_EPEND_OFFSET 0xF40
146#define EXYNOS_SVC_OFFSET 0xB08 146#define EXYNOS_SVC_OFFSET 0xB08
147#define EXYNOS_EINT_FUNC 0xF
147 148
148/* helpers to access interrupt service register */ 149/* helpers to access interrupt service register */
149#define EXYNOS_SVC_GROUP_SHIFT 3 150#define EXYNOS_SVC_GROUP_SHIFT 3
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
index 8a24223d5334..dd108a94acf9 100644
--- a/drivers/pinctrl/pinctrl-samsung.c
+++ b/drivers/pinctrl/pinctrl-samsung.c
@@ -776,7 +776,7 @@ static int __init samsung_gpiolib_unregister(struct platform_device *pdev,
776static const struct of_device_id samsung_pinctrl_dt_match[]; 776static const struct of_device_id samsung_pinctrl_dt_match[];
777 777
778/* retrieve the soc specific data */ 778/* retrieve the soc specific data */
779static inline struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data( 779static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data(
780 struct platform_device *pdev) 780 struct platform_device *pdev)
781{ 781{
782 int id; 782 int id;