Received: by 10.223.164.202 with SMTP id h10csp4773087wrb; Wed, 29 Nov 2017 11:35:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMaJeL4HDICCOewhyQz5jWPbFtQL513lYAYiCeZtRXriAiKoSCT7kYjqmK3WAl9JaACI9K7Z X-Received: by 10.99.123.14 with SMTP id w14mr3843908pgc.172.1511984155565; Wed, 29 Nov 2017 11:35:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511984155; cv=none; d=google.com; s=arc-20160816; b=D2aSkcg5v98mZdziFoTVKyNlMmssaQg6cMbQbqlk6ZRtftijFG075zmyq8eFkHSvVk R5TwVzSW4L/lo+6S5DzG9cgd2EVGCFq9tvjfQIZKpmVB7VVx9s0qT3Qf52ZI1akKyYVV 5qriETOj4tRetgqIqfwABQuc0OhQl0rBxodPLOuarTpcutnKWKkntZaD72W0sKq5Nb9j mXpfeYDnhZ/Psu39O1wZmHTHK7bUC4mPRm+iZZlE9DS4q2bXittqmXHEi13riNH8B0zo uAf+Aaa7sXDt8QbwCnbOxqz1Q3+ApDA3V3WYIkaOGcqawShVvBPNLPUeaVqbnyAXaIKe wDag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=xI2dZsRaWCKEWosaeR8tBWO3m2qfDQmNCZAE07G8MDQ=; b=GYftvPHAp3rW73svexBabmCHygLNOryjtKNhDTR33mHcMCdR1jl2i7fgNWUISU3NmL YrAkDvdKBhywycEuZ3wl8ogE8SGvpEZyIMXx4f4Vz5bIuEU04gdhR3foBKINl/ZMc/oT KToKyff714vkI8KXcxeOgmKE4G75diyWxlcedOBOAdC1prbl4tmtcOOGDetadKO7puoO LyU9pHzmW1F+PS2BofE9ImPBYFTMu6Ir4J8OgHbFZPHqqJGjm7vezOwczTqc1WpkvJGV YzQyRW+k2Ps7gkGlGwHSZGbgy32LpkaFS3VgRfHXj/3d9x7fAOxATDNSze83AXEE8S2Y avEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=JgpHiUun; dkim=pass header.i=@codeaurora.org header.s=default header.b=lZkfNKqt; 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 b63si1716466pga.635.2017.11.29.11.35.41; Wed, 29 Nov 2017 11:35:55 -0800 (PST) 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; dkim=pass header.i=@codeaurora.org header.s=default header.b=JgpHiUun; dkim=pass header.i=@codeaurora.org header.s=default header.b=lZkfNKqt; 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 S1752650AbdK2Tei (ORCPT + 99 others); Wed, 29 Nov 2017 14:34:38 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:34316 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752290AbdK2Teg (ORCPT ); Wed, 29 Nov 2017 14:34:36 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C8EC360720; Wed, 29 Nov 2017 19:34:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511984075; bh=g6Zui1gHut44CZTFHLggGTsn43lZZ+tVTAEkbWRGyyU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JgpHiUunk0i9BkHpqmj4pyLRA822OSrFdwxA74nloux7Yt66+AkjUSzf0j9VdnVgi IfVpG9PyYKjP3cmB6xua6o+IsOVWNvimqnJvLaTf1F98FEB5+hUrlSkldbpcvKxhG4 65DD/mKsIEeHfptQITeIz+8xtib/YRtQkhCzwkVY= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: sboyd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5C32960246; Wed, 29 Nov 2017 19:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1511984074; bh=g6Zui1gHut44CZTFHLggGTsn43lZZ+tVTAEkbWRGyyU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lZkfNKqtNUgBazTh4N2QNDNNd4f94vUBo6kjFZw2bKMVXCOjFVeNwU9Vs2VHVBM1D 1v5z02yBR7G85tsanTAXgtyeFV1oGMKKUxBO7Lda9lPi99ubPnr2exWJ0845hiUMC3 huF0uHV/UHNQ++Y3WVcg4JjC7HMgKW377OjG9xck= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5C32960246 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sboyd@codeaurora.org Date: Wed, 29 Nov 2017 11:34:33 -0800 From: Stephen Boyd To: Yixun Lan Cc: Neil Armstrong , Jerome Brunet , Kevin Hilman , Rob Herring , Mark Rutland , Michael Turquette , Carlo Caione , Qiufang Dai , linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/3] clk: meson-axg: add clock controller drivers Message-ID: <20171129193433.GA19419@codeaurora.org> References: <20171128125330.363-1-yixun.lan@amlogic.com> <20171128125330.363-3-yixun.lan@amlogic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171128125330.363-3-yixun.lan@amlogic.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/28, Yixun Lan wrote: > diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c > new file mode 100644 > index 000000000000..51c5b4062715 > --- /dev/null > +++ b/drivers/clk/meson/axg.c > @@ -0,0 +1,948 @@ > +/* > + * AmLogic Meson-AXG Clock Controller Driver > + * > + * Copyright (c) 2016 Baylibre SAS. > + * Author: Michael Turquette > + * > + * Copyright (c) 2017 Amlogic, inc. > + * Author: Qiufang Dai > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "clkc.h" > +#include "axg.h" > + > +static DEFINE_SPINLOCK(clk_lock); meson_axg_clk_lock? > + > +static const struct pll_rate_table sys_pll_rate_table[] = { > + PLL_RATE(24000000, 56, 1, 2), > + PLL_RATE(48000000, 64, 1, 2), > + PLL_RATE(72000000, 72, 1, 2), > + PLL_RATE(96000000, 64, 1, 2), > + PLL_RATE(120000000, 80, 1, 2), > + PLL_RATE(144000000, 96, 1, 2), > + PLL_RATE(168000000, 56, 1, 1), > + PLL_RATE(192000000, 64, 1, 1), > + PLL_RATE(216000000, 72, 1, 1), > + PLL_RATE(240000000, 80, 1, 1), [...] > + > +static const struct clkc_data axg_clkc_data = { > + .clk_gates = axg_clk_gates, > + .clk_gates_count = ARRAY_SIZE(axg_clk_gates), > + .clk_mplls = axg_clk_mplls, > + .clk_mplls_count = ARRAY_SIZE(axg_clk_mplls), > + .clk_plls = axg_clk_plls, > + .clk_plls_count = ARRAY_SIZE(axg_clk_plls), > + .clk_muxes = axg_clk_muxes, > + .clk_muxes_count = ARRAY_SIZE(axg_clk_muxes), > + .clk_dividers = axg_clk_dividers, > + .clk_dividers_count = ARRAY_SIZE(axg_clk_dividers), > + .hw_onecell_data = &axg_hw_onecell_data, > +}; > + > +static const struct of_device_id clkc_match_table[] = { > + { .compatible = "amlogic,axg-clkc", .data = &axg_clkc_data }, > + {}, Nitpick: Drop the comma. Nothing comes after this. > +}; > + > +static int axg_clkc_probe(struct platform_device *pdev) > +{ > + const struct clkc_data *clkc_data; > + void __iomem *clk_base; > + int ret, clkid, i; > + struct device *dev = &pdev->dev; > + > + clkc_data = of_device_get_match_data(&pdev->dev); > + if (!clkc_data) > + return -EINVAL; > + > + /* Generic clocks and PLLs */ > + clk_base = of_iomap(dev->of_node, 0); Use platform device APIs for ioremapping? > + if (!clk_base) { > + pr_err("%s: Unable to map clk base\n", __func__); > + return -ENXIO; > + } > + > + /* Populate base address for PLLs */ > + for (i = 0; i < clkc_data->clk_plls_count; i++) > + clkc_data->clk_plls[i]->base = clk_base; > + > + /* Populate base address for MPLLs */ > + for (i = 0; i < clkc_data->clk_mplls_count; i++) > + clkc_data->clk_mplls[i]->base = clk_base; > + > + /* Populate base address for gates */ > + for (i = 0; i < clkc_data->clk_gates_count; i++) > + clkc_data->clk_gates[i]->reg = clk_base + > + (u64)clkc_data->clk_gates[i]->reg; > + > + /* Populate base address for muxes */ > + for (i = 0; i < clkc_data->clk_muxes_count; i++) > + clkc_data->clk_muxes[i]->reg = clk_base + > + (u64)clkc_data->clk_muxes[i]->reg; > + > + /* Populate base address for dividers */ > + for (i = 0; i < clkc_data->clk_dividers_count; i++) > + clkc_data->clk_dividers[i]->reg = clk_base + > + (u64)clkc_data->clk_dividers[i]->reg; > + > + /* > + * register all clks > + */ Yes, that's obvious.. > + for (clkid = 0; clkid < clkc_data->hw_onecell_data->num; clkid++) { > + /* array might be sparse */ > + if (!clkc_data->hw_onecell_data->hws[clkid]) > + continue; > + > + ret = devm_clk_hw_register(dev, > + clkc_data->hw_onecell_data->hws[clkid]); > + if (ret) > + goto iounmap; > + } > + > + return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get, > + clkc_data->hw_onecell_data); > + > +iounmap: > + iounmap(clk_base); > + return ret; > +} > + > +static struct platform_driver axg_driver = { > + .probe = axg_clkc_probe, > + .driver = { > + .name = "axg-clkc", > + .of_match_table = clkc_match_table, > + }, > +}; > + > +builtin_platform_driver(axg_driver); > diff --git a/include/dt-bindings/clock/axg-clkc.h b/include/dt-bindings/clock/axg-clkc.h > new file mode 100644 > index 000000000000..d2c0f49ba0df > --- /dev/null > +++ b/include/dt-bindings/clock/axg-clkc.h > @@ -0,0 +1,72 @@ > +/* > + * Meson-AXG clock tree IDs > + * > + * Copyright (c) 2017 Amlogic, Inc. All rights reserved. > + * > + * SPDX-License-Identifier: (GPL-2.0+ OR MIT) There's a standard way to add these it seems. They should be the first line in the file and look like /* SPDX-License-Identifier: */ for header files and // SPDX-License-Identifier: for C files. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project From 1585353672250167462@xxx Tue Nov 28 23:17:59 +0000 2017 X-GM-THRID: 1585314441031766268 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread