Commit graph

108847 commits

Author SHA1 Message Date
Camille BAUD
f11f68eade drivers: timer: Harmonize mtime-based RISC-V timers
This commit replaces a bunch of ifdefs and bindings with a single
extensible binding, and makes all standard mtime system timers consistent.

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-01-22 05:39:59 +01:00
Camille BAUD
bf45c496bb drivers: timer: Remove unused divider setter in RISC-V machine timer
This removes a unused function for a unused binding,
and is prelude to a refactoring

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-01-22 05:39:59 +01:00
Andrej Butok
970204227f boards: frdm_mcxn947: fix mcuboot partitions
Fixes frdm_mcxn947 MCUBoot partitions
that were broken by d8ab81329e

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2025-01-22 05:39:37 +01:00
Emilio Benavente
d4bfe3b507 boards: nxp: frdm_mcxw71: Enable MCXW71 I2C Loopback
Enable and test I2C loopback with i2c_target_api

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2025-01-22 05:39:22 +01:00
Marcio Ribeiro
4551f3410d drivers: display: ssd1306: add support to ssd1309
SSD1309 support added to SSD1306 display driver

Signed-off-by: Marcio Ribeiro <wmrsouza@hotmail.com>
2025-01-22 05:39:10 +01:00
Nicolas Pitre
f93c1ed291 kernel/pipe: squash compiler warning
The compiler complains that:

```
zephyr/kernel/include/kernel_internal.h:121:29:
error: 'reader' may be used uninitialized [-Werror=maybe-uninitialized]
  121 |         thread->swap_retval = value;
      |         ~~~~~~~~~~~~~~~~~~~~^~~~~~~
zephyr/kernel/pipe.c: In function 'copy_to_pending_readers':
zephyr/kernel/pipe.c:92:26: note: 'reader' was declared here
   92 |         struct k_thread *reader;
      |                          ^~~~~~
```

The static analyzer fails to see through the `LOCK_SCHED_SPINLOCK`
construct that the `reader` pointer is always initialized.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-22 05:39:01 +01:00
Nicolas Pitre
0c0644bd68 kernel/pipe: disable direct-to-readers copy with CONFIG_KERNEL_COHERENCE
Systems that enabled this option don't have their stacks in coherent
memory. Given our pipe_buf_spec is stored on the stack, and readers may
also have their destination buffer on their stack too, it is not worth
going to the trouble of supporting direct-to-readers copy with them.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-21 19:44:57 +01:00
Nicolas Pitre
3da90f9d49 kernel/pipe: add missing calls to z_reschedule()
We are waking up threads but failed to let them run if they are
higher priority. Add missing calls to z_reschedule().

Also wake up all pending writers as we don't know how many there might
be. It is more efficient to wake them all when the ring buffer is full
before reading from it rather than waking them one by one whenever there is
more room in it.

Thanks to Peter Mitsis for noticing those issues.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-21 19:44:57 +01:00
Nicolas Pitre
99c2057bb6 tests: app_kernel: restore the PIPE_NOBUFF variant
... now that the new pipe implementation supports it.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-21 19:44:57 +01:00
Nicolas Pitre
29ae9e3435 kernel/pipe: implement direct-to-pending-readers data copy
If there are pending readers, it is best to perform a single data copy
directly into their final destination buffer rather than doing one copy
into the ring buffer just to immediately copy the same data out of it.

Incidentally, this allows for supporting pipes with no ring buffer at all.

The pipe implementation being deprecated has a similar capability so better
have it here too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-21 19:44:57 +01:00
Nicolas Pitre
4af80d72bc kernel/pipe: remove extra hardware timer query on thread wakeup
Dispense with the call to sys_timepoint_expired() by leveraging
swap_retval to distinguish between notifications and timeouts when
z_pend_curr() returns.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-21 19:44:57 +01:00
Nicolas Pitre
46617644e7 kernel/pipe: code flow cleanup
Simplify the logic, avoid repeated conditionals, avoid superfluous
scheduler calls, make the code more efficient and easier to read.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2025-01-21 19:44:57 +01:00
David Brown
19a376aa88 kernel: poll: Allow 0 events for submitted work
Change:
    commit cc6317d7ac
    Author: Jukka Rissanen <jukka.rissanen@linux.intel.com>
    Date:   Fri Nov 1 14:03:32 2019 +0200

        kernel: poll: Allow 0 event input

Allows `k_poll` to be user with 0 events, which is useful for allowing just
a sleep without having to create artificial events.

Allow the same for `k_work_submit_to_queue()` and `k_work_submit()`.

