Commit graph

24538 commits

Author SHA1 Message Date
Jerzy Kasenberg
f456852510 drivers: usb_device: smartbond: Fix unnecessary flush
Switching from write to read on EP0 is done when data is
transmitted.
Additionally receiver is enabled when NAK is created in
response to OUT token. This may happen when host sent
ZLP before everything was transmitted.
This case flushed receiver FIFO which could lead to
setup packet corruption.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-06-19 13:44:32 -04:00
Jerzy Kasenberg
18a7603560 drivers: usb_device: smartbond: Add power management
Add support for automatic control of PLL for USB subsystem.

This utilized virtual USB clock present in clock control.
USB driver enables PLL when device is attached or USB
sends resume signaling.

PLL can be turned off (if application does not requested it)
when device is detached (application request)
or USB host sends suspend request.

When VBUS is not present or application did not started USB yet
PD_DOMAIN_SYS is also not acquired that allows for deep
sleep. When USB is active deep sleep will never be activated.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-06-19 13:44:32 -04:00
Jerzy Kasenberg
16c0cecbf6 drivers: usb_device: smartbond: Fix reenable of EP0
When EP0 was disabled EP0 was setup to ignore setup and
out packets.
In usb_dc_ep_enable() function mask was never cleared.
It resulted in USB stop functioning after application
disabled endpoint (usb_disable()) and then tried
to enable usb again.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-06-19 13:44:32 -04:00
Jerzy Kasenberg
0f167af30f drivers: usb_device: smartbond: Fix VBUS interrupt enable
Code was enabling USB_IRQn twice. One of the calls clearly
should be enabling VBUS_IRQn.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-06-19 13:44:32 -04:00
Jerzy Kasenberg
207195dfe8 drivers: clock_control: smartbond: Add USB clock
Smartbodn does not have dedicated USB clock.
For USB to work PLL needs to be turned on.
To allow for flexible configuration artificial USB clock
is added that can be operated via clock_control subsystem.
This new clock turns on PLL when USB subsystem is enabled.
PLL can also be request in DT if application requires
more speed.

PLL can be automatically turned off when USB enters suspend
state and application did not requested it.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-06-19 13:44:32 -04:00
Mateusz Karlic
631248449a drivers: intc_gic: Return GICC_IAR without mask
The documentation recommends to read and then write-back the entire
register, when ending interrupts.

Signed-off-by: Mateusz Karlic <mkarlic@antmicro.com>
2024-06-19 13:43:06 -04:00
Jakub Topic
4fe32e1f4a drivers: rtc: rv3028: fix RTC time mask
Correct the RTC time mask to validate all supported fields.

Signed-off-by: Jakub Topic <jakub.topic@anitra.cz>
2024-06-19 13:22:29 -04:00
Jakub Topic
2feeeefbe7 drivers: rtc: pcf8563: check if the node has an interrupt pin
Verify if the int1_gpios property exists for the specific node.

Signed-off-by: Jakub Topic <jakub.topic@anitra.cz>
2024-06-19 13:22:29 -04:00
Jakub Topic
fdd7f524b9 drivers: rtc: pcf8563: validate time
Validate the contents of `struct rtc_time` against the provided mask
when setting time or alarm.

Use the same names of function parameters as those in the RTC Interface.

Signed-off-by: Jakub Topic <jakub.topic@anitra.cz>
2024-06-19 13:22:29 -04:00
Dominik Ermel
97a97c744a drivers/flash: Fix typos and incorrect description
Fixing typos.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-19 09:34:19 +02:00
Dominik Ermel
33f8039d95 drivers/flash: Fix flash_fill write chunk calculation
Fix incorrect last chunk calculation.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-06-19 09:34:19 +02:00
Swift Tian
5d24b6d37d drivers: fix Kconfig.mspi for issue #74349
Fix the Kconfig.mspi under flash and memc so that it don't litter.

