* [U-Boot] [PATCH] SPL: Add spl_early_board_init() generic function
@ 2017-01-15 22:46 Lukasz Majewski
2017-01-15 23:03 ` Marek Vasut
0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Majewski @ 2017-01-15 22:46 UTC (permalink / raw)
To: u-boot
Some boards do require early adjustments (due to e.g. HW fix) in SPL code.
In this particular case such operations must be performed just before ANY
external IC is accessed (good example here is the I2C early bus access).
Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
common/spl/Kconfig | 8 ++++++++
common/spl/spl.c | 6 ++++++
include/spl.h | 4 ++++
3 files changed, 18 insertions(+)
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index bb99f1f..7e6f9c4 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -185,6 +185,14 @@ config SPL_SAVEENV
"reboot_image" and act accordingly and change the reboot_image
to default mode using setenv and save the environemnt.
+config SPL_EARLY_BOARD_INIT
+ bool "Support early board init code"
+ depends on SPL
+ help
+ Enable support for very early SPL board code adjustments.
+ Some boards require having adjustements done before any
+ peripherals being operational (e.g. I2C, SPI, UART).
+
config SPL_ETH_SUPPORT
bool "Support Ethernet"
depends on SPL_ENV_SUPPORT
diff --git a/common/spl/spl.c b/common/spl/spl.c
index bdb165a..a15647b 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -393,6 +393,12 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
struct spl_image_info spl_image;
int i;
+#ifdef CONFIG_SPL_EARLY_BOARD_INIT
+ debug(">>spl:early_board_init()\n");
+
+ spl_early_board_init();
+#endif
+
debug(">>spl:board_init_r()\n");
#if defined(CONFIG_SYS_SPL_MALLOC_START)
diff --git a/include/spl.h b/include/spl.h
index e080a82..00a2058 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -215,6 +215,10 @@ int spl_init(void);
void spl_board_init(void);
#endif
+#ifdef CONFIG_SPL_EARLY_BOARD_INIT
+void spl_early_board_init(void);
+#endif
+
/**
* spl_was_boot_source() - check if U-Boot booted from SPL
*
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] SPL: Add spl_early_board_init() generic function
2017-01-15 22:46 [U-Boot] [PATCH] SPL: Add spl_early_board_init() generic function Lukasz Majewski
@ 2017-01-15 23:03 ` Marek Vasut
2017-01-16 1:19 ` Lukasz Majewski
0 siblings, 1 reply; 3+ messages in thread
From: Marek Vasut @ 2017-01-15 23:03 UTC (permalink / raw)
To: u-boot
On 01/15/2017 11:46 PM, Lukasz Majewski wrote:
> Some boards do require early adjustments (due to e.g. HW fix) in SPL code.
> In this particular case such operations must be performed just before ANY
> external IC is accessed (good example here is the I2C early bus access).
Shouldn't such stuff be done in board_init_f or so then ?
board_init_r is pretty late ...
btw I'm not a big fan of adding more and more callbacks, what is the
usecase here ?
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> ---
> common/spl/Kconfig | 8 ++++++++
> common/spl/spl.c | 6 ++++++
> include/spl.h | 4 ++++
> 3 files changed, 18 insertions(+)
>
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index bb99f1f..7e6f9c4 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -185,6 +185,14 @@ config SPL_SAVEENV
> "reboot_image" and act accordingly and change the reboot_image
> to default mode using setenv and save the environemnt.
>
> +config SPL_EARLY_BOARD_INIT
> + bool "Support early board init code"
> + depends on SPL
> + help
> + Enable support for very early SPL board code adjustments.
> + Some boards require having adjustements done before any
> + peripherals being operational (e.g. I2C, SPI, UART).
> +
> config SPL_ETH_SUPPORT
> bool "Support Ethernet"
> depends on SPL_ENV_SUPPORT
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index bdb165a..a15647b 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -393,6 +393,12 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> struct spl_image_info spl_image;
> int i;
>
> +#ifdef CONFIG_SPL_EARLY_BOARD_INIT
> + debug(">>spl:early_board_init()\n");
> +
> + spl_early_board_init();
> +#endif
> +
> debug(">>spl:board_init_r()\n");
>
> #if defined(CONFIG_SYS_SPL_MALLOC_START)
> diff --git a/include/spl.h b/include/spl.h
> index e080a82..00a2058 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -215,6 +215,10 @@ int spl_init(void);
> void spl_board_init(void);
> #endif
>
> +#ifdef CONFIG_SPL_EARLY_BOARD_INIT
> +void spl_early_board_init(void);
> +#endif
> +
> /**
> * spl_was_boot_source() - check if U-Boot booted from SPL
> *
>
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] SPL: Add spl_early_board_init() generic function
2017-01-15 23:03 ` Marek Vasut
@ 2017-01-16 1:19 ` Lukasz Majewski
0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Majewski @ 2017-01-16 1:19 UTC (permalink / raw)
To: u-boot
Dear All,
> On 01/15/2017 11:46 PM, Lukasz Majewski wrote:
> > Some boards do require early adjustments (due to e.g. HW fix) in
> > SPL code. In this particular case such operations must be performed
> > just before ANY external IC is accessed (good example here is the
> > I2C early bus access).
>
> Shouldn't such stuff be done in board_init_f or so then ?
> board_init_r is pretty late ...
>
> btw I'm not a big fan of adding more and more callbacks, what is the
> usecase here ?
We had some discussion with Marek and we have found better (and more
important already existing) place for this code.
Please regard this patch as not needed and hence dropped.
>
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > ---
> > common/spl/Kconfig | 8 ++++++++
> > common/spl/spl.c | 6 ++++++
> > include/spl.h | 4 ++++
> > 3 files changed, 18 insertions(+)
> >
> > diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> > index bb99f1f..7e6f9c4 100644
> > --- a/common/spl/Kconfig
> > +++ b/common/spl/Kconfig
> > @@ -185,6 +185,14 @@ config SPL_SAVEENV
> > "reboot_image" and act accordingly and change the
> > reboot_image to default mode using setenv and save the environemnt.
> >
> > +config SPL_EARLY_BOARD_INIT
> > + bool "Support early board init code"
> > + depends on SPL
> > + help
> > + Enable support for very early SPL board code adjustments.
> > + Some boards require having adjustements done before any
> > + peripherals being operational (e.g. I2C, SPI, UART).
> > +
> > config SPL_ETH_SUPPORT
> > bool "Support Ethernet"
> > depends on SPL_ENV_SUPPORT
> > diff --git a/common/spl/spl.c b/common/spl/spl.c
> > index bdb165a..a15647b 100644
> > --- a/common/spl/spl.c
> > +++ b/common/spl/spl.c
> > @@ -393,6 +393,12 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> > struct spl_image_info spl_image;
> > int i;
> >
> > +#ifdef CONFIG_SPL_EARLY_BOARD_INIT
> > + debug(">>spl:early_board_init()\n");
> > +
> > + spl_early_board_init();
> > +#endif
> > +
> > debug(">>spl:board_init_r()\n");
> >
> > #if defined(CONFIG_SYS_SPL_MALLOC_START)
> > diff --git a/include/spl.h b/include/spl.h
> > index e080a82..00a2058 100644
> > --- a/include/spl.h
> > +++ b/include/spl.h
> > @@ -215,6 +215,10 @@ int spl_init(void);
> > void spl_board_init(void);
> > #endif
> >
> > +#ifdef CONFIG_SPL_EARLY_BOARD_INIT
> > +void spl_early_board_init(void);
> > +#endif
> > +
> > /**
> > * spl_was_boot_source() - check if U-Boot booted from SPL
> > *
> >
>
>
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-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-16 1:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-15 22:46 [U-Boot] [PATCH] SPL: Add spl_early_board_init() generic function Lukasz Majewski
2017-01-15 23:03 ` Marek Vasut
2017-01-16 1:19 ` Lukasz Majewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox