linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building
@ 2018-06-22  3:49 sean.wang
  2018-06-22  3:49 ` [PATCH 2/7] pinctrl: mt7622: fix initialization sequence between eint and gpiochip sean.wang
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: sean.wang @ 2018-06-22  3:49 UTC (permalink / raw)
  To: linus.walleij, linux-mediatek
  Cc: linux-arm-kernel, linux-gpio, linux-kernel, Sean Wang, stable

From: Sean Wang <sean.wang@mediatek.com>

It should be to return an error code when failing at groups building.

Cc: stable@vger.kernel.org
Fixes: d6ed93551320 ("pinctrl: mediatek: add pinctrl driver for MT7622 SoC")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mt7622.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
index e3f1ab2..9ad8cb77 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
@@ -1703,7 +1703,7 @@ static int mtk_pinctrl_probe(struct platform_device *pdev)
 	err = mtk_build_groups(hw);
 	if (err) {
 		dev_err(&pdev->dev, "Failed to build groups\n");
-		return 0;
+		return err;
 	}
 
 	/* Setup functions descriptions per SoC types */
-- 
2.7.4


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

* [PATCH 2/7] pinctrl: mt7622: fix initialization sequence between eint and gpiochip
  2018-06-22  3:49 [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building sean.wang
@ 2018-06-22  3:49 ` sean.wang
  2018-06-29 12:18   ` Linus Walleij
  2018-06-22  3:49 ` [PATCH 3/7] pinctrl: mt7622: fix that pinctrl_claim_hogs cannot work sean.wang
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: sean.wang @ 2018-06-22  3:49 UTC (permalink / raw)
  To: linus.walleij, linux-mediatek
  Cc: linux-arm-kernel, linux-gpio, linux-kernel, Sean Wang, stable

From: Sean Wang <sean.wang@mediatek.com>

Because gpichip applied in the driver must depend on mtk eint to implement
the input data debouncing and the translation between gpio and irq, it's
better to keep logic consistent with mtk eint being built prior to gpiochip
being added.

Cc: stable@vger.kernel.org
Fixes: e6dabd38d8e7 ("pinctrl: mediatek: add EINT support to MT7622 SoC")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mt7622.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
index 9ad8cb77..e9eba62 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
@@ -1713,17 +1713,17 @@ static int mtk_pinctrl_probe(struct platform_device *pdev)
 		return err;
 	}
 
+	err = mtk_build_eint(hw, pdev);
+	if (err)
+		dev_warn(&pdev->dev,
+			 "Failed to add EINT, but pinctrl still can work\n");
+
 	err = mtk_build_gpiochip(hw, pdev->dev.of_node);
 	if (err) {
 		dev_err(&pdev->dev, "Failed to add gpio_chip\n");
 		return err;
 	}
 
-	err = mtk_build_eint(hw, pdev);
-	if (err)
-		dev_warn(&pdev->dev,
-			 "Failed to add EINT, but pinctrl still can work\n");
-
 	platform_set_drvdata(pdev, hw);
 
 	return 0;
-- 
2.7.4


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

* [PATCH 3/7] pinctrl: mt7622: fix that pinctrl_claim_hogs cannot work
  2018-06-22  3:49 [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building sean.wang
  2018-06-22  3:49 ` [PATCH 2/7] pinctrl: mt7622: fix initialization sequence between eint and gpiochip sean.wang
@ 2018-06-22  3:49 ` sean.wang
  2018-06-29 12:19   ` Linus Walleij
  2018-06-22  3:49 ` [PATCH 4/7] pinctrl: mt7622: stop using the deprecated pinctrl_add_gpio_range sean.wang
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: sean.wang @ 2018-06-22  3:49 UTC (permalink / raw)
  To: linus.walleij, linux-mediatek
  Cc: linux-arm-kernel, linux-gpio, linux-kernel, Sean Wang, stable

From: Sean Wang <sean.wang@mediatek.com>

To allow claiming hogs by pinctrl, we cannot enable pinctrl until all
groups and functions are being added done. Also, it's necessary that
the corresponding gpiochip is being added when the pinctrl device is
enabled.

Cc: stable@vger.kernel.org
Fixes: d6ed93551320 ("pinctrl: mediatek: add pinctrl driver for MT7622 SoC")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mt7622.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
index e9eba62..42155d4 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
@@ -1695,9 +1695,10 @@ static int mtk_pinctrl_probe(struct platform_device *pdev)
 	mtk_desc.custom_conf_items = mtk_conf_items;
 #endif
 
-	hw->pctrl = devm_pinctrl_register(&pdev->dev, &mtk_desc, hw);
-	if (IS_ERR(hw->pctrl))
-		return PTR_ERR(hw->pctrl);
+	err = devm_pinctrl_register_and_init(&pdev->dev, &mtk_desc, hw,
+					     &hw->pctrl);
+	if (err)
+		return err;
 
 	/* Setup groups descriptions per SoC types */
 	err = mtk_build_groups(hw);
@@ -1713,11 +1714,19 @@ static int mtk_pinctrl_probe(struct platform_device *pdev)
 		return err;
 	}
 
