On Wed, Sep 21, 2022 at 01:49:49PM +0200, Michael Riesch wrote: > Hi Sascha, > > On 9/21/22 11:46, Sascha Hauer wrote: > > On Mon, Sep 19, 2022 at 01:39:42PM +0200, Michael Riesch wrote: > >> The IO domains in Rockchip SoCs need to be configured to match the > >> corresponding 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. > >> > >> Signed-off-by: Michael Riesch <michael.riesch@xxxxxxxxxxxxxx> > >> --- > >> 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 > > > > There's nothing in this driver that makes sure it is probed before the > > users of the io domains. What happens when the users are probed before > > the io domain driver? > > Correct. Unfortunately, the situation is quite the same in the kernel. > Only recently there was a discussion as to how to resolve this issue > [0]. While the RFC in [0] was received well there is no mainline > solution to this problem. I would suggest that the mainline kernel > solution is adopted once there is one. > > In the mean time we could > - accept that it just works for some reason (TM) > - leave the magic bits in the low-level initialization to be on the > safe side Decided for this solution for now. I added the following as a reminder that there's still something to do. Sascha ---------------------------8<--------------------------- >From 502c4e819b80a6ccaefbce4af4c55b830b7e2c73 Mon Sep 17 00:00:00 2001 From: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> Date: Thu, 22 Sep 2022 09:56:57 +0200 Subject: [PATCH] ARM: Rockchip: Add FIXME comment to io domain setup We have a io-domain driver for rockchip boards which correctly configures the io domain voltages, but currently there is no way to make sure the io-domain driver is probed before its consumers. To be on the safe side keep the io domain setup in the lowlevel code for now, but add a comment that it should be removed once this issue is resolved. To solve this issue we need a phandle from the consumers to the io domain node. We could add this in barebox locally, but decided to wait until the upstream dts files have them. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- arch/arm/boards/radxa-rock3/lowlevel.c | 4 ++++ arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c | 4 ++++ arch/arm/boards/rockchip-rk3568-evb/lowlevel.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/arch/arm/boards/radxa-rock3/lowlevel.c b/arch/arm/boards/radxa-rock3/lowlevel.c index 2a449c17ae..a62f60dff8 100644 --- a/arch/arm/boards/radxa-rock3/lowlevel.c +++ b/arch/arm/boards/radxa-rock3/lowlevel.c @@ -17,6 +17,10 @@ static noinline void rk3568_start(void) /* * Enable vccio4 1.8V and vccio6 1.8V * Needed for GMAC to work. + * FIXME: This is done by the io-domain driver as well, but there + * currently is no mechanism to make sure the driver gets probed + * before its consumers. Remove this setup once this issue is + * resolved. */ writel(RK_SETBITS(0x50), 0xfdc20140); diff --git a/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c b/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c index f79f975080..4336d99365 100644 --- a/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c +++ b/arch/arm/boards/rockchip-rk3568-bpi-r2pro/lowlevel.c @@ -18,6 +18,10 @@ static noinline void rk3568_start(void) /* * set iodomain vccio6 to 1.8V needed for GMAC1 to work. * vccio4 (gmac0/switch) needs to stay at 3v3 (default) + * FIXME: This is done by the io-domain driver as well, but there + * currently is no mechanism to make sure the driver gets probed + * before its consumers. Remove this setup once this issue is + * resolved. */ //set bit 6 in PMU_GRF_IO_VSEL0 for vccio6 1v8 writel(RK_SETBITS(BIT(6)), PMU_GRF_IO_VSEL0); diff --git a/arch/arm/boards/rockchip-rk3568-evb/lowlevel.c b/arch/arm/boards/rockchip-rk3568-evb/lowlevel.c index 363639d21b..9ab436135c 100644 --- a/arch/arm/boards/rockchip-rk3568-evb/lowlevel.c +++ b/arch/arm/boards/rockchip-rk3568-evb/lowlevel.c @@ -18,6 +18,10 @@ static noinline void rk3568_start(void) /* * Enable vccio4 1.8V and vccio6 1.8V * Needed for GMAC to work. + * FIXME: This is done by the io-domain driver as well, but there + * currently is no mechanism to make sure the driver gets probed + * before its consumers. Remove this setup once this issue is + * resolved. */ writel(RK_SETBITS(0x50), 0xfdc20140); -- 2.30.2 -- 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 |