1
0
Fork 0

Use common cpu_is_xxx() macros on AT91 and AVR32

Several drivers shared between AT91 and AVR32 chips use cpu_is_xxx()
to handle CPU-specific differences. Currently, such code needs to be
inside #ifdef CONFIG_ARCH_AT91 because the macros don't exist on AVR32.

By defining the same macros on both AT91 and AVR32, these #ifdefs can
be eliminated. Since the macros will evaluate to a constant value for
CPUs that aren't supported by the current architecture, any code that
is only needed on AT91 will be optimized away on AVR32 and vice versa.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: David Brownell <david-b@pacbell.net>
Acked-by: Andrew Victor <andrew@sanpeople.com>
Cc: Nicolas Ferre <nicolas.ferre@rfo.atmel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
hifive-unleashed-5.1
Haavard Skinnemoen 2007-05-09 02:33:47 -07:00 committed by Linus Torvalds
parent 31143d5d51
commit e7498281d3
2 changed files with 39 additions and 0 deletions

View File

@ -68,4 +68,10 @@ static inline unsigned long at91_arch_identify(void)
#define cpu_is_at91sam9263() (0)
#endif
/*
* Since this is ARM, we will never run on any AVR32 CPU. But these
* definitions may reduce clutter in common drivers.
*/
#define cpu_is_at32ap7000() (0)
#endif

View File

@ -0,0 +1,33 @@
/*
* AVR32 and (fake) AT91 CPU identification
*
* Copyright (C) 2007 Atmel Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __ASM_ARCH_CPU_H
#define __ASM_ARCH_CPU_H
/*
* Only AT32AP7000 is defined for now. We can identify the specific
* chip at runtime, but I'm not sure if it's really worth it.
*/
#ifdef CONFIG_CPU_AT32AP7000
# define cpu_is_at32ap7000() (1)
#else
# define cpu_is_at32ap7000() (0)
#endif
/*
* Since this is AVR32, we will never run on any AT91 CPU. But these
* definitions may reduce clutter in common drivers.
*/
#define cpu_is_at91rm9200() (0)
#define cpu_is_at91sam9xe() (0)
#define cpu_is_at91sam9260() (0)
#define cpu_is_at91sam9261() (0)
#define cpu_is_at91sam9263() (0)
#endif /* __ASM_ARCH_CPU_H */