]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/pinctrl/pinctrl-exynos.c
Merge tag 'md-3.10' of git://neil.brown.name/md
[karo-tx-linux.git] / drivers / pinctrl / pinctrl-exynos.c
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>
29 #include <linux/spinlock.h>
30 #include <linux/err.h>
31
32 #include <asm/mach/irq.h>
33
34 #include "pinctrl-samsung.h"
35 #include "pinctrl-exynos.h"
36
37
38 static struct samsung_pin_bank_type bank_type_off = {
39         .fld_width = { 4, 1, 2, 2, 2, 2, },
40         .reg_offset = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, },
41 };
42
43 static struct samsung_pin_bank_type bank_type_alive = {
44         .fld_width = { 4, 1, 2, 2, },
45         .reg_offset = { 0x00, 0x04, 0x08, 0x0c, },
46 };
47
48 /* list of external wakeup controllers supported */
49 static const struct of_device_id exynos_wkup_irq_ids[] = {
50         { .compatible = "samsung,exynos4210-wakeup-eint", },
51         { }
52 };
53
54 static void exynos_gpio_irq_unmask(struct irq_data *irqd)
55 {
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;
59         unsigned long mask;
60
61         mask = readl(d->virt_base + reg_mask);
62         mask &= ~(1 << irqd->hwirq);
63         writel(mask, d->virt_base + reg_mask);
64 }
65
66 static void exynos_gpio_irq_mask(struct irq_data *irqd)
67 {
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;
71         unsigned long mask;
72
73         mask = readl(d->virt_base + reg_mask);
74         mask |= 1 << irqd->hwirq;
75         writel(mask, d->virt_base + reg_mask);
76 }
77
78 static void exynos_gpio_irq_ack(struct irq_data *irqd)
79 {
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;
83
84         writel(1 << irqd->hwirq, d->virt_base + reg_pend);
85 }
86
87 static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
88 {
89         struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
90         struct samsung_pin_bank_type *bank_type = bank->type;
91         struct samsung_pinctrl_drv_data *d = bank->drvdata;
92         struct samsung_pin_ctrl *ctrl = d->ctrl;
93         unsigned int pin = irqd->hwirq;
94         unsigned int shift = EXYNOS_EINT_CON_LEN * pin;
95         unsigned int con, trig_type;
96         unsigned long reg_con = ctrl->geint_con + bank->eint_offset;
97         unsigned long flags;
98         unsigned int mask;
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);
130
131         reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC];
132         shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC];
133         mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1;
134
135         spin_lock_irqsave(&bank->slock, flags);
136
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
142         spin_unlock_irqrestore(&bank->slock, flags);
143
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
158 static int exynos_gpio_irq_map(struct irq_domain *h, unsigned int virq,
159                                         irq_hw_number_t hw)
160 {
161         struct samsung_pin_bank *b = h->host_data;
162
163         irq_set_chip_data(virq, b);
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
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,
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
193         virq = irq_linear_revmap(bank->irq_domain, pin);
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 {
206         struct samsung_pin_bank *bank;
207         struct device *dev = d->dev;
208         unsigned int ret;
209         unsigned int i;
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
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                 }
233         }
234
235         return 0;
236 }
237
238 static void exynos_wkup_irq_unmask(struct irq_data *irqd)
239 {
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;
243         unsigned long mask;
244
245         mask = readl(d->virt_base + reg_mask);
246         mask &= ~(1 << irqd->hwirq);
247         writel(mask, d->virt_base + reg_mask);
248 }
249
250 static void exynos_wkup_irq_mask(struct irq_data *irqd)
251 {
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;
255         unsigned long mask;
256
257         mask = readl(d->virt_base + reg_mask);
258         mask |= 1 << irqd->hwirq;
259         writel(mask, d->virt_base + reg_mask);
260 }
261
262 static void exynos_wkup_irq_ack(struct irq_data *irqd)
263 {
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;
267
268         writel(1 << irqd->hwirq, d->virt_base + pend);
269 }
270
271 static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type)
272 {
273         struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
274         struct samsung_pin_bank_type *bank_type = bank->type;
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;
278         unsigned long shift = EXYNOS_EINT_CON_LEN * pin;
279         unsigned long con, trig_type;
280         unsigned long flags;
281         unsigned int mask;
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);
313
314         reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC];
315         shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC];
316         mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1;
317
318         spin_lock_irqsave(&bank->slock, flags);
319
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
325         spin_unlock_irqrestore(&bank->slock, flags);
326
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);
345         struct samsung_pin_bank *bank = eintd->bank;
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
355         eint_irq = irq_linear_revmap(bank->irq_domain, eintd->irq);
356         generic_handle_irq(eint_irq);
357         chip->irq_unmask(&desc->irq_data);
358         chained_irq_exit(chip, desc);
359 }
360
361 static inline void exynos_irq_demux_eint(unsigned long pend,
362                                                 struct irq_domain *domain)
363 {
364         unsigned int irq;
365
366         while (pend) {
367                 irq = fls(pend) - 1;
368                 generic_handle_irq(irq_find_mapping(domain, irq));
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);
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;
380         unsigned long pend;
381         unsigned long mask;
382         int i;
383
384         chained_irq_enter(chip, desc);
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
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;
420         struct device_node *wkup_np = NULL;
421         struct device_node *np;
422         struct samsung_pin_bank *bank;
423         struct exynos_weint_data *weint_data;
424         struct exynos_muxed_weint_data *muxed_data;
425         unsigned int muxed_banks = 0;
426         unsigned int i;
427         int idx, irq;
428
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                 }
434         }
435         if (!wkup_np)
436                 return -ENODEV;
437
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                 }
475         }
476
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");
490                 return -ENOMEM;
491         }
492
493         irq_set_chained_handler(irq, exynos_irq_demux_eint16_31);
494         irq_set_handler_data(irq, muxed_data);
495
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;
501
502                 muxed_data->banks[idx++] = bank;
503         }
504         muxed_data->nr_banks = muxed_banks;
505
506         return 0;
507 }
508
509 /* pin banks of exynos4210 pin-controller 0 */
510 static struct samsung_pin_bank exynos4210_pin_banks0[] = {
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),
527 };
528
529 /* pin banks of exynos4210 pin-controller 1 */
530 static struct samsung_pin_bank exynos4210_pin_banks1[] = {
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),
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"),
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),
551 };
552
553 /* pin banks of exynos4210 pin-controller 2 */
554 static struct samsung_pin_bank exynos4210_pin_banks2[] = {
555         EXYNOS_PIN_BANK_EINTN(7, 0x000, "gpz"),
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),
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),
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),
591                 .label          = "exynos4210-gpio-ctrl2",
592         },
593 };
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 };