11590Srgrimes// SPDX-License-Identifier: GPL-2.0-only
21590Srgrimes#include <linux/kernel.h>
31590Srgrimes#include <linux/init.h>
41590Srgrimes#include <linux/reboot.h>
51590Srgrimes
61590Srgrimes#include "iomap.h"
71590Srgrimes#include "common.h"
81590Srgrimes#include "control.h"
91590Srgrimes#include "prm3xxx.h"
101590Srgrimes
111590Srgrimes#define TI81XX_PRM_DEVICE_RSTCTRL	0x00a0
121590Srgrimes#define TI81XX_GLOBAL_RST_COLD		BIT(1)
131590Srgrimes
141590Srgrimes/**
151590Srgrimes * ti81xx_restart - trigger a software restart of the SoC
161590Srgrimes * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
171590Srgrimes * @cmd: passed from the userspace program rebooting the system (if provided)
181590Srgrimes *
191590Srgrimes * Resets the SoC.  For @cmd, see the 'reboot' syscall in
201590Srgrimes * kernel/sys.c.  No return value.
211590Srgrimes *
221590Srgrimes * NOTE: Warm reset does not seem to work, may require resetting
231590Srgrimes * clocks to bypass mode.
241590Srgrimes */
251590Srgrimesvoid ti81xx_restart(enum reboot_mode mode, const char *cmd)
261590Srgrimes{
271590Srgrimes	omap2_prm_set_mod_reg_bits(TI81XX_GLOBAL_RST_COLD, 0,
281590Srgrimes				   TI81XX_PRM_DEVICE_RSTCTRL);
2950477Speter	while (1)
301590Srgrimes		;
311590Srgrimes}
321590Srgrimes