+	/* For able to make pinctrl_claim_hogs, we must not enable pinctrl
+	 * until all groups and functions are being added one.
+	 */
+	err = pinctrl_enable(hw->pctrl);
+	if (err)
+		return err;
+
 	err = mtk_build_eint(hw, pdev);
 	if (err)
 		dev_warn(&pdev->dev,
 			 "Failed to add EINT, but pinctrl still can work\n");
 
+	/* Build gpiochip should be after pinctrl_enable is done */
 	err = mtk_build_gpiochip(hw, pdev->dev.of_node);
 	if (err) {
 		dev_err(&pdev->dev, "Failed to add gpio_chip\n");
-- 
2.7.4


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

* [PATCH 4/7] pinctrl: mt7622: stop using the deprecated pinctrl_add_gpio_range
  2018-06-22  3:49 [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building sean.wang
  2018-06-22  3:49 ` [PATCH 2/7] pinctrl: mt7622: fix initialization sequence between eint and gpiochip sean.wang
  2018-06-22  3:49 ` [PATCH 3/7] pinctrl: mt7622: fix that pinctrl_claim_hogs cannot work sean.wang
@ 2018-06-22  3:49 ` sean.wang
  2018-06-29 12:21   ` Linus Walleij
  2018-06-22  3:49 ` [PATCH 5/7] pinctrl: mt7622: fix a kernel panic when gpio-hog is being applied sean.wang
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: sean.wang @ 2018-06-22  3:49 UTC (permalink / raw)
  To: linus.walleij, linux-mediatek
  Cc: linux-arm-kernel, linux-gpio, linux-kernel, Sean Wang, stable

From: Sean Wang <sean.wang@mediatek.com>

If the pinctrl node has the gpio-ranges property, the range will be added
by the gpio core and doesn't need to be added by the pinctrl driver.

But for keeping backward compatibility, an explicit pinctrl_add_gpio_range
is still needed to be called when there is a missing gpio-ranges in pinctrl
node in old dts files.

Cc: stable@vger.kernel.org
Fixes: d6ed93551320 ("pinctrl: mediatek: add pinctrl driver for MT7622 SoC")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mt7622.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
index 42155d4..055074bb 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
@@ -1508,11 +1508,20 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw, struct device_node *np)
 	if (ret < 0)
 		return ret;
 
-	ret = gpiochip_add_pin_range(chip, dev_name(hw->dev), 0, 0,
-				     chip->ngpio);
-	if (ret < 0) {
-		gpiochip_remove(chip);
-		return ret;
+	/* Just for backward compatible for these old pinctrl nodes without
+	 * "gpio-ranges" property. Otherwise, called directly from a
+	 * DeviceTree-supported pinctrl driver is DEPRECATED.
+	 * Please see Section 2.1 of
+	 * Documentation/devicetree/bindings/gpio/gpio.txt on how to
+	 * bind pinctrl and gpio drivers via the "gpio-ranges" property.
+	 */
+	if (!of_find_property(np, "gpio-ranges", NULL)) {
+		ret = gpiochip_add_pin_range(chip, dev_name(hw->dev), 0, 0,
+					     chip->ngpio);
+		if (ret < 0) {
+			gpiochip_remove(chip);
+			return ret;
+		}
 	}
 
 	return 0;
-- 
2.7.4


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

* [PATCH 5/7] pinctrl: mt7622: fix a kernel panic when gpio-hog is being applied
  2018-06-22  3:49 [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building sean.wang
                   ` (2 preceding siblings ...)
  2018-06-22  3:49 ` [PATCH 4/7] pinctrl: mt7622: stop using the deprecated pinctrl_add_gpio_range sean.wang
@ 2018-06-22  3:49 ` sean.wang
  2018-06-29 12:22   ` Linus Walleij
  2018-06-22  3:49 ` [PATCH 6/7] arm64: dts: mt7622: use gpio-ranges to pinctrl device sean.wang
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: sean.wang @ 2018-06-22  3:49 UTC (permalink / raw)
  To: linus.walleij, linux-mediatek
  Cc: linux-arm-kernel, linux-gpio, linux-kernel, Sean Wang, stable

From: Sean Wang <sean.wang@mediatek.com>

When we are explicitly using GPIO hogging mechanism in the pinctrl node,
such as:

	&pio {
		line_input {
			gpio-hog;
			gpios = <95 0>, <96 0>, <97 0>;
			input;
		};
	};

A kernel panic happens at dereferencing a NULL pointer: In this case, the
drvdata is still not setup properly yet when it is being accessed.

A better solution for fixing up this issue should be we should obtain the
private data from struct gpio_chip using a specific gpiochip_get_data
instead of a generic dev_get_drvdata.

[    0.249424] Unable to handle kernel NULL pointer dereference at virtual
	       address 000000c8
[    0.257818] Mem abort info:
[    0.260704]   ESR = 0x96000005
[    0.263869]   Exception class = DABT (current EL), IL = 32 bits
[    0.270011]   SET = 0, FnV = 0
[    0.273167]   EA = 0, S1PTW = 0
[    0.276421] Data abort info:
[    0.279398]   ISV = 0, ISS = 0x00000005
[    0.283372]   CM = 0, WnR = 0
[    0.286440] [00000000000000c8] user address but active_mm is swapper
[    0.293027] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[    0.298795] Modules linked in:
[    0.301958] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.16.0-rc1+ #389
[    0.308716] Hardware name: MediaTek MT7622 RFB1 board (DT)
[    0.314396] pstate: 80000005 (Nzcv daif -PAN -UAO)
[    0.319362] pc : mtk_hw_pin_field_get+0x28/0x118
[    0.324140] lr : mtk_hw_set_value+0x30/0x104
[    0.328557] sp : ffffff800801b6d0
[    0.331983] x29: ffffff800801b6d0 x28: ffffff80086b7970
[    0.337484] x27: 0000000000000000 x26: ffffff80087b8000
[    0.342986] x25: 0000000000000000 x24: ffffffc00324c230
[    0.348487] x23: 0000000000000003 x22: 0000000000000000
[    0.353988] x21: ffffff80087b8000 x20: 0000000000000000
[    0.359489] x19: 0000000000000054 x18: 00000000fffff7c0
[    0.364990] x17: 0000000000006300 x16: 000000000000003f
[    0.370492] x15: 000000000000000e x14: ffffffffffffffff
[    0.375993] x13: 0000000000000000 x12: 0000000000000020
[    0.381494] x11: 0000000000000006 x10: 0101010101010101
[    0.386995] x9 : fffffffffffffffa x8 : 0000000000000007
[    0.392496] x7 : ffffff80085d63f8 x6 : 0000000000000003
[    0.397997] x5 : 0000000000000054 x4 : ffffffc0031eb800
[    0.403499] x3 : ffffff800801b728 x2 : 0000000000000003
[    0.409000] x1 : 0000000000000054 x0 : 0000000000000000
[    0.414502] Process swapper/0 (pid: 1, stack limit = 0x000000002a913c1c)
[    0.421441] Call trace:
[    0.423968]  mtk_hw_pin_field_get+0x28/0x118
[    0.428387]  mtk_hw_set_value+0x30/0x104
[    0.432445]  mtk_gpio_set+0x20/0x28
[    0.436052]  mtk_gpio_direction_output+0x18/0x30
[    0.440833]  gpiod_direction_output_raw_commit+0x7c/0xa0
[    0.446333]  gpiod_direction_output+0x104/0x114
[    0.451022]  gpiod_configure_flags+0xbc/0xfc
[    0.455441]  gpiod_hog+0x8c/0x140
[    0.458869]  of_gpiochip_add+0x27c/0x2d4
[    0.462928]  gpiochip_add_data_with_key+0x338/0x5f0
[    0.467976]  mtk_pinctrl_probe+0x388/0x400
[    0.472217]  platform_drv_probe+0x58/0xa4
[    0.476365]  driver_probe_device+0x204/0x44c
[    0.480783]  __device_attach_driver+0xac/0x108
[    0.485384]  bus_for_each_drv+0x7c/0xac
[    0.489352]  __device_attach+0xa0/0x144
[    0.493320]  device_initial_probe+0x10/0x18
[    0.497647]  bus_probe_device+0x2c/0x8c
[    0.501616]  device_add+0x2f8/0x540
[    0.505226]  of_device_add+0x3c/0x44
[    0.508925]  of_platform_device_create_pdata+0x80/0xb8
[    0.514245]  of_platform_bus_create+0x290/0x3e8
[    0.518933]  of_platform_populate+0x78/0x100
[    0.523352]  of_platform_default_populate+0x24/0x2c
[    0.528403]  of_platform_default_populate_init+0x94/0xa4
[    0.533903]  do_one_initcall+0x98/0x130
[    0.537874]  kernel_init_freeable+0x13c/0x1d4
[    0.542385]  kernel_init+0x10/0xf8
[    0.545903]  ret_from_fork+0x10/0x18
[    0.549603] Code: 900020a1 f9400800 911dcc21 1400001f (f9406401)
[    0.555916] ---[ end trace de8c34787fdad3b3 ]---
[    0.560722] Kernel panic - not syncing: Attempted to kill init!
	       exitcode=0x0000000b
[    0.560722]
[    0.570188] SMP: stopping secondary CPUs
[    0.574253] ---[ end Kernel panic - not syncing: Attempted to kill
	       init! exitcode=0x0000000b
[    0.574253]

Cc: stable@vger.kernel.org
Fixes: d6ed93551320 ("pinctrl: mediatek: add pinctrl driver for MT7622 SoC")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/pinctrl/mediatek/pinctrl-mt7622.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
index 055074bb..4c4740f 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
@@ -1424,7 +1424,7 @@ static struct pinctrl_desc mtk_desc = {
 
 static int mtk_gpio_get(struct gpio_chip *chip, unsigned int gpio)
 {
-	struct mtk_pinctrl *hw = dev_get_drvdata(chip->parent);
+	struct mtk_pinctrl *hw = gpiochip_get_data(chip);
 	int value, err;
 
 	err = mtk_hw_get_value(hw, gpio, PINCTRL_PIN_REG_DI, &value);
@@ -1436,7 +1436,7 @@ static int mtk_gpio_get(struct gpio_chip *chip, unsigned int gpio)
 
 static void mtk_gpio_set(struct gpio_chip *chip, unsigned int gpio, int value)
 {
-	struct mtk_pinctrl *hw = dev_get_drvdata(chip->parent);
+	struct mtk_pinctrl *hw = gpiochip_get_data(chip);
 
 	mtk_hw_set_value(hw, gpio, PINCTRL_PIN_REG_DO, !!value);
 }
-- 
2.7.4


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

* [PATCH 6/7] arm64: dts: mt7622: use gpio-ranges to pinctrl device
  2018-06-22  3:49 [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building sean.wang
                   ` (3 preceding siblings ...)
  2018-06-22  3:49 ` [PATCH 5/7] pinctrl: mt7622: fix a kernel panic when gpio-hog is being applied sean.wang
@ 2018-06-22  3:49 ` sean.wang
  2018-06-29 12:22   ` Linus Walleij
  2018-07-16 13:36   ` Matthias Brugger
  2018-06-22  3:49 ` [PATCH 7/7] arm64: dts: mt7622: add earlycon to mt7622-rfb1 board sean.wang
  2018-06-29 12:17 ` [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building Linus Walleij
  6 siblings, 2 replies; 15+ messages in thread
From: sean.wang @ 2018-06-22  3:49 UTC (permalink / raw)
  To: linus.walleij, linux-mediatek
  Cc: linux-arm-kernel, linux-gpio, linux-kernel, Sean Wang

From: Sean Wang <sean.wang@mediatek.com>

Using gpio-ranges property represent which GPIOs correspond to which pins
on MT7622 pin controllers. For details, we can see section 2.1 of
Documentation/devicetree/bindings/gpio/gpio.txt to know how to bind pinctrl
and gpio drivers via the "gpio-ranges" property.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 arch/arm64/boot/dts/mediatek/mt7622.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt7622.dtsi b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
index e2c5450..50cb56c 100644
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
@@ -291,6 +291,7 @@
 		reg-names = "base", "eint";
 		gpio-controller;
 		#gpio-cells = <2>;
+		gpio-ranges = <&pio 0 0 103>;
 		interrupt-controller;
 		interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>;
 		interrupt-parent = <&gic>;
-- 
2.7.4


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

* [PATCH 7/7] arm64: dts: mt7622: add earlycon to mt7622-rfb1 board
  2018-06-22  3:49 [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building sean.wang
                   ` (4 preceding siblings ...)
  2018-06-22  3:49 ` [PATCH 6/7] arm64: dts: mt7622: use gpio-ranges to pinctrl device sean.wang
@ 2018-06-22  3:49 ` sean.wang
  2018-07-16 13:37   ` Matthias Brugger
  2018-06-29 12:17 ` [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building Linus Walleij
  6 siblings, 1 reply; 15+ messages in thread
From: sean.wang @ 2018-06-22  3:49 UTC (permalink / raw)
  To: linus.walleij, linux-mediatek
  Cc: linux-arm-kernel, linux-gpio, linux-kernel, Sean Wang

From: Sean Wang <sean.wang@mediatek.com>

Add earlycon to mt7622-rfb1 as to know what was going on when a certain
fault is happening at the early initialization stage.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
index 1ff003e..a747b7b 100644
--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
+++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
@@ -18,7 +18,7 @@
 	compatible = "mediatek,mt7622-rfb1", "mediatek,mt7622";
 
 	chosen {
-		bootargs = "console=ttyS0,115200n1 swiotlb=512";
+		bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512";
 	};
 
 	cpus {
-- 
2.7.4


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

* Re: [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building
  2018-06-22  3:49 [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building sean.wang
                   ` (5 preceding siblings ...)
  2018-06-22  3:49 ` [PATCH 7/7] arm64: dts: mt7622: add earlycon to mt7622-rfb1 board sean.wang
@ 2018-06-29 12:17 ` Linus Walleij
  6 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2018-06-29 12:17 UTC (permalink / raw)
  To: Sean Wang
  Cc: moderated list:ARM/Mediatek SoC support, Linux ARM,
	open list:GPIO SUBSYSTEM, linux-kernel, stable

On Fri, Jun 22, 2018 at 5:49 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> It should be to return an error code when failing at groups building.
>
> Cc: stable@vger.kernel.org
> Fixes: d6ed93551320 ("pinctrl: mediatek: add pinctrl driver for MT7622 SoC")
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied for fixes.

Yours,
Linus Walleij

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

* Re: [PATCH 2/7] pinctrl: mt7622: fix initialization sequence between eint and gpiochip
  2018-06-22  3:49 ` [PATCH 2/7] pinctrl: mt7622: fix initialization sequence between eint and gpiochip sean.wang
@ 2018-06-29 12:18   ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2018-06-29 12:18 UTC (permalink / raw)
  To: Sean Wang
  Cc: moderated list:ARM/Mediatek SoC support, Linux ARM,
	open list:GPIO SUBSYSTEM, linux-kernel, stable

On Fri, Jun 22, 2018 at 5:49 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> Because gpichip applied in the driver must depend on mtk eint to implement
> the input data debouncing and the translation between gpio and irq, it's
> better to keep logic consistent with mtk eint being built prior to gpiochip
> being added.
>
> Cc: stable@vger.kernel.org
> Fixes: e6dabd38d8e7 ("pinctrl: mediatek: add EINT support to MT7622 SoC")
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied for fixes.

Yours,
Linus Walleij

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

* Re: [PATCH 3/7] pinctrl: mt7622: fix that pinctrl_claim_hogs cannot work
  2018-06-22  3:49 ` [PATCH 3/7] pinctrl: mt7622: fix that pinctrl_claim_hogs cannot work sean.wang
@ 2018-06-29 12:19   ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2018-06-29 12:19 UTC (permalink / raw)
  To: Sean Wang
  Cc: moderated list:ARM/Mediatek SoC support, Linux ARM,
	open list:GPIO SUBSYSTEM, linux-kernel, stable

On Fri, Jun 22, 2018 at 5:49 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> To allow claiming hogs by pinctrl, we cannot enable pinctrl until all
> groups and functions are being added done. Also, it's necessary that
> the corresponding gpiochip is being added when the pinctrl device is
> enabled.
>
> Cc: stable@vger.kernel.org
> Fixes: d6ed93551320 ("pinctrl: mediatek: add pinctrl driver for MT7622 SoC")
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied for fixes.

Yours,
Linus Walleij

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

* Re: [PATCH 4/7] pinctrl: mt7622: stop using the deprecated pinctrl_add_gpio_range
  2018-06-22  3:49 ` [PATCH 4/7] pinctrl: mt7622: stop using the deprecated pinctrl_add_gpio_range sean.wang
@ 2018-06-29 12:21   ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2018-06-29 12:21 UTC (permalink / raw)
  To: Sean Wang
  Cc: moderated list:ARM/Mediatek SoC support, Linux ARM,
	open list:GPIO SUBSYSTEM, linux-kernel, stable

On Fri, Jun 22, 2018 at 5:49 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> If the pinctrl node has the gpio-ranges property, the range will be added
> by the gpio core and doesn't need to be added by the pinctrl driver.
>
> But for keeping backward compatibility, an explicit pinctrl_add_gpio_range
> is still needed to be called when there is a missing gpio-ranges in pinctrl
> node in old dts files.
>
> Cc: stable@vger.kernel.org
> Fixes: d6ed93551320 ("pinctrl: mediatek: add pinctrl driver for MT7622 SoC")
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied for fixes.

Yours,
Linus Walleij

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

* Re: [PATCH 5/7] pinctrl: mt7622: fix a kernel panic when gpio-hog is being applied
  2018-06-22  3:49 ` [PATCH 5/7] pinctrl: mt7622: fix a kernel panic when gpio-hog is being applied sean.wang
@ 2018-06-29 12:22   ` Linus Walleij
  0 siblings, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2018-06-29 12:22 UTC (permalink / raw)
  To: Sean Wang
  Cc: moderated list:ARM/Mediatek SoC support, Linux ARM,
	open list:GPIO SUBSYSTEM, linux-kernel, stable

On Fri, Jun 22, 2018 at 5:49 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> When we are explicitly using GPIO hogging mechanism in the pinctrl node,
> such as:
>
>         &pio {
>                 line_input {
>                         gpio-hog;
>                         gpios = <95 0>, <96 0>, <97 0>;
>                         input;
>                 };
>         };
>
> A kernel panic happens at dereferencing a NULL pointer: In this case, the
> drvdata is still not setup properly yet when it is being accessed.
>
> A better solution for fixing up this issue should be we should obtain the
> private data from struct gpio_chip using a specific gpiochip_get_data
> instead of a generic dev_get_drvdata.
>
> [    0.249424] Unable to handle kernel NULL pointer dereference at virtual
>                address 000000c8
> [    0.257818] Mem abort info:
> [    0.260704]   ESR = 0x96000005
> [    0.263869]   Exception class = DABT (current EL), IL = 32 bits
> [    0.270011]   SET = 0, FnV = 0
> [    0.273167]   EA = 0, S1PTW = 0
> [    0.276421] Data abort info:
> [    0.279398]   ISV = 0, ISS = 0x00000005
> [    0.283372]   CM = 0, WnR = 0
> [    0.286440] [00000000000000c8] user address but active_mm is swapper
> [    0.293027] Internal error: Oops: 96000005 [#1] PREEMPT SMP
> [    0.298795] Modules linked in:
> [    0.301958] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.16.0-rc1+ #389
> [    0.308716] Hardware name: MediaTek MT7622 RFB1 board (DT)
> [    0.314396] pstate: 80000005 (Nzcv daif -PAN -UAO)
> [    0.319362] pc : mtk_hw_pin_field_get+0x28/0x118
> [    0.324140] lr : mtk_hw_set_value+0x30/0x104
> [    0.328557] sp : ffffff800801b6d0
> [    0.331983] x29: ffffff800801b6d0 x28: ffffff80086b7970
> [    0.337484] x27: 0000000000000000 x26: ffffff80087b8000
> [    0.342986] x25: 0000000000000000 x24: ffffffc00324c230
> [    0.348487] x23: 0000000000000003 x22: 0000000000000000
> [    0.353988] x21: ffffff80087b8000 x20: 0000000000000000
> [    0.359489] x19: 0000000000000054 x18: 00000000fffff7c0
> [    0.364990] x17: 0000000000006300 x16: 000000000000003f
> [    0.370492] x15: 000000000000000e x14: ffffffffffffffff
> [    0.375993] x13: 0000000000000000 x12: 0000000000000020
> [    0.381494] x11: 0000000000000006 x10: 0101010101010101
> [    0.386995] x9 : fffffffffffffffa x8 : 0000000000000007
> [    0.392496] x7 : ffffff80085d63f8 x6 : 0000000000000003
> [    0.397997] x5 : 0000000000000054 x4 : ffffffc0031eb800
> [    0.403499] x3 : ffffff800801b728 x2 : 0000000000000003
> [    0.409000] x1 : 0000000000000054 x0 : 0000000000000000
> [    0.414502] Process swapper/0 (pid: 1, stack limit = 0x000000002a913c1c)
> [    0.421441] Call trace:
> [    0.423968]  mtk_hw_pin_field_get+0x28/0x118
> [    0.428387]  mtk_hw_set_value+0x30/0x104
> [    0.432445]  mtk_gpio_set+0x20/0x28
> [    0.436052]  mtk_gpio_direction_output+0x18/0x30
> [    0.440833]  gpiod_direction_output_raw_commit+0x7c/0xa0
> [    0.446333]  gpiod_direction_output+0x104/0x114
> [    0.451022]  gpiod_configure_flags+0xbc/0xfc
> [    0.455441]  gpiod_hog+0x8c/0x140
> [    0.458869]  of_gpiochip_add+0x27c/0x2d4
> [    0.462928]  gpiochip_add_data_with_key+0x338/0x5f0
> [    0.467976]  mtk_pinctrl_probe+0x388/0x400
> [    0.472217]  platform_drv_probe+0x58/0xa4
> [    0.476365]  driver_probe_device+0x204/0x44c
> [    0.480783]  __device_attach_driver+0xac/0x108
> [    0.485384]  bus_for_each_drv+0x7c/0xac
> [    0.489352]  __device_attach+0xa0/0x144
> [    0.493320]  device_initial_probe+0x10/0x18
> [    0.497647]  bus_probe_device+0x2c/0x8c
> [    0.501616]  device_add+0x2f8/0x540
> [    0.505226]  of_device_add+0x3c/0x44
> [    0.508925]  of_platform_device_create_pdata+0x80/0xb8
> [    0.514245]  of_platform_bus_create+0x290/0x3e8
> [    0.518933]  of_platform_populate+0x78/0x100
> [    0.523352]  of_platform_default_populate+0x24/0x2c
> [    0.528403]  of_platform_default_populate_init+0x94/0xa4
> [    0.533903]  do_one_initcall+0x98/0x130
> [    0.537874]  kernel_init_freeable+0x13c/0x1d4
> [    0.542385]  kernel_init+0x10/0xf8
> [    0.545903]  ret_from_fork+0x10/0x18
> [    0.549603] Code: 900020a1 f9400800 911dcc21 1400001f (f9406401)
> [    0.555916] ---[ end trace de8c34787fdad3b3 ]---
> [    0.560722] Kernel panic - not syncing: Attempted to kill init!
>                exitcode=0x0000000b
> [    0.560722]
> [    0.570188] SMP: stopping secondary CPUs
> [    0.574253] ---[ end Kernel panic - not syncing: Attempted to kill
>                init! exitcode=0x0000000b
> [    0.574253]
>
> Cc: stable@vger.kernel.org
> Fixes: d6ed93551320 ("pinctrl: mediatek: add pinctrl driver for MT7622 SoC")
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Patch applied for fixes.

Yours,
Linus Walleij

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

* Re: [PATCH 6/7] arm64: dts: mt7622: use gpio-ranges to pinctrl device
  2018-06-22  3:49 ` [PATCH 6/7] arm64: dts: mt7622: use gpio-ranges to pinctrl device sean.wang
@ 2018-06-29 12:22   ` Linus Walleij
  2018-07-16 13:36   ` Matthias Brugger
  1 sibling, 0 replies; 15+ messages in thread
From: Linus Walleij @ 2018-06-29 12:22 UTC (permalink / raw)
  To: Sean Wang
  Cc: moderated list:ARM/Mediatek SoC support, Linux ARM,
	open list:GPIO SUBSYSTEM, linux-kernel

On Fri, Jun 22, 2018 at 5:49 AM <sean.wang@mediatek.com> wrote:

> From: Sean Wang <sean.wang@mediatek.com>
>
> Using gpio-ranges property represent which GPIOs correspond to which pins
> on MT7622 pin controllers. For details, we can see section 2.1 of
> Documentation/devicetree/bindings/gpio/gpio.txt to know how to bind pinctrl
> and gpio drivers via the "gpio-ranges" property.
>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH 6/7] arm64: dts: mt7622: use gpio-ranges to pinctrl device
  2018-06-22  3:49 ` [PATCH 6/7] arm64: dts: mt7622: use gpio-ranges to pinctrl device sean.wang
  2018-06-29 12:22   ` Linus Walleij
@ 2018-07-16 13:36   ` Matthias Brugger
  1 sibling, 0 replies; 15+ messages in thread
From: Matthias Brugger @ 2018-07-16 13:36 UTC (permalink / raw)
  To: sean.wang, linus.walleij, linux-mediatek
  Cc: linux-gpio, linux-kernel, linux-arm-kernel



On 22/06/18 05:49, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Using gpio-ranges property represent which GPIOs correspond to which pins
> on MT7622 pin controllers. For details, we can see section 2.1 of
> Documentation/devicetree/bindings/gpio/gpio.txt to know how to bind pinctrl
> and gpio drivers via the "gpio-ranges" property.
> 
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>

pushed now to v4.18-next/dts64

Thanks

> ---
>  arch/arm64/boot/dts/mediatek/mt7622.dtsi | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/boot/dts/mediatek/mt7622.dtsi b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
> index e2c5450..50cb56c 100644
> --- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
> @@ -291,6 +291,7 @@
>  		reg-names = "base", "eint";
>  		gpio-controller;
>  		#gpio-cells = <2>;
> +		gpio-ranges = <&pio 0 0 103>;
>  		interrupt-controller;
>  		interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>;
>  		interrupt-parent = <&gic>;
> 

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

* Re: [PATCH 7/7] arm64: dts: mt7622: add earlycon to mt7622-rfb1 board
  2018-06-22  3:49 ` [PATCH 7/7] arm64: dts: mt7622: add earlycon to mt7622-rfb1 board sean.wang
@ 2018-07-16 13:37   ` Matthias Brugger
  0 siblings, 0 replies; 15+ messages in thread
From: Matthias Brugger @ 2018-07-16 13:37 UTC (permalink / raw)
  To: sean.wang, linus.walleij, linux-mediatek
  Cc: linux-gpio, linux-kernel, linux-arm-kernel



On 22/06/18 05:49, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Add earlycon to mt7622-rfb1 as to know what was going on when a certain
> fault is happening at the early initialization stage.
> 
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
>  arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)


pushed now to v4.18-next/dts64

Thanks
Matthias

> 
> diff --git a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
> index 1ff003e..a747b7b 100644
> --- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
> +++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
> @@ -18,7 +18,7 @@
>  	compatible = "mediatek,mt7622-rfb1", "mediatek,mt7622";
>  
>  	chosen {
> -		bootargs = "console=ttyS0,115200n1 swiotlb=512";
> +		bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512";
>  	};
>  
>  	cpus {
> 

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

end of thread, other threads:[~2018-07-16 13:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-22  3:49 [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building sean.wang
2018-06-22  3:49 ` [PATCH 2/7] pinctrl: mt7622: fix initialization sequence between eint and gpiochip sean.wang
2018-06-29 12:18   ` Linus Walleij
2018-06-22  3:49 ` [PATCH 3/7] pinctrl: mt7622: fix that pinctrl_claim_hogs cannot work sean.wang
2018-06-29 12:19   ` Linus Walleij
2018-06-22  3:49 ` [PATCH 4/7] pinctrl: mt7622: stop using the deprecated pinctrl_add_gpio_range sean.wang
2018-06-29 12:21   ` Linus Walleij
2018-06-22  3:49 ` [PATCH 5/7] pinctrl: mt7622: fix a kernel panic when gpio-hog is being applied sean.wang
2018-06-29 12:22   ` Linus Walleij
2018-06-22  3:49 ` [PATCH 6/7] arm64: dts: mt7622: use gpio-ranges to pinctrl device sean.wang
2018-06-29 12:22   ` Linus Walleij
2018-07-16 13:36   ` Matthias Brugger
2018-06-22  3:49 ` [PATCH 7/7] arm64: dts: mt7622: add earlycon to mt7622-rfb1 board sean.wang
2018-07-16 13:37   ` Matthias Brugger
2018-06-29 12:17 ` [PATCH 1/7] pinctrl: mt7622: fix error path on failing at groups building Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).