Commit graph

8573 commits

Author SHA1 Message Date
Antony Pavlov 0369998e61 arch: add MIPS architecture support
MIPS (Microprocessor without Interlocked Pipelined Stages) is a
instruction set architecture (ISA) developed by MIPS Computer
Systems, now MIPS Technologies.

This commit provides MIPS architecture support to Zephyr. It is
compatible with the MIPS32 Release 1 specification.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
2022-01-19 13:48:21 -05:00
Neil Armstrong c65016b4d3 pcie: add Type 1 bridge config defines
Add config registers defines for the Type 1 bridge endpoints.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Neil Armstrong 43a47ce18a pcie: controller: add callback to get allocation base
When enumerating bridges, the allocated memory base and limit must be
programmed in the bridge config registers.

The base is programmed when starting enumerating the bridge and the
limit is programmed when all endpoints of the bridge and sub-bridges
are enumerated.

Add a second callback to get the base of the next allocation in
order to fill these base & limit values.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Flavio Ceolin 6ab08bc9fd pm: device: Additional note about on/off actions
Add a note to clarify that these actions are only used by power
domains to notify children.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-01-19 13:35:32 -05:00
Jordan Yates 7101899328 pm: device_runtime: init into PM_DEVICE_STATE_OFF
Add a function to tell runtime power management that the device is
starting in the off state instead of active or suspended.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00
Jordan Yates 3f7f8d8f75 pm: device: helper to query power domain
Adds a helper for devices to check if they are on a power-domain or not.
Drivers can use this information to determine if they will be turned on
at some point in the future, or if they are already turned on.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00
Jordan Yates 9e9fb319a7 pm: device: helper for running actions on children
Adds a helper function for running PM actions on child devices. A custom
implementation of `device_supported_foreach` is used as we don't
necessarily want the early exit behaviour of that function in the power
domain context.

The early exit behaviour can be obained through a return value in the
failure callback if that is desired.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00
Jordan Yates 79f382e96e pm: device: add action to turn device on
Adds `PM_DEVICE_ACTION_TURN_ON` to transition from `PM_DEVICE_STATE_OFF`
to `PM_DEVICE_STATE_SUSPENDED`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00
Flavio Ceolin 2e732dff6d pm: device: Make power domain optional
Add a Kconfig symbol to enable/disable power domain on Zephyr.
Disabling power domain save some memory / space.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-01-19 13:35:32 -05:00
Flavio Ceolin ddfa048058 pm: Add power domain infra structure
Add support for power domains on Zephyr. Power domains are implemented
as simple devices so they can use the existent Zephyr API, for resume
and suspend sync and async and also reference count.

The pm subsystem will ensure that domains are resumed before and
suspended after devices using them. For device runtime power
management, every time the device is got or released the same actions
is done to the domain it belongs.

As domains are implemented as simple devices, it is totally acceptable
a domain belongs to another domain.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-01-19 13:35:32 -05:00
Henrik Brix Andersen f5f93e5fba drivers: can: add error-warning state
Add CAN controller error-warning state and document the relationship
between CAN controller states and CAN controller RX/TX error counter
values.

Fixes: #21010

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 18:34:26 +01:00
Gerard Marull-Paretas 435213a753 drivers: remove redundant data/config casts
Some drivers explicitely casted data/config from void * to the
corresponding type. However, this is unnecessary and, in many drivers it
has been misused to drop const qualifier (refer to previous commits).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Krzysztof Chruscinski ff6b5d979f soc: arm: nordic_nrf: nrf53: Add Synchronized RTC
Add a module which is responsible for getting offset between RTCs
used for system clock on NET and APP cores. After getting an offset
between NET and APP clocks, it can be used for logging timestamping
on NET core to ensure that timestamping is in sync on both cores.

