Commit graph

23353 commits

Author SHA1 Message Date
Armando Visconti
858007dc93 drivers/sensor: add Kconfig.trigger_template
Add Kconfig.trigger_template to allow an extensive re-use of
trigger configuration inside all sensor drivers.

This template must be included as in the following example:

    module = LSM6DSO
    thread_priority = 10
    thread_stack_size = 1024
    source "drivers/sensor/Kconfig.trigger_template"

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-12-14 09:28:52 +01:00
Mahesh Mahadevan
3535732580 drivers: dma: Return DMA_STATUS_BLOCK or DMA_STATUS_COMPLETE
Use intA and intB fields of the DMA descriptor to decide when
the interrupt is per block versus when the transfer is complete.
This allows us to return the correct flag to the user.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-12-14 09:28:38 +01:00
Mahesh Mahadevan
7d12d654db drivers: i2s: Set DMA complete_callback flag
The MCUX LPC DMA driver now recognizes the compelete_callback
flag. Set this flag so we receive an interrupt after completion
of every block.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-12-14 09:28:38 +01:00
Mahesh Mahadevan
0dbbc3cc77 drivers: spi: Set the complete_callback flag
The MCUX LPC driver now recognizes the complete_callback
flag. We need to set this flag so we receive a callback
after every block.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-12-14 09:28:38 +01:00
Mahesh Mahadevan
4e14f73216 drivers: dma_lpc: Process complete_callback flag
Add code to recognize the complete_callback flag
and issue the callback accordingly.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-12-14 09:28:38 +01:00
Adam Wojasinski
861ccddb92 drivers: counter: counter_nrfx_rtc: Change HAL to HALY in RTC counter
NRFX has introduced HALY software layer which is a superset of HAL
and aggregates some hardware registers manipulations in a single
function calls.

Quote from nrfx changelog:

"HALY is an extension of the HAL layer that aggregates basic hardware
use cases within single functions. Now it is used instead of HAL
in the corresponding drivers."

This commit zephyr's driver to be aligned with the approach used
in nrfx, where drivers has been switched to use HALY instead of HAL.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-12-14 09:28:15 +01:00
Adam Wojasinski
b7949766e6 drivers: timer: nrf_rtc_timer: Change HAL to HALY in RTC timer driver
NRFX has introduced HALY software layer which is a superset of HAL
and aggregates some hardware registers manipulations in a single
function calls.

Quote from nrfx changelog:

"HALY is an extension of the HAL layer that aggregates basic hardware
use cases within single functions. Now it is used instead of HAL
in the corresponding drivers."

This commit zephyr's driver to be aligned with the approach used
in nrfx, where drivers has been switched to use HALY instead of HAL.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-12-14 09:28:15 +01:00
Florian La Roche
fdcfec0328 drivers: entropy: entropy_esp32.c: remove not necessary cast
This cast already has the correct type on both sides, so it
can be removed.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
2023-12-13 20:12:54 +01:00
Georgij Cernysiov
9f3d9f7594 drivers: spi: stm32: disable cs when spi is done
Deassert CS after SPI is done.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
Co-authored-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
2023-12-13 13:58:03 +01:00
Jędrzej Ciupis
7afeb62e20 drivers: ieee802154: support Key Identifier Mode > 1
IEEE 802.15.4-2020 defines four possible values for Key Identifier Mode
field of the Auxiliary Security Header. The current ieee802154 driver
API only supports two of them: b00 and b01. This commit adds support for
the two remaining Key Identifier Mode values. It's done by replacing a
field that can only hold Key Index into a field that can holds a pointer
to the entire Key Identifier field.

See IEEE 802.15.4-2020, sections 9.4.2.3 and 9.4.4 for further reference.

Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2023-12-13 13:57:24 +01:00
Kevin ORourke
fbfd36e81e drivers: clock_control: stm32: Add HSE CSS support
Add support for enabling the clock security system, which can detect
failures of the HSE clock.

Includes tests for nucleo_h743zi and nucleo_g474re.

Signed-off-by: Kevin ORourke <kevin.orourke@ferroamp.se>
2023-12-13 13:56:43 +01:00
Marc Desvaux
c758f1cc14 drivers: usb: device: usb_dc_stm32 issue USB drivers
Isochronous endpoint issue with USB drivers on STM32G491
we setup an isochronous endpoint and are having an issue
where every other frame sends the desired data sandwiched
between garbage data.

For isochronous the parameter ep_kind into the fonction :
HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, uint16_t ep_addr,
uint16_t ep_kind, uint32_t pmaadress) must be PCD_DBL_BUF.

