msm: spm_devices: Do not use predetermined logical ids for CPUs
The logical ids of CPUs can be altered during boot up in the linux bootloaders and the drivers cannot rely on logical CPUids hardcoded into the device tree. Remove support "qcom,core-id" and "qcom,vctl-cpu-mask", which were used for on targets where CPU phandles weren't available. These targets are not longer supported with the existing code base and the driver expects phandles to identify the CPU that is associated with a CPU. In scenarios where the CPU phandle isn't associated with a physical CPU, these devices are ignored and not probed. CRs-fixed: 756327 Change-Id: I5fc06c04636ada085002135f92c629ab6b629644 Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org> Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
This commit is contained in:
parent
873f37a248
commit
28985c4f42
|
@ -12,13 +12,9 @@ Required properties
|
|||
|
||||
- compatible: "qcom,spm-v2"
|
||||
- reg: The physical address and the size of the SPM's memory mapped registers
|
||||
- qcom,cpu: phandle for the CPU that the SPM block is attached to. On targets
|
||||
that dont support CPU phandles the driver would support qcom,core-id.
|
||||
This field is required on only for SPMs that control the CPU.
|
||||
- qcom, core-id: This property will be deprecated once all targets start
|
||||
supporting CPU phandles. This field will be used to identify SPMs
|
||||
that control the CPU.
|
||||
{0..n} for cores {0..n}
|
||||
- qcom,cpu: phandle for the CPU that the SPM block is attached to. This field
|
||||
is required on only for SPMs that control the CPU. This field is not required
|
||||
for SPMs that control L2/CCI/L3
|
||||
- qcom,saw2-ver-reg: The location of the version register
|
||||
- qcom,name: The name with which a SPM device is identified by the power
|
||||
management code.
|
||||
|
@ -136,7 +132,7 @@ Example 2:
|
|||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
reg = <0xf9089000 0x1000>;
|
||||
qcom,core-id = <0>;
|
||||
qcom,cpu = <&CPU0>;
|
||||
qcom,saw2-ver-reg = <0xfd0>;
|
||||
qcom,saw2-cfg = <0x1b>;
|
||||
qcom,saw2-avs-ctl = <0>;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -17,7 +17,7 @@
|
|||
#size-cells = <1>;
|
||||
reg = <0xf9089000 0x1000>;
|
||||
qcom,name = "core0";
|
||||
qcom,core-id = <0>;
|
||||
qcom,cpu = <&CPU0>;
|
||||
qcom,saw2-ver-reg = <0xfd0>;
|
||||
qcom,saw2-cfg = <0x01>;
|
||||
qcom,saw2-avs-ctl = <0>;
|
||||
|
@ -39,7 +39,7 @@
|
|||
#size-cells = <1>;
|
||||
reg = <0xf9099000 0x1000>;
|
||||
qcom,name = "core1";
|
||||
qcom,core-id = <1>;
|
||||
qcom,cpu = <&CPU1>;
|
||||
qcom,saw2-ver-reg = <0xfd0>;
|
||||
qcom,saw2-cfg = <0x01>;
|
||||
qcom,saw2-avs-ctl = <0>;
|
||||
|
@ -61,7 +61,7 @@
|
|||
#size-cells = <1>;
|
||||
reg = <0xf90a9000 0x1000>;
|
||||
qcom,name = "core2";
|
||||
qcom,core-id = <2>;
|
||||
qcom,cpu = <&CPU2>;
|
||||
qcom,saw2-ver-reg = <0xfd0>;
|
||||
qcom,saw2-cfg = <0x01>;
|
||||
qcom,saw2-avs-ctl = <0>;
|
||||
|
@ -83,7 +83,7 @@
|
|||
#size-cells = <1>;
|
||||
reg = <0xf90b9000 0x1000>;
|
||||
qcom,name = "core3";
|
||||
qcom,core-id = <3>;
|
||||
qcom,cpu = <&CPU3>;
|
||||
qcom,saw2-ver-reg = <0xfd0>;
|
||||
qcom,saw2-cfg = <0x01>;
|
||||
qcom,saw2-avs-ctl = <0>;
|
||||
|
@ -105,7 +105,6 @@
|
|||
#size-cells = <1>;
|
||||
reg = <0xf9012000 0x1000>;
|
||||
qcom,name = "system-l2";
|
||||
qcom,core-id = <0xffff>; /* L2/APCS SAW */
|
||||
qcom,saw2-ver-reg = <0xfd0>;
|
||||
qcom,saw2-cfg = <0x14>;
|
||||
qcom,saw2-avs-ctl = <0>;
|
||||
|
@ -120,7 +119,7 @@
|
|||
qcom,vctl-port = <0x0>;
|
||||
qcom,phase-port = <0x1>;
|
||||
qcom,pfm-port = <0x2>;
|
||||
qcom,cpu-vctl-mask = <0xf>;
|
||||
qcom,cpu-vctl-list = <&CPU0 &CPU1 &CPU2 &CPU3>;
|
||||
qcom,saw2-spm-cmd-ret = [1f 00 20 03 22 00 0f];
|
||||
qcom,saw2-spm-cmd-gdhs = [00 20 32 42 03 44 22 50 02 32 50 0f];
|
||||
qcom,saw2-spm-cmd-pc = [00 22 12 32 b0 11 42 07 01 b0 12 22
|
||||
|
|
|
@ -476,7 +476,6 @@ static int get_cpu_id(struct device_node *node)
|
|||
{
|
||||
struct device_node *cpu_node;
|
||||
u32 cpu;
|
||||
int ret = -EINVAL;
|
||||
char *key = "qcom,cpu";
|
||||
|
||||
cpu_node = of_parse_phandle(node, key, 0);
|
||||
|
@ -485,14 +484,10 @@ static int get_cpu_id(struct device_node *node)
|
|||
if (of_get_cpu_node(cpu, NULL) == cpu_node)
|
||||
return cpu;
|
||||
}
|
||||
} else {
|
||||
char *key = "qcom,core-id";
|
||||
} else
|
||||
return num_possible_cpus();
|
||||
|
||||
ret = of_property_read_u32(node, key, &cpu);
|
||||
if (!ret)
|
||||
return cpu;
|
||||
}
|
||||
return ret;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static struct msm_spm_device *msm_spm_get_device(struct platform_device *pdev)
|
||||
|
@ -504,7 +499,7 @@ static struct msm_spm_device *msm_spm_get_device(struct platform_device *pdev)
|
|||
|
||||
if ((cpu >= 0) && cpu < num_possible_cpus())
|
||||
dev = &per_cpu(msm_cpu_spm_device, cpu);
|
||||
else if ((cpu == 0xffff) || (cpu < 0))
|
||||
else if (cpu == num_possible_cpus())
|
||||
dev = devm_kzalloc(&pdev->dev, sizeof(struct msm_spm_device),
|
||||
GFP_KERNEL);
|
||||
|
||||
|
@ -524,34 +519,19 @@ static struct msm_spm_device *msm_spm_get_device(struct platform_device *pdev)
|
|||
|
||||
static void get_cpumask(struct device_node *node, struct cpumask *mask)
|
||||
{
|
||||
unsigned long vctl_mask = 0;
|
||||
unsigned c = 0;
|
||||
unsigned c;
|
||||
int idx = 0;
|
||||
struct device_node *cpu_node = NULL;
|
||||
int ret = 0;
|
||||
struct device_node *cpu_node;
|
||||
char *key = "qcom,cpu-vctl-list";
|
||||
bool found = false;
|
||||
|
||||
cpu_node = of_parse_phandle(node, key, idx++);
|
||||
while (cpu_node) {
|
||||
found = true;
|
||||
for_each_possible_cpu(c) {
|
||||
if (of_get_cpu_node(c, NULL) == cpu_node)
|
||||
cpumask_set_cpu(c, mask);
|
||||
}
|
||||
cpu_node = of_parse_phandle(node, key, idx++);
|
||||
};
|
||||
|
||||
if (found)
|
||||
return;
|
||||
|
||||
key = "qcom,cpu-vctl-mask";
|
||||
ret = of_property_read_u32(node, key, (u32 *) &vctl_mask);
|
||||
if (!ret) {
|
||||
for_each_set_bit(c, &vctl_mask, num_possible_cpus()) {
|
||||
cpumask_set_cpu(c, mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int msm_spm_dev_probe(struct platform_device *pdev)
|
||||
|
@ -608,8 +588,11 @@ static int msm_spm_dev_probe(struct platform_device *pdev)
|
|||
|
||||
dev = msm_spm_get_device(pdev);
|
||||
if (!dev) {
|
||||
ret = -ENOMEM;
|
||||
goto fail;
|
||||
/*
|
||||
* For partial goods support some CPUs might not be available
|
||||
* in which case, shouldn't throw an error
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
get_cpumask(node, &dev->mask);
|
||||
|
||||
|
|
Loading…
Reference in New Issue