Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pinctrl-lantiq.h
Go to the documentation of this file.
1 /*
2  * linux/drivers/pinctrl/pinctrl-lantiq.h
3  * based on linux/drivers/pinctrl/pinctrl-pxa3xx.h
4  *
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.
8  *
9  * Copyright (C) 2012 John Crispin <[email protected]>
10  */
11 
12 #ifndef __PINCTRL_LANTIQ_H
13 
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>
20 
21 #include "core.h"
22 
23 #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
24 
25 #define LTQ_MAX_MUX 4
26 #define MFPR_FUNC_MASK 0x3
27 
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)
31 
37 };
38 
39 struct ltq_cfg_param {
40  const char *property;
42 };
43 
44 struct ltq_mfp_pin {
45  const char *name;
46  const unsigned int pin;
47  const unsigned short func[LTQ_MAX_MUX];
48 };
49 
50 struct ltq_pin_group {
51  const char *name;
52  const unsigned mux;
53  const unsigned *pins;
54  const unsigned npins;
55 };
56 
57 struct ltq_pmx_func {
58  const char *name;
59  const char * const *groups;
60  const unsigned num_groups;
61 };
62 
64  struct device *dev;
65  struct pinctrl_dev *pctrl;
66 
67  /* we need to manage up to 5 pad controllers */
68  void __iomem *membase[5];
69 
70  /* the descriptor for the subsystem */
71  struct pinctrl_desc *desc;
72 
73  /* we expose our pads to the subsystem */
74  struct pinctrl_pin_desc *pads;
75 
76  /* the number of pads. this varies between socs */
77  unsigned int num_pads;
78 
79  /* these are our multifunction pins */
80  const struct ltq_mfp_pin *mfp;
81  unsigned int num_mfp;
82 
83  /* a number of multifunction pins can be grouped together */
84  const struct ltq_pin_group *grps;
85  unsigned int num_grps;
86 
87  /* a mapping between function string and id */
88  const struct ltq_pmx_func *funcs;
89  unsigned int num_funcs;
90 
91  /* the pinconf options that we are able to read from the DT */
92  const struct ltq_cfg_param *params;
93  unsigned int num_params;
94 
95  /* the pad controller can have a irq mapping */
96  const unsigned *exin;
97  unsigned int num_exin;
98 
99  /* we need 5 clocks max */
100  struct clk *clk[5];
101 
102  /* soc specific callback used to apply muxing */
103  int (*apply_mux)(struct pinctrl_dev *pctrldev, int pin, int mux);
104 };
105 
106 enum ltq_pin {
107  GPIO0 = 0,
117  GPIO10, /* 10 */
127  GPIO20, /* 20 */
137  GPIO30, /* 30 */
147  GPIO40, /* 40 */
157  GPIO50, /* 50 */
163 
189 };
190 
191 extern int ltq_pinctrl_register(struct platform_device *pdev,
192  struct ltq_pinmux_info *info);
193 extern int ltq_pinctrl_unregister(struct platform_device *pdev);
194 #endif /* __PINCTRL_PXA3XX_H */