All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init for QSPI-NOR
@ 2017-12-14 12:07 Ashish Kumar
  2017-12-14 12:07 ` [U-Boot] [PATCH v2 2/2] armv8: ls1088ardb: Add environment variable address location " Ashish Kumar
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ashish Kumar @ 2017-12-14 12:07 UTC (permalink / raw)
  To: u-boot

ENV variables can now be used before relocation.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
---
v2:
replace & with && in #if

Tested on ls1088ardb.
Tested on ls1012hexa after defining CONFIG_ENV_ADDR

 env/sf.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/env/sf.c b/env/sf.c
index e51b1ae..a2e4c93 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -34,6 +34,7 @@
 
 #ifndef CONFIG_SPL_BUILD
 #define CMD_SAVEENV
+#define INITENV
 #endif
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
@@ -348,6 +349,23 @@ out:
 }
 #endif
 
+#if defined(INITENV) && defined(CONFIG_ENV_ADDR)
+static int env_sf_init(void)
+{
+	env_t *env_ptr = (env_t *)(CONFIG_ENV_ADDR);
+
+	if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
+		gd->env_addr	= (ulong)&(env_ptr->data);
+		gd->env_valid	= 1;
+	} else {
+		gd->env_addr = (ulong)&default_environment[0];
+		gd->env_valid = 1;
+	}
+
+	return 0;
+}
+#endif
+
 U_BOOT_ENV_LOCATION(sf) = {
 	.location	= ENVL_SPI_FLASH,
 	ENV_NAME("SPI Flash")
@@ -355,4 +373,7 @@ U_BOOT_ENV_LOCATION(sf) = {
 #ifdef CMD_SAVEENV
 	.save		= env_save_ptr(env_sf_save),
 #endif
+#if defined(INITENV) && defined(CONFIG_ENV_ADDR)
+	.init		= env_sf_init,
+#endif
 };
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2 2/2] armv8: ls1088ardb: Add environment variable address location for QSPI-NOR
  2017-12-14 12:07 [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init for QSPI-NOR Ashish Kumar
@ 2017-12-14 12:07 ` Ashish Kumar
  2018-01-15 18:05   ` York Sun
  2018-01-19  0:58   ` York Sun
  2018-01-08 18:23 ` [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init " York Sun
  2018-01-19  0:57 ` York Sun
  2 siblings, 2 replies; 8+ messages in thread
From: Ashish Kumar @ 2017-12-14 12:07 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
---
 include/configs/ls1088a_common.h | 6 ++++++
 include/configs/ls1088aqds.h     | 1 -
 include/configs/ls1088ardb.h     | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h
index b99257e..c96d48d 100644
--- a/include/configs/ls1088a_common.h
+++ b/include/configs/ls1088a_common.h
@@ -32,6 +32,12 @@
 
 #define CONFIG_SUPPORT_RAW_INITRD
 
+#ifdef CONFIG_QSPI_BOOT
+#define CONFIG_SYS_FSL_QSPI_BASE	0x20000000
+#define CONFIG_ENV_OFFSET		0x300000        /* 3MB */
+#define CONFIG_ENV_ADDR			(CONFIG_SYS_FSL_QSPI_BASE + \
+						CONFIG_ENV_OFFSET)
+#endif
 
 #define CONFIG_SKIP_LOWLEVEL_INIT
 
diff --git a/include/configs/ls1088aqds.h b/include/configs/ls1088aqds.h
index e97091d..6b94667 100644
--- a/include/configs/ls1088aqds.h
+++ b/include/configs/ls1088aqds.h
@@ -21,7 +21,6 @@ unsigned long get_board_ddr_clk(void);
 
 #if defined(CONFIG_QSPI_BOOT)
 #define CONFIG_ENV_SIZE			0x2000          /* 8KB */
-#define CONFIG_ENV_OFFSET		0x300000        /* 3MB */
 #define CONFIG_ENV_SECT_SIZE		0x40000
 #elif defined(CONFIG_SD_BOOT)
 #define CONFIG_ENV_OFFSET		(3 * 1024 * 1024)
diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h
index 1da8153..bffaa76 100644
--- a/include/configs/ls1088ardb.h
+++ b/include/configs/ls1088ardb.h
@@ -12,8 +12,8 @@
 #define CONFIG_DISPLAY_BOARDINFO_LATE
 
 #if defined(CONFIG_QSPI_BOOT)
+#define CONFIG_SYS_FSL_QSPI_BASE	0x20000000
 #define CONFIG_ENV_SIZE			0x2000          /* 8KB */
