Skip to content

Commit

Permalink
clocksource/drivers/exynos_mct: Support frc-shared property
Browse files Browse the repository at this point in the history
When the FRC is shared with another main processor, the other processor
is assumed to have started it and this processor should not write to the
global registers.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Link: https://lore.kernel.org/r/20220609112738.359385-3-vincent.whitchurch@axis.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
  • Loading branch information
Vincent Whitchurch authored and Daniel Lezcano committed Sep 20, 2022
1 parent 99b701f commit e8550f0
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions drivers/clocksource/exynos_mct.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,16 @@ static cycles_t exynos4_read_current_timer(void)
}
#endif

static int __init exynos4_clocksource_init(void)
static int __init exynos4_clocksource_init(bool frc_shared)
{
exynos4_mct_frc_start();
/*
* When the frc is shared, the main processer should have already
* turned it on and we shouldn't be writing to TCON.
*/
if (frc_shared)
mct_frc.resume = NULL;
else
exynos4_mct_frc_start();

#if defined(CONFIG_ARM)
exynos4_delay_timer.read_current_timer = &exynos4_read_current_timer;
Expand Down Expand Up @@ -605,6 +612,7 @@ static int __init exynos4_timer_interrupts(struct device_node *np,

static int __init mct_init_dt(struct device_node *np, unsigned int int_type)
{
bool frc_shared = of_property_read_bool(np, "samsung,frc-shared");
int ret;

ret = exynos4_timer_resources(np);
Expand All @@ -615,10 +623,17 @@ static int __init mct_init_dt(struct device_node *np, unsigned int int_type)
if (ret)
return ret;

ret = exynos4_clocksource_init();
ret = exynos4_clocksource_init(frc_shared);
if (ret)
return ret;

/*
* When the FRC is shared with a main processor, this secondary
* processor cannot use the global comparator.
*/
if (frc_shared)
return ret;

return exynos4_clockevent_init();
}

Expand Down

0 comments on commit e8550f0

Please sign in to comment.