Skip to contentSkip to conversation

add external interrupt support to MT7622 pinctrl

PATCH In review [email protected] 4 participants 17 messages May 20, 2018 – Jun 25, 2018

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover add external interrupt support to MT7622 pinctrl

From: Sean Wang <[email protected]>

The series is to add external interrupt support to MT7622 pinctrl.

Before we can freely do that in pinctrl-mt7622.c with patch 3, a refactor work has to be done with patch 2 to split EINT-related code from a specific driver and then allows pintrl-mt7622.c to reuse it.

patch 1, 3, 7: add EINT support to MT7622 pinctrl.
patch 2, 6: make EINT-related become a generic way for all MediaTek
pinctrl.
patch 4, 5: eliminate unnecessary code in existent EINT-related ones after
refactor work was done.

Sean Wang (7):
dt-bindings: pinctrl: add external interrupt support to MT7622 pinctrl
pinctrl: mediatek: refactor EINT related code for all MediaTek pinctrl
can fit
pinctrl: mediatek: add EINT support to MT7622 SoC
pinctrl: mediatek: use generic EINT register maps for each SoC
pinctrl: mediatek: remove unused fields in struct mtk_eint_hw
MAINTAINERS: update entry for PIN CONTROLLER - MEDIATEK
arm64: dts: mt7622: add EINT support to pinctrl

 .../devicetree/bindings/pinctrl/pinctrl-mt7622.txt |  10 +
 MAINTAINERS                                        |   1 +
 arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts       |   2 +-
 arch/arm64/boot/dts/mediatek/mt7622.dtsi           |   8 +-
 drivers/pinctrl/mediatek/Kconfig                   |   6 +
 drivers/pinctrl/mediatek/Makefile                  |   1 +
 drivers/pinctrl/mediatek/mtk-eint.c                | 492 +++++++++++++++++
 drivers/pinctrl/mediatek/mtk-eint.h                | 106 ++++
 drivers/pinctrl/mediatek/pinctrl-mt2701.c          |  25 +-
 drivers/pinctrl/mediatek/pinctrl-mt2712.c          |  25 +-
 drivers/pinctrl/mediatek/pinctrl-mt7622.c          | 143 +++++
 drivers/pinctrl/mediatek/pinctrl-mt8127.c          |  25 +-
 drivers/pinctrl/mediatek/pinctrl-mt8135.c          |  25 +-
 drivers/pinctrl/mediatek/pinctrl-mt8173.c          |  25 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c      | 608 ++++-----------------
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h      |  13 +-
 16 files changed, 901 insertions(+), 614 deletions(-)
 create mode 100644 drivers/pinctrl/mediatek/mtk-eint.c
 create mode 100644 drivers/pinctrl/mediatek/mtk-eint.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/7 dt-bindings: pinctrl: add external interrupt support to MT7622 pinctrl

From: Sean Wang <[email protected]>

Extend the capability of MT7622 pinctrl with adding EINT so that each GPIO can be used to notify CPU when a signal state is changing on the line as an external interrupt.

---
 Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt +10 -0
index f18ed99..743b32d 100644
@@ -9,6 +9,16 @@ Required properties for the root node:
  - #gpio-cells: Should be two. The first cell is the pin number and the
    second is the GPIO flags.
 
+Optional properties:
+- interrupt-controller  : Marks the device node as an interrupt controller
+
+If the property interrupt-controller is defined, following property is required
+- reg-names: A string describing the "reg" entries. Must contain "eint".
+- interrupts : The interrupt output from the controller.
+- #interrupt-cells: Should be two.
+- interrupt-parent: Phandle of the interrupt parent to which the external
+  GPIO interrupts are forwarded to.
+
 Please refer to pinctrl-bindings.txt in this directory for details of the
 common pinctrl bindings used by client devices, including the meaning of the
 phrase "pin configuration node".
Signature · 1 line
2.7.4
maintainer Reviewed-by on v1 1/7
#2 lore raw

Re: [PATCH v1 1/7] dt-bindings: pinctrl: add external interrupt support to MT7622 pinctrl

Quoted 10 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

