Add the option for modems to register an arbitrary configuration
structure as part of the core config. This provides a location to
store per-instance, vendor-specific information.
Signed-off-by: Jordan Yates <jordan@embeint.com>
The SRM32 CRC driver is overly pessimistic about the CRC formats the
driver supports, presumably because polynomials were previously
incorrrectly sometime passed in reflected form to the driver which
caused incorrect results in certain functions. Allow all 8-, 16, and
32-bit formats.
Signed-off-by: Zee Yudenko <zyudenko@internships.antmicro.com>
CRC polynomials can be passed in either normal or reflected form.
Reflected form is only relevant to the software CRC implementation doing
reflected calculation. We pass polynomials given to `crc*` functions
as-is to the drivers, which is incorrect if the polynomial is reflected
(which is the case when the `reflected` argument is `true`, or always in
`crc16_reflect`). Fix this by reflecting the polynomial back before
passing it to the driver. Also, remove hacks in driver code for handling
reflected polynomials. This fix makes the previously-failing
`subsys.crc` test pass on STM platforms. Also, fix uninitialised usage
of `flag_reversed` in `crc4`.
Signed-off-by: Zee Yudenko <zyudenko@internships.antmicro.com>
Rework the Renesas RZ MHU MBOX driver to align Renesas RA IPC
Mbox driver so that a single MHU unit serves both TX and RX
on one MBOX channel, and so that one driver instance can own
several channels.
Binding: rename "channel" to "unit", since it indexes the MHU
hardware unit and not the MBOX channel; replace "tx-mask" and
"rx-mask" with a single "channel-mask"; make "shared-memory"
optional.
Rename the Kconfig timeout option to
MBOX_RENESAS_RZ_MHU_BUSY_WAIT_TIMEOUT_US
Signed-off-by: Phuc Pham <phuc.pham.xr@bp.renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
The numaker ethernet driver does not use
the separate ethernet controller, mdio bus, phy structure.
It does mdio inside the ethernet driver.
Until this is fixed this driver is going to be deprecated and
if not fixed in 2 releases removed.
The better way would it be to replace it with the
existing vendor independent dwc_mac driver.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Add support for accessing the 2-byte RAM of the Micro Crystal RV-3028
through the Zephyr retained memory API.
Signed-off-by: Janez Ugovsek <janez@ugovsek.info>
We don't want to be using the CONN port if possible. Reworked to use
the SSSAPI only. Initialization call now also initializes the TRNG.
Signed-off-by: Patrik Nemeth <patrik.nemeth@nxp.com>
mcux_lpuart_configure() begins by spinning unbounded on the
Transmission Complete flag before reconfiguring the peripheral. TC
only sets when the transmitter is enabled and idle, so a
uart_configure() call issued while traffic is flowing parks the
calling thread for the full duration of that traffic. Observed on an
MCXA153 driving a USB CDC-ACM to UART bridge: the host's line-coding
change (9600 -> 115200 at port open) triggered uart_configure()
against a live transfer and the configuring thread spun for 15.36 s,
the time the entire transfer took to drain at the old baud rate
(BAUD register sampled over SWD while stalled). When the loop finally
exited, the driver disabled TE/RE and reinitialized mid-frame,
deterministically corrupting the byte being received.
Bound the wait with WAIT_FOR (300 ms total, 100 us poll). On timeout,
return -EBUSY and leave the peripheral untouched so the caller can
quiesce its traffic and retry; proceeding to tear down the
transmitter and receiver at that point can only destroy in-flight
data. 300 ms covers this driver's worst-case 12-bit frame (start +
8 data + parity + 2 stop, 240 ms) at 50 baud, the slowest standard
rate, so a transmitter finishing its last frame completes within the
window; for the arbitrarily slower rates the hardware can still be
configured to, the bound is an intentional policy limit and the
resulting -EBUSY is side-effect-free and retryable.
Callers that configure an idle UART see no change: TC is already set
and WAIT_FOR returns on its first evaluation.
Signed-off-by: João Felipe <joao@binho.io>
Signed-off-by: Leonardo José Consoni <leonardo@binho.io>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
In synchronous mode, the slave SAI sub-block relies on the master
sub-block to provide the bit and frame clocks. Disabling the SAI
peripheral from the stream callback can disable the shared clock
source and prevent the synchronous slave from operating correctly.
Avoid disabling the SAI peripheral when bit clock gating is disabled,
allowing the master sub-block to continue providing clocks for the
synchronous slave.
Add a warning for synchronous slave configurations to highlight the
requirement for a matching synchronous master configuration and disabled
bit clock gating.
Signed-off-by: Mario Paja <mariopaja@hotmail.com>
Add the MCUX_FREQME_CLK clock identifier and enable the FREQME
peripheral gate (kCLOCK_Freqme) from clock_control_on() for the
IMXRT6XX, IMXRT5XX and RW6XX series, so the nxp,fmeas clock_monitor
back-end can ungate the block through the clock_control API.
The reference timebase reuses the existing MCUX_SYSTEM_CLK identifier,
which already returns the core/system clock rate on these series, so no
new rate case is required.
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
Add a clock_monitor back-end for the NXP BASIC Frequency Measurement
(fmeas) block, wrapping the MCUX SDK fsl_fmeas HAL. The block has no
interrupt line and no MIN/MAX threshold registers, so only MEASURE
(one-shot) mode is supported and WINDOW mode returns -ENOTSUP:
completion is polled from a workqueue and reported as MEASURE_DONE, or
as CLOCK_LOST when no target edges are counted. The HAL fixes the
window at 2^20 reference cycles, so window_ns is ignored.
Reference and target clocks are routed through INPUTMUX and selected at
runtime from devicetree source lists, each pairing a mux route with a
fixed rate or a clock_control provider.
Serialization is a single k_spinlock that is never held across a call
into another subsystem: configure() resolves the reference rate into
locals first and commits them in one short region, and set_source()
parks the state machine at CONFIGURING for the duration of the
re-route. start() arms the block and queues the poll inside its region
and stop() cancels inside its own, so the two cannot interleave and
both stay ISR-safe as the API requires.
Adds the nxp,fmeas binding, its NXP_FMEAS_* INPUTMUX cookie macros and
the fsl_fmeas / inputmux HAL component selection.
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
Assisted-by: Claude:claude-opus-5
The RSCANFD is capable of CAN and CAN FD communications.
It features 8 channels per controller.
Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
Build the STM32WB0 flash driver for STM32WL3x, whose flash
controller IP is compatible with STM32WB0.
Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
The RP1 register field macros were only used by the pinctrl driver, so
move them into pinctrl_rp1.c and drop the public header (the RP1 GPIO
driver already defines the few fields it needs itself).
Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
When dividing the writes into multiple block the driver doesn't sleep
after the last block write which causes a wrong throttling delay.
Fix this by removing an unnecessary check of len in the nrf_write
function.
FIXES: #118218
Signed-off-by: Riadh Ghaddab <riadh.ghaddab@nordicsemi.no>
Using k_events eliminates the drawback of the queue potentially dropping
messages and provides a reliable event notification mechanism.
With the commit c3109b9ebe
("usb: device_next: cdc_acm: rx throughput improvements"),
the CDC implementation queues as many buffers as are available.
The default UDC_KINETIS_EVENT_COUNT was set to 4, and it could already
be observed that the events are dropped. Though the number of
UDC_KINETIS_EVENT_COUNT could be increased, using k_events is the right
fix.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Align the driver design with most of the drivers in the tree and move
driver event handling from the UDC workqueue to the driver's own thread.
Driver thread handles the events under UDC internal lock and makes it
mutually exclusive with API calls. Add k_sched_lock() UDC internal lock
to avoid unnecessary context switch to the driver thread triggered by
e.g. interrupt event, while the internal lock is still held.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
z_vrfy_mux_control_disconnect() was missing the
K_SYSCALL_DRIVER_MUX_CONTROL(dev, disconnect) permission check that
every other handler in this file has. Without it, a userspace caller
could invoke mux_control_disconnect() on a device object that isn't
actually a mux controller, skipping the type/op validation the macro
provides.
Add the missing check, matching the pattern used by
z_vrfy_mux_control_set(), z_vrfy_mux_state_apply(), and
z_vrfy_mux_state_get().
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
Add support for software-managed RTS flow control to work around
hardware RTS silicon limitations on affected STM32 SoC revisions:
- Add st,sw-rts-gpios property to st,stm32-uart-base binding.
- Add UART_STM32_ABNORMAL_RTS_ERRATUM_WORKAROUND Kconfig option with
automatic GPIO selection.
- Configure USART hardware for CTS-only flow control.
- Assert RTS (active low) on rx_enable and deassert on rx_disable
or buffer exhaustion.
Fixes#36849
Signed-off-by: Priyanshu Singh <singhpriyanshu9838@gmail.com>
Add missing conditionals in clock request and release
so the clock is properly acted on in all cases.
Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
icm566xx_attr_set() ignored the return value of the accel/gyro config
helpers and always returned 0, and those helpers discarded the status of
every HAL setter, so unsupported attributes and bus failures were
reported as success. Also fix icm566xx_init() to check the accel LPF
call instead of re-testing the previous gyro LPF result.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
On ICM56686 builds the one-shot decoder routed SENSOR_CHAN_DIE_TEMP
through get_raw_reading_by_position(), which only handles the six
accel/gyro positions and returned -EINVAL as if it were a sample.
Read the 16-bit temperature straight from the payload instead.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Setting SENSOR_ATTR_FULL_SCALE only reprogrammed the accel/gyro FSR
register while the cached full-scale values used to convert raw samples
kept the devicetree settings, silently scaling every reading by the
wrong factor. Update the cached values on a successful FSR change, and
stamp encoded frames from the driver data instead of the fixed config.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The ODR register enums decrease as frequency increases, so comparing
the requested ODR with >= ODR_12_5_HZ picked low-noise mode for the
slowest rates and low-power mode for the fastest ones. Invert both the
accel and gyro comparisons so LN is selected for rates of 12.5 Hz and
above, and LP for the slower LP-only rates.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
ICM566XX_DT_GYRO_ODR_12_5 was defined as 1 instead of 12, which is
neither a valid hardware ODR encoding nor an accepted value of the
gyro-odr binding enum, and it made the low-noise branch of
ICM566XX_VALID_GYRO_ODR unsatisfiable so every LN devicetree failed
its BUILD_ASSERT. Also relax the ODR range checks to inclusive
comparisons so the documented 400 Hz LP and 12.5 Hz LN rates are
accepted, matching icm45686.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The gyroscope sensitivity values are encoded as LSB per dps scaled by
1000, but the rad/s conversion multiplied the raw value by 10000,
making every gyro reading ten times too large for all full-scale
settings. Use a multiplier of 1000 to match the sensitivity scaling.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Add a driver for the VIRTIO SPI controller device (virtio spec 1.4,
section 5.21), letting a Zephyr guest drive a SPI bus exposed by a
hypervisor or a vhost-user backend.
The device carries a single transfer per request, so a transceive call
is split into one request per contiguous chunk of the buffer sets, with
cs_change holding the chip select asserted in between. The controller
capabilities are read from the device configuration space at init and
checked against the SPI configuration. Every request is a round trip to
the device, so the SPI API can only be used from a thread.
Assisted-by: Claude Code:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Implement the GNSS start/stop API for the F9P and M10 drivers using
UBX-CFG-RST. Hot start restarts the engine in place, preserving RAM
config and nav data. Warm/cold start issue a receiver reset and then
re-run the init config, since a SW reset drops RAM configuration.
Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
Extract the fix-rate and init-sequence send out of the F9P and M10
driver init paths into standalone helpers. Init-time behavior is
unchanged; this only prepares the config application to be reused
outside of driver init.
Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
Track whether the emulator has been started so periodic fix updates
and callbacks only fire while running, and stop clears any pending
fix data. Adds a test exercising start/stop behavior and verifying
that callbacks stop and resume accordingly.
Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
Add DEVICE_DT_INST_GET_COMMA helper macro to include/zephyr/device.h to
easily get a device pointer followed by a comma when expanding
devicetree foreach iterators like DT_INST_FOREACH_STATUS_OKAY.
Update drivers, soc, subsys, and tests to use the common definition.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Assisted-by: Antigravity:gemini-1.5-pro
Move the STM32 NeoChrom GPU2D driver out of drivers/misc and
store it instead into soc/st/stm32/common since it is specific
to STM32 SoCs.
While moving it, rename the config from NEOCHROM_GPU2D into
STM32_NEOCHROM_GPU2D to match with other STM32 configs.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
match_event is the PWM period event, so the counter overflow
interrupt fires at whatever period the application picked. It was
armed from enable_capture() onwards, and the only place that disables
it is reached after a capture completes. With no signal on the capture
input the capture never completes, so a short PWM period becomes an
unbounded interrupt storm that starves the CPU.
The wrap count is only consumed as a difference between the two
capture edges, so wraps seen before the first edge cancel out. Arm the
interrupt when a first edge is captured and release it once the
measurement is done, tracking the users of the shared event in a
bitmask.
Reproduced on lpcxpresso55s36/lpc55s36 with the loopback jumper
removed: the suite hung at test_capture_busy with the core stuck in
the SCT0 ISR, and completes with this change.
Fixes: #117696
Assisted-by: Claude:claude-opus-5
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
A 0% duty cycle leaves the pulse match at 0 while the period match
still sets the output. As that match is also the counter limit it fires
every period, producing a one tick pulse instead of the constant
inactive level the PWM API requires of a zero length pulse.
The existing static level path was guarded by configured_chan == 1, which
missed a channel being configured for the first time and any case with
several channels active. Detach the output from its events and drive it
directly instead, after the normal channel setup has run.
Measured on lpcxpresso55s36/lpc55s36: an 889 ns pulse every 88.9 us before,
no transitions over 1 s after.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
All UART devices supports ISR_SAFE PM device when asynchronous
API is used so pm_device_runtime_put can be used from an interrupt
context. It allows to disable CONFIG_PM_DEVICE_RUNTIME_ASYNC if
needed to safe space.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Accept service_interval from the UAOL stream configuration (passed by
host from TLV type 6 in the gateway config blob) and use it for budget
calculations instead of the hardcoded 1000 us assumption.
This enables automatic scaling for high-bandwidth USB devices:
- Standard isochronous (1000 us): normal budget
- High-bandwidth isochronous (125/250/500 us): 8/4/2× budget improvement
The payload size (aps) calculation automatically scales:
aps = (sample_rate * service_interval_us * frame_size) / 1_000_000
Falls back to 1000 us if service_interval is 0 for backward
compatibility.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Every other FFF-based fake driver installs a ztest rule resetting its
fakes before each test case, and has done so since it was added. The
fake regulator driver never did, leaving its test suite to reset each
fake by hand and making it the sole exception to the pattern.
Install the same rule, re-installing the default get_voltage() delegate
after each reset as the other drivers do, and drop the 35 manual resets
it makes redundant. Each of those was the first statement of its test,
so the rule now does the same work one step earlier.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:claude-opus-5
Update Renesas Flash-HP for mapped-partition migration
Remove extend operation for Flash-HP since the block protect belong to
OFS setting
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
The `__ASSERT_UNREACHABLE` macro is a PRIVATE helper macro used in the
implementation of the actual `__ASSERT` macros. It should not be used
except by the `__assert.h` header itself; in fact, the macro is never
defined if assertions are not enabled.
Replace this private macro's usage in the aforementioned driver with
`__ASSERT_NO_MSG(0)` which will trigger a proper assertion panic if
reached, which seemed to be the intent here.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
DMA is only supported for full-duplex controller mode. Add an error
message and return an error if DMA is asked while in peripheral mode
or in half-duplex.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
In non-H7 full-duplex controller mode, using independent TXE/RXNE
handling in interrupt context can trigger RX overruns.
Switch this path to an RXNE-driven pipeline: seed one initial TX frame
at transfer start, then in each RXNE ISR read one frame and queue the
next TX frame. After the last TX frame, re-enable TXE once so transfer
completion is still detected when BSY clears.
Keep H7 behavior unchanged, and keep the existing non-full-duplex logic
unchanged.
This avoids ISR busy-wait loops while maintaining TX/RX synchronization
on non-H7 full-duplex transfers.
Assisted-by: GitHub Copilot:GPT-5.3-Codex
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
For the SPI devices with st,stm32-spi-fifo compatible, when configured
as master in half duplex RX mode, the clock is output non-stop on the
SCK line (the clock can't be started explicitly by filling the TX FIFO
since we're in half duplex RX), and the device has no way to know when to
stop (there is no TSIZE-like register like on st,stm32h7-spi compatible).
So, to prevent reception of unwanted extra data, the SPI must be disabled
as soon as all data have been received.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
Add support of half duplex transfers on peripheral side.
This adds the support for all STM32.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
CONFIG_NVME_REQUEST_TIMEOUT is documented and ranged in seconds, but
the request timeout path compared k_uptime_get_32 values in
milliseconds without converting. Default 5 therefore expired after
about 5 ms instead of 5 seconds.
Convert the Kconfig value with MSEC_PER_SEC before scheduling and
expiry checks, and reschedule with K_MSEC using the remaining time.
Clarify the Kconfig help text that the unit is seconds.
The FreeBSD NVMe host driver this path follows converts a seconds
timeout with SBT_1S before comparing against the request start time.
Apply the same seconds-to-milliseconds conversion here.
Signed-off-by: Xixin Liu <liuxixin@kylinos.cn>
The MPU6050 die-temperature conversion used a 36.00 degC offset, but
the InvenSense register map specifies TEMP_OUT/340 + 36.53 degC, making
every reading 0.53 degC too low. Use 36530000 microdegrees instead.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The PMU command emulation kept only the field being written and
cleared every other sensor's PMU state instead of the opposite.
Invert the mask so the read-modify-write preserves unrelated fields.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5