All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] rk3399: Add boot flash script offet, size
@ 2020-02-03  9:19 ` Jagan Teki
  0 siblings, 0 replies; 6+ messages in thread
From: Jagan Teki @ 2020-02-03  9:19 UTC (permalink / raw)
  To: Kever Yang, Simon Glass, Philipp Tomsich
  Cc: u-boot, linux-amarula, linux-rockchip

Most of the SPI flash devices in rockchip (rk3399)
are 16MiB size. So, let's use the script offset at
the end of 8K. 

This way it cannot overlap any offsets being used
by software components in flash layout.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---
 include/configs/rk3399_common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h
index 89a8a44bbe..01a9174bd2 100644
--- a/include/configs/rk3399_common.h
+++ b/include/configs/rk3399_common.h
@@ -48,6 +48,8 @@
 
 #define ENV_MEM_LAYOUT_SETTINGS \
 	"scriptaddr=0x00500000\0" \
+	"script_offset_f=0xffe000\0" \
+	"script_size_f=0x2000\0" \
 	"pxefile_addr_r=0x00600000\0" \
 	"fdt_addr_r=0x01f00000\0" \
 	"kernel_addr_r=0x02080000\0" \
-- 
2.17.1

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

* [PATCH 1/2] rk3399: Add boot flash script offet, size
@ 2020-02-03  9:19 ` Jagan Teki
  0 siblings, 0 replies; 6+ messages in thread
From: Jagan Teki @ 2020-02-03  9:19 UTC (permalink / raw)
  To: u-boot

Most of the SPI flash devices in rockchip (rk3399)
are 16MiB size. So, let's use the script offset at
the end of 8K. 

This way it cannot overlap any offsets being used
by software components in flash layout.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---
 include/configs/rk3399_common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h
index 89a8a44bbe..01a9174bd2 100644
--- a/include/configs/rk3399_common.h
+++ b/include/configs/rk3399_common.h
@@ -48,6 +48,8 @@
 
 #define ENV_MEM_LAYOUT_SETTINGS \
 	"scriptaddr=0x00500000\0" \
+	"script_offset_f=0xffe000\0" \
+	"script_size_f=0x2000\0" \
 	"pxefile_addr_r=0x00600000\0" \
 	"fdt_addr_r=0x01f00000\0" \
 	"kernel_addr_r=0x02080000\0" \
-- 
2.17.1

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

* [PATCH 2/2] rockchip: Add SF distro bootcmd
  2020-02-03  9:19 ` Jagan Teki
@ 2020-02-03  9:19     ` Jagan Teki
  -1 siblings, 0 replies; 6+ messages in thread
From: Jagan Teki @ 2020-02-03  9:19 UTC (permalink / raw)
  To: Kever Yang, Simon Glass, Philipp Tomsich
  Cc: u-boot-0aAXYlwwYIKGBzrmiIFOJg,
	linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/,
	Jagan Teki, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Add distro boot command support for SPI flash in Rockchip.

This distro boot will read the boot script at specific
location at the flash and start sourcing the same.

Included the SF device at the last of the target devices
list since all the rest of the devices on the list have
more possibility to boot the distribution due to the
size of the SPI flash is concern.

Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
---
 include/configs/rockchip-common.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h
index b55e09a9ca..8e7c994266 100644
--- a/include/configs/rockchip-common.h
+++ b/include/configs/rockchip-common.h
@@ -41,11 +41,26 @@
 	#define BOOT_TARGET_DHCP(func)
 #endif
 
+#if CONFIG_IS_ENABLED(CMD_SF)
+	#define BOOT_TARGET_SF(func)	func(SF, sf, na)
+#else
+	#define BOOT_TARGET_SF(func)
+#endif
+
+#define BOOTENV_DEV_SF(devtypeu, devtypel, instance) \
+	"bootcmd_sf=sf probe 0 0 0 && " \
+		"sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
+		"source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_SF(devtypeu, devtypel, instance) \
+	"sf "
+
 #define BOOT_TARGET_DEVICES(func) \
 	BOOT_TARGET_MMC(func) \
 	BOOT_TARGET_USB(func) \
 	BOOT_TARGET_PXE(func) \
