Commit graph

18163 commits

Author SHA1 Message Date
Michael Hope 740d19d6a6 drivers: add the ch32v00x USART driver 2024-05-17 19:44:46 +02:00
Michael Hope bcc9605b24 drivers: add the ch32v00x PWM driver 2024-05-17 19:44:01 +02:00
Michael Hope 78912fe03f drivers: add a GPIO driver 2024-05-17 19:43:24 +02:00
Michael Hope 1e25339528 drivers: add the PFIC interrupt controller 2024-05-17 19:42:19 +02:00
Michael Hope 561468f99d drivers: add the ch32v00x systick driver 2024-05-17 19:41:37 +02:00
Michael Hope c93260faca drivers: add the ch32v00x clock controller 2024-05-17 19:39:50 +02:00
Michael Hope e678dbb20f drivers: add ch32v00x pinctrl support 2024-05-17 19:39:24 +02:00
Johann Fischer 715e4ce6f3 drivers: udc_dwc2: prevent access to registers if USBHS is not ready
On USBHS, we cannot access the DWC2 register until VBUS is detected and
valid. Kernel event API is used to block if a valid VBUS signal is not
present when the user tries to force usbd_enable().

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer acd2fa7972 drivers: udc_dwc2: fix interpretation of NUMDEVEPS and INEPS fields
The NUMDEVEPS field provides the number of endpoints in addition to the
control endpoint. It is used to iterate over GHWCFG1 register value to
get correct number of configured IN/OUT endpoints. To get it correctly,
we need to use it internally as number including control endpoint.

Interpretation of INEPS misses +1 because value 0 means 1 IN endpoint
and so on.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer b117155320 drivers: udc_dwc2: add vendor quirks to support Nordic USBHS controller
Add vendor quirks to support Nordic USBHS controller.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer 6d06a8cea9 drivers: udc_dwc2: use devicetree to configure endpoint capabilities
Although we can get the number of configured OUT and IN endpoints and
endpoint capabilities from the DWC GHWCFGn registers, we need to
configure the number of endpoint configuration structs at build time. On
some platforms, we cannot access the hardware register at pre-init, so
we use the GHWCFGn values from the devicetree to provide endpoint
capabilities. This can be considered a workaround, and we may change the
upper layer internals to avoid it in the future.

Also, add a new vendor quirk to fill in platform-specific controller
capabilities.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer efb286dfdf drivers: udc_dwc2: rework vendor quirks
Rework and rename vendor quirks to better reflect where they intended to
be called. Number of quirks probably not final and will be trimmed
later.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer 67cdccc1c2 drivers: udc_dwc2: rework controller initialization
Move most of the controller initialization to a separate function called
during udc_enable(). This allows us to add support for the platform
where the device controller is only available when VBUS is present and
the PHY is powered.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Yong Cong Sin 5f1e1c7b34 drivers: sensor: sensor_shell: fix infinite loop when doing sensor get
Should increment `ch.chan_idx` instead of `channel_idx`,
otherwise we will be stucked in the loop forever.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-17 14:34:09 +02:00
Laurentiu Mihalcea ae082064ff drivers: dai: sai: write some data into TX FIFO before start
While running the following command:

	aplay ... | arecord ...

multiple times, it was discovered that the SAI transmit
FIFO goes into underrun. This only happened in the
beginning, a few BCLK cycles after unmasking the transmit
data line. With the following flow:

	1) Trigger start on RX
		a) Do TX and RX software reset
		b) Enable RX FIFO error interrupt
		c) Enable RX DMA requests
		d) Enable receive data line
		e) Enable transmitter
		f) Enable receiver

	    ..... some time has passed .....

	2) Trigger start on TX
		a) Enable DMA requests
		b) Enable transmit data line

and configuration in mind:

	1) RX is SYNC with TX
	2) TX is ASYNC
	3) Each FSYNC edge is 32-bit wide
	4) Each frame contains 2 32-bit words

