summaryrefslogtreecommitdiffstats
path: root/common/oftree.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-07-18 07:13:55 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-07-18 07:13:55 +0200
commit33f8f53317659cd2c61dd118bfa7150f33aa30fb (patch)
treecec893f4b273f4a78e1d84326d15e97b75a456df /common/oftree.c
parentca922d6044e49b1ed9782aa8eb28d1ed70931978 (diff)
parentb60bdac8a5870dc136c9b028771371dd123a2431 (diff)
downloadbarebox-33f8f53317659cd2c61dd118bfa7150f33aa30fb.tar.gz
barebox-33f8f53317659cd2c61dd118bfa7150f33aa30fb.tar.xz
Merge branch 'for-next/riscv'
Diffstat (limited to 'common/oftree.c')
-rw-r--r--common/oftree.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/common/oftree.c b/common/oftree.c
index 7028c49aca..962fff244d 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -232,7 +232,24 @@ static int of_fixup_bootargs(struct device_node *root, void *unused)
return err;
}
- return of_fixup_bootargs_bootsource(root, node);
+ err = of_fixup_bootargs_bootsource(root, node);
+ if (err)
+ return err;
+
+ if (IS_ENABLED(CONFIG_RISCV)) {
+ const char *hartid;
+
+ hartid = getenv("global.hartid");
+ if (hartid) {
+ unsigned long id;
+
+ err = kstrtoul(hartid, 10, &id);
+ if (!err)
+ err = of_property_write_u32(node, "boot-hartid", id);
+ }
+ }
+
+ return err;
}
static int of_register_bootargs_fixup(void)