-	BOOT_TARGET_DHCP(func)
+	BOOT_TARGET_DHCP(func) \
+	BOOT_TARGET_SF(func)
 
 #ifdef CONFIG_ARM64
 #define ROOT_UUID "B921B045-1DF0-41C3-AF44-4C6F280D3FAE;\0"
-- 
2.17.1

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

* [PATCH 2/2] rockchip: Add SF distro bootcmd
@ 2020-02-03  9:19     ` Jagan Teki
  0 siblings, 0 replies; 6+ messages in thread
From: Jagan Teki @ 2020-02-03  9:19 UTC (permalink / raw)
  To: u-boot

Add distro boot command support for SPI flash in Rockchip.

This distro boot will read the boot script at specific
location at the flash and start sourcing the same.

Included the SF device at the last of the target devices
list since all the rest of the devices on the list have
more possibility to boot the distribution due to the
size of the SPI flash is concern.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 include/configs/rockchip-common.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h
index b55e09a9ca..8e7c994266 100644
--- a/include/configs/rockchip-common.h
+++ b/include/configs/rockchip-common.h
@@ -41,11 +41,26 @@
 	#define BOOT_TARGET_DHCP(func)
 #endif
 
+#if CONFIG_IS_ENABLED(CMD_SF)
+	#define BOOT_TARGET_SF(func)	func(SF, sf, na)
+#else
+	#define BOOT_TARGET_SF(func)
+#endif
+
+#define BOOTENV_DEV_SF(devtypeu, devtypel, instance) \
+	"bootcmd_sf=sf probe 0 0 0 && " \
+		"sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
+		"source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
+
+#define BOOTENV_DEV_NAME_SF(devtypeu, devtypel, instance) \
+	"sf "
+
 #define BOOT_TARGET_DEVICES(func) \
 	BOOT_TARGET_MMC(func) \
 	BOOT_TARGET_USB(func) \
 	BOOT_TARGET_PXE(func) \
-	BOOT_TARGET_DHCP(func)
+	BOOT_TARGET_DHCP(func) \
+	BOOT_TARGET_SF(func)
 
 #ifdef CONFIG_ARM64
 #define ROOT_UUID "B921B045-1DF0-41C3-AF44-4C6F280D3FAE;\0"
-- 
2.17.1

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

* Re: [PATCH 2/2] rockchip: Add SF distro bootcmd
  2020-02-03  9:19     ` Jagan Teki
@ 2020-02-04 17:00       ` Tom Rini
  -1 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2020-02-04 17:00 UTC (permalink / raw)
  To: Jagan Teki; +Cc: linux-rockchip, u-boot, linux-amarula

[-- Attachment #1: Type: text/plain, Size: 2110 bytes --]

On Mon, Feb 03, 2020 at 02:49:24PM +0530, Jagan Teki wrote:

> Add distro boot command support for SPI flash in Rockchip.
> 
> This distro boot will read the boot script at specific
> location at the flash and start sourcing the same.
> 
> Included the SF device at the last of the target devices
> list since all the rest of the devices on the list have
> more possibility to boot the distribution due to the
> size of the SPI flash is concern.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  include/configs/rockchip-common.h | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h
> index b55e09a9ca..8e7c994266 100644
> --- a/include/configs/rockchip-common.h
> +++ b/include/configs/rockchip-common.h
> @@ -41,11 +41,26 @@
>  	#define BOOT_TARGET_DHCP(func)
>  #endif
>  
> +#if CONFIG_IS_ENABLED(CMD_SF)
> +	#define BOOT_TARGET_SF(func)	func(SF, sf, na)
> +#else
> +	#define BOOT_TARGET_SF(func)
> +#endif
> +
> +#define BOOTENV_DEV_SF(devtypeu, devtypel, instance) \
> +	"bootcmd_sf=sf probe 0 0 0 && " \
> +		"sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
> +		"source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
> +
> +#define BOOTENV_DEV_NAME_SF(devtypeu, devtypel, instance) \
> +	"sf "
> +
>  #define BOOT_TARGET_DEVICES(func) \
>  	BOOT_TARGET_MMC(func) \
>  	BOOT_TARGET_USB(func) \
>  	BOOT_TARGET_PXE(func) \
> -	BOOT_TARGET_DHCP(func)
> +	BOOT_TARGET_DHCP(func) \
> +	BOOT_TARGET_SF(func)
>  
>  #ifdef CONFIG_ARM64
>  #define ROOT_UUID "B921B045-1DF0-41C3-AF44-4C6F280D3FAE;\0"

Something I lamented in another thread is that we need to move things to
include/environment/ so that they can be re-used easily.  Lets start by
putting the "distro boot" SF stuff in to include/environment/distro/sf.h
and #include that here.  That way anything else that really does have
something written to SPI flash in this manner can opt-in without
duplication of the logic.

Thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [PATCH 2/2] rockchip: Add SF distro bootcmd
@ 2020-02-04 17:00       ` Tom Rini
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2020-02-04 17:00 UTC (permalink / raw)
  To: u-boot