-#define CONFIG_ENV_OFFSET		0x300000        /* 3MB */
 #define CONFIG_ENV_SECT_SIZE		0x40000
 #elif defined(CONFIG_SD_BOOT)
 #define CONFIG_ENV_OFFSET		(3 * 1024 * 1024)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init for QSPI-NOR
  2017-12-14 12:07 [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init for QSPI-NOR Ashish Kumar
  2017-12-14 12:07 ` [U-Boot] [PATCH v2 2/2] armv8: ls1088ardb: Add environment variable address location " Ashish Kumar
@ 2018-01-08 18:23 ` York Sun
  2018-01-11  9:32   ` Ashish Kumar
  2018-01-19  0:57 ` York Sun
  2 siblings, 1 reply; 8+ messages in thread
From: York Sun @ 2018-01-08 18:23 UTC (permalink / raw)
  To: u-boot

On 12/14/2017 04:06 AM, Ashish Kumar wrote:
> ENV variables can now be used before relocation.
> 
> Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
> ---
> v2:
> replace & with && in #if
> 
> Tested on ls1088ardb.
> Tested on ls1012hexa after defining CONFIG_ENV_ADDR
> 
>  env/sf.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/env/sf.c b/env/sf.c
> index e51b1ae..a2e4c93 100644
> --- a/env/sf.c
> +++ b/env/sf.c
> @@ -34,6 +34,7 @@
>  
>  #ifndef CONFIG_SPL_BUILD
>  #define CMD_SAVEENV
> +#define INITENV
>  #endif
>  
>  #ifdef CONFIG_ENV_OFFSET_REDUND
> @@ -348,6 +349,23 @@ out:
>  }
>  #endif
>  
> +#if defined(INITENV) && defined(CONFIG_ENV_ADDR)
> +static int env_sf_init(void)
> +{
> +	env_t *env_ptr = (env_t *)(CONFIG_ENV_ADDR);
> +
> +	if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
> +		gd->env_addr	= (ulong)&(env_ptr->data);
> +		gd->env_valid	= 1;
> +	} else {
> +		gd->env_addr = (ulong)&default_environment[0];
> +		gd->env_valid = 1;
> +	}
> +
> +	return 0;
> +}
> +#endif
> +
>  U_BOOT_ENV_LOCATION(sf) = {
>  	.location	= ENVL_SPI_FLASH,
>  	ENV_NAME("SPI Flash")
> @@ -355,4 +373,7 @@ U_BOOT_ENV_LOCATION(sf) = {
>  #ifdef CMD_SAVEENV
>  	.save		= env_save_ptr(env_sf_save),
>  #endif
> +#if defined(INITENV) && defined(CONFIG_ENV_ADDR)
> +	.init		= env_sf_init,
> +#endif
>  };
> 

Please run get_maintainer.pl to get the CC list if you don't use patman.

I wonder how SPI worked before. Did it work, Simon and Jagan?

York

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init for QSPI-NOR
  2018-01-08 18:23 ` [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init " York Sun
@ 2018-01-11  9:32   ` Ashish Kumar
  0 siblings, 0 replies; 8+ messages in thread
From: Ashish Kumar @ 2018-01-11  9:32 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: York Sun
> Sent: Monday, January 08, 2018 11:53 PM
> To: Ashish Kumar <ashish.kumar@nxp.com>; u-boot at lists.denx.de; Simon
> Glass <sjg@chromium.org>; Jagan Teki <jagan@openedev.com>
> Subject: Re: [PATCH v2 1/2] env: sf: Add support for env init for QSPI-NOR
> 
> On 12/14/2017 04:06 AM, Ashish Kumar wrote:
> > ENV variables can now be used before relocation.
> >
> > Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
> > ---
> > v2:
> > replace & with && in #if
> >
> > Tested on ls1088ardb.
> > Tested on ls1012hexa after defining CONFIG_ENV_ADDR
> >
> >  env/sf.c | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> >
> > diff --git a/env/sf.c b/env/sf.c
> > index e51b1ae..a2e4c93 100644
> > --- a/env/sf.c
> > +++ b/env/sf.c
> > @@ -34,6 +34,7 @@
> >
> >  #ifndef CONFIG_SPL_BUILD
> >  #define CMD_SAVEENV
> > +#define INITENV
> >  #endif
> >
> >  #ifdef CONFIG_ENV_OFFSET_REDUND
> > @@ -348,6 +349,23 @@ out:
> >  }
> >  #endif
> >
> > +#if defined(INITENV) && defined(CONFIG_ENV_ADDR) static int
> > +env_sf_init(void) {
> > +	env_t *env_ptr = (env_t *)(CONFIG_ENV_ADDR);
> > +
> > +	if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
> > +		gd->env_addr	= (ulong)&(env_ptr->data);
> > +		gd->env_valid	= 1;
> > +	} else {
> > +		gd->env_addr = (ulong)&default_environment[0];
> > +		gd->env_valid = 1;
> > +	}
> > +
> > +	return 0;
> > +}
> > +#endif
> > +
> >  U_BOOT_ENV_LOCATION(sf) = {
> >  	.location	= ENVL_SPI_FLASH,
> >  	ENV_NAME("SPI Flash")
> > @@ -355,4 +373,7 @@ U_BOOT_ENV_LOCATION(sf) = {  #ifdef
> CMD_SAVEENV
> >  	.save		= env_save_ptr(env_sf_save),
> >  #endif
> > +#if defined(INITENV) && defined(CONFIG_ENV_ADDR)
> > +	.init		= env_sf_init,
> > +#endif
> >  };
> >
> 
> Please run get_maintainer.pl to get the CC list if you don't use patman.
> 
> I wonder how SPI worked before. Did it work, Simon and Jagan?

SPI is working, this patch adds support to init environment such that it can be used before u-boot relocation similar to that of IFC-NOR.

Regards
Ashish
> 
> York

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2 2/2] armv8: ls1088ardb: Add environment variable address location for QSPI-NOR
  2017-12-14 12:07 ` [U-Boot] [PATCH v2 2/2] armv8: ls1088ardb: Add environment variable address location " Ashish Kumar
@ 2018-01-15 18:05   ` York Sun
  2018-01-16  6:41     ` Ashish Kumar
  2018-01-19  0:58   ` York Sun
  1 sibling, 1 reply; 8+ messages in thread
