summaryrefslogtreecommitdiffstats
path: root/common/reset_source.c
Commit message (Collapse)AuthorAgeFilesLines
* Rename struct device_d to deviceSascha Hauer2023-01-101-4/+4
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: reset_source: Remove of_get_reset_source_priority()Alexander Shiyan2022-06-101-17/+3
| | | | | | | | | of_get_reset_source_priority() has no users, so it can be safely removed. Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220608051244.2318-1-eagle.alexander923@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: replace license statements with SPDX-License-IdentifiersAhmad Fatoum2020-11-271-10/+1
| | | | | | | | | | | | | For all files in common/ that already have a license text: - Replace with appropriate SPDX-License-Identifier - Remove empty comment lines around replacement - remove comment completely if only thing remaining is name of file without description Reviewed-by: Roland Hieber <rhi@pengutronix.de> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: introduce reset_source_to_stringAhmad Fatoum2020-02-191-3/+3
| | | | | | | | | | | | | | We have a few places where driver code prints reset_source_name() to console after setting the reset source. This working is probe order dependent, because reset_source_name() prints the highest priority reset_source so far, which doesn't necessarily have to be the one that was just computed. Implement reset_source_to_string, so drivers can be migrated to use it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: implement helper to set a device as reset sourceUwe Kleine-König2019-08-281-2/+25
| | | | | | | This allows to remove some boilerplate from drivers. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: drop reset_source_set_instance()Uwe Kleine-König2019-08-281-11/+4
| | | | | | | | | | | | The semantic of reset_source_set_instance() required a separate call to reset_source_set() (or reset_source_set_priority()) and checked right usage only using the type. Make the set of functions a bit easier to use by dropping reset_source_set_instance() and instead introduce a function that can set all relevant parameters (source, priority and instance) in one go. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: fix ordering of exported functionsUwe Kleine-König2019-08-281-6/+6
| | | | | | | | Declare and implement getters first, then setters. This syncs the order of functions in reset_source.c and reset_source.h. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: use instance = -1 as defaultUwe Kleine-König2019-08-281-1/+1
| | | | | | | | | | | As with platform device id (does someone still remember?) 0 might be a valid id. So use -1 for "unknown" or "doesn't apply" instead of 0. Also don't pass the instance to the device tree if negative. (This ends up as 0xffffffff otherwise.) Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: add new Brownout reset (BOR) sourceAhmad Fatoum2019-06-131-0/+1
| | | | | | | | | The STM32MP1 can report brown out as reason for a reset, which doesn't fit into existing reasons. Thus add a new one to the enumeration. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: reset_source: Introduce reset_source_name()Andrey Smirnov2018-05-081-0/+6
| | | | | | | | Introduce reset_source_name() to get string representation of current reset source. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: reset_source: Add the notion of "reset source instance"Andrey Smirnov2018-04-261-0/+17
| | | | | | | | | In order to accomodate SoCs that come with multiple watchdogs (or any other reset sources of the same kind) add a notion of "reset source instance", similar to what we already have for bootsource API. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "globalvar: make globalvar functions more consistent"Sascha Hauer2017-06-131-1/+1
| | | | This reverts commit 1b4a05c9263ae26083526acfabdea1ef96531a1d.
* globalvar: make globalvar functions more consistentSascha Hauer2017-04-111-1/+1
| | | | | | | | | Similar to the device parameter functions also make the globalvar functions more consistent. This also adds support for readonly globalvars and changes several existing globalvars which should really be readonly to readonly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: export reset_source_set_priorityAlexander Stein2016-05-131-1/+1
| | | | | | | | | | | In commit 4a7534bf07e ("reset-source: Allow different priorities") the function name changed from reset_source_set to reset_source_set_priority. Do that change in EXPORT_SYMBOL() accordingly. reset_source_set still exists but is a static inline now. Fixes: 4a7534bf07e ("reset-source: Allow different priorities") Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset-source: Add some debugging aidsSascha Hauer2015-08-281-0/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset-source: Allow different prioritiesSascha Hauer2015-08-281-1/+22
| | | | | | | | | | | | | | Different devices may report the reset source with different levels of certainty. For example a SoC may see a power-on reset, but this may only be because an external PMIC has power cycled the SoC. This means the PMIC knows the real reason better and thus the reset reason from the PMIC should be preferred. This patch introduces priorities for the reset_source to handle the above scenario. Also add a of_get_reset_source_priority() function to retrieve the desired priority from the device tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset-source: Use globalvar_add_simple_enumSascha Hauer2015-08-271-4/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: Add external resetWadim Egorov2015-03-021-0/+1
| | | | | | | Some SoCs have special device pins for external reset signals. Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: make safe to call earlierSascha Hauer2015-03-021-2/+2
| | | | | | | | | reset_source_init used to set the reset source to unknown in a coredevice_initcall. This means if reset_source_set() has been called earlier the value would have been overwritten. Fix this by calling globalvar_add_simple() each time reset_source_set() is called. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: add thermal resetLucas Stach2014-11-041-0/+1
| | | | | | | | Some SoCs are able to detect if they got reset in response to an overtemperature event. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: add reset_source_getSascha Hauer2014-01-291-0/+10
| | | | | | To get reset_source from C code, not only from shell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: rename set_reset_source to reset_source_setSascha Hauer2014-01-291-4/+4
| | | | | | | To get all reset source related functions into the same function namespace. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* globalvar: Allow to set initial valueSascha Hauer2013-08-161-2/+2
| | | | | | | Calling globalvar_add_simple() and setting a value is more than common. Add a parameter for the initial value. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Enable a way to provide the reason for "being here"Juergen Beisert2012-07-181-0/+44
Many architectures support a way to detect why the bootloader is running. This patch adds a global variable to be able to use the cause in some kind of shell code to do special things on demand. For example to do an emergency boot, when the last boot fails and the watchdog reactivate the hanging system. Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>