forked from u-boot/u-boot
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sysreset: tegra: create arch specific sysreset driver
Tegra uses built in Power Management Controller (PMC) to perform CPU reset. Code to perform this was located in mach-tegra, so lest create DM driver to handle this. Signed-off-by: Svyatoslav Ryhel <[email protected]>
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
/* | ||
* Copyright(C) 2023 Svyatoslav Ryhel <[email protected]> | ||
*/ | ||
|
||
#include <common.h> | ||
#include <dm.h> | ||
#include <errno.h> | ||
#include <sysreset.h> | ||
#include <linux/err.h> | ||
#include <asm/arch-tegra/pmc.h> | ||
|
||
static int tegra_sysreset_request(struct udevice *dev, | ||
enum sysreset_t type) | ||
{ | ||
u32 value; | ||
|
||
switch (type) { | ||
case SYSRESET_WARM: | ||
case SYSRESET_COLD: | ||
/* resets everything but scratch 0 and reset status */ | ||
value = tegra_pmc_readl(PMC_CNTRL); | ||
value |= PMC_CNTRL_MAIN_RST; | ||
tegra_pmc_writel(value, PMC_CNTRL); | ||
break; | ||
default: | ||
return -EPROTONOSUPPORT; | ||
} | ||
|
||
return -EINPROGRESS; | ||
} | ||
|
||
static struct sysreset_ops tegra_sysreset = { | ||
.request = tegra_sysreset_request, | ||
}; | ||
|
||
U_BOOT_DRIVER(sysreset_tegra) = { | ||
.id = UCLASS_SYSRESET, | ||
.name = "sysreset_tegra", | ||
.ops = &tegra_sysreset, | ||
}; | ||
|
||
/* Link to Tegra PMC once there is a driver */ | ||
U_BOOT_DRVINFO(sysreset_tegra) = { | ||
.name = "sysreset_tegra" | ||
}; |