Commit 2284ba6b authored by Maxime Ripard's avatar Maxime Ripard

pinctrl: sunxi: Libraryse the driver

This will allow to have multiple drivers using the same core code, and
eventually, retire pinctrl-sunxi-pins.h
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
parent 4409cafc
...@@ -787,10 +787,10 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev) ...@@ -787,10 +787,10 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev)
return 0; return 0;
} }
static int sunxi_pinctrl_probe(struct platform_device *pdev) int sunxi_pinctrl_init(struct platform_device *pdev,
const struct sunxi_pinctrl_desc *desc)
{ {
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
const struct of_device_id *device;
struct pinctrl_pin_desc *pins; struct pinctrl_pin_desc *pins;
struct sunxi_pinctrl *pctl; struct sunxi_pinctrl *pctl;
struct reset_control *rstc; struct reset_control *rstc;
...@@ -810,11 +810,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) ...@@ -810,11 +810,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
if (IS_ERR(pctl->membase)) if (IS_ERR(pctl->membase))
return PTR_ERR(pctl->membase); return PTR_ERR(pctl->membase);
device = of_match_device(sunxi_pinctrl_match, &pdev->dev); pctl->desc = desc;
if (!device)
return -ENODEV;
pctl->desc = device->data;
ret = sunxi_pinctrl_build_state(pdev); ret = sunxi_pinctrl_build_state(pdev);
if (ret) { if (ret) {
...@@ -940,6 +936,17 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) ...@@ -940,6 +936,17 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int sunxi_pinctrl_probe(struct platform_device *pdev)
{
const struct of_device_id *device;
device = of_match_device(sunxi_pinctrl_match, &pdev->dev);
if (!device)
return -ENODEV;
return sunxi_pinctrl_init(pdev, device->data);
}
static struct platform_driver sunxi_pinctrl_driver = { static struct platform_driver sunxi_pinctrl_driver = {
.probe = sunxi_pinctrl_probe, .probe = sunxi_pinctrl_probe,
.driver = { .driver = {
......
...@@ -252,4 +252,7 @@ static inline u32 sunxi_irq_status_offset(u16 irq) ...@@ -252,4 +252,7 @@ static inline u32 sunxi_irq_status_offset(u16 irq)
return irq_num * IRQ_STATUS_IRQ_BITS; return irq_num * IRQ_STATUS_IRQ_BITS;
} }
int sunxi_pinctrl_init(struct platform_device *pdev,
const struct sunxi_pinctrl_desc *desc);
#endif /* __PINCTRL_SUNXI_H */ #endif /* __PINCTRL_SUNXI_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment