aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-04-21 14:21:57 -0400
committerSimon Horman <horms+renesas@verge.net.au>2013-06-05 04:17:13 -0400
commit0c151062f32c9db819c2ca3081d6f98194d61e78 (patch)
tree301b050b24e05fd9e48fbcbe1e21ae6f931a56ee
parent0ccaf5bb3fb6ad8d1fe3464cf269a3225c853c46 (diff)
sh-pfc: Add support for SoC-specific initialization
Add two optional init and exit SoC operations and call them from the core at probe and remove time. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r--drivers/pinctrl/sh-pfc/core.c16
-rw-r--r--drivers/pinctrl/sh-pfc/core.h1
-rw-r--r--drivers/pinctrl/sh-pfc/sh_pfc.h2
3 files changed, 18 insertions, 1 deletions
diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index 4540ce384ee5..3b2fd43ff294 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -372,6 +372,12 @@ static int sh_pfc_probe(struct platform_device *pdev)
372 372
373 spin_lock_init(&pfc->lock); 373 spin_lock_init(&pfc->lock);
374 374
375 if (info->ops && info->ops->init) {
376 ret = info->ops->init(pfc);
377 if (ret < 0)
378 return ret;
379 }
380
375 pinctrl_provide_dummies(); 381 pinctrl_provide_dummies();
376 382
377 /* 383 /*
@@ -379,7 +385,7 @@ static int sh_pfc_probe(struct platform_device *pdev)
379 */ 385 */
380 ret = sh_pfc_register_pinctrl(pfc); 386 ret = sh_pfc_register_pinctrl(pfc);
381 if (unlikely(ret != 0)) 387 if (unlikely(ret != 0))
382 return ret; 388 goto error;
383 389
384#ifdef CONFIG_GPIO_SH_PFC 390#ifdef CONFIG_GPIO_SH_PFC
385 /* 391 /*
@@ -401,6 +407,11 @@ static int sh_pfc_probe(struct platform_device *pdev)
401 dev_info(pfc->dev, "%s support registered\n", info->name); 407 dev_info(pfc->dev, "%s support registered\n", info->name);
402 408
403 return 0; 409 return 0;
410
411error:
412 if (info->ops && info->ops->exit)
413 info->ops->exit(pfc);
414 return ret;
404} 415}
405 416
406static int sh_pfc_remove(struct platform_device *pdev) 417static int sh_pfc_remove(struct platform_device *pdev)
@@ -412,6 +423,9 @@ static int sh_pfc_remove(struct platform_device *pdev)
412#endif 423#endif
413 sh_pfc_unregister_pinctrl(pfc); 424 sh_pfc_unregister_pinctrl(pfc);
414 425
426 if (pfc->info->ops && pfc->info->ops->exit)
427 pfc->info->ops->exit(pfc);
428
415 platform_set_drvdata(pdev, NULL); 429 platform_set_drvdata(pdev, NULL);
416 430
417 return 0; 431 return 0;
diff --git a/drivers/pinctrl/sh-pfc/core.h b/drivers/pinctrl/sh-pfc/core.h
index e847afbe1f98..f02ba1dde3a0 100644
--- a/drivers/pinctrl/sh-pfc/core.h
+++ b/drivers/pinctrl/sh-pfc/core.h
@@ -28,6 +28,7 @@ struct sh_pfc_pinctrl;
28struct sh_pfc { 28struct sh_pfc {
29 struct device *dev; 29 struct device *dev;
30 const struct sh_pfc_soc_info *info; 30 const struct sh_pfc_soc_info *info;
31 void *soc_data;
31 spinlock_t lock; 32 spinlock_t lock;
32 33
33 unsigned int num_windows; 34 unsigned int num_windows;
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index b1707612d24f..830ae1ffd0b5 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -129,6 +129,8 @@ struct pinmux_range {
129struct sh_pfc; 129struct sh_pfc;
130 130
131struct sh_pfc_soc_operations { 131struct sh_pfc_soc_operations {
132 int (*init)(struct sh_pfc *pfc);
133 void (*exit)(struct sh_pfc *pfc);
132 unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin); 134 unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin);
133 void (*set_bias)(struct sh_pfc *pfc, unsigned int pin, 135 void (*set_bias)(struct sh_pfc *pfc, unsigned int pin,
134 unsigned int bias); 136 unsigned int bias);