Commit graph

23353 commits

Author SHA1 Message Date
Erwan Gouriou
8cd8e53faf drivers: ethernet: stm32: Remove deprecated API support on impacted series
In release V3.3 new STM32Cube HAL ethernet API was added to STM32 ethernet
driver for STM32F4, STM32F7 and STM32H7 series. At the same time, the
legacy API was deprecated for these series.
I'm now fully removing the legacy API support for these series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-05-28 09:52:20 +02:00
Pisit Sawangvonganan
f503b7a26d drivers: serial: stm32: replace config parameter with usart
Updated function parameters from `const struct uart_stm32_config *config`
to `USART_TypeDef *usart`. This change reduces the level of pointer
indirection, which minimizes repeated dereferencing and helps reduce
the overall code size.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-05-28 09:49:09 +02:00
Pisit Sawangvonganan
86e0fe13e1 drivers: serial: stm32: reduce pointer level from config->usart to usart
This change reduces the level of pointer indirection, which minimizes
repeated dereferencing and helps reduce the overall code size.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-05-28 09:49:09 +02:00
Andrzej Głąbek
7abb9d7593 drivers: watchdog: Allow WDT_DISABLE_AT_BOOT only when supported
Introduce a hidden Kconfig option named HAS_WDT_DISABLE_AT_BOOT and
allow users to enable WDT_DISABLE_AT_BOOT only when that hidden option
is selected by a watchdog driver, i.e. disabling at boot is supported.
Select this new hidden option for all existing watchdog drivers that
refer to WDT_DISABLE_AT_BOOT.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2024-05-27 08:40:16 -07:00
Pisit Sawangvonganan
512c18393a drivers: clock_control: stm32: clean up unnecessary code
This commit removes unnecessary initialization of the local variable
where its value is guaranteed to be overwritten by subsequent operations.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-05-27 08:16:30 -07:00
Pisit Sawangvonganan
37466ac887 drivers: clock_control: stm32: fix typo
Use a code spell-checking tool to scan and correct spelling errors in
the following files:
- clock_stm32_ll_common.c
- clock_stm32_ll_h5.c
- clock_stm32_ll_h7.c
- clock_stm32_ll_u5.c
- clock_stm32_ll_wba.c

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-05-27 08:16:30 -07:00
Reto Schneider
58cb4557f0 net: ppp: Optimize memory allocation
net_pkt_alloc_buffer() deducts the free space from the requested number
of bytes.

As ppp_save_byte() calls net_pkt_alloc_buffer() when the packet has one
byte available still, this causes all but the first net_buf in the
packet to be of size CONFIG_NET_BUF_DATA_SIZE - 1.

Consequences:
 - With CONFIG_NET_BUF_FIXED_DATA_SIZE enabled, one byte per net_buf
   gets wasted.
 - CONFIG_NET_BUF_DATA_SIZE has typically an even, likely even a power
   of two value. Using exactly one byte less per buffer causes
   operations that require aligned memory (e.g. DMA) to become
   inefficient or to not work at all.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-05-27 08:15:36 -07:00
Joakim Andersson
3ad57e3030 drivers: spi_bitbang: Fix timing in SPI bitbang driver
Fix timing in SPI bitbang driver.
The issue occurs with CPHA=1 when the input data is changed immediately
after the clock shift on the last bit of the read.
Because we read the input bit after changing the clock, this bit
becomes invalid.
Instead of doing wait, clock-change, read. Do wait, read, clock-change.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
2024-05-27 05:42:26 -07:00
Aaron Ye
3f56baa295 drivers: bluetooth: hci: add retry mechanism for Apollo SPI busy scenario
The controller may be unavailable to receive packets because it is busy
on processing something or have packets to send to host. Need to free the
SPI bus and wait some moment to try again.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2024-05-27 03:27:43 -07:00
Aaron Ye
47ce99f7b0 drivers: bluetooth: hci: correct the Ambiq Apollox support BT feature
The BLE controller of some Ambiq Apollox Blue SOC may have issue to
report the expected supported features bitmask successfully, thought the
features are actually supportive. Need to correct them before going to
the host stack.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2024-05-27 03:27:43 -07:00
Aaron Ye
af54a38827 drivers: bluetooth: hci: add Ambiq Apollo3 Blue SOC support
This commit add the SPI-based HCI support for the Ambiq Apollo3 Blue
SOC (e.g. Apollo3 Blue Plus, Apollo3 Blue) support.
Also correct the dependency of necessary peripheral.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2024-05-27 03:27:43 -07:00
Aaron Ye
d84874309e drivers: spi: create Ambiq SPI BLEIF driver
Some Ambiq Apollox Blue SOC (e.g. Apollo3 Blue) uses internal designed
BLEIF module which is different from the general IOM module for SPI
transceiver. The called HAL API will also be independent. This driver is
implemented for the BLEIF module usage scenarios.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2024-05-27 03:27:43 -07:00
Flavio Ceolin
e1685bb421 stm32: power: SoC restores the clock
Clock must be restored as soon as the SoC leaves standby.
Keep the logic inside the SoC instead of delegate it to the pm
subsystem.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-05-27 02:10:03 -07:00
Flavio Ceolin
5ca3bc92c8 intel_adsp: power: SoC restores the clock
The SoC restores the clock only when leaving soft-off only.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-05-27 02:10:03 -07:00
Lucas Tamborrino
e282b0ea84 soc: esp32xx: refactor clock and RTC subsystems
The RTC subsystem in espressif's SOCs, among other tasks
is responsible for clock selection for CPU and for low
power domain clocks such as RTC_SLOW and RTC_FAST.

This commit allows for proper clock source and rate
selection for CPU, using the espressif,riscv and
espressif,xtensa-lx6/7 bindings.

It also enables clock selection for RTC_FAST and RTC_SLOW,
that impacts some peripherals, such as rtc_timer.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2024-05-27 01:37:18 -07:00
Henrik Brix Andersen
6a070ee165 drivers: can: shell: print raw DLC when sending frame, not bytes
Print the raw DLC when enqueuing a CAN frame for sending, not the
corresponding number of bytes.

Fixes: #73309

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-05-27 07:45:01 +02:00
Henrik Brix Andersen
fb4f67b775 drivers: can: shell: fully initialize frame before sending
Zerorise the CAN frame before filling in data to ensure all data bytes are
initialized.

Fixes: #73309

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-05-27 07:45:01 +02:00
Yong Cong Sin
7248efcd59 drivers: intc: update to use multi-level API
Update these multi-level interrupt drivers to use the new API.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-25 11:24:32 +03:00
Yong Cong Sin
a512f68f14 drivers: intc_dw_ace: convert to use instance-based macros
Define the DRV_COMPAT and use instance-based device DT macros.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-25 11:24:32 +03:00
Yong Cong Sin
5d9e266d13 drivers: interrupt_controller: irq_steer: use new multilevel irq impl
Update the NXP's irq_steer driver to use the new multi-level
interrupt implementation.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-25 11:24:32 +03:00
Yong Cong Sin
8f9ebb652f drivers: intc: plic: simplify isr handling
Save the reference of the start index of the `_sw_isr_table`
to the config struct, so that the `local_irq` can be used  as
offset directly.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-25 11:24:32 +03:00
Yong Cong Sin
c5f5b964c1 arch: sw_isr: revamp multi-level interrupt architecture
Previously the multi-level irq lookup table is generated by
looping through the devicetree nodes using macros & Kconfig,
which is hard to read and flimsy.

This PR shifts the heavy lifting to devicetree & DT macros such
that an interrupt controller driver, which has its info in the
devicetree, can register itself directly with the multi-level
interrupt architecture, which is more straightforward.

