All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7
@ 2017-09-11  9:18 Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 01/19] bootstage: adjust Makefile to allow including bootstage in SPL, but not in TPL Philipp Tomsich
                   ` (18 more replies)
  0 siblings, 19 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot


This series converts all dependencies for the RK3368-uQ7 to support a
live tree and and tests w/ BOOTSTAGE enabled (thus introducing a few
additional changes to the Rockchip DM timer driver).

Note that updating the RK3399 support (which will have us look at
video) for a live tree will be next: I plan to keep the RK3399 changes
as a separate series (to be applied on top of this one).

Changes in v2:
- implements the dev_read_addr_ptr() function
- use the new dev_read_addr_ptr() function
- improve error handling, in case dev_read_addr_ptr returns NULL

Philipp Tomsich (19):
  bootstage: adjust Makefile to allow including bootstage in SPL, but
    not in TPL
  dm: timer: Convert to livetree
  dm: timer: handle being called before dm_root is ready
  dm: core: add dev_read_addr_ptr()
  net: designware: Convert to livetree
  net: phy: micrel: Convert to livetree
  rockchip: mmc: convert to livetree
  rockchip: timer: implement timer_get_boot_us
  rockchip: timer: Convert to livetree
  rockchip: clk: rk3368: Convert to livetree
  rockchip: pinctrl: rk3368: Convert to livetree
  rockchip: spi: Convert to livetree
  rockchip: sdhci: Convert to livetree
  rockchip: rk8xx: remove unused header includes
  rockchip: i2c: Convert to livetree
  rockchip: gpio: convert to livetree
  rockchip: gpio: remove outdated/misleading comment
  rockchip: dts: rk3368-lion: add /chosen/tick-timer
  rockchip: lion-rk3368: defconfig: resync w/ OF_LIVE and BOOTSTAGE
    enabled

 arch/arm/dts/rk3368-lion-u-boot.dtsi      |  2 +
 common/Makefile                           |  2 +-
 configs/lion-rk3368_defconfig             |  7 +++
 drivers/clk/rockchip/clk_rk3368.c         |  2 +-
 drivers/core/read.c                       |  7 +++
 drivers/gpio/rk_gpio.c                    |  3 +-
 drivers/i2c/rk_i2c.c                      |  2 +-
 drivers/mmc/rockchip_dw_mmc.c             |  2 +-
 drivers/mmc/rockchip_sdhci.c              |  3 +-
 drivers/net/designware.c                  | 11 ++---
 drivers/net/phy/micrel_ksz90x1.c          |  5 +-
 drivers/pinctrl/rockchip/pinctrl_rk3368.c |  3 +-
 drivers/power/pmic/rk8xx.c                |  2 -
 drivers/spi/rk_spi.c                      |  2 +-
 drivers/timer/rockchip_timer.c            | 76 ++++++++++++++++++++++++++++---
 drivers/timer/timer-uclass.c              | 52 ++++++++++++---------
 include/dm/read.h                         | 15 ++++++
 17 files changed, 144 insertions(+), 52 deletions(-)

-- 
2.1.4

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

* [U-Boot] [PATCH v2 01/19] bootstage: adjust Makefile to allow including bootstage in SPL, but not in TPL
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 02/19] dm: timer: Convert to livetree Philipp Tomsich
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

For timing our bootstages on the RK3368, which has a minimal TPL
(and where we consequently don't want to time the bootstages) and a
full-featured SPL (where we can bootstage recording), we need to
adjust the Makefile.

Use the $(SPL_TPL_) macro in the Makefile for bootstage.o

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

Changes in v2: None

 common/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/Makefile b/common/Makefile
index 1b56cf9..801ea31 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -63,7 +63,7 @@ obj-$(CONFIG_CMDLINE) += cli_readline.o cli_simple.o
 
 endif # !CONFIG_SPL_BUILD
 
-obj-$(CONFIG_$(SPL_)BOOTSTAGE) += bootstage.o
+obj-$(CONFIG_$(SPL_TPL_)BOOTSTAGE) += bootstage.o
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu.o
-- 
2.1.4

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

* [U-Boot] [PATCH v2 02/19] dm: timer: Convert to livetree
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 01/19] bootstage: adjust Makefile to allow including bootstage in SPL, but not in TPL Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 03/19] dm: timer: handle being called before dm_root is ready Philipp Tomsich
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

This updates dm_timer_init to support a live tree and deals with
some fallout (i.e. the need to restructure the code such, that we
don't need multiple discontinuous #if CONFIG_IS_ENABLED blocks).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

Changes in v2: None

 drivers/timer/timer-uclass.c | 45 ++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
index a84755f..62d6f0b 100644
--- a/drivers/timer/timer-uclass.c
+++ b/drivers/timer/timer-uclass.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <dm/lists.h>
 #include <dm/device-internal.h>
+#include <dm/root.h>
 #include <clk.h>
 #include <errno.h>
 #include <timer.h>
@@ -54,9 +55,10 @@ static int timer_pre_probe(struct udevice *dev)
 		if (IS_ERR_VALUE(ret))
 			return ret;
 		uc_priv->clock_rate = ret;
-	} else
-		uc_priv->clock_rate = fdtdec_get_int(gd->fdt_blob,
-				dev_of_offset(dev),	"clock-frequency", 0);
+	} else {
+		uc_priv->clock_rate =
+			dev_read_u32_default(dev, "clock-frequency", 0);
+	}
 #endif
 
 	return 0;
@@ -83,9 +85,8 @@ u64 timer_conv_64(u32 count)
 
 int notrace dm_timer_init(void)
 {
-	__maybe_unused const void *blob = gd->fdt_blob;
 	struct udevice *dev = NULL;
-	int node = -ENOENT;
+	__maybe_unused ofnode node;
 	int ret;
 
 	if (gd->timer)
@@ -93,27 +94,27 @@ int notrace dm_timer_init(void)
 
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	/* Check for a chosen timer to be used for tick */
-	node = fdtdec_get_chosen_node(blob, "tick-timer");
+	node = ofnode_get_chosen_node("tick-timer");
+
+	if (ofnode_valid(node) &&
+	    uclass_get_device_by_ofnode(UCLASS_TIMER, node, &dev)) {
+		/*
+		 * If the timer is not marked to be bound before
+		 * relocation, bind it anyway.
+		 */
+		if (!lists_bind_fdt(dm_root(), node, &dev)) {
+			ret = device_probe(dev);
+			if (ret)
+				return ret;
+		}
+	}
 #endif
-	if (node < 0) {
-		/* No chosen timer, trying first available timer */
+
+	if (!dev) {
+		/* Fall back to the first available timer */
 		ret = uclass_first_device_err(UCLASS_TIMER, &dev);
 		if (ret)
 			return ret;
-	} else {
-		if (uclass_get_device_by_of_offset(UCLASS_TIMER, node, &dev)) {
-			/*
-			 * If the timer is not marked to be bound before
-			 * relocation, bind it anyway.
-			 */
-			if (node > 0 &&
-			    !lists_bind_fdt(gd->dm_root, offset_to_ofnode(node),
-					    &dev)) {
-				ret = device_probe(dev);
-				if (ret)
-					return ret;
-			}
-		}
 	}
 
 	if (dev) {
-- 
2.1.4

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

* [U-Boot] [PATCH v2 03/19] dm: timer: handle being called before dm_root is ready
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 01/19] bootstage: adjust Makefile to allow including bootstage in SPL, but not in TPL Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 02/19] dm: timer: Convert to livetree Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 04/19] dm: core: add dev_read_addr_ptr() Philipp Tomsich
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

When used with bootstage recording, dm_timer_init may be called
surprisingly early: i.e. before dm_root is ready. To deal with
this case, we explicitly check for this condition and return
-EAGAIN to the caller (refer to drivers/timer/rockchip_timer.c
for a case where this is needed/used).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

Changes in v2: None

 drivers/timer/timer-uclass.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
index 62d6f0b..45397b2 100644
--- a/drivers/timer/timer-uclass.c
+++ b/drivers/timer/timer-uclass.c
@@ -92,6 +92,13 @@ int notrace dm_timer_init(void)
 	if (gd->timer)
 		return 0;
 
+	/*
+	 * Directly access gd->dm_root to suppress error messages, if the
+	 * virtual root driver does not yet exist.
+	 */
+	if (gd->dm_root == NULL)
+		return -EAGAIN;
+
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	/* Check for a chosen timer to be used for tick */
 	node = ofnode_get_chosen_node("tick-timer");
-- 
2.1.4

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

* [U-Boot] [PATCH v2 04/19] dm: core: add dev_read_addr_ptr()
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (2 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 03/19] dm: timer: handle being called before dm_root is ready Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-12  2:44   ` Simon Glass
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 05/19] net: designware: Convert to livetree Philipp Tomsich
                   ` (14 subsequent siblings)
  18 siblings, 1 reply; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

The dev_read_addr_ptr() mimics the behaviour of the devfdt_get_addr_ptr(),
retrieving the first address of the node's reg-property and returning
it as a pointer (or NULL on failure).

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

---

Changes in v2:
- implements the dev_read_addr_ptr() function

 drivers/core/read.c |  7 +++++++
 include/dm/read.h   | 15 +++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/drivers/core/read.c b/drivers/core/read.c
index 6acb333..065589a 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -57,6 +57,13 @@ fdt_addr_t dev_read_addr(struct udevice *dev)
 	return dev_read_addr_index(dev, 0);
 }
 
+void *dev_read_addr_ptr(struct udevice *dev)
+{
+	fdt_addr_t addr = dev_read_addr(dev);
+
+	return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)addr;
+}
+
 fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property,
 				fdt_size_t *sizep)
 {
diff --git a/include/dm/read.h b/include/dm/read.h
index 49d69c9..e7f7125 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -113,6 +113,16 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);
 fdt_addr_t dev_read_addr(struct udevice *dev);
 
 /**
+ * dev_read_addr_ptr() - Get the reg property of a device
+ *                       as a pointer
+ *
+ * @dev: Device to read from
+ *
+ * @return pointer or NULL if not found
+ */
+void *dev_read_addr_ptr(struct udevice *dev);
+
+/**
  * dev_read_addr_size() - get address and size from a device property
  *
  * This does no address translation. It simply reads an property that contains
@@ -417,6 +427,11 @@ static inline fdt_addr_t dev_read_addr(struct udevice *dev)
 	return devfdt_get_addr(dev);
 }
 
+static inline void *dev_read_addr_ptr(struct udevice *dev)
+{
+	return devfdt_get_addr_ptr(dev);
+}
+
 static inline fdt_addr_t dev_read_addr_size(struct udevice *dev,
 					    const char *propname,
 					    fdt_size_t *sizep)
-- 
2.1.4

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

* [U-Boot] [PATCH v2 05/19] net: designware: Convert to livetree
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (3 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 04/19] dm: core: add dev_read_addr_ptr() Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 06/19] net: phy: micrel: " Philipp Tomsich
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Update the Designware Ethernet MAC driver to support a live device
tree.

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

Changes in v2: None

 drivers/net/designware.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 521e4dd..036d231 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -737,16 +737,14 @@ int designware_eth_ofdata_to_platdata(struct udevice *dev)
 #endif
 	struct eth_pdata *pdata = &dw_pdata->eth_pdata;
 	const char *phy_mode;
-	const fdt32_t *cell;
 #ifdef CONFIG_DM_GPIO
 	int reset_flags = GPIOD_IS_OUT;
 #endif
 	int ret = 0;
 
-	pdata->iobase = devfdt_get_addr(dev);
+	pdata->iobase = dev_read_addr(dev);
 	pdata->phy_interface = -1;
-	phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
-			       NULL);
+	phy_mode = dev_read_string(dev, "phy-mode");
 	if (phy_mode)
 		pdata->phy_interface = phy_get_interface_by_name(phy_mode);
 	if (pdata->phy_interface == -1) {
@@ -754,10 +752,7 @@ int designware_eth_ofdata_to_platdata(struct udevice *dev)
 		return -EINVAL;
 	}
 
-	pdata->max_speed = 0;
-	cell = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "max-speed", NULL);
-	if (cell)
-		pdata->max_speed = fdt32_to_cpu(*cell);
+	pdata->max_speed = dev_read_u32_default(dev, "max-speed", 0);
 
 #ifdef CONFIG_DM_GPIO
 	if (dev_read_bool(dev, "snps,reset-active-low"))
-- 
2.1.4

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

* [U-Boot] [PATCH v2 06/19] net: phy: micrel: Convert to livetree
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (4 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 05/19] net: designware: Convert to livetree Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11 19:34   ` Joe Hershberger
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 07/19] rockchip: mmc: convert " Philipp Tomsich
                   ` (12 subsequent siblings)
  18 siblings, 1 reply; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Update the Micrel KSZ90x1 driver for a live tree.

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

Changes in v2: None

 drivers/net/phy/micrel_ksz90x1.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c
index 0bb99e6..b350a61 100644
--- a/drivers/net/phy/micrel_ksz90x1.c
+++ b/drivers/net/phy/micrel_ksz90x1.c
@@ -9,11 +9,11 @@
  * (C) Copyright 2017 Adaptrum, Inc.
  * Written by Alexandru Gagniuc <alex.g@adaptrum.com> for Adaptrum, Inc.
  */
+
 #include <config.h>
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
-#include <fdtdec.h>
 #include <micrel.h>
 #include <phy.h>
 
@@ -120,8 +120,7 @@ static int ksz90x1_of_config_group(struct phy_device *phydev,
 		return -EOPNOTSUPP;
 
 	for (i = 0; i < ofcfg->grpsz; i++) {
-		val[i] = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
-					 ofcfg->grp[i].name, -1);
+		val[i] = dev_read_u32_default(dev, ofcfg->grp[i].name, ~0);
 		offset = ofcfg->grp[i].off;
 		if (val[i] == -1) {
 			/* Default register value for KSZ9021 */
-- 
2.1.4

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

* [U-Boot] [PATCH v2 07/19] rockchip: mmc: convert to livetree
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (5 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 06/19] net: phy: micrel: " Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 08/19] rockchip: timer: implement timer_get_boot_us Philipp Tomsich
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Update the Rockchip-specific wrapper for the Designware driver to
support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Version-changes: 2
- use the dev_read_addr_ptr function in rockchip_dw_mmc.c

---

Changes in v2: None

 drivers/mmc/rockchip_dw_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
index e7fcf89..807dc9e 100644
--- a/drivers/mmc/rockchip_dw_mmc.c
+++ b/drivers/mmc/rockchip_dw_mmc.c
@@ -58,7 +58,7 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)
 	struct dwmci_host *host = &priv->host;
 
 	host->name = dev->name;
-	host->ioaddr = (void *)devfdt_get_addr(dev);
+	host->ioaddr = dev_read_addr_ptr(dev);
 	host->buswidth = dev_read_u32_default(dev, "bus-width", 4);
 	host->get_mmc_clk = rockchip_dwmmc_get_mmc_clk;
 	host->priv = dev;
-- 
2.1.4

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

* [U-Boot] [PATCH v2 08/19] rockchip: timer: implement timer_get_boot_us
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (6 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 07/19] rockchip: mmc: convert " Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 09/19] rockchip: timer: Convert to livetree Philipp Tomsich
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

To make the Rockchip DM timer driver useful for the timing of
bootstages, we need a few enhancements:
 - This implements timer_get_boot_us.
 - This avoids reinitialising the timer, if it has already been
   set up (e.g. by our TPL and SPL stages). Now, we have a single
   timebase ticking from TPL through the full U-Boot.
 - This adds support for reading the timer even before the
   device-model is ready: we find the timer via /chosen/tick-timer,
   then read its address and clock-frequency, and finally read the
   timeval directly).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

Changes in v2: None

 drivers/timer/rockchip_timer.c | 72 +++++++++++++++++++++++++++++++++++++++---
 1 file changed, 67 insertions(+), 5 deletions(-)

diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c
index cd349ca..b19aaed 100644
--- a/drivers/timer/rockchip_timer.c
+++ b/drivers/timer/rockchip_timer.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <dm/ofnode.h>
 #include <mapmem.h>
 #include <asm/arch/timer.h>
 #include <dt-structs.h>
@@ -25,17 +26,72 @@ struct rockchip_timer_priv {
 	struct rk_timer *timer;
 };
 
-static int rockchip_timer_get_count(struct udevice *dev, u64 *count)
+static inline int64_t rockchip_timer_get_curr_value(struct rk_timer *timer)
 {
-	struct rockchip_timer_priv *priv = dev_get_priv(dev);
 	uint64_t timebase_h, timebase_l;
 	uint64_t cntr;
 
-	timebase_l = readl(&priv->timer->timer_curr_value0);
-	timebase_h = readl(&priv->timer->timer_curr_value1);
+	timebase_l = readl(&timer->timer_curr_value0);
+	timebase_h = readl(&timer->timer_curr_value1);
 
-	/* timers are down-counting */
 	cntr = timebase_h << 32 | timebase_l;
+	return cntr;
+}
+
+#if CONFIG_IS_ENABLED(BOOTSTAGE)
+ulong timer_get_boot_us(void)
+{
+	uint64_t  ticks = 0;
+	uint32_t  rate;
+	uint64_t  us;
+	int ret;
+
+	ret = dm_timer_init();
+
+	if (!ret) {
+		/* The timer is available */
+		rate = timer_get_rate(gd->timer);
+		timer_get_count(gd->timer, &ticks);
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+	} else if (ret == -EAGAIN) {
+		/* We have been called so early that the DM is not ready,... */
+		ofnode node = offset_to_ofnode(-1);
+		struct rk_timer *timer = NULL;
+
+		/*
+		 * ... so we try to access the raw timer, if it is specified
+		 * via the tick-timer property in /chosen.
+		 */
+		node = ofnode_get_chosen_node("tick-timer");
+		if (!ofnode_valid(node)) {
+			debug("%s: no /chosen/tick-timer\n", __func__);
+			return 0;
+		}
+
+		timer = (struct rk_timer *)ofnode_get_addr(node);
+
+		/* This timer is down-counting */
+		ticks = ~0uLL - rockchip_timer_get_curr_value(timer);
+		if (ofnode_read_u32(node, "clock-frequency", &rate)) {
+			debug("%s: could not read clock-frequency\n", __func__);
+			return 0;
+		}
+#endif
+	} else {
+		return 0;
+	}
+
+	us = (ticks * 1000) / rate;
+	return us;
+}
+#endif
+
+static int rockchip_timer_get_count(struct udevice *dev, u64 *count)
+{
+	struct rockchip_timer_priv *priv = dev_get_priv(dev);
+	uint64_t cntr = rockchip_timer_get_curr_value(priv->timer);
+
+	/* timers are down-counting */
 	*count = ~0ull - cntr;
 	return 0;
 }
@@ -58,6 +114,12 @@ static int rockchip_timer_start(struct udevice *dev)
 	const uint32_t reload_val_l = reload_val & 0xffffffff;
 	const uint32_t reload_val_h = reload_val >> 32;
 
+	/* don't reinit, if the timer is already running and set up */
+	if ((readl(&priv->timer->timer_ctrl_reg) & 1) == 1 &&
+	    (readl(&priv->timer->timer_load_count0) == reload_val_l) &&
+	    (readl(&priv->timer->timer_load_count1) == reload_val_h))
+		return 0;
+
 	/* disable timer and reset all control */
 	writel(0, &priv->timer->timer_ctrl_reg);
 	/* write reload value */
-- 
2.1.4

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

* [U-Boot] [PATCH v2 09/19] rockchip: timer: Convert to livetree
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (7 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 08/19] rockchip: timer: implement timer_get_boot_us Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 10/19] rockchip: clk: rk3368: " Philipp Tomsich
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Update the Rockchip timer driver to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

---

Changes in v2:
- use the new dev_read_addr_ptr() function
- improve error handling, in case dev_read_addr_ptr returns NULL

 drivers/timer/rockchip_timer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c
index b19aaed..07d1448 100644
--- a/drivers/timer/rockchip_timer.c
+++ b/drivers/timer/rockchip_timer.c
@@ -101,7 +101,9 @@ static int rockchip_clk_ofdata_to_platdata(struct udevice *dev)
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct rockchip_timer_priv *priv = dev_get_priv(dev);
 
-	priv->timer = (struct rk_timer *)devfdt_get_addr(dev);
+	priv->timer = dev_read_addr_ptr(dev);
+	if (!priv->timer)
+		return -ENOENT;
 #endif
 
 	return 0;
-- 
2.1.4

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

* [U-Boot] [PATCH v2 10/19] rockchip: clk: rk3368: Convert to livetree
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (8 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 09/19] rockchip: timer: Convert to livetree Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 11/19] rockchip: pinctrl: " Philipp Tomsich
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Update the clock driver for the RK3368 to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Version-changes: 2
- use the dev_read_addr_ptr function in	clk_rk3368.c

---

Changes in v2: None

 drivers/clk/rockchip/clk_rk3368.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c
index 0160d50..e274781 100644
--- a/drivers/clk/rockchip/clk_rk3368.c
+++ b/drivers/clk/rockchip/clk_rk3368.c
@@ -485,7 +485,7 @@ static int rk3368_clk_ofdata_to_platdata(struct udevice *dev)
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct rk3368_clk_priv *priv = dev_get_priv(dev);
 
-	priv->cru = (struct rk3368_cru *)devfdt_get_addr(dev);
+	priv->cru = dev_read_addr_ptr(dev);
 #endif
 
 	return 0;
-- 
2.1.4

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

* [U-Boot] [PATCH v2 11/19] rockchip: pinctrl: rk3368: Convert to livetree
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (9 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 10/19] rockchip: clk: rk3368: " Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 12/19] rockchip: spi: " Philipp Tomsich
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Update the pinctrl driver for the RK3368 to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

Changes in v2: None

 drivers/pinctrl/rockchip/pinctrl_rk3368.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3368.c b/drivers/pinctrl/rockchip/pinctrl_rk3368.c
index 81ce2e3..b1f5704 100644
--- a/drivers/pinctrl/rockchip/pinctrl_rk3368.c
+++ b/drivers/pinctrl/rockchip/pinctrl_rk3368.c
@@ -632,8 +632,7 @@ static int rk3368_pinctrl_get_periph_id(struct udevice *dev,
 	u32 cell[3];
 	int ret;
 
-	ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph),
-				   "interrupts", cell, ARRAY_SIZE(cell));
+	ret = dev_read_u32_array(periph, "interrupts", cell, ARRAY_SIZE(cell));
 	if (ret < 0)
 		return -EINVAL;
 
-- 
2.1.4

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

* [U-Boot] [PATCH v2 12/19] rockchip: spi: Convert to livetree
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (10 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 11/19] rockchip: pinctrl: " Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:32   ` Jagan Teki
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 13/19] rockchip: sdhci: " Philipp Tomsich
                   ` (6 subsequent siblings)
  18 siblings, 1 reply; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Update the Rockchip SPI driver to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

Changes in v2: None

 drivers/spi/rk_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index c70d636..b18db74 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -184,7 +184,7 @@ static int rockchip_spi_ofdata_to_platdata(struct udevice *bus)
 	struct rockchip_spi_priv *priv = dev_get_priv(bus);
 	int ret;
 
-	plat->base = devfdt_get_addr(bus);
+	plat->base = dev_read_addr(bus);
 
 	ret = clk_get_by_index(bus, 0, &priv->clk);
 	if (ret < 0) {
-- 
2.1.4

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

* [U-Boot] [PATCH v2 13/19] rockchip: sdhci: Convert to livetree
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (11 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 12/19] rockchip: spi: " Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 14/19] rockchip: rk8xx: remove unused header includes Philipp Tomsich
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Update the Rockchip SDHCI wrapper to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Version-changes: 2
- use the dev_read_addr_ptr function in	rockchip_sdhci.c

---

Changes in v2: None

 drivers/mmc/rockchip_sdhci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c
index f31d329..346a42c 100644
--- a/drivers/mmc/rockchip_sdhci.c
+++ b/drivers/mmc/rockchip_sdhci.c
@@ -9,7 +9,6 @@
 #include <common.h>
 #include <dm.h>
 #include <dt-structs.h>
-#include <fdtdec.h>
 #include <libfdt.h>
 #include <malloc.h>
 #include <mapmem.h>
@@ -82,7 +81,7 @@ static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
 	struct sdhci_host *host = dev_get_priv(dev);
 
 	host->name = dev->name;
-	host->ioaddr = devfdt_get_addr_ptr(dev);
+	host->ioaddr = dev_read_addr_ptr(dev);
 #endif
 
 	return 0;
-- 
2.1.4

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

* [U-Boot] [PATCH v2 14/19] rockchip: rk8xx: remove unused header includes
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (12 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 13/19] rockchip: sdhci: " Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 15/19] rockchip: i2c: Convert to livetree Philipp Tomsich
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Remove header file includes that have been left over after the
conversion to livetree-support.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

Changes in v2: None

 drivers/power/pmic/rk8xx.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c
index eb3ec0f..735046d 100644
--- a/drivers/power/pmic/rk8xx.c
+++ b/drivers/power/pmic/rk8xx.c
@@ -8,8 +8,6 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
-#include <fdtdec.h>
-#include <libfdt.h>
 #include <power/rk8xx_pmic.h>
 #include <power/pmic.h>
 
-- 
2.1.4

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

* [U-Boot] [PATCH v2 15/19] rockchip: i2c: Convert to livetree
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (13 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 14/19] rockchip: rk8xx: remove unused header includes Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11 11:29   ` Heiko Schocher
  2017-09-13  2:31   ` Simon Glass
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 16/19] rockchip: gpio: convert " Philipp Tomsich
                   ` (3 subsequent siblings)
  18 siblings, 2 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Update the Rockchip I2C driver to support livetree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Version-changes: 2
- use the dev_read_addr_ptr function in rk_i2c.c

---

Changes in v2: None

 drivers/i2c/rk_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c
index 68e6653..840b3f6 100644
--- a/drivers/i2c/rk_i2c.c
+++ b/drivers/i2c/rk_i2c.c
@@ -382,7 +382,7 @@ static int rockchip_i2c_probe(struct udevice *bus)
 {
 	struct rk_i2c *priv = dev_get_priv(bus);
 
-	priv->regs = (void *)devfdt_get_addr(bus);
+	priv->regs = dev_read_addr_ptr(bus);
 
 	return 0;
 }
-- 
2.1.4

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

* [U-Boot] [PATCH v2 16/19] rockchip: gpio: convert to livetree
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (14 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 15/19] rockchip: i2c: Convert to livetree Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 17/19] rockchip: gpio: remove outdated/misleading comment Philipp Tomsich
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Update the Rockchip GPIO-bank driver to support a live tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Version-changes: 2
- use the dev_read_addr_ptr function in rk_gpio.c

---

Changes in v2: None

 drivers/gpio/rk_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/rk_gpio.c b/drivers/gpio/rk_gpio.c
index 6f7366a..a6b83b2 100644
--- a/drivers/gpio/rk_gpio.c
+++ b/drivers/gpio/rk_gpio.c
@@ -104,7 +104,7 @@ static int rockchip_gpio_probe(struct udevice *dev)
 	int ret;
 
 	/* This only supports RK3288 at present */
