lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130926082059.GI16106@pengutronix.de>
Date:	Thu, 26 Sep 2013 10:20:59 +0200
From:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>
To:	Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:	Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, kernel@...gutronix.de,
	John Stultz <john.stultz@...aro.org>
Subject: Re: [RFC, PATCH] clocksource: provide timekeeping for efm32 SoCs

Hello Daniel,

On Thu, Sep 26, 2013 at 01:49:52AM +0200, Daniel Lezcano wrote:
> On 09/25/2013 05:32 PM, Uwe Kleine-König wrote:
> >>> +static void __init efm32_timer_init(struct device_node *np)
> >>> +{
> >>> +	static int has_clocksource, has_clockevent;
> >>> +	int ret;
> >>> +
> >>> +	if (!has_clocksource) {
> >>> +		ret = efm32_clocksource_init(np);
> >>> +		if (!ret) {
> >>> +			has_clocksource = 1;
> >>> +			return;
> >>> +		}
> >>> +	}
> >>> +
> >>> +	if (!has_clockevent) {
> >>> +		ret = efm32_clockevent_init(np);
> >>> +		if (!ret) {
> >>> +			has_clockevent = 1;
> >>> +			return;
> >>> +		}
> >>> +	}
> >>> +}
> >>
> >> I don't get the purpose of this initialization, can you explain ?
> > An efm32 SoC has four timer blocks. A single block can only be used for
> > one of clocksource or clockevent device and having more than one
> > clocksource or clockevent device doesn't make sense. So this routine
> > asserts that the first timer is used as clocksource and the second as
> > clockevent device. The others are unused.
> 
> Shouldn't be up to the dt to give the timers you want ?
The dt looks as follows:

                timer0: timer@...10000 {
                        compatible = "efm32,timer";
                        reg = <0x40010000 0x400>;
                        interrupts = <2>;
                        clocks = <&cmu clk_HFPERCLKTIMER0>;
                };

                timer1: timer@...10400 {
                        compatible = "efm32,timer";
                        reg = <0x40010400 0x400>;
                        interrupts = <12>;
                        clocks = <&cmu clk_HFPERCLKTIMER1>;
                };

                timer2: timer@...10800 {
                        compatible = "efm32,timer";
                        reg = <0x40010800 0x400>;
                        interrupts = <13>;
                        clocks = <&cmu clk_HFPERCLKTIMER2>;
                };

                timer3: timer@...10c00 {
                        compatible = "efm32,timer";
                        reg = <0x40010c00 0x400>;
                        interrupts = <14>;
                        clocks = <&cmu clk_HFPERCLKTIMER3>;
                };

What is your suggestion now? Add a property that specifies if the block
should be used as clocksource or clockevent_device? That isn't a
hardware description and so shouldn't go into the device tree.
Provide two drivers that match on "efm32,timer", one for clocksource and
another for clockevent_device? That wouldn't work, too, as the first
driver to be loaded would grab all four timers and the second would get
none.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