All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm
@ 2015-12-24 10:38 Mugunthan V N
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 01/19] arm: omap-common: do not build timer when CONFIG_TIMER defined Mugunthan V N
                   ` (18 more replies)
  0 siblings, 19 replies; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

This patch series enables omap timer to adopt driver model. This
has been tested on the following evms (logs [1]) by invoking
'sleep 10' command with minicom timestamps.
* dra72 evm
* dra74 evm
* am335x evm
* am335x bbb
* am437x-sk evm
* am437x-gp evm

Also pushed a branch for testing [2]

[1] - http://pastebin.ubuntu.com/14190309/
[2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-timer-v2

Changes from initial->v2:
* Moved get timer either from choosen/first available timer from
  dm_timer_init to timer_init.
* Fixed typo errors in doc and comments
* Changed omap_timer_get_count dedfinition as per latest code base.

Mugunthan V N (19):
  arm: omap-common: do not build timer when CONFIG_TIMER defined
  dm: timer: uclass: add timer init to add timer device
  dm: timer: uclass: Add flag to control sequence numbering
  drivers: timer: omap_timer: add timer driver for omap devices based on
    dm
  am43xx_evm: timer: do not define CONFIG_TIMER for spl
  arm: dts: am437x-sk-evm: add tick-timer to chosen node
  defconfig: am437x_sk_evm: enable timer driver model
  arm: dts: am437x-gp-evm: add tick-timer to chosen node
  defconfig: am437x_gp_evm: enable timer driver model
  am335x_evm: timer: do not define CONFIG_TIMER for spl
  arm: dts: am335x-boneblack: add tick-timer to chosen node
  defconfig: am335x_boneblack_vboot: enable timer driver model
  arm: dts: am335x-evm: add tick-timer to chosen node
  defconfig: am335x_gp_evm: enable timer driver model
  ti_omap5_common: timer: do not define CONFIG_TIMER for spl
  arm: dts: dra72-evm: add tick-timer to chosen node
  defconfig: dra72_evm: enable timer driver model
  arm: dts: dra7-evm: add tick-timer to chosen node
  defconfig: dra74_evm: enable timer driver model

 arch/arm/cpu/armv7/omap-common/Makefile  |   6 ++
 arch/arm/dts/am335x-boneblack.dts        |   1 +
 arch/arm/dts/am335x-evm.dts              |   1 +
 arch/arm/dts/am437x-gp-evm.dts           |   1 +
 arch/arm/dts/am437x-sk-evm.dts           |   1 +
 arch/arm/dts/dra7-evm.dts                |   1 +
 arch/arm/dts/dra72-evm.dts               |   1 +
 configs/am335x_boneblack_vboot_defconfig |   2 +
 configs/am335x_gp_evm_defconfig          |   2 +
 configs/am437x_gp_evm_defconfig          |   2 +
 configs/am437x_sk_evm_defconfig          |   2 +
 configs/dra72_evm_defconfig              |   2 +
 configs/dra74_evm_defconfig              |   2 +
 doc/device-tree-bindings/chosen.txt      |  43 ++++++++++++
 drivers/timer/Kconfig                    |   6 ++
 drivers/timer/Makefile                   |   1 +
 drivers/timer/omap-timer.c               | 108 +++++++++++++++++++++++++++++++
 drivers/timer/timer-uclass.c             |  43 ++++++++++++
 include/configs/am335x_evm.h             |   1 +
 include/configs/am43xx_evm.h             |   1 +
 include/configs/ti_omap5_common.h        |   1 +
 lib/time.c                               |  13 +---
 22 files changed, 230 insertions(+), 11 deletions(-)
 create mode 100644 doc/device-tree-bindings/chosen.txt
 create mode 100644 drivers/timer/omap-timer.c

-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 01/19] arm: omap-common: do not build timer when CONFIG_TIMER defined
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:57   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 02/19] dm: timer: uclass: add timer init to add timer device Mugunthan V N
                   ` (17 subsequent siblings)
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

To prepare timer driver to DM/DT conversion do not build the
exiting timer driver when CONFIG_TIMER is defined. But since
omap's SPL doesn't support DM yet so built timer driver only for
SPL build when CONFIG_TIMER is defined.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 arch/arm/cpu/armv7/omap-common/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/cpu/armv7/omap-common/Makefile b/arch/arm/cpu/armv7/omap-common/Makefile
index 464a5d1..87a7ac0 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -6,7 +6,13 @@
 #
 
 obj-y	:= reset.o
+ifeq ($(CONFIG_TIMER),)
 obj-y	+= timer.o
+else
+ifdef CONFIG_SPL_BUILD
+obj-y	+= timer.o
+endif
+endif
 obj-y	+= utils.o
 
 ifneq ($(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 02/19] dm: timer: uclass: add timer init to add timer device
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 01/19] arm: omap-common: do not build timer when CONFIG_TIMER defined Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2015-12-25  2:10   ` Bin Meng
  2015-12-25 10:41   ` [U-Boot] [PATCH v3 " Mugunthan V N
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 03/19] dm: timer: uclass: Add flag to control sequence numbering Mugunthan V N
                   ` (16 subsequent siblings)
  18 siblings, 2 replies; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Adding timer_init function to create and initialize the timer
device on platforms where u-boot,dm-pre-reloc is not used. Since
there will be multiple timer devices in the system, adding a
tick-timer node in chosen node to know which timer device to be
used as tick timer in u-boot.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 doc/device-tree-bindings/chosen.txt | 43 +++++++++++++++++++++++++++++++++++++
 drivers/timer/timer-uclass.c        | 42 ++++++++++++++++++++++++++++++++++++
 lib/time.c                          | 13 ++---------
 3 files changed, 87 insertions(+), 11 deletions(-)
 create mode 100644 doc/device-tree-bindings/chosen.txt

diff --git a/doc/device-tree-bindings/chosen.txt b/doc/device-tree-bindings/chosen.txt
new file mode 100644
index 0000000..bf9a30a
--- /dev/null
+++ b/doc/device-tree-bindings/chosen.txt
@@ -0,0 +1,43 @@
+The chosen node
+---------------
+The chosen node does not represent a real device, but serves as a place
+for passing data like which serial device to used to print the logs etc
+
+
+stdout-path property
+--------------------
+Device trees may specify the device to be used for boot console output
+with a stdout-path property under /chosen.
+
+Example
+-------
+/ {
+	chosen {
+		stdout-path = "/serial at f00:115200";
+	};
+
+	serial at f00 {
+		compatible = "vendor,some-uart";
+		reg = <0xf00 0x10>;
+	};
+};
+
+tick-timer property
+-------------------
+In a system there are multiple timers, specify which timer to be used
+as the tick-timer. Earlier it was hardcoded in the timer driver now
+since device tree has all the timer nodes. Specify which timer to be
+used as tick timer.
+
+Example
+-------
+/ {
+	chosen {
+		tick-timer = "/timer2 at f00";
+	};
+
+	timer2 at f00 {
+		compatible = "vendor,some-timer";
+		reg = <0xf00 0x10>;
+	};
+};
diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
index aca421b..db43611 100644
--- a/drivers/timer/timer-uclass.c
+++ b/drivers/timer/timer-uclass.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <dm/lists.h>
+#include <dm/device-internal.h>
 #include <errno.h>
 #include <timer.h>
 
@@ -56,6 +58,46 @@ u64 timer_conv_64(u32 count)
 	return ((u64)gd->timebase_h << 32) | gd->timebase_l;
 }
 
+int timer_init(void)
+{
+	const void *blob = gd->fdt_blob;
+	struct udevice *dev;
+	int node;
+	int ret;
+
+	/* Check for a chosen timer to be used for tick */
+	node = fdtdec_get_chosen_node(blob, "tick-timer");
+	if (node < 0)
+		return -ENODEV;
+
+	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, blob, node, &dev)) {
+			int ret = device_probe(dev);
+			if (ret)
+				return ret;
+		}
+	}
+
+	if (dev) {
+		gd->timer = dev;
+		return 0;
+	}
+
+	ret = uclass_first_device(UCLASS_TIMER, &dev);
+	if (ret)
+		return ret;
+	if (!dev)
+		return -ENODEV;
+
+	gd->timer = dev;
+	return 0;
+}
+
 UCLASS_DRIVER(timer) = {
 	.id		= UCLASS_TIMER,
 	.name		= "timer",
diff --git a/lib/time.c b/lib/time.c
index f37a662..d4060f1 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -43,17 +43,8 @@ extern unsigned long __weak timer_read_counter(void);
 #ifdef CONFIG_TIMER
 static int notrace dm_timer_init(void)
 {
-	struct udevice *dev;
-	int ret;
-
-	if (!gd->timer) {
-		ret = uclass_first_device(UCLASS_TIMER, &dev);
-		if (ret)
-			return ret;
-		if (!dev)
-			return -ENODEV;
-		gd->timer = dev;
-	}
+	if (!gd->timer)
+		return timer_init();
 
 	return 0;
 }
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 03/19] dm: timer: uclass: Add flag to control sequence numbering
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 01/19] arm: omap-common: do not build timer when CONFIG_TIMER defined Mugunthan V N
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 02/19] dm: timer: uclass: add timer init to add timer device Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:57   ` Tom Rini
  2016-01-06  0:25   ` Simon Glass
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 04/19] drivers: timer: omap_timer: add timer driver for omap devices based on dm Mugunthan V N
                   ` (15 subsequent siblings)
  18 siblings, 2 replies; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Like SPI and I2C, timer devices also have multiple chip
instances. This patch adds the flag 'DM_UC_FLAG_SEQ_ALIAS' in
timer_uclass driver to control device sequence numbering.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---
 drivers/timer/timer-uclass.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
index db43611..abeb060 100644
--- a/drivers/timer/timer-uclass.c
+++ b/drivers/timer/timer-uclass.c
@@ -102,5 +102,6 @@ UCLASS_DRIVER(timer) = {
 	.id		= UCLASS_TIMER,
 	.name		= "timer",
 	.pre_probe	= timer_pre_probe,
+	.flags		= DM_UC_FLAG_SEQ_ALIAS,
 	.per_device_auto_alloc_size = sizeof(struct timer_dev_priv),
 };
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 04/19] drivers: timer: omap_timer: add timer driver for omap devices based on dm
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (2 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 03/19] dm: timer: uclass: Add flag to control sequence numbering Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:57   ` Tom Rini
  2016-01-16  1:21   ` Simon Glass
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 05/19] am43xx_evm: timer: do not define CONFIG_TIMER for spl Mugunthan V N
                   ` (14 subsequent siblings)
  18 siblings, 2 replies; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Adding a timer driver for omap devices based on driver model
and device tree.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 drivers/timer/Kconfig      |   6 +++
 drivers/timer/Makefile     |   1 +
 drivers/timer/omap-timer.c | 108 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 115 insertions(+)
 create mode 100644 drivers/timer/omap-timer.c

diff --git a/drivers/timer/Kconfig b/drivers/timer/Kconfig
index 2b10d2b..ff65a73 100644
--- a/drivers/timer/Kconfig
+++ b/drivers/timer/Kconfig
@@ -30,4 +30,10 @@ config X86_TSC_TIMER
 	help
 	  Select this to enable Time-Stamp Counter (TSC) timer for x86.
 
+config OMAP_TIMER
+	bool "Omap timer support"
+	depends on TIMER
+	help
+	  Select this to enable an timer for Omap devices.
+
 endmenu
diff --git a/drivers/timer/Makefile b/drivers/timer/Makefile
index fe954ec..f351fbb 100644
--- a/drivers/timer/Makefile
+++ b/drivers/timer/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_TIMER)		+= timer-uclass.o
 obj-$(CONFIG_ALTERA_TIMER)	+= altera_timer.o
 obj-$(CONFIG_SANDBOX_TIMER)	+= sandbox_timer.o
 obj-$(CONFIG_X86_TSC_TIMER)	+= tsc_timer.o
+obj-$(CONFIG_OMAP_TIMER)	+= omap-timer.o
diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c
new file mode 100644
index 0000000..3bb38c5
--- /dev/null
+++ b/drivers/timer/omap-timer.c
@@ -0,0 +1,108 @@
+/*
+ * TI OMAP timer driver
+ *
+ * Copyright (C) 2015, Texas Instruments, Incorporated
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <timer.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Timer register bits */
+#define TCLR_START			BIT(0)	/* Start=1 */
+#define TCLR_AUTO_RELOAD		BIT(1)	/* Auto reload */
+#define TCLR_PRE_EN			BIT(5)	/* Pre-scaler enable */
+#define TCLR_PTV_SHIFT			(2)	/* Pre-scaler shift value */
+
+#define TIMER_CLOCK             (V_SCLK / (2 << CONFIG_SYS_PTV))
+
+struct omap_gptimer_regs {
+	unsigned int tidr;		/* offset 0x00 */
+	unsigned char res1[12];
+	unsigned int tiocp_cfg;		/* offset 0x10 */
+	unsigned char res2[12];
+	unsigned int tier;		/* offset 0x20 */
+	unsigned int tistatr;		/* offset 0x24 */
+	unsigned int tistat;		/* offset 0x28 */
+	unsigned int tisr;		/* offset 0x2c */
+	unsigned int tcicr;		/* offset 0x30 */
+	unsigned int twer;		/* offset 0x34 */
+	unsigned int tclr;		/* offset 0x38 */
+	unsigned int tcrr;		/* offset 0x3c */
+	unsigned int tldr;		/* offset 0x40 */
+	unsigned int ttgr;		/* offset 0x44 */
+	unsigned int twpc;		/* offset 0x48 */
+	unsigned int tmar;		/* offset 0x4c */
+	unsigned int tcar1;		/* offset 0x50 */
+	unsigned int tscir;		/* offset 0x54 */
+	unsigned int tcar2;		/* offset 0x58 */
+};
+
+/* Omap Timer Priv */
+struct omap_timer_priv {
+	struct omap_gptimer_regs *regs;
+};
+
+static int omap_timer_get_count(struct udevice *dev, u64 *count)
+{
+	struct omap_timer_priv *priv = dev_get_priv(dev);
+
+	*count = readl(&priv->regs->tcrr);
+
+	return 0;
+}
+
+static int omap_timer_probe(struct udevice *dev)
+{
+	struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
+	struct omap_timer_priv *priv = dev_get_priv(dev);
+
+	uc_priv->clock_rate = TIMER_CLOCK;
+
+	/* start the counter ticking up, reload value on overflow */
+	writel(0, &priv->regs->tldr);
+	/* enable timer */
+	writel((CONFIG_SYS_PTV << 2) | TCLR_PRE_EN | TCLR_AUTO_RELOAD |
+	       TCLR_START, &priv->regs->tclr);
+
+	return 0;
+}
+
+static int omap_timer_ofdata_to_platdata(struct udevice *dev)
+{
+	struct omap_timer_priv *priv = dev_get_priv(dev);
+
+	priv->regs = (struct omap_gptimer_regs *)dev_get_addr(dev);
+
+	return 0;
+}
+
+
+static const struct timer_ops omap_timer_ops = {
+	.get_count = omap_timer_get_count,
+};
+
+static const struct udevice_id omap_timer_ids[] = {
+	{ .compatible = "ti,am335x-timer" },
+	{ .compatible = "ti,am4372-timer" },
+	{ .compatible = "ti,omap5430-timer" },
+	{}
+};
+
+U_BOOT_DRIVER(omap_timer) = {
+	.name	= "omap_timer",
+	.id	= UCLASS_TIMER,
+	.of_match = omap_timer_ids,
+	.ofdata_to_platdata = omap_timer_ofdata_to_platdata,
+	.priv_auto_alloc_size = sizeof(struct omap_timer_priv),
+	.probe = omap_timer_probe,
+	.ops	= &omap_timer_ops,
+	.flags = DM_FLAG_PRE_RELOC,
+};
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 05/19] am43xx_evm: timer: do not define CONFIG_TIMER for spl
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (3 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 04/19] drivers: timer: omap_timer: add timer driver for omap devices based on dm Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:57   ` Tom Rini
  2016-01-16  1:21   ` Simon Glass
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 06/19] arm: dts: am437x-sk-evm: add tick-timer to chosen node Mugunthan V N
                   ` (13 subsequent siblings)
  18 siblings, 2 replies; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Since OMAP's spl doesn't support DM currently, do not define
CONFIG_TIMER for spl build.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 include/configs/am43xx_evm.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h
index aac550a..9980203 100644
--- a/include/configs/am43xx_evm.h
+++ b/include/configs/am43xx_evm.h
@@ -142,6 +142,7 @@
  */
 #ifdef CONFIG_SPL_BUILD
 #undef CONFIG_DM_MMC
+#undef CONFIG_TIMER
 #endif
 
 #ifndef CONFIG_SPL_BUILD
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 06/19] arm: dts: am437x-sk-evm: add tick-timer to chosen node
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (4 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 05/19] am43xx_evm: timer: do not define CONFIG_TIMER for spl Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22   ` Simon Glass
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 07/19] defconfig: am437x_sk_evm: enable timer driver model Mugunthan V N
                   ` (12 subsequent siblings)
  18 siblings, 2 replies; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Specify which timer to be used as tick-timer in chosen node.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 arch/arm/dts/am437x-sk-evm.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/am437x-sk-evm.dts b/arch/arm/dts/am437x-sk-evm.dts
index 3f9d808..85d3381 100644
--- a/arch/arm/dts/am437x-sk-evm.dts
+++ b/arch/arm/dts/am437x-sk-evm.dts
@@ -26,6 +26,7 @@
 
 	chosen {
 		stdout-path = &uart0;
+		tick-timer = &timer2;
 	};
 
 	backlight {
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 07/19] defconfig: am437x_sk_evm: enable timer driver model
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (5 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 06/19] arm: dts: am437x-sk-evm: add tick-timer to chosen node Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 08/19] arm: dts: am437x-gp-evm: add tick-timer to chosen node Mugunthan V N
                   ` (11 subsequent siblings)
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Enable timer driver model for am437x_sk_evm as omap-timer supports
driver model.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 configs/am437x_sk_evm_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am437x_sk_evm_defconfig b/configs/am437x_sk_evm_defconfig
index a9b6f52..56a7b11 100644
--- a/configs/am437x_sk_evm_defconfig
+++ b/configs/am437x_sk_evm_defconfig
@@ -18,3 +18,5 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SYS_NS16550=y
 CONFIG_TI_QSPI=y
+CONFIG_TIMER=y
+CONFIG_OMAP_TIMER=y
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 08/19] arm: dts: am437x-gp-evm: add tick-timer to chosen node
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (6 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 07/19] defconfig: am437x_sk_evm: enable timer driver model Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 09/19] defconfig: am437x_gp_evm: enable timer driver model Mugunthan V N
                   ` (10 subsequent siblings)
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Specify which timer to be used as tick-timer in chosen node.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 arch/arm/dts/am437x-gp-evm.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/am437x-gp-evm.dts b/arch/arm/dts/am437x-gp-evm.dts
index b5f0b4e..8e23b96 100644
--- a/arch/arm/dts/am437x-gp-evm.dts
+++ b/arch/arm/dts/am437x-gp-evm.dts
@@ -26,6 +26,7 @@
 
 	chosen {
 		stdout-path = &uart0;
+		tick-timer = &timer2;
 	};
 
 	vmmcsd_fixed: fixedregulator-sd {
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 09/19] defconfig: am437x_gp_evm: enable timer driver model
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (7 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 08/19] arm: dts: am437x-gp-evm: add tick-timer to chosen node Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 10/19] am335x_evm: timer: do not define CONFIG_TIMER for spl Mugunthan V N
                   ` (9 subsequent siblings)
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Enable timer driver model for am437x_gp_evm as omap-timer supports
driver model.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 configs/am437x_gp_evm_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am437x_gp_evm_defconfig b/configs/am437x_gp_evm_defconfig
index 7155c98..1d79ba19 100644
--- a/configs/am437x_gp_evm_defconfig
+++ b/configs/am437x_gp_evm_defconfig
@@ -18,3 +18,5 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SYS_NS16550=y
 CONFIG_TI_QSPI=y
+CONFIG_TIMER=y
+CONFIG_OMAP_TIMER=y
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 10/19] am335x_evm: timer: do not define CONFIG_TIMER for spl
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (8 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 09/19] defconfig: am437x_gp_evm: enable timer driver model Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 11/19] arm: dts: am335x-boneblack: add tick-timer to chosen node Mugunthan V N
                   ` (8 subsequent siblings)
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Since OMAP's spl doesn't support DM currently, do not define
CONFIG_TIMER for spl build.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 include/configs/am335x_evm.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index c51db8c..d93fdf1 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -361,6 +361,7 @@
  */
 #ifdef CONFIG_SPL_BUILD
 #undef CONFIG_DM_MMC
+#undef CONFIG_TIMER
 #endif
 
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT)
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 11/19] arm: dts: am335x-boneblack: add tick-timer to chosen node
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (9 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 10/19] am335x_evm: timer: do not define CONFIG_TIMER for spl Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 12/19] defconfig: am335x_boneblack_vboot: enable timer driver model Mugunthan V N
                   ` (7 subsequent siblings)
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Specify which timer to be used as tick-timer in chosen node.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 arch/arm/dts/am335x-boneblack.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/am335x-boneblack.dts b/arch/arm/dts/am335x-boneblack.dts
index 679248a..27ebe4a 100644
--- a/arch/arm/dts/am335x-boneblack.dts
+++ b/arch/arm/dts/am335x-boneblack.dts
@@ -15,6 +15,7 @@
 	compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
 	chosen {
 		stdout-path = &uart0;
+		tick-timer = &timer2;
 	};
 };
 
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 12/19] defconfig: am335x_boneblack_vboot: enable timer driver model
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (10 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 11/19] arm: dts: am335x-boneblack: add tick-timer to chosen node Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 13/19] arm: dts: am335x-evm: add tick-timer to chosen node Mugunthan V N
                   ` (6 subsequent siblings)
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Enable timer driver model for am335x_boneblack_vboot as
omap-timer supports driver model.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 configs/am335x_boneblack_vboot_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am335x_boneblack_vboot_defconfig b/configs/am335x_boneblack_vboot_defconfig
index ad40b07..888d5b1 100644
--- a/configs/am335x_boneblack_vboot_defconfig
+++ b/configs/am335x_boneblack_vboot_defconfig
@@ -18,3 +18,5 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
 CONFIG_SYS_NS16550=y