-	priv->regs = (struct rockchip_gpio_regs *)devfdt_get_addr(dev);
+	priv->regs = dev_read_addr_ptr(dev);
 	ret = uclass_first_device_err(UCLASS_PINCTRL, &priv->pinctrl);
 	if (ret)
 		return ret;
-- 
2.1.4

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

* [U-Boot] [PATCH v2 17/19] rockchip: gpio: remove outdated/misleading comment
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (15 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 16/19] rockchip: gpio: convert " Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 18/19] rockchip: dts: rk3368-lion: add /chosen/tick-timer Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 19/19] rockchip: lion-rk3368: defconfig: resync w/ OF_LIVE and BOOTSTAGE enabled Philipp Tomsich
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

Remove a comment claiming that this driver only supports the RK3288,
as we also use it on the RK3368, RK3399 and (most likely) on other
variants.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Version-changes: 2
- use the dev_read_addr_ptr function in rk_gpio.c

---

Changes in v2: None

 drivers/gpio/rk_gpio.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpio/rk_gpio.c b/drivers/gpio/rk_gpio.c
index a6b83b2..11fc3e2 100644
--- a/drivers/gpio/rk_gpio.c
+++ b/drivers/gpio/rk_gpio.c
@@ -103,7 +103,6 @@ static int rockchip_gpio_probe(struct udevice *dev)
 	char *end;
 	int ret;
 
