All of lore.kernel.org
 help / color / mirror / Atom feed
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 4/5] clk: hi6220: Clock driver support for Hisilicon hi6220 SoC
Date: Fri, 15 May 2015 12:30:41 -0700	[thread overview]
Message-ID: <20150515193041.GO31753@codeaurora.org> (raw)
In-Reply-To: <5555A37B.1090105@huawei.com>

On 05/15, Bintian wrote:
> On 2015/5/15 8:25, Stephen Boyd wrote:
> >On 05/05, Bintian Wang wrote:
> >>diff --git a/drivers/clk/hisilicon/clkdivider-hi6220.c b/drivers/clk/hisilicon/clkdivider-hi6220.c
> >>+
> >>+/**
> >>+ * struct hi6220_clk_divider - divider clock for hi6220
> >>+ *
> >>+ * @hw:		handle between common and hardware-specific interfaces
> >>+ * @reg:	register containing divider
> >>+ * @shift:	shift to the divider bit field
> >>+ * @width:	width of the divider bit field
> >>+ * @mask:	mask for setting divider rate
> >>+ * @table:	the div table that the divider supports
> >>+ * @lock:	register lock
> >>+ */
> >>+struct hi6220_clk_divider {
> >>+	struct clk_hw	hw;
> >>+	void __iomem	*reg;
> >>+	u8		shift;
> >>+	u8		width;
> >>+	u32		mask;
> >>+	const struct clk_div_table *table;
> >>+	spinlock_t	*lock;
> >>+};
> >
> >The clk-divider.c code has been made "reusable". Can you please
> >try to use the functions that it now exposes instead of
> >copy/pasting it and modifying it to suit your needs? A lot of
> >this code looks the same.
> In fact, I discussed this problem with Rob Herring and Mike Turquette
> in the 96boards internal mail list before.
> 
> The divider in hi6220 has a mask bit to guarantee writing the correct
> bits in register when setting rate, but the index of this mask bit has
> no rules to get (e.g. by left shift some fixed bits), so I add this
> divider clock to handle it, we can regard hi6220_clk_divider as a
> special case of generic divider clock.
> 
> If I don't add this divider clock for hi6220 chip, then I should change
> the core APIs "clk_register_divider" and "clk_register_divider_table",
> and then many other drivers will be updated.
> So I think just add this divider clock is a good solution now.

I think you missed my point. I didn't suggest using
clk_register_divider or clk_register_divider_table(). I'm
suggesting to use 

unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate,
                unsigned int val, const struct clk_div_table *table,
                unsigned long flags);
long divider_round_rate(struct clk_hw *hw, unsigned long rate,
                unsigned long *prate, const struct clk_div_table *table,
                u8 width, unsigned long flags);
int divider_get_val(unsigned long rate, unsigned long parent_rate,
                const struct clk_div_table *table, u8 width,
                unsigned long flags);

> >>+		return ERR_PTR(-ENOMEM);
> >>+	}
> >>+
> >>+	for (i = 0; i < max_div; i++) {
> >>+		table[i].div = min_div + i;
> >>+		table[i].val = table[i].div - 1;
> >>+	}
> >>+
> >>+	init.name = name;
> >>+	init.ops = &hi6220_clkdiv_ops;
> >>+	init.flags = flags | CLK_IS_BASIC;
> >
> >It's basic?
> I rechecked this flag, it's really useless to us, so I can remove it.
> But can you tell me which case I should use it?

I think the basic flag is there for drivers that want to know what type
of clock they're dealing with when all they have is the struct clk_hw
pointer. I like to discourage use of this flag in hopes of deleting
it someday.

> 
> How about just send this patch for review not the whole patch set in
> next version?
> 

Yes a single patch is fine. I take it you want the patch to go
through arm-soc with some Ack from us?

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

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@codeaurora.org>
To: Bintian <bintian.wang@huawei.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, catalin.marinas@arm.com,
	will.deacon@arm.com, devicetree@vger.kernel.org,
	robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	khilman@linaro.org, mturquette@linaro.org,
	rob.herring@linaro.org, zhangfei.gao@linaro.org,
	haojian.zhuang@linaro.org, xuwei5@hisilicon.com,
	jh80.chung@samsung.com, olof@lixom.net, yanhaifeng@gmail.com,
	xuejiancheng@huawei.com, sledge.yanwei@huawei.com,
	tomeu.vizoso@collabora.com, linux@arm.linux.org.uk,
	guodong.xu@linaro.org, jorge.ramirez-ortiz@linaro.org,
	tyler.baker@linaro.org, khilman@kernel.org, pebolle@tiscali.nl,
	arnd@arndb.de, marc.zyngier@arm.com, xuyiping@hisilicon.com,
	wangbinghui@hisilicon.com, zhenwei.wang@hisilicon.com,
	victor.lixin@hisilicon.com, puck.chen@hisilicon.com,
	dan.zhao@hisilicon.com, huxinw
Subject: Re: [PATCH v4 4/5] clk: hi6220: Clock driver support for Hisilicon hi6220 SoC
Date: Fri, 15 May 2015 12:30:41 -0700	[thread overview]
Message-ID: <20150515193041.GO31753@codeaurora.org> (raw)
In-Reply-To: <5555A37B.1090105@huawei.com>

On 05/15, Bintian wrote:
> On 2015/5/15 8:25, Stephen Boyd wrote:
> >On 05/05, Bintian Wang wrote:
> >>diff --git a/drivers/clk/hisilicon/clkdivider-hi6220.c b/drivers/clk/hisilicon/clkdivider-hi6220.c
> >>+
> >>+/**
> >>+ * struct hi6220_clk_divider - divider clock for hi6220
> >>+ *
> >>+ * @hw:		handle between common and hardware-specific interfaces
> >>+ * @reg:	register containing divider
> >>+ * @shift:	shift to the divider bit field
> >>+ * @width:	width of the divider bit field
> >>+ * @mask:	mask for setting divider rate
> >>+ * @table:	the div table that the divider supports
> >>+ * @lock:	register lock
> >>+ */
> >>+struct hi6220_clk_divider {
> >>+	struct clk_hw	hw;
> >>+	void __iomem	*reg;
> >>+	u8		shift;
> >>+	u8		width;
> >>+	u32		mask;
> >>+	const struct clk_div_table *table;
> >>+	spinlock_t	*lock;
> >>+};
> >
> >The clk-divider.c code has been made "reusable". Can you please
> >try to use the functions that it now exposes instead of
> >copy/pasting it and modifying it to suit your needs? A lot of
> >this code looks the same.
> In fact, I discussed this problem with Rob Herring and Mike Turquette
> in the 96boards internal mail list before.
> 
> The divider in hi6220 has a mask bit to guarantee writing the correct
> bits in register when setting rate, but the index of this mask bit has
> no rules to get (e.g. by left shift some fixed bits), so I add this
> divider clock to handle it, we can regard hi6220_clk_divider as a
> special case of generic divider clock.
> 
> If I don't add this divider clock for hi6220 chip, then I should change
> the core APIs "clk_register_divider" and "clk_register_divider_table",
> and then many other drivers will be updated.
> So I think just add this divider clock is a good solution now.

I think you missed my point. I didn't suggest using
clk_register_divider or clk_register_divider_table(). I'm
suggesting to use 

unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate,
                unsigned int val, const struct clk_div_table *table,
                unsigned long flags);
long divider_round_rate(struct clk_hw *hw, unsigned long rate,
                unsigned long *prate, const struct clk_div_table *table,
                u8 width, unsigned long flags);
int divider_get_val(unsigned long rate, unsigned long parent_rate,
                const struct clk_div_table *table, u8 width,
                unsigned long flags);

> >>+		return ERR_PTR(-ENOMEM);
> >>+	}
> >>+
> >>+	for (i = 0; i < max_div; i++) {
> >>+		table[i].div = min_div + i;
> >>+		table[i].val = table[i].div - 1;
> >>+	}
> >>+
> >>+	init.name = name;
> >>+	init.ops = &hi6220_clkdiv_ops;
> >>+	init.flags = flags | CLK_IS_BASIC;
> >
> >It's basic?
> I rechecked this flag, it's really useless to us, so I can remove it.
> But can you tell me which case I should use it?

