Skip to contentSkip to conversation

arm64: berlin: add pinctrl support

PATCH Applied Jisheng Zhang 3 participants 18 messages Oct 16, 2015

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

v6 cover arm64: berlin: add pinctrl support

This series adds support for Marvell berlin4ct pin-controller, allowing to configure the pin muxing from the device tree.

Since v5:
- add Sebastian and Antoine ack tag
- Reorder the statements under the PINCTRL_BERLIN_BG4CT config option

Since v4:
- drop ARCH_BERLIN dependency for it has been met
- drop COMPILE_TEST dependency but make berlin pinctrl driver visible if COMPILE_TEST=y, and let this change be a seperate commit.

Since v3:
- fix stupid build error: I missed local changes to berlin-bg4ct.c

Since v2:
- introduce new berlin_pinctrl_probe_regmap() to avoid duplicated code
- renaming such as s/urt/uart etc. but keep the group name as URT* to keep consistent with HW/ASIC

Since v1:
- use generic name for pin functions
- a new commit to add pinmux for uart0
- correct pinctrl usage in dts

Jisheng Zhang (7):
pinctrl: berlin: introduce berlin_pinctrl_probe_regmap()
pinctrl: berlin: Make berlin pinctrl driver visible if COMPILE_TEST=y
pinctrl: berlin: add the berlin4ct pinctrl driver
arm64: berlin: add the pinctrl dependency for Marvell Berlin SoCs
pinctrl: dt-binding: document berlin4ct SoC pinctrl
arm64: dts: berlin4ct: add the pinctrl node
arm64: dts: berlin4ct: add default pinmux for uart0

 .../devicetree/bindings/pinctrl/berlin,pinctrl.txt |   5 +-
 arch/arm64/Kconfig.platforms                       |   1 +
 arch/arm64/boot/dts/marvell/berlin4ct.dtsi         |  22 +
 drivers/pinctrl/berlin/Kconfig                     |   7 +-
 drivers/pinctrl/berlin/Makefile                    |   1 +
 drivers/pinctrl/berlin/berlin-bg4ct.c              | 503 +++++++++++++++++++++
 drivers/pinctrl/berlin/berlin.c                    |  26 +-
 drivers/pinctrl/berlin/berlin.h                    |   4 +
 8 files changed, 558 insertions(+), 11 deletions(-)
 create mode 100644 drivers/pinctrl/berlin/berlin-bg4ct.c
Signature · 1 line
2.6.1
#1 lore raw

PATCH v6 1/7 pinctrl: berlin: introduce berlin_pinctrl_probe_regmap()

This is to prepare for the next berlin4ct support, where we won't use simple-mfd any more.

---
 drivers/pinctrl/berlin/berlin.c | 26 +++++++++++++++++---------
 drivers/pinctrl/berlin/berlin.h |  4 ++++
 2 files changed, 21 insertions(+), 9 deletions(-)
drivers/pinctrl/berlin/berlin.c +17 -9
index f495806..898afa4 100644
@@ -292,20 +292,14 @@ static struct pinctrl_desc berlin_pctrl_desc = {
 	.owner		= THIS_MODULE,
 };
 
-int berlin_pinctrl_probe(struct platform_device *pdev,
-			 const struct berlin_pinctrl_desc *desc)
+int berlin_pinctrl_probe_regmap(struct platform_device *pdev,
+				const struct berlin_pinctrl_desc *desc,
+				struct regmap *regmap)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *parent_np = of_get_parent(dev->of_node);
 	struct berlin_pinctrl *pctrl;
-	struct regmap *regmap;
 	int ret;
 
-	regmap = syscon_node_to_regmap(parent_np);
-	of_node_put(parent_np);
-	if (IS_ERR(regmap))
-		return PTR_ERR(regmap);
-
 	pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL);
 	if (!pctrl)
 		return -ENOMEM;
@@ -330,3 +324,17 @@ int berlin_pinctrl_probe(struct platform_device *pdev,
 
 	return 0;
 }
