blob: 9609c23834cef2755aeb9a83558df5b8535759a6 [file] [log] [blame]
Thomas Abraham43b169d2012-09-07 06:07:19 +09001/*
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>
Catalin Marinasde88cbb2013-01-18 15:31:37 +000026#include <linux/irqchip/chained_irq.h>
Thomas Abraham43b169d2012-09-07 06:07:19 +090027#include <linux/of_irq.h>
28#include <linux/io.h>
29#include <linux/slab.h>
Tomasz Figa19846952013-03-18 22:31:50 +010030#include <linux/spinlock.h>
Thomas Abraham43b169d2012-09-07 06:07:19 +090031#include <linux/err.h>
32
Thomas Abraham43b169d2012-09-07 06:07:19 +090033#include "pinctrl-samsung.h"
34#include "pinctrl-exynos.h"
35
Tomasz Figa499147c2013-03-18 22:31:52 +010036
37static struct samsung_pin_bank_type bank_type_off = {
38 .fld_width = { 4, 1, 2, 2, 2, 2, },
Tomasz Figa43fc9e72013-03-18 22:31:53 +010039 .reg_offset = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, },
Tomasz Figa499147c2013-03-18 22:31:52 +010040};
41
42static struct samsung_pin_bank_type bank_type_alive = {
43 .fld_width = { 4, 1, 2, 2, },
Tomasz Figa43fc9e72013-03-18 22:31:53 +010044 .reg_offset = { 0x00, 0x04, 0x08, 0x0c, },
Tomasz Figa499147c2013-03-18 22:31:52 +010045};
46
Thomas Abraham43b169d2012-09-07 06:07:19 +090047/* list of external wakeup controllers supported */
48static const struct of_device_id exynos_wkup_irq_ids[] = {
49 { .compatible = "samsung,exynos4210-wakeup-eint", },
Axel Linafa538c2012-11-02 21:46:13 +080050 { }
Thomas Abraham43b169d2012-09-07 06:07:19 +090051};
52
Thomas Abraham43b169d2012-09-07 06:07:19 +090053static void exynos_gpio_irq_mask(struct irq_data *irqd)
54{
Tomasz Figa595be722012-10-11 10:11:16 +020055 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
56 struct samsung_pinctrl_drv_data *d = bank->drvdata;
57 unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset;
Thomas Abraham43b169d2012-09-07 06:07:19 +090058 unsigned long mask;
Doug Anderson5ae8cf72013-06-12 10:33:17 -070059 unsigned long flags;
60
61 spin_lock_irqsave(&bank->slock, flags);
Thomas Abraham43b169d2012-09-07 06:07:19 +090062
63 mask = readl(d->virt_base + reg_mask);
Tomasz Figa595be722012-10-11 10:11:16 +020064 mask |= 1 << irqd->hwirq;
Thomas Abraham43b169d2012-09-07 06:07:19 +090065 writel(mask, d->virt_base + reg_mask);
Doug Anderson5ae8cf72013-06-12 10:33:17 -070066
67 spin_unlock_irqrestore(&bank->slock, flags);
Thomas Abraham43b169d2012-09-07 06:07:19 +090068}
69
70static void exynos_gpio_irq_ack(struct irq_data *irqd)
71{
Tomasz Figa595be722012-10-11 10:11:16 +020072 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
73 struct samsung_pinctrl_drv_data *d = bank->drvdata;
74 unsigned long reg_pend = d->ctrl->geint_pend + bank->eint_offset;
Thomas Abraham43b169d2012-09-07 06:07:19 +090075
Tomasz Figa595be722012-10-11 10:11:16 +020076 writel(1 << irqd->hwirq, d->virt_base + reg_pend);
Thomas Abraham43b169d2012-09-07 06:07:19 +090077}
78
Doug Anderson5ace03f2013-06-12 10:33:18 -070079static void exynos_gpio_irq_unmask(struct irq_data *irqd)
80{
81 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
82 struct samsung_pinctrl_drv_data *d = bank->drvdata;
83 unsigned long reg_mask = d->ctrl->geint_mask + bank->eint_offset;
84 unsigned long mask;
85 unsigned long flags;
86
Doug Anderson5a68e7a2013-06-17 09:50:43 -070087 /*
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
Doug Anderson5ace03f2013-06-12 10:33:18 -070098 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);
105}
106
Thomas Abraham43b169d2012-09-07 06:07:19 +0900107static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
108{
Tomasz Figa595be722012-10-11 10:11:16 +0200109 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
Tomasz Figa499147c2013-03-18 22:31:52 +0100110 struct samsung_pin_bank_type *bank_type = bank->type;
Tomasz Figa595be722012-10-11 10:11:16 +0200111 struct samsung_pinctrl_drv_data *d = bank->drvdata;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900112 struct samsung_pin_ctrl *ctrl = d->ctrl;
Tomasz Figa595be722012-10-11 10:11:16 +0200113 unsigned int pin = irqd->hwirq;
114 unsigned int shift = EXYNOS_EINT_CON_LEN * pin;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900115 unsigned int con, trig_type;
Tomasz Figa595be722012-10-11 10:11:16 +0200116 unsigned long reg_con = ctrl->geint_con + bank->eint_offset;
Tomasz Figa19846952013-03-18 22:31:50 +0100117 unsigned long flags;
Tomasz Figaee2f5732012-09-21 07:33:48 +0900118 unsigned int mask;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900119
120 switch (type) {
121 case IRQ_TYPE_EDGE_RISING:
122 trig_type = EXYNOS_EINT_EDGE_RISING;
123 break;
124 case IRQ_TYPE_EDGE_FALLING:
125 trig_type = EXYNOS_EINT_EDGE_FALLING;
126 break;
127 case IRQ_TYPE_EDGE_BOTH:
128 trig_type = EXYNOS_EINT_EDGE_BOTH;
129 break;
130 case IRQ_TYPE_LEVEL_HIGH:
131 trig_type = EXYNOS_EINT_LEVEL_HIGH;
132 break;
133 case IRQ_TYPE_LEVEL_LOW:
134 trig_type = EXYNOS_EINT_LEVEL_LOW;
135 break;
136 default:
137 pr_err("unsupported external interrupt type\n");
138 return -EINVAL;
139 }
140
141 if (type & IRQ_TYPE_EDGE_BOTH)
142 __irq_set_handler_locked(irqd->irq, handle_edge_irq);
143 else
144 __irq_set_handler_locked(irqd->irq, handle_level_irq);
145
146 con = readl(d->virt_base + reg_con);
147 con &= ~(EXYNOS_EINT_CON_MASK << shift);
148 con |= trig_type << shift;
149 writel(con, d->virt_base + reg_con);
Tomasz Figaee2f5732012-09-21 07:33:48 +0900150
Tomasz Figa43fc9e72013-03-18 22:31:53 +0100151 reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC];
Tomasz Figa499147c2013-03-18 22:31:52 +0100152 shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC];
153 mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1;
Tomasz Figaee2f5732012-09-21 07:33:48 +0900154
Tomasz Figa19846952013-03-18 22:31:50 +0100155 spin_lock_irqsave(&bank->slock, flags);
156
Tomasz Figaee2f5732012-09-21 07:33:48 +0900157 con = readl(d->virt_base + reg_con);
158 con &= ~(mask << shift);
159 con |= EXYNOS_EINT_FUNC << shift;
160 writel(con, d->virt_base + reg_con);
161
Tomasz Figa19846952013-03-18 22:31:50 +0100162 spin_unlock_irqrestore(&bank->slock, flags);
163
Thomas Abraham43b169d2012-09-07 06:07:19 +0900164 return 0;
165}
166
167/*
168 * irq_chip for gpio interrupts.
169 */
170static struct irq_chip exynos_gpio_irq_chip = {
171 .name = "exynos_gpio_irq_chip",
172 .irq_unmask = exynos_gpio_irq_unmask,
173 .irq_mask = exynos_gpio_irq_mask,
174 .irq_ack = exynos_gpio_irq_ack,
175 .irq_set_type = exynos_gpio_irq_set_type,
176};
177
Thomas Abraham43b169d2012-09-07 06:07:19 +0900178static int exynos_gpio_irq_map(struct irq_domain *h, unsigned int virq,
179 irq_hw_number_t hw)
180{
Tomasz Figa595be722012-10-11 10:11:16 +0200181 struct samsung_pin_bank *b = h->host_data;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900182
Tomasz Figa595be722012-10-11 10:11:16 +0200183 irq_set_chip_data(virq, b);
Thomas Abraham43b169d2012-09-07 06:07:19 +0900184 irq_set_chip_and_handler(virq, &exynos_gpio_irq_chip,
185 handle_level_irq);
186 set_irq_flags(virq, IRQF_VALID);
187 return 0;
188}
189
Thomas Abraham43b169d2012-09-07 06:07:19 +0900190/*
191 * irq domain callbacks for external gpio interrupt controller.
192 */
193static const struct irq_domain_ops exynos_gpio_irqd_ops = {
194 .map = exynos_gpio_irq_map,
Thomas Abraham43b169d2012-09-07 06:07:19 +0900195 .xlate = irq_domain_xlate_twocell,
196};
197
198static irqreturn_t exynos_eint_gpio_irq(int irq, void *data)
199{
200 struct samsung_pinctrl_drv_data *d = data;
201 struct samsung_pin_ctrl *ctrl = d->ctrl;
202 struct samsung_pin_bank *bank = ctrl->pin_banks;
203 unsigned int svc, group, pin, virq;
204
205 svc = readl(d->virt_base + ctrl->svc);
206 group = EXYNOS_SVC_GROUP(svc);
207 pin = svc & EXYNOS_SVC_NUM_MASK;
208
209 if (!group)
210 return IRQ_HANDLED;
211 bank += (group - 1);
212
Tomasz Figa595be722012-10-11 10:11:16 +0200213 virq = irq_linear_revmap(bank->irq_domain, pin);
Thomas Abraham43b169d2012-09-07 06:07:19 +0900214 if (!virq)
215 return IRQ_NONE;
216 generic_handle_irq(virq);
217 return IRQ_HANDLED;
218}
219
Tomasz Figa7ccbc602013-05-22 16:03:17 +0200220struct exynos_eint_gpio_save {
221 u32 eint_con;
222 u32 eint_fltcon0;
223 u32 eint_fltcon1;
224};
225
Thomas Abraham43b169d2012-09-07 06:07:19 +0900226/*
227 * exynos_eint_gpio_init() - setup handling of external gpio interrupts.
228 * @d: driver data of samsung pinctrl driver.
229 */
230static int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
231{
Tomasz Figa595be722012-10-11 10:11:16 +0200232 struct samsung_pin_bank *bank;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900233 struct device *dev = d->dev;
Tomasz Figa7ccbc602013-05-22 16:03:17 +0200234 int ret;
235 int i;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900236
237 if (!d->irq) {
238 dev_err(dev, "irq number not available\n");
239 return -EINVAL;
240 }
241
242 ret = devm_request_irq(dev, d->irq, exynos_eint_gpio_irq,
243 0, dev_name(dev), d);
244 if (ret) {
245 dev_err(dev, "irq request failed\n");
246 return -ENXIO;
247 }
248
Tomasz Figa595be722012-10-11 10:11:16 +0200249 bank = d->ctrl->pin_banks;
250 for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) {
251 if (bank->eint_type != EINT_TYPE_GPIO)
252 continue;
253 bank->irq_domain = irq_domain_add_linear(bank->of_node,
254 bank->nr_pins, &exynos_gpio_irqd_ops, bank);
255 if (!bank->irq_domain) {
256 dev_err(dev, "gpio irq domain add failed\n");
Tomasz Figa7ccbc602013-05-22 16:03:17 +0200257 ret = -ENXIO;
258 goto err_domains;
259 }
260
261 bank->soc_priv = devm_kzalloc(d->dev,
262 sizeof(struct exynos_eint_gpio_save), GFP_KERNEL);
263 if (!bank->soc_priv) {
264 irq_domain_remove(bank->irq_domain);
265 ret = -ENOMEM;
266 goto err_domains;
Tomasz Figa595be722012-10-11 10:11:16 +0200267 }
Thomas Abraham43b169d2012-09-07 06:07:19 +0900268 }
269
270 return 0;
Tomasz Figa7ccbc602013-05-22 16:03:17 +0200271
272err_domains:
273 for (--i, --bank; i >= 0; --i, --bank) {
274 if (bank->eint_type != EINT_TYPE_GPIO)
275 continue;
276 irq_domain_remove(bank->irq_domain);
277 }
278
279 return ret;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900280}
281
Thomas Abraham43b169d2012-09-07 06:07:19 +0900282static void exynos_wkup_irq_mask(struct irq_data *irqd)
283{
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200284 struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd);
285 struct samsung_pinctrl_drv_data *d = b->drvdata;
286 unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900287 unsigned long mask;
Doug Anderson5ae8cf72013-06-12 10:33:17 -0700288 unsigned long flags;
289
290 spin_lock_irqsave(&b->slock, flags);
Thomas Abraham43b169d2012-09-07 06:07:19 +0900291
292 mask = readl(d->virt_base + reg_mask);
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200293 mask |= 1 << irqd->hwirq;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900294 writel(mask, d->virt_base + reg_mask);
Doug Anderson5ae8cf72013-06-12 10:33:17 -0700295
296 spin_unlock_irqrestore(&b->slock, flags);
Thomas Abraham43b169d2012-09-07 06:07:19 +0900297}
298
299static void exynos_wkup_irq_ack(struct irq_data *irqd)
300{
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200301 struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd);
302 struct samsung_pinctrl_drv_data *d = b->drvdata;
303 unsigned long pend = d->ctrl->weint_pend + b->eint_offset;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900304
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200305 writel(1 << irqd->hwirq, d->virt_base + pend);
Thomas Abraham43b169d2012-09-07 06:07:19 +0900306}
307
Doug Anderson5ace03f2013-06-12 10:33:18 -0700308static void exynos_wkup_irq_unmask(struct irq_data *irqd)
309{
310 struct samsung_pin_bank *b = irq_data_get_irq_chip_data(irqd);
311 struct samsung_pinctrl_drv_data *d = b->drvdata;
312 unsigned long reg_mask = d->ctrl->weint_mask + b->eint_offset;
313 unsigned long mask;
314 unsigned long flags;
315
Doug Anderson5a68e7a2013-06-17 09:50:43 -0700316 /*
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
Doug Anderson5ace03f2013-06-12 10:33:18 -0700327 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);
334}
335
Thomas Abraham43b169d2012-09-07 06:07:19 +0900336static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type)
337{
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200338 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
Tomasz Figa499147c2013-03-18 22:31:52 +0100339 struct samsung_pin_bank_type *bank_type = bank->type;
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200340 struct samsung_pinctrl_drv_data *d = bank->drvdata;
341 unsigned int pin = irqd->hwirq;
342 unsigned long reg_con = d->ctrl->weint_con + bank->eint_offset;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900343 unsigned long shift = EXYNOS_EINT_CON_LEN * pin;
344 unsigned long con, trig_type;
Tomasz Figa19846952013-03-18 22:31:50 +0100345 unsigned long flags;
Tomasz Figa22b9ba02012-10-11 10:11:19 +0200346 unsigned int mask;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900347
348 switch (type) {
349 case IRQ_TYPE_EDGE_RISING:
350 trig_type = EXYNOS_EINT_EDGE_RISING;
351 break;
352 case IRQ_TYPE_EDGE_FALLING:
353 trig_type = EXYNOS_EINT_EDGE_FALLING;
354 break;
355 case IRQ_TYPE_EDGE_BOTH:
356 trig_type = EXYNOS_EINT_EDGE_BOTH;
357 break;
358 case IRQ_TYPE_LEVEL_HIGH:
359 trig_type = EXYNOS_EINT_LEVEL_HIGH;
360 break;
361 case IRQ_TYPE_LEVEL_LOW:
362 trig_type = EXYNOS_EINT_LEVEL_LOW;
363 break;
364 default:
365 pr_err("unsupported external interrupt type\n");
366 return -EINVAL;
367 }
368
369 if (type & IRQ_TYPE_EDGE_BOTH)
370 __irq_set_handler_locked(irqd->irq, handle_edge_irq);
371 else
372 __irq_set_handler_locked(irqd->irq, handle_level_irq);
373
374 con = readl(d->virt_base + reg_con);
375 con &= ~(EXYNOS_EINT_CON_MASK << shift);
376 con |= trig_type << shift;
377 writel(con, d->virt_base + reg_con);
Tomasz Figa22b9ba02012-10-11 10:11:19 +0200378
Tomasz Figa43fc9e72013-03-18 22:31:53 +0100379 reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC];
Tomasz Figa499147c2013-03-18 22:31:52 +0100380 shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC];
381 mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1;
Tomasz Figa22b9ba02012-10-11 10:11:19 +0200382
Tomasz Figa19846952013-03-18 22:31:50 +0100383 spin_lock_irqsave(&bank->slock, flags);
384
Tomasz Figa22b9ba02012-10-11 10:11:19 +0200385 con = readl(d->virt_base + reg_con);
386 con &= ~(mask << shift);
387 con |= EXYNOS_EINT_FUNC << shift;
388 writel(con, d->virt_base + reg_con);
389
Tomasz Figa19846952013-03-18 22:31:50 +0100390 spin_unlock_irqrestore(&bank->slock, flags);
391
Thomas Abraham43b169d2012-09-07 06:07:19 +0900392 return 0;
393}
394
Tomasz Figaad350cd2013-05-17 18:24:27 +0200395static u32 exynos_eint_wake_mask = 0xffffffff;
396
397u32 exynos_get_eint_wake_mask(void)
398{
399 return exynos_eint_wake_mask;
400}
401
402static int exynos_wkup_irq_set_wake(struct irq_data *irqd, unsigned int on)
403{
404 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
405 unsigned long bit = 1UL << (2 * bank->eint_offset + irqd->hwirq);
406
407 pr_info("wake %s for irq %d\n", on ? "enabled" : "disabled", irqd->irq);
408
409 if (!on)
410 exynos_eint_wake_mask |= bit;
411 else
412 exynos_eint_wake_mask &= ~bit;
413
414 return 0;
415}
416
Thomas Abraham43b169d2012-09-07 06:07:19 +0900417/*
418 * irq_chip for wakeup interrupts
419 */
420static struct irq_chip exynos_wkup_irq_chip = {
421 .name = "exynos_wkup_irq_chip",
422 .irq_unmask = exynos_wkup_irq_unmask,
423 .irq_mask = exynos_wkup_irq_mask,
424 .irq_ack = exynos_wkup_irq_ack,
425 .irq_set_type = exynos_wkup_irq_set_type,
Tomasz Figaad350cd2013-05-17 18:24:27 +0200426 .irq_set_wake = exynos_wkup_irq_set_wake,
Thomas Abraham43b169d2012-09-07 06:07:19 +0900427};
428
429/* interrupt handler for wakeup interrupts 0..15 */
430static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
431{
432 struct exynos_weint_data *eintd = irq_get_handler_data(irq);
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200433 struct samsung_pin_bank *bank = eintd->bank;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900434 struct irq_chip *chip = irq_get_chip(irq);
435 int eint_irq;
436
437 chained_irq_enter(chip, desc);
438 chip->irq_mask(&desc->irq_data);
439
440 if (chip->irq_ack)
441 chip->irq_ack(&desc->irq_data);
442
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200443 eint_irq = irq_linear_revmap(bank->irq_domain, eintd->irq);
Thomas Abraham43b169d2012-09-07 06:07:19 +0900444 generic_handle_irq(eint_irq);
445 chip->irq_unmask(&desc->irq_data);
446 chained_irq_exit(chip, desc);
447}
448
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200449static inline void exynos_irq_demux_eint(unsigned long pend,
450 struct irq_domain *domain)
Thomas Abraham43b169d2012-09-07 06:07:19 +0900451{
452 unsigned int irq;
453
454 while (pend) {
455 irq = fls(pend) - 1;
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200456 generic_handle_irq(irq_find_mapping(domain, irq));
Thomas Abraham43b169d2012-09-07 06:07:19 +0900457 pend &= ~(1 << irq);
458 }
459}
460
461/* interrupt handler for wakeup interrupt 16 */
462static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
463{
464 struct irq_chip *chip = irq_get_chip(irq);
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200465 struct exynos_muxed_weint_data *eintd = irq_get_handler_data(irq);
466 struct samsung_pinctrl_drv_data *d = eintd->banks[0]->drvdata;
467 struct samsung_pin_ctrl *ctrl = d->ctrl;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900468 unsigned long pend;
Tomasz Figade590492012-09-21 07:33:55 +0900469 unsigned long mask;
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200470 int i;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900471
472 chained_irq_enter(chip, desc);
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200473
474 for (i = 0; i < eintd->nr_banks; ++i) {
475 struct samsung_pin_bank *b = eintd->banks[i];
476 pend = readl(d->virt_base + ctrl->weint_pend + b->eint_offset);
477 mask = readl(d->virt_base + ctrl->weint_mask + b->eint_offset);
478 exynos_irq_demux_eint(pend & ~mask, b->irq_domain);
479 }
480
Thomas Abraham43b169d2012-09-07 06:07:19 +0900481 chained_irq_exit(chip, desc);
482}
483
484static int exynos_wkup_irq_map(struct irq_domain *h, unsigned int virq,
485 irq_hw_number_t hw)
486{
487 irq_set_chip_and_handler(virq, &exynos_wkup_irq_chip, handle_level_irq);
488 irq_set_chip_data(virq, h->host_data);
489 set_irq_flags(virq, IRQF_VALID);
490 return 0;
491}
492
493/*
494 * irq domain callbacks for external wakeup interrupt controller.
495 */
496static const struct irq_domain_ops exynos_wkup_irqd_ops = {
497 .map = exynos_wkup_irq_map,
498 .xlate = irq_domain_xlate_twocell,
499};
500
501/*
502 * exynos_eint_wkup_init() - setup handling of external wakeup interrupts.
503 * @d: driver data of samsung pinctrl driver.
504 */
505static int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
506{
507 struct device *dev = d->dev;
Tomasz Figac3ad0562012-09-21 07:34:01 +0900508 struct device_node *wkup_np = NULL;
509 struct device_node *np;
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200510 struct samsung_pin_bank *bank;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900511 struct exynos_weint_data *weint_data;
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200512 struct exynos_muxed_weint_data *muxed_data;
513 unsigned int muxed_banks = 0;
514 unsigned int i;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900515 int idx, irq;
516
Tomasz Figac3ad0562012-09-21 07:34:01 +0900517 for_each_child_of_node(dev->of_node, np) {
518 if (of_match_node(exynos_wkup_irq_ids, np)) {
519 wkup_np = np;
520 break;
521 }
Thomas Abraham43b169d2012-09-07 06:07:19 +0900522 }
Tomasz Figac3ad0562012-09-21 07:34:01 +0900523 if (!wkup_np)
524 return -ENODEV;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900525
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200526 bank = d->ctrl->pin_banks;
527 for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) {
528 if (bank->eint_type != EINT_TYPE_WKUP)
529 continue;
530
531 bank->irq_domain = irq_domain_add_linear(bank->of_node,
532 bank->nr_pins, &exynos_wkup_irqd_ops, bank);
533 if (!bank->irq_domain) {
534 dev_err(dev, "wkup irq domain add failed\n");
535 return -ENXIO;
536 }
537
538 if (!of_find_property(bank->of_node, "interrupts", NULL)) {
539 bank->eint_type = EINT_TYPE_WKUP_MUX;
540 ++muxed_banks;
541 continue;
542 }
543
544 weint_data = devm_kzalloc(dev, bank->nr_pins
545 * sizeof(*weint_data), GFP_KERNEL);
546 if (!weint_data) {
547 dev_err(dev, "could not allocate memory for weint_data\n");
548 return -ENOMEM;
549 }
550
551 for (idx = 0; idx < bank->nr_pins; ++idx) {
552 irq = irq_of_parse_and_map(bank->of_node, idx);
553 if (!irq) {
554 dev_err(dev, "irq number for eint-%s-%d not found\n",
555 bank->name, idx);
556 continue;
557 }
558 weint_data[idx].irq = idx;
559 weint_data[idx].bank = bank;
560 irq_set_handler_data(irq, &weint_data[idx]);
561 irq_set_chained_handler(irq, exynos_irq_eint0_15);
562 }
Thomas Abraham43b169d2012-09-07 06:07:19 +0900563 }
564
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200565 if (!muxed_banks)
566 return 0;
567
568 irq = irq_of_parse_and_map(wkup_np, 0);
569 if (!irq) {
570 dev_err(dev, "irq number for muxed EINTs not found\n");
571 return 0;
572 }
573
574 muxed_data = devm_kzalloc(dev, sizeof(*muxed_data)
575 + muxed_banks*sizeof(struct samsung_pin_bank *), GFP_KERNEL);
576 if (!muxed_data) {
577 dev_err(dev, "could not allocate memory for muxed_data\n");
Thomas Abraham43b169d2012-09-07 06:07:19 +0900578 return -ENOMEM;
579 }
580
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200581 irq_set_chained_handler(irq, exynos_irq_demux_eint16_31);
582 irq_set_handler_data(irq, muxed_data);
Thomas Abraham43b169d2012-09-07 06:07:19 +0900583
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200584 bank = d->ctrl->pin_banks;
585 idx = 0;
586 for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) {
587 if (bank->eint_type != EINT_TYPE_WKUP_MUX)
588 continue;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900589
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200590 muxed_data->banks[idx++] = bank;
Thomas Abraham43b169d2012-09-07 06:07:19 +0900591 }
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200592 muxed_data->nr_banks = muxed_banks;
593
Thomas Abraham43b169d2012-09-07 06:07:19 +0900594 return 0;
595}
596
Tomasz Figa7ccbc602013-05-22 16:03:17 +0200597static void exynos_pinctrl_suspend_bank(
598 struct samsung_pinctrl_drv_data *drvdata,
599 struct samsung_pin_bank *bank)
600{
601 struct exynos_eint_gpio_save *save = bank->soc_priv;
602 void __iomem *regs = drvdata->virt_base;
603
604 save->eint_con = readl(regs + EXYNOS_GPIO_ECON_OFFSET
605 + bank->eint_offset);
606 save->eint_fltcon0 = readl(regs + EXYNOS_GPIO_EFLTCON_OFFSET
607 + 2 * bank->eint_offset);
608 save->eint_fltcon1 = readl(regs + EXYNOS_GPIO_EFLTCON_OFFSET
609 + 2 * bank->eint_offset + 4);
610
611 pr_debug("%s: save con %#010x\n", bank->name, save->eint_con);
612 pr_debug("%s: save fltcon0 %#010x\n", bank->name, save->eint_fltcon0);
613 pr_debug("%s: save fltcon1 %#010x\n", bank->name, save->eint_fltcon1);
614}
615
616static void exynos_pinctrl_suspend(struct samsung_pinctrl_drv_data *drvdata)
617{
618 struct samsung_pin_ctrl *ctrl = drvdata->ctrl;
619 struct samsung_pin_bank *bank = ctrl->pin_banks;
620 int i;
621
622 for (i = 0; i < ctrl->nr_banks; ++i, ++bank)
623 if (bank->eint_type == EINT_TYPE_GPIO)
624 exynos_pinctrl_suspend_bank(drvdata, bank);
625}
626
627static void exynos_pinctrl_resume_bank(
628 struct samsung_pinctrl_drv_data *drvdata,
629 struct samsung_pin_bank *bank)
630{
631 struct exynos_eint_gpio_save *save = bank->soc_priv;
632 void __iomem *regs = drvdata->virt_base;
633
634 pr_debug("%s: con %#010x => %#010x\n", bank->name,
635 readl(regs + EXYNOS_GPIO_ECON_OFFSET
636 + bank->eint_offset), save->eint_con);
637 pr_debug("%s: fltcon0 %#010x => %#010x\n", bank->name,
638 readl(regs + EXYNOS_GPIO_EFLTCON_OFFSET
639 + 2 * bank->eint_offset), save->eint_fltcon0);
640 pr_debug("%s: fltcon1 %#010x => %#010x\n", bank->name,
641 readl(regs + EXYNOS_GPIO_EFLTCON_OFFSET
642 + 2 * bank->eint_offset + 4), save->eint_fltcon1);
643
644 writel(save->eint_con, regs + EXYNOS_GPIO_ECON_OFFSET
645 + bank->eint_offset);
646 writel(save->eint_fltcon0, regs + EXYNOS_GPIO_EFLTCON_OFFSET
647 + 2 * bank->eint_offset);
648 writel(save->eint_fltcon1, regs + EXYNOS_GPIO_EFLTCON_OFFSET
649 + 2 * bank->eint_offset + 4);
650}
651
652static void exynos_pinctrl_resume(struct samsung_pinctrl_drv_data *drvdata)
653{
654 struct samsung_pin_ctrl *ctrl = drvdata->ctrl;
655 struct samsung_pin_bank *bank = ctrl->pin_banks;
656 int i;
657
658 for (i = 0; i < ctrl->nr_banks; ++i, ++bank)
659 if (bank->eint_type == EINT_TYPE_GPIO)
660 exynos_pinctrl_resume_bank(drvdata, bank);
661}
662
Mateusz Krawczuk608a26a2013-08-27 15:08:10 +0200663/* pin banks of s5pv210 pin-controller */
664static struct samsung_pin_bank s5pv210_pin_bank[] = {
665 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
Mateusz Krawczuk48802922013-09-24 17:04:11 +0200666 EXYNOS_PIN_BANK_EINTG(4, 0x020, "gpa1", 0x04),
Mateusz Krawczuk608a26a2013-08-27 15:08:10 +0200667 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08),
668 EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c),
669 EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10),
670 EXYNOS_PIN_BANK_EINTG(4, 0x0a0, "gpd0", 0x14),
Mateusz Krawczuk48802922013-09-24 17:04:11 +0200671 EXYNOS_PIN_BANK_EINTG(6, 0x0c0, "gpd1", 0x18),
672 EXYNOS_PIN_BANK_EINTG(8, 0x0e0, "gpe0", 0x1c),
673 EXYNOS_PIN_BANK_EINTG(5, 0x100, "gpe1", 0x20),
674 EXYNOS_PIN_BANK_EINTG(8, 0x120, "gpf0", 0x24),
Mateusz Krawczuk608a26a2013-08-27 15:08:10 +0200675 EXYNOS_PIN_BANK_EINTG(8, 0x140, "gpf1", 0x28),
676 EXYNOS_PIN_BANK_EINTG(8, 0x160, "gpf2", 0x2c),
Mateusz Krawczuk48802922013-09-24 17:04:11 +0200677 EXYNOS_PIN_BANK_EINTG(6, 0x180, "gpf3", 0x30),
Mateusz Krawczuk608a26a2013-08-27 15:08:10 +0200678 EXYNOS_PIN_BANK_EINTG(7, 0x1a0, "gpg0", 0x34),
679 EXYNOS_PIN_BANK_EINTG(7, 0x1c0, "gpg1", 0x38),
680 EXYNOS_PIN_BANK_EINTG(7, 0x1e0, "gpg2", 0x3c),
681 EXYNOS_PIN_BANK_EINTG(7, 0x200, "gpg3", 0x40),
682 EXYNOS_PIN_BANK_EINTN(7, 0x220, "gpi"),
683 EXYNOS_PIN_BANK_EINTG(8, 0x240, "gpj0", 0x44),
684 EXYNOS_PIN_BANK_EINTG(6, 0x260, "gpj1", 0x48),
685 EXYNOS_PIN_BANK_EINTG(8, 0x280, "gpj2", 0x4c),
686 EXYNOS_PIN_BANK_EINTG(8, 0x2a0, "gpj3", 0x50),
687 EXYNOS_PIN_BANK_EINTG(5, 0x2c0, "gpj4", 0x54),
688 EXYNOS_PIN_BANK_EINTN(8, 0x2e0, "mp01"),
689 EXYNOS_PIN_BANK_EINTN(4, 0x300, "mp02"),
690 EXYNOS_PIN_BANK_EINTN(8, 0x320, "mp03"),
691 EXYNOS_PIN_BANK_EINTN(8, 0x340, "mp04"),
692 EXYNOS_PIN_BANK_EINTN(8, 0x360, "mp05"),
693 EXYNOS_PIN_BANK_EINTN(8, 0x380, "mp06"),
694 EXYNOS_PIN_BANK_EINTN(8, 0x3a0, "mp07"),
695 EXYNOS_PIN_BANK_EINTW(8, 0xc00, "gph0", 0x00),
696 EXYNOS_PIN_BANK_EINTW(8, 0xc20, "gph1", 0x04),
697 EXYNOS_PIN_BANK_EINTW(8, 0xc40, "gph2", 0x08),
698 EXYNOS_PIN_BANK_EINTW(8, 0xc60, "gph3", 0x0c),
699};
700
701struct samsung_pin_ctrl s5pv210_pin_ctrl[] = {
702 {
703 /* pin-controller instance 0 data */
704 .pin_banks = s5pv210_pin_bank,
705 .nr_banks = ARRAY_SIZE(s5pv210_pin_bank),
706 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
707 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
708 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
709 .weint_con = EXYNOS_WKUP_ECON_OFFSET,
710 .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
711 .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
712 .svc = EXYNOS_SVC_OFFSET,
713 .eint_gpio_init = exynos_eint_gpio_init,
714 .eint_wkup_init = exynos_eint_wkup_init,
715 .suspend = exynos_pinctrl_suspend,
716 .resume = exynos_pinctrl_resume,
717 .label = "s5pv210-gpio-ctrl0",
718 },
719};
720
Tomasz Figad97f5b92014-04-14 10:45:47 +0900721/* pin banks of exynos3250 pin-controller 0 */
722static struct samsung_pin_bank exynos3250_pin_banks0[] = {
723 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
724 EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
725 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08),
726 EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c),
727 EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10),
728 EXYNOS_PIN_BANK_EINTG(4, 0x0a0, "gpd0", 0x14),
729 EXYNOS_PIN_BANK_EINTG(4, 0x0c0, "gpd1", 0x18),
730};
731
732/* pin banks of exynos3250 pin-controller 1 */
733static struct samsung_pin_bank exynos3250_pin_banks1[] = {
734 EXYNOS_PIN_BANK_EINTN(8, 0x120, "gpe0"),
735 EXYNOS_PIN_BANK_EINTN(8, 0x140, "gpe1"),
736 EXYNOS_PIN_BANK_EINTN(3, 0x180, "gpe2"),
737 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpk0", 0x08),
738 EXYNOS_PIN_BANK_EINTG(7, 0x060, "gpk1", 0x0c),
739 EXYNOS_PIN_BANK_EINTG(7, 0x080, "gpk2", 0x10),
740 EXYNOS_PIN_BANK_EINTG(4, 0x0c0, "gpl0", 0x18),
741 EXYNOS_PIN_BANK_EINTG(8, 0x260, "gpm0", 0x24),
742 EXYNOS_PIN_BANK_EINTG(7, 0x280, "gpm1", 0x28),
743 EXYNOS_PIN_BANK_EINTG(5, 0x2a0, "gpm2", 0x2c),
744 EXYNOS_PIN_BANK_EINTG(8, 0x2c0, "gpm3", 0x30),
745 EXYNOS_PIN_BANK_EINTG(8, 0x2e0, "gpm4", 0x34),
746 EXYNOS_PIN_BANK_EINTW(8, 0xc00, "gpx0", 0x00),
747 EXYNOS_PIN_BANK_EINTW(8, 0xc20, "gpx1", 0x04),
748 EXYNOS_PIN_BANK_EINTW(8, 0xc40, "gpx2", 0x08),
749 EXYNOS_PIN_BANK_EINTW(8, 0xc60, "gpx3", 0x0c),
750};
751
752/*
753 * Samsung pinctrl driver data for Exynos3250 SoC. Exynos3250 SoC includes
754 * two gpio/pin-mux/pinconfig controllers.
755 */
756struct samsung_pin_ctrl exynos3250_pin_ctrl[] = {
757 {
758 /* pin-controller instance 0 data */
759 .pin_banks = exynos3250_pin_banks0,
760 .nr_banks = ARRAY_SIZE(exynos3250_pin_banks0),
761 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
762 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
763 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
764 .svc = EXYNOS_SVC_OFFSET,
765 .eint_gpio_init = exynos_eint_gpio_init,
766 .suspend = exynos_pinctrl_suspend,
767 .resume = exynos_pinctrl_resume,
768 .label = "exynos3250-gpio-ctrl0",
769 }, {
770 /* pin-controller instance 1 data */
771 .pin_banks = exynos3250_pin_banks1,
772 .nr_banks = ARRAY_SIZE(exynos3250_pin_banks1),
773 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
774 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
775 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
776 .weint_con = EXYNOS_WKUP_ECON_OFFSET,
777 .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
778 .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
779 .svc = EXYNOS_SVC_OFFSET,
780 .eint_gpio_init = exynos_eint_gpio_init,
781 .eint_wkup_init = exynos_eint_wkup_init,
782 .suspend = exynos_pinctrl_suspend,
783 .resume = exynos_pinctrl_resume,
784 .label = "exynos3250-gpio-ctrl1",
785 },
786};
787
Thomas Abraham43b169d2012-09-07 06:07:19 +0900788/* pin banks of exynos4210 pin-controller 0 */
789static struct samsung_pin_bank exynos4210_pin_banks0[] = {
Tomasz Figa1b6056d2012-10-11 10:11:15 +0200790 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
791 EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
792 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08),
793 EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c),
794 EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10),
795 EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpd0", 0x14),
796 EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpd1", 0x18),
797 EXYNOS_PIN_BANK_EINTG(5, 0x0E0, "gpe0", 0x1c),
798 EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpe1", 0x20),
799 EXYNOS_PIN_BANK_EINTG(6, 0x120, "gpe2", 0x24),
800 EXYNOS_PIN_BANK_EINTG(8, 0x140, "gpe3", 0x28),
801 EXYNOS_PIN_BANK_EINTG(8, 0x160, "gpe4", 0x2c),
802 EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpf0", 0x30),
803 EXYNOS_PIN_BANK_EINTG(8, 0x1A0, "gpf1", 0x34),
804 EXYNOS_PIN_BANK_EINTG(8, 0x1C0, "gpf2", 0x38),
805 EXYNOS_PIN_BANK_EINTG(6, 0x1E0, "gpf3", 0x3c),
Thomas Abraham43b169d2012-09-07 06:07:19 +0900806};
807
808/* pin banks of exynos4210 pin-controller 1 */
809static struct samsung_pin_bank exynos4210_pin_banks1[] = {
Tomasz Figa1b6056d2012-10-11 10:11:15 +0200810 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpj0", 0x00),
811 EXYNOS_PIN_BANK_EINTG(5, 0x020, "gpj1", 0x04),
812 EXYNOS_PIN_BANK_EINTG(7, 0x040, "gpk0", 0x08),
813 EXYNOS_PIN_BANK_EINTG(7, 0x060, "gpk1", 0x0c),
814 EXYNOS_PIN_BANK_EINTG(7, 0x080, "gpk2", 0x10),
815 EXYNOS_PIN_BANK_EINTG(7, 0x0A0, "gpk3", 0x14),
816 EXYNOS_PIN_BANK_EINTG(8, 0x0C0, "gpl0", 0x18),
817 EXYNOS_PIN_BANK_EINTG(3, 0x0E0, "gpl1", 0x1c),
818 EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpl2", 0x20),
Tomasz Figa40ba6222012-10-11 10:11:09 +0200819 EXYNOS_PIN_BANK_EINTN(6, 0x120, "gpy0"),
820 EXYNOS_PIN_BANK_EINTN(4, 0x140, "gpy1"),
821 EXYNOS_PIN_BANK_EINTN(6, 0x160, "gpy2"),
822 EXYNOS_PIN_BANK_EINTN(8, 0x180, "gpy3"),
823 EXYNOS_PIN_BANK_EINTN(8, 0x1A0, "gpy4"),
824 EXYNOS_PIN_BANK_EINTN(8, 0x1C0, "gpy5"),
825 EXYNOS_PIN_BANK_EINTN(8, 0x1E0, "gpy6"),
Tomasz Figaa04b07c2012-10-11 10:11:18 +0200826 EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00),
827 EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04),
828 EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08),
829 EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c),
Thomas Abraham43b169d2012-09-07 06:07:19 +0900830};
831
832/* pin banks of exynos4210 pin-controller 2 */
833static struct samsung_pin_bank exynos4210_pin_banks2[] = {
Tomasz Figa40ba6222012-10-11 10:11:09 +0200834 EXYNOS_PIN_BANK_EINTN(7, 0x000, "gpz"),
Thomas Abraham43b169d2012-09-07 06:07:19 +0900835};
836
837/*
838 * Samsung pinctrl driver data for Exynos4210 SoC. Exynos4210 SoC includes
839 * three gpio/pin-mux/pinconfig controllers.
840 */
841struct samsung_pin_ctrl exynos4210_pin_ctrl[] = {
842 {
843 /* pin-controller instance 0 data */
844 .pin_banks = exynos4210_pin_banks0,
845 .nr_banks = ARRAY_SIZE(exynos4210_pin_banks0),
Thomas Abraham43b169d2012-09-07 06:07:19 +0900846 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
847 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
848 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
849 .svc = EXYNOS_SVC_OFFSET,
850 .eint_gpio_init = exynos_eint_gpio_init,
Tomasz Figa7ccbc602013-05-22 16:03:17 +0200851 .suspend = exynos_pinctrl_suspend,
852 .resume = exynos_pinctrl_resume,
Thomas Abraham43b169d2012-09-07 06:07:19 +0900853 .label = "exynos4210-gpio-ctrl0",
854 }, {
855 /* pin-controller instance 1 data */
856 .pin_banks = exynos4210_pin_banks1,
857 .nr_banks = ARRAY_SIZE(exynos4210_pin_banks1),
Thomas Abraham43b169d2012-09-07 06:07:19 +0900858 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
859 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
860 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
861 .weint_con = EXYNOS_WKUP_ECON_OFFSET,
862 .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
863 .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
864 .svc = EXYNOS_SVC_OFFSET,
865 .eint_gpio_init = exynos_eint_gpio_init,
866 .eint_wkup_init = exynos_eint_wkup_init,
Tomasz Figa7ccbc602013-05-22 16:03:17 +0200867 .suspend = exynos_pinctrl_suspend,
868 .resume = exynos_pinctrl_resume,
Thomas Abraham43b169d2012-09-07 06:07:19 +0900869 .label = "exynos4210-gpio-ctrl1",
870 }, {
871 /* pin-controller instance 2 data */
872 .pin_banks = exynos4210_pin_banks2,
873 .nr_banks = ARRAY_SIZE(exynos4210_pin_banks2),
Thomas Abraham43b169d2012-09-07 06:07:19 +0900874 .label = "exynos4210-gpio-ctrl2",
875 },
876};
Tomasz Figa6edc7942012-11-07 08:44:59 +0900877
878/* pin banks of exynos4x12 pin-controller 0 */
879static struct samsung_pin_bank exynos4x12_pin_banks0[] = {
880 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
881 EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
882 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08),
883 EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c),
884 EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10),
885 EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpd0", 0x14),
886 EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpd1", 0x18),
887 EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpf0", 0x30),
888 EXYNOS_PIN_BANK_EINTG(8, 0x1A0, "gpf1", 0x34),
889 EXYNOS_PIN_BANK_EINTG(8, 0x1C0, "gpf2", 0x38),
890 EXYNOS_PIN_BANK_EINTG(6, 0x1E0, "gpf3", 0x3c),
891 EXYNOS_PIN_BANK_EINTG(8, 0x240, "gpj0", 0x40),
892 EXYNOS_PIN_BANK_EINTG(5, 0x260, "gpj1", 0x44),
893};
894
895/* pin banks of exynos4x12 pin-controller 1 */
896static struct samsung_pin_bank exynos4x12_pin_banks1[] = {
897 EXYNOS_PIN_BANK_EINTG(7, 0x040, "gpk0", 0x08),
898 EXYNOS_PIN_BANK_EINTG(7, 0x060, "gpk1", 0x0c),
899 EXYNOS_PIN_BANK_EINTG(7, 0x080, "gpk2", 0x10),
900 EXYNOS_PIN_BANK_EINTG(7, 0x0A0, "gpk3", 0x14),
901 EXYNOS_PIN_BANK_EINTG(7, 0x0C0, "gpl0", 0x18),
902 EXYNOS_PIN_BANK_EINTG(2, 0x0E0, "gpl1", 0x1c),
903 EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpl2", 0x20),
904 EXYNOS_PIN_BANK_EINTG(8, 0x260, "gpm0", 0x24),
905 EXYNOS_PIN_BANK_EINTG(7, 0x280, "gpm1", 0x28),
906 EXYNOS_PIN_BANK_EINTG(5, 0x2A0, "gpm2", 0x2c),
907 EXYNOS_PIN_BANK_EINTG(8, 0x2C0, "gpm3", 0x30),
908 EXYNOS_PIN_BANK_EINTG(8, 0x2E0, "gpm4", 0x34),
909 EXYNOS_PIN_BANK_EINTN(6, 0x120, "gpy0"),
910 EXYNOS_PIN_BANK_EINTN(4, 0x140, "gpy1"),
911 EXYNOS_PIN_BANK_EINTN(6, 0x160, "gpy2"),
912 EXYNOS_PIN_BANK_EINTN(8, 0x180, "gpy3"),
913 EXYNOS_PIN_BANK_EINTN(8, 0x1A0, "gpy4"),
914 EXYNOS_PIN_BANK_EINTN(8, 0x1C0, "gpy5"),
915 EXYNOS_PIN_BANK_EINTN(8, 0x1E0, "gpy6"),
916 EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00),
917 EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04),
918 EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08),
919 EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c),
920};
921
922/* pin banks of exynos4x12 pin-controller 2 */
923static struct samsung_pin_bank exynos4x12_pin_banks2[] = {
924 EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz", 0x00),
925};
926
927/* pin banks of exynos4x12 pin-controller 3 */
928static struct samsung_pin_bank exynos4x12_pin_banks3[] = {
929 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpv0", 0x00),
930 EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpv1", 0x04),
931 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpv2", 0x08),
932 EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpv3", 0x0c),
933 EXYNOS_PIN_BANK_EINTG(2, 0x080, "gpv4", 0x10),
934};
935
936/*
937 * Samsung pinctrl driver data for Exynos4x12 SoC. Exynos4x12 SoC includes
938 * four gpio/pin-mux/pinconfig controllers.
939 */
940struct samsung_pin_ctrl exynos4x12_pin_ctrl[] = {
941 {
942 /* pin-controller instance 0 data */
943 .pin_banks = exynos4x12_pin_banks0,
944 .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks0),
945 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
946 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
947 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
948 .svc = EXYNOS_SVC_OFFSET,
949 .eint_gpio_init = exynos_eint_gpio_init,
Tomasz Figa7ccbc602013-05-22 16:03:17 +0200950 .suspend = exynos_pinctrl_suspend,
951 .resume = exynos_pinctrl_resume,
Tomasz Figa6edc7942012-11-07 08:44:59 +0900952 .label = "exynos4x12-gpio-ctrl0",
953 }, {
954 /* pin-controller instance 1 data */
955 .pin_banks = exynos4x12_pin_banks1,
956 .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks1),
957 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
958 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
959 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
960 .weint_con = EXYNOS_WKUP_ECON_OFFSET,
961 .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
962 .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
963 .svc = EXYNOS_SVC_OFFSET,
964 .eint_gpio_init = exynos_eint_gpio_init,
965 .eint_wkup_init = exynos_eint_wkup_init,
Tomasz Figa7ccbc602013-05-22 16:03:17 +0200966 .suspend = exynos_pinctrl_suspend,
967 .resume = exynos_pinctrl_resume,
Tomasz Figa6edc7942012-11-07 08:44:59 +0900968 .label = "exynos4x12-gpio-ctrl1",
969 }, {
970 /* pin-controller instance 2 data */
971 .pin_banks = exynos4x12_pin_banks2,
972 .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks2),
973 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
974 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
975 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
976 .svc = EXYNOS_SVC_OFFSET,
977 .eint_gpio_init = exynos_eint_gpio_init,
Tomasz Figa7ccbc602013-05-22 16:03:17 +0200978 .suspend = exynos_pinctrl_suspend,
979 .resume = exynos_pinctrl_resume,
Tomasz Figa6edc7942012-11-07 08:44:59 +0900980 .label = "exynos4x12-gpio-ctrl2",
981 }, {
982 /* pin-controller instance 3 data */
983 .pin_banks = exynos4x12_pin_banks3,
984 .nr_banks = ARRAY_SIZE(exynos4x12_pin_banks3),
985 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
986 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
987 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
988 .svc = EXYNOS_SVC_OFFSET,
989 .eint_gpio_init = exynos_eint_gpio_init,
Tomasz Figa7ccbc602013-05-22 16:03:17 +0200990 .suspend = exynos_pinctrl_suspend,
991 .resume = exynos_pinctrl_resume,
Tomasz Figa6edc7942012-11-07 08:44:59 +0900992 .label = "exynos4x12-gpio-ctrl3",
993 },
994};
Thomas Abrahamf67faf42012-12-28 10:37:27 -0800995
996/* pin banks of exynos5250 pin-controller 0 */
997static struct samsung_pin_bank exynos5250_pin_banks0[] = {
998 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
999 EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
1000 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpa2", 0x08),
1001 EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpb0", 0x0c),
1002 EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpb1", 0x10),
1003 EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpb2", 0x14),
1004 EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpb3", 0x18),
1005 EXYNOS_PIN_BANK_EINTG(7, 0x0E0, "gpc0", 0x1c),
1006 EXYNOS_PIN_BANK_EINTG(4, 0x100, "gpc1", 0x20),
1007 EXYNOS_PIN_BANK_EINTG(7, 0x120, "gpc2", 0x24),
1008 EXYNOS_PIN_BANK_EINTG(7, 0x140, "gpc3", 0x28),
1009 EXYNOS_PIN_BANK_EINTG(4, 0x160, "gpd0", 0x2c),
1010 EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpd1", 0x30),
1011 EXYNOS_PIN_BANK_EINTG(7, 0x2E0, "gpc4", 0x34),
1012 EXYNOS_PIN_BANK_EINTN(6, 0x1A0, "gpy0"),
1013 EXYNOS_PIN_BANK_EINTN(4, 0x1C0, "gpy1"),
1014 EXYNOS_PIN_BANK_EINTN(6, 0x1E0, "gpy2"),
1015 EXYNOS_PIN_BANK_EINTN(8, 0x200, "gpy3"),
1016 EXYNOS_PIN_BANK_EINTN(8, 0x220, "gpy4"),
1017 EXYNOS_PIN_BANK_EINTN(8, 0x240, "gpy5"),
1018 EXYNOS_PIN_BANK_EINTN(8, 0x260, "gpy6"),
1019 EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00),
1020 EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04),
1021 EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08),
1022 EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c),
1023};
1024
1025/* pin banks of exynos5250 pin-controller 1 */
1026static struct samsung_pin_bank exynos5250_pin_banks1[] = {
1027 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpe0", 0x00),
1028 EXYNOS_PIN_BANK_EINTG(2, 0x020, "gpe1", 0x04),
1029 EXYNOS_PIN_BANK_EINTG(4, 0x040, "gpf0", 0x08),
1030 EXYNOS_PIN_BANK_EINTG(4, 0x060, "gpf1", 0x0c),
1031 EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpg0", 0x10),
1032 EXYNOS_PIN_BANK_EINTG(8, 0x0A0, "gpg1", 0x14),
1033 EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpg2", 0x18),
1034 EXYNOS_PIN_BANK_EINTG(4, 0x0E0, "gph0", 0x1c),
1035 EXYNOS_PIN_BANK_EINTG(8, 0x100, "gph1", 0x20),
1036};
1037
1038/* pin banks of exynos5250 pin-controller 2 */
1039static struct samsung_pin_bank exynos5250_pin_banks2[] = {
1040 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpv0", 0x00),
1041 EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpv1", 0x04),
1042 EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpv2", 0x08),
1043 EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpv3", 0x0c),
1044 EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpv4", 0x10),
1045};
1046
1047/* pin banks of exynos5250 pin-controller 3 */
1048static struct samsung_pin_bank exynos5250_pin_banks3[] = {
1049 EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz", 0x00),
1050};
1051
1052/*
1053 * Samsung pinctrl driver data for Exynos5250 SoC. Exynos5250 SoC includes
1054 * four gpio/pin-mux/pinconfig controllers.
1055 */
1056struct samsung_pin_ctrl exynos5250_pin_ctrl[] = {
1057 {
1058 /* pin-controller instance 0 data */
1059 .pin_banks = exynos5250_pin_banks0,
1060 .nr_banks = ARRAY_SIZE(exynos5250_pin_banks0),
1061 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1062 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1063 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1064 .weint_con = EXYNOS_WKUP_ECON_OFFSET,
1065 .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
1066 .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
1067 .svc = EXYNOS_SVC_OFFSET,
1068 .eint_gpio_init = exynos_eint_gpio_init,
1069 .eint_wkup_init = exynos_eint_wkup_init,
Tomasz Figa7ccbc602013-05-22 16:03:17 +02001070 .suspend = exynos_pinctrl_suspend,
1071 .resume = exynos_pinctrl_resume,
Thomas Abrahamf67faf42012-12-28 10:37:27 -08001072 .label = "exynos5250-gpio-ctrl0",
1073 }, {
1074 /* pin-controller instance 1 data */
1075 .pin_banks = exynos5250_pin_banks1,
1076 .nr_banks = ARRAY_SIZE(exynos5250_pin_banks1),
1077 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1078 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1079 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1080 .svc = EXYNOS_SVC_OFFSET,
1081 .eint_gpio_init = exynos_eint_gpio_init,
Tomasz Figa7ccbc602013-05-22 16:03:17 +02001082 .suspend = exynos_pinctrl_suspend,
1083 .resume = exynos_pinctrl_resume,
Thomas Abrahamf67faf42012-12-28 10:37:27 -08001084 .label = "exynos5250-gpio-ctrl1",
1085 }, {
1086 /* pin-controller instance 2 data */
1087 .pin_banks = exynos5250_pin_banks2,
1088 .nr_banks = ARRAY_SIZE(exynos5250_pin_banks2),
1089 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1090 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1091 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1092 .svc = EXYNOS_SVC_OFFSET,
1093 .eint_gpio_init = exynos_eint_gpio_init,
Tomasz Figa7ccbc602013-05-22 16:03:17 +02001094 .suspend = exynos_pinctrl_suspend,
1095 .resume = exynos_pinctrl_resume,
Thomas Abrahamf67faf42012-12-28 10:37:27 -08001096 .label = "exynos5250-gpio-ctrl2",
1097 }, {
1098 /* pin-controller instance 3 data */
1099 .pin_banks = exynos5250_pin_banks3,
1100 .nr_banks = ARRAY_SIZE(exynos5250_pin_banks3),
1101 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1102 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1103 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1104 .svc = EXYNOS_SVC_OFFSET,
1105 .eint_gpio_init = exynos_eint_gpio_init,
Tomasz Figa7ccbc602013-05-22 16:03:17 +02001106 .suspend = exynos_pinctrl_suspend,
1107 .resume = exynos_pinctrl_resume,
Thomas Abrahamf67faf42012-12-28 10:37:27 -08001108 .label = "exynos5250-gpio-ctrl3",
1109 },
1110};
Leela Krishna Amudala983dbeb2013-06-19 22:16:26 +09001111
Young-Gun Jang9a8b6072014-02-05 11:51:28 +05301112/* pin banks of exynos5260 pin-controller 0 */
1113static struct samsung_pin_bank exynos5260_pin_banks0[] = {
1114 EXYNOS_PIN_BANK_EINTG(4, 0x000, "gpa0", 0x00),
1115 EXYNOS_PIN_BANK_EINTG(7, 0x020, "gpa1", 0x04),
1116 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpa2", 0x08),
1117 EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpb0", 0x0c),
1118 EXYNOS_PIN_BANK_EINTG(4, 0x080, "gpb1", 0x10),
1119 EXYNOS_PIN_BANK_EINTG(5, 0x0a0, "gpb2", 0x14),
1120 EXYNOS_PIN_BANK_EINTG(8, 0x0c0, "gpb3", 0x18),
1121 EXYNOS_PIN_BANK_EINTG(8, 0x0e0, "gpb4", 0x1c),
1122 EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpb5", 0x20),
1123 EXYNOS_PIN_BANK_EINTG(8, 0x120, "gpd0", 0x24),
1124 EXYNOS_PIN_BANK_EINTG(7, 0x140, "gpd1", 0x28),
1125 EXYNOS_PIN_BANK_EINTG(5, 0x160, "gpd2", 0x2c),
1126 EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpe0", 0x30),
1127 EXYNOS_PIN_BANK_EINTG(5, 0x1a0, "gpe1", 0x34),
1128 EXYNOS_PIN_BANK_EINTG(4, 0x1c0, "gpf0", 0x38),
1129 EXYNOS_PIN_BANK_EINTG(8, 0x1e0, "gpf1", 0x3c),
1130 EXYNOS_PIN_BANK_EINTG(2, 0x200, "gpk0", 0x40),
1131 EXYNOS_PIN_BANK_EINTW(8, 0xc00, "gpx0", 0x00),
1132 EXYNOS_PIN_BANK_EINTW(8, 0xc20, "gpx1", 0x04),
1133 EXYNOS_PIN_BANK_EINTW(8, 0xc40, "gpx2", 0x08),
1134 EXYNOS_PIN_BANK_EINTW(8, 0xc60, "gpx3", 0x0c),
1135};
1136
1137/* pin banks of exynos5260 pin-controller 1 */
1138static struct samsung_pin_bank exynos5260_pin_banks1[] = {
1139 EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpc0", 0x00),
1140 EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpc1", 0x04),
1141 EXYNOS_PIN_BANK_EINTG(7, 0x040, "gpc2", 0x08),
1142 EXYNOS_PIN_BANK_EINTG(4, 0x060, "gpc3", 0x0c),
1143 EXYNOS_PIN_BANK_EINTG(4, 0x080, "gpc4", 0x10),
1144};
1145
1146/* pin banks of exynos5260 pin-controller 2 */
1147static struct samsung_pin_bank exynos5260_pin_banks2[] = {
1148 EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz0", 0x00),
1149 EXYNOS_PIN_BANK_EINTG(4, 0x020, "gpz1", 0x04),
1150};
1151
1152/*
1153 * Samsung pinctrl driver data for Exynos5260 SoC. Exynos5260 SoC includes
1154 * three gpio/pin-mux/pinconfig controllers.
1155 */
1156struct samsung_pin_ctrl exynos5260_pin_ctrl[] = {
1157 {
1158 /* pin-controller instance 0 data */
1159 .pin_banks = exynos5260_pin_banks0,
1160 .nr_banks = ARRAY_SIZE(exynos5260_pin_banks0),
1161 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1162 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1163 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1164 .weint_con = EXYNOS_WKUP_ECON_OFFSET,
1165 .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
1166 .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
1167 .svc = EXYNOS_SVC_OFFSET,
1168 .eint_gpio_init = exynos_eint_gpio_init,
1169 .eint_wkup_init = exynos_eint_wkup_init,
1170 .label = "exynos5260-gpio-ctrl0",
1171 }, {
1172 /* pin-controller instance 1 data */
1173 .pin_banks = exynos5260_pin_banks1,
1174 .nr_banks = ARRAY_SIZE(exynos5260_pin_banks1),
1175 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1176 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1177 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1178 .svc = EXYNOS_SVC_OFFSET,
1179 .eint_gpio_init = exynos_eint_gpio_init,
1180 .label = "exynos5260-gpio-ctrl1",
1181 }, {
1182 /* pin-controller instance 2 data */
1183 .pin_banks = exynos5260_pin_banks2,
1184 .nr_banks = ARRAY_SIZE(exynos5260_pin_banks2),
1185 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1186 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1187 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1188 .svc = EXYNOS_SVC_OFFSET,
1189 .eint_gpio_init = exynos_eint_gpio_init,
1190 .label = "exynos5260-gpio-ctrl2",
1191 },
1192};
1193
Leela Krishna Amudala983dbeb2013-06-19 22:16:26 +09001194/* pin banks of exynos5420 pin-controller 0 */
1195static struct samsung_pin_bank exynos5420_pin_banks0[] = {
1196 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpy7", 0x00),
1197 EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00),
1198 EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04),
1199 EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08),
1200 EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c),
1201};
1202
1203/* pin banks of exynos5420 pin-controller 1 */
1204static struct samsung_pin_bank exynos5420_pin_banks1[] = {
1205 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpc0", 0x00),
1206 EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpc1", 0x04),
1207 EXYNOS_PIN_BANK_EINTG(7, 0x040, "gpc2", 0x08),
1208 EXYNOS_PIN_BANK_EINTG(4, 0x060, "gpc3", 0x0c),
1209 EXYNOS_PIN_BANK_EINTG(2, 0x080, "gpc4", 0x10),
1210 EXYNOS_PIN_BANK_EINTG(8, 0x0A0, "gpd1", 0x14),
1211 EXYNOS_PIN_BANK_EINTN(6, 0x0C0, "gpy0"),
1212 EXYNOS_PIN_BANK_EINTN(4, 0x0E0, "gpy1"),
1213 EXYNOS_PIN_BANK_EINTN(6, 0x100, "gpy2"),
1214 EXYNOS_PIN_BANK_EINTN(8, 0x120, "gpy3"),
1215 EXYNOS_PIN_BANK_EINTN(8, 0x140, "gpy4"),
1216 EXYNOS_PIN_BANK_EINTN(8, 0x160, "gpy5"),
1217 EXYNOS_PIN_BANK_EINTN(8, 0x180, "gpy6"),
1218};
1219
1220/* pin banks of exynos5420 pin-controller 2 */
1221static struct samsung_pin_bank exynos5420_pin_banks2[] = {
1222 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpe0", 0x00),
1223 EXYNOS_PIN_BANK_EINTG(2, 0x020, "gpe1", 0x04),
1224 EXYNOS_PIN_BANK_EINTG(6, 0x040, "gpf0", 0x08),
1225 EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpf1", 0x0c),
1226 EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpg0", 0x10),
1227 EXYNOS_PIN_BANK_EINTG(8, 0x0A0, "gpg1", 0x14),
1228 EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpg2", 0x18),
1229 EXYNOS_PIN_BANK_EINTG(4, 0x0E0, "gpj4", 0x1c),
1230};
1231
1232/* pin banks of exynos5420 pin-controller 3 */
1233static struct samsung_pin_bank exynos5420_pin_banks3[] = {
1234 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
1235 EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
1236 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpa2", 0x08),
1237 EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpb0", 0x0c),
1238 EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpb1", 0x10),
1239 EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpb2", 0x14),
1240 EXYNOS_PIN_BANK_EINTG(8, 0x0C0, "gpb3", 0x18),
1241 EXYNOS_PIN_BANK_EINTG(2, 0x0E0, "gpb4", 0x1c),
1242 EXYNOS_PIN_BANK_EINTG(8, 0x100, "gph0", 0x20),
1243};
1244
1245/* pin banks of exynos5420 pin-controller 4 */
1246static struct samsung_pin_bank exynos5420_pin_banks4[] = {
1247 EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz", 0x00),
1248};
1249
1250/*
1251 * Samsung pinctrl driver data for Exynos5420 SoC. Exynos5420 SoC includes
1252 * four gpio/pin-mux/pinconfig controllers.
1253 */
1254struct samsung_pin_ctrl exynos5420_pin_ctrl[] = {
1255 {
1256 /* pin-controller instance 0 data */
1257 .pin_banks = exynos5420_pin_banks0,
1258 .nr_banks = ARRAY_SIZE(exynos5420_pin_banks0),
1259 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1260 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1261 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1262 .weint_con = EXYNOS_WKUP_ECON_OFFSET,
1263 .weint_mask = EXYNOS_WKUP_EMASK_OFFSET,
1264 .weint_pend = EXYNOS_WKUP_EPEND_OFFSET,
1265 .svc = EXYNOS_SVC_OFFSET,
1266 .eint_gpio_init = exynos_eint_gpio_init,
1267 .eint_wkup_init = exynos_eint_wkup_init,
1268 .label = "exynos5420-gpio-ctrl0",
1269 }, {
1270 /* pin-controller instance 1 data */
1271 .pin_banks = exynos5420_pin_banks1,
1272 .nr_banks = ARRAY_SIZE(exynos5420_pin_banks1),
1273 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1274 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1275 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1276 .svc = EXYNOS_SVC_OFFSET,
1277 .eint_gpio_init = exynos_eint_gpio_init,
1278 .label = "exynos5420-gpio-ctrl1",
1279 }, {
1280 /* pin-controller instance 2 data */
1281 .pin_banks = exynos5420_pin_banks2,
1282 .nr_banks = ARRAY_SIZE(exynos5420_pin_banks2),
1283 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1284 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1285 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1286 .svc = EXYNOS_SVC_OFFSET,
1287 .eint_gpio_init = exynos_eint_gpio_init,
1288 .label = "exynos5420-gpio-ctrl2",
1289 }, {
1290 /* pin-controller instance 3 data */
1291 .pin_banks = exynos5420_pin_banks3,
1292 .nr_banks = ARRAY_SIZE(exynos5420_pin_banks3),
1293 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1294 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1295 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1296 .svc = EXYNOS_SVC_OFFSET,
1297 .eint_gpio_init = exynos_eint_gpio_init,
1298 .label = "exynos5420-gpio-ctrl3",
1299 }, {
1300 /* pin-controller instance 4 data */
1301 .pin_banks = exynos5420_pin_banks4,
1302 .nr_banks = ARRAY_SIZE(exynos5420_pin_banks4),
1303 .geint_con = EXYNOS_GPIO_ECON_OFFSET,
1304 .geint_mask = EXYNOS_GPIO_EMASK_OFFSET,
1305 .geint_pend = EXYNOS_GPIO_EPEND_OFFSET,
1306 .svc = EXYNOS_SVC_OFFSET,
1307 .eint_gpio_init = exynos_eint_gpio_init,
1308 .label = "exynos5420-gpio-ctrl4",
1309 },
1310};