Signed-off-by: Swift Tian <swift-tian@qq.com>
2024-06-18 19:55:35 -04:00
Tom Burdick
694428947a sensors: Fix shell missing channel types
The shell tries to decode all channel types and sequential channel
indexes. Unfortunately when swapping to channel specs we forgot to reset
the channel index for the next channel type to look at.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-06-18 14:55:27 -04:00
Ioannis Damigos
27c14042bd i2c_smartbond: Introcude TX_FIFO_DEPTH macro
Introcude TX_FIFO_DEPTH macro to avoid "magic"
numbers.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-06-18 14:36:38 -04:00
Ioannis Damigos
d9ad8c9c99 i2c_smartbond: Fix spin locking
Fix spin locking

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-06-18 14:36:38 -04:00
Ioannis Damigos
c7da55ef2c spi_smartbond: check that DMA controllers were provided
Check that DMA controllers were provided in
spi_smartbond_dma_deconfig()

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-06-18 14:36:38 -04:00
Ioannis Damigos
0a0bccabd8 drivers/smartbond: Fix PM device runtime support
Removed PM device runtime support from drivers in PD_SYS domain.

Update the rest device drivers to call pm_device_runtime_get/put()
functions when CONFIG_PM_DEVICE_RUNTIME is enabled.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-06-18 14:36:38 -04:00
Yong Cong Sin
c9d08fc876 driver: ieee802154: remove deprecated Kconfigs
The following Kconfigs have been deprecated for more than 2
releases, remove them:

- `IEEE802154_CC13XX_CC26XX_SUB_GHZ_RADIO_TX_RETRIES`
- `CONFIG_IEEE802154_2015`

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Yong Cong Sin
abbd19c393 drivers: interrupt controller: update GIC Kconfigs
Selection of these GIC Kconfigs have been deprecated
for more than 2 releases, users should use the devicetree
method instead, update the Kconfigs.

The SOCs below have been updated to not select `GIC_V3`, since
their devicetree already have the required compatible:
- fvp_aemv8r
- rzt2m
- rk3658

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Yong Cong Sin
3e4a9b9ec7 drivers: ethernet: stm32: remove deprecated MAC address Kconfigs
The following Kconfigs:

- `CONFIG_ETH_STM32_HAL_RANDOM_MAC`
- `CONFIG_ETH_STM32_HAL_USER_STATIC_MAC`
- `CONFIG_ETH_STM32_HAL_MAC3`
- `CONFIG_ETH_STM32_HAL_MAC4`
- `CONFIG_ETH_STM32_HAL_MAC5`

have been deprecated for more than 2 releases, user should
have switched to the devicetree method now, remove them.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Yong Cong Sin
2585595bca drivers: eeprom: remove CONFIG_EMUL_EEPROM_AT2X
`CONFIG_EMUL_EEPROM_AT2X` has been deprecated for more than 2
releases, remove it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Yong Cong Sin
88c96f7986 drivers: counter: stm32: remove deprecated clock source Kconfigs
These clock selection Kconfigs should have been deprecated for
more than 2 releases, remove them:

- `CONFIG_COUNTER_RTC_STM32_CLOCK_SRC`
- `CONFIG_COUNTER_RTC_STM32_CLOCK_LSI`
- `CONFIG_COUNTER_RTC_STM32_CLOCK_LSE`

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-18 14:33:58 -04:00
Nazar Palamar
f41cb40a6e drivers: wifi/airoc: update airoc_wifi_host_buffer_get
Update airoc_wifi_host_buffer_get function to set final
buff size based on input “size” param.

Update airoc_mgmt_send to use airoc_wifi_host_buffer_get
instead net_buf_alloc_len.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-06-18 15:55:19 +02:00
Jiafei Pan
f985e75ba1 drivers: eth_nxp_enet: fix MMIO mapping issue
Fixed #74370, the issue is caused by the update to introduce MMIO
mapping, after MMIO mapping, should use data->base for device
base memory address.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2024-06-18 15:52:21 +02:00
Gerson Fernando Budke
0561d74d31 drivers: counter: sam: Add qdec as tc special mode
The current atmel,sam-tc-qdec sensor implementation shared the timer
counter node. This create issues when users wants define both modes.
The current proposal changes the qdec dedinition to be a child of
tc and refactor all the chain of definitions.

