Clock changes needed to probe rng on omap4 and 5
Subsystems (3)
cover Clock changes needed to probe rng on omap4 and 5
Hi all,
We are currently missing the secure clocks for omap4 and 5, and that prevents us from adding rng and crypto accelerators to probe with ti-sysc interconnect target module driver.
We also have a clkctrl clock driver issue where we must rely on the dts node names for the clocks to work, so we must first fix that before we can add the drivers. Otherwise a wrong clock domain will be used for the secure clocks.
I'll be posting dts changes for the crypto accelerators in a separate series later on to keep things easier to review.
For merging these after review, I suggest that Tero picks up the first three clock related patches and sets up an immutable branch against v5.5-rc1 that I can also merge in for the rng and crypto accelerator dts changes.
Regards,
Tony
Tony Lindgren (5):
clk: ti: clkctrl: Fix hidden dependency to node name
ARM: dts: Add missing omap4 secure clocks
ARM: dts: Add missing omap5 secure clocks
ARM: dts: Configure omap4 rng to probe with ti-sysc
ARM: dts: Configure omap5 rng to probe with ti-sysc
.../devicetree/bindings/clock/ti-clkctrl.txt | 11 ++- .../boot/dts/motorola-mapphone-common.dtsi | 5 + arch/arm/boot/dts/omap4-l4.dtsi | 20 +++- arch/arm/boot/dts/omap44xx-clocks.dtsi | 11 ++- arch/arm/boot/dts/omap5-l4.dtsi | 20 +++- arch/arm/boot/dts/omap54xx-clocks.dtsi | 10 +- drivers/clk/ti/clk-44xx.c | 13 +++ drivers/clk/ti/clk-54xx.c | 13 +++ drivers/clk/ti/clk.c | 4 +- drivers/clk/ti/clkctrl.c | 96 ++++++++++++++++--- include/dt-bindings/clock/omap4.h | 11 +++ include/dt-bindings/clock/omap5.h | 11 +++ 12 files changed, 199 insertions(+), 26 deletions(-)
Signature · 1 line
2.24.0
PATCH 1/5 clk: ti: clkctrl: Fix hidden dependency to node name
We currently have a hidden dependency to the device tree node name for the clkctrl clocks. Instead of using standard node name like "clock", we must use "l4-per-clkctrl" type naming so the clock driver can find the associated clock domain. Further, if "clk" is specified for a clock node name, the driver sets TI_CLK_CLKCTRL_COMPAT flag that uses different logic for the clock name based on the parent node name for the all the clkctrl clocks for the SoC.
If the clock node naming dependency is not understood, the related clockdomain is not found, or a wrong one can get used if a clock manager has multiple clock domains.
As each clkctrl instance represents a single clock domain, let's allow using domain specific compatible names to specify the clock domain.
This simplifies things and removes the hidden dependency to the node name. And then later on, after the node names have been standardized, we can drop the related code for parsing the node names.
Let's also update the binding to use standard "clock" node naming instead of "clk" and add the missing description for reg.
--- .../devicetree/bindings/clock/ti-clkctrl.txt | 11 ++- drivers/clk/ti/clk.c | 4 +- drivers/clk/ti/clkctrl.c | 96 ++++++++++++++++--- 3 files changed, 96 insertions(+), 15 deletions(-)
Documentation/devicetree/bindings/clock/ti-clkctrl.txt +8 -3
@@ -16,18 +16,23 @@ For more information, please see the Linux clock framework binding at Documentation/devicetree/bindings/clock/clock-bindings.txt. Required properties : -- compatible : shall be "ti,clkctrl" +- compatible : shall be "ti,clkctrl" or a clock domain specific name: + "ti,clkctrl-l4-cfg" + "ti,clkctrl-l4-per" + "ti,clkctrl-l4-secure" + "ti,clkctrl-l4-wkup" - #clock-cells : shall contain 2 with the first entry being the instance offset from the clock domain base and the second being the clock index +- reg : clock registers Example: Clock controller node on omap 4430: &cm2 { l4per: cm@1400 { cm_l4per@0 { - cm_l4per_clkctrl: clk@20 { - compatible = "ti,clkctrl"; + cm_l4per_clkctrl: clock@20 { + compatible = "ti,clkctrl-l4-per", "ti,clkctrl"; reg = <0x20 0x1b0>; #clock-cells = <2>; };
drivers/clk/ti/clk.c +3 -1
@@ -171,7 +171,9 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[]) node =of_find_node_by_name (NULL , buf);if (num_args && compat_mode) { parent = node; - node =of_get_child_by_name (parent,"clk" ); + node =of_get_child_by_name (parent,"clock" ); +if (!node) + node =of_get_child_by_name (parent,"clk" );of_node_put (parent); }
drivers/clk/ti/clkctrl.c +85 -11
139 lines not on this page · raw message
Signature · 1 line
2.24.0
Re: [PATCH 1/5] clk: ti: clkctrl: Fix hidden dependency to node name
Quoted 22 lines · Tony Lindgren
We currently have a hidden dependency to the device tree node name for the clkctrl clocks. Instead of using standard node name like "clock", we must use "l4-per-clkctrl" type naming so the clock driver can find the associated clock domain. Further, if "clk" is specified for a clock node name, the driver sets
TI_CLK_CLKCTRL_COMPATflag that uses different logic for the clock name based on the parent node name for the all the clkctrl clocks for the SoC.If the clock node naming dependency is not understood, the related clockdomain is not found, or a wrong one can get used if a clock manager has multiple clock domains.
As each clkctrl instance represents a single clock domain, let's allow using domain specific compatible names to specify the clock domain.
This simplifies things and removes the hidden dependency to the node name. And then later on, after the node names have been standardized, we can drop the related code for parsing the node names.
Let's also update the binding to use standard "clock" node naming instead of "clk" and add the missing description for reg.
Quoted 9 lines
Cc Rob Herring <[email protected]>Signed-off-by Tony Lindgren <[email protected]>--- .../devicetree/bindings/clock/ti-clkctrl.txt | 11 ++- drivers/clk/ti/clk.c | 4 +- drivers/clk/ti/clkctrl.c | 96 ++++++++++++++++--- 3 files changed, 96 insertions(+), 15 deletions(-)
Re: [PATCH 1/5] clk: ti: clkctrl: Fix hidden dependency to node name
In reply to Tony LindgrenQuoting Tony Lindgren (2019-12-10 09:21:04)
Quoted 19 lines
We currently have a hidden dependency to the device tree node name for the clkctrl clocks. Instead of using standard node name like "clock", we must use "l4-per-clkctrl" type naming so the clock driver can find the associated clock domain. Further, if "clk" is specified for a clock node name, the driver sets
TI_CLK_CLKCTRL_COMPATflag that uses different logic for the clock name based on the parent node name for the all the clkctrl clocks for the SoC.If the clock node naming dependency is not understood, the related clockdomain is not found, or a wrong one can get used if a clock manager has multiple clock domains.
As each clkctrl instance represents a single clock domain, let's allow using domain specific compatible names to specify the clock domain.
This simplifies things and removes the hidden dependency to the node name. And then later on, after the node names have been standardized, we can drop the related code for parsing the node names.
Quoted 7 lines
Let's also update the binding to use standard "clock" node naming instead of "clk" and add the missing description for reg.
Cc Rob Herring <[email protected]>Signed-off-by Tony Lindgren <[email protected]>---
PATCH 2/5 ARM: dts: Add missing omap4 secure clocks
In reply to Tony LindgrenThe secure clocks on omap4 are similar to what we already have for dra7 in dra7_l4sec_clkctrl_regs and documented in the omap4460 TRM "Table 3-1346 L4PER_CM2 Registers Mapping Summary".
The secure clocks are part of the l4_per clock manager. As the l4_per clock manager has now two clock domains as children, let's also update the l4_per clockdomain node name to follow the "clock" node naming with a domain specific compatible property.
--- arch/arm/boot/dts/omap44xx-clocks.dtsi | 11 ++++++++--- drivers/clk/ti/clk-44xx.c | 13 +++++++++++++ include/dt-bindings/clock/omap4.h | 11 +++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-)
arch/arm/boot/dts/omap44xx-clocks.dtsi +8 -3
@@ -1279,13 +1279,18 @@ l4_per_cm: l4_per_cm@1400 { #size-cells = <1>; ranges = <0 0x1400 0x200>; - l4_per_clkctrl: clk@20 { - compatible = "ti,clkctrl"; + l4_per_clkctrl: clock@20 { + compatible = "ti,clkctrl-l4-per", "ti,clkctrl"; reg = <0x20 0x144>; #clock-cells = <2>; }; - }; + l4_secure_clkctrl: clock@1a0 { + compatible = "ti,clkctrl-l4-secure", "ti,clkctrl"; + reg = <0x1a0 0x3c>; + #clock-cells = <2>; + }; + }; }; &prm {
drivers/clk/ti/clk-44xx.c +13 -0
@@ -604,6 +604,18 @@ static const struct omap_clkctrl_reg_data omap4_l4_per_clkctrl_regs[] __initcons { 0 }, }; +static const struct +omap_clkctrl_reg_data omap4_l4_secure_clkctrl_regs[]__initconst = { + {OMAP4_AES1_CLKCTRL ,NULL ,CLKF_SW_SUP ,"" }, + {OMAP4_AES2_CLKCTRL ,NULL ,CLKF_SW_SUP ,"" }, + {OMAP4_DES3DES_CLKCTRL ,NULL ,CLKF_SW_SUP ,"" }, + {OMAP4_PKA_CLKCTRL ,NULL ,CLKF_SW_SUP ,"" }, + {OMAP4_RNG_CLKCTRL ,NULL ,CLKF_HW_SUP |CLKF_SOC_NONSEC ,"" }, + {OMAP4_SHA2MD5_CLKCTRL ,NULL ,CLKF_SW_SUP ,"" }, + {OMAP4_CRYPTODMA_CLKCTRL ,NULL ,CLKF_HW_SUP |CLKF_SOC_NONSEC ,"" }, + {0 }, +}; +static const struct omap_clkctrl_bit_data omap4_gpio1_bit_data[]__initconst = { {8 ,TI_CLK_GATE , omap4_gpio2_dbclk_parents,NULL }, { 0 },
@@ -691,6 +703,7 @@ const struct omap_clkctrl_data omap4_clkctrl_data[] __initconst = { { 0x4a009220, omap4_l3_gfx_clkctrl_regs }, { 0x4a009320, omap4_l3_init_clkctrl_regs }, { 0x4a009420, omap4_l4_per_clkctrl_regs }, + { 0x4a0095a0, omap4_l4_secure_clkctrl_regs }, { 0x4a307820, omap4_l4_wkup_clkctrl_regs }, { 0x4a307a20, omap4_emu_sys_clkctrl_regs }, { 0 },
include/dt-bindings/clock/omap4.h +11 -0
@@ -124,6 +124,17 @@#define OMAP4_UART4_CLKCTRL OMAP4_CLKCTRL_INDEX(0x158)#define OMAP4_MMC5_CLKCTRL OMAP4_CLKCTRL_INDEX(0x160) +/* l4_secure clocks */ +#define OMAP4_L4_SECURE_CLKCTRL_OFFSET 0x1a0 +#define OMAP4_L4_SECURE_CLKCTRL_INDEX (offset) ((offset) - OMAP4_L4_SECURE_CLKCTRL_OFFSET) +#define OMAP4_AES1_CLKCTRL OMAP4_L4_SECURE_CLKCTRL_INDEX(0x1a0) +#define OMAP4_AES2_CLKCTRL OMAP4_L4_SECURE_CLKCTRL_INDEX(0x1a8) +#define OMAP4_DES3DES_CLKCTRL OMAP4_L4_SECURE_CLKCTRL_INDEX(0x1b0) +#define OMAP4_PKA_CLKCTRL OMAP4_L4_SECURE_CLKCTRL_INDEX(0x1b8) +#define OMAP4_RNG_CLKCTRL OMAP4_L4_SECURE_CLKCTRL_INDEX(0x1c0) +#define OMAP4_SHA2MD5_CLKCTRL OMAP4_L4_SECURE_CLKCTRL_INDEX(0x1c8) +#define OMAP4_CRYPTODMA_CLKCTRL OMAP4_L4_SECURE_CLKCTRL_INDEX(0x1d8) +/* l4_wkup clocks */ #define OMAP4_L4_WKUP_CLKCTRL OMAP4_CLKCTRL_INDEX(0x20)#define OMAP4_WD_TIMER2_CLKCTRL OMAP4_CLKCTRL_INDEX(0x30)
Signature · 1 line
2.24.0
Re: [PATCH 2/5] ARM: dts: Add missing omap4 secure clocks
Quoting Tony Lindgren (2019-12-10 09:21:05)
Quoted 9 lines
The secure clocks on omap4 are similar to what we already have for dra7 in
dra7_l4sec_clkctrl_regsand documented in the omap4460 TRM "Table 3-1346L4PER_CM2Registers Mapping Summary".The secure clocks are part of the
l4_perclock manager. As thel4_perclock manager has now two clock domains as children, let's also update thel4_perclockdomain node name to follow the "clock" node naming with a domain specific compatible property.
Quoted 4 lines
Cc Rob Herring <[email protected]>Signed-off-by Tony Lindgren <[email protected]>---
PATCH 3/5 ARM: dts: Add missing omap5 secure clocks
In reply to Tony LindgrenThe secure clocks on omap5 are similar to what we already have for dra7 with dra7_l4sec_clkctrl_regs and documented in the omap5432 TRM in "Table 3-1044. CORE_CM_CORE Registers Mapping Summary".
The secure clocks are part of the l4per clock manager. As the l4per clock manager has now two clock domains as children, let's also update the l4per clockdomain node name to follow the "clock" node naming with a domain specific compatible property.
Compared to omap4, omap5 has more clocks working in hardare autogating mode.
--- arch/arm/boot/dts/omap54xx-clocks.dtsi | 10 ++++++++-- drivers/clk/ti/clk-54xx.c | 13 +++++++++++++ include/dt-bindings/clock/omap5.h | 11 +++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-)
arch/arm/boot/dts/omap54xx-clocks.dtsi +8 -2
@@ -1125,11 +1125,17 @@ l4per_cm: l4per_cm@1000 { #size-cells = <1>; ranges = <0 0x1000 0x200>; - l4per_clkctrl: clk@20 { - compatible = "ti,clkctrl"; + l4per_clkctrl: clock@20 { + compatible = "ti,clkctrl-l4per", "ti,clkctrl"; reg = <0x20 0x15c>; #clock-cells = <2>; }; + + l4sec_clkctrl: clock@1a0 { + compatible = "ti,clkctrl-l4sec", "ti,clkctrl"; + reg = <0x1a0 0x3c>; + #clock-cells = <2>; + }; }; dss_cm: dss_cm@1400 {
drivers/clk/ti/clk-54xx.c +13 -0
@@ -286,6 +286,18 @@ static const struct omap_clkctrl_reg_data omap5_l4per_clkctrl_regs[] __initconst { 0 }, }; +static const struct +omap_clkctrl_reg_data omap5_l4_secure_clkctrl_regs[]__initconst = { + {OMAP5_AES1_CLKCTRL ,NULL ,CLKF_HW_SUP ,"" }, + {OMAP5_AES2_CLKCTRL ,NULL ,CLKF_HW_SUP ,"" }, + {OMAP5_DES3DES_CLKCTRL ,NULL ,CLKF_HW_SUP ,"" }, + {OMAP5_FPKA_CLKCTRL ,NULL ,CLKF_SW_SUP ,"" }, + {OMAP5_RNG_CLKCTRL ,NULL ,CLKF_HW_SUP |CLKF_SOC_NONSEC ,"" }, + {OMAP5_SHA2MD5_CLKCTRL ,NULL ,CLKF_HW_SUP ,"" }, + {OMAP5_DMA_CRYPTO_CLKCTRL ,NULL ,CLKF_HW_SUP |CLKF_SOC_NONSEC ,"" }, + {0 }, +}; +static const struct omap_clkctrl_reg_data omap5_iva_clkctrl_regs[]__initconst = { {OMAP5_IVA_CLKCTRL ,NULL ,CLKF_HW_SUP ,"dpll_iva_h12x2_ck" }, { OMAP5_SL2IF_CLKCTRL, NULL, CLKF_HW_SUP, "dpll_iva_h12x2_ck" },
@@ -508,6 +520,7 @@ const struct omap_clkctrl_data omap5_clkctrl_data[] __initconst = { { 0x4a008d20, omap5_l4cfg_clkctrl_regs }, { 0x4a008e20, omap5_l3instr_clkctrl_regs }, { 0x4a009020, omap5_l4per_clkctrl_regs }, + { 0x4a0091a0, omap5_l4_secure_clkctrl_regs }, { 0x4a009220, omap5_iva_clkctrl_regs }, { 0x4a009420, omap5_dss_clkctrl_regs }, { 0x4a009520, omap5_gpu_clkctrl_regs },
include/dt-bindings/clock/omap5.h +11 -0
@@ -86,6 +86,17 @@#define OMAP5_UART5_CLKCTRL OMAP5_CLKCTRL_INDEX(0x170)#define OMAP5_UART6_CLKCTRL OMAP5_CLKCTRL_INDEX(0x178) +/* l4_secure clocks */ +#define OMAP5_L4_SECURE_CLKCTRL_OFFSET 0x1a0 +#define OMAP5_L4_SECURE_CLKCTRL_INDEX (offset) ((offset) - OMAP5_L4_SECURE_CLKCTRL_OFFSET) +#define OMAP5_AES1_CLKCTRL OMAP5_L4_SECURE_CLKCTRL_INDEX(0x1a0) +#define OMAP5_AES2_CLKCTRL OMAP5_L4_SECURE_CLKCTRL_INDEX(0x1a8) +#define OMAP5_DES3DES_CLKCTRL OMAP5_L4_SECURE_CLKCTRL_INDEX(0x1b0) +#define OMAP5_FPKA_CLKCTRL OMAP5_L4_SECURE_CLKCTRL_INDEX(0x1b8) +#define OMAP5_RNG_CLKCTRL OMAP5_L4_SECURE_CLKCTRL_INDEX(0x1c0) +#define OMAP5_SHA2MD5_CLKCTRL OMAP5_L4_SECURE_CLKCTRL_INDEX(0x1c8) +#define OMAP5_DMA_CRYPTO_CLKCTRL OMAP5_L4_SECURE_CLKCTRL_INDEX(0x1d8) +/* iva clocks */ #define OMAP5_IVA_CLKCTRL OMAP5_CLKCTRL_INDEX(0x20)#define OMAP5_SL2IF_CLKCTRL OMAP5_CLKCTRL_INDEX(0x28)
Signature · 1 line
2.24.0
Re: [PATCH 3/5] ARM: dts: Add missing omap5 secure clocks
Quoting Tony Lindgren (2019-12-10 09:21:06)
Quoted 9 lines
The secure clocks on omap5 are similar to what we already have for dra7 with
dra7_l4sec_clkctrl_regsand documented in the omap5432 TRM in "Table 3-1044.CORE_CM_CORERegisters Mapping Summary".The secure clocks are part of the l4per clock manager. As the l4per clock manager has now two clock domains as children, let's also update the l4per clockdomain node name to follow the "clock" node naming with a domain specific compatible property.
Quoted 7 lines
Compared to omap4, omap5 has more clocks working in hardare autogating mode.
Cc Rob Herring <[email protected]>Signed-off-by Tony Lindgren <[email protected]>---
PATCH 4/5 ARM: dts: Configure omap4 rng to probe with ti-sysc
In reply to Tony LindgrenAdd RNG interconnect data for omap4 similar to what dra7 has. The clock is OMAP4_CM_L4SEC_RNG_CLKCTRL_OFFSET at offset address 0x01c0, which matches what dra7 also has with DRA7_L4SEC_CLKCTRL_INDEX(0x1c0).
Note that we need to also add the related l4_secure clock entries. I've only added RNG, the others can be added as they get tested. They are probably very similar to what we already have for dra7 in dra7_l4sec_clkctrl_regs[].
With the clock tagged CLKF_SOC_NONSEC, clock is set disabled for secure devices and clk_get() will fail. Additionally we disable the RNG target module on droid4 to avoid introducing new boot time warnings.
--- .../boot/dts/motorola-mapphone-common.dtsi | 5 +++++ arch/arm/boot/dts/omap4-l4.dtsi | 20 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-)
arch/arm/boot/dts/motorola-mapphone-common.dtsi +5 -0
@@ -650,6 +650,11 @@ OMAP4_IOPAD(0x040, PIN_OUTPUT_PULLDOWN | MUX_MODE3) }; }; +/* RNG is used by secure mode and not accessible */ +&rng_target { + status = "disabled"; +}; + /* Configure pwm clock source for timers 8 & 9 */ &timer8 { assigned-clocks = <&abe_clkctrl OMAP4_TIMER8_CLKCTRL 24>;
arch/arm/boot/dts/omap4-l4.dtsi +17 -3
@@ -2002,12 +2002,26 @@ timer11: timer@0 { }; }; - target-module@90000 { /* 0x48090000, ap 57 2a.0 */ - compatible = "ti,sysc"; - status = "disabled"; + rng_target: target-module@90000 { /* 0x48090000, ap 57 2a.0 */ + compatible = "ti,sysc-omap2", "ti,sysc"; + reg = <0x91fe0 0x4>, + <0x91fe4 0x4>; + reg-names = "rev", "sysc"; + ti,sysc-mask = <(SYSC_OMAP2_AUTOIDLE)>; + ti,sysc-sidle = <SYSC_IDLE_FORCE>, + <SYSC_IDLE_NO>; + /* Domains (P, C): l4per_pwrdm, l4_secure_clkdm */ + clocks = <&l4_secure_clkctrl OMAP4_RNG_CLKCTRL 0>; + clock-names = "fck"; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x90000 0x2000>; + + rng: rng@0 { + compatible = "ti,omap4-rng"; + reg = <0x0 0x2000>; + interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; + }; }; target-module@96000 { /* 0x48096000, ap 37 26.0 */
Signature · 1 line
2.24.0
PATCH 5/5 ARM: dts: Configure omap5 rng to probe with ti-sysc
In reply to Tony LindgrenThis is similar to dra7 and omap4 with different clock naming and module address.
--- arch/arm/boot/dts/omap5-l4.dtsi | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
arch/arm/boot/dts/omap5-l4.dtsi +17 -3
@@ -1769,12 +1769,26 @@ timer11: timer@0 { }; }; - target-module@90000 { /* 0x48090000, ap 55 1a.0 */ - compatible = "ti,sysc"; - status = "disabled"; + rng_target: target-module@90000 { /* 0x48090000, ap 55 1a.0 */ + compatible = "ti,sysc-omap2", "ti,sysc"; + reg = <0x91fe0 0x4>, + <0x91fe4 0x4>; + reg-names = "rev", "sysc"; + ti,sysc-mask = <(SYSC_OMAP2_AUTOIDLE)>; + ti,sysc-sidle = <SYSC_IDLE_FORCE>, + <SYSC_IDLE_NO>; + /* Domains (P, C): l4per_pwrdm, l4sec_clkdm */ + clocks = <&l4sec_clkctrl OMAP5_RNG_CLKCTRL 0>; + clock-names = "fck"; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x90000 0x2000>; + + rng: rng@0 { + compatible = "ti,omap4-rng"; + reg = <0x0 0x2000>; + interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; + }; }; target-module@98000 { /* 0x48098000, ap 47 08.0 */
Signature · 1 line
2.24.0