2020-05-27 09:56:51

by Chunyan Zhang

[permalink] [raw]
Subject: [RESEND PATCH v2 0/4] add mipi_csi_xx gate clocks for SC9863A

From: Chunyan Zhang <[email protected]>

mipi_csi_xx clocks are used by camera sensors. These clocks cannot be
accessed (even read) if their parent gate clock is disabled. So this
patchset also add a check to parent clocks when reading these gate
clocks which marked with the specific flag (SPRD_GATE_NON_AON).

changes from v1:
* added Rob's acked-by;

Chunyan Zhang (4):
clk: sprd: check its parent status before reading gate clock
dt-bindings: clk: sprd: add mipi_csi_xx clocks for SC9863A
clk: sprd: add dt-bindings include for mipi_csi_xx clocks
clk: sprd: add mipi_csi_xx gate clocks

.../bindings/clock/sprd,sc9863a-clk.yaml | 1 +
drivers/clk/sprd/gate.c | 7 ++++
drivers/clk/sprd/gate.h | 9 ++++++
drivers/clk/sprd/sc9863a-clk.c | 32 +++++++++++++++++++
include/dt-bindings/clock/sprd,sc9863a-clk.h | 5 +++
5 files changed, 54 insertions(+)

--
2.20.1


2020-05-27 09:57:21

by Chunyan Zhang

[permalink] [raw]
Subject: [RESEND PATCH v2 3/4] clk: sprd: add dt-bindings include for mipi_csi_xx clocks

From: Chunyan Zhang <[email protected]>

mipi_csi_xx clocks are used by camera sensors.

Signed-off-by: Chunyan Zhang <[email protected]>
Acked-by: Rob Herring <[email protected]>
---
include/dt-bindings/clock/sprd,sc9863a-clk.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/dt-bindings/clock/sprd,sc9863a-clk.h b/include/dt-bindings/clock/sprd,sc9863a-clk.h
index 901ba59676c2..4e030421641f 100644
--- a/include/dt-bindings/clock/sprd,sc9863a-clk.h
+++ b/include/dt-bindings/clock/sprd,sc9863a-clk.h
@@ -308,6 +308,11 @@
#define CLK_MCPHY_CFG_EB 14
#define CLK_MM_GATE_NUM (CLK_MCPHY_CFG_EB + 1)

+#define CLK_MIPI_CSI 0
+#define CLK_MIPI_CSI_S 1
+#define CLK_MIPI_CSI_M 2
+#define CLK_MM_CLK_NUM (CLK_MIPI_CSI_M + 1)
+
#define CLK_SIM0_EB 0
#define CLK_IIS0_EB 1
#define CLK_IIS1_EB 2
--
2.20.1

2020-05-27 09:57:21

by Chunyan Zhang

[permalink] [raw]
Subject: [RESEND PATCH v2 4/4] clk: sprd: add mipi_csi_xx gate clocks

From: Chunyan Zhang <[email protected]>

mipi_csi_xx clocks are used by camera sensors.

Signed-off-by: Chunyan Zhang <[email protected]>
---
drivers/clk/sprd/sc9863a-clk.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

diff --git a/drivers/clk/sprd/sc9863a-clk.c b/drivers/clk/sprd/sc9863a-clk.c
index a0631f7756cf..f67bd08f225c 100644
--- a/drivers/clk/sprd/sc9863a-clk.c
+++ b/drivers/clk/sprd/sc9863a-clk.c
@@ -1615,6 +1615,36 @@ static const struct sprd_clk_desc sc9863a_mm_gate_desc = {
.hw_clks = &sc9863a_mm_gate_hws,
};

