All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] spl: spi: override CONFIG_SYS_SPI_U_BOOT_OFFS via /config-property
@ 2017-04-17 15:45 Philipp Tomsich
  2017-04-17 15:45 ` [U-Boot] [PATCH 2/3] doc: document /config/u-boot, spl-payload-offset property Philipp Tomsich
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Philipp Tomsich @ 2017-04-17 15:45 UTC (permalink / raw)
  To: u-boot

For the RK3399-Q7, we need some flexibility (depending on the feature
set we include in the SPL stage and how large our SPI flash is) in
positioning the SPL payload (i.e. the FIT image containing U-Boot, ATF
and the M0 payload) in our SPI flash.

To avoid having to deal with this through different U-Boot images, we
introduce a the '/config/u-boot,spl-payload-offset' property node
allow it to override the default setting.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

---

 common/spl/spl_spi.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index 925a1b1..42880d5 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -15,6 +15,8 @@
 #include <errno.h>
 #include <spl.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #ifdef CONFIG_SPL_OS_BOOT
 /*
  * Load the kernel, check for a valid header we can parse, and if found load
@@ -70,6 +72,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
 			      struct spl_boot_device *bootdev)
 {
 	int err = 0;
+	unsigned payload_offs = CONFIG_SYS_SPI_U_BOOT_OFFS;
 	struct spi_flash *flash;
 	struct image_header *header;
 
@@ -89,12 +92,18 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
 	/* use CONFIG_SYS_TEXT_BASE as temporary storage area */
 	header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
 
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
+	payload_offs = fdtdec_get_config_int(gd->fdt_blob,
+					     "u-boot,spl-payload-offset",
+					     payload_offs);
+#endif
+
 #ifdef CONFIG_SPL_OS_BOOT
 	if (spl_start_uboot() || spi_load_image_os(spl_image, flash, header))
 #endif
 	{
 		/* Load u-boot, mkimage header is 64 bytes. */
-		err = spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS, 0x40,
+		err = spi_flash_read(flash, payload_offs, 0x40,
 				     (void *)header);
 		if (err) {
 			debug("%s: Failed to read from SPI flash (err=%d)\n",
@@ -113,13 +122,13 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
 			load.bl_len = 1;
 			load.read = spl_spi_fit_read;
 			err = spl_load_simple_fit(spl_image, &load,
-						  CONFIG_SYS_SPI_U_BOOT_OFFS,
+						  payload_offs,
 						  header);
 		} else {
 			err = spl_parse_image_header(spl_image, header);
 			if (err)
 				return err;
-			err = spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS,
+			err = spi_flash_read(flash, payload_offs,
 					     spl_image->size,
 					     (void *)spl_image->load_addr);
 		}
-- 
1.9.1

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

* [U-Boot] [PATCH 2/3] doc: document /config/u-boot, spl-payload-offset property
  2017-04-17 15:45 [U-Boot] [PATCH 1/3] spl: spi: override CONFIG_SYS_SPI_U_BOOT_OFFS via /config-property Philipp Tomsich
@ 2017-04-17 15:45 ` Philipp Tomsich
  2017-04-18  4:00   ` Simon Glass
  2017-05-12 17:18   ` [U-Boot] [U-Boot, " Tom Rini
  2017-04-17 15:45 ` [U-Boot] [PATCH 3/3] spl: Makefile: include /config in the (reduced) FDT used by the SPL stage Philipp Tomsich
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 10+ messages in thread
From: Philipp Tomsich @ 2017-04-17 15:45 UTC (permalink / raw)
  To: u-boot

This adds documentation on the u-boot,spl-payload-offset property
(which overrides CONFIG_SYS_SPI_U_BOOT_OFFS during the SPI loading in
the SPL stage, if present).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

 doc/device-tree-bindings/config.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/device-tree-bindings/config.txt b/doc/device-tree-bindings/config.txt
index 5640bae..d4bc1df 100644
--- a/doc/device-tree-bindings/config.txt
+++ b/doc/device-tree-bindings/config.txt
@@ -20,3 +20,8 @@ u-boot,efi-partition-entries-offset
 	is formatted.
 
 	This setting will override any values configured via Kconfig.
+
+u-boot,spl-payload-offset
+	If present (and SPL is controlled by the device-tree), this allows
+	to override the CONFIG_SYS_SPI_U_BOOT_OFFS setting using a value
+	from the device-tree.
-- 
1.9.1

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

* [U-Boot] [PATCH 3/3] spl: Makefile: include /config in the (reduced) FDT used by the SPL stage
  2017-04-17 15:45 [U-Boot] [PATCH 1/3] spl: spi: override CONFIG_SYS_SPI_U_BOOT_OFFS via /config-property Philipp Tomsich
  2017-04-17 15:45 ` [U-Boot] [PATCH 2/3] doc: document /config/u-boot, spl-payload-offset property Philipp Tomsich
@ 2017-04-17 15:45 ` Philipp Tomsich
  2017-04-18  4:00   ` Simon Glass
  2017-05-12 17:18   ` [U-Boot] [U-Boot, " Tom Rini
  2017-04-18  4:00 ` [U-Boot] [PATCH 1/3] spl: spi: override CONFIG_SYS_SPI_U_BOOT_OFFS via /config-property Simon Glass
  2017-05-12 17:18 ` [U-Boot] [U-Boot, " Tom Rini
  3 siblings, 2 replies; 10+ messages in thread
From: Philipp Tomsich @ 2017-04-17 15:45 UTC (permalink / raw)
  To: u-boot

When OF control is enabled for the SPL stage, nodes are removed from
the DTB to reduce its size. While /chosen is kept, /config is removed.

There's no reason why /chosen should be kept over /config (and as we
would like to put properties into /config that control the SPL stage),
we add '/config' to the list of nodes to be retained for the SPL stage.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

 scripts/Makefile.spl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index eb24292..182b300 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -232,7 +232,7 @@ fdtgrep_props := -b u-boot,dm-pre-reloc -b u-boot,dm-spl
 endif
 quiet_cmd_fdtgrep = FDTGREP $@
       cmd_fdtgrep = $(objtree)/tools/fdtgrep $(fdtgrep_props) -RT $< \
-		-n /chosen -O dtb | \
+		-n /chosen -n /config -O dtb | \
 	$(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
 		$(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))
 
-- 
1.9.1

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

* [U-Boot] [PATCH 2/3] doc: document /config/u-boot, spl-payload-offset property
  2017-04-17 15:45 ` [U-Boot] [PATCH 2/3] doc: document /config/u-boot, spl-payload-offset property Philipp Tomsich
@ 2017-04-18  4:00   ` Simon Glass
  2017-05-12 17:18   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 10+ messages in thread
From: Simon Glass @ 2017-04-18  4:00 UTC (permalink / raw)
  To: u-boot

On 17 April 2017 at 09:45, Philipp Tomsich <
philipp.tomsich@theobroma-systems.com> wrote:
> This adds documentation on the u-boot,spl-payload-offset property
> (which overrides CONFIG_SYS_SPI_U_BOOT_OFFS during the SPI loading in
> the SPL stage, if present).
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
> doc/device-tree-bindings/config.txt | 5 +++++
> 1 file changed, 5 insertions(+)
>

Acked-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH 1/3] spl: spi: override CONFIG_SYS_SPI_U_BOOT_OFFS via /config-property
  2017-04-17 15:45 [U-Boot] [PATCH 1/3] spl: spi: override CONFIG_SYS_SPI_U_BOOT_OFFS via /config-property Philipp Tomsich
  2017-04-17 15:45 ` [U-Boot] [PATCH 2/3] doc: document /config/u-boot, spl-payload-offset property Philipp Tomsich
  2017-04-17 15:45 ` [U-Boot] [PATCH 3/3] spl: Makefile: include /config in the (reduced) FDT used by the SPL stage Philipp Tomsich
@ 2017-04-18  4:00 ` Simon Glass
  2017-05-12 17:18 ` [U-Boot] [U-Boot, " Tom Rini
  3 siblings, 0 replies; 10+ messages in thread
From: Simon Glass @ 2017-04-18  4:00 UTC (permalink / raw)
  To: u-boot

On 17 April 2017 at 09:45, Philipp Tomsich <
philipp.tomsich@theobroma-systems.com> wrote:
> For the RK3399-Q7, we need some flexibility (depending on the feature
> set we include in the SPL stage and how large our SPI flash is) in
> positioning the SPL payload (i.e. the FIT image containing U-Boot, ATF
> and the M0 payload) in our SPI flash.
>
> To avoid having to deal with this through different U-Boot images, we
> introduce a the '/config/u-boot,spl-payload-offset' property node
> allow it to override the default setting.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> ---
>
> common/spl/spl_spi.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH 3/3] spl: Makefile: include /config in the (reduced) FDT used by the SPL stage
  2017-04-17 15:45 ` [U-Boot] [PATCH 3/3] spl: Makefile: include /config in the (reduced) FDT used by the SPL stage Philipp Tomsich
@ 2017-04-18  4:00   ` Simon Glass
  2017-04-18  8:30     ` Dr. Philipp Tomsich
  2017-05-12 17:18   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 1 reply; 10+ messages in thread
From: Simon Glass @ 2017-04-18  4:00 UTC (permalink / raw)
  To: u-boot

On 17 April 2017 at 09:45, Philipp Tomsich <
philipp.tomsich@theobroma-systems.com> wrote:
> When OF control is enabled for the SPL stage, nodes are removed from
> the DTB to reduce its size. While /chosen is kept, /config is removed.
>
> There's no reason why /chosen should be kept over /config (and as we
> would like to put properties into /config that control the SPL stage),
> we add '/config' to the list of nodes to be retained for the SPL stage.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
> scripts/Makefile.spl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>