Fixes #71312

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2024-06-17 17:47:42 -04:00
Pisit Sawangvonganan
ebb75b38dd drivers: ethernet: stm32: replace reverse with intrinsic __RBIT
Replaced the software `reverse` function, used for bit reversal, with
the intrinsic `__RBIT` function.

This utilizes the hardware bit-reversal instruction for improved
efficiency.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-06-17 17:46:29 -04:00
Aksel Skauge Mellbye
4f712fffe0 drivers: pinctrl: gecko: Fix Series 1 I2C SCL route location config
Implementation erroneously used a mask from the ROUTEPEN register
when writing the ROUTELOC register.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2024-06-17 12:10:11 -04:00
Aksel Skauge Mellbye
35d95f934c drivers: pinctrl: gecko: Fix Series 2 I2C location config
Series 2 uses DBUS for alternate function control, which directly uses
port and pin numbers for location selection. Configure pinout as part
of the I2C_SDA/I2C_SCL case, rather than the separate _LOC case,
as the port and pin are not available at this point.

Configure route register prior to enabling the route, to ensure that
the wrong pin is not temporarily claimed.

Fixes an issue where DBUS was always configured to port A and
pin given by the GECKO_LOC() macro, rather than the correct port/pin
pair.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2024-06-17 12:10:11 -04:00
Jakub Topic
7efd885bd7 drivers: rtc: update alarm_set_callback to return ENOTSUP
This commit addresses the issue related to the rtc.h API returning ENOSYS
for a driver not implementing alarm_set_callback when the ALARM
functionality is enabled but interrupts, and thus alarm callbacks, are not
supported by the current configuration.

The following drivers have been modified to return correct code:
- rtc_pcf8523
- rtc_pcf8563
- rtc_rv3028

Signed-off-by: Jakub Topic <jakub.topic@anitra.cz>
2024-06-17 12:09:15 -04:00
Andriy Gelman
d2607f0911 drivers: can: mcp251xfd: Use macro to set TDCO
Use CAN_CALC_TDCO() macro to set TDCO. There is a minor change how the
tdco is calculated. In the macro the SYNC segement is taken into
account while it wasn't used before.

Fixes #73821.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2024-06-17 12:08:08 -04:00
Chris Friedt
12cc7bbd8a net: sockets: use z_finalize_typed_fd() to identify as sockets
Fill-in the mode field of the fd_entry so that the
implementation can be made aware that the specific file
descriptors created are sockets.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-15 07:47:12 -04:00
Tomasz Moń
e1b95eb6df drivers: udc_dwc2: Initial Buffer DMA support
Implement absolute minimum necessary to get Buffer DMA working. Require
Data Cache to be disabled if DWC2 OTG has DMA enabled because the stack
does not currently guarantee cache line alignment for allocated buffers.

Set EPENA bit before disabling IN endpoints because it seems to be
necessary in Buffer DMA mode (without EPENA the wait for INEPNAKEFF does
time out). Setting EPENA should have no impact on Completer mode
operation (where EPENA is not necessary for INEPNAKEFF to trigger).

Programming Guide recommends programming SUPCnt to 3, but the only
advantage would be to be able to tell how many back-to-back SETUP packets
were received if there was no more than 3 back-to-back SETUPs. This
information doesn't seem to be useful. The disadvantage is that the
buffer needed for receiving SETUP packet must be able to hold SUPCnt
multiple of 8 bytes. Use SUPCnt 1 so the 8 bytes buffer is enough.

Make sure to clear StsPhseRcvd interrupt bit in Buffer DMA mode because
the DMA seems to prevent the SETUP Phase Done interrupt from triggering
if StsPhseRcvd is set. Clearing this bit doesn't seem to be necessary in
Completer mode. This bit is set on control transfers with data stage
from host to device.

Both Buffer DMA and Completer mode operation on nRF54H20DK was verified
using USB2CV Chapter 9 Tests and MSC Tests with Mass Storage sample.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-06-15 07:43:45 -04:00
Tomasz Moń
59702c7633 drivers: udc_dwc2: Avoid unnecessary register accesses
Do not use sys_clear_bits() followed by sys_set_bits() on DCTL register
to avoid writing to DCTL register twice - first with zeroed out address,
and then with the new address. Change the code to write the address in
one DCTL register write.

