The driver asserted !status on the TRNG SDK calls and always
returned 0. In release builds __ASSERT_NO_MSG is a no-op, so
HW failures were silently swallowed and callers received
success with a possibly zero-filled buffer, poisoning the
xoshiro128 seed and pinning sys_rand_get() to 0.
Return -EIO on any status_t != kStatus_Success in both the
get_entropy and init paths, and propagate the init return
value from the PM TURN_ON action.
Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
Drop the buffer and buffer_size pointer from the data struct and use the
ones in cfg directly, guess this was originally done to avoid using the
data dev pointer in data, but now it's there anyway so we may as well
use it to find back the cfg pointer and use the buffer and buffer_size
from there directly, save few bytes of sram.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The dual-bank error check read SR2 but tested the bank1 ECC error
flags, so bank2 ECC errors were reported based on bank1 bits. Use
the bank2 flags like the rest of the bank2 block.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
PM2STS.GPF (host-command BUSY) is set in the PMC2 IBF ISR and cleared
on the response path. If a sysjump happens in between, the response
never runs and GPF is left set. The new image re-enables the PMC2
interrupt but doesn't clear the BUSY bit, so the host sees a
permanently BUSY interface and every subsequent host command times
out.
Clear PM2STS.GPF in pmc2_it8xxx2_init() before enabling the IBF
interrupt, matching the equivalent fix in the Nuvoton NPCX driver
(host_hcmd_init() in drivers/espi/host_subs_npcx.c clears HIPMST.F0
for the same reason)
Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com>
The RRAM driver was allowing unaligned operations for erase
and write because the underlying PDL driver would correct the
operation doing read-modify-write. Rather than relying on the
lower level implementation to correct the alignements and due
to the fact that the flash apis specifically state that alignment
must be checked, added the check and returned error for
unaligned operations.
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
A plain LPTMR counter that is not the system-timer companion can also
serve as a wakeup source - for example an application arming an alarm
before entering a deep low-power state - but whether it should wake the
SoC is a run-time decision, not a fixed role.
In addition to the companion path, arm the wakeup controller when the
instance has been enabled as a wakeup source at run time
(pm_device_wakeup_enable(), PM_DEVICE_FLAG_WS_ENABLED); the device
declares the capability in devicetree (wakeup-source) and the
application enables it. Register a pm_device so the device can carry the
flag; the action callback has no device power state to manage, so it
accepts suspend/resume and returns -ENOTSUP for anything else. The
registration and the flag check are a no-op unless CONFIG_PM_DEVICE is
enabled, so the companion path stays free of any PM_DEVICE dependency.
Disarming still keys off the static "is a wakeup source" condition and
deliberately does not re-check WS_ENABLED: the run-time flag can be
cleared between arming the alarm and its firing or cancellation, and a
disarm gated on WS_ENABLED would then be skipped, leaving a stale entry
armed in the controller. Because the static condition is a superset of
the arm condition, whatever armed the WUU is always disarmed, and
disarming an instance that never armed is an idempotent no-op.
Build-tested tests/subsys/pm/power_mgmt_soc on frdm_mcxn947.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
When the LPTMR is the system-timer low-power companion, the main system
timer is stopped in deep low-power states and the LPTMR alarm is what
wakes the core. On SoCs that gate the alarm interrupt behind a wakeup
controller (the NXP WUU) the alarm only wakes the SoC once the LPTMR is
armed as a wakeup source, which the driver never did.
Arm the wakeup controller in set_alarm() and disarm it in
cancel_alarm() and the ISR when the LPTMR is a wakeup source -
devicetree both declares it one (wakeup-source) and routes it to a
controller (wakeup-ctrls) - and it is the chosen system-timer companion
(zephyr,system-timer-companion), whose alarm is intrinsically a wake
event. Keying the companion off the devicetree chosen keeps it
independent of the system-timer implementation and needs no device-PM
state; it also covers an application that drives the companion instance
directly (e.g. a system-off wake timer).
The controller is armed and disarmed under the alarm spinlock so a
concurrent set_alarm()/cancel_alarm() pair cannot leave it armed with no
pending alarm (or vice versa); the WUC calls only write registers, so
they are safe under the spinlock and in the ISR. Arming happens before
the alarm is committed and a failure propagates as the set_alarm()
return value rather than a log: on the companion path the console may
already be suspended when this runs, and if the arm failed the SoC would
sleep without waking to flush a deferred message, so only the return
value can act before the sleep. The ISR ignores the disarm result for
the same reason; disarming a devicetree-defined source does not fail.
The companion arms only when it has a deadline to wake for, which falls
out of the alarm lifecycle with no extra check:
- no finite timeout (K_TICKS_FOREVER): the PM core does not hand the
deadline to the companion, set_alarm() is never called and the WUU
stays unarmed, so the SoC waits for another wakeup source;
- finite timeout: the companion is given an alarm, set_alarm() arms
the WUU so the alarm wakes the core.
Disarming keys off the static "is a wakeup source" condition, not on
whether it armed: for the companion this condition never changes, so
arm and disarm always agree and no stale WUU entry is left behind.
Build-tested tests/subsys/pm/power_mgmt_soc and the s2ram / system_off
samples on frdm_mcxn947.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Add a power domain driver for the BCM283X SoC family, enabling VideoCore
firmware-based power management via the mailbox property channel.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
cadence_nand_read_page() allocates main and spare buffers before
submitting the read-page command. Free both buffers on every exit path so
repeated reads do not leak host memory.
Signed-off-by: Old Ding <ai.neo.ae86@gmail.com>
lpspi_end_xfer() only clears TCR CONT/CONTC when SPI_HOLD_ON_CS is
absent from the transfer's config, so that consecutive
spi_transceive() calls within a HOLD_ON_CS transaction keep native
(non-GPIO) CS asserted between transfers, as intended.
However, once the caller finishes the whole transaction and calls
spi_release(), those bits were never cleared, leaving native CS
asserted indefinitely - spi_context_unlock_unconditionally() already
force-releases GPIO-based CS via _spi_context_cs_control(ctx, false,
true), but has no way to know about the LPSPI-specific TCR bits for
native CS.
Clear TCR CONT/CONTC directly in spi_lpspi_release() so that
spi_release() actually deasserts native CS as its API contract
implies, matching the existing GPIO CS behavior.
Confirmed on real hardware (FRDM-MCXN947, LPSPI1 native PCS0): CS
previously stayed low indefinitely after the first HOLD_ON_CS
transaction (as used by the Arduino SPI API, which always sets
SPI_HOLD_ON_CS to support multiple transfer() calls per transaction);
with this fix CS correctly returns high after each endTransaction().
Signed-off-by: Tedd OKANO <okano.akifumi@gmail.com>
There is no 'config UART' base definition in the tree; the only
definition was an accidental bare declaration in the
cy8cproto_062_4343w board Kconfig.defconfig, so every
'select UART' resolved against a phantom bool that gates nothing.
- bluetooth: hci: BT_AIROC: drop the select. BT_H4 already selects
BT_UART, which selects SERIAL and UART_INTERRUPT_DRIVEN, so the
H4 transport is fully covered.
- sensor: explorir_m, fcx_mldx5, s3km1110: drop the select. These
drivers already have 'depends on UART_INTERRUPT_DRIVEN', which
requires SERIAL; replacing the select with 'select SERIAL' would
create a Kconfig dependency loop through UART_INTERRUPT_DRIVEN.
- input: ch9350l: drop the select for the same reason (it depends
on SERIAL_SUPPORT_INTERRUPT and selects UART_INTERRUPT_DRIVEN).
- stepper: adi_tmc: STEPPER_ADI_TMC_UART: replace with
'select SERIAL', matching the sibling STEPPER_ADI_TMCM_RS485
symbol, so enabling the UART bus variant actually enables the
serial drivers.
Found by a full-tree Kconfig audit cross-referencing every defined
symbol against its uses.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Change the boot-time UART clock divider from /3 to /4 (BCLK 80 MHz ->
20 MHz). The BL61x CAN controller is clocked from the UART peripheral
clock (halved by the SJA1000 internal bit-timing divider), and the
previous 80/3 MHz setting cannot be divided down to any standard CAN
bitrate exactly, causing CAN driver init to fail with -ENOTSUP. A
20 MHz UART clock yields a 10 MHz CAN core clock, which divides evenly
into all standard bitrates.
The UART driver computes its baud divisor from the live divider, so
console operation is unaffected.
Signed-off-by: William Markezana <william.markezana@gmail.com>
Add a classic CAN 2.0 controller driver for the Bouffalo Lab BL61x
(BL616/BL618) SoCs. The ISO11898 peripheral is an NXP SJA1000 compatible
PeliCAN core with 8-bit registers on a 32-bit word stride, so it is
implemented as a thin front-end over the shared CAN_SJA1000 driver.
The controller is clocked from the UART peripheral clock domain (halved
for the SJA1000 internal bit-timing divider) and its TX/RX signals reach
GPIO pads through the UART signal multiplexer, configured via pinctrl.
Signed-off-by: William Markezana <william.markezana@gmail.com>
counter_config_info.freq is uint64_t when COUNTER_64BITS_FREQ is
selected, but counter_mcux_gpt logs it with %u and the ITE it51xxx,
ITE it8xxx2 and Xilinx AXI timer drivers with %d. Any build that
compiles one of these drivers with COUNTER_64BITS_FREQ enabled fails
under -Werror=format=.
Log the frequency with %llu and an explicit cast, which is correct
for both the 32-bit and the 64-bit layout of the field.
Signed-off-by: Holt Sun <holt.sun@nxp.com>
Fix up ADC drivers to consistently return -ENOMEM when validation of a
sequence buffer size fails.
Signed-off-by: Pete Johanson <pete.johanson@analog.com>
Adjust the MAX32 and MCUX LPADC drivers to use the new common sequence
buffer validation utility.
Signed-off-by: Pete Johanson <pete.johanson@analog.com>
The configdefault for NET_BUF_ALIGNMENT references DCACHE_LINE_SIZE
unconditionally. On platforms where CACHE_MANAGEMENT is enabled but
CACHE_TYPE is not DCACHE (e.g., EXTERNAL_CACHE for instruction-only
caches), the DCACHE_LINE_SIZE symbol is hidden inside `if DCACHE`
and resolves to 0. Kconfig stores int 0 as an empty string, which
breaks GEN_ABSOLUTE_SYM_KCONFIG and produces an assembler error:
"missing expression".
Add an `if DCACHE` guard and use SDHC_BUFFER_ALIGNMENT for
platforms without DCACHE, which reflects the actual USDHC ADMA2
DMA transfer alignment requirement.
Signed-off-by: Qiankun Li <qiankun.li@nxp.com>
The Kconfig options related to USB common code should be gated by the
STM32_USB_COMMON option. Otherwise, they can appear in Kconfig of builds
where USB is not enabled at all (notably, the options related to logging
configuration were always leaked)
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Keep the timeout calculation in 64-bit arithmetic through the hardware
range validation so that oversized timeouts are rejected instead of being
truncated.
Signed-off-by: Kevin Wang <kevinwang821020@gmail.com>
vs1838b_init() used data_input.port on a pointer, which does not
compile when the driver is built. Use data_input->port.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Add Ethernet driver for the Broadcom GENET MAC controller
found on the BCM2711 SoC, targeting the rpi_4b board.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Add MDIO driver for the Broadcom GENET MDIO controller,
used to access the PHY attached to the BCM2711 GENET MAC.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Add support for the GNSS receiver integrated in the
Ericsson F5521gw (HP HS2340) WWAN module.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Enable Automatic pad/CRC stripping (APCS) for
packets that have a ethertype/lenght <= 1500.
The other option (CSTF) only strips the
FCS for a ethertype greater than 0x0600 (1536).
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
rx and tx errors can happen durring normal
operation, but are not fatal, so we only
log them with debug level to not confuse
the users
Signed-off-by: Fin Maaß <info@finmaass.de>
add support for the esp32 in the generic
dwc_mac driver.
esp32 specific code is based
the init of the original esp32 eth driver in zephyr.
The esp32 uses HW version 3.70.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
on some socs, the dma and mac registers are
in a different order, add the possibility to change that.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The XEC SMB-I2C block samples SCL/SDA asynchronously even when its PCR
SLEEP_EN is asserted and auto clock-stretches SCL on a START until the
clocks recover.
Add an opt-in wakeup-source boolean to the binding and arm the block's
START-bit wake (WAKE_STATUS bit 0 / WAKE_ENABLE bit 0 at offsets 0x60
and 0x64) plus the GIRQ22 source bit during PM_DEVICE_ACTION_SUSPEND
when the property is set and a target is attached.
Signed-off-by: Manimaran A <manimaran.a@microchip.com>
XEC_I2C_SMB_WK_GIRQ was set to 26, but per the MEC172x and MEC175x
datasheets the SMB-I2C START-bit wake events are routed through GIRQ22
(bits 1..5 for controllers 0..4); GIRQ26 is the GPIO 240..261 aggregator
and unrelated.
Signed-off-by: Manimaran A <manimaran.a@microchip.com>
Add a pm_action handler to i2c_mchp_xec_v2 to gate the I2C block clock via
PCR sleep-enable on suspend and restore it on resume.
Hold a PM_STATE_SUSPEND_TO_IDLE policy lock for the duration of each
controller transfer to prevent the system from entering suspend mid-
transaction.
Additionally, acquire the PM_STATE_SUSPEND_TO_IDLE policy lock on address
match (AAT) within the target ISR. Release this lock upon IDLE, external
STOP, and bus error exits. Also, release the lock in target_unregister to
prevent lock leakage if an unregister action races with an in-flight
transaction.
Signed-off-by: Manimaran A <manimaran.a@microchip.com>
Extend generic is31fl319x driver to support is31fl3193 variant.
Similar to 3194 but with slight differences on register and
features.
Reword error message.
Update example in binding of is31fl3194 as well for required
current-limit attribute.
Assisted-by: Claude:claude-sonnet-4.6 Claude-Code
Signed-off-by: Nathan Olff <nathan@kickmaker.net>
Add CAN driver support for Realtek Bee series SoCs,
including RTL87x2G.
This driver supports:
- Classic CAN 2.0A/B
- Standard and Extended identifiers
- Remote and data frames
- Transmission and Reception
Unsupport features:
- CAN FD mode
- Manual recovery
Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
Add initial UART driver support for the ELAN EM32 SoC family. The driver
implements basic polling TX/RX via the Zephyr serial API and instantiates
devices from devicetree when an EM32 UART node is present and okay.
Devicetree:
- Compatible: "elan,em32-uart" (binding included)
Notes:
- The driver is initialized at PRE_KERNEL_1
with CONFIG_SERIAL_INIT_PRIORITY
so the device is ready before the console backend binds.
Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
Add the initial pinctrl driver support for the ELAN EM32 SoC family.
This driver provides basic pin multiplexing and electrical configuration
support. Device tree bindings are included for pin function definitions.
Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
Add the initial GPIO driver support for the ELAN EM32 SoC family.
The driver provides basic GPIO input/output control, pin configuration,
and interrupt handling. Device instances are created from devicetree.
Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
Add clock control drivers for the Elan EM32 AHB and APB domains along with
DT bindings and clock gate IDs.
Model peripheral clock gating with #clock-cells = <1>, where the clock
specifier carries a gate-id. Introduce EM32_GATE_NONE for nodes that only
need a parent clock reference without a hardware gate.
Update the EM32 SoC/board devicetree to pass gate-ids in `clocks`
properties and integrate the drivers into Kconfig/CMake.
Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
clock_monitor_set_source() is declared as a __syscall and has a
z_impl_ implementation, but clock_monitor_handlers.c never provided
the matching z_vrfy_ shim (and its _mrsh.c include) like the other
four syscalls do. With CONFIG_USERSPACE=y the generated syscall
table falls back to the unimplemented-syscall handler, so a user
mode caller of clock_monitor_set_source() faults instead of being
dispatched.
Add the verifier mirroring the other optional op (get_rate): check
the device via K_SYSCALL_DRIVER_CLOCK_MONITOR() and forward the two
scalar cookies to z_impl_clock_monitor_set_source().
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
SBS_GAUGE_CMD_AVG_CURRENT returns a 16-bit signed integer (in mA,
negative when discharging). Cast tmp_val to int16_t before
multiplying by 1000 so negative values are properly extended to
int32_t instead of producing large positive uA values.
Assisted-by: Antigravity:gemini-3.6-flash
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
STM32MP13 has the possibility to use timers IP such as other MCUs
already upstreamed in the project.
Add the necessary clock support to handle it.
STM32_SRC_TIMPCLKx index has been chosed as 1,2 and 6 to match
with the APBx clock used for each timers.
Then we distinguish 3 groups of timers, each one corresponds to
one APB clock used for the timers. In the LL, they are noted as
LL_RCC_TIMG1PRES, LL_RCC_TIMG2PRES and LL_RCC_TIMG3PRES.
We so make the following assocations:
Group 1 - From TIM2 to TIM7:
Use APB1 --> STM32_SRC_TIMPCLK1 --> LL_RCC_TIMG1PRES
Group 2 - For TIM1 and TIM8:
Use APB2 --> STM32_SRC_TIMPCLK2 --> LL_RCC_TIMG2PRES
Group 3 - From TIM12 to TIM17:
Use APB6 --> STM32_SRC_TIMPCLK6 --> LL_RCC_TIMG3PRES
Signed-off-by: Erwan SZYMANSKI <erwan.szymanski@st.com>
In order to prepare the Timers integration of STM32MP13,
this driver needs to be changed a bit.
Indeed, NVIC functions are called by default at some places but
MP13 is cortex A and uses GIC as interrupt controller.
Get inspired by renesas and nxp drivers to add GIC support
in STM32 one.
Signed-off-by: Erwan SZYMANSKI <erwan.szymanski@st.com>