aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLina Iyer <lina.iyer@linaro.org>2015-03-02 18:30:28 -0500
committerKumar Gala <galak@codeaurora.org>2015-03-11 16:15:05 -0400
commita353e4a06f24235138d483a2625726a5fc472949 (patch)
tree87c373a4ae708b8f2df901ff9c16592ae02e6338
parent916f743da3546c28a2f350d197e3bea95d97ba15 (diff)
firmware: qcom: scm: Clean cold boot entry to export only the API
We dont need to export the SCM specific cold boot flags to the platform code. Export only a function to set the cold boot address. Signed-off-by: Lina Iyer <lina.iyer@linaro.org> Signed-off-by: Kumar Gala <galak@codeaurora.org>
-rw-r--r--arch/arm/mach-qcom/platsmp.c21
-rw-r--r--drivers/firmware/qcom_scm.c41
-rw-r--r--include/linux/qcom_scm.h5
3 files changed, 43 insertions, 24 deletions
diff --git a/arch/arm/mach-qcom/platsmp.c b/arch/arm/mach-qcom/platsmp.c
index 4b67e56911d3..5cde63a64b34 100644
--- a/arch/arm/mach-qcom/platsmp.c
+++ b/arch/arm/mach-qcom/platsmp.c
@@ -319,25 +319,10 @@ static int kpssv2_boot_secondary(unsigned int cpu, struct task_struct *idle)
319 319
320static void __init qcom_smp_prepare_cpus(unsigned int max_cpus) 320static void __init qcom_smp_prepare_cpus(unsigned int max_cpus)
321{ 321{
322 int cpu, map; 322 int cpu;
323 unsigned int flags = 0;
324 static const int cold_boot_flags[] = {
325 0,
326 QCOM_SCM_FLAG_COLDBOOT_CPU1,
327 QCOM_SCM_FLAG_COLDBOOT_CPU2,
328 QCOM_SCM_FLAG_COLDBOOT_CPU3,
329 };
330
331 for_each_present_cpu(cpu) {
332 map = cpu_logical_map(cpu);
333 if (WARN_ON(map >= ARRAY_SIZE(cold_boot_flags))) {
334 set_cpu_present(cpu, false);
335 continue;
336 }
337 flags |= cold_boot_flags[map];
338 }
339 323
340 if (qcom_scm_set_boot_addr(virt_to_phys(secondary_startup_arm), flags)) { 324 if (qcom_scm_set_cold_boot_addr(secondary_startup_arm,
325 cpu_present_mask)) {
341 for_each_present_cpu(cpu) { 326 for_each_present_cpu(cpu) {
342 if (cpu == smp_processor_id()) 327 if (cpu == smp_processor_id())
343 continue; 328 continue;
diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
index 6e7a72bdb176..c953cc38918f 100644
--- a/drivers/firmware/qcom_scm.c
+++ b/drivers/firmware/qcom_scm.c
@@ -34,6 +34,11 @@
34#define QCOM_SCM_ERROR -1 34#define QCOM_SCM_ERROR -1
35#define QCOM_SCM_INTERRUPTED 1 35#define QCOM_SCM_INTERRUPTED 1
36 36
37#define QCOM_SCM_FLAG_COLDBOOT_CPU0 0x00
38#define QCOM_SCM_FLAG_COLDBOOT_CPU1 0x01
39#define QCOM_SCM_FLAG_COLDBOOT_CPU2 0x08
40#define QCOM_SCM_FLAG_COLDBOOT_CPU3 0x20
41
37static DEFINE_MUTEX(qcom_scm_lock); 42static DEFINE_MUTEX(qcom_scm_lock);
38 43
39/** 44/**
@@ -329,7 +334,7 @@ EXPORT_SYMBOL(qcom_scm_get_version);
329/* 334/*
330 * Set the cold/warm boot address for one of the CPU cores. 335 * Set the cold/warm boot address for one of the CPU cores.
331 */ 336 */
332int qcom_scm_set_boot_addr(u32 addr, int flags) 337static int qcom_scm_set_boot_addr(u32 addr, int flags)
333{ 338{
334 struct { 339 struct {
335 __le32 flags; 340 __le32 flags;
@@ -341,4 +346,36 @@ int qcom_scm_set_boot_addr(u32 addr, int flags)
341 return qcom_scm_call(QCOM_SCM_SVC_BOOT, QCOM_SCM_BOOT_ADDR, 346 return qcom_scm_call(QCOM_SCM_SVC_BOOT, QCOM_SCM_BOOT_ADDR,
342 &cmd, sizeof(cmd), NULL, 0); 347 &cmd, sizeof(cmd), NULL, 0);
343} 348}
344EXPORT_SYMBOL(qcom_scm_set_boot_addr); 349
350/**
351 * qcom_scm_set_cold_boot_addr() - Set the cold boot address for cpus
352 * @entry: Entry point function for the cpus
353 * @cpus: The cpumask of cpus that will use the entry point
354 *
355 * Set the cold boot address of the cpus. Any cpu outside the supported
356 * range would be removed from the cpu present mask.
357 */
358int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
359{
360 int flags = 0;
361 int cpu;
362 int scm_cb_flags[] = {
363 QCOM_SCM_FLAG_COLDBOOT_CPU0,
364 QCOM_SCM_FLAG_COLDBOOT_CPU1,
365 QCOM_SCM_FLAG_COLDBOOT_CPU2,
366 QCOM_SCM_FLAG_COLDBOOT_CPU3,
367 };
368
369 if (!cpus || (cpus && cpumask_empty(cpus)))
370 return -EINVAL;
371
372 for_each_cpu(cpu, cpus) {
373 if (cpu < ARRAY_SIZE(scm_cb_flags))
374 flags |= scm_cb_flags[cpu];
375 else
376 set_cpu_present(cpu, false);
377 }
378
379 return qcom_scm_set_boot_addr(virt_to_phys(entry), flags);
380}
381EXPORT_SYMBOL(qcom_scm_set_cold_boot_addr);
diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h
index 6bb84cffb396..68a1d8801c6f 100644
--- a/include/linux/qcom_scm.h
+++ b/include/linux/qcom_scm.h
@@ -12,15 +12,12 @@
12#ifndef __QCOM_SCM_H 12#ifndef __QCOM_SCM_H
13#define __QCOM_SCM_H 13#define __QCOM_SCM_H
14 14
15#define QCOM_SCM_FLAG_COLDBOOT_CPU1 0x01
16#define QCOM_SCM_FLAG_COLDBOOT_CPU2 0x08
17#define QCOM_SCM_FLAG_COLDBOOT_CPU3 0x20
18#define QCOM_SCM_FLAG_WARMBOOT_CPU0 0x04 15#define QCOM_SCM_FLAG_WARMBOOT_CPU0 0x04
19#define QCOM_SCM_FLAG_WARMBOOT_CPU1 0x02 16#define QCOM_SCM_FLAG_WARMBOOT_CPU1 0x02
20#define QCOM_SCM_FLAG_WARMBOOT_CPU2 0x10 17#define QCOM_SCM_FLAG_WARMBOOT_CPU2 0x10
21#define QCOM_SCM_FLAG_WARMBOOT_CPU3 0x40 18#define QCOM_SCM_FLAG_WARMBOOT_CPU3 0x40
22 19
23extern int qcom_scm_set_boot_addr(u32 addr, int flags); 20extern int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus);
24 21
25#define QCOM_SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF)) 22#define QCOM_SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF))
26 23