1 // SPDX-License-Identifier: GPL-2.0
3 * Raspberry Pi 4 firmware reset driver
5 * Copyright (C) 2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
9 #include <reset-uclass.h>
10 #include <asm/arch/msg.h>
11 #include <dt-bindings/reset/raspberrypi,firmware-reset.h>
13 static int raspberrypi_reset_request(struct reset_ctl *reset_ctl)
15 if (reset_ctl->id >= RASPBERRYPI_FIRMWARE_RESET_NUM_IDS)
21 static int raspberrypi_reset_free(struct reset_ctl *reset_ctl)
26 static int raspberrypi_reset_assert(struct reset_ctl *reset_ctl)
28 switch (reset_ctl->id) {
29 case RASPBERRYPI_FIRMWARE_RESET_ID_USB:
30 bcm2711_notify_vl805_reset();
37 static int raspberrypi_reset_deassert(struct reset_ctl *reset_ctl)
42 struct reset_ops raspberrypi_reset_ops = {
43 .request = raspberrypi_reset_request,
44 .rfree = raspberrypi_reset_free,
45 .rst_assert = raspberrypi_reset_assert,
46 .rst_deassert = raspberrypi_reset_deassert,
49 static const struct udevice_id raspberrypi_reset_ids[] = {
50 { .compatible = "raspberrypi,firmware-reset" },
54 U_BOOT_DRIVER(raspberrypi_reset) = {
55 .name = "raspberrypi-reset",
57 .of_match = raspberrypi_reset_ids,
58 .ops = &raspberrypi_reset_ops,