Skip to content

Commit 82df5b7

Browse files
XBurstbebarino
authored andcommitted
clk: Ingenic: Add RTC related clocks for Ingenic SoCs.
The RTC unit in the Ingenic SoCs has two clock sources, one is from an external 32.768kHz clock, and the other is from an external 24MHz/48MHz main clock that is divided by 512. The choice of these two clocks is controlled by the ERCS bit in the OPCR register. The RNG unit will also use this clock. Tested-by: 周正 (Zhou Zheng) <[email protected]> Signed-off-by: 周琰杰 (Zhou Yanjie) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent acb3b78 commit 82df5b7

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

drivers/clk/ingenic/jz4780-cgu.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,18 @@ static const struct ingenic_cgu_clk_info jz4780_cgu_clocks[] = {
516516
.gate = { CGU_REG_CLKGR0, 1 },
517517
},
518518

519+
[JZ4780_CLK_EXCLK_DIV512] = {
520+
"exclk_div512", CGU_CLK_FIXDIV,
521+
.parents = { JZ4780_CLK_EXCLK },
522+
.fixdiv = { 512 },
523+
},
524+
525+
[JZ4780_CLK_RTC] = {
526+
"rtc_ercs", CGU_CLK_MUX | CGU_CLK_GATE,
527+
.parents = { JZ4780_CLK_EXCLK_DIV512, JZ4780_CLK_RTCLK },
528+
.mux = { CGU_REG_OPCR, 2, 1},
529+
},
530+
519531
/* Gate-only clocks */
520532

521533
[JZ4780_CLK_NEMC] = {

drivers/clk/ingenic/x1000-cgu.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,19 @@ static const struct ingenic_cgu_clk_info x1000_cgu_clocks[] = {
278278
.mux = { CGU_REG_SSICDR, 30, 1 },
279279
},
280280

281+
[X1000_CLK_EXCLK_DIV512] = {
282+
"exclk_div512", CGU_CLK_FIXDIV,
283+
.parents = { X1000_CLK_EXCLK },
284+
.fixdiv = { 512 },
285+
},
286+
287+
[X1000_CLK_RTC] = {
288+
"rtc_ercs", CGU_CLK_MUX | CGU_CLK_GATE,
289+
.parents = { X1000_CLK_EXCLK_DIV512, X1000_CLK_RTCLK },
290+
.mux = { CGU_REG_OPCR, 2, 1},
291+
.gate = { CGU_REG_CLKGR, 27 },
292+
},
293+
281294
/* Gate-only clocks */
282295

283296
[X1000_CLK_EMC] = {

drivers/clk/ingenic/x1830-cgu.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,19 @@ static const struct ingenic_cgu_clk_info x1830_cgu_clocks[] = {
329329
.mux = { CGU_REG_SSICDR, 29, 1 },
330330
},
331331

332+
[X1830_CLK_EXCLK_DIV512] = {
333+
"exclk_div512", CGU_CLK_FIXDIV,
334+
.parents = { X1830_CLK_EXCLK },
335+
.fixdiv = { 512 },
336+
},
337+
338+
[X1830_CLK_RTC] = {
339+
"rtc_ercs", CGU_CLK_MUX | CGU_CLK_GATE,
340+
.parents = { X1830_CLK_EXCLK_DIV512, X1830_CLK_RTCLK },
341+
.mux = { CGU_REG_OPCR, 2, 1},
342+
.gate = { CGU_REG_CLKGR0, 29 },
343+
},
344+
332345
/* Gate-only clocks */
333346

334347
[X1830_CLK_EMC] = {

0 commit comments

Comments
 (0)