Add counter capture support to the GP-Timer driver. A GPIO edge is
routed through the ETM to the timer capture task, latching the counter
value in hardware. Only available on ETM capable SoCs.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Add a missing RTIO completion notification in STM32 I2C v1 RTIO driver
when a device acts in dual mod controller/target and switches to
target mode for data transfer.
Fixes: #112472
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Extend the VBAT driver to support VDDCORE channel on more STM32 series:
- STM32H7R/S
- STM32MP2
- STM32N6
- STM32U3
This is achieved by using different LL APIs which seem more portable
(with the exception of STM32H5 series on which they are not available!)
Adding actual DTSI nodes for the sensors will be done in other commits.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Implement a common function to validate a DAC channel ID (and translate
it to an "index" value, ultimately used to obtain the LL channel value).
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
The number of channels supported by an instance is a fixed value so it
can be saved in the instance configuration instead of the instance data.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
The RTC API does not seem to disallow an alarm matching both a specific
day of the month **and** a specific day of the week at the same time.
However, the STM32 RTC hardware only supports ONE of these two criteria
at a time. Add a check in the STM32 RTC driver to reject attempts to
configure an alarm matching both criteria at the same time.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
This adds word alignment for the shell_out_buffer that may be used
in the log_output_func function that can use fast copying
for word alignment memory.
Signed-off-by: Kamil Jawański-Gawor <kjgawor@baylibre.com>
The low-speed channel update latches the preceding register writes and
can stall for milliseconds if an interrupt preempts the sequence. Lock
interrupts around the start and stop sequences to keep them atomic.
Signed-off-by: Sylvio Alves <sylviojalves@gmail.com>
Note: Control and Bulk transfers only
Add initial usb host driver for Synopsys DWC2 with vendor quirks.
Signed-off-by: Roman Leonov <jam_roma@yahoo.com>
Get core revision:
Different core revisions require different handling.
To have an option to get the revision and apply different
logic add the possibility to read masked revision from
GSNPSID register.
Set PHY Low Power Clock Select:
For the HS UTMI+ PHY interface uses 48MHz for Low speed devices,
instead of 480 MHz. We need to configure this after port
completed a reset.
Frame number:
Add HFNUM register FRNUM field getter, to allow getting the frame
number for the USB host purposes.
Signed-off-by: Roman Leonov <jam_roma@yahoo.com>
In case of FSL_FEATURE_USDHC_HAS_NO_VS18 is definied,
kUSDHC_SupportV180Flag is not defined in fsl_usdhc.h, so it will has
compile issue, the fix is to make 1.8v support to be false in case of
FSL_FEATURE_USDHC_HAS_NO_VS18 is definied.
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Update syscall validation handlers to only validate that API != NULL
if the API is required. Optional APIs have runtime NULL checks in
their implementations, so only permissions and subsystem type needs
to be validated.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
On ESP32-P4 the ROM selects XTAL as the console UART source, and XTAL
is independent of the CPU and PLL frequency. Keep the console on XTAL
across the CPU clock change instead of re-sourcing it to PLL_F80M: that
reference clock is later gated by esp_perip_clk_init(), which would
otherwise leave the console without a clock and stall the first
transmit.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Add the MCUX_EQDC_CLK, MCUX_EQDC0_CLK and MCUX_EQDC1_CLK clock ids and
handle them in the lpc-syscon clock controller so each EQDC instance's
peripheral clock can be enabled, disabled and have its rate queried.
EQDC is clocked from the AHB bus clock on MCXA, so get_rate returns
CLOCK_GetFreq(kCLOCK_BusClk). The handling is guarded by CONFIG_EQDC_MCUX
and is required by the EQDC sensor driver. Free clock ids (0x36 for the
single-instance id, 0x37 for the EQDC0/EQDC1 dual-instance parts) are
used to avoid colliding with the existing CRC clock id.
Co-authored-by: bnina-ayoub <ouba.bnina@gmail.com>
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
Add a sensor driver for the NXP MCUX Enhanced Quadrature Decoder (EQDC)
using the fsl_eqdc HAL. The PHASEA/PHASEB decoder inputs are routed
through the on-chip INPUTMUX, described by an "inputmux-connections"
phandle-array following the nxp,inputmux convention.
The driver exposes SENSOR_CHAN_ROTATION, SENSOR_CHAN_RPM,
SENSOR_CHAN_ENCODER_COUNT and SENSOR_CHAN_ENCODER_REVOLUTIONS; the last
channel is added to the sensor API. Velocity uses the EQDC period
measurement (POSDH/POSDPERH), so a prescaler keeps the 16-bit period
counter from saturating at the sample rate.
A single-phase-mode property selects single-phase decode (one count per
PHASEA pulse, with the direction taken from PHASEB) instead of the
default quadrature X4 decoding, with the counts-per-revolution scaling
adjusted accordingly.
Co-authored-by: bnina-ayoub <ouba.bnina@gmail.com>
Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
Use constants defined in hal_ti for decimation value. This is because
nromally, the value written to reg = decimation rate - 1. So the true
values of decimation rate are 1 to 8, while the value written to reg is
0-7.
The TRM for L series states the following:
```
A decimation rate of decimate-by-4 (DECIM_RATE=0x3) or greater is required
to obtain the minimum entropy which is required to pass the NIST SP800-22
statistical test suite. TI recommends using decimate-by-4 or greater when
using the TRNG in cryptographic applications.
```
This change also fixes the default value to be decimate-by-4 instead of
decimate-by-5 (since previously, it was denoting value written to reg,
not decimation rate).
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
The dt property `ti,clk-div` specifies the clock divider, which is used
to calibrate trng frequency as a fraction of MCLK. This should be used
to calculate true TRNG frequency.
DL_TRNG_CLOCK_DIVIDE_%i is the mapping to CLKDIV register, and thus is
clock divider - 1. So in case clock divider is set to 1 (i.e. use the
base MCLK frequency), TRNG_CLOCK_DIVIDE_RATIO is 0, and
TRNG_SAMPLE_GENERATE_TIME is either 0 or undefined depending on the
order things are parsed, which is incorrect either way.
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Add an optional cellular_get_stats() returning a struct of cumulative
counters, gated on CONFIG_MODEM_CELLULAR_STATS.
Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
Based on the DS18B20 driver. Only the temperature sensor functionality is
exposed by this driver, not eeprom access nor parasite power configuration.
Signed-off-by: Tomas Groth Christensen <tgc@foss.dk>
Generalize the I2C/SPI interface for CS40L26/27 and CS40L5x drivers
and provide a common I2C/SPI implementation for all drivers to use.
Propagates changes to CS40L26/27 and CS40L5x drivers.
Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
Add Hall-effect pulse-output flow meter driver. An ISR increments a
64-bit pulse counter implemented as two 32-bit atomics (low word and
high word) with wraparound detection.
Volume thresholds are stored as a snapshot of the low pulse counter at
arm time plus a delta in pulses. The ISR fires when the unsigned 32-bit
difference (current - snapshot) reaches the delta, which is inherently
wraparound-safe. Sub-pulse thresholds are clamped to one pulse. The
threshold trigger is one-shot: it disarms on firing or when a NULL
handler is registered. Work is deferred to the system workqueue to avoid
running the handler in ISR context.
SENSOR_CHAN_VOLUME reports accumulated volume in liters since boot.
SENSOR_CHAN_FLOW_RATE reports instantaneous flow in L/min, computed at
sample_fetch time from the delta pulse count and elapsed time since the
previous fetch. SENSOR_ATTR_CALIBRATION provides a runtime override for
the pulses-per-liter calibration value. An optional power GPIO can be
asserted at init to enable the sensor module.
Signed-off-by: Nicolas Belin <nbelin@baylibre.com>
Add a controller and PHY driver for the BL808 UHS PSRAM. The PHY read/write
eye is calibrated at boot by sweeping the DQS/DQ delay taps and latency, so
any supported rate works without per-rate constants. Add the devicetree
nodes and enable on the M1S Dock.
Signed-off-by: William Markezana <william.markezana@gmail.com>
Add the UHS PLL, a dedicated PLL that feeds only the UHS PSRAM PHY. It is
outside the system clock tree and brought up on demand; the output
frequency comes from the clk_uhspll devicetree node.
Signed-off-by: William Markezana <william.markezana@gmail.com>
Register structs rely on the compiler emitting 32-bit volatile accesses
and on the struct layout staying in sync with the hardware. sys_read32
and sys_write32 make the access width explicit, work with DEVICE_MMIO
address mapping, and match the convention used by in-tree drivers.
Signed-off-by: Daniel Schultz <dnltz@aesc-silicon.de>
Register structs rely on the compiler emitting 32-bit volatile accesses
and on the struct layout staying in sync with the hardware. sys_read32
and sys_write32 make the access width explicit, work with DEVICE_MMIO
address mapping, and match the convention used by in-tree drivers.
Signed-off-by: Daniel Schultz <dnltz@aesc-silicon.de>
Register structs rely on the compiler emitting 32-bit volatile accesses
and on the struct layout staying in sync with the hardware. sys_read32
and sys_write32 make the access width explicit, work with DEVICE_MMIO
address mapping, and match the convention used by in-tree drivers.
Signed-off-by: Daniel Schultz <dnltz@aesc-silicon.de>
Make uart_aesc_dev_cfg_##no "static const struct" instead of
"static struct" to move this struct into ROM. This reduces the
memory usage for this driver.
Signed-off-by: Daniel Schultz <dnltz@aesc-silicon.de>
Make gpio_aesc_dev_cfg_##no "static const struct" instead of
"static struct" to move this struct into ROM. This reduces the
memory usage for this driver.
Signed-off-by: Daniel Schultz <dnltz@aesc-silicon.de>
Commit f4a2a27071 ("kernel: timeout: make the system clock tick
interface unsigned") changed sys_clock_set_timeout() to take a
uint32_t tick count, and commit c33571b372 ("kernel: timeout: cap
the timeout passed to drivers centrally") removed K_TICKS_FOREVER
from the driver interface. This driver was missed by both, breaking
the build with a conflicting-types error on boards using the RTC JDP
system timer, e.g. frdm_mcxe31b.
Adopt the unsigned prototype, drop the now-meaningless negative-tick
clamp, and replace the K_TICKS_FOREVER test with the new
no-pending-timeout convention: under CONFIG_SYSTEM_CLOCK_SLOPPY_IDLE
the core signals "no deadline" with ticks == SYS_CLOCK_MAX_WAIT, in
which case wait as long as the hardware allows. Other values are
finite and already saturated against cycles_max.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The driver's local RTC_BASE macro collides with the RTC_BASE
peripheral base address macro defined by the NXP MCUX SDK device
headers (e.g. MCXE31B_COMMON.h, pulled in through soc.h), which
breaks the build with a macro-redefinition error on frdm_mcxe31b
when the RTC JDP system timer is enabled.
Rename the driver-local macro to RTC_JDP_BASE so it cannot shadow
the SDK definition. No functional change.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Commit f4a2a27071 ("kernel: timeout: make the system clock tick
interface unsigned") changed sys_clock_set_timeout() to take a
uint32_t tick count, and commit c33571b372 ("kernel: timeout: cap
the timeout passed to drivers centrally") removed K_TICKS_FOREVER
from the driver interface. This driver was missed by both, breaking
the build with a conflicting-types error on any board using it, e.g.
sr100_rdk/sr100 via tests/drivers/build_all/timer.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The syscall is declared with a uint32_t level; the verify handler
had uint8_t, which fails to compile once the generated marshalling
include resolves again.
Signed-off-by: Jonathan E. Peace <jep@alphabetiq.com>
CONFIG_LEGACY_GENERATED_INCLUDE_PATH is deprecated and no longer
enabled by default, so generated headers must be included with the
zephyr/ prefix. Fix the legacy <syscalls/haptics.h> include in the
API header and the <syscalls/*_mrsh.c> includes in the syscall
handlers.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
CONFIG_LEGACY_GENERATED_INCLUDE_PATH is deprecated and no longer
enabled by default, so generated headers must be included with the
zephyr/ prefix. Fix the legacy <autoconf.h> include so the driver
builds without the deprecated compatibility option.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Hello, it's great that this driver has finally been released,
and I'm very impressed with the sheer amount of code. I'm reading
it and can't understand everything, but I have a few questions.
- `silabs_efr32_filter`: I see that the Zephyr API requires setting
and unsetting filters, and the Silabs platform also supports unsetting
filters, but why do we return ENOTSUP when the set variable is false?
- `silabs_efr32_cca` isn't implemented and returns ENOTSUP, but
I see a function called `unslotted_csma_ca_channel_access`
in the upper layer that retrieves the return value of
`ieee802154_radio_cca` (this function wraps the cca API).
If it returns an error other than EBUSY, it will be considered
a fatal error and abort the transmission.
I wonder if it's advisable to return 0 (no errror) so it means
that the CCA software doesn't do anything because the CCA
hardware has already performed the task?
- I've added a variable `testing`
if the `CONFIG_IEEE802154_CARRIER_FUNCTIONS`
configuration is enabled.
Signed-off-by: Phuc Hoang <donp172748@gmail.com>
When CONFIG_NXP_WIFI_IPV6 is not enabled, the
WIFI_EVENT_UAP_NET_ADDR_CONFIG message is never sent to wlcmgr_task
because it relies solely on the NET_EVENT_IPV6_DAD_SUCCEED callback.
This causes WLAN_REASON_UAP_SUCCESS to never be triggered, leaving
applications waiting indefinitely for WIFI_STATUS_AP_SUCCESS.
Send WIFI_EVENT_UAP_NET_ADDR_CONFIG directly in
net_configure_address() when IPv6 is disabled, so the uAP state
machine can proceed to CM_UAP_IP_UP and emit the success event
regardless of IPv6 configuration.
Assisted-by: WChat:Claude
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
The RTC (rtc_jdp) is a single hardware instance that can back either the
counter API or the system timer, but not both at once. When the
zephyr,system-timer chosen property points at an nxp,rtc-jdp node, skip
that instance in the counter driver so the counter and system timer
drivers never bind the same hardware. This mirrors the arbitration in
counter_mcux_lptmr.c.
The driver body is also guarded so that when the only nxp,rtc-jdp
instance is the chosen system timer, no unused counter device or static
functions remain.
Build-tested on frdm_mcxe31b: tests/drivers/counter/counter_basic_api
still instantiates the RTC counter in the default configuration, while
tests/kernel/timer/timer_api builds with the RTC as the system timer and
the counter instance compiled out.
Signed-off-by: Holt Sun <holt.sun@nxp.com>
Add a system timer driver for the NXP RTC (rtc_jdp) IP on the MCXE31x
family. It implements the standard system clock interfaces and is
selected through the zephyr,system-timer chosen property pointing at an
nxp,rtc-jdp node.
The RTC is a free-running 32-bit up-counter with a single absolute
compare register (RTCVAL); the driver runs tickless against it. Because
the RTC keeps counting in all low-power states, it can serve as the
kernel tick source without a companion timer.
RTCVAL is an equality compare that synchronizes into the slow RTC clock
domain and sets INV_RTC while in progress, during which further RTCVAL
writes are ignored. The driver waits for INV_RTC to clear before a write
and, after it, re-reads the counter and retries with the compare bumped
forward if the count has already reached it, so a match is never lost to
the sync latency (a miss would only recur after a full 32-bit wrap). The
scheduling horizon is capped at half the counter range so a compare
cannot wrap past the counter and look like the past, mirroring
mcux_stm_timer.c.
The counter rate (clock-frequency / prescaler) is published at runtime
via TIMER_READS_ITS_FREQUENCY_AT_RUNTIME, making the devicetree
prescaler the single source of truth for the tick rate. The MCXE31x SoC
defconfig disables SysTick and defaults the tick rate when this timer is
selected.
Validated on frdm_mcxe31b: tests/kernel/timer/timer_api passes 15/15.
Signed-off-by: Holt Sun <holt.sun@nxp.com>
On STM32H74x/H75x, prepare_regulator_voltage_scale() selected voltage
scale 0 (VOS0) on every board. VOS0 there is entered via the overdrive
bit SYSCFG_PWRCR.ODEN and is only valid when Vcore is generated by the
LDO (H7 Data Sheets; stm32h7xx_hal_pwr.h). On a board whose pwr node
selects an SMPS-direct/bypass supply (LDO off), setting ODEN drives the
regulator out of spec: ~1.5 V Vcore measured on an STM32H755, above the
1.40 V absolute maximum, risking permanent damage.
This was latent until the VOS0/ODEN fix in v4.4.0 (PR #104749): before
that the ODEN write was silently dropped and the part stayed at VOS1.
On H74x/H75x, select VOS0 only for the supply modes where the LDO
generates Vcore (ldo, smps-ldo, smps-ext-ldo) and use VOS1 otherwise;
enable the SYSCFG clock first so the ODEN write takes effect (on a cold
boot it is otherwise gated until later in SoC init). Other H7 lines do
not use ODEN for VOS0, so their behavior is unchanged.
Signed-off-by: Thomas Peter <thomas.peter@volpi-group.com>
Replace wifi_get_country_code() with wlan_get_country_code() in the
shim driver. The shim driver should call WLAN layer APIs (wlan.h)
rather than internal wifi driver APIs (wifi.h) directly.
Assisted-by: WChat:Claude
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Add support for CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS in the NXP WiFi
driver. When enabled, the driver emits NET_EVENT_WIFI_RAW_SCAN_RESULT
events containing reconstructed 802.11 beacon frames with raw IEs
from each scanned BSS.
This allows applications to access information not available in the
standard wifi_scan_result struct, such as country code, RSN IE, and
mobility domain.
When CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS_ONLY is set, normal parsed
scan results are suppressed.
The raw frame data includes a reconstructed 802.11 MAC header (24B)
and fixed fields (12B) prepended to the IEs, making it compatible
with the existing wifi shell raw scan result handler.
Assisted-by: WChat:Claude
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
Add support for scanning PCIe buses beyond bus 0 using a devicetree
property. Some platforms have PCIe devices on
non-zero buses that are not reachable through bridge
enumeration from bus 0.
Signed-off-by: Bindu S <bindu.s@intel.com>
This adds a driver for the ARM CMSDK APB timer as a system clock.
There exists a similar driver for the ARM CMSDK APB timer as a counter.
Signed-off-by: Mike J. Chen <mjchen@google.com>
Co-authored-by: Wojciech Sipak <wsipak@antmicro.com>
Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
The changes are required to allow using a system timer driver
for the same device with the same compatible string.
The counter driver is used for each instance that is not used as
the chosen system timer.
Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>