-	/* This only supports RK3288 at present */
 	priv->regs = dev_read_addr_ptr(dev);
 	ret = uclass_first_device_err(UCLASS_PINCTRL, &priv->pinctrl);
 	if (ret)
-- 
2.1.4

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

* [U-Boot] [PATCH v2 18/19] rockchip: dts: rk3368-lion: add /chosen/tick-timer
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (16 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 17/19] rockchip: gpio: remove outdated/misleading comment Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 19/19] rockchip: lion-rk3368: defconfig: resync w/ OF_LIVE and BOOTSTAGE enabled Philipp Tomsich
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

To support bootstage recording, we want to mark our DM timer as the
tick-timer; this triggers the support for 'trying harder' to read the
timer in the Rockchip DM timer driver, even if the device model isn't
ready yet.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

Changes in v2: None

 arch/arm/dts/rk3368-lion-u-boot.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/dts/rk3368-lion-u-boot.dtsi b/arch/arm/dts/rk3368-lion-u-boot.dtsi
index dbf614c..a9b7f81 100644
--- a/arch/arm/dts/rk3368-lion-u-boot.dtsi
+++ b/arch/arm/dts/rk3368-lion-u-boot.dtsi
@@ -13,6 +13,7 @@
 	chosen {
 		stdout-path = "serial0:115200n8";
 		u-boot,spl-boot-order = &emmc, &sdmmc;
+		tick-timer = "/timer at ff810000";
 	};
 
 };
