clk: sirf: add CSR atlas7 clk and reset support
Subsystems (2)
PATCH v3 1/2 clk: sirf: add CSR atlas7 clk and reset support
From: Zhiwu Song <[email protected]>
the hardware node includes both clock and reset support, so it is named as "car".
this patch implements Flexible clocks(mux, divider, gate), Selectable clock(mux, divider, gate), root clock(gate),leaf clock(gate), others. it also implements the reset controller functionality.
--- .../devicetree/bindings/clock/csr,atlas7-car.txt | 55 + drivers/clk/sirf/Makefile | 2 +- drivers/clk/sirf/clk-atlas7.c | 1635 ++++++++++++++++++++ 3 files changed, 1691 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/clock/csr,atlas7-car.txt create mode 100644 drivers/clk/sirf/clk-atlas7.c
Documentation/devicetree/bindings/clock/csr,atlas7-car.txt new file +55 -0
@@ -0,0 +1,55 @@ +* Clock and reset bindings for CSR atlas7 + +Required properties: +- compatible: Should be "sirf,atlas7-car" +- reg: Address and length of the register set +- #clock-cells: Should be <1> +- #reset-cells: Should be <1> + +The clock consumer should specify the desired clock by having the clock +ID in its "clocks" phandle cell. +The ID list atlas7_clks defined in drivers/clk/sirf/clk-atlas7.c + +The reset consumer should specify the desired reset by having the reset +ID in its "reset" phandle cell. +The ID list atlas7_reset_unit defined in drivers/clk/sirf/clk-atlas7.c + +Examples: Clock and reset controller node: + +car: clock-controller at 18620000 { + compatible = "sirf,atlas7-car"; + reg = <0x18620000 0x1000>; + #clock-cells = <1>; + #reset-cells = <1>; +}; + +Examples: Consumers using clock or reset: + +timer at 10dc0000 { + compatible = "sirf,macro-tick"; + reg = <0x10dc0000 0x1000>; + clocks = <&car 54>; + interrupts = <0 0 0>, + <0 1 0>, + <0 2 0>, + <0 49 0>, + <0 50 0>, + <0 51 0>; +}; + +uart1: uart at 18020000 { + cell-index = <1>; + compatible = "sirf,macro-uart"; + reg = <0x18020000 0x1000>; + clocks = <&clks 95>; + interrupts = <0 18 0>; + fifosize = <32>; +}; + +vpp at 13110000 { + compatible = "sirf,prima2-vpp"; + reg = <0x13110000 0x10000>; + interrupts = <0 31 0>; + clocks = <&car 85>; + resets = <&car 29>; +};
drivers/clk/sirf/Makefile +1 -1
@@ -2,4 +2,4 @@ # Makefile for sirf specific clk # -obj-$(CONFIG_ARCH_SIRF) += clk-prima2.o clk-atlas6.o +obj-$(CONFIG_ARCH_SIRF) += clk-prima2.o clk-atlas6.o clk-atlas7.o
drivers/clk/sirf/clk-atlas7.c new file +1635 -0
1,635 lines not on this page · raw message
Signature · 1 line
2.3.5
PATCH v3 2/2 ARM: dts: atlas7: add fixed frequency clocks in car node
From: Guo Zeng <[email protected]>
This patch adds the fixed clocks of external crystal oscillators.
--- arch/arm/boot/dts/atlas7.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm/boot/dts/atlas7.dtsi +12 -0
@@ -183,6 +183,18 @@ reg = <0x18620000 0x1000>; #clock-cells = <1>; #reset-cells = <1>; + xinw { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "xinw"; + }; + xin { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <26000000>; + clock-output-names = "xin"; + }; }; };
Signature · 1 line
2.3.5
PATCH v3 2/2 ARM: dts: atlas7: add fixed frequency clocks in car node
Quoted 13 lines · Barry Song
arch/arm/boot/dts/atlas7.dtsi +5
-0@@ -183,6 +183,18 @@ reg = <0x18620000 0x1000>; #clock-cells = <1>; #reset-cells = <1>; + xinw { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "xinw";
arch/arm/boot/dts/atlas7.dtsi line 200
Quoted 10 lines
arch/arm/boot/dts/atlas7.dtsi +7
-0+ }; + xin { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <26000000>; + clock-output-names = "xin"; + }; }; };
Sorry I should have been clearer. I was suggesting putting these nodes in DT at the root node "/" because they're part of the board and not part of the SoC.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 1/2 clk: sirf: add CSR atlas7 clk and reset support
In reply to Barry SongQuoted 8 lines · Barry Song
From: Zhiwu Song <[email protected]>
the hardware node includes both clock and reset support, so it is named as "car".
this patch implements Flexibleclocks(mux, divider, gate), Selectableclock(mux, divider, gate), root clock(gate),leaf clock(gate), others. it also implements the reset controller functionality.
Quoted 4 lines
Signed-off-by Zhiwu Song <[email protected]>Signed-off-by Guo Zeng <[email protected]>Signed-off-by Barry Song <[email protected]>---
Still a bunch of checkpatch warnings (dismissing the 80 char limit). Please fix them.
WARNING: static const char * array should probably be static const char * const #721: FILE: drivers/clk/sirf/clk-atlas7.c:618:
+static const char *disp1dto_clk_parents[] = {
WARNING: __initdata should be placed after divider_list[] #742: FILE: drivers/clk/sirf/clk-atlas7.c:639:
+static __initdata struct atlas7_div_init_data divider_list[] = {
WARNING: static const char * array should probably be static const char * const #1052: FILE: drivers/clk/sirf/clk-atlas7.c:949:
+static const char *sdr_clk_parents[] = {
WARNING: static const char * array should probably be static const char * const #1063: FILE: drivers/clk/sirf/clk-atlas7.c:960:
+static const char *vip_clk_parents[] = {
WARNING: __initdata should be placed after mux_list[] #1107: FILE: drivers/clk/sirf/clk-atlas7.c:1004:
+static __initdata struct atlas7_mux_init_data mux_list[] = {
WARNING: __initdata should be placed after unit_list[] #1142: FILE: drivers/clk/sirf/clk-atlas7.c:1039:
+static __initdata struct atlas7_unit_init_data unit_list[] = {
ERROR: space prohibited before that ',' (ctx:WxW)
#1145: FILE: drivers/clk/sirf/clk-atlas7.c:1042:
+ {1 , "gnssm_gnss", "gnss_mux", 0, SIRFSOC_CLKC_ROOT_CLK_EN0_SET, 1, &root0_gate_lock},
^
ERROR: space prohibited before that ',' (ctx:WxW)
And many more...
Quoted 13 lines
.../devicetree/bindings/clock/csr,atlas7-car.txt | 55 + drivers/clk/sirf/Makefile | 2 +- drivers/clk/sirf/clk-atlas7.c | 1635 ++++++++++++++++++++ 3 files changed, 1691 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/clock/csr,atlas7-car.txt create mode 100644 drivers/clk/sirf/clk-atlas7.cdrivers/clk/sirf/clk-atlas7.c new file +1
-0@@ -0,0 +1,1635 @@ +/*
drivers/clk/sirf/clk-atlas7.c line 11
Quoted 10 lines
drivers/clk/sirf/clk-atlas7.c new file +10
-0+* Clock tree for CSR SiRFAtlas7 +* +* Copyright (c) 2014 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#include <linux/bitops.h> +#include <linux/io.h> +#include <linux/clk.h>
Do you need this include?
drivers/clk/sirf/clk-atlas7.c line 16
Quoted 5 lines
drivers/clk/sirf/clk-atlas7.c new file +5
-0+#include <linux/clk-provider.h> +#include <linux/delay.h> +#include <linux/of_address.h> +#include <linux/reset-controller.h> +#include <linux/syscore_ops.h>
Unused include?
drivers/clk/sirf/clk-atlas7.c
Quoted 4 lines
drivers/clk/sirf/clk-atlas7.c new file +4
-0+#include <linux/slab.h> + + +static struct clk_ops ab_pll_ops = {
const?
Quoted 2 lines
drivers/clk/sirf/clk-atlas7.c new file +2
-0+ .recalc_rate = pll_clk_recalc_rate, +};
[...]
drivers/clk/sirf/clk-atlas7.c line 1635
Quoted 4 lines
drivers/clk/sirf/clk-atlas7.c new file +3
-0+ + +CLK_OF_DECLARE (atlas7_clk,"sirf,atlas7-car" , atlas7_clk_init);
I'm also curious if we actually need to use CLK_OF_DECLARE here or if could we use a platform device.
Even if we need to use CLK_OF_DECLARE because some timer or other early device needs a clock, I wonder if we shouldn't also make these things into real platform drivers that register the other clocks that aren't necessary for the early boot process.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 1/2 clk: sirf: add CSR atlas7 clk and reset support
2015-05-16 2:30 GMT+08:00 Stephen Boyd <[email protected]>:
Quoted 41 lines · Barry Song
Quoted 8 lines
From: Zhiwu Song <[email protected]>
the hardware node includes both clock and reset support, so it is named as "car".
this patch implements Flexibleclocks(mux, divider, gate), Selectableclock(mux, divider, gate), root clock(gate),leaf clock(gate), others. it also implements the reset controller functionality.Quoted 4 lines
Signed-off-by Zhiwu Song <[email protected]>Signed-off-by Guo Zeng <[email protected]>Signed-off-by Barry Song <[email protected]>---
Still a bunch of checkpatch warnings (dismissing the 80 char limit). Please fix them.
WARNING: static const char * array should probably be static const char * const #721: FILE:
drivers/clk/sirf/clk-atlas7.c:618:
+static const char *disp1dto_clk_parents[] = {WARNING:
__initdatashould be placed after divider_list[] #742: FILE:drivers/clk/sirf/clk-atlas7.c:639:
+static__initdatastructatlas7_div_init_datadivider_list[] = {WARNING: static const char * array should probably be static const char * const #1052: FILE:
drivers/clk/sirf/clk-atlas7.c:949:
+static const char *sdr_clk_parents[] = {WARNING: static const char * array should probably be static const char * const #1063: FILE:
drivers/clk/sirf/clk-atlas7.c:960:
+static const char *vip_clk_parents[] = {WARNING:
__initdatashould be placed after mux_list[] #1107: FILE:drivers/clk/sirf/clk-atlas7.c:1004:
+static__initdatastructatlas7_mux_init_datamux_list[] = {WARNING:
__initdatashould be placed after unit_list[] #1142: FILE:drivers/clk/sirf/clk-atlas7.c:1039:
+static__initdatastructatlas7_unit_init_dataunit_list[] = {
Quoted 8 lines
ERROR: space prohibited before that ',' (ctx:WxW)
#1145: FILE:drivers/clk/sirf/clk-atlas7.c:1042:
+ {1 , "gnssm_gnss", "gnss_mux", 0,SIRFSOC_CLKC_ROOT_CLK_EN0_SET, 1,&root0_gate_lock},^ERROR: space prohibited before that ',' (ctx:WxW)
And many more...
sorry, it seems our local checkpatch in gerrit dosn't run automatically. will fix it.
Quoted 54 lines
Quoted 14 lines
.../devicetree/bindings/clock/csr,atlas7-car.txt | 55 + drivers/clk/sirf/Makefile | 2 +- drivers/clk/sirf/clk-atlas7.c | 1635 ++++++++++++++++++++ 3 files changed, 1691 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/clock/csr,atlas7-car.txt create mode 100644 drivers/clk/sirf/clk-atlas7.cdrivers/clk/sirf/clk-atlas7.c new file +1
-0@@ -0,0 +1,1635 @@ +/* drivers/clk/sirf/clk-atlas7.c line 11
Quoted 10 lines
drivers/clk/sirf/clk-atlas7.c new file +10
-0+* Clock tree for CSR SiRFAtlas7 +* +* Copyright (c) 2014 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#include <linux/bitops.h> +#include <linux/io.h> +#include <linux/clk.h> Do you need this include?
drivers/clk/sirf/clk-atlas7.c line 16
Quoted 5 lines
drivers/clk/sirf/clk-atlas7.c new file +5
-0+#include <linux/clk-provider.h> +#include <linux/delay.h> +#include <linux/of_address.h> +#include <linux/reset-controller.h> +#include <linux/syscore_ops.h> Unused include?
drivers/clk/sirf/clk-atlas7.c
Quoted 4 lines
drivers/clk/sirf/clk-atlas7.c new file +4
-0+#include <linux/slab.h> + + +static struct clk_ops ab_pll_ops = {const?
Quoted 2 lines
drivers/clk/sirf/clk-atlas7.c new file +2
-0+ .recalc_rate = pll_clk_recalc_rate, +};[...]
drivers/clk/sirf/clk-atlas7.c line 1635
Quoted 4 lines
drivers/clk/sirf/clk-atlas7.c new file +3
-0+ + +CLK_OF_DECLARE (atlas7_clk,"sirf,atlas7-car" , atlas7_clk_init);I'm also curious if we actually need to use
CLK_OF_DECLAREhere or if could we use a platform device.
Quoted 5 lines
Even if we need to use
CLK_OF_DECLAREbecause some timer or other early device needs a clock, I wonder if we shouldn't also make these things into real platform drivers that register the other clocks that aren't necessary for the early boot process.
it seems it is a general question not only for this driver?
the main difficulty is maintaining the boot sequence of the platform devices and other machine codes which require clocks. it seems it is the easiest way to make clk ready earlier than other drivers. and i don't think registering these clocks takes much boot time and make boot slower at least for atlas7 platform since there is no sleep and long delay in the procedure.
-barry
PATCH v3 1/2 clk: sirf: add CSR atlas7 clk and reset support
Quoted 15 lines · Barry Song
2015-05-16 2:30 GMT+08:00 Stephen Boyd <[email protected]>:
Quoted 14 lines · Barry Song
Quoted 12 lines
From: Zhiwu Song <[email protected]>
the hardware node includes both clock and reset support, so it is named as "car".
this patch implements Flexibleclocks(mux, divider, gate), Selectableclock(mux, divider, gate), root clock(gate),leaf clock(gate), others. it also implements the reset controller functionality.Signed-off-by Zhiwu Song <[email protected]>Signed-off-by Guo Zeng <[email protected]>Signed-off-by Barry Song <[email protected]>---
Yes this has already been applied, but replying to the last comment.
Quoted 8 lines
Quoted 8 lines
drivers/clk/sirf/clk-atlas7.c line 1635
Quoted 4 lines
drivers/clk/sirf/clk-atlas7.c new file +3
-0+ + +CLK_OF_DECLARE (atlas7_clk,"sirf,atlas7-car" , atlas7_clk_init);I'm also curious if we actually need to use
CLK_OF_DECLAREhere or if could we use a platform device.
Quoted 6 lines
Quoted 5 lines
Even if we need to use
CLK_OF_DECLAREbecause some timer or other early device needs a clock, I wonder if we shouldn't also make these things into real platform drivers that register the other clocks that aren't necessary for the early boot process.it seems it is a general question not only for this driver?
Yes it is.
Quoted 7 lines
the main difficulty is maintaining the boot sequence of the platform devices and other machine codes which require clocks. it seems it is the easiest way to make clk ready earlier than other drivers. and i don't think registering these clocks takes much boot time and make boot slower at least for atlas7 platform since there is no sleep and long delay in the procedure.
It isn't really about making boot time faster, it's about using the proper linux device model for clock providers. That way when we want to support things like suspend/resume, deferred probe, devm_*(), sysfs, etc. we can use the device model instead of resorting to things like syscore_ops for suspend/resume or forgoing features entirely.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 1/2 clk: sirf: add CSR atlas7 clk and reset support
2015-05-22 5:33 GMT+08:00 Stephen Boyd <[email protected]>:
Quoted 45 lines · Barry Song
Quoted 15 lines
2015-05-16 2:30 GMT+08:00 Stephen Boyd <[email protected]>:
Quoted 14 lines · Barry Song
Quoted 12 lines
From: Zhiwu Song <[email protected]>
the hardware node includes both clock and reset support, so it is named as "car".
this patch implements Flexibleclocks(mux, divider, gate), Selectableclock(mux, divider, gate), root clock(gate),leaf clock(gate), others. it also implements the reset controller functionality.Signed-off-by Zhiwu Song <[email protected]>Signed-off-by Guo Zeng <[email protected]>Signed-off-by Barry Song <[email protected]>---
Yes this has already been applied, but replying to the last comment.
Quoted 8 lines
Quoted 8 lines
drivers/clk/sirf/clk-atlas7.c line 1635
Quoted 4 lines
drivers/clk/sirf/clk-atlas7.c new file +3
-0+ + +CLK_OF_DECLARE (atlas7_clk,"sirf,atlas7-car" , atlas7_clk_init);I'm also curious if we actually need to use
CLK_OF_DECLAREhere or if could we use a platform device.Quoted 6 lines
Quoted 5 lines
Even if we need to use
CLK_OF_DECLAREbecause some timer or other early device needs a clock, I wonder if we shouldn't also make these things into real platform drivers that register the other clocks that aren't necessary for the early boot process.it seems it is a general question not only for this driver?
Yes it is.
Quoted 7 lines
the main difficulty is maintaining the boot sequence of the platform devices and other machine codes which require clocks. it seems it is the easiest way to make clk ready earlier than other drivers. and i don't think registering these clocks takes much boot time and make boot slower at least for atlas7 platform since there is no sleep and long delay in the procedure.
Quoted 7 lines
It isn't really about making boot time faster, it's about using the proper linux device model for clock providers. That way when we want to support things like suspend/resume, deferred probe, devm_*(), sysfs, etc. we can use the device model instead of resorting to things like
syscore_opsfor suspend/resume or forgoing features entirely.
my feeling is if the clock controller is an internal controller which serve all controllers in the SoC, "deferred probe" might be yes for almost all HW since all HW need clock. so it seems it makes "deferred probe" has no meaning. clock controller seems to be 1st HW which needs to be ready.
but if the clock controller is an external controller, it might be exactly a platform driver, or other bus-based drivers.
Quoted 3 lines
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
-barry
PATCH v3 1/2 clk: sirf: add CSR atlas7 clk and reset support
Quoted 13 lines · Barry Song
2015-05-22 5:33 GMT+08:00 Stephen Boyd <[email protected]>:
Quoted 11 lines · Barry Song
Quoted 2 lines
2015-05-16 2:30 GMT+08:00 Stephen Boyd <[email protected]>:
Quoted 1 line · Barry Song
It isn't really about making boot time faster, it's about using the proper linux device model for clock providers. That way when we want to support things like suspend/resume, deferred probe, devm_*(), sysfs, etc. we can use the device model instead of resorting to things like
syscore_opsfor suspend/resume or forgoing features entirely.
Quoted 5 lines
my feeling is if the clock controller is an internal controller which serve all controllers in the SoC, "deferred probe" might be yes for almost all HW since all HW need clock. so it seems it makes "deferred probe" has no meaning. clock controller seems to be 1st HW which needs to be ready.
That sounds like a probe ordering problem, and I agree most likely the clock driver will need to probe first in this case. It doesn't do anything about other problems like suspend/resume or other features that the device model provides solutions for though. Maybe we don't use these features, but it doesn't mean we should forgo the device model just because we don't need it.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 1/2 clk: sirf: add CSR atlas7 clk and reset support
2015-06-11 5:33 GMT+08:00 Stephen Boyd <[email protected]>:
Quoted 20 lines · Barry Song
Quoted 13 lines
2015-05-22 5:33 GMT+08:00 Stephen Boyd <[email protected]>:
Quoted 11 lines · Barry Song
Quoted 2 lines
2015-05-16 2:30 GMT+08:00 Stephen Boyd <[email protected]>:
Quoted 1 line · Barry Song
It isn't really about making boot time faster, it's about using the proper linux device model for clock providers. That way when we want to support things like suspend/resume, deferred probe, devm_*(), sysfs, etc. we can use the device model instead of resorting to things like
syscore_opsfor suspend/resume or forgoing features entirely.Quoted 5 lines
my feeling is if the clock controller is an internal controller which serve all controllers in the SoC, "deferred probe" might be yes for almost all HW since all HW need clock. so it seems it makes "deferred probe" has no meaning. clock controller seems to be 1st HW which needs to be ready.
Quoted 6 lines
That sounds like a probe ordering problem, and I agree most likely the clock driver will need to probe first in this case. It doesn't do anything about other problems like suspend/resume or other features that the device model provides solutions for though. Maybe we don't use these features, but it doesn't mean we should forgo the device model just because we don't need it.
this is generally done by a earlier init like subsys_init, core_init etc. i agree it is always good to use the bus/driver/device model if possible.
actually, moving to platform bus still has some deferred probe issue. it is probably everyone before clk driver need deferred probe. do you think we are possible to ask for clk even before platform devices are extended in machine callbacks?
Quoted 4 lines
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
-barry