The previous auto-generated look up table with macros is now
moved in a file of its own. A new compatibility Kconfig:
`CONFIG_LEGACY_MULTI_LEVEL_TABLE_GENERATION` is added and
enabled by default to compile the legacy look up table for
interrupt controller drivers that aren't updated to support the
new architecture yet.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-25 11:24:32 +03:00
Yong Cong Sin
c57f9f12a2 drivers: intc: VPR CLIC should make sure GEN_IRQ_VECTOR_TABLE is enabled
VPR cores CLIC supports vectored mode only. Select
`GEN_IRQ_VECTOR_TABLE` such that it can't be disabled.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-25 11:24:32 +03:00
Axel Le Bourhis
ee03123dd1 drivers: hci: Add NXP HCI driver
Add HCI driver generic to NXP platforms.
Update west.yml to have ble support for rw61x

Signed-off-by: Axel Le Bourhis <axel.lebourhis@nxp.com>
Signed-off-by: Yassine El Aissaoui <yassine.elaissaoui@nxp.com>
2024-05-25 11:23:04 +03:00
Andrzej Kaczmarek
2e2aeb13ed drivers: bluetooth: da1469x: Fix deferred buffer allocation
If rx buffer allocation has to be deferred to rx_thread, we need to stop
isr reading from mailbox as otherwise rx_thread won't be able to process
other buffers.

Since CMAC2SYS irq is cleared before data is read from mailbox, in case
rx buffer allocation was deferred we also need to trigger irq manually
to make sure all pending data is processed.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2024-05-25 11:21:16 +03:00
Sreeram Tatapudi
f96e6ccbc0 boards: arm: Introduce Infineon CYW920829M2EVK-02 board
- Add initial version of CYW920829M2EVK-02 board
- [drivers: clock_control] Make it possible to set up both iho and imo
  clocks instead of just one or the other

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2024-05-24 18:05:11 -04:00
Andrzej Kaczmarek
5ead91d099 drivers: clock_control: smartbond: Update CMAC sleep clock
The CMAC uses lp_clk as a sleep clock so it has to be updated if
frequency of lp_clk has changed. This happens either after XTAL32K
settling or RCX calibration.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2024-05-24 18:03:26 -04:00
Francois Ramu
6db2c2c2c1 drivers: rtc: stm32 rtc driver disable alarm interrupt if not used
Note that the Init of the alarm has no need for BCD2BIN conversion,
the LL_RTC_ALMx_Init will do. Add more log debug
The driver must clear the ALARM enable bit before wrting the alarm
registers.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-05-24 09:56:29 -05:00
Francois Ramu
2499a4b226 drivers: rtc: stm32 rtc driver configure time and Date
Set a Calendar using the LL functions LL_RTC_TIME_Init
and LL_RTC_DATE_Init. Add more DBG info
On the stm32F2 serie, check RS Flag after setting calendar registers.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-05-24 09:56:29 -05:00
Flavio Ceolin
693b65583c power_domain: intel_adsp: Use register definitions
Make it a little bit easier to read using already existent
definitions for the registers used here.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-05-24 09:53:04 -05:00
Jerzy Kasenberg
bd6bb64d8a drivers: timer: smartbond: Fix timer2 timeout set
When function sys_clock_set_timout() is called with small value
(i.e. 1) calculated time to be programmed to TIMER2 reload
register may be such that is expires before code set's it
up. In that case timer interrupt will be scheduled in far
future.

With this change, code checks after it sets reload value if
requested time already passed and if so TIMER2 interrupt
is marked as pending to avoid races.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-05-24 08:04:18 -04:00
Celina Sophie Kalus
051dc14bb6 drivers: mbox: Add driver for STM32 HSEM
This driver implements a simple MBOX device which supports a single
instance, two channels (one for each direction), and only signalling
mode with no data transfer. Signalling to another core is achieved by
taking and giving two hardware semaphores, similar to the STM32 HSEM
IPM driver.

