All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] pinctrl: sunxi: Start to enforce the strict mode
@ 2017-10-05 20:54 ` Maxime Ripard
  0 siblings, 0 replies; 19+ messages in thread
From: Maxime Ripard @ 2017-10-05 20:54 UTC (permalink / raw)
  To: Chen-Yu Tsai, Maxime Ripard, linus.walleij
  Cc: linux-arm-kernel, linux-kernel, linux-gpio

Hi,

Here is an attempt to enable pinctrl's strict mode on our pinctrl drivers.
Indeed, our controllers should have had that mode enabled since its
introduction.

However, there's a number of issues with old device trees that prevent from
just enabling it for all the devices. There's basically two of them:

  - Most of our old DTs have a pinctrl node for GPIOs, which will result in
    an error when the driver is going to request the gpio because it would
    already be requested automatically by pinctrl. We cannot break those.

  - Some of these GPIOs also need to change their pin configuration to add
    a bias or change the current output, and there isn't a migration path.

Let's just keep the old behaviour for the old SoCs, and enforce it on the
new one, and enabled it by default so that the situation at least doesn't
get worse.

This has been tested on an A83t (strict on) and an H3 (strict off) board.

Let me know what you think,
Maxime

Maxime Ripard (3):
  pinctrl: sunxi: Introduce the strict flag
  pinctrl: sunxi: Disable strict mode for old pinctrl drivers
  pinctrl: sunxi: Enforce the strict mode by default

 drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
 drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sunxi.c     | 6 +++++-
 drivers/pinctrl/sunxi/pinctrl-sunxi.h     | 1 +
 9 files changed, 14 insertions(+), 2 deletions(-)

base-commit: c27ad2958485126c3828e59d53013d3b45ec14f2
-- 
git-series 0.9.1

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 0/3] pinctrl: sunxi: Start to enforce the strict mode
@ 2017-10-05 20:54 ` Maxime Ripard
  0 siblings, 0 replies; 19+ messages in thread
From: Maxime Ripard @ 2017-10-05 20:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Here is an attempt to enable pinctrl's strict mode on our pinctrl drivers.
Indeed, our controllers should have had that mode enabled since its
introduction.

However, there's a number of issues with old device trees that prevent from
just enabling it for all the devices. There's basically two of them:

  - Most of our old DTs have a pinctrl node for GPIOs, which will result in
    an error when the driver is going to request the gpio because it would
    already be requested automatically by pinctrl. We cannot break those.

  - Some of these GPIOs also need to change their pin configuration to add
    a bias or change the current output, and there isn't a migration path.

Let's just keep the old behaviour for the old SoCs, and enforce it on the
new one, and enabled it by default so that the situation at least doesn't
get worse.

This has been tested on an A83t (strict on) and an H3 (strict off) board.

Let me know what you think,
Maxime

Maxime Ripard (3):
  pinctrl: sunxi: Introduce the strict flag
  pinctrl: sunxi: Disable strict mode for old pinctrl drivers
  pinctrl: sunxi: Enforce the strict mode by default

 drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
 drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sunxi.c     | 6 +++++-
 drivers/pinctrl/sunxi/pinctrl-sunxi.h     | 1 +
 9 files changed, 14 insertions(+), 2 deletions(-)

base-commit: c27ad2958485126c3828e59d53013d3b45ec14f2
-- 
git-series 0.9.1

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/3] pinctrl: sunxi: Introduce the strict flag
  2017-10-05 20:54 ` Maxime Ripard
@ 2017-10-05 20:54   ` Maxime Ripard
  -1 siblings, 0 replies; 19+ messages in thread
From: Maxime Ripard @ 2017-10-05 20:54 UTC (permalink / raw)
  To: Chen-Yu Tsai, Maxime Ripard, linus.walleij
  Cc: linux-arm-kernel, linux-kernel, linux-gpio

Our pinctrl device should have had strict set all along. However, it wasn't
the case, and most of our old device trees also have a pinctrl group in
addition to the GPIOs properties, which mean that we can't really turn it
on now.

All our new SoCs don't have that group, so we should still enable that mode
on the newer one though.

In order to enable it by default, add a flag that will allow to disable
that mode that should be set by pinctrl drivers that cannot be migrated.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 5 ++++-
 drivers/pinctrl/sunxi/pinctrl-sunxi.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 52edf3b5988d..1753a5b1573f 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -690,7 +690,7 @@ sunxi_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
 	return 0;
 }
 
