linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv3b 5/5] ARM: OMAP2+: hwmod: populate clkctrl clocks for hwmods if available
Date: Tue, 30 May 2017 11:15:17 -0700	[thread overview]
Message-ID: <20170530181516.GB3730@atomide.com> (raw)
In-Reply-To: <1496155669-1677-6-git-send-email-t-kristo@ti.com>

* Tero Kristo <t-kristo@ti.com> [170530 07:52]:
> If clkctrl clocks are available on a device, populate these automatically
> to replace hwmod main_clk info. First, the patch parses all "ti,clkctrl"
> compatible nodes and maps these against existing clockdomain data. Once
> done, individual hwmod init routines can search for a clkctrl clock
> handle based on the clockdomain info and the created mapping.
...
> --- a/arch/arm/mach-omap2/omap_hwmod.c
> +++ b/arch/arm/mach-omap2/omap_hwmod.c
>  /**
>   * _init_main_clk - get a struct clk * for the the hwmod's main functional clk
>   * @oh: struct omap_hwmod *
> + * @np: device node mapped to this hwmod
>   *
>   * Called from _init_clocks().  Populates the @oh _clk (main
>   * functional clock pointer) if a clock matching the hwmod name is found,
>   * or a main_clk is present.  Returns 0 on success or -EINVAL on error.
>   */
> -static int _init_main_clk(struct omap_hwmod *oh)
> +static int _init_main_clk(struct omap_hwmod *oh, struct device_node *np)
>  {
>  	int ret = 0;
> -	char name[MOD_CLK_MAX_NAME_LEN];
> -	struct clk *clk;
> -	static const char modck[] = "_mod_ck";
> +	struct clk *clk = NULL;
>  
> -	if (strlen(oh->name) >= MOD_CLK_MAX_NAME_LEN - strlen(modck))
> -		pr_warn("%s: warning: cropping name for %s\n", __func__,
> -			oh->name);
> -
> -	strlcpy(name, oh->name, MOD_CLK_MAX_NAME_LEN - strlen(modck));
> -	strlcat(name, modck, MOD_CLK_MAX_NAME_LEN);
> +	if (np) {
> +		clk = _lookup_clkctrl_clk(oh, np);
> +
> +		if (!IS_ERR_OR_NULL(clk)) {
> +			pr_debug("%s: mapped main_clk %s for %s\n", __func__,
> +				 __clk_get_name(clk), oh->name);
> +			oh->main_clk = __clk_get_name(clk);
> +			oh->_clk = clk;
> +			soc_ops.disable_direct_prcm(oh);
> +		}
> +	}

Shouldn't we just parse all "ti,clkctrl" matches to
a list, then match against that list?

Again I'm worried that the "struct device_node *np"
here won't really map to struct omap_hwmod but to one of
the child devices. Or what is the np here?

Regards,

Tony

  reply	other threads:[~2017-05-30 18:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 14:47 [PATCHv3b 0/5] ARM: OMAP2+: preparation for clk/clkctrl support Tero Kristo
2017-05-30 14:47 ` [PATCHv3b 1/5] ARM: OMAP2+: timer: add support for fetching fck handle from DT Tero Kristo
2017-05-30 14:47 ` [PATCHv3b 2/5] ARM: OMAP4: hwmod_data: add opt clks for dss_hdmi and dss_venc Tero Kristo
2017-05-30 14:47 ` [PATCHv3b 3/5] ARM: omap2+: clockdomain: add clkdm_xlate_address Tero Kristo
2017-05-30 14:47 ` [PATCHv3b 4/5] ARM: OMAP4: cminst: add support for clkdm_xlate_address Tero Kristo
2017-05-30 18:10   ` Tony Lindgren
2017-05-31 14:36     ` Tero Kristo
2017-05-30 14:47 ` [PATCHv3b 5/5] ARM: OMAP2+: hwmod: populate clkctrl clocks for hwmods if available Tero Kristo
2017-05-30 18:15   ` Tony Lindgren [this message]
2017-05-31 14:40     ` Tero Kristo
2017-05-30 18:16 ` [PATCHv3b 0/5] ARM: OMAP2+: preparation for clk/clkctrl support Tony Lindgren
2017-05-31 14:40   ` Tero Kristo

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=20170530181516.GB3730@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).