Do not use sys_set_bits() to set test mode, but rather prepare the
correct value first.

Set DCFG and GUSBCFG registers in one go. There is no point in reading
back the value or doing multiple subsequent writes to these registers.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-06-15 07:43:45 -04:00
Tomasz Moń
2c9371ea45 drivers: udc_dwc2: Add DMA register bit defines
Add register bit defines for registers needed for DMA operation.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2024-06-15 07:43:45 -04:00
Robert Hancock
680fa154bf drivers: spi_xlnx_axi_quadspi: Reduce IRQ work
This driver could end up doing a great deal of work inside the ISR when
large SPI transfers were in use, which could cause significant IRQ
latency. For the normal, non-async SPI transfer case, use events to
signal the calling thread to complete the work rather than performing
FIFO transfers inside the ISR.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2024-06-15 05:15:46 -04:00
Robert Hancock
68a24863c0 drivers: spi_xlnx_axi_quadspi: Optimize FIFO handling
Add an optional DT property to specify the size of the RX/TX FIFO
implemented within the SPI core. The property name used is the same one
used by Xilinx's device tree generator.

When the FIFO is known to exist, we can use the RX FIFO occupancy register
to determine how many words can be read from the RX FIFO without checking
the RX FIFO empty flag after every read. Likewise with the TX FIFO, we can
use the FIFO size to avoid checking the FIFO full flag after every write.
This can increase overall throughput.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2024-06-15 05:15:46 -04:00
Robert Hancock
cff3811613 drivers: spi_xlnx_axi_quadspi: add STARTUP block workaround support
Add support for a workaround required when using the Xilinx Quad SPI core
with the USE_STARTUP option, which routes the core's SPI clock to the
FPGA's dedicated CCLK pin rather than a normal I/O pin. This is typically
used when interfacing with the same SPI flash device used for FPGA
configuration. In this mode, the SPI core cannot actually take control
of the CCLK pin until a few clock cycles are issued, which would break
the first transfer issued by the core. This workaround applies a dummy
command to the connected device to ensure that the clock signal is in the
correct state for subsequent commands.

See Xilinx answer record at:
https://support.xilinx.com/s/article/52626?language=en_US

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2024-06-15 05:15:46 -04:00
Adam Berlinger
19b39406eb soc: st: Add support for STOP3 on STM32U5
LPTIM is not available in STOP3 mode, so RTC needs to be used instead.
This code usese similar approach as STM32WBAx for suspend to ram.
The STOP3 is disabled by default in device tree.

Signed-off-by: Adam Berlinger <adam.berlinger@st.com>
2024-06-15 04:44:26 -04:00
Adam Berlinger
2c88cc08b3 drivers: timer: Fix timing in suspend-to-ram
Fix timing in suspend-to-ram when using STM32WBA.
Switch to use RTC timer should be done only when idle is set
and LPTIM clocks should be switched off

Signed-off-by: Adam Berlinger <adam.berlinger@st.com>
2024-06-15 04:44:26 -04:00
Trent Piepho
971227180b drivers/sensor: si7006: Switch to undef DT_DRV_COMPAT
This style is used in sensor drivers.  It's more complicated than the
other way, which is used in different drivers that are not sensor
drivers.

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
2024-06-15 04:42:31 -04:00
Trent Piepho
0f219e1e6d drivers/sensor: si7006: Fix math for calculating sensor values
The existing code rounded the result to an integer, then multiplied that
integer by 1000000 to get micro-degrees or micro-percent, and then
divided by 1000000 to get whole degrees/percent and took the modulus to
get fractional degrees/percent.

Obviously, multiplying and then dividing an integer by the same value
has no effect!

The result is the humidity and temperature were always rounded down to
the nearest integer.

Fix this to properly keep the fractional component.  This is done in a
way that avoids any integer divisions, which are slow on all CPUs, but
especially most microcontrollers, e.g. Cortex-M, lack any integer
division instruction.