From: York Sun @ 2018-01-15 18:05 UTC (permalink / raw)
  To: u-boot

On 12/14/2017 04:06 AM, Ashish Kumar wrote:
> Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
> ---
>  include/configs/ls1088a_common.h | 6 ++++++
>  include/configs/ls1088aqds.h     | 1 -
>  include/configs/ls1088ardb.h     | 2 +-
>  3 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h
> index b99257e..c96d48d 100644
> --- a/include/configs/ls1088a_common.h
> +++ b/include/configs/ls1088a_common.h
> @@ -32,6 +32,12 @@
>  
>  #define CONFIG_SUPPORT_RAW_INITRD
>  
> +#ifdef CONFIG_QSPI_BOOT
> +#define CONFIG_SYS_FSL_QSPI_BASE	0x20000000
> +#define CONFIG_ENV_OFFSET		0x300000        /* 3MB */
> +#define CONFIG_ENV_ADDR			(CONFIG_SYS_FSL_QSPI_BASE + \
> +						CONFIG_ENV_OFFSET)
> +#endif
>  
>  #define CONFIG_SKIP_LOWLEVEL_INIT
>  
> diff --git a/include/configs/ls1088aqds.h b/include/configs/ls1088aqds.h
> index e97091d..6b94667 100644
> --- a/include/configs/ls1088aqds.h
> +++ b/include/configs/ls1088aqds.h
> @@ -21,7 +21,6 @@ unsigned long get_board_ddr_clk(void);
>  
>  #if defined(CONFIG_QSPI_BOOT)
>  #define CONFIG_ENV_SIZE			0x2000          /* 8KB */
> -#define CONFIG_ENV_OFFSET		0x300000        /* 3MB */
>  #define CONFIG_ENV_SECT_SIZE		0x40000
>  #elif defined(CONFIG_SD_BOOT)
>  #define CONFIG_ENV_OFFSET		(3 * 1024 * 1024)
> diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h
> index 1da8153..bffaa76 100644
> --- a/include/configs/ls1088ardb.h
> +++ b/include/configs/ls1088ardb.h
> @@ -12,8 +12,8 @@
>  #define CONFIG_DISPLAY_BOARDINFO_LATE
>  
>  #if defined(CONFIG_QSPI_BOOT)
> +#define CONFIG_SYS_FSL_QSPI_BASE	0x20000000

Looks like you are redefining this macro. Will remove when I merge it.

York

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2 2/2] armv8: ls1088ardb: Add environment variable address location for QSPI-NOR
  2018-01-15 18:05   ` York Sun
@ 2018-01-16  6:41     ` Ashish Kumar
  0 siblings, 0 replies; 8+ messages in thread
