Linux-Clk Archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: "Simek, Michal" <michal.simek@amd.com>,
	"Trivedi Manojbhai, Naman" <Naman.TrivediManojbhai@amd.com>,
	robh@kernel.org
Cc: linux-clk@vger.kernel.org <linux-clk@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org
	<linux-arm-kernel@lists.infradead.org>,
	linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] drivers: clk: zynqmp: remove clock name dependency
Date: Wed, 10 Apr 2024 21:17:52 -0700	[thread overview]
Message-ID: <a48f6017bacb4aacb0a318554229cb65.sboyd@kernel.org> (raw)
In-Reply-To: <PH7PR12MB728433875E7B7DD673E8785D8A342@PH7PR12MB7284.namprd12.prod.outlook.com>

Quoting Trivedi Manojbhai, Naman (2024-03-26 22:47:28)
> >>Quoting Naman Trivedi Manojbhai (2024-01-02 23:20:17)
> >>> Currently, from zynqmp_get_parent_list() function the clock driver
> >>> references the clock by name instead of its reference from device tree.
> >>> This causes problem when the clock name in the device tree is changed.
> >>>
> >>> Remove hard dependency of clock name and update the logic to use
> >>> clock reference from device tree instead of clock name.
> >>
> >>Please use struct clk_parent_data instead.
> >Thanks for review. As per my understanding, you suggest to replace the
> >proposed logic, and use "struct clk_parent_data" to get the clock name from
> >device tree.

No, do not get the clock name of a parent in the driver. Use struct
clk_parent_data to tell the clk framework what the parent is.

> >
> >I have gone through other drivers which use the "struct clk_parent_data"
> >structure, they have hard coded clock names in the driver. In zynqmp, the
> >driver receives clock name from firmware.

Don't use a string name. The devicetree index must be stable, so simply
use the index that the binding has as the index in struct
clk_parent_data.

	struct clk_parent_data parent_map[] = {
		{ .index = MY_DT_PARENT_1 }, /* parent index 0 */
		{ .index = MT_DT_PARENT_2 }, /* parent index 1 */
	};

> >
> >Also, the "zynqmp_get_parent_list" function is called before clocks are
> >registered. So at this point, we don't have the hw structure which has
> >clk_parent_data.

I guess that's a problem with how the code is written? 

> >
> >So, I did not get how to use the struct clk_parent_data in this case. Can you
> >please provide an example which I can look at as a reference?
> >

There are many references. A new qcom one is drivers/clk/qcom/gcc-x1e80100.c

  reply	other threads:[~2024-04-11  4:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03  7:20 [PATCH] drivers: clk: zynqmp: remove clock name dependency Naman Trivedi Manojbhai
2024-01-03 10:03 ` Michal Simek
2024-01-03 22:28 ` kernel test robot
2024-01-04  1:00 ` Stephen Boyd
2024-01-09 11:24   ` Trivedi Manojbhai, Naman
2024-01-29 16:48     ` Trivedi Manojbhai, Naman
2024-01-22 12:05   ` Trivedi Manojbhai, Naman
2024-03-07  6:06   ` Trivedi Manojbhai, Naman
2024-03-27  5:47     ` Trivedi Manojbhai, Naman
2024-04-11  4:17       ` Stephen Boyd [this message]
2024-01-04  1:41 ` kernel test robot

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=a48f6017bacb4aacb0a318554229cb65.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=Naman.TrivediManojbhai@amd.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=robh@kernel.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 read-only IMAP folder(s) and NNTP newsgroup(s).