+/* camera sensor clocks */
+static SPRD_GATE_CLK_HW(mipi_csi_clk, "mipi-csi-clk", &mahb_ckg_eb.common.hw,
+ 0x20, BIT(16), 0, SPRD_GATE_NON_AON);
+static SPRD_GATE_CLK_HW(mipi_csi_s_clk, "mipi-csi-s-clk", &mahb_ckg_eb.common.hw,
+ 0x24, BIT(16), 0, SPRD_GATE_NON_AON);
+static SPRD_GATE_CLK_HW(mipi_csi_m_clk, "mipi-csi-m-clk", &mahb_ckg_eb.common.hw,
+ 0x28, BIT(16), 0, SPRD_GATE_NON_AON);
+
+static struct sprd_clk_common *sc9863a_mm_clk_clks[] = {
+ /* address base is 0x60900000 */
+ &mipi_csi_clk.common,
+ &mipi_csi_s_clk.common,
+ &mipi_csi_m_clk.common,
+};
+
+static struct clk_hw_onecell_data sc9863a_mm_clk_hws = {
+ .hws = {
+ [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw,
+ [CLK_MIPI_CSI_S] = &mipi_csi_s_clk.common.hw,
+ [CLK_MIPI_CSI_M] = &mipi_csi_m_clk.common.hw,
+ },
+ .num = CLK_MM_CLK_NUM,
+};
+
+static const struct sprd_clk_desc sc9863a_mm_clk_desc = {
+ .clk_clks = sc9863a_mm_clk_clks,
+ .num_clk_clks = ARRAY_SIZE(sc9863a_mm_clk_clks),
+ .hw_clks = &sc9863a_mm_clk_hws,
+};
+
static SPRD_SC_GATE_CLK_FW_NAME(sim0_eb, "sim0-eb", "ext-26m", 0x0,
0x1000, BIT(0), 0, 0);
static SPRD_SC_GATE_CLK_FW_NAME(iis0_eb, "iis0-eb", "ext-26m", 0x0,
@@ -1737,6 +1767,8 @@ static const struct of_device_id sprd_sc9863a_clk_ids[] = {
.data = &sc9863a_aonapb_gate_desc },
{ .compatible = "sprd,sc9863a-mm-gate", /* 0x60800000 */
.data = &sc9863a_mm_gate_desc },
+ { .compatible = "sprd,sc9863a-mm-clk", /* 0x60900000 */
+ .data = &sc9863a_mm_clk_desc },
{ .compatible = "sprd,sc9863a-apapb-gate", /* 0x71300000 */
.data = &sc9863a_apapb_gate_desc },
{ }
--
2.20.1

2020-05-27 10:07:20

by Stephen Boyd

[permalink] [raw]
Subject: Re: [RESEND PATCH v2 4/4] clk: sprd: add mipi_csi_xx gate clocks

Quoting Chunyan Zhang (2020-05-26 22:36:38)
> From: Chunyan Zhang <[email protected]>
>
> mipi_csi_xx clocks are used by camera sensors.
>
> Signed-off-by: Chunyan Zhang <[email protected]>
> ---

Applied to clk-next

2020-05-27 10:18:56

by Chunyan Zhang

[permalink] [raw]
Subject: [RESEND PATCH v2 2/4] dt-bindings: clk: sprd: add mipi_csi_xx clocks for SC9863A

From: Chunyan Zhang <[email protected]>

mipi_csi_xx clocks are used by camera sensors.

Signed-off-by: Chunyan Zhang <[email protected]>
Acked-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/clock/sprd,sc9863a-clk.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/clock/sprd,sc9863a-clk.yaml b/Documentation/devicetree/bindings/clock/sprd,sc9863a-clk.yaml
index bb3a78d8105e..87e8349a539a 100644
--- a/Documentation/devicetree/bindings/clock/sprd,sc9863a-clk.yaml
+++ b/Documentation/devicetree/bindings/clock/sprd,sc9863a-clk.yaml
@@ -28,6 +28,7 @@ properties:
- sprd,sc9863a-rpll
- sprd,sc9863a-dpll
- sprd,sc9863a-mm-gate
+ - sprd,sc9863a-mm-clk
- sprd,sc9863a-apapb-gate

clocks:
--
2.20.1

2020-05-27 10:22:29

by Stephen Boyd

[permalink] [raw]
Subject: Re: [RESEND PATCH v2 3/4] clk: sprd: add dt-bindings include for mipi_csi_xx clocks

Quoting Chunyan Zhang (2020-05-26 22:36:37)
> From: Chunyan Zhang <[email protected]>
>
> mipi_csi_xx clocks are used by camera sensors.
>
> Signed-off-by: Chunyan Zhang <[email protected]>
> Acked-by: Rob Herring <[email protected]>
> ---

Applied to clk-next