@@ -88,6 +89,7 @@
 &timer0 {
 	u-boot,dm-pre-reloc;
 	clock-frequency = <24000000>;
+	status = "okay";
 };
 
 
-- 
2.1.4

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

* [U-Boot] [PATCH v2 19/19] rockchip: lion-rk3368: defconfig: resync w/ OF_LIVE and BOOTSTAGE enabled
  2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
                   ` (17 preceding siblings ...)
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 18/19] rockchip: dts: rk3368-lion: add /chosen/tick-timer Philipp Tomsich
@ 2017-09-11  9:18 ` Philipp Tomsich
  18 siblings, 0 replies; 26+ messages in thread
From: Philipp Tomsich @ 2017-09-11  9:18 UTC (permalink / raw)
  To: u-boot

This adds OF_LIVE and BOOTSTAGE support for the RK3368-uQ7 and
regenerates the defconfig (picking up a few changes/reorderings) from
upstream Kconfig changes.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

Changes in v2: None

 configs/lion-rk3368_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/configs/lion-rk3368_defconfig b/configs/lion-rk3368_defconfig
index 45a12a8..c7ee7b3 100644
--- a/configs/lion-rk3368_defconfig
+++ b/configs/lion-rk3368_defconfig
@@ -19,6 +19,11 @@ CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_FIT_SOURCE="board/theobroma-systems/lion_rk3368/fit_spl_atf.its"
+CONFIG_BOOTSTAGE=y
+CONFIG_SPL_BOOTSTAGE=y
+CONFIG_BOOTSTAGE_REPORT=y
+CONFIG_BOOTSTAGE_FDT=y
+CONFIG_ENV_IS_IN_MMC=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_ARCH_EARLY_INIT_R=y
 CONFIG_SPL=y
