lkml.org 
[lkml]   [2014]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/3] clocksource: tegra: Define timer bases in header file
On 02/03/2014 05:17 PM, Andrew Chew wrote:
> Added timers that are present in tegra30 and later, that are NOT in tegra20.
>
> Also, some of these timer bases are needed in the tegra watchdog driver, so
> separate them out into a header file that both the clocksource driver and
> the watchdog driver can share them.

> diff --git a/include/clocksource/tegra_timer.h b/include/clocksource/tegra_timer.h

> +/* Tegra 20 timers */
> +#define TEGRA20_TIMER1_BASE 0x0
> +#define TEGRA20_TIMER2_BASE 0x8
> +#define TEGRA20_TIMER3_BASE 0x50
> +#define TEGRA20_TIMER4_BASE 0x58
> +
> +/* Tegra 30 timers */
> +#define TEGRA30_TIMER1_BASE TEGRA20_TIMER1_BASE
> +#define TEGRA30_TIMER2_BASE TEGRA20_TIMER2_BASE
> +#define TEGRA30_TIMER3_BASE TEGRA20_TIMER3_BASE
> +#define TEGRA30_TIMER4_BASE TEGRA20_TIMER4_BASE
> +#define TEGRA30_TIMER5_BASE 0x60
> +#define TEGRA30_TIMER6_BASE 0x68
> +#define TEGRA30_TIMER7_BASE 0x70
> +#define TEGRA30_TIMER8_BASE 0x78
> +#define TEGRA30_TIMER9_BASE 0x80
> +#define TEGRA30_TIMER0_BASE 0x88

Why put the SoC name in the define names? Why not just have
TIMER1_BASE..TIMER10_BASE (that should be 10 not 0 as in your patch,
right?) and have the driver know that 1..4 are valid on Tegra20, and
1..10 are valid on later chips.

I guess if the defines are moved into a header file, adding a TEGRA_
prefix does make sense.

But I wonder if it wouldn't be simpler for the Tegra WDT driver to just
call a function on the Tegra clocksource driver to find out which timer
ID(s) to avoid using? Even simpler would be to just put a comment in the
WDT driver saying that timer 5 was chosen arbitrarily, but if it's
changed make sure not to conflict with the clocksource driver (and an
equivalent change to the clocksource driver).


\
 
 \ /
  Last update: 2014-02-05 22:21    [W:0.411 / U:2.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site