Krzysztof Kozlowski | 221173a | 2017-12-26 19:09:42 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | // |
| 3 | // S3C64xx specific support for pinctrl-samsung driver. |
| 4 | // |
| 5 | // Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com> |
| 6 | // |
| 7 | // Based on pinctrl-exynos.c, please see the file for original copyrights. |
| 8 | // |
| 9 | // This file contains the Samsung S3C64xx specific information required by the |
| 10 | // the Samsung pinctrl/gpiolib driver. It also includes the implementation of |
| 11 | // external gpio and wakeup interrupt support. |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 12 | |
Paul Gortmaker | 8208b28 | 2017-05-22 16:56:46 -0400 | [diff] [blame] | 13 | #include <linux/init.h> |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 14 | #include <linux/device.h> |
| 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/irqdomain.h> |
| 17 | #include <linux/irq.h> |
| 18 | #include <linux/of_irq.h> |
| 19 | #include <linux/io.h> |
Tomasz Figa | a0d4262 | 2013-04-17 00:23:59 +0200 | [diff] [blame] | 20 | #include <linux/irqchip/chained_irq.h> |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 21 | #include <linux/slab.h> |
| 22 | #include <linux/err.h> |
| 23 | |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 24 | #include "pinctrl-samsung.h" |
| 25 | |
| 26 | #define NUM_EINT0 28 |
| 27 | #define NUM_EINT0_IRQ 4 |
| 28 | #define EINT_MAX_PER_REG 16 |
| 29 | #define EINT_MAX_PER_GROUP 16 |
| 30 | |
| 31 | /* External GPIO and wakeup interrupt related definitions */ |
| 32 | #define SVC_GROUP_SHIFT 4 |
| 33 | #define SVC_GROUP_MASK 0xf |
| 34 | #define SVC_NUM_MASK 0xf |
| 35 | #define SVC_GROUP(x) ((x >> SVC_GROUP_SHIFT) & \ |
| 36 | SVC_GROUP_MASK) |
| 37 | |
| 38 | #define EINT12CON_REG 0x200 |
| 39 | #define EINT12MASK_REG 0x240 |
| 40 | #define EINT12PEND_REG 0x260 |
| 41 | |
| 42 | #define EINT_OFFS(i) ((i) % (2 * EINT_MAX_PER_GROUP)) |
| 43 | #define EINT_GROUP(i) ((i) / EINT_MAX_PER_GROUP) |
| 44 | #define EINT_REG(g) (4 * ((g) / 2)) |
| 45 | |
| 46 | #define EINTCON_REG(i) (EINT12CON_REG + EINT_REG(EINT_GROUP(i))) |
| 47 | #define EINTMASK_REG(i) (EINT12MASK_REG + EINT_REG(EINT_GROUP(i))) |
| 48 | #define EINTPEND_REG(i) (EINT12PEND_REG + EINT_REG(EINT_GROUP(i))) |
| 49 | |
| 50 | #define SERVICE_REG 0x284 |
| 51 | #define SERVICEPEND_REG 0x288 |
| 52 | |
| 53 | #define EINT0CON0_REG 0x900 |
| 54 | #define EINT0MASK_REG 0x920 |
| 55 | #define EINT0PEND_REG 0x924 |
| 56 | |
| 57 | /* S3C64xx specific external interrupt trigger types */ |
| 58 | #define EINT_LEVEL_LOW 0 |
| 59 | #define EINT_LEVEL_HIGH 1 |
| 60 | #define EINT_EDGE_FALLING 2 |
| 61 | #define EINT_EDGE_RISING 4 |
| 62 | #define EINT_EDGE_BOTH 6 |
| 63 | #define EINT_CON_MASK 0xF |
| 64 | #define EINT_CON_LEN 4 |
| 65 | |
Tomasz Figa | 94ce944 | 2014-09-23 21:05:39 +0200 | [diff] [blame] | 66 | static const struct samsung_pin_bank_type bank_type_4bit_off = { |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 67 | .fld_width = { 4, 1, 2, 0, 2, 2, }, |
| 68 | .reg_offset = { 0x00, 0x04, 0x08, 0, 0x0c, 0x10, }, |
| 69 | }; |
| 70 | |
Tomasz Figa | 94ce944 | 2014-09-23 21:05:39 +0200 | [diff] [blame] | 71 | static const struct samsung_pin_bank_type bank_type_4bit_alive = { |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 72 | .fld_width = { 4, 1, 2, }, |
| 73 | .reg_offset = { 0x00, 0x04, 0x08, }, |
| 74 | }; |
| 75 | |
Tomasz Figa | 94ce944 | 2014-09-23 21:05:39 +0200 | [diff] [blame] | 76 | static const struct samsung_pin_bank_type bank_type_4bit2_off = { |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 77 | .fld_width = { 4, 1, 2, 0, 2, 2, }, |
| 78 | .reg_offset = { 0x00, 0x08, 0x0c, 0, 0x10, 0x14, }, |
| 79 | }; |
| 80 | |
Tomasz Figa | 94ce944 | 2014-09-23 21:05:39 +0200 | [diff] [blame] | 81 | static const struct samsung_pin_bank_type bank_type_4bit2_alive = { |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 82 | .fld_width = { 4, 1, 2, }, |
| 83 | .reg_offset = { 0x00, 0x08, 0x0c, }, |
| 84 | }; |
| 85 | |
Tomasz Figa | 94ce944 | 2014-09-23 21:05:39 +0200 | [diff] [blame] | 86 | static const struct samsung_pin_bank_type bank_type_2bit_off = { |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 87 | .fld_width = { 2, 1, 2, 0, 2, 2, }, |
| 88 | .reg_offset = { 0x00, 0x04, 0x08, 0, 0x0c, 0x10, }, |
| 89 | }; |
| 90 | |
Tomasz Figa | 94ce944 | 2014-09-23 21:05:39 +0200 | [diff] [blame] | 91 | static const struct samsung_pin_bank_type bank_type_2bit_alive = { |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 92 | .fld_width = { 2, 1, 2, }, |
| 93 | .reg_offset = { 0x00, 0x04, 0x08, }, |
| 94 | }; |
| 95 | |
| 96 | #define PIN_BANK_4BIT(pins, reg, id) \ |
| 97 | { \ |
| 98 | .type = &bank_type_4bit_off, \ |
| 99 | .pctl_offset = reg, \ |
| 100 | .nr_pins = pins, \ |
| 101 | .eint_type = EINT_TYPE_NONE, \ |
| 102 | .name = id \ |
| 103 | } |
| 104 | |
| 105 | #define PIN_BANK_4BIT_EINTG(pins, reg, id, eoffs) \ |
| 106 | { \ |
| 107 | .type = &bank_type_4bit_off, \ |
| 108 | .pctl_offset = reg, \ |
| 109 | .nr_pins = pins, \ |
| 110 | .eint_type = EINT_TYPE_GPIO, \ |
| 111 | .eint_func = 7, \ |
| 112 | .eint_mask = (1 << (pins)) - 1, \ |
| 113 | .eint_offset = eoffs, \ |
| 114 | .name = id \ |
| 115 | } |
| 116 | |
| 117 | #define PIN_BANK_4BIT_EINTW(pins, reg, id, eoffs, emask) \ |
| 118 | { \ |
| 119 | .type = &bank_type_4bit_alive,\ |
| 120 | .pctl_offset = reg, \ |
| 121 | .nr_pins = pins, \ |
| 122 | .eint_type = EINT_TYPE_WKUP, \ |
| 123 | .eint_func = 3, \ |
| 124 | .eint_mask = emask, \ |
| 125 | .eint_offset = eoffs, \ |
| 126 | .name = id \ |
| 127 | } |
| 128 | |
| 129 | #define PIN_BANK_4BIT2_EINTG(pins, reg, id, eoffs) \ |
| 130 | { \ |
| 131 | .type = &bank_type_4bit2_off, \ |
| 132 | .pctl_offset = reg, \ |
| 133 | .nr_pins = pins, \ |
| 134 | .eint_type = EINT_TYPE_GPIO, \ |
| 135 | .eint_func = 7, \ |
| 136 | .eint_mask = (1 << (pins)) - 1, \ |
| 137 | .eint_offset = eoffs, \ |
| 138 | .name = id \ |
| 139 | } |
| 140 | |
| 141 | #define PIN_BANK_4BIT2_EINTW(pins, reg, id, eoffs, emask) \ |
| 142 | { \ |
| 143 | .type = &bank_type_4bit2_alive,\ |
| 144 | .pctl_offset = reg, \ |
| 145 | .nr_pins = pins, \ |
| 146 | .eint_type = EINT_TYPE_WKUP, \ |
| 147 | .eint_func = 3, \ |
| 148 | .eint_mask = emask, \ |
| 149 | .eint_offset = eoffs, \ |
| 150 | .name = id \ |
| 151 | } |
| 152 | |
| 153 | #define PIN_BANK_4BIT2_ALIVE(pins, reg, id) \ |
| 154 | { \ |
| 155 | .type = &bank_type_4bit2_alive,\ |
| 156 | .pctl_offset = reg, \ |
| 157 | .nr_pins = pins, \ |
| 158 | .eint_type = EINT_TYPE_NONE, \ |
| 159 | .name = id \ |
| 160 | } |
| 161 | |
| 162 | #define PIN_BANK_2BIT(pins, reg, id) \ |
| 163 | { \ |
| 164 | .type = &bank_type_2bit_off, \ |
| 165 | .pctl_offset = reg, \ |
| 166 | .nr_pins = pins, \ |
| 167 | .eint_type = EINT_TYPE_NONE, \ |
| 168 | .name = id \ |
| 169 | } |
| 170 | |
| 171 | #define PIN_BANK_2BIT_EINTG(pins, reg, id, eoffs, emask) \ |
| 172 | { \ |
| 173 | .type = &bank_type_2bit_off, \ |
| 174 | .pctl_offset = reg, \ |
| 175 | .nr_pins = pins, \ |
| 176 | .eint_type = EINT_TYPE_GPIO, \ |
| 177 | .eint_func = 3, \ |
| 178 | .eint_mask = emask, \ |
| 179 | .eint_offset = eoffs, \ |
| 180 | .name = id \ |
| 181 | } |
| 182 | |
| 183 | #define PIN_BANK_2BIT_EINTW(pins, reg, id, eoffs) \ |
| 184 | { \ |
| 185 | .type = &bank_type_2bit_alive,\ |
| 186 | .pctl_offset = reg, \ |
| 187 | .nr_pins = pins, \ |
| 188 | .eint_type = EINT_TYPE_WKUP, \ |
| 189 | .eint_func = 2, \ |
| 190 | .eint_mask = (1 << (pins)) - 1, \ |
| 191 | .eint_offset = eoffs, \ |
| 192 | .name = id \ |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * struct s3c64xx_eint0_data: EINT0 common data |
| 197 | * @drvdata: pin controller driver data |
| 198 | * @domains: IRQ domains of particular EINT0 interrupts |
| 199 | * @pins: pin offsets inside of banks of particular EINT0 interrupts |
| 200 | */ |
| 201 | struct s3c64xx_eint0_data { |
| 202 | struct samsung_pinctrl_drv_data *drvdata; |
| 203 | struct irq_domain *domains[NUM_EINT0]; |
| 204 | u8 pins[NUM_EINT0]; |
| 205 | }; |
| 206 | |
| 207 | /** |
| 208 | * struct s3c64xx_eint0_domain_data: EINT0 per-domain data |
| 209 | * @bank: pin bank related to the domain |
| 210 | * @eints: EINT0 interrupts related to the domain |
| 211 | */ |
| 212 | struct s3c64xx_eint0_domain_data { |
| 213 | struct samsung_pin_bank *bank; |
| 214 | u8 eints[]; |
| 215 | }; |
| 216 | |
| 217 | /** |
| 218 | * struct s3c64xx_eint_gpio_data: GPIO EINT data |
| 219 | * @drvdata: pin controller driver data |
| 220 | * @domains: array of domains related to EINT interrupt groups |
| 221 | */ |
| 222 | struct s3c64xx_eint_gpio_data { |
| 223 | struct samsung_pinctrl_drv_data *drvdata; |
| 224 | struct irq_domain *domains[]; |
| 225 | }; |
| 226 | |
| 227 | /* |
| 228 | * Common functions for S3C64xx EINT configuration |
| 229 | */ |
| 230 | |
| 231 | static int s3c64xx_irq_get_trigger(unsigned int type) |
| 232 | { |
| 233 | int trigger; |
| 234 | |
| 235 | switch (type) { |
| 236 | case IRQ_TYPE_EDGE_RISING: |
| 237 | trigger = EINT_EDGE_RISING; |
| 238 | break; |
| 239 | case IRQ_TYPE_EDGE_FALLING: |
| 240 | trigger = EINT_EDGE_FALLING; |
| 241 | break; |
| 242 | case IRQ_TYPE_EDGE_BOTH: |
| 243 | trigger = EINT_EDGE_BOTH; |
| 244 | break; |
| 245 | case IRQ_TYPE_LEVEL_HIGH: |
| 246 | trigger = EINT_LEVEL_HIGH; |
| 247 | break; |
| 248 | case IRQ_TYPE_LEVEL_LOW: |
| 249 | trigger = EINT_LEVEL_LOW; |
| 250 | break; |
| 251 | default: |
| 252 | return -EINVAL; |
| 253 | } |
| 254 | |
| 255 | return trigger; |
| 256 | } |
| 257 | |
Thomas Gleixner | f66eb49 | 2015-06-23 15:52:57 +0200 | [diff] [blame] | 258 | static void s3c64xx_irq_set_handler(struct irq_data *d, unsigned int type) |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 259 | { |
| 260 | /* Edge- and level-triggered interrupts need different handlers */ |
| 261 | if (type & IRQ_TYPE_EDGE_BOTH) |
Thomas Gleixner | f66eb49 | 2015-06-23 15:52:57 +0200 | [diff] [blame] | 262 | irq_set_handler_locked(d, handle_edge_irq); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 263 | else |
Thomas Gleixner | f66eb49 | 2015-06-23 15:52:57 +0200 | [diff] [blame] | 264 | irq_set_handler_locked(d, handle_level_irq); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 265 | } |
| 266 | |
| 267 | static void s3c64xx_irq_set_function(struct samsung_pinctrl_drv_data *d, |
| 268 | struct samsung_pin_bank *bank, int pin) |
| 269 | { |
Tomasz Figa | 94ce944 | 2014-09-23 21:05:39 +0200 | [diff] [blame] | 270 | const struct samsung_pin_bank_type *bank_type = bank->type; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 271 | unsigned long flags; |
| 272 | void __iomem *reg; |
| 273 | u8 shift; |
| 274 | u32 mask; |
| 275 | u32 val; |
| 276 | |
| 277 | /* Make sure that pin is configured as interrupt */ |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 278 | reg = d->virt_base + bank->pctl_offset; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 279 | shift = pin; |
| 280 | if (bank_type->fld_width[PINCFG_TYPE_FUNC] * shift >= 32) { |
| 281 | /* 4-bit bank type with 2 con regs */ |
| 282 | reg += 4; |
| 283 | shift -= 8; |
| 284 | } |
| 285 | |
| 286 | shift = shift * bank_type->fld_width[PINCFG_TYPE_FUNC]; |
| 287 | mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1; |
| 288 | |
| 289 | spin_lock_irqsave(&bank->slock, flags); |
| 290 | |
| 291 | val = readl(reg); |
| 292 | val &= ~(mask << shift); |
| 293 | val |= bank->eint_func << shift; |
| 294 | writel(val, reg); |
| 295 | |
| 296 | spin_unlock_irqrestore(&bank->slock, flags); |
| 297 | } |
| 298 | |
| 299 | /* |
| 300 | * Functions for EINT GPIO configuration (EINT groups 1-9) |
| 301 | */ |
| 302 | |
| 303 | static inline void s3c64xx_gpio_irq_set_mask(struct irq_data *irqd, bool mask) |
| 304 | { |
| 305 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 306 | struct samsung_pinctrl_drv_data *d = bank->drvdata; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 307 | unsigned char index = EINT_OFFS(bank->eint_offset) + irqd->hwirq; |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 308 | void __iomem *reg = d->virt_base + EINTMASK_REG(bank->eint_offset); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 309 | u32 val; |
| 310 | |
| 311 | val = readl(reg); |
| 312 | if (mask) |
| 313 | val |= 1 << index; |
| 314 | else |
| 315 | val &= ~(1 << index); |
| 316 | writel(val, reg); |
| 317 | } |
| 318 | |
| 319 | static void s3c64xx_gpio_irq_unmask(struct irq_data *irqd) |
| 320 | { |
| 321 | s3c64xx_gpio_irq_set_mask(irqd, false); |
| 322 | } |
| 323 | |
| 324 | static void s3c64xx_gpio_irq_mask(struct irq_data *irqd) |
| 325 | { |
| 326 | s3c64xx_gpio_irq_set_mask(irqd, true); |
| 327 | } |
| 328 | |
| 329 | static void s3c64xx_gpio_irq_ack(struct irq_data *irqd) |
| 330 | { |
| 331 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 332 | struct samsung_pinctrl_drv_data *d = bank->drvdata; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 333 | unsigned char index = EINT_OFFS(bank->eint_offset) + irqd->hwirq; |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 334 | void __iomem *reg = d->virt_base + EINTPEND_REG(bank->eint_offset); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 335 | |
| 336 | writel(1 << index, reg); |
| 337 | } |
| 338 | |
| 339 | static int s3c64xx_gpio_irq_set_type(struct irq_data *irqd, unsigned int type) |
| 340 | { |
| 341 | struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); |
| 342 | struct samsung_pinctrl_drv_data *d = bank->drvdata; |
| 343 | void __iomem *reg; |
| 344 | int trigger; |
| 345 | u8 shift; |
| 346 | u32 val; |
| 347 | |
| 348 | trigger = s3c64xx_irq_get_trigger(type); |
| 349 | if (trigger < 0) { |
| 350 | pr_err("unsupported external interrupt type\n"); |
| 351 | return -EINVAL; |
| 352 | } |
| 353 | |
Thomas Gleixner | f66eb49 | 2015-06-23 15:52:57 +0200 | [diff] [blame] | 354 | s3c64xx_irq_set_handler(irqd, type); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 355 | |
| 356 | /* Set up interrupt trigger */ |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 357 | reg = d->virt_base + EINTCON_REG(bank->eint_offset); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 358 | shift = EINT_OFFS(bank->eint_offset) + irqd->hwirq; |
| 359 | shift = 4 * (shift / 4); /* 4 EINTs per trigger selector */ |
| 360 | |
| 361 | val = readl(reg); |
| 362 | val &= ~(EINT_CON_MASK << shift); |
| 363 | val |= trigger << shift; |
| 364 | writel(val, reg); |
| 365 | |
| 366 | s3c64xx_irq_set_function(d, bank, irqd->hwirq); |
| 367 | |
| 368 | return 0; |
| 369 | } |
| 370 | |
| 371 | /* |
| 372 | * irq_chip for gpio interrupts. |
| 373 | */ |
| 374 | static struct irq_chip s3c64xx_gpio_irq_chip = { |
| 375 | .name = "GPIO", |
| 376 | .irq_unmask = s3c64xx_gpio_irq_unmask, |
| 377 | .irq_mask = s3c64xx_gpio_irq_mask, |
| 378 | .irq_ack = s3c64xx_gpio_irq_ack, |
| 379 | .irq_set_type = s3c64xx_gpio_irq_set_type, |
| 380 | }; |
| 381 | |
| 382 | static int s3c64xx_gpio_irq_map(struct irq_domain *h, unsigned int virq, |
| 383 | irq_hw_number_t hw) |
| 384 | { |
| 385 | struct samsung_pin_bank *bank = h->host_data; |
| 386 | |
| 387 | if (!(bank->eint_mask & (1 << hw))) |
| 388 | return -EINVAL; |
| 389 | |
| 390 | irq_set_chip_and_handler(virq, |
| 391 | &s3c64xx_gpio_irq_chip, handle_level_irq); |
| 392 | irq_set_chip_data(virq, bank); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 393 | |
| 394 | return 0; |
| 395 | } |
| 396 | |
| 397 | /* |
| 398 | * irq domain callbacks for external gpio interrupt controller. |
| 399 | */ |
| 400 | static const struct irq_domain_ops s3c64xx_gpio_irqd_ops = { |
| 401 | .map = s3c64xx_gpio_irq_map, |
| 402 | .xlate = irq_domain_xlate_twocell, |
| 403 | }; |
| 404 | |
Thomas Gleixner | bd0b9ac | 2015-09-14 10:42:37 +0200 | [diff] [blame] | 405 | static void s3c64xx_eint_gpio_irq(struct irq_desc *desc) |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 406 | { |
Jiang Liu | 5663bb2 | 2015-06-04 12:13:16 +0800 | [diff] [blame] | 407 | struct irq_chip *chip = irq_desc_get_chip(desc); |
| 408 | struct s3c64xx_eint_gpio_data *data = irq_desc_get_handler_data(desc); |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 409 | struct samsung_pinctrl_drv_data *drvdata = data->drvdata; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 410 | |
| 411 | chained_irq_enter(chip, desc); |
| 412 | |
| 413 | do { |
| 414 | unsigned int svc; |
| 415 | unsigned int group; |
| 416 | unsigned int pin; |
| 417 | unsigned int virq; |
| 418 | |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 419 | svc = readl(drvdata->virt_base + SERVICE_REG); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 420 | group = SVC_GROUP(svc); |
| 421 | pin = svc & SVC_NUM_MASK; |
| 422 | |
| 423 | if (!group) |
| 424 | break; |
| 425 | |
| 426 | /* Group 1 is used for two pin banks */ |
| 427 | if (group == 1) { |
| 428 | if (pin < 8) |
| 429 | group = 0; |
| 430 | else |
| 431 | pin -= 8; |
| 432 | } |
| 433 | |
| 434 | virq = irq_linear_revmap(data->domains[group], pin); |
| 435 | /* |
| 436 | * Something must be really wrong if an unmapped EINT |
| 437 | * was unmasked... |
| 438 | */ |
| 439 | BUG_ON(!virq); |
| 440 | |
| 441 | generic_handle_irq(virq); |
| 442 | } while (1); |
| 443 | |
| 444 | chained_irq_exit(chip, desc); |
| 445 | } |
| 446 | |
| 447 | /** |
| 448 | * s3c64xx_eint_gpio_init() - setup handling of external gpio interrupts. |
| 449 | * @d: driver data of samsung pinctrl driver. |
| 450 | */ |
| 451 | static int s3c64xx_eint_gpio_init(struct samsung_pinctrl_drv_data *d) |
| 452 | { |
| 453 | struct s3c64xx_eint_gpio_data *data; |
| 454 | struct samsung_pin_bank *bank; |
| 455 | struct device *dev = d->dev; |
| 456 | unsigned int nr_domains; |
| 457 | unsigned int i; |
| 458 | |
| 459 | if (!d->irq) { |
| 460 | dev_err(dev, "irq number not available\n"); |
| 461 | return -EINVAL; |
| 462 | } |
| 463 | |
| 464 | nr_domains = 0; |
Tomasz Figa | 1bf00d7 | 2014-09-23 21:05:40 +0200 | [diff] [blame] | 465 | bank = d->pin_banks; |
| 466 | for (i = 0; i < d->nr_banks; ++i, ++bank) { |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 467 | unsigned int nr_eints; |
| 468 | unsigned int mask; |
| 469 | |
| 470 | if (bank->eint_type != EINT_TYPE_GPIO) |
| 471 | continue; |
| 472 | |
| 473 | mask = bank->eint_mask; |
| 474 | nr_eints = fls(mask); |
| 475 | |
| 476 | bank->irq_domain = irq_domain_add_linear(bank->of_node, |
| 477 | nr_eints, &s3c64xx_gpio_irqd_ops, bank); |
| 478 | if (!bank->irq_domain) { |
| 479 | dev_err(dev, "gpio irq domain add failed\n"); |
| 480 | return -ENXIO; |
| 481 | } |
| 482 | |
| 483 | ++nr_domains; |
| 484 | } |
| 485 | |
Kees Cook | 0ed2dd0 | 2018-05-08 16:08:53 -0700 | [diff] [blame] | 486 | data = devm_kzalloc(dev, struct_size(data, domains, nr_domains), |
| 487 | GFP_KERNEL); |
Marek Szyprowski | fa5c0f4 | 2017-01-19 14:48:45 +0100 | [diff] [blame] | 488 | if (!data) |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 489 | return -ENOMEM; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 490 | data->drvdata = d; |
| 491 | |
Tomasz Figa | 1bf00d7 | 2014-09-23 21:05:40 +0200 | [diff] [blame] | 492 | bank = d->pin_banks; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 493 | nr_domains = 0; |
Tomasz Figa | 1bf00d7 | 2014-09-23 21:05:40 +0200 | [diff] [blame] | 494 | for (i = 0; i < d->nr_banks; ++i, ++bank) { |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 495 | if (bank->eint_type != EINT_TYPE_GPIO) |
| 496 | continue; |
| 497 | |
| 498 | data->domains[nr_domains++] = bank->irq_domain; |
| 499 | } |
| 500 | |
Thomas Gleixner | 623a650 | 2015-06-21 20:16:18 +0200 | [diff] [blame] | 501 | irq_set_chained_handler_and_data(d->irq, s3c64xx_eint_gpio_irq, data); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 502 | |
| 503 | return 0; |
| 504 | } |
| 505 | |
| 506 | /* |
| 507 | * Functions for configuration of EINT0 wake-up interrupts |
| 508 | */ |
| 509 | |
| 510 | static inline void s3c64xx_eint0_irq_set_mask(struct irq_data *irqd, bool mask) |
| 511 | { |
| 512 | struct s3c64xx_eint0_domain_data *ddata = |
| 513 | irq_data_get_irq_chip_data(irqd); |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 514 | struct samsung_pinctrl_drv_data *d = ddata->bank->drvdata; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 515 | u32 val; |
| 516 | |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 517 | val = readl(d->virt_base + EINT0MASK_REG); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 518 | if (mask) |
| 519 | val |= 1 << ddata->eints[irqd->hwirq]; |
| 520 | else |
| 521 | val &= ~(1 << ddata->eints[irqd->hwirq]); |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 522 | writel(val, d->virt_base + EINT0MASK_REG); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 523 | } |
| 524 | |
| 525 | static void s3c64xx_eint0_irq_unmask(struct irq_data *irqd) |
| 526 | { |
| 527 | s3c64xx_eint0_irq_set_mask(irqd, false); |
| 528 | } |
| 529 | |
| 530 | static void s3c64xx_eint0_irq_mask(struct irq_data *irqd) |
| 531 | { |
| 532 | s3c64xx_eint0_irq_set_mask(irqd, true); |
| 533 | } |
| 534 | |
| 535 | static void s3c64xx_eint0_irq_ack(struct irq_data *irqd) |
| 536 | { |
| 537 | struct s3c64xx_eint0_domain_data *ddata = |
| 538 | irq_data_get_irq_chip_data(irqd); |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 539 | struct samsung_pinctrl_drv_data *d = ddata->bank->drvdata; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 540 | |
| 541 | writel(1 << ddata->eints[irqd->hwirq], |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 542 | d->virt_base + EINT0PEND_REG); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 543 | } |
| 544 | |
| 545 | static int s3c64xx_eint0_irq_set_type(struct irq_data *irqd, unsigned int type) |
| 546 | { |
| 547 | struct s3c64xx_eint0_domain_data *ddata = |
| 548 | irq_data_get_irq_chip_data(irqd); |
| 549 | struct samsung_pin_bank *bank = ddata->bank; |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 550 | struct samsung_pinctrl_drv_data *d = bank->drvdata; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 551 | void __iomem *reg; |
| 552 | int trigger; |
| 553 | u8 shift; |
| 554 | u32 val; |
| 555 | |
| 556 | trigger = s3c64xx_irq_get_trigger(type); |
| 557 | if (trigger < 0) { |
| 558 | pr_err("unsupported external interrupt type\n"); |
| 559 | return -EINVAL; |
| 560 | } |
| 561 | |
Thomas Gleixner | f66eb49 | 2015-06-23 15:52:57 +0200 | [diff] [blame] | 562 | s3c64xx_irq_set_handler(irqd, type); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 563 | |
| 564 | /* Set up interrupt trigger */ |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 565 | reg = d->virt_base + EINT0CON0_REG; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 566 | shift = ddata->eints[irqd->hwirq]; |
| 567 | if (shift >= EINT_MAX_PER_REG) { |
| 568 | reg += 4; |
| 569 | shift -= EINT_MAX_PER_REG; |
| 570 | } |
| 571 | shift = EINT_CON_LEN * (shift / 2); |
| 572 | |
| 573 | val = readl(reg); |
| 574 | val &= ~(EINT_CON_MASK << shift); |
| 575 | val |= trigger << shift; |
| 576 | writel(val, reg); |
| 577 | |
| 578 | s3c64xx_irq_set_function(d, bank, irqd->hwirq); |
| 579 | |
| 580 | return 0; |
| 581 | } |
| 582 | |
| 583 | /* |
| 584 | * irq_chip for wakeup interrupts |
| 585 | */ |
| 586 | static struct irq_chip s3c64xx_eint0_irq_chip = { |
| 587 | .name = "EINT0", |
| 588 | .irq_unmask = s3c64xx_eint0_irq_unmask, |
| 589 | .irq_mask = s3c64xx_eint0_irq_mask, |
| 590 | .irq_ack = s3c64xx_eint0_irq_ack, |
| 591 | .irq_set_type = s3c64xx_eint0_irq_set_type, |
| 592 | }; |
| 593 | |
Jiang Liu | 5663bb2 | 2015-06-04 12:13:16 +0800 | [diff] [blame] | 594 | static inline void s3c64xx_irq_demux_eint(struct irq_desc *desc, u32 range) |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 595 | { |
Jiang Liu | 5663bb2 | 2015-06-04 12:13:16 +0800 | [diff] [blame] | 596 | struct irq_chip *chip = irq_desc_get_chip(desc); |
| 597 | struct s3c64xx_eint0_data *data = irq_desc_get_handler_data(desc); |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 598 | struct samsung_pinctrl_drv_data *drvdata = data->drvdata; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 599 | unsigned int pend, mask; |
| 600 | |
| 601 | chained_irq_enter(chip, desc); |
| 602 | |
Krzysztof Kozlowski | cee7413 | 2017-06-15 17:46:37 +0200 | [diff] [blame] | 603 | pend = readl(drvdata->virt_base + EINT0PEND_REG); |
| 604 | mask = readl(drvdata->virt_base + EINT0MASK_REG); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 605 | |
| 606 | pend = pend & range & ~mask; |
| 607 | pend &= range; |
| 608 | |
| 609 | while (pend) { |
Jiang Liu | 5663bb2 | 2015-06-04 12:13:16 +0800 | [diff] [blame] | 610 | unsigned int virq, irq; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 611 | |
| 612 | irq = fls(pend) - 1; |
| 613 | pend &= ~(1 << irq); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 614 | virq = irq_linear_revmap(data->domains[irq], data->pins[irq]); |
| 615 | /* |
| 616 | * Something must be really wrong if an unmapped EINT |
| 617 | * was unmasked... |
| 618 | */ |
| 619 | BUG_ON(!virq); |
| 620 | |
| 621 | generic_handle_irq(virq); |
| 622 | } |
| 623 | |
| 624 | chained_irq_exit(chip, desc); |
| 625 | } |
| 626 | |
Thomas Gleixner | bd0b9ac | 2015-09-14 10:42:37 +0200 | [diff] [blame] | 627 | static void s3c64xx_demux_eint0_3(struct irq_desc *desc) |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 628 | { |
Jiang Liu | 5663bb2 | 2015-06-04 12:13:16 +0800 | [diff] [blame] | 629 | s3c64xx_irq_demux_eint(desc, 0xf); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 630 | } |
| 631 | |
Thomas Gleixner | bd0b9ac | 2015-09-14 10:42:37 +0200 | [diff] [blame] | 632 | static void s3c64xx_demux_eint4_11(struct irq_desc *desc) |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 633 | { |
Jiang Liu | 5663bb2 | 2015-06-04 12:13:16 +0800 | [diff] [blame] | 634 | s3c64xx_irq_demux_eint(desc, 0xff0); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 635 | } |
| 636 | |
Thomas Gleixner | bd0b9ac | 2015-09-14 10:42:37 +0200 | [diff] [blame] | 637 | static void s3c64xx_demux_eint12_19(struct irq_desc *desc) |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 638 | { |
Jiang Liu | 5663bb2 | 2015-06-04 12:13:16 +0800 | [diff] [blame] | 639 | s3c64xx_irq_demux_eint(desc, 0xff000); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 640 | } |
| 641 | |
Thomas Gleixner | bd0b9ac | 2015-09-14 10:42:37 +0200 | [diff] [blame] | 642 | static void s3c64xx_demux_eint20_27(struct irq_desc *desc) |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 643 | { |
Jiang Liu | 5663bb2 | 2015-06-04 12:13:16 +0800 | [diff] [blame] | 644 | s3c64xx_irq_demux_eint(desc, 0xff00000); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 645 | } |
| 646 | |
| 647 | static irq_flow_handler_t s3c64xx_eint0_handlers[NUM_EINT0_IRQ] = { |
| 648 | s3c64xx_demux_eint0_3, |
| 649 | s3c64xx_demux_eint4_11, |
| 650 | s3c64xx_demux_eint12_19, |
| 651 | s3c64xx_demux_eint20_27, |
| 652 | }; |
| 653 | |
| 654 | static int s3c64xx_eint0_irq_map(struct irq_domain *h, unsigned int virq, |
| 655 | irq_hw_number_t hw) |
| 656 | { |
| 657 | struct s3c64xx_eint0_domain_data *ddata = h->host_data; |
| 658 | struct samsung_pin_bank *bank = ddata->bank; |
| 659 | |
| 660 | if (!(bank->eint_mask & (1 << hw))) |
| 661 | return -EINVAL; |
| 662 | |
| 663 | irq_set_chip_and_handler(virq, |
| 664 | &s3c64xx_eint0_irq_chip, handle_level_irq); |
| 665 | irq_set_chip_data(virq, ddata); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 666 | |
| 667 | return 0; |
| 668 | } |
| 669 | |
| 670 | /* |
| 671 | * irq domain callbacks for external wakeup interrupt controller. |
| 672 | */ |
| 673 | static const struct irq_domain_ops s3c64xx_eint0_irqd_ops = { |
| 674 | .map = s3c64xx_eint0_irq_map, |
| 675 | .xlate = irq_domain_xlate_twocell, |
| 676 | }; |
| 677 | |
| 678 | /* list of external wakeup controllers supported */ |
| 679 | static const struct of_device_id s3c64xx_eint0_irq_ids[] = { |
| 680 | { .compatible = "samsung,s3c64xx-wakeup-eint", }, |
| 681 | { } |
| 682 | }; |
| 683 | |
| 684 | /** |
| 685 | * s3c64xx_eint_eint0_init() - setup handling of external wakeup interrupts. |
| 686 | * @d: driver data of samsung pinctrl driver. |
| 687 | */ |
| 688 | static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d) |
| 689 | { |
| 690 | struct device *dev = d->dev; |
| 691 | struct device_node *eint0_np = NULL; |
| 692 | struct device_node *np; |
| 693 | struct samsung_pin_bank *bank; |
| 694 | struct s3c64xx_eint0_data *data; |
| 695 | unsigned int i; |
| 696 | |
| 697 | for_each_child_of_node(dev->of_node, np) { |
| 698 | if (of_match_node(s3c64xx_eint0_irq_ids, np)) { |
| 699 | eint0_np = np; |
| 700 | break; |
| 701 | } |
| 702 | } |
| 703 | if (!eint0_np) |
| 704 | return -ENODEV; |
| 705 | |
| 706 | data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); |
Marek Szyprowski | fa5c0f4 | 2017-01-19 14:48:45 +0100 | [diff] [blame] | 707 | if (!data) |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 708 | return -ENOMEM; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 709 | data->drvdata = d; |
| 710 | |
| 711 | for (i = 0; i < NUM_EINT0_IRQ; ++i) { |
| 712 | unsigned int irq; |
| 713 | |
| 714 | irq = irq_of_parse_and_map(eint0_np, i); |
| 715 | if (!irq) { |
| 716 | dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i); |
| 717 | return -ENXIO; |
| 718 | } |
| 719 | |
Thomas Gleixner | 623a650 | 2015-06-21 20:16:18 +0200 | [diff] [blame] | 720 | irq_set_chained_handler_and_data(irq, |
| 721 | s3c64xx_eint0_handlers[i], |
| 722 | data); |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 723 | } |
| 724 | |
Tomasz Figa | 1bf00d7 | 2014-09-23 21:05:40 +0200 | [diff] [blame] | 725 | bank = d->pin_banks; |
| 726 | for (i = 0; i < d->nr_banks; ++i, ++bank) { |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 727 | struct s3c64xx_eint0_domain_data *ddata; |
| 728 | unsigned int nr_eints; |
| 729 | unsigned int mask; |
| 730 | unsigned int irq; |
| 731 | unsigned int pin; |
| 732 | |
| 733 | if (bank->eint_type != EINT_TYPE_WKUP) |
| 734 | continue; |
| 735 | |
| 736 | mask = bank->eint_mask; |
| 737 | nr_eints = fls(mask); |
| 738 | |
| 739 | ddata = devm_kzalloc(dev, |
| 740 | sizeof(*ddata) + nr_eints, GFP_KERNEL); |
Marek Szyprowski | fa5c0f4 | 2017-01-19 14:48:45 +0100 | [diff] [blame] | 741 | if (!ddata) |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 742 | return -ENOMEM; |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 743 | ddata->bank = bank; |
| 744 | |
| 745 | bank->irq_domain = irq_domain_add_linear(bank->of_node, |
| 746 | nr_eints, &s3c64xx_eint0_irqd_ops, ddata); |
| 747 | if (!bank->irq_domain) { |
| 748 | dev_err(dev, "wkup irq domain add failed\n"); |
| 749 | return -ENXIO; |
| 750 | } |
| 751 | |
| 752 | irq = bank->eint_offset; |
| 753 | mask = bank->eint_mask; |
| 754 | for (pin = 0; mask; ++pin, mask >>= 1) { |
| 755 | if (!(mask & 1)) |
| 756 | continue; |
| 757 | data->domains[irq] = bank->irq_domain; |
| 758 | data->pins[irq] = pin; |
| 759 | ddata->eints[pin] = irq; |
| 760 | ++irq; |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | return 0; |
| 765 | } |
| 766 | |
| 767 | /* pin banks of s3c64xx pin-controller 0 */ |
Tomasz Figa | 8100cf4 | 2014-09-23 21:05:41 +0200 | [diff] [blame] | 768 | static const struct samsung_pin_bank_data s3c64xx_pin_banks0[] __initconst = { |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 769 | PIN_BANK_4BIT_EINTG(8, 0x000, "gpa", 0), |
| 770 | PIN_BANK_4BIT_EINTG(7, 0x020, "gpb", 8), |
| 771 | PIN_BANK_4BIT_EINTG(8, 0x040, "gpc", 16), |
| 772 | PIN_BANK_4BIT_EINTG(5, 0x060, "gpd", 32), |
| 773 | PIN_BANK_4BIT(5, 0x080, "gpe"), |
| 774 | PIN_BANK_2BIT_EINTG(16, 0x0a0, "gpf", 48, 0x3fff), |
| 775 | PIN_BANK_4BIT_EINTG(7, 0x0c0, "gpg", 64), |
| 776 | PIN_BANK_4BIT2_EINTG(10, 0x0e0, "gph", 80), |
| 777 | PIN_BANK_2BIT(16, 0x100, "gpi"), |
| 778 | PIN_BANK_2BIT(12, 0x120, "gpj"), |
| 779 | PIN_BANK_4BIT2_ALIVE(16, 0x800, "gpk"), |
| 780 | PIN_BANK_4BIT2_EINTW(15, 0x810, "gpl", 16, 0x7f00), |
| 781 | PIN_BANK_4BIT_EINTW(6, 0x820, "gpm", 23, 0x1f), |
| 782 | PIN_BANK_2BIT_EINTW(16, 0x830, "gpn", 0), |
| 783 | PIN_BANK_2BIT_EINTG(16, 0x140, "gpo", 96, 0xffff), |
| 784 | PIN_BANK_2BIT_EINTG(15, 0x160, "gpp", 112, 0x7fff), |
| 785 | PIN_BANK_2BIT_EINTG(9, 0x180, "gpq", 128, 0x1ff), |
| 786 | }; |
| 787 | |
| 788 | /* |
| 789 | * Samsung pinctrl driver data for S3C64xx SoC. S3C64xx SoC includes |
| 790 | * one gpio/pin-mux/pinconfig controller. |
| 791 | */ |
Krzysztof Kozlowski | 93b0bea | 2018-02-20 19:17:51 +0100 | [diff] [blame] | 792 | static const struct samsung_pin_ctrl s3c64xx_pin_ctrl[] __initconst = { |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 793 | { |
| 794 | /* pin-controller instance 1 data */ |
| 795 | .pin_banks = s3c64xx_pin_banks0, |
| 796 | .nr_banks = ARRAY_SIZE(s3c64xx_pin_banks0), |
| 797 | .eint_gpio_init = s3c64xx_eint_gpio_init, |
| 798 | .eint_wkup_init = s3c64xx_eint_eint0_init, |
Tomasz Figa | 61dd726 | 2013-03-18 22:31:55 +0100 | [diff] [blame] | 799 | }, |
| 800 | }; |
Krzysztof Kozlowski | 93b0bea | 2018-02-20 19:17:51 +0100 | [diff] [blame] | 801 | |
| 802 | const struct samsung_pinctrl_of_match_data s3c64xx_of_data __initconst = { |
| 803 | .ctrl = s3c64xx_pin_ctrl, |
| 804 | .num_ctrl = ARRAY_SIZE(s3c64xx_pin_ctrl), |
| 805 | }; |