The parameter pmaadress (EP address in The PMA) is like that:
EP address in The PMA: In case of single buffer endpoint
this parameter is 16-bit value providing the address
in PMA allocated to endpoint.
In case of double buffer endpoint this parameter
is a 32-bit value providing the endpoint buffer 0 address
in the LSB part of 32-bit value and endpoint buffer 1 address
in the MSB part of 32-bit value.


Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-12-13 10:40:23 +01:00
Fabiola Kwasowiec
431da79dfa hda: separation of l1 settings to new function
Separating two new functions force and allow l1
to have the current state with separated functions
in the ipc file so that SOF can call these
functions via IPC DMI_FORCE_L1_EXIT. Change related
to the addition of a new parameter to force
DMI L1 exit on IPC request.

Signed-off-by: Fabiola Kwasowiec <fabiola.kwasowiec@intel.com>
2023-12-13 10:39:17 +01:00
Jeremy Bettis
e268a6ce7d gpio: Add lock around registers and data
Added a spinlock to accesses of registers and struct gpio_ite_data,
except for gpio_ite_isr() function.

Bug #66401

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2023-12-13 09:56:31 +01:00
Armando Visconti
72620baefe tests: drivers: build_all: add die_temp test case
Add test case for all drivers that are supporting the die temperature
feature, and fix right away all the yet undiscovered issues.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-12-13 09:42:23 +01:00
Jukka Rissanen
f9b5dc20f7 drivers: net: loopback: Do not change the original pkt
When we are sending a network pkt, do not tweak the original
packet but the cloned one. The original behavior is ok too, but
logically we should adjust the cloned packet only that is being
received by the stack. This also means that we avoid one extra
copy to tmp variable when sending the packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-12-13 09:42:12 +01:00
Daniel Leung
6d5e0c25a6 xtensa: rename z_xtensa_irq to simple xtensa_irq
This gets rid of the z_ prefix.

Note that z_xt_*() are being used by the HAL so they cannot be
renamed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-12-13 09:41:24 +01:00
Lucas Denefle
d1ba79a070 drivers: cellular: add signal and modem_info API
Implement modem info pulling using the init and periodic chat scripts

Signed-off-by: Lucas Denefle <lucas.denefle@converge.io>
2023-12-12 19:09:33 +01:00
Ricardo Rivera-Matos
16519a5b3c drivers: charger: Updates drivers to use charge_enable handler
Updates existing drivers to make use of the charge_enable handler.

Signed-off-by: Ricardo Rivera-Matos <ricardo.rivera-matos@cirrus.com>
2023-12-12 10:49:39 -06:00
Ricardo Rivera-Matos
d4ed6bacf0 drivers: charger: Adds charge_enable handler
Adds a charge_enable handler to facilitate enabling and disabling
a charge cycle. This deprecates enabling and disable the charge
cycle via the CHARGER_PROP_STATUS property.

Signed-off-by: Ricardo Rivera-Matos <ricardo.rivera-matos@cirrus.com>
2023-12-12 10:49:39 -06:00
Sebastian Schlupp
b504932ae9 drivers: can_sam0: added clock configuration for SAME5x devices
Added clock source configuration depending on SAM SoC series.

Signed-off-by: Sebastian Schlupp <sebastian.schlupp@gmail.com>
2023-12-12 16:25:46 +01:00
Johann Fischer
aad6a81a3b drivers: udc_nrf: submit resume event after RWUP is initiated
Submit resume event after remote wakeup (resume) signalling is
initiated. Handle it same way as in the usb_dc_nrfx driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-12-12 15:34:11 +01:00
Henrik Brix Andersen
fe74ffe2d5 drivers: can: drop POSIX from the native Linux SocketCAN driver name
Rename the native Linux SocketCAN driver to reflect that it can can now be
used in both native_posix and native_sim (with or without an embedded
C-library).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-12-12 14:28:26 +00:00
Jerzy Kasenberg
f1e7a0dd6c drivers: clock_control: smartbond: Fix rc32k calibration
If RC32K oscillator was on during startup, calibration
work was never going to actually calibrate this oscillator.
It happen because lpc_clock_state.rc32k_started was only set when
oscillator was turned on after if was turned off.

