Skip to contentSkip to conversation

pinctrl: add support for HiSilicon HiSTB SoCs

RFC PATCH In review Yang Xiwen 2 participants 5 messages Feb 12, 2024 Pin control

lore
Share & tools
lore

Yang Xiwen

author
#0 lore raw

RFC PATCH 1/1 pinctrl: add support for HiSilicon HiSTB SoCs

The first supported SoC is Hi3798MV200.

---
This patchset adds support for HiSTB ioconfig module. The module is used to set pins config(e.g. pull-up, pull-down, drive-strength etc..) and pinmux.

The first supported chip is Hi3798MV200. Adding support for Hi3798CV200 should be also easy.

Below is an example of the dts node:

```dts
ioconfig: pinctrl@8a21000 {
	compatible = "hisilicon,hi3798mv200-ioconfig";
	reg = <0x8a21000 0x180>;
	#pinctrl-cells = <1>;

	emmc_default: emmc-default-state {
		cdata-pins {
			// CDATA0-7
			pins = "W20", "V20", "U20", "V19", "Y21", "W21", "V21", "U21";
			bias-pullup;
			slew-rate = <1>;

			drive-strength = <8>;
			function = "emmc_cdata";
		};

		cclk-pin {
			pins = "T18";

			bias-pullup;
			slew-rate = <1>;

			drive-strength = <8>;
			function = "emmc_cclk";
		};

		ccmd-pin {
			pins = "T20";

			bias-pullup;
			slew-rate = <1>;

			drive-strength = <6>;
			function = "emmc_ccmd";
		};

		reset-pin {
			pins = "R20";

			bias-disable;
			slew-rate = <1>;

			drive-strength = <1>;
			function = "emmc_rst";
		};

		datastrobe-pin {
			pins = "R21";

			bias-pullup;
			slew-rate;

			drive-strength = <1>;
			function = "emmc_datastrobe";
		};
	};
};
```
---
 drivers/pinctrl/Kconfig                        |   1 +
 drivers/pinctrl/Makefile                       |   1 +
 drivers/pinctrl/hisilicon/Kconfig              |  21 ++
 drivers/pinctrl/hisilicon/Makefile             |   6 +
 drivers/pinctrl/hisilicon/pinctrl-hi3798mv2x.c | 319 +++++++++++++++++++++++++
 drivers/pinctrl/hisilicon/pinctrl-histb.c      | 276 +++++++++++++++++++++
 drivers/pinctrl/hisilicon/pinctrl-histb.h      | 132 ++++++++++
 7 files changed, 756 insertions(+)
drivers/pinctrl/Kconfig +1 -0
index a1d53cfbdb..d600a30492 100644
@@ -346,6 +346,7 @@ endif
 
 source "drivers/pinctrl/broadcom/Kconfig"
 source "drivers/pinctrl/exynos/Kconfig"
+source "drivers/pinctrl/hisilicon/Kconfig"
 source "drivers/pinctrl/intel/Kconfig"
 source "drivers/pinctrl/mediatek/Kconfig"
 source "drivers/pinctrl/meson/Kconfig"
drivers/pinctrl/Makefile +1 -0
index 0e929d8ca0..79fb800faf 100644
@@ -36,3 +36,4 @@ obj-$(CONFIG_$(SPL_)PINCTRL_STMFX)	+= pinctrl-stmfx.o
 obj-y				+= broadcom/
 obj-$(CONFIG_PINCTRL_ZYNQMP)	+= pinctrl-zynqmp.o
 obj-$(CONFIG_PINCTRL_STARFIVE)	+= starfive/
+obj-$(CONFIG_PINCTRL_HISILICON)	+= hisilicon/
drivers/pinctrl/hisilicon/Kconfig new file +21 -0
new file mode 100644
index 0000000000..33c3048940
@@ -0,0 +1,21 @@
+config PINCTRL_HISILICON
+	bool
+
+config PINCTRL_HISTB
+	bool "HiSilicon HiSTB pinctrl framework"
+	depends on PINCTRL
+	select PINCTRL_HISILICON
+	imply PINCONF
+	help
+	  Support HiSTB SoCs IOCONFIG module
+
+menu "HiSTB pinctrl drivers"
+	depends on PINCTRL_HISTB
+
+config PINCTRL_HI3798MV2X
+	bool "HiSilicon Hi3798MV2X pinctrl driver"
+	depends on ARCH_HI3798MV2X
+	help
+	  Support IOCONFIG on Hi3798MV2X SoCs
+
+endmenu
drivers/pinctrl/hisilicon/Makefile new file +6 -0
new file mode 100644
index 0000000000..5afb64d4b6
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright 2024 (r) Yang Xiwen <[email protected]>
+
+obj-$(CONFIG_PINCTRL_HISTB)		+= pinctrl-histb.o
+obj-$(CONFIG_PINCTRL_HI3798MV2X)	+= pinctrl-hi3798mv2x.o
drivers/pinctrl/hisilicon/pinctrl-hi3798mv2x.c new file +319 -0

319 lines not on this page · raw message

drivers/pinctrl/hisilicon/pinctrl-histb.c new file +276 -0

276 lines not on this page · raw message

