summaryrefslogtreecommitdiffstats
path: root/drivers/sysreset
Commit message (Collapse)AuthorAgeFilesLines
* sysreset: add reset controller based reboot driverWeijie Gao2020-04-273-0/+55
| | | | | | | | | | | Some chips provide their sysreset function in reset controller, which is normally a bit written to 1 to perform the sysreset. This patch adds a new sysreset driver to take advantage of it. Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
* x86: Move acpi_s3.h to include/acpi/Simon Glass2020-04-161-1/+1
| | | | | | | | | | | | | This header relates to ACPI and we are about to add some more ACPI headers. Move this one into a new directory so they are together. The header inclusion in pci_rom.c is not specific to x86 anymore, so drop the #ifdef CONFIG_X86. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* dm: core: Create a new header file for 'compat' featuresSimon Glass2020-02-051-0/+1
| | | | | | | | | | | | At present dm/device.h includes the linux-compatible features. This requires including linux/compat.h which in turn includes a lot of headers. One of these is malloc.h which we thus end up including in every file in U-Boot. Apart from the inefficiency of this, it is problematic for sandbox which needs to use the system malloc() in some files. Move the compatibility features into a separate header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Require users of devres to include the headerSimon Glass2020-02-052-0/+2
| | | | | | | | | | At present devres.h is included in all files that include dm.h but few make use of it. Also this pulls in linux/compat which adds several more headers. Drop the automatic inclusion and require files to include devres themselves. This provides a good indication of which files use devres. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anatolij Gustschin <agust@denx.de>
* common: Move hang() to the same header as panic()Simon Glass2020-01-171-0/+1
| | | | | | | | | | At present panic() is in the vsprintf.h header file. That does not seem like an obvious choice for hang(), even though it relates to panic(). So let's put hang() in its own header. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Migrate a few more files] Signed-off-by: Tom Rini <trini@konsulko.com>
* common: Move reset_cpu() to the CPU headerSimon Glass2020-01-171-0/+1
| | | | | | Move this function out of common.h and into a relevant header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* arm: socfpga: Convert reset manager from struct to definesLey Foon Tan2020-01-071-3/+3
| | | | | | | | | | | | | | Convert reset manager for Gen5, Arria 10 and Stratix 10 from struct to defines. Change to get reset manager base address from DT node instead of using #define. spl_early_init() initializes the DT setup. So, move spl_early_init() to beginning of function and before get base address from DT. Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
* sysreset_mpc83xx: fix mcp83xx -> mpc83xx typoRasmus Villemoes2019-12-132-2/+2
| | | | Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
* x86: Move acpi_s3.h to a common locationSimon Glass2019-10-081-1/+1
| | | | | | | | At present this hedaer is only available on x86. To allow sandbox to use it for testing, move it to a common location. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* x86: sysreset: Allow reset driver to be included in SPL/TPLSimon Glass2019-10-082-1/+13
| | | | | | | | | | | At present this driver is always included in SPL and TPL, if U-Boot proper enables it. Update the Makefile to provide full control using the existing Kconfig options. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: make the Kconfig help text a little bit clearer] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* sysreset: move stm32mp sysreset poweroff implementation to sysreset uclassUrja Rannikko2019-08-192-0/+28
| | | | | | | | | | | | | | | This is a generic implementation. Add CONFIG_SYSRESET_CMD_POWEROFF to signal when we need it. Enable it from the STPMIC1 config and in sandbox. The config flag is transitionary, that is it can be removed after all poweroff implementations use sysreset, and just have CMD_POWEROFF depend on sysreset. Signed-off-by: Urja Rannikko <urjaman@gmail.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com> Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
* sysreset: switch to using SYSRESET_POWER_OFF for poweroffUrja Rannikko2019-08-192-3/+3
| | | | | | | | | | | | | | | It seems that SYSRESET_POWER_OFF was added recently, and all previous code used SYSRESET_POWER for poweroff. SYSRESET_POWER is supposed to be a PMIC-level power cycle, not a poweroff. (Comment by Simon Glass) SYSRESET_POWER means to do a power reset (removing and reinstating all power) SYSRESET_POWER_OFF means to turn the device off and leave it off Signed-off-by: Urja Rannikko <urjaman@gmail.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com> (Update comment to help understand the patch) Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
* spl: kconfig: separate sysreset and firmware drivers from miscSimon Goldschmidt2019-07-211-0/+1
| | | | | | | | | | | | | | | | | | | | | This adds separate kconfig options for drivers/sysreset and drivers/firmware. Up to now, CONFIG_SPL_DRIVERS_MISC_SUPPORT added drivers/misc to SPL build but also added drivers/firmware and drivers/sysreset at the same time. Since that is confusing, this patch uses CONFIG_SPL_SYSRESET for drivers/sysreset and adds CONFIG_SPL_FIRMWARE for drivers/firmware (and accordingly for the TPL options). CONFIG_SPL_DRIVERS_MISC_SUPPORT stays for including drivers/misc into the SPL build (and accordingly for TPL) since there are boards using non-DM (non UCLASS_MISC) files from drivers/misc. Such boards don't have CONFIG_SPL_MISC enabled, so cannot use this to include drivers/misc into the SPL build. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
* sysreset: socfpga: stratix10: add sysreset driverSimon Goldschmidt2019-07-213-0/+37
| | | | | | This adds a UCLASS_SYSRESET sysreset driver for socfgpa stratix10. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
* sysreset: socfpga: gen5: add sysreset driverSimon Goldschmidt2019-07-213-0/+64
| | | | | | This adds a UCLASS_SYSRESET sysreset driver for socfgpa gen5. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
* Merge tag 'u-boot-stm32-20190712' of ↵Tom Rini2019-07-141-2/+4
|\ | | | | | | | | | | | | | | | | | | | | https://gitlab.denx.de/u-boot/custodians/u-boot-stm - syscon: add support for power off - stm32mp1: add op-tee config - stm32mp1: add specific commands: stboard and stm32key - add stm32 mailbox driver - solve many stm32 warnings when building with W=1 - update stm32 gpio driver
| * sysreset: syscon: add support for power offPatrick Delaunay2019-07-121-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new type sysreset 'POWER_OFF', introduced by commit 751fed426f87 ("sysreset: Add a way to find the last reset") is only supported for "syscon-poweroff" compatible. For details see Linux binding: ./Documentation/devicetree/bindings/power/reset/syscon-poweroff.txt This patch removes the support of POWER_OFF for "syscon-reboot" and keeps only the COLD reset (for command reset support) and it introduces the compatible "syscon-poweroff" for the POWER_OFF case. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
* | sandbox: Exit when SYSRESET_POWER_OFF is requestedSimon Glass2019-07-101-0/+1
|/ | | | | | | | | At present this returns but it seems better to just exit sandbox immediately. Signed-off-by: Simon Glass <sjg@chromium.org> reset
* sysreset: select DM_GPIO instead of GPIOChris Packham2019-05-101-1/+1
| | | | | | | | | CONFIG_GPIO does not exist. sysreset_gpio.c uses the DM gpio APIs so the correct option to select is DM_GPIO. Reported-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Merge tag 'rockchip-for-v2019.07-rc1' of git://git.denx.de/u-boot-rockchipTom Rini2019-05-092-1/+19
|\ | | | | | | | | | | | | | | | | | | | | | | | | Improvements and new features: - split more rockchip pinctrl_core feature into per SoC - enable TPL for evb-rk3399 board - enable TPL/SPL for evb-px5 board - enable TPL and OP-TEE support for evb-rk3229 - update fix in arm common assembly start code for rockchip header file - update default SPL_FIT_GENERATOR for rockchip - rk3399 boards update to use '-u-boot.dtsi' - add new rk3399 boards: Nanopi M4, Nanopc T4 - enable sound for chromebook_minnie
| * sysreset: enable driver support in SPL/TPLKever Yang2019-05-082-1/+19
| | | | | | | | | | | | SPL/TPL also need use sysreset for some feature like panic callback. Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
* | x86: sysreset: Implement the get_last() methodSimon Glass2019-05-081-0/+6
| | | | | | | | | | | | | | | | | | Add a default implementation of this method which always indicates that the last reset was a power-on reset. This is the most likely type of reset and without a PCH-specific driver we cannot determine any other type. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* | x86: sysreset: Implement power-off if availableSimon Glass2019-05-081-1/+78
| | | | | | | | | | | | | | | | On modern x86 devices we can power the system off using the power- management features of the PCH. Add an implementation for this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* | x86: sysreset: Separate out the EFI codeSimon Glass2019-05-081-5/+11
|/ | | | | | | | | | | | | | The EFI implementation of reset sits inside the driver and is called directly from outside the driver, breaking the normal driver-model conventions. Worse, it passed NULL as the device pointer, hoping that the called function won't use it, which breaks as soon as code is added to use it. Separate out the implementation to improve the situation enough to allow a future patch to add new sysreset features. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* rockchip: use 'arch-rockchip' as header file pathKever Yang2019-05-011-3/+3
| | | | | | | | Rockchip use 'arch-rockchip' instead of arch-$(SOC) as common header file path, so that we can get the correct path directly. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
* sysreset: syscon: remove POWER reset causePatrick Delaunay2019-04-261-0/+3
| | | | | | | | | | | The sysreset of 'POWER' type is a PMIC reset defined as 'remove and restore power'. So normally only COLD/WARN is supported by sysreset_syscon. This modification allows to use the function sysreset_walk(SYSRESET_POWER) when it is supported by PMIC driver (see example in stpmic1). Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
* sysreset: use syscon_regmap_lookup_by_phandlePatrick Delaunay2019-04-111-13/+2
| | | | | | | Use the new function syscon_regmap_lookup_by_phandle() to simplify the code. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
* x86: Add efi runtime resetAlexander Graf2019-03-111-1/+22
| | | | | | | | | | | | | | | | | Our selftest will soon test the actual runtime reset function rather than the boot time one. For this, we need to ensure that the runtime version actually succeeds on x86 to keep our travis tests work. So this patch implements an x86 runtime reset function. It is missing shutdown functionality today, but OSs usually implement that via ACPI and this function does more than the stub from before, so it's at least an improvement. Eventually we will want to have full DM functionality in runtime services. But this fixes a travis failure and doesn't clutter the code too heavily, so we should pull it in without the amazing new RTS DM framework. Signed-off-by: Alexander Graf <agraf@suse.de>
* sandbox: sysreset: Update to support power-on resetSimon Glass2018-12-051-1/+7
| | | | | | | | | If U-Boot is started from SPL or TPL, then those earlier phases deal with the reset cause. On real hardware this cause may be lost once it is read. Emulate that behaviour in sandbox by reporting a warm reset when a previous phase has run since start-up. Signed-off-by: Simon Glass <sjg@chromium.org>
* sysreset: Remove DM_FLAG_PRE_RELOC flag in various driversBin Meng2018-11-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage. To mitigate this potential impact, the following changes are implemented: - Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* sysreset: Add a way to find the last resetSimon Glass2018-10-092-0/+45
| | | | | | | | We have a method to return the last reset as a string for humans, but not a method that allows it to be used programmatically. Add a new method that returns the last reset as an enum. Signed-off-by: Simon Glass <sjg@chromium.org>
* sysreset: Tidy up a few comments and loggingSimon Glass2018-10-091-1/+3
| | | | | | | Some comments are incorrect or missing pieces. Fix these and use logging to print the error. Signed-off-by: Simon Glass <sjg@chromium.org>
* mpc83xx: Add sysreset driverMario Six2018-09-184-4/+325
| | | | | | | Add a sysreset driver for the MPC83xx platform. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc>
* test: Add tests for sysreset_get_statusMario Six2018-09-181-0/+16
| | | | | | | Add some tests for sysreset_get_status. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc>
* sysreset: Add get_status methodMario Six2018-09-181-0/+10
| | | | | | | | | | | | It's useful to have the reset status of the SoC printed out during reset (e.g. to learn whether the reset was caused by software or a watchdog). As a first step to implement this, add a get_status method to the sysreset class, which enables the caller to get printable information about the reset status (akin to get_desc in the CPU uclass). Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc>
* sysreset: Add TI System Control Interface (TI SCI) sysreset driverAndreas Dannenberg2018-09-113-0/+81
| | | | | | | | | | | | | | | | | Devices from the TI K3 family of SoCs like the AM654x contain a Device Management and Security Controller (SYSFW) that manages the low-level device control (like clocks, resets etc) for the various hardware modules present on the SoC. These device control operations are provided to the host processor OS through a communication protocol called the TI System Control Interface (TI SCI) protocol. This patch adds a system reset driver that communicates to the system controller over the TI SCI protocol for allowing to perform a system- wide SoC reset. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Andreas Dannenberg <dannenberg@ti.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
* Merge git://git.denx.de/u-boot-x86Tom Rini2018-07-204-0/+58
|\
| * dm: sysreset: Add a standard message when doing resetBin Meng2018-07-201-0/+2
| | | | | | | | | | | | | | It's good to print a message when doing reset. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
| * dm: sysreset: x86: Add a sysreset driverBin Meng2018-07-203-0/+56
| | | | | | | | | | | | | | This adds a generic reset driver for x86 processor. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | sysreset: syscon: update regmap access to sysconPatrick Delaunay2018-07-201-7/+9
|/ | | | | | | | Use new API syscon_node_to_regmap in sysreset_syscon driver for compatible "syscon-reboot"; that's avoid the need of explicit syscon binding for "regmap" handle. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
* sysreset: Add support for Microblaze soft reset jumpMichal Simek2018-07-193-0/+37
| | | | | | | | | | | | | | | | | | Microblaze is storing reset vector at address 0x0. It means soft reset can be done by just jumping to this address. This code was in platform code but sysreset interface is providing enough capabilities to have more options how to reset the system. It can go from gpio reset through watchdog reset till soft reset. The driver has not compatible string because this is cpu specific and DM core is not able to detect compatible string in DT root that's why this driver will be instantiated from platform code by calling device_bind_driver(gd->dm_root, "mb_soft_reset", "reset_soft", NULL); It should be bind as the last reset method to ensure that hw reset is called before this. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* sysreset: Add support for gpio-restartMichal Simek2018-07-193-0/+68
| | | | | | | | | | | | | | | | | | | | The Linux kernel has binding for gpio-restart node. This patch is adding basic support without supporting any optional properties. This driver was tested on Microblaze system where gpio is connected to SoC reset logic. Output value is handled via gpios cells values. In gpio_reboot_request() set_value is writing 1 because dm_gpio_set_value() is capable to changing it when it is ACTIVE_LOW. ... if (desc->flags & GPIOD_ACTIVE_LOW) value = !value; ... Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* sysreset: dm: Support manual relocation for sysresetMichal Simek2018-07-191-0/+16
| | | | | | | | | Relocate sysreset ops as was done by: "dm: Add support for all targets which requires MANUAL_RELOC" (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3) Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* regmap: clean up regmap allocationMasahiro Yamada2018-05-071-1/+1
| | | | | | | | | | | | | | | | | | Putting zero length array at the end of struct is a common technique to embed arbitrary length of members. There is no good reason to let regmap_alloc_count() branch by "if (count <= 1)". As far as I understood the code, regmap->base is an alias of regmap->ranges[0].start, but it is not helpful but make the code just ugly. Rename regmap_alloc_count() to regmap_alloc() because the _count suffix seems pointless. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: fixup cpu_info-rcar.c] Signed-off-by: Tom Rini <trini@konsulko.com>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-0710-21/+10
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTRTom Rini2018-04-271-2/+0
| | | | | | | | We have a large number of places where while we historically referenced gd in the code we no longer do, as well as cases where the code added that line "just in case" during development and never dropped it. Signed-off-by: Tom Rini <trini@konsulko.com>
* sysreset: syscon: convert to use live dtÁlvaro Fernández Rojas2018-04-101-6/+2
| | | | | Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
* db410c: replace reset driver with psciJorge Ramirez-Ortiz2018-01-152-42/+0
| | | | | | this should be the norm for armv8 platforms. Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
* dm: reset: have the reset-command perform a COLD resetPhilipp Tomsich2017-12-121-1/+1
| | | | | | | | | | | | | | The DM version of do_reset has been issuing a warm-reset, which (on some platforms keeps GPIOs and other parts of the platform active). This may cause unintended behaviour, as calling do_reset usually indicates a desire to reset the board/platform and not just the CPU. This changes do_reset to always request a COLD reset. Note that programmatic uses can still invoke a WARM reset through reset_cpu() or using sysreset_walk(). Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* rockchip: sysreset: update Makefile to work with merged sysreset driverPhilipp Tomsich2017-11-211-10/+1
| | | | | | | | After applying the merged sysreset driver, there are build failures due to an out-of-sync Makefile. This updates drivers/sysreset/Makefile to address these build failures. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>