Commit graph

56786 commits

Author SHA1 Message Date
Siew Chin Lim ccebf5885f soc: arm64: Add Kconfig files for Intel SoC FPGA
Add Kconfig files for intel_socfpga folder.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
2021-10-12 08:37:03 -04:00
Siew Chin Lim f1a6cc14c0 soc: arm64: Add MMU table for Intel SoC FPGA Agilex
Add MMU table for Intel SoC FPGA Agilex initial bring up.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
2021-10-12 08:37:03 -04:00
Siew Chin Lim 31f5f511eb soc: arm64: Add common header files for Intel SoC FPGA
Add common header files for Intel SoC FPGA. The header files define the
handoff data structure and system manager base addresses needed by
Agilex initial bring up.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
2021-10-12 08:37:03 -04:00
Siew Chin Lim 0c34373720 drivers: clock_control: Add clock driver for Intel SoC FPGA Agilex
Add clock driver for Intel SoC FPGA Agilex.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
2021-10-12 08:37:03 -04:00
Siew Chin Lim 5b6c59397e include: common: Add sys_set_bits and set_clear_bits inline functions
Add new common inline functions sys_set_bits and set_clear_bits to set
and clear multiple bits via bit mask in single function call.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
2021-10-12 08:37:03 -04:00
Carlo Caione 43cb00df08 multi_heap: Introduce shared multi-heap memory pool manager
The shared multi-heap memory pool manager uses the multi-heap allocator
to manage a set of reserved memory regions with different capabilities /
attributes (cacheable, non-cacheable, etc...) defined in the DT.

The user can request allocation from the shared pool specifying the
capability / attribute of interest for the memory (cacheable /
non-cacheable memory, etc...)

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-10-12 07:44:46 -04:00
Krzysztof Chruscinski 863600cd0e doc: releases: Add note about UART Asynchronous API change
Added note to release notes about timeout units used in
uart_tx and uart_rx_enable.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-12 12:26:56 +02:00
Krzysztof Chruscinski c590b3545a drivers: serial: Use microseconds to represent timeout
Updated uart_rx_enable() and uart_tx() to use timeout given
in microseconds. Previously argument was given in milliseconds.
However, there are cases when milliseconds granularity is not
enough and can significantly reduce a throughput, e.g. 1ms is
100 bytes at 1Mb.

Updated 4 drivers which implement asynchronous API. Updated
places where API was used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-12 12:26:56 +02:00
Krzysztof Chruscinski cc69ca1a9b sys: time_units: Add SYS_FOREVER_US macro
Add macro for representing forever timeout in microseconds.
Macro is similar to already existing SYS_FOREVER_MS.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-12 12:26:56 +02:00
Joakim Andersson 0f53679859 modules: tfm: Use ZEPHYR_<MODULE>_MODULE_DIR instead of relative paths
Use ZEPHYR_<MODULE>_MODULE_DIR instead of relative paths. Moving the
module folder would otherwise break the build system.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-10-11 21:05:30 -04:00
Emil Gydesen 6e99941f6a Bluetooth: ISO: Remove bt_iso_data_path struct
The struct basically only had a pointer to
bt_iso_chan_path as well as duplicating the pid and
the direction.

The commit removes the struct as it was more confusing than helpful,
and instead use the PID for the bt_iso_chan_path and
supply the direction as a argument instead.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-10-11 21:05:05 -04:00
Emil Gydesen f546ef4cde Bluetooth: ISO: Fix missing fallback to HCI for ISO data path
A recent change broke the fallback to using a simple
HCI data path configuration in case that the application
does not provide a data path.

This commit fixes that issue, while retaining the
intended update from the change that broke the fallback,
as well as making the code a bit easier to read
and more documented.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-10-11 21:05:05 -04:00
Thomas Ebert Hansen e69b159c34 Bluetooth: host: Fix endianess bug in value_handle
The characteristic value handle is missing an endianess conversion.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2021-10-11 21:04:51 -04:00
Pavel Hübner 7504265e47 drivers: lis2dh: Add names to choices in Kconfig
Unless a choice is named, its default value
cannot be changed in another Kconfig file.

