Commit 1bbdf637 authored by Catalin Marinas's avatar Catalin Marinas

RealView: Clean up the machine_is_*() calls in platsmp.c

Some of the calls weren't necessary and some others were duplicated.
This patch tidies up the platsmp.c file.
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>


parent ebac6546
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#define REALVIEW_REFCOUNTER (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET) #define REALVIEW_REFCOUNTER (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET)
/* used by entry-macro.S */ /* used by entry-macro.S and platsmp.c */
void __iomem *gic_cpu_base_addr; void __iomem *gic_cpu_base_addr;
/* /*
......
...@@ -193,4 +193,7 @@ ...@@ -193,4 +193,7 @@
#define core_tile_a9mp() 0 #define core_tile_a9mp() 0
#endif #endif
#define machine_is_realview_eb_mp() \
(machine_is_realview_eb() && (core_tile_eb11mp() || core_tile_a9mp()))
#endif /* __ASM_ARCH_BOARD_EB_H */ #endif /* __ASM_ARCH_BOARD_EB_H */
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include <mach/board-pb11mp.h> #include <mach/board-pb11mp.h>
#include <mach/scu.h> #include <mach/scu.h>
#include "core.h"
extern void realview_secondary_startup(void); extern void realview_secondary_startup(void);
/* /*
...@@ -31,16 +33,20 @@ extern void realview_secondary_startup(void); ...@@ -31,16 +33,20 @@ extern void realview_secondary_startup(void);
*/ */
volatile int __cpuinitdata pen_release = -1; volatile int __cpuinitdata pen_release = -1;
static void __iomem *scu_base_addr(void)
{
if (machine_is_realview_eb_mp())
return __io_address(REALVIEW_EB11MP_SCU_BASE);
else if (machine_is_realview_pb11mp())
return __io_address(REALVIEW_TC11MP_SCU_BASE);
else
return (void __iomem *)0;
}
static unsigned int __init get_core_count(void) static unsigned int __init get_core_count(void)
{ {
unsigned int ncores; unsigned int ncores;
void __iomem *scu_base = 0; void __iomem *scu_base = scu_base_addr();
if (machine_is_realview_eb() &&
(core_tile_eb11mp() || core_tile_a9mp()))
scu_base = __io_address(REALVIEW_EB11MP_SCU_BASE);
else if (machine_is_realview_pb11mp())
scu_base = __io_address(REALVIEW_TC11MP_SCU_BASE);
if (scu_base) { if (scu_base) {
ncores = __raw_readl(scu_base + SCU_CONFIG); ncores = __raw_readl(scu_base + SCU_CONFIG);
...@@ -57,15 +63,7 @@ static unsigned int __init get_core_count(void) ...@@ -57,15 +63,7 @@ static unsigned int __init get_core_count(void)
static void scu_enable(void) static void scu_enable(void)
{ {
u32 scu_ctrl; u32 scu_ctrl;
void __iomem *scu_base; void __iomem *scu_base = scu_base_addr();
if (machine_is_realview_eb() &&
(core_tile_eb11mp() || core_tile_a9mp()))
scu_base = __io_address(REALVIEW_EB11MP_SCU_BASE);
else if (machine_is_realview_pb11mp())
scu_base = __io_address(REALVIEW_TC11MP_SCU_BASE);
else
BUG();
scu_ctrl = __raw_readl(scu_base + SCU_CTRL); scu_ctrl = __raw_readl(scu_base + SCU_CTRL);
scu_ctrl |= 1; scu_ctrl |= 1;
...@@ -90,11 +88,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu) ...@@ -90,11 +88,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
* core (e.g. timer irq), then they will not have been enabled * core (e.g. timer irq), then they will not have been enabled
* for us: do so * for us: do so
*/ */
if (machine_is_realview_eb() && gic_cpu_init(0, gic_cpu_base_addr);
(core_tile_eb11mp() || core_tile_a9mp()))
gic_cpu_init(0, __io_address(REALVIEW_EB11MP_GIC_CPU_BASE));
else if (machine_is_realview_pb11mp())
gic_cpu_init(0, __io_address(REALVIEW_TC11MP_GIC_CPU_BASE));
/* /*
* let the primary processor know we're out of the * let the primary processor know we're out of the
...@@ -235,10 +229,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) ...@@ -235,10 +229,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
* dummy (!CONFIG_LOCAL_TIMERS), it was already registers in * dummy (!CONFIG_LOCAL_TIMERS), it was already registers in
* realview_timer_init * realview_timer_init
*/ */
if ((machine_is_realview_eb() && local_timer_setup();
(core_tile_eb11mp() || core_tile_a9mp())) ||
machine_is_realview_pb11mp())
local_timer_setup();
#endif #endif
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment