From patchwork Wed Aug 2 20:39:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Tomsich X-Patchwork-Id: 796808 X-Patchwork-Delegate: philipp.tomsich@theobroma-systems.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=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xN4xQ0HdFz9s7g for ; Thu, 3 Aug 2017 06:47:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id AF439C21E0A; Wed, 2 Aug 2017 20:44:44 +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=none 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 6AE0EC21DFD; Wed, 2 Aug 2017 20:44:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EAD59C21D93; Wed, 2 Aug 2017 20:40:27 +0000 (UTC) Received: from mail.theobroma-systems.com (vegas.theobroma-systems.com [144.76.126.164]) by lists.denx.de (Postfix) with ESMTPS id D2DEAC21D7E for ; Wed, 2 Aug 2017 20:40:26 +0000 (UTC) Received: from [86.59.122.178] (port=53936 helo=android.lan) by mail.theobroma-systems.com with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA256:128) (Exim 4.80) (envelope-from ) id 1dd0RN-0002Mj-0U; Wed, 02 Aug 2017 22:40:25 +0200 From: Philipp Tomsich To: u-boot@lists.denx.de Date: Wed, 2 Aug 2017 22:39:57 +0200 Message-Id: <1501706406-10284-2-git-send-email-philipp.tomsich@theobroma-systems.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1501706406-10284-1-git-send-email-philipp.tomsich@theobroma-systems.com> References: <1501706406-10284-1-git-send-email-philipp.tomsich@theobroma-systems.com> Cc: Vlad Zakharov , Zakharov Vlad , Klaus Goger Subject: [U-Boot] [PATCH v2 1/6] timer: add OF_PLATDATA support for timer-uclass 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The timer-uclass depends on full OF_CONTROL through its interrogation of /chosen and the code to determine the clock-frequency. For the OF_PLATDATA case, these code-paths are disabled and it becomes the timer driver's responsibility to correctly set the clock-frequency in the uclass priv-data. Signed-off-by: Philipp Tomsich Reviewed-by: Simon Glass --- Changes in v2: - marks blob as maybe_unused (to accomodate the OF_CONTROL case w/o warnings) drivers/timer/timer-uclass.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index ec10b28..a84755f 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -42,6 +42,7 @@ unsigned long notrace timer_get_rate(struct udevice *dev) static int timer_pre_probe(struct udevice *dev) { +#if !CONFIG_IS_ENABLED(OF_PLATDATA) struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct clk timer_clk; int err; @@ -56,6 +57,7 @@ static int timer_pre_probe(struct udevice *dev) } else uc_priv->clock_rate = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "clock-frequency", 0); +#endif return 0; } @@ -81,16 +83,18 @@ u64 timer_conv_64(u32 count) int notrace dm_timer_init(void) { - const void *blob = gd->fdt_blob; + __maybe_unused const void *blob = gd->fdt_blob; struct udevice *dev = NULL; - int node; + int node = -ENOENT; int ret; if (gd->timer) return 0; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) /* Check for a chosen timer to be used for tick */ node = fdtdec_get_chosen_node(blob, "tick-timer"); +#endif if (node < 0) { /* No chosen timer, trying first available timer */ ret = uclass_first_device_err(UCLASS_TIMER, &dev);