All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot
@ 2017-09-11 11:59 Philipp Tomsich
  2017-09-11 11:59 ` [U-Boot] [PATCH 01/10] rockchip: rk3399: make spl_board_init board-specific Philipp Tomsich
                   ` (9 more replies)
  0 siblings, 10 replies; 25+ messages in thread
From: Philipp Tomsich @ 2017-09-11 11:59 UTC (permalink / raw)
  To: u-boot

path that we'd like to see supported in the mainline:
- The override signal BIOS_DISABLE keeps the on-module SPI and eMMC
  powered-down (actually: in reset) to force booting from external
  sources.  Before proceeding with the SPL boot, we thus need to
  power the devices up (actually: release the reset) in software.
  This is done using the regulator framework and a fixed regulator.
- Depending on the boot-sources and system configuration, we may
  want to insert the device the SPL stage was booted from at the
  start of the boot order, for these we introduce the special device
  select 'same-as-spl' for the boot-order.

This series contains the following changes:
* moves board-specific functionality for the RK3399 SPL stage from the
  shared SPL board support file to individual ones for the EVB and Puma.
* enables the power-regulator framework of Puma
* adds fixed regulator support for powering up the eMMC and SPI flashes
* adds support for the 'same-as-spl' specifier for the boot order (incl.
  updating the documentation for this


Philipp Tomsich (10):
  rockchip: rk3399: make spl_board_init board-specific
  rockchip: bootrom: add definitions to retrieve BROM boot-source
  rockchip: spl: add documentation for spl_node_to_boot_device()
  rockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order
  rockchip: spl: rk3399: implement chip-specific
    board_spl_was_booted_from()
  rockchip: dts: rk3399-puma: add 'same-as-spl' to the front of the
    boot-order
  rockchip: puma-rk3399: update board_init()
  rockchip: rk3399-puma: add boot-on regulator to override BIOS_DISABLE
  power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig
  rockchip: defconfig: puma-rk3399: update for DM_REGULATOR support in
    SPL

 arch/arm/dts/rk3399-puma.dtsi                     | 26 +++++++++-
 arch/arm/include/asm/arch-rockchip/bootrom.h      | 18 +++++++
 arch/arm/mach-rockchip/rk3399-board-spl.c         | 51 +++++++++-----------
 arch/arm/mach-rockchip/spl-boot-order.c           | 48 +++++++++++++++++-
 board/rockchip/evb_rk3399/evb-rk3399.c            | 32 +++++++++++-
 board/theobroma-systems/puma_rk3399/puma-rk3399.c | 59 +++++++++--------------
 configs/puma-rk3399_defconfig                     |  7 ++-
 doc/device-tree-bindings/chosen.txt               | 12 ++++-
 drivers/power/regulator/Kconfig                   |  7 +++
 9 files changed, 192 insertions(+), 68 deletions(-)

-- 
2.1.4

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

* [U-Boot] [PATCH 01/10] rockchip: rk3399: make spl_board_init board-specific
  2017-09-11 11:59 [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot Philipp Tomsich
@ 2017-09-11 11:59 ` Philipp Tomsich
  2017-09-13  4:25   ` Simon Glass
  2017-09-11 11:59 ` [U-Boot] [PATCH 02/10] rockchip: bootrom: add definitions to retrieve BROM boot-source Philipp Tomsich
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Philipp Tomsich @ 2017-09-11 11:59 UTC (permalink / raw)
  To: u-boot

The later-stage spl_board_init (as opposed to board_init_f) should set
up board-specific details: these differ between the EVB-RK3399 and the
RK3399-Q7 (Puma).

This moves spl_board_init back into the individual boards and removes
the unneeded functionality from Puma.

As we are touching these files, we also sort the #include directives
and drop the inclusion of unneeded files.

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

 arch/arm/mach-rockchip/rk3399-board-spl.c         | 27 -------------------
 board/rockchip/evb_rk3399/evb-rk3399.c            | 32 +++++++++++++++++++++--
 board/theobroma-systems/puma_rk3399/puma-rk3399.c | 15 ++++++++---
 3 files changed, 41 insertions(+), 33 deletions(-)

diff --git a/arch/arm/mach-rockchip/rk3399-board-spl.c b/arch/arm/mach-rockchip/rk3399-board-spl.c
index 1c39d9b..8e38ef1 100644
--- a/arch/arm/mach-rockchip/rk3399-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3399-board-spl.c
@@ -149,33 +149,6 @@ void board_init_f(ulong dummy)
 	}
 }
 
-void spl_board_init(void)
-{
-	struct udevice *pinctrl;
-	int ret;
-
-	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
-	if (ret) {
-		debug("%s: Cannot find pinctrl device\n", __func__);
-		goto err;
-	}
-
-	/* Enable debug UART */
-	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
-	if (ret) {
-		debug("%s: Failed to set up console UART\n", __func__);
-		goto err;
-	}
-
-	preloader_console_init();
-	return;
-err:
-	printf("spl_board_init: Error %d\n", ret);
-
-	/* No way to report error here */
-	hang();
-}
-
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/rockchip/evb_rk3399/evb-rk3399.c
index d50c59d..506efff 100644
--- a/board/rockchip/evb_rk3399/evb-rk3399.c
+++ b/board/rockchip/evb_rk3399/evb-rk3399.c
@@ -3,13 +3,14 @@
  *
  * SPDX-License-Identifier:     GPL-2.0+
  */
+
 #include <common.h>
+#include <asm/arch/periph.h>
 #include <dm.h>
-#include <ram.h>
 #include <dm/pinctrl.h>
 #include <dm/uclass-internal.h>
-#include <asm/arch/periph.h>
 #include <power/regulator.h>
+#include <spl.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -67,3 +68,30 @@ int board_init(void)
 out:
 	return 0;
 }
+
+void spl_board_init(void)
+{
+	struct udevice *pinctrl;
+	int ret;
+
+	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
+	if (ret) {
+		debug("%s: Cannot find pinctrl device\n", __func__);
+		goto err;
+	}
+
+	/* Enable debug UART */
+	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
+	if (ret) {
+		debug("%s: Failed to set up console UART\n", __func__);
+		goto err;
+	}
+
+	preloader_console_init();
+	return;
+err:
+	printf("spl_board_init: Error %d\n", ret);
+
+	/* No way to report error here */
+	hang();
+}
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index c6f8eed..01b90e3 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -3,15 +3,16 @@
  *
  * SPDX-License-Identifier:     GPL-2.0+
  */
+
 #include <common.h>
+#include <asm/arch/periph.h>
+#include <asm/setup.h>
 #include <dm.h>
-#include <misc.h>
-#include <ram.h>
 #include <dm/pinctrl.h>
 #include <dm/uclass-internal.h>
-#include <asm/setup.h>
-#include <asm/arch/periph.h>
+#include <misc.h>
 #include <power/regulator.h>
+#include <spl.h>
 #include <u-boot/sha256.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -59,6 +60,12 @@ out:
 	return 0;
 }
 
+void spl_board_init(void)
+{
+	preloader_console_init();
+	return;
+}
+
 static void setup_macaddr(void)
 {
 #if CONFIG_IS_ENABLED(CMD_NET)
-- 
2.1.4

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

* [U-Boot] [PATCH 02/10] rockchip: bootrom: add definitions to retrieve BROM boot-source
  2017-09-11 11:59 [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot Philipp Tomsich
  2017-09-11 11:59 ` [U-Boot] [PATCH 01/10] rockchip: rk3399: make spl_board_init board-specific Philipp Tomsich
@ 2017-09-11 11:59 ` Philipp Tomsich
  2017-09-13  4:25   ` Simon Glass
  2017-09-11 11:59 ` [U-Boot] [PATCH 03/10] rockchip: spl: add documentation for spl_node_to_boot_device() Philipp Tomsich
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Philipp Tomsich @ 2017-09-11 11:59 UTC (permalink / raw)
  To: u-boot

The Rockchip BROM allows reading where it booted from from SRAM.
This adds the necessary definitions (as received from Kever) for
the location of this information in the RK3399's SRAM and naming
for the constants used.

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

 arch/arm/include/asm/arch-rockchip/bootrom.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm/include/asm/arch-rockchip/bootrom.h b/arch/arm/include/asm/arch-rockchip/bootrom.h
index 92eb878..169cc5e 100644
--- a/arch/arm/include/asm/arch-rockchip/bootrom.h
+++ b/arch/arm/include/asm/arch-rockchip/bootrom.h
@@ -24,4 +24,22 @@ void back_to_bootrom(void);
  */
 void _back_to_bootrom_s(void);
 
+/**
+ * Boot-device identifiers as used by the BROM
+ */
+enum {
+	BROM_BOOTSOURCE_NAND = 1,
+	BROM_BOOTSOURCE_EMMC = 2,
+	BROM_BOOTSOURCE_SPINOR = 3,
+	BROM_BOOTSOURCE_SPINAND = 4,
+	BROM_BOOTSOURCE_SD = 5,
+	BROM_BOOTSOURCE_USB = 10,
+	BROM_LAST_BOOTSOURCE = BROM_BOOTSOURCE_USB
+};
+
+/**
+ * Locations of the boot-device identifier in SRAM
+ */
+#define RK3399_BROM_BOOTSOURCE_ID_ADDR   0xff8c0010
+
 #endif
-- 
2.1.4

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

* [U-Boot] [PATCH 03/10] rockchip: spl: add documentation for spl_node_to_boot_device()
  2017-09-11 11:59 [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot Philipp Tomsich
  2017-09-11 11:59 ` [U-Boot] [PATCH 01/10] rockchip: rk3399: make spl_board_init board-specific Philipp Tomsich
  2017-09-11 11:59 ` [U-Boot] [PATCH 02/10] rockchip: bootrom: add definitions to retrieve BROM boot-source Philipp Tomsich
@ 2017-09-11 11:59 ` Philipp Tomsich
  2017-09-13  4:25   ` Simon Glass
  2017-09-11 11:59 ` [U-Boot] [PATCH 04/10] rockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order Philipp Tomsich
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Philipp Tomsich @ 2017-09-11 11:59 UTC (permalink / raw)
  To: u-boot

In the expectation that the spl-boot-order code will eventually
gain use outside of mach-rockchip: let's add documentation on the
spl_node_to_boot_device() function, which is likely to become a
publicly exported function.

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

 arch/arm/mach-rockchip/spl-boot-order.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c
index 4f78c72..0bb9a73 100644
--- a/arch/arm/mach-rockchip/spl-boot-order.c
+++ b/arch/arm/mach-rockchip/spl-boot-order.c
@@ -10,6 +10,25 @@
 #include <spl.h>
 
 #if CONFIG_IS_ENABLED(OF_CONTROL)
+/**
+ * spl_node_to_boot_device() - maps from a DT-node to a SPL boot device
+ * @node:	of_offset of the node
+ *
+ * The SPL framework uses BOOT_DEVICE_... constants to identify its boot
+ * sources.  These may take on a device-specific meaning, depending on
+ * what nodes are enabled in a DTS (e.g. BOOT_DEVICE_MMC1 may refer to
+ * different controllers/block-devices, depending on which SD/MMC controllers
+ * are enabled in any given DTS).  This function maps from a DT-node back
+ * onto a BOOT_DEVICE_... constant, considering the currently active devices.
+ *
+ * Returns
+ *   -ENOENT, if no device matching the node could be found
+ *   -ENOSYS, if the device matching the node can not be mapped onto a
+ *            SPL boot device (e.g. the third MMC device)
+ *   -1, for unspecified failures
+ *   a positive integer (from the BOOT_DEVICE_... family) on succes.
+ */
+
 static int spl_node_to_boot_device(int node)
 {
 	struct udevice *parent;
-- 
2.1.4

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

* [U-Boot] [PATCH 04/10] rockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order
  2017-09-11 11:59 [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot Philipp Tomsich
                   ` (2 preceding siblings ...)
  2017-09-11 11:59 ` [U-Boot] [PATCH 03/10] rockchip: spl: add documentation for spl_node_to_boot_device() Philipp Tomsich
@ 2017-09-11 11:59 ` Philipp Tomsich
  2017-09-13  4:25   ` Simon Glass
  2017-09-11 11:59 ` [U-Boot] [PATCH 05/10] rockchip: spl: rk3399: implement chip-specific board_spl_was_booted_from() Philipp Tomsich
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Philipp Tomsich @ 2017-09-11 11:59 UTC (permalink / raw)
  To: u-boot

It is often desirable to configure the spl-boot-order (i.e. the order
that SPL probes devices to find the FIT image containing a full U-Boot)
such that it contains 'the same device the SPL stage was booted from'
early on.  To support this, we introduce the 'same-as-spl' specifier
for the spl-boot-order property.

This commit adds:
 - documentation for the new board_spl_was_booted_from() function that
   individual SoCs/boards should provide, if they can determine where
   the SPL was booted from
 - implements the new board_spl_was_booted_from() stub function
 - adds support for handling the 'same-as-spl' specifier and calling
   into the per-SoC/per-board support code.

This also updates the documentation for the 'u-boot,spl-boot-order'
property.

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

 arch/arm/mach-rockchip/spl-boot-order.c | 29 ++++++++++++++++++++++++++++-
 doc/device-tree-bindings/chosen.txt     | 12 +++++++++++-
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c
index 0bb9a73..843998d 100644
--- a/arch/arm/mach-rockchip/spl-boot-order.c
+++ b/arch/arm/mach-rockchip/spl-boot-order.c
@@ -76,6 +76,24 @@ static int spl_node_to_boot_device(int node)
 	return -1;
 }
 
+/**
+ * board_spl_was_booted_from() - retrieves the of-path the SPL was loaded from
+ *
+ * To support a 'same-as-spl' specification in the search-order for the next
+ * stage, we need a SoC- or board-specific way to handshake with what 'came
+ * before us' (either a BROM or TPL stage) and map the info retrieved onto
+ * a OF path.
+ *
+ * Returns
+ *   NULL, on failure or if the device could not be identified
+ *   a of_path (a string), on success
+ */
+__weak const char *board_spl_was_booted_from(void)
+{
+	debug("%s: no support for 'same-as-spl' for this board\n", __func__);
+	return NULL;
+}
+
 void board_boot_order(u32 *spl_boot_list)
 {
 	const void *blob = gd->fdt_blob;
@@ -97,8 +115,17 @@ void board_boot_order(u32 *spl_boot_list)
 	     (conf = fdt_stringlist_get(blob, chosen_node,
 					"u-boot,spl-boot-order", elem, NULL));
 	     elem++) {
+		const char *alias;
+
+		/* Handle the case of 'same device the SPL was loaded from' */
+		if (strncmp(conf, "same-as-spl", 11) == 0) {
+			conf = board_spl_was_booted_from();
+			if (!conf)
+				continue;
+		}
+
 		/* First check if the list element is an alias */
-		const char *alias = fdt_get_alias(blob, conf);
+		alias = fdt_get_alias(blob, conf);
 		if (alias)
 			conf = alias;
 
diff --git a/doc/device-tree-bindings/chosen.txt b/doc/device-tree-bindings/chosen.txt
index 5625d21..c96b8f7 100644
--- a/doc/device-tree-bindings/chosen.txt
+++ b/doc/device-tree-bindings/chosen.txt
@@ -56,10 +56,20 @@ Each list element of the property should specify a device to be probed
 in the order they are listed: references (i.e. implicit paths), a full
 path or an alias is expected for each entry.
 
+A special specifier "same-as-spl" can be used at any position in the
+boot-order to direct U-Boot to insert the device the SPL was booted
+from there.  Whether this is indeed inserted or silently ignored (if
+it is not supported on any given SoC/board or if the boot-device is
+not available to continue booting from) is implementation-defined.
+Note that if "same-as-spl" expands to an actual node for a given
+board, the corresponding node may appear multiple times in the
+boot-order (as there currently exists no mechanism to suppress
+duplicates from the list).
+
 Example
 -------
 / {
 	chosen {
-		u-boot,spl-boot-order = &sdmmc, "/sdhci at fe330000";
+		u-boot,spl-boot-order = "same-as-spl", &sdmmc, "/sdhci at fe330000";
 	};
 };
-- 
2.1.4

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

* [U-Boot] [PATCH 05/10] rockchip: spl: rk3399: implement chip-specific board_spl_was_booted_from()
  2017-09-11 11:59 [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot Philipp Tomsich
                   ` (3 preceding siblings ...)
  2017-09-11 11:59 ` [U-Boot] [PATCH 04/10] rockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order Philipp Tomsich
@ 2017-09-11 11:59 ` Philipp Tomsich
  2017-09-13  4:25   ` Simon Glass
  2017-09-11 11:59 ` [U-Boot] [PATCH 06/10] rockchip: dts: rk3399-puma: add 'same-as-spl' to the front of the boot-order Philipp Tomsich
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Philipp Tomsich @ 2017-09-11 11:59 UTC (permalink / raw)
  To: u-boot

To support the new "same-as-spl" specifier in the boot-order on the
RK3399, this implements the chip-specific mapping from the information
obtainable from the BROM to a OF path name.

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

 arch/arm/mach-rockchip/rk3399-board-spl.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3399-board-spl.c b/arch/arm/mach-rockchip/rk3399-board-spl.c
index 8e38ef1..9c20f56 100644
--- a/arch/arm/mach-rockchip/rk3399-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3399-board-spl.c
@@ -26,6 +26,30 @@ void board_return_to_bootrom(void)
 	back_to_bootrom();
 }
 
+static const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
+	[BROM_BOOTSOURCE_EMMC] = "/sdhci at fe330000",
+	[BROM_BOOTSOURCE_SPINOR] = "/spi at ff1d0000",
+	[BROM_BOOTSOURCE_SD] = "/dwmmc at fe320000",
+};
+
+const char *board_spl_was_booted_from(void)
+{
+	u32  bootdevice_brom_id = readl(RK3399_BROM_BOOTSOURCE_ID_ADDR);
+	const char *bootdevice_ofpath = NULL;
+
+	if (bootdevice_brom_id < ARRAY_SIZE(boot_devices))
+		bootdevice_ofpath = boot_devices[bootdevice_brom_id];
+
+	if (bootdevice_ofpath)
+		debug("%s: brom_bootdevice_id %x maps to '%s'\n",
+		      __func__, bootdevice_brom_id, bootdevice_ofpath);
+	else
+		debug("%s: failed to resolve brom_bootdevice_id %x\n",
+		      __func__, bootdevice_brom_id);
+
+	return bootdevice_ofpath;
+}
+
 u32 spl_boot_device(void)
 {
 	u32 boot_device = BOOT_DEVICE_MMC1;
-- 
2.1.4

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

* [U-Boot] [PATCH 06/10] rockchip: dts: rk3399-puma: add 'same-as-spl' to the front of the boot-order
  2017-09-11 11:59 [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot Philipp Tomsich
                   ` (4 preceding siblings ...)
  2017-09-11 11:59 ` [U-Boot] [PATCH 05/10] rockchip: spl: rk3399: implement chip-specific board_spl_was_booted_from() Philipp Tomsich
@ 2017-09-11 11:59 ` Philipp Tomsich
  2017-09-13  4:26   ` Simon Glass
  2017-09-11 11:59 ` [U-Boot] [PATCH 07/10] rockchip: puma-rk3399: update board_init() Philipp Tomsich
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Philipp Tomsich @ 2017-09-11 11:59 UTC (permalink / raw)
  To: u-boot

In the general case, we want to continue booting the full U-Boot
(contained in a discoverable FIT image) from the same device the SPL
stage was loaded from.  This prepends the 'same-as-spl' specifier to
our configurable boot-order to make this the default behaviour.

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

 arch/arm/dts/rk3399-puma.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/rk3399-puma.dtsi b/arch/arm/dts/rk3399-puma.dtsi
index dd1baea..edb9424 100644
--- a/arch/arm/dts/rk3399-puma.dtsi
+++ b/arch/arm/dts/rk3399-puma.dtsi
@@ -20,7 +20,8 @@
 
 	chosen {
 		stdout-path = "serial0:115200n8";
-		u-boot,spl-boot-order = &spiflash, &sdhci, &sdmmc;
+		u-boot,spl-boot-order = \
+			"same-as-spl", &spiflash, &sdhci, &sdmmc;
 	};
 
 	aliases {
-- 
2.1.4

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

* [U-Boot] [PATCH 07/10] rockchip: puma-rk3399: update board_init()
  2017-09-11 11:59 [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot Philipp Tomsich
                   ` (5 preceding siblings ...)
  2017-09-11 11:59 ` [U-Boot] [PATCH 06/10] rockchip: dts: rk3399-puma: add 'same-as-spl' to the front of the boot-order Philipp Tomsich
@ 2017-09-11 11:59 ` Philipp Tomsich
  2017-09-13  4:26   ` Simon Glass
  2017-09-11 11:59 ` [U-Boot] [PATCH 08/10] rockchip: rk3399-puma: add boot-on regulator to override BIOS_DISABLE Philipp Tomsich
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 25+ messages in thread
From: Philipp Tomsich @ 2017-09-11 11:59 UTC (permalink / raw)
  To: u-boot

The original initialisation code for board_init() was largely lifted
from the code on the EVB.  However, the RK3399-Q7 can do with a much
more concise init sequence.

This cleans up the board_init() by updating it to the essentials for
the RK3399-Q7 and getting rid of the accumulated cruft.

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

 board/theobroma-systems/puma_rk3399/puma-rk3399.c | 36 +++--------------------
 1 file changed, 4 insertions(+), 32 deletions(-)

diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index 01b90e3..cc572b5 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -19,44 +19,16 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int board_init(void)
 {
-	struct udevice *pinctrl, *regulator;
 	int ret;
 
 	/*
-	 * The PWM does not have decicated interrupt number in dts and can
-	 * not get periph_id by pinctrl framework, so let's init them here.
-	 * The PWM2 and PWM3 are for pwm regulators.
+	 * We need to call into regulators_enable_boot_on() again, as the call
+	 * during SPL may have not included all regulators.
 	 */
-	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
-	if (ret) {
-		debug("%s: Cannot find pinctrl device\n", __func__);
-		goto out;
-	}
-
-	ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2);
-	if (ret) {
-		debug("%s PWM2 pinctrl init fail!\n", __func__);
-		goto out;
-	}
-
-	/* rk3399 need to init vdd_center to get the correct output voltage */
-	ret = regulator_get_by_platname("vdd_center", &regulator);
+	ret = regulators_enable_boot_on(false);
 	if (ret)
-		debug("%s: Cannot get vdd_center regulator\n", __func__);
-
-	ret = regulator_get_by_platname("vcc5v0_host", &regulator);
-	if (ret) {
-		debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
-		goto out;
-	}
-
-	ret = regulator_set_enable(regulator, true);
-	if (ret) {
-		debug("%s vcc5v0-host-en set fail!\n", __func__);
-		goto out;
-	}
+		debug("%s: Cannot enable boot on regulator\n", __func__);
 
-out:
 	return 0;
 }
 
-- 
2.1.4

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

* [U-Boot] [PATCH 08/10] rockchip: rk3399-puma: add boot-on regulator to override BIOS_DISABLE
  2017-09-11 11:59 [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot Philipp Tomsich
                   ` (6 preceding siblings ...)
  2017-09-11 11:59 ` [U-Boot] [PATCH 07/10] rockchip: puma-rk3399: update board_init() Philipp Tomsich
@ 2017-09-11 11:59 ` Philipp Tomsich
  2017-09-13  4:26   ` Simon Glass
  2017-09-11 11:59 ` [U-Boot] [PATCH 09/10] power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig Philipp Tomsich
  2017-09-11 11:59 ` [U-Boot] [PATCH 10/10] rockchip: defconfig: puma-rk3399: update for DM_REGULATOR support in SPL Philipp Tomsich
  9 siblings, 1 reply; 25+ messages in thread
From: Philipp Tomsich @ 2017-09-11 11:59 UTC (permalink / raw)
  To: u-boot

The (Qseven) BIOS_DISABLE signal on the RK3399-Q7 (Puma) keeps the
eMMC and SPI in reset initially and we need to write a GPIO to turn
them on before continuing the boot-up.

This adds the DTS entries for the additional regulator and makes
pinctrl and gpio3 available during SPL.  It also adds a hook to the
spl_board_init() to ensure that the regulator gets probed and enabled.

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

 arch/arm/dts/rk3399-puma.dtsi                     | 23 +++++++++++++++++++++++
 board/theobroma-systems/puma_rk3399/puma-rk3399.c | 10 ++++++++++
 2 files changed, 33 insertions(+)

diff --git a/arch/arm/dts/rk3399-puma.dtsi b/arch/arm/dts/rk3399-puma.dtsi
index edb9424..85e00ec 100644
--- a/arch/arm/dts/rk3399-puma.dtsi
+++ b/arch/arm/dts/rk3399-puma.dtsi
@@ -90,6 +90,24 @@
 		};
 	};
 
+	/*
+	 * The Qseven BIOS_DISABLE signal on the RK3399-Q7 keeps the on-module
+	 * eMMC and SPI flash powered-down initially (in fact it keeps the
+	 * reset signal asserted).  Even though it is an enable signal, we
+	 * model this as a regulator.
+	 */
+	bios_enable: bios_enable {
+		compatible = "regulator-fixed";
+		u-boot,dm-pre-reloc;
+		regulator-name = "bios_enable";
+		enable-active-low;
+		gpio = <&gpio3 29 GPIO_ACTIVE_HIGH>;
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+
 	vccadc_ref: vccadc-ref {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc1v8_sys";
@@ -523,10 +541,15 @@
 	status = "okay";
 };
 
+&gpio3 {
+       u-boot,dm-pre-reloc;
+};
+
 &pinctrl {
 	/* Pins that are not explicitely used by any devices */
 	pinctrl-names = "default";
 	pinctrl-0 = <&puma_pin_hog>;
+
 	hog {
 		puma_pin_hog: puma_pin_hog {
 			rockchip,pins =
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index cc572b5..b49fa66 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -34,6 +34,16 @@ int board_init(void)
 
 void spl_board_init(void)
 {
+	int  ret;
+
+	/*
+	 * Turning the eMMC and SPI back on (if disabled via the Qseven
+	 * BIOS_ENABLE) signal is done through a always-on regulator).
+	 */
+	ret = regulators_enable_boot_on(false);
+	if (ret)
+		debug("%s: Cannot enable boot on regulator\n", __func__);
+
 	preloader_console_init();
 	return;
 }
-- 
2.1.4

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

* [U-Boot] [PATCH 09/10] power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig
  2017-09-11 11:59 [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot Philipp Tomsich
                   ` (7 preceding siblings ...)
  2017-09-11 11:59 ` [U-Boot] [PATCH 08/10] rockchip: rk3399-puma: add boot-on regulator to override BIOS_DISABLE Philipp Tomsich
@ 2017-09-11 11:59 ` Philipp Tomsich
  2017-09-13  4:26   ` Simon Glass
  2017-09-11 11:59 ` [U-Boot] [PATCH 10/10] rockchip: defconfig: puma-rk3399: update for DM_REGULATOR support in SPL Philipp Tomsich
  9 siblings, 1 reply; 25+ messages in thread
From: Philipp Tomsich @ 2017-09-11 11:59 UTC (permalink / raw)
  To: u-boot

The Makefile already tests for SPL_DM_REGULATOR_FIXED, but Kconfig
does not provide it.  This adds SPL_DM_REGULATOR_FIXED to Kconfig.

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

 drivers/power/regulator/Kconfig | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig
index c82a936..a11408f 100644
--- a/drivers/power/regulator/Kconfig
+++ b/drivers/power/regulator/Kconfig
@@ -77,6 +77,13 @@ config DM_REGULATOR_FIXED
 	features for fixed value regulators. The driver implements get/set api
 	for enable and get only for voltage value.
 
+config SPL_DM_REGULATOR_FIXED
+	bool "Enable Driver Model for REGULATOR Fixed value in SPL"
+	depends on DM_REGULATOR_FIXED
+	---help---
+	This config enables implementation of driver-model regulator uclass
+	features for fixed value regulators in SPL.
+
 config DM_REGULATOR_GPIO
 	bool "Enable Driver Model for GPIO REGULATOR"
 	depends on DM_REGULATOR
-- 
2.1.4

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

* [U-Boot] [PATCH 10/10] rockchip: defconfig: puma-rk3399: update for DM_REGULATOR support in SPL
  2017-09-11 11:59 [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot Philipp Tomsich
                   ` (8 preceding siblings ...)
  2017-09-11 11:59 ` [U-Boot] [PATCH 09/10] power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig Philipp Tomsich
@ 2017-09-11 11:59 ` Philipp Tomsich
  2017-09-13  4:26   ` Simon Glass
  9 siblings, 1 reply; 25+ messages in thread
From: Philipp Tomsich @ 2017-09-11 11:59 UTC (permalink / raw)
  To: u-boot

The RK3399-Q7 requires DM regulator support in SPL, so we can use the
regulator framework to reenable the eMMC and SPI, if these had been
turned of by the BIOS_DISABLE signal.

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

 configs/puma-rk3399_defconfig | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
index 1badf80..861b8c6 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_ARCH_ROCKCHIP=y
+CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_SYS_MALLOC_F_LEN=0x4000
@@ -20,6 +21,8 @@ CONFIG_SPL_BOARD_INIT=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_POWER_SUPPORT=y
 CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_IMLS is not set
 CONFIG_CMD_GPT=y
@@ -62,8 +65,10 @@ CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_ROCKCHIP_RK3399=y
 CONFIG_DM_PMIC=y
 CONFIG_PMIC_RK8XX=y
-CONFIG_REGULATOR_PWM=y
+CONFIG_SPL_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_REGULATOR_RK8XX=y
 CONFIG_PWM_ROCKCHIP=y
 CONFIG_RAM=y
-- 
2.1.4

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

* [U-Boot] [PATCH 01/10] rockchip: rk3399: make spl_board_init board-specific
  2017-09-11 11:59 ` [U-Boot] [PATCH 01/10] rockchip: rk3399: make spl_board_init board-specific Philipp Tomsich
@ 2017-09-13  4:25   ` Simon Glass
  0 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2017-09-13  4:25 UTC (permalink / raw)
  To: u-boot

Hi Philipp,

On 11 September 2017 at 05:59, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
>
> The later-stage spl_board_init (as opposed to board_init_f) should set
> up board-specific details: these differ between the EVB-RK3399 and the
> RK3399-Q7 (Puma).
>
> This moves spl_board_init back into the individual boards and removes
> the unneeded functionality from Puma.
>
> As we are touching these files, we also sort the #include directives
> and drop the inclusion of unneeded files.

Well that can go in its own patch :-)

>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
>  arch/arm/mach-rockchip/rk3399-board-spl.c         | 27 -------------------
>  board/rockchip/evb_rk3399/evb-rk3399.c            | 32 +++++++++++++++++++++--
>  board/theobroma-systems/puma_rk3399/puma-rk3399.c | 15 ++++++++---
>  3 files changed, 41 insertions(+), 33 deletions(-)
>
> diff --git a/arch/arm/mach-rockchip/rk3399-board-spl.c b/arch/arm/mach-rockchip/rk3399-board-spl.c
> index 1c39d9b..8e38ef1 100644
> --- a/arch/arm/mach-rockchip/rk3399-board-spl.c
> +++ b/arch/arm/mach-rockchip/rk3399-board-spl.c
> @@ -149,33 +149,6 @@ void board_init_f(ulong dummy)
>         }
>  }
>
> -void spl_board_init(void)
> -{
> -       struct udevice *pinctrl;
> -       int ret;
> -
> -       ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
> -       if (ret) {
> -               debug("%s: Cannot find pinctrl device\n", __func__);
> -               goto err;
> -       }
> -
> -       /* Enable debug UART */
> -       ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
> -       if (ret) {
> -               debug("%s: Failed to set up console UART\n", __func__);
> -               goto err;
> -       }
> -
> -       preloader_console_init();
> -       return;
> -err:
> -       printf("spl_board_init: Error %d\n", ret);
> -
> -       /* No way to report error here */
> -       hang();
> -}
> -
>  #ifdef CONFIG_SPL_LOAD_FIT
>  int board_fit_config_name_match(const char *name)
>  {
> diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/rockchip/evb_rk3399/evb-rk3399.c
> index d50c59d..506efff 100644
> --- a/board/rockchip/evb_rk3399/evb-rk3399.c
> +++ b/board/rockchip/evb_rk3399/evb-rk3399.c
> @@ -3,13 +3,14 @@
>   *
>   * SPDX-License-Identifier:     GPL-2.0+
>   */
> +
>  #include <common.h>
> +#include <asm/arch/periph.h>

Actually this was correct. Please see:

https://www.denx.de/wiki/U-Boot/CodingStyle

>  #include <dm.h>
> -#include <ram.h>
>  #include <dm/pinctrl.h>
>  #include <dm/uclass-internal.h>
> -#include <asm/arch/periph.h>
>  #include <power/regulator.h>
> +#include <spl.h>
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> @@ -67,3 +68,30 @@ int board_init(void)
>  out:
>         return 0;
>  }
> +
> +void spl_board_init(void)
> +{
> +       struct udevice *pinctrl;
> +       int ret;
> +
> +       ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
> +       if (ret) {
> +               debug("%s: Cannot find pinctrl device\n", __func__);
> +               goto err;
> +       }
> +
> +       /* Enable debug UART */
> +       ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
> +       if (ret) {
> +               debug("%s: Failed to set up console UART\n", __func__);
> +               goto err;
> +       }
> +
> +       preloader_console_init();
> +       return;
> +err:
> +       printf("spl_board_init: Error %d\n", ret);
> +
> +       /* No way to report error here */
> +       hang();
> +}
> diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
> index c6f8eed..01b90e3 100644
> --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
> +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
> @@ -3,15 +3,16 @@
>   *
>   * SPDX-License-Identifier:     GPL-2.0+
>   */
> +
>  #include <common.h>
> +#include <asm/arch/periph.h>
> +#include <asm/setup.h>

Similarly here. In any case, this should go in a separate patch.

>  #include <dm.h>
> -#include <misc.h>
> -#include <ram.h>
>  #include <dm/pinctrl.h>
>  #include <dm/uclass-internal.h>
> -#include <asm/setup.h>
> -#include <asm/arch/periph.h>
> +#include <misc.h>
>  #include <power/regulator.h>
> +#include <spl.h>
>  #include <u-boot/sha256.h>
>
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -59,6 +60,12 @@ out:
>         return 0;
>  }
>
> +void spl_board_init(void)
> +{
> +       preloader_console_init();
> +       return;
> +}
> +
>  static void setup_macaddr(void)
>  {
>  #if CONFIG_IS_ENABLED(CMD_NET)
> --
> 2.1.4
>

Regards,
Simon

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

* [U-Boot] [PATCH 02/10] rockchip: bootrom: add definitions to retrieve BROM boot-source
  2017-09-11 11:59 ` [U-Boot] [PATCH 02/10] rockchip: bootrom: add definitions to retrieve BROM boot-source Philipp Tomsich
@ 2017-09-13  4:25   ` Simon Glass
  0 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2017-09-13  4:25 UTC (permalink / raw)
  To: u-boot

On 11 September 2017 at 05:59, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> The Rockchip BROM allows reading where it booted from from SRAM.
> This adds the necessary definitions (as received from Kever) for
> the location of this information in the RK3399's SRAM and naming
> for the constants used.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
>  arch/arm/include/asm/arch-rockchip/bootrom.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

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

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

* [U-Boot] [PATCH 03/10] rockchip: spl: add documentation for spl_node_to_boot_device()
  2017-09-11 11:59 ` [U-Boot] [PATCH 03/10] rockchip: spl: add documentation for spl_node_to_boot_device() Philipp Tomsich
@ 2017-09-13  4:25   ` Simon Glass
  0 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2017-09-13  4:25 UTC (permalink / raw)
  To: u-boot

On 11 September 2017 at 05:59, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> In the expectation that the spl-boot-order code will eventually
> gain use outside of mach-rockchip: let's add documentation on the
> spl_node_to_boot_device() function, which is likely to become a
> publicly exported function.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
>  arch/arm/mach-rockchip/spl-boot-order.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)

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

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

* [U-Boot] [PATCH 04/10] rockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order
  2017-09-11 11:59 ` [U-Boot] [PATCH 04/10] rockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order Philipp Tomsich
@ 2017-09-13  4:25   ` Simon Glass
  2017-09-13  8:13     ` Dr. Philipp Tomsich
  0 siblings, 1 reply; 25+ messages in thread
From: Simon Glass @ 2017-09-13  4:25 UTC (permalink / raw)
  To: u-boot

On 11 September 2017 at 05:59, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> It is often desirable to configure the spl-boot-order (i.e. the order
> that SPL probes devices to find the FIT image containing a full U-Boot)
> such that it contains 'the same device the SPL stage was booted from'
> early on.  To support this, we introduce the 'same-as-spl' specifier
> for the spl-boot-order property.
>
> This commit adds:
>  - documentation for the new board_spl_was_booted_from() function that
>    individual SoCs/boards should provide, if they can determine where
>    the SPL was booted from
>  - implements the new board_spl_was_booted_from() stub function
>  - adds support for handling the 'same-as-spl' specifier and calling
>    into the per-SoC/per-board support code.
>
> This also updates the documentation for the 'u-boot,spl-boot-order'
> property.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
>  arch/arm/mach-rockchip/spl-boot-order.c | 29 ++++++++++++++++++++++++++++-
>  doc/device-tree-bindings/chosen.txt     | 12 +++++++++++-
>  2 files changed, 39 insertions(+), 2 deletions(-)

Can that weak function be declared in a header file somewhere?

One day we should have SPL pass to U-Boot a structure containing this
information and other things it wants to pass on...

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

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

* [U-Boot] [PATCH 05/10] rockchip: spl: rk3399: implement chip-specific board_spl_was_booted_from()
  2017-09-11 11:59 ` [U-Boot] [PATCH 05/10] rockchip: spl: rk3399: implement chip-specific board_spl_was_booted_from() Philipp Tomsich
@ 2017-09-13  4:25   ` Simon Glass
  2017-09-13  8:10     ` Dr. Philipp Tomsich
  0 siblings, 1 reply; 25+ messages in thread
From: Simon Glass @ 2017-09-13  4:25 UTC (permalink / raw)
  To: u-boot

On 11 September 2017 at 05:59, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> To support the new "same-as-spl" specifier in the boot-order on the
> RK3399, this implements the chip-specific mapping from the information
> obtainable from the BROM to a OF path name.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
>  arch/arm/mach-rockchip/rk3399-board-spl.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)

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

This feels a bit klugey. Does SPL not have access to the same DT? If
so then (at some point when we add support) perhaps it could pass its
name through?

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

* [U-Boot] [PATCH 06/10] rockchip: dts: rk3399-puma: add 'same-as-spl' to the front of the boot-order
  2017-09-11 11:59 ` [U-Boot] [PATCH 06/10] rockchip: dts: rk3399-puma: add 'same-as-spl' to the front of the boot-order Philipp Tomsich
@ 2017-09-13  4:26   ` Simon Glass
  0 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2017-09-13  4:26 UTC (permalink / raw)
  To: u-boot

On 11 September 2017 at 05:59, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> In the general case, we want to continue booting the full U-Boot
> (contained in a discoverable FIT image) from the same device the SPL
> stage was loaded from.  This prepends the 'same-as-spl' specifier to
> our configurable boot-order to make this the default behaviour.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
>  arch/arm/dts/rk3399-puma.dtsi | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
Reviewed-by: Simon Glass <sjg@chromium.org>

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

* [U-Boot] [PATCH 07/10] rockchip: puma-rk3399: update board_init()
  2017-09-11 11:59 ` [U-Boot] [PATCH 07/10] rockchip: puma-rk3399: update board_init() Philipp Tomsich
@ 2017-09-13  4:26   ` Simon Glass
  0 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2017-09-13  4:26 UTC (permalink / raw)
  To: u-boot

On 11 September 2017 at 05:59, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> The original initialisation code for board_init() was largely lifted
> from the code on the EVB.  However, the RK3399-Q7 can do with a much
> more concise init sequence.
>
> This cleans up the board_init() by updating it to the essentials for
> the RK3399-Q7 and getting rid of the accumulated cruft.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
>  board/theobroma-systems/puma_rk3399/puma-rk3399.c | 36 +++--------------------
>  1 file changed, 4 insertions(+), 32 deletions(-)

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

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

* [U-Boot] [PATCH 08/10] rockchip: rk3399-puma: add boot-on regulator to override BIOS_DISABLE
  2017-09-11 11:59 ` [U-Boot] [PATCH 08/10] rockchip: rk3399-puma: add boot-on regulator to override BIOS_DISABLE Philipp Tomsich
@ 2017-09-13  4:26   ` Simon Glass
  0 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2017-09-13  4:26 UTC (permalink / raw)
  To: u-boot

On 11 September 2017 at 05:59, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> The (Qseven) BIOS_DISABLE signal on the RK3399-Q7 (Puma) keeps the
> eMMC and SPI in reset initially and we need to write a GPIO to turn
> them on before continuing the boot-up.
>
> This adds the DTS entries for the additional regulator and makes
> pinctrl and gpio3 available during SPL.  It also adds a hook to the
> spl_board_init() to ensure that the regulator gets probed and enabled.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
>  arch/arm/dts/rk3399-puma.dtsi                     | 23 +++++++++++++++++++++++
>  board/theobroma-systems/puma_rk3399/puma-rk3399.c | 10 ++++++++++
>  2 files changed, 33 insertions(+)

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

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

* [U-Boot] [PATCH 09/10] power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig
  2017-09-11 11:59 ` [U-Boot] [PATCH 09/10] power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig Philipp Tomsich
@ 2017-09-13  4:26   ` Simon Glass
  2017-09-13  8:20     ` Dr. Philipp Tomsich
  0 siblings, 1 reply; 25+ messages in thread
From: Simon Glass @ 2017-09-13  4:26 UTC (permalink / raw)
  To: u-boot

On 11 September 2017 at 05:59, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> The Makefile already tests for SPL_DM_REGULATOR_FIXED, but Kconfig
> does not provide it.  This adds SPL_DM_REGULATOR_FIXED to Kconfig.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
>  drivers/power/regulator/Kconfig | 7 +++++++
>  1 file changed, 7 insertions(+)
>

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

Should that default to y?

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

* [U-Boot] [PATCH 10/10] rockchip: defconfig: puma-rk3399: update for DM_REGULATOR support in SPL
  2017-09-11 11:59 ` [U-Boot] [PATCH 10/10] rockchip: defconfig: puma-rk3399: update for DM_REGULATOR support in SPL Philipp Tomsich
@ 2017-09-13  4:26   ` Simon Glass
  0 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2017-09-13  4:26 UTC (permalink / raw)
  To: u-boot

On 11 September 2017 at 05:59, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> The RK3399-Q7 requires DM regulator support in SPL, so we can use the
> regulator framework to reenable the eMMC and SPI, if these had been
> turned of by the BIOS_DISABLE signal.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
>  configs/puma-rk3399_defconfig | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

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

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

* [U-Boot] [PATCH 05/10] rockchip: spl: rk3399: implement chip-specific board_spl_was_booted_from()
  2017-09-13  4:25   ` Simon Glass
@ 2017-09-13  8:10     ` Dr. Philipp Tomsich
  0 siblings, 0 replies; 25+ messages in thread
From: Dr. Philipp Tomsich @ 2017-09-13  8:10 UTC (permalink / raw)
  To: u-boot

> On 13 Sep 2017, at 06:25, Simon Glass <sjg@chromium.org> wrote:
> 
> On 11 September 2017 at 05:59, Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com> wrote:
>> To support the new "same-as-spl" specifier in the boot-order on the
>> RK3399, this implements the chip-specific mapping from the information
>> obtainable from the BROM to a OF path name.
>> 
>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>> ---
>> 
>> arch/arm/mach-rockchip/rk3399-board-spl.c | 24 ++++++++++++++++++++++++
>> 1 file changed, 24 insertions(+)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> This feels a bit klugey. Does SPL not have access to the same DT? If
> so then (at some point when we add support) perhaps it could pass its
> name through?

This is for the SPL stage (I may have not made this sufficiently clear in the
documentation): ‘same-as-spl’ is really intended to direct the SPL stage to
search for the full U-Boot stage in the same device the SPL was loaded from.

We use this feature for our boot-override slider (the BIOS_DISABLE) signal
to allow us to inject the “same device the SPL was loaded from” early on in
the search-order for the FIT image containing the ATF, FDT and full U-Boot. 

Injecting this info (and also the expanded name of the entry in the search-order
that was finally used) into the DT later on would be a nice future enhancement
that would allow later stages (and the full OS) to know about where things were
booted from.

Regard,
Philipp.

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

* [U-Boot] [PATCH 04/10] rockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order
  2017-09-13  4:25   ` Simon Glass
@ 2017-09-13  8:13     ` Dr. Philipp Tomsich
  0 siblings, 0 replies; 25+ messages in thread
From: Dr. Philipp Tomsich @ 2017-09-13  8:13 UTC (permalink / raw)
  To: u-boot


> On 13 Sep 2017, at 06:25, Simon Glass <sjg@chromium.org> wrote:
> 
> On 11 September 2017 at 05:59, Philipp Tomsich
> <philipp.tomsich at theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>> wrote:
>> It is often desirable to configure the spl-boot-order (i.e. the order
>> that SPL probes devices to find the FIT image containing a full U-Boot)
>> such that it contains 'the same device the SPL stage was booted from'
>> early on.  To support this, we introduce the 'same-as-spl' specifier
>> for the spl-boot-order property.
>> 
>> This commit adds:
>> - documentation for the new board_spl_was_booted_from() function that
>>   individual SoCs/boards should provide, if they can determine where
>>   the SPL was booted from
>> - implements the new board_spl_was_booted_from() stub function
>> - adds support for handling the 'same-as-spl' specifier and calling
>>   into the per-SoC/per-board support code.
>> 
>> This also updates the documentation for the 'u-boot,spl-boot-order'
>> property.
>> 
>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>> ---
>> 
>> arch/arm/mach-rockchip/spl-boot-order.c | 29 ++++++++++++++++++++++++++++-
>> doc/device-tree-bindings/chosen.txt     | 12 +++++++++++-
>> 2 files changed, 39 insertions(+), 2 deletions(-)
> 
> Can that weak function be declared in a header file somewhere?

I’d rather save this change for when we lift the code from spl-boot-order.c up
into the common SPL support code (when the declaration of these should end
up in spl.h): this has been always written to be useful across boards, but I had
hoped to let this stabilise in our sub-arch first.

> One day we should have SPL pass to U-Boot a structure containing this
> information and other things it wants to pass on...
> 
> Reviewed-by: Simon Glass <sjg at chromium.org <mailto:sjg@chromium.org>>

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

* [U-Boot] [PATCH 09/10] power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig
  2017-09-13  4:26   ` Simon Glass
@ 2017-09-13  8:20     ` Dr. Philipp Tomsich
  2017-09-17 17:52       ` Simon Glass
  0 siblings, 1 reply; 25+ messages in thread
From: Dr. Philipp Tomsich @ 2017-09-13  8:20 UTC (permalink / raw)
  To: u-boot


> On 13 Sep 2017, at 06:26, Simon Glass <sjg@chromium.org> wrote:
> 
> On 11 September 2017 at 05:59, Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com> wrote:
>> The Makefile already tests for SPL_DM_REGULATOR_FIXED, but Kconfig
>> does not provide it.  This adds SPL_DM_REGULATOR_FIXED to Kconfig.
>> 
>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>> ---
>> 
>> drivers/power/regulator/Kconfig | 7 +++++++
>> 1 file changed, 7 insertions(+)
>> 
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> Should that default to y?

I am undecided, as pretty much any default will be wrong for most people.
Fortunately it can be easily changed via defconfig or from implying it from
one of the other Kconfig sections.

My reasoning behind not making it the default was that a large number of
boards will have DM_REGULATOR_FIXED enabled (e.g. for enabling some
of the USB path), but many of the boards will not need it at the SPL stage.
If we’d make this the default, we might see increases in size (and some SPL
stages exceeding their size limit) from this change.

I’d more more than happy to make it the default, though.

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

* [U-Boot] [PATCH 09/10] power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig
  2017-09-13  8:20     ` Dr. Philipp Tomsich
@ 2017-09-17 17:52       ` Simon Glass
  0 siblings, 0 replies; 25+ messages in thread
From: Simon Glass @ 2017-09-17 17:52 UTC (permalink / raw)
  To: u-boot

On 13 September 2017 at 02:20, Dr. Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
>
>> On 13 Sep 2017, at 06:26, Simon Glass <sjg@chromium.org> wrote:
>>
>> On 11 September 2017 at 05:59, Philipp Tomsich
>> <philipp.tomsich@theobroma-systems.com> wrote:
>>> The Makefile already tests for SPL_DM_REGULATOR_FIXED, but Kconfig
>>> does not provide it.  This adds SPL_DM_REGULATOR_FIXED to Kconfig.
>>>
>>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>>> ---
>>>
>>> drivers/power/regulator/Kconfig | 7 +++++++
>>> 1 file changed, 7 insertions(+)
>>>
>>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> Should that default to y?
>
> I am undecided, as pretty much any default will be wrong for most people.
> Fortunately it can be easily changed via defconfig or from implying it from
> one of the other Kconfig sections.
>
> My reasoning behind not making it the default was that a large number of
> boards will have DM_REGULATOR_FIXED enabled (e.g. for enabling some
> of the USB path), but many of the boards will not need it at the SPL stage.
> If we’d make this the default, we might see increases in size (and some SPL
> stages exceeding their size limit) from this change.
>
> I’d more more than happy to make it the default, though.

Seems fine, I understand.

- Simon

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

end of thread, other threads:[~2017-09-17 17:52 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 11:59 [U-Boot] [PATCH 00/10] For the RK3399-Q7, we have a few additional features in the SPL boot Philipp Tomsich
2017-09-11 11:59 ` [U-Boot] [PATCH 01/10] rockchip: rk3399: make spl_board_init board-specific Philipp Tomsich
2017-09-13  4:25   ` Simon Glass
2017-09-11 11:59 ` [U-Boot] [PATCH 02/10] rockchip: bootrom: add definitions to retrieve BROM boot-source Philipp Tomsich
2017-09-13  4:25   ` Simon Glass
2017-09-11 11:59 ` [U-Boot] [PATCH 03/10] rockchip: spl: add documentation for spl_node_to_boot_device() Philipp Tomsich
2017-09-13  4:25   ` Simon Glass
2017-09-11 11:59 ` [U-Boot] [PATCH 04/10] rockchip: spl: support a 'same-as-spl'-specifier in the spl-boot-order Philipp Tomsich
2017-09-13  4:25   ` Simon Glass
2017-09-13  8:13     ` Dr. Philipp Tomsich
2017-09-11 11:59 ` [U-Boot] [PATCH 05/10] rockchip: spl: rk3399: implement chip-specific board_spl_was_booted_from() Philipp Tomsich
2017-09-13  4:25   ` Simon Glass
2017-09-13  8:10     ` Dr. Philipp Tomsich
2017-09-11 11:59 ` [U-Boot] [PATCH 06/10] rockchip: dts: rk3399-puma: add 'same-as-spl' to the front of the boot-order Philipp Tomsich
2017-09-13  4:26   ` Simon Glass
2017-09-11 11:59 ` [U-Boot] [PATCH 07/10] rockchip: puma-rk3399: update board_init() Philipp Tomsich
2017-09-13  4:26   ` Simon Glass
2017-09-11 11:59 ` [U-Boot] [PATCH 08/10] rockchip: rk3399-puma: add boot-on regulator to override BIOS_DISABLE Philipp Tomsich
2017-09-13  4:26   ` Simon Glass
2017-09-11 11:59 ` [U-Boot] [PATCH 09/10] power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig Philipp Tomsich
2017-09-13  4:26   ` Simon Glass
2017-09-13  8:20     ` Dr. Philipp Tomsich
2017-09-17 17:52       ` Simon Glass
2017-09-11 11:59 ` [U-Boot] [PATCH 10/10] rockchip: defconfig: puma-rk3399: update for DM_REGULATOR support in SPL Philipp Tomsich
2017-09-13  4:26   ` Simon Glass

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.