this points to the following possibilites:

	1) The transmitter is enabled so close to the
	start of a new frame that even though the DMA requests
	are asserted, the DMAC doesn't have enough time
	to service them until the module goes into underrun
	=> the timing is bad.

	2) The transmitter is enabled somewhat close to
	the start of a new frame such that the DMAC is not
	fast enough to service the module until it goes into
	underrun => DMAC is too slow AND the timing is bad.

Although the exact cause was not pinpointed, this patch
aims to fix the problem by writing a frame's worth of 0s
in the transmit FIFO. This way, even if we're dealing with
scenario 1) or 2), the DMAC has plenty of time to perform
the transfer (i.e: a frame), thus avoiding the underrun.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-05-17 12:40:43 +02:00
Yong Cong Sin b0394425e1 drivers: sensor: st: vbat: check for ADC nodes
The vbat driver requires the adc node to be enabled:

```c
.adc = DEVICE_DT_GET(DT_INST_IO_CHANNELS_CTLR(inst))
```

Update its Kconfig to depend on `DT_HAS_ST_STM32_ADC_ENABLED`,
which is the `"st,stm32-adc"` compat that all ST ADC bindings
include, this will guarantee that at least one ADC node is
enabled, but not necessarily the ADC used by the vbat node.

To make sure that it at least compiles, we init the `adc`
pointer only if the specified ADC node is enabled, otherwise
it will points to `NULL`.

Finally, check if the `adc` points to `NULL` in
`stm32_vbat_init`. We are not relying on the existing
`device_is_ready` check because `DEVICE_DT_GET` will not
return `NULL` if the ADC is enabled. `adc == NULL` means
that the ADC node is not enabled in the devicetree.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-17 11:39:19 +02:00
Marcin Niestroj 87a6df2a9b drivers: nsos: support IPV6_V6ONLY getsockopt() and setsockopt()
Handle IPV6_V6ONLY option in getsockopt() and setsockopt() APIs.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-17 11:12:43 +02:00
Marcin Niestroj d47ec4f75d drivers: nsos: support IPPROTO_TCP getsockopt() and setsockopt()
Handle IPPROTO_TCP specific options in getsockopt() and setsockopt() APIs.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-17 11:12:43 +02:00
Marcin Niestroj 736fe29349 drivers: nsos: support ioctl(FIONREAD)
This further increases compatibility with tests defined in
'tests/net/socket/udp/'.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-17 11:12:43 +02:00
Marcin Niestroj cd2c425efe drivers: nsos: support setsockopt(SO_RCVTIMEO)
Handle timeout on receive that is configured using SO_RCVTIMEO.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-17 11:12:43 +02:00
Marcin Niestroj a3f2b5f4b3 drivers: nsos: initial support for getsockopt() and setsockopt()
Add initial support for getsockopt() and setsockopt() on SOL_SOCKET level.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-17 11:12:43 +02:00
Andrei Emeltchenko adeb19b30c drivers: apic_tsc: Use toolchain cpuid()
We have already code using toolchain provided __get_cpuid(), clean up
apic_tsc and make it consistent with the rest of the code.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2024-05-17 09:30:27 +02:00
Tom Burdick b249535093 sensors: Add channel specifier
Use a structured channel specifier rather than a single enum when
specifying channels to read in the new read/decoder API.

Replaces usages of a seperate channel and channel_index parameter
where previously used with a struct sensor_chan_spec.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-05-17 09:30:18 +02:00
Daniel DeGrasse a2087bed16 drivers: sdhc: sdhc_spi: rework CMD12 failure logic
Rework CMD12 failure logic for SDHC SPI driver. Previously, the error
code of CMD12 was not checked, so even if CMD12 failed to send the
initial command would be retried. Change this behavior to retry CMD12
until it succeeds. If CMD12 fails, its error code will be propagated to
the caller. Otherwise, the return code from the command being sent by
the caller will be propagated.

Fixes #72365

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-05-17 09:30:12 +02:00
Daniel DeGrasse cb9d8bac54 drivers: sdhc: sdhc_spi: release bus on error
Properly release SPI bus on transmit error within the SDHC SPI driver.
In these cases return code is not checked, as we wish to return the
error code from the failed transfer to the SD stack.