drivers/pinctrl/hisilicon/pinctrl-histb.h new file +132 -0

132 lines not on this page · raw message

---
base-commit: 050a9b981d6a835133521b599be3ae189ce70f41
change-id: 20240204-pinctrl-3a126ad9286e

Best regards,

Signature · 1 line
Yang Xiwen <[email protected]>
#1 lore raw
Quoted 10 lines · On Tue, Feb 13, 2024 at 12:30:15AM +0800, Yang Xiwen via B4 Relay wrote:

From: Yang Xiwen <[email protected]>

The first supported SoC is Hi3798MV200.

---
This patchset adds support for HiSTB ioconfig module. The module is used to set pins config(e.g. pull-up, pull-down, drive-strength etc..) and pinmux.

Quoted 4 lines

The first supported chip is Hi3798MV200. Adding support for Hi3798CV200 should be also easy.

Below is an example of the dts node:

[snip]

Has this binding already been accepted to the kernel? Thanks.

Signature · 1 line
Tom
author
#2 lore raw
Quoted 12 lines · Tom Rini
Quoted 10 lines · On Tue, Feb 13, 2024 at 12:30:15AM +0800, Yang Xiwen via B4 Relay wrote:

From: Yang Xiwen <[email protected]>

The first supported SoC is Hi3798MV200.

---
This patchset adds support for HiSTB ioconfig module. The module is used to set pins config(e.g. pull-up, pull-down, drive-strength etc..) and pinmux.

Quoted 8 lines
Quoted 4 lines

The first supported chip is Hi3798MV200. Adding support for Hi3798CV200 should be also easy.

Below is an example of the dts node:

[snip]

Has this binding already been accepted to the kernel? Thanks.

No, I've not wrote the driver for linux yet. That's why it is RFC now. But it is expected to be soon. I'm going to finish u-boot part first and work on linux kernel later. After that, i can sync linux dts and bindings back to u-boot.

Signature · 2 lines
Regards,
Yang Xiwen
#3 lore raw
Quoted 17 lines · Yang Xiwen
Quoted 16 lines · Tom Rini
Quoted 14 lines · On Tue, Feb 13, 2024 at 12:30:15AM +0800, Yang Xiwen via B4 Relay wrote:

From: Yang Xiwen <[email protected]>

The first supported SoC is Hi3798MV200.

---
This patchset adds support for HiSTB ioconfig module. The module is used to set pins config(e.g. pull-up, pull-down, drive-strength etc..) and pinmux.

The first supported chip is Hi3798MV200. Adding support for Hi3798CV200 should be also easy.

Below is an example of the dts node:

Quoted 8 lines
Quoted 4 lines

[snip]

Has this binding already been accepted to the kernel? Thanks.

No, I've not wrote the driver for linux yet. That's why it is RFC now. But it is expected to be soon. I'm going to finish u-boot part first and work on linux kernel later. After that, i can sync linux dts and bindings back to u-boot.

How soon before you start on the Linux side of things? Given that this wouldn't be merged for v2024.04, there's plenty of time to get that Linux side going (or at least the binding reviewed and accepted to -next or similar) before merging here, and for U-Boot the biggest feedback (aside from anything checkpatch.pl may say) would be to get the binding reviewed.

Signature · 1 line
Tom
author
#4 lore raw
Quoted 26 lines · Tom Rini
Quoted 17 lines · Yang Xiwen
Quoted 16 lines · Tom Rini
Quoted 14 lines · On Tue, Feb 13, 2024 at 12:30:15AM +0800, Yang Xiwen via B4 Relay wrote:

From: Yang Xiwen <[email protected]>

The first supported SoC is Hi3798MV200.

---
This patchset adds support for HiSTB ioconfig module. The module is used to set pins config(e.g. pull-up, pull-down, drive-strength etc..) and pinmux.

The first supported chip is Hi3798MV200. Adding support for Hi3798CV200 should be also easy.

Below is an example of the dts node:

Quoted 8 lines
Quoted 4 lines

[snip]

Has this binding already been accepted to the kernel? Thanks.

No, I've not wrote the driver for linux yet. That's why it is RFC now. But it is expected to be soon. I'm going to finish u-boot part first and work on linux kernel later. After that, i can sync linux dts and bindings back to u-boot.

Quoted 7 lines

How soon before you start on the Linux side of things? Given that this wouldn't be merged for v2024.04, there's plenty of time to get that Linux side going (or at least the binding reviewed and accepted to -next or similar) before merging here, and for U-Boot the biggest feedback (aside from anything checkpatch.pl may say) would be to get the binding reviewed.

Sadly, it's not on my urgent list, since we only need to setup pinctrl stuff once during boot. Not even this SoC(Hi3798MV200) is supported in mainline Linux yet. I'm keeping working on this, but I really can't say how soon i can start working on Linux side. Though I can say it's not going to be very soon if i'm the only one who is working on this platform.

Maybe Jorge and Igor can join and speed up the process. Since Hi3798CV200 is supported by mainline(This SoC is used by 96boards poplar), writing a pinctrl driver for that SoC would receive more comments and reviews.

Signature · 2 lines
Regards,
Yang Xiwen