blob: a3ac39b79192a4c8f2de0d063054f5477a1f257a [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#define DRV_NAME "pinctrl-sh_pfc"
11
12#define pr_fmt(fmt) DRV_NAME " " KBUILD_MODNAME ": " fmt
Paul Mundtca5481c62012-07-10 12:08:14 +090013
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/sh_pfc.h>
17#include <linux/err.h>
18#include <linux/slab.h>
Paul Mundtd93a8912012-07-11 17:17:10 +090019#include <linux/spinlock.h>
Paul Mundtca5481c62012-07-10 12:08:14 +090020#include <linux/platform_device.h>
21#include <linux/pinctrl/consumer.h>
22#include <linux/pinctrl/pinctrl.h>
23#include <linux/pinctrl/pinconf.h>
24#include <linux/pinctrl/pinmux.h>
25#include <linux/pinctrl/pinconf-generic.h>
26
27struct sh_pfc_pinctrl {
28 struct pinctrl_dev *pctl;
29 struct sh_pfc *pfc;
30
Paul Mundtd93a8912012-07-11 17:17:10 +090031 struct pinmux_gpio **functions;
32 unsigned int nr_functions;
33
Paul Mundtca5481c62012-07-10 12:08:14 +090034 struct pinctrl_pin_desc *pads;
35 unsigned int nr_pads;
Paul Mundtd93a8912012-07-11 17:17:10 +090036
37 spinlock_t lock;
Paul Mundtca5481c62012-07-10 12:08:14 +090038};
39
40static struct sh_pfc_pinctrl *sh_pfc_pmx;
41
Paul Mundte3f805e2012-07-17 15:48:18 +090042static int sh_pfc_get_groups_count(struct pinctrl_dev *pctldev)
Paul Mundtca5481c62012-07-10 12:08:14 +090043{
Paul Mundte3f805e2012-07-17 15:48:18 +090044 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
45
46 return pmx->nr_pads;
Paul Mundtca5481c62012-07-10 12:08:14 +090047}
48
Paul Mundte3f805e2012-07-17 15:48:18 +090049static const char *sh_pfc_get_group_name(struct pinctrl_dev *pctldev,
Paul Mundtca5481c62012-07-10 12:08:14 +090050 unsigned selector)
51{
Paul Mundte3f805e2012-07-17 15:48:18 +090052 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
53
54 return pmx->pads[selector].name;
Paul Mundtca5481c62012-07-10 12:08:14 +090055}
56
57static int sh_pfc_get_group_pins(struct pinctrl_dev *pctldev, unsigned group,
58 const unsigned **pins, unsigned *num_pins)
59{
Paul Mundte3f805e2012-07-17 15:48:18 +090060 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
61
62 *pins = &pmx->pads[group].number;
63 *num_pins = 1;
64
65 return 0;
Paul Mundtca5481c62012-07-10 12:08:14 +090066}
67
Paul Mundtfdd85ec2012-07-20 16:39:09 +090068static void sh_pfc_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
69 unsigned offset)
70{
71 seq_printf(s, "%s", DRV_NAME);
72}
73
Paul Mundtca5481c62012-07-10 12:08:14 +090074static struct pinctrl_ops sh_pfc_pinctrl_ops = {
Paul Mundte3f805e2012-07-17 15:48:18 +090075 .get_groups_count = sh_pfc_get_groups_count,
76 .get_group_name = sh_pfc_get_group_name,
Paul Mundtca5481c62012-07-10 12:08:14 +090077 .get_group_pins = sh_pfc_get_group_pins,
Paul Mundtfdd85ec2012-07-20 16:39:09 +090078 .pin_dbg_show = sh_pfc_pin_dbg_show,
Paul Mundtca5481c62012-07-10 12:08:14 +090079};
80
Paul Mundtd93a8912012-07-11 17:17:10 +090081static int sh_pfc_get_functions_count(struct pinctrl_dev *pctldev)
82{
83 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
Paul Mundtca5481c62012-07-10 12:08:14 +090084
Paul Mundtd93a8912012-07-11 17:17:10 +090085 return pmx->nr_functions;
86}
87
88static const char *sh_pfc_get_function_name(struct pinctrl_dev *pctldev,
89 unsigned selector)
90{
91 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
92
93 return pmx->functions[selector]->name;
94}
95
Paul Mundtca5481c62012-07-10 12:08:14 +090096static int sh_pfc_get_function_groups(struct pinctrl_dev *pctldev, unsigned func,
97 const char * const **groups,
98 unsigned * const num_groups)
99{
Paul Mundtd93a8912012-07-11 17:17:10 +0900100 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
101
102 *groups = &pmx->functions[func]->name;
103 *num_groups = 1;
104
Paul Mundtca5481c62012-07-10 12:08:14 +0900105 return 0;
106}
107
108static int sh_pfc_noop_enable(struct pinctrl_dev *pctldev, unsigned func,
109 unsigned group)
110{
111 return 0;
112}
113
114static void sh_pfc_noop_disable(struct pinctrl_dev *pctldev, unsigned func,
115 unsigned group)
116{
117}
118
Paul Mundtd93a8912012-07-11 17:17:10 +0900119static inline int sh_pfc_config_function(struct sh_pfc *pfc, unsigned offset)
120{
121 if (sh_pfc_config_gpio(pfc, offset,
122 PINMUX_TYPE_FUNCTION,
123 GPIO_CFG_DRYRUN) != 0)
124 return -EINVAL;
125
126 if (sh_pfc_config_gpio(pfc, offset,
127 PINMUX_TYPE_FUNCTION,
128 GPIO_CFG_REQ) != 0)
129 return -EINVAL;
130
131 return 0;
132}
133
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900134static int sh_pfc_reconfig_pin(struct sh_pfc *pfc, unsigned offset,
135 int new_type)
136{
137 unsigned long flags;
138 int pinmux_type;
139 int ret = -EINVAL;
140
141 spin_lock_irqsave(&pfc->lock, flags);
142
143 pinmux_type = pfc->gpios[offset].flags & PINMUX_FLAG_TYPE;
144
145 /*
146 * See if the present config needs to first be de-configured.
147 */
148 switch (pinmux_type) {
149 case PINMUX_TYPE_GPIO:
150 break;
151 case PINMUX_TYPE_OUTPUT:
152 case PINMUX_TYPE_INPUT:
153 case PINMUX_TYPE_INPUT_PULLUP:
154 case PINMUX_TYPE_INPUT_PULLDOWN:
155 sh_pfc_config_gpio(pfc, offset, pinmux_type, GPIO_CFG_FREE);
156 break;
157 default:
158 goto err;
159 }
160
161 /*
162 * Dry run
163 */
164 if (sh_pfc_config_gpio(pfc, offset, new_type,
165 GPIO_CFG_DRYRUN) != 0)
166 goto err;
167
168 /*
169 * Request
170 */
171 if (sh_pfc_config_gpio(pfc, offset, new_type,
172 GPIO_CFG_REQ) != 0)
173 goto err;
174
175 pfc->gpios[offset].flags &= ~PINMUX_FLAG_TYPE;
176 pfc->gpios[offset].flags |= new_type;
177
178 ret = 0;
179
180err:
181 spin_unlock_irqrestore(&pfc->lock, flags);
182
183 return ret;
184}
185
186
Paul Mundtca5481c62012-07-10 12:08:14 +0900187static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
188 struct pinctrl_gpio_range *range,
189 unsigned offset)
190{
191 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
192 struct sh_pfc *pfc = pmx->pfc;
Paul Mundtca5481c62012-07-10 12:08:14 +0900193 unsigned long flags;
Paul Mundtd93a8912012-07-11 17:17:10 +0900194 int ret, pinmux_type;
Paul Mundtca5481c62012-07-10 12:08:14 +0900195
196 spin_lock_irqsave(&pfc->lock, flags);
197
Paul Mundtd93a8912012-07-11 17:17:10 +0900198 pinmux_type = pfc->gpios[offset].flags & PINMUX_FLAG_TYPE;
Paul Mundtca5481c62012-07-10 12:08:14 +0900199
Paul Mundtd93a8912012-07-11 17:17:10 +0900200 switch (pinmux_type) {
201 case PINMUX_TYPE_FUNCTION:
202 pr_notice_once("Use of GPIO API for function requests is "
203 "deprecated, convert to pinctrl\n");
204 /* handle for now */
205 ret = sh_pfc_config_function(pfc, offset);
206 if (unlikely(ret < 0))
Paul Mundtca5481c62012-07-10 12:08:14 +0900207 goto err;
208
Paul Mundtd93a8912012-07-11 17:17:10 +0900209 break;
210 case PINMUX_TYPE_GPIO:
211 break;
212 default:
213 pr_err("Unsupported mux type (%d), bailing...\n", pinmux_type);
Laurent Pinchart077664a2012-09-14 20:25:48 +0200214 ret = -ENOTSUPP;
215 goto err;
Paul Mundtd93a8912012-07-11 17:17:10 +0900216 }
Paul Mundtca5481c62012-07-10 12:08:14 +0900217
218 ret = 0;
219
220err:
221 spin_unlock_irqrestore(&pfc->lock, flags);
222
223 return ret;
224}
225
226static void sh_pfc_gpio_disable_free(struct pinctrl_dev *pctldev,
227 struct pinctrl_gpio_range *range,
228 unsigned offset)
229{
230 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
231 struct sh_pfc *pfc = pmx->pfc;
232 unsigned long flags;
233 int pinmux_type;
234
235 spin_lock_irqsave(&pfc->lock, flags);
236
237 pinmux_type = pfc->gpios[offset].flags & PINMUX_FLAG_TYPE;
238
239 sh_pfc_config_gpio(pfc, offset, pinmux_type, GPIO_CFG_FREE);
240
Paul Mundtca5481c62012-07-10 12:08:14 +0900241 spin_unlock_irqrestore(&pfc->lock, flags);
242}
243
244static int sh_pfc_gpio_set_direction(struct pinctrl_dev *pctldev,
245 struct pinctrl_gpio_range *range,
246 unsigned offset, bool input)
247{
248 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900249 int type = input ? PINMUX_TYPE_INPUT : PINMUX_TYPE_OUTPUT;
Paul Mundtca5481c62012-07-10 12:08:14 +0900250
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900251 return sh_pfc_reconfig_pin(pmx->pfc, offset, type);
Paul Mundtca5481c62012-07-10 12:08:14 +0900252}
253
254static struct pinmux_ops sh_pfc_pinmux_ops = {
Paul Mundtd93a8912012-07-11 17:17:10 +0900255 .get_functions_count = sh_pfc_get_functions_count,
256 .get_function_name = sh_pfc_get_function_name,
Paul Mundtca5481c62012-07-10 12:08:14 +0900257 .get_function_groups = sh_pfc_get_function_groups,
258 .enable = sh_pfc_noop_enable,
259 .disable = sh_pfc_noop_disable,
260 .gpio_request_enable = sh_pfc_gpio_request_enable,
261 .gpio_disable_free = sh_pfc_gpio_disable_free,
262 .gpio_set_direction = sh_pfc_gpio_set_direction,
263};
264
265static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin,
266 unsigned long *config)
267{
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900268 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
269 struct sh_pfc *pfc = pmx->pfc;
Paul Mundtd93a8912012-07-11 17:17:10 +0900270
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900271 *config = pfc->gpios[pin].flags & PINMUX_FLAG_TYPE;
Paul Mundtd93a8912012-07-11 17:17:10 +0900272
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900273 return 0;
Paul Mundtca5481c62012-07-10 12:08:14 +0900274}
275
276static int sh_pfc_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin,
277 unsigned long config)
278{
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900279 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900280
281 /* Validate the new type */
282 if (config >= PINMUX_FLAG_TYPE)
283 return -EINVAL;
284
285 return sh_pfc_reconfig_pin(pmx->pfc, pin, config);
286}
287
288static void sh_pfc_pinconf_dbg_show(struct pinctrl_dev *pctldev,
289 struct seq_file *s, unsigned pin)
290{
291 const char *pinmux_type_str[] = {
292 [PINMUX_TYPE_NONE] = "none",
293 [PINMUX_TYPE_FUNCTION] = "function",
294 [PINMUX_TYPE_GPIO] = "gpio",
295 [PINMUX_TYPE_OUTPUT] = "output",
296 [PINMUX_TYPE_INPUT] = "input",
297 [PINMUX_TYPE_INPUT_PULLUP] = "input bias pull up",
298 [PINMUX_TYPE_INPUT_PULLDOWN] = "input bias pull down",
299 };
300 unsigned long config;
301 int rc;
302
303 rc = sh_pfc_pinconf_get(pctldev, pin, &config);
304 if (unlikely(rc != 0))
305 return;
306
307 seq_printf(s, " %s", pinmux_type_str[config]);
Paul Mundtca5481c62012-07-10 12:08:14 +0900308}
309
310static struct pinconf_ops sh_pfc_pinconf_ops = {
Paul Mundtca5481c62012-07-10 12:08:14 +0900311 .pin_config_get = sh_pfc_pinconf_get,
312 .pin_config_set = sh_pfc_pinconf_set,
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900313 .pin_config_dbg_show = sh_pfc_pinconf_dbg_show,
Paul Mundtca5481c62012-07-10 12:08:14 +0900314};
315
316static struct pinctrl_gpio_range sh_pfc_gpio_range = {
Paul Mundt54407112012-07-20 16:18:21 +0900317 .name = DRV_NAME,
Paul Mundtca5481c62012-07-10 12:08:14 +0900318 .id = 0,
319};
320
321static struct pinctrl_desc sh_pfc_pinctrl_desc = {
Paul Mundt54407112012-07-20 16:18:21 +0900322 .name = DRV_NAME,
Paul Mundtca5481c62012-07-10 12:08:14 +0900323 .owner = THIS_MODULE,
324 .pctlops = &sh_pfc_pinctrl_ops,
325 .pmxops = &sh_pfc_pinmux_ops,
326 .confops = &sh_pfc_pinconf_ops,
327};
328
Paul Mundtd93a8912012-07-11 17:17:10 +0900329static inline void __devinit sh_pfc_map_one_gpio(struct sh_pfc *pfc,
330 struct sh_pfc_pinctrl *pmx,
331 struct pinmux_gpio *gpio,
332 unsigned offset)
333{
334 struct pinmux_data_reg *dummy;
335 unsigned long flags;
336 int bit;
337
338 gpio->flags &= ~PINMUX_FLAG_TYPE;
339
340 if (sh_pfc_get_data_reg(pfc, offset, &dummy, &bit) == 0)
341 gpio->flags |= PINMUX_TYPE_GPIO;
342 else {
343 gpio->flags |= PINMUX_TYPE_FUNCTION;
344
345 spin_lock_irqsave(&pmx->lock, flags);
346 pmx->nr_functions++;
347 spin_unlock_irqrestore(&pmx->lock, flags);
348 }
349}
350
Paul Mundtca5481c62012-07-10 12:08:14 +0900351/* pinmux ranges -> pinctrl pin descs */
352static int __devinit sh_pfc_map_gpios(struct sh_pfc *pfc,
353 struct sh_pfc_pinctrl *pmx)
354{
Paul Mundtd93a8912012-07-11 17:17:10 +0900355 unsigned long flags;
Paul Mundtca5481c62012-07-10 12:08:14 +0900356 int i;
357
358 pmx->nr_pads = pfc->last_gpio - pfc->first_gpio + 1;
359
360 pmx->pads = kmalloc(sizeof(struct pinctrl_pin_desc) * pmx->nr_pads,
361 GFP_KERNEL);
362 if (unlikely(!pmx->pads)) {
363 pmx->nr_pads = 0;
364 return -ENOMEM;
365 }
366
Paul Mundtd93a8912012-07-11 17:17:10 +0900367 spin_lock_irqsave(&pfc->lock, flags);
368
Paul Mundtca5481c62012-07-10 12:08:14 +0900369 /*
370 * We don't necessarily have a 1:1 mapping between pin and linux
371 * GPIO number, as the latter maps to the associated enum_id.
372 * Care needs to be taken to translate back to pin space when
373 * dealing with any pin configurations.
374 */
375 for (i = 0; i < pmx->nr_pads; i++) {
376 struct pinctrl_pin_desc *pin = pmx->pads + i;
377 struct pinmux_gpio *gpio = pfc->gpios + i;
378
379 pin->number = pfc->first_gpio + i;
380 pin->name = gpio->name;
Paul Mundtd93a8912012-07-11 17:17:10 +0900381
Paul Mundte3e79452012-07-17 15:23:11 +0900382 /* XXX */
383 if (unlikely(!gpio->enum_id))
384 continue;
385
Paul Mundtd93a8912012-07-11 17:17:10 +0900386 sh_pfc_map_one_gpio(pfc, pmx, gpio, i);
Paul Mundtca5481c62012-07-10 12:08:14 +0900387 }
388
Paul Mundtd93a8912012-07-11 17:17:10 +0900389 spin_unlock_irqrestore(&pfc->lock, flags);
390
Paul Mundtca5481c62012-07-10 12:08:14 +0900391 sh_pfc_pinctrl_desc.pins = pmx->pads;
392 sh_pfc_pinctrl_desc.npins = pmx->nr_pads;
393
394 return 0;
395}
396
Paul Mundtd93a8912012-07-11 17:17:10 +0900397static int __devinit sh_pfc_map_functions(struct sh_pfc *pfc,
398 struct sh_pfc_pinctrl *pmx)
399{
400 unsigned long flags;
401 int i, fn;
402
403 pmx->functions = kzalloc(pmx->nr_functions * sizeof(void *),
404 GFP_KERNEL);
405 if (unlikely(!pmx->functions))
406 return -ENOMEM;
407
408 spin_lock_irqsave(&pmx->lock, flags);
409
410 for (i = fn = 0; i < pmx->nr_pads; i++) {
411 struct pinmux_gpio *gpio = pfc->gpios + i;
412
413 if ((gpio->flags & PINMUX_FLAG_TYPE) == PINMUX_TYPE_FUNCTION)
414 pmx->functions[fn++] = gpio;
415 }
416
417 spin_unlock_irqrestore(&pmx->lock, flags);
418
419 return 0;
420}
421
Paul Mundtca5481c62012-07-10 12:08:14 +0900422static int __devinit sh_pfc_pinctrl_probe(struct platform_device *pdev)
423{
424 struct sh_pfc *pfc;
425 int ret;
426
427 if (unlikely(!sh_pfc_pmx))
428 return -ENODEV;
429
430 pfc = sh_pfc_pmx->pfc;
431
432 ret = sh_pfc_map_gpios(pfc, sh_pfc_pmx);
433 if (unlikely(ret != 0))
434 return ret;
435
Paul Mundtd93a8912012-07-11 17:17:10 +0900436 ret = sh_pfc_map_functions(pfc, sh_pfc_pmx);
437 if (unlikely(ret != 0))
438 goto free_pads;
439
Paul Mundtca5481c62012-07-10 12:08:14 +0900440 sh_pfc_pmx->pctl = pinctrl_register(&sh_pfc_pinctrl_desc, &pdev->dev,
441 sh_pfc_pmx);
442 if (IS_ERR(sh_pfc_pmx->pctl)) {
443 ret = PTR_ERR(sh_pfc_pmx->pctl);
Paul Mundtd93a8912012-07-11 17:17:10 +0900444 goto free_functions;
Paul Mundtca5481c62012-07-10 12:08:14 +0900445 }
446
447 sh_pfc_gpio_range.npins = pfc->last_gpio - pfc->first_gpio + 1;
448 sh_pfc_gpio_range.base = pfc->first_gpio;
449 sh_pfc_gpio_range.pin_base = pfc->first_gpio;
450
451 pinctrl_add_gpio_range(sh_pfc_pmx->pctl, &sh_pfc_gpio_range);
452
453 platform_set_drvdata(pdev, sh_pfc_pmx);
454
455 return 0;
456
Paul Mundtd93a8912012-07-11 17:17:10 +0900457free_functions:
458 kfree(sh_pfc_pmx->functions);
459free_pads:
Paul Mundtca5481c62012-07-10 12:08:14 +0900460 kfree(sh_pfc_pmx->pads);
461 kfree(sh_pfc_pmx);
Paul Mundtd93a8912012-07-11 17:17:10 +0900462
Paul Mundtca5481c62012-07-10 12:08:14 +0900463 return ret;
464}
465
466static int __devexit sh_pfc_pinctrl_remove(struct platform_device *pdev)
467{
468 struct sh_pfc_pinctrl *pmx = platform_get_drvdata(pdev);
469
Paul Mundtca5481c62012-07-10 12:08:14 +0900470 pinctrl_unregister(pmx->pctl);
471
472 platform_set_drvdata(pdev, NULL);
473
Paul Mundtd93a8912012-07-11 17:17:10 +0900474 kfree(sh_pfc_pmx->functions);
Paul Mundtca5481c62012-07-10 12:08:14 +0900475 kfree(sh_pfc_pmx->pads);
476 kfree(sh_pfc_pmx);
477
478 return 0;
479}
480
481static struct platform_driver sh_pfc_pinctrl_driver = {
482 .probe = sh_pfc_pinctrl_probe,
483 .remove = __devexit_p(sh_pfc_pinctrl_remove),
484 .driver = {
Paul Mundt54407112012-07-20 16:18:21 +0900485 .name = DRV_NAME,
Paul Mundtca5481c62012-07-10 12:08:14 +0900486 .owner = THIS_MODULE,
487 },
488};
489
490static struct platform_device sh_pfc_pinctrl_device = {
Paul Mundt54407112012-07-20 16:18:21 +0900491 .name = DRV_NAME,
Paul Mundtca5481c62012-07-10 12:08:14 +0900492 .id = -1,
493};
494
Paul Mundt1e32dfe2012-08-01 16:27:38 +0900495static int sh_pfc_pinctrl_init(void)
Paul Mundtca5481c62012-07-10 12:08:14 +0900496{
497 int rc;
498
499 rc = platform_driver_register(&sh_pfc_pinctrl_driver);
500 if (likely(!rc)) {
501 rc = platform_device_register(&sh_pfc_pinctrl_device);
502 if (unlikely(rc))
503 platform_driver_unregister(&sh_pfc_pinctrl_driver);
504 }
505
506 return rc;
507}
508
Paul Mundt1e32dfe2012-08-01 16:27:38 +0900509int sh_pfc_register_pinctrl(struct sh_pfc *pfc)
510{
511 sh_pfc_pmx = kzalloc(sizeof(struct sh_pfc_pinctrl), GFP_KERNEL);
512 if (unlikely(!sh_pfc_pmx))
513 return -ENOMEM;
514
515 spin_lock_init(&sh_pfc_pmx->lock);
516
517 sh_pfc_pmx->pfc = pfc;
518
519 return sh_pfc_pinctrl_init();
520}
521EXPORT_SYMBOL_GPL(sh_pfc_register_pinctrl);
522
Paul Mundtca5481c62012-07-10 12:08:14 +0900523static void __exit sh_pfc_pinctrl_exit(void)
524{
525 platform_driver_unregister(&sh_pfc_pinctrl_driver);
526}
Paul Mundtca5481c62012-07-10 12:08:14 +0900527module_exit(sh_pfc_pinctrl_exit);