* [PATCH v2 0/2] clk: sunxi: Fix APBS clock for Allwinner A80
@ 2016-02-12 9:31 Chen-Yu Tsai
2016-02-12 9:31 ` [PATCH v2 1/2] clk: sunxi: Add support for A80 APBS clock Chen-Yu Tsai
2016-02-12 9:31 ` [PATCH v2 2/2] ARM: dts: sun9i: Fix apbs clock compatible Chen-Yu Tsai
0 siblings, 2 replies; 4+ messages in thread
From: Chen-Yu Tsai @ 2016-02-12 9:31 UTC (permalink / raw)
To: Maxime Ripard, Michael Turquette, Stephen Boyd
Cc: Chen-Yu Tsai, linux-clk, linux-arm-kernel, linux-kernel,
linux-sunxi, devicetree
Hi everyone,
This is v2 of the A80 APBS clock fixes series.
When I did the A80 PRCM support, I failed to notice the A80's APBS clock
was not the same as the A23's APB0 clock. The former is a zero-based
divider, while the latter is a power-of-two divider. But the lowest 2
dividers are the same.
The hardware defaults to the lowest setting, or a /1 divider. Since the
child gates do not propagate clk_set_rate up, and no consumers here do
clk_set_rate, this actually works.
I realized my mistake while reviewing the A83T's PRCM patches. The A83T
shares the same PRCM clocks as the A80.
Maxime, since this was introduced in 4.5-rc1, please apply this series
for 4.5 so we fix it before the release.
Changes since v1:
- Replace the CLK_OF_DECLARE version of sun8i-a23-apb0-clk with the
A80 APBS version, instead of writing a new driver.
Regards
ChenYu
Chen-Yu Tsai (2):
clk: sunxi: Add support for A80 APBS clock
ARM: dts: sun9i: Fix apbs clock compatible
Documentation/devicetree/bindings/clock/sunxi.txt | 1 +
arch/arm/boot/dts/sun9i-a80.dtsi | 2 +-
drivers/clk/sunxi/clk-sun8i-apb0.c | 23 ++++++++---------------
3 files changed, 10 insertions(+), 16 deletions(-)
--
2.7.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v2 1/2] clk: sunxi: Add support for A80 APBS clock 2016-02-12 9:31 [PATCH v2 0/2] clk: sunxi: Fix APBS clock for Allwinner A80 Chen-Yu Tsai @ 2016-02-12 9:31 ` Chen-Yu Tsai 2016-02-12 16:52 ` Rob Herring 2016-02-12 9:31 ` [PATCH v2 2/2] ARM: dts: sun9i: Fix apbs clock compatible Chen-Yu Tsai 1 sibling, 1 reply; 4+ messages in thread From: Chen-Yu Tsai @ 2016-02-12 9:31 UTC (permalink / raw) To: Maxime Ripard, Michael Turquette, Stephen Boyd Cc: Chen-Yu Tsai, linux-clk, linux-arm-kernel, linux-kernel, linux-sunxi, devicetree A80's APBS clock is not the same as the APB0 clock on A23. The A80's is a zero-based divider, while the A23's is a power-of-two divider. Replace the CLK_OF_DECLARE version of sun8i-a23-apb0. This also extends the common setup function to take div clk flags. Signed-off-by: Chen-Yu Tsai <wens@csie.org> --- Documentation/devicetree/bindings/clock/sunxi.txt | 1 + drivers/clk/sunxi/clk-sun8i-apb0.c | 23 ++++++++--------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt b/Documentation/devicetree/bindings/clock/sunxi.txt index 966dcaffcb9c..5206e48694d6 100644 --- a/Documentation/devicetree/bindings/clock/sunxi.txt +++ b/Documentation/devicetree/bindings/clock/sunxi.txt @@ -60,6 +60,7 @@ Required properties: "allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23 "allwinner,sun8i-a83t-bus-gates-clk" - for the bus gates on A83T "allwinner,sun8i-h3-bus-gates-clk" - for the bus gates on H3 + "allwinner,sun9i-a80-apbs-clk" - for the APBS clock on A80 "allwinner,sun9i-a80-apbs-gates-clk" - for the APBS gates on A80 "allwinner,sun4i-a10-dram-gates-clk" - for the DRAM gates on A10 "allwinner,sun5i-a13-mbus-clk" - for the MBUS clock on A13 diff --git a/drivers/clk/sunxi/clk-sun8i-apb0.c b/drivers/clk/sunxi/clk-sun8i-apb0.c index 7ba61103a6f5..cfe9c19a831b 100644 --- a/drivers/clk/sunxi/clk-sun8i-apb0.c +++ b/drivers/clk/sunxi/clk-sun8i-apb0.c @@ -21,7 +21,7 @@ #include <linux/platform_device.h> static struct clk *sun8i_a23_apb0_register(struct device_node *node, - void __iomem *reg) + void __iomem *reg, u8 div_flags) { const char *clk_name = node->name; const char *clk_parent; @@ -36,7 +36,7 @@ static struct clk *sun8i_a23_apb0_register(struct device_node *node, /* The A23 APB0 clock is a standard 2 bit wide divider clock */ clk = clk_register_divider(NULL, clk_name, clk_parent, 0, reg, - 0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL); + 0, 2, div_flags, NULL); if (IS_ERR(clk)) return clk; @@ -52,7 +52,7 @@ err_unregister: return ERR_PTR(ret); } -static void sun8i_a23_apb0_setup(struct device_node *node) +static void sun9i_a80_apbs_setup(struct device_node *node) { void __iomem *reg; struct resource res; @@ -60,18 +60,11 @@ static void sun8i_a23_apb0_setup(struct device_node *node) reg = of_io_request_and_map(node, 0, of_node_full_name(node)); if (IS_ERR(reg)) { - /* - * This happens with clk nodes instantiated through mfd, - * as those do not have their resources assigned in the - * device tree. Do not print an error in this case. - */ - if (PTR_ERR(reg) != -EINVAL) - pr_err("Could not get registers for a23-apb0-clk\n"); - + pr_err("Could not get registers for a80-apbs-clk\n"); return; } - clk = sun8i_a23_apb0_register(node, reg); + clk = sun8i_a23_apb0_register(node, reg, 0); if (IS_ERR(clk)) goto err_unmap; @@ -82,8 +75,8 @@ err_unmap: of_address_to_resource(node, 0, &res); release_mem_region(res.start, resource_size(&res)); } -CLK_OF_DECLARE(sun8i_a23_apb0, "allwinner,sun8i-a23-apb0-clk", - sun8i_a23_apb0_setup); +CLK_OF_DECLARE(sun9i_a80_apbs, "allwinner,sun9i-a80-apbs-clk", + sun9i_a80_apbs_setup); static int sun8i_a23_apb0_clk_probe(struct platform_device *pdev) { @@ -97,7 +90,7 @@ static int sun8i_a23_apb0_clk_probe(struct platform_device *pdev) if (IS_ERR(reg)) return PTR_ERR(reg); - clk = sun8i_a23_apb0_register(np, reg); + clk = sun8i_a23_apb0_register(np, reg, CLK_DIVIDER_POWER_OF_TWO); if (IS_ERR(clk)) return PTR_ERR(clk); -- 2.7.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] clk: sunxi: Add support for A80 APBS clock 2016-02-12 9:31 ` [PATCH v2 1/2] clk: sunxi: Add support for A80 APBS clock Chen-Yu Tsai @ 2016-02-12 16:52 ` Rob Herring 0 siblings, 0 replies; 4+ messages in thread From: Rob Herring @ 2016-02-12 16:52 UTC (permalink / raw) To: Chen-Yu Tsai Cc: Maxime Ripard, Michael Turquette, Stephen Boyd, linux-clk, linux-arm-kernel, linux-kernel, linux-sunxi, devicetree On Fri, Feb 12, 2016 at 05:31:14PM +0800, Chen-Yu Tsai wrote: > A80's APBS clock is not the same as the APB0 clock on A23. The A80's > is a zero-based divider, while the A23's is a power-of-two divider. > > Replace the CLK_OF_DECLARE version of sun8i-a23-apb0. This also extends > the common setup function to take div clk flags. > > Signed-off-by: Chen-Yu Tsai <wens@csie.org> > --- > Documentation/devicetree/bindings/clock/sunxi.txt | 1 + Acked-by: Rob Herring <robh@kernel.org> > drivers/clk/sunxi/clk-sun8i-apb0.c | 23 ++++++++--------------- > 2 files changed, 9 insertions(+), 15 deletions(-) ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] ARM: dts: sun9i: Fix apbs clock compatible 2016-02-12 9:31 [PATCH v2 0/2] clk: sunxi: Fix APBS clock for Allwinner A80 Chen-Yu Tsai 2016-02-12 9:31 ` [PATCH v2 1/2] clk: sunxi: Add support for A80 APBS clock Chen-Yu Tsai @ 2016-02-12 9:31 ` Chen-Yu Tsai 1 sibling, 0 replies; 4+ messages in thread From: Chen-Yu Tsai @ 2016-02-12 9:31 UTC (permalink / raw) To: Maxime Ripard, Michael Turquette, Stephen Boyd Cc: Chen-Yu Tsai, linux-clk, linux-arm-kernel, linux-kernel, linux-sunxi, devicetree The APBS clock on A80 is not compatible with A23's APB0 clock. The only reason it works is becase the lowest and default divider is the same. Signed-off-by: Chen-Yu Tsai <wens@csie.org> --- arch/arm/boot/dts/sun9i-a80.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/sun9i-a80.dtsi b/arch/arm/boot/dts/sun9i-a80.dtsi index f68b3242b33a..2b4ce813b0ad 100644 --- a/arch/arm/boot/dts/sun9i-a80.dtsi +++ b/arch/arm/boot/dts/sun9i-a80.dtsi @@ -395,7 +395,7 @@ }; apbs: clk@0800141c { - compatible = "allwinner,sun8i-a23-apb0-clk"; + compatible = "allwinner,sun9i-a80-apbs-clk"; reg = <0x0800141c 0x4>; #clock-cells = <0>; clocks = <&ahbs>; -- 2.7.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-12 16:52 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-12 9:31 [PATCH v2 0/2] clk: sunxi: Fix APBS clock for Allwinner A80 Chen-Yu Tsai 2016-02-12 9:31 ` [PATCH v2 1/2] clk: sunxi: Add support for A80 APBS clock Chen-Yu Tsai 2016-02-12 16:52 ` Rob Herring 2016-02-12 9:31 ` [PATCH v2 2/2] ARM: dts: sun9i: Fix apbs clock compatible Chen-Yu Tsai
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox