1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2021, Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
13 static enum sbi_srst_reset_type reset_type_map[SYSRESET_COUNT] = {
14 [SYSRESET_WARM] = SBI_SRST_RESET_TYPE_WARM_REBOOT,
15 [SYSRESET_COLD] = SBI_SRST_RESET_TYPE_COLD_REBOOT,
16 [SYSRESET_POWER] = SBI_SRST_RESET_TYPE_COLD_REBOOT,
17 [SYSRESET_POWER_OFF] = SBI_SRST_RESET_TYPE_SHUTDOWN,
20 static int sbi_sysreset_request(struct udevice *dev, enum sysreset_t type)
22 enum sbi_srst_reset_type reset_type;
24 reset_type = reset_type_map[type];
25 sbi_srst_reset(reset_type, SBI_SRST_RESET_REASON_NONE);
30 static int sbi_sysreset_probe(struct udevice *dev)
34 have_reset = sbi_probe_extension(SBI_EXT_SRST);
38 log_warning("SBI has no system reset extension\n");
42 static struct sysreset_ops sbi_sysreset_ops = {
43 .request = sbi_sysreset_request,
46 U_BOOT_DRIVER(sbi_sysreset) = {
47 .name = "sbi-sysreset",
48 .id = UCLASS_SYSRESET,
49 .ops = &sbi_sysreset_ops,
50 .probe = sbi_sysreset_probe,