Fixes #72364

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-05-17 09:30:12 +02:00
Flavio Ceolin 8cd1ab8896 drivers: pcie: Remove deprecated pcie_bdf_lookup
pcie_bdf_lookup() was deprecated before 3.3 release. Time to remove
it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-05-17 09:30:04 +02:00
Flavio Ceolin f4aefc281b drivers: pcie: Remove deprecated pcie_probe
pcie_probe() was deprecated before 3.3 release. Time to remove it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-05-17 09:30:04 +02:00
Jerzy Kasenberg 82ca880fb9 drivers: clock_control: Smartbond: Add runtime frequency support
RC32K and RCX low power clocks require runtime calibration to work
correctly.
Frequency of those clock can differ from chip to chip, one constant
value from Kconfig may not be best when low power clock (sourced
from RCX or RC32K) is used for system tick.

This code modifies global z_clock_hw_cycles_per_sec variable that
is used when TIMER_READS_ITS_FREQUENCY_AT_RUNTIME is enabled
in Kconfig.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-05-17 09:29:58 +02:00
frei tycho caf332e745 drivers: added missing parenthesis
- added missing parenthesis around macro argument expansion

Signed-off-by: frei tycho <tfrei@baumer.com>
2024-05-17 09:29:48 +02:00
Andrzej Kaczmarek 6306596b27 drivers: hci: da1469x: Add driver for CMAC core on DA1469x
This adds HCI driver which enables communication with CMAC core on
Renesas SmartBond DA1469x series. The CMAC core is running an Apache
NimBLE controller binary and uses shared memory for communcation via
mailboxes.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2024-05-16 18:58:00 -04:00
Jeppe Odgaard c9f53d3374 drivers: sensor: add Innovative Sensor Technology TSic xx6 driver
Add driver for TSic 206/306/316/506F/516/716 temperature sensor.
The driver uses PWM capture driver to read a single wire with
Manchester-like encoding.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2024-05-16 18:57:24 -04:00
Daniel DeGrasse 1de7574d3a drivers: flash: flash_mcux_flexspi_nor: better handle legacy SFDP tables
Implement more robust handling for legacy SFDP tables, which may not
implement some of the JEDEC defined DWORDS for SFDP data. Instead of
failing to probe/initialize the flash when these DWORDS are not defined
in the basic flash parameter table, revert to sane defaults for SPI
flash.

Fixes #72051

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-05-16 18:56:33 -04:00
Jordan Yates 7ddbe9d4bd sensor: voltage_divider: fix power-gpio
`CONFIG_PM_DEVICE` being disabled does not mean that the `power-gpio`
does not need to be controlled.

Additionally, not having a `power-gpio` property does not mean that
power management is not supported, just that is has no work to do.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-05-16 18:55:45 -04:00
Ioannis Karachalios 97bd924f59 drivers: entropy: smartbond: Bug fix
This commit should fix few wrong expressions

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-05-16 18:55:18 -04:00
Sylvio Alves bda05fb51a drivers: wifi: esp32: remove pre-defined mbedTLS requirements
In #72651, build fails due to conflict when enabling mbedTLS components.
Current Wi-Fi implementation for ESP32 can discard those selected cryptos.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-05-16 18:54:43 -04:00
Ryan McClelland c75783219f drivers: i3c: cdns: handle variable length ccc with m0 err
The CDNS will report a M0 error if the data length is not what
it expects, but certain CCCs can have a variable length such as
GETMXDS and GETCAPS. This sets it up to ignore the M0 error if
it sees that ccc was GETMXDS or GETCAPS.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-05-16 16:23:31 +02:00
Ryan McClelland bb66b7b870 drivers: i3c: shell: fix argc length check for optional param
GETSTATUS and GETMRL where not checking the right argc length. This
corrects it to check for the right count.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-05-16 16:23:31 +02:00
Ryan McClelland 328b03f56e drivers: i3c: shell: add ccc getcaps command
Add a shell command for the CCC GETCAPS

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-05-16 16:23:31 +02:00
Ryan McClelland e59d65536d drivers: i3c: add reading GETCAPS in basic_info_get
Add reading of GETCAPS CCC in `i3c_device_basic_info_get`.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-05-16 16:23:31 +02:00
Ryan McClelland 9640905a71 drivers: i3c: add ccc getcaps helper
This adds the defines for getcaps format 1 and format 2.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-05-16 16:23:31 +02:00
Ryan McClelland 014e879e6f drivers: i3c: use byte ordering macros with ccc
Use the sys_get_be* macros with ccc where it can be used.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2024-05-16 16:23:31 +02:00
Alberto Escolar Piedras d599e2b670 drivers/timer/nrf_grtc_timer: Misc fixes
Misc fixes for the grtc timer driver:
* In non tickless mode:
  * The tick time would drift a bit with each interrupt
  * If something would cause a very significant delay
    in handling the tick interrupt the number of announcements
    would be incorrect
