From: Quentin Schulz <quentin.schulz@cherry.de>
To: Anand Moon <anand@edgeble.ai>, Tom Rini <trini@konsulko.com>,
Simon Glass <sjg@chromium.org>,
Philipp Tomsich <philipp.tomsich@vrull.eu>,
Kever Yang <kever.yang@rock-chips.com>
Cc: Jagan Teki <jagan@edgeble.ai>, u-boot@lists.denx.de
Subject: Re: [PATCH v1 1/9] rockchip: RK3328: Read the reset cause from clock reset unit for RK3328 SoC
Date: Thu, 16 May 2024 15:39:30 +0200 [thread overview]
Message-ID: <0929d137-54d7-45cc-b58f-6549510e95c3@cherry.de> (raw)
In-Reply-To: <20240516090031.2373-2-anand@edgeble.ai>
Hi Anand,
On 5/16/24 10:59 AM, Anand Moon wrote:
> Read the reset cause from clock reset unit for RK3328 SoC.
>
> Cc: Jagan Teki <jagan@edgeble.ai>
> Signed-off-by: Anand Moon <anand@edgeble.ai>
> ---
> arch/arm/mach-rockchip/cpu-info.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-rockchip/cpu-info.c b/arch/arm/mach-rockchip/cpu-info.c
> index 14c7331e1a..fce4bd7541 100644
> --- a/arch/arm/mach-rockchip/cpu-info.c
> +++ b/arch/arm/mach-rockchip/cpu-info.c
> @@ -8,12 +8,17 @@
> #include <init.h>
> #include <asm/arch-rockchip/clock.h>
> #include <asm/arch-rockchip/cru.h>
> +#if IS_ENABLED(CONFIG_ROCKCHIP_RK3328)
> +#include <asm/arch-rockchip/cru_rk3328.h>
> +#endif
> #include <asm/arch-rockchip/hardware.h>
> #include <linux/err.h>
>
> char *get_reset_cause(void)
> {
> - struct rockchip_cru *cru = rockchip_get_cru();
> +#if IS_ENABLED(CONFIG_ROCKCHIP_RK3328)
> + struct rk3328_cru *cru = rockchip_get_cru();
> +#endif
NACK.
If I only apply this patch, it breaks support for rk3288 and rk3399 (the
ones which have a rockchip_cru struct).
Do:
"""
#if IS_ENABLED(CONFIG_ROCKCHIP_RK3328)
struct rk3328_cru *cru = rockchip_get_cru();
#else
struct rockchip_cru *cru = rockchip_get_cru();
#endif
"""
instead to keep the current support and add stuff.
However, I very much don't like this. There's no need for cpuinfo.c to
become SoC-specific.
I would recommend to move get_reset_cause() in some file that is SoC
specific, and out of the DISPLAY_CPUINFO ifdef since it may be useful
outside of this very specific print_cpuinfo function (c.f. the rk3399
firefly board).
Yes there's a bit of code duplication then, BUT, nothing guarantees us
the reset reason will always be stored in that glb_rst_st register and
moreover, RK3588 already has more reasons that currently supported, and
this prevents us from expanding it.
You can have a
"""
__weak char *get_reset_cause(void)
{
return "could not get reset cause";
}
"""
in replacement and let SoC-specific files expand it by overriding it.
And.... to think even further than that, maybe we should actually expand
drivers/sysreset/sysreset_rockchip.c to support more SoCs.
Then we could get the status via get_status callback from sysreset_ops in
https://elixir.bootlin.com/u-boot/latest/source/common/board_f.c#L904
and remove this cpu-info.c file from the arch/arm/mach-rockchip.
Reporting the SoC could be done with a CPU UCLASS (c.f. what's done for
IMX8 already), from
https://elixir.bootlin.com/u-boot/latest/source/common/board_f.c#L176.
This honestly makes more sense to me.
Cheers,
Quentin
next prev parent reply other threads:[~2024-05-16 13:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240516090031.2373-1-anand@edgeble.ai>
2024-05-16 8:59 ` [PATCH v1 1/9] rockchip: RK3328: Read the reset cause from clock reset unit for RK3328 SoC Anand Moon
2024-05-16 13:39 ` Quentin Schulz [this message]
2024-05-16 8:59 ` [PATCH v1 2/9] rockchip: RK3328: Enable display cpuinfo support on all boards Anand Moon
2024-05-16 8:59 ` [PATCH v1 3/9] rockchip: RK3399: Read the reset cause from clock reset unit for RK3399 SoC Anand Moon
2024-05-16 8:59 ` [PATCH v1 4/9] rockchip: RK3399: Enable display cpuinfo support on all boards Anand Moon
2024-05-16 8:59 ` [PATCH v1 5/9] arm: rockchip: Enable display cpuinfo to be build with SPL_BUILD Anand Moon
2024-05-16 13:45 ` Quentin Schulz
2024-05-16 14:03 ` Jonas Karlman
2024-05-16 8:59 ` [PATCH v1 6/9] rockchip: RK3568: Read the reset cause from clock reset unit for RK356x SoC Anand Moon
2024-05-16 14:17 ` Jonas Karlman
2024-05-17 7:45 ` Anand Moon
2024-05-24 8:48 ` Anand Moon
2024-05-16 8:59 ` [PATCH v1 7/9] rockchip: RK356x: Enable display cpuinfo support on all boards Anand Moon
2024-05-16 8:59 ` [PATCH v1 8/9] rockchip: RK3588: Read the reset cause from clock reset unit for RK3588 SoC Anand Moon
2024-05-16 8:59 ` [PATCH v1 9/9] rockchip: RK3588: Enable display cpuinfo support on all boards Anand Moon
2024-05-16 9:21 ` Quentin Schulz
2024-05-16 10:12 ` Anand Moon
2024-05-16 10:43 ` Quentin Schulz
2024-05-16 11:51 ` Anand Moon
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=0929d137-54d7-45cc-b58f-6549510e95c3@cherry.de \
--to=quentin.schulz@cherry.de \
--cc=anand@edgeble.ai \
--cc=jagan@edgeble.ai \
--cc=kever.yang@rock-chips.com \
--cc=philipp.tomsich@vrull.eu \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).