pinctrl-meson.h (277d14eb815fdfb95a72ea126bc09f75a2bd58fd) pinctrl-meson.h (ce385aa24a0dcccdc81dfcbc90cf7aa290d8b758)
1/*
2 * Pin controller and GPIO driver for Amlogic Meson SoCs
3 *
4 * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.

--- 18 unchanged lines hidden (view full) ---

27 * @reg: register offset for the group in the domain mux registers
28 * @bit bit index enabling the group
29 * @domain: index of the domain this group belongs to
30 */
31struct meson_pmx_group {
32 const char *name;
33 const unsigned int *pins;
34 unsigned int num_pins;
1/*
2 * Pin controller and GPIO driver for Amlogic Meson SoCs
3 *
4 * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.

--- 18 unchanged lines hidden (view full) ---

27 * @reg: register offset for the group in the domain mux registers
28 * @bit bit index enabling the group
29 * @domain: index of the domain this group belongs to
30 */
31struct meson_pmx_group {
32 const char *name;
33 const unsigned int *pins;
34 unsigned int num_pins;
35 bool is_gpio;
36 unsigned int reg;
37 unsigned int bit;
35 const void *data;
38};
39
40/**
41 * struct meson_pmx_func - a pinmux function
42 *
43 * @name: function name
44 * @groups: groups in the function
45 * @num_groups: number of groups in the function

--- 58 unchanged lines hidden (view full) ---

104 const struct pinctrl_pin_desc *pins;
105 struct meson_pmx_group *groups;
106 struct meson_pmx_func *funcs;
107 unsigned int num_pins;
108 unsigned int num_groups;
109 unsigned int num_funcs;
110 struct meson_bank *banks;
111 unsigned int num_banks;
36};
37
38/**
39 * struct meson_pmx_func - a pinmux function
40 *
41 * @name: function name
42 * @groups: groups in the function
43 * @num_groups: number of groups in the function

--- 58 unchanged lines hidden (view full) ---

102 const struct pinctrl_pin_desc *pins;
103 struct meson_pmx_group *groups;
104 struct meson_pmx_func *funcs;
105 unsigned int num_pins;
106 unsigned int num_groups;
107 unsigned int num_funcs;
108 struct meson_bank *banks;
109 unsigned int num_banks;
110 const struct pinmux_ops *pmx_ops;
112};
113
114struct meson_pinctrl {
115 struct device *dev;
116 struct pinctrl_dev *pcdev;
117 struct pinctrl_desc desc;
118 struct meson_pinctrl_data *data;
119 struct regmap *reg_mux;
120 struct regmap *reg_pullen;
121 struct regmap *reg_pull;
122 struct regmap *reg_gpio;
123 struct gpio_chip chip;
124 struct device_node *of_node;
125};
126
111};
112
113struct meson_pinctrl {
114 struct device *dev;
115 struct pinctrl_dev *pcdev;
116 struct pinctrl_desc desc;
117 struct meson_pinctrl_data *data;
118 struct regmap *reg_mux;
119 struct regmap *reg_pullen;
120 struct regmap *reg_pull;
121 struct regmap *reg_gpio;
122 struct gpio_chip chip;
123 struct device_node *of_node;
124};
125
127#define GROUP(grp, r, b) \
128 { \
129 .name = #grp, \
130 .pins = grp ## _pins, \
131 .num_pins = ARRAY_SIZE(grp ## _pins), \
132 .reg = r, \
133 .bit = b, \
134 }
135
136#define GPIO_GROUP(gpio) \
137 { \
138 .name = #gpio, \
139 .pins = (const unsigned int[]){ gpio }, \
140 .num_pins = 1, \
141 .is_gpio = true, \
142 }
143
144#define FUNCTION(fn) \
145 { \
146 .name = #fn, \
147 .groups = fn ## _groups, \
148 .num_groups = ARRAY_SIZE(fn ## _groups), \
149 }
150
151#define BANK(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib) \

--- 9 unchanged lines hidden (view full) ---

161 [REG_DIR] = { dr, db }, \
162 [REG_OUT] = { or, ob }, \
163 [REG_IN] = { ir, ib }, \
164 }, \
165 }
166
167#define MESON_PIN(x) PINCTRL_PIN(x, #x)
168
126#define FUNCTION(fn) \
127 { \
128 .name = #fn, \
129 .groups = fn ## _groups, \
130 .num_groups = ARRAY_SIZE(fn ## _groups), \
131 }
132
133#define BANK(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib) \

--- 9 unchanged lines hidden (view full) ---

143 [REG_DIR] = { dr, db }, \
144 [REG_OUT] = { or, ob }, \
145 [REG_IN] = { ir, ib }, \
146 }, \
147 }
148
149#define MESON_PIN(x) PINCTRL_PIN(x, #x)
150
151/* Common pmx functions */
152int meson_pmx_get_funcs_count(struct pinctrl_dev *pcdev);
153const char *meson_pmx_get_func_name(struct pinctrl_dev *pcdev,
154 unsigned selector);
155int meson_pmx_get_groups(struct pinctrl_dev *pcdev,
156 unsigned selector,
157 const char * const **groups,
158 unsigned * const num_groups);
159
169/* Common probe function */
170int meson_pinctrl_probe(struct platform_device *pdev);
160/* Common probe function */
161int meson_pinctrl_probe(struct platform_device *pdev);