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

Commit 12d6d412 authored by John Stultz's avatar John Stultz
Browse files

clocksource: scx200_hrt: Convert scx200 to use clocksource_register_hz



Converts the scx200 clocksource to using clocksource_register_hz.

CC: Jim Cromie <jim.cromie@gmail.com>
Tested-by: default avatarJim Cromie <jim.cromie@gmail.com>
Acked-by: default avatarJim Cromie <jim.cromie@gmail.com>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent c7f798e3
Loading
Loading
Loading
Loading
+7 −13
Original line number Original line Diff line number Diff line
@@ -49,9 +49,6 @@ static cycle_t read_hrt(struct clocksource *cs)
	return (cycle_t) inl(scx200_cb_base + SCx200_TIMER_OFFSET);
	return (cycle_t) inl(scx200_cb_base + SCx200_TIMER_OFFSET);
}
}


#define HRT_SHIFT_1	22
#define HRT_SHIFT_27	26

static struct clocksource cs_hrt = {
static struct clocksource cs_hrt = {
	.name		= "scx200_hrt",
	.name		= "scx200_hrt",
	.rating		= 250,
	.rating		= 250,
@@ -63,6 +60,7 @@ static struct clocksource cs_hrt = {


static int __init init_hrt_clocksource(void)
static int __init init_hrt_clocksource(void)
{
{
	u32 freq;
	/* Make sure scx200 has initialized the configuration block */
	/* Make sure scx200 has initialized the configuration block */
	if (!scx200_cb_present())
	if (!scx200_cb_present())
		return -ENODEV;
		return -ENODEV;
@@ -79,19 +77,15 @@ static int __init init_hrt_clocksource(void)
	outb(HR_TMEN | (mhz27 ? HR_TMCLKSEL : 0),
	outb(HR_TMEN | (mhz27 ? HR_TMCLKSEL : 0),
	     scx200_cb_base + SCx200_TMCNFG_OFFSET);
	     scx200_cb_base + SCx200_TMCNFG_OFFSET);


	if (mhz27) {
	freq = (HRT_FREQ + ppm);
		cs_hrt.shift = HRT_SHIFT_27;
	if (mhz27)
		cs_hrt.mult = clocksource_hz2mult((HRT_FREQ + ppm) * 27,
		freq *= 27;
						  cs_hrt.shift);

	} else {
		cs_hrt.shift = HRT_SHIFT_1;
		cs_hrt.mult = clocksource_hz2mult(HRT_FREQ + ppm,
						  cs_hrt.shift);
	}
	pr_info("enabling scx200 high-res timer (%s MHz +%d ppm)\n",
	pr_info("enabling scx200 high-res timer (%s MHz +%d ppm)\n",
	printk(KERN_INFO "enabling scx200 high-res timer (%s MHz +%d ppm)\n",
		mhz27 ? "27":"1", ppm);
		mhz27 ? "27":"1", ppm);


	return clocksource_register(&cs_hrt);
	return clocksource_register_hz(&cs_hrt, freq);
}
}


module_init(init_hrt_clocksource);
module_init(init_hrt_clocksource);