aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2012-10-11 04:11:13 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-10-15 03:10:11 -0400
commitab663789d69760d2735402f66501f20b60312a3d (patch)
tree67483cfb29a5d3bc6c4c1e23dc77f5bede862414 /drivers
parenta7a8241540c3168965588d313f46b14f79e86753 (diff)
pinctrl: samsung: Match pin banks with their device nodes
This patch is a preparation for converting the pinctrl-samsung driver to one GPIO chip and IRQ domain per bank. It binds banks defined by internal driver data with bank nodes in device tree. Signed-off-by: Tomasz Figa <t.figa@samsung.com> Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Thomas Abraham <thomas.abraham@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pinctrl/pinctrl-samsung.c13
-rw-r--r--drivers/pinctrl/pinctrl-samsung.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
index 94e13780a6a6..f266710a1b04 100644
--- a/drivers/pinctrl/pinctrl-samsung.c
+++ b/drivers/pinctrl/pinctrl-samsung.c
@@ -794,6 +794,7 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data(
794 int id; 794 int id;
795 const struct of_device_id *match; 795 const struct of_device_id *match;
796 const struct device_node *node = pdev->dev.of_node; 796 const struct device_node *node = pdev->dev.of_node;
797 struct device_node *np;
797 struct samsung_pin_ctrl *ctrl; 798 struct samsung_pin_ctrl *ctrl;
798 struct samsung_pin_bank *bank; 799 struct samsung_pin_bank *bank;
799 int i; 800 int i;
@@ -816,6 +817,18 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data(
816 } 817 }
817 } 818 }
818 819
820 for_each_child_of_node(node, np) {
821 if (!of_find_property(np, "gpio-controller", NULL))
822 continue;
823 bank = ctrl->pin_banks;
824 for (i = 0; i < ctrl->nr_banks; ++i, ++bank) {
825 if (!strcmp(bank->name, np->name)) {
826 bank->of_node = np;
827 break;
828 }
829 }
830 }
831
819 ctrl->base = pin_base; 832 ctrl->base = pin_base;
820 pin_base += ctrl->nr_pins; 833 pin_base += ctrl->nr_pins;
821 834
diff --git a/drivers/pinctrl/pinctrl-samsung.h b/drivers/pinctrl/pinctrl-samsung.h
index b8956934cda6..5c53f32cca06 100644
--- a/drivers/pinctrl/pinctrl-samsung.h
+++ b/drivers/pinctrl/pinctrl-samsung.h
@@ -111,6 +111,7 @@ struct samsung_pinctrl_drv_data;
111 * @eint_type: type of the external interrupt supported by the bank. 111 * @eint_type: type of the external interrupt supported by the bank.
112 * @irq_base: starting controller local irq number of the bank. 112 * @irq_base: starting controller local irq number of the bank.
113 * @name: name to be prefixed for each pin in this pin bank. 113 * @name: name to be prefixed for each pin in this pin bank.
114 * @of_node: OF node of the bank.
114 */ 115 */
115struct samsung_pin_bank { 116struct samsung_pin_bank {
116 u32 pctl_offset; 117 u32 pctl_offset;
@@ -124,6 +125,7 @@ struct samsung_pin_bank {
124 enum eint_type eint_type; 125 enum eint_type eint_type;
125 u32 irq_base; 126 u32 irq_base;
126 char *name; 127 char *name;
128 struct device_node *of_node;
127}; 129};
128 130
129/** 131/**