Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp770767ybl; Thu, 22 Aug 2019 04:45:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzm6wjz7OBgfdwzRojCnoWIj/0vtbDX/OPgxXMLUQUPY4d0H7+AK46olTNYP19ovm1Xc6yL X-Received: by 2002:a17:902:29e9:: with SMTP id h96mr38686064plb.110.1566474335626; Thu, 22 Aug 2019 04:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566474335; cv=none; d=google.com; s=arc-20160816; b=B7FTj0Sof0cIwwIhnU8S/RTR/oQ96JT4s0S7IvLgd7XmyrXb/kZCybh3bsG1jyXMuy KBC5w/8KpLInEX1bz1QA9Klh+/G8eG/fRm7bfwfKl5pMhkaigK8ySsdU7svJQUgLwCIZ xwd+CQP7ef8N8o5CnnJGN59JnJXT1Q3VHNaBFgM/bRiCJUn1Tg8jOPJT4tajROs3CpoT HszVY+ZHItI6zMz/WI7sxXIn44T4ZwUwpQhXYXS2uGI6NK/jiXz7AinSjFIw9vkJ6B+9 hDyesqZb9RdCAWL3JSEuykLvzlPg9DkfNaQMIYY4gYgWASBMmKAvzYIkNPR+MudtaU5g PObQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=seksTz213FiZx7OOzA1ey3k54IF53WLm13Z7+2NjCNQ=; b=a4ibLA+0yZtk6h328arzOQ9ufXbzPjdvoSqsZq47ZQEUjv2TspeAf2pQkrN/bqzn/y 0iwDF3L03cbS6kfrdG1Ptqu9cyij731qLYkrMfWhfg0UFRq+zN998LOtCq0NG7Mi8/2n Ux3XGMpdu1/OfG+gdd6XcFeeA3Hjz46nInqkr//y4K909SlWDuG1z778OeaEYzHFs99w tIh0cNM5N4p5dtIal+65Xowx546qR+sns8kEHKhW3cLdII6Wume4dNcRppku/NrLCjmu fUNZZuayzi1DIjScqzpAYDWzUzhi+EBJ8GVblLi6RJeTPcgaEgA5OPSVxLl4RmWpHvfL 6ZvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14si18547750pfc.35.2019.08.22.04.45.20; Thu, 22 Aug 2019 04:45:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733305AbfHVJd4 (ORCPT + 99 others); Thu, 22 Aug 2019 05:33:56 -0400 Received: from shell.v3.sk ([90.176.6.54]:35843 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733284AbfHVJdy (ORCPT ); Thu, 22 Aug 2019 05:33:54 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id E1B59D755A; Thu, 22 Aug 2019 11:33:50 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id LqdrDrATp3VP; Thu, 22 Aug 2019 11:33:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id BE2A9D7360; Thu, 22 Aug 2019 11:32:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ORVKNwk84bqK; Thu, 22 Aug 2019 11:27:49 +0200 (CEST) Received: from belphegor.brq.redhat.com (nat-pool-brq-t.redhat.com [213.175.37.10]) by zimbra.v3.sk (Postfix) with ESMTPSA id A0F65D7567; Thu, 22 Aug 2019 11:26:50 +0200 (CEST) From: Lubomir Rintel To: Olof Johansson Cc: Rob Herring , Mark Rutland , Thomas Gleixner , Jason Cooper , Marc Zyngier , Kishon Vijay Abraham I , Russell King , Michael Turquette , Stephen Boyd , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Lubomir Rintel Subject: [PATCH v2 13/20] ARM: mmp: DT: convert timer driver to use TIMER_OF_DECLARE Date: Thu, 22 Aug 2019 11:26:36 +0200 Message-Id: <20190822092643.593488-14-lkundrak@v3.sk> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190822092643.593488-1-lkundrak@v3.sk> References: <20190822092643.593488-1-lkundrak@v3.sk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This makes things just a tiny bit simpler. Signed-off-by: Lubomir Rintel --- arch/arm/mach-mmp/mmp-dt.c | 5 ++--- arch/arm/mach-mmp/mmp2-dt.c | 5 ++--- arch/arm/mach-mmp/time.c | 38 +++++++++++-------------------------- 3 files changed, 15 insertions(+), 33 deletions(-) diff --git a/arch/arm/mach-mmp/mmp-dt.c b/arch/arm/mach-mmp/mmp-dt.c index 35559792d5cca..91214996acecc 100644 --- a/arch/arm/mach-mmp/mmp-dt.c +++ b/arch/arm/mach-mmp/mmp-dt.c @@ -9,14 +9,13 @@ #include #include #include +#include #include #include #include =20 #include "common.h" =20 -extern void __init mmp_dt_init_timer(void); - static const char *const pxa168_dt_board_compat[] __initconst =3D { "mrvl,pxa168-aspenite", NULL, @@ -32,8 +31,8 @@ static void __init mmp_init_time(void) #ifdef CONFIG_CACHE_TAUROS2 tauros2_init(0); #endif - mmp_dt_init_timer(); of_clk_init(NULL); + timer_probe(); } =20 DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)") diff --git a/arch/arm/mach-mmp/mmp2-dt.c b/arch/arm/mach-mmp/mmp2-dt.c index 8eec881191f4b..510c762ddc484 100644 --- a/arch/arm/mach-mmp/mmp2-dt.c +++ b/arch/arm/mach-mmp/mmp2-dt.c @@ -10,21 +10,20 @@ #include #include #include +#include #include #include #include =20 #include "common.h" =20 -extern void __init mmp_dt_init_timer(void); - static void __init mmp_init_time(void) { #ifdef CONFIG_CACHE_TAUROS2 tauros2_init(0); #endif of_clk_init(NULL); - mmp_dt_init_timer(); + timer_probe(); } =20 static const char *const mmp2_dt_board_compat[] __initconst =3D { diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c index 483df32583be6..3f6fd0be00512 100644 --- a/arch/arm/mach-mmp/time.c +++ b/arch/arm/mach-mmp/time.c @@ -195,30 +195,17 @@ void __init mmp_timer_init(int irq, unsigned long r= ate) clockevents_config_and_register(&ckevt, rate, MIN_DELTA, MAX_DELTA); } =20 -#ifdef CONFIG_OF -static const struct of_device_id mmp_timer_dt_ids[] =3D { - { .compatible =3D "mrvl,mmp-timer", }, - {} -}; - -void __init mmp_dt_init_timer(void) +static int __init mmp_dt_init_timer(struct device_node *np) { - struct device_node *np; struct clk *clk; int irq, ret; unsigned long rate; =20 - np =3D of_find_matching_node(NULL, mmp_timer_dt_ids); - if (!np) { - ret =3D -ENODEV; - goto out; - } - clk =3D of_clk_get(np, 0); if (!IS_ERR(clk)) { ret =3D clk_prepare_enable(clk); if (ret) - goto out; + return ret; rate =3D clk_get_rate(clk) / 2; } else if (cpu_is_pj4()) { rate =3D 6500000; @@ -227,18 +214,15 @@ void __init mmp_dt_init_timer(void) } =20 irq =3D irq_of_parse_and_map(np, 0); - if (!irq) { - ret =3D -EINVAL; - goto out; - } + if (!irq) + return -EINVAL; + mmp_timer_base =3D of_iomap(np, 0); - if (!mmp_timer_base) { - ret =3D -ENOMEM; - goto out; - } + if (!mmp_timer_base) + return -ENOMEM; + mmp_timer_init(irq, rate); - return; -out: - pr_err("Failed to get timer from device tree with error:%d\n", ret); + return 0; } -#endif + +TIMER_OF_DECLARE(mmp_timer, "mrvl,mmp-timer", mmp_dt_init_timer); --=20 2.21.0