Re: [PATCH RFC] pinctrl: add support for HiSilicon HiSTB SoCs

2024-02-12 Thread Yang Xiwen

On 2/13/2024 1:08 AM, Tom Rini wrote:

On Tue, Feb 13, 2024 at 01:02:50AM +0800, Yang Xiwen wrote:

On 2/13/2024 12:58 AM, Tom Rini wrote:

On Tue, Feb 13, 2024 at 12:30:15AM +0800, Yang Xiwen via B4 Relay wrote:


From: Yang Xiwen 

The first supported SoC is Hi3798MV200.

Signed-off-by: Yang Xiwen 
---
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:

[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.

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.


--
Regards,
Yang Xiwen



Re: [PATCH RFC] pinctrl: add support for HiSilicon HiSTB SoCs

2024-02-12 Thread Tom Rini
On Tue, Feb 13, 2024 at 01:02:50AM +0800, Yang Xiwen wrote:
> On 2/13/2024 12:58 AM, Tom Rini wrote:
> > On Tue, Feb 13, 2024 at 12:30:15AM +0800, Yang Xiwen via B4 Relay wrote:
> > 
> > > From: Yang Xiwen 
> > > 
> > > The first supported SoC is Hi3798MV200.
> > > 
> > > Signed-off-by: Yang Xiwen 
> > > ---
> > > 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:
> > [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.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH RFC] pinctrl: add support for HiSilicon HiSTB SoCs

2024-02-12 Thread Yang Xiwen

On 2/13/2024 12:58 AM, Tom Rini wrote:

On Tue, Feb 13, 2024 at 12:30:15AM +0800, Yang Xiwen via B4 Relay wrote:


From: Yang Xiwen 

The first supported SoC is Hi3798MV200.

Signed-off-by: Yang Xiwen 
---
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:

[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.


--
Regards,
Yang Xiwen



Re: [PATCH RFC] pinctrl: add support for HiSilicon HiSTB SoCs

2024-02-12 Thread Tom Rini
On Tue, Feb 13, 2024 at 12:30:15AM +0800, Yang Xiwen via B4 Relay wrote:

> From: Yang Xiwen 
> 
> The first supported SoC is Hi3798MV200.
> 
> Signed-off-by: Yang Xiwen 
> ---
> 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:
[snip]

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

-- 
Tom


signature.asc
Description: PGP signature


[PATCH RFC] pinctrl: add support for HiSilicon HiSTB SoCs

2024-02-12 Thread Yang Xiwen via B4 Relay
From: Yang Xiwen 

The first supported SoC is Hi3798MV200.

Signed-off-by: Yang Xiwen 
---
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(+)

diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index a1d53cfbdb..d600a30492 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -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"
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index 0e929d8ca0..79fb800faf 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -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/
diff --git a/drivers/pinctrl/hisilicon/Kconfig 
b/drivers/pinctrl/hisilicon/Kconfig
new file mode 100644
index 00..33c3048940
--- /dev/null
+++ b/drivers/pinctrl/hisilicon/Kconfig
@@ -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
diff --git a/drivers/pinctrl/hisilicon/Makefile 
b/drivers/pinctrl/hisilicon/Makefile
new file mode 100644
index 00..5afb64d4b6
--- /dev/null
+++ b/drivers/pinctrl/hisilicon/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright 2024 (r) Yang Xiwen 
+
+obj-$(CONFIG_PINCTRL_HISTB)+= pinctrl-histb.o
+obj-$(CONFIG_PINCTRL_HI3798MV2X)   += pinctrl-hi3798mv2x.o
diff --git a/drivers/pinctrl/hisilicon/pinctrl-hi3798mv2x.c 
b/drivers/pinctrl/hisilicon/pinctrl-hi3798mv2x.c
new file mode 100644
index 00..1e0a89675a
--- /dev/null
+++ b/drivers/pinctrl/hisilicon/pinctrl-hi3798mv2x.c
@@ -0,0 +1,319 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * IOCONFIG driver for Hi3798MV2x SoCs
+ *
+ * Copyright 2024 (r) Yang Xiwen 
+ */
+
+#include 
+
+#include "pinctrl-histb.h"
+
+// The sequence is important!
+enum hi3798mv2x_ioconfig_pins {
+   HI3798MV2X_Y19,
+   HI3798MV2X_W19,
+