Commit graph

77 commits

Author SHA1 Message Date
Mateusz Sierszulski ea4746fc68 drivers: hwinfo: Fix Gecko hwinfo driver building
do not build hwinfo driver for this board - it does not have support for it

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-12-20 22:50:19 +01:00
Erwan Gouriou 50473ec0a9 drivers: hwinfo: stm32: Deal with iwdgX and wwdgX instances
On some STM32 series (H7, MP1), iwdg and wwdg have multiple instances.
Due to current driver implementation, these wdg instances were not
checked in the function.

Fixes #53002

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-19 09:22:28 +00:00
Michal Moskal d46b9bd124 drivers: hwinfo: Implement hwinfo_get_device_id for ESP32-C3
ESP32-C3 uses different fuse addresses for storing the MAC addr,
but the the format is the same.

Signed-off-by: Michal Moskal <michal@moskal.me>
2022-12-14 09:51:44 +01:00
Wei-Tai Lee 00b97feb56 drivers: hwinfo: add Andes hwinfo driver
Add hwinfo driver for Andes.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2022-08-26 11:55:55 +02:00
Navin Sankar Velliangiri 9315aef26d drivers: hwinfo: Exclude SYSCON driver on LPC51U68
The hwinfo_mcux_syscon driver isn't relavant for LPC51U68 SoC
series. Add a Kconfig exclusion so the driver isn't available
on LPC51U68 SoC.

Signed-off-by: Navin Sankar Velliangiri <navin@linumiz.com>
2022-08-12 16:15:42 -05:00
Bryce Wilkins b5a95bad3d drivers: hwinfo: Fix mcux device id
This fixes an issue where the unique device identifier is incorrectly
copied from an address on the AHB bus to memory using memcpy.

I verified corrected behavior by comparing `hwinfo devid` command
output to memory view of the SoC using the debugger.

Signed-off-by: Bryce Wilkins <bryce.wilkins@gmail.com>
2022-08-02 13:40:04 -05:00
Johann Fischer 5e5ea9a21d drivers: use unsigned int for irq_lock()
irq_lock() returns an unsigned integer key.
Generated by spatch using semantic patch
scripts/coccinelle/irq_lock.cocci

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-07-14 14:37:13 -05:00
Pieter De Gendt 90af62243e drivers: hwinfo: shell: Add missing reset cause strings
The hwinfo shell commands was missing human readable names for
* RESET_HARDWARE
* RESET_USER
* RESET_TEMPERATURE

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-07 17:59:19 +00:00
Gerard Marull-Paretas e00ad413d9 drivers: hwinfo: mcux: update include paths
Use the <zephyr/...> prefix.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 12:45:29 -04:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Daniel DeGrasse 58a2b15972 drivers: hwinfo: implemented hardware info support for RT11xx SOC
RT11xx SOC uses same system reset controller as RT10xx series. Add
support for SRC on RT11xx

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-06 11:33:26 +02:00
Michal Sieron 5098aaa2d1 hwinfo: hwinfo_litex: Make compatible with both 8 and 32-bit CSRs
LiteX CSRs can only be accessed on addresses aligned to 4 bytes.
That's why in 32-bit CSRs case there is bit shifting needed.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Joakim Andersson 2dae1823ab hwinfo: Add dependency handling for HWINFO_NRF in nonsecure
The limitation on HWINFO_NRF depending on not nonsecure was removed in
52be3030aa.
This caused problems when TF-M was not enabled.

This happens on the thingy53_nrf5340_cpuapp_ns board since this board
is not supported by TF-M.

Introduce proper dependency handling for the soc secure functions
to make HWINFO_NRF unavailable when no secure services exist in
nonsecure.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-04-07 11:02:52 -04:00
Joakim Andersson 52be3030aa drivers: hwinfo: Remove HWINFO_NRF limitation for non-secure config
Remove the limitiation in HWINFO_NRF not working in non-secure
configuration. Use the exposed soc_secure_read_deviceid function
that accesses the device ID through the secure services.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-04-04 11:15:28 +02:00
Cezar Burlacu 27da68cfb2 hwinfo shell: reset_cause fix
`reset_cause` with no arguments will print the device id.
Change it to print the reset cause.

Tested on nucleo_f767zi.