From: Ashish Kumar @ 2018-01-16  6:41 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: York Sun
> Sent: Monday, January 15, 2018 11:36 PM
> To: Ashish Kumar <ashish.kumar@nxp.com>; u-boot at lists.denx.de
> Subject: Re: [PATCH v2 2/2] armv8: ls1088ardb: Add environment variable
> address location for QSPI-NOR
> 
> On 12/14/2017 04:06 AM, Ashish Kumar wrote:
> > Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
> > ---
> >  include/configs/ls1088a_common.h | 6 ++++++
> >  include/configs/ls1088aqds.h     | 1 -
> >  include/configs/ls1088ardb.h     | 2 +-
> >  3 files changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/configs/ls1088a_common.h
> > b/include/configs/ls1088a_common.h
> > index b99257e..c96d48d 100644
> > --- a/include/configs/ls1088a_common.h
> > +++ b/include/configs/ls1088a_common.h
> > @@ -32,6 +32,12 @@
> >
> >  #define CONFIG_SUPPORT_RAW_INITRD
> >
> > +#ifdef CONFIG_QSPI_BOOT
> > +#define CONFIG_SYS_FSL_QSPI_BASE	0x20000000
> > +#define CONFIG_ENV_OFFSET		0x300000        /* 3MB */
> > +#define CONFIG_ENV_ADDR			(CONFIG_SYS_FSL_QSPI_BASE
> + \
> > +						CONFIG_ENV_OFFSET)
> > +#endif
> >
> >  #define CONFIG_SKIP_LOWLEVEL_INIT
> >
> > diff --git a/include/configs/ls1088aqds.h
> > b/include/configs/ls1088aqds.h index e97091d..6b94667 100644
> > --- a/include/configs/ls1088aqds.h
> > +++ b/include/configs/ls1088aqds.h
> > @@ -21,7 +21,6 @@ unsigned long get_board_ddr_clk(void);
> >
> >  #if defined(CONFIG_QSPI_BOOT)
> >  #define CONFIG_ENV_SIZE			0x2000          /* 8KB */
> > -#define CONFIG_ENV_OFFSET		0x300000        /* 3MB */
> >  #define CONFIG_ENV_SECT_SIZE		0x40000
> >  #elif defined(CONFIG_SD_BOOT)
> >  #define CONFIG_ENV_OFFSET		(3 * 1024 * 1024)
> > diff --git a/include/configs/ls1088ardb.h
> > b/include/configs/ls1088ardb.h index 1da8153..bffaa76 100644
> > --- a/include/configs/ls1088ardb.h
> > +++ b/include/configs/ls1088ardb.h
> > @@ -12,8 +12,8 @@
> >  #define CONFIG_DISPLAY_BOARDINFO_LATE
> >
> >  #if defined(CONFIG_QSPI_BOOT)
> > +#define CONFIG_SYS_FSL_QSPI_BASE	0x20000000
> 
> Looks like you are redefining this macro. Will remove when I merge it.
Yes. Thanks York.
> 
> York

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init for QSPI-NOR
  2017-12-14 12:07 [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init for QSPI-NOR Ashish Kumar
  2017-12-14 12:07 ` [U-Boot] [PATCH v2 2/2] armv8: ls1088ardb: Add environment variable address location " Ashish Kumar
  2018-01-08 18:23 ` [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init " York Sun
@ 2018-01-19  0:57 ` York Sun
  2 siblings, 0 replies; 8+ messages in thread
From: York Sun @ 2018-01-19  0:57 UTC (permalink / raw)
  To: u-boot

On 12/14/2017 04:06 AM, Ashish Kumar wrote:
> ENV variables can now be used before relocation.
> 
> Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
> ---
> v2:
> replace & with && in #if
> 
> Tested on ls1088ardb.
> Tested on ls1012hexa after defining CONFIG_ENV_ADDR
> 

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2 2/2] armv8: ls1088ardb: Add environment variable address location for QSPI-NOR
  2017-12-14 12:07 ` [U-Boot] [PATCH v2 2/2] armv8: ls1088ardb: Add environment variable address location " Ashish Kumar
  2018-01-15 18:05   ` York Sun
@ 2018-01-19  0:58   ` York Sun
  1 sibling, 0 replies; 8+ messages in thread
From: York Sun @ 2018-01-19  0:58 UTC (permalink / raw)
  To: u-boot

On 12/14/2017 04:06 AM, Ashish Kumar wrote:
> Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
> ---

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-19  0:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-14 12:07 [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init for QSPI-NOR Ashish Kumar
2017-12-14 12:07 ` [U-Boot] [PATCH v2 2/2] armv8: ls1088ardb: Add environment variable address location " Ashish Kumar
2018-01-15 18:05   ` York Sun
2018-01-16  6:41     ` Ashish Kumar
2018-01-19  0:58   ` York Sun
2018-01-08 18:23 ` [U-Boot] [PATCH v2 1/2] env: sf: Add support for env init " York Sun
2018-01-11  9:32   ` Ashish Kumar
2018-01-19  0:57 ` York Sun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.