2 * Pinctrl driver for Rockchip SoCs
4 * Copyright (c) 2013 MundoReader S.L.
5 * Author: Heiko Stuebner <heiko@sntech.de>
7 * With some ideas taken from pinctrl-samsung:
8 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
9 * http://www.samsung.com
10 * Copyright (c) 2012 Linaro Ltd
11 * http://www.linaro.org
14 * Copyright (C) 2011-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as published
18 * by the Free Software Foundation.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
26 #include <linux/module.h>
27 #include <linux/platform_device.h>
29 #include <linux/bitops.h>
30 #include <linux/gpio.h>
31 #include <linux/of_address.h>
32 #include <linux/of_irq.h>
33 #include <linux/pinctrl/machine.h>
34 #include <linux/pinctrl/pinconf.h>
35 #include <linux/pinctrl/pinctrl.h>
36 #include <linux/pinctrl/pinmux.h>
37 #include <linux/pinctrl/pinconf-generic.h>
38 #include <linux/irqchip/chained_irq.h>
39 #include <linux/clk.h>
40 #include <dt-bindings/pinctrl/rockchip.h>
45 /* GPIO control registers */
46 #define GPIO_SWPORT_DR 0x00
47 #define GPIO_SWPORT_DDR 0x04
48 #define GPIO_INTEN 0x30
49 #define GPIO_INTMASK 0x34
50 #define GPIO_INTTYPE_LEVEL 0x38
51 #define GPIO_INT_POLARITY 0x3c
52 #define GPIO_INT_STATUS 0x40
53 #define GPIO_INT_RAWSTATUS 0x44
54 #define GPIO_DEBOUNCE 0x48
55 #define GPIO_PORTS_EOI 0x4c
56 #define GPIO_EXT_PORT 0x50
57 #define GPIO_LS_SYNC 0x60
59 enum rockchip_pinctrl_type
{
65 enum rockchip_pin_bank_type
{
71 * @reg_base: register base of the gpio bank
72 * @reg_pull: optional separate register for additional pull settings
73 * @clk: clock of the gpio bank
74 * @irq: interrupt of the gpio bank
75 * @pin_base: first pin number
76 * @nr_pins: number of pins in this bank
77 * @name: name of the bank
78 * @bank_num: number of the bank, to account for holes
79 * @valid: are all necessary informations present
80 * @of_node: dt node of this bank
81 * @drvdata: common pinctrl basedata
82 * @domain: irqdomain of the gpio bank
83 * @gpio_chip: gpiolib chip
85 * @slock: spinlock for the gpio bank
87 struct rockchip_pin_bank
{
88 void __iomem
*reg_base
;
89 void __iomem
*reg_pull
;
96 enum rockchip_pin_bank_type bank_type
;
98 struct device_node
*of_node
;
99 struct rockchip_pinctrl
*drvdata
;
100 struct irq_domain
*domain
;
101 struct gpio_chip gpio_chip
;
102 struct pinctrl_gpio_range grange
;
104 u32 toggle_edge_mode
;
107 #define PIN_BANK(id, pins, label) \
116 struct rockchip_pin_ctrl
{
117 struct rockchip_pin_bank
*pin_banks
;
121 enum rockchip_pinctrl_type type
;
123 void (*pull_calc_reg
)(struct rockchip_pin_bank
*bank
, int pin_num
,
124 void __iomem
**reg
, u8
*bit
);
127 struct rockchip_pin_config
{
129 unsigned long *configs
;
130 unsigned int nconfigs
;
134 * struct rockchip_pin_group: represent group of pins of a pinmux function.
135 * @name: name of the pin group, used to lookup the group.
136 * @pins: the pins included in this group.
137 * @npins: number of pins included in this group.
138 * @func: the mux function number to be programmed when selected.
139 * @configs: the config values to be set for each pin
140 * @nconfigs: number of configs for each pin
142 struct rockchip_pin_group
{
146 struct rockchip_pin_config
*data
;
150 * struct rockchip_pmx_func: represent a pin function.
151 * @name: name of the pin function, used to lookup the function.
152 * @groups: one or more names of pin groups that provide this function.
153 * @num_groups: number of groups included in @groups.
155 struct rockchip_pmx_func
{
161 struct rockchip_pinctrl
{
162 void __iomem
*reg_base
;
163 void __iomem
*reg_pull
;
165 struct rockchip_pin_ctrl
*ctrl
;
166 struct pinctrl_desc pctl
;
167 struct pinctrl_dev
*pctl_dev
;
168 struct rockchip_pin_group
*groups
;
169 unsigned int ngroups
;
170 struct rockchip_pmx_func
*functions
;
171 unsigned int nfunctions
;
174 static inline struct rockchip_pin_bank
*gc_to_pin_bank(struct gpio_chip
*gc
)
176 return container_of(gc
, struct rockchip_pin_bank
, gpio_chip
);
179 static const inline struct rockchip_pin_group
*pinctrl_name_to_group(
180 const struct rockchip_pinctrl
*info
,
185 for (i
= 0; i
< info
->ngroups
; i
++) {
186 if (!strcmp(info
->groups
[i
].name
, name
))
187 return &info
->groups
[i
];
194 * given a pin number that is local to a pin controller, find out the pin bank
195 * and the register base of the pin bank.
197 static struct rockchip_pin_bank
*pin_to_bank(struct rockchip_pinctrl
*info
,
200 struct rockchip_pin_bank
*b
= info
->ctrl
->pin_banks
;
202 while (pin
>= (b
->pin_base
+ b
->nr_pins
))
208 static struct rockchip_pin_bank
*bank_num_to_bank(
209 struct rockchip_pinctrl
*info
,
212 struct rockchip_pin_bank
*b
= info
->ctrl
->pin_banks
;
215 for (i
= 0; i
< info
->ctrl
->nr_banks
; i
++, b
++) {
216 if (b
->bank_num
== num
)
220 return ERR_PTR(-EINVAL
);
224 * Pinctrl_ops handling
227 static int rockchip_get_groups_count(struct pinctrl_dev
*pctldev
)
229 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
231 return info
->ngroups
;
234 static const char *rockchip_get_group_name(struct pinctrl_dev
*pctldev
,
237 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
239 return info
->groups
[selector
].name
;
242 static int rockchip_get_group_pins(struct pinctrl_dev
*pctldev
,
243 unsigned selector
, const unsigned **pins
,
246 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
248 if (selector
>= info
->ngroups
)
251 *pins
= info
->groups
[selector
].pins
;
252 *npins
= info
->groups
[selector
].npins
;
257 static int rockchip_dt_node_to_map(struct pinctrl_dev
*pctldev
,
258 struct device_node
*np
,
259 struct pinctrl_map
**map
, unsigned *num_maps
)
261 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
262 const struct rockchip_pin_group
*grp
;
263 struct pinctrl_map
*new_map
;
264 struct device_node
*parent
;
269 * first find the group of this node and check if we need to create
270 * config maps for pins
272 grp
= pinctrl_name_to_group(info
, np
->name
);
274 dev_err(info
->dev
, "unable to find group for node %s\n",
279 map_num
+= grp
->npins
;
280 new_map
= devm_kzalloc(pctldev
->dev
, sizeof(*new_map
) * map_num
,
289 parent
= of_get_parent(np
);
291 devm_kfree(pctldev
->dev
, new_map
);
294 new_map
[0].type
= PIN_MAP_TYPE_MUX_GROUP
;
295 new_map
[0].data
.mux
.function
= parent
->name
;
296 new_map
[0].data
.mux
.group
= np
->name
;
299 /* create config map */
301 for (i
= 0; i
< grp
->npins
; i
++) {
302 new_map
[i
].type
= PIN_MAP_TYPE_CONFIGS_PIN
;
303 new_map
[i
].data
.configs
.group_or_pin
=
304 pin_get_name(pctldev
, grp
->pins
[i
]);
305 new_map
[i
].data
.configs
.configs
= grp
->data
[i
].configs
;
306 new_map
[i
].data
.configs
.num_configs
= grp
->data
[i
].nconfigs
;
309 dev_dbg(pctldev
->dev
, "maps: function %s group %s num %d\n",
310 (*map
)->data
.mux
.function
, (*map
)->data
.mux
.group
, map_num
);
315 static void rockchip_dt_free_map(struct pinctrl_dev
*pctldev
,
316 struct pinctrl_map
*map
, unsigned num_maps
)
320 static const struct pinctrl_ops rockchip_pctrl_ops
= {
321 .get_groups_count
= rockchip_get_groups_count
,
322 .get_group_name
= rockchip_get_group_name
,
323 .get_group_pins
= rockchip_get_group_pins
,
324 .dt_node_to_map
= rockchip_dt_node_to_map
,
325 .dt_free_map
= rockchip_dt_free_map
,
333 * Set a new mux function for a pin.
335 * The register is divided into the upper and lower 16 bit. When changing
336 * a value, the previous register value is not read and changed. Instead
337 * it seems the changed bits are marked in the upper 16 bit, while the
338 * changed value gets set in the same offset in the lower 16 bit.
339 * All pin settings seem to be 2 bit wide in both the upper and lower
341 * @bank: pin bank to change
342 * @pin: pin to change
343 * @mux: new mux function to set
345 static void rockchip_set_mux(struct rockchip_pin_bank
*bank
, int pin
, int mux
)
347 struct rockchip_pinctrl
*info
= bank
->drvdata
;
348 void __iomem
*reg
= info
->reg_base
+ info
->ctrl
->mux_offset
;
353 dev_dbg(info
->dev
, "setting mux of GPIO%d-%d to %d\n",
354 bank
->bank_num
, pin
, mux
);
356 /* get basic quadrupel of mux registers and the correct reg inside */
357 reg
+= bank
->bank_num
* 0x10;
358 reg
+= (pin
/ 8) * 4;
361 spin_lock_irqsave(&bank
->slock
, flags
);
363 data
= (3 << (bit
+ 16));
364 data
|= (mux
& 3) << bit
;
367 spin_unlock_irqrestore(&bank
->slock
, flags
);
370 #define RK2928_PULL_OFFSET 0x118
371 #define RK2928_PULL_PINS_PER_REG 16
372 #define RK2928_PULL_BANK_STRIDE 8
374 static void rk2928_calc_pull_reg_and_bit(struct rockchip_pin_bank
*bank
,
375 int pin_num
, void __iomem
**reg
, u8
*bit
)
377 struct rockchip_pinctrl
*info
= bank
->drvdata
;
379 *reg
= info
->reg_base
+ RK2928_PULL_OFFSET
;
380 *reg
+= bank
->bank_num
* RK2928_PULL_BANK_STRIDE
;
381 *reg
+= (pin_num
/ RK2928_PULL_PINS_PER_REG
) * 4;
383 *bit
= pin_num
% RK2928_PULL_PINS_PER_REG
;
386 #define RK3188_PULL_BITS_PER_PIN 2
387 #define RK3188_PULL_PINS_PER_REG 8
388 #define RK3188_PULL_BANK_STRIDE 16
390 static void rk3188_calc_pull_reg_and_bit(struct rockchip_pin_bank
*bank
,
391 int pin_num
, void __iomem
**reg
, u8
*bit
)
393 struct rockchip_pinctrl
*info
= bank
->drvdata
;
395 /* The first 12 pins of the first bank are located elsewhere */
396 if (bank
->bank_type
== RK3188_BANK0
&& pin_num
< 12) {
397 *reg
= bank
->reg_pull
+
398 ((pin_num
/ RK3188_PULL_PINS_PER_REG
) * 4);
399 *bit
= pin_num
% RK3188_PULL_PINS_PER_REG
;
400 *bit
*= RK3188_PULL_BITS_PER_PIN
;
402 *reg
= info
->reg_pull
- 4;
403 *reg
+= bank
->bank_num
* RK3188_PULL_BANK_STRIDE
;
404 *reg
+= ((pin_num
/ RK3188_PULL_PINS_PER_REG
) * 4);
407 * The bits in these registers have an inverse ordering
408 * with the lowest pin being in bits 15:14 and the highest
411 *bit
= 7 - (pin_num
% RK3188_PULL_PINS_PER_REG
);
412 *bit
*= RK3188_PULL_BITS_PER_PIN
;
416 static int rockchip_get_pull(struct rockchip_pin_bank
*bank
, int pin_num
)
418 struct rockchip_pinctrl
*info
= bank
->drvdata
;
419 struct rockchip_pin_ctrl
*ctrl
= info
->ctrl
;
424 /* rk3066b does support any pulls */
425 if (ctrl
->type
== RK3066B
)
426 return PIN_CONFIG_BIAS_DISABLE
;
428 ctrl
->pull_calc_reg(bank
, pin_num
, ®
, &bit
);
430 switch (ctrl
->type
) {
432 return !(readl_relaxed(reg
) & BIT(bit
))
433 ? PIN_CONFIG_BIAS_PULL_PIN_DEFAULT
434 : PIN_CONFIG_BIAS_DISABLE
;
436 data
= readl_relaxed(reg
) >> bit
;
437 data
&= (1 << RK3188_PULL_BITS_PER_PIN
) - 1;
441 return PIN_CONFIG_BIAS_DISABLE
;
443 return PIN_CONFIG_BIAS_PULL_UP
;
445 return PIN_CONFIG_BIAS_PULL_DOWN
;
447 return PIN_CONFIG_BIAS_BUS_HOLD
;
450 dev_err(info
->dev
, "unknown pull setting\n");
453 dev_err(info
->dev
, "unsupported pinctrl type\n");
458 static int rockchip_set_pull(struct rockchip_pin_bank
*bank
,
459 int pin_num
, int pull
)
461 struct rockchip_pinctrl
*info
= bank
->drvdata
;
462 struct rockchip_pin_ctrl
*ctrl
= info
->ctrl
;
468 dev_dbg(info
->dev
, "setting pull of GPIO%d-%d to %d\n",
469 bank
->bank_num
, pin_num
, pull
);
471 /* rk3066b does support any pulls */
472 if (ctrl
->type
== RK3066B
)
473 return pull
? -EINVAL
: 0;
475 ctrl
->pull_calc_reg(bank
, pin_num
, ®
, &bit
);
477 switch (ctrl
->type
) {
479 spin_lock_irqsave(&bank
->slock
, flags
);
481 data
= BIT(bit
+ 16);
482 if (pull
== PIN_CONFIG_BIAS_DISABLE
)
486 spin_unlock_irqrestore(&bank
->slock
, flags
);
489 spin_lock_irqsave(&bank
->slock
, flags
);
491 /* enable the write to the equivalent lower bits */
492 data
= ((1 << RK3188_PULL_BITS_PER_PIN
) - 1) << (bit
+ 16);
495 case PIN_CONFIG_BIAS_DISABLE
:
497 case PIN_CONFIG_BIAS_PULL_UP
:
500 case PIN_CONFIG_BIAS_PULL_DOWN
:
503 case PIN_CONFIG_BIAS_BUS_HOLD
:
507 spin_unlock_irqrestore(&bank
->slock
, flags
);
508 dev_err(info
->dev
, "unsupported pull setting %d\n",
515 spin_unlock_irqrestore(&bank
->slock
, flags
);
518 dev_err(info
->dev
, "unsupported pinctrl type\n");
526 * Pinmux_ops handling
529 static int rockchip_pmx_get_funcs_count(struct pinctrl_dev
*pctldev
)
531 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
533 return info
->nfunctions
;
536 static const char *rockchip_pmx_get_func_name(struct pinctrl_dev
*pctldev
,
539 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
541 return info
->functions
[selector
].name
;
544 static int rockchip_pmx_get_groups(struct pinctrl_dev
*pctldev
,
545 unsigned selector
, const char * const **groups
,
546 unsigned * const num_groups
)
548 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
550 *groups
= info
->functions
[selector
].groups
;
551 *num_groups
= info
->functions
[selector
].ngroups
;
556 static int rockchip_pmx_enable(struct pinctrl_dev
*pctldev
, unsigned selector
,
559 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
560 const unsigned int *pins
= info
->groups
[group
].pins
;
561 const struct rockchip_pin_config
*data
= info
->groups
[group
].data
;
562 struct rockchip_pin_bank
*bank
;
565 dev_dbg(info
->dev
, "enable function %s group %s\n",
566 info
->functions
[selector
].name
, info
->groups
[group
].name
);
569 * for each pin in the pin group selected, program the correspoding pin
570 * pin function number in the config register.
572 for (cnt
= 0; cnt
< info
->groups
[group
].npins
; cnt
++) {
573 bank
= pin_to_bank(info
, pins
[cnt
]);
574 rockchip_set_mux(bank
, pins
[cnt
] - bank
->pin_base
,
581 static void rockchip_pmx_disable(struct pinctrl_dev
*pctldev
,
582 unsigned selector
, unsigned group
)
584 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
585 const unsigned int *pins
= info
->groups
[group
].pins
;
586 struct rockchip_pin_bank
*bank
;
589 dev_dbg(info
->dev
, "disable function %s group %s\n",
590 info
->functions
[selector
].name
, info
->groups
[group
].name
);
592 for (cnt
= 0; cnt
< info
->groups
[group
].npins
; cnt
++) {
593 bank
= pin_to_bank(info
, pins
[cnt
]);
594 rockchip_set_mux(bank
, pins
[cnt
] - bank
->pin_base
, 0);
599 * The calls to gpio_direction_output() and gpio_direction_input()
600 * leads to this function call (via the pinctrl_gpio_direction_{input|output}()
601 * function called from the gpiolib interface).
603 static int rockchip_pmx_gpio_set_direction(struct pinctrl_dev
*pctldev
,
604 struct pinctrl_gpio_range
*range
,
605 unsigned offset
, bool input
)
607 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
608 struct rockchip_pin_bank
*bank
;
609 struct gpio_chip
*chip
;
614 bank
= gc_to_pin_bank(chip
);
615 pin
= offset
- chip
->base
;
617 dev_dbg(info
->dev
, "gpio_direction for pin %u as %s-%d to %s\n",
618 offset
, range
->name
, pin
, input
? "input" : "output");
620 rockchip_set_mux(bank
, pin
, RK_FUNC_GPIO
);
622 data
= readl_relaxed(bank
->reg_base
+ GPIO_SWPORT_DDR
);
623 /* set bit to 1 for output, 0 for input */
628 writel_relaxed(data
, bank
->reg_base
+ GPIO_SWPORT_DDR
);
633 static const struct pinmux_ops rockchip_pmx_ops
= {
634 .get_functions_count
= rockchip_pmx_get_funcs_count
,
635 .get_function_name
= rockchip_pmx_get_func_name
,
636 .get_function_groups
= rockchip_pmx_get_groups
,
637 .enable
= rockchip_pmx_enable
,
638 .disable
= rockchip_pmx_disable
,
639 .gpio_set_direction
= rockchip_pmx_gpio_set_direction
,
643 * Pinconf_ops handling
646 static bool rockchip_pinconf_pull_valid(struct rockchip_pin_ctrl
*ctrl
,
647 enum pin_config_param pull
)
649 switch (ctrl
->type
) {
651 return (pull
== PIN_CONFIG_BIAS_PULL_PIN_DEFAULT
||
652 pull
== PIN_CONFIG_BIAS_DISABLE
);
654 return pull
? false : true;
656 return (pull
!= PIN_CONFIG_BIAS_PULL_PIN_DEFAULT
);
662 /* set the pin config settings for a specified pin */
663 static int rockchip_pinconf_set(struct pinctrl_dev
*pctldev
, unsigned int pin
,
664 unsigned long *configs
, unsigned num_configs
)
666 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
667 struct rockchip_pin_bank
*bank
= pin_to_bank(info
, pin
);
668 enum pin_config_param param
;
673 for (i
= 0; i
< num_configs
; i
++) {
674 param
= pinconf_to_config_param(configs
[i
]);
675 arg
= pinconf_to_config_argument(configs
[i
]);
678 case PIN_CONFIG_BIAS_DISABLE
:
679 rc
= rockchip_set_pull(bank
, pin
- bank
->pin_base
,
684 case PIN_CONFIG_BIAS_PULL_UP
:
685 case PIN_CONFIG_BIAS_PULL_DOWN
:
686 case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT
:
687 case PIN_CONFIG_BIAS_BUS_HOLD
:
688 if (!rockchip_pinconf_pull_valid(info
->ctrl
, param
))
694 rc
= rockchip_set_pull(bank
, pin
- bank
->pin_base
,
703 } /* for each config */
708 /* get the pin config settings for a specified pin */
709 static int rockchip_pinconf_get(struct pinctrl_dev
*pctldev
, unsigned int pin
,
710 unsigned long *config
)
712 struct rockchip_pinctrl
*info
= pinctrl_dev_get_drvdata(pctldev
);
713 struct rockchip_pin_bank
*bank
= pin_to_bank(info
, pin
);
714 enum pin_config_param param
= pinconf_to_config_param(*config
);
717 case PIN_CONFIG_BIAS_DISABLE
:
718 if (rockchip_get_pull(bank
, pin
- bank
->pin_base
) != param
)
723 case PIN_CONFIG_BIAS_PULL_UP
:
724 case PIN_CONFIG_BIAS_PULL_DOWN
:
725 case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT
:
726 case PIN_CONFIG_BIAS_BUS_HOLD
:
727 if (!rockchip_pinconf_pull_valid(info
->ctrl
, param
))
730 if (rockchip_get_pull(bank
, pin
- bank
->pin_base
) != param
)
743 static const struct pinconf_ops rockchip_pinconf_ops
= {
744 .pin_config_get
= rockchip_pinconf_get
,
745 .pin_config_set
= rockchip_pinconf_set
,
748 static const struct of_device_id rockchip_bank_match
[] = {
749 { .compatible
= "rockchip,gpio-bank" },
750 { .compatible
= "rockchip,rk3188-gpio-bank0" },
754 static void rockchip_pinctrl_child_count(struct rockchip_pinctrl
*info
,
755 struct device_node
*np
)
757 struct device_node
*child
;
759 for_each_child_of_node(np
, child
) {
760 if (of_match_node(rockchip_bank_match
, child
))
764 info
->ngroups
+= of_get_child_count(child
);
768 static int rockchip_pinctrl_parse_groups(struct device_node
*np
,
769 struct rockchip_pin_group
*grp
,
770 struct rockchip_pinctrl
*info
,
773 struct rockchip_pin_bank
*bank
;
780 dev_dbg(info
->dev
, "group(%d): %s\n", index
, np
->name
);
782 /* Initialise group */
783 grp
->name
= np
->name
;
786 * the binding format is rockchip,pins = <bank pin mux CONFIG>,
787 * do sanity check and calculate pins number
789 list
= of_get_property(np
, "rockchip,pins", &size
);
790 /* we do not check return since it's safe node passed down */
791 size
/= sizeof(*list
);
792 if (!size
|| size
% 4) {
793 dev_err(info
->dev
, "wrong pins number or pins and configs should be by 4\n");
797 grp
->npins
= size
/ 4;
799 grp
->pins
= devm_kzalloc(info
->dev
, grp
->npins
* sizeof(unsigned int),
801 grp
->data
= devm_kzalloc(info
->dev
, grp
->npins
*
802 sizeof(struct rockchip_pin_config
),
804 if (!grp
->pins
|| !grp
->data
)
807 for (i
= 0, j
= 0; i
< size
; i
+= 4, j
++) {
808 const __be32
*phandle
;
809 struct device_node
*np_config
;
811 num
= be32_to_cpu(*list
++);
812 bank
= bank_num_to_bank(info
, num
);
814 return PTR_ERR(bank
);
816 grp
->pins
[j
] = bank
->pin_base
+ be32_to_cpu(*list
++);
817 grp
->data
[j
].func
= be32_to_cpu(*list
++);
823 np_config
= of_find_node_by_phandle(be32_to_cpup(phandle
));
824 ret
= pinconf_generic_parse_dt_config(np_config
,
825 &grp
->data
[j
].configs
, &grp
->data
[j
].nconfigs
);
833 static int rockchip_pinctrl_parse_functions(struct device_node
*np
,
834 struct rockchip_pinctrl
*info
,
837 struct device_node
*child
;
838 struct rockchip_pmx_func
*func
;
839 struct rockchip_pin_group
*grp
;
841 static u32 grp_index
;
844 dev_dbg(info
->dev
, "parse function(%d): %s\n", index
, np
->name
);
846 func
= &info
->functions
[index
];
848 /* Initialise function */
849 func
->name
= np
->name
;
850 func
->ngroups
= of_get_child_count(np
);
851 if (func
->ngroups
<= 0)
854 func
->groups
= devm_kzalloc(info
->dev
,
855 func
->ngroups
* sizeof(char *), GFP_KERNEL
);
859 for_each_child_of_node(np
, child
) {
860 func
->groups
[i
] = child
->name
;
861 grp
= &info
->groups
[grp_index
++];
862 ret
= rockchip_pinctrl_parse_groups(child
, grp
, info
, i
++);
870 static int rockchip_pinctrl_parse_dt(struct platform_device
*pdev
,
871 struct rockchip_pinctrl
*info
)
873 struct device
*dev
= &pdev
->dev
;
874 struct device_node
*np
= dev
->of_node
;
875 struct device_node
*child
;
879 rockchip_pinctrl_child_count(info
, np
);
881 dev_dbg(&pdev
->dev
, "nfunctions = %d\n", info
->nfunctions
);
882 dev_dbg(&pdev
->dev
, "ngroups = %d\n", info
->ngroups
);
884 info
->functions
= devm_kzalloc(dev
, info
->nfunctions
*
885 sizeof(struct rockchip_pmx_func
),
887 if (!info
->functions
) {
888 dev_err(dev
, "failed to allocate memory for function list\n");
892 info
->groups
= devm_kzalloc(dev
, info
->ngroups
*
893 sizeof(struct rockchip_pin_group
),
896 dev_err(dev
, "failed allocate memory for ping group list\n");
902 for_each_child_of_node(np
, child
) {
903 if (of_match_node(rockchip_bank_match
, child
))
906 ret
= rockchip_pinctrl_parse_functions(child
, info
, i
++);
908 dev_err(&pdev
->dev
, "failed to parse function\n");
916 static int rockchip_pinctrl_register(struct platform_device
*pdev
,
917 struct rockchip_pinctrl
*info
)
919 struct pinctrl_desc
*ctrldesc
= &info
->pctl
;
920 struct pinctrl_pin_desc
*pindesc
, *pdesc
;
921 struct rockchip_pin_bank
*pin_bank
;
925 ctrldesc
->name
= "rockchip-pinctrl";
926 ctrldesc
->owner
= THIS_MODULE
;
927 ctrldesc
->pctlops
= &rockchip_pctrl_ops
;
928 ctrldesc
->pmxops
= &rockchip_pmx_ops
;
929 ctrldesc
->confops
= &rockchip_pinconf_ops
;
931 pindesc
= devm_kzalloc(&pdev
->dev
, sizeof(*pindesc
) *
932 info
->ctrl
->nr_pins
, GFP_KERNEL
);
934 dev_err(&pdev
->dev
, "mem alloc for pin descriptors failed\n");
937 ctrldesc
->pins
= pindesc
;
938 ctrldesc
->npins
= info
->ctrl
->nr_pins
;
941 for (bank
= 0 , k
= 0; bank
< info
->ctrl
->nr_banks
; bank
++) {
942 pin_bank
= &info
->ctrl
->pin_banks
[bank
];
943 for (pin
= 0; pin
< pin_bank
->nr_pins
; pin
++, k
++) {
945 pdesc
->name
= kasprintf(GFP_KERNEL
, "%s-%d",
946 pin_bank
->name
, pin
);
951 info
->pctl_dev
= pinctrl_register(ctrldesc
, &pdev
->dev
, info
);
952 if (!info
->pctl_dev
) {
953 dev_err(&pdev
->dev
, "could not register pinctrl driver\n");
957 for (bank
= 0; bank
< info
->ctrl
->nr_banks
; ++bank
) {
958 pin_bank
= &info
->ctrl
->pin_banks
[bank
];
959 pin_bank
->grange
.name
= pin_bank
->name
;
960 pin_bank
->grange
.id
= bank
;
961 pin_bank
->grange
.pin_base
= pin_bank
->pin_base
;
962 pin_bank
->grange
.base
= pin_bank
->gpio_chip
.base
;
963 pin_bank
->grange
.npins
= pin_bank
->gpio_chip
.ngpio
;
964 pin_bank
->grange
.gc
= &pin_bank
->gpio_chip
;
965 pinctrl_add_gpio_range(info
->pctl_dev
, &pin_bank
->grange
);
968 ret
= rockchip_pinctrl_parse_dt(pdev
, info
);
970 pinctrl_unregister(info
->pctl_dev
);
981 static int rockchip_gpio_request(struct gpio_chip
*chip
, unsigned offset
)
983 return pinctrl_request_gpio(chip
->base
+ offset
);
986 static void rockchip_gpio_free(struct gpio_chip
*chip
, unsigned offset
)
988 pinctrl_free_gpio(chip
->base
+ offset
);
991 static void rockchip_gpio_set(struct gpio_chip
*gc
, unsigned offset
, int value
)
993 struct rockchip_pin_bank
*bank
= gc_to_pin_bank(gc
);
994 void __iomem
*reg
= bank
->reg_base
+ GPIO_SWPORT_DR
;
998 spin_lock_irqsave(&bank
->slock
, flags
);
1001 data
&= ~BIT(offset
);
1003 data
|= BIT(offset
);
1006 spin_unlock_irqrestore(&bank
->slock
, flags
);
1010 * Returns the level of the pin for input direction and setting of the DR
1011 * register for output gpios.
1013 static int rockchip_gpio_get(struct gpio_chip
*gc
, unsigned offset
)
1015 struct rockchip_pin_bank
*bank
= gc_to_pin_bank(gc
);
1018 data
= readl(bank
->reg_base
+ GPIO_EXT_PORT
);
1025 * gpiolib gpio_direction_input callback function. The setting of the pin
1026 * mux function as 'gpio input' will be handled by the pinctrl susbsystem
1029 static int rockchip_gpio_direction_input(struct gpio_chip
*gc
, unsigned offset
)
1031 return pinctrl_gpio_direction_input(gc
->base
+ offset
);
1035 * gpiolib gpio_direction_output callback function. The setting of the pin
1036 * mux function as 'gpio output' will be handled by the pinctrl susbsystem
1039 static int rockchip_gpio_direction_output(struct gpio_chip
*gc
,
1040 unsigned offset
, int value
)
1042 rockchip_gpio_set(gc
, offset
, value
);
1043 return pinctrl_gpio_direction_output(gc
->base
+ offset
);
1047 * gpiolib gpio_to_irq callback function. Creates a mapping between a GPIO pin
1048 * and a virtual IRQ, if not already present.
1050 static int rockchip_gpio_to_irq(struct gpio_chip
*gc
, unsigned offset
)
1052 struct rockchip_pin_bank
*bank
= gc_to_pin_bank(gc
);
1058 virq
= irq_create_mapping(bank
->domain
, offset
);
1060 return (virq
) ? : -ENXIO
;
1063 static const struct gpio_chip rockchip_gpiolib_chip
= {
1064 .request
= rockchip_gpio_request
,
1065 .free
= rockchip_gpio_free
,
1066 .set
= rockchip_gpio_set
,
1067 .get
= rockchip_gpio_get
,
1068 .direction_input
= rockchip_gpio_direction_input
,
1069 .direction_output
= rockchip_gpio_direction_output
,
1070 .to_irq
= rockchip_gpio_to_irq
,
1071 .owner
= THIS_MODULE
,
1075 * Interrupt handling
1078 static void rockchip_irq_demux(unsigned int irq
, struct irq_desc
*desc
)
1080 struct irq_chip
*chip
= irq_get_chip(irq
);
1081 struct rockchip_pin_bank
*bank
= irq_get_handler_data(irq
);
1082 u32 polarity
= 0, data
= 0;
1084 bool edge_changed
= false;
1086 dev_dbg(bank
->drvdata
->dev
, "got irq for bank %s\n", bank
->name
);
1088 chained_irq_enter(chip
, desc
);
1090 pend
= readl_relaxed(bank
->reg_base
+ GPIO_INT_STATUS
);
1092 if (bank
->toggle_edge_mode
) {
1093 polarity
= readl_relaxed(bank
->reg_base
+
1095 data
= readl_relaxed(bank
->reg_base
+ GPIO_EXT_PORT
);
1103 virq
= irq_linear_revmap(bank
->domain
, irq
);
1106 dev_err(bank
->drvdata
->dev
, "unmapped irq %d\n", irq
);
1110 dev_dbg(bank
->drvdata
->dev
, "handling irq %d\n", irq
);
1113 * Triggering IRQ on both rising and falling edge
1114 * needs manual intervention.
1116 if (bank
->toggle_edge_mode
& BIT(irq
)) {
1117 if (data
& BIT(irq
))
1118 polarity
&= ~BIT(irq
);
1120 polarity
|= BIT(irq
);
1122 edge_changed
= true;
1125 generic_handle_irq(virq
);
1128 if (bank
->toggle_edge_mode
&& edge_changed
) {
1129 /* Interrupt params should only be set with ints disabled */
1130 data
= readl_relaxed(bank
->reg_base
+ GPIO_INTEN
);
1131 writel_relaxed(0, bank
->reg_base
+ GPIO_INTEN
);
1132 writel(polarity
, bank
->reg_base
+ GPIO_INT_POLARITY
);
1133 writel(data
, bank
->reg_base
+ GPIO_INTEN
);
1136 chained_irq_exit(chip
, desc
);
1139 static int rockchip_irq_set_type(struct irq_data
*d
, unsigned int type
)
1141 struct irq_chip_generic
*gc
= irq_data_get_irq_chip_data(d
);
1142 struct rockchip_pin_bank
*bank
= gc
->private;
1143 u32 mask
= BIT(d
->hwirq
);
1148 /* make sure the pin is configured as gpio input */
1149 rockchip_set_mux(bank
, d
->hwirq
, RK_FUNC_GPIO
);
1150 data
= readl_relaxed(bank
->reg_base
+ GPIO_SWPORT_DDR
);
1152 writel_relaxed(data
, bank
->reg_base
+ GPIO_SWPORT_DDR
);
1154 if (type
& IRQ_TYPE_EDGE_BOTH
)
1155 __irq_set_handler_locked(d
->irq
, handle_edge_irq
);
1157 __irq_set_handler_locked(d
->irq
, handle_level_irq
);
1161 level
= readl_relaxed(gc
->reg_base
+ GPIO_INTTYPE_LEVEL
);
1162 polarity
= readl_relaxed(gc
->reg_base
+ GPIO_INT_POLARITY
);
1165 case IRQ_TYPE_EDGE_BOTH
:
1166 bank
->toggle_edge_mode
|= mask
;
1170 * Determine gpio state. If 1 next interrupt should be falling
1173 data
= readl(bank
->reg_base
+ GPIO_EXT_PORT
);
1179 case IRQ_TYPE_EDGE_RISING
:
1180 bank
->toggle_edge_mode
&= ~mask
;
1184 case IRQ_TYPE_EDGE_FALLING
:
1185 bank
->toggle_edge_mode
&= ~mask
;
1189 case IRQ_TYPE_LEVEL_HIGH
:
1190 bank
->toggle_edge_mode
&= ~mask
;
1194 case IRQ_TYPE_LEVEL_LOW
:
1195 bank
->toggle_edge_mode
&= ~mask
;
1204 writel_relaxed(level
, gc
->reg_base
+ GPIO_INTTYPE_LEVEL
);
1205 writel_relaxed(polarity
, gc
->reg_base
+ GPIO_INT_POLARITY
);
1212 static int rockchip_interrupts_register(struct platform_device
*pdev
,
1213 struct rockchip_pinctrl
*info
)
1215 struct rockchip_pin_ctrl
*ctrl
= info
->ctrl
;
1216 struct rockchip_pin_bank
*bank
= ctrl
->pin_banks
;
1217 unsigned int clr
= IRQ_NOREQUEST
| IRQ_NOPROBE
| IRQ_NOAUTOEN
;
1218 struct irq_chip_generic
*gc
;
1222 for (i
= 0; i
< ctrl
->nr_banks
; ++i
, ++bank
) {
1224 dev_warn(&pdev
->dev
, "bank %s is not valid\n",
1229 bank
->domain
= irq_domain_add_linear(bank
->of_node
, 32,
1230 &irq_generic_chip_ops
, NULL
);
1231 if (!bank
->domain
) {
1232 dev_warn(&pdev
->dev
, "could not initialize irq domain for bank %s\n",
1237 ret
= irq_alloc_domain_generic_chips(bank
->domain
, 32, 1,
1238 "rockchip_gpio_irq", handle_level_irq
,
1239 clr
, 0, IRQ_GC_INIT_MASK_CACHE
);
1241 dev_err(&pdev
->dev
, "could not alloc generic chips for bank %s\n",
1243 irq_domain_remove(bank
->domain
);
1247 gc
= irq_get_domain_generic_chip(bank
->domain
, 0);
1248 gc
->reg_base
= bank
->reg_base
;
1250 gc
->chip_types
[0].regs
.mask
= GPIO_INTEN
;
1251 gc
->chip_types
[0].regs
.ack
= GPIO_PORTS_EOI
;
1252 gc
->chip_types
[0].chip
.irq_ack
= irq_gc_ack_set_bit
;
1253 gc
->chip_types
[0].chip
.irq_mask
= irq_gc_mask_clr_bit
;
1254 gc
->chip_types
[0].chip
.irq_unmask
= irq_gc_mask_set_bit
;
1255 gc
->chip_types
[0].chip
.irq_set_wake
= irq_gc_set_wake
;
1256 gc
->chip_types
[0].chip
.irq_set_type
= rockchip_irq_set_type
;
1258 irq_set_handler_data(bank
->irq
, bank
);
1259 irq_set_chained_handler(bank
->irq
, rockchip_irq_demux
);
1265 static int rockchip_gpiolib_register(struct platform_device
*pdev
,
1266 struct rockchip_pinctrl
*info
)
1268 struct rockchip_pin_ctrl
*ctrl
= info
->ctrl
;
1269 struct rockchip_pin_bank
*bank
= ctrl
->pin_banks
;
1270 struct gpio_chip
*gc
;
1274 for (i
= 0; i
< ctrl
->nr_banks
; ++i
, ++bank
) {
1276 dev_warn(&pdev
->dev
, "bank %s is not valid\n",
1281 bank
->gpio_chip
= rockchip_gpiolib_chip
;
1283 gc
= &bank
->gpio_chip
;
1284 gc
->base
= bank
->pin_base
;
1285 gc
->ngpio
= bank
->nr_pins
;
1286 gc
->dev
= &pdev
->dev
;
1287 gc
->of_node
= bank
->of_node
;
1288 gc
->label
= bank
->name
;
1290 ret
= gpiochip_add(gc
);
1292 dev_err(&pdev
->dev
, "failed to register gpio_chip %s, error code: %d\n",
1298 rockchip_interrupts_register(pdev
, info
);
1303 for (--i
, --bank
; i
>= 0; --i
, --bank
) {
1307 if (gpiochip_remove(&bank
->gpio_chip
))
1308 dev_err(&pdev
->dev
, "gpio chip %s remove failed\n",
1309 bank
->gpio_chip
.label
);
1314 static int rockchip_gpiolib_unregister(struct platform_device
*pdev
,
1315 struct rockchip_pinctrl
*info
)
1317 struct rockchip_pin_ctrl
*ctrl
= info
->ctrl
;
1318 struct rockchip_pin_bank
*bank
= ctrl
->pin_banks
;
1322 for (i
= 0; !ret
&& i
< ctrl
->nr_banks
; ++i
, ++bank
) {
1326 ret
= gpiochip_remove(&bank
->gpio_chip
);
1330 dev_err(&pdev
->dev
, "gpio chip remove failed\n");
1335 static int rockchip_get_bank_data(struct rockchip_pin_bank
*bank
,
1338 struct resource res
;
1340 if (of_address_to_resource(bank
->of_node
, 0, &res
)) {
1341 dev_err(dev
, "cannot find IO resource for bank\n");
1345 bank
->reg_base
= devm_ioremap_resource(dev
, &res
);
1346 if (IS_ERR(bank
->reg_base
))
1347 return PTR_ERR(bank
->reg_base
);
1350 * special case, where parts of the pull setting-registers are
1351 * part of the PMU register space
1353 if (of_device_is_compatible(bank
->of_node
,
1354 "rockchip,rk3188-gpio-bank0")) {
1355 bank
->bank_type
= RK3188_BANK0
;
1357 if (of_address_to_resource(bank
->of_node
, 1, &res
)) {
1358 dev_err(dev
, "cannot find IO resource for bank\n");
1362 bank
->reg_pull
= devm_ioremap_resource(dev
, &res
);
1363 if (IS_ERR(bank
->reg_pull
))
1364 return PTR_ERR(bank
->reg_pull
);
1366 bank
->bank_type
= COMMON_BANK
;
1369 bank
->irq
= irq_of_parse_and_map(bank
->of_node
, 0);
1371 bank
->clk
= of_clk_get(bank
->of_node
, 0);
1372 if (IS_ERR(bank
->clk
))
1373 return PTR_ERR(bank
->clk
);
1375 return clk_prepare_enable(bank
->clk
);
1378 static const struct of_device_id rockchip_pinctrl_dt_match
[];
1380 /* retrieve the soc specific data */
1381 static struct rockchip_pin_ctrl
*rockchip_pinctrl_get_soc_data(
1382 struct rockchip_pinctrl
*d
,
1383 struct platform_device
*pdev
)
1385 const struct of_device_id
*match
;
1386 struct device_node
*node
= pdev
->dev
.of_node
;
1387 struct device_node
*np
;
1388 struct rockchip_pin_ctrl
*ctrl
;
1389 struct rockchip_pin_bank
*bank
;
1392 match
= of_match_node(rockchip_pinctrl_dt_match
, node
);
1393 ctrl
= (struct rockchip_pin_ctrl
*)match
->data
;
1395 for_each_child_of_node(node
, np
) {
1396 if (!of_find_property(np
, "gpio-controller", NULL
))
1399 bank
= ctrl
->pin_banks
;
1400 for (i
= 0; i
< ctrl
->nr_banks
; ++i
, ++bank
) {
1401 if (!strcmp(bank
->name
, np
->name
)) {
1404 if (!rockchip_get_bank_data(bank
, &pdev
->dev
))
1412 bank
= ctrl
->pin_banks
;
1413 for (i
= 0; i
< ctrl
->nr_banks
; ++i
, ++bank
) {
1414 spin_lock_init(&bank
->slock
);
1416 bank
->pin_base
= ctrl
->nr_pins
;
1417 ctrl
->nr_pins
+= bank
->nr_pins
;
1423 static int rockchip_pinctrl_probe(struct platform_device
*pdev
)
1425 struct rockchip_pinctrl
*info
;
1426 struct device
*dev
= &pdev
->dev
;
1427 struct rockchip_pin_ctrl
*ctrl
;
1428 struct resource
*res
;
1431 if (!dev
->of_node
) {
1432 dev_err(dev
, "device tree node not found\n");
1436 info
= devm_kzalloc(dev
, sizeof(struct rockchip_pinctrl
), GFP_KERNEL
);
1440 ctrl
= rockchip_pinctrl_get_soc_data(info
, pdev
);
1442 dev_err(dev
, "driver data not available\n");
1448 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
1449 info
->reg_base
= devm_ioremap_resource(&pdev
->dev
, res
);
1450 if (IS_ERR(info
->reg_base
))
1451 return PTR_ERR(info
->reg_base
);
1453 /* The RK3188 has its pull registers in a separate place */
1454 if (ctrl
->type
== RK3188
) {
1455 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 1);
1456 info
->reg_pull
= devm_ioremap_resource(&pdev
->dev
, res
);
1457 if (IS_ERR(info
->reg_pull
))
1458 return PTR_ERR(info
->reg_pull
);
1461 ret
= rockchip_gpiolib_register(pdev
, info
);
1465 ret
= rockchip_pinctrl_register(pdev
, info
);
1467 rockchip_gpiolib_unregister(pdev
, info
);
1471 platform_set_drvdata(pdev
, info
);
1476 static struct rockchip_pin_bank rk2928_pin_banks
[] = {
1477 PIN_BANK(0, 32, "gpio0"),
1478 PIN_BANK(1, 32, "gpio1"),
1479 PIN_BANK(2, 32, "gpio2"),
1480 PIN_BANK(3, 32, "gpio3"),
1483 static struct rockchip_pin_ctrl rk2928_pin_ctrl
= {
1484 .pin_banks
= rk2928_pin_banks
,
1485 .nr_banks
= ARRAY_SIZE(rk2928_pin_banks
),
1486 .label
= "RK2928-GPIO",
1489 .pull_calc_reg
= rk2928_calc_pull_reg_and_bit
,
1492 static struct rockchip_pin_bank rk3066a_pin_banks
[] = {
1493 PIN_BANK(0, 32, "gpio0"),
1494 PIN_BANK(1, 32, "gpio1"),
1495 PIN_BANK(2, 32, "gpio2"),
1496 PIN_BANK(3, 32, "gpio3"),
1497 PIN_BANK(4, 32, "gpio4"),
1498 PIN_BANK(6, 16, "gpio6"),
1501 static struct rockchip_pin_ctrl rk3066a_pin_ctrl
= {
1502 .pin_banks
= rk3066a_pin_banks
,
1503 .nr_banks
= ARRAY_SIZE(rk3066a_pin_banks
),
1504 .label
= "RK3066a-GPIO",
1507 .pull_calc_reg
= rk2928_calc_pull_reg_and_bit
,
1510 static struct rockchip_pin_bank rk3066b_pin_banks
[] = {
1511 PIN_BANK(0, 32, "gpio0"),
1512 PIN_BANK(1, 32, "gpio1"),
1513 PIN_BANK(2, 32, "gpio2"),
1514 PIN_BANK(3, 32, "gpio3"),
1517 static struct rockchip_pin_ctrl rk3066b_pin_ctrl
= {
1518 .pin_banks
= rk3066b_pin_banks
,
1519 .nr_banks
= ARRAY_SIZE(rk3066b_pin_banks
),
1520 .label
= "RK3066b-GPIO",
1525 static struct rockchip_pin_bank rk3188_pin_banks
[] = {
1526 PIN_BANK(0, 32, "gpio0"),
1527 PIN_BANK(1, 32, "gpio1"),
1528 PIN_BANK(2, 32, "gpio2"),
1529 PIN_BANK(3, 32, "gpio3"),
1532 static struct rockchip_pin_ctrl rk3188_pin_ctrl
= {
1533 .pin_banks
= rk3188_pin_banks
,
1534 .nr_banks
= ARRAY_SIZE(rk3188_pin_banks
),
1535 .label
= "RK3188-GPIO",
1538 .pull_calc_reg
= rk3188_calc_pull_reg_and_bit
,
1541 static const struct of_device_id rockchip_pinctrl_dt_match
[] = {
1542 { .compatible
= "rockchip,rk2928-pinctrl",
1543 .data
= (void *)&rk2928_pin_ctrl
},
1544 { .compatible
= "rockchip,rk3066a-pinctrl",
1545 .data
= (void *)&rk3066a_pin_ctrl
},
1546 { .compatible
= "rockchip,rk3066b-pinctrl",
1547 .data
= (void *)&rk3066b_pin_ctrl
},
1548 { .compatible
= "rockchip,rk3188-pinctrl",
1549 .data
= (void *)&rk3188_pin_ctrl
},
1552 MODULE_DEVICE_TABLE(of
, rockchip_pinctrl_dt_match
);
1554 static struct platform_driver rockchip_pinctrl_driver
= {
1555 .probe
= rockchip_pinctrl_probe
,
1557 .name
= "rockchip-pinctrl",
1558 .owner
= THIS_MODULE
,
1559 .of_match_table
= rockchip_pinctrl_dt_match
,
1563 static int __init
rockchip_pinctrl_drv_register(void)
1565 return platform_driver_register(&rockchip_pinctrl_driver
);
1567 postcore_initcall(rockchip_pinctrl_drv_register
);
1569 MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>");
1570 MODULE_DESCRIPTION("Rockchip pinctrl driver");
1571 MODULE_LICENSE("GPL v2");