All I2C access in crypto_ataes132a goes through
ataes132a_device_config. The i2c field in ataes132a_device_data
field is never written or read.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Table 14-1. ATAES132A Configuration Memory Map says
that key config spans from 0xf080 to 0xf0bf for a total of
16 keys. (0xF080 + (keyid < 2)) uses the boolean operator
instead of bit shift operator and produces values.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
EncryptOK is represented by bits 1 and 2 and the proper
mask is (BIT(1) | BIT(2)) and not (BIT(1) & BIT(2)) that
evaluates always to 0b00.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Make static the function ataes132a_atmel_crc implemented in
the private header to avoid possible linkage error if the file
is inlcluded ina different object unit.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Fix gpio_sam_port_toggle_bits() and gpio_sam_port_set_masked_raw()
PIO_MSKR need to be set before configure PIO_ODSR.
Signed-off-by: CHEN Xing <xing.chen@microchip.com>
Add a required ngpios property to the BCM2711 pinctrl binding
and set it in the SoC dtsi. Update the driver to read the number
of GPIOs from devicetree via DT_INST_PROP.
This makes the GPIO count explicit in devicetree and avoids
hardcoded assumptions in the driver.
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
Update the modem script to activate the flight mode before setting the
APN (AT+CGDCONT), otherwise the APN is not configured properly in the
modem and network connection may fail.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The MCXW7x clock controller configured the OSC32K 32 kHz crystal
oscillator with an 8 pF internal load capacitance (cap value 4) on
both the XTAL and EXTAL pins, and hardcoded the amplifier coarse
gain to Range0. This configuration leads to a clock precision issue
of around 180 ppm on the 32 kHz clock.
A 16 pF internal load capacitance is the best configuration to
achieve the best precision, together with a per-SoC coarse amplifier
gain. Fix the default configuration:
- Use a 16 pF internal load capacitance on XTAL and EXTAL.
- Add an osc32k-coarse-adjustment devicetree property so the coarse
amplifier gain is configurable (the driver previously forced
Range0), and wire it into the CCM32K oscillator config.
- Set the coarse gain per SoC: Range3 on MCXW72, Range1 on MCXW71.
MCXW70 is aligned with MCXW72 (Range3).
Also add named dt-bindings macros for the OSC32K load capacitance
(MCXW_CLK_OSC32K_CAP_*pF, value N maps to 2*N pF) and coarse gain
(MCXW_CLK_OSC32K_COARSE_RANGE*) so the devicetree no longer relies
on opaque magic numbers.
Built samples/hello_world for frdm_mcxw70, frdm_mcxw71 and
frdm_mcxw72 and verified the generated devicetree resolves to 16 pF
caps with coarse gain Range3 (W70/W72) and Range1 (W71).
Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
Packets with dribbling error flag set but with valid CRC
should not be discarded, as they are valid.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
For most cellular modem drivers, the PPP net device was
initialized at POST_KERNEL priority 98,
which is after net_if_init() runs at POST_KERNEL priority 90
After PR #112499 net_if_init() skips interfaces whose device is
not yet ready, so the PPP interface was never initialized
and cellular drivers failed to start.
Remove the _prio parameter from MODEM_DEV_PPP_DEFINE,
MODEM_DT_INST_PPP_DEFINE and MODEM_PPP_DEFINE, replacing the
hardcoded 98 with CONFIG_KERNEL_INIT_PRIORITY_DEFAULT (default
40). This matches the priority already used by drivers/net/ppp.c
and ensures the PPP device is ready before net_if_init() checks
it.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The flash_controller node is defined using the non secure
alias regster. Add a macro to switch between the secure
and non secure one correctly.
Also properly call the serial_memory_setup function to
init the object.
Signed-off-by: Laura Carlesso <laura.carlesso@infineon.com>
The compat string is updated in device drivers to align with
changes in binding files.
Added depends on $(dt_compat_on_bus,$(DT_COMPAT_[DEVICE]),mspi)
to device Kconfig.
Signed-off-by: Swift Tian <swift.tian@ambiq.com>
Change check for unsupported event registration in order to avoid
having to update the LTDC driver everytime a new event is added.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
The consecutive chat-script failure limit, after which the driver gives up
on the current attempt and suspends, was a hard-coded define. Move it to
Kconfig so it can be tuned per application.
Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
Init-script and CMUX-connect failures both enter a recovery that resets or
power-cycles the modem and re-runs the full bring-up, with no attempt cap
and no delay between attempts. A persistently failing modem therefore loops
through hardware resets indefinitely, thrashing the power rails, while the
per-script failure path already caps and suspends.
Add a recovery state that backs off before resetting (delay grows per
attempt, up to a ceiling) and cap the consecutive attempts: once the budget
is exhausted the driver suspends to idle instead of resetting forever,
matching the script-failure behaviour. The counter resets when CMUX
reconnects. The attempt cap, backoff step and ceiling are Kconfig-tunable,
and a zero cap keeps unlimited retries.
Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
Propagate prepare_send_cmd() failures through validate_and_prepare() as
socket-style errors.
When send command preparation fails, translate the returned error code to
errno and return -1 so the socket send path reports failures consistently
with the rest of the offload API.
Keep successful command preparation returning 0.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Move the generic GNSS NMEA match data to the start of the HL78XX GNSS
runtime structure.
The generic gnss_nmea0183_match_* callbacks cast user_data directly to
struct gnss_nmea0183_match_data, so the embedded match_data member must
be at offset zero in struct hl78xx_gnss_data.
Add a static assertion to catch future layout changes that would break
that assumption.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Harden selected HL78XX socket helper paths.
Move IPv4/subnet splitting earlier in the socket implementation and
validate its inputs before copying. Reject NULL inputs, zero-sized output
buffers, empty address/subnet parts, and output buffers that are too
small instead of silently truncating the parsed values.
Add defensive checks before accessing offload socket state in
modem_process_handler(), socket_notify_data(), and KTCP notification
handling so invalid or incomplete state cannot be dereferenced.
Validate send command arguments before formatting TCP or UDP send
commands, and reject UDP sends without a destination address.
Require socket data notifications to include both socket ID and queued
byte count before parsing them.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Wake socket waiters before marking a drained TCP socket as errored.
Some modem socket wait paths do not signal data-ready semaphores after a
socket has been marked disconnected. Notify the waiter while the socket
is still considered connected, then apply the deferred TCP error and
clear the pending error state.
This lets blocked receive paths wake up and observe the deferred socket
error instead of remaining asleep after the modem reports a remote
disconnect with no unread data left.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Move `binary_str_to_byte()` outside the low-power configuration guard
since it is used independently of `CONFIG_MODEM_HL78XX_LOW_POWER_MODE`.
This allows the helper to be shared by code that is built regardless of
low-power support while keeping `byte_to_binary_str()` scoped to the
low-power configuration.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Handle quoted active time and periodic TAU fields when parsing CEREG
responses.
The modem reports PSM timer fields as quoted 8-bit strings, but the
driver stores the raw 8-bit value without quotes. Strip matching quotes
before validating and copying the timer field.
Update the CEREG unit test to pass modem-style quoted timer fields and
expect the normalized unquoted values in the cached registration state.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Rename the CEREG parser boolean from is_urc to has_n_param.
The parser needs to know whether argv contains the query response <n>
parameter before <stat>. Query responses use:
+CEREG: <n>,<stat>,...
while URCs use:
+CEREG: <stat>,...
Use has_n_param to describe the actual parsing decision and update the
caller to pass true when both <n> and <stat> are present.
This avoids treating the flag as a generic URC indicator and makes the
status field index calculation clearer.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Reject PLMN strings that contain more digits than the parser can store.
Previously the parser stopped collecting digits when the local buffer was
full and continued scanning the rest of the string. This could allow an
overlong numeric operator value to be truncated and parsed as if it were
valid.
Return false as soon as the digit buffer would overflow so invalid
operator strings are rejected instead of silently truncated.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Remove the modem chat header include from the public HL78XX API header.
The public API only needs to expose pointers to struct modem_chat_match,
so forward declare the type instead of pulling in
<zephyr/modem/chat.h>. This reduces the header dependency surface for
users of the HL78XX API.
Include <zephyr/modem/chat.h> directly in hl78xx_apis.c, where the full
modem chat definitions are needed.
Also keep the GNSS auxiliary data types and callback registration macros
available from the public API header instead of hiding them behind
CONFIG_HL78XX_GNSS_AUX_DATA_PARSER, so code can compile against the API
types regardless of that build option.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Move auxiliary GNSS NMEA parsing helpers into a dedicated parser module.
Add hl78xx_gnss_aux_parse.c and hl78xx_gnss_aux_parse.h for parsing GSA,
GST, and PSEPU argument lists into HL78XX auxiliary GNSS data. Keep UTC
and optional milli-unit parsing private to that module.
Leave modem chat callback handling in hl78xx_gnss_parsers.c, where the
callbacks can update runtime GNSS state and publish auxiliary data. This
keeps the parsing logic testable without coupling it to modem chat
callback flow.
Build the new auxiliary parser module when HL78XX GNSS support is
enabled.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
Move GNSSLOC-specific parser helpers into a dedicated source file.
Create hl78xx_gnssloc.c and hl78xx_gnssloc.h for parsing GNSSLOC DMS
coordinates, values with units, speeds, and GPS time strings. Keep the
NMEA parser file focused on NMEA sentence callbacks and shared NMEA
helper logic.
Build the new GNSSLOC parser file when HL78XX GNSS support is enabled,
and include the new header from the existing GNSS parser implementation.
This also lets unit tests target the GNSSLOC helpers directly without
pulling in unrelated NMEA callback code.
Signed-off-by: Zafer SEN <zafersn93@gmail.com>
send_buf uses NRF_GPIO as the GPIO controller base address.
NRF_GPIO is defined as NRF_P0 in sdk-hal_nordic/nrfx/mdk,
so with pins not belong to GPIO0,
it causes data to be sent to the wrong pin.
At compile time get the GPIO controller register address
from devicetree, and calculate the OUTSET base address
with struct NRF_GPIO_Type.
Tested on nRF52833 hardware.
Signed-off-by: ZF Yu <ez4y2f@icloud.com>
Call i2c HAL init after HW FSM reset so i2c_recover_bus() leaves
the controller ready for the next transfer on C5/C6/H2/P4. Return
-EIO on master ACK errors per Zephyr I2C API.
Fixes testcase errors on `tests/drivers/i2c/i2c_at24` for the above
mentioned devices.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
This patch adds driver support for TI ECAP module which can capture an
external input or work as a standalone APWM generator.
Signed-off-by: Amneesh Singh <amneesh@ti.com>
Enable the iProc endpoint driver by default when the corresponding
devicetree node is present.
Drop the now-redundant board defconfig selections from the bcm958402m2
variants.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
ADd `brcm,iproc-pcie-ep-v2` to represent the version difference
with `brcm,iproc-pcie-ep`.
This property can replace the CONFIG_PCIE_EP_IPROC_V2.
So, we removed it.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Enable the following G1 DAC Kconfig options by default for
Microchip SAM D5x/E5x devices:
- DAC_MCHP_G1_REFRESH
- DAC_MCHP_G1_EXTERNAL_FILTER
- DAC_MCHP_G1_OVERSAMPLING_RATIO
These Kconfig symbols were introduced during the addition
of DAC driver support for PIC32CX SG family devices, but
the default enablement for SAM D5x/E5x devices was missed.
Signed-off-by: Arunprasath P <arunprasath.p@microchip.com>
loading the mac address for stm32 is
the same for all 4 stm32 ethernet drivers,
combine that into a shared function.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Previously Max3421e driver locked and unlocked `uhc_data` mutex by using
`k_mutex_lock()` and `k_mutex_unlock()` instead the already existing
uhc helpers: `uhc_lock_internal()` and `uhc_unlock_internal()`.
Signed-off-by: Benjamin Jurewicz <bjurewicz@internships.antmicro.com>
Some RCP modules (e.g. IW61X) require an asynchronous firmware load
sequence before the 15.4 SPI interface becomes operational.
The firmware is uploaded via a separate transport (e.g. BT UART H4),
Without this option, Zephyr's net_if_post_init() automatically brings up
the OpenThread interface at boot, before the RCP is ready, causing Spinel
command failures and NULL dereferences.
Add CONFIG_HDLC_RCP_IF_SPI_DEFERRED_INIT (default n, preserves existing
behavior) which:
- hdlc_iface_init(): skip ieee802154_init(), set NET_IF_NO_AUTO_START
to block net_if_post_init() from starting the interface
before the RCP is ready.
- hdlc_rcp_if_spi_init(): skip SPI IRQ arming and RCP reset,
- hdlc_deferred_init(): arms the SPI IRQ and clears NET_IF_NO_AUTO_START.
Signed-off-by: Jean-Yves Salaun <jean-yves.salaun@nxp.com>
In hdlc_rcp_if_push_pull_spi(), two cases cause OpenThread Tx
timeouts and RCP resets on the host side.
- RECV_LEN undersized when data->rx_len == 0
When the host sends a frame and no RX is pending, RECV_LEN was
unconditionally set to CONFIG_HDLC_RCP_IF_SPI_SMALL_PACKET_SIZE.
As RECV_LEN is less than tx_len, the RCP does not answer and the
host goes into Tx timeout.
Fix: set RECV_LEN to max(CONFIG_HDLC_RCP_IF_SPI_SMALL_PACKET_SIZE,
tx_len), matching the OpenThread POSIX reference implementation
- No retry when RCP RECV_LEN < tx_len
When peer_max_rx (slave RECV_LEN) < tx_len, the outgoing frame was
silently dropped after logging a warning.
Fix: The host must keep tx_len and tx_ready
to retry on the next SPI transaction.
Signed-off-by: Jean-Yves Salaun <jean-yves.salaun@nxp.com>
Add support for decompressing the initrd before using it as the RAM Disk.
For now, only LZ4 compression is supported.
It is advised to use smaller block sizes for the compressed initrd to
reduce the size of heap memory required for decompression.
Requires adding the lz4 external module on application layer.
Signed-off-by: Svitlana Drozd <svitlana_drozd@epam.com>
Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
The driver used a macro which was effectively a reimplementation of the
`_current_cpu` macro, but less safe. Use the real `_current_cpu` macro
directly and drop the driver's handrolled version.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
The PMUX register was not being properly cleared before setting
the new mux value. This causes incorrect pin configuration when
the register contains non-zero initial values.
Signed-off-by: Fabin V Martin <Fabinv.Martin@microchip.com>
The siwx91x SPI driver required to wait for a very small amouth of time
(100ns to 50µs).
When CONFIG_PM is enabled, the granularity of k_busy_wait() is not
sufficient (~32µs). So, the driver implement a raw busy loop.
This busy loop depends on the frequency of the CPU. This was wrongly
retrieved from CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC.
DT_PROP(DT_NODELABEL(cpu0), clock_frequency) is more accurate.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
When the SPI hardware block is use to send data (without receiving any
data), the DMA callback is called when the data are transmitted to the SPI
controller, but before the data are actually sent over the wire.
Then, the chip-select signal could be released while the Tx was still in
progress.
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
When processing LE Extended Advertising Report events in
is_hci_event_discardable(), the evt_type field of adv_info[0] may
reside at an unaligned address. This occurs because evt_data can
point to shared memory (e.g., IMU buffer) at an odd address, and
the evt_type (uint16_t) ends up at an odd offset after the packed
struct layout.
On Cortex-M33 with UNALIGN_TRP enabled, this causes a HardFault.
Use sys_le16_to_cpu() to read the evt_type field, which ensures
the compiler generates byte-level access (LDRB) for the packed
struct member, avoiding the unaligned LDRH instruction.
Signed-off-by: Gang Li <gang.li_1@nxp.com>
Add a periodic script that queries the current serving cell info and
broadcasts it out through the `CELLULAR_EVENT_NETWORK_STATUS_CHANGED`
event. Drop the periodic script frequency down to every 30 seconds for
this modem as it is not used as a comms keepalive check.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Subscribe to the CEREG URC that contains more information about the
registration state, specifically the access technology that
`modem_cellular` consumes.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Add generic 3GPP modem queries to the init path so that
`CELLULAR_EVENT_MODEM_INFO_CHANGED` events fire on modem startup. The
SIM card IMSI can only be queried after putting the modem into full
functional mode (`AT+CFUN=1`) and even then only after a short delay.
Signed-off-by: Jordan Yates <jordan@embeint.com>
The nRF93M1 has been observed to take up to 1.5 seconds to send its
"RDY" message after the CMUX disconnect occurs. Set the timeout to
double this value. In normal operation this timeout is never hit, as
the state machine continues on as soon as the "RDY" event is received.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Allow modem driver to explicitly set the timeout for the modem to return
to AT mode after CMUX disconnects. If not specified, it falls back to
the current behaviour (`reset_pulse_duration_ms`).
Signed-off-by: Jordan Yates <jordan@embeint.com>