diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2014-04-18 14:10:41 -0400 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2014-05-04 03:03:24 -0400 |
commit | 2284ba6b7d8310d09f3a0a5d81669632532ec26c (patch) | |
tree | 32fae9eaeb8509665f73e75c751bfb7cf61cbd47 /drivers/pinctrl | |
parent | 4409cafc1a4ce73ffc4a2107cda85fc1f034def0 (diff) |
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: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/sunxi/pinctrl-sunxi.c | 21 | ||||
-rw-r--r-- | drivers/pinctrl/sunxi/pinctrl-sunxi.h | 3 |
2 files changed, 17 insertions, 7 deletions
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index f0e908702ebe..b06ce90f1ed8 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c | |||
@@ -787,10 +787,10 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev) | |||
787 | return 0; | 787 | return 0; |
788 | } | 788 | } |
789 | 789 | ||
790 | static int sunxi_pinctrl_probe(struct platform_device *pdev) | 790 | int sunxi_pinctrl_init(struct platform_device *pdev, |
791 | const struct sunxi_pinctrl_desc *desc) | ||
791 | { | 792 | { |
792 | struct device_node *node = pdev->dev.of_node; | 793 | struct device_node *node = pdev->dev.of_node; |
793 | const struct of_device_id *device; | ||
794 | struct pinctrl_pin_desc *pins; | 794 | struct pinctrl_pin_desc *pins; |
795 | struct sunxi_pinctrl *pctl; | 795 | struct sunxi_pinctrl *pctl; |
796 | struct reset_control *rstc; | 796 | struct reset_control *rstc; |
@@ -810,11 +810,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev) | |||
810 | if (IS_ERR(pctl->membase)) | 810 | if (IS_ERR(pctl->membase)) |
811 | return PTR_ERR(pctl->membase); | 811 | return PTR_ERR(pctl->membase); |
812 | 812 | ||
813 | device = of_match_device(sunxi_pinctrl_match, &pdev->dev); | 813 | pctl->desc = desc; |
814 | if (!device) | ||
815 | return -ENODEV; | ||
816 | |||
817 | pctl->desc = device->data; | ||
818 | 814 | ||
819 | ret = sunxi_pinctrl_build_state(pdev); | 815 | ret = sunxi_pinctrl_build_state(pdev); |
820 | if (ret) { | 816 | if (ret) { |
@@ -940,6 +936,17 @@ pinctrl_error: | |||
940 | return ret; | 936 | return ret; |
941 | } | 937 | } |
942 | 938 | ||
939 | static int sunxi_pinctrl_probe(struct platform_device *pdev) | ||
940 | { | ||
941 | const struct of_device_id *device; | ||
942 | |||
943 | device = of_match_device(sunxi_pinctrl_match, &pdev->dev); | ||
944 | if (!device) | ||
945 | return -ENODEV; | ||
946 | |||
947 | return sunxi_pinctrl_init(pdev, device->data); | ||
948 | } | ||
949 | |||
943 | static struct platform_driver sunxi_pinctrl_driver = { | 950 | static struct platform_driver sunxi_pinctrl_driver = { |
944 | .probe = sunxi_pinctrl_probe, | 951 | .probe = sunxi_pinctrl_probe, |
945 | .driver = { | 952 | .driver = { |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h index 9775a5003b01..8169ba598876 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h | |||
@@ -252,4 +252,7 @@ static inline u32 sunxi_irq_status_offset(u16 irq) | |||
252 | return irq_num * IRQ_STATUS_IRQ_BITS; | 252 | return irq_num * IRQ_STATUS_IRQ_BITS; |
253 | } | 253 | } |
254 | 254 | ||
255 | int sunxi_pinctrl_init(struct platform_device *pdev, | ||
256 | const struct sunxi_pinctrl_desc *desc); | ||
257 | |||
255 | #endif /* __PINCTRL_SUNXI_H */ | 258 | #endif /* __PINCTRL_SUNXI_H */ |