Signed-off-by: Pavel Hübner <pavel.hubner@hardwario.com>
2021-10-11 21:04:09 -04:00
Yuriy Vynnychek 8e5eb1732d drivers: uart: irq_tx_ready info update with TX IRQ dependencies
irq_tx_ready API should return 1 only in case if TX IRQ is enabled.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-10-11 21:02:21 -04:00
Yuriy Vynnychek 1242f5129d drivers: serial: b91: irq_tx_ready update to check TX IRQ
Updated b91_irq_tx_ready API to check TX IRQ enabled.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-10-11 21:02:21 -04:00
Piotr Pryga 1c8af8cfe5 Bluetooth: controller: df: fix handling of max count of IQ reports
There was an error in handling of max number of IQ reports
generated by controller. Accordin to BT Core Spec 5.1 the host
may request a number of CTEs to be sampled and reported by
controller while enable IQ sampling. The max_cte_count value
set to zero means sample all CTEs in a periodic advertising chain.

The commit fixes wrong handling of the max_cte_count provided
value to generate expected number of IQ reports.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-11 21:01:36 -04:00
Nicolas Pitre cf49699b0d net: sockets: socketpair: fix locking
The irq_lock() usage here is incompatible with SMP systems, and one's
first reaction might be to convert it to a spinlock.

But are those irq_lock() instances really necessary?