Signed-off-by: Celina Sophie Kalus <hello@celinakalus.de>
2024-05-24 07:52:06 -04:00
Robert Hancock
1af474b575 flash: spi_nor: error-checking fixes
Check the return values of commands such as spi_nor_cmd_* and
spi_nor_wait_until_ready and ensure they are propagated back to the
caller on error.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2024-05-24 07:51:20 -04:00
Dominik Ermel
deabfa3c3a drivers/flash/spi_nor: Fix and rework spi_nor_set_address_mode
The commit removes unneeded check for enter_4byte_addr_exist in
the function, as the utility function is supposed to set the address
by parsing enter_4byte_addr parameter, while the enter_4byte_addr_exist
used to exist only for DTS entries that directly set enter-4byte-addr
parameters for a flash node.

The change also moves LOG_DBG reporting enter_4byte_addr before
it is processed, to allow logging what actually function will be working
with, before it does so.

The enter_4byte_addr_exist is removed as it is no longer used anywhere.

Setting of data->flag_access_32bit has been moved in the same code block
as call to the spi_nor_cmd_write, as it can be only consequence of
successful call to that function.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-05-24 07:50:25 -04:00
Aurelien Jarno
18c73de93d drivers: spi: stm32: Skip pinctrl suspend/resume for subghzspi
Subghzspi instances cannot have any pinctrl configs. This causes a
failure of the power management suspend and resume operations for the
subghzspi instance because no "default" pinctrl is found.

Fix that by skipping the pinctrl parts on subghzspi instances.

At the same time fix a copy and paste in the suspend error message.

Fixes: b567a7db83

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2024-05-24 07:50:09 -04:00
Yong Cong Sin
e993e994ea sensors: add new channel SENSOR_CHAN_POS_DXYZ
Add new channel: `SENSOR_CHAN_POS_DXYZ`, so that it is
consistent with other 3-axis channels.

Updated pytest, `sensor_shell` & `fake_sensor` accordingly.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-24 07:49:27 -04:00
Yong Cong Sin
4e7168028b sensors: shell: use SENSOR_CHANNEL_3_AXIS whenever possible
Instead of specifying 3 axis channels manually, use
`SENSOR_CHANNEL_3_AXIS` instead.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-24 07:49:27 -04:00
Yong Cong Sin
eb37b8620b sensor_shell: fix hang when device is not a sensor
If `CONFIG_SENSOR_INFO` is enabled, use the `sensor_info`
section to validate that the argument is a sensor before using,
otherwise the shell command will hang the application.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-24 07:49:27 -04:00
Yong Cong Sin
e879cd0502 sensor_shell: fix assertion due to NULL pointer deref
The `SENSOR_CHAN_VSHUNT` was added in #60717 but was never
added to the `sensor_channel_name[SENSOR_CHAN_COMMON_COUNT]`
table. Since the length of `sensor_channel_name` is fixed to
`SENSOR_CHAN_COMMON_COUNT`, this means that the index at
`SENSOR_CHAN_VSHUNT` points to `NULL`. When we use the
`sensor get` command for anything bigger than
`SENSOR_CHAN_VSHUNT`, we will deref that `NULL` pointer
when we do `strcmp` in the for-loop of `parse_named_int`.

