mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-26 13:44:29 +08:00
cpu: imx8: reimplement get cpu count
Return 4 is not correct on i.MX8DX/DXL/8QM and etc. we need to count available cpu node with device_type "cpu". Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
parent
f5b66af2cb
commit
adb3bd7654
@ -118,7 +118,24 @@ static int cpu_imx_get_info(struct udevice *dev, struct cpu_info *info)
|
||||
|
||||
static int cpu_imx_get_count(struct udevice *dev)
|
||||
{
|
||||
return 4;
|
||||
ofnode node;
|
||||
int num = 0;
|
||||
|
||||
ofnode_for_each_subnode(node, dev_ofnode(dev->parent)) {
|
||||
const char *device_type;
|
||||
|
||||
if (!ofnode_is_available(node))
|
||||
continue;
|
||||
|
||||
device_type = ofnode_read_string(node, "device_type");
|
||||
if (!device_type)
|
||||
continue;
|
||||
|
||||
if (!strcmp(device_type, "cpu"))
|
||||
num++;
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
static int cpu_imx_get_vendor(struct udevice *dev, char *buf, int size)
|
||||
|
Loading…
Reference in New Issue
Block a user