blob: c9e9a1d9523026f61ba4d61495c3b9d8d57c696d [file] [log] [blame]
Paul Mundtca5481c62012-07-10 12:08:14 +09001/*
2 * SuperH Pin Function Controller pinmux support.
3 *
4 * Copyright (C) 2012 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
Paul Mundt54407112012-07-20 16:18:21 +090010
Laurent Pinchartc6193ea2012-12-15 23:50:47 +010011#define DRV_NAME "sh-pfc"
Laurent Pinchartf9492fd2012-12-15 23:50:45 +010012#define pr_fmt(fmt) KBUILD_MODNAME " pinctrl: " fmt
Paul Mundtca5481c62012-07-10 12:08:14 +090013
Laurent Pinchart1724acf2012-12-15 23:50:48 +010014#include <linux/device.h>
Laurent Pinchart90efde22012-12-15 23:50:52 +010015#include <linux/err.h>
Paul Mundtca5481c62012-07-10 12:08:14 +090016#include <linux/init.h>
17#include <linux/module.h>
Laurent Pinchart90efde22012-12-15 23:50:52 +010018#include <linux/pinctrl/consumer.h>
19#include <linux/pinctrl/pinconf.h>
20#include <linux/pinctrl/pinconf-generic.h>
21#include <linux/pinctrl/pinctrl.h>
22#include <linux/pinctrl/pinmux.h>
Paul Mundtca5481c62012-07-10 12:08:14 +090023#include <linux/slab.h>
Paul Mundtd93a8912012-07-11 17:17:10 +090024#include <linux/spinlock.h>
Paul Mundtca5481c62012-07-10 12:08:14 +090025
Laurent Pinchartf9165132012-12-15 23:50:44 +010026#include "core.h"
27
Paul Mundtca5481c62012-07-10 12:08:14 +090028struct sh_pfc_pinctrl {
29 struct pinctrl_dev *pctl;
Laurent Pinchartdcc427e2013-02-16 16:38:30 +010030 struct pinctrl_desc pctl_desc;
Laurent Pinchartdcc427e2013-02-16 16:38:30 +010031
Paul Mundtca5481c62012-07-10 12:08:14 +090032 struct sh_pfc *pfc;
33
Laurent Pincharta373ed02012-11-29 13:24:07 +010034 struct pinmux_func **functions;
Paul Mundtd93a8912012-07-11 17:17:10 +090035 unsigned int nr_functions;
36
Paul Mundtca5481c62012-07-10 12:08:14 +090037 struct pinctrl_pin_desc *pads;
38 unsigned int nr_pads;
39};
40
Paul Mundte3f805e2012-07-17 15:48:18 +090041static int sh_pfc_get_groups_count(struct pinctrl_dev *pctldev)
Paul Mundtca5481c62012-07-10 12:08:14 +090042{
Paul Mundte3f805e2012-07-17 15:48:18 +090043 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
44
45 return pmx->nr_pads;
Paul Mundtca5481c62012-07-10 12:08:14 +090046}
47
Paul Mundte3f805e2012-07-17 15:48:18 +090048static const char *sh_pfc_get_group_name(struct pinctrl_dev *pctldev,
Paul Mundtca5481c62012-07-10 12:08:14 +090049 unsigned selector)
50{
Paul Mundte3f805e2012-07-17 15:48:18 +090051 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
52
53 return pmx->pads[selector].name;
Paul Mundtca5481c62012-07-10 12:08:14 +090054}
55
56static int sh_pfc_get_group_pins(struct pinctrl_dev *pctldev, unsigned group,
57 const unsigned **pins, unsigned *num_pins)
58{
Paul Mundte3f805e2012-07-17 15:48:18 +090059 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
60
61 *pins = &pmx->pads[group].number;
62 *num_pins = 1;
63
64 return 0;
Paul Mundtca5481c62012-07-10 12:08:14 +090065}
66
Paul Mundtfdd85ec2012-07-20 16:39:09 +090067static void sh_pfc_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
68 unsigned offset)
69{
70 seq_printf(s, "%s", DRV_NAME);
71}
72
Laurent Pinchartfe330ce2013-02-15 16:04:47 +010073static const struct pinctrl_ops sh_pfc_pinctrl_ops = {
Paul Mundte3f805e2012-07-17 15:48:18 +090074 .get_groups_count = sh_pfc_get_groups_count,
75 .get_group_name = sh_pfc_get_group_name,
Paul Mundtca5481c62012-07-10 12:08:14 +090076 .get_group_pins = sh_pfc_get_group_pins,
Paul Mundtfdd85ec2012-07-20 16:39:09 +090077 .pin_dbg_show = sh_pfc_pin_dbg_show,
Paul Mundtca5481c62012-07-10 12:08:14 +090078};
79
Paul Mundtd93a8912012-07-11 17:17:10 +090080static int sh_pfc_get_functions_count(struct pinctrl_dev *pctldev)
81{
82 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
Paul Mundtca5481c62012-07-10 12:08:14 +090083
Paul Mundtd93a8912012-07-11 17:17:10 +090084 return pmx->nr_functions;
85}
86
87static const char *sh_pfc_get_function_name(struct pinctrl_dev *pctldev,
88 unsigned selector)
89{
90 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
91
92 return pmx->functions[selector]->name;
93}
94
Paul Mundtca5481c62012-07-10 12:08:14 +090095static int sh_pfc_get_function_groups(struct pinctrl_dev *pctldev, unsigned func,
96 const char * const **groups,
97 unsigned * const num_groups)
98{
Paul Mundtd93a8912012-07-11 17:17:10 +090099 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
100
101 *groups = &pmx->functions[func]->name;
102 *num_groups = 1;
103
Paul Mundtca5481c62012-07-10 12:08:14 +0900104 return 0;
105}
106
107static int sh_pfc_noop_enable(struct pinctrl_dev *pctldev, unsigned func,
108 unsigned group)
109{
110 return 0;
111}
112
113static void sh_pfc_noop_disable(struct pinctrl_dev *pctldev, unsigned func,
114 unsigned group)
115{
116}
117
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900118static int sh_pfc_reconfig_pin(struct sh_pfc *pfc, unsigned offset,
119 int new_type)
120{
Laurent Pinchart934cb022013-02-14 22:35:09 +0100121 struct sh_pfc_pin *pin = sh_pfc_get_pin(pfc, offset);
122 unsigned int mark = pin->enum_id;
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900123 unsigned long flags;
124 int pinmux_type;
125 int ret = -EINVAL;
126
127 spin_lock_irqsave(&pfc->lock, flags);
128
Laurent Pinchart934cb022013-02-14 22:35:09 +0100129 pinmux_type = pin->flags & PINMUX_FLAG_TYPE;
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900130
131 /*
132 * See if the present config needs to first be de-configured.
133 */
134 switch (pinmux_type) {
135 case PINMUX_TYPE_GPIO:
136 break;
137 case PINMUX_TYPE_OUTPUT:
138 case PINMUX_TYPE_INPUT:
139 case PINMUX_TYPE_INPUT_PULLUP:
140 case PINMUX_TYPE_INPUT_PULLDOWN:
Laurent Pincharta68fdca92013-02-14 17:36:56 +0100141 sh_pfc_config_mux(pfc, mark, pinmux_type, GPIO_CFG_FREE);
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900142 break;
143 default:
144 goto err;
145 }
146
147 /*
148 * Dry run
149 */
Laurent Pincharta68fdca92013-02-14 17:36:56 +0100150 if (sh_pfc_config_mux(pfc, mark, new_type, GPIO_CFG_DRYRUN) != 0)
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900151 goto err;
152
153 /*
154 * Request
155 */
Laurent Pincharta68fdca92013-02-14 17:36:56 +0100156 if (sh_pfc_config_mux(pfc, mark, new_type, GPIO_CFG_REQ) != 0)
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900157 goto err;
158
Laurent Pinchart934cb022013-02-14 22:35:09 +0100159 pin->flags &= ~PINMUX_FLAG_TYPE;
160 pin->flags |= new_type;
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900161
162 ret = 0;
163
164err:
165 spin_unlock_irqrestore(&pfc->lock, flags);
166
167 return ret;
168}
169
Paul Mundtca5481c62012-07-10 12:08:14 +0900170static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
171 struct pinctrl_gpio_range *range,
172 unsigned offset)
173{
174 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
175 struct sh_pfc *pfc = pmx->pfc;
Laurent Pinchart934cb022013-02-14 22:35:09 +0100176 struct sh_pfc_pin *pin = sh_pfc_get_pin(pfc, offset);
Paul Mundtca5481c62012-07-10 12:08:14 +0900177 unsigned long flags;
Paul Mundtd93a8912012-07-11 17:17:10 +0900178 int ret, pinmux_type;
Paul Mundtca5481c62012-07-10 12:08:14 +0900179
180 spin_lock_irqsave(&pfc->lock, flags);
181
Laurent Pinchart934cb022013-02-14 22:35:09 +0100182 pinmux_type = pin->flags & PINMUX_FLAG_TYPE;
Paul Mundtca5481c62012-07-10 12:08:14 +0900183
Paul Mundtd93a8912012-07-11 17:17:10 +0900184 switch (pinmux_type) {
Paul Mundtd93a8912012-07-11 17:17:10 +0900185 case PINMUX_TYPE_GPIO:
Paul Mundt16d74eb2012-09-25 11:51:05 +0900186 case PINMUX_TYPE_INPUT:
187 case PINMUX_TYPE_OUTPUT:
Paul Mundtd93a8912012-07-11 17:17:10 +0900188 break;
Laurent Pinchart2119f7c2012-11-29 13:03:53 +0100189 case PINMUX_TYPE_FUNCTION:
Paul Mundtd93a8912012-07-11 17:17:10 +0900190 default:
191 pr_err("Unsupported mux type (%d), bailing...\n", pinmux_type);
Laurent Pinchart077664a2012-09-14 20:25:48 +0200192 ret = -ENOTSUPP;
193 goto err;
Paul Mundtd93a8912012-07-11 17:17:10 +0900194 }
Paul Mundtca5481c62012-07-10 12:08:14 +0900195
196 ret = 0;
197
198err:
199 spin_unlock_irqrestore(&pfc->lock, flags);
200
201 return ret;
202}
203
204static void sh_pfc_gpio_disable_free(struct pinctrl_dev *pctldev,
205 struct pinctrl_gpio_range *range,
206 unsigned offset)
207{
208 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
209 struct sh_pfc *pfc = pmx->pfc;
Laurent Pinchart934cb022013-02-14 22:35:09 +0100210 struct sh_pfc_pin *pin = sh_pfc_get_pin(pfc, offset);
Paul Mundtca5481c62012-07-10 12:08:14 +0900211 unsigned long flags;
212 int pinmux_type;
213
214 spin_lock_irqsave(&pfc->lock, flags);
215
Laurent Pinchart934cb022013-02-14 22:35:09 +0100216 pinmux_type = pin->flags & PINMUX_FLAG_TYPE;
Paul Mundtca5481c62012-07-10 12:08:14 +0900217
Laurent Pinchart934cb022013-02-14 22:35:09 +0100218 sh_pfc_config_mux(pfc, pin->enum_id, pinmux_type, GPIO_CFG_FREE);
Paul Mundtca5481c62012-07-10 12:08:14 +0900219
Paul Mundtca5481c62012-07-10 12:08:14 +0900220 spin_unlock_irqrestore(&pfc->lock, flags);
221}
222
223static int sh_pfc_gpio_set_direction(struct pinctrl_dev *pctldev,
224 struct pinctrl_gpio_range *range,
225 unsigned offset, bool input)
226{
227 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900228 int type = input ? PINMUX_TYPE_INPUT : PINMUX_TYPE_OUTPUT;
Paul Mundtca5481c62012-07-10 12:08:14 +0900229
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900230 return sh_pfc_reconfig_pin(pmx->pfc, offset, type);
Paul Mundtca5481c62012-07-10 12:08:14 +0900231}
232
Laurent Pinchartfe330ce2013-02-15 16:04:47 +0100233static const struct pinmux_ops sh_pfc_pinmux_ops = {
Paul Mundtd93a8912012-07-11 17:17:10 +0900234 .get_functions_count = sh_pfc_get_functions_count,
235 .get_function_name = sh_pfc_get_function_name,
Paul Mundtca5481c62012-07-10 12:08:14 +0900236 .get_function_groups = sh_pfc_get_function_groups,
237 .enable = sh_pfc_noop_enable,
238 .disable = sh_pfc_noop_disable,
239 .gpio_request_enable = sh_pfc_gpio_request_enable,
240 .gpio_disable_free = sh_pfc_gpio_disable_free,
241 .gpio_set_direction = sh_pfc_gpio_set_direction,
242};
243
Laurent Pinchart934cb022013-02-14 22:35:09 +0100244static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned _pin,
Paul Mundtca5481c62012-07-10 12:08:14 +0900245 unsigned long *config)
246{
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900247 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
248 struct sh_pfc *pfc = pmx->pfc;
Laurent Pinchart934cb022013-02-14 22:35:09 +0100249 struct sh_pfc_pin *pin = sh_pfc_get_pin(pfc, _pin);
Paul Mundtd93a8912012-07-11 17:17:10 +0900250
Laurent Pinchart934cb022013-02-14 22:35:09 +0100251 *config = pin->flags & PINMUX_FLAG_TYPE;
Paul Mundtd93a8912012-07-11 17:17:10 +0900252
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900253 return 0;
Paul Mundtca5481c62012-07-10 12:08:14 +0900254}
255
256static int sh_pfc_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin,
257 unsigned long config)
258{
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900259 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900260
261 /* Validate the new type */
262 if (config >= PINMUX_FLAG_TYPE)
263 return -EINVAL;
264
265 return sh_pfc_reconfig_pin(pmx->pfc, pin, config);
266}
267
268static void sh_pfc_pinconf_dbg_show(struct pinctrl_dev *pctldev,
269 struct seq_file *s, unsigned pin)
270{
271 const char *pinmux_type_str[] = {
272 [PINMUX_TYPE_NONE] = "none",
273 [PINMUX_TYPE_FUNCTION] = "function",
274 [PINMUX_TYPE_GPIO] = "gpio",
275 [PINMUX_TYPE_OUTPUT] = "output",
276 [PINMUX_TYPE_INPUT] = "input",
277 [PINMUX_TYPE_INPUT_PULLUP] = "input bias pull up",
278 [PINMUX_TYPE_INPUT_PULLDOWN] = "input bias pull down",
279 };
280 unsigned long config;
281 int rc;
282
283 rc = sh_pfc_pinconf_get(pctldev, pin, &config);
284 if (unlikely(rc != 0))
285 return;
286
287 seq_printf(s, " %s", pinmux_type_str[config]);
Paul Mundtca5481c62012-07-10 12:08:14 +0900288}
289
Laurent Pinchartfe330ce2013-02-15 16:04:47 +0100290static const struct pinconf_ops sh_pfc_pinconf_ops = {
Paul Mundtca5481c62012-07-10 12:08:14 +0900291 .pin_config_get = sh_pfc_pinconf_get,
292 .pin_config_set = sh_pfc_pinconf_set,
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900293 .pin_config_dbg_show = sh_pfc_pinconf_dbg_show,
Paul Mundtca5481c62012-07-10 12:08:14 +0900294};
295
Laurent Pinchart63d57382013-02-15 01:33:38 +0100296/* PFC ranges -> pinctrl pin descs */
297static int sh_pfc_map_pins(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx)
Paul Mundtca5481c62012-07-10 12:08:14 +0900298{
Laurent Pinchart63d57382013-02-15 01:33:38 +0100299 const struct pinmux_range *ranges;
300 struct pinmux_range def_range;
301 unsigned int nr_ranges;
302 unsigned int nr_pins;
303 unsigned int i;
Paul Mundtca5481c62012-07-10 12:08:14 +0900304
Laurent Pinchart63d57382013-02-15 01:33:38 +0100305 if (pfc->info->ranges == NULL) {
306 def_range.begin = 0;
307 def_range.end = pfc->info->nr_pins - 1;
308 ranges = &def_range;
309 nr_ranges = 1;
310 } else {
311 ranges = pfc->info->ranges;
312 nr_ranges = pfc->info->nr_ranges;
313 }
Paul Mundtca5481c62012-07-10 12:08:14 +0900314
Laurent Pinchart63d57382013-02-15 01:33:38 +0100315 pmx->pads = devm_kzalloc(pfc->dev,
316 sizeof(*pmx->pads) * pfc->info->nr_pins,
Laurent Pinchart1724acf2012-12-15 23:50:48 +0100317 GFP_KERNEL);
Laurent Pinchart63d57382013-02-15 01:33:38 +0100318 if (unlikely(!pmx->pads))
Paul Mundtca5481c62012-07-10 12:08:14 +0900319 return -ENOMEM;
Laurent Pinchart63d57382013-02-15 01:33:38 +0100320
321 for (i = 0, nr_pins = 0; i < nr_ranges; ++i) {
322 const struct pinmux_range *range = &ranges[i];
323 unsigned int number;
324
325 for (number = range->begin; number <= range->end;
326 number++, nr_pins++) {
327 struct pinctrl_pin_desc *pin = &pmx->pads[nr_pins];
328 struct sh_pfc_pin *info = &pfc->info->pins[nr_pins];
329
330 pin->number = number;
331 pin->name = info->name;
332 }
Paul Mundtca5481c62012-07-10 12:08:14 +0900333 }
334
Laurent Pinchart63d57382013-02-15 01:33:38 +0100335 pfc->nr_pins = ranges[nr_ranges-1].end + 1;
Paul Mundtca5481c62012-07-10 12:08:14 +0900336
Laurent Pinchart63d57382013-02-15 01:33:38 +0100337 return nr_ranges;
Paul Mundtca5481c62012-07-10 12:08:14 +0900338}
339
Greg Kroah-Hartman0fe763c2012-12-21 15:14:44 -0800340static int sh_pfc_map_functions(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx)
Paul Mundtd93a8912012-07-11 17:17:10 +0900341{
Paul Mundtd93a8912012-07-11 17:17:10 +0900342 int i, fn;
343
Laurent Pincharta373ed02012-11-29 13:24:07 +0100344 for (i = 0; i < pfc->info->nr_func_gpios; i++) {
345 struct pinmux_func *func = pfc->info->func_gpios + i;
346
347 if (func->enum_id)
348 pmx->nr_functions++;
349 }
350
Laurent Pinchart1724acf2012-12-15 23:50:48 +0100351 pmx->functions = devm_kzalloc(pfc->dev, pmx->nr_functions *
352 sizeof(*pmx->functions), GFP_KERNEL);
Paul Mundtd93a8912012-07-11 17:17:10 +0900353 if (unlikely(!pmx->functions))
354 return -ENOMEM;
355
Laurent Pincharta373ed02012-11-29 13:24:07 +0100356 for (i = fn = 0; i < pfc->info->nr_func_gpios; i++) {
357 struct pinmux_func *func = pfc->info->func_gpios + i;
Paul Mundtd93a8912012-07-11 17:17:10 +0900358
Laurent Pincharta373ed02012-11-29 13:24:07 +0100359 if (func->enum_id)
360 pmx->functions[fn++] = func;
Paul Mundtd93a8912012-07-11 17:17:10 +0900361 }
362
Paul Mundtd93a8912012-07-11 17:17:10 +0900363 return 0;
364}
365
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100366int sh_pfc_register_pinctrl(struct sh_pfc *pfc)
Paul Mundtca5481c62012-07-10 12:08:14 +0900367{
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100368 struct sh_pfc_pinctrl *pmx;
Laurent Pinchart63d57382013-02-15 01:33:38 +0100369 int nr_ranges;
Paul Mundtca5481c62012-07-10 12:08:14 +0900370 int ret;
371
Laurent Pinchart1724acf2012-12-15 23:50:48 +0100372 pmx = devm_kzalloc(pfc->dev, sizeof(*pmx), GFP_KERNEL);
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100373 if (unlikely(!pmx))
374 return -ENOMEM;
Paul Mundtca5481c62012-07-10 12:08:14 +0900375
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100376 pmx->pfc = pfc;
377 pfc->pinctrl = pmx;
378
Laurent Pinchart63d57382013-02-15 01:33:38 +0100379 nr_ranges = sh_pfc_map_pins(pfc, pmx);
380 if (unlikely(nr_ranges < 0))
381 return nr_ranges;
Paul Mundtca5481c62012-07-10 12:08:14 +0900382
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100383 ret = sh_pfc_map_functions(pfc, pmx);
Paul Mundtd93a8912012-07-11 17:17:10 +0900384 if (unlikely(ret != 0))
Laurent Pinchart1724acf2012-12-15 23:50:48 +0100385 return ret;
Paul Mundtd93a8912012-07-11 17:17:10 +0900386
Laurent Pinchartdcc427e2013-02-16 16:38:30 +0100387 pmx->pctl_desc.name = DRV_NAME;
388 pmx->pctl_desc.owner = THIS_MODULE;
389 pmx->pctl_desc.pctlops = &sh_pfc_pinctrl_ops;
390 pmx->pctl_desc.pmxops = &sh_pfc_pinmux_ops;
391 pmx->pctl_desc.confops = &sh_pfc_pinconf_ops;
392 pmx->pctl_desc.pins = pmx->pads;
Laurent Pinchart63d57382013-02-15 01:33:38 +0100393 pmx->pctl_desc.npins = pfc->info->nr_pins;
Laurent Pinchartdcc427e2013-02-16 16:38:30 +0100394
395 pmx->pctl = pinctrl_register(&pmx->pctl_desc, pfc->dev, pmx);
Laurent Pinchart1724acf2012-12-15 23:50:48 +0100396 if (IS_ERR(pmx->pctl))
397 return PTR_ERR(pmx->pctl);
Paul Mundtca5481c62012-07-10 12:08:14 +0900398
Paul Mundtca5481c62012-07-10 12:08:14 +0900399 return 0;
Paul Mundtca5481c62012-07-10 12:08:14 +0900400}
401
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100402int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc)
Paul Mundtca5481c62012-07-10 12:08:14 +0900403{
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100404 struct sh_pfc_pinctrl *pmx = pfc->pinctrl;
Paul Mundtca5481c62012-07-10 12:08:14 +0900405
Paul Mundtca5481c62012-07-10 12:08:14 +0900406 pinctrl_unregister(pmx->pctl);
407
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100408 pfc->pinctrl = NULL;
Paul Mundtca5481c62012-07-10 12:08:14 +0900409 return 0;
410}