I think the basic flag is there for drivers that want to know what type
of clock they're dealing with when all they have is the struct clk_hw
pointer. I like to discourage use of this flag in hopes of deleting
it someday.

> 
> How about just send this patch for review not the whole patch set in
> next version?
> 

Yes a single patch is fine. I take it you want the patch to go
through arm-soc with some Ack from us?

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

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@codeaurora.org>
To: Bintian <bintian.wang@huawei.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, catalin.marinas@arm.com,
	will.deacon@arm.com, devicetree@vger.kernel.org,
	robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	khilman@linaro.org, mturquette@linaro.org,
	rob.herring@linaro.org, zhangfei.gao@linaro.org,
	haojian.zhuang@linaro.org, xuwei5@hisilicon.com,
	jh80.chung@samsung.com, olof@lixom.net, yanhaifeng@gmail.com,
	xuejiancheng@huawei.com, sledge.yanwei@huawei.com,
	tomeu.vizoso@collabora.com, linux@arm.linux.org.uk,
	guodong.xu@linaro.org, jorge.ramirez-ortiz@linaro.org,
	tyler.baker@linaro.org, khilman@kernel.org, pebolle@tiscali.nl,
	arnd@arndb.de, marc.zyngier@arm.com, xuyiping@hisilicon.com,
	wangbinghui@hisilicon.com, zhenwei.wang@hisilicon.com,
	victor.lixin@hisilicon.com, puck.chen@hisilicon.com,
	dan.zhao@hisilicon.com, huxinwei@huawei.com,
	z.liuxinliang@huawei.com, heyunlei@huawei.com,
	kong.kongxinwei@hisilicon.com, btw@mail.itp.ac.cn,
	w.f@huawei.com, liguozhu@hisilicon.com
Subject: Re: [PATCH v4 4/5] clk: hi6220: Clock driver support for Hisilicon hi6220 SoC
Date: Fri, 15 May 2015 12:30:41 -0700	[thread overview]
Message-ID: <20150515193041.GO31753@codeaurora.org> (raw)
In-Reply-To: <5555A37B.1090105@huawei.com>

On 05/15, Bintian wrote:
> On 2015/5/15 8:25, Stephen Boyd wrote:
> >On 05/05, Bintian Wang wrote:
> >>diff --git a/drivers/clk/hisilicon/clkdivider-hi6220.c b/drivers/clk/hisilicon/clkdivider-hi6220.c
> >>+
> >>+/**
> >>+ * struct hi6220_clk_divider - divider clock for hi6220
> >>+ *
> >>+ * @hw:		handle between common and hardware-specific interfaces
> >>+ * @reg:	register containing divider
> >>+ * @shift:	shift to the divider bit field
> >>+ * @width:	width of the divider bit field
> >>+ * @mask:	mask for setting divider rate
> >>+ * @table:	the div table that the divider supports
> >>+ * @lock:	register lock
> >>+ */
> >>+struct hi6220_clk_divider {
> >>+	struct clk_hw	hw;
> >>+	void __iomem	*reg;
> >>+	u8		shift;
> >>+	u8		width;
> >>+	u32		mask;
> >>+	const struct clk_div_table *table;
> >>+	spinlock_t	*lock;
> >>+};
> >
> >The clk-divider.c code has been made "reusable". Can you please
> >try to use the functions that it now exposes instead of
> >copy/pasting it and modifying it to suit your needs? A lot of
> >this code looks the same.
> In fact, I discussed this problem with Rob Herring and Mike Turquette
> in the 96boards internal mail list before.
> 
> The divider in hi6220 has a mask bit to guarantee writing the correct
> bits in register when setting rate, but the index of this mask bit has
> no rules to get (e.g. by left shift some fixed bits), so I add this
> divider clock to handle it, we can regard hi6220_clk_divider as a
> special case of generic divider clock.
> 
> If I don't add this divider clock for hi6220 chip, then I should change
> the core APIs "clk_register_divider" and "clk_register_divider_table",
> and then many other drivers will be updated.
> So I think just add this divider clock is a good solution now.

I think you missed my point. I didn't suggest using
clk_register_divider or clk_register_divider_table(). I'm
suggesting to use 

unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate,
                unsigned int val, const struct clk_div_table *table,
                unsigned long flags);
long divider_round_rate(struct clk_hw *hw, unsigned long rate,
                unsigned long *prate, const struct clk_div_table *table,
                u8 width, unsigned long flags);
int divider_get_val(unsigned long rate, unsigned long parent_rate,
                const struct clk_div_table *table, u8 width,
                unsigned long flags);

> >>+		return ERR_PTR(-ENOMEM);
> >>+	}
> >>+
> >>+	for (i = 0; i < max_div; i++) {
> >>+		table[i].div = min_div + i;
> >>+		table[i].val = table[i].div - 1;
> >>+	}
> >>+
> >>+	init.name = name;
> >>+	init.ops = &hi6220_clkdiv_ops;
> >>+	init.flags = flags | CLK_IS_BASIC;
> >
> >It's basic?
> I rechecked this flag, it's really useless to us, so I can remove it.
> But can you tell me which case I should use it?

I think the basic flag is there for drivers that want to know what type
of clock they're dealing with when all they have is the struct clk_hw
pointer. I like to discourage use of this flag in hopes of deleting
it someday.

> 
> How about just send this patch for review not the whole patch set in
> next version?
> 

Yes a single patch is fine. I take it you want the patch to go
through arm-soc with some Ack from us?

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

  reply	other threads:[~2015-05-15 19:30 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 12:06 [PATCH v4 0/5] arm64,hi6220: Enable Hisilicon Hi6220 SoC Bintian Wang
2015-05-05 12:06 ` Bintian Wang
2015-05-05 12:06 ` Bintian Wang
2015-05-05 12:06 ` [PATCH v4 1/5] arm64: Enable Hisilicon ARMv8 SoC family in Kconfig and defconfig Bintian Wang
2015-05-05 12:06   ` Bintian Wang
2015-05-05 12:06   ` Bintian Wang
2015-05-05 12:06 ` [PATCH v4 2/5] arm64: hi6220: Document devicetree bindings for Hisilicon hi6220 SoC Bintian Wang
2015-05-05 12:06   ` Bintian Wang
2015-05-05 12:06   ` Bintian Wang
2015-05-15  0:27   ` Stephen Boyd
2015-05-15  0:27     ` Stephen Boyd
2015-05-15  0:27     ` Stephen Boyd
2015-05-15  1:31     ` Bintian
2015-05-15  1:31       ` Bintian
2015-05-15  1:31       ` Bintian
2015-05-05 12:06 ` [PATCH v4 3/5] clk: hi6220: Document devicetree bindings for hi6220 clock Bintian Wang
2015-05-05 12:06   ` Bintian Wang
2015-05-05 12:06   ` Bintian Wang
2015-05-15  0:26   ` Stephen Boyd
2015-05-15  0:26     ` Stephen Boyd
2015-05-15  0:26     ` Stephen Boyd
2015-05-05 12:06 ` [PATCH v4 4/5] clk: hi6220: Clock driver support for Hisilicon hi6220 SoC Bintian Wang
2015-05-05 12:06   ` Bintian Wang
2015-05-05 12:06   ` Bintian Wang
2015-05-15  0:25   ` Stephen Boyd
2015-05-15  0:25     ` Stephen Boyd
2015-05-15  0:25     ` Stephen Boyd
2015-05-15  7:42     ` Bintian
2015-05-15  7:42       ` Bintian
2015-05-15  7:42       ` Bintian
2015-05-15 19:30       ` Stephen Boyd [this message]
2015-05-15 19:30         ` Stephen Boyd
2015-05-15 19:30         ` Stephen Boyd
2015-05-16  2:54         ` Brent Wang
2015-05-16  2:54           ` Brent Wang
2015-05-16  2:54           ` Brent Wang
2015-05-19 20:35           ` Stephen Boyd
2015-05-19 20:35             ` Stephen Boyd
2015-05-19 20:35             ` Stephen Boyd
2015-05-20  0:52             ` Bintian
2015-05-20  0:52               ` Bintian
2015-05-20  0:52               ` Bintian
2015-05-05 12:06 ` [PATCH v4 5/5] arm64: dts: Add dts files for Hisilicon Hi6220 SoC Bintian Wang
2015-05-05 12:06   ` Bintian Wang
2015-05-05 12:06   ` Bintian Wang
2015-05-05 17:13   ` Mark Rutland
2015-05-05 17:13     ` Mark Rutland
2015-05-06  3:16     ` Bintian
2015-05-06  3:16       ` Bintian
2015-05-06  3:51       ` Leo Yan
2015-05-06  3:51         ` Leo Yan
2015-05-06  9:20         ` Mark Rutland
2015-05-06  9:20           ` Mark Rutland
2015-05-06 11:17           ` Leo Yan
2015-05-06 11:17             ` Leo Yan
2015-05-06  6:50       ` Bintian
2015-05-06  6:50         ` Bintian
2015-05-06  9:30         ` Mark Rutland
2015-05-06  9:30           ` Mark Rutland
2015-05-06 10:36           ` Bintian
2015-05-06 10:36             ` Bintian
2015-05-06 10:55             ` Mark Rutland
2015-05-06 10:55               ` Mark Rutland
2015-05-06 15:31               ` Brent Wang
2015-05-06 15:31                 ` Brent Wang
2015-05-06 15:44                 ` Mark Rutland
2015-05-06 15:44                   ` Mark Rutland
2015-05-06 16:03                   ` Brent Wang
2015-05-06 16:03                     ` Brent Wang
2015-05-06 16:23                     ` Mark Rutland
2015-05-06 16:23                       ` Mark Rutland
2015-05-06 17:15                       ` Brent Wang
2015-05-06 17:15                         ` Brent Wang
2015-05-07  7:24                         ` Bintian
2015-05-07  7:24                           ` Bintian
2015-05-13  7:12               ` Bintian Wang
2015-05-13  7:12                 ` Bintian Wang
2015-05-13  7:30                 ` Bintian
2015-05-13  7:30                   ` Bintian
2015-05-06 10:38           ` Haojian Zhuang
2015-05-06 10:38             ` Haojian Zhuang
2015-05-06 11:01             ` Mark Rutland
2015-05-06 11:01               ` Mark Rutland
2015-05-05 13:45 ` [PATCH v4 0/5] arm64,hi6220: Enable " Haojian Zhuang
2015-05-05 13:45   ` Haojian Zhuang
2015-05-05 13:45   ` Haojian Zhuang
2015-05-05 23:46 ` Tyler Baker
2015-05-05 23:46   ` Tyler Baker
2015-05-05 23:46   ` Tyler Baker
2015-05-06 10:46   ` Bintian
2015-05-06 10:46     ` Bintian
2015-05-06 10:46     ` Bintian
2015-05-07  9:02 ` Will Deacon
2015-05-07  9:02   ` Will Deacon
2015-05-07  9:29   ` Bintian
2015-05-07  9:29     ` Bintian
2015-05-07 11:25     ` Will Deacon
2015-05-07 11:25       ` Will Deacon
2015-05-07 11:55       ` Leo Yan
2015-05-07 11:55         ` Leo Yan
2015-05-07 12:01       ` Bintian
2015-05-07 12:01         ` Bintian
2015-05-07 12:57         ` Will Deacon
2015-05-07 12:57           ` Will Deacon
2015-05-07 13:06           ` Bintian
2015-05-07 13:06             ` Bintian
2015-05-07  9:33   ` Haojian Zhuang
2015-05-07  9:33     ` Haojian Zhuang
2015-05-07 10:44     ` Jorge Ramirez-Ortiz
2015-05-07 10:44       ` Jorge Ramirez-Ortiz
2015-05-13  7:33 ` Bintian
2015-05-13  7:33   ` Bintian
2015-05-13  7:33   ` Bintian
2015-05-13  9:16   ` Will Deacon
2015-05-13  9:16     ` Will Deacon
2015-05-13  9:19     ` Arnd Bergmann
2015-05-13  9:19       ` Arnd Bergmann
2015-05-13 10:17     ` Bintian
2015-05-13 10:17       ` Bintian

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=20150515193041.GO31753@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.