linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Richard Cochran <richardcochran@gmail.com>,
	Murali Karicheri <m-karicheri2@ti.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Mugunthan V N <mugunthanvnm@ti.com>,
	Sekhar Nori <nsekhar@ti.com>,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org, Wingman Kwok <w-kwok2@ti.com>,
	linux-clk@vger.kernel.org
Subject: Re: [PATCH 2/6] net: ethernet: ti: cpts: add support for ext rftclk selection
Date: Thu, 8 Dec 2016 16:47:45 -0800	[thread overview]
Message-ID: <20161209004745.GJ5423@codeaurora.org> (raw)
In-Reply-To: <11994fbc-3713-6ef7-8a44-8a2442106dfc@ti.com>

On 12/06, Grygorii Strashko wrote:
> Subject: [PATCH] cpts refclk sel
> 
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
>  arch/arm/boot/dts/keystone-k2e-netcp.dtsi | 10 +++++-
>  drivers/net/ethernet/ti/cpts.c            | 52 ++++++++++++++++++++++++++++++-
>  2 files changed, 60 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/keystone-k2e-netcp.dtsi b/arch/arm/boot/dts/keystone-k2e-netcp.dtsi
> index 919e655..b27aa22 100644
> --- a/arch/arm/boot/dts/keystone-k2e-netcp.dtsi
> +++ b/arch/arm/boot/dts/keystone-k2e-netcp.dtsi
> @@ -138,7 +138,7 @@ netcp: netcp@24000000 {
>  	/* NetCP address range */
>  	ranges = <0 0x24000000 0x1000000>;
> 
> -	clocks = <&clkpa>, <&clkcpgmac>, <&chipclk12>;
> +	clocks = <&clkpa>, <&clkcpgmac>, <&cpts_mux>;
>  	clock-names = "pa_clk", "ethss_clk", "cpts";
>  	dma-coherent;
> 
> @@ -162,6 +162,14 @@ netcp: netcp@24000000 {
>  			cpts-ext-ts-inputs = <6>;
>  			cpts-ts-comp-length;
> 
> +			cpts_mux: cpts_refclk_mux {
> +				#clock-cells = <0>;
> +				clocks = <&chipclk12>, <&chipclk13>;
> +				cpts-mux-tbl = <0>, <1>;
> +				assigned-clocks = <&cpts_mux>;
> +				assigned-clock-parents = <&chipclk12>;

Is there a binding update? Why the subnode? Why not have it as
part of the netcp node? Does the cpts-mux-tbl property change?

> +			};
> +
>  			interfaces {
>  				gbe0: interface-0 {
>  					slave-port = <0>;
> diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
> index 938de22..ef94316 100644
> --- a/drivers/net/ethernet/ti/cpts.c
> +++ b/drivers/net/ethernet/ti/cpts.c
> @@ -17,6 +17,7 @@
>   * along with this program; if not, write to the Free Software
>   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
>   */
> +#include <linux/clk-provider.h>
>  #include <linux/err.h>
>  #include <linux/if.h>
>  #include <linux/hrtimer.h>
> @@ -672,6 +673,7 @@ int cpts_register(struct cpts *cpts)
>  	cpts->phc_index = ptp_clock_index(cpts->clock);
> 
>  	schedule_delayed_work(&cpts->overflow_work, cpts->ov_check_period);
> +

Maybe in another patch.

>  	return 0;
> 
>  err_ptp:
> @@ -741,6 +743,54 @@ static void cpts_calc_mult_shift(struct cpts *cpts)
>  		 freq, cpts->cc_mult, cpts->cc.shift, (ns - NSEC_PER_SEC));
>  }
> 
> +static int cpts_of_mux_clk_setup(struct cpts *cpts, struct device_node *node)
> +{
> +	unsigned int num_parents;
> +	const char **parent_names;
> +	struct device_node *refclk_np;
> +	void __iomem *reg;
> +	struct clk *clk;
> +	u32 *mux_table;
> +	int ret;
> +
> +	refclk_np = of_get_child_by_name(node, "cpts_refclk_mux");
> +	if (!refclk_np)
> +		return -EINVAL;
> +
> +	num_parents = of_clk_get_parent_count(refclk_np);
> +	if (num_parents < 1) {
> +		dev_err(cpts->dev, "mux-clock %s must have parents\n",
> +			refclk_np->name);
> +		return -EINVAL;
> +	}
> +	parent_names = devm_kzalloc(cpts->dev, (sizeof(char *) * num_parents),
> +				    GFP_KERNEL);
> +	if (!parent_names)
> +		return -ENOMEM;
> +
> +	of_clk_parent_fill(refclk_np, parent_names, num_parents);
> +
> +	mux_table = devm_kzalloc(cpts->dev, sizeof(*mux_table) * (32 + 1),
> +				 GFP_KERNEL);
> +	if (!mux_table)
> +		return -ENOMEM;
> +
> +	ret = of_property_read_variable_u32_array(refclk_np, "cpts-mux-tbl",
> +						  mux_table, 1, 32);
> +	if (ret < 0)
> +		return ret;
> +
> +	reg = &cpts->reg->rftclk_sel;
> +
> +	clk = clk_register_mux_table(cpts->dev, refclk_np->name,
> +				     parent_names, num_parents,
> +				     0, reg, 0, 0x1F, 0, mux_table, NULL);
> +	if (IS_ERR(clk))
> +		return PTR_ERR(clk);
> +
> +	return of_clk_add_provider(refclk_np, of_clk_src_simple_get, clk);

Can you please use the clk_hw APIs instead?


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  parent reply	other threads:[~2016-12-09  0:47 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-28 23:04 [PATCH 0/6] net: ethernet: ti: cpts: update and enable support on keystone 2 socs Grygorii Strashko
2016-11-28 23:04 ` [PATCH 1/6] net: ethernet: ti: netcp: add support of cpts Grygorii Strashko
2016-11-30  9:44   ` Richard Cochran
2016-11-30 17:31     ` Grygorii Strashko
2016-11-30 18:22       ` Richard Cochran
2016-12-05 14:49   ` Rob Herring
2016-12-05 18:25     ` Grygorii Strashko
2016-12-05 19:30       ` Richard Cochran
2016-11-28 23:04 ` [PATCH 2/6] net: ethernet: ti: cpts: add support for ext rftclk selection Grygorii Strashko
2016-11-30  9:56   ` Richard Cochran
2016-11-30 17:35     ` Grygorii Strashko
2016-12-06 19:39       ` Grygorii Strashko
2016-12-06 20:25         ` Richard Cochran
2016-12-06 20:40           ` Grygorii Strashko
2016-12-09  0:47         ` Stephen Boyd [this message]
2016-12-09 23:29           ` Grygorii Strashko
2016-12-05 14:51   ` Rob Herring
2016-11-28 23:04 ` [PATCH 3/6] net: ethernet: ti: cpts: add support of cpts HW_TS_PUSH Grygorii Strashko
2016-11-30 10:19   ` Richard Cochran
2016-11-30 11:08   ` Jan Lübbe
2016-11-30 20:15     ` Grygorii Strashko
2016-12-03 23:21   ` Richard Cochran
2016-12-08 19:04     ` Grygorii Strashko
2016-12-09  8:50       ` Richard Cochran
2016-11-28 23:04 ` [PATCH 4/6] net: ethernet: ti: cpts: add ptp pps support Grygorii Strashko
2016-11-30 10:05   ` Richard Cochran
2016-12-06 18:08     ` Richard Cochran
2016-12-06 20:43       ` Grygorii Strashko
2016-11-30 11:01   ` Jan Lübbe
2016-11-30 18:45   ` Richard Cochran
2016-11-30 20:43     ` Grygorii Strashko
2016-11-30 22:17       ` Richard Cochran
2016-12-02  9:58         ` Richard Cochran
2016-12-02 17:58           ` Grygorii Strashko
2016-12-02 19:28             ` Richard Cochran
2016-11-28 23:04 ` [PATCH 5/6] ARM: keystone: dts: fix netcp clocks and add names Grygorii Strashko
2016-11-28 23:04 ` [PATCH 6/6] ARM: dts: keystone: enable time synchronization (cpts) submodule Grygorii Strashko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161209004745.GJ5423@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=grygorii.strashko@ti.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=mugunthanvnm@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=richardcochran@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=w-kwok2@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).