-static const struct pinmux_ops sunxi_pmx_ops = {
+static struct pinmux_ops sunxi_pmx_ops = {
 	.get_functions_count	= sunxi_pmx_get_funcs_cnt,
 	.get_function_name	= sunxi_pmx_get_func_name,
 	.get_function_groups	= sunxi_pmx_get_func_groups,
@@ -1307,6 +1307,9 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
 	pctrl_desc->pctlops = &sunxi_pctrl_ops;
 	pctrl_desc->pmxops =  &sunxi_pmx_ops;
 
+	if (desc->disable_strict_mode)
+		sunxi_pmx_ops.strict = false;
+
 	pctl->pctl_dev = devm_pinctrl_register(&pdev->dev, pctrl_desc, pctl);
 	if (IS_ERR(pctl->pctl_dev)) {
 		dev_err(&pdev->dev, "couldn't register pinctrl driver\n");
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
index 1bfc0d8a55df..11b128f54ed2 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
@@ -112,6 +112,7 @@ struct sunxi_pinctrl_desc {
 	unsigned			irq_banks;
 	unsigned			irq_bank_base;
 	bool				irq_read_needs_mux;
+	bool				disable_strict_mode;
 };
 
 struct sunxi_pinctrl_function {
-- 
git-series 0.9.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 1/3] pinctrl: sunxi: Introduce the strict flag
@ 2017-10-05 20:54   ` Maxime Ripard
  0 siblings, 0 replies; 19+ messages in thread
From: Maxime Ripard @ 2017-10-05 20:54 UTC (permalink / raw)
  To: linux-arm-kernel

Our pinctrl device should have had strict set all along. However, it wasn't
the case, and most of our old device trees also have a pinctrl group in
addition to the GPIOs properties, which mean that we can't really turn it
on now.

All our new SoCs don't have that group, so we should still enable that mode
on the newer one though.

In order to enable it by default, add a flag that will allow to disable
that mode that should be set by pinctrl drivers that cannot be migrated.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 5 ++++-
 drivers/pinctrl/sunxi/pinctrl-sunxi.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 52edf3b5988d..1753a5b1573f 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -690,7 +690,7 @@ sunxi_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
 	return 0;
 }
 
-static const struct pinmux_ops sunxi_pmx_ops = {
+static struct pinmux_ops sunxi_pmx_ops = {
 	.get_functions_count	= sunxi_pmx_get_funcs_cnt,
 	.get_function_name	= sunxi_pmx_get_func_name,
 	.get_function_groups	= sunxi_pmx_get_func_groups,
@@ -1307,6 +1307,9 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
 	pctrl_desc->pctlops = &sunxi_pctrl_ops;
 	pctrl_desc->pmxops =  &sunxi_pmx_ops;
 
+	if (desc->disable_strict_mode)
+		sunxi_pmx_ops.strict = false;
+
 	pctl->pctl_dev = devm_pinctrl_register(&pdev->dev, pctrl_desc, pctl);
 	if (IS_ERR(pctl->pctl_dev)) {
 		dev_err(&pdev->dev, "couldn't register pinctrl driver\n");
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
index 1bfc0d8a55df..11b128f54ed2 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
@@ -112,6 +112,7 @@ struct sunxi_pinctrl_desc {
 	unsigned			irq_banks;
 	unsigned			irq_bank_base;
 	bool				irq_read_needs_mux;
+	bool				disable_strict_mode;
 };
 
 struct sunxi_pinctrl_function {
-- 
git-series 0.9.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/3] pinctrl: sunxi: Disable strict mode for old pinctrl drivers
  2017-10-05 20:54 ` Maxime Ripard
@ 2017-10-05 20:54   ` Maxime Ripard
  -1 siblings, 0 replies; 19+ messages in thread
From: Maxime Ripard @ 2017-10-05 20:54 UTC (permalink / raw)
  To: Chen-Yu Tsai, Maxime Ripard, linus.walleij
  Cc: linux-arm-kernel, linux-kernel, linux-gpio

Old pinctrl drivers will need to disable strict mode for various reasons,
among which:
  - Some DT will still have a pinctrl group for each GPIO used, which will
    be rejected by pin_request. While we could remove those nodes, we still
    have to deal with old DTs.
  - Some GPIOs on these boards need to have their pin configuration changed
    (for bias or current), and there's no clear migration path

Let's disable the strict mode on those SoCs so that there's no breakage.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
 drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +
 7 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
index f763d8d62d6e..295e48fc94bc 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
@@ -1289,6 +1289,7 @@ static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = {
 	.npins = ARRAY_SIZE(sun4i_a10_pins),
 	.irq_banks = 1,
 	.irq_read_needs_mux = true,
+	.disable_strict_mode = true,
 };
 
 static int sun4i_a10_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun5i.c b/drivers/pinctrl/sunxi/pinctrl-sun5i.c
index 47afd558b114..27ec99e81c4c 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun5i.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun5i.c
@@ -713,6 +713,7 @@ static const struct sunxi_pinctrl_desc sun5i_pinctrl_data = {
 	.pins = sun5i_pins,
 	.npins = ARRAY_SIZE(sun5i_pins),
 	.irq_banks = 1,
+	.disable_strict_mode = true,
 };
 
 static int sun5i_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
index 951a25c18815..82ffaf466892 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
@@ -965,6 +965,7 @@ static const struct sunxi_pinctrl_desc sun6i_a31_pinctrl_data = {
 	.pins = sun6i_a31_pins,
 	.npins = ARRAY_SIZE(sun6i_a31_pins),
 	.irq_banks = 4,
+	.disable_strict_mode = true,
 };
 
 static int sun6i_a31_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
index 721b6935baf3..402fd7d21e7b 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
@@ -563,6 +563,7 @@ static const struct sunxi_pinctrl_desc sun8i_a23_pinctrl_data = {
 	.pins = sun8i_a23_pins,
 	.npins = ARRAY_SIZE(sun8i_a23_pins),
 	.irq_banks = 3,
+	.disable_strict_mode = true,
 };
 
 static int sun8i_a23_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
index ef1e0bef4099..da387211a75e 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
@@ -486,6 +486,7 @@ static const struct sunxi_pinctrl_desc sun8i_a33_pinctrl_data = {
 	.npins = ARRAY_SIZE(sun8i_a33_pins),
 	.irq_banks = 2,
 	.irq_bank_base = 1,
+	.disable_strict_mode = true,
 };
 
 static int sun8i_a33_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
index 518a92df4418..d1719a738c20 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
@@ -491,7 +491,8 @@ static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = {
 	.pins = sun8i_h3_pins,
 	.npins = ARRAY_SIZE(sun8i_h3_pins),
 	.irq_banks = 2,
-	.irq_read_needs_mux = true
+	.irq_read_needs_mux = true,
+	.disable_strict_mode = true,
 };
 
 static int sun8i_h3_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
index bc14e954d7a2..472ef0d91b99 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
@@ -721,6 +721,7 @@ static const struct sunxi_pinctrl_desc sun9i_a80_pinctrl_data = {
 	.pins = sun9i_a80_pins,
 	.npins = ARRAY_SIZE(sun9i_a80_pins),
 	.irq_banks = 5,
+	.disable_strict_mode = true,
 };
 
 static int sun9i_a80_pinctrl_probe(struct platform_device *pdev)
-- 
git-series 0.9.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/3] pinctrl: sunxi: Disable strict mode for old pinctrl drivers
@ 2017-10-05 20:54   ` Maxime Ripard
  0 siblings, 0 replies; 19+ messages in thread
From: Maxime Ripard @ 2017-10-05 20:54 UTC (permalink / raw)
  To: linux-arm-kernel

Old pinctrl drivers will need to disable strict mode for various reasons,
among which:
  - Some DT will still have a pinctrl group for each GPIO used, which will
    be rejected by pin_request. While we could remove those nodes, we still
    have to deal with old DTs.
  - Some GPIOs on these boards need to have their pin configuration changed
    (for bias or current), and there's no clear migration path

Let's disable the strict mode on those SoCs so that there's no breakage.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
 drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +
 7 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
index f763d8d62d6e..295e48fc94bc 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
@@ -1289,6 +1289,7 @@ static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = {
 	.npins = ARRAY_SIZE(sun4i_a10_pins),
 	.irq_banks = 1,
 	.irq_read_needs_mux = true,
+	.disable_strict_mode = true,
 };
 
 static int sun4i_a10_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun5i.c b/drivers/pinctrl/sunxi/pinctrl-sun5i.c
index 47afd558b114..27ec99e81c4c 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun5i.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun5i.c
@@ -713,6 +713,7 @@ static const struct sunxi_pinctrl_desc sun5i_pinctrl_data = {
 	.pins = sun5i_pins,
 	.npins = ARRAY_SIZE(sun5i_pins),
 	.irq_banks = 1,
+	.disable_strict_mode = true,
 };
 
 static int sun5i_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
index 951a25c18815..82ffaf466892 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
@@ -965,6 +965,7 @@ static const struct sunxi_pinctrl_desc sun6i_a31_pinctrl_data = {
 	.pins = sun6i_a31_pins,
 	.npins = ARRAY_SIZE(sun6i_a31_pins),
 	.irq_banks = 4,
+	.disable_strict_mode = true,
 };
 
 static int sun6i_a31_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
index 721b6935baf3..402fd7d21e7b 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
@@ -563,6 +563,7 @@ static const struct sunxi_pinctrl_desc sun8i_a23_pinctrl_data = {
 	.pins = sun8i_a23_pins,
 	.npins = ARRAY_SIZE(sun8i_a23_pins),
 	.irq_banks = 3,
+	.disable_strict_mode = true,
 };
 
 static int sun8i_a23_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
index ef1e0bef4099..da387211a75e 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
@@ -486,6 +486,7 @@ static const struct sunxi_pinctrl_desc sun8i_a33_pinctrl_data = {
 	.npins = ARRAY_SIZE(sun8i_a33_pins),
 	.irq_banks = 2,
 	.irq_bank_base = 1,
+	.disable_strict_mode = true,
 };
 
 static int sun8i_a33_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
index 518a92df4418..d1719a738c20 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
@@ -491,7 +491,8 @@ static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = {
 	.pins = sun8i_h3_pins,
 	.npins = ARRAY_SIZE(sun8i_h3_pins),
 	.irq_banks = 2,
-	.irq_read_needs_mux = true
+	.irq_read_needs_mux = true,
+	.disable_strict_mode = true,
 };
 
 static int sun8i_h3_pinctrl_probe(struct platform_device *pdev)
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
index bc14e954d7a2..472ef0d91b99 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
@@ -721,6 +721,7 @@ static const struct sunxi_pinctrl_desc sun9i_a80_pinctrl_data = {
 	.pins = sun9i_a80_pins,
 	.npins = ARRAY_SIZE(sun9i_a80_pins),
 	.irq_banks = 5,
+	.disable_strict_mode = true,
 };
 
 static int sun9i_a80_pinctrl_probe(struct platform_device *pdev)
-- 
git-series 0.9.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/3] pinctrl: sunxi: Enforce the strict mode by default
  2017-10-05 20:54 ` Maxime Ripard
@ 2017-10-05 20:54   ` Maxime Ripard
  -1 siblings, 0 replies; 19+ messages in thread
From: Maxime Ripard @ 2017-10-05 20:54 UTC (permalink / raw)
  To: Chen-Yu Tsai, Maxime Ripard, linus.walleij
  Cc: linux-arm-kernel, linux-kernel, linux-gpio

The strict mode should always have been enabled on our driver, and leaving
it unchecked just makes it harder to find a migration path as time passes.

Let's enable it by default now so that hopefully the new SoCs should be
safe.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 1753a5b1573f..2313c3b8931a 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -696,6 +696,7 @@ static struct pinmux_ops sunxi_pmx_ops = {
 	.get_function_groups	= sunxi_pmx_get_func_groups,
 	.set_mux		= sunxi_pmx_set_mux,
 	.gpio_set_direction	= sunxi_pmx_gpio_set_direction,
+	.strict			= true,
 };
 
 static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
-- 
git-series 0.9.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/3] pinctrl: sunxi: Enforce the strict mode by default
@ 2017-10-05 20:54   ` Maxime Ripard
  0 siblings, 0 replies; 19+ messages in thread
From: Maxime Ripard @ 2017-10-05 20:54 UTC (permalink / raw)
  To: linux-arm-kernel

The strict mode should always have been enabled on our driver, and leaving
it unchecked just makes it harder to find a migration path as time passes.

Let's enable it by default now so that hopefully the new SoCs should be
safe.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 1753a5b1573f..2313c3b8931a 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -696,6 +696,7 @@ static struct pinmux_ops sunxi_pmx_ops = {
 	.get_function_groups	= sunxi_pmx_get_func_groups,
 	.set_mux		= sunxi_pmx_set_mux,
 	.gpio_set_direction	= sunxi_pmx_gpio_set_direction,
+	.strict			= true,
 };
 
 static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
-- 
git-series 0.9.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/3] pinctrl: sunxi: Introduce the strict flag
  2017-10-05 20:54   ` Maxime Ripard
@ 2017-10-06  8:32     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2017-10-06  8:32 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Linus Walleij, linux-arm-kernel, linux-kernel, linux-gpio

On Fri, Oct 6, 2017 at 4:54 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Our pinctrl device should have had strict set all along. However, it wasn't
> the case, and most of our old device trees also have a pinctrl group in
> addition to the GPIOs properties, which mean that we can't really turn it
> on now.
>
> All our new SoCs don't have that group, so we should still enable that mode
> on the newer one though.
>
> In order to enable it by default, add a flag that will allow to disable
> that mode that should be set by pinctrl drivers that cannot be migrated.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/pinctrl/sunxi/pinctrl-sunxi.c | 5 ++++-
>  drivers/pinctrl/sunxi/pinctrl-sunxi.h | 1 +
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> index 52edf3b5988d..1753a5b1573f 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> @@ -690,7 +690,7 @@ sunxi_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
>         return 0;
>  }
>
> -static const struct pinmux_ops sunxi_pmx_ops = {
> +static struct pinmux_ops sunxi_pmx_ops = {
>         .get_functions_count    = sunxi_pmx_get_funcs_cnt,
>         .get_function_name      = sunxi_pmx_get_func_name,
>         .get_function_groups    = sunxi_pmx_get_func_groups,
> @@ -1307,6 +1307,9 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
>         pctrl_desc->pctlops = &sunxi_pctrl_ops;
>         pctrl_desc->pmxops =  &sunxi_pmx_ops;
>
> +       if (desc->disable_strict_mode)
> +               sunxi_pmx_ops.strict = false;

This is a bad idea. We have two pinctrl instances sharing the
same ops structure for later SoCs (the normal PIO and R_PIO).
What if they don't match? It would be better to make a copy,
(preferably) at runtime, or statically.

ChenYu

> +
>         pctl->pctl_dev = devm_pinctrl_register(&pdev->dev, pctrl_desc, pctl);
>         if (IS_ERR(pctl->pctl_dev)) {
>                 dev_err(&pdev->dev, "couldn't register pinctrl driver\n");
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> index 1bfc0d8a55df..11b128f54ed2 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> @@ -112,6 +112,7 @@ struct sunxi_pinctrl_desc {
>         unsigned                        irq_banks;
>         unsigned                        irq_bank_base;
>         bool                            irq_read_needs_mux;
> +       bool                            disable_strict_mode;
>  };
>
>  struct sunxi_pinctrl_function {
> --
> git-series 0.9.1

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/3] pinctrl: sunxi: Introduce the strict flag
@ 2017-10-06  8:32     ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2017-10-06  8:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 6, 2017 at 4:54 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Our pinctrl device should have had strict set all along. However, it wasn't
> the case, and most of our old device trees also have a pinctrl group in
> addition to the GPIOs properties, which mean that we can't really turn it
> on now.
>
> All our new SoCs don't have that group, so we should still enable that mode
> on the newer one though.
>
> In order to enable it by default, add a flag that will allow to disable
> that mode that should be set by pinctrl drivers that cannot be migrated.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/pinctrl/sunxi/pinctrl-sunxi.c | 5 ++++-
>  drivers/pinctrl/sunxi/pinctrl-sunxi.h | 1 +
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> index 52edf3b5988d..1753a5b1573f 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
> @@ -690,7 +690,7 @@ sunxi_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
>         return 0;
>  }
>
> -static const struct pinmux_ops sunxi_pmx_ops = {
> +static struct pinmux_ops sunxi_pmx_ops = {
>         .get_functions_count    = sunxi_pmx_get_funcs_cnt,
>         .get_function_name      = sunxi_pmx_get_func_name,
>         .get_function_groups    = sunxi_pmx_get_func_groups,
> @@ -1307,6 +1307,9 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
>         pctrl_desc->pctlops = &sunxi_pctrl_ops;
>         pctrl_desc->pmxops =  &sunxi_pmx_ops;
>
> +       if (desc->disable_strict_mode)
> +               sunxi_pmx_ops.strict = false;

This is a bad idea. We have two pinctrl instances sharing the
same ops structure for later SoCs (the normal PIO and R_PIO).
What if they don't match? It would be better to make a copy,
(preferably) at runtime, or statically.

ChenYu

> +
>         pctl->pctl_dev = devm_pinctrl_register(&pdev->dev, pctrl_desc, pctl);
>         if (IS_ERR(pctl->pctl_dev)) {
>                 dev_err(&pdev->dev, "couldn't register pinctrl driver\n");
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> index 1bfc0d8a55df..11b128f54ed2 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h
> @@ -112,6 +112,7 @@ struct sunxi_pinctrl_desc {
>         unsigned                        irq_banks;
>         unsigned                        irq_bank_base;
>         bool                            irq_read_needs_mux;
> +       bool                            disable_strict_mode;
>  };
>
>  struct sunxi_pinctrl_function {
> --
> git-series 0.9.1

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] pinctrl: sunxi: Disable strict mode for old pinctrl drivers
  2017-10-05 20:54   ` Maxime Ripard
@ 2017-10-06  8:34     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2017-10-06  8:34 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Linus Walleij, linux-arm-kernel, linux-kernel, linux-gpio

On Fri, Oct 6, 2017 at 4:54 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Old pinctrl drivers will need to disable strict mode for various reasons,
> among which:
>   - Some DT will still have a pinctrl group for each GPIO used, which will
>     be rejected by pin_request. While we could remove those nodes, we still
>     have to deal with old DTs.
>   - Some GPIOs on these boards need to have their pin configuration changed
>     (for bias or current), and there's no clear migration path
>
> Let's disable the strict mode on those SoCs so that there's no breakage.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
>  drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +

You should also set it for the R_PIO drivers.
IIRC you removed some entries for them in your
other patchset.

Otherwise,

Acked-by: Chen-Yu Tsai <wens@csie.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 2/3] pinctrl: sunxi: Disable strict mode for old pinctrl drivers
@ 2017-10-06  8:34     ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2017-10-06  8:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 6, 2017 at 4:54 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Old pinctrl drivers will need to disable strict mode for various reasons,
> among which:
>   - Some DT will still have a pinctrl group for each GPIO used, which will
>     be rejected by pin_request. While we could remove those nodes, we still
>     have to deal with old DTs.
>   - Some GPIOs on these boards need to have their pin configuration changed
>     (for bias or current), and there's no clear migration path
>
> Let's disable the strict mode on those SoCs so that there's no breakage.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
>  drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +

You should also set it for the R_PIO drivers.
IIRC you removed some entries for them in your
other patchset.

Otherwise,

Acked-by: Chen-Yu Tsai <wens@csie.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/3] pinctrl: sunxi: Enforce the strict mode by default
  2017-10-05 20:54   ` Maxime Ripard
@ 2017-10-06  8:34     ` Chen-Yu Tsai
  -1 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2017-10-06  8:34 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Linus Walleij, linux-arm-kernel, linux-kernel, linux-gpio

On Fri, Oct 6, 2017 at 4:54 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> The strict mode should always have been enabled on our driver, and leaving
> it unchecked just makes it harder to find a migration path as time passes.
>
> Let's enable it by default now so that hopefully the new SoCs should be
> safe.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Acked-by: Chen-Yu Tsai <wens@csie.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 3/3] pinctrl: sunxi: Enforce the strict mode by default
@ 2017-10-06  8:34     ` Chen-Yu Tsai
  0 siblings, 0 replies; 19+ messages in thread
From: Chen-Yu Tsai @ 2017-10-06  8:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Oct 6, 2017 at 4:54 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> The strict mode should always have been enabled on our driver, and leaving
> it unchecked just makes it harder to find a migration path as time passes.
>
> Let's enable it by default now so that hopefully the new SoCs should be
> safe.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Acked-by: Chen-Yu Tsai <wens@csie.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] pinctrl: sunxi: Disable strict mode for old pinctrl drivers
  2017-10-06  8:34     ` Chen-Yu Tsai
@ 2017-10-09  8:45       ` Maxime Ripard
  -1 siblings, 0 replies; 19+ messages in thread
From: Maxime Ripard @ 2017-10-09  8:45 UTC (permalink / raw)
  To: Chen-Yu Tsai; +Cc: Linus Walleij, linux-arm-kernel, linux-kernel, linux-gpio

[-- Attachment #1: Type: text/plain, Size: 1559 bytes --]

Hi,

On Fri, Oct 06, 2017 at 08:34:07AM +0000, Chen-Yu Tsai wrote:
> On Fri, Oct 6, 2017 at 4:54 AM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Old pinctrl drivers will need to disable strict mode for various reasons,
> > among which:
> >   - Some DT will still have a pinctrl group for each GPIO used, which will
> >     be rejected by pin_request. While we could remove those nodes, we still
> >     have to deal with old DTs.
> >   - Some GPIOs on these boards need to have their pin configuration changed
> >     (for bias or current), and there's no clear migration path
> >
> > Let's disable the strict mode on those SoCs so that there's no breakage.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> >  drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
> >  drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
> >  drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
> >  drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
> >  drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
> >  drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
> >  drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +
> 
> You should also set it for the R_PIO drivers.  IIRC you removed some
> entries for them in your other patchset.

I'll look into the R_PIO that can be switched on, but we won't be able
to enable that flag on the one where we removed nodes.

That would break the old DTs.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 2/3] pinctrl: sunxi: Disable strict mode for old pinctrl drivers
@ 2017-10-09  8:45       ` Maxime Ripard
  0 siblings, 0 replies; 19+ messages in thread
From: Maxime Ripard @ 2017-10-09  8:45 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Fri, Oct 06, 2017 at 08:34:07AM +0000, Chen-Yu Tsai wrote:
> On Fri, Oct 6, 2017 at 4:54 AM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
> > Old pinctrl drivers will need to disable strict mode for various reasons,
> > among which:
> >   - Some DT will still have a pinctrl group for each GPIO used, which will
> >     be rejected by pin_request. While we could remove those nodes, we still
> >     have to deal with old DTs.
> >   - Some GPIOs on these boards need to have their pin configuration changed
> >     (for bias or current), and there's no clear migration path
> >
> > Let's disable the strict mode on those SoCs so that there's no breakage.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> > ---
> >  drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
> >  drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
> >  drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
> >  drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
> >  drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
> >  drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
> >  drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +
> 
> You should also set it for the R_PIO drivers.  IIRC you removed some
> entries for them in your other patchset.

I'll look into the R_PIO that can be switched on, but we won't be able
to enable that flag on the one where we removed nodes.

That would break the old DTs.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171009/35c5530e/attachment.sig>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] pinctrl: sunxi: Disable strict mode for old pinctrl drivers
  2017-10-05 20:54   ` Maxime Ripard
  (?)
@ 2017-12-07 10:32     ` Ludovic Desroches
  -1 siblings, 0 replies; 19+ messages in thread
From: Ludovic Desroches @ 2017-12-07 10:32 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, linus.walleij, linux-arm-kernel, linux-kernel, linux-gpio

Hi,

On Thu, Oct 05, 2017 at 10:54:07PM +0200, Maxime Ripard wrote:
> Old pinctrl drivers will need to disable strict mode for various reasons,
> among which:
>   - Some DT will still have a pinctrl group for each GPIO used, which will
>     be rejected by pin_request. While we could remove those nodes, we still
>     have to deal with old DTs.
>   - Some GPIOs on these boards need to have their pin configuration changed
>     (for bias or current), and there's no clear migration path
> 
> Let's disable the strict mode on those SoCs so that there's no breakage.
> 

I revive this thread since I am facing the same issue. Did you find a way to
deal with it? I have not seen a new version of this set of patches, I may have
missed it.

Why you didn't choose to add an optionnal property to enforce the use of
the strict mode? I mean, with your solution, if there is a new DT with
an old pin controller, it won't benefit from the strict mode.

Ludovic

> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
>  drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +
>  7 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
> index f763d8d62d6e..295e48fc94bc 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
> @@ -1289,6 +1289,7 @@ static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = {
>  	.npins = ARRAY_SIZE(sun4i_a10_pins),
>  	.irq_banks = 1,
>  	.irq_read_needs_mux = true,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun4i_a10_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun5i.c b/drivers/pinctrl/sunxi/pinctrl-sun5i.c
> index 47afd558b114..27ec99e81c4c 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun5i.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun5i.c
> @@ -713,6 +713,7 @@ static const struct sunxi_pinctrl_desc sun5i_pinctrl_data = {
>  	.pins = sun5i_pins,
>  	.npins = ARRAY_SIZE(sun5i_pins),
>  	.irq_banks = 1,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun5i_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
> index 951a25c18815..82ffaf466892 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
> @@ -965,6 +965,7 @@ static const struct sunxi_pinctrl_desc sun6i_a31_pinctrl_data = {
>  	.pins = sun6i_a31_pins,
>  	.npins = ARRAY_SIZE(sun6i_a31_pins),
>  	.irq_banks = 4,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun6i_a31_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
> index 721b6935baf3..402fd7d21e7b 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
> @@ -563,6 +563,7 @@ static const struct sunxi_pinctrl_desc sun8i_a23_pinctrl_data = {
>  	.pins = sun8i_a23_pins,
>  	.npins = ARRAY_SIZE(sun8i_a23_pins),
>  	.irq_banks = 3,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun8i_a23_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
> index ef1e0bef4099..da387211a75e 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
> @@ -486,6 +486,7 @@ static const struct sunxi_pinctrl_desc sun8i_a33_pinctrl_data = {
>  	.npins = ARRAY_SIZE(sun8i_a33_pins),
>  	.irq_banks = 2,
>  	.irq_bank_base = 1,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun8i_a33_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
> index 518a92df4418..d1719a738c20 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
> @@ -491,7 +491,8 @@ static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = {
>  	.pins = sun8i_h3_pins,
>  	.npins = ARRAY_SIZE(sun8i_h3_pins),
>  	.irq_banks = 2,
> -	.irq_read_needs_mux = true
> +	.irq_read_needs_mux = true,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun8i_h3_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
> index bc14e954d7a2..472ef0d91b99 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
> @@ -721,6 +721,7 @@ static const struct sunxi_pinctrl_desc sun9i_a80_pinctrl_data = {
>  	.pins = sun9i_a80_pins,
>  	.npins = ARRAY_SIZE(sun9i_a80_pins),
>  	.irq_banks = 5,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun9i_a80_pinctrl_probe(struct platform_device *pdev)
> -- 
> git-series 0.9.1
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] pinctrl: sunxi: Disable strict mode for old pinctrl drivers
@ 2017-12-07 10:32     ` Ludovic Desroches
  0 siblings, 0 replies; 19+ messages in thread
From: Ludovic Desroches @ 2017-12-07 10:32 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, linus.walleij, linux-arm-kernel, linux-kernel, linux-gpio

Hi,

On Thu, Oct 05, 2017 at 10:54:07PM +0200, Maxime Ripard wrote:
> Old pinctrl drivers will need to disable strict mode for various reasons,
> among which:
>   - Some DT will still have a pinctrl group for each GPIO used, which will
>     be rejected by pin_request. While we could remove those nodes, we still
>     have to deal with old DTs.
>   - Some GPIOs on these boards need to have their pin configuration changed
>     (for bias or current), and there's no clear migration path
> 
> Let's disable the strict mode on those SoCs so that there's no breakage.
> 

I revive this thread since I am facing the same issue. Did you find a way to
deal with it? I have not seen a new version of this set of patches, I may have
missed it.

Why you didn't choose to add an optionnal property to enforce the use of
the strict mode? I mean, with your solution, if there is a new DT with
an old pin controller, it won't benefit from the strict mode.

Ludovic

> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
>  drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +
>  7 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
> index f763d8d62d6e..295e48fc94bc 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
> @@ -1289,6 +1289,7 @@ static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = {
>  	.npins = ARRAY_SIZE(sun4i_a10_pins),
>  	.irq_banks = 1,
>  	.irq_read_needs_mux = true,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun4i_a10_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun5i.c b/drivers/pinctrl/sunxi/pinctrl-sun5i.c
> index 47afd558b114..27ec99e81c4c 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun5i.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun5i.c
> @@ -713,6 +713,7 @@ static const struct sunxi_pinctrl_desc sun5i_pinctrl_data = {
>  	.pins = sun5i_pins,
>  	.npins = ARRAY_SIZE(sun5i_pins),
>  	.irq_banks = 1,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun5i_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
> index 951a25c18815..82ffaf466892 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
> @@ -965,6 +965,7 @@ static const struct sunxi_pinctrl_desc sun6i_a31_pinctrl_data = {
>  	.pins = sun6i_a31_pins,
>  	.npins = ARRAY_SIZE(sun6i_a31_pins),
>  	.irq_banks = 4,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun6i_a31_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
> index 721b6935baf3..402fd7d21e7b 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
> @@ -563,6 +563,7 @@ static const struct sunxi_pinctrl_desc sun8i_a23_pinctrl_data = {
>  	.pins = sun8i_a23_pins,
>  	.npins = ARRAY_SIZE(sun8i_a23_pins),
>  	.irq_banks = 3,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun8i_a23_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
> index ef1e0bef4099..da387211a75e 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
> @@ -486,6 +486,7 @@ static const struct sunxi_pinctrl_desc sun8i_a33_pinctrl_data = {
>  	.npins = ARRAY_SIZE(sun8i_a33_pins),
>  	.irq_banks = 2,
>  	.irq_bank_base = 1,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun8i_a33_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
> index 518a92df4418..d1719a738c20 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
> @@ -491,7 +491,8 @@ static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = {
>  	.pins = sun8i_h3_pins,
>  	.npins = ARRAY_SIZE(sun8i_h3_pins),
>  	.irq_banks = 2,
> -	.irq_read_needs_mux = true
> +	.irq_read_needs_mux = true,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun8i_h3_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
> index bc14e954d7a2..472ef0d91b99 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
> @@ -721,6 +721,7 @@ static const struct sunxi_pinctrl_desc sun9i_a80_pinctrl_data = {
>  	.pins = sun9i_a80_pins,
>  	.npins = ARRAY_SIZE(sun9i_a80_pins),
>  	.irq_banks = 5,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun9i_a80_pinctrl_probe(struct platform_device *pdev)
> -- 
> git-series 0.9.1
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 2/3] pinctrl: sunxi: Disable strict mode for old pinctrl drivers
@ 2017-12-07 10:32     ` Ludovic Desroches
  0 siblings, 0 replies; 19+ messages in thread
From: Ludovic Desroches @ 2017-12-07 10:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Thu, Oct 05, 2017 at 10:54:07PM +0200, Maxime Ripard wrote:
> Old pinctrl drivers will need to disable strict mode for various reasons,
> among which:
>   - Some DT will still have a pinctrl group for each GPIO used, which will
>     be rejected by pin_request. While we could remove those nodes, we still
>     have to deal with old DTs.
>   - Some GPIOs on these boards need to have their pin configuration changed
>     (for bias or current), and there's no clear migration path
> 
> Let's disable the strict mode on those SoCs so that there's no breakage.
> 

I revive this thread since I am facing the same issue. Did you find a way to
deal with it? I have not seen a new version of this set of patches, I may have
missed it.

Why you didn't choose to add an optionnal property to enforce the use of
the strict mode? I mean, with your solution, if there is a new DT with
an old pin controller, it won't benefit from the strict mode.

Ludovic

> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
>  drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
>  drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +
>  7 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
> index f763d8d62d6e..295e48fc94bc 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
> @@ -1289,6 +1289,7 @@ static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = {
>  	.npins = ARRAY_SIZE(sun4i_a10_pins),
>  	.irq_banks = 1,
>  	.irq_read_needs_mux = true,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun4i_a10_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun5i.c b/drivers/pinctrl/sunxi/pinctrl-sun5i.c
> index 47afd558b114..27ec99e81c4c 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun5i.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun5i.c
> @@ -713,6 +713,7 @@ static const struct sunxi_pinctrl_desc sun5i_pinctrl_data = {
>  	.pins = sun5i_pins,
>  	.npins = ARRAY_SIZE(sun5i_pins),
>  	.irq_banks = 1,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun5i_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
> index 951a25c18815..82ffaf466892 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
> @@ -965,6 +965,7 @@ static const struct sunxi_pinctrl_desc sun6i_a31_pinctrl_data = {
>  	.pins = sun6i_a31_pins,
>  	.npins = ARRAY_SIZE(sun6i_a31_pins),
>  	.irq_banks = 4,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun6i_a31_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
> index 721b6935baf3..402fd7d21e7b 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c
> @@ -563,6 +563,7 @@ static const struct sunxi_pinctrl_desc sun8i_a23_pinctrl_data = {
>  	.pins = sun8i_a23_pins,
>  	.npins = ARRAY_SIZE(sun8i_a23_pins),
>  	.irq_banks = 3,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun8i_a23_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
> index ef1e0bef4099..da387211a75e 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c
> @@ -486,6 +486,7 @@ static const struct sunxi_pinctrl_desc sun8i_a33_pinctrl_data = {
>  	.npins = ARRAY_SIZE(sun8i_a33_pins),
>  	.irq_banks = 2,
>  	.irq_bank_base = 1,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun8i_a33_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
> index 518a92df4418..d1719a738c20 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
> @@ -491,7 +491,8 @@ static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = {
>  	.pins = sun8i_h3_pins,
>  	.npins = ARRAY_SIZE(sun8i_h3_pins),
>  	.irq_banks = 2,
> -	.irq_read_needs_mux = true
> +	.irq_read_needs_mux = true,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun8i_h3_pinctrl_probe(struct platform_device *pdev)
> diff --git a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
> index bc14e954d7a2..472ef0d91b99 100644
> --- a/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
> +++ b/drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c
> @@ -721,6 +721,7 @@ static const struct sunxi_pinctrl_desc sun9i_a80_pinctrl_data = {
>  	.pins = sun9i_a80_pins,
>  	.npins = ARRAY_SIZE(sun9i_a80_pins),
>  	.irq_banks = 5,
> +	.disable_strict_mode = true,
>  };
>  
>  static int sun9i_a80_pinctrl_probe(struct platform_device *pdev)
> -- 
> git-series 0.9.1
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-12-07 10:32 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05 20:54 [PATCH 0/3] pinctrl: sunxi: Start to enforce the strict mode Maxime Ripard
2017-10-05 20:54 ` Maxime Ripard
2017-10-05 20:54 ` [PATCH 1/3] pinctrl: sunxi: Introduce the strict flag Maxime Ripard
2017-10-05 20:54   ` Maxime Ripard
2017-10-06  8:32   ` Chen-Yu Tsai
2017-10-06  8:32     ` Chen-Yu Tsai
2017-10-05 20:54 ` [PATCH 2/3] pinctrl: sunxi: Disable strict mode for old pinctrl drivers Maxime Ripard
2017-10-05 20:54   ` Maxime Ripard
2017-10-06  8:34   ` Chen-Yu Tsai
2017-10-06  8:34     ` Chen-Yu Tsai
2017-10-09  8:45     ` Maxime Ripard
2017-10-09  8:45       ` Maxime Ripard
2017-12-07 10:32   ` Ludovic Desroches
2017-12-07 10:32     ` Ludovic Desroches
2017-12-07 10:32     ` Ludovic Desroches
2017-10-05 20:54 ` [PATCH 3/3] pinctrl: sunxi: Enforce the strict mode by default Maxime Ripard
2017-10-05 20:54   ` Maxime Ripard
2017-10-06  8:34   ` Chen-Yu Tsai
2017-10-06  8:34     ` Chen-Yu Tsai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.