@@ -37,10 +42,12 @@ CONFIG_TPL_DRIVERS_MISC_SUPPORT=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
+CONFIG_CMD_BOOTSTAGE=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_TPL_OF_CONTROL=y
+CONFIG_OF_LIVE=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names interrupt-parent"
 CONFIG_TPL_OF_PLATDATA=y
 CONFIG_ENV_IS_IN_MMC=y
-- 
2.1.4

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

* [U-Boot] [PATCH v2 12/19] rockchip: spi: Convert to livetree
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 12/19] rockchip: spi: " Philipp Tomsich
@ 2017-09-11  9:32   ` Jagan Teki
  0 siblings, 0 replies; 26+ messages in thread
From: Jagan Teki @ 2017-09-11  9:32 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 11, 2017 at 2:48 PM, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> Update the Rockchip SPI driver to support a live device tree.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Reviewed-by: Jagan Teki <jagan@openedev.com>

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.

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

* [U-Boot] [PATCH v2 15/19] rockchip: i2c: Convert to livetree
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 15/19] rockchip: i2c: Convert to livetree Philipp Tomsich
@ 2017-09-11 11:29   ` Heiko Schocher
  2017-09-13  2:31   ` Simon Glass
  1 sibling, 0 replies; 26+ messages in thread
From: Heiko Schocher @ 2017-09-11 11:29 UTC (permalink / raw)
  To: u-boot

Hello Philipp,

Am 11.09.2017 um 11:18 schrieb Philipp Tomsich:
> Update the Rockchip I2C driver to support livetree.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> Version-changes: 2
> - use the dev_read_addr_ptr function in rk_i2c.c
>
> ---
>
> Changes in v2: None
>
>   drivers/i2c/rk_i2c.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de

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

* [U-Boot] [PATCH v2 06/19] net: phy: micrel: Convert to livetree
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 06/19] net: phy: micrel: " Philipp Tomsich
@ 2017-09-11 19:34   ` Joe Hershberger
  2017-09-11 19:54     ` Dr. Philipp Tomsich
  0 siblings, 1 reply; 26+ messages in thread
From: Joe Hershberger @ 2017-09-11 19:34 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 11, 2017 at 4:18 AM, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> Update the Micrel KSZ90x1 driver for a live tree.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

You seem to not have included my Acked-by tags in the new version.

-Joe

> ---
>
> Changes in v2: None
>
>  drivers/net/phy/micrel_ksz90x1.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c
> index 0bb99e6..b350a61 100644
> --- a/drivers/net/phy/micrel_ksz90x1.c
> +++ b/drivers/net/phy/micrel_ksz90x1.c
> @@ -9,11 +9,11 @@
>   * (C) Copyright 2017 Adaptrum, Inc.
>   * Written by Alexandru Gagniuc <alex.g@adaptrum.com> for Adaptrum, Inc.
>   */
> +
>  #include <config.h>
>  #include <common.h>
>  #include <dm.h>
>  #include <errno.h>
> -#include <fdtdec.h>
>  #include <micrel.h>
>  #include <phy.h>
>
> @@ -120,8 +120,7 @@ static int ksz90x1_of_config_group(struct phy_device *phydev,
>                 return -EOPNOTSUPP;
>
>         for (i = 0; i < ofcfg->grpsz; i++) {
> -               val[i] = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
> -                                        ofcfg->grp[i].name, -1);
> +               val[i] = dev_read_u32_default(dev, ofcfg->grp[i].name, ~0);
>                 offset = ofcfg->grp[i].off;
>                 if (val[i] == -1) {
>                         /* Default register value for KSZ9021 */
> --
> 2.1.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] [PATCH v2 06/19] net: phy: micrel: Convert to livetree
  2017-09-11 19:34   ` Joe Hershberger