Now lpc_clock_state.rc32k_started is also set when rc32k is already
started (possible during boot).

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-12-12 15:03:17 +01:00
Benedikt Schmidt
0861395713 drivers: smbus: implement SMBus driver for STM32
Implement a SMBus driver for STM32, which reuses
the I2C implementation.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-12-12 10:57:41 +01:00
Benedikt Schmidt
fc86d0c3bc drivers: smbus: extract handler function for SMB alert
Extract a helper function for handling an SMB alert, as every
SMBus implementation will have to loop through the peripheral
address which might have triggered the alert.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-12-12 10:57:41 +01:00
Benedikt Schmidt
a0f547aac4 drivers: smbus: add missing includes
Add includes which are actually required for the compilation
in the headers themselves to avoid include dependencies.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-12-12 10:57:41 +01:00
Daniel DeGrasse
2236eaf52c drivers: sdhc: imx_usdhc: add explicit fallthrough to I/O timing setup
DDR50/DDR52 modes should use PINCTRL_STATE_SLOW (50MHz), so the lack of a
break statement after enabling DDR mode is expected. Add an explicit
__fallthrough to resolve the issue flagged by coverity scan

Fixes #65324

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-12-12 10:57:20 +01:00
Daniel DeGrasse
0b365359dc drivers: sdhc: imx_usdhc: explicitly set host_io fields
Explicitly set host_io fields, instead of using memset(). This way the
fields should have values that are defined in the enum types for each
field.

Fixes #63130

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-12-12 10:57:20 +01:00
Conor Paxton
7e192e9e27 drivers: intc_plic: claim interrupt from hart that serviced it
The plic has a very simple mechanism to claim an interrupt as well as to
complete and clear it. The same register is read from/ written to to
achieve this.

Get the ID of the HART that serviced the interrupt and write to the
claim complete register in the correct context
Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
2023-12-12 10:56:20 +01:00
Conor Paxton
4e825f572c drivers: intc_plic: enable contexts for all harts on a platform
The plic uses contexts to seperate irq enables, threshold priority and
claim complete registers from each core for a given platform. As well as
this, each privilege level has its own context.
for multi-core platform's, we need to be able to enable/ disable a
global interrupt for all the cores that are associated with Zephyr.

To do this, we need to make some assumptions:
1. The privilege contexts are contiguous
2. M mode context is first, followed by S mode.

We know how many cpus are used in an application and each cpu's hartid,
thanks to some very handy inline functions. So we iterate through each
cpu and use the hartid of a cpu in the calculation of the context.

While we are at it, In an effort to make the driver more readable,
allign with the macro naming convention outlined in Linux's PLIC driver

Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
2023-12-12 10:56:20 +01:00
Francois Ramu
eeb7a88ff0 drivers: timer: stm32 lptimer adjust the TICKS_PER_SEC to LPTIM clock
With low LPTIM freq when prescaler is set to 16 or 32,
the CONFIG_SYS_CLOCK_TICKS_PER_SEC must be reduced to
LPTIM CLOCK_/prescaler to avoid spurious timer wakeup activity.
Assert error if the CONFIG_SYS_CLOCK_TICKS_PER_SEC
is not compatible with the lptim clock freq.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-12-12 09:52:30 +00:00
Francois Ramu
a19eb7cf88 drivers: timer: stm32 lptimer clock prescaler property
Rename to LPTIM_PRESCALER, the <st,property> prescaler of
the stm32 LPTimer. This commit gives better readability than
LPTIM_CLOCK_RATIO.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-12-12 09:52:30 +00:00
Jun Lin
fde31c03c5 driver: crypto: SHA: npcx: fix SHA driver for npcx4 QS chip
The commit fixes the SHA driver because the ROM API has the following
changes from ES to QS chip:
1. base addres: from 0x13c -> 0x148
2. required SHA context buffer size : from 228 -> 240 bytes

This change also adds a check for the pre-allocated buffer size of the
SHA context when the driver initiliazes.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-12-12 09:52:04 +00:00
Ali Hozhabri
e3ec41e15c drivers: bluetooth: hci: Remove config BT_SPI_BLUENRG
Remove BT_SPI_BLUENRG Kconfig parameter as it is redundant according to
the new changes introduced by ST SPI protocol V1 and V2.

Remove "config BT_SPI_BLUENRG" from the boards that were using it.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-12-11 23:57:49 +00:00
Ali Hozhabri
a67bc25b5f drivers: bluetooth: hci: Introduce ST SPI protocol V2
Introduce STMicroelectronics SPI protocol V2 which is used in BlueNRG-1
and successor devices.

Change the size of the variable "size" to 16 bits as it is necessary for ST
BlueNRG-1 and successor devices.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-12-11 23:57:49 +00:00
Ali Hozhabri
810df7cef9 drivers: bluetooth: hci: Remove header acquisition from bt_spi_send
Replace the header acquisition scope in bt_spi_send with bt_spi_get_header.