+
+int berlin_pinctrl_probe(struct platform_device *pdev,
+			 const struct berlin_pinctrl_desc *desc)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *parent_np = of_get_parent(dev->of_node);
+	struct regmap *regmap = syscon_node_to_regmap(parent_np);
+
+	of_node_put(parent_np);
+	if (IS_ERR(regmap))
+		return PTR_ERR(regmap);
+
+	return berlin_pinctrl_probe_regmap(pdev, desc, regmap);
+}
drivers/pinctrl/berlin/berlin.h +4 -0
index e1aa841..dabbd2a 100644
@@ -58,4 +58,8 @@ struct berlin_pinctrl_function {
 int berlin_pinctrl_probe(struct platform_device *pdev,
 			 const struct berlin_pinctrl_desc *desc);
 
+int berlin_pinctrl_probe_regmap(struct platform_device *pdev,
+				const struct berlin_pinctrl_desc *desc,
+				struct regmap *regmap);
+
 #endif /* __PINCTRL_BERLIN_H */
Signature · 1 line
2.6.1
#3 lore raw

PATCH v6 2/7 pinctrl: berlin: Make berlin pinctrl driver visible if COMPILE_TEST=y

In reply to Jisheng Zhang

It is good to allow berlin pinctrl driver to build with COMPILE_TEST, so make the it menu visible when compile-testing.

---
 drivers/pinctrl/berlin/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/berlin/Kconfig +1 -1
index b18322b..f7e45c8 100644
@@ -1,4 +1,4 @@
-if ARCH_BERLIN
+if (ARCH_BERLIN || COMPILE_TEST)
 
 config PINCTRL_BERLIN
 	bool
Signature · 1 line
2.6.1
#5 lore raw

PATCH v6 3/7 pinctrl: berlin: add the berlin4ct pinctrl driver

In reply to Jisheng Zhang

Add the pin-controller driver for Marvell Berlin BG4CT SoC, with definition of its groups and functions. This uses the core Berlin pinctrl driver.

---
 drivers/pinctrl/berlin/Kconfig        |   5 +
 drivers/pinctrl/berlin/Makefile       |   1 +
 drivers/pinctrl/berlin/berlin-bg4ct.c | 503 ++++++++++++++++++++++++++++++++++
 3 files changed, 509 insertions(+)
 create mode 100644 drivers/pinctrl/berlin/berlin-bg4ct.c
drivers/pinctrl/berlin/Kconfig +5 -0
index f7e45c8..aaafd56 100644
@@ -17,4 +17,9 @@ config PINCTRL_BERLIN_BG2Q
 	bool
 	select PINCTRL_BERLIN
 
+config PINCTRL_BERLIN_BG4CT
+	bool "Marvell berlin4ct pin controller driver"
+	depends on OF
+	select PINCTRL_BERLIN
+
 endif
drivers/pinctrl/berlin/Makefile +1 -0
index deb0c6b..06f9402 100644
@@ -2,3 +2,4 @@ obj-$(CONFIG_PINCTRL_BERLIN)		+= berlin.o
 obj-$(CONFIG_PINCTRL_BERLIN_BG2)	+= berlin-bg2.o
 obj-$(CONFIG_PINCTRL_BERLIN_BG2CD)	+= berlin-bg2cd.o
 obj-$(CONFIG_PINCTRL_BERLIN_BG2Q)	+= berlin-bg2q.o
+obj-$(CONFIG_PINCTRL_BERLIN_BG4CT)	+= berlin-bg4ct.o
drivers/pinctrl/berlin/berlin-bg4ct.c new file +503 -0

503 lines not on this page · raw message

Signature · 1 line
2.6.1
#7 lore raw

PATCH v6 4/7 arm64: berlin: add the pinctrl dependency for Marvell Berlin SoCs

In reply to Jisheng Zhang

This is to add the pinctrl dependency for Marvell Berlin SoCs.

---
 arch/arm64/Kconfig.platforms | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/Kconfig.platforms +1 -0
index c6e2c75..3d17ee2 100644
@@ -9,6 +9,7 @@ config ARCH_BERLIN
 	bool "Marvell Berlin SoC Family"
 	select ARCH_REQUIRE_GPIOLIB
 	select DW_APB_ICTL
+	select PINCTRL
 	help
 	  This enables support for Marvell Berlin SoC Family
 
Signature · 1 line
2.6.1
#10 lore raw

PATCH v6 5/7 pinctrl: dt-binding: document berlin4ct SoC pinctrl

In reply to Jisheng Zhang

Add berlin4ct to existing berlin pinctrl device tree binding.

---
 Documentation/devicetree/bindings/pinctrl/berlin,pinctrl.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/pinctrl/berlin,pinctrl.txt +4 -1
index a8bb5e2..f8fa28c 100644
@@ -20,7 +20,10 @@ Required properties:
 	"marvell,berlin2cd-soc-pinctrl",
 	"marvell,berlin2cd-system-pinctrl",
 	"marvell,berlin2q-soc-pinctrl",
-	"marvell,berlin2q-system-pinctrl"
+	"marvell,berlin2q-system-pinctrl",
+	"marvell,berlin4ct-avio-pinctrl",
+	"marvell,berlin4ct-soc-pinctrl",
+	"marvell,berlin4ct-system-pinctrl"
 
 Required subnode-properties:
 - groups: a list of strings describing the group names.
Signature · 1 line
2.6.1
#12 lore raw

PATCH v6 6/7 arm64: dts: berlin4ct: add the pinctrl node

In reply to Jisheng Zhang

Add the avio, soc, sm pinctrl nodes for Marvell berlin4ct SoC.

---
 arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/boot/dts/marvell/berlin4ct.dtsi +15 -0
index a3b5f1d..8e66355 100644
@@ -225,6 +225,16 @@
 			};
 		};
 
