Skip to content

Commit 4aa3644

Browse files
committed
Merge tag 'timers-urgent-2021-02-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Thomas Gleixner: "A small set of clockevent fixes which fell through the cracks before the 5.11 release: - Ensure a clock is enabled on sh_cmt - Trivial compile fail and compile warning fixes" * tag 'timers-urgent-2021-02-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: clocksource/drivers/mxs_timer: Add missing semicolon when DEBUG is defined clocksource/drivers/sh_cmt: Make sure channel clock supply is enabled clocksource/drivers/ixp4xx: Select TIMER_OF when needed
2 parents c958423 + 8acb54a commit 4aa3644

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

arch/arm/mach-ixp4xx/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ config MACH_IXP4XX_OF
1313
select I2C
1414
select I2C_IOP3XX
1515
select PCI
16-
select TIMER_OF
1716
select USE_OF
1817
help
1918
Say 'Y' here to support Device Tree-based IXP4xx platforms.

drivers/clocksource/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ config IXP4XX_TIMER
7979
bool "Intel XScale IXP4xx timer driver" if COMPILE_TEST
8080
depends on HAS_IOMEM
8181
select CLKSRC_MMIO
82+
select TIMER_OF if OF
8283
help
8384
Enables support for the Intel XScale IXP4xx SoC timer.
8485

drivers/clocksource/mxs_timer.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,7 @@ static void mxs_irq_clear(char *state)
131131

132132
/* Clear pending interrupt */
133133
timrot_irq_acknowledge();
134-
135-
#ifdef DEBUG
136-
pr_info("%s: changing mode to %s\n", __func__, state)
137-
#endif /* DEBUG */
134+
pr_debug("%s: changing mode to %s\n", __func__, state);
138135
}
139136

140137
static int mxs_shutdown(struct clock_event_device *evt)

drivers/clocksource/sh_cmt.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ static const struct sh_cmt_info sh_cmt_info[] = {
235235
#define CMCNT 1 /* channel register */
236236
#define CMCOR 2 /* channel register */
237237

238+
#define CMCLKE 0x1000 /* CLK Enable Register (R-Car Gen2) */
239+
238240
static inline u32 sh_cmt_read_cmstr(struct sh_cmt_channel *ch)
239241
{
240242
if (ch->iostart)
@@ -853,6 +855,7 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
853855
unsigned int hwidx, bool clockevent,
854856
bool clocksource, struct sh_cmt_device *cmt)
855857
{
858+
u32 value;
856859
int ret;
857860

858861
/* Skip unused channels. */
@@ -882,6 +885,11 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
882885
ch->iostart = cmt->mapbase + ch->hwidx * 0x100;
883886
ch->ioctrl = ch->iostart + 0x10;
884887
ch->timer_bit = 0;
888+
889+
/* Enable the clock supply to the channel */
890+
value = ioread32(cmt->mapbase + CMCLKE);
891+
value |= BIT(hwidx);
892+
iowrite32(value, cmt->mapbase + CMCLKE);
885893
break;
886894
}
887895

@@ -1014,12 +1022,10 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
10141022
else
10151023
cmt->rate = clk_get_rate(cmt->clk) / 8;
10161024

1017-
clk_disable(cmt->clk);
1018-
10191025
/* Map the memory resource(s). */
10201026
ret = sh_cmt_map_memory(cmt);
10211027
if (ret < 0)
1022-
goto err_clk_unprepare;
1028+
goto err_clk_disable;
10231029

10241030
/* Allocate and setup the channels. */
10251031
cmt->num_channels = hweight8(cmt->hw_channels);
@@ -1047,13 +1053,17 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
10471053
mask &= ~(1 << hwidx);
10481054
}
10491055

1056+
clk_disable(cmt->clk);
1057+
10501058
platform_set_drvdata(pdev, cmt);
10511059

10521060
return 0;
10531061

10541062
err_unmap:
10551063
kfree(cmt->channels);
10561064
iounmap(cmt->mapbase);
1065+
err_clk_disable:
1066+
clk_disable(cmt->clk);
10571067
err_clk_unprepare:
10581068
clk_unprepare(cmt->clk);
10591069
err_clk_put:

0 commit comments

Comments
 (0)