* [PATCH v2 00/11] Update clock definitions
@ 2021-06-24 13:02 Biju Das
2021-06-24 13:02 ` [PATCH v2 01/11] drivers: clk: renesas: renesas-rzg2l-cpg: Add multi clock PM support Biju Das
` (10 more replies)
0 siblings, 11 replies; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Michael Turquette, Rob Herring, Stephen Boyd
Cc: Biju Das, Geert Uytterhoeven, linux-renesas-soc, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
This patch series aims to update clock and reset definitions as per
RZ/G2L_clock_list_r02_02.xlsx and RZ/G2L HW(Rev.0.50) manual.
As per this, we need to separate resets from module clocks in order to
handle it efficiently.
Added support for multi clock PM support and updated clock driver enties.
This patch series is tested with USB Host, USB Device, I2C, DMAC and SSI.
This patch series is based on [1] and [2]
[1] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/commit/?h=renesas-clk-for-v5.15
[2] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git/
v1->v2
* Updated reset entries
* Added Geert's Rb tag for multi clock PM support.
v1:
* https://patchwork.kernel.org/project/linux-renesas-soc/list/?series=503135
Biju Das (11):
drivers: clk: renesas: renesas-rzg2l-cpg: Add multi clock PM support
drivers: clk: renesas: r9a07g044-cpg: Rename divider table
drivers: clk: renesas: r9a07g044-cpg: Fix P1 Clock
drivers: clk: renesas: r9a07g044-cpg: Add P2 Clock support
dt-bindings: clk: r9a07g044-cpg: Update clock/reset definitions
drivers: clk: renesas: renesas-rzg2l-cpg: Separate reset from module
clocks
drivers: clk: renesas: r9a07g044-cpg: Update {GIC,IA55,SCIF}
clock/reset entries
arm64: dts: renesas: r9a07g044: Update SCIF0 clock/reset
drivers: clk: renesas: r9a07g044-cpg: Add I2C clocks/resets
drivers: clk: renesas: r9a07g044-cpg: Add DMAC clocks/resets
arm64: dts: renesas: r9a07g044: Add I2C nodes
arch/arm64/boot/dts/renesas/r9a07g044.dtsi | 84 +++++++-
drivers/clk/renesas/r9a07g044-cpg.c | 99 ++++++---
drivers/clk/renesas/renesas-rzg2l-cpg.c | 92 ++++----
drivers/clk/renesas/renesas-rzg2l-cpg.h | 28 ++-
include/dt-bindings/clock/r9a07g044-cpg.h | 236 ++++++++++++++++-----
5 files changed, 405 insertions(+), 134 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 01/11] drivers: clk: renesas: renesas-rzg2l-cpg: Add multi clock PM support
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
@ 2021-06-24 13:02 ` Biju Das
2021-06-24 13:02 ` [PATCH v2 02/11] drivers: clk: renesas: r9a07g044-cpg: Rename divider table Biju Das
` (9 subsequent siblings)
10 siblings, 0 replies; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Michael Turquette, Stephen Boyd
Cc: Biju Das, Geert Uytterhoeven, linux-renesas-soc, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Add multi clock PM support for cpg driver.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v1->v2:
* Added Geert's Rb tag.
---
drivers/clk/renesas/renesas-rzg2l-cpg.c | 51 ++++++++++++++-----------
1 file changed, 29 insertions(+), 22 deletions(-)
diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.c b/drivers/clk/renesas/renesas-rzg2l-cpg.c
index 1452881b4123..892392b9e0b2 100644
--- a/drivers/clk/renesas/renesas-rzg2l-cpg.c
+++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c
@@ -586,42 +586,49 @@ static int rzg2l_cpg_attach_dev(struct generic_pm_domain *unused, struct device
{
struct device_node *np = dev->of_node;
struct of_phandle_args clkspec;
+ bool once = true;
struct clk *clk;
int error;
int i = 0;
while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i,
&clkspec)) {
- if (rzg2l_cpg_is_pm_clk(&clkspec))
- goto found;
-
- of_node_put(clkspec.np);
+ if (rzg2l_cpg_is_pm_clk(&clkspec)) {
+ if (once) {
+ once = false;
+ error = pm_clk_create(dev);
+ if (error) {
+ of_node_put(clkspec.np);
+ goto err;
+ }
+ }
+ clk = of_clk_get_from_provider(&clkspec);
+ of_node_put(clkspec.np);
+ if (IS_ERR(clk)) {
+ error = PTR_ERR(clk);
+ goto fail_destroy;
+ }
+
+ error = pm_clk_add_clk(dev, clk);
+ if (error) {
+ dev_err(dev, "pm_clk_add_clk failed %d\n",
+ error);
+ goto fail_put;
+ }
+ } else {
+ of_node_put(clkspec.np);
+ }
i++;
}
return 0;
-found:
- clk = of_clk_get_from_provider(&clkspec);
- of_node_put(clkspec.np);
-
- if (IS_ERR(clk))
- return PTR_ERR(clk);
-
- error = pm_clk_create(dev);
- if (error)
- goto fail_put;
-
- error = pm_clk_add_clk(dev, clk);
- if (error)
- goto fail_destroy;
-
- return 0;
+fail_put:
+ clk_put(clk);
fail_destroy:
pm_clk_destroy(dev);
-fail_put:
- clk_put(clk);
+err:
return error;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 02/11] drivers: clk: renesas: r9a07g044-cpg: Rename divider table
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
2021-06-24 13:02 ` [PATCH v2 01/11] drivers: clk: renesas: renesas-rzg2l-cpg: Add multi clock PM support Biju Das
@ 2021-06-24 13:02 ` Biju Das
2021-06-25 14:27 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 03/11] drivers: clk: renesas: r9a07g044-cpg: Fix P1 Clock Biju Das
` (8 subsequent siblings)
10 siblings, 1 reply; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Michael Turquette, Stephen Boyd
Cc: Biju Das, Geert Uytterhoeven, linux-renesas-soc, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
As per RZ/G2L HW Manual (Rev.0.50), CPG_PL3A_DDIV,CPG_PL3B_DDIV
and CPG_PL2_DDIV(for P0) shares same divider table entries. Rename
clk_div_table dtable_3b to clk_div_table dtable_1_32 so that it
can be reused.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v2:
* New patch
---
drivers/clk/renesas/r9a07g044-cpg.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/renesas/r9a07g044-cpg.c b/drivers/clk/renesas/r9a07g044-cpg.c
index 50b5269586a4..3b6bde487437 100644
--- a/drivers/clk/renesas/r9a07g044-cpg.c
+++ b/drivers/clk/renesas/r9a07g044-cpg.c
@@ -42,12 +42,13 @@ enum clk_ids {
};
/* Divider tables */
-static const struct clk_div_table dtable_3b[] = {
+static const struct clk_div_table dtable_common_1_32[] = {
{0, 1},
{1, 2},
{2, 4},
{3, 8},
{4, 32},
+ {0, 0},
};
static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
@@ -72,10 +73,10 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
/* Core output clk */
DEF_FIXED("I", R9A07G044_CLK_I, CLK_PLL1, 1, 1),
DEF_DIV("P0", R9A07G044_CLK_P0, CLK_PLL2_DIV16, DIVPL2A,
- dtable_3b, CLK_DIVIDER_HIWORD_MASK),
+ dtable_common_1_32, CLK_DIVIDER_HIWORD_MASK),
DEF_FIXED("TSU", R9A07G044_CLK_TSU, CLK_PLL2_DIV20, 1, 1),
DEF_DIV("P1", R9A07G044_CLK_P1, CLK_PLL3_DIV8,
- DIVPL3B, dtable_3b, CLK_DIVIDER_HIWORD_MASK),
+ DIVPL3B, dtable_common_1_32, CLK_DIVIDER_HIWORD_MASK),
};
static struct rzg2l_mod_clk r9a07g044_mod_clks[] = {
--
2.17.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 03/11] drivers: clk: renesas: r9a07g044-cpg: Fix P1 Clock
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
2021-06-24 13:02 ` [PATCH v2 01/11] drivers: clk: renesas: renesas-rzg2l-cpg: Add multi clock PM support Biju Das
2021-06-24 13:02 ` [PATCH v2 02/11] drivers: clk: renesas: r9a07g044-cpg: Rename divider table Biju Das
@ 2021-06-24 13:02 ` Biju Das
2021-06-25 14:32 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 04/11] drivers: clk: renesas: r9a07g044-cpg: Add P2 Clock support Biju Das
` (7 subsequent siblings)
10 siblings, 1 reply; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Michael Turquette, Stephen Boyd
Cc: Biju Das, Geert Uytterhoeven, linux-renesas-soc, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
As per RZ/G2L HW Manual(Rev.0.50) P1 is sourced from pll3_div2_4.
So fix the clock definitions for P1.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v2:
* New patch
---
drivers/clk/renesas/r9a07g044-cpg.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/renesas/r9a07g044-cpg.c b/drivers/clk/renesas/r9a07g044-cpg.c
index 3b6bde487437..caf3412d7b23 100644
--- a/drivers/clk/renesas/r9a07g044-cpg.c
+++ b/drivers/clk/renesas/r9a07g044-cpg.c
@@ -30,8 +30,8 @@ enum clk_ids {
CLK_PLL2_DIV20,
CLK_PLL3,
CLK_PLL3_DIV2,
+ CLK_PLL3_DIV2_4,
CLK_PLL3_DIV4,
- CLK_PLL3_DIV8,
CLK_PLL4,
CLK_PLL5,
CLK_PLL5_DIV2,
@@ -67,15 +67,15 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
DEF_FIXED(".pll2_div20", CLK_PLL2_DIV20, CLK_PLL2, 1, 20),
DEF_FIXED(".pll3_div2", CLK_PLL3_DIV2, CLK_PLL3, 1, 2),
+ DEF_FIXED(".pll3_div2_4", CLK_PLL3_DIV2_4, CLK_PLL3_DIV2, 1, 4),
DEF_FIXED(".pll3_div4", CLK_PLL3_DIV4, CLK_PLL3, 1, 4),
- DEF_FIXED(".pll3_div8", CLK_PLL3_DIV8, CLK_PLL3, 1, 8),
/* Core output clk */
DEF_FIXED("I", R9A07G044_CLK_I, CLK_PLL1, 1, 1),
DEF_DIV("P0", R9A07G044_CLK_P0, CLK_PLL2_DIV16, DIVPL2A,
dtable_common_1_32, CLK_DIVIDER_HIWORD_MASK),
DEF_FIXED("TSU", R9A07G044_CLK_TSU, CLK_PLL2_DIV20, 1, 1),
- DEF_DIV("P1", R9A07G044_CLK_P1, CLK_PLL3_DIV8,
+ DEF_DIV("P1", R9A07G044_CLK_P1, CLK_PLL3_DIV2_4,
DIVPL3B, dtable_common_1_32, CLK_DIVIDER_HIWORD_MASK),
};
--
2.17.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 04/11] drivers: clk: renesas: r9a07g044-cpg: Add P2 Clock support
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
` (2 preceding siblings ...)
2021-06-24 13:02 ` [PATCH v2 03/11] drivers: clk: renesas: r9a07g044-cpg: Fix P1 Clock Biju Das
@ 2021-06-24 13:02 ` Biju Das
2021-06-25 14:33 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 05/11] dt-bindings: clk: r9a07g044-cpg: Update clock/reset definitions Biju Das
` (6 subsequent siblings)
10 siblings, 1 reply; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Michael Turquette, Stephen Boyd
Cc: Biju Das, Geert Uytterhoeven, linux-renesas-soc, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Add support for P2 clock which is sourced from pll3_div2_4_2.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v1->v2:
* Changed the divider name.
---
drivers/clk/renesas/r9a07g044-cpg.c | 4 ++++
drivers/clk/renesas/renesas-rzg2l-cpg.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/drivers/clk/renesas/r9a07g044-cpg.c b/drivers/clk/renesas/r9a07g044-cpg.c
index caf3412d7b23..d03f7ae6177e 100644
--- a/drivers/clk/renesas/r9a07g044-cpg.c
+++ b/drivers/clk/renesas/r9a07g044-cpg.c
@@ -31,6 +31,7 @@ enum clk_ids {
CLK_PLL3,
CLK_PLL3_DIV2,
CLK_PLL3_DIV2_4,
+ CLK_PLL3_DIV2_4_2,
CLK_PLL3_DIV4,
CLK_PLL4,
CLK_PLL5,
@@ -68,6 +69,7 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
DEF_FIXED(".pll3_div2", CLK_PLL3_DIV2, CLK_PLL3, 1, 2),
DEF_FIXED(".pll3_div2_4", CLK_PLL3_DIV2_4, CLK_PLL3_DIV2, 1, 4),
+ DEF_FIXED(".pll3_div2_4_2", CLK_PLL3_DIV2_4_2, CLK_PLL3_DIV2_4, 1, 2),
DEF_FIXED(".pll3_div4", CLK_PLL3_DIV4, CLK_PLL3, 1, 4),
/* Core output clk */
@@ -77,6 +79,8 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
DEF_FIXED("TSU", R9A07G044_CLK_TSU, CLK_PLL2_DIV20, 1, 1),
DEF_DIV("P1", R9A07G044_CLK_P1, CLK_PLL3_DIV2_4,
DIVPL3B, dtable_common_1_32, CLK_DIVIDER_HIWORD_MASK),
+ DEF_DIV("P2", R9A07G044_CLK_P2, CLK_PLL3_DIV2_4_2,
+ DIVPL3A, dtable_common_1_32, CLK_DIVIDER_HIWORD_MASK),
};
static struct rzg2l_mod_clk r9a07g044_mod_clks[] = {
diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.h b/drivers/clk/renesas/renesas-rzg2l-cpg.h
index 3948bdd8afc9..a6a3bade1985 100644
--- a/drivers/clk/renesas/renesas-rzg2l-cpg.h
+++ b/drivers/clk/renesas/renesas-rzg2l-cpg.h
@@ -21,6 +21,7 @@
#define DDIV_PACK(offset, bitpos, size) \
(((offset) << 20) | ((bitpos) << 12) | ((size) << 8))
#define DIVPL2A DDIV_PACK(CPG_PL2_DDIV, 0, 3)
+#define DIVPL3A DDIV_PACK(CPG_PL3A_DDIV, 0, 3)
#define DIVPL3B DDIV_PACK(CPG_PL3A_DDIV, 4, 3)
/**
--
2.17.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 05/11] dt-bindings: clk: r9a07g044-cpg: Update clock/reset definitions
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
` (3 preceding siblings ...)
2021-06-24 13:02 ` [PATCH v2 04/11] drivers: clk: renesas: r9a07g044-cpg: Add P2 Clock support Biju Das
@ 2021-06-24 13:02 ` Biju Das
2021-06-25 14:33 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 06/11] drivers: clk: renesas: renesas-rzg2l-cpg: Separate reset from module clocks Biju Das
` (5 subsequent siblings)
10 siblings, 1 reply; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Rob Herring
Cc: Biju Das, Lad Prabhakar, devicetree, Geert Uytterhoeven,
Chris Paterson, Biju Das, linux-renesas-soc
Update clock and reset definitions as per RZ/G2L_clock_list_r02_02.xlsx
and RZ/G2L HW(Rev.0.50) manual.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v1->v2:
* Added seperate reset entries.
v1:-
* https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210618095823.19885-2-biju.das.jz@bp.renesas.com/
---
include/dt-bindings/clock/r9a07g044-cpg.h | 236 +++++++++++++++++-----
1 file changed, 183 insertions(+), 53 deletions(-)
diff --git a/include/dt-bindings/clock/r9a07g044-cpg.h b/include/dt-bindings/clock/r9a07g044-cpg.h
index 1d8986563fc5..0728ad07ff7a 100644
--- a/include/dt-bindings/clock/r9a07g044-cpg.h
+++ b/include/dt-bindings/clock/r9a07g044-cpg.h
@@ -32,58 +32,188 @@
#define R9A07G044_OSCCLK 21
/* R9A07G044 Module Clocks */
-#define R9A07G044_CLK_GIC600 0
-#define R9A07G044_CLK_IA55 1
-#define R9A07G044_CLK_SYC 2
-#define R9A07G044_CLK_DMAC 3
-#define R9A07G044_CLK_SYSC 4
-#define R9A07G044_CLK_MTU 5
-#define R9A07G044_CLK_GPT 6
-#define R9A07G044_CLK_ETH0 7
-#define R9A07G044_CLK_ETH1 8
-#define R9A07G044_CLK_I2C0 9
-#define R9A07G044_CLK_I2C1 10
-#define R9A07G044_CLK_I2C2 11
-#define R9A07G044_CLK_I2C3 12
-#define R9A07G044_CLK_SCIF0 13
-#define R9A07G044_CLK_SCIF1 14
-#define R9A07G044_CLK_SCIF2 15
-#define R9A07G044_CLK_SCIF3 16
-#define R9A07G044_CLK_SCIF4 17
-#define R9A07G044_CLK_SCI0 18
-#define R9A07G044_CLK_SCI1 19
-#define R9A07G044_CLK_GPIO 20
-#define R9A07G044_CLK_SDHI0 21
-#define R9A07G044_CLK_SDHI1 22
-#define R9A07G044_CLK_USB0 23
-#define R9A07G044_CLK_USB1 24
-#define R9A07G044_CLK_CANFD 25
-#define R9A07G044_CLK_SSI0 26
-#define R9A07G044_CLK_SSI1 27
-#define R9A07G044_CLK_SSI2 28
-#define R9A07G044_CLK_SSI3 29
-#define R9A07G044_CLK_MHU 30
-#define R9A07G044_CLK_OSTM0 31
-#define R9A07G044_CLK_OSTM1 32
-#define R9A07G044_CLK_OSTM2 33
-#define R9A07G044_CLK_WDT0 34
-#define R9A07G044_CLK_WDT1 35
-#define R9A07G044_CLK_WDT2 36
-#define R9A07G044_CLK_WDT_PON 37
-#define R9A07G044_CLK_GPU 38
-#define R9A07G044_CLK_ISU 39
-#define R9A07G044_CLK_H264 40
-#define R9A07G044_CLK_CRU 41
-#define R9A07G044_CLK_MIPI_DSI 42
-#define R9A07G044_CLK_LCDC 43
-#define R9A07G044_CLK_SRC 44
-#define R9A07G044_CLK_RSPI0 45
-#define R9A07G044_CLK_RSPI1 46
-#define R9A07G044_CLK_RSPI2 47
-#define R9A07G044_CLK_ADC 48
-#define R9A07G044_CLK_TSU_PCLK 49
-#define R9A07G044_CLK_SPI 50
-#define R9A07G044_CLK_MIPI_DSI_V 51
-#define R9A07G044_CLK_MIPI_DSI_PIN 52
+#define R9A07G044_CA55_SCLK 0
+#define R9A07G044_CA55_PCLK 1
+#define R9A07G044_CA55_ATCLK 2
+#define R9A07G044_CA55_GICCLK 3
+#define R9A07G044_CA55_PERICLK 4
+#define R9A07G044_CA55_ACLK 5
+#define R9A07G044_CA55_TSCLK 6
+#define R9A07G044_GIC600_GICCLK 7
+#define R9A07G044_IA55_CLK 8
+#define R9A07G044_IA55_PCLK 9
+#define R9A07G044_MHU_PCLK 10
+#define R9A07G044_SYC_CNT_CLK 11
+#define R9A07G044_DMAC_ACLK 12
+#define R9A07G044_DMAC_PCLK 13
+#define R9A07G044_OSTM0_PCLK 14
+#define R9A07G044_OSTM1_PCLK 15
+#define R9A07G044_OSTM2_PCLK 16
+#define R9A07G044_MTU_X_MCK_MTU3 17
+#define R9A07G044_POE3_CLKM_POE 18
+#define R9A07G044_GPT_PCLK 19
+#define R9A07G044_POEG_A_CLKP 20
+#define R9A07G044_POEG_B_CLKP 21
+#define R9A07G044_POEG_C_CLKP 22
+#define R9A07G044_POEG_D_CLKP 23
+#define R9A07G044_WDT0_PCLK 24
+#define R9A07G044_WDT0_CLK 25
+#define R9A07G044_WDT1_PCLK 26
+#define R9A07G044_WDT1_CLK 27
+#define R9A07G044_WDT2_PCLK 28
+#define R9A07G044_WDT2_CLK 29
+#define R9A07G044_SPI_CLK2 30
+#define R9A07G044_SPI_CLK 31
+#define R9A07G044_SDHI0_IMCLK 32
+#define R9A07G044_SDHI0_IMCLK2 33
+#define R9A07G044_SDHI0_CLK_HS 34
+#define R9A07G044_SDHI0_ACLK 35
+#define R9A07G044_SDHI1_IMCLK 36
+#define R9A07G044_SDHI1_IMCLK2 37
+#define R9A07G044_SDHI1_CLK_HS 38
+#define R9A07G044_SDHI1_ACLK 39
+#define R9A07G044_GPU_CLK 40
+#define R9A07G044_GPU_AXI_CLK 41
+#define R9A07G044_GPU_ACE_CLK 42
+#define R9A07G044_ISU_ACLK 43
+#define R9A07G044_ISU_PCLK 44
+#define R9A07G044_H264_CLK_A 45
+#define R9A07G044_H264_CLK_P 46
+#define R9A07G044_CRU_SYSCLK 47
+#define R9A07G044_CRU_VCLK 48
+#define R9A07G044_CRU_PCLK 49
+#define R9A07G044_CRU_ACLK 50
+#define R9A07G044_MIPI_DSI_PLLCLK 51
+#define R9A07G044_MIPI_DSI_SYSCLK 52
+#define R9A07G044_MIPI_DSI_ACLK 53
+#define R9A07G044_MIPI_DSI_PCLK 54
+#define R9A07G044_MIPI_DSI_VCLK 55
+#define R9A07G044_MIPI_DSI_LPCLK 56
+#define R9A07G044_LCDC_CLK_A 57
+#define R9A07G044_LCDC_CLK_P 58
+#define R9A07G044_LCDC_CLK_D 59
+#define R9A07G044_SSI0_PCLK2 60
+#define R9A07G044_SSI0_PCLK_SFR 61
+#define R9A07G044_SSI1_PCLK2 62
+#define R9A07G044_SSI1_PCLK_SFR 63
+#define R9A07G044_SSI2_PCLK2 64
+#define R9A07G044_SSI2_PCLK_SFR 65
+#define R9A07G044_SSI3_PCLK2 66
+#define R9A07G044_SSI3_PCLK_SFR 67
+#define R9A07G044_SRC_CLKP 68
+#define R9A07G044_USB_U2H0_HCLK 69
+#define R9A07G044_USB_U2H1_HCLK 70
+#define R9A07G044_USB_U2P_EXR_CPUCLK 71
+#define R9A07G044_USB_PCLK 72
+#define R9A07G044_ETH0_CLK_AXI 73
+#define R9A07G044_ETH0_CLK_CHI 74
+#define R9A07G044_ETH1_CLK_AXI 75
+#define R9A07G044_ETH1_CLK_CHI 76
+#define R9A07G044_I2C0_PCLK 77
+#define R9A07G044_I2C1_PCLK 78
+#define R9A07G044_I2C2_PCLK 79
+#define R9A07G044_I2C3_PCLK 80
+#define R9A07G044_SCIF0_CLK_PCK 81
+#define R9A07G044_SCIF1_CLK_PCK 82
+#define R9A07G044_SCIF2_CLK_PCK 83
+#define R9A07G044_SCIF3_CLK_PCK 84
+#define R9A07G044_SCIF4_CLK_PCK 85
+#define R9A07G044_SCI0_CLKP 86
+#define R9A07G044_SCI1_CLKP 87
+#define R9A07G044_IRDA_CLKP 88
+#define R9A07G044_RSPI0_CLKB 89
+#define R9A07G044_RSPI1_CLKB 90
+#define R9A07G044_RSPI2_CLKB 91
+#define R9A07G044_CANFD_PCLK 92
+#define R9A07G044_GPIO_HCLK 93
+#define R9A07G044_ADC_ADCLK 94
+#define R9A07G044_ADC_PCLK 95
+#define R9A07G044_TSU_PCLK 96
+
+/* R9A07G044 Resets */
+#define R9A07G044_CA55_RST_1_0 0
+#define R9A07G044_CA55_RST_1_1 1
+#define R9A07G044_CA55_RST_3_0 2
+#define R9A07G044_CA55_RST_3_1 3
+#define R9A07G044_CA55_RST_4 4
+#define R9A07G044_CA55_RST_5 5
+#define R9A07G044_CA55_RST_6 6
+#define R9A07G044_CA55_RST_7 7
+#define R9A07G044_CA55_RST_8 8
+#define R9A07G044_CA55_RST_9 9
+#define R9A07G044_CA55_RST_10 10
+#define R9A07G044_CA55_RST_11 11
+#define R9A07G044_CA55_RST_12 12
+#define R9A07G044_GIC600_GICRESET_N 13
+#define R9A07G044_GIC600_DBG_GICRESET_N 14
+#define R9A07G044_IA55_RESETN 15
+#define R9A07G044_MHU_RESETN 16
+#define R9A07G044_DMAC_ARESETN 17
+#define R9A07G044_DMAC_RST_ASYNC 18
+#define R9A07G044_SYC_RESETN 19
+#define R9A07G044_OSTM0_PRESETZ 20
+#define R9A07G044_OSTM1_PRESETZ 21
+#define R9A07G044_OSTM2_PRESETZ 22
+#define R9A07G044_MTU_X_PRESET_MTU3 23
+#define R9A07G044_POE3_RST_M_REG 24
+#define R9A07G044_GPT_RST_C 25
+#define R9A07G044_POEG_A_RST 26
+#define R9A07G044_POEG_B_RST 27
+#define R9A07G044_POEG_C_RST 28
+#define R9A07G044_POEG_D_RST 29
+#define R9A07G044_WDT0_PRESETN 30
+#define R9A07G044_WDT1_PRESETN 31
+#define R9A07G044_WDT2_PRESETN 32
+#define R9A07G044_SPI_RST 33
+#define R9A07G044_SDHI0_IXRST 34
+#define R9A07G044_SDHI1_IXRST 35
+#define R9A07G044_GPU_RESETN 36
+#define R9A07G044_GPU_AXI_RESETN 37
+#define R9A07G044_GPU_ACE_RESETN 38
+#define R9A07G044_ISU_ARESETN 39
+#define R9A07G044_ISU_PRESETN 40
+#define R9A07G044_H264_X_RESET_VCP 41
+#define R9A07G044_H264_CP_PRESET_P 42
+#define R9A07G044_CRU_CMN_RSTB 43
+#define R9A07G044_CRU_PRESETN 44
+#define R9A07G044_CRU_ARESETN 45
+#define R9A07G044_MIPI_DSI_CMN_RSTB 46
+#define R9A07G044_MIPI_DSI_ARESET_N 47
+#define R9A07G044_MIPI_DSI_PRESET_N 48
+#define R9A07G044_LCDC_RESET_N 49
+#define R9A07G044_SSI0_RST_M2_REG 50
+#define R9A07G044_SSI1_RST_M2_REG 51
+#define R9A07G044_SSI2_RST_M2_REG 52
+#define R9A07G044_SSI3_RST_M2_REG 53
+#define R9A07G044_SRC_RST 54
+#define R9A07G044_USB_U2H0_HRESETN 55
+#define R9A07G044_USB_U2H1_HRESETN 56
+#define R9A07G044_USB_U2P_EXL_SYSRST 57
+#define R9A07G044_USB_PRESETN 58
+#define R9A07G044_ETH0_RST_HW_N 59
+#define R9A07G044_ETH1_RST_HW_N 60
+#define R9A07G044_I2C0_MRST 61
+#define R9A07G044_I2C1_MRST 62
+#define R9A07G044_I2C2_MRST 63
+#define R9A07G044_I2C3_MRST 64
+#define R9A07G044_SCIF0_RST_SYSTEM_N 65
+#define R9A07G044_SCIF1_RST_SYSTEM_N 66
+#define R9A07G044_SCIF2_RST_SYSTEM_N 67
+#define R9A07G044_SCIF3_RST_SYSTEM_N 68
+#define R9A07G044_SCIF4_RST_SYSTEM_N 69
+#define R9A07G044_SCI0_RST 70
+#define R9A07G044_SCI1_RST 71
+#define R9A07G044_IRDA_RST 72
+#define R9A07G044_RSPI0_RST 73
+#define R9A07G044_RSPI1_RST 74
+#define R9A07G044_RSPI2_RST 75
+#define R9A07G044_CANFD_RSTP_N 76
+#define R9A07G044_CANFD_RSTC_N 77
+#define R9A07G044_GPIO_RSTN 78
+#define R9A07G044_GPIO_PORT_RESETN 79
+#define R9A07G044_GPIO_SPARE_RESETN 80
+#define R9A07G044_ADC_PRESETN 81
+#define R9A07G044_ADC_ADRST_N 82
+#define R9A07G044_TSU_PRESETN 83
#endif /* __DT_BINDINGS_CLOCK_R9A07G044_CPG_H__ */
--
2.17.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 06/11] drivers: clk: renesas: renesas-rzg2l-cpg: Separate reset from module clocks
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
` (4 preceding siblings ...)
2021-06-24 13:02 ` [PATCH v2 05/11] dt-bindings: clk: r9a07g044-cpg: Update clock/reset definitions Biju Das
@ 2021-06-24 13:02 ` Biju Das
2021-06-25 14:42 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update {GIC,IA55,SCIF} clock/reset entries Biju Das
` (4 subsequent siblings)
10 siblings, 1 reply; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Michael Turquette, Stephen Boyd
Cc: Biju Das, Geert Uytterhoeven, linux-renesas-soc, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
RZ/G2L SoC's have different definitions for clock and reset.
Separate reset from module clocks in order to handle it efficiently.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v2:
* New patch
---
drivers/clk/renesas/renesas-rzg2l-cpg.c | 1 +
drivers/clk/renesas/renesas-rzg2l-cpg.h | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.c b/drivers/clk/renesas/renesas-rzg2l-cpg.c
index 892392b9e0b2..c969c31d4197 100644
--- a/drivers/clk/renesas/renesas-rzg2l-cpg.c
+++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c
@@ -78,6 +78,7 @@ struct rzg2l_cpg_priv {
struct clk **clks;
unsigned int num_core_clks;
unsigned int num_mod_clks;
+ unsigned int num_resets;
unsigned int last_dt_core_clk;
struct raw_notifier_head notifiers;
diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.h b/drivers/clk/renesas/renesas-rzg2l-cpg.h
index a6a3bade1985..10beb1913363 100644
--- a/drivers/clk/renesas/renesas-rzg2l-cpg.h
+++ b/drivers/clk/renesas/renesas-rzg2l-cpg.h
@@ -99,6 +99,26 @@ struct rzg2l_mod_clk {
.reset = (_reset) \
}
+/**
+ * struct rzg2l_reset - Reset definitions
+ *
+ * @id: reset index in array containing all resets
+ * @off: register offset
+ * @reset: reset bits
+ */
+struct rzg2l_reset {
+ unsigned int id;
+ u16 off;
+ u8 reset;
+};
+
+#define DEF_RST(_id, _off, _reset) \
+ [_id] = { \
+ .id = _id, \
+ .off = (_off), \
+ .reset = (_reset) \
+ }
+
/**
* struct rzg2l_cpg_info - SoC-specific CPG Description
*
@@ -127,6 +147,10 @@ struct rzg2l_cpg_info {
unsigned int num_mod_clks;
unsigned int num_hw_mod_clks;
+ /* Resets */
+ const struct rzg2l_reset *resets;
+ unsigned int num_resets;
+
/* Critical Module Clocks that should not be disabled */
const unsigned int *crit_mod_clks;
unsigned int num_crit_mod_clks;
--
2.17.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update {GIC,IA55,SCIF} clock/reset entries
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
` (5 preceding siblings ...)
2021-06-24 13:02 ` [PATCH v2 06/11] drivers: clk: renesas: renesas-rzg2l-cpg: Separate reset from module clocks Biju Das
@ 2021-06-24 13:02 ` Biju Das
2021-06-25 15:05 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 08/11] arm64: dts: renesas: r9a07g044: Update SCIF0 clock/reset Biju Das
` (3 subsequent siblings)
10 siblings, 1 reply; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Michael Turquette, Stephen Boyd
Cc: Biju Das, Geert Uytterhoeven, linux-renesas-soc, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Update {GIC,IA55,SCIF} clock and reset entries to CPG driver to match with
RZ/G2L clock list hardware manual(RZG2L_clock_list_r02_02.xlsx) and RZ/G2L
HW manual(Rev.0.50).
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v1->v2:
* Updated reset entries.
v1:
* https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210618095823.19885-4-biju.das.jz@bp.renesas.com/
---
drivers/clk/renesas/r9a07g044-cpg.c | 62 ++++++++++++++-----------
drivers/clk/renesas/renesas-rzg2l-cpg.c | 40 +++++++---------
drivers/clk/renesas/renesas-rzg2l-cpg.h | 5 +-
3 files changed, 55 insertions(+), 52 deletions(-)
diff --git a/drivers/clk/renesas/r9a07g044-cpg.c b/drivers/clk/renesas/r9a07g044-cpg.c
index d03f7ae6177e..7bcf373494e0 100644
--- a/drivers/clk/renesas/r9a07g044-cpg.c
+++ b/drivers/clk/renesas/r9a07g044-cpg.c
@@ -84,34 +84,40 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
};
static struct rzg2l_mod_clk r9a07g044_mod_clks[] = {
- DEF_MOD("gic", R9A07G044_CLK_GIC600,
- R9A07G044_CLK_P1,
- 0x514, BIT(0), (BIT(0) | BIT(1))),
- DEF_MOD("ia55", R9A07G044_CLK_IA55,
- R9A07G044_CLK_P1,
- 0x518, (BIT(0) | BIT(1)), BIT(0)),
- DEF_MOD("scif0", R9A07G044_CLK_SCIF0,
- R9A07G044_CLK_P0,
- 0x584, BIT(0), BIT(0)),
- DEF_MOD("scif1", R9A07G044_CLK_SCIF1,
- R9A07G044_CLK_P0,
- 0x584, BIT(1), BIT(1)),
- DEF_MOD("scif2", R9A07G044_CLK_SCIF2,
- R9A07G044_CLK_P0,
- 0x584, BIT(2), BIT(2)),
- DEF_MOD("scif3", R9A07G044_CLK_SCIF3,
- R9A07G044_CLK_P0,
- 0x584, BIT(3), BIT(3)),
- DEF_MOD("scif4", R9A07G044_CLK_SCIF4,
- R9A07G044_CLK_P0,
- 0x584, BIT(4), BIT(4)),
- DEF_MOD("sci0", R9A07G044_CLK_SCI0,
- R9A07G044_CLK_P0,
- 0x588, BIT(0), BIT(0)),
+ DEF_MOD("gic", R9A07G044_GIC600_GICCLK, R9A07G044_CLK_P1,
+ 0x514, 0),
+ DEF_MOD("ia55_pclk", R9A07G044_IA55_PCLK, R9A07G044_CLK_P2,
+ 0x518, 0),
+ DEF_MOD("ia55_clk", R9A07G044_IA55_CLK, R9A07G044_CLK_P1,
+ 0x518, 1),
+ DEF_MOD("scif0", R9A07G044_SCIF0_CLK_PCK, R9A07G044_CLK_P0,
+ 0x584, 0),
+ DEF_MOD("scif1", R9A07G044_SCIF1_CLK_PCK, R9A07G044_CLK_P0,
+ 0x584, 1),
+ DEF_MOD("scif2", R9A07G044_SCIF2_CLK_PCK, R9A07G044_CLK_P0,
+ 0x584, 2),
+ DEF_MOD("scif3", R9A07G044_SCIF3_CLK_PCK, R9A07G044_CLK_P0,
+ 0x584, 3),
+ DEF_MOD("scif4", R9A07G044_SCIF4_CLK_PCK, R9A07G044_CLK_P0,
+ 0x584, 4),
+ DEF_MOD("sci0", R9A07G044_SCI0_CLKP, R9A07G044_CLK_P0,
+ 0x588, 0),
+};
+
+static struct rzg2l_reset r9a07g044_resets[] = {
+ DEF_RST(R9A07G044_GIC600_GICRESET_N, 0x814, 0),
+ DEF_RST(R9A07G044_GIC600_DBG_GICRESET_N, 0x814, 1),
+ DEF_RST(R9A07G044_IA55_RESETN, 0x818, 0),
+ DEF_RST(R9A07G044_SCIF0_RST_SYSTEM_N, 0x884, 0),
+ DEF_RST(R9A07G044_SCIF1_RST_SYSTEM_N, 0x884, 1),
+ DEF_RST(R9A07G044_SCIF2_RST_SYSTEM_N, 0x884, 2),
+ DEF_RST(R9A07G044_SCIF3_RST_SYSTEM_N, 0x884, 3),
+ DEF_RST(R9A07G044_SCIF4_RST_SYSTEM_N, 0x884, 4),
+ DEF_RST(R9A07G044_SCI0_RST, 0x888, 0),
};
static const unsigned int r9a07g044_crit_mod_clks[] __initconst = {
- MOD_CLK_BASE + R9A07G044_CLK_GIC600,
+ MOD_CLK_BASE + R9A07G044_GIC600_GICCLK,
};
const struct rzg2l_cpg_info r9a07g044_cpg_info = {
@@ -128,5 +134,9 @@ const struct rzg2l_cpg_info r9a07g044_cpg_info = {
/* Module Clocks */
.mod_clks = r9a07g044_mod_clks,
.num_mod_clks = ARRAY_SIZE(r9a07g044_mod_clks),
- .num_hw_mod_clks = R9A07G044_CLK_MIPI_DSI_PIN + 1,
+ .num_hw_mod_clks = R9A07G044_TSU_PCLK + 1,
+
+ /* Resets */
+ .resets = r9a07g044_resets,
+ .num_resets = ARRAY_SIZE(r9a07g044_resets),
};
diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.c b/drivers/clk/renesas/renesas-rzg2l-cpg.c
index c969c31d4197..8fc260a02473 100644
--- a/drivers/clk/renesas/renesas-rzg2l-cpg.c
+++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c
@@ -47,9 +47,9 @@
#define SDIV(val) DIV_RSMASK(val, 0, 0x7)
#define CLK_ON_R(reg) (reg)
-#define CLK_MON_R(reg) (0x680 - 0x500 + (reg))
-#define CLK_RST_R(reg) (0x800 - 0x500 + (reg))
-#define CLK_MRST_R(reg) (0x980 - 0x500 + (reg))
+#define CLK_MON_R(reg) (0x180 + (reg))
+#define CLK_RST_R(reg) (reg)
+#define CLK_MRST_R(reg) (0x180 + (reg))
#define GET_REG_OFFSET(val) ((val >> 20) & 0xfff)
#define GET_REG_SAMPLL_CLK1(val) ((val >> 22) & 0xfff)
@@ -310,14 +310,12 @@ rzg2l_cpg_register_core_clk(const struct cpg_core_clk *core,
* @hw: handle between common and hardware-specific interfaces
* @off: register offset
* @onoff: ON/MON bits
- * @reset: reset bits
* @priv: CPG/MSTP private data
*/
struct mstp_clock {
struct clk_hw hw;
u16 off;
u8 onoff;
- u8 reset;
struct rzg2l_cpg_priv *priv;
};
@@ -451,8 +449,7 @@ rzg2l_cpg_register_mod_clk(const struct rzg2l_mod_clk *mod,
init.num_parents = 1;
clock->off = mod->off;
- clock->onoff = mod->onoff;
- clock->reset = mod->reset;
+ clock->onoff = BIT(mod->onoff);
clock->priv = priv;
clock->hw.init = &init;
@@ -476,12 +473,11 @@ static int rzg2l_cpg_reset(struct reset_controller_dev *rcdev,
{
struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
const struct rzg2l_cpg_info *info = priv->info;
- unsigned int reg = info->mod_clks[id].off;
- u32 dis = info->mod_clks[id].reset;
+ unsigned int reg = info->resets[id].off;
+ u32 dis = BIT(info->resets[id].reset);
u32 we = dis << 16;
- dev_dbg(rcdev->dev, "reset name:%s id:%ld offset:0x%x\n",
- info->mod_clks[id].name, id, CLK_RST_R(reg));
+ dev_dbg(rcdev->dev, "reset id:%ld offset:0x%x\n", id, CLK_RST_R(reg));
/* Reset module */
writel(we, priv->base + CLK_RST_R(reg));
@@ -500,11 +496,10 @@ static int rzg2l_cpg_assert(struct reset_controller_dev *rcdev,
{
struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
const struct rzg2l_cpg_info *info = priv->info;
- unsigned int reg = info->mod_clks[id].off;
- u32 value = info->mod_clks[id].reset << 16;
+ unsigned int reg = info->resets[id].off;
+ u32 value = BIT(info->resets[id].reset) << 16;
- dev_dbg(rcdev->dev, "assert name:%s id:%ld offset:0x%x\n",
- info->mod_clks[id].name, id, CLK_RST_R(reg));
+ dev_dbg(rcdev->dev, "assert id:%ld offset:0x%x\n", id, CLK_RST_R(reg));
writel(value, priv->base + CLK_RST_R(reg));
return 0;
@@ -515,12 +510,12 @@ static int rzg2l_cpg_deassert(struct reset_controller_dev *rcdev,
{
struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
const struct rzg2l_cpg_info *info = priv->info;
- unsigned int reg = info->mod_clks[id].off;
- u32 dis = info->mod_clks[id].reset;
+ unsigned int reg = info->resets[id].off;
+ u32 dis = BIT(info->resets[id].reset);
u32 value = (dis << 16) | dis;
- dev_dbg(rcdev->dev, "deassert name:%s id:%ld offset:0x%x\n",
- info->mod_clks[id].name, id, CLK_RST_R(reg));
+ dev_dbg(rcdev->dev, "deassert id:%ld offset:0x%x\n", id,
+ CLK_RST_R(reg));
writel(value, priv->base + CLK_RST_R(reg));
return 0;
@@ -531,8 +526,8 @@ static int rzg2l_cpg_status(struct reset_controller_dev *rcdev,
{
struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
const struct rzg2l_cpg_info *info = priv->info;
- unsigned int reg = info->mod_clks[id].off;
- u32 bitmask = info->mod_clks[id].reset;
+ unsigned int reg = info->resets[id].off;
+ u32 bitmask = BIT(info->resets[id].reset);
return !(readl(priv->base + CLK_MRST_R(reg)) & bitmask);
}
@@ -564,7 +559,7 @@ static int rzg2l_cpg_reset_controller_register(struct rzg2l_cpg_priv *priv)
priv->rcdev.dev = priv->dev;
priv->rcdev.of_reset_n_cells = 1;
priv->rcdev.of_xlate = rzg2l_cpg_reset_xlate;
- priv->rcdev.nr_resets = priv->num_mod_clks;
+ priv->rcdev.nr_resets = priv->num_resets;
return devm_reset_controller_register(priv->dev, &priv->rcdev);
}
@@ -692,6 +687,7 @@ static int __init rzg2l_cpg_probe(struct platform_device *pdev)
priv->clks = clks;
priv->num_core_clks = info->num_total_core_clks;
priv->num_mod_clks = info->num_hw_mod_clks;
+ priv->num_resets = info->num_resets;
priv->last_dt_core_clk = info->last_dt_core_clk;
for (i = 0; i < nclks; i++)
diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.h b/drivers/clk/renesas/renesas-rzg2l-cpg.h
index 10beb1913363..3efd81475c7c 100644
--- a/drivers/clk/renesas/renesas-rzg2l-cpg.h
+++ b/drivers/clk/renesas/renesas-rzg2l-cpg.h
@@ -78,7 +78,6 @@ enum clk_types {
* @parent: id of parent clock
* @off: register offset
* @onoff: ON/MON bits
- * @reset: reset bits
*/
struct rzg2l_mod_clk {
const char *name;
@@ -86,17 +85,15 @@ struct rzg2l_mod_clk {
unsigned int parent;
u16 off;
u8 onoff;
- u8 reset;
};
-#define DEF_MOD(_name, _id, _parent, _off, _onoff, _reset) \
+#define DEF_MOD(_name, _id, _parent, _off, _onoff) \
[_id] = { \
.name = _name, \
.id = MOD_CLK_BASE + _id, \
.parent = (_parent), \
.off = (_off), \
.onoff = (_onoff), \
- .reset = (_reset) \
}
/**
--
2.17.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 08/11] arm64: dts: renesas: r9a07g044: Update SCIF0 clock/reset
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
` (6 preceding siblings ...)
2021-06-24 13:02 ` [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update {GIC,IA55,SCIF} clock/reset entries Biju Das
@ 2021-06-24 13:02 ` Biju Das
2021-06-25 15:05 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 09/11] drivers: clk: renesas: r9a07g044-cpg: Add I2C clocks/resets Biju Das
` (2 subsequent siblings)
10 siblings, 1 reply; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Rob Herring
Cc: Biju Das, Lad Prabhakar, devicetree, Geert Uytterhoeven,
Chris Paterson, Biju Das, linux-renesas-soc
Update SCIF0 clock and reset index in SoC DTSI.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v1->v2:
* Updated reset entries
---
arch/arm64/boot/dts/renesas/r9a07g044.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi
index 734c8adeceba..01482d227506 100644
--- a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi
@@ -82,10 +82,10 @@
<GIC_SPI 384 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "eri", "rxi", "txi",
"bri", "dri", "tei";
- clocks = <&cpg CPG_MOD R9A07G044_CLK_SCIF0>;
+ clocks = <&cpg CPG_MOD R9A07G044_SCIF0_CLK_PCK>;
clock-names = "fck";
power-domains = <&cpg>;
- resets = <&cpg R9A07G044_CLK_SCIF0>;
+ resets = <&cpg R9A07G044_SCIF0_RST_SYSTEM_N>;
status = "disabled";
};
--
2.17.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 09/11] drivers: clk: renesas: r9a07g044-cpg: Add I2C clocks/resets
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
` (7 preceding siblings ...)
2021-06-24 13:02 ` [PATCH v2 08/11] arm64: dts: renesas: r9a07g044: Update SCIF0 clock/reset Biju Das
@ 2021-06-24 13:02 ` Biju Das
2021-06-25 15:06 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 10/11] drivers: clk: renesas: r9a07g044-cpg: Add DMAC clocks/resets Biju Das
2021-06-24 13:02 ` [PATCH v2 11/11] arm64: dts: renesas: r9a07g044: Add I2C nodes Biju Das
10 siblings, 1 reply; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Michael Turquette, Stephen Boyd
Cc: Biju Das, Geert Uytterhoeven, linux-renesas-soc, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Add I2C{0,1,2,3} clock and reset entries.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v1->v2:
* Updated reset entries.
---
drivers/clk/renesas/r9a07g044-cpg.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/clk/renesas/r9a07g044-cpg.c b/drivers/clk/renesas/r9a07g044-cpg.c
index 7bcf373494e0..f363efd9e841 100644
--- a/drivers/clk/renesas/r9a07g044-cpg.c
+++ b/drivers/clk/renesas/r9a07g044-cpg.c
@@ -90,6 +90,14 @@ static struct rzg2l_mod_clk r9a07g044_mod_clks[] = {
0x518, 0),
DEF_MOD("ia55_clk", R9A07G044_IA55_CLK, R9A07G044_CLK_P1,
0x518, 1),
+ DEF_MOD("i2c0", R9A07G044_I2C0_PCLK, R9A07G044_CLK_P0,
+ 0x580, 0),
+ DEF_MOD("i2c1", R9A07G044_I2C1_PCLK, R9A07G044_CLK_P0,
+ 0x580, 1),
+ DEF_MOD("i2c2", R9A07G044_I2C2_PCLK, R9A07G044_CLK_P0,
+ 0x580, 2),
+ DEF_MOD("i2c3", R9A07G044_I2C3_PCLK, R9A07G044_CLK_P0,
+ 0x580, 3),
DEF_MOD("scif0", R9A07G044_SCIF0_CLK_PCK, R9A07G044_CLK_P0,
0x584, 0),
DEF_MOD("scif1", R9A07G044_SCIF1_CLK_PCK, R9A07G044_CLK_P0,
@@ -108,6 +116,10 @@ static struct rzg2l_reset r9a07g044_resets[] = {
DEF_RST(R9A07G044_GIC600_GICRESET_N, 0x814, 0),
DEF_RST(R9A07G044_GIC600_DBG_GICRESET_N, 0x814, 1),
DEF_RST(R9A07G044_IA55_RESETN, 0x818, 0),
+ DEF_RST(R9A07G044_I2C0_MRST, 0x880, 0),
+ DEF_RST(R9A07G044_I2C1_MRST, 0x880, 1),
+ DEF_RST(R9A07G044_I2C2_MRST, 0x880, 2),
+ DEF_RST(R9A07G044_I2C3_MRST, 0x880, 3),
DEF_RST(R9A07G044_SCIF0_RST_SYSTEM_N, 0x884, 0),
DEF_RST(R9A07G044_SCIF1_RST_SYSTEM_N, 0x884, 1),
DEF_RST(R9A07G044_SCIF2_RST_SYSTEM_N, 0x884, 2),
--
2.17.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 10/11] drivers: clk: renesas: r9a07g044-cpg: Add DMAC clocks/resets
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
` (8 preceding siblings ...)
2021-06-24 13:02 ` [PATCH v2 09/11] drivers: clk: renesas: r9a07g044-cpg: Add I2C clocks/resets Biju Das
@ 2021-06-24 13:02 ` Biju Das
2021-06-25 15:12 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 11/11] arm64: dts: renesas: r9a07g044: Add I2C nodes Biju Das
10 siblings, 1 reply; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Michael Turquette, Stephen Boyd
Cc: Biju Das, Geert Uytterhoeven, linux-renesas-soc, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Add DMAC clock and reset entries in CPG driver.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v1->v2:
* Updated reset entries
---
drivers/clk/renesas/r9a07g044-cpg.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/clk/renesas/r9a07g044-cpg.c b/drivers/clk/renesas/r9a07g044-cpg.c
index f363efd9e841..4a433a859d0a 100644
--- a/drivers/clk/renesas/r9a07g044-cpg.c
+++ b/drivers/clk/renesas/r9a07g044-cpg.c
@@ -37,6 +37,7 @@ enum clk_ids {
CLK_PLL5,
CLK_PLL5_DIV2,
CLK_PLL6,
+ CLK_P1_DIV2,
/* Module Clocks */
MOD_CLK_BASE,
@@ -79,6 +80,7 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
DEF_FIXED("TSU", R9A07G044_CLK_TSU, CLK_PLL2_DIV20, 1, 1),
DEF_DIV("P1", R9A07G044_CLK_P1, CLK_PLL3_DIV2_4,
DIVPL3B, dtable_common_1_32, CLK_DIVIDER_HIWORD_MASK),
+ DEF_FIXED("P1_DIV2", CLK_P1_DIV2, R9A07G044_CLK_P1, 1, 2),
DEF_DIV("P2", R9A07G044_CLK_P2, CLK_PLL3_DIV2_4_2,
DIVPL3A, dtable_common_1_32, CLK_DIVIDER_HIWORD_MASK),
};
@@ -90,6 +92,10 @@ static struct rzg2l_mod_clk r9a07g044_mod_clks[] = {
0x518, 0),
DEF_MOD("ia55_clk", R9A07G044_IA55_CLK, R9A07G044_CLK_P1,
0x518, 1),
+ DEF_MOD("dmac_aclk", R9A07G044_DMAC_ACLK, R9A07G044_CLK_P1,
+ 0x52c, 0),
+ DEF_MOD("dmac_pclk", R9A07G044_DMAC_PCLK, CLK_P1_DIV2,
+ 0x52c, 1),
DEF_MOD("i2c0", R9A07G044_I2C0_PCLK, R9A07G044_CLK_P0,
0x580, 0),
DEF_MOD("i2c1", R9A07G044_I2C1_PCLK, R9A07G044_CLK_P0,
@@ -116,6 +122,8 @@ static struct rzg2l_reset r9a07g044_resets[] = {
DEF_RST(R9A07G044_GIC600_GICRESET_N, 0x814, 0),
DEF_RST(R9A07G044_GIC600_DBG_GICRESET_N, 0x814, 1),
DEF_RST(R9A07G044_IA55_RESETN, 0x818, 0),
+ DEF_RST(R9A07G044_DMAC_ARESETN, 0x82c, 0),
+ DEF_RST(R9A07G044_DMAC_RST_ASYNC, 0x82c, 1),
DEF_RST(R9A07G044_I2C0_MRST, 0x880, 0),
DEF_RST(R9A07G044_I2C1_MRST, 0x880, 1),
DEF_RST(R9A07G044_I2C2_MRST, 0x880, 2),
--
2.17.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 11/11] arm64: dts: renesas: r9a07g044: Add I2C nodes
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
` (9 preceding siblings ...)
2021-06-24 13:02 ` [PATCH v2 10/11] drivers: clk: renesas: r9a07g044-cpg: Add DMAC clocks/resets Biju Das
@ 2021-06-24 13:02 ` Biju Das
2021-06-25 15:16 ` Geert Uytterhoeven
10 siblings, 1 reply; 28+ messages in thread
From: Biju Das @ 2021-06-24 13:02 UTC (permalink / raw
To: Rob Herring
Cc: Biju Das, Lad Prabhakar, devicetree, Geert Uytterhoeven,
Chris Paterson, Biju Das, linux-renesas-soc
Add I2C{0,1,2,3} nodes to RZ/G2L (R9A07G044) SoC DTSI.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v1->v2:
* Updated reset entries.
---
arch/arm64/boot/dts/renesas/r9a07g044.dtsi | 80 ++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi
index 01482d227506..63d9696bc769 100644
--- a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi
@@ -89,6 +89,86 @@
status = "disabled";
};
+ i2c0: i2c@10058000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "renesas,riic-r9a07g044", "renesas,riic-rz";
+ reg = <0 0x10058000 0 0x400>;
+ interrupts = <GIC_SPI 350 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 348 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 349 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 352 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 351 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 354 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 355 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD R9A07G044_I2C0_PCLK>;
+ clock-frequency = <100000>;
+ resets = <&cpg R9A07G044_I2C0_MRST>;
+ power-domains = <&cpg>;
+ status = "disabled";
+ };
+
+ i2c1: i2c@10058400 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "renesas,riic-r9a07g044", "renesas,riic-rz";
+ reg = <0 0x10058400 0 0x400>;
+ interrupts = <GIC_SPI 358 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 356 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 357 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 360 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 361 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 359 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 362 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 363 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD R9A07G044_I2C1_PCLK>;
+ clock-frequency = <100000>;
+ resets = <&cpg R9A07G044_I2C1_MRST>;
+ power-domains = <&cpg>;
+ status = "disabled";
+ };
+
+ i2c2: i2c@10058800 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "renesas,riic-r9a07g044", "renesas,riic-rz";
+ reg = <0 0x10058800 0 0x400>;
+ interrupts = <GIC_SPI 366 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 364 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 365 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 368 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 369 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 367 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 370 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 371 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD R9A07G044_I2C2_PCLK>;
+ clock-frequency = <100000>;
+ resets = <&cpg R9A07G044_I2C2_MRST>;
+ power-domains = <&cpg>;
+ status = "disabled";
+ };
+
+ i2c3: i2c@10058c00 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "renesas,riic-r9a07g044", "renesas,riic-rz";
+ reg = <0 0x10058c00 0 0x400>;
+ interrupts = <GIC_SPI 374 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 372 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 373 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 376 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 377 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 379 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD R9A07G044_I2C3_PCLK>;
+ clock-frequency = <100000>;
+ resets = <&cpg R9A07G044_I2C3_MRST>;
+ power-domains = <&cpg>;
+ status = "disabled";
+ };
+
cpg: clock-controller@11010000 {
compatible = "renesas,r9a07g044-cpg";
reg = <0 0x11010000 0 0x10000>;
--
2.17.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH v2 02/11] drivers: clk: renesas: r9a07g044-cpg: Rename divider table
2021-06-24 13:02 ` [PATCH v2 02/11] drivers: clk: renesas: r9a07g044-cpg: Rename divider table Biju Das
@ 2021-06-25 14:27 ` Geert Uytterhoeven
2021-06-25 14:52 ` Biju Das
0 siblings, 1 reply; 28+ messages in thread
From: Geert Uytterhoeven @ 2021-06-25 14:27 UTC (permalink / raw
To: Biju Das
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Hi Biju,
Thanks for your patch!
On Thu, Jun 24, 2021 at 3:02 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> As per RZ/G2L HW Manual (Rev.0.50), CPG_PL3A_DDIV,CPG_PL3B_DDIV
> and CPG_PL2_DDIV(for P0) shares same divider table entries. Rename
> clk_div_table dtable_3b to clk_div_table dtable_1_32 so that it
This does not match the actual variable name.
I do like the shorter name, though ;-)
> can be reused.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Apart from that:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> --- a/drivers/clk/renesas/r9a07g044-cpg.c
> +++ b/drivers/clk/renesas/r9a07g044-cpg.c
> @@ -42,12 +42,13 @@ enum clk_ids {
> };
>
> /* Divider tables */
> -static const struct clk_div_table dtable_3b[] = {
> +static const struct clk_div_table dtable_common_1_32[] = {
> {0, 1},
> {1, 2},
> {2, 4},
> {3, 8},
> {4, 32},
> + {0, 0},
> };
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 03/11] drivers: clk: renesas: r9a07g044-cpg: Fix P1 Clock
2021-06-24 13:02 ` [PATCH v2 03/11] drivers: clk: renesas: r9a07g044-cpg: Fix P1 Clock Biju Das
@ 2021-06-25 14:32 ` Geert Uytterhoeven
0 siblings, 0 replies; 28+ messages in thread
From: Geert Uytterhoeven @ 2021-06-25 14:32 UTC (permalink / raw
To: Biju Das
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
On Thu, Jun 24, 2021 at 3:02 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> As per RZ/G2L HW Manual(Rev.0.50) P1 is sourced from pll3_div2_4.
> So fix the clock definitions for P1.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 04/11] drivers: clk: renesas: r9a07g044-cpg: Add P2 Clock support
2021-06-24 13:02 ` [PATCH v2 04/11] drivers: clk: renesas: r9a07g044-cpg: Add P2 Clock support Biju Das
@ 2021-06-25 14:33 ` Geert Uytterhoeven
0 siblings, 0 replies; 28+ messages in thread
From: Geert Uytterhoeven @ 2021-06-25 14:33 UTC (permalink / raw
To: Biju Das
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
On Thu, Jun 24, 2021 at 3:02 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Add support for P2 clock which is sourced from pll3_div2_4_2.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 05/11] dt-bindings: clk: r9a07g044-cpg: Update clock/reset definitions
2021-06-24 13:02 ` [PATCH v2 05/11] dt-bindings: clk: r9a07g044-cpg: Update clock/reset definitions Biju Das
@ 2021-06-25 14:33 ` Geert Uytterhoeven
0 siblings, 0 replies; 28+ messages in thread
From: Geert Uytterhoeven @ 2021-06-25 14:33 UTC (permalink / raw
To: Biju Das
Cc: Rob Herring, Lad Prabhakar,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Geert Uytterhoeven, Chris Paterson, Biju Das, Linux-Renesas
Hi Biju,
On Thu, Jun 24, 2021 at 3:02 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Update clock and reset definitions as per RZ/G2L_clock_list_r02_02.xlsx
> and RZ/G2L HW(Rev.0.50) manual.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v1->v2:
> * Added seperate reset entries.
Thanks for the update!
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 06/11] drivers: clk: renesas: renesas-rzg2l-cpg: Separate reset from module clocks
2021-06-24 13:02 ` [PATCH v2 06/11] drivers: clk: renesas: renesas-rzg2l-cpg: Separate reset from module clocks Biju Das
@ 2021-06-25 14:42 ` Geert Uytterhoeven
2021-06-25 14:50 ` Biju Das
0 siblings, 1 reply; 28+ messages in thread
From: Geert Uytterhoeven @ 2021-06-25 14:42 UTC (permalink / raw
To: Biju Das
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Hi Biju,
On Thu, Jun 24, 2021 at 3:03 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> RZ/G2L SoC's have different definitions for clock and reset.
> Separate reset from module clocks in order to handle it efficiently.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Thanks for your patch!
> --- a/drivers/clk/renesas/renesas-rzg2l-cpg.h
> +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.h
> @@ -99,6 +99,26 @@ struct rzg2l_mod_clk {
> .reset = (_reset) \
> }
>
> +/**
> + * struct rzg2l_reset - Reset definitions
> + *
> + * @id: reset index in array containing all resets
> + * @off: register offset
> + * @reset: reset bits
bit
> + */
> +struct rzg2l_reset {
> + unsigned int id;
Do you need this field? It seems to be set only.
> + u16 off;
> + u8 reset;
> +};
> +
> +#define DEF_RST(_id, _off, _reset) \
> + [_id] = { \
> + .id = _id, \
> + .off = (_off), \
> + .reset = (_reset) \
> + }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* RE: [PATCH v2 06/11] drivers: clk: renesas: renesas-rzg2l-cpg: Separate reset from module clocks
2021-06-25 14:42 ` Geert Uytterhoeven
@ 2021-06-25 14:50 ` Biju Das
0 siblings, 0 replies; 28+ messages in thread
From: Biju Das @ 2021-06-25 14:50 UTC (permalink / raw
To: Geert Uytterhoeven
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Hi Geert,
Thanks for the feedback.
> Subject: Re: [PATCH v2 06/11] drivers: clk: renesas: renesas-rzg2l-cpg:
> Separate reset from module clocks
>
> Hi Biju,
>
> On Thu, Jun 24, 2021 at 3:03 PM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > RZ/G2L SoC's have different definitions for clock and reset.
> > Separate reset from module clocks in order to handle it efficiently.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Thanks for your patch!
>
> > --- a/drivers/clk/renesas/renesas-rzg2l-cpg.h
> > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.h
> > @@ -99,6 +99,26 @@ struct rzg2l_mod_clk {
> > .reset = (_reset) \
> > }
> >
> > +/**
> > + * struct rzg2l_reset - Reset definitions
> > + *
> > + * @id: reset index in array containing all resets
> > + * @off: register offset
> > + * @reset: reset bits
>
> bit
OK. Will fix it.
> > + */
> > +struct rzg2l_reset {
> > + unsigned int id;
>
> Do you need this field? It seems to be set only.
OK, not required.
Regards,
Biju
>
> > + u16 off;
> > + u8 reset;
> > +};
> > +
> > +#define DEF_RST(_id, _off, _reset) \
> > + [_id] = { \
> > + .id = _id, \
> > + .off = (_off), \
> > + .reset = (_reset) \
> > + }
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-
> m68k.org
>
> In personal conversations with technical people, I call myself a hacker.
> But when I'm talking to journalists I just say "programmer" or something
> like that.
> -- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* RE: [PATCH v2 02/11] drivers: clk: renesas: r9a07g044-cpg: Rename divider table
2021-06-25 14:27 ` Geert Uytterhoeven
@ 2021-06-25 14:52 ` Biju Das
0 siblings, 0 replies; 28+ messages in thread
From: Biju Das @ 2021-06-25 14:52 UTC (permalink / raw
To: Geert Uytterhoeven
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Hi Geert,
Thanks for the feedback.
> Subject: Re: [PATCH v2 02/11] drivers: clk: renesas: r9a07g044-cpg: Rename
> divider table
>
> Hi Biju,
>
> Thanks for your patch!
>
> On Thu, Jun 24, 2021 at 3:02 PM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > As per RZ/G2L HW Manual (Rev.0.50), CPG_PL3A_DDIV,CPG_PL3B_DDIV and
> > CPG_PL2_DDIV(for P0) shares same divider table entries. Rename
> > clk_div_table dtable_3b to clk_div_table dtable_1_32 so that it
>
> This does not match the actual variable name.
> I do like the shorter name, though ;-)
OK, will change actual variable name with dtable_1_32.
Regards,
Biju
> > can be reused.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Apart from that:
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> > --- a/drivers/clk/renesas/r9a07g044-cpg.c
> > +++ b/drivers/clk/renesas/r9a07g044-cpg.c
> > @@ -42,12 +42,13 @@ enum clk_ids {
> > };
> >
> > /* Divider tables */
> > -static const struct clk_div_table dtable_3b[] = {
> > +static const struct clk_div_table dtable_common_1_32[] = {
> > {0, 1},
> > {1, 2},
> > {2, 4},
> > {3, 8},
> > {4, 32},
> > + {0, 0},
> > };
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-
> m68k.org
>
> In personal conversations with technical people, I call myself a hacker.
> But when I'm talking to journalists I just say "programmer" or something
> like that.
> -- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update {GIC,IA55,SCIF} clock/reset entries
2021-06-24 13:02 ` [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update {GIC,IA55,SCIF} clock/reset entries Biju Das
@ 2021-06-25 15:05 ` Geert Uytterhoeven
2021-06-25 16:08 ` Biju Das
0 siblings, 1 reply; 28+ messages in thread
From: Geert Uytterhoeven @ 2021-06-25 15:05 UTC (permalink / raw
To: Biju Das
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Hi Biju,
On Thu, Jun 24, 2021 at 3:03 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Update {GIC,IA55,SCIF} clock and reset entries to CPG driver to match with
> RZ/G2L clock list hardware manual(RZG2L_clock_list_r02_02.xlsx) and RZ/G2L
> HW manual(Rev.0.50).
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v1->v2:
> * Updated reset entries.
Thanks for the update!
I think this patch can be merged with the previous one ("[PATCH
v2 06/11] drivers: clk: renesas: renesas-rzg2l-cpg: Separate reset from
module clocks"). The previous patch defined the infrastructure, and
this patch implements it. All files touched by the previous patch
are also touched by this patch.
> --- a/drivers/clk/renesas/renesas-rzg2l-cpg.c
> +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c
> @@ -47,9 +47,9 @@
> #define SDIV(val) DIV_RSMASK(val, 0, 0x7)
>
> #define CLK_ON_R(reg) (reg)
> -#define CLK_MON_R(reg) (0x680 - 0x500 + (reg))
> -#define CLK_RST_R(reg) (0x800 - 0x500 + (reg))
> -#define CLK_MRST_R(reg) (0x980 - 0x500 + (reg))
> +#define CLK_MON_R(reg) (0x180 + (reg))
> +#define CLK_RST_R(reg) (reg)
> +#define CLK_MRST_R(reg) (0x180 + (reg))
>
> #define GET_REG_OFFSET(val) ((val >> 20) & 0xfff)
> #define GET_REG_SAMPLL_CLK1(val) ((val >> 22) & 0xfff)
> @@ -310,14 +310,12 @@ rzg2l_cpg_register_core_clk(const struct cpg_core_clk *core,
> * @hw: handle between common and hardware-specific interfaces
> * @off: register offset
> * @onoff: ON/MON bits
> - * @reset: reset bits
> * @priv: CPG/MSTP private data
> */
> struct mstp_clock {
> struct clk_hw hw;
> u16 off;
> u8 onoff;
> - u8 reset;
> struct rzg2l_cpg_priv *priv;
> };
>
> @@ -451,8 +449,7 @@ rzg2l_cpg_register_mod_clk(const struct rzg2l_mod_clk *mod,
> init.num_parents = 1;
>
> clock->off = mod->off;
> - clock->onoff = mod->onoff;
> - clock->reset = mod->reset;
> + clock->onoff = BIT(mod->onoff);
I find it a bit confusing to have two members (albeit in different
structures) named the same with different semantics.
Moreover, mstp_clock.onoff is too small to hold anything beyond bit
7. While RZ/G2{L,LC} don't have any clock bit definitions beyond
bit 7 (there are reset bit definitions up to bit 12), future SoCs in
the series may have them.
So I'd just store the bit offset (which always fits in u8) in both
structures, and perhaps rename it to "bit", as it is no longer a
bitmask of multiple bits to control on/off.
Same for "reset"?
> clock->priv = priv;
> clock->hw.init = &init;
>
> @@ -476,12 +473,11 @@ static int rzg2l_cpg_reset(struct reset_controller_dev *rcdev,
> {
> struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
> const struct rzg2l_cpg_info *info = priv->info;
> - unsigned int reg = info->mod_clks[id].off;
> - u32 dis = info->mod_clks[id].reset;
> + unsigned int reg = info->resets[id].off;
> + u32 dis = BIT(info->resets[id].reset);
> u32 we = dis << 16;
>
> - dev_dbg(rcdev->dev, "reset name:%s id:%ld offset:0x%x\n",
> - info->mod_clks[id].name, id, CLK_RST_R(reg));
> + dev_dbg(rcdev->dev, "reset id:%ld offset:0x%x\n", id, CLK_RST_R(reg));
>
> /* Reset module */
> writel(we, priv->base + CLK_RST_R(reg));
> @@ -500,11 +496,10 @@ static int rzg2l_cpg_assert(struct reset_controller_dev *rcdev,
> {
> struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
> const struct rzg2l_cpg_info *info = priv->info;
> - unsigned int reg = info->mod_clks[id].off;
> - u32 value = info->mod_clks[id].reset << 16;
> + unsigned int reg = info->resets[id].off;
> + u32 value = BIT(info->resets[id].reset) << 16;
I just realize there's no checking if "id" points to a filled entry
in info->resets[], except for a range check against nr_resets.
Perhaps rzg2l_cpg_reset_xlate() (which is BTW identical to
of_reset_simple_xlate()) can check for a non-zero .off field? In the
(long) end, we should have all entries filled in, but until then,
a resets property in DT pointing to a non-filled entry may cause havoc.
> --- a/drivers/clk/renesas/renesas-rzg2l-cpg.h
> +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.h
> @@ -78,7 +78,6 @@ enum clk_types {
> * @parent: id of parent clock
> * @off: register offset
> * @onoff: ON/MON bits
> - * @reset: reset bits
> */
> struct rzg2l_mod_clk {
> const char *name;
> @@ -86,17 +85,15 @@ struct rzg2l_mod_clk {
> unsigned int parent;
> u16 off;
> u8 onoff;
> - u8 reset;
> };
>
> -#define DEF_MOD(_name, _id, _parent, _off, _onoff, _reset) \
> +#define DEF_MOD(_name, _id, _parent, _off, _onoff) \
> [_id] = { \
Hadn't realized this before, but do you need the "[_id] ="?
rzg2l_cpg_info.mod_clks[] is only indexed during initialization.
If there are gaps due to not all clocks being implemented yet, they
are skipped by the .name check in rzg2l_cpg_register_mod_clk().
But I think you can just remove the gaps instead, decreasing kernel
size (for now).
> .name = _name, \
> .id = MOD_CLK_BASE + _id, \
> .parent = (_parent), \
> .off = (_off), \
> .onoff = (_onoff), \
> - .reset = (_reset) \
> }
>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 08/11] arm64: dts: renesas: r9a07g044: Update SCIF0 clock/reset
2021-06-24 13:02 ` [PATCH v2 08/11] arm64: dts: renesas: r9a07g044: Update SCIF0 clock/reset Biju Das
@ 2021-06-25 15:05 ` Geert Uytterhoeven
0 siblings, 0 replies; 28+ messages in thread
From: Geert Uytterhoeven @ 2021-06-25 15:05 UTC (permalink / raw
To: Biju Das
Cc: Rob Herring, Lad Prabhakar,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Chris Paterson, Biju Das, Linux-Renesas
On Thu, Jun 24, 2021 at 3:03 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Update SCIF0 clock and reset index in SoC DTSI.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 09/11] drivers: clk: renesas: r9a07g044-cpg: Add I2C clocks/resets
2021-06-24 13:02 ` [PATCH v2 09/11] drivers: clk: renesas: r9a07g044-cpg: Add I2C clocks/resets Biju Das
@ 2021-06-25 15:06 ` Geert Uytterhoeven
0 siblings, 0 replies; 28+ messages in thread
From: Geert Uytterhoeven @ 2021-06-25 15:06 UTC (permalink / raw
To: Biju Das
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
On Thu, Jun 24, 2021 at 3:03 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Add I2C{0,1,2,3} clock and reset entries.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v1->v2:
> * Updated reset entries.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 10/11] drivers: clk: renesas: r9a07g044-cpg: Add DMAC clocks/resets
2021-06-24 13:02 ` [PATCH v2 10/11] drivers: clk: renesas: r9a07g044-cpg: Add DMAC clocks/resets Biju Das
@ 2021-06-25 15:12 ` Geert Uytterhoeven
0 siblings, 0 replies; 28+ messages in thread
From: Geert Uytterhoeven @ 2021-06-25 15:12 UTC (permalink / raw
To: Biju Das
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
On Thu, Jun 24, 2021 at 3:03 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Add DMAC clock and reset entries in CPG driver.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> v1->v2:
> * Updated reset entries
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 11/11] arm64: dts: renesas: r9a07g044: Add I2C nodes
2021-06-24 13:02 ` [PATCH v2 11/11] arm64: dts: renesas: r9a07g044: Add I2C nodes Biju Das
@ 2021-06-25 15:16 ` Geert Uytterhoeven
2021-06-25 17:01 ` Biju Das
0 siblings, 1 reply; 28+ messages in thread
From: Geert Uytterhoeven @ 2021-06-25 15:16 UTC (permalink / raw
To: Biju Das
Cc: Rob Herring, Lad Prabhakar,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Chris Paterson, Biju Das, Linux-Renesas
On Thu, Jun 24, 2021 at 3:03 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> Add I2C{0,1,2,3} nodes to RZ/G2L (R9A07G044) SoC DTSI.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> --- a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi
> @@ -89,6 +89,86 @@
> status = "disabled";
> };
>
> + i2c0: i2c@10058000 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + compatible = "renesas,riic-r9a07g044", "renesas,riic-rz";
> + reg = <0 0x10058000 0 0x400>;
> + interrupts = <GIC_SPI 350 IRQ_TYPE_LEVEL_HIGH>,
There's a double space after the first interrupt number (in each i2c node).
With the above fixed:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* RE: [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update {GIC,IA55,SCIF} clock/reset entries
2021-06-25 15:05 ` Geert Uytterhoeven
@ 2021-06-25 16:08 ` Biju Das
2021-06-25 17:42 ` Geert Uytterhoeven
0 siblings, 1 reply; 28+ messages in thread
From: Biju Das @ 2021-06-25 16:08 UTC (permalink / raw
To: Geert Uytterhoeven
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Hi Geert,
Thanks for the feedback.
> Subject: Re: [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update
> {GIC,IA55,SCIF} clock/reset entries
>
> Hi Biju,
>
> On Thu, Jun 24, 2021 at 3:03 PM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > Update {GIC,IA55,SCIF} clock and reset entries to CPG driver to match
> > with RZ/G2L clock list hardware manual(RZG2L_clock_list_r02_02.xlsx)
> > and RZ/G2L HW manual(Rev.0.50).
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> > v1->v2:
> > * Updated reset entries.
>
> Thanks for the update!
>
> I think this patch can be merged with the previous one ("[PATCH
> v2 06/11] drivers: clk: renesas: renesas-rzg2l-cpg: Separate reset from
> module clocks"). The previous patch defined the infrastructure, and this
> patch implements it. All files touched by the previous patch are also
> touched by this patch.
OK. Will do.
>
> > --- a/drivers/clk/renesas/renesas-rzg2l-cpg.c
> > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c
> > @@ -47,9 +47,9 @@
> > #define SDIV(val) DIV_RSMASK(val, 0, 0x7)
> >
> > #define CLK_ON_R(reg) (reg)
> > -#define CLK_MON_R(reg) (0x680 - 0x500 + (reg))
> > -#define CLK_RST_R(reg) (0x800 - 0x500 + (reg))
> > -#define CLK_MRST_R(reg) (0x980 - 0x500 + (reg))
> > +#define CLK_MON_R(reg) (0x180 + (reg))
> > +#define CLK_RST_R(reg) (reg)
> > +#define CLK_MRST_R(reg) (0x180 + (reg))
> >
> > #define GET_REG_OFFSET(val) ((val >> 20) & 0xfff)
> > #define GET_REG_SAMPLL_CLK1(val) ((val >> 22) & 0xfff)
> > @@ -310,14 +310,12 @@ rzg2l_cpg_register_core_clk(const struct
> cpg_core_clk *core,
> > * @hw: handle between common and hardware-specific interfaces
> > * @off: register offset
> > * @onoff: ON/MON bits
> > - * @reset: reset bits
> > * @priv: CPG/MSTP private data
> > */
> > struct mstp_clock {
> > struct clk_hw hw;
> > u16 off;
> > u8 onoff;
> > - u8 reset;
> > struct rzg2l_cpg_priv *priv;
> > };
> >
> > @@ -451,8 +449,7 @@ rzg2l_cpg_register_mod_clk(const struct
> rzg2l_mod_clk *mod,
> > init.num_parents = 1;
> >
> > clock->off = mod->off;
> > - clock->onoff = mod->onoff;
> > - clock->reset = mod->reset;
> > + clock->onoff = BIT(mod->onoff);
>
> I find it a bit confusing to have two members (albeit in different
> structures) named the same with different semantics.
> Moreover, mstp_clock.onoff is too small to hold anything beyond bit 7.
> While RZ/G2{L,LC} don't have any clock bit definitions beyond bit 7 (there
> are reset bit definitions up to bit 12), future SoCs in the series may
> have them.
> So I'd just store the bit offset (which always fits in u8) in both
> structures, and perhaps rename it to "bit", as it is no longer a bitmask
> of multiple bits to control on/off.
OK will use bit. And store the bit offset value.
>
> Same for "reset"?
OK. Will use the name bit.
>
> > clock->priv = priv;
> > clock->hw.init = &init;
> >
> > @@ -476,12 +473,11 @@ static int rzg2l_cpg_reset(struct
> > reset_controller_dev *rcdev, {
> > struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
> > const struct rzg2l_cpg_info *info = priv->info;
> > - unsigned int reg = info->mod_clks[id].off;
> > - u32 dis = info->mod_clks[id].reset;
> > + unsigned int reg = info->resets[id].off;
> > + u32 dis = BIT(info->resets[id].reset);
> > u32 we = dis << 16;
> >
> > - dev_dbg(rcdev->dev, "reset name:%s id:%ld offset:0x%x\n",
> > - info->mod_clks[id].name, id, CLK_RST_R(reg));
> > + dev_dbg(rcdev->dev, "reset id:%ld offset:0x%x\n", id,
> > + CLK_RST_R(reg));
> >
> > /* Reset module */
> > writel(we, priv->base + CLK_RST_R(reg)); @@ -500,11 +496,10 @@
> > static int rzg2l_cpg_assert(struct reset_controller_dev *rcdev, {
> > struct rzg2l_cpg_priv *priv = rcdev_to_priv(rcdev);
> > const struct rzg2l_cpg_info *info = priv->info;
> > - unsigned int reg = info->mod_clks[id].off;
> > - u32 value = info->mod_clks[id].reset << 16;
> > + unsigned int reg = info->resets[id].off;
> > + u32 value = BIT(info->resets[id].reset) << 16;
>
> I just realize there's no checking if "id" points to a filled entry in
> info->resets[], except for a range check against nr_resets.
> Perhaps rzg2l_cpg_reset_xlate() (which is BTW identical to
> of_reset_simple_xlate()) can check for a non-zero .off field? In the
> (long) end, we should have all entries filled in, but until then, a resets
> property in DT pointing to a non-filled entry may cause havoc.
OK. Will check for non zero .off field.
> > --- a/drivers/clk/renesas/renesas-rzg2l-cpg.h
> > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.h
> > @@ -78,7 +78,6 @@ enum clk_types {
> > * @parent: id of parent clock
> > * @off: register offset
> > * @onoff: ON/MON bits
> > - * @reset: reset bits
> > */
> > struct rzg2l_mod_clk {
> > const char *name;
> > @@ -86,17 +85,15 @@ struct rzg2l_mod_clk {
> > unsigned int parent;
> > u16 off;
> > u8 onoff;
> > - u8 reset;
> > };
> >
> > -#define DEF_MOD(_name, _id, _parent, _off, _onoff, _reset) \
> > +#define DEF_MOD(_name, _id, _parent, _off, _onoff) \
> > [_id] = { \
>
> Hadn't realized this before, but do you need the "[_id] ="?
> rzg2l_cpg_info.mod_clks[] is only indexed during initialization.
> If there are gaps due to not all clocks being implemented yet, they are
> skipped by the .name check in rzg2l_cpg_register_mod_clk().
> But I think you can just remove the gaps instead, decreasing kernel size
> (for now).
That means we need to loop through the array and find out the index corresponding to the ID.
Current implementation, we don't need to find out ID iterating through LUT. But as you
said it is at the expense of kernel memory.
Speed vs memory. Long term any way we will fill the holes. The max index now is 96.
What is your preference here? Please share your views.
Regards,
Biju
> > .name = _name, \
> > .id = MOD_CLK_BASE + _id, \
> > .parent = (_parent), \
> > .off = (_off), \
> > .onoff = (_onoff), \
> > - .reset = (_reset) \
> > }
> >
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-
> m68k.org
>
> In personal conversations with technical people, I call myself a hacker.
> But when I'm talking to journalists I just say "programmer" or something
> like that.
> -- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* RE: [PATCH v2 11/11] arm64: dts: renesas: r9a07g044: Add I2C nodes
2021-06-25 15:16 ` Geert Uytterhoeven
@ 2021-06-25 17:01 ` Biju Das
0 siblings, 0 replies; 28+ messages in thread
From: Biju Das @ 2021-06-25 17:01 UTC (permalink / raw
To: Geert Uytterhoeven
Cc: Rob Herring, Prabhakar Mahadev Lad,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
Chris Paterson, Biju Das, Linux-Renesas
Hi Geert,
Thanks for the feedback.
> Subject: Re: [PATCH v2 11/11] arm64: dts: renesas: r9a07g044: Add I2C
> nodes
>
> On Thu, Jun 24, 2021 at 3:03 PM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > Add I2C{0,1,2,3} nodes to RZ/G2L (R9A07G044) SoC DTSI.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> > --- a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi
> > +++ b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi
> > @@ -89,6 +89,86 @@
> > status = "disabled";
> > };
> >
> > + i2c0: i2c@10058000 {
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > + compatible = "renesas,riic-r9a07g044",
> "renesas,riic-rz";
> > + reg = <0 0x10058000 0 0x400>;
> > + interrupts = <GIC_SPI 350
> > + IRQ_TYPE_LEVEL_HIGH>,
>
> There's a double space after the first interrupt number (in each i2c
> node).
OK. Will fix this.
Cheers,
Biju
>
> With the above fixed:
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-
> m68k.org
>
> In personal conversations with technical people, I call myself a hacker.
> But when I'm talking to journalists I just say "programmer" or something
> like that.
> -- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update {GIC,IA55,SCIF} clock/reset entries
2021-06-25 16:08 ` Biju Das
@ 2021-06-25 17:42 ` Geert Uytterhoeven
2021-06-25 18:32 ` Biju Das
0 siblings, 1 reply; 28+ messages in thread
From: Geert Uytterhoeven @ 2021-06-25 17:42 UTC (permalink / raw
To: Biju Das
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Hi Biju,
On Fri, Jun 25, 2021 at 6:08 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > Subject: Re: [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update
> > {GIC,IA55,SCIF} clock/reset entries
> > On Thu, Jun 24, 2021 at 3:03 PM Biju Das <biju.das.jz@bp.renesas.com>
> > wrote:
> > > Update {GIC,IA55,SCIF} clock and reset entries to CPG driver to match
> > > with RZ/G2L clock list hardware manual(RZG2L_clock_list_r02_02.xlsx)
> > > and RZ/G2L HW manual(Rev.0.50).
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > --- a/drivers/clk/renesas/renesas-rzg2l-cpg.h
> > > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.h
> > > @@ -78,7 +78,6 @@ enum clk_types {
> > > * @parent: id of parent clock
> > > * @off: register offset
> > > * @onoff: ON/MON bits
> > > - * @reset: reset bits
> > > */
> > > struct rzg2l_mod_clk {
> > > const char *name;
> > > @@ -86,17 +85,15 @@ struct rzg2l_mod_clk {
> > > unsigned int parent;
> > > u16 off;
> > > u8 onoff;
> > > - u8 reset;
> > > };
> > >
> > > -#define DEF_MOD(_name, _id, _parent, _off, _onoff, _reset) \
> > > +#define DEF_MOD(_name, _id, _parent, _off, _onoff) \
> > > [_id] = { \
> >
> > Hadn't realized this before, but do you need the "[_id] ="?
> > rzg2l_cpg_info.mod_clks[] is only indexed during initialization.
> > If there are gaps due to not all clocks being implemented yet, they are
> > skipped by the .name check in rzg2l_cpg_register_mod_clk().
> > But I think you can just remove the gaps instead, decreasing kernel size
> > (for now).
>
> That means we need to loop through the array and find out the index corresponding to the ID.
>
> Current implementation, we don't need to find out ID iterating through LUT. But as you
> said it is at the expense of kernel memory.
>
> Speed vs memory. Long term any way we will fill the holes. The max index now is 96.
Unless I'm missing something, this array is only used for initializing
the clocks? Clock lookup by ID is done using rzg2l_cpg_priv.clks[],
which is indexed by ID.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 28+ messages in thread
* RE: [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update {GIC,IA55,SCIF} clock/reset entries
2021-06-25 17:42 ` Geert Uytterhoeven
@ 2021-06-25 18:32 ` Biju Das
0 siblings, 0 replies; 28+ messages in thread
From: Biju Das @ 2021-06-25 18:32 UTC (permalink / raw
To: Geert Uytterhoeven
Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
Chris Paterson, Biju Das, Prabhakar Mahadev Lad
Hi Geert,
Thanks for the feedback.
> Subject: Re: [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update
> {GIC,IA55,SCIF} clock/reset entries
>
> Hi Biju,
>
> On Fri, Jun 25, 2021 at 6:08 PM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > > Subject: Re: [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg:
> > > Update {GIC,IA55,SCIF} clock/reset entries On Thu, Jun 24, 2021 at
> > > 3:03 PM Biju Das <biju.das.jz@bp.renesas.com>
> > > wrote:
> > > > Update {GIC,IA55,SCIF} clock and reset entries to CPG driver to
> > > > match with RZ/G2L clock list hardware
> > > > manual(RZG2L_clock_list_r02_02.xlsx)
> > > > and RZ/G2L HW manual(Rev.0.50).
> > > >
> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > Reviewed-by: Lad Prabhakar
> > > > <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> > > > --- a/drivers/clk/renesas/renesas-rzg2l-cpg.h
> > > > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.h
> > > > @@ -78,7 +78,6 @@ enum clk_types {
> > > > * @parent: id of parent clock
> > > > * @off: register offset
> > > > * @onoff: ON/MON bits
> > > > - * @reset: reset bits
> > > > */
> > > > struct rzg2l_mod_clk {
> > > > const char *name;
> > > > @@ -86,17 +85,15 @@ struct rzg2l_mod_clk {
> > > > unsigned int parent;
> > > > u16 off;
> > > > u8 onoff;
> > > > - u8 reset;
> > > > };
> > > >
> > > > -#define DEF_MOD(_name, _id, _parent, _off, _onoff, _reset) \
> > > > +#define DEF_MOD(_name, _id, _parent, _off, _onoff) \
> > > > [_id] = { \
> > >
> > > Hadn't realized this before, but do you need the "[_id] ="?
> > > rzg2l_cpg_info.mod_clks[] is only indexed during initialization.
> > > If there are gaps due to not all clocks being implemented yet, they
> > > are skipped by the .name check in rzg2l_cpg_register_mod_clk().
> > > But I think you can just remove the gaps instead, decreasing kernel
> > > size (for now).
> >
> > That means we need to loop through the array and find out the index
> corresponding to the ID.
> >
> > Current implementation, we don't need to find out ID iterating through
> > LUT. But as you said it is at the expense of kernel memory.
> >
> > Speed vs memory. Long term any way we will fill the holes. The max index
> now is 96.
>
> Unless I'm missing something, this array is only used for initializing the
> clocks? Clock lookup by ID is done using rzg2l_cpg_priv.clks[], which is
> indexed by ID.
Geert, you are correct. _Id can be removed.
Regards,
Biju
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2021-06-25 18:33 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-24 13:02 [PATCH v2 00/11] Update clock definitions Biju Das
2021-06-24 13:02 ` [PATCH v2 01/11] drivers: clk: renesas: renesas-rzg2l-cpg: Add multi clock PM support Biju Das
2021-06-24 13:02 ` [PATCH v2 02/11] drivers: clk: renesas: r9a07g044-cpg: Rename divider table Biju Das
2021-06-25 14:27 ` Geert Uytterhoeven
2021-06-25 14:52 ` Biju Das
2021-06-24 13:02 ` [PATCH v2 03/11] drivers: clk: renesas: r9a07g044-cpg: Fix P1 Clock Biju Das
2021-06-25 14:32 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 04/11] drivers: clk: renesas: r9a07g044-cpg: Add P2 Clock support Biju Das
2021-06-25 14:33 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 05/11] dt-bindings: clk: r9a07g044-cpg: Update clock/reset definitions Biju Das
2021-06-25 14:33 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 06/11] drivers: clk: renesas: renesas-rzg2l-cpg: Separate reset from module clocks Biju Das
2021-06-25 14:42 ` Geert Uytterhoeven
2021-06-25 14:50 ` Biju Das
2021-06-24 13:02 ` [PATCH v2 07/11] drivers: clk: renesas: r9a07g044-cpg: Update {GIC,IA55,SCIF} clock/reset entries Biju Das
2021-06-25 15:05 ` Geert Uytterhoeven
2021-06-25 16:08 ` Biju Das
2021-06-25 17:42 ` Geert Uytterhoeven
2021-06-25 18:32 ` Biju Das
2021-06-24 13:02 ` [PATCH v2 08/11] arm64: dts: renesas: r9a07g044: Update SCIF0 clock/reset Biju Das
2021-06-25 15:05 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 09/11] drivers: clk: renesas: r9a07g044-cpg: Add I2C clocks/resets Biju Das
2021-06-25 15:06 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 10/11] drivers: clk: renesas: r9a07g044-cpg: Add DMAC clocks/resets Biju Das
2021-06-25 15:12 ` Geert Uytterhoeven
2021-06-24 13:02 ` [PATCH v2 11/11] arm64: dts: renesas: r9a07g044: Add I2C nodes Biju Das
2021-06-25 15:16 ` Geert Uytterhoeven
2021-06-25 17:01 ` Biju Das
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.