mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-06 13:14:27 +00:00
720620e691
-----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAl/0YVIACgkQFHw5/5Y0 tywtEwv/cJWlKgcSnYjuJrxwuJdauUTfXdbUgtCxOtBw/BP4dsKkbGTJPw5q5M+4 LJJSKyksmJVTX26h1dpkzQjOpWtTDnWqm5CTIxD52oQD7pxK+zCQ9T6S+QbQD0Se ogHmZluzFoluxbNgo8tiO52xvMhDO3TVAzxsNDdGfkd5/tAXOHClPc34RmAkdRHU VsR89AKdT2q543fiUfrRZYDzdctaNWhRGXMDcJ4+QU/8hQhrpcr8EtHbF+3mWX4K pA01pDz150Rn4UI6S2xKEWrjSTHe55fxVj/Qj0rq9z2E/+NqGXemf5s13AR0G/z3 PqHdVLHzDe64pbOvmyU1pVQ0aMb8vMJUnqx68SQZY3On2c+MjRWQ+7aVVaKOcPGp uatk6QMrggHp3Li+3yZrLBE0qPr/sNMVb7mUesdZb6lFd2VIs8siwhfeGXMS+nDI xePzsR43Fnn5Q5KIqqvcWUb+TTTqUDUff0wyAU8NBgCaIBIZK8h2ppS1jjnbms0I mr8Er2vb =Dfum -----END PGP SIGNATURE----- Merge tag 'v2021.01-rc5' into next Prepare v2021.01-rc5 Signed-off-by: Tom Rini <trini@konsulko.com>
83 lines
1.9 KiB
C
83 lines
1.9 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2017, STMicroelectronics - All Rights Reserved
|
|
* Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics.
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <regmap.h>
|
|
#include <syscon.h>
|
|
#include <sysreset.h>
|
|
#include <asm/io.h>
|
|
#include <linux/bitops.h>
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
struct sti_sysreset_priv {
|
|
phys_addr_t base;
|
|
};
|
|
|
|
static int sti_sysreset_request(struct udevice *dev, enum sysreset_t type)
|
|
{
|
|
struct sti_sysreset_priv *priv = dev_get_priv(dev);
|
|
|
|
generic_clear_bit(0, (void __iomem *)priv->base);
|
|
|
|
return -EINPROGRESS;
|
|
}
|
|
|
|
static int sti_sysreset_probe(struct udevice *dev)
|
|
{
|
|
struct sti_sysreset_priv *priv = dev_get_priv(dev);
|
|
struct udevice *syscon;
|
|
struct regmap *regmap;
|
|
struct fdtdec_phandle_args syscfg_phandle;
|
|
int ret;
|
|
|
|
/* get corresponding syscon phandle */
|
|
ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
|
|
"st,syscfg", NULL, 0, 0,
|
|
&syscfg_phandle);
|
|
if (ret < 0) {
|
|
pr_err("Can't get syscfg phandle: %d\n", ret);
|
|
return ret;
|
|
}
|
|
|
|
ret = uclass_get_device_by_of_offset(UCLASS_SYSCON,
|
|
syscfg_phandle.node,
|
|
&syscon);
|
|
if (ret) {
|
|
pr_err("%s: uclass_get_device_by_of_offset failed: %d\n",
|
|
__func__, ret);
|
|
return ret;
|
|
}
|
|
|
|
regmap = syscon_get_regmap(syscon);
|
|
if (!regmap) {
|
|
pr_err("unable to get regmap for %s\n", syscon->name);
|
|
return -ENODEV;
|
|
}
|
|
|
|
priv->base = regmap->ranges[0].start;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static struct sysreset_ops sti_sysreset = {
|
|
.request = sti_sysreset_request,
|
|
};
|
|
|
|
static const struct udevice_id sti_sysreset_ids[] = {
|
|
{ .compatible = "st,stih407-restart" },
|
|
{ }
|
|
};
|
|
|
|
U_BOOT_DRIVER(sysreset_sti) = {
|
|
.name = "sysreset_sti",
|
|
.id = UCLASS_SYSRESET,
|
|
.ops = &sti_sysreset,
|
|
.probe = sti_sysreset_probe,
|
|
.of_match = sti_sysreset_ids,
|
|
.priv_auto = sizeof(struct sti_sysreset_priv),
|
|
};
|