Make rram_write() a non-sleeping single-block primitive so it is safe to
call from interrupt context.
The throttling delay is now realized by the callers: k_usleep() between
blocks on the thread path.
Add as well a new nrf_flash_sync_set_delay() function that spaces
timeslots on the radio-sync path.
This allows SOC_FLASH_NRF_THROTTLING and SOC_FLASH_NRF_RADIO_SYNC_MPSL
to be enabled at the same time.
Signed-off-by: Riadh Ghaddab <riadh.ghaddab@nordicsemi.no>
The zephyr,usb-c-vbus-adc driver expands the optional discharge-gpios
and power-gpios properties into its device config with
GPIO_DT_SPEC_INST_GET_OR(), so the GPIO controller they reference must
be built whenever either property is present in devicetree.
CONFIG_GPIO is no longer enabled by the ST board defconfigs since
commit 90b9c954f0 ("boards: st: *: don't enable CONFIG_GPIO by
default"), so samples/subsys/usb_c/sink no longer links for
stm32g081b_eval:
libdrivers__usb_c__vbus.a(usbc_vbus_adc.c.obj):
(.rodata.drv_config_0+0x20): undefined reference to
`__device_dts_ord_53'
Select GPIO from the driver when either property is used, so that every
board and application using this driver is fixed rather than only the
one that happened to be reported.
Signed-off-by: Nicholas Cadieux <ncadieux@qti.qualcomm.com>
Add device power management so the sensor can sit under a power domain
that may be unpowered at init. Bring-up moves to a PM_DEVICE_ACTION_TURN_ON
handler, and RESUME/SUSPEND toggle the config register shutdown bit.
One-shot mode keeps the sensor shut down between fetches, so RESUME
leaves the shutdown bit set in that configuration.
Signed-off-by: Corey Wharton <xodus7@cwharton.com>
Validate the message queue with K_SYSCALL_OBJ_STATIC() so that message
queues user mode can free are rejected outright. Every in-tree caller
already uses CAN_MSGQ_DEFINE(), which is the documented way to define a
CAN RX message queue.
Also document the lifetime requirement on can_add_rx_filter_msgq(). It
applies to supervisor callers too: they bypass the system call handler
and must keep the message queue valid until the filter is removed.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Update comments, log messages, Kconfig prose, and driver-local
identifiers to use the controller/target terminology ratified by
coding guideline A.2 and already used by the Zephyr I2C API.
Identifiers mirroring the Telink HAL (e.g. i2c_master_init,
i2c_set_master_clk, i2c_master_send_stop) are kept unchanged.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Update comments and driver-local identifiers to use the
controller/target terminology ratified by coding guideline A.2 and
already used by the Zephyr I2C API, including renaming the
driver-composed RCAR_I2C_ICMCR_MASTER convenience mask to
RCAR_I2C_ICMCR_CONTROLLER.
Register mnemonics mirroring the R-Car datasheet (ICMCR, ICSCR, MNR,
MAL, ...) and the comments spelling out their datasheet names are
kept unchanged.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Update comments, log messages, Kconfig prose, and driver-local
identifiers to use the controller/target terminology ratified by
coding guideline A.2 and already used by the Zephyr I2C API.
Identifiers mirroring the NXP MCUX SDK and i.MX HAL
(e.g. I2C_Master* / I2C_Slave*, kI2C_Slave* event/flag enums,
LPI2C_Master* / LPI2C_Slave*) are kept unchanged.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Update comments, log messages, Kconfig prose, and driver-local
identifiers to use the controller/target terminology ratified by
coding guideline A.2 and already used by the Zephyr I2C API.
Identifiers mirroring the NXP LPC11U6x user manual (UM10732)
(e.g. LPC11U6X_I2C_MASTER_TX_*, LPC11U6X_I2C_MASTER_RX_*,
LPC11U6X_I2C_SLAVE_TX_*) are kept unchanged.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Update comments, log messages, Kconfig prose, and driver-local
identifiers to use the controller/target terminology ratified by
coding guideline A.2 and already used by the Zephyr I2C API.
Identifiers mirroring the Cadence IP databook
(e.g. CDNS_I2C_CR_MS, CDNS_I2C_IXR_SLV_RDY) are kept unchanged.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Two-line copyright notices were wrapped in the SPDX "<text>...</text>"
construct, which is only valid in an SPDX document, not a file header.
The REUSE tool then folds the literal "<text>" into the holder name
and drops the second line from the SBOM.
Remove the markers and tag the continuation line. Holder, year and
e-mail are left unchanged; only the syntax is fixed.
Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Counter 2 of the MCWDT free-runs at the low-frequency clock and is the
cycle domain, while counters 0 and 1, cascaded into a 32-bit match, are
armed as a one-shot relative delay: a RELOAD backend whose alarm is a
separate timer from the counter. Arming resets that pair before setting
the match, so the delay always runs from zero and cannot be programmed
into the past, which is why no reload floor is stated.
The core takes over the tick accounting. announced_cycles, the spinlock
and the cycle-to-tick math go with it, and so do sys_clock_set_timeout(),
sys_clock_elapsed() and sys_clock_cycle_get_32(), which the core emits.
What is left of the interrupt handler is the acknowledge and the announce.
A ticked kernel now works. The core leaves the period of a reload backend
to the driver, and this alarm does not reload itself, so init and the
handler arm one tick. The driver used to arm the full 32-bit range at
init and never again in that configuration, which put the first tick some
36 hours out.
The counter is reported to the kernel as it reads, so the devicetree
clock-frequency and CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC have to agree.
That was already assumed; a BUILD_ASSERT now says so.
Also drop the unused gpio.h and pull in kernel.h, which the removed
headers happened to provide for WAIT_FOR().
Build-tested on kit_psc3m5_evk, ticked and tickless.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
I belive that
tmp = (int16_t)data->current
is more descriptive and straightforward than
if (INA219_SIGN_BIT(data->current)) {
data->current = ~data->current + 1;
sign = -1;
}
tmp = sign * data->current
Thus to make it consistent with signed conversion which is already
done for SENSOR_CHAN_VSHUNT I propose such cosmetic fix.
Signed-off-by: Lukasz Wiecaszek <lukasz.wiecaszek@gmail.com>
Implementation of ina219 was missing support for
shunt voltage readouts (SENSOR_CHAN_VSHUNT).
This commit fixes that issue.
Signed-off-by: Lukasz Wiecaszek <lukasz.wiecaszek@gmail.com>
The SDL input driver only handled the primary mouse button (reported as
INPUT_BTN_TOUCH) and pointer motion, so the mouse wheel and the middle and
right buttons were silently dropped.
Report the wheel as a relative INPUT_REL_WHEEL event, and report the middle
and right buttons as INPUT_BTN_MIDDLE and INPUT_BTN_RIGHT. The left button
keeps its existing INPUT_BTN_TOUCH behaviour, so the touch/pointer path is
unchanged.
This allows a scroll/rotation input source such as an LVGL encoder input
device to be driven in the native_sim simulator, using the wheel for
rotation and a distinct button for its press.
Signed-off-by: Vandra-Meyer Akos <akos@lvgl.io>
Compilation was failing when one instance is using interrupt driven
API and another one is using asynchronous API with TIMER byte counting.
Compilation was also failing if instance had timer property in DT but
Kconfig was indicating use of the interrupt driven API.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
The continuous acquisition path programs the analog calibration
registers and runs the shared front-end without holding the
analog i2c master clock, the same gap the oneshot path had.
Hold the reference counted clock from controller start until
stop so the acquisition does not depend on another user keeping
that clock enabled.
Assisted-by: Claude:opus-4-8
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
The oneshot read path touched the analog calibration registers
and started conversions without holding the analog i2c master
clock. On SoCs where that clock is root gated it is shared with
the Wi-Fi modem, so the first modem sleep cycle gated it and the
conversion polling never returned.
Hold the reference counted analog clock across channel setup,
calibration load and conversion, and propagate a conversion
failure as -ETIMEDOUT so callers can retry when the shared
analog hardware is temporarily powered down by modem sleep. The
completion wait bound is adjustable through the new
ADC_ESP32_CONVERSION_TIMEOUT_US option.
Assisted-by: Claude:opus-4-8
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
axi_dmac_isr() was defined unconditionally, but only referenced via
IRQ_CONNECT when the devicetree node has an interrupts property. A
core synthesized without an interrupt line (dma_get_status() drives
the state machine by polling instead) failed the build with
-Werror=unused-function. Guard the definition the same way
drivers/watchdog/wdt_dw.c does for the identical situation.
Adds a build-only test targeting arty_a7 covering both the IRQ-driven
and the no-IRQ polling configuration, since this AXI core only exists
in FPGA fabric with no SoC/board to instantiate it on.
Signed-off-by: Iustin Stolniceanu <iustin.stolniceanu@analog.com>
Provides DMA transfers for AXI-Stream peripherals through the standard
Zephyr DMA API, supporting both one-shot and cyclic capture modes. In
cyclic mode the transfer is automatically resubmitted on completion,
keeping the destination buffer continuously updated with no CPU
involvement. Cores synthesized without an interrupt line are driven
through the polling path in dma_get_status().
CONFIG_DMA_ADI_AXI_DMAC is auto-selected when DT_HAS_ADI_AXI_DMAC_ENABLED.
Signed-off-by: Iustin Stolniceanu <iustin.stolniceanu@analog.com>
Add support for the AMD/Xilinx AXI Timer as a Zephyr system
clock driver for soft-core CPUs such as MicroBlaze and
MicroBlaze V.
The driver targets the common dual 32-bit timer configuration
where timer1 is used as a free-running clock source and
timer0 is used as a clock event source.
Timer1 operates as an up-counter with auto-reload enabled.
Timer0 supports both periodic and one-shot operation and is
used to implement tickful and tickless kernel modes
respectively.
Signed-off-by: Alp Sayin <alpsayin@gmail.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Satya Sri <satyasri.katru@amd.com>
Implement the target error callback in the driver to support the new
common I2C target API error callback.
Report timeout through the target error callback based on the target
status.
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
Implement the target error callback in the driver to support the new
common I2C target API error callback.
Report timeout and arbitration errors through the target error callback
based on the target status.
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
Add support for processing buffers with non-multiple-of-block-size
lengths.
Fix mchp_aes support for test_ctr_encrypt_partial which was added by:
e3ac7e9ed5 "tests: crypto: Add AES test cases for Infineon MXCRYPTO"
Signed-off-by: Tony Han <tony.han@microchip.com>
siwx91x_on_join runs on the WiseConnect event-engine thread. Sync NWP
commands from that context (multicast filter via net_if_dormant_off,
DHCP, power-save) block the engine so BLE RX buffers cannot be freed and
the shared pool exhausts. Defer that work to the system workqueue.
Signed-off-by: Devika Raju <Devika.Raju@silabs.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Devika Raju <Devika.Raju@silabs.com>
Add device pm support so the LPUART can be re-initialized
after a low-power state that collapses its power domain
(for example i.MX RT700 deep-sleep-retention), which loses
all peripheral state.
The suspend action saves and masks the enabled interrupts
so a pending interrupt cannot fire its ISR against the
powered-down register bank; the resume action re-initializes
the peripheral and restores those interrupts, and the ISR
bails out while suspended. pm_device_driver_init() establishes
the initial device state.
This relies on the LP_FLEXCOMM parent being resumed first
to re-select the peripheral in the wrapper, which device PM
guarantees via init-priority ordering.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Add device pm support to the LP_FLEXCOMM multi-function
wrapper so it can be brought back after a low-power state
that collapses its power domain (for example i.MX RT700
deep-sleep-retention).
Such a state resets the wrapper: PSELID[PERSEL] clears,
so no communications function is selected and, per the
reference manual, the selected module's register-interface
clock is internally gated -- any access to a child
(LPUART/LPSPI/LPI2C) register then bus-faults.
Add a resume PM action that re-deasserts reset and re-selects
the peripheral, and call pm_device_driver_init() to establish
the initial device state. device PM resumes the wrapper before
its children (it has the lower init priority), so PERSEL is
restored before a child driver touches its registers.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Move the child scan and the LP_FLEXCOMM_Init peripheral-selection logic
out of nxp_lp_flexcomm_init() into a new nxp_lp_flexcomm_select_periph()
helper so it can be reused. No functional change.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
The HAL2 mspi_stm32_xspi_memmap_off() checked whether memory-mapped mode
was active before stopping it, while the legacy one did not, and the
check already exists in mspi_stm32_xspi_abort_memmap_if_enabled().
Drop the check from the adapter and let mspi_memmap_config() go through
that helper, like every other caller already does. The stop is now only
issued while memory-mapped mode is active, which is the documented
precondition of HAL_XSPI_StopMemoryMappedMode(), and both adapters behave
the same again.
On the legacy HAL this means HAL_XSPI_Abort() is no longer called when
memory-mapped mode is not active; that abort had nothing to abort on this
path.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Add the STM32Cube2 (HAL2) implementation of the HAL adapter section,
selected by CONFIG_STM32_HAL2, so the driver also works on series
delivered with STM32Cube2 only, such as STM32C5. Everything below the
adapter section is compiled unchanged for both HAL generations.
The HAL2 adapters mirror the legacy ones one-to-one; the differences
come from the HAL2 API itself:
- HAL_XSPI_Init() takes the instance as an argument and the
controller configuration goes through HAL_XSPI_SetConfig() and
HAL_XSPI_SetFifoThreshold() instead of handle Init fields
- the memory size values are the DCR1 DEVSIZE field content rather
than the raw value, and the memory type constants use a different
prefix, both derived from the same devicetree properties
- commands are sent with HAL_XSPI_SendRegularCmd(), auto-polling is
started with HAL_XSPI_ExecRegularAutoPoll_IT()
- memory-mapped state is read back with HAL_XSPI_GetState() and left
with HAL_XSPI_StopMemoryMappedMode() instead of a plain abort
- the delay block is set up with DLYB_CalculateMaxClockPhase() and
SetConfigDelay(max / 4), matching the legacy PhaseSel = period / 4.
Both calls restore the delay block to the state they found it in,
so it is enabled explicitly afterwards
- the DMA channel is initialized with HAL_DMA_Init(hdma, channel)
plus HAL_DMA_SetConfigDirectXfer() and linked to the XSPI handle
with HAL_XSPI_SetTxDMA()/HAL_XSPI_SetRxDMA()
- the weak HAL_DMA_Abort stubs are not needed, and stm32_bitops.h
does not exist there, so both are legacy-only now
The legacy code kept the SIOO, prefetch, wrap size, delay block
bypass and 16-line data gates; the HAL2 structures have no such
fields. The DMA transfer path compiles against HAL2 but has not been
exercised on hardware yet (no supported board routes DMA to the XSPI
node).
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Prepare the parts shared between the MSPI drivers for STM32Cube2
(HAL2):
- mspi_stm32.h: under CONFIG_STM32_HAL2, use the HAL2 type names for
the XSPI handle (hal_xspi_handle_t) and the XSPI DMA handles
(hal_dma_handle_t). The OSPI/QSPI members are untouched.
- mspi_stm32_common.c: provide the HAL2 GPDMA LL spellings of the
priority, data width and direction values under the existing
driver-local MSPI_DMA_* names, and switch the direction table to
those names (for legacy they map 1:1 to the HAL constants the table
used before, so the table content is unchanged).
Legacy builds compile exactly the same code as before; nothing
selects CONFIG_STM32_HAL2 together with this driver yet.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
When the auto-polling wait times out, the driver aborts the ongoing
operation but ignored the result of the abort. A failed abort likely
leaves the controller stuck, so check it and emit a warning; the
function still returns -EIO either way.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Collect every remaining piece of code that touches a HAL name whose
spelling or call shape differs between the legacy STM32Cube HAL and
STM32Cube2 (HAL2) into small adapter functions, and group them (with
prepare_cmd/send_cmd, the HAL init, the delay block setup, the DMA
init and the weak HAL_DMA_Abort stubs) in one section at the top of
the file:
- memmap_start(): the memory-mapped mode activation tail of
memmap_on(); the rest of memmap_on() is HAL-independent now
- autopoll_start(): builds and starts the auto-polling configuration;
the semaphore/PM handling stays in wait_auto_polling()
- abort(): wraps HAL_XSPI_Abort(), which takes an extra timeout
argument in HAL2
- is_busy(): wraps the busy flag check used by get_channel_status()
- dma_link_tx()/dma_link_rx(): wrap __HAL_LINKDMA(), which HAL2
replaces with HAL_XSPI_SetTxDMA()/HAL_XSPI_SetRxDMA() calls that
can fail, so the adapters return an errno value
Pure code movement plus the listed extractions; no functional change.
A later commit compiles an HAL2 implementation of this section, so
everything below it becomes common code.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Make read_write_in_indirect_mode() return 0 or a negative errno value
instead of HAL_StatusTypeDef, and let the DMA callback pass its
opaque argument straight to HAL_DMA_IRQHandler() instead of going
through a typed local variable.
Every failure return already ended up as -EIO in the caller, so the
behavior is the same. The point is to keep HAL type names out of the
code that will be shared between the two HAL generations: the status
type and the DMA handle type are named differently in STM32Cube2
(hal_status_t, hal_dma_handle_t), while function names like
HAL_XSPI_Receive() and HAL_DMA_IRQHandler() are the same in both, so
the function bodies can stay common.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Introduce a driver-local command structure (opcode, operation type,
address and its length in bytes, dummy cycles, data length) and one
function, mspi_stm32_xspi_send_cmd(), that translates it into the HAL
command structure and sends it. mspi_stm32_xspi_access(),
mspi_stm32_xspi_status_reg() and mspi_stm32_xspi_memmap_on() now fill
the neutral structure instead of the HAL one.
This is the main preparation for STM32Cube2 (HAL2) support: the two
HAL generations use different names for the command type, its fields
and its enum values, so the translation has to live in exactly one
HAL-specific place for the rest of the driver to be shared.
The callers pass an address length of 0 (no address phase, previously
AddressMode = HAL_XSPI_ADDRESS_NONE), 3 or 4 bytes, matching what
mspi_stm32_xspi_hal_address_size() returned for every input, so the
sent commands are unchanged; the helper is removed and the two
"24-bit address" checks compare the address length directly. The
single-line RDSR case reuses the 1-line settings of prepare_cmd()
instead of patching the command afterwards, which results in the same
command. The duplicated SIOOMode assignment in memmap_on() is dropped
(prepare_cmd() already sets the same value).
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Move the XSPI handle Init fields from the compile-time initializer in
the device instantiation macro into mspi_hal_init(), together with
the Instance assignment that mspi_stm32_xspi_config() did. The values
are unchanged; the devicetree-derived data they need (st,csbound,
st,ssht-enable, and the memory size and type of the child node) is now
carried in the driver config structure. The prescaler search loop
moves to a small helper so the Init assignments read as one block.
The Init fields are only read by HAL_XSPI_Init(), which runs at the
end of this function, so filling them at runtime behaves the same.
This prepares for STM32Cube2 (HAL2) support: the HAL2 handle has no
Init member (configuration is passed to HAL_XSPI_SetConfig() at
runtime instead), so a compile-time initializer cannot be expressed
for it and the device macro must stay HAL-agnostic.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Move the Zephyr DMA driver part of mspi_stm32_xspi_dma_init() (device
ready check, dma_config() call, data size check) into a separate
function. This part does not touch the HAL DMA handle, so it can be
reused as-is by the STM32Cube2 (HAL2) variant of the DMA init, which
configures the HAL side with a different API. No functional change.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Replace HAL_XSPI_TIMEOUT_DEFAULT_VALUE with a driver define of the
same value (5000 ms). The STM32Cube2 (HAL2) XSPI driver does not
provide this macro and its transfer functions take an explicit
timeout, so a driver-owned define lets the same call sites work with
both HAL generations. No functional change.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
The DMA priority lookup table pulled its values from DMA_LOW_PRIORITY_*
and DMA_HIGH_PRIORITY, redefining those HAL-namespaced macros as a
fallback on series whose HAL does not provide them. Shadowing HAL
primitive names is best avoided and does not extend cleanly to a second
HAL generation whose priority constants live under different names.
Introduce driver-local MSPI_DMA_PRIORITY_* macros that map to the
per-series constant, mirroring the existing MSPI_DMA_*_DATAWIDTH_*
handling, and populate the table from them. No functional change: each
macro resolves to the same value as before on every series.
Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
Across the tree, I/DCACHE_LINE_SIZE is required at compile-time for
macros, compiler attributes, & linker scripts to function correctly
even if run-time cache line detection is available.
So remove the dependency of ICACHE_LINE_SIZE on
ICACHE_LINE_SIZE_DETECT=n, and of DCACHE_LINE_SIZE on
DCACHE_LINE_SIZE_DETECT=n.
DCACHE_LINE_SIZE_DETECT & ICACHE_LINE_SIZE_DETECT Kconfig options
enable querying some SoC register for finding the i/d-cache line size
at the expense of taking more memory and code and a slightly
increased boot time.
Add new hidden options D/ICACHE_LINE_SIZE_DETECT_SUPPORT only selected
by the software component (arch/SoC layer, driver) implementing the system
cache API.
Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
Recently reworked ICBMSG IPC service backend executes receive callback
from an interrupt context of the mailbox driver. Additional thread is
needed and processing of received messages is deferred to that thread.
It is a similar approach like in case of uart (h4.c). Implementation
utilizes RX buffer holding feature so no need to allocate additional
buffer. IPC RX buffer is hold in the receive callback and thread
releases it.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Added pm_action suspend/resume/turn_on routine for PWM
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Richard Mc Sweeney <Richard.McSweeney@infineon.com>
install_timeout() reports the timeout it settled on with LOG_ERR, on every
call, whether or not anything was rounded, and the message carries an
embedded newline that breaks the log's own framing.
Nothing here is an error: the driver granularity is fixed and a requested
window that does not land on it is rounded by design. Warn instead, only
when a value actually changed, and say what was asked for beside what was
installed - which is the part a caller needs and the old message left out.
Signed-off-by: Arkadiusz Grzelka <devitwise@gmail.com>
The driver waits one millisecond for TCC_SYNCBUSY-style synchronization to
finish, but the watchdog is clocked from the internal ultra low power
oscillator, which reaches the peripheral at about 1.024 kHz on parts of
this family. A single synchronization therefore costs milliseconds rather
than microseconds: enabling the watchdog on a PIC32CM GC00 was measured at
1.12 ms.
The consequence is not only a logged timeout on every boot. The wait
returns while the peripheral is still synchronizing and the driver carries
on writing registers the hardware discards in that state, so the
configuration that ends up in the watchdog is not the one that was asked
for.
Five milliseconds covers the measured value with margin and costs nothing
on a part whose synchronization is quicker, because the wait ends on the
flag rather than on the timeout.
Signed-off-by: Arkadiusz Grzelka <devitwise@gmail.com>
Four properties are read with DT_PROP(DT_NODELABEL(wdt), ...), so the
driver compiles only against a devicetree that labels its watchdog node
exactly `wdt`. Nothing in the binding says so, and a board that picks
another label gets an unknown-node error out of the devicetree macros
rather than anything pointing at the cause. Every other property in the
driver already comes through DT_INST.
The driver is single instance in practice - it defines DT_DRV_COMPAT and
iterates with DT_INST_FOREACH_STATUS_OKAY, but these four values size a
structure and bound a loop at compile time, so they cannot vary per
instance without a larger change. DT_INST_PROP(0, ...) keeps that
restriction exactly as it is and drops the dependency on a label.
Left alone deliberately, and worth a maintainer's eye: the neighbouring
WDT_FLAG_ONLY_ONE_TIMEOUT_VALUE_SUPPORTED reads
only_one_timeout_val_supported_flag from DT_NODELABEL(wdog), a label no
devicetree in the tree defines, and the property appears in no binding.
It survives only because it is tested with #if defined(), which is true
for any object-like macro, so the code it guards is compiled
unconditionally and the macro itself is never expanded. Making the guard
honest would change behaviour on every part this driver serves, which is
not a change to make from one board.
Signed-off-by: Arkadiusz Grzelka <devitwise@gmail.com>
On Microchip SAM0/SAMx54 family SoCs, the MCAN peripheral uses a 16-bit
Message RAM Base Address (MRBA) register relative to 0x20000000.
If MRAM buffers are placed above 0x20010000, the address truncates
and DMA operations access invalid memory locations.
This change introduces a dedicated .mram_noinit section via
zephyr_linker_sources_ifdef in SAM0 common CMake scripts to guarantee
that MRAM buffers are allocated at the start of RAM, staying strictly
within the 64 KB offset limit.
Signed-off-by: Xavier Douville <github@douville.org>
Cap the reinitialization retries in the recovery path: after a fixed
number of consecutive failures, with a growing backoff between
attempts, fail the submission with -EIO instead of retrying forever,
so a detached or dead device cannot spin the RTIO work queue.
Guard the hand-off points the recovery flow relies on: submitting a
work item without a checked-out submission is rejected, and an error
reported with no submission in progress returns the driver to idle so
the next submission can recover. Complete a successful recovery with
rtio_iodev_sqe_ok() instead of an error completion carrying result 0.
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
Stopping and restarting the measurement timer does not bring the device
back once it reports an error: the data stream stays dead until the
board is rebooted. Argus_StopMeasurementTimer() also blocks, and it was
called for every data-ready trigger seen while the device was in error,
delaying the data evaluation that frees the internal buffer and holding
the device in the failed state.
Track the error and the recovery as explicit states so the stop is done
once per error occurrence and an in-progress recovery is distinguishable
from a new failure. Recover by tearing the Argus handle down and
initializing it again through a shared reinitialization sequence, which
restores the stream in place. The initialization and configuration steps
that afbr_s50_init open-coded are factored into that shared sequence so
the recovery path and the initial bring-up run the same code.
Signed-off-by: Luis Ubieda <luisf@croxel.com>
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>