Skip to contentSkip to conversation

soc: rockchip: add driver for rockchip io domains

PATCH Superseded Michael Riesch 2 participants 5 messages Sep 5, 2022 – Sep 19, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover soc: rockchip: add driver for rockchip io domains

Hi all,

The IO domains on Rockchip SoCs need to be configured to the correct bank voltage. In Linux this is achieved by means of a platform driver that reads the voltage value of the supplies and configures the bits in the general register file (GRF) accordingly.

This series ports this driver to barebox to provide support for the Rockchip RK356x SoCs. Please note that I could only test the changes on RK3568 boards, so I left out the parts for the other SoCs supported by the Linux driver. Also, it should be noted that the Linux driver uses notifiers to react to voltage changes. This is not supported by this barebox driver.

WARNING: Use those patches with care as they have the potential to fry up your board. That said, testers are very welcome ;-)

Looking forward to your comments!

Best regards,
Michael

Michael Riesch (2):
soc: rockchip: add driver for rockchip io domains
arm: rockchip: radxa-rock3: remove io domain configuration

 arch/arm/boards/radxa-rock3/lowlevel.c |   6 -
 drivers/soc/Kconfig                    |   1 +
 drivers/soc/Makefile                   |   1 +
 drivers/soc/rockchip/Kconfig           |  17 ++
 drivers/soc/rockchip/Makefile          |   6 +
 drivers/soc/rockchip/io-domain.c       | 223 +++++++++++++++++++++++++
 6 files changed, 248 insertions(+), 6 deletions(-)
 create mode 100644 drivers/soc/rockchip/Kconfig
 create mode 100644 drivers/soc/rockchip/Makefile
 create mode 100644 drivers/soc/rockchip/io-domain.c
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/2 soc: rockchip: add driver for rockchip io domains

The IO domains on Rockchip SoCs need to be configured to the correct bank voltage. In Linux this is achieved by means of a platform driver that reads the voltage value of the supplies and configures the bits in the general register file (GRF) accordingly. Port this driver to barebox to provide support for the Rockchip RK356x SoCs.

---
 drivers/soc/Kconfig              |   1 +
 drivers/soc/Makefile             |   1 +
 drivers/soc/rockchip/Kconfig     |  17 +++
 drivers/soc/rockchip/Makefile    |   6 +
 drivers/soc/rockchip/io-domain.c | 223 +++++++++++++++++++++++++++++++
 5 files changed, 248 insertions(+)
 create mode 100644 drivers/soc/rockchip/Kconfig
 create mode 100644 drivers/soc/rockchip/Makefile
 create mode 100644 drivers/soc/rockchip/io-domain.c
drivers/soc/Kconfig +1 -0
index 54b69cc42e..c0fe214429 100644
@@ -2,5 +2,6 @@ menu "SoC drivers"
 
 source "drivers/soc/imx/Kconfig"
 source "drivers/soc/kvx/Kconfig"
+source "drivers/soc/rockchip/Kconfig"
 
 endmenu
drivers/soc/Makefile +1 -0
index a23e81ffb3..9bff737b78 100644
@@ -2,5 +2,6 @@
 
 obj-$(CONFIG_ARCH_IMX)		+= imx/
 obj-$(CONFIG_KVX)		+= kvx/
+obj-$(CONFIG_ARCH_ROCKCHIP)	+= rockchip/
 obj-$(CONFIG_CPU_SIFIVE)	+= sifive/
 obj-$(CONFIG_SOC_STARFIVE)	+= starfive/