Synchronization is done using PPI, IPM task and events and RTC
capture feature.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-19 17:46:28 +01:00
Krzysztof Chruscinski ec9a32481b drivers: timer: nrf_rtc_timer: Add z_nrf_rtc_timer_capture_task_address_get
Add function for getting address of RTC capture task.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-19 17:46:28 +01:00
Krzysztof Chruscinski da1bfd6ffa drivers: timer: nrf_rtc_timer: Add missing include
k_timeout_t is used in the header but sys_clock.h was not included.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-19 17:46:28 +01:00
Neil Armstrong 9463525347 pcie: controller: rename generic_pcie_ to pcie_generic_
As suggested by Tomasz Bursztyka, it's clearer to move generic after the
domain prefix, here pcie.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 09:47:59 -05:00
Neil Armstrong 6595ca1a35 pcie: controller: rename xlate to translate
As suggested by Tomasz Bursztyka, translate is clearer than xlate in
the PCIe controller functions and callbacks names.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 09:47:22 -05:00
Daniel Leung e783e3c12b drivers: introduce memory management driver APIs
This introduces new APIs for memory management hardware which
are not traditionally associated with an architecture (e.g.
MMU on ARM and x86) and thus not implemented in architecture
code.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-18 19:18:30 -05:00
Anas Nashif 01b7800bc8 include: remove deprecated headers
Remove all deprecated headers which were moved to a different location.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-01-18 19:17:50 -05:00
Henrik Brix Andersen 5598ae85c0 drivers: can: fix can_set_state_change_callback() API function
Remove "return" statement from can_set_state_change_callback() API
wrappper function (which is a void function).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-18 15:26:17 -05:00
Torbjörn Leksell e955b6540d Tracing: Fixed TraceRecorder inclusion problem
Moved conditional inclusion of tracing_tracerecorder.h
from the start of tracing.h to the bottom. This was the
initial placement of this include but it was moved as
part of PR #40126. If this file is included at the
start of tracing.h the TraceRecorder module hooks
will not map correctly and completely breaks
that module.

Signed-off-by: Torbjörn Leksell <torbjorn.leksell@percepio.com>
2022-01-18 14:15:54 -05:00
Daniel DeGrasse 19bb8e2ec8 soc: rt11xx: Enable power management for RT11xx series SOCs
Enables basic power management for the RT11xx series SOCs. The following
power saving measures are currently implemented:

- system reduces core voltage during sleep
- core clock can be gated in deep sleep

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 14:09:45 -05:00
Emil Gydesen 0785e9479d Bluetooth: ISO: Add function to get info of ISO channel
The application may want to want the type of an
ISO channel, and take action based on what the type is.

It has been implemented as a get_info to be
consistent with other get_info functions in the
Bluetooth subsystem.

The bt_iso_info struct can be expanded with more information
later as required.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 13:19:47 -05:00
Emil Gydesen c6b78b93d9 Bluetooth: ISO: Add ISO channel type
Add a enum for the ISO channel type instead of using
a boolean for just bis/cis.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 13:19:47 -05:00
Andrew Hedin 7f004f1b35 net: lwm2m: Add LwM2M gateway object
Add support for the gateway object [EXPERIMENTAL] used by the
MG100, BT510, and BT610 LwM2M demo.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2022-01-18 13:19:12 -05:00
Krzysztof Chruscinski 50c7c7b1e4 sys: time_units: Add Kconfig option for algorithm selection
Add maximum timeout used for conversion to Kconfig. Option is used
to determine which conversion algorithm to use: faster but overflowing
earlier or slower without early overflow.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-18 13:11:52 -05:00
Krzysztof Chruscinski fb5334d2cf sys: time_units: Increase range of z_tmcvt
Avoid result overflow due to intermediate product overflow.
Algorithm was multiplying input value by target frequency
before dividing it by source frequency. If target frequency was
high (e.g. conversion to nanoseconds) it could easily lead to
overflow even though final result would not overflow. Adjusting
algorithm to avoid that.

Note, that typically this code is resolved at compile time so
it will not impact performance as long as it can be resolved.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-18 13:11:52 -05:00
Jim Shu fd2c07682e arch: riscv: pmp: Fix is_user_mode in RV64
Currently, is_user_mode is 8-byte in riscv64 and it breaks a 4-byte PMP
region protecting it. Because is_user_mode is a single flag, we could
just fix it's size to 4-byte in both riscv32 and riscv64.

Signed-off-by: Jim Shu <cwshu09@gmail.com>
2022-01-18 13:11:36 -05:00
Jim Shu 10e618ff33 arch: riscv: pmp: Fix RV64 compatibility of register size
In RV64, all general-purpose registers and pmpcfg CSR are 64-bit
instead of 32-bit. Fix these registers and related C variables/literals
to be 32/64-bit compatible.

Signed-off-by: Jim Shu <cwshu09@gmail.com>
2022-01-18 13:11:36 -05:00
Emil Gydesen f8c20ec76a Bluetooth: Add reference to BT_HCI_ERR_* for disconnect reason
Add reference to BT_HCI_ERR_* for ACL and ISO disconnect
reason.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 13:10:40 -05:00
Gerard Marull-Paretas d80d47000b pm: device: add parentheses to Z_PM_DEVICE_GET
Improve the macro by adding surrounding parentheses.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-18 12:14:06 -05:00
Gerard Marull-Paretas ddc168fa78 pm: s/PM_DEVICE_(DT_(INST))_REF/PM_DEVICE_(DT_(INST))_GET
In order to align with macros used to obtain a device reference (e.g.
DEVICE_DT_GET), align the PM macros to use "GET" instead of "REF". This
change should have low impact since no official release has gone out yet
with the "REF" macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-18 12:14:06 -05:00
Emil Gydesen ffd4fd571a Bluetooth: CSIS: Merge the two client discovery functions
Merges bt_csis_client_discover and
bt_csis_client_discover_sets, as they should be done
together for the discovery procedure from the CSIP
spec.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen e9703294b1 Bluetooth: CSIS: Rename bt_csis_client_set
Rename struct bt_csis_client_set to
struct bt_csis_client_csis_inst, as that is more descriptive
of the actual content of the struct.

