2 * linux/drivers/pinctrl/pinctrl-lantiq.h
3 * based on linux/drivers/pinctrl/pinctrl-pxa3xx.h
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
9 * Copyright (C) 2012 John Crispin <blogic@openwrt.org>
12 #ifndef __PINCTRL_LANTIQ_H
14 #include <linux/clkdev.h>
15 #include <linux/pinctrl/pinctrl.h>
16 #include <linux/pinctrl/pinconf.h>
17 #include <linux/pinctrl/pinmux.h>
18 #include <linux/pinctrl/consumer.h>
19 #include <linux/pinctrl/machine.h>
23 #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
26 #define MFPR_FUNC_MASK 0x3
28 #define LTQ_PINCONF_PACK(param, arg) ((param) << 16 | (arg))
29 #define LTQ_PINCONF_UNPACK_PARAM(conf) ((conf) >> 16)
30 #define LTQ_PINCONF_UNPACK_ARG(conf) ((conf) & 0xffff)
32 enum ltq_pinconf_param
{
33 LTQ_PINCONF_PARAM_PULL
,
34 LTQ_PINCONF_PARAM_OPEN_DRAIN
,
35 LTQ_PINCONF_PARAM_DRIVE_CURRENT
,
36 LTQ_PINCONF_PARAM_SLEW_RATE
,
37 LTQ_PINCONF_PARAM_OUTPUT
,
40 struct ltq_cfg_param
{
42 enum ltq_pinconf_param param
;
47 const unsigned int pin
;
48 const unsigned short func
[LTQ_MAX_MUX
];
51 struct ltq_pin_group
{
60 const char * const *groups
;
61 const unsigned num_groups
;
64 struct ltq_pinmux_info
{
66 struct pinctrl_dev
*pctrl
;
68 /* we need to manage up to 5 pad controllers */
69 void __iomem
*membase
[5];
71 /* the descriptor for the subsystem */
72 struct pinctrl_desc
*desc
;
74 /* we expose our pads to the subsystem */
75 struct pinctrl_pin_desc
*pads
;
77 /* the number of pads. this varies between socs */
78 unsigned int num_pads
;
80 /* these are our multifunction pins */
81 const struct ltq_mfp_pin
*mfp
;
84 /* a number of multifunction pins can be grouped together */
85 const struct ltq_pin_group
*grps
;
86 unsigned int num_grps
;
88 /* a mapping between function string and id */
89 const struct ltq_pmx_func
*funcs
;
90 unsigned int num_funcs
;
92 /* the pinconf options that we are able to read from the DT */
93 const struct ltq_cfg_param
*params
;
94 unsigned int num_params
;
96 /* the pad controller can have a irq mapping */
98 unsigned int num_exin
;
100 /* we need 5 clocks max */
103 /* soc specific callback used to apply muxing */
104 int (*apply_mux
)(struct pinctrl_dev
*pctrldev
, int pin
, int mux
);
192 extern int ltq_pinctrl_register(struct platform_device
*pdev
,
193 struct ltq_pinmux_info
*info
);
194 extern int ltq_pinctrl_unregister(struct platform_device
*pdev
);
195 #endif /* __PINCTRL_PXA3XX_H */