Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pinctrl-samsung.h
Go to the documentation of this file.
1 /*
2  * pin-controller/pin-mux/pin-config/gpio-driver for Samsung's SoC's.
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 <[email protected]>
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 
17 #ifndef __PINCTRL_SAMSUNG_H
18 #define __PINCTRL_SAMSUNG_H
19 
20 #include <linux/pinctrl/pinctrl.h>
21 #include <linux/pinctrl/pinmux.h>
22 #include <linux/pinctrl/pinconf.h>
23 #include <linux/pinctrl/consumer.h>
24 #include <linux/pinctrl/machine.h>
25 
26 /* register offsets within a pin bank */
27 #define DAT_REG 0x4
28 #define PUD_REG 0x8
29 #define DRV_REG 0xC
30 #define CONPDN_REG 0x10
31 #define PUDPDN_REG 0x14
32 
33 /* pinmux function number for pin as gpio output line */
34 #define FUNC_OUTPUT 0x1
35 
48 };
49 
50 /*
51  * pin configuration (pull up/down and drive strength) type and its value are
52  * packed together into a 16-bits. The upper 8-bits represent the configuration
53  * type and the lower 8-bits hold the value of the configuration type.
54  */
55 #define PINCFG_TYPE_MASK 0xFF
56 #define PINCFG_VALUE_SHIFT 8
57 #define PINCFG_VALUE_MASK (0xFF << PINCFG_VALUE_SHIFT)
58 #define PINCFG_PACK(type, value) (((value) << PINCFG_VALUE_SHIFT) | type)
59 #define PINCFG_UNPACK_TYPE(cfg) ((cfg) & PINCFG_TYPE_MASK)
60 #define PINCFG_UNPACK_VALUE(cfg) (((cfg) & PINCFG_VALUE_MASK) >> \
61  PINCFG_VALUE_SHIFT)
62 
75 enum eint_type {
79 };
80 
81 /* maximum length of a pin in pin descriptor (example: "gpa0-0") */
82 #define PIN_NAME_LENGTH 10
83 
84 #define PIN_GROUP(n, p, f) \
85  { \
86  .name = n, \
87  .pins = p, \
88  .num_pins = ARRAY_SIZE(p), \
89  .func = f \
90  }
91 
92 #define PMX_FUNC(n, g) \
93  { \
94  .name = n, \
95  .groups = g, \
96  .num_groups = ARRAY_SIZE(g), \
97  }
98 
100 
126  char *name;
127 };
128 
153 
158 
162 
166 
168 
171  char *label;
172 };
173 
191  struct device *dev;
192  int irq;
193 
195  struct pinctrl_desc pctl;
197 
199  unsigned int nr_groups;
201  unsigned int nr_functions;
202 
205 
206  struct gpio_chip *gc;
207  struct pinctrl_gpio_range grange;
208 };
209 
218  const char *name;
219  const unsigned int *pins;
222 };
223 
231  const char *name;
232  const char **groups;
234 };
235 
236 /* list of all exported SoC specific data */
237 extern struct samsung_pin_ctrl exynos4210_pin_ctrl[];
238 
239 #endif /* __PINCTRL_SAMSUNG_H */