All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH v2 04/18] timer: dw-apb: add reset handling
Date: Tue, 15 Oct 2019 22:10:17 +0200	[thread overview]
Message-ID: <20191015201032.20156-5-simon.k.r.goldschmidt@gmail.com> (raw)
In-Reply-To: <20191015201032.20156-1-simon.k.r.goldschmidt@gmail.com>

To use this timer on socfpga as system tick, it needs to take itself out
of reset.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---

Changes in v2: None

 drivers/timer/dw-apb-timer.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/timer/dw-apb-timer.c b/drivers/timer/dw-apb-timer.c
index 86312b8dc7..fad22be8c9 100644
--- a/drivers/timer/dw-apb-timer.c
+++ b/drivers/timer/dw-apb-timer.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <clk.h>
+#include <reset.h>
 #include <timer.h>
 
 #include <asm/io.h>
@@ -18,7 +19,8 @@
 #define DW_APB_CTRL		0x8
 
 struct dw_apb_timer_priv {
-	fdt_addr_t	regs;
+	fdt_addr_t regs;
+	struct reset_ctl_bulk resets;
 };
 
 static int dw_apb_timer_get_count(struct udevice *dev, u64 *count)
@@ -42,6 +44,12 @@ static int dw_apb_timer_probe(struct udevice *dev)
 	struct clk clk;
 	int ret;
 
+	ret = reset_get_bulk(dev, &priv->resets);
+	if (ret)
+		dev_warn(dev, "Can't get reset: %d\n", ret);
+	else
+		reset_deassert_bulk(&priv->resets);
+
 	ret = clk_get_by_index(dev, 0, &clk);
 	if (ret)
 		return ret;
@@ -67,6 +75,13 @@ static int dw_apb_timer_ofdata_to_platdata(struct udevice *dev)
 	return 0;
 }
 
+static int dw_apb_timer_remove(struct udevice *dev)
+{
+	struct dw_apb_timer_priv *priv = dev_get_priv(dev);
+
+	return reset_release_bulk(&priv->resets);
+}
+
 static const struct timer_ops dw_apb_timer_ops = {
 	.get_count	= dw_apb_timer_get_count,
 };
@@ -83,5 +98,6 @@ U_BOOT_DRIVER(dw_apb_timer) = {
 	.probe		= dw_apb_timer_probe,
 	.of_match	= dw_apb_timer_ids,
 	.ofdata_to_platdata = dw_apb_timer_ofdata_to_platdata,
+	.remove		= dw_apb_timer_remove,
 	.priv_auto_alloc_size = sizeof(struct dw_apb_timer_priv),
 };
-- 
2.20.1

  parent reply	other threads:[~2019-10-15 20:10 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 20:10 [U-Boot] [RFC PATCH v2 00/18] arm: socfpga: gen5: move to DM Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 01/18] ddr: socfpga: gen5: constify altera_gen5_sdram_ops Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 02/18] dts: arm: socfpga: add label for clkmgr Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 03/18] arm: socfpga: gen5: increase SPL_SYS_MALLOC_F_LEN Simon Goldschmidt
2019-10-15 20:10 ` Simon Goldschmidt [this message]
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 05/18] arm: socfpga: gen5: move initial reset handling to reset driver Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 06/18] arm: dts: socfpga: add settings for gen5 clk driver Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 07/18] arm: dts: socfpga: make clock nodes available in SPL Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 08/18] socfpga: gen5: add new tool to create handoff dtsi files Simon Goldschmidt
2019-10-22 17:10   ` Dalon L Westergreen
2019-10-22 17:13     ` Simon Goldschmidt
2019-10-23 16:03       ` Dalon L Westergreen
2019-10-23 19:22         ` Simon Goldschmidt
2019-10-24 14:25           ` Dalon L Westergreen
2019-10-24 14:29             ` Simon Goldschmidt
2019-10-24 17:29               ` Dalon L Westergreen
2019-10-24 18:00                 ` Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 09/18] sdram: socfpga: gen5: make config structs dts compatible Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 10/18] ddr: socfpga: gen5: fetch handoff information from 'of_to_platdata' Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 11/18] ddr: socfpga: gen5: read handoff information from devicetree Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 12/18] arm: socfpga: gen5: add readonly clk driver Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 13/18] arm: socfpga: gen5: enable DM CLK Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 14/18] arm: socfpga: gen5: move clock initialization to CLK driver Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 15/18] arm: socfpga: gen5: load CLK config from devicetree Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 16/18] spi: cadence_qspi: support DM_CLK Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 17/18] arm: socfpga: gen5: parse qspi clock from devictree Simon Goldschmidt
2019-10-15 20:10 ` [U-Boot] [RFC PATCH v2 18/18] socfpga: gen5: move CLK and SDRAM to DM Simon Goldschmidt
2019-10-23 20:36 ` [U-Boot] [RFC PATCH v2 00/18] arm: socfpga: gen5: move " Simon Goldschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191015201032.20156-5-simon.k.r.goldschmidt@gmail.com \
    --to=simon.k.r.goldschmidt@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.