+CONFIG_TIMER=y
+CONFIG_OMAP_TIMER=y
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 13/19] arm: dts: am335x-evm: add tick-timer to chosen node
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (11 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 12/19] defconfig: am335x_boneblack_vboot: enable timer driver model Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 14/19] defconfig: am335x_gp_evm: enable timer driver model Mugunthan V N
                   ` (5 subsequent siblings)
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Specify timer2 to be used as tick-timer in chosen node.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 arch/arm/dts/am335x-evm.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/am335x-evm.dts b/arch/arm/dts/am335x-evm.dts
index e1c5d4f..c0bc2af 100644
--- a/arch/arm/dts/am335x-evm.dts
+++ b/arch/arm/dts/am335x-evm.dts
@@ -16,6 +16,7 @@
 
 	chosen {
 		stdout-path = &uart0;
+		tick-timer = &timer2;
 	};
 
 	cpus {
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 14/19] defconfig: am335x_gp_evm: enable timer driver model
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (12 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 13/19] arm: dts: am335x-evm: add tick-timer to chosen node Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 15/19] ti_omap5_common: timer: do not define CONFIG_TIMER for spl Mugunthan V N
                   ` (4 subsequent siblings)
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Enable timer driver model for am335x_gp_evm as omap-timer supports
driver model.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 configs/am335x_gp_evm_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am335x_gp_evm_defconfig b/configs/am335x_gp_evm_defconfig
index 74d9ffb..49461e2 100644
--- a/configs/am335x_gp_evm_defconfig
+++ b/configs/am335x_gp_evm_defconfig
@@ -16,3 +16,5 @@ CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
 CONFIG_SYS_NS16550=y
 CONFIG_RSA=y
+CONFIG_TIMER=y
+CONFIG_OMAP_TIMER=y
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 15/19] ti_omap5_common: timer: do not define CONFIG_TIMER for spl
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (13 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 14/19] defconfig: am335x_gp_evm: enable timer driver model Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 16/19] arm: dts: dra72-evm: add tick-timer to chosen node Mugunthan V N
                   ` (3 subsequent siblings)
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Since OMAP's spl doesn't support DM currently, do not define
CONFIG_TIMER for spl build.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 include/configs/ti_omap5_common.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h
index 2d492f8..d164e6a 100644
--- a/include/configs/ti_omap5_common.h
+++ b/include/configs/ti_omap5_common.h
@@ -164,6 +164,7 @@
  */
 #ifdef CONFIG_SPL_BUILD
 #undef CONFIG_DM_MMC
+#undef CONFIG_TIMER
 #endif
 
 #endif /* __CONFIG_TI_OMAP5_COMMON_H */
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 16/19] arm: dts: dra72-evm: add tick-timer to chosen node
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (14 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 15/19] ti_omap5_common: timer: do not define CONFIG_TIMER for spl Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 17/19] defconfig: dra72_evm: enable timer driver model Mugunthan V N
                   ` (2 subsequent siblings)
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Specify timer2 to be used as tick-timer in chosen node.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 arch/arm/dts/dra72-evm.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/dra72-evm.dts b/arch/arm/dts/dra72-evm.dts
index efb544c..6e3bbfd 100644
--- a/arch/arm/dts/dra72-evm.dts
+++ b/arch/arm/dts/dra72-evm.dts
@@ -16,6 +16,7 @@
 
 	chosen {
 		stdout-path = &uart1;
+		tick-timer = &timer2;
 	};
 
 	memory {
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 17/19] defconfig: dra72_evm: enable timer driver model
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (15 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 16/19] arm: dts: dra72-evm: add tick-timer to chosen node Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 18/19] arm: dts: dra7-evm: add tick-timer to chosen node Mugunthan V N
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 19/19] defconfig: dra74_evm: enable timer driver model Mugunthan V N
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Enable timer driver model for dra72_evm_defconfig as omap-timer
supports driver model.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 configs/dra72_evm_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/dra72_evm_defconfig b/configs/dra72_evm_defconfig
index 3205bd5..530a25e 100644
--- a/configs/dra72_evm_defconfig
+++ b/configs/dra72_evm_defconfig
@@ -20,3 +20,5 @@ CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SYS_NS16550=y
 CONFIG_TI_QSPI=y
+CONFIG_TIMER=y
+CONFIG_OMAP_TIMER=y
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 18/19] arm: dts: dra7-evm: add tick-timer to chosen node
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (16 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 17/19] defconfig: dra72_evm: enable timer driver model Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:59   ` Tom Rini
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 19/19] defconfig: dra74_evm: enable timer driver model Mugunthan V N
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Specify timer2 to be used as tick-timer in chosen node.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 arch/arm/dts/dra7-evm.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/dra7-evm.dts b/arch/arm/dts/dra7-evm.dts
index e4daa99..2568aad 100644
--- a/arch/arm/dts/dra7-evm.dts
+++ b/arch/arm/dts/dra7-evm.dts
@@ -16,6 +16,7 @@
 
 	chosen {
 		stdout-path = &uart1;
+		tick-timer = &timer2;
 	};
 
 	memory {
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 19/19] defconfig: dra74_evm: enable timer driver model
  2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
                   ` (17 preceding siblings ...)
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 18/19] arm: dts: dra7-evm: add tick-timer to chosen node Mugunthan V N
@ 2015-12-24 10:38 ` Mugunthan V N
  2016-01-04 19:59   ` Tom Rini
  18 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-24 10:38 UTC (permalink / raw)
  To: u-boot

Enable timer driver model for dra74_evm_defconfig as omap-timer
supports driver model.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 configs/dra74_evm_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/dra74_evm_defconfig b/configs/dra74_evm_defconfig
index 394edbe..a68870e 100644
--- a/configs/dra74_evm_defconfig
+++ b/configs/dra74_evm_defconfig
@@ -19,3 +19,5 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_TI_QSPI=y
+CONFIG_TIMER=y
+CONFIG_OMAP_TIMER=y
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v2 02/19] dm: timer: uclass: add timer init to add timer device
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 02/19] dm: timer: uclass: add timer init to add timer device Mugunthan V N
@ 2015-12-25  2:10   ` Bin Meng
  2015-12-25  7:08     ` Mugunthan V N
  2015-12-25 10:41   ` [U-Boot] [PATCH v3 " Mugunthan V N
  1 sibling, 1 reply; 68+ messages in thread
From: Bin Meng @ 2015-12-25  2:10 UTC (permalink / raw)
  To: u-boot

Hi Mugunthan,

On Thu, Dec 24, 2015 at 6:38 PM, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> Adding timer_init function to create and initialize the timer
> device on platforms where u-boot,dm-pre-reloc is not used. Since
> there will be multiple timer devices in the system, adding a
> tick-timer node in chosen node to know which timer device to be
> used as tick timer in u-boot.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> ---
>  doc/device-tree-bindings/chosen.txt | 43 +++++++++++++++++++++++++++++++++++++
>  drivers/timer/timer-uclass.c        | 42 ++++++++++++++++++++++++++++++++++++
>  lib/time.c                          | 13 ++---------
>  3 files changed, 87 insertions(+), 11 deletions(-)
>  create mode 100644 doc/device-tree-bindings/chosen.txt
>
> diff --git a/doc/device-tree-bindings/chosen.txt b/doc/device-tree-bindings/chosen.txt
> new file mode 100644
> index 0000000..bf9a30a
> --- /dev/null
> +++ b/doc/device-tree-bindings/chosen.txt
> @@ -0,0 +1,43 @@
> +The chosen node
> +---------------
> +The chosen node does not represent a real device, but serves as a place
> +for passing data like which serial device to used to print the logs etc
> +
> +
> +stdout-path property
> +--------------------
> +Device trees may specify the device to be used for boot console output
> +with a stdout-path property under /chosen.
> +
> +Example
> +-------
> +/ {
> +       chosen {
> +               stdout-path = "/serial at f00:115200";
> +       };
> +
> +       serial at f00 {
> +               compatible = "vendor,some-uart";
> +               reg = <0xf00 0x10>;
> +       };
> +};
> +
> +tick-timer property
> +-------------------
> +In a system there are multiple timers, specify which timer to be used
> +as the tick-timer. Earlier it was hardcoded in the timer driver now
> +since device tree has all the timer nodes. Specify which timer to be
> +used as tick timer.
> +
> +Example
> +-------
> +/ {
> +       chosen {
> +               tick-timer = "/timer2 at f00";
> +       };
> +
> +       timer2 at f00 {
> +               compatible = "vendor,some-timer";
> +               reg = <0xf00 0x10>;
> +       };
> +};
> diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
> index aca421b..db43611 100644
> --- a/drivers/timer/timer-uclass.c
> +++ b/drivers/timer/timer-uclass.c
> @@ -6,6 +6,8 @@
>
>  #include <common.h>
>  #include <dm.h>
> +#include <dm/lists.h>
> +#include <dm/device-internal.h>
>  #include <errno.h>
>  #include <timer.h>
>
> @@ -56,6 +58,46 @@ u64 timer_conv_64(u32 count)
>         return ((u64)gd->timebase_h << 32) | gd->timebase_l;
>  }
>
> +int timer_init(void)
> +{
> +       const void *blob = gd->fdt_blob;
> +       struct udevice *dev;
> +       int node;
> +       int ret;
> +
> +       /* Check for a chosen timer to be used for tick */
> +       node = fdtdec_get_chosen_node(blob, "tick-timer");
> +       if (node < 0)
> +               return -ENODEV;

This changes now require every device tree provide a "tick-timer"
under /chosen, which break all the existing dm timer enabled boards,
and is not necessary.

We should do:

    if (node < 0) {
        ret = uclass_first_device(UCLASS_TIMER, &dev);
        if (ret)
            return ret;
        if (!dev)
            return -ENODEV;
        gd->timer = dev;
    } 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, blob, node, &dev)) {
> +                       int ret = device_probe(dev);
> +                       if (ret)
> +                               return ret;
> +               }
> +       }
> +
> +       if (dev) {
> +               gd->timer = dev;
> +               return 0;
> +       }
> +
> +       ret = uclass_first_device(UCLASS_TIMER, &dev);
> +       if (ret)
> +               return ret;
> +       if (!dev)
> +               return -ENODEV;
> +
> +       gd->timer = dev;
> +       return 0;
> +}
> +
>  UCLASS_DRIVER(timer) = {
>         .id             = UCLASS_TIMER,
>         .name           = "timer",
> diff --git a/lib/time.c b/lib/time.c
> index f37a662..d4060f1 100644
> --- a/lib/time.c
> +++ b/lib/time.c
> @@ -43,17 +43,8 @@ extern unsigned long __weak timer_read_counter(void);
>  #ifdef CONFIG_TIMER
>  static int notrace dm_timer_init(void)
>  {
> -       struct udevice *dev;
> -       int ret;
> -
> -       if (!gd->timer) {
> -               ret = uclass_first_device(UCLASS_TIMER, &dev);
> -               if (ret)
> -                       return ret;
> -               if (!dev)
> -                       return -ENODEV;
> -               gd->timer = dev;
> -       }
> +       if (!gd->timer)
> +               return timer_init();

Looks timer_init() is only called in timer-uclass.c, should we declare
it as static? Otherwise timer_init() will be called in either
board_f.c or board_r.c on different architectures. This causes timer
devices to be probed twice. We may just simply move all codes in
timer_init() into dm_timer_init().

>
>         return 0;
>  }
> --

Regards,
Bin

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

* [U-Boot] [PATCH v2 02/19] dm: timer: uclass: add timer init to add timer device
  2015-12-25  2:10   ` Bin Meng