+		soc_pinctrl: pin-controller at ea8000 {
+			compatible = "marvell,berlin4ct-soc-pinctrl";
+			reg = <0xea8000 0x14>;
+		};
+
+		avio_pinctrl: pin-controller at ea8400 {
+			compatible = "marvell,berlin4ct-avio-pinctrl";
+			reg = <0xea8400 0x8>;
+		};
+
 		apb at fc0000 {
 			compatible = "simple-bus";
 			#address-cells = <1>;
@@ -280,5 +290,10 @@
 				status = "disabled";
 			};
 		};
+
+		system_pinctrl: pin-controller at fe2200 {
+			compatible = "marvell,berlin4ct-system-pinctrl";
+			reg = <0xfe2200 0xc>;
+		};
 	};
 };
Signature · 1 line
2.6.1
#15 lore raw

PATCH v6 7/7 arm64: dts: berlin4ct: add default pinmux for uart0

In reply to Jisheng Zhang

Add urt0 txd and rxd muxing setup in the dtsi because uart0 always uses them to work, no other possibilities.

---
 arch/arm64/boot/dts/marvell/berlin4ct.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/marvell/berlin4ct.dtsi +7 -0
index 8e66355..a4a1876 100644
@@ -288,12 +288,19 @@
 				clocks = <&osc>;
 				reg-shift = <2>;
 				status = "disabled";
+				pinctrl-0 = <&uart0_pmux>;
+				pinctrl-names = "default";
 			};
 		};
 
 		system_pinctrl: pin-controller at fe2200 {
 			compatible = "marvell,berlin4ct-system-pinctrl";
 			reg = <0xfe2200 0xc>;
+
+			uart0_pmux: uart0-pmux {
+				groups = "SM_URT0_TXD", "SM_URT0_RXD";
+				function = "uart0";
+			};
 		};
 	};
 };
Signature · 1 line
2.6.1
Acked-by on v6 4/7
#8 lore raw

Re: [PATCH v6 4/7] arm64: berlin: add the pinctrl dependency for Marvell Berlin SoCs

In reply to Jisheng Zhang
Quoted 5 lines · Jisheng Zhang

This is to add the pinctrl dependency for Marvell Berlin SoCs.

Please push this through the ARM SoC tree or wherever patches to this file goes. It doesn't seem to be a hard dependency to the pin control patches.

Yours,
Linus Walleij

Acked-by on v6 7/7
#16 lore raw

Re: [PATCH v6 7/7] arm64: dts: berlin4ct: add default pinmux for uart0

In reply to Jisheng Zhang
Quoted 6 lines · Jisheng Zhang

Add urt0 txd and rxd muxing setup in the dtsi because uart0 always uses them to work, no other possibilities.

Funnel this through ARM SoC.

Yours,
Linus Walleij

maintainer Applied
#14 lore raw

Re: [PATCH v6 6/7] arm64: dts: berlin4ct: add the pinctrl node

In reply to Linus Walleij
Quoted 10 lines · Linus Walleij
Quoted 5 lines · Jisheng Zhang

Add the avio, soc, sm pinctrl nodes for Marvell berlin4ct SoC.

Funnel this through ARM SoC.

Applied to berlin64/dt with Linus' Ack.

Thanks,
Sebastian

maintainer Applied
#17 lore raw

Re: [PATCH v6 7/7] arm64: dts: berlin4ct: add default pinmux for uart0

In reply to Linus Walleij
Quoted 11 lines · Linus Walleij
Quoted 6 lines · Jisheng Zhang

Add urt0 txd and rxd muxing setup in the dtsi because uart0 always uses them to work, no other possibilities.

Funnel this through ARM SoC.

Applied to berlin64/dt with Linus' Ack.

Thanks,
Sebastian

#9 lore raw

Re: [PATCH v6 4/7] arm64: berlin: add the pinctrl dependency for Marvell Berlin SoCs

In reply to Linus Walleij
Quoted 8 lines · Linus Walleij
Quoted 5 lines · Jisheng Zhang

This is to add the pinctrl dependency for Marvell Berlin SoCs.

Quoted 5 lines

Please push this through the ARM SoC tree or wherever patches to this file goes. It doesn't seem to be a hard dependency to the pin control patches.

[Added arm-soc Maintainers]

This patch is touching arch/arm64/Kconfig.platforms. The hunk is very small so that it may be ok that I apply and send it with the next PR.

If the arm-soc Maintainers want to pick it up, I can resend the original patch with all Acked-by to arm-soc maintainer e-mail directly.

Sebastian