Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Exynos specific support for Samsung pinctrl/gpiolib driver with eint support. |
| 3 | * |
| 4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. |
| 5 | * http://www.samsung.com |
| 6 | * Copyright (c) 2012 Linaro Ltd |
| 7 | * http://www.linaro.org |
| 8 | * |
| 9 | * Author: Thomas Abraham <thomas.ab@samsung.com> |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This file contains the Samsung Exynos specific information required by the |
| 17 | * the Samsung pinctrl/gpiolib driver. It also includes the implementation of |
| 18 | * external gpio and wakeup interrupt support. |
| 19 | */ |
| 20 | |
| 21 | #include <linux/module.h> |
| 22 | #include <linux/device.h> |
| 23 | #include <linux/interrupt.h> |
| 24 | #include <linux/irqdomain.h> |
| 25 | #include <linux/irq.h> |
| 26 | #include <linux/of_irq.h> |
| 27 | #include <linux/io.h> |
| 28 | #include <linux/slab.h> |
Tomasz Figa | 1984695 | 2013-03-18 22:31:50 +0100 | [diff] [blame] | 29 | #include <linux/spinlock.h> |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 30 | #include <linux/err.h> |
| 31 | |
| 32 | #include <asm/mach/irq.h> |
| 33 | |
| 34 | #include "pinctrl-samsung.h" |
| 35 | #include "pinctrl-exynos.h" |
| 36 | |
Tomasz Figa | 499147c | 2013-03-18 22:31:52 +0100 | [diff] [blame] | 37 | |
| 38 | static struct samsung_pin_bank_type bank_type_off = { |
| 39 | .fld_width = { 4, 1, 2, 2, 2, 2, }, |
Tomasz Figa | 43fc9e7 | 2013-03-18 22:31:53 +0100 | [diff] [blame] | 40 | .reg_offset = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, }, |
Tomasz Figa | 499147c | 2013-03-18 22:31:52 +0100 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | static struct samsung_pin_bank_type bank_type_alive = { |
| 44 | .fld_width = { 4, 1, 2, 2, }, |
Tomasz Figa | 43fc9e7 | 2013-03-18 22:31:53 +0100 | [diff] [blame] | 45 | .reg_offset = { 0x00, 0x04, 0x08, 0x0c, }, |
Tomasz Figa | 499147c | 2013-03-18 22:31:52 +0100 | [diff] [blame] | 46 | }; |
| 47 | |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 48 | /* list of external wakeup controllers supported */ |
| 49 | static const struct of_device_id exynos_wkup_irq_ids[] = { |
| 50 | { .compatible = "samsung,exynos4210-wakeup-eint", }, |
Axel Lin | afa538c | 2012-11-02 21:46:13 +0800 | [diff] [blame] | 51 | { } |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | static void exynos_gpio_irq_unmask(struct irq_data *irqd) |
| 55 | { |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 56 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); |
| 57 | struct samsung_pinctrl_drv_data *d = bank->drvdata; |
| 58 | unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 59 | unsigned long mask; |
| 60 | |
| 61 | mask = readl(d->virt_base + reg_mask); |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 62 | mask &= ~(1 << irqd->hwirq); |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 63 | writel(mask, d->virt_base + reg_mask); |
| 64 | } |
| 65 | |
| 66 | static void exynos_gpio_irq_mask(struct irq_data *irqd) |
| 67 | { |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 68 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); |
| 69 | struct samsung_pinctrl_drv_data *d = bank->drvdata; |
| 70 | unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 71 | unsigned long mask; |
| 72 | |
| 73 | mask = readl(d->virt_base + reg_mask); |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 74 | mask |= 1 << irqd->hwirq; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 75 | writel(mask, d->virt_base + reg_mask); |
| 76 | } |
| 77 | |
| 78 | static void exynos_gpio_irq_ack(struct irq_data *irqd) |
| 79 | { |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 80 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); |
| 81 | struct samsung_pinctrl_drv_data *d = bank->drvdata; |
| 82 | unsigned long reg_pend = d->ctrl->geint_pend + bank->eint_offset; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 83 | |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 84 | writel(1 << irqd->hwirq, d->virt_base + reg_pend); |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type) |
| 88 | { |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 89 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); |
Tomasz Figa | 499147c | 2013-03-18 22:31:52 +0100 | [diff] [blame] | 90 | struct samsung_pin_bank_type *bank_type = bank->type; |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 91 | struct samsung_pinctrl_drv_data *d = bank->drvdata; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 92 | struct samsung_pin_ctrl *ctrl = d->ctrl; |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 93 | unsigned int pin = irqd->hwirq; |
| 94 | unsigned int shift = EXYNOS_EINT_CON_LEN * pin; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 95 | unsigned int con, trig_type; |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 96 | unsigned long reg_con = ctrl->geint_con + bank->eint_offset; |
Tomasz Figa | 1984695 | 2013-03-18 22:31:50 +0100 | [diff] [blame] | 97 | unsigned long flags; |
Tomasz Figa | ee2f573 | 2012-09-21 07:33:48 +0900 | [diff] [blame] | 98 | unsigned int mask; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 99 | |
| 100 | switch (type) { |
| 101 | case IRQ_TYPE_EDGE_RISING: |
| 102 | trig_type = EXYNOS_EINT_EDGE_RISING; |
| 103 | break; |
| 104 | case IRQ_TYPE_EDGE_FALLING: |
| 105 | trig_type = EXYNOS_EINT_EDGE_FALLING; |
| 106 | break; |
| 107 | case IRQ_TYPE_EDGE_BOTH: |
| 108 | trig_type = EXYNOS_EINT_EDGE_BOTH; |
| 109 | break; |
| 110 | case IRQ_TYPE_LEVEL_HIGH: |
| 111 | trig_type = EXYNOS_EINT_LEVEL_HIGH; |
| 112 | break; |
| 113 | case IRQ_TYPE_LEVEL_LOW: |
| 114 | trig_type = EXYNOS_EINT_LEVEL_LOW; |
| 115 | break; |
| 116 | default: |
| 117 | pr_err("unsupported external interrupt type\n"); |
| 118 | return -EINVAL; |
| 119 | } |
| 120 | |
| 121 | if (type & IRQ_TYPE_EDGE_BOTH) |
| 122 | __irq_set_handler_locked(irqd->irq, handle_edge_irq); |
| 123 | else |
| 124 | __irq_set_handler_locked(irqd->irq, handle_level_irq); |
| 125 | |
| 126 | con = readl(d->virt_base + reg_con); |
| 127 | con &= ~(EXYNOS_EINT_CON_MASK << shift); |
| 128 | con |= trig_type << shift; |
| 129 | writel(con, d->virt_base + reg_con); |
Tomasz Figa | ee2f573 | 2012-09-21 07:33:48 +0900 | [diff] [blame] | 130 | |
Tomasz Figa | 43fc9e7 | 2013-03-18 22:31:53 +0100 | [diff] [blame] | 131 | reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC]; |
Tomasz Figa | 499147c | 2013-03-18 22:31:52 +0100 | [diff] [blame] | 132 | shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC]; |
| 133 | mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1; |
Tomasz Figa | ee2f573 | 2012-09-21 07:33:48 +0900 | [diff] [blame] | 134 | |
Tomasz Figa | 1984695 | 2013-03-18 22:31:50 +0100 | [diff] [blame] | 135 | spin_lock_irqsave(&bank->slock, flags); |
| 136 | |
Tomasz Figa | ee2f573 | 2012-09-21 07:33:48 +0900 | [diff] [blame] | 137 | con = readl(d->virt_base + reg_con); |
| 138 | con &= ~(mask << shift); |
| 139 | con |= EXYNOS_EINT_FUNC << shift; |
| 140 | writel(con, d->virt_base + reg_con); |
| 141 | |
Tomasz Figa | 1984695 | 2013-03-18 22:31:50 +0100 | [diff] [blame] | 142 | spin_unlock_irqrestore(&bank->slock, flags); |
| 143 | |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 144 | return 0; |
| 145 | } |
| 146 | |
| 147 | /* |
| 148 | * irq_chip for gpio interrupts. |
| 149 | */ |
| 150 | static struct irq_chip exynos_gpio_irq_chip = { |
| 151 | .name = "exynos_gpio_irq_chip", |
| 152 | .irq_unmask = exynos_gpio_irq_unmask, |
| 153 | .irq_mask = exynos_gpio_irq_mask, |
| 154 | .irq_ack = exynos_gpio_irq_ack, |
| 155 | .irq_set_type = exynos_gpio_irq_set_type, |
| 156 | }; |
| 157 | |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 158 | static int exynos_gpio_irq_map(struct irq_domain *h, unsigned int virq, |
| 159 | irq_hw_number_t hw) |
| 160 | { |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 161 | struct samsung_pin_bank *b = h->host_data; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 162 | |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 163 | irq_set_chip_data(virq, b); |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 164 | irq_set_chip_and_handler(virq, &exynos_gpio_irq_chip, |
| 165 | handle_level_irq); |
| 166 | set_irq_flags(virq, IRQF_VALID); |
| 167 | return 0; |
| 168 | } |
| 169 | |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 170 | /* |
| 171 | * irq domain callbacks for external gpio interrupt controller. |
| 172 | */ |
| 173 | static const struct irq_domain_ops exynos_gpio_irqd_ops = { |
| 174 | .map = exynos_gpio_irq_map, |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 175 | .xlate = irq_domain_xlate_twocell, |
| 176 | }; |
| 177 | |
| 178 | static irqreturn_t exynos_eint_gpio_irq(int irq, void *data) |
| 179 | { |
| 180 | struct samsung_pinctrl_drv_data *d = data; |
| 181 | struct samsung_pin_ctrl *ctrl = d->ctrl; |
| 182 | struct samsung_pin_bank *bank = ctrl->pin_banks; |
| 183 | unsigned int svc, group, pin, virq; |
| 184 | |
| 185 | svc = readl(d->virt_base + ctrl->svc); |
| 186 | group = EXYNOS_SVC_GROUP(svc); |
| 187 | pin = svc & EXYNOS_SVC_NUM_MASK; |
| 188 | |
| 189 | if (!group) |
| 190 | return IRQ_HANDLED; |
| 191 | bank += (group - 1); |
| 192 | |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 193 | virq = irq_linear_revmap(bank->irq_domain, pin); |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 194 | if (!virq) |
| 195 | return IRQ_NONE; |
| 196 | generic_handle_irq(virq); |
| 197 | return IRQ_HANDLED; |
| 198 | } |
| 199 | |
| 200 | /* |
| 201 | * exynos_eint_gpio_init() - setup handling of external gpio interrupts. |
| 202 | * @d: driver data of samsung pinctrl driver. |
| 203 | */ |
| 204 | static int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d) |
| 205 | { |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 206 | struct samsung_pin_bank *bank; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 207 | struct device *dev = d->dev; |
| 208 | unsigned int ret; |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 209 | unsigned int i; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 210 | |
| 211 | if (!d->irq) { |
| 212 | dev_err(dev, "irq number not available\n"); |
| 213 | return -EINVAL; |
| 214 | } |
| 215 | |
| 216 | ret = devm_request_irq(dev, d->irq, exynos_eint_gpio_irq, |
| 217 | 0, dev_name(dev), d); |
| 218 | if (ret) { |
| 219 | dev_err(dev, "irq request failed\n"); |
| 220 | return -ENXIO; |
| 221 | } |
| 222 | |
Tomasz Figa | 595be72 | 2012-10-11 10:11:16 +0200 | [diff] [blame] | 223 | bank = d->ctrl->pin_banks; |
| 224 | for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) { |
| 225 | if (bank->eint_type != EINT_TYPE_GPIO) |
| 226 | continue; |
| 227 | bank->irq_domain = irq_domain_add_linear(bank->of_node, |
| 228 | bank->nr_pins, &exynos_gpio_irqd_ops, bank); |
| 229 | if (!bank->irq_domain) { |
| 230 | dev_err(dev, "gpio irq domain add failed\n"); |
| 231 | return -ENXIO; |
| 232 | } |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | return 0; |
| 236 | } |
| 237 | |
| 238 | static void exynos_wkup_irq_unmask(struct irq_data *irqd) |
| 239 | { |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 240 | struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd); |
| 241 | struct samsung_pinctrl_drv_data *d = b->drvdata; |
| 242 | unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 243 | unsigned long mask; |
| 244 | |
| 245 | mask = readl(d->virt_base + reg_mask); |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 246 | mask &= ~(1 << irqd->hwirq); |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 247 | writel(mask, d->virt_base + reg_mask); |
| 248 | } |
| 249 | |
| 250 | static void exynos_wkup_irq_mask(struct irq_data *irqd) |
| 251 | { |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 252 | struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd); |
| 253 | struct samsung_pinctrl_drv_data *d = b->drvdata; |
| 254 | unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 255 | unsigned long mask; |
| 256 | |
| 257 | mask = readl(d->virt_base + reg_mask); |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 258 | mask |= 1 << irqd->hwirq; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 259 | writel(mask, d->virt_base + reg_mask); |
| 260 | } |
| 261 | |
| 262 | static void exynos_wkup_irq_ack(struct irq_data *irqd) |
| 263 | { |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 264 | struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd); |
| 265 | struct samsung_pinctrl_drv_data *d = b->drvdata; |
| 266 | unsigned long pend = d->ctrl->weint_pend + b->eint_offset; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 267 | |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 268 | writel(1 << irqd->hwirq, d->virt_base + pend); |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type) |
| 272 | { |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 273 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); |
Tomasz Figa | 499147c | 2013-03-18 22:31:52 +0100 | [diff] [blame] | 274 | struct samsung_pin_bank_type *bank_type = bank->type; |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 275 | struct samsung_pinctrl_drv_data *d = bank->drvdata; |
| 276 | unsigned int pin = irqd->hwirq; |
| 277 | unsigned long reg_con = d->ctrl->weint_con + bank->eint_offset; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 278 | unsigned long shift = EXYNOS_EINT_CON_LEN * pin; |
| 279 | unsigned long con, trig_type; |
Tomasz Figa | 1984695 | 2013-03-18 22:31:50 +0100 | [diff] [blame] | 280 | unsigned long flags; |
Tomasz Figa | 22b9ba0 | 2012-10-11 10:11:19 +0200 | [diff] [blame] | 281 | unsigned int mask; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 282 | |
| 283 | switch (type) { |
| 284 | case IRQ_TYPE_EDGE_RISING: |
| 285 | trig_type = EXYNOS_EINT_EDGE_RISING; |
| 286 | break; |
| 287 | case IRQ_TYPE_EDGE_FALLING: |
| 288 | trig_type = EXYNOS_EINT_EDGE_FALLING; |
| 289 | break; |
| 290 | case IRQ_TYPE_EDGE_BOTH: |
| 291 | trig_type = EXYNOS_EINT_EDGE_BOTH; |
| 292 | break; |
| 293 | case IRQ_TYPE_LEVEL_HIGH: |
| 294 | trig_type = EXYNOS_EINT_LEVEL_HIGH; |
| 295 | break; |
| 296 | case IRQ_TYPE_LEVEL_LOW: |
| 297 | trig_type = EXYNOS_EINT_LEVEL_LOW; |
| 298 | break; |
| 299 | default: |
| 300 | pr_err("unsupported external interrupt type\n"); |
| 301 | return -EINVAL; |
| 302 | } |
| 303 | |
| 304 | if (type & IRQ_TYPE_EDGE_BOTH) |
| 305 | __irq_set_handler_locked(irqd->irq, handle_edge_irq); |
| 306 | else |
| 307 | __irq_set_handler_locked(irqd->irq, handle_level_irq); |
| 308 | |
| 309 | con = readl(d->virt_base + reg_con); |
| 310 | con &= ~(EXYNOS_EINT_CON_MASK << shift); |
| 311 | con |= trig_type << shift; |
| 312 | writel(con, d->virt_base + reg_con); |
Tomasz Figa | 22b9ba0 | 2012-10-11 10:11:19 +0200 | [diff] [blame] | 313 | |
Tomasz Figa | 43fc9e7 | 2013-03-18 22:31:53 +0100 | [diff] [blame] | 314 | reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC]; |
Tomasz Figa | 499147c | 2013-03-18 22:31:52 +0100 | [diff] [blame] | 315 | shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC]; |
| 316 | mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1; |
Tomasz Figa | 22b9ba0 | 2012-10-11 10:11:19 +0200 | [diff] [blame] | 317 | |
Tomasz Figa | 1984695 | 2013-03-18 22:31:50 +0100 | [diff] [blame] | 318 | spin_lock_irqsave(&bank->slock, flags); |
| 319 | |
Tomasz Figa | 22b9ba0 | 2012-10-11 10:11:19 +0200 | [diff] [blame] | 320 | con = readl(d->virt_base + reg_con); |
| 321 | con &= ~(mask << shift); |
| 322 | con |= EXYNOS_EINT_FUNC << shift; |
| 323 | writel(con, d->virt_base + reg_con); |
| 324 | |
Tomasz Figa | 1984695 | 2013-03-18 22:31:50 +0100 | [diff] [blame] | 325 | spin_unlock_irqrestore(&bank->slock, flags); |
| 326 | |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 327 | return 0; |
| 328 | } |
| 329 | |
| 330 | /* |
| 331 | * irq_chip for wakeup interrupts |
| 332 | */ |
| 333 | static struct irq_chip exynos_wkup_irq_chip = { |
| 334 | .name = "exynos_wkup_irq_chip", |
| 335 | .irq_unmask = exynos_wkup_irq_unmask, |
| 336 | .irq_mask = exynos_wkup_irq_mask, |
| 337 | .irq_ack = exynos_wkup_irq_ack, |
| 338 | .irq_set_type = exynos_wkup_irq_set_type, |
| 339 | }; |
| 340 | |
| 341 | /* interrupt handler for wakeup interrupts 0..15 */ |
| 342 | static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc) |
| 343 | { |
| 344 | struct exynos_weint_data *eintd = irq_get_handler_data(irq); |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 345 | struct samsung_pin_bank *bank = eintd->bank; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 346 | struct irq_chip *chip = irq_get_chip(irq); |
| 347 | int eint_irq; |
| 348 | |
| 349 | chained_irq_enter(chip, desc); |
| 350 | chip->irq_mask(&desc->irq_data); |
| 351 | |
| 352 | if (chip->irq_ack) |
| 353 | chip->irq_ack(&desc->irq_data); |
| 354 | |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 355 | eint_irq = irq_linear_revmap(bank->irq_domain, eintd->irq); |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 356 | generic_handle_irq(eint_irq); |
| 357 | chip->irq_unmask(&desc->irq_data); |
| 358 | chained_irq_exit(chip, desc); |
| 359 | } |
| 360 | |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 361 | static inline void exynos_irq_demux_eint(unsigned long pend, |
| 362 | struct irq_domain *domain) |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 363 | { |
| 364 | unsigned int irq; |
| 365 | |
| 366 | while (pend) { |
| 367 | irq = fls(pend) - 1; |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 368 | generic_handle_irq(irq_find_mapping(domain, irq)); |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 369 | pend &= ~(1 << irq); |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | /* interrupt handler for wakeup interrupt 16 */ |
| 374 | static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc) |
| 375 | { |
| 376 | struct irq_chip *chip = irq_get_chip(irq); |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 377 | struct exynos_muxed_weint_data *eintd = irq_get_handler_data(irq); |
| 378 | struct samsung_pinctrl_drv_data *d = eintd->banks[0]->drvdata; |
| 379 | struct samsung_pin_ctrl *ctrl = d->ctrl; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 380 | unsigned long pend; |
Tomasz Figa | de59049 | 2012-09-21 07:33:55 +0900 | [diff] [blame] | 381 | unsigned long mask; |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 382 | int i; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 383 | |
| 384 | chained_irq_enter(chip, desc); |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 385 | |
| 386 | for (i = 0; i < eintd->nr_banks; ++i) { |
| 387 | struct samsung_pin_bank *b = eintd->banks[i]; |
| 388 | pend = readl(d->virt_base + ctrl->weint_pend + b->eint_offset); |
| 389 | mask = readl(d->virt_base + ctrl->weint_mask + b->eint_offset); |
| 390 | exynos_irq_demux_eint(pend & ~mask, b->irq_domain); |
| 391 | } |
| 392 | |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 393 | chained_irq_exit(chip, desc); |
| 394 | } |
| 395 | |
| 396 | static int exynos_wkup_irq_map(struct irq_domain *h, unsigned int virq, |
| 397 | irq_hw_number_t hw) |
| 398 | { |
| 399 | irq_set_chip_and_handler(virq, &exynos_wkup_irq_chip, handle_level_irq); |
| 400 | irq_set_chip_data(virq, h->host_data); |
| 401 | set_irq_flags(virq, IRQF_VALID); |
| 402 | return 0; |
| 403 | } |
| 404 | |
| 405 | /* |
| 406 | * irq domain callbacks for external wakeup interrupt controller. |
| 407 | */ |
| 408 | static const struct irq_domain_ops exynos_wkup_irqd_ops = { |
| 409 | .map = exynos_wkup_irq_map, |
| 410 | .xlate = irq_domain_xlate_twocell, |
| 411 | }; |
| 412 | |
| 413 | /* |
| 414 | * exynos_eint_wkup_init() - setup handling of external wakeup interrupts. |
| 415 | * @d: driver data of samsung pinctrl driver. |
| 416 | */ |
| 417 | static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) |
| 418 | { |
| 419 | struct device *dev = d->dev; |
Tomasz Figa | c3ad056 | 2012-09-21 07:34:01 +0900 | [diff] [blame] | 420 | struct device_node *wkup_np = NULL; |
| 421 | struct device_node *np; |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 422 | struct samsung_pin_bank *bank; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 423 | struct exynos_weint_data *weint_data; |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 424 | struct exynos_muxed_weint_data *muxed_data; |
| 425 | unsigned int muxed_banks = 0; |
| 426 | unsigned int i; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 427 | int idx, irq; |
| 428 | |
Tomasz Figa | c3ad056 | 2012-09-21 07:34:01 +0900 | [diff] [blame] | 429 | for_each_child_of_node(dev->of_node, np) { |
| 430 | if (of_match_node(exynos_wkup_irq_ids, np)) { |
| 431 | wkup_np = np; |
| 432 | break; |
| 433 | } |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 434 | } |
Tomasz Figa | c3ad056 | 2012-09-21 07:34:01 +0900 | [diff] [blame] | 435 | if (!wkup_np) |
| 436 | return -ENODEV; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 437 | |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 438 | bank = d->ctrl->pin_banks; |
| 439 | for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) { |
| 440 | if (bank->eint_type != EINT_TYPE_WKUP) |
| 441 | continue; |
| 442 | |
| 443 | bank->irq_domain = irq_domain_add_linear(bank->of_node, |
| 444 | bank->nr_pins, &exynos_wkup_irqd_ops, bank); |
| 445 | if (!bank->irq_domain) { |
| 446 | dev_err(dev, "wkup irq domain add failed\n"); |
| 447 | return -ENXIO; |
| 448 | } |
| 449 | |
| 450 | if (!of_find_property(bank->of_node, "interrupts", NULL)) { |
| 451 | bank->eint_type = EINT_TYPE_WKUP_MUX; |
| 452 | ++muxed_banks; |
| 453 | continue; |
| 454 | } |
| 455 | |
| 456 | weint_data = devm_kzalloc(dev, bank->nr_pins |
| 457 | * sizeof(*weint_data), GFP_KERNEL); |
| 458 | if (!weint_data) { |
| 459 | dev_err(dev, "could not allocate memory for weint_data\n"); |
| 460 | return -ENOMEM; |
| 461 | } |
| 462 | |
| 463 | for (idx = 0; idx < bank->nr_pins; ++idx) { |
| 464 | irq = irq_of_parse_and_map(bank->of_node, idx); |
| 465 | if (!irq) { |
| 466 | dev_err(dev, "irq number for eint-%s-%d not found\n", |
| 467 | bank->name, idx); |
| 468 | continue; |
| 469 | } |
| 470 | weint_data[idx].irq = idx; |
| 471 | weint_data[idx].bank = bank; |
| 472 | irq_set_handler_data(irq, &weint_data[idx]); |
| 473 | irq_set_chained_handler(irq, exynos_irq_eint0_15); |
| 474 | } |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 475 | } |
| 476 | |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 477 | if (!muxed_banks) |
| 478 | return 0; |
| 479 | |
| 480 | irq = irq_of_parse_and_map(wkup_np, 0); |
| 481 | if (!irq) { |
| 482 | dev_err(dev, "irq number for muxed EINTs not found\n"); |
| 483 | return 0; |
| 484 | } |
| 485 | |
| 486 | muxed_data = devm_kzalloc(dev, sizeof(*muxed_data) |
| 487 | + muxed_banks*sizeof(struct samsung_pin_bank *), GFP_KERNEL); |
| 488 | if (!muxed_data) { |
| 489 | dev_err(dev, "could not allocate memory for muxed_data\n"); |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 490 | return -ENOMEM; |
| 491 | } |
| 492 | |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 493 | irq_set_chained_handler(irq, exynos_irq_demux_eint16_31); |
| 494 | irq_set_handler_data(irq, muxed_data); |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 495 | |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 496 | bank = d->ctrl->pin_banks; |
| 497 | idx = 0; |
| 498 | for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) { |
| 499 | if (bank->eint_type != EINT_TYPE_WKUP_MUX) |
| 500 | continue; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 501 | |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 502 | muxed_data->banks[idx++] = bank; |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 503 | } |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 504 | muxed_data->nr_banks = muxed_banks; |
| 505 | |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 506 | return 0; |
| 507 | } |
| 508 | |
| 509 | /* pin banks of exynos4210 pin-controller 0 */ |
| 510 | static struct samsung_pin_bank exynos4210_pin_banks0[] = { |
Tomasz Figa | 1b6056d | 2012-10-11 10:11:15 +0200 | [diff] [blame] | 511 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), |
| 512 | EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04), |
| 513 | EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08), |
| 514 | EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c), |
| 515 | EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10), |
| 516 | EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpd0", 0x14), |
| 517 | EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpd1", 0x18), |
| 518 | EXYNOS_PIN_BANK_EINTG(5, 0x0E0, "gpe0", 0x1c), |
| 519 | EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpe1", 0x20), |
| 520 | EXYNOS_PIN_BANK_EINTG(6, 0x120, "gpe2", 0x24), |
| 521 | EXYNOS_PIN_BANK_EINTG(8, 0x140, "gpe3", 0x28), |
| 522 | EXYNOS_PIN_BANK_EINTG(8, 0x160, "gpe4", 0x2c), |
| 523 | EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpf0", 0x30), |
| 524 | EXYNOS_PIN_BANK_EINTG(8, 0x1A0, "gpf1", 0x34), |
| 525 | EXYNOS_PIN_BANK_EINTG(8, 0x1C0, "gpf2", 0x38), |
| 526 | EXYNOS_PIN_BANK_EINTG(6, 0x1E0, "gpf3", 0x3c), |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 527 | }; |
| 528 | |
| 529 | /* pin banks of exynos4210 pin-controller 1 */ |
| 530 | static struct samsung_pin_bank exynos4210_pin_banks1[] = { |
Tomasz Figa | 1b6056d | 2012-10-11 10:11:15 +0200 | [diff] [blame] | 531 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpj0", 0x00), |
| 532 | EXYNOS_PIN_BANK_EINTG(5, 0x020, "gpj1", 0x04), |
| 533 | EXYNOS_PIN_BANK_EINTG(7, 0x040, "gpk0", 0x08), |
| 534 | EXYNOS_PIN_BANK_EINTG(7, 0x060, "gpk1", 0x0c), |
| 535 | EXYNOS_PIN_BANK_EINTG(7, 0x080, "gpk2", 0x10), |
| 536 | EXYNOS_PIN_BANK_EINTG(7, 0x0A0, "gpk3", 0x14), |
| 537 | EXYNOS_PIN_BANK_EINTG(8, 0x0C0, "gpl0", 0x18), |
| 538 | EXYNOS_PIN_BANK_EINTG(3, 0x0E0, "gpl1", 0x1c), |
| 539 | EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpl2", 0x20), |
Tomasz Figa | 40ba622 | 2012-10-11 10:11:09 +0200 | [diff] [blame] | 540 | EXYNOS_PIN_BANK_EINTN(6, 0x120, "gpy0"), |
| 541 | EXYNOS_PIN_BANK_EINTN(4, 0x140, "gpy1"), |
| 542 | EXYNOS_PIN_BANK_EINTN(6, 0x160, "gpy2"), |
| 543 | EXYNOS_PIN_BANK_EINTN(8, 0x180, "gpy3"), |
| 544 | EXYNOS_PIN_BANK_EINTN(8, 0x1A0, "gpy4"), |
| 545 | EXYNOS_PIN_BANK_EINTN(8, 0x1C0, "gpy5"), |
| 546 | EXYNOS_PIN_BANK_EINTN(8, 0x1E0, "gpy6"), |
Tomasz Figa | a04b07c | 2012-10-11 10:11:18 +0200 | [diff] [blame] | 547 | EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00), |
| 548 | EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04), |
| 549 | EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08), |
| 550 | EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c), |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 551 | }; |
| 552 | |
| 553 | /* pin banks of exynos4210 pin-controller 2 */ |
| 554 | static struct samsung_pin_bank exynos4210_pin_banks2[] = { |
Tomasz Figa | 40ba622 | 2012-10-11 10:11:09 +0200 | [diff] [blame] | 555 | EXYNOS_PIN_BANK_EINTN(7, 0x000, "gpz"), |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 556 | }; |
| 557 | |
| 558 | /* |
| 559 | * Samsung pinctrl driver data for Exynos4210 SoC. Exynos4210 SoC includes |
| 560 | * three gpio/pin-mux/pinconfig controllers. |
| 561 | */ |
| 562 | struct samsung_pin_ctrl exynos4210_pin_ctrl[] = { |
| 563 | { |
| 564 | /* pin-controller instance 0 data */ |
| 565 | .pin_banks = exynos4210_pin_banks0, |
| 566 | .nr_banks = ARRAY_SIZE(exynos4210_pin_banks0), |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 567 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, |
| 568 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, |
| 569 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
| 570 | .svc = EXYNOS_SVC_OFFSET, |
| 571 | .eint_gpio_init = exynos_eint_gpio_init, |
| 572 | .label = "exynos4210-gpio-ctrl0", |
| 573 | }, { |
| 574 | /* pin-controller instance 1 data */ |
| 575 | .pin_banks = exynos4210_pin_banks1, |
| 576 | .nr_banks = ARRAY_SIZE(exynos4210_pin_banks1), |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 577 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, |
| 578 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, |
| 579 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
| 580 | .weint_con = EXYNOS_WKUP_ECON_OFFSET, |
| 581 | .weint_mask = EXYNOS_WKUP_EMASK_OFFSET, |
| 582 | .weint_pend = EXYNOS_WKUP_EPEND_OFFSET, |
| 583 | .svc = EXYNOS_SVC_OFFSET, |
| 584 | .eint_gpio_init = exynos_eint_gpio_init, |
| 585 | .eint_wkup_init = exynos_eint_wkup_init, |
| 586 | .label = "exynos4210-gpio-ctrl1", |
| 587 | }, { |
| 588 | /* pin-controller instance 2 data */ |
| 589 | .pin_banks = exynos4210_pin_banks2, |
| 590 | .nr_banks = ARRAY_SIZE(exynos4210_pin_banks2), |
Thomas Abraham | 43b169d | 2012-09-07 06:07:19 +0900 | [diff] [blame] | 591 | .label = "exynos4210-gpio-ctrl2", |
| 592 | }, |
| 593 | }; |
Tomasz Figa | 6edc794 | 2012-11-07 08:44:59 +0900 | [diff] [blame] | 594 | |
| 595 | /* pin banks of exynos4x12 pin-controller 0 */ |
| 596 | static struct samsung_pin_bank exynos4x12_pin_banks0[] = { |
| 597 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), |
| 598 | EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04), |
| 599 | EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08), |
| 600 | EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c), |
| 601 | EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10), |
| 602 | EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpd0", 0x14), |
| 603 | EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpd1", 0x18), |
| 604 | EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpf0", 0x30), |
| 605 | EXYNOS_PIN_BANK_EINTG(8, 0x1A0, "gpf1", 0x34), |
| 606 | EXYNOS_PIN_BANK_EINTG(8, 0x1C0, "gpf2", 0x38), |
| 607 | EXYNOS_PIN_BANK_EINTG(6, 0x1E0, "gpf3", 0x3c), |
| 608 | EXYNOS_PIN_BANK_EINTG(8, 0x240, "gpj0", 0x40), |
| 609 | EXYNOS_PIN_BANK_EINTG(5, 0x260, "gpj1", 0x44), |
| 610 | }; |
| 611 | |
| 612 | /* pin banks of exynos4x12 pin-controller 1 */ |
| 613 | static struct samsung_pin_bank exynos4x12_pin_banks1[] = { |
| 614 | EXYNOS_PIN_BANK_EINTG(7, 0x040, "gpk0", 0x08), |
| 615 | EXYNOS_PIN_BANK_EINTG(7, 0x060, "gpk1", 0x0c), |
| 616 | EXYNOS_PIN_BANK_EINTG(7, 0x080, "gpk2", 0x10), |
| 617 | EXYNOS_PIN_BANK_EINTG(7, 0x0A0, "gpk3", 0x14), |
| 618 | EXYNOS_PIN_BANK_EINTG(7, 0x0C0, "gpl0", 0x18), |
| 619 | EXYNOS_PIN_BANK_EINTG(2, 0x0E0, "gpl1", 0x1c), |
| 620 | EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpl2", 0x20), |
| 621 | EXYNOS_PIN_BANK_EINTG(8, 0x260, "gpm0", 0x24), |
| 622 | EXYNOS_PIN_BANK_EINTG(7, 0x280, "gpm1", 0x28), |
| 623 | EXYNOS_PIN_BANK_EINTG(5, 0x2A0, "gpm2", 0x2c), |
| 624 | EXYNOS_PIN_BANK_EINTG(8, 0x2C0, "gpm3", 0x30), |
| 625 | EXYNOS_PIN_BANK_EINTG(8, 0x2E0, "gpm4", 0x34), |
| 626 | EXYNOS_PIN_BANK_EINTN(6, 0x120, "gpy0"), |
| 627 | EXYNOS_PIN_BANK_EINTN(4, 0x140, "gpy1"), |
| 628 | EXYNOS_PIN_BANK_EINTN(6, 0x160, "gpy2"), |
| 629 | EXYNOS_PIN_BANK_EINTN(8, 0x180, "gpy3"), |
| 630 | EXYNOS_PIN_BANK_EINTN(8, 0x1A0, "gpy4"), |
| 631 | EXYNOS_PIN_BANK_EINTN(8, 0x1C0, "gpy5"), |
| 632 | EXYNOS_PIN_BANK_EINTN(8, 0x1E0, "gpy6"), |
| 633 | EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00), |
| 634 | EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04), |
| 635 | EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08), |
| 636 | EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c), |
| 637 | }; |
| 638 | |
| 639 | /* pin banks of exynos4x12 pin-controller 2 */ |
| 640 | static struct samsung_pin_bank exynos4x12_pin_banks2[] = { |
| 641 | EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz", 0x00), |
| 642 | }; |
| 643 | |
| 644 | /* pin banks of exynos4x12 pin-controller 3 */ |
| 645 | static struct samsung_pin_bank exynos4x12_pin_banks3[] = { |
| 646 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpv0", 0x00), |
| 647 | EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpv1", 0x04), |
| 648 | EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpv2", 0x08), |
| 649 | EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpv3", 0x0c), |
| 650 | EXYNOS_PIN_BANK_EINTG(2, 0x080, "gpv4", 0x10), |
| 651 | }; |
| 652 | |
| 653 | /* |
| 654 | * Samsung pinctrl driver data for Exynos4x12 SoC. Exynos4x12 SoC includes |
| 655 | * four gpio/pin-mux/pinconfig controllers. |
| 656 | */ |
| 657 | struct samsung_pin_ctrl exynos4x12_pin_ctrl[] = { |
| 658 | { |
| 659 | /* pin-controller instance 0 data */ |
| 660 | .pin_banks = exynos4x12_pin_banks0, |
| 661 | .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks0), |
| 662 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, |
| 663 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, |
| 664 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
| 665 | .svc = EXYNOS_SVC_OFFSET, |
| 666 | .eint_gpio_init = exynos_eint_gpio_init, |
| 667 | .label = "exynos4x12-gpio-ctrl0", |
| 668 | }, { |
| 669 | /* pin-controller instance 1 data */ |
| 670 | .pin_banks = exynos4x12_pin_banks1, |
| 671 | .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks1), |
| 672 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, |
| 673 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, |
| 674 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
| 675 | .weint_con = EXYNOS_WKUP_ECON_OFFSET, |
| 676 | .weint_mask = EXYNOS_WKUP_EMASK_OFFSET, |
| 677 | .weint_pend = EXYNOS_WKUP_EPEND_OFFSET, |
| 678 | .svc = EXYNOS_SVC_OFFSET, |
| 679 | .eint_gpio_init = exynos_eint_gpio_init, |
| 680 | .eint_wkup_init = exynos_eint_wkup_init, |
| 681 | .label = "exynos4x12-gpio-ctrl1", |
| 682 | }, { |
| 683 | /* pin-controller instance 2 data */ |
| 684 | .pin_banks = exynos4x12_pin_banks2, |
| 685 | .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks2), |
| 686 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, |
| 687 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, |
| 688 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
| 689 | .svc = EXYNOS_SVC_OFFSET, |
| 690 | .eint_gpio_init = exynos_eint_gpio_init, |
| 691 | .label = "exynos4x12-gpio-ctrl2", |
| 692 | }, { |
| 693 | /* pin-controller instance 3 data */ |
| 694 | .pin_banks = exynos4x12_pin_banks3, |
| 695 | .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks3), |
| 696 | .geint_con = EXYNOS_GPIO_ECON_OFFSET, |
| 697 | .geint_mask = EXYNOS_GPIO_EMASK_OFFSET, |
| 698 | .geint_pend = EXYNOS_GPIO_EPEND_OFFSET, |
| 699 | .svc = EXYNOS_SVC_OFFSET, |
| 700 | .eint_gpio_init = exynos_eint_gpio_init, |
| 701 | .label = "exynos4x12-gpio-ctrl3", |
| 702 | }, |
| 703 | }; |