I hope we don't end up having to filter the properties to include!

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

* [U-Boot] [PATCH 3/3] spl: Makefile: include /config in the (reduced) FDT used by the SPL stage
  2017-04-18  4:00   ` Simon Glass
@ 2017-04-18  8:30     ` Dr. Philipp Tomsich
  0 siblings, 0 replies; 10+ messages in thread
From: Dr. Philipp Tomsich @ 2017-04-18  8:30 UTC (permalink / raw)
  To: u-boot

On 18 Apr 2017, at 06:00, Simon Glass <sjg@chromium.org> wrote:
> 
> On 17 April 2017 at 09:45, Philipp Tomsich <philipp.tomsich@theobroma-systems.com> wrote:
> > When OF control is enabled for the SPL stage, nodes are removed from
> > the DTB to reduce its size. While /chosen is kept, /config is removed.
> >
> > There's no reason why /chosen should be kept over /config (and as we
> > would like to put properties into /config that control the SPL stage),
> > we add '/config' to the list of nodes to be retained for the SPL stage.
> >
> > Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> > ---
> >
> > scripts/Makefile.spl | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Acked-by: Simon Glass <sjg@chromium.org>
> 
> I hope we don't end up having to filter the properties to include!

Both the /config and /chosen nodes are passed through the CONFIG_OF_SPL_REMOVE_PROPS
filter anyway:
> quiet_cmd_fdtgrep = FDTGREP $@
>       cmd_fdtgrep = $(objtree)/tools/fdtgrep $(fdtgrep_props) -RT $< \
>                 -n /chosen -n /config -O dtb | \
>         $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
>                 $(addprefix -P ,$(subst $\",,$(CONFIG_OF_SPL_REMOVE_PROPS)))

If anybody wanted to filter these, then there’s a mechanisms in place already.

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

* [U-Boot] [U-Boot, 1/3] spl: spi: override CONFIG_SYS_SPI_U_BOOT_OFFS via /config-property
  2017-04-17 15:45 [U-Boot] [PATCH 1/3] spl: spi: override CONFIG_SYS_SPI_U_BOOT_OFFS via /config-property Philipp Tomsich
                   ` (2 preceding siblings ...)
  2017-04-18  4:00 ` [U-Boot] [PATCH 1/3] spl: spi: override CONFIG_SYS_SPI_U_BOOT_OFFS via /config-property Simon Glass
@ 2017-05-12 17:18 ` Tom Rini
  3 siblings, 0 replies; 10+ messages in thread
From: Tom Rini @ 2017-05-12 17:18 UTC (permalink / raw)
  To: u-boot

On Mon, Apr 17, 2017 at 05:45:11PM +0200, Philipp Tomsich wrote:

> For the RK3399-Q7, we need some flexibility (depending on the feature
> set we include in the SPL stage and how large our SPI flash is) in
> positioning the SPL payload (i.e. the FIT image containing U-Boot, ATF
> and the M0 payload) in our SPI flash.
> 
> To avoid having to deal with this through different U-Boot images, we
> introduce a the '/config/u-boot,spl-payload-offset' property node
> allow it to override the default setting.
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/37498a5e/attachment.sig>

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

* [U-Boot] [U-Boot, 2/3] doc: document /config/u-boot, spl-payload-offset property
  2017-04-17 15:45 ` [U-Boot] [PATCH 2/3] doc: document /config/u-boot, spl-payload-offset property Philipp Tomsich
  2017-04-18  4:00   ` Simon Glass
@ 2017-05-12 17:18   ` Tom Rini
  1 sibling, 0 replies; 10+ messages in thread
From: Tom Rini @ 2017-05-12 17:18 UTC (permalink / raw)
  To: u-boot

On Mon, Apr 17, 2017 at 05:45:12PM +0200, Philipp Tomsich wrote:

> This adds documentation on the u-boot,spl-payload-offset property
> (which overrides CONFIG_SYS_SPI_U_BOOT_OFFS during the SPI loading in
> the SPL stage, if present).
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/b6b498a0/attachment.sig>

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

* [U-Boot] [U-Boot, 3/3] spl: Makefile: include /config in the (reduced) FDT used by the SPL stage
  2017-04-17 15:45 ` [U-Boot] [PATCH 3/3] spl: Makefile: include /config in the (reduced) FDT used by the SPL stage Philipp Tomsich
  2017-04-18  4:00   ` Simon Glass
@ 2017-05-12 17:18   ` Tom Rini
  1 sibling, 0 replies; 10+ messages in thread
From: Tom Rini @ 2017-05-12 17:18 UTC (permalink / raw)
  To: u-boot

On Mon, Apr 17, 2017 at 05:45:13PM +0200, Philipp Tomsich wrote:

> When OF control is enabled for the SPL stage, nodes are removed from
> the DTB to reduce its size. While /chosen is kept, /config is removed.
> 
> There's no reason why /chosen should be kept over /config (and as we
> would like to put properties into /config that control the SPL stage),
> we add '/config' to the list of nodes to be retained for the SPL stage.
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/bf62db38/attachment.sig>

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

end of thread, other threads:[~2017-05-12 17:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-17 15:45 [U-Boot] [PATCH 1/3] spl: spi: override CONFIG_SYS_SPI_U_BOOT_OFFS via /config-property Philipp Tomsich
2017-04-17 15:45 ` [U-Boot] [PATCH 2/3] doc: document /config/u-boot, spl-payload-offset property Philipp Tomsich
2017-04-18  4:00   ` Simon Glass
2017-05-12 17:18   ` [U-Boot] [U-Boot, " Tom Rini
2017-04-17 15:45 ` [U-Boot] [PATCH 3/3] spl: Makefile: include /config in the (reduced) FDT used by the SPL stage Philipp Tomsich
2017-04-18  4:00   ` Simon Glass
2017-04-18  8:30     ` Dr. Philipp Tomsich
2017-05-12 17:18   ` [U-Boot] [U-Boot, " Tom Rini
2017-04-18  4:00 ` [U-Boot] [PATCH 1/3] spl: spi: override CONFIG_SYS_SPI_U_BOOT_OFFS via /config-property Simon Glass
2017-05-12 17:18 ` [U-Boot] [U-Boot, " 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.