Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99f76891 authored by Linus Walleij's avatar Linus Walleij Committed by Russell King
Browse files

ARM: 6375/1: plat-nomadik: MTU timer trivial bug fix



timer0 to 3 are all on mtu block 0, so don't calculate the clock event
rate based upon mtu block 1's clock speed.

Acked-by: default avatarAlessandro Rubini <rubini@unipv.it>
Signed-off-by: default avatarJonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 03a7ab08
Loading
Loading
Loading
Loading
+2 −14
Original line number Original line Diff line number Diff line
@@ -131,17 +131,12 @@ void __init nmdk_timer_init(void)
{
{
	unsigned long rate;
	unsigned long rate;
	struct clk *clk0;
	struct clk *clk0;
	struct clk *clk1;
	u32 cr;
	u32 cr;


	clk0 = clk_get_sys("mtu0", NULL);
	clk0 = clk_get_sys("mtu0", NULL);
	BUG_ON(IS_ERR(clk0));
	BUG_ON(IS_ERR(clk0));


	clk1 = clk_get_sys("mtu1", NULL);
	BUG_ON(IS_ERR(clk1));

	clk_enable(clk0);
	clk_enable(clk0);
	clk_enable(clk1);


	/*
	/*
	 * Tick rate is 2.4MHz for Nomadik and 110MHz for ux500:
	 * Tick rate is 2.4MHz for Nomadik and 110MHz for ux500:
@@ -170,15 +165,8 @@ void __init nmdk_timer_init(void)
		pr_err("timer: failed to initialize clock source %s\n",
		pr_err("timer: failed to initialize clock source %s\n",
		       nmdk_clksrc.name);
		       nmdk_clksrc.name);


	/* Timer 1 is used for events, fix according to rate */
	/* Timer 1 is used for events */
	cr = MTU_CRn_32BITS;

	rate = clk_get_rate(clk1);
	if (rate > 16 << 20) {
		rate /= 16;
		cr |= MTU_CRn_PRESCALE_16;
	} else {
		cr |= MTU_CRn_PRESCALE_1;
	}
	clockevents_calc_mult_shift(&nmdk_clkevt, rate, MTU_MIN_RANGE);
	clockevents_calc_mult_shift(&nmdk_clkevt, rate, MTU_MIN_RANGE);


	writel(cr | MTU_CRn_ONESHOT, mtu_base + MTU_CR(1)); /* off, currently */
	writel(cr | MTU_CRn_ONESHOT, mtu_base + MTU_CR(1)); /* off, currently */