Skip to contentSkip to conversation

arm64: berlin: add pinctrl support

PATCH Superseded Jisheng Zhang 1 participant 7 messages Oct 9, 2015

Subsystems (5)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 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 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 (6):
pinctrl: berlin: introduce berlin_pinctrl_probe_regmap()
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                     |   5 +
 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, 557 insertions(+), 10 deletions(-)
 create mode 100644 drivers/pinctrl/berlin/berlin-bg4ct.c
Signature · 1 line
2.6.1
#1 lore raw

PATCH v3 1/6 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
#2 lore raw

PATCH v3 2/6 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 b18322b..c13f6d2 100644
@@ -17,4 +17,9 @@ config PINCTRL_BERLIN_BG2Q
 	bool
 	select PINCTRL_BERLIN
 
+config PINCTRL_BERLIN_BG4CT
+	depends on OF && (ARCH_BERLIN || COMPILE_TEST)
+	bool "Marvell berlin4ct pin controller driver"
+	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
#3 lore raw

PATCH v3 3/6 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
#4 lore raw

PATCH v3 4/6 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
#5 lore raw

PATCH v3 5/6 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
#6 lore raw

PATCH v3 6/6 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