mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Michael Riesch <michael.riesch@wolfvision.net>
Cc: barebox@lists.infradead.org, Frank Wunderlich <frank-w@public-files.de>
Subject: Re: [PATCH v2 1/7] soc: rockchip: add driver for rockchip io domains
Date: Thu, 22 Sep 2022 10:03:29 +0200	[thread overview]
Message-ID: <20220922080329.GG986@pengutronix.de> (raw)
In-Reply-To: <223f9b7c-a95a-7847-503d-e51cb2abaf64@wolfvision.net>

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@wolfvision.net>
> >> ---
> >>  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@pengutronix.de>
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@pengutronix.de>
---
 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 |



  reply	other threads:[~2022-09-22  8:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19 11:39 [PATCH v2 0/7] " Michael Riesch
2022-09-19 11:39 ` [PATCH v2 1/7] " Michael Riesch
2022-09-21  9:46   ` Sascha Hauer
2022-09-21 11:49     ` Michael Riesch
2022-09-22  8:03       ` Sascha Hauer [this message]
2022-09-22  8:13         ` Ahmad Fatoum
2022-09-22  8:23           ` Sascha Hauer
2022-09-19 11:39 ` [PATCH v2 2/7] arm: rockchip_v8_defconfig: enable io domain driver Michael Riesch
2022-09-19 11:39 ` [PATCH v2 3/7] arm: rockchip: radxa-rock3: remove io domain configuration Michael Riesch
2022-09-19 11:39 ` [PATCH v2 4/7] arm: rockchip: rk3568-evb: " Michael Riesch
2022-09-19 11:39 ` [PATCH v2 5/7] arm: rockchip: rk3568-bpi-r2pro: " Michael Riesch
2022-09-19 11:39 ` [PATCH v2 6/7] arm: rockchip: rk3568: refactor common rk3568_start method Michael Riesch
2022-09-21  9:17   ` Sascha Hauer
2022-09-21 11:57     ` Michael Riesch
2022-09-21 12:21       ` Sascha Hauer
2022-09-21 12:34         ` Michael Riesch
2022-09-19 11:39 ` [PATCH v2 7/7] arm: rockchip: rk3568-bpi-r2pro: use common method rk3568_start Michael Riesch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220922080329.GG986@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=frank-w@public-files.de \
    --cc=michael.riesch@wolfvision.net \
    --subject='Re: [PATCH v2 1/7] soc: rockchip: add driver for rockchip io domains' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox