u-boot-brain/drivers/sysreset/sysreset_resetctl.c
Simon Glass 41575d8e4c dm: treewide: Rename auto_alloc_size members to be shorter
This construct is quite long-winded. In earlier days it made some sense
since auto-allocation was a strange concept. But with driver model now
used pretty universally, we can shorten this to 'auto'. This reduces
verbosity and makes it easier to read.

Coincidentally it also ensures that every declaration is on one line,
thus making dtoc's job easier.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13 08:00:25 -07:00

49 lines
1.0 KiB
C

// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2020 MediaTek Inc.
*
* Author: Weijie Gao <weijie.gao@mediatek.com>
*/
#include <common.h>
#include <dm.h>
#include <errno.h>
#include <sysreset.h>
#include <reset.h>
struct resetctl_reboot_priv {
struct reset_ctl_bulk resets;
};
static int resetctl_reboot_request(struct udevice *dev, enum sysreset_t type)
{
struct resetctl_reboot_priv *priv = dev_get_priv(dev);
return reset_assert_bulk(&priv->resets);
}
static struct sysreset_ops resetctl_reboot_ops = {
.request = resetctl_reboot_request,
};
int resetctl_reboot_probe(struct udevice *dev)
{
struct resetctl_reboot_priv *priv = dev_get_priv(dev);
return reset_get_bulk(dev, &priv->resets);
}
static const struct udevice_id resetctl_reboot_ids[] = {
{ .compatible = "resetctl-reboot" },
{ }
};
U_BOOT_DRIVER(resetctl_reboot) = {
.id = UCLASS_SYSRESET,
.name = "resetctl_reboot",
.of_match = resetctl_reboot_ids,
.ops = &resetctl_reboot_ops,
.priv_auto = sizeof(struct resetctl_reboot_priv),
.probe = resetctl_reboot_probe,
};