Signed-off-by: Cezar Burlacu <cezar@embeddedp.ro>
2022-03-22 12:33:11 +01:00
Yonatan Schachter 72c61f1005 drivers: hwinfo: Added reset cause support for RPi Pico
Added support for hwinfo's reset cause functions, for the Raspberry Pi
Pico series.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-03-16 10:24:32 +01:00
Yonatan Schachter 90b20fffa4 drivers: hwinfo: Added unique ID support for RPi Pico
Added support for hwinfo's hwinfo_get_device_id for the
RPi Pico series.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-03-16 10:24:32 +01:00
Nazar Kazakov 9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Gerard Marull-Paretas 95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Pieter De Gendt 1e747eca0d drivers: hwinfo: sam: Introduce RSTC driver
Add a new hwinfo driver to get the reset cause on
SAM4S/SAME70/SAMV71 SoC series.

The user-nrst dts property has been added to enable external user
resets.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-02-28 10:53:57 +01:00
Alexander Wachter ecd7c23daa drivers: hwinfo: shell: Add reset cause shell command
This commit adds shell commands for the reset cause API
- show: show the persistent reset cause
- clear: clear the persistent reset cause
- supported: list all supported reset causes

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2021-11-07 14:55:52 -05:00
Alexander Wachter 5db37b12a3 drivers: hwinfo: shell: rename args to satisfy rule 5.7
This commit changes the shell argument name from shell to sh
to satisfy the warning
"Violation to rule 5.7 (Tag name should be unique) tag: shell"

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-11-07 14:55:52 -05:00
Kumar Gala fb4d68973f shell: Fix various build issues with string formattors
We get a few different CI failures associated with data type
differences on various platforms.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-10-20 10:54:38 -05:00
Pieter De Gendt 4e2bb0e762 drivers: hwinfo: add reset cause support for iMX RT series
Add a shim driver to get/clear the reset reason on NXP i.MX
RT controllers

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-09-29 14:44:21 -04:00
Daniel Leung 6edd223772 drivers: hwinfo: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Henrik Brix Andersen b7b7709eec drivers: hwinfo: add NXP MCUX RCM hwinfo driver
Add driver shim for the NXP MCUX Reset Control Module (RCM) for
determining reset cause.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-07-08 09:33:32 -05:00
Mahesh Mahadevan 0057c5753b drivers: hwinfo: Update i.MX RT Hwinfo driver
Add support for RT1170. The fuse register that holds
the unique device ID is different as compared to the
RT10XX series

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-06-29 11:30:00 -04:00
Kumar Gala b12c6dbeec drivers: hwinfo: Fix building of NXP LPC syscon driver
The NXP LPC syscon driver failed to build on several platforms for
various reasons.  We need dts support on LPC55s1x and LPC55s2x, the
driver doesn't seem like it will work on LPC54114 so we exclude it
there for now.

Additionally, fix a dtc warning on LPC55s6x based on unit-address in
the node naming needing to be lowercase.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-24 12:39:18 -05:00
Mahesh Mahadevan 6dbffcb2a8 hwinfo: Support NXP LPC family
add hwinfo driver support for NXP's LPC family.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-06-23 18:24:08 -05:00
Kumar Gala fb57b23a37 drivers: hwinfo: Exclude GECKO driver on EFR32MG21
The EFR32MG21 doesn't have a RMU and thus the driver isn't relevant for
that SoC series.  Add a Kconfig exclusion so the driver isn't available
on EFR32MG21 SoCs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-12 08:48:16 -05:00
Kumar Gala f1affb5e67 drivers: hwinfo: gecko: Fix build
Fix how HAS_BROWNOUT so things build correct and without warnings.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-11 16:23:05 -05:00
Yonatan Schachter 782c9b7973 drivers: hwinfo: Added Gecko support for reset cause
This commit provides implementations for the reset cause
API functions as part of hwinfo.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2021-06-10 17:10:28 -04:00
Arvin Farahmand 98a0ccd5c5 drivers: hwinfo: Add reset cause support
Add `hwinfo_get_reset_cause` and `hwinfo_clear_reset_cause` to retrieve
and to clear cause of system reset on supported platforms.

Different platforms can provide different causes of reset, however
there is a great deal of overlap. `enum reset_cause` can be expanded in
the future to support additional reasons, as additional platforms are
supported.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-06-08 10:16:17 +02:00
Flavio Ceolin 6771f7bb90 drivers: hwinfo: Remove invalid comparison
size_t is never lesser than zero. Just remove it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-26 07:13:13 -04:00
Sun Amar 1be7937f4e hwinfo: support exx32 family
add hwinfo driver support for the
exx32 gecko family.

Signed-off-by: Sun Amar <sun681@gmail.com>
2021-02-22 17:44:33 +03:00
Martin Jäger 39d388287f drivers: hwinfo: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Gerson Fernando Budke 03ef8feeb6 drivers: hwinfo: Add cypress psoc6 hwinfo support
Introduce Cypress PSoC-6 hwinfo driver.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2020-10-21 07:20:13 -05:00
Gerson Fernando Budke bca8e83cab drivers: hwinfo: sam: Add sam4l hwinfo support
Add initial version.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-09-04 16:29:19 -05:00
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Anas Nashif ee985d81aa shell: enable modules by default if shell is enabled
If shell is enabled then enable all sub-shells if their dependencies are
satisfied. This was done for some modules and subsystems but was not
consistent.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-24 21:37:12 -04:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Peter Bigot 82d4fcc1bf drivers: hwinfo: fix ESP32 implementation
Add the missing prefix z_ required to make the ESP32 version override
the weak implementation.

General practice in ESP32 seems to be to use the MAC address, so
extract that in its canonical byte order.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-28 15:32:53 -04:00
Peter Bigot 736860ac90 drivers: hwinfo: update mcux-sim implementation byte order
Following the practice for i.MX decoding assume the 32-bit identifier
values need to be converted to big-endian representation for
device-independent interpretation.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-22 17:31:56 +02:00
Peter Bigot 1668c21e17 drivers: hwinfo: update i.MX implementation byte order
Resources indicate that CFG2 holds the upper 32 bits, and CFG1 the
lower 32 bits, of a 64-bit unique identifier.  Store it in big-endian
format so it reads correctly when accessed as a byte sequence.

https://community.nxp.com/docs/DOC-94459

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-22 17:31:56 +02:00
Peter Bigot 8c749ffc0a drivers: hwinfo: update stm32 implementation byte order
The unique identifier for this platform is a 96-bit value, where the
upper 56 bits provide an ASCII encoding of the lot number, and the
lower 40 bits provide the wafer number and X, Y position on the wafer.
Extract the value into big-endian form for device-independent
interpretation.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-20 19:04:26 +02:00
Steven Slupsky c54f7ec1fc drivers: hwinfo: fix endianness for sam0 and nrf
HWINFO drivers should be responsible for ensuring that
the data structure is a sequence of bytes. That is not
what the current sam0 and nordic drivers do. The drivers
read the data as u32_t and then memcpy the data to a
buffer. This ensures the data has the endianness of the
underlying MCU, which in this case is Cortex M0 which
is little endian.

This commit fixes the endianness so the data can be
interpreted as a "left to right sequence of bytes".

This commit updates the API doc to provide clarification
of the data structure.
Add to 2.3 release notes.

Fixes #23444, #24103

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
2020-04-09 19:30:32 +02:00
Kumar Gala a5daf74467 drivers: hwinfo: atmel_sam: Replace DT_FLASH define
Replace DT_FLASH_DEV_BASE_ADDRESS with new DT_REG_ADDR/DT_INST macro as
we phase out DT_FLASH define usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-09 08:41:09 -05:00
Kumar Gala 88469b7010 drivers: litex: Convert litex drivers to new DT_INST macros
Convert older DT_INST_ macro use in litex drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 12:49:43 -05:00
Kumar Gala 28870e7a32 drivers: atmel sam0: Convert atmel sam0 drivers to new DT_INST macros
Convert older DT_INST_ macro use in atmel sam0 drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 11:02:57 -05:00
Alexander Wachter a22f0ac1ab drivers: hwinfo: Don't disable CLOE on SAM3x seies
CLOE (Code Loop Optimization) does not exist on SAM3x.
Make the EEFC_FMR_CLOE disable depending on CONFIG_SOC_SERIES_SAM3X.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-02-27 21:14:54 +01:00