@ 2015-12-25  7:08     ` Mugunthan V N
  0 siblings, 0 replies; 68+ messages in thread
From: Mugunthan V N @ 2015-12-25  7:08 UTC (permalink / raw)
  To: u-boot

On Friday 25 December 2015 07:40 AM, Bin Meng wrote:
>> +       /* Check for a chosen timer to be used for tick */
>> > +       node = fdtdec_get_chosen_node(blob, "tick-timer");
>> > +       if (node < 0)
>> > +               return -ENODEV;
> This changes now require every device tree provide a "tick-timer"
> under /chosen, which break all the existing dm timer enabled boards,
> and is not necessary.
> 
> We should do:
> 
>     if (node < 0) {
>         ret = uclass_first_device(UCLASS_TIMER, &dev);
>         if (ret)
>             return ret;
>         if (!dev)
>             return -ENODEV;
>         gd->timer = dev;
>     } else {
>     ....
>     }
> 

Oops!, will fix it in next version.

Regards
Mugunthan V N

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

* [U-Boot] [PATCH v3 02/19] dm: timer: uclass: add timer init to add timer device
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 02/19] dm: timer: uclass: add timer init to add timer device Mugunthan V N
  2015-12-25  2:10   ` Bin Meng
@ 2015-12-25 10:41   ` Mugunthan V N
  2015-12-25 12:13     ` Bin Meng
  2016-01-16 16:03     ` [U-Boot] [PATCH v4 02/19] dm: timer: uclass: add timer init in uclass driver " Mugunthan V N
  1 sibling, 2 replies; 68+ messages in thread
From: Mugunthan V N @ 2015-12-25 10:41 UTC (permalink / raw)
  To: u-boot

Adding timer_init function to create and initialize the timer
device on platforms where u-boot,dm-pre-reloc is not used. Since
there will be multiple timer devices in the system, adding a
tick-timer node in chosen node to know which timer device to be
used as tick timer in u-boot.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---

Submitting 02/19 only for v3 as there is no change on other
patches and to reduce traffic.

This patch is verified on AM437x SK and DRA74 EVM logs [1] and
pushed a branch for testing

[1] - http://pastebin.ubuntu.com/14205433/
[2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-timer-v3

Changes from v2->v3:
* Fixed issue which is in v2 that if no chosen timer node is
  present in DT then timer init always fails without trying
  first available timer.

---
 doc/device-tree-bindings/chosen.txt | 43 +++++++++++++++++++++++++++++++++++++
 drivers/timer/timer-uclass.c        | 41 +++++++++++++++++++++++++++++++++++
 lib/time.c                          | 13 ++---------
 3 files changed, 86 insertions(+), 11 deletions(-)
 create mode 100644 doc/device-tree-bindings/chosen.txt

diff --git a/doc/device-tree-bindings/chosen.txt b/doc/device-tree-bindings/chosen.txt
new file mode 100644
index 0000000..bf9a30a
--- /dev/null
+++ b/doc/device-tree-bindings/chosen.txt
@@ -0,0 +1,43 @@
+The chosen node
+---------------
+The chosen node does not represent a real device, but serves as a place
+for passing data like which serial device to used to print the logs etc
+
+
+stdout-path property
+--------------------
+Device trees may specify the device to be used for boot console output
+with a stdout-path property under /chosen.
+
+Example
+-------
+/ {
+	chosen {
+		stdout-path = "/serial at f00:115200";
+	};
+
+	serial at f00 {
+		compatible = "vendor,some-uart";
+		reg = <0xf00 0x10>;
+	};
+};
+
+tick-timer property
+-------------------
+In a system there are multiple timers, specify which timer to be used
+as the tick-timer. Earlier it was hardcoded in the timer driver now
+since device tree has all the timer nodes. Specify which timer to be
+used as tick timer.
+
+Example
+-------
+/ {
+	chosen {
+		tick-timer = "/timer2 at f00";
+	};
+
+	timer2 at f00 {
+		compatible = "vendor,some-timer";
+		reg = <0xf00 0x10>;
+	};
+};
diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
index aca421b..b6699f2 100644
--- a/drivers/timer/timer-uclass.c
+++ b/drivers/timer/timer-uclass.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <dm/lists.h>
+#include <dm/device-internal.h>
 #include <errno.h>
 #include <timer.h>
 
@@ -56,6 +58,45 @@ u64 timer_conv_64(u32 count)
 	return ((u64)gd->timebase_h << 32) | gd->timebase_l;
 }
 
+int timer_init(void)
+{
+	const void *blob = gd->fdt_blob;
+	struct udevice *dev = NULL;
+	int node;
+	int ret;
+
+	/* Check for a chosen timer to be used for tick */
+	node = fdtdec_get_chosen_node(blob, "tick-timer");
+	if (node < 0) {
+		/* No chosen timer, trying first available timer */
+		ret = uclass_first_device(UCLASS_TIMER, &dev);
+		if (ret)
+			return ret;
+		if (!dev)
+			return -ENODEV;
+	} 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, blob, node, &dev)) {
+				int ret = device_probe(dev);
+				if (ret)
+					return ret;
+			}
+		}
+	}
+
+	if (dev) {
+		gd->timer = dev;
+		return 0;
+	}
+
+	return -ENODEV;
+}
+
 UCLASS_DRIVER(timer) = {
 	.id		= UCLASS_TIMER,
 	.name		= "timer",
diff --git a/lib/time.c b/lib/time.c
index f37a662..d4060f1 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -43,17 +43,8 @@ extern unsigned long __weak timer_read_counter(void);
 #ifdef CONFIG_TIMER
 static int notrace dm_timer_init(void)
 {
-	struct udevice *dev;
-	int ret;
-
-	if (!gd->timer) {
-		ret = uclass_first_device(UCLASS_TIMER, &dev);
-		if (ret)
-			return ret;
-		if (!dev)
-			return -ENODEV;
-		gd->timer = dev;
-	}
+	if (!gd->timer)
+		return timer_init();
 
 	return 0;
 }
-- 
2.7.0.rc1.5.gf3adf45

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

* [U-Boot] [PATCH v3 02/19] dm: timer: uclass: add timer init to add timer device
  2015-12-25 10:41   ` [U-Boot] [PATCH v3 " Mugunthan V N
@ 2015-12-25 12:13     ` Bin Meng
  2015-12-25 13:08       ` Mugunthan V N
  2016-01-16 16:03     ` [U-Boot] [PATCH v4 02/19] dm: timer: uclass: add timer init in uclass driver " Mugunthan V N
  1 sibling, 1 reply; 68+ messages in thread
From: Bin Meng @ 2015-12-25 12:13 UTC (permalink / raw)
  To: u-boot

Hi Mugunthan,

On Fri, Dec 25, 2015 at 6:41 PM, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> Adding timer_init function to create and initialize the timer
> device on platforms where u-boot,dm-pre-reloc is not used. Since
> there will be multiple timer devices in the system, adding a
> tick-timer node in chosen node to know which timer device to be
> used as tick timer in u-boot.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> ---
>
> Submitting 02/19 only for v3 as there is no change on other
> patches and to reduce traffic.
>
> This patch is verified on AM437x SK and DRA74 EVM logs [1] and
> pushed a branch for testing
>
> [1] - http://pastebin.ubuntu.com/14205433/
> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-timer-v3
>
> Changes from v2->v3:
> * Fixed issue which is in v2 that if no chosen timer node is
>   present in DT then timer init always fails without trying
>   first available timer.
>
> ---
>  doc/device-tree-bindings/chosen.txt | 43 +++++++++++++++++++++++++++++++++++++
>  drivers/timer/timer-uclass.c        | 41 +++++++++++++++++++++++++++++++++++
>  lib/time.c                          | 13 ++---------
>  3 files changed, 86 insertions(+), 11 deletions(-)
>  create mode 100644 doc/device-tree-bindings/chosen.txt
>
> diff --git a/doc/device-tree-bindings/chosen.txt b/doc/device-tree-bindings/chosen.txt
> new file mode 100644
> index 0000000..bf9a30a
> --- /dev/null
> +++ b/doc/device-tree-bindings/chosen.txt
> @@ -0,0 +1,43 @@
> +The chosen node
> +---------------
> +The chosen node does not represent a real device, but serves as a place
> +for passing data like which serial device to used to print the logs etc
> +
> +
> +stdout-path property
> +--------------------
> +Device trees may specify the device to be used for boot console output
> +with a stdout-path property under /chosen.
> +
> +Example
> +-------
> +/ {
> +       chosen {
> +               stdout-path = "/serial at f00:115200";
> +       };
> +
> +       serial at f00 {
> +               compatible = "vendor,some-uart";
> +               reg = <0xf00 0x10>;
> +       };
> +};
> +
> +tick-timer property
> +-------------------
> +In a system there are multiple timers, specify which timer to be used
> +as the tick-timer. Earlier it was hardcoded in the timer driver now
> +since device tree has all the timer nodes. Specify which timer to be
> +used as tick timer.
> +
> +Example
> +-------
> +/ {
> +       chosen {
> +               tick-timer = "/timer2 at f00";
> +       };
> +
> +       timer2 at f00 {
> +               compatible = "vendor,some-timer";
> +               reg = <0xf00 0x10>;
> +       };
> +};
> diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
> index aca421b..b6699f2 100644
> --- a/drivers/timer/timer-uclass.c
> +++ b/drivers/timer/timer-uclass.c
> @@ -6,6 +6,8 @@
>
>  #include <common.h>
>  #include <dm.h>
> +#include <dm/lists.h>
> +#include <dm/device-internal.h>
>  #include <errno.h>
>  #include <timer.h>
>
> @@ -56,6 +58,45 @@ u64 timer_conv_64(u32 count)
>         return ((u64)gd->timebase_h << 32) | gd->timebase_l;
>  }
>
> +int timer_init(void)
> +{
> +       const void *blob = gd->fdt_blob;
> +       struct udevice *dev = NULL;
> +       int node;
> +       int ret;
> +
> +       /* Check for a chosen timer to be used for tick */
> +       node = fdtdec_get_chosen_node(blob, "tick-timer");
> +       if (node < 0) {
> +               /* No chosen timer, trying first available timer */
> +               ret = uclass_first_device(UCLASS_TIMER, &dev);
> +               if (ret)
> +                       return ret;
> +               if (!dev)
> +                       return -ENODEV;

Thanks for the quick v3!

> +       } 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, blob, node, &dev)) {
> +                               int ret = device_probe(dev);

nits: no need to declare another ret. Just "ret = device_probe(dev)".

> +                               if (ret)
> +                                       return ret;
> +                       }
> +               }
> +       }
> +
> +       if (dev) {
> +               gd->timer = dev;
> +               return 0;
> +       }
> +
> +       return -ENODEV;
> +}
> +
>  UCLASS_DRIVER(timer) = {
>         .id             = UCLASS_TIMER,
>         .name           = "timer",
> diff --git a/lib/time.c b/lib/time.c
> index f37a662..d4060f1 100644
> --- a/lib/time.c
> +++ b/lib/time.c
> @@ -43,17 +43,8 @@ extern unsigned long __weak timer_read_counter(void);
>  #ifdef CONFIG_TIMER
>  static int notrace dm_timer_init(void)
>  {
> -       struct udevice *dev;
> -       int ret;
> -
> -       if (!gd->timer) {
> -               ret = uclass_first_device(UCLASS_TIMER, &dev);
> -               if (ret)
> -                       return ret;
> -               if (!dev)
> -                       return -ENODEV;
> -               gd->timer = dev;
> -       }
> +       if (!gd->timer)
> +               return timer_init();

What about my comments in v2, that make timer_init() static or just
move codes in timer_init() into this dm_timer_init()?

>
>         return 0;
>  }
> --

Regards,
Bin

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

* [U-Boot] [PATCH v3 02/19] dm: timer: uclass: add timer init to add timer device
  2015-12-25 12:13     ` Bin Meng
@ 2015-12-25 13:08       ` Mugunthan V N
  2016-01-16  1:20         ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2015-12-25 13:08 UTC (permalink / raw)
  To: u-boot

On Friday 25 December 2015 05:43 PM, Bin Meng wrote:
> Hi Mugunthan,
> 
> On Fri, Dec 25, 2015 at 6:41 PM, Mugunthan V N <mugunthanvnm@ti.com> wrote:
>> Adding timer_init function to create and initialize the timer
>> device on platforms where u-boot,dm-pre-reloc is not used. Since
>> there will be multiple timer devices in the system, adding a
>> tick-timer node in chosen node to know which timer device to be
>> used as tick timer in u-boot.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>> ---
>>
>> Submitting 02/19 only for v3 as there is no change on other
>> patches and to reduce traffic.
>>
>> This patch is verified on AM437x SK and DRA74 EVM logs [1] and
>> pushed a branch for testing
>>
>> [1] - http://pastebin.ubuntu.com/14205433/
>> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-timer-v3
>>
>> Changes from v2->v3:
>> * Fixed issue which is in v2 that if no chosen timer node is
>>   present in DT then timer init always fails without trying
>>   first available timer.
>>
>> ---
>>  doc/device-tree-bindings/chosen.txt | 43 +++++++++++++++++++++++++++++++++++++
>>  drivers/timer/timer-uclass.c        | 41 +++++++++++++++++++++++++++++++++++
>>  lib/time.c                          | 13 ++---------
>>  3 files changed, 86 insertions(+), 11 deletions(-)
>>  create mode 100644 doc/device-tree-bindings/chosen.txt
>>
>> diff --git a/doc/device-tree-bindings/chosen.txt b/doc/device-tree-bindings/chosen.txt
>> new file mode 100644
>> index 0000000..bf9a30a
>> --- /dev/null
>> +++ b/doc/device-tree-bindings/chosen.txt
>> @@ -0,0 +1,43 @@
>> +The chosen node
>> +---------------
>> +The chosen node does not represent a real device, but serves as a place
>> +for passing data like which serial device to used to print the logs etc
>> +
>> +
>> +stdout-path property
>> +--------------------
>> +Device trees may specify the device to be used for boot console output
>> +with a stdout-path property under /chosen.
>> +
>> +Example
>> +-------
>> +/ {
>> +       chosen {
>> +               stdout-path = "/serial at f00:115200";
>> +       };
>> +
>> +       serial at f00 {
>> +               compatible = "vendor,some-uart";
>> +               reg = <0xf00 0x10>;
>> +       };
>> +};
>> +
>> +tick-timer property
>> +-------------------
>> +In a system there are multiple timers, specify which timer to be used
>> +as the tick-timer. Earlier it was hardcoded in the timer driver now
>> +since device tree has all the timer nodes. Specify which timer to be
>> +used as tick timer.
>> +
>> +Example
>> +-------
>> +/ {
>> +       chosen {
>> +               tick-timer = "/timer2 at f00";
>> +       };
>> +
>> +       timer2 at f00 {
>> +               compatible = "vendor,some-timer";
>> +               reg = <0xf00 0x10>;
>> +       };
>> +};
>> diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
>> index aca421b..b6699f2 100644
>> --- a/drivers/timer/timer-uclass.c
>> +++ b/drivers/timer/timer-uclass.c
>> @@ -6,6 +6,8 @@
>>
>>  #include <common.h>
>>  #include <dm.h>
>> +#include <dm/lists.h>
>> +#include <dm/device-internal.h>
>>  #include <errno.h>
>>  #include <timer.h>
>>
>> @@ -56,6 +58,45 @@ u64 timer_conv_64(u32 count)
>>         return ((u64)gd->timebase_h << 32) | gd->timebase_l;
>>  }
>>
>> +int timer_init(void)
>> +{
>> +       const void *blob = gd->fdt_blob;
>> +       struct udevice *dev = NULL;
>> +       int node;
>> +       int ret;
>> +
>> +       /* Check for a chosen timer to be used for tick */
>> +       node = fdtdec_get_chosen_node(blob, "tick-timer");
>> +       if (node < 0) {
>> +               /* No chosen timer, trying first available timer */
>> +               ret = uclass_first_device(UCLASS_TIMER, &dev);
>> +               if (ret)
>> +                       return ret;
>> +               if (!dev)
>> +                       return -ENODEV;
> 
> Thanks for the quick v3!
> 
>> +       } 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, blob, node, &dev)) {
>> +                               int ret = device_probe(dev);
> 
> nits: no need to declare another ret. Just "ret = device_probe(dev)".

Hmmm, yep not needed.

> 
>> +                               if (ret)
>> +                                       return ret;
>> +                       }
>> +               }
>> +       }
>> +
>> +       if (dev) {
>> +               gd->timer = dev;
>> +               return 0;
>> +       }
>> +
>> +       return -ENODEV;
>> +}
>> +
>>  UCLASS_DRIVER(timer) = {
>>         .id             = UCLASS_TIMER,
>>         .name           = "timer",
>> diff --git a/lib/time.c b/lib/time.c
>> index f37a662..d4060f1 100644
>> --- a/lib/time.c
>> +++ b/lib/time.c
>> @@ -43,17 +43,8 @@ extern unsigned long __weak timer_read_counter(void);
>>  #ifdef CONFIG_TIMER
>>  static int notrace dm_timer_init(void)
>>  {
>> -       struct udevice *dev;
>> -       int ret;
>> -
>> -       if (!gd->timer) {
>> -               ret = uclass_first_device(UCLASS_TIMER, &dev);
>> -               if (ret)
>> -                       return ret;
>> -               if (!dev)
>> -                       return -ENODEV;
>> -               gd->timer = dev;
>> -       }
>> +       if (!gd->timer)
>> +               return timer_init();
> 
> What about my comments in v2, that make timer_init() static or just
> move codes in timer_init() into this dm_timer_init()?

Oops, missed :)

The timer_init() code can be moved to dm_timer_init(), but since it
provides timer uclass functionality I kept the code in timer-uclass driver.

Now since dm_timer_init() doesn't have any thing other than calling
timer_init, I will move the dm_timer_init() to timer_uclass and move
timer_init code to it.

Regards
Mugunthan V N

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

* [U-Boot] [PATCH v2 01/19] arm: omap-common: do not build timer when CONFIG_TIMER defined
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 01/19] arm: omap-common: do not build timer when CONFIG_TIMER defined Mugunthan V N
@ 2016-01-04 19:57   ` Tom Rini
  2016-01-16  1:20     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:57 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:04PM +0530, Mugunthan V N wrote:

> To prepare timer driver to DM/DT conversion do not build the
> exiting timer driver when CONFIG_TIMER is defined. But since
> omap's SPL doesn't support DM yet so built timer driver only for
> SPL build when CONFIG_TIMER is defined.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 03/19] dm: timer: uclass: Add flag to control sequence numbering
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 03/19] dm: timer: uclass: Add flag to control sequence numbering Mugunthan V N
@ 2016-01-04 19:57   ` Tom Rini
  2016-01-06  0:25   ` Simon Glass
  1 sibling, 0 replies; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:57 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:06PM +0530, Mugunthan V N wrote:

> Like SPI and I2C, timer devices also have multiple chip
> instances. This patch adds the flag 'DM_UC_FLAG_SEQ_ALIAS' in
> timer_uclass driver to control device sequence numbering.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 04/19] drivers: timer: omap_timer: add timer driver for omap devices based on dm
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 04/19] drivers: timer: omap_timer: add timer driver for omap devices based on dm Mugunthan V N
@ 2016-01-04 19:57   ` Tom Rini
  2016-01-16  1:21   ` Simon Glass
  1 sibling, 0 replies; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:57 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:07PM +0530, Mugunthan V N wrote:

> Adding a timer driver for omap devices based on driver model
> and device tree.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
[snip]
> +static const struct udevice_id omap_timer_ids[] = {
> +	{ .compatible = "ti,am335x-timer" },
> +	{ .compatible = "ti,am4372-timer" },
> +	{ .compatible = "ti,omap5430-timer" },
> +	{}
> +};

This is the same IP block that's been used "forever" yes?  Can we add in
the compatibles for omap3 (and ti81xx?) as well so it will just work as
those get brought over as well?

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

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

* [U-Boot] [PATCH v2 05/19] am43xx_evm: timer: do not define CONFIG_TIMER for spl
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 05/19] am43xx_evm: timer: do not define CONFIG_TIMER for spl Mugunthan V N
@ 2016-01-04 19:57   ` Tom Rini
  2016-01-16  1:21   ` Simon Glass
  1 sibling, 0 replies; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:57 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:08PM +0530, Mugunthan V N wrote:

> Since OMAP's spl doesn't support DM currently, do not define
> CONFIG_TIMER for spl build.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 06/19] arm: dts: am437x-sk-evm: add tick-timer to chosen node
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 06/19] arm: dts: am437x-sk-evm: add tick-timer to chosen node Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22   ` Simon Glass
  1 sibling, 0 replies; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:09PM +0530, Mugunthan V N wrote:

> Specify which timer to be used as tick-timer in chosen node.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 07/19] defconfig: am437x_sk_evm: enable timer driver model
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 07/19] defconfig: am437x_sk_evm: enable timer driver model Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:10PM +0530, Mugunthan V N wrote:

> Enable timer driver model for am437x_sk_evm as omap-timer supports
> driver model.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 08/19] arm: dts: am437x-gp-evm: add tick-timer to chosen node
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 08/19] arm: dts: am437x-gp-evm: add tick-timer to chosen node Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:11PM +0530, Mugunthan V N wrote:

> Specify which timer to be used as tick-timer in chosen node.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 09/19] defconfig: am437x_gp_evm: enable timer driver model
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 09/19] defconfig: am437x_gp_evm: enable timer driver model Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:12PM +0530, Mugunthan V N wrote:

> Enable timer driver model for am437x_gp_evm as omap-timer supports
> driver model.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 10/19] am335x_evm: timer: do not define CONFIG_TIMER for spl
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 10/19] am335x_evm: timer: do not define CONFIG_TIMER for spl Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:13PM +0530, Mugunthan V N wrote:

> Since OMAP's spl doesn't support DM currently, do not define
> CONFIG_TIMER for spl build.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 11/19] arm: dts: am335x-boneblack: add tick-timer to chosen node
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 11/19] arm: dts: am335x-boneblack: add tick-timer to chosen node Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:14PM +0530, Mugunthan V N wrote:

> Specify which timer to be used as tick-timer in chosen node.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 12/19] defconfig: am335x_boneblack_vboot: enable timer driver model
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 12/19] defconfig: am335x_boneblack_vboot: enable timer driver model Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:15PM +0530, Mugunthan V N wrote:

> Enable timer driver model for am335x_boneblack_vboot as
> omap-timer supports driver model.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 13/19] arm: dts: am335x-evm: add tick-timer to chosen node
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 13/19] arm: dts: am335x-evm: add tick-timer to chosen node Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:16PM +0530, Mugunthan V N wrote:

> Specify timer2 to be used as tick-timer in chosen node.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 14/19] defconfig: am335x_gp_evm: enable timer driver model
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 14/19] defconfig: am335x_gp_evm: enable timer driver model Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:17PM +0530, Mugunthan V N wrote:

> Enable timer driver model for am335x_gp_evm as omap-timer supports
> driver model.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 15/19] ti_omap5_common: timer: do not define CONFIG_TIMER for spl
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 15/19] ti_omap5_common: timer: do not define CONFIG_TIMER for spl Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:18PM +0530, Mugunthan V N wrote:

> Since OMAP's spl doesn't support DM currently, do not define
> CONFIG_TIMER for spl build.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 16/19] arm: dts: dra72-evm: add tick-timer to chosen node
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 16/19] arm: dts: dra72-evm: add tick-timer to chosen node Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:19PM +0530, Mugunthan V N wrote:

> Specify timer2 to be used as tick-timer in chosen node.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 17/19] defconfig: dra72_evm: enable timer driver model
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 17/19] defconfig: dra72_evm: enable timer driver model Mugunthan V N
@ 2016-01-04 19:58   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:58 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:20PM +0530, Mugunthan V N wrote:

> Enable timer driver model for dra72_evm_defconfig as omap-timer
> supports driver model.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 18/19] arm: dts: dra7-evm: add tick-timer to chosen node
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 18/19] arm: dts: dra7-evm: add tick-timer to chosen node Mugunthan V N
@ 2016-01-04 19:59   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:59 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:21PM +0530, Mugunthan V N wrote:

> Specify timer2 to be used as tick-timer in chosen node.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 19/19] defconfig: dra74_evm: enable timer driver model
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 19/19] defconfig: dra74_evm: enable timer driver model Mugunthan V N
@ 2016-01-04 19:59   ` Tom Rini
  2016-01-16  1:22     ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Tom Rini @ 2016-01-04 19:59 UTC (permalink / raw)
  To: u-boot

On Thu, Dec 24, 2015 at 04:08:22PM +0530, Mugunthan V N wrote:

> Enable timer driver model for dra74_evm_defconfig as omap-timer
> supports driver model.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

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

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

* [U-Boot] [PATCH v2 03/19] dm: timer: uclass: Add flag to control sequence numbering
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 03/19] dm: timer: uclass: Add flag to control sequence numbering Mugunthan V N
  2016-01-04 19:57   ` Tom Rini
@ 2016-01-06  0:25   ` Simon Glass
  2016-01-16  1:21     ` Simon Glass
  1 sibling, 1 reply; 68+ messages in thread
From: Simon Glass @ 2016-01-06  0:25 UTC (permalink / raw)
  To: u-boot

On 24 December 2015 at 03:38, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> Like SPI and I2C, timer devices also have multiple chip
> instances. This patch adds the flag 'DM_UC_FLAG_SEQ_ALIAS' in
> timer_uclass driver to control device sequence numbering.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>  drivers/timer/timer-uclass.c | 1 +
>  1 file changed, 1 insertion(+)

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

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

* [U-Boot] [PATCH v2 01/19] arm: omap-common: do not build timer when CONFIG_TIMER defined
  2016-01-04 19:57   ` Tom Rini
@ 2016-01-16  1:20     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:20 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:57, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:04PM +0530, Mugunthan V N wrote:
>
>> To prepare timer driver to DM/DT conversion do not build the
>> exiting timer driver when CONFIG_TIMER is defined. But since
>> omap's SPL doesn't support DM yet so built timer driver only for
>> SPL build when CONFIG_TIMER is defined.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v3 02/19] dm: timer: uclass: add timer init to add timer device
  2015-12-25 13:08       ` Mugunthan V N
@ 2016-01-16  1:20         ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:20 UTC (permalink / raw)
  To: u-boot

On 25 December 2015 at 06:08, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> On Friday 25 December 2015 05:43 PM, Bin Meng wrote:
>> Hi Mugunthan,
>>
>> On Fri, Dec 25, 2015 at 6:41 PM, Mugunthan V N <mugunthanvnm@ti.com> wrote:
>>> Adding timer_init function to create and initialize the timer
>>> device on platforms where u-boot,dm-pre-reloc is not used. Since
>>> there will be multiple timer devices in the system, adding a
>>> tick-timer node in chosen node to know which timer device to be
>>> used as tick timer in u-boot.
>>>
>>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>>> ---
>>>
>>> Submitting 02/19 only for v3 as there is no change on other
>>> patches and to reduce traffic.
>>>
>>> This patch is verified on AM437x SK and DRA74 EVM logs [1] and
>>> pushed a branch for testing
>>>
>>> [1] - http://pastebin.ubuntu.com/14205433/
>>> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-timer-v3
>>>
>>> Changes from v2->v3:
>>> * Fixed issue which is in v2 that if no chosen timer node is
>>>   present in DT then timer init always fails without trying
>>>   first available timer.
>>>
>>> ---
>>>  doc/device-tree-bindings/chosen.txt | 43 +++++++++++++++++++++++++++++++++++++
>>>  drivers/timer/timer-uclass.c        | 41 +++++++++++++++++++++++++++++++++++
>>>  lib/time.c                          | 13 ++---------
>>>  3 files changed, 86 insertions(+), 11 deletions(-)
>>>  create mode 100644 doc/device-tree-bindings/chosen.txt
>>>
>>> diff --git a/doc/device-tree-bindings/chosen.txt b/doc/device-tree-bindings/chosen.txt
>>> new file mode 100644
>>> index 0000000..bf9a30a
>>> --- /dev/null
>>> +++ b/doc/device-tree-bindings/chosen.txt
>>> @@ -0,0 +1,43 @@
>>> +The chosen node
>>> +---------------
>>> +The chosen node does not represent a real device, but serves as a place
>>> +for passing data like which serial device to used to print the logs etc
>>> +
>>> +
>>> +stdout-path property
>>> +--------------------
>>> +Device trees may specify the device to be used for boot console output
>>> +with a stdout-path property under /chosen.
>>> +
>>> +Example
>>> +-------
>>> +/ {
>>> +       chosen {
>>> +               stdout-path = "/serial at f00:115200";
>>> +       };
>>> +
>>> +       serial at f00 {
>>> +               compatible = "vendor,some-uart";
>>> +               reg = <0xf00 0x10>;
>>> +       };
>>> +};
>>> +
>>> +tick-timer property
>>> +-------------------
>>> +In a system there are multiple timers, specify which timer to be used
>>> +as the tick-timer. Earlier it was hardcoded in the timer driver now
>>> +since device tree has all the timer nodes. Specify which timer to be
>>> +used as tick timer.
>>> +
>>> +Example
>>> +-------
>>> +/ {
>>> +       chosen {
>>> +               tick-timer = "/timer2 at f00";
>>> +       };
>>> +
>>> +       timer2 at f00 {
>>> +               compatible = "vendor,some-timer";
>>> +               reg = <0xf00 0x10>;
>>> +       };
>>> +};
>>> diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
>>> index aca421b..b6699f2 100644
>>> --- a/drivers/timer/timer-uclass.c
>>> +++ b/drivers/timer/timer-uclass.c
>>> @@ -6,6 +6,8 @@
>>>
>>>  #include <common.h>
>>>  #include <dm.h>
>>> +#include <dm/lists.h>
>>> +#include <dm/device-internal.h>
>>>  #include <errno.h>
>>>  #include <timer.h>
>>>
>>> @@ -56,6 +58,45 @@ u64 timer_conv_64(u32 count)
>>>         return ((u64)gd->timebase_h << 32) | gd->timebase_l;
>>>  }
>>>
>>> +int timer_init(void)
>>> +{
>>> +       const void *blob = gd->fdt_blob;
>>> +       struct udevice *dev = NULL;
>>> +       int node;
>>> +       int ret;
>>> +
>>> +       /* Check for a chosen timer to be used for tick */
>>> +       node = fdtdec_get_chosen_node(blob, "tick-timer");
>>> +       if (node < 0) {
>>> +               /* No chosen timer, trying first available timer */
>>> +               ret = uclass_first_device(UCLASS_TIMER, &dev);
>>> +               if (ret)
>>> +                       return ret;
>>> +               if (!dev)
>>> +                       return -ENODEV;
>>
>> Thanks for the quick v3!
>>
>>> +       } 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, blob, node, &dev)) {
>>> +                               int ret = device_probe(dev);
>>
>> nits: no need to declare another ret. Just "ret = device_probe(dev)".
>
> Hmmm, yep not needed.
>
>>
>>> +                               if (ret)
>>> +                                       return ret;
>>> +                       }
>>> +               }
>>> +       }
>>> +
>>> +       if (dev) {
>>> +               gd->timer = dev;
>>> +               return 0;
>>> +       }
>>> +
>>> +       return -ENODEV;
>>> +}
>>> +
>>>  UCLASS_DRIVER(timer) = {
>>>         .id             = UCLASS_TIMER,
>>>         .name           = "timer",
>>> diff --git a/lib/time.c b/lib/time.c
>>> index f37a662..d4060f1 100644
>>> --- a/lib/time.c
>>> +++ b/lib/time.c
>>> @@ -43,17 +43,8 @@ extern unsigned long __weak timer_read_counter(void);
>>>  #ifdef CONFIG_TIMER
>>>  static int notrace dm_timer_init(void)
>>>  {
>>> -       struct udevice *dev;
>>> -       int ret;
>>> -
>>> -       if (!gd->timer) {
>>> -               ret = uclass_first_device(UCLASS_TIMER, &dev);
>>> -               if (ret)
>>> -                       return ret;
>>> -               if (!dev)
>>> -                       return -ENODEV;
>>> -               gd->timer = dev;
>>> -       }
>>> +       if (!gd->timer)
>>> +               return timer_init();
>>
>> What about my comments in v2, that make timer_init() static or just
>> move codes in timer_init() into this dm_timer_init()?
>
> Oops, missed :)
>
> The timer_init() code can be moved to dm_timer_init(), but since it
> provides timer uclass functionality I kept the code in timer-uclass driver.
>
> Now since dm_timer_init() doesn't have any thing other than calling
> timer_init, I will move the dm_timer_init() to timer_uclass and move
> timer_init code to it.
>
> Regards
> Mugunthan V N

Can you please add these changes in a follow-up commit? I'd like to
apply this series.

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 03/19] dm: timer: uclass: Add flag to control sequence numbering
  2016-01-06  0:25   ` Simon Glass
