diff mbox series

[U-Boot,v2,7/8] arm: socfpga: gen5: deassert peripheral reset by default

Message ID 20190221214332.4246-8-simon.k.r.goldschmidt@gmail.com
State Superseded
Delegated to: Marek Vasut
Headers show
Series arm: socfpga: implement proper peripheral reset handling | expand

Commit Message

Simon Goldschmidt Feb. 21, 2019, 9:43 p.m. UTC
To keep the current behaviour of taking all peripherals out of reset
before booting the OS before removing that code from socfpga gen5 SPL,
this enables the new behaviour by default for all gen5 boards by adding
the environment variable "socfpga_permodrst_ungate=1" to the default
environment.

This can be overridden in board config files or by saving an environment
without this variable enabled.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---

Changes in v2:
- this patch is new in v2

 include/configs/socfpga_common.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Marek Vasut Feb. 21, 2019, 9:53 p.m. UTC | #1
On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
> To keep the current behaviour of taking all peripherals out of reset
> before booting the OS before removing that code from socfpga gen5 SPL,
> this enables the new behaviour by default for all gen5 boards by adding
> the environment variable "socfpga_permodrst_ungate=1" to the default
> environment.
> 
> This can be overridden in board config files or by saving an environment
> without this variable enabled.
> 
> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> ---
> 
> Changes in v2:
> - this patch is new in v2
> 
>  include/configs/socfpga_common.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> index c9cbf8f5e3..2510c6fd7b 100644
> --- a/include/configs/socfpga_common.h
> +++ b/include/configs/socfpga_common.h
> @@ -321,6 +321,19 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>  
>  #include <config_distro_bootcmd.h>
>  
> +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
> +/*
> + * Handle compatibility for peripheral reset for Linux kernels that haven't
> + * implemented peripheral reset for all drivers.
> + * Define this to "" disable this compatibility.
> + */
> +#ifndef SOCFPGA_PERMODRST_UNGATE
> +#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0"
> +#endif
> +#else
> +#define SOCFPGA_PERMODRST_UNGATE ""
> +#endif

Just add this socfpga_permodrst_ungate to the default end and drop all
those macros/Kconfig options.

I think it'd be better to call it socfpga_legacy_reset_compat or something.

>  #ifndef CONFIG_EXTRA_ENV_SETTINGS
>  #define CONFIG_EXTRA_ENV_SETTINGS \
>  	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
> @@ -330,6 +343,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>  	"scriptaddr=0x02100000\0" \
>  	"pxefile_addr_r=0x02200000\0" \
>  	"ramdisk_addr_r=0x02300000\0" \
> +	SOCFPGA_PERMODRST_UNGATE \
>  	BOOTENV
>  
>  #endif
>
Simon Goldschmidt Feb. 21, 2019, 10:09 p.m. UTC | #2
Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <marex@denx.de> geschrieben:

> On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
> > To keep the current behaviour of taking all peripherals out of reset
> > before booting the OS before removing that code from socfpga gen5 SPL,
> > this enables the new behaviour by default for all gen5 boards by adding
> > the environment variable "socfpga_permodrst_ungate=1" to the default
> > environment.
> >
> > This can be overridden in board config files or by saving an environment
> > without this variable enabled.
> >
> > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> > ---
> >
> > Changes in v2:
> > - this patch is new in v2
> >
> >  include/configs/socfpga_common.h | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/include/configs/socfpga_common.h
> b/include/configs/socfpga_common.h
> > index c9cbf8f5e3..2510c6fd7b 100644
> > --- a/include/configs/socfpga_common.h
> > +++ b/include/configs/socfpga_common.h
> > @@ -321,6 +321,19 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> >
> >  #include <config_distro_bootcmd.h>
> >
> > +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
> > +/*
> > + * Handle compatibility for peripheral reset for Linux kernels that
> haven't
> > + * implemented peripheral reset for all drivers.
> > + * Define this to "" disable this compatibility.
> > + */
> > +#ifndef SOCFPGA_PERMODRST_UNGATE
> > +#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0"
> > +#endif
> > +#else
> > +#define SOCFPGA_PERMODRST_UNGATE ""
> > +#endif
>
> Just add this socfpga_permodrst_ungate to the default end and drop all
> those macros/Kconfig options.
>

But how would it then be overridden?

I think it'd be better to call it socfpga_legacy_reset_compat or something.
>

Ok.

Regards,
Simon