This also avoids the confusion about what a "set" is,
which is clearly not a single instance of CSIS
on a single remote server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 47e23ab344 Bluetooth: CSIS: Add bt_csis_client_set_info struct
Several APIs worked on the bt_csis_client_set struct,
which not only included information about a set, but
also a reference to a specific CSIS instance.

A specialized struct only for the set information
is more useful in those scenarios.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen c075ec28a3 Bluetooth: CSIS: Update minor documentation for the CSIS server
A few of the functions were poorly or wrongly described.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 3953289fda Bluetooth: CSIS: Modify bt_csis_client_get_lock_state to read all members
Modify bt_csis_client_get_lock_state to be the Ordered Access
procedure, which means that instead of reading a single lock value
on a single device, it will read the lock value for all
set members supplied in the function, and return true if any
of them is locked, or false otherwise.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 9c5f30a64c Bluetooth: CSIS: Rename bt_csis_client_lock_get
Rename bt_csis_client_lock_get to
bt_csis_client_get_lock_state. `get` could be
misunderstood as acquire, i.e. that `get` would
mean that the lock was taken by this device.

The new name should make it more obviously that it
is just a read procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen ebb962dfc3 Bluetooth: CSIS: Document missing functions in csis.h
Document the functions and callbacks, macros, etc. that
was missing in the file.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen f13aa0e059 Bluetooth: CSIS: Remove addr from bt_csis_client_set_member
Remove the addr struct from bt_csis_client_set_member as that
was only used by the upper layers and not the CSIS client
itself, and as such should only reside in the
upper layers.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen f2401ecbe9 Bluetooth: CSIS: Don't expose SIRK type to upper layers
Change how the SIRK is exposed to the upper layers.
The SIRK will always be the unencrypted 16 octet
SIRK now, instead of a struct.

This not only allows us to avoid having a
__packed struct in the API, but also gives a better
API as we don't expose encrypted data to the upper layers.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen e7ec241fe7 Bluetooth: CSIS: Remove BT_CSIS_ERROR_SIRK_ACCESS_REJECTED
Remove the error code BT_CSIS_ERROR_SIRK_ACCESS_REJECTED
as it no longer exists in the specification.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 170d094ca8 Bluetooth: CSIS: Refactor bt_csis_client_lock_get to use member
Refactor the bt_csis_client_lock_get function to use a
pointer to a member and a set instead of a bt_conn
pointer and an index.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 9c3745a69b Bluetooth: CSIS: Refactor bt_csis_client_lock_read_cb to use set
Refactor the bt_csis_client_lock_read_cb callback to use
a bt_csis_client_set pointer instead of conn and index.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 061fb633a5 Bluetooth: CSIS: Remove conn from bt_csis_client_lock_changed_cb
The connection pointer can be inferred based on the
set pointer, by using e.g. CONTAINER_OF.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen fa1be6436a Bluetooth: CSIS: Refactor bt_csis_client_discover_sets to use member
Refactor bt_csis_client_discover_sets to use the
bt_csis_client_set_member struct instead of a bt_conn.
The bt_csis_client_set_member represents a remote server
(set member), and make it possible to avoid sending indexes
of instances around instead of bt_csis.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 728f390f65 Bluetooth: CSIS: Remove unused functions and callbacks from csis.h
Remove the lock and release sets functions, as well
as the discover member function as they have been removed
from the implementation a while ago.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 2bf89990ee Bluetooth: CSIS: Expose bt_csis to client via bt_csis_client_set_member
Use the bt_csis_client_set_member struct to store the individual
bt_csis client struct. This way they are exposed to the
client application.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Emil Gydesen 60181a183f Bluetooth: CSIS: Add array of bt_csis to discovery function
Add an [out] array to the discovery function and
an array to the discovery callback of bt_csis structs.
These should be used instead of bt_conn pointers for
CSIS client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-18 10:40:33 -05:00
Henrik Brix Andersen ea355a0032 drivers: can: document the expected behavior for lost arbitration or NACK
Document the expected driver behavior for can_send()/can_write() when
loosing bus arbitration or when a frame is not acknowledged.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-17 21:09:17 -05:00