@ 2016-01-16  1:21     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:21 UTC (permalink / raw)
  To: u-boot

On 5 January 2016 at 17:25, Simon Glass <sjg@chromium.org> wrote:
> On 24 December 2015 at 03:38, Mugunthan V N <mugunthanvnm@ti.com> wrote:
>> Like SPI and I2C, timer devices also have multiple chip
>> instances. This patch adds the flag 'DM_UC_FLAG_SEQ_ALIAS' in
>> timer_uclass driver to control device sequence numbering.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>  drivers/timer/timer-uclass.c | 1 +
>>  1 file changed, 1 insertion(+)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 04/19] drivers: timer: omap_timer: add timer driver for omap devices based on dm
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 04/19] drivers: timer: omap_timer: add timer driver for omap devices based on dm Mugunthan V N
  2016-01-04 19:57   ` Tom Rini
@ 2016-01-16  1:21   ` Simon Glass
  1 sibling, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:21 UTC (permalink / raw)
  To: u-boot

On 24 December 2015 at 03:38, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> Adding a timer driver for omap devices based on driver model
> and device tree.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> ---
>  drivers/timer/Kconfig      |   6 +++
>  drivers/timer/Makefile     |   1 +
>  drivers/timer/omap-timer.c | 108 +++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 115 insertions(+)
>  create mode 100644 drivers/timer/omap-timer.c

Applied to u-boot-dm, thanks!

Please address comments in a follow-up patch.

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

* [U-Boot] [PATCH v2 05/19] am43xx_evm: timer: do not define CONFIG_TIMER for spl
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 05/19] am43xx_evm: timer: do not define CONFIG_TIMER for spl Mugunthan V N
  2016-01-04 19:57   ` Tom Rini
@ 2016-01-16  1:21   ` Simon Glass
  1 sibling, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:21 UTC (permalink / raw)
  To: u-boot

On 24 December 2015 at 03:38, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> Since OMAP's spl doesn't support DM currently, do not define
> CONFIG_TIMER for spl build.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> ---
>  include/configs/am43xx_evm.h | 1 +
>  1 file changed, 1 insertion(+)

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 06/19] arm: dts: am437x-sk-evm: add tick-timer to chosen node
  2015-12-24 10:38 ` [U-Boot] [PATCH v2 06/19] arm: dts: am437x-sk-evm: add tick-timer to chosen node Mugunthan V N
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22   ` Simon Glass
  1 sibling, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 24 December 2015 at 03:38, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> Specify which timer to be used as tick-timer in chosen node.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> ---
>  arch/arm/dts/am437x-sk-evm.dts | 1 +
>  1 file changed, 1 insertion(+)

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 07/19] defconfig: am437x_sk_evm: enable timer driver model
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:58, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:10PM +0530, Mugunthan V N wrote:
>
>> Enable timer driver model for am437x_sk_evm as omap-timer supports
>> driver model.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 08/19] arm: dts: am437x-gp-evm: add tick-timer to chosen node
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:58, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:11PM +0530, Mugunthan V N wrote:
>
>> Specify which timer to be used as tick-timer in chosen node.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 09/19] defconfig: am437x_gp_evm: enable timer driver model
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:58, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:12PM +0530, Mugunthan V N wrote:
>
>> Enable timer driver model for am437x_gp_evm as omap-timer supports
>> driver model.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 10/19] am335x_evm: timer: do not define CONFIG_TIMER for spl
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:58, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:13PM +0530, Mugunthan V N wrote:
>
>> Since OMAP's spl doesn't support DM currently, do not define
>> CONFIG_TIMER for spl build.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 11/19] arm: dts: am335x-boneblack: add tick-timer to chosen node
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:58, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:14PM +0530, Mugunthan V N wrote:
>
>> Specify which timer to be used as tick-timer in chosen node.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 12/19] defconfig: am335x_boneblack_vboot: enable timer driver model
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:58, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:15PM +0530, Mugunthan V N wrote:
>
>> Enable timer driver model for am335x_boneblack_vboot as
>> omap-timer supports driver model.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 13/19] arm: dts: am335x-evm: add tick-timer to chosen node
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:58, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:16PM +0530, Mugunthan V N wrote:
>
>> Specify timer2 to be used as tick-timer in chosen node.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 14/19] defconfig: am335x_gp_evm: enable timer driver model
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:58, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:17PM +0530, Mugunthan V N wrote:
>
>> Enable timer driver model for am335x_gp_evm as omap-timer supports
>> driver model.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 15/19] ti_omap5_common: timer: do not define CONFIG_TIMER for spl
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:58, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:18PM +0530, Mugunthan V N wrote:
>
>> Since OMAP's spl doesn't support DM currently, do not define
>> CONFIG_TIMER for spl build.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 16/19] arm: dts: dra72-evm: add tick-timer to chosen node
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:58, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:19PM +0530, Mugunthan V N wrote:
>
>> Specify timer2 to be used as tick-timer in chosen node.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 17/19] defconfig: dra72_evm: enable timer driver model
  2016-01-04 19:58   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:58, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:20PM +0530, Mugunthan V N wrote:
>
>> Enable timer driver model for dra72_evm_defconfig as omap-timer
>> supports driver model.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 18/19] arm: dts: dra7-evm: add tick-timer to chosen node
  2016-01-04 19:59   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:59, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:21PM +0530, Mugunthan V N wrote:
>
>> Specify timer2 to be used as tick-timer in chosen node.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v2 19/19] defconfig: dra74_evm: enable timer driver model
  2016-01-04 19:59   ` Tom Rini
@ 2016-01-16  1:22     ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-16  1:22 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 12:59, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Dec 24, 2015 at 04:08:22PM +0530, Mugunthan V N wrote:
>
>> Enable timer driver model for dra74_evm_defconfig as omap-timer
>> supports driver model.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Reviewed-by: Tom Rini <trini@konsulko.com>
>
> --
> Tom

Applied to u-boot-dm, thanks!

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

* [U-Boot] [PATCH v4 02/19] dm: timer: uclass: add timer init in uclass driver to add timer device
  2015-12-25 10:41   ` [U-Boot] [PATCH v3 " Mugunthan V N
  2015-12-25 12:13     ` Bin Meng
@ 2016-01-16 16:03     ` Mugunthan V N
  2016-01-16 16:08       ` Mugunthan V N
  1 sibling, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2016-01-16 16:03 UTC (permalink / raw)
  To: u-boot

Adding timer init function in timer-uclass driver to create and
initialize the timer device on platforms where u-boot,dm-pre-reloc
is not used. Since there will be multiple timer devices in the
system, adding a tick-timer node in chosen node to know which
timer device to be used as tick timer in u-boot.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 doc/device-tree-bindings/chosen.txt | 43 ++++++++++++++++++++++++++++++++++++
 drivers/timer/timer-uclass.c        | 44 +++++++++++++++++++++++++++++++++++++
 include/timer.h                     |  9 ++++++++
 lib/time.c                          | 17 --------------
 4 files changed, 96 insertions(+), 17 deletions(-)
 create mode 100644 doc/device-tree-bindings/chosen.txt

Changes from v3:
* removed dm_timer_init() in lib/time.c as it doesn't add
  anything and simply calls uclass driver's init and also
  renamed timer_init() to dm_timer_init() as many platforms
  calls timer_init() before dm init.
* removed re-declaring of ret in dm_timer_init()

Tested this patch on DRA74x EVM  (logs [1]) with sleep 10 with
minicom timestamps and pushed a branch [2] for testing.

[1] - http://pastebin.ubuntu.com/14520385/
[2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-timer-v4

---

diff --git a/doc/device-tree-bindings/chosen.txt b/doc/device-tree-bindings/chosen.txt
new file mode 100644
index 0000000..bf9a30a
--- /dev/null
+++ b/doc/device-tree-bindings/chosen.txt
@@ -0,0 +1,43 @@
+The chosen node
+---------------
+The chosen node does not represent a real device, but serves as a place
+for passing data like which serial device to used to print the logs etc
+
+
+stdout-path property
+--------------------
+Device trees may specify the device to be used for boot console output
+with a stdout-path property under /chosen.
+
+Example
+-------
+/ {
+	chosen {
+		stdout-path = "/serial at f00:115200";
+	};
+
+	serial at f00 {
+		compatible = "vendor,some-uart";
+		reg = <0xf00 0x10>;
+	};
+};
+
+tick-timer property
+-------------------
+In a system there are multiple timers, specify which timer to be used
+as the tick-timer. Earlier it was hardcoded in the timer driver now
+since device tree has all the timer nodes. Specify which timer to be
+used as tick timer.
+
+Example
+-------
+/ {
+	chosen {
+		tick-timer = "/timer2 at f00";
+	};
+
+	timer2 at f00 {
+		compatible = "vendor,some-timer";
+		reg = <0xf00 0x10>;
+	};
+};
diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
index aca421b..0480178 100644
--- a/drivers/timer/timer-uclass.c
+++ b/drivers/timer/timer-uclass.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <dm/lists.h>
+#include <dm/device-internal.h>
 #include <errno.h>
 #include <timer.h>
 
@@ -56,6 +58,48 @@ u64 timer_conv_64(u32 count)
 	return ((u64)gd->timebase_h << 32) | gd->timebase_l;
 }
 
+int notrace dm_timer_init(void)
+{
+	const void *blob = gd->fdt_blob;
+	struct udevice *dev = NULL;
+	int node;
+	int ret;
+
+	if (gd->timer)
+		return 0;
+
+	/* Check for a chosen timer to be used for tick */
+	node = fdtdec_get_chosen_node(blob, "tick-timer");
+	if (node < 0) {
+		/* No chosen timer, trying first available timer */
+		ret = uclass_first_device(UCLASS_TIMER, &dev);
+		if (ret)
+			return ret;
+		if (!dev)
+			return -ENODEV;
+	} 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, blob, node, &dev)) {
+				ret = device_probe(dev);
+				if (ret)
+					return ret;
+			}
+		}
+	}
+
+	if (dev) {
+		gd->timer = dev;
+		return 0;
+	}
+
+	return -ENODEV;
+}
+
 UCLASS_DRIVER(timer) = {
 	.id		= UCLASS_TIMER,
 	.name		= "timer",
diff --git a/include/timer.h b/include/timer.h
index 7fee17e..f14725c 100644
--- a/include/timer.h
+++ b/include/timer.h
@@ -8,6 +8,15 @@
 #define _TIMER_H_
 
 /*
+ * dm_timer_init - initialize a timer for time keeping. On success
+ * initializes gd->timer so that lib/timer can use it for future
+ * referrence.
+ *
+ * @return - 0 on success or error number
+ */
+int dm_timer_init(void);
+
+/*
  * timer_conv_64 - convert 32-bit counter value to 64-bit
  *
  * @count: 32-bit counter value
diff --git a/lib/time.c b/lib/time.c
index f37a662..e9f6861 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -41,23 +41,6 @@ extern unsigned long __weak timer_read_counter(void);
 #endif
 
 #ifdef CONFIG_TIMER
-static int notrace dm_timer_init(void)
-{
-	struct udevice *dev;
-	int ret;
-
-	if (!gd->timer) {
-		ret = uclass_first_device(UCLASS_TIMER, &dev);
-		if (ret)
-			return ret;
-		if (!dev)
-			return -ENODEV;
-		gd->timer = dev;
-	}
-
-	return 0;
-}
-
 ulong notrace get_tbclk(void)
 {
 	int ret;
-- 
2.7.0.rc3

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

* [U-Boot] [PATCH v4 02/19] dm: timer: uclass: add timer init in uclass driver to add timer device
  2016-01-16 16:03     ` [U-Boot] [PATCH v4 02/19] dm: timer: uclass: add timer init in uclass driver " Mugunthan V N
@ 2016-01-16 16:08       ` Mugunthan V N
  2016-01-16 16:41         ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2016-01-16 16:08 UTC (permalink / raw)
  To: u-boot

On Saturday 16 January 2016 09:33 PM, Mugunthan V N wrote:
> Adding timer init function in timer-uclass driver to create and
> initialize the timer device on platforms where u-boot,dm-pre-reloc
> is not used. Since there will be multiple timer devices in the
> system, adding a tick-timer node in chosen node to know which
> timer device to be used as tick timer in u-boot.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Please drop this patch, will send a fixup patch as the series is already
applied to u-boot-dm tree.

Regards
Mugunthan V N

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

* [U-Boot] [PATCH v4 02/19] dm: timer: uclass: add timer init in uclass driver to add timer device
  2016-01-16 16:08       ` Mugunthan V N
@ 2016-01-16 16:41         ` Simon Glass
  2016-01-16 16:51           ` Mugunthan V N
  0 siblings, 1 reply; 68+ messages in thread
From: Simon Glass @ 2016-01-16 16:41 UTC (permalink / raw)
  To: u-boot

Hi Mugunthan,

On 16 January 2016 at 09:08, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> On Saturday 16 January 2016 09:33 PM, Mugunthan V N wrote:
>> Adding timer init function in timer-uclass driver to create and
>> initialize the timer device on platforms where u-boot,dm-pre-reloc
>> is not used. Since there will be multiple timer devices in the
>> system, adding a tick-timer node in chosen node to know which
>> timer device to be used as tick timer in u-boot.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>
> Please drop this patch, will send a fixup patch as the series is already
> applied to u-boot-dm tree.

You can send a new patch if you like and I can replace it. Either works for me.

Regards,
Simon

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

* [U-Boot] [PATCH v4 02/19] dm: timer: uclass: add timer init in uclass driver to add timer device
  2016-01-16 16:41         ` Simon Glass
@ 2016-01-16 16:51           ` Mugunthan V N
  2016-01-18  3:58             ` Simon Glass
  0 siblings, 1 reply; 68+ messages in thread
From: Mugunthan V N @ 2016-01-16 16:51 UTC (permalink / raw)
  To: u-boot

On Saturday 16 January 2016 10:11 PM, Simon Glass wrote:
> Hi Mugunthan,
> 
> On 16 January 2016 at 09:08, Mugunthan V N <mugunthanvnm@ti.com> wrote:
>> On Saturday 16 January 2016 09:33 PM, Mugunthan V N wrote:
>>> Adding timer init function in timer-uclass driver to create and
>>> initialize the timer device on platforms where u-boot,dm-pre-reloc
>>> is not used. Since there will be multiple timer devices in the
>>> system, adding a tick-timer node in chosen node to know which
>>> timer device to be used as tick timer in u-boot.
>>>
>>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>>
>> Please drop this patch, will send a fixup patch as the series is already
>> applied to u-boot-dm tree.
> 
> You can send a new patch if you like and I can replace it. Either works for me.
> 

Just sent a follow-up patch. Its good to not change the pushed history.

Regards
Mugunthan V N

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

* [U-Boot] [PATCH v4 02/19] dm: timer: uclass: add timer init in uclass driver to add timer device
  2016-01-16 16:51           ` Mugunthan V N
@ 2016-01-18  3:58             ` Simon Glass
  0 siblings, 0 replies; 68+ messages in thread
From: Simon Glass @ 2016-01-18  3:58 UTC (permalink / raw)
  To: u-boot

Hi Mugunthan,

On 16 January 2016 at 09:51, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> On Saturday 16 January 2016 10:11 PM, Simon Glass wrote:
>> Hi Mugunthan,
>>
>> On 16 January 2016 at 09:08, Mugunthan V N <mugunthanvnm@ti.com> wrote:
>>> On Saturday 16 January 2016 09:33 PM, Mugunthan V N wrote:
>>>> Adding timer init function in timer-uclass driver to create and
>>>> initialize the timer device on platforms where u-boot,dm-pre-reloc
>>>> is not used. Since there will be multiple timer devices in the
>>>> system, adding a tick-timer node in chosen node to know which
>>>> timer device to be used as tick timer in u-boot.
>>>>
>>>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>>>
>>> Please drop this patch, will send a fixup patch as the series is already
>>> applied to u-boot-dm tree.
>>

>> You can send a new patch if you like and I can replace it. Either works for me.
>>
>
> Just sent a follow-up patch. Its good to not change the pushed history.

I actually do this all the time as I rebase against master before
testing and sending pull requests. It helps to avoid conflicts for Tom
to deal with.

So since you have given me two options, I've pick up this patch and
replaced the v3 patch with it. I checked that the effect is the same
as applying your fix-up. The patches were sitting around since
Christmas so I wanted to get them in to permit the maximum possible
testing window.

Applied to u-boot-dm, thanks!

Regards,
Simon

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

end of thread, other threads:[~2016-01-18  3:58 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-24 10:38 [U-Boot] [PATCH v2 00/19] driver model bring-up of omap timer on dra72, dra74, am335x and am437x-sk evm Mugunthan V N
2015-12-24 10:38 ` [U-Boot] [PATCH v2 01/19] arm: omap-common: do not build timer when CONFIG_TIMER defined Mugunthan V N
2016-01-04 19:57   ` Tom Rini
2016-01-16  1:20     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 02/19] dm: timer: uclass: add timer init to add timer device Mugunthan V N
2015-12-25  2:10   ` Bin Meng
2015-12-25  7:08     ` Mugunthan V N
2015-12-25 10:41   ` [U-Boot] [PATCH v3 " Mugunthan V N
2015-12-25 12:13     ` Bin Meng
2015-12-25 13:08       ` Mugunthan V N
2016-01-16  1:20         ` Simon Glass
2016-01-16 16:03     ` [U-Boot] [PATCH v4 02/19] dm: timer: uclass: add timer init in uclass driver " Mugunthan V N
2016-01-16 16:08       ` Mugunthan V N
2016-01-16 16:41         ` Simon Glass
2016-01-16 16:51           ` Mugunthan V N
2016-01-18  3:58             ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 03/19] dm: timer: uclass: Add flag to control sequence numbering Mugunthan V N
2016-01-04 19:57   ` Tom Rini
2016-01-06  0:25   ` Simon Glass
2016-01-16  1:21     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 04/19] drivers: timer: omap_timer: add timer driver for omap devices based on dm Mugunthan V N
2016-01-04 19:57   ` Tom Rini
2016-01-16  1:21   ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 05/19] am43xx_evm: timer: do not define CONFIG_TIMER for spl Mugunthan V N
2016-01-04 19:57   ` Tom Rini
2016-01-16  1:21   ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 06/19] arm: dts: am437x-sk-evm: add tick-timer to chosen node Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22   ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 07/19] defconfig: am437x_sk_evm: enable timer driver model Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 08/19] arm: dts: am437x-gp-evm: add tick-timer to chosen node Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 09/19] defconfig: am437x_gp_evm: enable timer driver model Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 10/19] am335x_evm: timer: do not define CONFIG_TIMER for spl Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 11/19] arm: dts: am335x-boneblack: add tick-timer to chosen node Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 12/19] defconfig: am335x_boneblack_vboot: enable timer driver model Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 13/19] arm: dts: am335x-evm: add tick-timer to chosen node Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 14/19] defconfig: am335x_gp_evm: enable timer driver model Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 15/19] ti_omap5_common: timer: do not define CONFIG_TIMER for spl Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 16/19] arm: dts: dra72-evm: add tick-timer to chosen node Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 17/19] defconfig: dra72_evm: enable timer driver model Mugunthan V N
2016-01-04 19:58   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 18/19] arm: dts: dra7-evm: add tick-timer to chosen node Mugunthan V N
2016-01-04 19:59   ` Tom Rini
2016-01-16  1:22     ` Simon Glass
2015-12-24 10:38 ` [U-Boot] [PATCH v2 19/19] defconfig: dra74_evm: enable timer driver model Mugunthan V N
2016-01-04 19:59   ` Tom Rini
2016-01-16  1:22     ` 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.