> >  #ifndef CONFIG_EXTRA_ENV_SETTINGS
> >  #define CONFIG_EXTRA_ENV_SETTINGS \
> >       "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
> > @@ -330,6 +343,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> >       "scriptaddr=0x02100000\0" \
> >       "pxefile_addr_r=0x02200000\0" \
> >       "ramdisk_addr_r=0x02300000\0" \
> > +     SOCFPGA_PERMODRST_UNGATE \
> >       BOOTENV
> >
> >  #endif
> >
>
>
Marek Vasut Feb. 21, 2019, 10:16 p.m. UTC | #3
On 2/21/19 11:09 PM, Simon Goldschmidt wrote:
> 
> 
> Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <marex@denx.de
> <mailto:marex@denx.de>> geschrieben:
> 
>     On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
>     > To keep the current behaviour of taking all peripherals out of reset
>     > before booting the OS before removing that code from socfpga gen5 SPL,
>     > this enables the new behaviour by default for all gen5 boards by
>     adding
>     > the environment variable "socfpga_permodrst_ungate=1" to the default
>     > environment.
>     >
>     > This can be overridden in board config files or by saving an
>     environment
>     > without this variable enabled.
>     >
>     > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com
>     <mailto:simon.k.r.goldschmidt@gmail.com>>
>     > ---
>     >
>     > Changes in v2:
>     > - this patch is new in v2
>     >
>     >  include/configs/socfpga_common.h | 14 ++++++++++++++
>     >  1 file changed, 14 insertions(+)
>     >
>     > diff --git a/include/configs/socfpga_common.h
>     b/include/configs/socfpga_common.h
>     > index c9cbf8f5e3..2510c6fd7b 100644
>     > --- a/include/configs/socfpga_common.h
>     > +++ b/include/configs/socfpga_common.h
>     > @@ -321,6 +321,19 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>     > 
>     >  #include <config_distro_bootcmd.h>
>     > 
>     > +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
>     > +/*
>     > + * Handle compatibility for peripheral reset for Linux kernels
>     that haven't
>     > + * implemented peripheral reset for all drivers.
>     > + * Define this to "" disable this compatibility.
>     > + */
>     > +#ifndef SOCFPGA_PERMODRST_UNGATE
>     > +#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0"
>     > +#endif
>     > +#else
>     > +#define SOCFPGA_PERMODRST_UNGATE ""
>     > +#endif
> 
>     Just add this socfpga_permodrst_ungate to the default end and drop all
>     those macros/Kconfig options.
> 
> 
> But how would it then be overridden?

User would setenv it to "" and saveenv ? I might be missing something
obvious.
Simon Goldschmidt Feb. 22, 2019, 5:55 a.m. UTC | #4
On Thu, Feb 21, 2019 at 11:17 PM Marek Vasut <marex@denx.de> wrote:
>
> On 2/21/19 11:09 PM, Simon Goldschmidt wrote:
> >
> >
> > Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <marex@denx.de
> > <mailto:marex@denx.de>> geschrieben:
> >
> >     On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
> >     > To keep the current behaviour of taking all peripherals out of reset
> >     > before booting the OS before removing that code from socfpga gen5 SPL,
> >     > this enables the new behaviour by default for all gen5 boards by
> >     adding
> >     > the environment variable "socfpga_permodrst_ungate=1" to the default
> >     > environment.
> >     >
> >     > This can be overridden in board config files or by saving an
> >     environment
> >     > without this variable enabled.
> >     >
> >     > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com
> >     <mailto:simon.k.r.goldschmidt@gmail.com>>
> >     > ---
> >     >
> >     > Changes in v2:
> >     > - this patch is new in v2
> >     >
> >     >  include/configs/socfpga_common.h | 14 ++++++++++++++
> >     >  1 file changed, 14 insertions(+)
> >     >
> >     > diff --git a/include/configs/socfpga_common.h
> >     b/include/configs/socfpga_common.h
> >     > index c9cbf8f5e3..2510c6fd7b 100644
> >     > --- a/include/configs/socfpga_common.h
> >     > +++ b/include/configs/socfpga_common.h
> >     > @@ -321,6 +321,19 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> >     >
> >     >  #include <config_distro_bootcmd.h>
> >     >
> >     > +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
> >     > +/*
> >     > + * Handle compatibility for peripheral reset for Linux kernels
> >     that haven't
> >     > + * implemented peripheral reset for all drivers.
> >     > + * Define this to "" disable this compatibility.
> >     > + */
> >     > +#ifndef SOCFPGA_PERMODRST_UNGATE
> >     > +#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0"
> >     > +#endif
> >     > +#else
> >     > +#define SOCFPGA_PERMODRST_UNGATE ""
> >     > +#endif
> >
> >     Just add this socfpga_permodrst_ungate to the default end and drop all
> >     those macros/Kconfig options.
> >
> >
> > But how would it then be overridden?
>
> User would setenv it to "" and saveenv ? I might be missing something
> obvious.

