[PATCHv2 02/11] mxc timer: refactor timer code to use timer versions

Grant Likely grant.likely at secretlab.ca
Wed Feb 3 11:23:18 EST 2010


On Tue, Feb 2, 2010 at 10:16 PM, Amit Kucheria
<amit.kucheria at canonical.com> wrote:
> From: Sascha Hauer <s.hauer at pengutronix.de>
>
> Refactor the timer code into version 1 and version 2.
>
> Essentially there are 2 versions of the timer hardware. Version 1 is found on
> MX1/MXL and MX21. Version 2 is found on MX25, MX27, MX31, MX35, MX37, MX51,
> and future parts.
>
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> Acked-by: Amit Kucheria <amit.kucheria at canonical.com>
> Signed-off-by: Amit Kucheria <amit.kucheria at canonical.com>
> ---
>  arch/arm/plat-mxc/time.c |   19 +++++++++++--------
>  1 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
> index 844567e..7d6499e 100644
> --- a/arch/arm/plat-mxc/time.c
> +++ b/arch/arm/plat-mxc/time.c
> @@ -57,6 +57,9 @@
>  #define MX3_TCN                        0x24
>  #define MX3_TCMP               0x10
>
> +#define timer_is_v1()  (cpu_is_mx1() || cpu_is_mx27())
> +#define timer_is_v2()  (cpu_is_mx3() || cpu_is_mx25())

Just from a defensive programming standpoint, it may be better to
define timer_is_v2() as (!timer_is_v1()).  I assume future parts are
more likely to be v2, and doing it that way means one less place in
the code to modify when new parts appear.

Otherwise,
Acked-by: Grant Likely <grant.likely at secretlab.ca>



More information about the linux-arm-kernel mailing list