Skip to content

Commit 7925017

Browse files
Wolfram Sanggeertu
authored andcommitted
clk: renesas: r8a779a0: Add SDHI support
We use the shiny new CPG library for that. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20201227174202.40834-5-wsa+renesas@sang-engineering.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 8bb67d8 commit 7925017

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

drivers/clk/renesas/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ config CLK_R8A77995
148148

149149
config CLK_R8A779A0
150150
bool "R-Car V3U clock support" if COMPILE_TEST
151+
select CLK_RCAR_CPG_LIB
151152
select CLK_RENESAS_CPG_MSSR
152153

153154
config CLK_R9A06G032

drivers/clk/renesas/r8a779a0-cpg-mssr.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525

2626
#include <dt-bindings/clock/r8a779a0-cpg-mssr.h>
2727

28+
#include "rcar-cpg-lib.h"
2829
#include "renesas-cpg-mssr.h"
2930

3031
enum rcar_r8a779a0_clk_types {
3132
CLK_TYPE_R8A779A0_MAIN = CLK_TYPE_CUSTOM,
3233
CLK_TYPE_R8A779A0_PLL1,
3334
CLK_TYPE_R8A779A0_PLL2X_3X, /* PLL[23][01] */
3435
CLK_TYPE_R8A779A0_PLL5,
36+
CLK_TYPE_R8A779A0_SD,
3537
CLK_TYPE_R8A779A0_MDSEL, /* Select parent/divider using mode pin */
3638
CLK_TYPE_R8A779A0_OSC, /* OSC EXTAL predivider and fixed divider */
3739
};
@@ -82,6 +84,9 @@ enum clk_ids {
8284
DEF_BASE(_name, _id, CLK_TYPE_R8A779A0_PLL2X_3X, CLK_MAIN, \
8385
.offset = _offset)
8486

87+
#define DEF_SD(_name, _id, _parent, _offset) \
88+
DEF_BASE(_name, _id, CLK_TYPE_R8A779A0_SD, _parent, .offset = _offset)
89+
8590
#define DEF_MDSEL(_name, _id, _md, _parent0, _div0, _parent1, _div1) \
8691
DEF_BASE(_name, _id, CLK_TYPE_R8A779A0_MDSEL, \
8792
(_parent0) << 16 | (_parent1), \
@@ -113,6 +118,7 @@ static const struct cpg_core_clk r8a779a0_core_clks[] __initconst = {
113118
DEF_FIXED(".pll5_div4", CLK_PLL5_DIV4, CLK_PLL5_DIV2, 2, 1),
114119
DEF_FIXED(".s1", CLK_S1, CLK_PLL1_DIV2, 2, 1),
115120
DEF_FIXED(".s3", CLK_S3, CLK_PLL1_DIV2, 4, 1),
121+
DEF_FIXED(".sdsrc", CLK_SDSRC, CLK_PLL5_DIV4, 1, 1),
116122
DEF_RATE(".oco", CLK_OCO, 32768),
117123

118124
/* Core Clock Outputs */
@@ -139,6 +145,8 @@ static const struct cpg_core_clk r8a779a0_core_clks[] __initconst = {
139145
DEF_FIXED("cbfusa", R8A779A0_CLK_CBFUSA, CLK_EXTAL, 2, 1),
140146
DEF_FIXED("cp", R8A779A0_CLK_CP, CLK_EXTAL, 2, 1),
141147

148+
DEF_SD("sd0", R8A779A0_CLK_SD0, CLK_SDSRC, 0x870),
149+
142150
DEF_DIV6P1("mso", R8A779A0_CLK_MSO, CLK_PLL5_DIV4, 0x87c),
143151
DEF_DIV6P1("canfd", R8A779A0_CLK_CANFD, CLK_PLL5_DIV4, 0x878),
144152
DEF_DIV6P1("csi0", R8A779A0_CLK_CSI0, CLK_PLL5_DIV4, 0x880),
@@ -168,6 +176,7 @@ static const struct mssr_mod_clk r8a779a0_mod_clks[] __initconst = {
168176
DEF_MOD("scif1", 703, R8A779A0_CLK_S1D8),
169177
DEF_MOD("scif3", 704, R8A779A0_CLK_S1D8),
170178
DEF_MOD("scif4", 705, R8A779A0_CLK_S1D8),
179+
DEF_MOD("sdhi0", 706, R8A779A0_CLK_SD0),
171180
DEF_MOD("vin00", 730, R8A779A0_CLK_S1D1),
172181
DEF_MOD("vin01", 731, R8A779A0_CLK_S1D1),
173182
DEF_MOD("vin02", 800, R8A779A0_CLK_S1D1),
@@ -213,8 +222,6 @@ static const struct mssr_mod_clk r8a779a0_mod_clks[] __initconst = {
213222
DEF_MOD("vspx3", 1031, R8A779A0_CLK_S1D1),
214223
};
215224

216-
static spinlock_t cpg_lock;
217-
218225
static const struct rcar_r8a779a0_cpg_pll_config *cpg_pll_config __initdata;
219226
static unsigned int cpg_clk_extalr __initdata;
220227
static u32 cpg_mode __initdata;
@@ -253,6 +260,12 @@ static struct clk * __init rcar_r8a779a0_cpg_clk_register(struct device *dev,
253260
div = cpg_pll_config->pll5_div;
254261
break;
255262

263+
case CLK_TYPE_R8A779A0_SD:
264+
return cpg_sd_clk_register(core->name, base, core->offset,
265+
__clk_get_name(parent), notifiers,
266+
false);
267+
break;
268+
256269
case CLK_TYPE_R8A779A0_MDSEL:
257270
/*
258271
* Clock selectable between two parents and two fixed dividers

0 commit comments

Comments
 (0)