mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
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>
This commit is contained in:
parent
0ccaf5bb3f
commit
0c151062f3
3 changed files with 18 additions and 1 deletions
|
@ -372,6 +372,12 @@ static int sh_pfc_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
spin_lock_init(&pfc->lock);
|
spin_lock_init(&pfc->lock);
|
||||||
|
|
||||||
|
if (info->ops && info->ops->init) {
|
||||||
|
ret = info->ops->init(pfc);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
pinctrl_provide_dummies();
|
pinctrl_provide_dummies();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -379,7 +385,7 @@ static int sh_pfc_probe(struct platform_device *pdev)
|
||||||
*/
|
*/
|
||||||
ret = sh_pfc_register_pinctrl(pfc);
|
ret = sh_pfc_register_pinctrl(pfc);
|
||||||
if (unlikely(ret != 0))
|
if (unlikely(ret != 0))
|
||||||
return ret;
|
goto error;
|
||||||
|
|
||||||
#ifdef CONFIG_GPIO_SH_PFC
|
#ifdef CONFIG_GPIO_SH_PFC
|
||||||
/*
|
/*
|
||||||
|
@ -401,6 +407,11 @@ static int sh_pfc_probe(struct platform_device *pdev)
|
||||||
dev_info(pfc->dev, "%s support registered\n", info->name);
|
dev_info(pfc->dev, "%s support registered\n", info->name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
if (info->ops && info->ops->exit)
|
||||||
|
info->ops->exit(pfc);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sh_pfc_remove(struct platform_device *pdev)
|
static int sh_pfc_remove(struct platform_device *pdev)
|
||||||
|
@ -412,6 +423,9 @@ static int sh_pfc_remove(struct platform_device *pdev)
|
||||||
#endif
|
#endif
|
||||||
sh_pfc_unregister_pinctrl(pfc);
|
sh_pfc_unregister_pinctrl(pfc);
|
||||||
|
|
||||||
|
if (pfc->info->ops && pfc->info->ops->exit)
|
||||||
|
pfc->info->ops->exit(pfc);
|
||||||
|
|
||||||
platform_set_drvdata(pdev, NULL);
|
platform_set_drvdata(pdev, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -28,6 +28,7 @@ struct sh_pfc_pinctrl;
|
||||||
struct sh_pfc {
|
struct sh_pfc {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
const struct sh_pfc_soc_info *info;
|
const struct sh_pfc_soc_info *info;
|
||||||
|
void *soc_data;
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
|
|
||||||
unsigned int num_windows;
|
unsigned int num_windows;
|
||||||
|
|
|
@ -129,6 +129,8 @@ struct pinmux_range {
|
||||||
struct sh_pfc;
|
struct sh_pfc;
|
||||||
|
|
||||||
struct sh_pfc_soc_operations {
|
struct sh_pfc_soc_operations {
|
||||||
|
int (*init)(struct sh_pfc *pfc);
|
||||||
|
void (*exit)(struct sh_pfc *pfc);
|
||||||
unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin);
|
unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin);
|
||||||
void (*set_bias)(struct sh_pfc *pfc, unsigned int pin,
|
void (*set_bias)(struct sh_pfc *pfc, unsigned int pin,
|
||||||
unsigned int bias);
|
unsigned int bias);
|
||||||
|
|
Loading…
Reference in a new issue