Add WRITE_DATA_CONDITION in order not to retransmit data without reading
the header as it is meaningless for ST BlueNRG devices.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-12-11 23:57:49 +00:00
Ali Hozhabri
36b0e26e64 drivers: bluetooth: hci: Restructure spi.c to handle different protocols
Update structure of spi.c to have a better and cleaner separation
between STMicroelectronics and Zephyr SPI protocol.

Introduce bt_spi_get_header to separate algorithms well for
header acquisition in different protocols.

Remove header acquisition from bt_spi_rx_thread to make it simpler.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-12-11 23:57:49 +00:00
Anas Nashif
01264d23db drivers: intc: manage multi-level interrupt configs
Multilevel interrupt configs are leaking into every single build without
this option being enabled, so guard the Kconfig and include files to
avoid this.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-12-11 18:23:23 -05:00
Marcio Ribeiro
8cb870f7de driver: input: espressif touch_sensor
Espressif touch sensor driver implemented.

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2023-12-11 18:31:38 +01:00
Xiao Qin
7c46b0b898 drivers: display: uc81xx: add support for uc8175
Add support for uc8175 display driver. uc8175 has a slightly
different command/data length requirements for certain registers,
namely TRES and PTL, compared to uc8176/uc8179

This commit refactors the driver code and such that setting TRES and PTL
registers are now done by function pointers provided by config->quirks,
by the same token as how it is done for setting CDI register

Signed-off-by: Xiao Qin <xiaoq@google.com>
2023-12-11 15:57:21 +01:00
Cong Nguyen Huu
501384a579 drivers: nxp_s32_netc: configure to grant SI permissions
Configure to grant SI permissions to allow to set MAC,
update hash filter table and promiscuous multicast.

Fixes #66198

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-12-11 12:50:42 +01:00
Yuval Peress
694fa3c293 rtio: Fix i2c implementation
- Allow non RTIO i2c drivers to be intermixed with RTIO drivers
- Remove reference to rtio_spsc_drop_all()
- Fix impllicit cast which throws an error with more restrictive
  compile flags

Signed-off-by: Yuval Peress <peress@google.com>
2023-12-11 10:10:59 +01:00
Bryan Zhu
3e456e8cfb drivers: serial: pl011: Remove busy wait in Ambiq UART initiate
Ambiq UART requires specific busy wait during initialization for
propagating powering control registers, original k_busy_wait()
used here generated a dead loop because k_busy_wait() relays on
timer, who's driver is initialized after UART(UART init in
PRE_KERNEL_1, timer init in PRE_KERNEL_2), replace k_busy_wait()
with checking power status register is more suitable here.

Signed-off-by: Bryan Zhu <bzhu@ambiq.com>
2023-12-11 10:10:39 +01:00
Sylvio Alves
b8d887f0e1 net: wifi: esp32: disable automatic reconnection on leaving
Automatic Wi-Fi station reconnection is forced even when
application requests disconnection. This PR adds a check
in the disconnection event reason to decide whether or not
perform the reconnection.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-12-11 09:57:02 +01:00
Marcus Folkesson
cbae54c7f7 drivers: display: remove dummy functions for unsupported API
As the display API now check against valid callback functions and
returns -ENOSYS (or equalent), there is no need to provide
such functions in the driver code

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
2023-12-11 09:56:42 +01:00
Manuel Argüelles
eee09a55c5 drivers: pwm: mcux_ftm: check against period cycles overflow
The FTM counter modulo register (MOD) holds a 16-bit value, but PWM
set_cycles API allows to set 32-bit cycles values.

Fixes #66226

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-12-11 09:56:15 +01:00
Henrik Brix Andersen
7ddc0f713f drivers: spi: mcux: lpspi: fix error on first configure on MKE1xF
Fix error writing to the CR register on the first call to SPI configure on
NXP MKE1xF. On the first call, the module clock is not enabled and writing
to the CR register will fail.

Fixes: #66036

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-12-11 09:52:20 +01:00
Mahesh Mahadevan
41c2c3d4b8 drivers: dma_mcux_lpc: Clear out the dma channel structure
The DMA channel data structure can retain config information.
We need to clear this everytime dma_configure is called on a
channel.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-12-11 09:52:12 +01:00
Declan Snyder
79b00f6cd3 drivers: nxp_enet: Add link state logging message
Add info logging message to NXP ENET MAC driver about link state.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-12-11 09:50:58 +01:00