@ 2017-09-11 19:54     ` Dr. Philipp Tomsich
  0 siblings, 0 replies; 26+ messages in thread
From: Dr. Philipp Tomsich @ 2017-09-11 19:54 UTC (permalink / raw)
  To: u-boot

> On 11 Sep 2017, at 21:34, Joe Hershberger <joe.hershberger@ni.com> wrote:
> 
> On Mon, Sep 11, 2017 at 4:18 AM, Philipp Tomsich
> <philipp.tomsich at theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>> wrote:
>> Update the Micrel KSZ90x1 driver for a live tree.
>> 
>> Signed-off-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>
> 
> You seem to not have included my Acked-by tags in the new version.

Oops.  Seems like those got lost those somewhere along the line.
Thanks for pointing this out.

Phil.

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

* [U-Boot] [PATCH v2 04/19] dm: core: add dev_read_addr_ptr()
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 04/19] dm: core: add dev_read_addr_ptr() Philipp Tomsich
@ 2017-09-12  2:44   ` Simon Glass
  0 siblings, 0 replies; 26+ messages in thread
From: Simon Glass @ 2017-09-12  2:44 UTC (permalink / raw)
  To: u-boot

On 11 September 2017 at 03:18, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> The dev_read_addr_ptr() mimics the behaviour of the devfdt_get_addr_ptr(),
> retrieving the first address of the node's reg-property and returning
> it as a pointer (or NULL on failure).
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> ---
>
> Changes in v2:
> - implements the dev_read_addr_ptr() function
>
>  drivers/core/read.c |  7 +++++++
>  include/dm/read.h   | 15 +++++++++++++++
>  2 files changed, 22 insertions(+)

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

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