Extend the capability of MT7622 pinctrl with adding EINT so that each GPIO can be used to notify CPU when a signal state is changing on the line as an external interrupt.

---
 Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)
#3 lore raw

Re: [PATCH v1 1/7] dt-bindings: pinctrl: add external interrupt support to MT7622 pinctrl

In reply to [email protected]
Quoted 7 lines · On Sun, May 20, 2018 at 7:01 PM, <[email protected]> wrote:

From: Sean Wang <[email protected]>

Extend the capability of MT7622 pinctrl with adding EINT so that each GPIO can be used to notify CPU when a signal state is changing on the line as an external interrupt.

Patch applied with Rob's review tag.

Yours,
Linus Walleij

#4 lore raw

PATCH 2/7 pinctrl: mediatek: refactor EINT related code for all MediaTek pinctrl can fit

In reply to [email protected]

From: Sean Wang <[email protected]>

This patch is in preparation for adding EINT support to MT7622 pinctrl, and the refactoring doesn't alter any existent logic.

A reason we have to refactor EINT code pieces into a generic way is that currently, they're tightly coupled with a certain type of MediaTek pinctrl would cause a grown in a very bad way as there is different types of pinctrl devices getting to join.

Therefore, it is an essential or urgent thing that EINT code pieces are refactored to eliminate any dependencies across GPIO and EINT as possible.

Additional structure mtk_eint_[xt, hw, regs] are being introduced for indicating how maps being designed between GPIO and EINT hw number, how to set and get GPIO state for a certain EINT pin, what characteristic on a EINT device is present on various SoCs.

---
 drivers/pinctrl/mediatek/Kconfig              |   6 +
 drivers/pinctrl/mediatek/Makefile             |   1 +
 drivers/pinctrl/mediatek/mtk-eint.c           | 492 +++++++++++++++++++++
 drivers/pinctrl/mediatek/mtk-eint.h           | 107 +++++
 drivers/pinctrl/mediatek/pinctrl-mt2701.c     |  12 +-
 drivers/pinctrl/mediatek/pinctrl-mt2712.c     |  12 +-
 drivers/pinctrl/mediatek/pinctrl-mt8127.c     |  12 +-
 drivers/pinctrl/mediatek/pinctrl-mt8135.c     |  12 +-
 drivers/pinctrl/mediatek/pinctrl-mt8173.c     |  12 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 604 +++++---------------------
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |  13 +-
 11 files changed, 756 insertions(+), 527 deletions(-)
 create mode 100644 drivers/pinctrl/mediatek/mtk-eint.c
 create mode 100644 drivers/pinctrl/mediatek/mtk-eint.h
drivers/pinctrl/mediatek/Kconfig +6 -0
index 862c5db..310db42 100644
@@ -1,12 +1,18 @@
 menu "MediaTek pinctrl drivers"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
 
+config EINT_MTK
+	bool "MediaTek External Interrupt Support"
+	depends on PINCTRL_MTK || COMPILE_TEST
+	select IRQ_DOMAIN
+
 config PINCTRL_MTK
 	bool
 	depends on OF
 	select PINMUX
 	select GENERIC_PINCONF
 	select GPIOLIB
+	select EINT_MTK
 	select OF_GPIO
 
 # For ARMv7 SoCs
drivers/pinctrl/mediatek/Makefile +1 -0
index 7959e77..3de7156 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 # Core
+obj-$(CONFIG_EINT_MTK)		+= mtk-eint.o
 obj-$(CONFIG_PINCTRL_MTK)	+= pinctrl-mtk-common.o
 
 # SoC Drivers
drivers/pinctrl/mediatek/mtk-eint.c new file +492 -0

492 lines not on this page · raw message

drivers/pinctrl/mediatek/mtk-eint.h new file +107 -0

107 lines not on this page · raw message

