[PATCH 24/45] pinctrl: at91: Fix a bug in at91_pinctrl_set_state

Andrey Smirnov andrew.smirnov at gmail.com
Mon Mar 6 14:53:35 PST 2017


Pin number, as specified in OF pinumx entries, is relative to each bank
start, whereas both at91_mux_pin() and at91_pinctrl_set_conf() asssume
absolute pin numbering, so we need to take into account each bank's pin
base and convert pin number appropriately. Failing to do so results in
any pinmux configuration being applied to pins in bank A.

Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
---
 drivers/pinctrl/pinctrl-at91.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index e24c9be..34fb0ae 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -462,6 +462,8 @@ static int at91_pinctrl_set_state(struct pinctrl_device *pdev, struct device_nod
 		mux = be32_to_cpu(*list++);
 		conf = be32_to_cpu(*list++);
 
+		pin_num += bank_num * MAX_NB_GPIO_PER_BANK;
+
 		ret = at91_mux_pin(pin_num, mux, conf & PULL_UP);
 		if (ret) {
 			dev_err(pdev->dev, "failed to mux pin %d\n", pin_num);
-- 
2.9.3




More information about the barebox mailing list