From: bintian.wang@huawei.com (Bintian)
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 15:42:51 +0800 [thread overview]
Message-ID: <5555A37B.1090105@huawei.com> (raw)
In-Reply-To: <20150515002527.GD31753@codeaurora.org>
Hello Stephen,
On 2015/5/15 8:25, Stephen Boyd wrote:
> On 05/05, Bintian Wang wrote:
>> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
>> index 9897f35..935c44b 100644
>> --- a/drivers/clk/Kconfig
>> +++ b/drivers/clk/Kconfig
>> @@ -152,6 +152,8 @@ config COMMON_CLK_CDCE706
>>
>> source "drivers/clk/qcom/Kconfig"
>>
>> +source "drivers/clk/hisilicon/Kconfig"
>> +
>
> Please move this above qcom to maintain alphabet sort.
OK, fix in next version.
>
>> endmenu
>>
>> source "drivers/clk/bcm/Kconfig"
>> diff --git a/drivers/clk/hisilicon/Kconfig b/drivers/clk/hisilicon/Kconfig
>> new file mode 100644
>> index 0000000..8034739
>> --- /dev/null
>> +++ b/drivers/clk/hisilicon/Kconfig
>> @@ -0,0 +1,6 @@
>> +config COMMON_CLK_HI6220
>> + bool "Hi6220 Clock Driver"
>> + depends on OF && ARCH_HISI
>> + default y
>
> Can this be
>
> depends on ARCH_HISI || COMPILE_TEST
> default ARCH_HISI
>
> instead? I'd like to increase build coverage.
No problem, will fix in next version.
>
>> + help
>> + Build the Hisilicon Hi6220 clock driver based on the common clock framework.
>> diff --git a/drivers/clk/hisilicon/clk-hi6220.c b/drivers/clk/hisilicon/clk-hi6220.c
>> new file mode 100644
>> index 0000000..91b1cd7
>> --- /dev/null
>> +++ b/drivers/clk/hisilicon/clk-hi6220.c
>> @@ -0,0 +1,292 @@
>> +/*
>> + * Hisilicon Hi6220 clock driver
>> + *
>> + * Copyright (c) 2015 Hisilicon Limited.
>> + *
>> + * Author: Bintian Wang <bintian.wang@huawei.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/clk-provider.h>
>> +#include <linux/clkdev.h>
>> +#include <linux/io.h>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +#include <linux/of_device.h>
>> +#include <linux/slab.h>
>> +#include <linux/clk.h>
>
> Do we need to include linux/clk.h? I don't see any consumer
> usage here.
You are right, remove in next version.
>
>> +
>> +#include <dt-bindings/clock/hi6220-clock.h>
>> +
>> +#include "clk.h"
>> +
>> diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c
>> index a078e84..5d2305c 100644
>> --- a/drivers/clk/hisilicon/clk.c
>> +++ b/drivers/clk/hisilicon/clk.c
>> @@ -108,4 +123,6 @@ void __init hisi_clk_register_gate(struct hisi_gate_clock *,
>> int, struct hisi_clock_data *);
>> void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *,
>> int, struct hisi_clock_data *);
>> +void __init hi6220_clk_register_divider(struct hi6220_divider_clock *,
>> + int, struct hisi_clock_data *);
>
> __init markings on function prototypes are useless. Please remove them.
OK
>
>> #endif /* __HISI_CLK_H */
>> 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.
>
>> +
>> +#define to_hi6220_clk_divider(_hw) \
> [..]
>> +
>> +static struct clk_ops hi6220_clkdiv_ops = {
>
> const?
Add in next version.
>
>> + .recalc_rate = hi6220_clkdiv_recalc_rate,
>> + .round_rate = hi6220_clkdiv_round_rate,
>> + .set_rate = hi6220_clkdiv_set_rate,
>> +};
>> +
>> +struct clk *hi6220_register_clkdiv(struct device *dev, const char *name,
>> + const char *parent_name, unsigned long flags, void __iomem *reg,
>> + u8 shift, u8 width, u32 mask_bit, spinlock_t *lock)
>> +{
>> + struct hi6220_clk_divider *div;
>> + struct clk *clk;
>> + struct clk_init_data init;
>> + struct clk_div_table *table;
>> + u32 max_div, min_div;
>> + int i;
>> +
>> + /* allocate the divider */
>> + div = kzalloc(sizeof(struct hi6220_clk_divider), GFP_KERNEL);
>> + if (!div) {
>> + pr_err("%s: could not allocate divider clk\n", __func__);
>
> Useless error message on allocation failure. Please run
> checkpatch. I've sent a patch to remove these from basic clock
> types.
Remove in next version.
>
>> + return ERR_PTR(-ENOMEM);
>> + }
>> +
>> + /* Init the divider table */
>> + max_div = div_mask(width) + 1;
>> + min_div = 1;
>> +
>> + table = kzalloc(sizeof(struct clk_div_table) * (max_div + 1), GFP_KERNEL);
>> + if (!table) {
>> + kfree(div);
>> + pr_err("%s: failed to alloc divider table!\n", __func__);
>
> ditto.
Will remove in next version.
>
>> + 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?
How about just send this patch for review not the whole patch set in
next version?
Thanks,
Bintian
>
>> + init.parent_names = parent_name ? &parent_name : NULL;
>> + init.num_parents = parent_name ? 1 : 0;
>
WARNING: multiple messages have this Message-ID (diff)
From: Bintian <bintian.wang@huawei.com>
To: Stephen Boyd <sboyd@codeaurora.org>
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@his
Subject: Re: [PATCH v4 4/5] clk: hi6220: Clock driver support for Hisilicon hi6220 SoC
Date: Fri, 15 May 2015 15:42:51 +0800 [thread overview]
Message-ID: <5555A37B.1090105@huawei.com> (raw)
In-Reply-To: <20150515002527.GD31753@codeaurora.org>
Hello Stephen,
On 2015/5/15 8:25, Stephen Boyd wrote:
> On 05/05, Bintian Wang wrote:
>> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
>> index 9897f35..935c44b 100644
>> --- a/drivers/clk/Kconfig
>> +++ b/drivers/clk/Kconfig
>> @@ -152,6 +152,8 @@ config COMMON_CLK_CDCE706
>>
>> source "drivers/clk/qcom/Kconfig"
>>
>> +source "drivers/clk/hisilicon/Kconfig"
>> +
>
> Please move this above qcom to maintain alphabet sort.
OK, fix in next version.
>
>> endmenu
>>
>> source "drivers/clk/bcm/Kconfig"
>> diff --git a/drivers/clk/hisilicon/Kconfig b/drivers/clk/hisilicon/Kconfig
>> new file mode 100644
>> index 0000000..8034739
>> --- /dev/null
>> +++ b/drivers/clk/hisilicon/Kconfig
>> @@ -0,0 +1,6 @@
>> +config COMMON_CLK_HI6220
>> + bool "Hi6220 Clock Driver"
>> + depends on OF && ARCH_HISI
>> + default y
>
> Can this be
>
> depends on ARCH_HISI || COMPILE_TEST
> default ARCH_HISI
>
> instead? I'd like to increase build coverage.
No problem, will fix in next version.
>
>> + help
>> + Build the Hisilicon Hi6220 clock driver based on the common clock framework.
>> diff --git a/drivers/clk/hisilicon/clk-hi6220.c b/drivers/clk/hisilicon/clk-hi6220.c
>> new file mode 100644
>> index 0000000..91b1cd7
>> --- /dev/null
>> +++ b/drivers/clk/hisilicon/clk-hi6220.c
>> @@ -0,0 +1,292 @@
>> +/*
>> + * Hisilicon Hi6220 clock driver
>> + *
>> + * Copyright (c) 2015 Hisilicon Limited.
>> + *
>> + * Author: Bintian Wang <bintian.wang@huawei.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/clk-provider.h>
>> +#include <linux/clkdev.h>
>> +#include <linux/io.h>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +#include <linux/of_device.h>
>> +#include <linux/slab.h>
>> +#include <linux/clk.h>
>
> Do we need to include linux/clk.h? I don't see any consumer
> usage here.
You are right, remove in next version.
>
>> +
>> +#include <dt-bindings/clock/hi6220-clock.h>
>> +
>> +#include "clk.h"
>> +
>> diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c
>> index a078e84..5d2305c 100644
>> --- a/drivers/clk/hisilicon/clk.c
>> +++ b/drivers/clk/hisilicon/clk.c
>> @@ -108,4 +123,6 @@ void __init hisi_clk_register_gate(struct hisi_gate_clock *,
>> int, struct hisi_clock_data *);
>> void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *,
>> int, struct hisi_clock_data *);
>> +void __init hi6220_clk_register_divider(struct hi6220_divider_clock *,
>> + int, struct hisi_clock_data *);
>
> __init markings on function prototypes are useless. Please remove them.
OK
>
>> #endif /* __HISI_CLK_H */
>> 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.
>
>> +
>> +#define to_hi6220_clk_divider(_hw) \
> [..]
>> +
>> +static struct clk_ops hi6220_clkdiv_ops = {
>
> const?
Add in next version.
>
>> + .recalc_rate = hi6220_clkdiv_recalc_rate,
>> + .round_rate = hi6220_clkdiv_round_rate,
>> + .set_rate = hi6220_clkdiv_set_rate,
>> +};
>> +
>> +struct clk *hi6220_register_clkdiv(struct device *dev, const char *name,
>> + const char *parent_name, unsigned long flags, void __iomem *reg,
>> + u8 shift, u8 width, u32 mask_bit, spinlock_t *lock)
>> +{
>> + struct hi6220_clk_divider *div;
>> + struct clk *clk;
>> + struct clk_init_data init;
>> + struct clk_div_table *table;
>> + u32 max_div, min_div;
>> + int i;
>> +
>> + /* allocate the divider */
>> + div = kzalloc(sizeof(struct hi6220_clk_divider), GFP_KERNEL);
>> + if (!div) {
>> + pr_err("%s: could not allocate divider clk\n", __func__);
>
> Useless error message on allocation failure. Please run
> checkpatch. I've sent a patch to remove these from basic clock
> types.
Remove in next version.
>
>> + return ERR_PTR(-ENOMEM);
>> + }
>> +
>> + /* Init the divider table */
>> + max_div = div_mask(width) + 1;
>> + min_div = 1;
>> +
>> + table = kzalloc(sizeof(struct clk_div_table) * (max_div + 1), GFP_KERNEL);
>> + if (!table) {
>> + kfree(div);
>> + pr_err("%s: failed to alloc divider table!\n", __func__);
>
> ditto.
Will remove in next version.
>
>> + 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?
How about just send this patch for review not the whole patch set in
next version?
Thanks,
Bintian
>
>> + init.parent_names = parent_name ? &parent_name : NULL;
>> + init.num_parents = parent_name ? 1 : 0;
>
WARNING: multiple messages have this Message-ID (diff)
From: Bintian <bintian.wang@huawei.com>
To: Stephen Boyd <sboyd@codeaurora.org>
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 15:42:51 +0800 [thread overview]
Message-ID: <5555A37B.1090105@huawei.com> (raw)
In-Reply-To: <20150515002527.GD31753@codeaurora.org>
Hello Stephen,
On 2015/5/15 8:25, Stephen Boyd wrote:
> On 05/05, Bintian Wang wrote:
>> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
>> index 9897f35..935c44b 100644
>> --- a/drivers/clk/Kconfig
>> +++ b/drivers/clk/Kconfig
>> @@ -152,6 +152,8 @@ config COMMON_CLK_CDCE706
>>
>> source "drivers/clk/qcom/Kconfig"
>>
>> +source "drivers/clk/hisilicon/Kconfig"
>> +
>
> Please move this above qcom to maintain alphabet sort.
OK, fix in next version.
>
>> endmenu
>>
>> source "drivers/clk/bcm/Kconfig"
>> diff --git a/drivers/clk/hisilicon/Kconfig b/drivers/clk/hisilicon/Kconfig
>> new file mode 100644
>> index 0000000..8034739
>> --- /dev/null
>> +++ b/drivers/clk/hisilicon/Kconfig
>> @@ -0,0 +1,6 @@
>> +config COMMON_CLK_HI6220
>> + bool "Hi6220 Clock Driver"
>> + depends on OF && ARCH_HISI
>> + default y
>
> Can this be
>
> depends on ARCH_HISI || COMPILE_TEST
> default ARCH_HISI
>
> instead? I'd like to increase build coverage.
No problem, will fix in next version.
>
>> + help
>> + Build the Hisilicon Hi6220 clock driver based on the common clock framework.
>> diff --git a/drivers/clk/hisilicon/clk-hi6220.c b/drivers/clk/hisilicon/clk-hi6220.c
>> new file mode 100644
>> index 0000000..91b1cd7
>> --- /dev/null
>> +++ b/drivers/clk/hisilicon/clk-hi6220.c
>> @@ -0,0 +1,292 @@
>> +/*
>> + * Hisilicon Hi6220 clock driver
>> + *
>> + * Copyright (c) 2015 Hisilicon Limited.
>> + *
>> + * Author: Bintian Wang <bintian.wang@huawei.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/clk-provider.h>
>> +#include <linux/clkdev.h>
>> +#include <linux/io.h>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +#include <linux/of_device.h>
>> +#include <linux/slab.h>
>> +#include <linux/clk.h>
>
> Do we need to include linux/clk.h? I don't see any consumer
> usage here.
You are right, remove in next version.
>
>> +
>> +#include <dt-bindings/clock/hi6220-clock.h>
>> +
>> +#include "clk.h"
>> +
>> diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c
>> index a078e84..5d2305c 100644
>> --- a/drivers/clk/hisilicon/clk.c
>> +++ b/drivers/clk/hisilicon/clk.c
>> @@ -108,4 +123,6 @@ void __init hisi_clk_register_gate(struct hisi_gate_clock *,
>> int, struct hisi_clock_data *);
>> void __init hisi_clk_register_gate_sep(struct hisi_gate_clock *,
>> int, struct hisi_clock_data *);
>> +void __init hi6220_clk_register_divider(struct hi6220_divider_clock *,
>> + int, struct hisi_clock_data *);
>
> __init markings on function prototypes are useless. Please remove them.
OK
>
>> #endif /* __HISI_CLK_H */
>> 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.
>
>> +
>> +#define to_hi6220_clk_divider(_hw) \
> [..]
>> +
>> +static struct clk_ops hi6220_clkdiv_ops = {
>
> const?
Add in next version.
>
>> + .recalc_rate = hi6220_clkdiv_recalc_rate,
>> + .round_rate = hi6220_clkdiv_round_rate,
>> + .set_rate = hi6220_clkdiv_set_rate,
>> +};
>> +
>> +struct clk *hi6220_register_clkdiv(struct device *dev, const char *name,
>> + const char *parent_name, unsigned long flags, void __iomem *reg,
>> + u8 shift, u8 width, u32 mask_bit, spinlock_t *lock)
>> +{
>> + struct hi6220_clk_divider *div;
>> + struct clk *clk;
>> + struct clk_init_data init;
>> + struct clk_div_table *table;
>> + u32 max_div, min_div;
>> + int i;
>> +
>> + /* allocate the divider */
>> + div = kzalloc(sizeof(struct hi6220_clk_divider), GFP_KERNEL);
>> + if (!div) {
>> + pr_err("%s: could not allocate divider clk\n", __func__);
>
> Useless error message on allocation failure. Please run
> checkpatch. I've sent a patch to remove these from basic clock
> types.
Remove in next version.
>
>> + return ERR_PTR(-ENOMEM);
>> + }
>> +
>> + /* Init the divider table */
>> + max_div = div_mask(width) + 1;
>> + min_div = 1;
>> +
>> + table = kzalloc(sizeof(struct clk_div_table) * (max_div + 1), GFP_KERNEL);
>> + if (!table) {
>> + kfree(div);
>> + pr_err("%s: failed to alloc divider table!\n", __func__);
>
> ditto.
Will remove in next version.
>
>> + 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?
How about just send this patch for review not the whole patch set in
next version?
Thanks,
Bintian
>
>> + init.parent_names = parent_name ? &parent_name : NULL;
>> + init.num_parents = parent_name ? 1 : 0;
>
next prev parent reply other threads:[~2015-05-15 7:42 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 [this message]
2015-05-15 7:42 ` Bintian
2015-05-15 7:42 ` Bintian
2015-05-15 19:30 ` Stephen Boyd
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=5555A37B.1090105@huawei.com \
--to=bintian.wang@huawei.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 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.