From patchwork Tue Oct 15 20:10:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Goldschmidt X-Patchwork-Id: 1177378 X-Patchwork-Delegate: simon.k.r.goldschmidt@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aBnYV4wm"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46t6DP0VQvz9sPF for ; Wed, 16 Oct 2019 07:17:40 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id B6711C21D72; Tue, 15 Oct 2019 20:12:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 29330C21DAF; Tue, 15 Oct 2019 20:11:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2E5A3C21D83; Tue, 15 Oct 2019 20:10:47 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by lists.denx.de (Postfix) with ESMTPS id 5B1ABC21DD3 for ; Tue, 15 Oct 2019 20:10:44 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id p7so387652wmp.4 for ; Tue, 15 Oct 2019 13:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4oL7AJGA1e6OptUfzWJfjnqNXrJQbUtE3KLwD9AfH4A=; b=aBnYV4wmQJXpGDoDzGS5HtBQJ1DDJpIr86vIQ55vZyDR/aTd3oEYKMjY+FbDxpL7aB cj0BBqeBVbScPg/5gAtG128mtlT746gSP9jgbEFAVcgoCAA25/V4I7gw1FMXbDz9+7o+ om8RUGpWax/2B/bY5GfSiikbI4FTkpRB/w+sFfvZZM2J7OuQ7mfq0D2hVBxnK5VAmLl3 L3zn+MmMXRlq7KUSFAPgmAGouGRi5RRXhnpKS1rIG2xU4+0+vCYjOEZL34fNsTRL34Ev ZA/3TN98Gq/8/pC4JhL9HGq7qB5/3E/ogFn3XT5kcMprI1kZDJHDyhw/w/uL2W0oY4Gs dk1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4oL7AJGA1e6OptUfzWJfjnqNXrJQbUtE3KLwD9AfH4A=; b=Jdb7XrT1yk4/0fzlJSy58wglcrqyC9sfsFLMEzRQp2Qh+GMUKvOmoIBPpgf0y0DRGY 6b2y3ZutoWXph2o3g1CwycElosw72ooQTN1rs7pP0GPGo2OxdrLUwBH/AzuZiqqe7nkw DtFJXlQDmYcNk15yGtEQ68vKzKL6FcpB1dxHr/rOl38SzMuEuQaNZhzzh58fAmii6IeS OS5gdV/4Wxl3ZN/PJkPs2gpjRNP7teUNwtZulDwDeR2AgU1UFR19qtuHPJm4pW6/wxtT 2B+Y8FNeTExoXB0hLJv1LChK/iFZycbDqc9S5mLs0jWhcrDWSiIJj1wXP5Ankd/4NTXP VEEQ== X-Gm-Message-State: APjAAAU1UtLQZLjiJgP0cUMYSKst6Fw3MoI21jOHS0DRWpVZ7cb+jQ5T qu7WmMdDqkYv8xxE/4IOAhE= X-Google-Smtp-Source: APXvYqxd8iYsZLQlKwlfj/84dRzYJA9yKKPdDRi4u/taGhKYLiwjAdCJqsOsWwohqiP+7fiz0m1iAA== X-Received: by 2002:a05:600c:2549:: with SMTP id e9mr194725wma.64.1571170244034; Tue, 15 Oct 2019 13:10:44 -0700 (PDT) Received: from ubuntu.home ([2a02:8071:6a3:700:9d84:c831:fe55:4622]) by smtp.gmail.com with ESMTPSA id 79sm329194wmb.7.2019.10.15.13.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 13:10:43 -0700 (PDT) From: Simon Goldschmidt To: Dalon L Westergreen Date: Tue, 15 Oct 2019 22:10:17 +0200 Message-Id: <20191015201032.20156-5-simon.k.r.goldschmidt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191015201032.20156-1-simon.k.r.goldschmidt@gmail.com> References: <20191015201032.20156-1-simon.k.r.goldschmidt@gmail.com> MIME-Version: 1.0 Cc: Marek Vasut , u-boot@lists.denx.de Subject: [U-Boot] [RFC PATCH v2 04/18] timer: dw-apb: add reset handling X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" To use this timer on socfpga as system tick, it needs to take itself out of reset. Signed-off-by: Simon Goldschmidt --- 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 #include #include +#include #include #include @@ -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), };