power: supply: sbs-battery: simplify DT parsing
[deliverable/linux.git] / arch / arm / mach-realview / platsmp.c
CommitLineData
862184fe
RK
1/*
2 * linux/arch/arm/mach-realview/platsmp.c
3 *
4 * Copyright (C) 2002 ARM Ltd.
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/init.h>
12#include <linux/errno.h>
862184fe 13#include <linux/smp.h>
fced80c7 14#include <linux/io.h>
862184fe 15
6d407a6e 16#include "hardware.h"
7dd19e75 17#include <asm/mach-types.h>
0462b447 18#include <asm/smp_scu.h>
862184fe 19
6d407a6e
AB
20#include "board-eb.h"
21#include "board-pb11mp.h"
22#include "board-pbx.h"
b7b0ba94 23
3695adc2 24#include <plat/platsmp.h>
1bbdf637 25
3695adc2 26#include "core.h"
3705ff6d 27
1bbdf637
CM
28static void __iomem *scu_base_addr(void)
29{
30 if (machine_is_realview_eb_mp())
31 return __io_address(REALVIEW_EB11MP_SCU_BASE);
32 else if (machine_is_realview_pb11mp())
33 return __io_address(REALVIEW_TC11MP_SCU_BASE);
1b504bbe
CT
34 else if (machine_is_realview_pbx() &&
35 (core_tile_pbx11mp() || core_tile_pbxa9mp()))
36 return __io_address(REALVIEW_PBX_TILE_SCU_BASE);
1bbdf637
CM
37 else
38 return (void __iomem *)0;
39}
40
7bbb7940
RK
41/*
42 * Initialise the CPU possible map early - this describes the CPUs
43 * which may be present or become present in the system.
44 */
3695adc2 45static void __init realview_smp_init_cpus(void)
7bbb7940 46{
fd778f0a
RK
47 void __iomem *scu_base = scu_base_addr();
48 unsigned int i, ncores;
7bbb7940 49
fd778f0a 50 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
862184fe
RK
51
52 /* sanity check */
a06f916b
RK
53 if (ncores > nr_cpu_ids) {
54 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
55 ncores, nr_cpu_ids);
56 ncores = nr_cpu_ids;
862184fe
RK
57 }
58
bbc3d14e
RK
59 for (i = 0; i < ncores; i++)
60 set_cpu_possible(i, true);
61}
862184fe 62
3695adc2 63static void __init realview_smp_prepare_cpus(unsigned int max_cpus)
bbc3d14e 64{
862184fe 65
05c74a6c
RK
66 scu_enable(scu_base_addr());
67
862184fe 68 /*
05c74a6c
RK
69 * Write the address of secondary startup into the
70 * system-wide flags register. The BootMonitor waits
71 * until it receives a soft interrupt, and then the
72 * secondary CPU branches to this address.
862184fe 73 */
764a579f 74 __raw_writel(virt_to_phys(versatile_secondary_startup),
05c74a6c 75 __io_address(REALVIEW_SYS_FLAGSSET));
862184fe 76}
3695adc2 77
75305275 78const struct smp_operations realview_smp_ops __initconst = {
3695adc2
MZ
79 .smp_init_cpus = realview_smp_init_cpus,
80 .smp_prepare_cpus = realview_smp_prepare_cpus,
81 .smp_secondary_init = versatile_secondary_init,
82 .smp_boot_secondary = versatile_boot_secondary,
83#ifdef CONFIG_HOTPLUG_CPU
84 .cpu_die = realview_cpu_die,
85#endif
86};
This page took 0.680005 seconds and 5 git commands to generate.