Signed-off-by: David Brown <david.brown@linaro.org>
2025-01-21 19:44:07 +01:00
Jilay Pandya
1b392779d7 docs: migration_guide_4_1: migration guide entry for renamed properties
add migration guide for following renamed variables
 - ``en_spreadcycle`` to ``en-spreadcycle``
- ``i_scale_analog`` to ``i-scale-analog``
- ``index_optw``to ``index-otpw```
- ``ìndex_step`` to ``index-step``
- ``internal_rsense`` to ``internal-rsense``
- ``lock_gconf`` to ``lock-gconf``
- ``mstep_reg_select`` to ``mstep-reg-select``
- ``pdn_disable`` to ``pdn-disable``
- ``poscmp_enable`` to ``poscmp-enable``
- ``test_mode`` to ``test-mode``

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2025-01-21 19:37:47 +01:00
Jilay Pandya
dfdbc77787 dts: bindings: stepper: use hyphens instead of underscore
This commit replaces hyphens with underscore in order to comply with
devicetree standards

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2025-01-21 19:37:47 +01:00
Tomas Galbicka
49c6725750 soc: Enable reset hook for mcxn236
This commit selects reset hook for mcxn236 in Kconfig.

This fixes the issue #84213.

Signed-off-by: Tomas Galbicka <tomas.galbicka@nxp.com>
2025-01-21 19:31:02 +01:00
Paul Wedeck
fda64760ba drivers: uart_wch: Fix compiler warning
This commit removes an unused variable.

Signed-off-by: Paul Wedeck <paulwedeck@gmail.com>
2025-01-21 19:30:53 +01:00
Vinayak Kariappa Chettimada
f3e398d64c Bluetooth: Controller: Fix uninitialized is_aborted in conn done event
Fix uninitialized is_aborted in connection done event.

Relates to commit cadef5a64f ("Bluetooth: Controller:
Introduce BT_CTLR_PERIPHERAL_RESERVE_MAX").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-21 19:30:41 +01:00
Shawn Nematbakhsh
c8e9da2615 soc: lowrisc: opentitan: Fix manifest sizing
The actual manifest is 1024 bytes, but we previously had padding bytes
due to the implementation of SECTION_FUNC(). The manifest is not
executable code so SECTION_VAR() is appropriate and produces a section of
the appropriate size.

Fixes: #82822

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2025-01-21 19:30:30 +01:00
Brandon Allen
e0173d9b8e zbus: assert when inside an ISR and time out is not zero
Currently various zbus functions silently change the timeout
to zero  when inside an ISR. If a developer is not aware
of this it could lead to unexpected behaviour or a
publish/read failing.

Also in the zbus docs it states to only use a timeout of
zero when inside a ISR multiple times.

Signed-off-by: Brandon Allen <brandon.allen@exacttechnology.com>
2025-01-21 19:30:20 +01:00
Robert Lubos
64e5a31b61 net: coap: Fix coap_packet_is_request() check for empty code
Empty code was incorrectly matched as a request, fix that.

Align coap_handle_request_len() function to behave as documented in the
API documentation - in case of invalid request code (which is also the
case for empty code) -ENOTSUP Should be returned.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-21 19:30:06 +01:00
Robert Lubos
13cd48a431 net: coap: Fix response matching algorithm
The algorithm for matching request with response was incorrect, which
could lead to false matches (for example if request had a token, and
piggybacked reply had no token but matching message ID only, that would
still be counted as a match).

This commit fixes it. The request/reply matching is implemented based on
RFC now, with separate conditions for piggybacked/separate responses.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-21 19:30:06 +01:00
Robert Lubos
3e1efedac1 tests: net: coap: Add test case for matching pending replies
Add test case for matching pending replies with received responses.
Cover corner cases that are failing with the current implementation.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-21 19:30:06 +01:00
Jukka Rissanen
ab9b85b199 net: Build assert issue with llvm
Remove the build assert from NET_L3_REGISTER() macro as that
is causing an issue with llvm. Add runtime check of the handler
pointer value.

subsys/net/l2/ethernet/arp.c:1044:1: error: static_assert expression
is not an integral constant expression

ETH_NET_L3_REGISTER(ARP, NET_ETH_PTYPE_ARP, arp_recv);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/net/ethernet.h:1272:2: note: expanded from
macro 'ETH_NET_L3_REGISTER'
        NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/net/net_core.h:190:2: note: expanded from
macro 'NET_L3_REGISTER'
        BUILD_ASSERT((_handler) != NULL, "Handler is not defined")
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/zephyr/toolchain/gcc.h:87:51: note: expanded from
macro 'BUILD_ASSERT'
define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
                                                  ^~~~~~
subsys/net/l2/ethernet/arp.c:1044:1: note: cast from 'void *' is not
allowed in a constant expression
include/zephyr/net/ethernet.h:1272:2: note: expanded from
macro 'ETH_NET_L3_REGISTER'
        NET_L3_REGISTER(&NET_L2_GET_NAME(ETHERNET), name, ptype, handler)
        ^
include/zephyr/net/net_core.h:190:29: note: expanded from
macro 'NET_L3_REGISTER'
        BUILD_ASSERT((_handler) != NULL, "Handler is not defined")
                                   ^
/usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h:89:16: note: expanded
from macro 'NULL'
  define NULL ((void*)0)

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Jukka Rissanen
04205ae24f net: Set the protocol type of fragmented packet
The fragmented packet should inherit the protocol type of the
original packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Jukka Rissanen
3e680551b6 net: ipv6: Do not set ptype when preparing for sending
Trust that the protocol type is set correctly by functions
called before this one. We should not set the protocol type
blindly in this generic function.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Jukka Rissanen
30ad29c2a3 net: ipv4: Do not change the protocol type when sending
The ARP code has set the protocol type of the packet to
0x806, so do not change it when preparing to send to 0x800
which is the IP protocol type. Lets trust the previously
called functions to set the ptype correctly and do not set
it here.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Jukka Rissanen
81938f4c82 tests: net: arp: Remove the ARP cache clear from the tests
It was incorrectly introduced earlier and not really needed
because the test will pass without it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Jukka Rissanen
4a796913cc net: arp: Enhance debug messages
Print more data / debug information for ARP messages.
Also remove unnecessary "&" when printing IPv4 address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Jukka Rissanen
ed582c1374 net: ethernet: Only try ARP for IP packets
The work in Ethernet send in commit 2f10d7d816
("net: ethernet: Set the ptype by the caller in send")
introduced a bug because we could try to do ARP resolving
for ARP packets too. This is clearly a wrong thing to do.
So before trying to do ARP resolving, make sure the the
packet type is IP packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Vinayak Kariappa Chettimada
e09d629024 Bluetooth: Controller: Fix reset of drift_skip count
Fix reset of drift_skip count when an anchor point sync was
missed so that drift compensation is applied on the next
successful anchor point sync. This will improve connection
stability for short overlapping radio event intervals.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2025-01-21 19:29:45 +01:00
Carlo Kirchmeier
6d35071227 drivers: disk: sdmmc_subsys: stm32_sdmmc driver custom disk name support
In order to allow a custom disk name same as with the standard
sdmmc driver an additional device-tree property was introduced.

Signed-off-by: Carlo Kirchmeier <carlo.kirchmeier@zuehlke.com>
2025-01-21 19:29:36 +01:00
Martin Hoff
2f5f39fa37 dts: arm: change usart binding of silabs series 2 boards
Make the Silabs series 2 boards use the new USART driver
"silabs,usart-uart".

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-01-21 19:29:25 +01:00
Martin Hoff
1318f1543c driver: serial: split silabs series 2 and series 0/1 boards usart driver
Split the USART driver into separate implementations for Silabs Series 2
and Series 0/1 boards. This change improves maintainability (especially
with the support of pin-ctrl and clock-ctrl on series 2 boards).

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-01-21 19:29:25 +01:00
Sven Ginka
12c98694c0 board: ganymed_bob_sy120: add uart pinctrl
Add pin definitions for the available uarts
for the ganymed_bob_sy120 boards.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2025-01-21 19:29:14 +01:00
Sven Ginka
a89b81b110 drivers: serial: sy1xx add support for pinctrl
Add pin ctrl to the serial driver.

Signed-off-by: Sven Ginka <s.ginka@sensry.de>
2025-01-21 19:29:14 +01:00
Fabrice DJIATSA
2931ad70de samples: boards: st: uart: circular_dma: update circular dma sample
Add the nucleo_wba55cg board, which implements continuous transfer
with GPDMA and a linked list.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-01-21 19:29:03 +01:00
Fabrice DJIATSA
7b379f47fa drivers: dma: add linked list in dmau5 driver
- Init linked list node and structure
- configure source and destination address
- Setting gpdma request mode
- Configure linked list node and structure for
continous transfer, enable half transfert irq.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
co-authored-by: Lubos Koudelka <lubos.koudelka@st.com>
2025-01-21 19:29:03 +01:00
Fabrice DJIATSA
ed92eeb3c8 drivers: dma: cyclic dma handling
keeping the stream busy when cyclic DMA is used.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-01-21 19:29:03 +01:00
Stephan Gatzka
bda1970b33 modbus: initialize return variable.
Currently, when disabling CONFIG_MODBUS_FP_EXTENSIONS,return variable
'err'  is not initialized (at least not for debug builds) but later on
checked.

Signed-off-by: Stephan Gatzka <stephan.gatzka@gmail.com>
2025-01-21 19:28:52 +01:00
Stephan Gatzka
3936470973 modbus: serial: check return value of uart_irq_callback_user_data_set
uart_irq_callback_user_data_set return non-zero if the callback function
can't be set. This might happen if you forgot to enable
CONFIG_UART_INTERRUPT_DRIVEN.

Signed-off-by: Stephan Gatzka <stephan.gatzka@gmail.com>
2025-01-21 19:28:52 +01:00
Flavio Felder
f953b0d3a1 docs: samples: subsys: lorawan: class_a: update README
Updated the README for the LoRaWAN Class A example to explain limitations
when running multiple times. Provided guidance to resolve the issue.

Signed-off-by: Flavio Felder <felf@zhaw.ch>
2025-01-21 19:28:36 +01:00
Andrej Butok
31c299e5b7 boards: mimxrt1180_evk: set LinkServer as the default runner
Sets LinkServer as the default runner for the mimxrt1180-evk board,
as the board is configured for CMSIS-DAP by default.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2025-01-21 19:28:25 +01:00
Tomasz Moń
45ee2a0b0d drivers: udc_dwc2: Fix multipart DMA OUT transfers
DMA transfers are supposed to write to buffer tail. Use the proper
pointer to make multipart DMA transfers actually write the data to the
intended location.

The issue was observed on control write transfers where the OUT Data
Stage was at least 128 bytes (because endpoint 0 transfer width is
limited to 7 bits).

The issue is unlikely to happen on non-control transfers because the
transfer size width is at least 11 bits (at most 19 bits) and packet
size counter is at least 4 bits (at most: 10 bits) which means that
at least 2048 byte transfer spanning at least 15 packets (or at least
524288 byte spanning 1023 packets for 19 bits transfer size counter
and 10 bits packet counter) is required to necessitate multipart DMA.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-01-21 19:28:13 +01:00
Tomasz Moń
883b77fe3b drivers: udc_dwc2: Recover after STALLed OUT Data Stage
Prepare buffer to receive SETUP data on OUT endpoint 0 after endpoint
halt. This solves the issue where the device would no longer process any
control transfers after the first failed transfer with too large OUT
Data Stage (when processing failed due to data stage buffer allocation
failure).

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-01-21 19:28:13 +01:00
Tomasz Moń
18be1d0768 drivers: udc_dwc2: Fix large control write transfers
The DOEPTSIZ0 XferSize field is 7 bits long, meaning that maximum single
transfer can be 127 bytes long. Configure the control write (OUT)
transfers considering the XferSize field size to support transfers with
data stage larger than 127 bytes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2025-01-21 19:28:13 +01:00
Declan Snyder
d02c48ee8d uart_mcux_lpuart: LPFlexcomm inst based determine
Since some platforms may have some lpuart that are wrapped in lpflexcomm
and some that are not, then change the init code to determine how to
connect the interrupt on an instance basis.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-21 19:28:01 +01:00
Declan Snyder
4f9eda6981 i2c_mcux_lpspi: LPflexcomm determine by inst
Determine if lpflexcomm wrapped lpi2c by instance and connect
irq differently dependending on that to support platforms with
both flexcomm wrapped and unwrapped lpi2c's.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-21 19:28:01 +01:00
Declan Snyder
e531c709c0 spi_mcux_lpspi: Determine lpflexcomm by inst
Determine proper irq setup depending whether the spi is wrapped in an
lpflexcomm or not on an instance basis since some platforms have some
wrapped and some not.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-21 19:28:01 +01:00
Lukasz Majewski
8719abaaa0 samples: settings: Enable NVS backend on mimxrt1020_evk board
The tests for settings will not work properly with just provided config
file for mimxrt1020:
west build -p always -b mimxrt1020_evk samples/subsys/settings

as there the settings_save_one() would return -2 (-ENOENT) as by default
the CONFIG_SETTINGS_NONE is defined for mimxrt1020 configuration.

For proper operation (i.e. to have a memory medium to store settings
values) the NVS backend needs to be enabled.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2025-01-21 19:27:49 +01:00