Avoiding the base 10 math does not require more code.  One just needs to
think in binary and use binary fractions instead of base 10 fractions.

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
2024-06-15 04:42:31 -04:00
Trent Piepho
88649dad1a drivers/sensor: si7006: Mask off low two bits of data reads
The low two bits are not part of the data, but rather "status" bits that
should be masked off.

This is documented in the HTU21D datasheet Edition 8, date 05/2017, pp.
15, and Sensirion SHT21 datasheet version 6, date 10/2022, §6 (wording
exactly the same):

"The two status bits, the last bits of LSB, must be set to ‘0’ before
calculating physical values."

Also Silicon Labs Si7006 example driver code:
        /* Swap the bytes and clear the status bits */
        return ((data.byte[0] * 256) + data.byte[1]) & ~3;

Since these are the LSBs, it has only a small effect and might not have
been noticed despite being wrong.

While editing this code, switch to using the Zephyr endian conversion
functions intead of a written out conversion.

Add error code to error log message.

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
2024-06-15 04:42:31 -04:00
Trent Piepho
c7b3b13119 drivers/sensor: si7006: Clean up headers
Some, like stdio.h, don't belong here at all and aren't needed.

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
2024-06-15 04:42:31 -04:00
Trent Piepho
d7e03dd148 drivers/sensor: si7006: Support SHT21 and HTU21D
These three sensor types are all largely compatible.  The SHT21 and
HTU21D can be supported by this driver by sending command 0xE3 instead
of 0xE0 to read the temperature.

Mention the sensor names in bindings and Kconfig to help those looking
for support to find it.  There have been at least five PRs attempting to
add SHT21 and/or HTU21D support that did not realize the Si7006 is the
same.

As mentioned in PR #22862, the Sensirion SH21 is the original.  The dts
bindings are adjusted (in a backward compatible way!) to make the sht21
the base binding and si7006 is derived from that.

Examples of dts compatibles:

TE Connectivity née Measurement Sepcialties HTU21D:
compatible = "meas,htu21d", "sensirion,sht21";

Sensirion SHT21:
compatible = "sensirion,sht21";

Silicon Labs Si7006
compatible = "silabs,si7006";

Silicon Labs Si7021
compatible = "silabs,si7021", "silabs,si7006";

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
2024-06-15 04:42:31 -04:00
Trent Piepho
6817ac34b6 drivers/sensor: si7006: Remove unused struct device field
Use was removed but the field itself wasn't deleted.

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
2024-06-15 04:42:31 -04:00
Jakub Zymelka
8091e93838 drivers: mbox: nrf: Change VEVIFs and BELLBOARD nomenclature
Renaming 'LOCAL' to 'RX' and 'REMOTE' to 'TX'.
This seems more descriptive and intuitive to use.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2024-06-15 04:41:47 -04:00
Jakub Zymelka
bace4a102d drivers: mbox: add initial driver for nRF VEVIF event
Add a mailbox driver for VEVIF events (VPR irq).
The driver can be built in either 'rx' or 'tx' configuration.
The VPR sends the event, so it uses the 'tx' configuration,
while the master core uses the 'rx' configuration of the driver
to receive the VPR events.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2024-06-15 04:41:47 -04:00
Dawid Niedzwiecki
3b85e8b8ea drivers: counter: add missing include
Add missing include for get_value_64 in the counter_handlers.c file.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-06-14 21:14:43 -04:00
Swift Tian
ece0c9b0d3 drivers: mspi: Add ATXP032 NOR flash driver
The ATXP032 is a NOR flash device that supports up to ~100MHz
octal SDR/DDR with 4MB nonvolatile memory.
The device driver uses MSPI bus API and could be used across different
SoC controllers that implement the MSPI bus API.

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2024-06-14 21:07:00 -04:00
Swift Tian
c7ed0b6aa8 drivers: memc: Add APS6404L device driver
The APS6404L psram is a quad SDR SPI device that runs up to 100MHz.
It can provide 8MB of external RAM for SoCs that supports XIP feature.
The device driver uses MSPI bus API and could be used across
different controllers that implement the MSPI bus API.

Signed-off-by: Swift Tian <swift.tian@ambiq.com>
2024-06-14 21:07:00 -04:00