drivers/pinctrl/mediatek/pinctrl-mt2701.c +7 -5
index f86f3b3..e0963c6 100644
@@ -531,8 +531,14 @@ static const struct mtk_pinctrl_devdata mt2701_pinctrl_data = {
 	.port_shf = 4,
 	.port_mask = 0x1f,
 	.port_align = 4,
-	.eint_offsets = {
+	.eint_hw = {
 		.name = "mt2701_eint",
+		.port_mask = 6,
+		.ports     = 6,
+		.ap_num    = 169,
+		.db_cnt    = 16,
+	},
+	.eint_regs = {
 		.stat      = 0x000,
 		.ack       = 0x040,
 		.mask      = 0x080,
@@ -551,11 +557,7 @@ static const struct mtk_pinctrl_devdata mt2701_pinctrl_data = {
 		.dbnc_ctrl = 0x500,
 		.dbnc_set  = 0x600,
 		.dbnc_clr  = 0x700,
-		.port_mask = 6,
-		.ports     = 6,
 	},
-	.ap_num = 169,
-	.db_cnt = 16,
 };
 
 static int mt2701_pinctrl_probe(struct platform_device *pdev)
drivers/pinctrl/mediatek/pinctrl-mt2712.c +7 -5
index 81e11f9..02aff28 100644
@@ -576,8 +576,14 @@ static const struct mtk_pinctrl_devdata mt2712_pinctrl_data = {
 	.port_shf = 4,
 	.port_mask = 0xf,
 	.port_align = 4,
-	.eint_offsets = {
+	.eint_hw = {
 		.name = "mt2712_eint",
+		.port_mask = 0xf,
+		.ports     = 8,
+		.ap_num    = 229,
+		.db_cnt    = 40,
+	},
+	.eint_regs = {
 		.stat      = 0x000,
 		.ack       = 0x040,
 		.mask      = 0x080,
@@ -596,11 +602,7 @@ static const struct mtk_pinctrl_devdata mt2712_pinctrl_data = {
 		.dbnc_ctrl = 0x500,
 		.dbnc_set  = 0x600,
 		.dbnc_clr  = 0x700,
-		.port_mask = 0xf,
-		.ports     = 8,
 	},
-	.ap_num = 229,
-	.db_cnt = 40,
 };
 
 static int mt2712_pinctrl_probe(struct platform_device *pdev)
drivers/pinctrl/mediatek/pinctrl-mt8127.c +7 -5
index d764915..71f6258 100644
@@ -300,8 +300,14 @@ static const struct mtk_pinctrl_devdata mt8127_pinctrl_data = {
 	.port_shf = 4,
 	.port_mask = 0xf,
 	.port_align = 4,
-	.eint_offsets = {
+	.eint_hw = {
 		.name = "mt8127_eint",
+		.port_mask = 7,
+		.ports     = 6,
+		.ap_num    = 143,
+		.db_cnt    = 16,
+	},
+	.eint_regs = {
 		.stat      = 0x000,
 		.ack       = 0x040,
 		.mask      = 0x080,
@@ -320,11 +326,7 @@ static const struct mtk_pinctrl_devdata mt8127_pinctrl_data = {
 		.dbnc_ctrl = 0x500,
 		.dbnc_set  = 0x600,
 		.dbnc_clr  = 0x700,
-		.port_mask = 7,
-		.ports     = 6,
 	},
-	.ap_num = 143,
-	.db_cnt = 16,
 };
 
 static int mt8127_pinctrl_probe(struct platform_device *pdev)
drivers/pinctrl/mediatek/pinctrl-mt8135.c +7 -5
index d8c645f..fdfa357 100644
@@ -313,8 +313,14 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data = {
 	.port_shf = 4,
 	.port_mask = 0xf,
 	.port_align = 4,
-	.eint_offsets = {
+	.eint_hw = {
 		.name = "mt8135_eint",
+		.port_mask = 7,
+		.ports     = 6,
+		.ap_num    = 192,
+		.db_cnt    = 16,
+	},
+	.eint_regs = {
 		.stat      = 0x000,
 		.ack       = 0x040,
 		.mask      = 0x080,
@@ -333,11 +339,7 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data = {
 		.dbnc_ctrl = 0x500,
 		.dbnc_set  = 0x600,
 		.dbnc_clr  = 0x700,
-		.port_mask = 7,
-		.ports     = 6,
 	},
-	.ap_num = 192,
-	.db_cnt = 16,
 };
 
 static int mt8135_pinctrl_probe(struct platform_device *pdev)
drivers/pinctrl/mediatek/pinctrl-mt8173.c +7 -5
index 8bfd427..1466c95 100644
@@ -340,8 +340,14 @@ static const struct mtk_pinctrl_devdata mt8173_pinctrl_data = {
 	.port_shf = 4,
 	.port_mask = 0xf,
 	.port_align = 4,
-	.eint_offsets = {
+	.eint_hw = {
 		.name = "mt8173_eint",
+		.port_mask = 7,
+		.ports     = 6,
+		.ap_num    = 224,
+		.db_cnt    = 16,
+	},
+	.eint_regs = {
 		.stat      = 0x000,
 		.ack       = 0x040,
 		.mask      = 0x080,
@@ -360,11 +366,7 @@ static const struct mtk_pinctrl_devdata mt8173_pinctrl_data = {
 		.dbnc_ctrl = 0x500,
 		.dbnc_set  = 0x600,
 		.dbnc_clr  = 0x700,
-		.port_mask = 7,
-		.ports     = 6,
 	},
-	.ap_num = 224,
-	.db_cnt = 16,
 };
 
 static int mt8173_pinctrl_probe(struct platform_device *pdev)
drivers/pinctrl/mediatek/pinctrl-mtk-common.c +110 -494

677 lines not on this page · raw message

drivers/pinctrl/mediatek/pinctrl-mtk-common.h +5 -8
index 8543bc4..346e3db 100644
@@ -19,6 +19,8 @@
 #include <linux/regmap.h>
 #include <linux/pinctrl/pinconf-generic.h>
 
+#include "mtk-eint.h"
+
 #define NO_EINT_SUPPORT    255
 #define MT_EDGE_SENSITIVE           0
 #define MT_LEVEL_SENSITIVE          1
@@ -258,9 +260,8 @@ struct mtk_pinctrl_devdata {
 	unsigned char  port_shf;
 	unsigned char  port_mask;
 	unsigned char  port_align;
-	struct mtk_eint_offsets eint_offsets;
-	unsigned int	ap_num;
-	unsigned int	db_cnt;
+	struct mtk_eint_hw eint_hw;
+	struct mtk_eint_regs eint_regs;
 };
 
 struct mtk_pinctrl {
@@ -274,11 +275,7 @@ struct mtk_pinctrl {
 	const char          **grp_names;
 	struct pinctrl_dev      *pctl_dev;
 	const struct mtk_pinctrl_devdata  *devdata;
-	void __iomem		*eint_reg_base;
-	struct irq_domain	*domain;
-	int			*eint_dual_edges;
-	u32 *wake_mask;
-	u32 *cur_mask;
+	struct mtk_eint *eint;
 };
 
 int mtk_pctrl_init(struct platform_device *pdev,
Signature · 1 line
2.7.4
#5 lore raw

Re: [PATCH v1 2/7] pinctrl: mediatek: refactor EINT related code for all MediaTek pinctrl can fit

Quoted 13 lines · On Sun, May 20, 2018 at 7:01 PM, <[email protected]> wrote:

From: Sean Wang <[email protected]>

This patch is in preparation for adding EINT support to MT7622 pinctrl, and the refactoring doesn't alter any existent logic.

A reason we have to refactor EINT code pieces into a generic way is that currently, they're tightly coupled with a certain type of MediaTek pinctrl would cause a grown in a very bad way as there is different types of pinctrl devices getting to join.

Therefore, it is an essential or urgent thing that EINT code pieces are refactored to eliminate any dependencies across GPIO and EINT as possible.

Quoted 6 lines

Additional structure mtk_eint_[xt, hw, regs] are being introduced for indicating how maps being designed between GPIO and EINT hw number, how to set and get GPIO state for a certain EINT pin, what characteristic on a EINT device is present on various SoCs.

Patch applied.

Yours,
Linus Walleij

#6 lore raw

PATCH 3/7 pinctrl: mediatek: add EINT support to MT7622 SoC

In reply to [email protected]

From: Sean Wang <[email protected]>

Add EINT support to MT7622 SoC and the support is made as just an option to MT7622 pinctrl.

---
 drivers/pinctrl/mediatek/Kconfig          |   2 +-
 drivers/pinctrl/mediatek/pinctrl-mt7622.c | 143 ++++++++++++++++++++++++++++++
 2 files changed, 144 insertions(+), 1 deletion(-)
drivers/pinctrl/mediatek/Kconfig +1 -1
index 310db42..9905dc6 100644
@@ -3,7 +3,7 @@ menu "MediaTek pinctrl drivers"
 
 config EINT_MTK
 	bool "MediaTek External Interrupt Support"
-	depends on PINCTRL_MTK || COMPILE_TEST
+	depends on PINCTRL_MTK || PINCTRL_MT7622 || COMPILE_TEST
 	select IRQ_DOMAIN
 
 config PINCTRL_MTK
drivers/pinctrl/mediatek/pinctrl-mt7622.c +143 -0

203 lines not on this page · raw message

Signature · 1 line
2.7.4
#8 lore raw

PATCH 4/7 pinctrl: mediatek: use generic EINT register maps for each SoC

In reply to [email protected]

From: Sean Wang <[email protected]>

So far, EINT on each SoC all used exactly identical register map and thus it's better that we apply generic register map already supported in EINT library and stop copy-n-pasting the same data block and filling into its platform data.

---
 drivers/pinctrl/mediatek/pinctrl-mt2701.c     | 20 --------------------
 drivers/pinctrl/mediatek/pinctrl-mt2712.c     | 20 --------------------
 drivers/pinctrl/mediatek/pinctrl-mt8127.c     | 20 --------------------
 drivers/pinctrl/mediatek/pinctrl-mt8135.c     | 20 --------------------
 drivers/pinctrl/mediatek/pinctrl-mt8173.c     | 20 --------------------
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |  6 +++++-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |  2 +-
 7 files changed, 6 insertions(+), 102 deletions(-)
drivers/pinctrl/mediatek/pinctrl-mt2701.c +0 -20
index e0963c6..db22250 100644
@@ -538,26 +538,6 @@ static const struct mtk_pinctrl_devdata mt2701_pinctrl_data = {
 		.ap_num    = 169,
 		.db_cnt    = 16,
 	},
-	.eint_regs = {
-		.stat      = 0x000,
-		.ack       = 0x040,
-		.mask      = 0x080,
-		.mask_set  = 0x0c0,
-		.mask_clr  = 0x100,
-		.sens      = 0x140,
-		.sens_set  = 0x180,
-		.sens_clr  = 0x1c0,
-		.soft      = 0x200,
-		.soft_set  = 0x240,
-		.soft_clr  = 0x280,
-		.pol       = 0x300,
-		.pol_set   = 0x340,
-		.pol_clr   = 0x380,
-		.dom_en    = 0x400,
-		.dbnc_ctrl = 0x500,
-		.dbnc_set  = 0x600,
-		.dbnc_clr  = 0x700,
-	},
 };
 
 static int mt2701_pinctrl_probe(struct platform_device *pdev)
drivers/pinctrl/mediatek/pinctrl-mt2712.c +0 -20
index 02aff28..6e2acef 100644
@@ -583,26 +583,6 @@ static const struct mtk_pinctrl_devdata mt2712_pinctrl_data = {
 		.ap_num    = 229,
 		.db_cnt    = 40,
 	},
-	.eint_regs = {
-		.stat      = 0x000,
-		.ack       = 0x040,
-		.mask      = 0x080,
-		.mask_set  = 0x0c0,
-		.mask_clr  = 0x100,
-		.sens      = 0x140,
-		.sens_set  = 0x180,
-		.sens_clr  = 0x1c0,
-		.soft      = 0x200,
-		.soft_set  = 0x240,
-		.soft_clr  = 0x280,
-		.pol       = 0x300,
-		.pol_set   = 0x340,
-		.pol_clr   = 0x380,
-		.dom_en    = 0x400,
-		.dbnc_ctrl = 0x500,
-		.dbnc_set  = 0x600,
-		.dbnc_clr  = 0x700,
-	},
 };
 
 static int mt2712_pinctrl_probe(struct platform_device *pdev)
drivers/pinctrl/mediatek/pinctrl-mt8127.c +0 -20
index 71f6258..949a235 100644
@@ -307,26 +307,6 @@ static const struct mtk_pinctrl_devdata mt8127_pinctrl_data = {
 		.ap_num    = 143,
 		.db_cnt    = 16,
 	},
-	.eint_regs = {
-		.stat      = 0x000,
-		.ack       = 0x040,
-		.mask      = 0x080,
-		.mask_set  = 0x0c0,
-		.mask_clr  = 0x100,
-		.sens      = 0x140,
-		.sens_set  = 0x180,
-		.sens_clr  = 0x1c0,
-		.soft      = 0x200,
-		.soft_set  = 0x240,
-		.soft_clr  = 0x280,
-		.pol       = 0x300,
-		.pol_set   = 0x340,
-		.pol_clr   = 0x380,
-		.dom_en    = 0x400,
-		.dbnc_ctrl = 0x500,
-		.dbnc_set  = 0x600,
-		.dbnc_clr  = 0x700,
-	},
 };
 
 static int mt8127_pinctrl_probe(struct platform_device *pdev)
drivers/pinctrl/mediatek/pinctrl-mt8135.c +0 -20
index fdfa357..974a1f43 100644
@@ -320,26 +320,6 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data = {
 		.ap_num    = 192,
 		.db_cnt    = 16,
 	},
-	.eint_regs = {
-		.stat      = 0x000,
-		.ack       = 0x040,
-		.mask      = 0x080,
-		.mask_set  = 0x0c0,
-		.mask_clr  = 0x100,
-		.sens      = 0x140,
-		.sens_set  = 0x180,
-		.sens_clr  = 0x1c0,
-		.soft      = 0x200,
-		.soft_set  = 0x240,
-		.soft_clr  = 0x280,
-		.pol       = 0x300,
-		.pol_set   = 0x340,
-		.pol_clr   = 0x380,
-		.dom_en    = 0x400,
-		.dbnc_ctrl = 0x500,
-		.dbnc_set  = 0x600,
-		.dbnc_clr  = 0x700,
-	},
 };
 
 static int mt8135_pinctrl_probe(struct platform_device *pdev)
drivers/pinctrl/mediatek/pinctrl-mt8173.c +0 -20
index 1466c95..a836cee3 100644
@@ -347,26 +347,6 @@ static const struct mtk_pinctrl_devdata mt8173_pinctrl_data = {
 		.ap_num    = 224,
 		.db_cnt    = 16,
 	},
-	.eint_regs = {
-		.stat      = 0x000,
-		.ack       = 0x040,
-		.mask      = 0x080,
-		.mask_set  = 0x0c0,
-		.mask_clr  = 0x100,
-		.sens      = 0x140,
-		.sens_set  = 0x180,
-		.sens_clr  = 0x1c0,
-		.soft      = 0x200,
-		.soft_set  = 0x240,
-		.soft_clr  = 0x280,
-		.pol       = 0x300,
-		.pol_set   = 0x340,
-		.pol_clr   = 0x380,
-		.dom_en    = 0x400,
-		.dbnc_ctrl = 0x500,
-		.dbnc_set  = 0x600,
-		.dbnc_clr  = 0x700,
-	},
 };
 
 static int mt8173_pinctrl_probe(struct platform_device *pdev)
drivers/pinctrl/mediatek/pinctrl-mtk-common.c +5 -1
index 11e0d0f..b379969 100644
@@ -1014,7 +1014,11 @@ static int mtk_eint_init(struct mtk_pinctrl *pctl, struct platform_device *pdev)
 		return -EINVAL;
 
 	pctl->eint->dev = &pdev->dev;
-	pctl->eint->regs = &pctl->devdata->eint_regs;
+	/*
+	 * If pctl->eint->regs == NULL, it would fall back into using a generic
+	 * register map in mtk_eint_do_init calls.
+	 */
+	pctl->eint->regs = pctl->devdata->eint_regs;
 	pctl->eint->hw = &pctl->devdata->eint_hw;
 	pctl->eint->pctl = pctl;
 	pctl->eint->gpio_xlate = &mtk_eint_xt;
drivers/pinctrl/mediatek/pinctrl-mtk-common.h +1 -1
index 346e3db..bf13eb0 100644
@@ -261,7 +261,7 @@ struct mtk_pinctrl_devdata {
 	unsigned char  port_mask;
 	unsigned char  port_align;
 	struct mtk_eint_hw eint_hw;
-	struct mtk_eint_regs eint_regs;
+	struct mtk_eint_regs *eint_regs;
 };
 
 struct mtk_pinctrl {
Signature · 1 line
2.7.4
#9 lore raw

Re: [PATCH v1 4/7] pinctrl: mediatek: use generic EINT register maps for each SoC

Quoted 8 lines · On Sun, May 20, 2018 at 7:01 PM, <[email protected]> wrote:

From: Sean Wang <[email protected]>

So far, EINT on each SoC all used exactly identical register map and thus it's better that we apply generic register map already supported in EINT library and stop copy-n-pasting the same data block and filling into its platform data.

Patch applied.

Yours,
Linus Walleij

#10 lore raw

PATCH 5/7 pinctrl: mediatek: remove unused fields in struct mtk_eint_hw

In reply to [email protected]

From: Sean Wang <[email protected]>

The .name field has been not being used in existent code logic, so it's better that we remove them all.

---
 drivers/pinctrl/mediatek/mtk-eint.h       | 1 -
 drivers/pinctrl/mediatek/pinctrl-mt2701.c | 1 -
 drivers/pinctrl/mediatek/pinctrl-mt2712.c | 1 -
 drivers/pinctrl/mediatek/pinctrl-mt8127.c | 1 -
 drivers/pinctrl/mediatek/pinctrl-mt8135.c | 1 -
 drivers/pinctrl/mediatek/pinctrl-mt8173.c | 1 -
 6 files changed, 6 deletions(-)
drivers/pinctrl/mediatek/mtk-eint.h +0 -1
index 55b4d5f..c286a9b 100644
@@ -33,7 +33,6 @@ struct mtk_eint_regs {
 };
 
 struct mtk_eint_hw {
-	const char	*name;
 	u8		port_mask;
 	u8		ports;
 	unsigned int	ap_num;
drivers/pinctrl/mediatek/pinctrl-mt2701.c +0 -1
index db22250..e91c314 100644
@@ -532,7 +532,6 @@ static const struct mtk_pinctrl_devdata mt2701_pinctrl_data = {
 	.port_mask = 0x1f,
 	.port_align = 4,
 	.eint_hw = {
-		.name = "mt2701_eint",
 		.port_mask = 6,
 		.ports     = 6,
 		.ap_num    = 169,
drivers/pinctrl/mediatek/pinctrl-mt2712.c +0 -1
index 6e2acef..8398d55 100644
@@ -577,7 +577,6 @@ static const struct mtk_pinctrl_devdata mt2712_pinctrl_data = {
 	.port_mask = 0xf,
 	.port_align = 4,
 	.eint_hw = {
-		.name = "mt2712_eint",
 		.port_mask = 0xf,
 		.ports     = 8,
 		.ap_num    = 229,
drivers/pinctrl/mediatek/pinctrl-mt8127.c +0 -1
index 949a235..2e4cc92 100644
@@ -301,7 +301,6 @@ static const struct mtk_pinctrl_devdata mt8127_pinctrl_data = {
 	.port_mask = 0xf,
 	.port_align = 4,
 	.eint_hw = {
-		.name = "mt8127_eint",
 		.port_mask = 7,
 		.ports     = 6,
 		.ap_num    = 143,
drivers/pinctrl/mediatek/pinctrl-mt8135.c +0 -1
index 974a1f43..7f5edfa 100644
@@ -314,7 +314,6 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data = {
 	.port_mask = 0xf,
 	.port_align = 4,
 	.eint_hw = {
-		.name = "mt8135_eint",
 		.port_mask = 7,
 		.ports     = 6,
 		.ap_num    = 192,
drivers/pinctrl/mediatek/pinctrl-mt8173.c +0 -1
index a836cee3..c449c9a 100644
@@ -341,7 +341,6 @@ static const struct mtk_pinctrl_devdata mt8173_pinctrl_data = {
 	.port_mask = 0xf,
 	.port_align = 4,
 	.eint_hw = {
-		.name = "mt8173_eint",
 		.port_mask = 7,
 		.ports     = 6,
 		.ap_num    = 224,
Signature · 1 line
2.7.4
#12 lore raw

PATCH 6/7 MAINTAINERS: update entry for PIN CONTROLLER - MEDIATEK

In reply to [email protected]

From: Sean Wang <[email protected]>

Add new files for the entry

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 9051a9c..7f3cced 100644
@@ -11193,6 +11193,7 @@ L:	linux-mediatek at lists.infradead.org (moderated for non-subscribers)
 S:	Maintained
 F:	Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
 F:	Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt
+F:	drivers/pinctrl/mediatek/mtk-eint.*
 F:	drivers/pinctrl/mediatek/pinctrl-mtk-common.*
 F:	drivers/pinctrl/mediatek/pinctrl-mt2701.c
 F:	drivers/pinctrl/mediatek/pinctrl-mt7622.c
Signature · 1 line
2.7.4
#14 lore raw

PATCH 7/7 arm64: dts: mt7622: add EINT support to pinctrl

In reply to [email protected]

From: Sean Wang <[email protected]>

Add EINT support to pinctrl and set those GPIO keys as interrupt-driven keys.

---
 arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 2 +-
 arch/arm64/boot/dts/mediatek/mt7622.dtsi     | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +1 -1
index b783764..1ff003e 100644
@@ -34,7 +34,7 @@
 	};
 
 	gpio-keys {
-		compatible = "gpio-keys-polled";
+		compatible = "gpio-keys";
 		poll-interval = <100>;
 
 		factory {
arch/arm64/boot/dts/mediatek/mt7622.dtsi +7 -1
index 9213c96..e2c5450 100644
@@ -286,9 +286,15 @@
 
 	pio: pinctrl at 10211000 {
 		compatible = "mediatek,mt7622-pinctrl";
-		reg = <0 0x10211000 0 0x1000>;
+		reg = <0 0x10211000 0 0x1000>,
+		      <0 0x10005000 0 0x1000>;
+		reg-names = "base", "eint";
 		gpio-controller;
 		#gpio-cells = <2>;
+		interrupt-controller;
+		interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-parent = <&gic>;
+		#interrupt-cells = <2>;
 	};
 
 	watchdog: watchdog at 10212000 {
Signature · 1 line
2.7.4
maintainer
#16 lore raw

Re: [PATCH v1 7/7] arm64: dts: mt7622: add EINT support to pinctrl

In reply to [email protected]
Quoted 7 lines · sean.wang at mediatek.com

From: Sean Wang <[email protected]>

Add EINT support to pinctrl and set those GPIO keys as interrupt-driven keys.

---

Merged,

Thanks!

Quoted 39 lines
 arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 2 +-
 arch/arm64/boot/dts/mediatek/mt7622.dtsi     | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +1 -1
index b783764..1ff003e 100644
@@ -34,7 +34,7 @@
 	};
 
 	gpio-keys {
-		compatible = "gpio-keys-polled";
+		compatible = "gpio-keys";
 		poll-interval = <100>;
 
 		factory {
arch/arm64/boot/dts/mediatek/mt7622.dtsi +7 -1
index 9213c96..e2c5450 100644
@@ -286,9 +286,15 @@
 
 	pio: pinctrl at 10211000 {
 		compatible = "mediatek,mt7622-pinctrl";
-		reg = <0 0x10211000 0 0x1000>;
+		reg = <0 0x10211000 0 0x1000>,
+		      <0 0x10005000 0 0x1000>;
+		reg-names = "base", "eint";
 		gpio-controller;
 		#gpio-cells = <2>;
+		interrupt-controller;
+		interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-parent = <&gic>;
+		#interrupt-cells = <2>;
 	};
 
 	watchdog: watchdog at 10212000 {