Of course. I meant how to override it for the default env. E.g. to test on
some boards.

But it's probably enough that CONFIG_EXTRA_ENV_SETTINGS is overridable.

Regards,
Simon
Marek Vasut Feb. 22, 2019, 4:08 p.m. UTC | #5
On 2/22/19 6:55 AM, Simon Goldschmidt wrote:
> On Thu, Feb 21, 2019 at 11:17 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 2/21/19 11:09 PM, Simon Goldschmidt wrote:
>>>
>>>
>>> Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <marex@denx.de
>>> <mailto:marex@denx.de>> geschrieben:
>>>
>>>     On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
>>>     > To keep the current behaviour of taking all peripherals out of reset
>>>     > before booting the OS before removing that code from socfpga gen5 SPL,
>>>     > this enables the new behaviour by default for all gen5 boards by
>>>     adding
>>>     > the environment variable "socfpga_permodrst_ungate=1" to the default
>>>     > environment.
>>>     >
>>>     > This can be overridden in board config files or by saving an
>>>     environment
>>>     > without this variable enabled.
>>>     >
>>>     > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com
>>>     <mailto:simon.k.r.goldschmidt@gmail.com>>
>>>     > ---
>>>     >
>>>     > Changes in v2:
>>>     > - this patch is new in v2
>>>     >
>>>     >  include/configs/socfpga_common.h | 14 ++++++++++++++
>>>     >  1 file changed, 14 insertions(+)
>>>     >
>>>     > diff --git a/include/configs/socfpga_common.h
>>>     b/include/configs/socfpga_common.h
>>>     > index c9cbf8f5e3..2510c6fd7b 100644
>>>     > --- a/include/configs/socfpga_common.h
>>>     > +++ b/include/configs/socfpga_common.h
>>>     > @@ -321,6 +321,19 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>>>     >
>>>     >  #include <config_distro_bootcmd.h>
>>>     >
>>>     > +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
>>>     > +/*
>>>     > + * Handle compatibility for peripheral reset for Linux kernels
>>>     that haven't
>>>     > + * implemented peripheral reset for all drivers.
>>>     > + * Define this to "" disable this compatibility.
>>>     > + */
>>>     > +#ifndef SOCFPGA_PERMODRST_UNGATE
>>>     > +#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0"
>>>     > +#endif
>>>     > +#else
>>>     > +#define SOCFPGA_PERMODRST_UNGATE ""
>>>     > +#endif
>>>
>>>     Just add this socfpga_permodrst_ungate to the default end and drop all
>>>     those macros/Kconfig options.
>>>
>>>
>>> But how would it then be overridden?
>>
>> User would setenv it to "" and saveenv ? I might be missing something
>> obvious.
> 
> Of course. I meant how to override it for the default env. E.g. to test on
> some boards.
> 
> But it's probably enough that CONFIG_EXTRA_ENV_SETTINGS is overridable.

I think so ... or ?
diff mbox series

Patch

diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index c9cbf8f5e3..2510c6fd7b 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -321,6 +321,19 @@  unsigned int cm_get_qspi_controller_clk_hz(void);
 
 #include <config_distro_bootcmd.h>
 
+#ifdef CONFIG_TARGET_SOCFPGA_GEN5
+/*
+ * Handle compatibility for peripheral reset for Linux kernels that haven't
+ * implemented peripheral reset for all drivers.
+ * Define this to "" disable this compatibility.
+ */
+#ifndef SOCFPGA_PERMODRST_UNGATE
+#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0"
+#endif
+#else
+#define SOCFPGA_PERMODRST_UNGATE ""
+#endif
+
 #ifndef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
@@ -330,6 +343,7 @@  unsigned int cm_get_qspi_controller_clk_hz(void);
 	"scriptaddr=0x02100000\0" \
 	"pxefile_addr_r=0x02200000\0" \
 	"ramdisk_addr_r=0x02300000\0" \
+	SOCFPGA_PERMODRST_UNGATE \
 	BOOTENV
 
 #endif