Commit 6161ea2542 ("net: socket: socketpair: mitigate possible race
condition") doesn't say much:

> There was a possible race condition between sock_is_nonblock()
> and k_sem_take() in spair_read() and spair_write() that was
> mitigated.

A possible race without the irq_lock would be:

thread A                thread B
|                       |
+ spair_write():        |
+   is_nonblock = sock_is_nonblock(spair); [false]
*   [preemption here]   |
|                       + spair_ioctl():
|                       +   res = k_sem_take(&spair->sem, K_FOREVER);
|                       +   [...]
|                       +   spair->flags |= SPAIR_FLAG_NONBLOCK;
|                       *   [preemption here]
+   res = k_sem_take(&spair->sem, K_NO_WAIT); [-1]
+   if (res < 0) {      |
+     if (is_nonblock) { [skipped] }
*     res = k_sem_take(&spair->sem, K_FOREVER); [blocks here]
|                       +   [...]

But the version with irq_lock() isn't much better:

thread A                thread B
|                       |
|                       + spair_ioctl():
|                       +   res = k_sem_take(&spair->sem, K_FOREVER);
|                       +   [...]
|                       *   [preemption here]
+ spair_write():        |
+   irq_lock();         |
+   is_nonblock = sock_is_nonblock(spair); [false]
+   res = k_sem_take(&spair->sem, K_NO_WAIT); [-1]
+   irq_unlock();       |
*   [preemption here]   |
|                       +   spair->flags |= SPAIR_FLAG_NONBLOCK;
|                       +   [...]
|                       +   k_sem_give(&spair->sem);
|                       + spair_read():
|                       +   res = k_sem_take(&spair->sem, K_NO_WAIT);
|                       *   [preemption here]
+   if (res < 0) {      |
+     if (is_nonblock) { [skipped] }
*     res = k_sem_take(&spair->sem, K_FOREVER); [blocks here]

In both cases the last k_sem_take(K_FOREVER) will block despite
SPAIR_FLAG_NONBLOCK being set at that moment. Other race scenarios
exist too, and on SMP they are even more likely.

The only guarantee provided by the irq_lock() is to make sure that
whenever the semaphore is acquired then the is_nonblock value is always
current. A better way to achieve that and be SMP compatible is to simply
move the initial sock_is_nonblock() *after* the k_sem_take() and remove
those irq_locks().

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-10-11 21:00:41 -04:00
Neil Armstrong c24d0c8405 arm64: mmu: implement arch_virt_region_align()
Add the arm64 MMU arch_virt_region_align() implementation used
to return a possible virtual addres alignment in order to
optimize the MMU table layout and possibly avoid using L3 tables
and use some L1 & L3 blocks instead for most of the mapping.

Suggested-by: Nicolas Pitre <npitre@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-10-11 21:00:28 -04:00
Neil Armstrong 7830f87ccd mmu: get virtual alignment from physical address
On ARM64 platforms, when mapping multiple memory zones with size
not multiple of a L2 block size (2MiB), all the following mappings
will probably use L3 tables.

And a huge mapping will consume all possible L3 tables.

In order to reduce usage of L3 tables, this introduces a new
arch_virt_region_align() optional architecture specific
call to eventually return a more optimal virtual address
alignment than the default MMU_PAGE_SIZE.

This alignment is used in virt_region_alloc() by:
- requesting more pages in virt_region_bitmap to make sure we request
  up to the possible aligned virtual address
- freeing the supplementary pages used for alignment

Suggested-by: Nicolas Pitre <npitre@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-10-11 21:00:28 -04:00
Carlo Caione 6c00e980b2 ipc: ipc_service: Rework multi-instance backend.
Only one single IPC service backend is currently present: multi_instance
backend. This backend is heavily relying on the RPMsg multi_instance
code to instanciate and manage instances and endpoints. Samples exist
for both in the samples/subsys/ipc/ directory.

With this patch we are "unpacking" the RPMsg multi_service code to make
it more modular and reusable by different backends.

In particular we are re-organizing the code into two helper libraries:
an RPMsg library and a VRING / virtqueues static allocation library. At
the same time we rewrite the multi_instance backend to make fully use of
those new libraries and remove the old multi_instance sample.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-10-11 20:58:09 -04:00
Carles Cufi 6a3593f4af west: runners: Add a deprecation action to the core code
In order to allow for further options to be deprecated with minimal
impact, add a deprecation argparse Action and a callable instantiator
that can be used to deprecate options in favor of new ones.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-10-11 20:56:27 -04:00
Carles Cufi 2ccfd22594 runners: pyocd: Convert to -i/--dev-id
Remove the previous pyocd-specific --board-id option and switch to
the common -i/--dev-id one.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-10-11 20:56:27 -04:00
Carles Cufi 285c2cabf1 runners: dfu-util: Convert to -i/--dev-id
Remove the previous dfu-util-specific --pid option and switch to the
common -i/--dev-id one.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-10-11 20:56:27 -04:00
Carles Cufi e3e23a51bb runners: canopen: Convert to -i/--dev-id
Remove the previous canopen-specific --node-id option and switch to the
common -i/--dev-id one.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-10-11 20:56:27 -04:00
Carles Cufi 5ee719ee9d runners: nrfjprog: Convert to -i/--dev-id
Remove the previous nrfjprog-specific --id option and switch to the
common -i/--dev-id one.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-10-11 20:56:27 -04:00
Carles Cufi f6b13ddb6f runners: jlink: Convert to -i/--dev-id
Remove the previous jlink-specific --id option and switch to the common
-i/--dev-id one.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-10-11 20:56:27 -04:00
Carles Cufi 898f65f53c runners: Add new common -i/--dev-id command-line option
In an effort to standardize the way that a particular debugger or device
instance is identified when there are multiple present, introduce a new
-i/--dev-id option common to all runners that allows the user to specify
which device to interact with when there are multiple connected.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-10-11 20:56:27 -04:00
Andrzej Głąbek c6e55d46de doc: release: Add release notes for ADC, DMIC, I2S, and PWM drivers
Update v2.7 release notes with entries for added ADC, DMIC, I2S,
and PWM drivers.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-10-11 15:37:49 -05:00
Christopher Friedt 65b1c207f2 net: mdns + dns_sd: fix regression that breaks ptr queries
While adding support for service type enumeration, a regression was
introduced which prevented mDNS ptr query responses.

1. There was an off-by-one error with label size checking
2. Valid queries were failing to match in `dns_rec_match()` due to
   not checking for either NULL or 0 "wildcard" port

Fixes #39284

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-10-11 08:50:45 -04:00
Jordan Yates 9c4366f1ae cmake: remove LINKER_PASS2 define
This option was deprecated for the v2.6 release, and has therefore met
the 2 release deprecation cycle requirements.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-11 10:21:53 +02:00
Glauber Maroto Ferreira 7468121f19 esp32s2: drivers: spi: add driver support
and hooks to spi_loopback test.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-10 14:52:41 -04:00
Glauber Maroto Ferreira 26131ba5d4 esp32: drivers: spi: driver refactoring
in preparation to support other esp32-family socs

on top of existing driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-10 14:52:41 -04:00
Glauber Maroto Ferreira fb1632925e soc: esp32: partial code standardization
Replaces the prefixes of gpio_matrix_in and gpio_matrix_out
to unify those function calls on all supported socs.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-10 14:52:41 -04:00
Peter Mitsis e231d50535 tracing: fix k_thread_abort tracing references
Fixes undefined references to sys_port_trace_k_thread_abort_enter()
and sys_port_trace_k_thread_abort_enter().

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2021-10-08 17:33:40 -04:00
Kumar Gala 80981dc489 boards: arm: nxp: Add pinctrl-names
Add "pinctrl-names" property for "default" to all NXP kinetis
based boards.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-10-08 10:28:37 -05:00
Francois Ramu 41833951b0 dts: arm: stm32u5 fix register address for spi3 node
this commit is correcting the address of the spi3 bank

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-08 08:32:52 -05:00
Andrzej Głąbek 165c14dc60 drivers: pwm_nrfx: Fix handling of zero length periods
When the driver was called to set the period length for a channel
to 0, it set the COUNTERTOP register in the PWM peripheral to 0,
what resulted in an undefined behavior of the peripheral (and lack
of the STOPPED event sometimes).
The PWM API does not precise how should a zero length period be
handled; some drivers return the -EINVAL error in such case, some
do not. This patch fixes the pwm_nrfx driver so that it does not
change the previously used COUNTERTOP register value when the period
length is set to 0, and because the pulse cycles are always limited
by the driver to period cycles (so 0 in this case), in result the
relevant channel is simply deactivated. This allows users to switch
off a channel by requesting the pulse width to be set to 0 without
providing a non-zero period in such call.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-10-08 13:06:40 +02:00
Tim Lin 41c9b71450 ITE: soc: add cpu idle task
Implement the CPU idle task. The system should enter this task when
there is no any task to ensure power saving.

Tested on it8xxx2_evb board. It will reduce 12.5mA when system enters
the CPU idle task.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-10-08 13:01:06 +02:00
Pieter De Gendt d5520f2e59 debug: coredump: flash backend: fix header if stream erase
If CONFIG_STREAM_FLASH_ERASE is set, a page erase is done before
writing the coredump header to the flash. If the flash page erase size
is larger than the flash write size this results in erasing part of
the coredump data.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-10-08 13:00:57 +02:00
Pieter De Gendt 1dc74d70f2 debug: coredump: flash backend: fix stream API data size
The stream api initialization for the coredump flash backend used an
incorrect size.

This commit subtracts the header size.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-10-08 13:00:57 +02:00
Sylvio Alves 06a624f2a3 soc: esp32: add west debug support
This adds west debug support for ESP32
and ESP32S2 boards using custom openocd tool.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-10-08 12:59:55 +02:00
Sylvio Alves 49bcc08033 openocd: add hardcoded configs as input parameters
Debugging ESP32 SoCs is not possible if the commands
halt, target and load are enabled by default.
This MR allows this configs to be used as input parameters.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-10-08 12:59:55 +02:00
Piotr Pryga 39c535fef8 Bluetooth: controller: Make per adv filtering by CTE cond compilable
The filtering of periodic advertisements by scanner may be not needed
in certain situations e.g. while use of periodic advertising by BT ISO.
To make the code smaller and avoid execution of not needed code the
functionality will be conditionally compilable. It may be enabled
or disabled by use of CONFIG_BT_CTLR_SYNC_PERIODIC_CTE_TYPE_FILTERING
Kconfig option.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-07 21:36:55 -04:00
Piotr Pryga b61101144a tests: Bluetooth: bsim_test_iso: Change wait time in BIG receiver
The receiver and transmitter in the test are synchronized by
use of sleep functions. The change in handling of periodic
advertising synchronized event caused missmach in waiting
times. Receiver is notified about established synchronization
later that it was in the past. Due to that the wait for end
of transmitter operation was too long.

Temporary fix for the problem is decrease of receiver sleep
time by one periodic advertising interval.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-07 21:36:55 -04:00
Piotr Pryga e03f9c3042 Bluetooth: controller: Add per sync filt by CTE type for SOC w/o DFE
First implementation of periodic advertising sync filtering
requires existence of Direction Finding Extension in Radio
peripheral.
To add the filtering support for other Nodric SOCs software
based PDU traversing for CTEInfo should be implemented.

In case there is no DFE in Radio peripheral, actual filtering
is done in ULL.

The commit provides necessary changes to previous solution.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-07 21:36:55 -04:00
Piotr Pryga fba51111cf samples: Bluetooth: df: enable filtering of per adv by CTE type
Enable filtering of periodic advertisements to synchronize
with advertisenemts that include CTE.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-07 21:36:55 -04:00
Piotr Pryga ecf761b4e9 Bluetooth: controller: ULL: add per sync filtering by CTE type
Follow up on changes in lower link layer to add filtering
of periodic advertisements synchronization by CTE type.

The NODE_RX_TYPE_SYNC is used to transport information that:
- Sync is established. In such situation the node_rx
  includes data related with received PDU
- Sync scanning is terminated.
In first case ULL will generate NODE_RX_TYPE_SYNC_REPORT
after sending NODE_RX_TYPE_SYNC.

Also EVENT_DONE_EXTRA_TYPE_SYNC handling has additional
execution path that terminates sync scanning if requested
by lower link layer. In other case it adjusts sync scan
window and maintains timeout as usual.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-07 21:36:55 -04:00
Piotr Pryga 9b66a8b47d Bluetooth: controller: rework per scan lll to allow filt by CTE type
Periodic advertisement synchronization may be filtered by CTE type.
If particular CTE type is not allowed then depening on filtering policy:
- if filtering policy is off synchronization if terminated
- if filtering policy is on synchronization is continued to
  synchonize with another device from allowed adverisements list.
If synchronization is established and peer device changes CTE type
to one that is not allowed, synchronization should be maintained.

There are two new execution paths. First one is executed when
synchronization is created. In this case CTEILINE is enabled
to parse PDU for CTEInfo field. In this execution path CTE
type is verified. Second execution path does not include
parsing PDU for CTEInfo and verification of CTE type.

Information about sync allowed is added to node_rx instance
that transports received PDU data. In case the sync has to be
terminated the node_rx will not hold PDU data.

Also done event is extended with information about sync
termination if CTE type is not allowed and filtering
policy is off.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-07 21:36:55 -04:00
Piotr Pryga 04e2e84cb7 Bluetooth: radio: move radio_df_cte_inline_set_enabled to radio.c
To enable runtime parsing of PDU to find CTEInfo field CTEINLINE mode
has to be enabled. Thanks to that it is possible to verify if the PDU
has allowed CTE type e.g. for periodic advertising synchornization.
To run CTEInfo parsing other parametrers of CTEINLINE are not relevant.
If Radio is set to disable after PDU END event the CTE sampling
will not be processed.

The commit moves the radio_df_cte_inline_set_enable function to make
it accessible even the direction finding features are disabled.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-10-07 21:36:55 -04:00