* Fortickless mode: The calculation of the next tick time
  in sys_clock_set_timeout() was incorrectly done,
  resulting in two spurious, too early, wakes of the kernel
  before each correct wake. This caused tests/kernel/context/
  to fail.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-05-16 15:19:08 +01:00
Armin Brauns 846007676a drivers/flash: enable memory-mapped mode for STM32 QSPI
This puts the QSPI peripheral into memory-mapped mode when
CONFIG_STM32_MEMMAP is set. Writes and erase put it back into indirect
write mode.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-05-16 15:52:01 +02:00
Francois Ramu cb7ed8d97d drivers: flash: stm32 flash driver has a Kconfig STM32_MEMMAP
This CONFIG_STM32_MEMMAP is for enabling the MemoryMapped mode
on external octo or quad spi memory.
In this case, the flash_stm32_read is done in mem map mode
the flash_stm32_erase is not available.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-05-16 15:52:01 +02:00
Fabio Baltieri 7a538c88cd input: gpio_keys: skip change checking when suspended
Check if the driver is suspended in gpio_keys_change_deferred(), this
avoids a potential situation where a race condition could try and read
from a pin that has just been disconnected.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-05-16 14:02:36 +02:00
Jordan Yates d725666b2c sensor: convert ADC depends on to select
When a sensor that depends on an ADC is enabled in devicetree, enable
the ADC subsystem. ADC is roughly equivalent to a bus for these sensors
(the mechanism through which data is transferred), which had the same
conversion applied in #48707.

The same benefits apply here, namely removing the need for the following
pattern in board `.kconfig` files:
```
configdefault ADC
    default y if SENSOR
```

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-05-16 13:31:32 +02:00
Francois Ramu c8cd57fe9e drivers: flash: stm32 qspi driver when Dual-Flash not supported
Some stm32 devices with quadspi (like stm32l47x or stm32l48x)
does not support Dual-Flash Mode. Avoid building error even if
the &quadspi node has a <flash-id>  property defined.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-05-16 11:00:27 +02:00
Henrik Brix Andersen 0f7cd6128e drivers: can: set default initial bitrates via Kconfig
Set the default initial bitrates globally via Kconfig. The initial bitrates
can still be overridden using the "bus-speed" and "bus-speed-data"
devicetree properties.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-05-16 09:23:59 +02:00
Daniel DeGrasse 3b718bf1fe drivers: sdhc: rcar_mmc: remove frequency correction code
RCAR MMC driver previously had to report inaccurate maximum supported
frequency to SD subsystem so that the subsystem would select SDR104 mode
timing. Remove this logic, as it should no longer be needed.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-05-16 09:21:03 +02:00
Mahesh Mahadevan d9e83c9026 drivers: usb: usb_dc_mcux: add case for MCXN94X SOC series
Add case for MCXN94X SOC series to indicate which device controller
is in use.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-05-16 09:17:18 +02:00