Skip to content

Commit 97af391

Browse files
Wolfram Sanggeertu
authored andcommitted
clk: renesas: rcar-gen3: Remove cpg_quirks access when registering SD clock
We want to reuse SD clock handling for other SoCs and, thus, need to generalize it. So, don't access cpg_quirks in that realm. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Link: https://lore.kernel.org/r/20201227174202.40834-3-wsa+renesas@sang-engineering.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 010ce43 commit 97af391

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

drivers/clk/renesas/rcar-gen3-cpg.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,9 @@ static const struct clk_ops cpg_sd_clock_ops = {
375375
.set_rate = cpg_sd_clock_set_rate,
376376
};
377377

378-
static u32 cpg_quirks __initdata;
379-
380-
#define PLL_ERRATA BIT(0) /* Missing PLL0/2/4 post-divider */
381-
#define RCKCR_CKSEL BIT(1) /* Manual RCLK parent selection */
382-
#define SD_SKIP_FIRST BIT(2) /* Skip first clock in SD table */
383-
384378
static struct clk * __init cpg_sd_clk_register(const char *name,
385379
void __iomem *base, unsigned int offset, const char *parent_name,
386-
struct raw_notifier_head *notifiers)
380+
struct raw_notifier_head *notifiers, bool skip_first)
387381
{
388382
struct clk_init_data init;
389383
struct sd_clock *clock;
@@ -405,7 +399,7 @@ static struct clk * __init cpg_sd_clk_register(const char *name,
405399
clock->div_table = cpg_sd_div_table;
406400
clock->div_num = ARRAY_SIZE(cpg_sd_div_table);
407401

408-
if (cpg_quirks & SD_SKIP_FIRST) {
402+
if (skip_first) {
409403
clock->div_table++;
410404
clock->div_num--;
411405
}
@@ -518,6 +512,12 @@ static struct clk * __init cpg_rpcd2_clk_register(const char *name,
518512
static const struct rcar_gen3_cpg_pll_config *cpg_pll_config __initdata;
519513
static unsigned int cpg_clk_extalr __initdata;
520514
static u32 cpg_mode __initdata;
515+
static u32 cpg_quirks __initdata;
516+
517+
#define PLL_ERRATA BIT(0) /* Missing PLL0/2/4 post-divider */
518+
#define RCKCR_CKSEL BIT(1) /* Manual RCLK parent selection */
519+
#define SD_SKIP_FIRST BIT(2) /* Skip first clock in SD table */
520+
521521

522522
static const struct soc_device_attribute cpg_quirks_match[] __initconst = {
523523
{
@@ -613,7 +613,8 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
613613

614614
case CLK_TYPE_GEN3_SD:
615615
return cpg_sd_clk_register(core->name, base, core->offset,
616-
__clk_get_name(parent), notifiers);
616+
__clk_get_name(parent), notifiers,
617+
cpg_quirks & SD_SKIP_FIRST);
617618

618619
case CLK_TYPE_GEN3_R:
619620
if (cpg_quirks & RCKCR_CKSEL) {

0 commit comments

Comments
 (0)