For many of the state checks with timeout, the check
should be very fast (sub 1 microseconds) and the
previous implemention involving busy waits between
checks could add unneeded latency. Change the
timeout checking method to use WAIT_FOR(), with
no extra delays between checks.
Signed-off-by: Mike J. Chen <mjchen@google.com>
Deprecate the use of location_* properties in the i2c_gecko driver
and migrate to the pinctrl api for enhanced maintainability and
compliance with current standards.
Signed-off-by: Arunmani Alagarsamy <arunmani.a@capgemini.com>
This update integrates I2C support with the pinctrl_configure_pins api
within the pinctrl_gecko driver.
Signed-off-by: Arunmani Alagarsamy <arunmani.a@capgemini.com>
Align the SPI init priority with other devices.
Other bus-devices like UART and I2C are init at standard kernel
device level (50), but SPI is at 70 and there appears to not be
a reason for it.
GPIO is init at 40 so there should not be an issue to use the default.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Some devices (like nRF54H20) must have PWM data buffer
stored in appropriate location.
Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
For some hardwares, it is very common that some aligment on the allocated
memory is required. For example, the PxP and eLCDIF of NXP require aligned
buffers so that their performances can be optimal.
Add a new video_buffer_aligned_alloc() API for these needs.
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Non-secure images cannot reference NRF_RRAMC_NS because NRF_RRAMC_NS
does not exist.
TF-M will configure RRAMC according to these Kconfig's before booting
the non-secure image so we ifdef out this code.
Also, rewrite the implementation of commit_changes to also work when
the commit task is not available.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This change restore DCDC configuration after system resumes.
When CONFIG_PM_DEVICE is enabled each of the four rails that
support DCDC handle resume in regulator_da1469x_pm_action function.
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
This adds automatic GPIO latching before going to extended sleep and
restoring state after wakeup.
Mode and state for each pin is stored, then ports are latched to retain
state when PD_COM is disabled during sleep. On wakeup mode and state for
each pin is restored and ports are unlatched to make it work again.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
This enabled extended sleep for Renesas SmartBond(tm).
Extended sleep is low power mode where ARM core is powered off and can
be woken up by PDC. This is default sleep mode when CONFIG_PM is
enabled.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
This adds timer driver for Renesas SmartBond(tm) family.
It uses TIMER2 block which is in PD_TIM power domain so it can work even
if ARM core is disabled, thus can work as a sleep timer.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
This fixes the problem that `adc_raw_to_millivolts` only returns half of
the actual voltage.
Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
Found via static analyis. When `adc_kb1200_start_read` succeeds, no
value is set for `error` so it is still uninitialized when it is
returned.
Signed-off-by: François Baldassari <francois@memfault.com>
Use information encoded in conversion result value to validate it.
Check if MSB bit is set to zero.
Check if channel number included in the result matches channel
number selected for conversion.
Use bitmask to extract converted value instead of math calculations.
Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
k_thread_name_set() function returns an error if CONFIG_THREAD_NAME is
not enabled which may make the driver not functional.
Fix the issue by adding a check against CONFIG_THREAD_NAME avaliability
before calling k_thread_name_set() function so the driver can operate
properly with CONFIG_THREAD_NAME disabled.
Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
Add configuration of internal refference voltage value so raw ADC
readings can be converted to mV utilizing adc_raw_to_millivolts()
ADC API function.
Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
This commit refactors the Intel SSP DAI driver to support dynamic
management of SSP IP. This change additionally separates the management
of the DAI part from the management part of the SSP IP.
Key changes:
- Add new static functions to manage SSP IP power.
- Update the DAI SSP configuration functions to use the new management
approach.
- Update device tree bindings and instances to reflect the new SSP IP
management mechanism.
Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
Fix incorrect note that write only allows to change value of
bit to zero, where proper information is that change is only allowed
from erase-value to the opposite.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The commit adds missing binary or in write operation.
Assuming that program-erase devices only allow switching bits
from erase-value to opposite, in case of 0x00 erase value device
only ones can be written.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This implements basic driver to utilize the I3C IP block
on NPCX.
1. I3C mode: Main controller mode only.
2. Transfer: Support SDR only.
3. IBI: Support Hot-Join, IBI(MDB).
Controller request is not supported.
4. Support 3 I3C modules:
I3C1(3.3V), I3C2(1.8V, espi mode), (I3C3 1.8V or 3.3V)
Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
During DAA, the responding device might not be in the device list.
This CL adds target device descriptor's pointer checking to prevent
getting unexpected results.
Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
1. The only valid values of MCLKD clock frequency
are between 40Mhz to 50Mhz.
2. If DMA is used, the APB4_CLK clock frequency must
be equal to or higher than 20Mhz.
Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
Found via static analysis. In `can_mcan_state_change_handler`, the
return value of `can_mcan_get_state` is not checked for error. In the
event of an error, both `err_cnt` and `state` are left unitialized and
accessed downstream.
The correct behavior is to return early in that case.
Signed-off-by: François Baldassari <francois@memfault.com>
- Configure a UART TX buffer; the backend would otherwise assert in
its configuration or (if the asserts are off) miserably fail when
trying to send anything to the GNSS modem.
- Fine tune the UART RX buffer size and make it depend on whether
satellite data is received.
- Remove unused k_spinlock.
- Make declaration of Kconfig items dependent on GNSS_NMEA_GENERIC
conditional.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
As of now only the resume action is supported, and doesn't perform
any power action on the GNSS modem.
It allows to initialize the GNSS driver later than it would otherwise
be.
Also, the driver now runs a modem-specific chat script on resumption.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Those helpers allow to define some typical kinds of chat matches and
scripts with more ease/less boilerplate.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Fixes overwriting a mailbox before sending it completes.
Overwriting can occur when one thread has waited for
another thread to complete the send function and
fills a mailbox selected based on
the transmit_status_register variable,
which has not been updated after waiting and,
accordingly, does not contain up-to-date information
about the mailboxes used.
Signed-off-by: Mikhail Siomin <victorovich.01@mail.ru>
Remove unnecessary asserts from various CAN controller drivers. These
asserts are all covered by the common CAN subsystem API implementations.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Validate the CAN ID and CAN ID mask used in the can_filter struct before
passing it to the driver.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Mass Storage enumeration failed because udc_stm32_ep_mem_config() was only
increasing priv->occupied_mem on endpoint enable, and not decreasing it on
endpoint disable. Fix the issue by decreasing priv->occupied_mem
on endpoint disable.
Signed-off-by: Arne Bohnsack <arne.bohnsack@draeger.com>
Added write of strobe register after setting long press reset
configuration. This is needed to apply the new value.
Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
1. Correct node label in k64 overlay for ptp test
- Not sure if this actually matters since it appears
that actual hardware is no longer tested in net tests
2. Include fsl_enet with <> instead of "".
3. Build the ptp clock driver only if the ethernet driver is built
- Technically I think the 1588 timer should be able to be used
even if the ethernet mac is not used, but I would imagine this
to be an extraordinarily rare, weird, and niche use case, so to fix
the current CI error caused by net test disabling ethernet drivers,
couple the ptp clock driver to the ethernet driver in the build
configuration.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Negative error codes cannot be returned if the function returns an
unsigned integer. Change function's API to return the read compare
register value through a pointer and the actual result as a signed
integer.
Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
We are not able to achive 50ppm on nRF54L.
Working on fixing it propperly, but untill we do set what we get.
Signed-off-by: Martin Tverdal <martin.tverdal@nordicsemi.no>
add gpio_intel driver with acpi based resource enumeration support.
Also updated test cases overlay with new dts entires.
Signed-off-by: Najumon B.A <najumon.ba@intel.com>
The commit "drivers: ethernet: dsa_ksz8xxx: use
NET_DEVICE_DT_DEFINE_INSTANCE"
(SHA1: f78a081066) replaced
NET_DEVICE_INIT_INSTANCE() with NET_DEVICE_DT_DEFINE_INSTANCE() to
facilitate the removal of deprecated (from Zephyr's 3.2 release)
DT_LABEL() macro.
Unfortunately, the per LAN port initialization is necessary for correct
operation of the DSA driver - otherwise following errors were visible
when LLDP DSA sample (samples/net/dsa/src) was run on ip_k66f board:
<wrn> net_if: iface 0x20001440 is down
<inf> net_dsa_lldp_sample: LLDP pkt recv -> lan1
<inf> net_dsa_lldp_sample: CHASSIS ID: 38:05:43:69:XX:ZZ
<inf> net_dsa_lldp_sample: PORT ID: 38:05:43:69:XX:ZZ
<inf> net_dsa_lldp_sample: TTL: 120s
<inf> net_dsa_lldp_sample: SYSTEM NAME: mtt
<err> net_dsa_lldp_sample: Failed to send, errno 115
The fix is to use again NET_DEVICE_INIT_INSTANCE() with "lan"X name
assigned (to avoid too long names when recommended DT_PROP() is
used instead of DT_LABEL()).
Fixes: f78a081066
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Add an I3C shell. This includes support of all I3C CCC commands that
currently have helper functions implemented. This also includes all
the read/write shell commands that the i2c shell supported. An Info
command is also provided which will print out all i3c and i2c info
of an i3c bus. Only SDR read/writes are currently implemented.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Updates the linker script fragments under 'drivers' to use
Z_LINK_ITERABLE_SUBALIGN for the subalignment instead of
a hardcoded value of 4.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit removes unnecessary usage of the `ARG_UNUSED` macro and
unnecessary initialization of the `ret` variable where its value is
guaranteed to be overwritten by subsequent operations.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Interrupt handlers are expected to have a pototype
void (const void*)
but nrfx_grtc_irq_handler has just a void(void)
(with no input parameter).
Fix it by using a trampoline.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
FTM internal counter can be clocked by one of three clock sources
independent of the module bus clock. This patch introduces a DT property
to perform the clock selection from DT.
DT sources are updated to keep the current clock selection for all boards,
with exception of ucans32k1sic board which is migrated to use system
clock by default, as this seems to be a better choice for most cases.
Some PWM LED samples require slower clock so overlays are added for
those cases.
Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
There is no reason to pass addrlen by pointer, since it is a read-only in
the context of sockaddr_to_nsos_mid().
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
Add support for half-duplex (3-wire) SPI operation using the Raspberry
Pi Pico PIO. To allow control of the size of the driver, including
half-duplex support is optional, under the control of Kconfig options.
The original PIO source code is also included as a reference.
Corrected 3-wire tx/rx counts.
Enable half-duplex code based on DTS configuration
Replace runtime checks with static BUILD_ASSERT()
Remove too-fussy Kconfig options
Removed PIO source per review request
Signed-off-by: Steve Boylan <stephen.boylan@beechwoods.com>
Redundant kLPSPI_MasterPcsContinuous transfer config flag
is eliminated since this is set earlier.
Signed-off-by: Dipak Shetty <dipak.shetty@zeiss.com>
Submit USBFSOTG_EVT_XFER on halt clear to allow queued
transfers to execute as soon as endpoint STALL is cleared.
Signed-off-by: Mark Wang <yichang.wang@nxp.com>
Make DSA dependent on ETH_DSA_SUPPORT which is selected by driver
kconfigs, rather than having a list of dependencies.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Deprecate ETH_MCUX, by:
- Marking it as DEPRECATED in Kconfig, obviously.
- Unmarking the new driver as experimental.
- Putting the new and old drivers in the same folder.
- Reworking the menu appearance of the driver selection.
Note that technically now it is possible to choose the wrong
driver than what is enabled in DT, this is intentional, but
the correct one will obviously be enabled by default.
- Convert all sample overlays to the new Kconfigs. This was
part of the motivation for the shared overlays, as it was
causing twister/CI logs to look ugly and misleading due
to Kconfig warnings.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
I have tested the DSA support with ETH_NXP_ENET driver and it
works, so marking it as supported by adding it to the dependency
list for the DSA feature.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
The MAC address macros are ridiculous in this driver.
Rewrite to be simpler and use eth.h common function.
Also, clarify the mac address generation on the DT overlays.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Convert from multiple threads for each instance to use
one workqueue for all instances. The benefit is to save
memory and use a kernel function that already exists
for a use case like this.
Also introduce the ETH_NXP_ENET_RX_THREAD_PRIORITY kconfig,
which makes the thread priority of the workqueue configurable.
Finally, remove the code enabling the RxBufferInterrupt, since
the meaning of it isn't used currently in this driver.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add functionality for when NET_POWER_MANAGEMENT (ie PM_DEVICE)
is enabled. This function code originally comes from the
old eth_mcux driver which was only tested on kinetis family SOCs,
so that family kconfig is a dependency for this feature for now.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Some comments in this driver are just redundant - the code
spells out exactly what the comment says. And some comment
blocks are just unnecessary to have. Finally, remove the TODO
comment because this is flagged by static analysis and there
are already tracking issues for the zero copy enhancement.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
The dependencies should be in a 'depends on' clause.
Also, 'depends on PTP_CLOCK' is redundant because this is
within 'if PTP_CLOCK' already.
Additionally, conditionally include the PTP header in the mac driver.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Added changes required for nxp_enet ethernet driver to work
with multiple PHYs and fixed few problems:
- The cfg_link API resets PHY before configuring link. It was moved
here so the ethernet driver does not have to reset it - not all
PHYs need reset before configuring link and moving the reset code
here makes possible to have the reset done in a PHY specific way
(for example to reset by toggling GPIO pin). It also avoids ethernet
driver touching PHY registers without locking.
- When reset GPIO is not defined, reset is performed by setting reset
bit in control register.
- The cfg_link API does not return error when autonegotiation fails.
This fixes situation when the link is down at system start - ethernet
driver then skipped setting link-change callback and link was never
to be detected again.
- Added reset of excessive bits 16-31 when reading register values.
As only 16 bits are read from PHY, but the API is supposed to read
into uint32_t, the remaining bits contained previous data after
a successful read.
- Fixed missing mutex unlock when querying link state and link was down.
- Added missing initializer to link state variables. This could result
in link state change detection while link was still down, because
the speed/duplex settings could be random and old and new state
could be wrongly detected as different.
- Not logging link speed/duplex status when link is not up.
Signed-off-by: Stanislav Poboril <stanislav.poboril@nxp.com>
The lpadc driver needs to obtain its functional clock to configure
the acquisition time. This patch add support for I.MX RT three digit
parts, I.MX RT11xx parts, and LPC parts.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
When RX length was 0 and error was reported then UART_RX_STOPPED event
was not sent. Fixing the condition check to ensure that UART_RX_STOPPED
is always generated.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Clean error state on re-enabling RX. If previous transmission ended with
an error it should not impact next receiving session.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
The Open_PDM_Filter_64/128() functions of the third-party OpenPDMFilter
library are designed to handle a fixed PCM block size of 1 ms of audio.
Allow the MPxxDTyy drivers to use a block size of more than 1 ms by
calling the filtering function multiple times, once for each ms of
audio.
Fixeszephyrproject-rtos/zephyr#69447
Signed-off-by: Petar Susac <petar.susac@byte-lab.com>
Adds a DAC driver for Texas Instruments DACx0501 family of devices
Signed-off-by: Eran Gal <erang@google.com>
Co-authored-by: Martin Jäger <17674105+martinjaeger@users.noreply.github.com>
... so that the pin is kept in a defined state when the IO3 line is
not controlled by the QSPI peripheral (when the peripheral is disabled
or disconnected from the pin).
The IO3 pin in Quad SPI flash chips usually has dual functionality -
it is an I/O line when the chip is configured to work in Quad (4 I/O)
mode and it is a HOLD# or RESET# line when the chip is configured to
work in non-Quad (2 I/O) mode. In the latter case, it is important that
the line is kept in the inactive (high) state, otherwise communication
with the chip may be disrupted (and this actually happens when e.g.
the spi_flash sample is used on a brand new nRF5340 or nRF52840 DK -
the nrf_qspi_nor driver fails to initialize and the sample just ends
up with the "mx25r6435f@0: device not ready" message).
This commit addresses the problem in the same way that it was done for
the CSN line in commit 6d8172f4e9.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Some SPI based displays expect the ability to lock the SPI bus after a
transaction completes, or to hold CS low. In order to accommodate this
within the MIPI DBI layer, add the mipi_dbi_release API, which allows
SPI displays to hold then release the SPI bus used by the MIPI
abstraction layer.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Nuvoton NPCX chips have reset registers which allow to reset the
peripheral hardware modules. This commit adds the support by
implementing the reset driver. Note that only the reset_line_toggle API
is supported because of the nature of the reset controller's design.
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Move resetting of the receiver state to disabling function so that once
uart is disabled there is no data pending in the module.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This driver creates a disk_access that transparently reads from and writes
to a file in a file system.
Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
DT nodes and compatible had been renamed and Kconfig option was relying
on the names that do not exists.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Have seen timeout error occur when doing an emit stop at
end of a multiple register write to a mmc5633 mag sensor IC.
The i3c_mcux driver would return on such an error without
doing the k_condvar_broadcast(), since the stop wasn't
technically done (or unclear if it was), and then future
transfers requests waiting on the condvar could be blocked
forever. Add a limited retry when a timeout occurs to
avoid such a stall condition from happening.
Signed-off-by: Mike J. Chen <mjchen@google.com>
`bt_recv` is invoked from the BT long work queue, which is preemptible.
The host uses cooperative scheduling to ensure thread safety.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Removes conditional calling k_busy_wait() on single threaded
systems and uses k_sleep for both single and multi threaded
systems.
Commit e375d82 ("kernel: Implement k_sleep for Single Thread")
eliminated the need to call k_busy_wait() on single threaded
systems in place of k_sleep.
Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
Removes conditional calling k_busy_wait() on single threaded
systems and uses k_sleep for both single and multi threaded
systems.
Commit e375d82 ("kernel: Implement k_sleep for Single Thread")
eliminated the need to call k_busy_wait() on single threaded
systems in place of k_sleep.
Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>