Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp609627pxx; Mon, 26 Oct 2020 16:47:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFacb0v0bgqmjgCvsq4yYZEdh6uymXD4eDI4w6r1gJW1lQjXIzSo9VYXHcQ+mVP6QtHuOZ X-Received: by 2002:aa7:dc42:: with SMTP id g2mr18512336edu.11.1603756042178; Mon, 26 Oct 2020 16:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603756042; cv=none; d=google.com; s=arc-20160816; b=Qg1YQFg8HTlxvATMZ1SEm6xmN8oxwHhO+U3q1NW7VrIDhwqeii7vPP5pCN+3UTqtwL v8VYvK+af9xyQLEVZ/zntoh7YKpOmSsYdqRJPT7v1BiRtWTiavnd+ijgP+/qsdi3tSPt KIFwnFmtPDPrlhK7UFnCM7CssNGVcafZ5S20nTPL/AFO90cMjh8GVKePvp28IwL49267 J01Bk9NHlJy5+NMfOZzLLvS5bh3qQVMkIT39lRHD9AKWyGK3NhoKZ8x7CeR1A9fEdxSd vuX+D3Z1jGbfIvNSUO01bmMk9HjQSYs3sSWFR3jWVQWCS7LIfghNWXQWDjrVDUNBQQ/C 5onw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FHudRtp7yzYdmsxvUUGKxH7K88Fn6l9DBuMQ5iU2qAI=; b=L+YNjoph8eRA2FR090a+9ocKlQRdPL+L5UP3yhEQOi/Re1XkeMBwS72ZLN2KMDva9a UDCeg3jU1e4YzgluWR3q5+fs2E83mUWUvkEaZaDgggCFbVAEciylxCLbzkRo3Vr9SoPQ 54CzrKuIFHH4KYr4FQYRKZUk4TDkIptuhg0JNZJWamTWX4X6jp/uR12BEgQytAas7v0O 66NnlQw5uKjROBcFizogYPxUuwM9N4yRUfvaf9eX2bfmipdQEnmitrZXhcXOTdBGPxZp viq+Oo4pW+fDqDxPX2S3pocVrp0T1OWGbOE/GTVKjSiXicoDprZ/qLgt65SB0lov2s8T AaTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=EgVUQ50K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj3si8589988ejb.313.2020.10.26.16.47.00; Mon, 26 Oct 2020 16:47:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=EgVUQ50K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1789204AbgJZSIc (ORCPT + 99 others); Mon, 26 Oct 2020 14:08:32 -0400 Received: from mail-il1-f195.google.com ([209.85.166.195]:34722 "EHLO mail-il1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1783374AbgJZSIc (ORCPT ); Mon, 26 Oct 2020 14:08:32 -0400 Received: by mail-il1-f195.google.com with SMTP id v18so3829895ilg.1 for ; Mon, 26 Oct 2020 11:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FHudRtp7yzYdmsxvUUGKxH7K88Fn6l9DBuMQ5iU2qAI=; b=EgVUQ50Kuv45cI5ojv4WXe4qC3H1y/RPR4naCQph6DTzVdU4YcS6zm1VL0nyTRaKSz 7Xa4pbYYWS5GJ5MRiqBFginYq2aewpye2Sj6DcyQ/5XmHeefO1RRueF0X71qlv8LY8pL y6/n5OYAur+1WCRQF1PU3ncXDYj+5m6P6AZsIbb7iF7Xg+v3A+nP8+H6N3ItNqIoFTCr fFcM/KVRTY0oYIWL2G0qc9bRNDdFVYwGbBVQva0vconViKNWw2N4dJkRgzXlAHNWy7M5 Hfaaag7nn9dW9hgSSGR3OMQQMzyLY4D+/mQ6ke8F53hYZUoQ4JdkqX8iImaHPe760Mrh saJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FHudRtp7yzYdmsxvUUGKxH7K88Fn6l9DBuMQ5iU2qAI=; b=pmQVEkJYJS58cn2JAKyZQmmQzZjRKKyvp0jjuLYAXdVN++q2RgENi3QB29Zrdxg5Yj IQB1ZB3ZXTnzh+gbokV4jPKSNSG08BkeIxp7R2VIqQBlNyd5bWdiMMvc2QdSyJ8mseVM E0PovlyrtZYocNmu0DmAGh+l0AHt5aH5ssMEoWyhvrnkn5HuAW1HDwm9DeH8J67k2prc OeLgdU3WKsHDSiruDjeCJae6aPCFXboXalRr6S+ukORbmxEGdS6AHvzJAWMLi/1YOK9Q mgZxJYn0sVk3rK44HsfkIycw0M5nYmD6GsIv0+LhIaWKZx3z9Ov+0x2Whj0c1bpNzN5b 4+7A== X-Gm-Message-State: AOAM533BRxycDbskrz4AcqUTOEjNE86VKZVJXLW4USjm6iT9ot1NyH+O xZaQV6dpPqsyiwrmDWEzLlWgVT0O6kwUEDYJGGn9Hg== X-Received: by 2002:a92:7f10:: with SMTP id a16mr12479315ild.134.1603735710869; Mon, 26 Oct 2020 11:08:30 -0700 (PDT) MIME-Version: 1.0 References: <20201017153857.2494845-1-fparent@baylibre.com> <20201017153857.2494845-2-fparent@baylibre.com> <20201026133006.GA29275@bogus> In-Reply-To: <20201026133006.GA29275@bogus> From: Fabien Parent Date: Mon, 26 Oct 2020 19:08:20 +0100 Message-ID: Subject: Re: [PATCH 2/2] clocksource: mediatek: add clk13m and bus clock support To: Rob Herring Cc: "moderated list:ARM/Mediatek SoC support" , Linux ARM , DTML , linux-kernel , Matthias Brugger , tglx@linutronix.de, Daniel Lezcano Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rob, On Mon, Oct 26, 2020 at 2:30 PM Rob Herring wrote: > > On Sat, Oct 17, 2020 at 05:38:57PM +0200, Fabien Parent wrote: > > Some MediaTek SoC like MT8516 need to enable additional clocks > > for the GPT timer. Enable them if present. > > > > Signed-off-by: Fabien Parent > > --- > > drivers/clocksource/timer-mediatek.c | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > > diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c > > index 9318edcd8963..42e2d2090484 100644 > > --- a/drivers/clocksource/timer-mediatek.c > > +++ b/drivers/clocksource/timer-mediatek.c > > @@ -9,6 +9,7 @@ > > > > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > > > +#include > > #include > > #include > > #include > > @@ -278,8 +279,19 @@ static int __init mtk_syst_init(struct device_node *node) > > > > static int __init mtk_gpt_init(struct device_node *node) > > { > > + struct clk *clk_13m, *clk_bus; > > int ret; > > > > + /* Optional clock*/ > > Then use the optional api variant. I looked for optional API variant but could only find these: * struct clk *devm_clk_get_optional(struct device *dev, const char *id); * struct clk *devm_clk_get_optional(struct device *dev, const char *id); These two require a "struct device" parameter but in the function mtk_gpt_init, we only have a "struct device_node" I didn't see any way to get a "struct device" from a "struct device_node". > > > + clk_13m = of_clk_get_by_name(node, "clk13m"); > > + if (!IS_ERR(clk_13m)) > > And then you can drop this check (or handle it for any error other than > clock is not present). > > > + clk_prepare_enable(clk_13m); > > + > > + /* Optional clock*/ > > + clk_bus = of_clk_get_by_name(node, "bus"); > > + if (!IS_ERR(clk_bus)) > > + clk_prepare_enable(clk_bus); > > + > > to.clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; > > to.clkevt.set_state_shutdown = mtk_gpt_clkevt_shutdown; > > to.clkevt.set_state_periodic = mtk_gpt_clkevt_set_periodic; > > -- > > 2.28.0 > >