From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 3/9] arm: exynos: Detect revision later, when all resources are ready
Date: Sun, 17 Feb 2019 23:34:13 +0100 [thread overview]
Message-ID: <20190217233413.5b244c99@jawa> (raw)
In-Reply-To: <20190216094548.911-4-krzk@kernel.org>
On Sat, 16 Feb 2019 10:45:42 +0100
Krzysztof Kozlowski <krzk@kernel.org> wrote:
> Detection of board revision is done early - before power setup. In
> case of Odroid XU3/XU4/HC1 family, the detection is done using ADC
> which is supplied by LDO4/VDD_ADC regulator. This regulator could be
> turned off (e.g. by kernel before reboot). If ADC is used early, the
> regulators are not yet available and the detection won't work.
>
> Split the revision detection out of set_board_type() into separate
> function called later - either when displaying board info (in late
> mode) or during misc_init_r. The idea is that set_board_type() will
> be called early so its method of detection are limited to flattened
> device tree (exynos5-dt-types.c for Exynos5) or GPIO (odroid.c for
> Exynos4412). The newly added set_board_revision() can be called only
> later, when resources like regulator are available.
>
> This is necessary to fix the detection of Odroid HC1 after reboot, if
> kernel turned off the LDO4 regulator.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
> board/samsung/common/board.c | 22 +++++++++++++++++++++-
> board/samsung/common/exynos5-dt-types.c | 16 +++++++++++++---
> board/samsung/odroid/odroid.c | 8 ++++++++
> include/samsung/misc.h | 1 +
> 4 files changed, 43 insertions(+), 4 deletions(-)
>
> diff --git a/board/samsung/common/board.c
> b/board/samsung/common/board.c index 96228a86a117..ef2204742e1d 100644
> --- a/board/samsung/common/board.c
> +++ b/board/samsung/common/board.c
> @@ -253,7 +253,18 @@ int board_eth_init(bd_t *bis)
> int checkboard(void)
> {
> if (IS_ENABLED(CONFIG_BOARD_TYPES)) {
> - const char *board_info = get_board_type();
> + const char *board_info;
> +
> + if (IS_ENABLED(CONFIG_DISPLAY_BOARDINFO_LATE)) {
> + /*
> + * Printing type requires having revision,
> although
> + * this will succeed only if done late.
> + * Otherwise revision will be set in
> misc_init_r().
> + */
> + set_board_revision();
> + }
> +
> + board_info = get_board_type();
>
> if (board_info)
> printf("Type: %s\n", board_info);
> @@ -287,6 +298,15 @@ int board_late_init(void)
> #ifdef CONFIG_MISC_INIT_R
> int misc_init_r(void)
> {
> + if (!IS_ENABLED(CONFIG_DISPLAY_BOARDINFO_LATE)) {
> + /*
> + * If revision was not set by late display boardinfo,
> + * set it here. At this point regulators should be
> already
> + * available.
> + */
> + set_board_revision();
> + }
> +
> #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> set_board_info();
> #endif
> diff --git a/board/samsung/common/exynos5-dt-types.c
> b/board/samsung/common/exynos5-dt-types.c index
> 7a86e9187768..7c1271d6547a 100644 ---
> a/board/samsung/common/exynos5-dt-types.c +++
> b/board/samsung/common/exynos5-dt-types.c @@ -192,8 +192,11 @@ const
> char *get_board_type(void)
> /**
> * set_board_type() - set board type in gd->board_type.
> - * As default type set EXYNOS5_BOARD_GENERIC, if detect Odroid,
> - * then set its proper type.
> + * As default type set EXYNOS5_BOARD_GENERIC. If Odroid is detected,
> + * set its proper type based on device tree.
> + *
> + * This might be called early when some more specific ways to detect
> revision
> + * are not yet available.
> */
> void set_board_type(void)
> {
> @@ -211,8 +214,15 @@ void set_board_type(void)
> gd->board_type = of_match->data;
> break;
> }
> +}
>
> - /* If Odroid, then check its revision */
> +/**
> + * set_board_revision() - set detailed board type in gd->board_type.
> + * Should be called when resources (e.g. regulators) are available
> + * so ADC can be used to detect the specific revision of a board.
> + */
> +void set_board_revision(void)
> +{
> if (board_is_odroidxu3())
> gd->board_type = odroid_get_board_type();
> }
> diff --git a/board/samsung/odroid/odroid.c
> b/board/samsung/odroid/odroid.c index 552333fe869d..4be8cc9826c3
> 100644 --- a/board/samsung/odroid/odroid.c
> +++ b/board/samsung/odroid/odroid.c
> @@ -54,6 +54,14 @@ void set_board_type(void)
> gd->board_type = ODROID_TYPE_U3;
> }
>
> +void set_board_revision(void)
> +{
> + /*
> + * Revision already set by set_board_type() because it can be
> + * executed early.
> + */
> +}
> +
> const char *get_board_type(void)
> {
> const char *board_type[] = {"u3", "x2"};
> diff --git a/include/samsung/misc.h b/include/samsung/misc.h
> index 017560c25662..4ff28a1df0e8 100644
> --- a/include/samsung/misc.h
> +++ b/include/samsung/misc.h
> @@ -33,6 +33,7 @@ char *get_dfu_alt_system(char *interface, char
> *devstr); char *get_dfu_alt_boot(char *interface, char *devstr);
> #endif
> void set_board_type(void);
> +void set_board_revision(void);
> const char *get_board_type(void);
>
> #endif /* __SAMSUNG_MISC_COMMON_H__ */
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190217/f71435e4/attachment.sig>
next prev parent reply other threads:[~2019-02-17 22:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-16 9:45 [U-Boot] [PATCH v3 0/9] arm: exynos: Fix reboot on Odroid HC1 Krzysztof Kozlowski
2019-02-16 9:45 ` [U-Boot] [PATCH v3 1/9] adc: exynos-adc: Fix wrong bit operation used to stop the ADC Krzysztof Kozlowski
2019-02-16 9:45 ` [U-Boot] [PATCH v3 2/9] power: regulator: s2mps11: Fix step for LDO27 and LDO35 Krzysztof Kozlowski
2019-02-16 9:45 ` [U-Boot] [PATCH v3 3/9] arm: exynos: Detect revision later, when all resources are ready Krzysztof Kozlowski
2019-02-17 22:34 ` Lukasz Majewski [this message]
2019-02-16 9:45 ` [U-Boot] [PATCH v3 4/9] arm: exynos: odroid-xu3: Display info late to have proper type Krzysztof Kozlowski
2019-02-16 9:45 ` [U-Boot] [PATCH v3 5/9] arm: exynos: Wait till ADC stabilizes before checking Odroid HC1 revision Krzysztof Kozlowski
2019-02-16 9:45 ` [U-Boot] [PATCH v3 6/9] regulator: Add support for ramp delay Krzysztof Kozlowski
2019-02-18 14:03 ` Torsten Duwe
2019-02-18 14:28 ` Krzysztof Kozlowski
2019-02-18 15:26 ` Torsten Duwe
2019-02-19 12:14 ` Krzysztof Kozlowski
2019-02-16 9:45 ` [U-Boot] [PATCH v3 7/9] power: regulator: s2mps11: Add enable delay Krzysztof Kozlowski
2019-02-16 9:45 ` [U-Boot] [PATCH v3 8/9] arm: dts: exynos: Add supply for ADC block to Odroid XU3 family Krzysztof Kozlowski
2019-02-16 9:45 ` [U-Boot] [PATCH v3 9/9] arm: dts: exynos: Add ramp delay property to LDO regulators " Krzysztof Kozlowski
2019-02-24 12:55 ` [U-Boot] [PATCH v3 0/9] arm: exynos: Fix reboot on Odroid HC1 Anand Moon
2019-03-05 10:16 ` Minkyu Kang
2019-03-05 19:54 ` Krzysztof Kozlowski
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=20190217233413.5b244c99@jawa \
--to=lukma@denx.de \
--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