mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
clocksource/drivers/timer-mediatek: Request and enable the bus clock
MediaTek APXGPT general purpose timers may optionally depend on a bus clock. If this clock is not enabled the timers don't actually run. Boot loaders usually turn it on, but later the kernel turns it off since it's never requested by any driver. Some platforms (like mt6735) declare it as a critical clock in their clock definitions to keep it running, but at least on mt8167 it's not actually required for a successful boot. If a bus clock is declared in the device tree, make sure it is enabled by driver probe and associated to the device. Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Link: https://patch.msgid.link/20261002072115.169250-4-l.scorcia@gmail.com
This commit is contained in:
parent
7a097aba72
commit
e234d40823
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clockchips.h>
|
||||
#include <linux/clocksource.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
|
@ -283,8 +284,9 @@ static struct timer_of to = {
|
|||
},
|
||||
};
|
||||
|
||||
static int mtk_syst_init(struct device_node *node)
|
||||
static int mtk_syst_init(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
int ret;
|
||||
|
||||
to.clkevt.features = CLOCK_EVT_FEAT_DYNIRQ | CLOCK_EVT_FEAT_ONESHOT;
|
||||
|
|
@ -305,10 +307,14 @@ static int mtk_syst_init(struct device_node *node)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int __init mtk_gpt_init(struct device_node *node)
|
||||
static int mtk_gpt_init(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct clk *clk_bus;
|
||||
int ret;
|
||||
|
||||
clk_bus = devm_clk_get_optional_enabled(&pdev->dev, "bus");
|
||||
|
||||
to.clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
|
||||
to.clkevt.set_state_shutdown = mtk_gpt_clkevt_shutdown;
|
||||
to.clkevt.set_state_periodic = mtk_gpt_clkevt_set_periodic;
|
||||
|
|
@ -344,11 +350,10 @@ static int __init mtk_gpt_init(struct device_node *node)
|
|||
|
||||
static int mtk_timer_probe(struct platform_device *pdev)
|
||||
{
|
||||
int (*timer_init)(struct device_node *node);
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
int (*timer_init)(struct platform_device *pdev);
|
||||
|
||||
timer_init = of_device_get_match_data(&pdev->dev);
|
||||
return timer_init(np);
|
||||
return timer_init(pdev);
|
||||
}
|
||||
|
||||
static const struct of_device_id mtk_timer_match_table[] = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user