On Mon, Feb 03, 2020 at 02:49:24PM +0530, Jagan Teki wrote:

> Add distro boot command support for SPI flash in Rockchip.
> 
> This distro boot will read the boot script at specific
> location at the flash and start sourcing the same.
> 
> Included the SF device at the last of the target devices
> list since all the rest of the devices on the list have
> more possibility to boot the distribution due to the
> size of the SPI flash is concern.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  include/configs/rockchip-common.h | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h
> index b55e09a9ca..8e7c994266 100644
> --- a/include/configs/rockchip-common.h
> +++ b/include/configs/rockchip-common.h
> @@ -41,11 +41,26 @@
>  	#define BOOT_TARGET_DHCP(func)
>  #endif
>  
> +#if CONFIG_IS_ENABLED(CMD_SF)
> +	#define BOOT_TARGET_SF(func)	func(SF, sf, na)
> +#else
> +	#define BOOT_TARGET_SF(func)
> +#endif
> +
> +#define BOOTENV_DEV_SF(devtypeu, devtypel, instance) \
> +	"bootcmd_sf=sf probe 0 0 0 && " \
> +		"sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
> +		"source ${scriptaddr}; echo SCRIPT FAILED: continuing...;\0"
> +
> +#define BOOTENV_DEV_NAME_SF(devtypeu, devtypel, instance) \
> +	"sf "
> +
>  #define BOOT_TARGET_DEVICES(func) \
>  	BOOT_TARGET_MMC(func) \
>  	BOOT_TARGET_USB(func) \
>  	BOOT_TARGET_PXE(func) \
> -	BOOT_TARGET_DHCP(func)
> +	BOOT_TARGET_DHCP(func) \
> +	BOOT_TARGET_SF(func)
>  
>  #ifdef CONFIG_ARM64
>  #define ROOT_UUID "B921B045-1DF0-41C3-AF44-4C6F280D3FAE;\0"

Something I lamented in another thread is that we need to move things to
include/environment/ so that they can be re-used easily.  Lets start by
putting the "distro boot" SF stuff in to include/environment/distro/sf.h
and #include that here.  That way anything else that really does have
something written to SPI flash in this manner can opt-in without
duplication of the logic.

Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200204/142648c7/attachment.sig>

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

end of thread, other threads:[~2020-02-04 17:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03  9:19 [PATCH 1/2] rk3399: Add boot flash script offet, size Jagan Teki
2020-02-03  9:19 ` Jagan Teki
     [not found] ` <20200203091924.15385-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
2020-02-03  9:19   ` [PATCH 2/2] rockchip: Add SF distro bootcmd Jagan Teki
2020-02-03  9:19     ` Jagan Teki
2020-02-04 17:00     ` Tom Rini
2020-02-04 17:00       ` Tom Rini

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.