blob: 6852010a6d708b5010555cbb141bf57ac31de077 [file] [log] [blame]
Shawn Guo17723112012-04-28 13:00:50 +08001/*
2 * Copyright 2012 Freescale Semiconductor, Inc.
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include <linux/err.h>
13#include <linux/init.h>
14#include <linux/io.h>
Shawn Guo17723112012-04-28 13:00:50 +080015#include <linux/of.h>
16#include <linux/of_address.h>
17#include <linux/pinctrl/machine.h>
18#include <linux/pinctrl/pinconf.h>
19#include <linux/pinctrl/pinctrl.h>
20#include <linux/pinctrl/pinmux.h>
21#include <linux/platform_device.h>
22#include <linux/slab.h>
Linus Walleijedad3b22014-09-03 13:37:38 +020023#include "../core.h"
Shawn Guo17723112012-04-28 13:00:50 +080024#include "pinctrl-mxs.h"
25
26#define SUFFIX_LEN 4
27
28struct mxs_pinctrl_data {
29 struct device *dev;
30 struct pinctrl_dev *pctl;
31 void __iomem *base;
32 struct mxs_pinctrl_soc_data *soc;
33};
34
35static int mxs_get_groups_count(struct pinctrl_dev *pctldev)
36{
37 struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
38
39 return d->soc->ngroups;
40}
41
42static const char *mxs_get_group_name(struct pinctrl_dev *pctldev,
43 unsigned group)
44{
45 struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
46
47 return d->soc->groups[group].name;
48}
49
50static int mxs_get_group_pins(struct pinctrl_dev *pctldev, unsigned group,
51 const unsigned **pins, unsigned *num_pins)
52{
53 struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
54
55 *pins = d->soc->groups[group].pins;
56 *num_pins = d->soc->groups[group].npins;
57
58 return 0;
59}
60
61static void mxs_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
62 unsigned offset)
63{
64 seq_printf(s, " %s", dev_name(pctldev->dev));
65}
66
67static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev,
68 struct device_node *np,
69 struct pinctrl_map **map, unsigned *num_maps)
70{
71 struct pinctrl_map *new_map;
Shawn Guo3b7ac942012-05-13 23:19:00 +080072 char *group = NULL;
73 unsigned new_num = 1;
Shawn Guo17723112012-04-28 13:00:50 +080074 unsigned long config = 0;
75 unsigned long *pconfig;
76 int length = strlen(np->name) + SUFFIX_LEN;
Shawn Guo3b7ac942012-05-13 23:19:00 +080077 bool purecfg = false;
78 u32 val, reg;
79 int ret, i = 0;
80
81 /* Check for pin config node which has no 'reg' property */
82 if (of_property_read_u32(np, "reg", &reg))
83 purecfg = true;
Shawn Guo17723112012-04-28 13:00:50 +080084
85 ret = of_property_read_u32(np, "fsl,drive-strength", &val);
86 if (!ret)
87 config = val | MA_PRESENT;
88 ret = of_property_read_u32(np, "fsl,voltage", &val);
89 if (!ret)
90 config |= val << VOL_SHIFT | VOL_PRESENT;
91 ret = of_property_read_u32(np, "fsl,pull-up", &val);
92 if (!ret)
93 config |= val << PULL_SHIFT | PULL_PRESENT;
94
Shawn Guo3b7ac942012-05-13 23:19:00 +080095 /* Check for group node which has both mux and config settings */
96 if (!purecfg && config)
97 new_num = 2;
98
Shawn Guo17723112012-04-28 13:00:50 +080099 new_map = kzalloc(sizeof(*new_map) * new_num, GFP_KERNEL);
100 if (!new_map)
101 return -ENOMEM;
102
Shawn Guo3b7ac942012-05-13 23:19:00 +0800103 if (!purecfg) {
104 new_map[i].type = PIN_MAP_TYPE_MUX_GROUP;
105 new_map[i].data.mux.function = np->name;
Shawn Guo17723112012-04-28 13:00:50 +0800106
Shawn Guo3b7ac942012-05-13 23:19:00 +0800107 /* Compose group name */
108 group = kzalloc(length, GFP_KERNEL);
Devendra Naga0bf74812012-06-09 17:31:23 +0530109 if (!group) {
110 ret = -ENOMEM;
111 goto free;
112 }
Shawn Guo3b7ac942012-05-13 23:19:00 +0800113 snprintf(group, length, "%s.%d", np->name, reg);
114 new_map[i].data.mux.group = group;
115 i++;
116 }
Shawn Guo17723112012-04-28 13:00:50 +0800117
118 if (config) {
119 pconfig = kmemdup(&config, sizeof(config), GFP_KERNEL);
120 if (!pconfig) {
121 ret = -ENOMEM;
Devendra Naga0bf74812012-06-09 17:31:23 +0530122 goto free_group;
Shawn Guo17723112012-04-28 13:00:50 +0800123 }
124
Shawn Guo3b7ac942012-05-13 23:19:00 +0800125 new_map[i].type = PIN_MAP_TYPE_CONFIGS_GROUP;
126 new_map[i].data.configs.group_or_pin = purecfg ? np->name :
127 group;
128 new_map[i].data.configs.configs = pconfig;
129 new_map[i].data.configs.num_configs = 1;
Shawn Guo17723112012-04-28 13:00:50 +0800130 }
131
132 *map = new_map;
133 *num_maps = new_num;
134
135 return 0;
136
Devendra Naga0bf74812012-06-09 17:31:23 +0530137free_group:
138 if (!purecfg)
Fabio Estevam14e1e9f2012-06-13 14:06:07 -0300139 kfree(group);
Shawn Guo17723112012-04-28 13:00:50 +0800140free:
141 kfree(new_map);
142 return ret;
143}
144
145static void mxs_dt_free_map(struct pinctrl_dev *pctldev,
146 struct pinctrl_map *map, unsigned num_maps)
147{
Fabio Estevam4b090d82013-01-07 22:53:49 -0200148 u32 i;
Shawn Guo17723112012-04-28 13:00:50 +0800149
150 for (i = 0; i < num_maps; i++) {
151 if (map[i].type == PIN_MAP_TYPE_MUX_GROUP)
152 kfree(map[i].data.mux.group);
153 if (map[i].type == PIN_MAP_TYPE_CONFIGS_GROUP)
154 kfree(map[i].data.configs.configs);
155 }
156
157 kfree(map);
158}
159
Laurent Pinchart022ab142013-02-16 10:25:07 +0100160static const struct pinctrl_ops mxs_pinctrl_ops = {
Shawn Guo17723112012-04-28 13:00:50 +0800161 .get_groups_count = mxs_get_groups_count,
162 .get_group_name = mxs_get_group_name,
163 .get_group_pins = mxs_get_group_pins,
164 .pin_dbg_show = mxs_pin_dbg_show,
165 .dt_node_to_map = mxs_dt_node_to_map,
166 .dt_free_map = mxs_dt_free_map,
167};
168
169static int mxs_pinctrl_get_funcs_count(struct pinctrl_dev *pctldev)
170{
171 struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
172
173 return d->soc->nfunctions;
174}
175
176static const char *mxs_pinctrl_get_func_name(struct pinctrl_dev *pctldev,
177 unsigned function)
178{
179 struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
180
181 return d->soc->functions[function].name;
182}
183
184static int mxs_pinctrl_get_func_groups(struct pinctrl_dev *pctldev,
185 unsigned group,
186 const char * const **groups,
187 unsigned * const num_groups)
188{
189 struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
190
191 *groups = d->soc->functions[group].groups;
192 *num_groups = d->soc->functions[group].ngroups;
193
194 return 0;
195}
196
Uwe Kleine-König485b0f12017-05-18 11:23:55 +0200197static void mxs_pinctrl_rmwl(u32 value, u32 mask, u8 shift, void __iomem *reg)
198{
199 u32 tmp;
200
201 tmp = readl(reg);
202 tmp &= ~(mask << shift);
203 tmp |= value << shift;
204 writel(tmp, reg);
205}
206
Linus Walleij03e9f0c2014-09-03 13:02:56 +0200207static int mxs_pinctrl_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
208 unsigned group)
Shawn Guo17723112012-04-28 13:00:50 +0800209{
210 struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
211 struct mxs_group *g = &d->soc->groups[group];
212 void __iomem *reg;
213 u8 bank, shift;
214 u16 pin;
Fabio Estevam4b090d82013-01-07 22:53:49 -0200215 u32 i;
Shawn Guo17723112012-04-28 13:00:50 +0800216
217 for (i = 0; i < g->npins; i++) {
218 bank = PINID_TO_BANK(g->pins[i]);
219 pin = PINID_TO_PIN(g->pins[i]);
220 reg = d->base + d->soc->regs->muxsel;
221 reg += bank * 0x20 + pin / 16 * 0x10;
222 shift = pin % 16 * 2;
223
Uwe Kleine-König485b0f12017-05-18 11:23:55 +0200224 mxs_pinctrl_rmwl(g->muxsel[i], 0x3, shift, reg);
Shawn Guo17723112012-04-28 13:00:50 +0800225 }
226
227 return 0;
228}
229
Laurent Pinchart022ab142013-02-16 10:25:07 +0100230static const struct pinmux_ops mxs_pinmux_ops = {
Shawn Guo17723112012-04-28 13:00:50 +0800231 .get_functions_count = mxs_pinctrl_get_funcs_count,
232 .get_function_name = mxs_pinctrl_get_func_name,
233 .get_function_groups = mxs_pinctrl_get_func_groups,
Linus Walleij03e9f0c2014-09-03 13:02:56 +0200234 .set_mux = mxs_pinctrl_set_mux,
Shawn Guo17723112012-04-28 13:00:50 +0800235};
236
237static int mxs_pinconf_get(struct pinctrl_dev *pctldev,
238 unsigned pin, unsigned long *config)
239{
240 return -ENOTSUPP;
241}
242
243static int mxs_pinconf_set(struct pinctrl_dev *pctldev,
Sherman Yin03b054e2013-08-27 11:32:12 -0700244 unsigned pin, unsigned long *configs,
245 unsigned num_configs)
Shawn Guo17723112012-04-28 13:00:50 +0800246{
247 return -ENOTSUPP;
248}
249
250static int mxs_pinconf_group_get(struct pinctrl_dev *pctldev,
251 unsigned group, unsigned long *config)
252{
253 struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
254
255 *config = d->soc->groups[group].config;
256
257 return 0;
258}
259
260static int mxs_pinconf_group_set(struct pinctrl_dev *pctldev,
Sherman Yin03b054e2013-08-27 11:32:12 -0700261 unsigned group, unsigned long *configs,
262 unsigned num_configs)
Shawn Guo17723112012-04-28 13:00:50 +0800263{
264 struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
265 struct mxs_group *g = &d->soc->groups[group];
266 void __iomem *reg;
267 u8 ma, vol, pull, bank, shift;
268 u16 pin;
Fabio Estevam4b090d82013-01-07 22:53:49 -0200269 u32 i;
Sherman Yin03b054e2013-08-27 11:32:12 -0700270 int n;
271 unsigned long config;
Shawn Guo17723112012-04-28 13:00:50 +0800272
Sherman Yin03b054e2013-08-27 11:32:12 -0700273 for (n = 0; n < num_configs; n++) {
274 config = configs[n];
Shawn Guo17723112012-04-28 13:00:50 +0800275
Sherman Yin03b054e2013-08-27 11:32:12 -0700276 ma = CONFIG_TO_MA(config);
277 vol = CONFIG_TO_VOL(config);
278 pull = CONFIG_TO_PULL(config);
Shawn Guo17723112012-04-28 13:00:50 +0800279
Sherman Yin03b054e2013-08-27 11:32:12 -0700280 for (i = 0; i < g->npins; i++) {
281 bank = PINID_TO_BANK(g->pins[i]);
282 pin = PINID_TO_PIN(g->pins[i]);
Shawn Guo17723112012-04-28 13:00:50 +0800283
Sherman Yin03b054e2013-08-27 11:32:12 -0700284 /* drive */
285 reg = d->base + d->soc->regs->drive;
286 reg += bank * 0x40 + pin / 8 * 0x10;
287
288 /* mA */
289 if (config & MA_PRESENT) {
290 shift = pin % 8 * 4;
Uwe Kleine-König485b0f12017-05-18 11:23:55 +0200291 mxs_pinctrl_rmwl(ma, 0x3, shift, reg);
Sherman Yin03b054e2013-08-27 11:32:12 -0700292 }
293
294 /* vol */
295 if (config & VOL_PRESENT) {
296 shift = pin % 8 * 4 + 2;
297 if (vol)
298 writel(1 << shift, reg + SET);
299 else
300 writel(1 << shift, reg + CLR);
301 }
302
303 /* pull */
304 if (config & PULL_PRESENT) {
305 reg = d->base + d->soc->regs->pull;
306 reg += bank * 0x10;
307 shift = pin;
308 if (pull)
309 writel(1 << shift, reg + SET);
310 else
311 writel(1 << shift, reg + CLR);
312 }
Shawn Guo17723112012-04-28 13:00:50 +0800313 }
314
Sherman Yin03b054e2013-08-27 11:32:12 -0700315 /* cache the config value for mxs_pinconf_group_get() */
316 g->config = config;
Shawn Guo17723112012-04-28 13:00:50 +0800317
Sherman Yin03b054e2013-08-27 11:32:12 -0700318 } /* for each config */
Shawn Guo17723112012-04-28 13:00:50 +0800319
320 return 0;
321}
322
323static void mxs_pinconf_dbg_show(struct pinctrl_dev *pctldev,
324 struct seq_file *s, unsigned pin)
325{
326 /* Not support */
327}
328
329static void mxs_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
330 struct seq_file *s, unsigned group)
331{
332 unsigned long config;
333
334 if (!mxs_pinconf_group_get(pctldev, group, &config))
335 seq_printf(s, "0x%lx", config);
336}
337
Laurent Pinchart022ab142013-02-16 10:25:07 +0100338static const struct pinconf_ops mxs_pinconf_ops = {
Shawn Guo17723112012-04-28 13:00:50 +0800339 .pin_config_get = mxs_pinconf_get,
340 .pin_config_set = mxs_pinconf_set,
341 .pin_config_group_get = mxs_pinconf_group_get,
342 .pin_config_group_set = mxs_pinconf_group_set,
343 .pin_config_dbg_show = mxs_pinconf_dbg_show,
344 .pin_config_group_dbg_show = mxs_pinconf_group_dbg_show,
345};
346
347static struct pinctrl_desc mxs_pinctrl_desc = {
348 .pctlops = &mxs_pinctrl_ops,
349 .pmxops = &mxs_pinmux_ops,
350 .confops = &mxs_pinconf_ops,
351 .owner = THIS_MODULE,
352};
353
Greg Kroah-Hartman150632b2012-12-21 13:10:23 -0800354static int mxs_pinctrl_parse_group(struct platform_device *pdev,
355 struct device_node *np, int idx,
356 const char **out_name)
Shawn Guo17723112012-04-28 13:00:50 +0800357{
358 struct mxs_pinctrl_data *d = platform_get_drvdata(pdev);
359 struct mxs_group *g = &d->soc->groups[idx];
360 struct property *prop;
361 const char *propname = "fsl,pinmux-ids";
362 char *group;
363 int length = strlen(np->name) + SUFFIX_LEN;
Fabio Estevam4b090d82013-01-07 22:53:49 -0200364 u32 val, i;
Shawn Guo17723112012-04-28 13:00:50 +0800365
366 group = devm_kzalloc(&pdev->dev, length, GFP_KERNEL);
367 if (!group)
368 return -ENOMEM;
Shawn Guo3b7ac942012-05-13 23:19:00 +0800369 if (of_property_read_u32(np, "reg", &val))
370 snprintf(group, length, "%s", np->name);
371 else
372 snprintf(group, length, "%s.%d", np->name, val);
Shawn Guo17723112012-04-28 13:00:50 +0800373 g->name = group;
374
375 prop = of_find_property(np, propname, &length);
376 if (!prop)
377 return -EINVAL;
378 g->npins = length / sizeof(u32);
379
380 g->pins = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->pins),
381 GFP_KERNEL);
382 if (!g->pins)
383 return -ENOMEM;
384
385 g->muxsel = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->muxsel),
386 GFP_KERNEL);
387 if (!g->muxsel)
388 return -ENOMEM;
389
390 of_property_read_u32_array(np, propname, g->pins, g->npins);
391 for (i = 0; i < g->npins; i++) {
392 g->muxsel[i] = MUXID_TO_MUXSEL(g->pins[i]);
393 g->pins[i] = MUXID_TO_PINID(g->pins[i]);
394 }
395
Shawn Guo3b7ac942012-05-13 23:19:00 +0800396 if (out_name)
397 *out_name = g->name;
Shawn Guo17723112012-04-28 13:00:50 +0800398
399 return 0;
400}
401
Greg Kroah-Hartman150632b2012-12-21 13:10:23 -0800402static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
403 struct mxs_pinctrl_data *d)
Shawn Guo17723112012-04-28 13:00:50 +0800404{
405 struct mxs_pinctrl_soc_data *soc = d->soc;
406 struct device_node *np = pdev->dev.of_node;
407 struct device_node *child;
408 struct mxs_function *f;
Shawn Guo48516802012-05-13 23:19:01 +0800409 const char *gpio_compat = "fsl,mxs-gpio";
Shawn Guo17723112012-04-28 13:00:50 +0800410 const char *fn, *fnull = "";
411 int i = 0, idxf = 0, idxg = 0;
412 int ret;
413 u32 val;
414
415 child = of_get_next_child(np, NULL);
416 if (!child) {
417 dev_err(&pdev->dev, "no group is defined\n");
418 return -ENOENT;
419 }
420
421 /* Count total functions and groups */
422 fn = fnull;
423 for_each_child_of_node(np, child) {
Shawn Guo48516802012-05-13 23:19:01 +0800424 if (of_device_is_compatible(child, gpio_compat))
425 continue;
Shawn Guo3b7ac942012-05-13 23:19:00 +0800426 soc->ngroups++;
Shawn Guo17723112012-04-28 13:00:50 +0800427 /* Skip pure pinconf node */
428 if (of_property_read_u32(child, "reg", &val))
429 continue;
430 if (strcmp(fn, child->name)) {
431 fn = child->name;
432 soc->nfunctions++;
433 }
Shawn Guo17723112012-04-28 13:00:50 +0800434 }
435
436 soc->functions = devm_kzalloc(&pdev->dev, soc->nfunctions *
437 sizeof(*soc->functions), GFP_KERNEL);
438 if (!soc->functions)
439 return -ENOMEM;
440
441 soc->groups = devm_kzalloc(&pdev->dev, soc->ngroups *
442 sizeof(*soc->groups), GFP_KERNEL);
443 if (!soc->groups)
444 return -ENOMEM;
445
446 /* Count groups for each function */
447 fn = fnull;
448 f = &soc->functions[idxf];
449 for_each_child_of_node(np, child) {
Shawn Guo48516802012-05-13 23:19:01 +0800450 if (of_device_is_compatible(child, gpio_compat))
451 continue;
Shawn Guo17723112012-04-28 13:00:50 +0800452 if (of_property_read_u32(child, "reg", &val))
453 continue;
454 if (strcmp(fn, child->name)) {
Uwe Kleine-Königfdaaf6d2014-10-21 11:40:45 +0200455 struct device_node *child2;
456
457 /*
458 * This reference is dropped by
459 * of_get_next_child(np, * child)
460 */
461 of_node_get(child);
462
463 /*
464 * The logic parsing the functions from dt currently
465 * doesn't handle if functions with the same name are
466 * not grouped together. Only the first contiguous
467 * cluster is usable for each function name. This is a
468 * bug that is not trivial to fix, but at least warn
469 * about it.
470 */
471 for (child2 = of_get_next_child(np, child);
472 child2 != NULL;
473 child2 = of_get_next_child(np, child2)) {
474 if (!strcmp(child2->name, fn))
475 dev_warn(&pdev->dev,
476 "function nodes must be grouped by name (failed for: %s)",
477 fn);
478 }
479
Shawn Guo17723112012-04-28 13:00:50 +0800480 f = &soc->functions[idxf++];
481 f->name = fn = child->name;
482 }
483 f->ngroups++;
Javier Martinez Canillas14316c42015-09-16 10:28:28 +0200484 }
Shawn Guo17723112012-04-28 13:00:50 +0800485
486 /* Get groups for each function */
487 idxf = 0;
488 fn = fnull;
489 for_each_child_of_node(np, child) {
Shawn Guo48516802012-05-13 23:19:01 +0800490 if (of_device_is_compatible(child, gpio_compat))
491 continue;
Shawn Guo3b7ac942012-05-13 23:19:00 +0800492 if (of_property_read_u32(child, "reg", &val)) {
493 ret = mxs_pinctrl_parse_group(pdev, child,
494 idxg++, NULL);
495 if (ret)
496 return ret;
Shawn Guo17723112012-04-28 13:00:50 +0800497 continue;
Shawn Guo3b7ac942012-05-13 23:19:00 +0800498 }
499
Shawn Guo17723112012-04-28 13:00:50 +0800500 if (strcmp(fn, child->name)) {
501 f = &soc->functions[idxf++];
502 f->groups = devm_kzalloc(&pdev->dev, f->ngroups *
503 sizeof(*f->groups),
504 GFP_KERNEL);
505 if (!f->groups)
506 return -ENOMEM;
507 fn = child->name;
508 i = 0;
509 }
510 ret = mxs_pinctrl_parse_group(pdev, child, idxg++,
511 &f->groups[i++]);
512 if (ret)
513 return ret;
514 }
515
516 return 0;
517}
518
Greg Kroah-Hartman150632b2012-12-21 13:10:23 -0800519int mxs_pinctrl_probe(struct platform_device *pdev,
520 struct mxs_pinctrl_soc_data *soc)
Shawn Guo17723112012-04-28 13:00:50 +0800521{
522 struct device_node *np = pdev->dev.of_node;
523 struct mxs_pinctrl_data *d;
524 int ret;
525
526 d = devm_kzalloc(&pdev->dev, sizeof(*d), GFP_KERNEL);
527 if (!d)
528 return -ENOMEM;
529
530 d->dev = &pdev->dev;
531 d->soc = soc;
532
533 d->base = of_iomap(np, 0);
534 if (!d->base)
535 return -EADDRNOTAVAIL;
536
537 mxs_pinctrl_desc.pins = d->soc->pins;
538 mxs_pinctrl_desc.npins = d->soc->npins;
539 mxs_pinctrl_desc.name = dev_name(&pdev->dev);
540
541 platform_set_drvdata(pdev, d);
542
543 ret = mxs_pinctrl_probe_dt(pdev, d);
544 if (ret) {
545 dev_err(&pdev->dev, "dt probe failed: %d\n", ret);
546 goto err;
547 }
548
549 d->pctl = pinctrl_register(&mxs_pinctrl_desc, &pdev->dev, d);
Masahiro Yamada323de9e2015-06-09 13:01:16 +0900550 if (IS_ERR(d->pctl)) {
Shawn Guo17723112012-04-28 13:00:50 +0800551 dev_err(&pdev->dev, "Couldn't register MXS pinctrl driver\n");
Masahiro Yamada323de9e2015-06-09 13:01:16 +0900552 ret = PTR_ERR(d->pctl);
Shawn Guo17723112012-04-28 13:00:50 +0800553 goto err;
554 }
555
556 return 0;
557
558err:
559 iounmap(d->base);
560 return ret;
561}
562EXPORT_SYMBOL_GPL(mxs_pinctrl_probe);