Don't rely on drivers protecting the spi_rtio ctx from multiple
threads as this is generic and could just be part of the spi_rtio
context to avoid duplicate code and thus make using it safer and
more efficient.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
The spi_rtio_copy implementation incorrectly sets up a transceive sqe
in place of a write or read when an empty "spacer" spi_buf is passed
which is not aligned with the "opposing" spi_buf. Using transceive in
these cases passes a NULL receive/transmit buffer with positive length,
which is a bug.
Some drivers have an additional check to clear the size if the buffer
is NULL, but we should not rely on this check in drivers as it is
duplicate code.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Move variable declarations into platform-specific conditional blocks
and extend i.MX93 support to include M33 core. This eliminates unused
variable compilation warnings without affecting existing platform
functionality.
Signed-off-by: Ruoshan Shi <ruoshan.shi@nxp.com>
- Added mcux_lcdifv3_set_pixel_format api
- Fix pointer-to-integer cast error by using uintptr_t intermediate cast
instead of direct uint64_t cast
- Fixed the pixel_format setting on waveshare_dsi_lcd shield
Signed-off-by: Ruoshan Shi <ruoshan.shi@nxp.com>
Add support for the DAC module on TI’s MSPM0 G-Series MCUs. The DAC
supports 8-bit and 12-bit resolution.
Signed-off-by: Santhosh Charles <santhosh@linumiz.com>
Call i2c_hal_init() during driver init and after the clock
off/on cycle in i2c_hw_fsm_reset(). On SoCs where the
controller clock gate defaults to off, the peripheral would
not respond until explicitly enabled, matching the behavior
of ESP-IDF's i2c_hal_init().
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
IDLE exit is programmed to happen shortly before systimer
programmed wake-up event happens. If the interrupt from
the timer happens before, idle_exit() does not run, as
timeout_idle flag is cleared at the ISR. Fix condition for
both systimer (ESP32) and xtensa drivers.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
Fixes zephyrproject-rtos/zephyr#106597
The current driver for the NXP C40 flash controller instantiates two
drivers, one for the controller (which has no real code -- it's just
a device with no API, config, or data), and one for the flash bank.
This breaks the various partition APIs because they expect the flash
driver API to be attached to the "grandparent" of the partitions
object -- but in the current C40 driver, it is attached to the parent.
I was worried this fix was going to be more complicated, but it
appears to have been quite simple. All I needed to do was to
instantiate a single device with the the API, config and data.
The fix requires the "soc-nv-flash" compatibility to be added to
device trees which reference this driver (see previous commit).
This fix addresses the bug report I filed a few days ago:
NXP C40 flash driver incompatibility with partitions macro APIs #106597
Signed-off-by: Rob Newberry <rob@zenomoto.com>
Signed-off-by: rob-zeno <rob@zenomoto.com>
Migrate intel_adsp_timer to the unified timer lock API. Replace the
driver-private spinlock with sys_clock_lock()/sys_clock_announce_locked().
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Migrate apic_tsc to the unified timer lock API. Replace the
driver-private spinlock with sys_clock_lock()/sys_clock_announce_locked().
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Migrate hpet to the unified timer lock API. Replace the driver-private
spinlock with sys_clock_lock()/sys_clock_announce_locked().
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Migrate xtensa_sys_timer to the unified timer lock API. Replace the
driver-private spinlock with sys_clock_lock()/sys_clock_announce_locked()
so that the hardware cycle baseline and the kernel tick counter are
always updated under the same lock.
Also migrate sys_clock_idle_exit() which updates driver state and
announces ticks on LPM exit.
Add extern declarations for sys_clock_cycle_get_32/64 in
arch/xtensa/arch.h, consistent with all other architectures, to
avoid a circular include dependency with system_timer.h. Xtensa
was the only architecture missing them.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Migrate riscv_machine_timer to the unified timer lock API. Replace the
driver-private spinlock with sys_clock_lock()/sys_clock_announce_locked()
so that the hardware cycle baseline (last_count) and the kernel tick
counter (curr_tick) are always updated under the same lock.
This eliminates a race on SMP where sys_clock_elapsed() could observe
the updated last_count before sys_clock_announce() had advanced
curr_tick, causing time-dependent kernel operations to see inconsistent
values.
Remove internal locking from sys_clock_set_timeout() and
sys_clock_elapsed() as they are now always called with the timer lock
held.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Migrate arm_arch_timer to the unified timer lock API. Replace the
driver-private spinlock with sys_clock_lock()/sys_clock_announce_locked()
so that the hardware cycle baseline (last_cycle) and the kernel tick
counter (curr_tick) are always updated under the same lock.
This eliminates a race on SMP where sys_clock_elapsed() could observe
the updated last_cycle before sys_clock_announce() had advanced
curr_tick, causing time-dependent kernel operations to see inconsistent
values.
Remove internal locking from sys_clock_set_timeout() and
sys_clock_elapsed() as they are now always called with the timer lock
held.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Change indentation on multi-line test instruction for consistency
and to ease readability. Also replace 2 tabulations with a space char.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
LPADC_DoOffsetCalibration() triggers offset calibration but returns
immediately without waiting for it to complete. If gain calibration
is requested before offset calibration finishes, the hardware silently
rejects it and GCC[RDY] never asserts, causing
LPADC_FinishAutoCalibration() to spin forever at boot (~50% of the
time on affected boards like FRDM-MCXA266).
Fix by replacing LPADC_DoAutoCalibration() with the split HAL API:
LPADC_PrepareAutoCalibration() + k_busy_wait(1U) +
LPADC_FinishAutoCalibration()
The 1us busy-wait gives offset calibration sufficient time to complete
on all LPADC platforms before the gain calibration request is issued.
Only the HAS_CTRL_CALOFS path is affected (the path that also calls
DoOffsetCalibration); the HAS_CFG_CALOFS path has no preceding offset
calibration and is left unchanged.
Fixes#105652
Signed-off-by: Jjateen Gundesha <jjateen97@gmail.com>
Correct some behaviors that were broken in the original SPI DMA + RTIO
work:
* Properly fallback to interrupt behavior if no DMA channels are assigned
to a given SPI peripheral.
* Properly handle held CS lines across transactions when using hardware CS
control.
Signed-off-by: Pete Johanson <pete.johanson@analog.com>
The VIM IP has a register that informs the maximum
number of interrupts that can be supported.
The ASSERT must check whether the number of IRQs
is LESSER THAN OR EQUAL to above register value,
not a strict equality check.
Signed-off-by: Shreyas Shankar <s-shankar@ti.com>
Updates the legacy HAL version of the Infineon clock control driver to
be excluded for devices not using the legacy HAL based drivers.
This fixes a failure in the libraries.devicetree.api_ext test, which
on PSC3M5 introduces a "fixed-clock" DTS note that causes
DT_HAS_FIXED_CLOCK_ENABLED and SOC_FAMILY_INFINEON_CAT1 to both be
selected. This results in the HAL based driver being incorrectly
included in the build, causing build errors.
Assisted-by: GitHub Copilot:claude-opus-4.6
Signed-off-by: John Batch <john.batch@infineon.com>
Fix build error when independent reset is enabled on custom host.
Add out-of-band reset kconfig option to guard dependency on host GPIO,
so that in-band independent reset can be supported by default.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
In the `FLEXCAN_SetTimingConfig` function(fsl_flexcan.c), the following
statement is implemented when the Enhanced Bit Timing Register is enabled:
```
base->ENCBT = CAN_ENCBT_NRJW(pConfig->rJumpwidth) |
CAN_ENCBT_NTSEG1((uint32_t)pConfig->phaseSeg1 +
pConfig->propSeg + 1U) |
CAN_ENCBT_NTSEG2(pConfig->phaseSeg2);
```
`prop_seg + 1` represents the length of the propagation segment.
- `pConfig->propSeg` = `flexcan_config.timingConfig.propSeg`
- Therefore, flexcan_config.timingConfig.propSeg(can_mcux_flexcan.c) should
be equal to `data->timing.prop_seg - 1U`.
Fixes: #106238
Signed-off-by: Jianchao Wang <Jianchao.wang_1@nxp.com>
This commit addresses two integer handling issues in the ataes132a
crypto driver identified by coverity scans.
1. In ataes132a_send_command, added a centralized validation check
to ensure the 'nparams' value, when combined with the 5-byte
packet overhead, does not exceed the 8-bit 'count' limit or the
physical 64-byte command buffer. This prevents a potential wrap-
around that would cause the chip to receive an invalid length byte.
2. In the Atmel CRC calculation, added an explicit cast to uint16_t
during the bit-shift operation. This prevents unintended integer
promotion and satisfies static analysis regarding potential
overflows during the 16-bit CRC generation.
Fixes#84683Fixes#84690
Signed-off-by: David J. Leach, Jr. <tasmar@gmail.com>
STM32WB0 watchdog does not support disable the Debug
module during STANDBY mode once the DBGMCU
clock is enabled.
Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
If building mbox driver for ESP32-C5, it fails due to
invalid headers. Add needed guard for that SoC.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Return 0 from clock_control_esp32_on() when the peripheral clock is
already on, matching clock_control_on() success semantics.
Signed-off-by: Anand Kumar <anandvtu16158@gmail.com>
Since `a78cd34` the ADC driver did not correctly configure
its internal divisor. The responsibility was moved from the
clock control driver to the ADC driver and the `init` function
of the ADC driver was updated accordingly. But the driver
continued calling the clock control API from the `configure`
function, leading to `-EINVAL` being returned.
Correctly configure the internal divisor in the ADC driver by
calling the HAL API directly.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
The twt_capable field in wifi status earlier was hardcoded to true. It
seems better to set it to true only when the link mode is 802.11ax or
higher.
Signed-off-by: Muzaffar Ahmed <muzaffar.ahmed@silabs.com>
Kinetis ke1xf (twr_ke18f/mke18f16) and k8x (frdm_k82f) select
CONFIG_HAS_MCUX_CACHE but previously fell through to the no-op
clear_flash_caches() path, meaning caches were not invalidated
after flash erase or write operations.
After the FTFE controller completes an erase or write, stale data
may remain in the instruction cache and (on some parts) the system
bus cache. Subsequent reads can return outdated values instead of
updated flash contents. This causes test_flash_erase,
test_flash_fill, and test_flash_flatten in
tests/drivers/flash/common to fail, with data read back as stale
values (e.g. 0xAA from a prior fill).
Rebased on top of #105918 and updated to use Zephyr's generic cache
API (sys_cache_instr_invd_all() / sys_cache_data_invd_all()) for
cache invalidation. This keeps the flash driver SoC-agnostic and
relies on the cache driver (e.g. LMEM) for hardware-specific
handling.
Fixes#98487
Signed-off-by: Mohit Talwar <talwarmohit2005@gmail.com>
LMEM cache maintenance helpers can be called before the
underlying code or system cache has been enabled.
This becomes visible on RT11xx CM4 targets once the generic ARM MPU
nocache-memory cleanup path uses the generic cache API for non-ARCH
cache backends during early boot. In that case, LMEM maintenance
requests must not blindly access the hardware while ENCACHE is clear.
Check the corresponding LMEM enable bit before performing code or
system cache maintenance. Return -EAGAIN when the selected cache is
currently disabled, and keep disable requests as a no-op when the
cache is already off.
Signed-off-by: Holt Sun <holt.sun@nxp.com>
This code would fail to compile if compiled with
`-Werror=implicit-fallthrough=`. The fallthrough does not seem to be
intentional as it is handling 2 discrete events.
Signed-off-by: Benjamin Gwin <bgwin@google.com>
The current code resets the refresh_pos pointer on write, but does not
clear the corresponding digit drive pin. This means that the next timer
iteration is going to set the gpio for digit 0, but any other digit may
still be selected, which would cause a glitch on that digit for the
cycle.
There's no real need to reset this pointer on write though so just drop
the line, then the timer refresh just catches up to the new string and
the display is stable.
Also drop the reset line from the clear function as it does not make
much sense there either, but reset on timer end so that the next cycle
starts from the first digit.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
`tests/drivers/watchdog/wdt_error_cases` test was failing
on `it51xxx_evb/it51526aw` due to insufficient error
handling. This change fixes those issues, and the following
tests now pass.
- tests/drivers/watchdog/wdt_error_cases
- tests/drivers/watchdog/wdt_basic_api
- tests/drivers/watchdog/wdt_basic_reset_none
- tests/drivers/watchdog/wdt_variables
- samples/drivers/watchdog
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
Move buffer size validation into `start_read()` to prevent adc
context from getting stuck. This issue is revealed by
`tests/drivers/adc/adc_error_cases` test.
Also, this patch adds check for unsupoorted options, including
oversampling and invalid resolution and adds support for higher
channel range. (8 and above).
Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>