* [U-Boot] [PATCH v2 15/19] rockchip: i2c: Convert to livetree
  2017-09-11  9:18 ` [U-Boot] [PATCH v2 15/19] rockchip: i2c: Convert to livetree Philipp Tomsich
  2017-09-11 11:29   ` Heiko Schocher
@ 2017-09-13  2:31   ` Simon Glass
  1 sibling, 0 replies; 26+ messages in thread
From: Simon Glass @ 2017-09-13  2:31 UTC (permalink / raw)
  To: u-boot

On 11 September 2017 at 03:18, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> Update the Rockchip I2C driver to support livetree.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> Version-changes: 2
> - use the dev_read_addr_ptr function in rk_i2c.c
>
> ---
>
> Changes in v2: None
>
>  drivers/i2c/rk_i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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

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

end of thread, other threads:[~2017-09-13  2:31 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11  9:18 [U-Boot] [PATCH v2 00/19] rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 01/19] bootstage: adjust Makefile to allow including bootstage in SPL, but not in TPL Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 02/19] dm: timer: Convert to livetree Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 03/19] dm: timer: handle being called before dm_root is ready Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 04/19] dm: core: add dev_read_addr_ptr() Philipp Tomsich
2017-09-12  2:44   ` Simon Glass
2017-09-11  9:18 ` [U-Boot] [PATCH v2 05/19] net: designware: Convert to livetree Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 06/19] net: phy: micrel: " Philipp Tomsich
2017-09-11 19:34   ` Joe Hershberger
2017-09-11 19:54     ` Dr. Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 07/19] rockchip: mmc: convert " Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 08/19] rockchip: timer: implement timer_get_boot_us Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 09/19] rockchip: timer: Convert to livetree Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 10/19] rockchip: clk: rk3368: " Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 11/19] rockchip: pinctrl: " Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 12/19] rockchip: spi: " Philipp Tomsich
2017-09-11  9:32   ` Jagan Teki
2017-09-11  9:18 ` [U-Boot] [PATCH v2 13/19] rockchip: sdhci: " Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 14/19] rockchip: rk8xx: remove unused header includes Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 15/19] rockchip: i2c: Convert to livetree Philipp Tomsich
2017-09-11 11:29   ` Heiko Schocher
2017-09-13  2:31   ` Simon Glass
2017-09-11  9:18 ` [U-Boot] [PATCH v2 16/19] rockchip: gpio: convert " Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 17/19] rockchip: gpio: remove outdated/misleading comment Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 18/19] rockchip: dts: rk3368-lion: add /chosen/tick-timer Philipp Tomsich
2017-09-11  9:18 ` [U-Boot] [PATCH v2 19/19] rockchip: lion-rk3368: defconfig: resync w/ OF_LIVE and BOOTSTAGE enabled Philipp Tomsich

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.