Commit ab663789 authored by Tomasz Figa's avatar Tomasz Figa Committed by Linus Walleij

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: default avatarTomasz Figa <t.figa@samsung.com>
Reviewed-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Acked-by: default avatarThomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent a7a82415
...@@ -794,6 +794,7 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data( ...@@ -794,6 +794,7 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data(
int id; int id;
const struct of_device_id *match; const struct of_device_id *match;
const struct device_node *node = pdev->dev.of_node; const struct device_node *node = pdev->dev.of_node;
struct device_node *np;
struct samsung_pin_ctrl *ctrl; struct samsung_pin_ctrl *ctrl;
struct samsung_pin_bank *bank; struct samsung_pin_bank *bank;
int i; int i;
...@@ -816,6 +817,18 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data( ...@@ -816,6 +817,18 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data(
} }
} }
for_each_child_of_node(node, np) {
if (!of_find_property(np, "gpio-controller", NULL))
continue;
bank = ctrl->pin_banks;
for (i = 0; i < ctrl->nr_banks; ++i, ++bank) {
if (!strcmp(bank->name, np->name)) {
bank->of_node = np;
break;
}
}
}
ctrl->base = pin_base; ctrl->base = pin_base;
pin_base += ctrl->nr_pins; pin_base += ctrl->nr_pins;
......
...@@ -111,6 +111,7 @@ struct samsung_pinctrl_drv_data; ...@@ -111,6 +111,7 @@ struct samsung_pinctrl_drv_data;
* @eint_type: type of the external interrupt supported by the bank. * @eint_type: type of the external interrupt supported by the bank.
* @irq_base: starting controller local irq number of the bank. * @irq_base: starting controller local irq number of the bank.
* @name: name to be prefixed for each pin in this pin bank. * @name: name to be prefixed for each pin in this pin bank.
* @of_node: OF node of the bank.
*/ */
struct samsung_pin_bank { struct samsung_pin_bank {
u32 pctl_offset; u32 pctl_offset;
...@@ -124,6 +125,7 @@ struct samsung_pin_bank { ...@@ -124,6 +125,7 @@ struct samsung_pin_bank {
enum eint_type eint_type; enum eint_type eint_type;
u32 irq_base; u32 irq_base;
char *name; char *name;
struct device_node *of_node;
}; };
/** /**
......
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