From: Claudiu Beznea <claudiu.beznea@microchip.com>
To: <daniel.lezcano@linaro.org>, <tglx@linutronix.de>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>,
Claudiu Beznea <claudiu.beznea@microchip.com>
Subject: [PATCH v3 5/6] clocksource/drivers/timer-microchip-pit64b: use mchp_pit64b_{suspend, resume}
Date: Fri, 4 Mar 2022 15:36:00 +0200 [thread overview]
Message-ID: <20220304133601.2404086-6-claudiu.beznea@microchip.com> (raw)
In-Reply-To: <20220304133601.2404086-1-claudiu.beznea@microchip.com>
Use mchp_pit64b_suspend() and mchp_pit64b_resume() to disable or
enable timers clocks on init and remove specific
clk_prepare_{disable, enable} calls. This is ok also for clockevent timer
as proper clock enable, disable is done on .set_state_oneshot,
.set_state_periodic, .set_state_shutdown calls.
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
drivers/clocksource/timer-microchip-pit64b.c | 24 ++++----------------
1 file changed, 5 insertions(+), 19 deletions(-)
diff --git a/drivers/clocksource/timer-microchip-pit64b.c b/drivers/clocksource/timer-microchip-pit64b.c
index b51259395ac3..f50705698283 100644
--- a/drivers/clocksource/timer-microchip-pit64b.c
+++ b/drivers/clocksource/timer-microchip-pit64b.c
@@ -344,6 +344,7 @@ static int __init mchp_pit64b_init_clksrc(struct mchp_pit64b_timer *timer,
if (!cs)
return -ENOMEM;
+ mchp_pit64b_resume(timer);
mchp_pit64b_reset(timer, ULLONG_MAX, MCHP_PIT64B_MR_CONT, 0);
mchp_pit64b_cs_base = timer->base;
@@ -365,8 +366,7 @@ static int __init mchp_pit64b_init_clksrc(struct mchp_pit64b_timer *timer,
pr_debug("clksrc: Failed to register PIT64B clocksource!\n");
/* Stop timer. */
- writel_relaxed(MCHP_PIT64B_CR_SWRST,
- timer->base + MCHP_PIT64B_CR);
+ mchp_pit64b_suspend(timer);
kfree(cs);
return ret;
@@ -450,19 +450,10 @@ static int __init mchp_pit64b_dt_init_timer(struct device_node *node,
if (ret)
goto irq_unmap;
- ret = clk_prepare_enable(timer.pclk);
- if (ret)
- goto irq_unmap;
-
- if (timer.mode & MCHP_PIT64B_MR_SGCLK) {
- ret = clk_prepare_enable(timer.gclk);
- if (ret)
- goto pclk_unprepare;
-
+ if (timer.mode & MCHP_PIT64B_MR_SGCLK)
clk_rate = clk_get_rate(timer.gclk);
- } else {
+ else
clk_rate = clk_get_rate(timer.pclk);
- }
clk_rate = clk_rate / (MCHP_PIT64B_MODE_TO_PRES(timer.mode) + 1);
if (clkevt)
@@ -471,15 +462,10 @@ static int __init mchp_pit64b_dt_init_timer(struct device_node *node,
ret = mchp_pit64b_init_clksrc(&timer, clk_rate);
if (ret)
- goto gclk_unprepare;
+ goto irq_unmap;
return 0;
-gclk_unprepare:
- if (timer.mode & MCHP_PIT64B_MR_SGCLK)
- clk_disable_unprepare(timer.gclk);
-pclk_unprepare:
- clk_disable_unprepare(timer.pclk);
irq_unmap:
irq_dispose_mapping(irq);
io_unmap:
--
2.32.0
next prev parent reply other threads:[~2022-03-04 13:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-04 13:35 [PATCH v3 0/6] clocksource/drivers/timer-microchip-pit64b: fixes and improvements Claudiu Beznea
2022-03-04 13:35 ` [PATCH v3 1/6] clocksource/drivers/timer-microchip-pit64b: remove mmio selection Claudiu Beznea
2022-03-14 9:28 ` [tip: timers/core] clocksource/drivers/timer-microchip-pit64b: Remove " tip-bot2 for Claudiu Beznea
2022-03-04 13:35 ` [PATCH v3 2/6] clocksource/drivers/timer-microchip-pit64b: use notrace Claudiu Beznea
2022-03-14 9:28 ` [tip: timers/core] clocksource/drivers/timer-microchip-pit64b: Use notrace tip-bot2 for Claudiu Beznea
2022-03-04 13:35 ` [PATCH v3 3/6] clocksource/drivers/timer-microchip-pit64b: use 5MHz for clockevent Claudiu Beznea
2022-03-14 9:28 ` [tip: timers/core] clocksource/drivers/timer-microchip-pit64b: Use " tip-bot2 for Claudiu Beznea
2022-03-04 13:35 ` [PATCH v3 4/6] clocksource/drivers/timer-microchip-pit64b: remove suspend/resume ops for ce Claudiu Beznea
2022-03-04 13:36 ` Claudiu Beznea [this message]
2022-03-04 13:36 ` [PATCH v3 6/6] clocksource/drivers/timer-microchip-pit64b: fix compilation warnings Claudiu Beznea
2022-03-04 19:46 ` [PATCH v3 0/6] clocksource/drivers/timer-microchip-pit64b: fixes and improvements Daniel Lezcano
2022-03-07 12:17 ` Claudiu.Beznea
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220304133601.2404086-6-claudiu.beznea@microchip.com \
--to=claudiu.beznea@microchip.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®