Fix this by defining `SENSOR_CHAN_VSHUNT` in the table.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-24 07:49:27 -04:00
Ioannis Karachalios
62f8f160ad drivers: entropy: smartbond: Optimize driver PM
This commit should optimize the way the device is allowed
to enter the suspended state. Instead of returning a PM
error code to abort the PM process, the standby power state
is constrained as long as the device is not allowed to enter
suspension. With that approach, acquiring PD_SYS is not needed
when in PM device runtime mode.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-05-24 07:48:41 -04:00
Ioannis Karachalios
71a5f1b9fd drivers: display: smartbond: Optimize driver PM
This commit should optimize the way the device is allowed
to enter the suspended state. Instead of returning a PM
error code to abort the PM process, the standby power state
is constrained as long as the device is not allowed to enter
suspension. With that approach, acquiring PD_SYS is not needed
when in PM device runtime mode.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-05-24 07:48:41 -04:00
Ioannis Karachalios
2958f691bb drivers: mipi_dbi: smartbond: Optimize driver PM
This commit should optimize the way the device is allowed
to enter the suspended state. Instead of returning a PM
error code to abort the PM process, the standby power state
is constrained as long as the device is not allowed to enter
suspension. With that approach, acquiring PD_SYS is not needed
when in PM device runtime mode.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-05-24 07:48:41 -04:00
Krzysztof Chruściński
af3c8b973e drivers: timer: nrf_grtc_timer: Fix for random system hangs
d599e2b670 removed early return from sys_clock_timeout_handler if
current counter value is less than cc_val. It seems that this return is
needed as after the removal some stress tests which were using system
timers heavily started to hang.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-05-24 07:47:29 -04:00
Luis Ubieda
4ae093eaf0 drivers: i2c: nrfx_twi_rtio: Minor indentation fixes
Not necessarily related to the namespacing changes, but just
establishing proper indentation formatting throughout the whole file.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-05-24 07:46:27 -04:00
Luis Ubieda
98c121d262 i2c: nrfx_twi_rtio: Establish proper namespacing in driver
To clearly distinguish between common code and RTIO-only code
on nrfx_twi and nrfx_twi_rtio.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-05-24 07:46:27 -04:00
Mike J. Chen
3656c1b14c spi_nor: remove unneeded enter_dpd() at end of spi_nor_configure()
This block of code was in the original commit that added
CONFIG_SPI_NOR_IDLE_IN_DPD but later modifications
added acquire_device() and release_device() calls
earlier in spi_nor_configure() and the release_device()
function will have already done the enter_dpd().

Signed-off-by: Mike J. Chen <mjchen@google.com>
2024-05-23 11:53:45 -04:00
Hao Luo
d7afd88e71 drivers: counter: Add support for Apollo3 SoCs counter
This commit adds support for the counter which
can be found in Apollo3 SoCs

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-05-23 11:52:37 -04:00
Jérémy LOCHE - MAKEEN Energy
0af906a533 gpio: imx: Added IRQ lock for RMW operations
The GPIO API performs unprotected RMW operations that
can cause glitching and race conditions when GPIOs are used by
different threads or ISRs.

Signed-off-by: Jérémy LOCHE - MAKEEN Energy <jlh@makeenenergy.com>
2024-05-23 11:51:51 -04:00
Phi Bang Nguyen
ea02b93eea drivers: video: csi: Add support for i.MX RT11XX
On i.MX RT11XX which has MIPI CSI-2 Rx, image data from the camera sensor
after passing through the camera pipeline (MIPI CSI-2 Rx --> Video Mux -->
CSI) will be implicitly converted to a 32-bits pixel formats. For example,
an input in RGB565 / YUYV (2-bytes format) will become an XRGB32 / XYUV32
(4-bytes format), respectively. Make changes to support this.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
2024-05-23 07:52:09 -04:00
Ioannis Karachalios
e1772409ce drivers: clock_control: smartbond: Add support for the memc driver.
1. Update the clock control driver so it can update timing settings for
   QSPIC2 following system clock transitions (translated based on
   AHB AMBA bus clock).
2. Remove the QSPIC related subroutines and use the respective HAL API
   which is now available.
3. Add support for PM (CONFIG_PM_DEVICE). This is required as QSPIC2
   register file is powered by PD_SYS which is turned off during device
   sleep and so registers contents are lost (in contrast to QSPIC which
   is used to drive the flash memory).

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-05-23 07:51:41 -04:00