114e067c1SJean-Sebastien A. Beaudry /* 214e067c1SJean-Sebastien A. Beaudry * am33xx-restart.c - Code common to all AM33xx machines. 314e067c1SJean-Sebastien A. Beaudry * 414e067c1SJean-Sebastien A. Beaudry * This program is free software; you can redistribute it and/or modify 514e067c1SJean-Sebastien A. Beaudry * it under the terms of the GNU General Public License version 2 as 614e067c1SJean-Sebastien A. Beaudry * published by the Free Software Foundation. 714e067c1SJean-Sebastien A. Beaudry */ 814e067c1SJean-Sebastien A. Beaudry #include <linux/kernel.h> 9*7b6d864bSRobin Holt #include <linux/reboot.h> 1014e067c1SJean-Sebastien A. Beaudry 1114e067c1SJean-Sebastien A. Beaudry #include "common.h" 1214e067c1SJean-Sebastien A. Beaudry #include "prm-regbits-33xx.h" 1314e067c1SJean-Sebastien A. Beaudry #include "prm33xx.h" 1414e067c1SJean-Sebastien A. Beaudry 1514e067c1SJean-Sebastien A. Beaudry /** 1614e067c1SJean-Sebastien A. Beaudry * am3xx_restart - trigger a software restart of the SoC 1714e067c1SJean-Sebastien A. Beaudry * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c 1814e067c1SJean-Sebastien A. Beaudry * @cmd: passed from the userspace program rebooting the system (if provided) 1914e067c1SJean-Sebastien A. Beaudry * 2014e067c1SJean-Sebastien A. Beaudry * Resets the SoC. For @cmd, see the 'reboot' syscall in 2114e067c1SJean-Sebastien A. Beaudry * kernel/sys.c. No return value. 2214e067c1SJean-Sebastien A. Beaudry */ 23*7b6d864bSRobin Holt void am33xx_restart(enum reboot_mode mode, const char *cmd) 2414e067c1SJean-Sebastien A. Beaudry { 2514e067c1SJean-Sebastien A. Beaudry /* TODO: Handle mode and cmd if necessary */ 2614e067c1SJean-Sebastien A. Beaudry 2714e067c1SJean-Sebastien A. Beaudry am33xx_prm_rmw_reg_bits(AM33XX_GLOBAL_WARM_SW_RST_MASK, 2814e067c1SJean-Sebastien A. Beaudry AM33XX_GLOBAL_WARM_SW_RST_MASK, 2914e067c1SJean-Sebastien A. Beaudry AM33XX_PRM_DEVICE_MOD, 3014e067c1SJean-Sebastien A. Beaudry AM33XX_PRM_RSTCTRL_OFFSET); 3114e067c1SJean-Sebastien A. Beaudry 3214e067c1SJean-Sebastien A. Beaudry /* OCP barrier */ 3314e067c1SJean-Sebastien A. Beaudry (void)am33xx_prm_read_reg(AM33XX_PRM_DEVICE_MOD, 3414e067c1SJean-Sebastien A. Beaudry AM33XX_PRM_RSTCTRL_OFFSET); 3514e067c1SJean-Sebastien A. Beaudry } 36