drivers/soc/rockchip/Kconfig new file +17 -0
new file mode 100644
index 0000000000..3484b37e22
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+if ARCH_ROCKCHIP || COMPILE_TEST
+
+menu "Rockchip SoC drivers"
+
+config ROCKCHIP_IODOMAIN
+	tristate "Rockchip IO domain support"
+	depends on OFDEVICE
+	help
+	  Say y here to enable support io domains on Rockchip SoCs. It is
+	  necessary for the io domain setting of the SoC to match the
+	  voltage supplied by the regulators.
+
+endmenu
+
+endif
drivers/soc/rockchip/Makefile new file +6 -0
new file mode 100644
index 0000000000..104fad968e
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Rockchip Soc drivers
+#
+
+obj-$(CONFIG_ROCKCHIP_IODOMAIN) += io-domain.o
drivers/soc/rockchip/io-domain.c new file +223 -0

223 lines not on this page · raw message

Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/2 arm: rockchip: radxa-rock3: remove io domain configuration

In reply to Michael Riesch

Let the recently added Rockchip IO domain driver configure the IO domains instead of setting the bits in rk3568_start().

---
 arch/arm/boards/radxa-rock3/lowlevel.c | 6 ------
 1 file changed, 6 deletions(-)
arch/arm/boards/radxa-rock3/lowlevel.c +0 -6
index 00a68889cd..5c2499362b 100644
@@ -23,12 +23,6 @@ static noinline void rk3568_start(void *fdt)
 
 	setup_c();
 
-	/*
-	 * Enable vccio4 1.8V and vccio6 1.8V
-	 * Needed for GMAC to work.
-	 */
-	writel(RK_SETBITS(0x50), 0xfdc20140);
-
 	if (current_el() == 3) {
 		rk3568_lowlevel_init();
 		rk3568_atf_load_bl31(fdt);
Signature · 1 line
2.30.2
#3 lore raw
In reply to Michael Riesch
Quoted 14 lines · Michael Riesch

Hi all,

The IO domains on Rockchip SoCs need to be configured to the correct bank voltage. In Linux this is achieved by means of a platform driver that reads the voltage value of the supplies and configures the bits in the general register file (GRF) accordingly.

This series ports this driver to barebox to provide support for the Rockchip RK356x SoCs. Please note that I could only test the changes on RK3568 boards, so I left out the parts for the other SoCs supported by the Linux driver. Also, it should be noted that the Linux driver uses notifiers to react to voltage changes. This is not supported by this barebox driver.

Quoted 2 lines

WARNING: Use those patches with care as they have the potential to fry up your board. That said, testers are very welcome ;-)

You are frightening me.

I would apply this series, but given you warn about its usage I'm not sure what I should do with it. I could give it a test on the RK3568-EVB once it returned back in our remote lab, but I neither have a Pine64 nor a BananaPi R2 Pro.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#4 lore raw

Hi Sascha,

Quoted 15 lines · Sascha Hauer
Quoted 14 lines · Michael Riesch

Hi all,

The IO domains on Rockchip SoCs need to be configured to the correct bank voltage. In Linux this is achieved by means of a platform driver that reads the voltage value of the supplies and configures the bits in the general register file (GRF) accordingly.

This series ports this driver to barebox to provide support for the Rockchip RK356x SoCs. Please note that I could only test the changes on RK3568 boards, so I left out the parts for the other SoCs supported by the Linux driver. Also, it should be noted that the Linux driver uses notifiers to react to voltage changes. This is not supported by this barebox driver.

Quoted 4 lines
Quoted 2 lines

WARNING: Use those patches with care as they have the potential to fry up your board. That said, testers are very welcome ;-)

You are frightening me.

That was not my intention :-) In the mean time I have tested the driver successfully on a RK3568 EVB1 and I plan to dig out my Quartz64. However, I do not have a BananaPi R2 Pro and cannot test the patches there.

Quoted 4 lines

I would apply this series, but given you warn about its usage I'm not sure what I should do with it. I could give it a test on the RK3568-EVB once it returned back in our remote lab, but I neither have a Pine64 nor a BananaPi R2 Pro.

I will submit a v2 of this series that features additional clean up work. I'll try to keep the changes that affect the BananaPi R2 Pro separate. They need Frank's approval, the rest can be applied IMHO.

Best regards,
Michael