2 * at91 pinctrl driver based on at91 pinmux core
4 * Copyright (C) 2011-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
10 #include <linux/err.h>
11 #include <linux/init.h>
12 #include <linux/module.h>
14 #include <linux/of_device.h>
15 #include <linux/of_address.h>
16 #include <linux/of_irq.h>
17 #include <linux/slab.h>
18 #include <linux/interrupt.h>
19 #include <linux/irq.h>
20 #include <linux/irqdomain.h>
22 #include <linux/gpio.h>
23 #include <linux/irqdomain.h>
24 #include <linux/pinctrl/machine.h>
25 #include <linux/pinctrl/pinconf.h>
26 #include <linux/pinctrl/pinctrl.h>
27 #include <linux/pinctrl/pinmux.h>
28 /* Since we request GPIOs from ourself */
29 #include <linux/pinctrl/consumer.h>
31 #include <asm/mach/irq.h>
33 #include <mach/hardware.h>
34 #include <mach/at91_pio.h>
38 #define MAX_NB_GPIO_PER_BANK 32
40 struct at91_pinctrl_mux_ops
;
42 struct at91_gpio_chip
{
43 struct gpio_chip chip
;
44 struct pinctrl_gpio_range range
;
45 struct at91_gpio_chip
*next
; /* Bank sharing same clock */
46 int pioc_hwirq
; /* PIO bank interrupt identifier on AIC */
47 int pioc_virq
; /* PIO bank Linux virtual interrupt */
48 int pioc_idx
; /* PIO bank index */
49 void __iomem
*regbase
; /* PIO bank virtual address */
50 struct clk
*clock
; /* associated clock */
51 struct irq_domain
*domain
; /* associated irq domain */
52 struct at91_pinctrl_mux_ops
*ops
; /* ops */
55 #define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip)
57 static struct at91_gpio_chip
*gpio_chips
[MAX_GPIO_BANKS
];
59 static int gpio_banks
;
61 #define PULL_UP (0 << 1)
62 #define MULTI_DRIVE (1 << 1)
65 * struct at91_pmx_func - describes AT91 pinmux functions
66 * @name: the name of this specific function
67 * @groups: corresponding pin groups
68 * @ngroups: the number of groups
70 struct at91_pmx_func
{
78 AT91_MUX_PERIPH_A
= 1,
79 AT91_MUX_PERIPH_B
= 2,
80 AT91_MUX_PERIPH_C
= 3,
81 AT91_MUX_PERIPH_D
= 4,
85 * struct at91_pmx_pin - describes an At91 pin mux
86 * @bank: the bank of the pin
87 * @pin: the pin number in the @bank
88 * @mux: the mux mode : gpio or periph_x of the pin i.e. alternate function.
89 * @conf: the configuration of the pin: PULL_UP, MULTIDRIVE etc...
99 * struct at91_pin_group - describes an At91 pin group
100 * @name: the name of this specific pin group
101 * @pins_conf: the mux mode for each pin in this group. The size of this
102 * array is the same as pins.
103 * @pins: an array of discrete physical pins used in this group, taken
104 * from the driver-local pin enumeration space
105 * @npins: the number of pins in this group array, i.e. the number of
106 * elements in .pins so we can iterate over that array
108 struct at91_pin_group
{
110 struct at91_pmx_pin
*pins_conf
;
116 * struct at91_pinctrl_mux_ops - describes an At91 mux ops group
117 * on new IP with support for periph C and D the way to mux in
118 * periph A and B has changed
119 * So provide the right call back
120 * if not present means the IP does not support it
121 * @get_periph: return the periph mode configured
122 * @mux_A_periph: mux as periph A
123 * @mux_B_periph: mux as periph B
124 * @mux_C_periph: mux as periph C
125 * @mux_D_periph: mux as periph D
126 * @irq_type: return irq type
128 struct at91_pinctrl_mux_ops
{
129 enum at91_mux (*get_periph
)(void __iomem
*pio
, unsigned mask
);
130 void (*mux_A_periph
)(void __iomem
*pio
, unsigned mask
);
131 void (*mux_B_periph
)(void __iomem
*pio
, unsigned mask
);
132 void (*mux_C_periph
)(void __iomem
*pio
, unsigned mask
);
133 void (*mux_D_periph
)(void __iomem
*pio
, unsigned mask
);
135 int (*irq_type
)(struct irq_data
*d
, unsigned type
);
138 static int gpio_irq_type(struct irq_data
*d
, unsigned type
);
139 static int alt_gpio_irq_type(struct irq_data
*d
, unsigned type
);
141 struct at91_pinctrl
{
143 struct pinctrl_dev
*pctl
;
150 struct at91_pmx_func
*functions
;
153 struct at91_pin_group
*groups
;
156 struct at91_pinctrl_mux_ops
*ops
;
159 static const inline struct at91_pin_group
*at91_pinctrl_find_group_by_name(
160 const struct at91_pinctrl
*info
,
163 const struct at91_pin_group
*grp
= NULL
;
166 for (i
= 0; i
< info
->ngroups
; i
++) {
167 if (strcmp(info
->groups
[i
].name
, name
))
170 grp
= &info
->groups
[i
];
171 dev_dbg(info
->dev
, "%s: %d 0:%d\n", name
, grp
->npins
, grp
->pins
[0]);
178 static int at91_get_groups_count(struct pinctrl_dev
*pctldev
)
180 struct at91_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
182 return info
->ngroups
;
185 static const char *at91_get_group_name(struct pinctrl_dev
*pctldev
,
188 struct at91_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
190 return info
->groups
[selector
].name
;
193 static int at91_get_group_pins(struct pinctrl_dev
*pctldev
, unsigned selector
,
194 const unsigned **pins
,
197 struct at91_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
199 if (selector
>= info
->ngroups
)
202 *pins
= info
->groups
[selector
].pins
;
203 *npins
= info
->groups
[selector
].npins
;
208 static void at91_pin_dbg_show(struct pinctrl_dev
*pctldev
, struct seq_file
*s
,
211 seq_printf(s
, "%s", dev_name(pctldev
->dev
));
214 static int at91_dt_node_to_map(struct pinctrl_dev
*pctldev
,
215 struct device_node
*np
,
216 struct pinctrl_map
**map
, unsigned *num_maps
)
218 struct at91_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
219 const struct at91_pin_group
*grp
;
220 struct pinctrl_map
*new_map
;
221 struct device_node
*parent
;
224 struct at91_pmx_pin
*pin
;
227 * first find the group of this node and check if we need create
228 * config maps for pins
230 grp
= at91_pinctrl_find_group_by_name(info
, np
->name
);
232 dev_err(info
->dev
, "unable to find group for node %s\n",
237 map_num
+= grp
->npins
;
238 new_map
= devm_kzalloc(pctldev
->dev
, sizeof(*new_map
) * map_num
, GFP_KERNEL
);
246 parent
= of_get_parent(np
);
251 new_map
[0].type
= PIN_MAP_TYPE_MUX_GROUP
;
252 new_map
[0].data
.mux
.function
= parent
->name
;
253 new_map
[0].data
.mux
.group
= np
->name
;
256 /* create config map */
258 for (i
= 0; i
< grp
->npins
; i
++) {
259 pin
= &grp
->pins_conf
[i
];
261 new_map
[i
].type
= PIN_MAP_TYPE_CONFIGS_PIN
;
262 new_map
[i
].data
.configs
.group_or_pin
=
263 pin_get_name(pctldev
, grp
->pins
[i
]);
264 new_map
[i
].data
.configs
.configs
= &grp
->pins_conf
[i
].conf
;
265 new_map
[i
].data
.configs
.num_configs
= 1;
268 dev_dbg(pctldev
->dev
, "maps: function %s group %s num %d\n",
269 (*map
)->data
.mux
.function
, (*map
)->data
.mux
.group
, map_num
);
274 static void at91_dt_free_map(struct pinctrl_dev
*pctldev
,
275 struct pinctrl_map
*map
, unsigned num_maps
)
279 static struct pinctrl_ops at91_pctrl_ops
= {
280 .get_groups_count
= at91_get_groups_count
,
281 .get_group_name
= at91_get_group_name
,
282 .get_group_pins
= at91_get_group_pins
,
283 .pin_dbg_show
= at91_pin_dbg_show
,
284 .dt_node_to_map
= at91_dt_node_to_map
,
285 .dt_free_map
= at91_dt_free_map
,
288 static void __iomem
* pin_to_controller(struct at91_pinctrl
*info
,
291 return gpio_chips
[bank
]->regbase
;
294 static inline int pin_to_bank(unsigned pin
)
296 return pin
/= MAX_NB_GPIO_PER_BANK
;
299 static unsigned pin_to_mask(unsigned int pin
)
304 static void at91_mux_disable_interrupt(void __iomem
*pio
, unsigned mask
)
306 writel_relaxed(mask
, pio
+ PIO_IDR
);
309 static unsigned at91_mux_get_pullup(void __iomem
*pio
, unsigned pin
)
311 return (readl_relaxed(pio
+ PIO_PUSR
) >> pin
) & 0x1;
314 static void at91_mux_set_pullup(void __iomem
*pio
, unsigned mask
, bool on
)
316 writel_relaxed(mask
, pio
+ (on
? PIO_PUER
: PIO_PUDR
));
319 static unsigned at91_mux_get_multidrive(void __iomem
*pio
, unsigned pin
)
321 return (readl_relaxed(pio
+ PIO_MDSR
) >> pin
) & 0x1;
324 static void at91_mux_set_multidrive(void __iomem
*pio
, unsigned mask
, bool on
)
326 writel_relaxed(mask
, pio
+ (on
? PIO_MDER
: PIO_MDDR
));
329 static void at91_mux_set_A_periph(void __iomem
*pio
, unsigned mask
)
331 writel_relaxed(mask
, pio
+ PIO_ASR
);
334 static void at91_mux_set_B_periph(void __iomem
*pio
, unsigned mask
)
336 writel_relaxed(mask
, pio
+ PIO_BSR
);
339 static void at91_mux_pio3_set_A_periph(void __iomem
*pio
, unsigned mask
)
342 writel_relaxed(readl_relaxed(pio
+ PIO_ABCDSR1
) & ~mask
,
344 writel_relaxed(readl_relaxed(pio
+ PIO_ABCDSR2
) & ~mask
,
348 static void at91_mux_pio3_set_B_periph(void __iomem
*pio
, unsigned mask
)
350 writel_relaxed(readl_relaxed(pio
+ PIO_ABCDSR1
) | mask
,
352 writel_relaxed(readl_relaxed(pio
+ PIO_ABCDSR2
) & ~mask
,
356 static void at91_mux_pio3_set_C_periph(void __iomem
*pio
, unsigned mask
)
358 writel_relaxed(readl_relaxed(pio
+ PIO_ABCDSR1
) & ~mask
, pio
+ PIO_ABCDSR1
);
359 writel_relaxed(readl_relaxed(pio
+ PIO_ABCDSR2
) | mask
, pio
+ PIO_ABCDSR2
);
362 static void at91_mux_pio3_set_D_periph(void __iomem
*pio
, unsigned mask
)
364 writel_relaxed(readl_relaxed(pio
+ PIO_ABCDSR1
) | mask
, pio
+ PIO_ABCDSR1
);
365 writel_relaxed(readl_relaxed(pio
+ PIO_ABCDSR2
) | mask
, pio
+ PIO_ABCDSR2
);
368 static enum at91_mux
at91_mux_pio3_get_periph(void __iomem
*pio
, unsigned mask
)
372 if (readl_relaxed(pio
+ PIO_PSR
) & mask
)
373 return AT91_MUX_GPIO
;
375 select
= !!(readl_relaxed(pio
+ PIO_ABCDSR1
) & mask
);
376 select
|= (!!(readl_relaxed(pio
+ PIO_ABCDSR2
) & mask
) << 1);
381 static enum at91_mux
at91_mux_get_periph(void __iomem
*pio
, unsigned mask
)
385 if (readl_relaxed(pio
+ PIO_PSR
) & mask
)
386 return AT91_MUX_GPIO
;
388 select
= readl_relaxed(pio
+ PIO_ABSR
) & mask
;
393 static struct at91_pinctrl_mux_ops at91rm9200_ops
= {
394 .get_periph
= at91_mux_get_periph
,
395 .mux_A_periph
= at91_mux_set_A_periph
,
396 .mux_B_periph
= at91_mux_set_B_periph
,
397 .irq_type
= gpio_irq_type
,
400 static struct at91_pinctrl_mux_ops at91sam9x5_ops
= {
401 .get_periph
= at91_mux_pio3_get_periph
,
402 .mux_A_periph
= at91_mux_pio3_set_A_periph
,
403 .mux_B_periph
= at91_mux_pio3_set_B_periph
,
404 .mux_C_periph
= at91_mux_pio3_set_C_periph
,
405 .mux_D_periph
= at91_mux_pio3_set_D_periph
,
406 .irq_type
= alt_gpio_irq_type
,
409 static void at91_pin_dbg(const struct device
*dev
, const struct at91_pmx_pin
*pin
)
412 dev_dbg(dev
, "pio%c%d configured as periph%c with conf = 0x%lu\n",
413 pin
->bank
+ 'A', pin
->pin
, pin
->mux
- 1 + 'A', pin
->conf
);
415 dev_dbg(dev
, "pio%c%d configured as gpio with conf = 0x%lu\n",
416 pin
->bank
+ 'A', pin
->pin
, pin
->conf
);
420 static int pin_check_config(struct at91_pinctrl
*info
, const char* name
,
421 int index
, const struct at91_pmx_pin
*pin
)
425 /* check if it's a valid config */
426 if (pin
->bank
>= info
->nbanks
) {
427 dev_err(info
->dev
, "%s: pin conf %d bank_id %d >= nbanks %d\n",
428 name
, index
, pin
->bank
, info
->nbanks
);
432 if (pin
->pin
>= MAX_NB_GPIO_PER_BANK
) {
433 dev_err(info
->dev
, "%s: pin conf %d pin_bank_id %d >= %d\n",
434 name
, index
, pin
->pin
, MAX_NB_GPIO_PER_BANK
);
443 if (mux
>= info
->nmux
) {
444 dev_err(info
->dev
, "%s: pin conf %d mux_id %d >= nmux %d\n",
445 name
, index
, mux
, info
->nmux
);
449 if (!(info
->mux_mask
[pin
->bank
* info
->nmux
+ mux
] & 1 << pin
->pin
)) {
450 dev_err(info
->dev
, "%s: pin conf %d mux_id %d not supported for pio%c%d\n",
451 name
, index
, mux
, pin
->bank
+ 'A', pin
->pin
);
458 static void at91_mux_gpio_disable(void __iomem
*pio
, unsigned mask
)
460 writel_relaxed(mask
, pio
+ PIO_PDR
);
463 static void at91_mux_gpio_enable(void __iomem
*pio
, unsigned mask
, bool input
)
465 writel_relaxed(mask
, pio
+ PIO_PER
);
466 writel_relaxed(mask
, pio
+ (input
? PIO_ODR
: PIO_OER
));
469 static int at91_pmx_enable(struct pinctrl_dev
*pctldev
, unsigned selector
,
472 struct at91_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
473 const struct at91_pmx_pin
*pins_conf
= info
->groups
[group
].pins_conf
;
474 const struct at91_pmx_pin
*pin
;
475 uint32_t npins
= info
->groups
[group
].npins
;
480 dev_dbg(info
->dev
, "enable function %s group %s\n",
481 info
->functions
[selector
].name
, info
->groups
[group
].name
);
483 /* first check that all the pins of the group are valid with a valid
485 for (i
= 0; i
< npins
; i
++) {
487 ret
= pin_check_config(info
, info
->groups
[group
].name
, i
, pin
);
492 for (i
= 0; i
< npins
; i
++) {
494 at91_pin_dbg(info
->dev
, pin
);
495 pio
= pin_to_controller(info
, pin
->bank
);
496 mask
= pin_to_mask(pin
->pin
);
497 at91_mux_disable_interrupt(pio
, mask
);
500 at91_mux_gpio_enable(pio
, mask
, 1);
502 case AT91_MUX_PERIPH_A
:
503 info
->ops
->mux_A_periph(pio
, mask
);
505 case AT91_MUX_PERIPH_B
:
506 info
->ops
->mux_B_periph(pio
, mask
);
508 case AT91_MUX_PERIPH_C
:
509 if (!info
->ops
->mux_C_periph
)
511 info
->ops
->mux_C_periph(pio
, mask
);
513 case AT91_MUX_PERIPH_D
:
514 if (!info
->ops
->mux_D_periph
)
516 info
->ops
->mux_D_periph(pio
, mask
);
520 at91_mux_gpio_disable(pio
, mask
);
526 static void at91_pmx_disable(struct pinctrl_dev
*pctldev
, unsigned selector
,
529 struct at91_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
530 const struct at91_pmx_pin
*pins_conf
= info
->groups
[group
].pins_conf
;
531 const struct at91_pmx_pin
*pin
;
532 uint32_t npins
= info
->groups
[group
].npins
;
537 for (i
= 0; i
< npins
; i
++) {
539 at91_pin_dbg(info
->dev
, pin
);
540 pio
= pin_to_controller(info
, pin
->bank
);
541 mask
= pin_to_mask(pin
->pin
);
542 at91_mux_gpio_enable(pio
, mask
, 1);
546 static int at91_pmx_get_funcs_count(struct pinctrl_dev
*pctldev
)
548 struct at91_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
550 return info
->nfunctions
;
553 static const char *at91_pmx_get_func_name(struct pinctrl_dev
*pctldev
,
556 struct at91_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
558 return info
->functions
[selector
].name
;
561 static int at91_pmx_get_groups(struct pinctrl_dev
*pctldev
, unsigned selector
,
562 const char * const **groups
,
563 unsigned * const num_groups
)
565 struct at91_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
567 *groups
= info
->functions
[selector
].groups
;
568 *num_groups
= info
->functions
[selector
].ngroups
;
573 int at91_gpio_request_enable(struct pinctrl_dev
*pctldev
,
574 struct pinctrl_gpio_range
*range
,
577 struct at91_pinctrl
*npct
= pinctrl_dev_get_drvdata(pctldev
);
578 struct at91_gpio_chip
*at91_chip
;
579 struct gpio_chip
*chip
;
583 dev_err(npct
->dev
, "invalid range\n");
587 dev_err(npct
->dev
, "missing GPIO chip in range\n");
591 at91_chip
= container_of(chip
, struct at91_gpio_chip
, chip
);
593 dev_dbg(npct
->dev
, "enable pin %u as GPIO\n", offset
);
595 mask
= 1 << (offset
- chip
->base
);
597 dev_dbg(npct
->dev
, "enable pin %u as PIO%c%d 0x%x\n",
598 offset
, 'A' + range
->id
, offset
- chip
->base
, mask
);
600 writel_relaxed(mask
, at91_chip
->regbase
+ PIO_PER
);
605 void at91_gpio_disable_free(struct pinctrl_dev
*pctldev
,
606 struct pinctrl_gpio_range
*range
,
609 struct at91_pinctrl
*npct
= pinctrl_dev_get_drvdata(pctldev
);
611 dev_dbg(npct
->dev
, "disable pin %u as GPIO\n", offset
);
612 /* Set the pin to some default state, GPIO is usually default */
615 static struct pinmux_ops at91_pmx_ops
= {
616 .get_functions_count
= at91_pmx_get_funcs_count
,
617 .get_function_name
= at91_pmx_get_func_name
,
618 .get_function_groups
= at91_pmx_get_groups
,
619 .enable
= at91_pmx_enable
,
620 .disable
= at91_pmx_disable
,
621 .gpio_request_enable
= at91_gpio_request_enable
,
622 .gpio_disable_free
= at91_gpio_disable_free
,
625 static int at91_pinconf_get(struct pinctrl_dev
*pctldev
,
626 unsigned pin_id
, unsigned long *config
)
628 struct at91_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
632 dev_dbg(info
->dev
, "%s:%d, pin_id=%d, config=0x%lx", __func__
, __LINE__
, pin_id
, *config
);
633 pio
= pin_to_controller(info
, pin_to_bank(pin_id
));
634 pin
= pin_id
% MAX_NB_GPIO_PER_BANK
;
636 if (at91_mux_get_multidrive(pio
, pin
))
637 *config
|= MULTI_DRIVE
;
639 if (at91_mux_get_pullup(pio
, pin
))
645 static int at91_pinconf_set(struct pinctrl_dev
*pctldev
,
646 unsigned pin_id
, unsigned long config
)
648 struct at91_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
652 dev_dbg(info
->dev
, "%s:%d, pin_id=%d, config=0x%lx", __func__
, __LINE__
, pin_id
, config
);
653 pio
= pin_to_controller(info
, pin_to_bank(pin_id
));
654 mask
= pin_to_mask(pin_id
% MAX_NB_GPIO_PER_BANK
);
656 at91_mux_set_pullup(pio
, mask
, config
& PULL_UP
);
657 at91_mux_set_multidrive(pio
, mask
, config
& MULTI_DRIVE
);
661 static void at91_pinconf_dbg_show(struct pinctrl_dev
*pctldev
,
662 struct seq_file
*s
, unsigned pin_id
)
667 static void at91_pinconf_group_dbg_show(struct pinctrl_dev
*pctldev
,
668 struct seq_file
*s
, unsigned group
)
672 struct pinconf_ops at91_pinconf_ops
= {
673 .pin_config_get
= at91_pinconf_get
,
674 .pin_config_set
= at91_pinconf_set
,
675 .pin_config_dbg_show
= at91_pinconf_dbg_show
,
676 .pin_config_group_dbg_show
= at91_pinconf_group_dbg_show
,
679 static struct pinctrl_desc at91_pinctrl_desc
= {
680 .pctlops
= &at91_pctrl_ops
,
681 .pmxops
= &at91_pmx_ops
,
682 .confops
= &at91_pinconf_ops
,
683 .owner
= THIS_MODULE
,
686 static const char *gpio_compat
= "atmel,at91rm9200-gpio";
688 static void __devinit
at91_pinctrl_child_count(struct at91_pinctrl
*info
,
689 struct device_node
*np
)
691 struct device_node
*child
;
693 for_each_child_of_node(np
, child
) {
694 if (of_device_is_compatible(child
, gpio_compat
)) {
698 info
->ngroups
+= of_get_child_count(child
);
703 static int __devinit
at91_pinctrl_mux_mask(struct at91_pinctrl
*info
,
704 struct device_node
*np
)
708 const const __be32
*list
;
710 list
= of_get_property(np
, "atmel,mux-mask", &size
);
712 dev_err(info
->dev
, "can not read the mux-mask of %d\n", size
);
716 size
/= sizeof(*list
);
717 if (!size
|| size
% info
->nbanks
) {
718 dev_err(info
->dev
, "wrong mux mask array should be by %d\n", info
->nbanks
);
721 info
->nmux
= size
/ info
->nbanks
;
723 info
->mux_mask
= devm_kzalloc(info
->dev
, sizeof(u32
) * size
, GFP_KERNEL
);
724 if (!info
->mux_mask
) {
725 dev_err(info
->dev
, "could not alloc mux_mask\n");
729 ret
= of_property_read_u32_array(np
, "atmel,mux-mask",
730 info
->mux_mask
, size
);
732 dev_err(info
->dev
, "can not read the mux-mask of %d\n", size
);
736 static int __devinit
at91_pinctrl_parse_groups(struct device_node
*np
,
737 struct at91_pin_group
*grp
,
738 struct at91_pinctrl
*info
,
741 struct at91_pmx_pin
*pin
;
743 const const __be32
*list
;
746 dev_dbg(info
->dev
, "group(%d): %s\n", index
, np
->name
);
748 /* Initialise group */
749 grp
->name
= np
->name
;
752 * the binding format is atmel,pins = <bank pin mux CONFIG ...>,
753 * do sanity check and calculate pins number
755 list
= of_get_property(np
, "atmel,pins", &size
);
756 /* we do not check return since it's safe node passed down */
757 size
/= sizeof(*list
);
758 if (!size
|| size
% 4) {
759 dev_err(info
->dev
, "wrong pins number or pins and configs should be by 4\n");
763 grp
->npins
= size
/ 4;
764 pin
= grp
->pins_conf
= devm_kzalloc(info
->dev
, grp
->npins
* sizeof(struct at91_pmx_pin
),
766 grp
->pins
= devm_kzalloc(info
->dev
, grp
->npins
* sizeof(unsigned int),
768 if (!grp
->pins_conf
|| !grp
->pins
)
771 for (i
= 0, j
= 0; i
< size
; i
+= 4, j
++) {
772 pin
->bank
= be32_to_cpu(*list
++);
773 pin
->pin
= be32_to_cpu(*list
++);
774 grp
->pins
[j
] = pin
->bank
* MAX_NB_GPIO_PER_BANK
+ pin
->pin
;
775 pin
->mux
= be32_to_cpu(*list
++);
776 pin
->conf
= be32_to_cpu(*list
++);
778 at91_pin_dbg(info
->dev
, pin
);
785 static int __devinit
at91_pinctrl_parse_functions(struct device_node
*np
,
786 struct at91_pinctrl
*info
, u32 index
)
788 struct device_node
*child
;
789 struct at91_pmx_func
*func
;
790 struct at91_pin_group
*grp
;
792 static u32 grp_index
;
795 dev_dbg(info
->dev
, "parse function(%d): %s\n", index
, np
->name
);
797 func
= &info
->functions
[index
];
799 /* Initialise function */
800 func
->name
= np
->name
;
801 func
->ngroups
= of_get_child_count(np
);
802 if (func
->ngroups
<= 0) {
803 dev_err(info
->dev
, "no groups defined\n");
806 func
->groups
= devm_kzalloc(info
->dev
,
807 func
->ngroups
* sizeof(char *), GFP_KERNEL
);
811 for_each_child_of_node(np
, child
) {
812 func
->groups
[i
] = child
->name
;
813 grp
= &info
->groups
[grp_index
++];
814 ret
= at91_pinctrl_parse_groups(child
, grp
, info
, i
++);
822 static struct of_device_id at91_pinctrl_of_match
[] __devinitdata
= {
823 { .compatible
= "atmel,at91sam9x5-pinctrl", .data
= &at91sam9x5_ops
},
824 { .compatible
= "atmel,at91rm9200-pinctrl", .data
= &at91rm9200_ops
},
828 static int __devinit
at91_pinctrl_probe_dt(struct platform_device
*pdev
,
829 struct at91_pinctrl
*info
)
834 struct device_node
*np
= pdev
->dev
.of_node
;
835 struct device_node
*child
;
840 info
->dev
= &pdev
->dev
;
842 of_match_device(at91_pinctrl_of_match
, &pdev
->dev
)->data
;
843 at91_pinctrl_child_count(info
, np
);
845 if (info
->nbanks
< 1) {
846 dev_err(&pdev
->dev
, "you need to specify atleast one gpio-controller\n");
850 ret
= at91_pinctrl_mux_mask(info
, np
);
854 dev_dbg(&pdev
->dev
, "nmux = %d\n", info
->nmux
);
856 dev_dbg(&pdev
->dev
, "mux-mask\n");
857 tmp
= info
->mux_mask
;
858 for (i
= 0; i
< info
->nbanks
; i
++) {
859 for (j
= 0; j
< info
->nmux
; j
++, tmp
++) {
860 dev_dbg(&pdev
->dev
, "%d:%d\t0x%x\n", i
, j
, tmp
[0]);
864 dev_dbg(&pdev
->dev
, "nfunctions = %d\n", info
->nfunctions
);
865 dev_dbg(&pdev
->dev
, "ngroups = %d\n", info
->ngroups
);
866 info
->functions
= devm_kzalloc(&pdev
->dev
, info
->nfunctions
* sizeof(struct at91_pmx_func
),
868 if (!info
->functions
)
871 info
->groups
= devm_kzalloc(&pdev
->dev
, info
->ngroups
* sizeof(struct at91_pin_group
),
876 dev_dbg(&pdev
->dev
, "nbanks = %d\n", info
->nbanks
);
877 dev_dbg(&pdev
->dev
, "nfunctions = %d\n", info
->nfunctions
);
878 dev_dbg(&pdev
->dev
, "ngroups = %d\n", info
->ngroups
);
882 for_each_child_of_node(np
, child
) {
883 if (of_device_is_compatible(child
, gpio_compat
))
885 ret
= at91_pinctrl_parse_functions(child
, info
, i
++);
887 dev_err(&pdev
->dev
, "failed to parse function\n");
895 static int __devinit
at91_pinctrl_probe(struct platform_device
*pdev
)
897 struct at91_pinctrl
*info
;
898 struct pinctrl_pin_desc
*pdesc
;
901 info
= devm_kzalloc(&pdev
->dev
, sizeof(*info
), GFP_KERNEL
);
905 ret
= at91_pinctrl_probe_dt(pdev
, info
);
910 * We need all the GPIO drivers to probe FIRST, or we will not be able
911 * to obtain references to the struct gpio_chip * for them, and we
912 * need this to proceed.
914 for (i
= 0; i
< info
->nbanks
; i
++) {
915 if (!gpio_chips
[i
]) {
916 dev_warn(&pdev
->dev
, "GPIO chip %d not registered yet\n", i
);
917 devm_kfree(&pdev
->dev
, info
);
918 return -EPROBE_DEFER
;
922 at91_pinctrl_desc
.name
= dev_name(&pdev
->dev
);
923 at91_pinctrl_desc
.npins
= info
->nbanks
* MAX_NB_GPIO_PER_BANK
;
924 at91_pinctrl_desc
.pins
= pdesc
=
925 devm_kzalloc(&pdev
->dev
, sizeof(*pdesc
) * at91_pinctrl_desc
.npins
, GFP_KERNEL
);
927 if (!at91_pinctrl_desc
.pins
)
930 for (i
= 0 , k
= 0; i
< info
->nbanks
; i
++) {
931 for (j
= 0; j
< MAX_NB_GPIO_PER_BANK
; j
++, k
++) {
933 pdesc
->name
= kasprintf(GFP_KERNEL
, "pio%c%d", i
+ 'A', j
);
938 platform_set_drvdata(pdev
, info
);
939 info
->pctl
= pinctrl_register(&at91_pinctrl_desc
, &pdev
->dev
, info
);
942 dev_err(&pdev
->dev
, "could not register AT91 pinctrl driver\n");
947 /* We will handle a range of GPIO pins */
948 for (i
= 0; i
< info
->nbanks
; i
++)
949 pinctrl_add_gpio_range(info
->pctl
, &gpio_chips
[i
]->range
);
951 dev_info(&pdev
->dev
, "initialized AT91 pinctrl driver\n");
959 int __devexit
at91_pinctrl_remove(struct platform_device
*pdev
)
961 struct at91_pinctrl
*info
= platform_get_drvdata(pdev
);
963 pinctrl_unregister(info
->pctl
);
968 static int at91_gpio_request(struct gpio_chip
*chip
, unsigned offset
)
971 * Map back to global GPIO space and request muxing, the direction
972 * parameter does not matter for this controller.
974 int gpio
= chip
->base
+ offset
;
975 int bank
= chip
->base
/ chip
->ngpio
;
977 dev_dbg(chip
->dev
, "%s:%d pio%c%d(%d)\n", __func__
, __LINE__
,
978 'A' + bank
, offset
, gpio
);
980 return pinctrl_request_gpio(gpio
);
983 static void at91_gpio_free(struct gpio_chip
*chip
, unsigned offset
)
985 int gpio
= chip
->base
+ offset
;
987 pinctrl_free_gpio(gpio
);
990 static int at91_gpio_direction_input(struct gpio_chip
*chip
, unsigned offset
)
992 struct at91_gpio_chip
*at91_gpio
= to_at91_gpio_chip(chip
);
993 void __iomem
*pio
= at91_gpio
->regbase
;
994 unsigned mask
= 1 << offset
;
996 writel_relaxed(mask
, pio
+ PIO_ODR
);
1000 static int at91_gpio_get(struct gpio_chip
*chip
, unsigned offset
)
1002 struct at91_gpio_chip
*at91_gpio
= to_at91_gpio_chip(chip
);
1003 void __iomem
*pio
= at91_gpio
->regbase
;
1004 unsigned mask
= 1 << offset
;
1007 pdsr
= readl_relaxed(pio
+ PIO_PDSR
);
1008 return (pdsr
& mask
) != 0;
1011 static void at91_gpio_set(struct gpio_chip
*chip
, unsigned offset
,
1014 struct at91_gpio_chip
*at91_gpio
= to_at91_gpio_chip(chip
);
1015 void __iomem
*pio
= at91_gpio
->regbase
;
1016 unsigned mask
= 1 << offset
;
1018 writel_relaxed(mask
, pio
+ (val
? PIO_SODR
: PIO_CODR
));
1021 static int at91_gpio_direction_output(struct gpio_chip
*chip
, unsigned offset
,
1024 struct at91_gpio_chip
*at91_gpio
= to_at91_gpio_chip(chip
);
1025 void __iomem
*pio
= at91_gpio
->regbase
;
1026 unsigned mask
= 1 << offset
;
1028 writel_relaxed(mask
, pio
+ (val
? PIO_SODR
: PIO_CODR
));
1029 writel_relaxed(mask
, pio
+ PIO_OER
);
1034 static int at91_gpio_to_irq(struct gpio_chip
*chip
, unsigned offset
)
1036 struct at91_gpio_chip
*at91_gpio
= to_at91_gpio_chip(chip
);
1039 if (offset
< chip
->ngpio
)
1040 virq
= irq_create_mapping(at91_gpio
->domain
, offset
);
1044 dev_dbg(chip
->dev
, "%s: request IRQ for GPIO %d, return %d\n",
1045 chip
->label
, offset
+ chip
->base
, virq
);
1049 #ifdef CONFIG_DEBUG_FS
1050 static void at91_gpio_dbg_show(struct seq_file
*s
, struct gpio_chip
*chip
)
1054 struct at91_gpio_chip
*at91_gpio
= to_at91_gpio_chip(chip
);
1055 void __iomem
*pio
= at91_gpio
->regbase
;
1057 for (i
= 0; i
< chip
->ngpio
; i
++) {
1058 unsigned pin
= chip
->base
+ i
;
1059 unsigned mask
= pin_to_mask(pin
);
1060 const char *gpio_label
;
1063 gpio_label
= gpiochip_is_requested(chip
, i
);
1066 mode
= at91_gpio
->ops
->get_periph(pio
, mask
);
1067 seq_printf(s
, "[%s] GPIO%s%d: ",
1068 gpio_label
, chip
->label
, i
);
1069 if (mode
== AT91_MUX_GPIO
) {
1070 pdsr
= readl_relaxed(pio
+ PIO_PDSR
);
1072 seq_printf(s
, "[gpio] %s\n",
1076 seq_printf(s
, "[periph %c]\n",
1082 #define at91_gpio_dbg_show NULL
1085 /* Several AIC controller irqs are dispatched through this GPIO handler.
1086 * To use any AT91_PIN_* as an externally triggered IRQ, first call
1087 * at91_set_gpio_input() then maybe enable its glitch filter.
1088 * Then just request_irq() with the pin ID; it works like any ARM IRQ
1090 * First implementation always triggers on rising and falling edges
1091 * whereas the newer PIO3 can be additionally configured to trigger on
1092 * level, edge with any polarity.
1094 * Alternatively, certain pins may be used directly as IRQ0..IRQ6 after
1095 * configuring them with at91_set_a_periph() or at91_set_b_periph().
1096 * IRQ0..IRQ6 should be configurable, e.g. level vs edge triggering.
1099 static void gpio_irq_mask(struct irq_data
*d
)
1101 struct at91_gpio_chip
*at91_gpio
= irq_data_get_irq_chip_data(d
);
1102 void __iomem
*pio
= at91_gpio
->regbase
;
1103 unsigned mask
= 1 << d
->hwirq
;
1106 writel_relaxed(mask
, pio
+ PIO_IDR
);
1109 static void gpio_irq_unmask(struct irq_data
*d
)
1111 struct at91_gpio_chip
*at91_gpio
= irq_data_get_irq_chip_data(d
);
1112 void __iomem
*pio
= at91_gpio
->regbase
;
1113 unsigned mask
= 1 << d
->hwirq
;
1116 writel_relaxed(mask
, pio
+ PIO_IER
);
1119 static int gpio_irq_type(struct irq_data
*d
, unsigned type
)
1123 case IRQ_TYPE_EDGE_BOTH
:
1130 /* Alternate irq type for PIO3 support */
1131 static int alt_gpio_irq_type(struct irq_data
*d
, unsigned type
)
1133 struct at91_gpio_chip
*at91_gpio
= irq_data_get_irq_chip_data(d
);
1134 void __iomem
*pio
= at91_gpio
->regbase
;
1135 unsigned mask
= 1 << d
->hwirq
;
1138 case IRQ_TYPE_EDGE_RISING
:
1139 writel_relaxed(mask
, pio
+ PIO_ESR
);
1140 writel_relaxed(mask
, pio
+ PIO_REHLSR
);
1142 case IRQ_TYPE_EDGE_FALLING
:
1143 writel_relaxed(mask
, pio
+ PIO_ESR
);
1144 writel_relaxed(mask
, pio
+ PIO_FELLSR
);
1146 case IRQ_TYPE_LEVEL_LOW
:
1147 writel_relaxed(mask
, pio
+ PIO_LSR
);
1148 writel_relaxed(mask
, pio
+ PIO_FELLSR
);
1150 case IRQ_TYPE_LEVEL_HIGH
:
1151 writel_relaxed(mask
, pio
+ PIO_LSR
);
1152 writel_relaxed(mask
, pio
+ PIO_REHLSR
);
1154 case IRQ_TYPE_EDGE_BOTH
:
1156 * disable additional interrupt modes:
1157 * fall back to default behavior
1159 writel_relaxed(mask
, pio
+ PIO_AIMDR
);
1163 pr_warn("AT91: No type for irq %d\n", gpio_to_irq(d
->irq
));
1167 /* enable additional interrupt modes */
1168 writel_relaxed(mask
, pio
+ PIO_AIMER
);
1174 static int gpio_irq_set_wake(struct irq_data
*d
, unsigned state
)
1176 struct at91_gpio_chip
*at91_gpio
= irq_data_get_irq_chip_data(d
);
1177 unsigned bank
= at91_gpio
->pioc_idx
;
1179 if (unlikely(bank
>= MAX_GPIO_BANKS
))
1182 irq_set_irq_wake(at91_gpio
->pioc_virq
, state
);
1187 #define gpio_irq_set_wake NULL
1190 static struct irq_chip gpio_irqchip
= {
1192 .irq_disable
= gpio_irq_mask
,
1193 .irq_mask
= gpio_irq_mask
,
1194 .irq_unmask
= gpio_irq_unmask
,
1195 /* .irq_set_type is set dynamically */
1196 .irq_set_wake
= gpio_irq_set_wake
,
1199 static void gpio_irq_handler(unsigned irq
, struct irq_desc
*desc
)
1201 struct irq_chip
*chip
= irq_desc_get_chip(desc
);
1202 struct irq_data
*idata
= irq_desc_get_irq_data(desc
);
1203 struct at91_gpio_chip
*at91_gpio
= irq_data_get_irq_chip_data(idata
);
1204 void __iomem
*pio
= at91_gpio
->regbase
;
1208 chained_irq_enter(chip
, desc
);
1210 /* Reading ISR acks pending (edge triggered) GPIO interrupts.
1211 * When there none are pending, we're finished unless we need
1212 * to process multiple banks (like ID_PIOCDE on sam9263).
1214 isr
= readl_relaxed(pio
+ PIO_ISR
) & readl_relaxed(pio
+ PIO_IMR
);
1216 if (!at91_gpio
->next
)
1218 at91_gpio
= at91_gpio
->next
;
1219 pio
= at91_gpio
->regbase
;
1223 n
= find_first_bit(&isr
, BITS_PER_LONG
);
1224 while (n
< BITS_PER_LONG
) {
1225 generic_handle_irq(irq_find_mapping(at91_gpio
->domain
, n
));
1226 n
= find_next_bit(&isr
, BITS_PER_LONG
, n
+ 1);
1229 chained_irq_exit(chip
, desc
);
1230 /* now it may re-trigger */
1234 * This lock class tells lockdep that GPIO irqs are in a different
1235 * category than their parents, so it won't report false recursion.
1237 static struct lock_class_key gpio_lock_class
;
1239 static int at91_gpio_irq_map(struct irq_domain
*h
, unsigned int virq
,
1242 struct at91_gpio_chip
*at91_gpio
= h
->host_data
;
1244 irq_set_lockdep_class(virq
, &gpio_lock_class
);
1247 * Can use the "simple" and not "edge" handler since it's
1248 * shorter, and the AIC handles interrupts sanely.
1250 irq_set_chip_and_handler(virq
, &gpio_irqchip
,
1252 set_irq_flags(virq
, IRQF_VALID
);
1253 irq_set_chip_data(virq
, at91_gpio
);
1258 static struct irq_domain_ops at91_gpio_ops
= {
1259 .map
= at91_gpio_irq_map
,
1260 .xlate
= irq_domain_xlate_twocell
,
1263 static int at91_gpio_of_irq_setup(struct device_node
*node
,
1264 struct at91_gpio_chip
*at91_gpio
)
1266 struct at91_gpio_chip
*prev
= NULL
;
1267 struct irq_data
*d
= irq_get_irq_data(at91_gpio
->pioc_virq
);
1269 at91_gpio
->pioc_hwirq
= irqd_to_hwirq(d
);
1271 /* Setup proper .irq_set_type function */
1272 gpio_irqchip
.irq_set_type
= at91_gpio
->ops
->irq_type
;
1274 /* Disable irqs of this PIO controller */
1275 writel_relaxed(~0, at91_gpio
->regbase
+ PIO_IDR
);
1277 /* Setup irq domain */
1278 at91_gpio
->domain
= irq_domain_add_linear(node
, at91_gpio
->chip
.ngpio
,
1279 &at91_gpio_ops
, at91_gpio
);
1280 if (!at91_gpio
->domain
)
1281 panic("at91_gpio.%d: couldn't allocate irq domain (DT).\n",
1282 at91_gpio
->pioc_idx
);
1284 /* Setup chained handler */
1285 if (at91_gpio
->pioc_idx
)
1286 prev
= gpio_chips
[at91_gpio
->pioc_idx
- 1];
1288 /* The toplevel handler handles one bank of GPIOs, except
1289 * on some SoC it can handles up to three...
1290 * We only set up the handler for the first of the list.
1292 if (prev
&& prev
->next
== at91_gpio
)
1295 irq_set_chip_data(at91_gpio
->pioc_virq
, at91_gpio
);
1296 irq_set_chained_handler(at91_gpio
->pioc_virq
, gpio_irq_handler
);
1301 /* This structure is replicated for each GPIO block allocated at probe time */
1302 static struct gpio_chip at91_gpio_template
= {
1303 .request
= at91_gpio_request
,
1304 .free
= at91_gpio_free
,
1305 .direction_input
= at91_gpio_direction_input
,
1306 .get
= at91_gpio_get
,
1307 .direction_output
= at91_gpio_direction_output
,
1308 .set
= at91_gpio_set
,
1309 .to_irq
= at91_gpio_to_irq
,
1310 .dbg_show
= at91_gpio_dbg_show
,
1312 .ngpio
= MAX_NB_GPIO_PER_BANK
,
1315 static void __devinit
at91_gpio_probe_fixup(void)
1318 struct at91_gpio_chip
*at91_gpio
, *last
= NULL
;
1320 for (i
= 0; i
< gpio_banks
; i
++) {
1321 at91_gpio
= gpio_chips
[i
];
1324 * GPIO controller are grouped on some SoC:
1325 * PIOC, PIOD and PIOE can share the same IRQ line
1327 if (last
&& last
->pioc_virq
== at91_gpio
->pioc_virq
)
1328 last
->next
= at91_gpio
;
1333 static struct of_device_id at91_gpio_of_match
[] __devinitdata
= {
1334 { .compatible
= "atmel,at91sam9x5-gpio", .data
= &at91sam9x5_ops
, },
1335 { .compatible
= "atmel,at91rm9200-gpio", .data
= &at91rm9200_ops
},
1339 static int __devinit
at91_gpio_probe(struct platform_device
*pdev
)
1341 struct device_node
*np
= pdev
->dev
.of_node
;
1342 struct resource
*res
;
1343 struct at91_gpio_chip
*at91_chip
= NULL
;
1344 struct gpio_chip
*chip
;
1345 struct pinctrl_gpio_range
*range
;
1348 int alias_idx
= of_alias_get_id(np
, "gpio");
1351 BUG_ON(alias_idx
>= ARRAY_SIZE(gpio_chips
));
1352 if (gpio_chips
[alias_idx
]) {
1357 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
1363 irq
= platform_get_irq(pdev
, 0);
1369 at91_chip
= devm_kzalloc(&pdev
->dev
, sizeof(*at91_chip
), GFP_KERNEL
);
1375 at91_chip
->regbase
= devm_request_and_ioremap(&pdev
->dev
, res
);
1376 if (!at91_chip
->regbase
) {
1377 dev_err(&pdev
->dev
, "failed to map registers, ignoring.\n");
1383 of_match_device(at91_gpio_of_match
, &pdev
->dev
)->data
;
1384 at91_chip
->pioc_virq
= irq
;
1385 at91_chip
->pioc_idx
= alias_idx
;
1387 at91_chip
->clock
= clk_get(&pdev
->dev
, NULL
);
1388 if (IS_ERR(at91_chip
->clock
)) {
1389 dev_err(&pdev
->dev
, "failed to get clock, ignoring.\n");
1393 if (clk_prepare(at91_chip
->clock
))
1396 /* enable PIO controller's clock */
1397 if (clk_enable(at91_chip
->clock
)) {
1398 dev_err(&pdev
->dev
, "failed to enable clock, ignoring.\n");
1402 at91_chip
->chip
= at91_gpio_template
;
1404 chip
= &at91_chip
->chip
;
1406 chip
->label
= dev_name(&pdev
->dev
);
1407 chip
->dev
= &pdev
->dev
;
1408 chip
->owner
= THIS_MODULE
;
1409 chip
->base
= alias_idx
* MAX_NB_GPIO_PER_BANK
;
1411 if (!of_property_read_u32(np
, "#gpio-lines", &ngpio
)) {
1412 if (ngpio
>= MAX_NB_GPIO_PER_BANK
)
1413 pr_err("at91_gpio.%d, gpio-nb >= %d failback to %d\n",
1414 alias_idx
, MAX_NB_GPIO_PER_BANK
, MAX_NB_GPIO_PER_BANK
);
1416 chip
->ngpio
= ngpio
;
1419 range
= &at91_chip
->range
;
1420 range
->name
= chip
->label
;
1421 range
->id
= alias_idx
;
1422 range
->pin_base
= range
->base
= range
->id
* MAX_NB_GPIO_PER_BANK
;
1424 range
->npins
= chip
->ngpio
;
1427 ret
= gpiochip_add(chip
);
1431 gpio_chips
[alias_idx
] = at91_chip
;
1432 gpio_banks
= max(gpio_banks
, alias_idx
+ 1);
1434 at91_gpio_probe_fixup();
1436 at91_gpio_of_irq_setup(np
, at91_chip
);
1438 dev_info(&pdev
->dev
, "at address %p\n", at91_chip
->regbase
);
1443 clk_unprepare(at91_chip
->clock
);
1445 clk_put(at91_chip
->clock
);
1447 dev_err(&pdev
->dev
, "Failure %i for GPIO %i\n", ret
, alias_idx
);
1452 static struct platform_driver at91_gpio_driver
= {
1454 .name
= "gpio-at91",
1455 .owner
= THIS_MODULE
,
1456 .of_match_table
= of_match_ptr(at91_gpio_of_match
),
1458 .probe
= at91_gpio_probe
,
1461 static struct platform_driver at91_pinctrl_driver
= {
1463 .name
= "pinctrl-at91",
1464 .owner
= THIS_MODULE
,
1465 .of_match_table
= of_match_ptr(at91_pinctrl_of_match
),
1467 .probe
= at91_pinctrl_probe
,
1468 .remove
= __devexit_p(at91_pinctrl_remove
),
1471 static int __init
at91_pinctrl_init(void)
1475 ret
= platform_driver_register(&at91_gpio_driver
);
1478 return platform_driver_register(&at91_pinctrl_driver
);
1480 arch_initcall(at91_pinctrl_init
);
1482 static void __exit
at91_pinctrl_exit(void)
1484 platform_driver_unregister(&at91_pinctrl_driver
);
1487 module_exit(at91_pinctrl_exit
);
1488 MODULE_AUTHOR("Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>");
1489 MODULE_DESCRIPTION("Atmel AT91 pinctrl driver");
1490 MODULE_LICENSE("GPL v2");