blob: b4960df6aa2d45986849190e6df3bfcb90ea3acf [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
Laurent Pinchart1a0039d2013-03-08 17:43:54 +010028struct sh_pfc_pin_config {
29 u32 type;
30};
31
Paul Mundtca5481c62012-07-10 12:08:14 +090032struct sh_pfc_pinctrl {
33 struct pinctrl_dev *pctl;
Laurent Pinchartdcc427e2013-02-16 16:38:30 +010034 struct pinctrl_desc pctl_desc;
Laurent Pinchartdcc427e2013-02-16 16:38:30 +010035
Paul Mundtca5481c62012-07-10 12:08:14 +090036 struct sh_pfc *pfc;
37
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +010038 struct pinctrl_pin_desc *pins;
Laurent Pinchart1a0039d2013-03-08 17:43:54 +010039 struct sh_pfc_pin_config *configs;
Paul Mundtca5481c62012-07-10 12:08:14 +090040};
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
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +010046 return pmx->pfc->info->nr_groups;
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
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +010054 return pmx->pfc->info->groups[selector].name;
Paul Mundtca5481c62012-07-10 12:08:14 +090055}
56
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +010057static int sh_pfc_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
Paul Mundtca5481c62012-07-10 12:08:14 +090058 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
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +010062 *pins = pmx->pfc->info->groups[selector].pins;
63 *num_pins = pmx->pfc->info->groups[selector].nr_pins;
Paul Mundte3f805e2012-07-17 15:48:18 +090064
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
Laurent Pinchartfe330ce2013-02-15 16:04:47 +010074static const 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
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +010085 return pmx->pfc->info->nr_functions;
Paul Mundtd93a8912012-07-11 17:17:10 +090086}
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
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +010093 return pmx->pfc->info->functions[selector].name;
Paul Mundtd93a8912012-07-11 17:17:10 +090094}
95
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +010096static int sh_pfc_get_function_groups(struct pinctrl_dev *pctldev,
97 unsigned selector,
Paul Mundtca5481c62012-07-10 12:08:14 +090098 const char * const **groups,
99 unsigned * const num_groups)
100{
Paul Mundtd93a8912012-07-11 17:17:10 +0900101 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
102
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +0100103 *groups = pmx->pfc->info->functions[selector].groups;
104 *num_groups = pmx->pfc->info->functions[selector].nr_groups;
Paul Mundtd93a8912012-07-11 17:17:10 +0900105
Paul Mundtca5481c62012-07-10 12:08:14 +0900106 return 0;
107}
108
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +0100109static int sh_pfc_func_enable(struct pinctrl_dev *pctldev, unsigned selector,
Paul Mundtca5481c62012-07-10 12:08:14 +0900110 unsigned group)
111{
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +0100112 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
113 struct sh_pfc *pfc = pmx->pfc;
114 const struct sh_pfc_pin_group *grp = &pfc->info->groups[group];
115 unsigned long flags;
116 unsigned int i;
117 int ret = -EINVAL;
118
119 spin_lock_irqsave(&pfc->lock, flags);
120
121 for (i = 0; i < grp->nr_pins; ++i) {
Laurent Pinchart861601d2013-03-10 15:29:14 +0100122 if (sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION))
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +0100123 goto done;
124 }
125
126 ret = 0;
127
128done:
129 spin_unlock_irqrestore(&pfc->lock, flags);
130 return ret;
Paul Mundtca5481c62012-07-10 12:08:14 +0900131}
132
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +0100133static void sh_pfc_func_disable(struct pinctrl_dev *pctldev, unsigned selector,
Paul Mundtca5481c62012-07-10 12:08:14 +0900134 unsigned group)
135{
136}
137
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100138static int sh_pfc_reconfig_pin(struct sh_pfc_pinctrl *pmx, unsigned offset,
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900139 int new_type)
140{
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100141 struct sh_pfc *pfc = pmx->pfc;
142 int idx = sh_pfc_get_pin_index(pfc, offset);
143 struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
Laurent Pinchartcd3c1be2013-02-16 18:47:05 +0100144 const struct sh_pfc_pin *pin = &pfc->info->pins[idx];
Laurent Pinchart934cb022013-02-14 22:35:09 +0100145 unsigned int mark = pin->enum_id;
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900146 unsigned long flags;
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900147 int ret = -EINVAL;
148
149 spin_lock_irqsave(&pfc->lock, flags);
150
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100151 switch (cfg->type) {
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900152 case PINMUX_TYPE_GPIO:
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900153 case PINMUX_TYPE_OUTPUT:
154 case PINMUX_TYPE_INPUT:
155 case PINMUX_TYPE_INPUT_PULLUP:
156 case PINMUX_TYPE_INPUT_PULLDOWN:
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900157 break;
158 default:
159 goto err;
160 }
161
Laurent Pinchart861601d2013-03-10 15:29:14 +0100162 if (sh_pfc_config_mux(pfc, mark, new_type) != 0)
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900163 goto err;
164
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100165 cfg->type = new_type;
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900166
167 ret = 0;
168
169err:
170 spin_unlock_irqrestore(&pfc->lock, flags);
171
172 return ret;
173}
174
Paul Mundtca5481c62012-07-10 12:08:14 +0900175static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
176 struct pinctrl_gpio_range *range,
177 unsigned offset)
178{
179 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
180 struct sh_pfc *pfc = pmx->pfc;
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100181 int idx = sh_pfc_get_pin_index(pfc, offset);
182 struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
Paul Mundtca5481c62012-07-10 12:08:14 +0900183 unsigned long flags;
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100184 int ret;
Paul Mundtca5481c62012-07-10 12:08:14 +0900185
186 spin_lock_irqsave(&pfc->lock, flags);
187
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100188 switch (cfg->type) {
Paul Mundtd93a8912012-07-11 17:17:10 +0900189 case PINMUX_TYPE_GPIO:
Paul Mundt16d74eb2012-09-25 11:51:05 +0900190 case PINMUX_TYPE_INPUT:
191 case PINMUX_TYPE_OUTPUT:
Paul Mundtd93a8912012-07-11 17:17:10 +0900192 break;
Laurent Pinchart2119f7c2012-11-29 13:03:53 +0100193 case PINMUX_TYPE_FUNCTION:
Paul Mundtd93a8912012-07-11 17:17:10 +0900194 default:
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100195 pr_err("Unsupported mux type (%d), bailing...\n", cfg->type);
Laurent Pinchart077664a2012-09-14 20:25:48 +0200196 ret = -ENOTSUPP;
197 goto err;
Paul Mundtd93a8912012-07-11 17:17:10 +0900198 }
Paul Mundtca5481c62012-07-10 12:08:14 +0900199
200 ret = 0;
201
202err:
203 spin_unlock_irqrestore(&pfc->lock, flags);
204
205 return ret;
206}
207
208static void sh_pfc_gpio_disable_free(struct pinctrl_dev *pctldev,
209 struct pinctrl_gpio_range *range,
210 unsigned offset)
211{
Paul Mundtca5481c62012-07-10 12:08:14 +0900212}
213
214static int sh_pfc_gpio_set_direction(struct pinctrl_dev *pctldev,
215 struct pinctrl_gpio_range *range,
216 unsigned offset, bool input)
217{
218 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900219 int type = input ? PINMUX_TYPE_INPUT : PINMUX_TYPE_OUTPUT;
Paul Mundtca5481c62012-07-10 12:08:14 +0900220
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100221 return sh_pfc_reconfig_pin(pmx, offset, type);
Paul Mundtca5481c62012-07-10 12:08:14 +0900222}
223
Laurent Pinchartfe330ce2013-02-15 16:04:47 +0100224static const struct pinmux_ops sh_pfc_pinmux_ops = {
Paul Mundtd93a8912012-07-11 17:17:10 +0900225 .get_functions_count = sh_pfc_get_functions_count,
226 .get_function_name = sh_pfc_get_function_name,
Paul Mundtca5481c62012-07-10 12:08:14 +0900227 .get_function_groups = sh_pfc_get_function_groups,
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +0100228 .enable = sh_pfc_func_enable,
229 .disable = sh_pfc_func_disable,
Paul Mundtca5481c62012-07-10 12:08:14 +0900230 .gpio_request_enable = sh_pfc_gpio_request_enable,
231 .gpio_disable_free = sh_pfc_gpio_disable_free,
232 .gpio_set_direction = sh_pfc_gpio_set_direction,
233};
234
Laurent Pinchart934cb022013-02-14 22:35:09 +0100235static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned _pin,
Paul Mundtca5481c62012-07-10 12:08:14 +0900236 unsigned long *config)
237{
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900238 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
239 struct sh_pfc *pfc = pmx->pfc;
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100240 int idx = sh_pfc_get_pin_index(pfc, _pin);
241 struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
Paul Mundtd93a8912012-07-11 17:17:10 +0900242
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100243 *config = cfg->type;
Paul Mundtd93a8912012-07-11 17:17:10 +0900244
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900245 return 0;
Paul Mundtca5481c62012-07-10 12:08:14 +0900246}
247
248static int sh_pfc_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin,
249 unsigned long config)
250{
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900251 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900252
253 /* Validate the new type */
254 if (config >= PINMUX_FLAG_TYPE)
255 return -EINVAL;
256
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100257 return sh_pfc_reconfig_pin(pmx, pin, config);
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900258}
259
260static void sh_pfc_pinconf_dbg_show(struct pinctrl_dev *pctldev,
261 struct seq_file *s, unsigned pin)
262{
263 const char *pinmux_type_str[] = {
264 [PINMUX_TYPE_NONE] = "none",
265 [PINMUX_TYPE_FUNCTION] = "function",
266 [PINMUX_TYPE_GPIO] = "gpio",
267 [PINMUX_TYPE_OUTPUT] = "output",
268 [PINMUX_TYPE_INPUT] = "input",
269 [PINMUX_TYPE_INPUT_PULLUP] = "input bias pull up",
270 [PINMUX_TYPE_INPUT_PULLDOWN] = "input bias pull down",
271 };
272 unsigned long config;
273 int rc;
274
275 rc = sh_pfc_pinconf_get(pctldev, pin, &config);
276 if (unlikely(rc != 0))
277 return;
278
279 seq_printf(s, " %s", pinmux_type_str[config]);
Paul Mundtca5481c62012-07-10 12:08:14 +0900280}
281
Laurent Pinchartfe330ce2013-02-15 16:04:47 +0100282static const struct pinconf_ops sh_pfc_pinconf_ops = {
Paul Mundtca5481c62012-07-10 12:08:14 +0900283 .pin_config_get = sh_pfc_pinconf_get,
284 .pin_config_set = sh_pfc_pinconf_set,
Paul Mundtfdd85ec2012-07-20 16:39:09 +0900285 .pin_config_dbg_show = sh_pfc_pinconf_dbg_show,
Paul Mundtca5481c62012-07-10 12:08:14 +0900286};
287
Laurent Pinchart63d57382013-02-15 01:33:38 +0100288/* PFC ranges -> pinctrl pin descs */
289static int sh_pfc_map_pins(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx)
Paul Mundtca5481c62012-07-10 12:08:14 +0900290{
Laurent Pinchart63d57382013-02-15 01:33:38 +0100291 const struct pinmux_range *ranges;
292 struct pinmux_range def_range;
293 unsigned int nr_ranges;
294 unsigned int nr_pins;
295 unsigned int i;
Paul Mundtca5481c62012-07-10 12:08:14 +0900296
Laurent Pinchart63d57382013-02-15 01:33:38 +0100297 if (pfc->info->ranges == NULL) {
298 def_range.begin = 0;
299 def_range.end = pfc->info->nr_pins - 1;
300 ranges = &def_range;
301 nr_ranges = 1;
302 } else {
303 ranges = pfc->info->ranges;
304 nr_ranges = pfc->info->nr_ranges;
305 }
Paul Mundtca5481c62012-07-10 12:08:14 +0900306
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +0100307 pmx->pins = devm_kzalloc(pfc->dev,
308 sizeof(*pmx->pins) * pfc->info->nr_pins,
Laurent Pinchart1724acf2012-12-15 23:50:48 +0100309 GFP_KERNEL);
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +0100310 if (unlikely(!pmx->pins))
Paul Mundtca5481c62012-07-10 12:08:14 +0900311 return -ENOMEM;
Laurent Pinchart63d57382013-02-15 01:33:38 +0100312
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100313 pmx->configs = devm_kzalloc(pfc->dev,
314 sizeof(*pmx->configs) * pfc->info->nr_pins,
315 GFP_KERNEL);
316 if (unlikely(!pmx->configs))
317 return -ENOMEM;
318
Laurent Pinchart63d57382013-02-15 01:33:38 +0100319 for (i = 0, nr_pins = 0; i < nr_ranges; ++i) {
320 const struct pinmux_range *range = &ranges[i];
321 unsigned int number;
322
323 for (number = range->begin; number <= range->end;
324 number++, nr_pins++) {
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100325 struct sh_pfc_pin_config *cfg = &pmx->configs[nr_pins];
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +0100326 struct pinctrl_pin_desc *pin = &pmx->pins[nr_pins];
Laurent Pinchartcd3c1be2013-02-16 18:47:05 +0100327 const struct sh_pfc_pin *info =
328 &pfc->info->pins[nr_pins];
Laurent Pinchart63d57382013-02-15 01:33:38 +0100329
330 pin->number = number;
331 pin->name = info->name;
Laurent Pinchart1a0039d2013-03-08 17:43:54 +0100332 cfg->type = PINMUX_TYPE_GPIO;
Laurent Pinchart63d57382013-02-15 01:33:38 +0100333 }
Paul Mundtca5481c62012-07-10 12:08:14 +0900334 }
335
Laurent Pinchart63d57382013-02-15 01:33:38 +0100336 pfc->nr_pins = ranges[nr_ranges-1].end + 1;
Paul Mundtca5481c62012-07-10 12:08:14 +0900337
Laurent Pinchart63d57382013-02-15 01:33:38 +0100338 return nr_ranges;
Paul Mundtca5481c62012-07-10 12:08:14 +0900339}
340
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100341int sh_pfc_register_pinctrl(struct sh_pfc *pfc)
Paul Mundtca5481c62012-07-10 12:08:14 +0900342{
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100343 struct sh_pfc_pinctrl *pmx;
Laurent Pinchart63d57382013-02-15 01:33:38 +0100344 int nr_ranges;
Paul Mundtca5481c62012-07-10 12:08:14 +0900345
Laurent Pinchart1724acf2012-12-15 23:50:48 +0100346 pmx = devm_kzalloc(pfc->dev, sizeof(*pmx), GFP_KERNEL);
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100347 if (unlikely(!pmx))
348 return -ENOMEM;
Paul Mundtca5481c62012-07-10 12:08:14 +0900349
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100350 pmx->pfc = pfc;
351 pfc->pinctrl = pmx;
352
Laurent Pinchart63d57382013-02-15 01:33:38 +0100353 nr_ranges = sh_pfc_map_pins(pfc, pmx);
354 if (unlikely(nr_ranges < 0))
355 return nr_ranges;
Paul Mundtca5481c62012-07-10 12:08:14 +0900356
Laurent Pinchartdcc427e2013-02-16 16:38:30 +0100357 pmx->pctl_desc.name = DRV_NAME;
358 pmx->pctl_desc.owner = THIS_MODULE;
359 pmx->pctl_desc.pctlops = &sh_pfc_pinctrl_ops;
360 pmx->pctl_desc.pmxops = &sh_pfc_pinmux_ops;
361 pmx->pctl_desc.confops = &sh_pfc_pinconf_ops;
Laurent Pinchart3d8d9f12013-01-03 14:33:13 +0100362 pmx->pctl_desc.pins = pmx->pins;
Laurent Pinchart63d57382013-02-15 01:33:38 +0100363 pmx->pctl_desc.npins = pfc->info->nr_pins;
Laurent Pinchartdcc427e2013-02-16 16:38:30 +0100364
365 pmx->pctl = pinctrl_register(&pmx->pctl_desc, pfc->dev, pmx);
Wei Yongjunfd9d05b2013-03-11 22:08:12 +0800366 if (pmx->pctl == NULL)
367 return -EINVAL;
Paul Mundtca5481c62012-07-10 12:08:14 +0900368
Paul Mundtca5481c62012-07-10 12:08:14 +0900369 return 0;
Paul Mundtca5481c62012-07-10 12:08:14 +0900370}
371
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100372int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc)
Paul Mundtca5481c62012-07-10 12:08:14 +0900373{
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100374 struct sh_pfc_pinctrl *pmx = pfc->pinctrl;
Paul Mundtca5481c62012-07-10 12:08:14 +0900375
Paul Mundtca5481c62012-07-10 12:08:14 +0900376 pinctrl_unregister(pmx->pctl);
377
Laurent Pinchartc6193ea2012-12-15 23:50:47 +0100378 pfc->pinctrl = NULL;
Paul Mundtca5481c62012-07-10 12:08:14 +0900379 return 0;
380}