"Das U-Boot" Source Tree
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Raspberry Pi 4 firmware reset driver
4 *
5 * Copyright (C) 2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
6 */
7#include <dm.h>
8#include <reset-uclass.h>
9#include <asm/arch/msg.h>
10#include <dt-bindings/reset/raspberrypi,firmware-reset.h>
11
12static int raspberrypi_reset_request(struct reset_ctl *reset_ctl)
13{
14 if (reset_ctl->id >= RASPBERRYPI_FIRMWARE_RESET_NUM_IDS)
15 return -EINVAL;
16
17 return 0;
18}
19
20static int raspberrypi_reset_assert(struct reset_ctl *reset_ctl)
21{
22 switch (reset_ctl->id) {
23 case RASPBERRYPI_FIRMWARE_RESET_ID_USB:
24 bcm2711_notify_vl805_reset();
25 return 0;
26 default:
27 return -EINVAL;
28 }
29}
30
31struct reset_ops raspberrypi_reset_ops = {
32 .request = raspberrypi_reset_request,
33 .rst_assert = raspberrypi_reset_assert,
34};
35
36static const struct udevice_id raspberrypi_reset_ids[] = {
37 { .compatible = "raspberrypi,firmware-reset" },
38 { }
39};
40
41U_BOOT_DRIVER(raspberrypi_reset) = {
42 .name = "raspberrypi-reset",
43 .id = UCLASS_RESET,
44 .of_match = raspberrypi_reset_ids,
45 .ops = &raspberrypi_reset_ops,
46};