Since nordic DMM has been introduced, the SPIM RAM buffer is no
longer used in case DMM is enabled. Before DMM the SPIM RAM buffer
was manually placed in the DMM linker section, now the driver
allocates a buffer from the DMM linker section dynamically instead.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Get/put PM state lock for suspend-to-ram mode when CONFIG_PM_S2RAM
is enabled to prevent clocks are switch off while an I2C transfer
is on-going.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Add i2c_stm32_pm_get() and i2c_stm32_pm_put() helper functions for
all STM32 I2C driver flavors to get and put PM resources when the
I2C bus is used. Use them in the I2C master mode sequences instead
of using local implementation.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Check that the controller and PHY clock devices are ready, then
enable the clocks with clock_control_on() before calling
clock_control_set_rate().
This lets the host EHCI driver bring up RT7xx USB clocks from the
devicetree clock description.
Signed-off-by: Aiden Hu <weiwei.hu@nxp.com>
This commit fixes an issue where a framing error is never cleared
on the PL011 serial peripheral.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Perry Naseck <pnaseck@media.mit.edu>
Added option to nrf gswdt drivers to be able to configure
maximum timeout window and also to be able to stop gswdt.
This features are only available when gswdt service is
supported by local domain, otherwise gswdt can still be
used but with fixed timeout and cant be stopped.
Signed-off-by: Łukasz Stępnicki <lukasz.stepnicki@nordicsemi.no>
New driver based on sysctrl acting as a watchdog.
After global software watchdog setup sysctrl will monitor
pings from particular local domain and reset SOC if ping
doesnt arrive before 6s timeout expires.
This software watchdog will be active only if local
domain will do wdt setup procedure.'
Signed-off-by: Łukasz Stępnicki <lukasz.stepnicki@nordicsemi.no>
Add tfm-nrf-mramc to zephyr MRAMC driver, since mramc is secure only
peripheral. Access of nrf-mramc need nrf mramc service.
Bugfix for unaligned write should be done byte by byte instead of word
by word.
Flash write in normal write mode, previously nrf_mramc driver write use
DIRECT_WRITE_MODE in mramc. It is a not reliable method of handling
flash write since the write buffer may lost content when the write is
interrupted. This change is to switch to normal write mode and the
every write should align to 16 bytes which is the write-block-size.
Signed-off-by: Travis Lam <travis.lam@nordicsemi.no>
Physical write block size of mram is 16 for nrf7120. While using
direct write mode for write. Writing 32-bits word is handled by
mramc hardware itself.
In nrf7120 is capable to disable busfault when word written is
corrupted. Data verification is added after write/erase to
ensure a write is robust.
Signed-off-by: Travis Lam <travis.lam@nordicsemi.no>
qspi_read_jedec_id() builds the JEDEC Read ID (0x9F) command with
.AddressMode set to QSPI_ADDRESS_1_LINE, while intending to send no
address phase: .AddressSize is set to QSPI_ADDRESS_NONE, which is the
AddressMode "none" constant (0x0) and, used as an address size, equals
QSPI_ADDRESS_8_BITS.
Because the STM32 HAL emits an address phase whenever
AddressMode != QSPI_ADDRESS_NONE, the controller clocks out a phantom
8-bit address after the opcode. This shifts the returned data by one
byte and drops the manufacturer ID: flash_read_jedec_id() returns e.g.
40 19 00 instead of EF 40 19 for a Winbond W25Q256JV.
Set .AddressMode to QSPI_ADDRESS_NONE so the Read ID command issues no
address phase, as the 0x9F command requires.
Signed-off-by: Lucas Zampar Bernardi <lucas.zampar@gmail.com>
Expose the chunk size used when downloading the nRF70 firmware patches
to the RPU as NRF70_PATCH_DL_CHUNK_SIZE. It defaults to 4096 bytes, and
to 2048 bytes on the nRF54H.
Each chunk maps to a single SPI/QSPI transfer, so it has to fit both the
host EasyDMA MAXCNT and any DMA bounce region the bus driver relies on.
The previous hard-coded 8192 overran the 13-bit EasyDMA MAXCNT on nRF91
(max 8191 bytes) and the 4 KB cpuapp DMA bounce region on nRF54H20. The
oversized transfer was rejected and the error dropped on the write path,
leaving the RPU with a corrupt patch and a bad boot signature.
On the nRF54H the bounce buffer comes from the small 4 KB cpuapp DMA
region that is shared with the console UART and other peripherals, so
even a 4096 byte chunk cannot find contiguous space there. Default to
2048 on that SoC and keep 4096 elsewhere, which also stays within the
nRF91 MAXCNT while keeping the chunk count low.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Assisted-by: Cursor:Auto
- Added `phy_channel` to track actual PHY hardware state
- Created `rf_change_channel()` as single entry point for all changes
- Implemented `rf_restore_main_channel()` for automatic restoration
- Added `rf_restart_rx_if_enabled()` helper to avoid code duplication
- Restored `rf_set_channel()` as low-level PHY configuration helper
Signed-off-by: Baptiste Coffin <baptiste.coffin_1@nxp.com>
Wrap each node-label arm of OSPI_INST_NUM() in
COND_CODE_1(DT_NODE_EXISTS(...)) so DT_NODELABEL(octospiN) is only
expanded when that node exists in the current DTS. The macro
previously referenced octospi1 and octospi2 unconditionally, which
broke the build on parts that do not have both instances. An
unknown node now resolves to 0 instead of silently defaulting to 1.
Guard the OSPIM-only helpers (DT_OSPI_IO_PORT_PROP_OR and
OSPI_INST_IO_{LOW,HIGH}_PORT) with #if defined(OCTOSPIM) and
provide neutral zero stubs otherwise, so the driver compiles on
STM32 parts without the OCTOSPI I/O Manager (e.g. STM32L4/L5).
Add a BUILD_ASSERT in MSPI_STM32_INIT to reject at compile time a
DTS node that is neither octospi1 nor octospi2 (the trailing 0
case).
Zero-initialize s_MemMappedCfg so no uninitialized fields are
passed to HAL_OSPI_MemoryMapped().
Signed-off-by: Kirill Shypachov <kshypachov@outlook.com>
Add OSPI_INST_NUM() to determine the hardware OSPI instance
number (1, 2, ...) from the devicetree node label instead of the
DT_INST ordinal index. The ordinal depends on enumeration order
and does not necessarily match the hardware instance, so the
default OSPIM port values could be assigned to the wrong
controller.
Use OSPI_INST_NUM() and the new OSPI_INST_IO_{LOW,HIGH}_PORT()
helpers for the clk, ncs and IO port defaults, replacing the
(index == 0) assumption that index 0 is always OCTOSPI1.
Collapse the identical OCTOSPI1 and OCTOSPI2 branches in
mspi_stm32_ospi_config() into a single assignment and keep only
the instance validity check.
Drop a duplicate DataDtrMode assignment in
mspi_stm32_ospi_prepare_cmd().
Signed-off-by: Kirill Shypachov <kshypachov@outlook.com>
Fix reading the OSPIM port settings from devicetree. The values
were resolved with a runtime dev_id passed to devicetree macros,
so the macros always fell back to defaults instead of the DTS
values. Read the ports from the device config, populated at
build time, instead.
Add an STM32U5 errata 2.6.1 workaround: set DQSE in WCCR for
memory-mapped writes, otherwise every memory-mapped write
returns an AHB error (Bus Fault).
Enable the bus inactivity timeout when the OCTOSPI I/O Manager
runs in multiplexed mode (OCTOSPI1/OCTOSPI2 share CS, CLK and
IO0-IO3). Without it one peripheral can hold the bus
indefinitely; the timeout forces nCS release. The value 0x34
was chosen empirically. This is gated on OCTOSPIM/MUXEN, not on
the U5 series.
Signed-off-by: Kirill Shypachov <kshypachov@outlook.com>
Extend the mspi_stm32_conf structure with fields to store the
OSPIM module port settings (clk, dqs, ncs, io low/high) that
are read from the devicetree.
Signed-off-by: Kirill Shypachov <kshypachov@outlook.com>
Enable Wi-FI keep-alive by default. If not configured,
devices may experience unintended disconnections from certain APs.
Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
on_cmd_socknotifyev() scanned for quote delimiters using `len` (the
attacker-controlled frame length) as the loop bound, while the data was
linearized into a fixed 40-byte `value` buffer. A long response walked
past the buffer and the value[p2] = '\0' store wrote out of bounds.
Bound the scanning loops by out_len (the linearized length) instead.
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The +CGCONTRDP handler computed each address field length from
delimiter positions in the network-supplied response and used it
unbounded in strncpy() into the fixed temp_addr_str stack buffer (and
the smaller dns_v4_string), allowing a malicious network to overflow the
stack.
Bound each field length against the destination buffer before the copy.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Numerous AT response handlers called net_buf_linearize(dst, sizeof(dst),
...) and then wrote dst[out_len] = 0. net_buf_linearize() can return a
count equal to its destination-length argument, so when a field exactly
filled the buffer the terminating NUL was written one byte past the end,
corrupting adjacent context fields. One site additionally passed the
wire length as the destination size, allowing a full overflow.
Pass sizeof(dst) - 1 (and a correct bound for the IMSI and KCELLMEAS
sites) so the NUL write always stays in bounds, matching the already
correct handler.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
- Kconfigs in modules/ should not define configs with an SOC_ prefix.
Furthermore, these options are SDK specific, not SoC specific.
- The simplicity_sdk configs do the same.
Signed-off-by: Michael Zimmermann <michael.zimmermann@sevenlab.de>
data->target_config is NULL until i3c_target_register() is called by
the application layer. The I3C bus master can assert a STOP condition
during board init before registration occurs, firing the ISR while
target_config is still NULL.
Both npcx_i3c_target_isr() and npcx_i3c_target_xfer_end_handle()
unconditionally dereferenced data->target_config->callbacks, causing
an MPU Instruction Access Violation when the resulting garbage pointer
was used as a function pointer.
Guard the callbacks pointer derivation with a NULL check on
target_config in both sites. Existing per-callback NULL guards
downstream already handle the NULL case correctly.
Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
The escape_conf bits reset to 1 and were left set, escaping 0xC0 and
0xDB on the async path even with SLIP off. Clear them, then enable.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
use min-len/max-len for asserting the correct length of the
array, drop corresponding build asserts
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
The driver discarded the load offset returned by pio_add_program() and
started the state machine with pio_sm_init(pio, sm, -1, ...). The -1 is
silently masked to PC 31 by pio_encode_jmp(), which only works by
accident while the ws2812 program is the sole program in the PIO
instance: top-down placement puts it at offsets 28..31, and PC 31 then
happens to hit the program's final jmp back to its start.
As soon as another program is loaded into the same PIO instance first
(lower init priority), the ws2812 program is placed at a lower offset.
The SM then starts inside foreign code, falls through into empty
instruction memory and loops there forever, so the data pin stays
silent without any error being reported.
Store the offset in a data struct of the parent PIO program device and
pass it to pio_sm_init() as the initial PC, with error handling for
exhausted instruction memory. Parent-before-child init order is given
by the devicetree dependency ordinals; a device_is_ready() guard is
added as a safety net.
Signed-off-by: Andreas Petter <andreas@ibpetter.de>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Simplifies the sys_clock_set_timeout() calculation used to determine
the next correct cycle at which to trigger the timer interrupt. There
is no risk that number of cycles we are adding will exceed MAX_CYCLES.
--
Furthermore, should the current cycle count match the 'last_count',
it prevents the timer from firing one tick too early. That firing
would not lead to miscount of ticks, nor mis-execution of handlers.
However it could lead to one extra timer interrupt being processed
unnecessarily.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Init the sensorhub targets using 8-bit i2c_addr for those drivers
when their STMEMSC API requires it.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
`uart_irq_tx_ready` should report true if transmit is empty
and the transmit interrupt is enabled. This isn't documented in
drivers/uart.h but is required by code such
`subsys/modules/modbus_serial.c` and implemented in drivers such as
`uart_sam.c` and `uart_stm32.c`.
Fix.
Signed-off-by: Michael Hope <michaelh@juju.nz>
Add a driver for the u-blox M10 GNSS receiver.
It is heavily modeled on the F9P implementation.
Signed-off-by: Gaston Donikian <gastondonikian@gmail.com>
- Adds the CRC-32/MPEG-2 variant
(ISO/IEC 13818-1 Annex A, ITU-T H.222.0)
to both the software CRC subsystem and the CRC device API.
- Adds crc32_mpeg2() and crc32_mpeg2_update().
Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
Install flash functions at driver init, once the scheduler
is running, since early boot leaves the chip on the no-OS path.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
For STM32H7, disable IRQ in RTIO when tranfer is completed to prevent
spurious IRQ to stall the system.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
For st,stm32h7-spi compatible, always use the TSIZE register and the FIFO
for polling and interrupt mode. This increases performance compared to not
using it, and it reduces code complexity. This removes the need for the
fifo-enable property.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
For st,stm32h7-spi compatibles, when fifo-enable property is set, the
driver was setting the TSIZE register with the size of each buffer in the
transaction, leading to several disable/enable of the SPI instance.
Now, it sets the complete size of the transaction without intempestive
disabling of the SPI.
To add flexibility, the FIFO threshold is now configurable from a dts
property.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
This commit simplifies the flow of the STM32 SPI DMA transfer.
For the "st,stm32h7-spi" compatible, do not set the TSIZE register for a
DMA transfer (to define the size of the transfer). This setting was
leading to several disable/enable of the SPI instance in case multiple
buffers were used in the transaction, and it didn't bring noticeable
performance benefit. At the same time, do not use the SPI FIFO because
it's a hurdle to use without the TSIZE.
Rework the flow of initial operation to better match the procedure
described in the Reference Manuals.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
When waiting for DMA transfer done, wait for both TX and RX, instead of
only one of them.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
sys_clock_set_timeout() computed the compare value as
cyc = ticks * CYC_PER_TICK + unannounced;
cyc = DIV_ROUND_UP(cyc, CYC_PER_TICK) * CYC_PER_TICK;
target = last_count + cyc;
The DIV_ROUND_UP forces the fire onto the next tick boundary *after*
the requested point, but the driver never subtracts the unannounced
sub-tick offset back out. When the caller arms partway through a tick
(the common case), the timer therefore fires one tick later than the
kernel asked for -- k_timer_start(K_TICKS(N), ...) ends up firing at
roughly N+2 ticks instead of N+1.
Adopt the absolute tick-aligned deadline pattern already proven in
arm_arch_timer.c and riscv_machine_timer.c:
- Track last_elapsed: the tick count the kernel last observed via
sys_clock_elapsed(). Reset to 0 in the handler at announce.
- sys_clock_set_timeout() computes the target as
target = last_count + (last_elapsed + ticks) * CYC_PER_TICK
and clamps the cycle delta from last_count at MAX_CYCLES so the
24-bit compare register is satisfied relative to the current
counter.
- The handler reads the current counter (not the scheduled expire
time) to compute dticks, advancing last_count to the actual tick
boundary just past now in one shot. This subsumes the previous
"wrap protection" branch: a large unannounced delta naturally
produces a target in the past, compare_set forces an immediate
IRQ, and the handler catches up in a single invocation.
- sys_clock_elapsed() records the delta in last_elapsed.
A v1 of this change (commit 67a29d7f98 ("drivers: timer:
nrf_rtc_timer: switch to absolute tick-aligned deadlines"), since
reverted) kept a separate "if unannounced >= COUNTER_HALF_SPAN,
target = last_count" branch. That broke the handler invariant:
dticks evaluated to zero, last_count never advanced, and the ISR
re-pended in an infinite loop once the counter naturally crossed
COUNTER_HALF_SPAN (~4m17s on nrf52). The structural change above
removes the need for any such recovery branch.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
add support for the stm32 f series in the
dwmac driver.
Assisted-by: Github Copilot:Claude Haiku 4.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
add support for the dwc_ether_mac10_100_1000_universal,
that is used, f.e. on the stm32 f series.
Assisted-by: Github Copilot:Claude Haiku 4.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>