diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pinctrl/pinctrl-exynos.c | 41 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-exynos.h | 1 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-samsung.c | 2 |
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) unsigned long mask; mask = readl(d->virt_base + reg_mask); - mask |= ~(1 << edata->pin); + mask |= 1 << edata->pin; writel(mask, d->virt_base + reg_mask); } @@ -76,9 +76,11 @@ static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type) struct samsung_pinctrl_drv_data *d = irqd->domain->host_data; struct samsung_pin_ctrl *ctrl = d->ctrl; struct exynos_geint_data *edata = irq_data_get_irq_handler_data(irqd); + struct samsung_pin_bank *bank = edata->bank; unsigned int shift = EXYNOS_EINT_CON_LEN * edata->pin; unsigned int con, trig_type; unsigned long reg_con = ctrl->geint_con + edata->eint_offset; + unsigned int mask; switch (type) { case IRQ_TYPE_EDGE_RISING: @@ -110,6 +112,16 @@ static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type) con &= ~(EXYNOS_EINT_CON_MASK << shift); con |= trig_type << shift; writel(con, d->virt_base + reg_con); + + reg_con = bank->pctl_offset; + shift = edata->pin * bank->func_width; + mask = (1 << bank->func_width) - 1; + + con = readl(d->virt_base + reg_con); + con &= ~(mask << shift); + con |= EXYNOS_EINT_FUNC << shift; + writel(con, d->virt_base + reg_con); + return 0; } @@ -278,7 +290,7 @@ static void exynos_wkup_irq_mask(struct irq_data *irqd) unsigned long mask; mask = readl(d->virt_base + reg_mask); - mask &= ~(1 << pin); + mask |= 1 << pin; writel(mask, d->virt_base + reg_mask); } @@ -364,7 +376,7 @@ static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc) chained_irq_exit(chip, desc); } -static void exynos_irq_demux_eint(int irq_base, unsigned long pend, +static inline void exynos_irq_demux_eint(int irq_base, unsigned long pend, struct irq_domain *domain) { unsigned int irq; @@ -383,12 +395,15 @@ static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc) struct exynos_weint_data *eintd = irq_get_handler_data(irq); struct samsung_pinctrl_drv_data *d = eintd->domain->host_data; unsigned long pend; + unsigned long mask; chained_irq_enter(chip, desc); pend = readl(d->virt_base + d->ctrl->weint_pend + 0x8); - exynos_irq_demux_eint(16, pend, eintd->domain); + mask = readl(d->virt_base + d->ctrl->weint_mask + 0x8); + exynos_irq_demux_eint(16, pend & ~mask, eintd->domain); pend = readl(d->virt_base + d->ctrl->weint_pend + 0xC); - exynos_irq_demux_eint(24, pend, eintd->domain); + mask = readl(d->virt_base + d->ctrl->weint_mask + 0xC); + exynos_irq_demux_eint(24, pend & ~mask, eintd->domain); chained_irq_exit(chip, desc); } @@ -416,19 +431,23 @@ static const struct irq_domain_ops exynos_wkup_irqd_ops = { static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) { struct device *dev = d->dev; - struct device_node *wkup_np; + struct device_node *wkup_np = NULL; + struct device_node *np; struct exynos_weint_data *weint_data; int idx, irq; - wkup_np = of_find_matching_node(dev->of_node, exynos_wkup_irq_ids); - if (!wkup_np) { - dev_err(dev, "wakeup controller node not found\n"); - return -ENODEV; + for_each_child_of_node(dev->of_node, np) { + if (of_match_node(exynos_wkup_irq_ids, np)) { + wkup_np = np; + break; + } } + if (!wkup_np) + return -ENODEV; d->wkup_irqd = irq_domain_add_linear(wkup_np, d->ctrl->nr_wint, &exynos_wkup_irqd_ops, d); - if (!d->gpio_irqd) { + if (!d->wkup_irqd) { dev_err(dev, "wakeup irq domain allocation failed\n"); return -ENXIO; } 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 { #define EXYNOS_WKUP_EMASK_OFFSET 0xF00 #define EXYNOS_WKUP_EPEND_OFFSET 0xF40 #define EXYNOS_SVC_OFFSET 0xB08 +#define EXYNOS_EINT_FUNC 0xF /* helpers to access interrupt service register */ #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, static const struct of_device_id samsung_pinctrl_dt_match[]; /* retrieve the soc specific data */ -static inline struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data( +static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data( struct platform_device *pdev) { int id; |