Commit graph

14804 commits

Author SHA1 Message Date
Grant Ramsay dc0e98c224 drivers: virtualization: Add implementation for ivshmem-v2
ivshmem-v2 is primarily used for IPC in the Jailhouse hypervisor

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-05-14 18:17:33 -04:00
Grant Ramsay 4ed404a27f drivers: virtualization: Add interface for ivshmem-v2
ivshmem-v2 is primarily used for IPC in the Jailhouse hypervisor

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-05-14 18:17:33 -04:00
Declan Snyder 0dafeed054 drivers: i2s_mcux_flexcomm: Fix instance macro
Driver init should be using instance based macros,
not nodelabels numbering, there is no guarantee
about which nodes will be assigned which instance numbers.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-12 06:21:13 -05:00
Henrik Brix Andersen 7c3a708ab8 drivers: can: stm32: guard Kconfig options
Add Kconfig guards for CONFIG_CAN_MAX_STD_ID_FILTER and
CONFIG_CAN_MAX_EXT_ID_FILTER as they only apply to the STM32 bxCAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-12 10:51:49 +00:00
Henrik Brix Andersen 10e25351d6 drivers: can: stm32h7: remove unused std/ext filter size Kconfig options
Remove the STM32H7 specific Kconfig overrides for setting the maximum
number of standard and extended CAN RX filters as they are unused.

The number of available standard and extended filter elements for Bosch
M_CAN can be configured via the devicetree.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-12 10:51:29 +00:00
Sylvio Alves 01da4df197 drivers: uart: esp32: fix baudrate return value
Baudrate value was not updated properly when requested.

Fixes #57746

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-05-12 09:59:25 +02:00
Andreas Sandberg 6535d6a0e6 drivers: ssd16xx: Remove SCREEN_INFO_DOUBLE_BUFFER cap
The SSD16xx driver used to use the SCREEN_INFO_DOUBLE_BUFFER flag to
indicate to the LVGL integration that it needs writes to be performed
twice. This was required because partial writes require both the old
and new buffer to be written.

This behavior is really an implementation detail and only applies to
partial refresh. Do this buffer maintenance in the driver instead.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2023-05-11 14:40:50 -07:00
Andreas Sandberg daf9030fa7 drivers: ssd16xx: Add support for the ssd1680
Add support for the SSD1680 EPD driver chip with support for up to
296x176 pixel displays.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2023-05-11 14:40:50 -07:00
Andreas Sandberg 400ced3501 drivers: ssd16xx: Clean up ssd16xx_clear_cntlr_mem
Remove the optional call to ssd16xx_update_display() in
ssd16xx_clear_cntlr_mem(). This doesn't really belong in that function
and just adds a non-obvious boolean argument to the function.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2023-05-11 14:40:50 -07:00
Andreas Sandberg 5ca33e20a8 drivers: ssd16xx: Add support for partial refresh profiles
Add support for partial refresh profiles. This makes it possible to
use partial refresh on generation 2 devices which are able to store
partial refresh LUTs in OTP.

Partial refresh is only enabled if a partial profile has been
provided. The display will use the full refresh profile if in this
case.

Devices that need custom LUTs and voltages can specify them separately
for the full and partial profiles. The controller will be reset when
changing profiles which means that profiles always override the
default reset values. This means that it is, for example, possible to
use default values and LUTs from OTP for a full refresh and a custom
profile for partial refreshes.

For example, to use a GoodDisplay GDEY027T91 with partial refresh
simply use the following device tree fragment:

display: ssd1680@0 {
	compatible = "solomon,ssd1680";

	spi-max-frequency = <4000000>;
	duplex = <SPI_HALF_DUPLEX>;
	reg = <0>;

	dc-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>;
	reset-gpios = <&arduino_header 14 GPIO_ACTIVE_LOW>;
	busy-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>;

	/* Enable the built-in temperature sensor */
	tssv = <0x80>;

	width = <264>;
	height = <176>;

        /* Enable partial refresh using built-in LUT */
	partial {
	};
};

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2023-05-11 14:40:50 -07:00
Andreas Sandberg 40437c675c drivers: ssd16xx: Update DT bindings for multiple profiles
Update the device tree bindings for the SSD16xx driver to make it
possible to specify multiple refresh profiles.

The only profile currently supported is the 'full' profile.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2023-05-11 14:40:50 -07:00
Andreas Sandberg 5f781f4b11 drivers: ssd16xx: Use device-specific compatibles
The SSD16xx driver currently provides basic support for most chips in
the Solomon Systech SSD16xx range of e-paper drivers. We currently use
the SSD1608, SSD1673, SSD1675A, and SSD1681 in various boards
supported by Zephyr.

The main user-facing difference between the various SSD16xx chips is
the resolution they support (sources & gates), but there are other
differences as well. For example:

 * 8 or 16 bits used to represent x coordinates
 * 8 or 16 bits used to represent y coordinates
 * Differences in refresh configuration (SSD16XX_CMD_UPDATE_CTRL2)
 * Differences in LUT sizes

The driver currently assumes that the user specifies the number of
bits used to describe coordinates. However, as we add support for more
chips, more of the differences will become apparent and need
workaround.

Comparing data sheets from different chips in the SSD16xx range
suggests that there are (at least) two different generations
present. These differ in the size of the LUTs they expect and the way
they handle partial refresh. This impacts register layout where
SSD16XX_CMD_UPDATE_CTRL2 uses bit 3 selects "mode 2" whereas older
devices uses this for a mode referred to as "initial".

In order to add support for partial refresh in newer devices, we need
to be able to distinguish between the different generations of the
chip. It might be possible to add a DT property to indicate the
revision, but that seems like a bit of an anti-pattern and it would be
hard for users to specify the correct chip generation.

This change introduces chip-specific compatible strings instead of the
generic SSD16xx. There is unfortunately clear pattern that can be used
to distinguish different generations, so the full chip name must be
specified. A benefit of this is that we don't need to specify the
width of the fields describing coordinates in device trees.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2023-05-11 14:40:50 -07:00
Benedikt Schmidt ecac441171 drivers: gpio: implement GPIOs in ADS114S08
Implement GPIO exander within the ADC ADS114S08.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-05-11 12:04:15 -04:00
Johann Fischer 0a5b682461 drivers: udc_virtual: fix bus SUSPEND, RESUME, RESET event handling
Only UVB_EVT_REQUEST type passes the pkt argument.
This was overlooked in the last refactoring and
resulted in a zero pointer dereference.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-11 15:29:58 +02:00
Marcin Niestroj 2da9be1583 drivers: sensor: lsm6dsl: use more precise ODR values
LSM6DSL's datasheet [1] lists 1666, 3332 and 6664 as valid ODR values for
accel and gyro. Update those from 1660, 3330 and 6660.

[1] http://www.st.com/en/mems-and-sensors/lsm6dsl.html

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-05-11 07:46:24 -05:00
Marcin Niestroj edfc08879d drivers: sensor: lsm6dsl: fix 250dps gyro range
Commit e015c00300 ("sensor: add lsm6dsl sensor driver") that introduced
initial support for lsm6dsl used 245dps instead of 250dps. According to
referenced documentation at [1] the latter is correct.

Use value of 250 instead of 245 for gyro range.

[1] http://www.st.com/en/mems-and-sensors/lsm6dsl.html

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-05-11 07:46:24 -05:00
Marcin Niestroj 56c0e166ff drivers: sensor: lsm6dsl: drop double assign of 'accel_freq'
This instance member is set as part of lsm6dsl_accel_set_odr_raw()
function, so there is no need to do it right before calling it.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-05-11 07:46:24 -05:00
Marcin Niestroj 86b60c34af drivers: sensor: lsm6dsl: remove unused accel_fs and gyro_{fs,freq}
Those are not used, so drop them from instance data.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-05-11 07:46:24 -05:00
Georgij Cernysiov 6bb603f4ee drivers: flash: stm32 ospi add ssht property
Allows to enable Sample Shifting Half-Cycle.

It is recommended to be enabled for STR mode.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-05-11 07:36:11 -05:00
Guillaume Gautier a7b8a5d61f drivers: adc: use dts properties for stm32 adc sampling time
Use the new dts properties for sampling time in the STM32 ADC driver:
- Get the sampling time from dts
- Remove all sampling time macro concatenation.
- Simplify/refactor setting of sampling time
- Check that sampling time is the same for all series using common channel

This also fixes a few cases where wrong sampling times were used for an
ADC instance (like ADC4 on U5, or ADC3 on STM32H723).

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-05-11 10:25:54 +00:00
Benjamin Bigler 1889af9d9c drivers: clock_control: stm32: Fix switching to HSI
If clock frequency was already high and a ahb prescaler greater than 1
was used frequency could temporary become higher than allowed.

Signed-off-by: Benjamin Bigler <benjamin.bigler@securiton.ch>
2023-05-11 10:05:47 +02:00
Sylvio Alves cc3ba0cd1a driver: wifi: esp32: add wifi statistics info
Adds Wi-Fi statistics feature.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-05-11 10:05:04 +02:00
Sylvio Alves 0b32c1f851 driver: wifi: esp32: add status information
Adds Wi-Fi driver connection status details.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-05-11 10:05:04 +02:00
Daniel DeGrasse 7c228c9042 drivers: display: stm32_ltdc: Update LTDC driver to use LCDIF binding
Update LTDC driver to use LCDIF bindings, to simplify bindings
between LCD interface controller IP blocks.

Boards supporting the LTDC are also updated to use the properties as
declared by the new lcd controller binding

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-05-11 10:04:24 +02:00
Daniel DeGrasse 746758d1f6 drivers: display: update MCUX ELCDIF driver to use new lcdif binding
Update MCUX ELCDIF driver to use new LCDIF bindings. This
update also adds support for configuring the root clock of
the ELCDIF module based on the pixel-clock property to the
RT11xx SOC clock init, as this SOC series has this IP block

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-05-11 10:04:24 +02:00
Daniel DeGrasse a4afa7d164 drivers: update DCNANO LCDIF IP to use shared LCDIF binding
Update DCNANO LCDIF IP to use shared lcd interface binding. This
requires changes to the RT5xx SOC and RT595 EVK, as this SOC
uses the LCDIF IP, and configures the clock for it based off
the new pixel-clock property.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-05-11 10:04:24 +02:00
Daniel DeGrasse 98408b1733 dts: mipi_dsi: introduce phy-clock property
Introduce phy-clock property, which is used by MIPI devices to determine
the target clock frequency for the MIPI PHY. This property can vary
depending on the attached display and target framerate.

Update the MIPI DSI MCUX driver to utilize this property to configure
the MIPI host, and update the RT500 clock initialization to configure
the MIPI root clock based on this property.

Remove dphy-clk-div property from the MIPI DSI 2L binding, as it
is redundant with this change.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-05-11 10:04:24 +02:00
Henrik Brix Andersen 3ee2b4c31a drivers: can: stm32: fdcan: move register definitions to implementation
Move definitions of the STM32 FDCAN specific registers to the front-end
driver implementation and implement remapping of these registers to/from
the standard Bosch M_CAN registers.

Some of the STM32 FDCAN register bit fields are limited in size compared to
the Bosch M_CAN specification. This is due to hardware limitations on the
number of elements in the various sections of the Message RAM. Add build
assertions to ensure the number of elements specified do not exceed the
hardware limitations instead of using custom definitions for these fields.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-10 15:28:11 +02:00
Henrik Brix Andersen 89f4330f94 drivers: can: mcux: mcan: move register definition to implementation
Move definition of the NXP LPC MCAN specific Message RAM Base Address
register (MRBA) to the front-end driver implementation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-10 15:28:11 +02:00
Henrik Brix Andersen a781ccde0f drivers: can: mcan: move message RAM configuration to front-end drivers
Some Bosch M_CAN IP core implementations use a fixed Message RAM
configuration, other use a fixed memory area and relative addressing,
others again have custom registers for configuring the Message RAM.

Move the responsibility for configuring the various Bosch M_CAN Message RAM
addresses to the front-end drivers. This removes some of the front-end
specific code from the backend. Provide a helper function for configuring
the most common variations.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-10 15:28:11 +02:00
Henrik Brix Andersen 65350b8362 drivers: can: mcan: allow drivers front-ends to read/write registers
Expose the can_mcan_read_reg()/can_mcan_write_reg() along with all the
Bosch M_CAN register definitions for use in Bosch M_CAN driver front-ends.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-10 15:28:11 +02:00
Henrik Brix Andersen bbfc1f905c drivers: can: mcan: let front-end drivers supply register r/w functions
Let the Bosch M_CAN front-end drivers supply their own register read/write
functions.

This is preparation for handling non-standard Bosch M_CAN register layouts
directly in the front-end and for accessing Bosch M_CAN IP cores over
peripheral busses.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-10 15:28:11 +02:00
Henrik Brix Andersen 1c0a43ec45 drivers: can: mcan: use sys_read32()/sys_write32() for register access
Use sys_read32()/sys_write32() instead of volatile struct for register
access. Be consistent in using unsigned constants in register
comparisons. Use locking around register read-modify-write operations.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-10 15:28:11 +02:00
Johann Fischer fce0b85eca drivers: usb_dc_dw: add support for STM32F4 SoC family
This commit is a draft to support more controller implementations
with these drivers. The goal is also to make it easier to port
this driver to the new UDC API later.
We use compatible, like st,stm24f4-fsotg to support and enable
vendor-specific quirk. The core of the driver remains generic,
and therefore described and enabled by snps,dwc2 compatible.

STM32F4 support requires PINCTRL, even though pinctrl API is
generic, not all platforms implement it, so we have to include
and compile it conditionally.

Now we also switch to use new snps,dwc2 compatible and
explicitly force the controller into device mode,
as we do not support other roles or role changes.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-10 20:07:04 +09:00
Johann Fischer 7538c551ff drivers: usb_dc_dw: add definition for GHWCFG1..4 registers
Add definition for GHWCFG1..4 registers to be able to obtain basic
information about PHY, endpoints, and Data FIFO.

Add GGPIO defines for STM32F4 SoC family USB controllers.
This implementation uses GGPIO to enable transceiver, VBUS
detection, and a few other functions.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-10 20:07:04 +09:00
Johann Fischer 4d2645a734 drivers: usb_dc_dw: cleanup and reorder register header
Align and sort defines according to the position in memory.
Remove unnecessary parentheses.

Fix USB_DW_DSTS_ENUM_SPD_MASK.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-10 20:07:04 +09:00
Johann Fischer 51f8d02294 drivers: usb_dc_dw: cleanup, move USB_DW macros to driver code
Cleanup includes, fix build and missing kernel header include.
Move copyright notice to the top.

USB_DW_* macros are a bit misplaced in register header,
which is supposed to be about registers only.

USB_DW macro is used to point to base of controller register set.
Move it to driver code and add a new variable in driver's configuration
that takes the base address of the instance. This also makes later
porting to UDC API and support multiple instances easier.

Remove redundant DW_USB_IN_EP_NUM and DW_USB_OUT_EP_NUM
macros. Do not limit number of endpoint register in
struct usb_dw_in_ep_reg as it does not reflect common
register mapping of the controller.

Fix build warnings caused by USB_DW_EP_FIFO and use base variable
to calculate data FIFO access register.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-10 20:07:04 +09:00
Dean Sellers ca7a66d787 drivers: ethernet: enc28j60: Prevent infinate loop on driver init
In the case that there is a situation where the controller
oscillator start-up timer doesn't expire, or the SPI can't
read the CLKRDY bit the driver would hang during init.
The config option ETH_ENC28J60_CLKRDY_INIT_WAIT_MS sets
the time that the driver will wait for OST before returning
an ETIMEDOUT error.

Signed-off-by: Dean Sellers <dsellers@evos.com.au>
2023-05-10 11:56:59 +02:00
Lucas Tamborrino b916440b2e drivers: dma: esp32xx: Remove dynamic allocation for invalid buffers
According to the coding guidelines "dynamic allocation is not allowed".

This commit removes handling invalid DMA capable buffers by allocating
temporary buffer in a valid memory region, considering them as errors.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-05-10 10:15:05 +02:00
Lucas Tamborrino a35dd4b926 drivers: dma: esp32s3: Add DMA support for esp32s3
Add GDMA support for esp32s3.
Remove suspend/resume since they are optional and do
the same as start/stop.
Fix possible null pointer derreference.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-05-10 10:15:05 +02:00
Sylvio Alves e7665bf75a driver: i2c: esp32: fix I2C statistics
I2C driver overwrites i2c_msgs buffers, which
causes statistics to fail counting.
This creates new variables to hold msg buffer information.

Fixes #57532

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-05-10 16:53:27 +09:00
yeongnam chu 5a6813519e drivers: add mutex to the i2c-gpio driver.
Mutexs  were added to improve the overlapping phenomenon
because there is a part that shares the i2c line.

Signed-off-by: yeongnam chu <yeongnam.chu@assaabloy.com>
2023-05-10 16:51:14 +09:00
Francois Ramu 609bb002e6 drivers: flash: stm32 ospi flash driver waits for full chip erase
Add a function to wait for the full (bulk) Nor-octoflah erase command.
When erasing the full octo-flash, the drivers waits until
the operation is ready and the external NOR mem becomes ready itself.
The full (bulk) erase operation lasts for several seconds.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-05-10 16:50:22 +09:00
Sreeram Tatapudi 861a7639ab drivers: flash: Fix kconfig dependency
- Update KCONFIG for flash driver to depend on
DT_HAS_FIXED_PARTITIONS_ENABLED, since that is necessary for the
driver implementation

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2023-05-10 16:49:59 +09:00
Shawn Nematbakhsh 5002ea4c42 drivers: spi: Add OpenTitan SPI driver
Add driver for OpenTitan SPI host.

Tested and verified single SPI full duplex on opentitan_earlgrey in
Verilator.

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2023-05-10 16:48:46 +09:00
Declan Snyder f4c2dc54b4 drivers: entropy_mcux_caam: Add semaphore
Add a semaphore to the entropy mcux caam driver
to make the driver thread safe, since some static
variables in the HAL can be the source of
some race conditions.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-09 13:24:00 -05:00
Tom Burdick e4b10328b4 rtio: Use mpsc for submission and completion queue
Rather than the rings, which weren't shared between userspace and kernel
space in Zephyr like they are in Linux with io_uring, use atomic mpsc
queues for submission and completion queues.

Most importantly this removes a potential head of line blocker in the
submission queue as the sqe would be held until a task is completed.

As additional bonuses this avoids some additional locks and restrictions
about what can be submitted and where. It also removes the need for
two executors as all chains/transactions are done concurrently.

Lastly this opens up the possibility for a common pool of sqe's to
allocate from potentially saving lots of memory.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-05-10 00:39:43 +09:00
Jared Baumann 26ee337517 drivers: adc: Rename gecko IADC config option
Renamed CONFIG_ADC_GECKO to CONFIG_IADC_GECKO to eliminate confusion
between the Incremental ADC found on series 2 silabs gecko MCUs, and the
ADC found on earlier gecko series.

Signed-off-by: Jared Baumann <jared.baumann8@t-mobile.com>
2023-05-09 23:31:45 +09:00
Mahesh Rao dc9dc3d044 subsystem: sip_svc: Add ARM SiP SVC subsystem
Introduce a new SiP SVC subsystem to provide ARM Silicon Provider based
supervisory call services. SiP SVC service provides the capability to
send SMC/HVC call from kernel running at EL1 to hypervisor/
secure monitor firmware running at EL2/EL3 and also added SiP SVC shell
commands to exercise the service.

Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
2023-05-09 08:46:50 -04:00
Mahesh Rao 1a7576ce9e drivers: sip_svc: Add driver for SiP Supervisory call
Add driver for communicating with EL3/EL2 layer using smc/hvc call
for Silicon vendor Provided services for INTEL AGILEX SOC FPGA.

Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
2023-05-09 08:46:50 -04:00
Dean Sellers 308cec45b0 drivers: spi: esp32xx: Add chip select setup and hold time
Added device tree bindings and implementaion for setting the
spi controllers chip select setup and hold time settings.

Signed-off-by: Dean Sellers <dsellers@evos.com.au>
2023-05-09 14:31:15 +02:00
Andrzej Głąbek 0b573a1f38 drivers: spi_flash_at45: Fix erasing of first two sectors
Most available AT45 flash chips have their first two sectors shorter
than the consecutive ones. Usually, the first sector is marked as 0a
and has its size equal to eight pages (one block) and the second one
(usually 0b) is the complement to the size of a regular sector.
This commits modifies the driver so that erasing of these first two
sectors is performed correctly. This modified behavior is configurable
with a new DT property so that it is still possible to also use legacy
AT45 chips that do not feature such sector split. Such legacy chips
usually also do not support the chip erase and sector erase commands,
so two more DT properties are introduced to cover that.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-05-09 12:22:15 +02:00
Aleksander Wasaznik bb1ede6a9b Bluetooth: Use bt_addr_eq
Refactor. Using `bt_addr_eq` instead of `bt_addr_cmp`.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-05-09 09:23:52 +02:00
Pieter De Gendt bab23bbe6c drivers: pwm: pwm_mcux: Round up PWM frequency to prevent overflow
The HAL function PWM_SetupPwm does the inverse division to get the
number of pulses from the frequency.
In the case of a prescaler of 1 and a period of UINT16_MAX cycles
this would result in an uint16_t overflow.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-05-09 16:23:35 +09:00
Armando Visconti 7ea422af84 drivers/sensor: add support to LSM6DSO16IS IMU sensor
The LSM6DSO16IS is a system-in-package featuring a 3-axis digital
accelerometer and a 3-axis digital gyroscope for industrial and IoT
solutions. The LSM6DSO16IS embeds a new ST category of processing,
ISPU (intelligent sensor processing unit) to support real-time applications
that rely on sensor data. The ISPU is an ultra-low-power, high-performance
programmable core which can execute signal processing and AI algorithms
in the edge.

https://www.st.com/en/mems-and-sensors/lsm6dso16is.html

This driver is based on stmemsc HAL i/f v2.02

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-05-09 16:23:15 +09:00
Armando Visconti a4337af69f drivers/sensor: stmemsc: add macros to populate stmdev_ctx_t structure
Add STMEMSC_CTX I2C/SPI/I3C macros that can be reused among all STMEMSC
based ST sensor drivers to populate the stmdev_ctx_t stucture.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-05-09 16:23:15 +09:00
Armando Visconti e7ddb6466b tests: drivers: build_all: add sensorhub test case
Add test case for all drivers that are supporting the sensorhub
feature, and fix right away all the yet undiscovered issues.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-05-09 16:23:15 +09:00
Mateusz Holenko 534952adff drivers: serial: uart_miv: Disable SERIAL_SUPPORT_INTERRUPT
In the real MiV platform, UART does not have any interrupts routed to
the interrupt controller.

Up to this stage, the driver implemented a separate thread to simulate
interrupt operation to enable shell samples. This is not required anymore,
as Zephyr can run shell on interrupt-less UARTs.

Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2023-05-08 16:59:21 -04:00
Jordan Yates ec362d4a48 modem: modem_iface_uart_async: handle RX errors
Re-enable reception on the UART instance when `UART_RX_DISABLED`
triggers, which can happen when errors occur on the line.

This stops the driver permanently moving into an unresponsive state.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-05-08 16:42:58 +02:00
Antonio Tessarolo 4598e6bf0a drivers/adc: imx6sx ADC support.
This commit adds support for adc_vf610 ADC.

Signed-off-by: Antonio Tessarolo <anthonytexdev@gmail.com>
2023-05-08 16:42:40 +02:00
Aaron Massey 3cc74f1140 emul: Make ESPI/I2C_EMUL depend on EMUL
The emulated espi and i2c bus controllers do not depend on CONFIG_EMUL
being enabled. When these fake bus controllers are enabled by their
assoicated compatible in the devicetree without CONFIG_EMUL it results in
linker failures for underlying peripheral emulators which may be difficult
to understand. The SPI config already depends on EMUL.

Make the ESPI and I2C emulated controllers depend on CONFIG_EMUL. Note:
This still allows linker failures if CONFIG_EMUL=n, but the linker failures
will be consistently at device driver instantiation due to a missing bus
controller. Regardless, this will be easier to debug when someone forgets
to enable CONFIG_EMUL.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-05-08 16:20:52 +02:00
Eivind Jølsgard 704e15d7f3 drivers: spi: nrfx: add multithreading Kconfig dependency
The nrfx SPI driver depends on semaphores, which require multithreading
support to be enabled.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
2023-05-08 16:18:20 +02:00
Sreeram Tatapudi 98858f1e6a drivers: flash: Add Infineon CAT1 Flash driver
- Added initial version of Infineon CAT1 Flash driver
- Added binding file for infineon,cat1-flash-controller.yaml
- Added overlays for subsys/nvs and drivers/flash_shell
to support cy8cproto_063_ble, cy8cproto_062_4343w boards
- Defined erase-block-size in PSoC6 MPN dtsi.

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2023-05-08 11:16:09 +02:00
Alberto Escolar Piedras 3e70063f94 drivers: nrf5 flash: Fix for simulation
Use new nrfx hal function to memcpy from flash
instead of accessing the array directly.
That function is inlining a memcpy for real targets,
so there is no practical difference for those.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-08 10:08:35 +02:00
Keith Short d4fef500b2 emul: pi3usb9201: Add charging mode support
Add charging mode support the PI3USB9201 emulator and add a backend API
for connecting/disconnecting a portable device partner.

Signed-off-by: Keith Short <keithshort@google.com>
2023-05-08 09:57:56 +02:00
Keith Short 00733f346b bc12: Add charging mode support
Add chargingg mode support to the BC1.2 API and the PI3USB9201 driver.

Signed-off-by: Keith Short <keithshort@google.com>
2023-05-08 09:57:56 +02:00
Keith Short 86cb55943d bc12: Add charging mode role information to callback
Update the result callback routine to also provide information about the
charging mode role. This permits tests to validate plug/unplug events
detected by the BC1.2 device operating in charging mode.

Signed-off-by: Keith Short <keithshort@google.com>
2023-05-08 09:57:56 +02:00
Bjarki Arge Andreasen d1bcc90160 drivers/sensor/bmi323: Add BMI323 driver support
This PR adds a driver for the BMI323, which implements
the following features:

* Enable and disable accelerometer and gyroscope respectively
* Set full scale for accelerometer and gyroscope respectively
* Set data rate for accelerometer and gyroscope respectively
* Get samples (x,y,z) from accelerometer and gyroscope respectively
* Get die temperature
* Set trigger to accelerometer data ready, and accelerometer any motion.

The driver implements device and device runtime power management. If
runtime management is used, it is initialized into the suspended state,
which soft-resets the device to achieve the lowest possible power
consumption, otherwise it is resumed when initialized. When resumed,
the bus is initialized, the feature engine is enabled, and INT1 is
initialized.

The driver only implements the SPI bus at this time. The driver is
prepared to be expanded with I2C support in the future.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-05-08 09:57:40 +02:00
Cyril Fougeray 1be72d9888 dma: callback with 2 status codes for successful transfers
Make use of positive status values in the DMA callback to pass
info to the DMA client after a successful DMA operation.
A completed DMA transfer uses the status 0 while a reached
water mark uses the status 1.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-05-08 09:57:32 +02:00
Dean Sellers 47f4218ea5 drivers: spi: esp32xx: Fix word size limiting transaction
Word size setting limited any SPI transaction to the frame
size. In addition to making the SPI inefficient this
broke drivers that set the word size. It appears that most
drivers use a one byte (8) size for this setting.
This change respects what I think is the intended use of
the word size setting. That is to set the length of
each element in a tx/rx buffer struct.

Signed-off-by: Dean Sellers <dsellers@evos.com.au>
2023-05-05 16:17:44 +02:00
TOKITA Hiroshi b2cf407c50 drivers: ethernet: enc28j60: Allow to create multiple instances
Allow defining multiple instances of enc28j60.
Remove the ETH_ENC28J60_0 Kconfig option along with this.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-05-05 16:17:29 +02:00
TOKITA Hiroshi 5e2cbd5184 drivers: ethernet: enc28j60: Add full-duplex property for devicetree
Add the `full-duplex` property for the `microchip,enc28j60` node.
Replace ETH_ENC28J60_0_FULL_DUPLEX Kconfig option with this property.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-05-05 16:17:29 +02:00
TOKITA Hiroshi 8a2f5c97f0 drivers: ethernet: enc28j60: Enable specific options only when selected
Enable enc28j60-specific options only when selecting ETH_ENC28J60.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-05-05 16:17:29 +02:00
Maximilian Deubel cbaa136e26 drivers: i2c: nrfx: add multithreading dependency
This patch adds MULTITHREADING as a dependency to the nrfx i2c driver.
The driver uses semaphores internally and can result in linker errors
if MULTITHREADING is not enabled.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2023-05-05 16:17:00 +02:00
Manimaran A 519477fbf1 drivers: i2c: microchip: I2C reset fix
Updated the code to to invoke reset using PCR block
z_mchp_xec_pcr_periph_reset()  instead of resetting
using I2C Configuration register

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-05-05 16:16:01 +02:00
Tomasz Moń 11b599c708 drivers: usb_dc_nrfx: Enable SOF interrupts only when needed
Do not enable SOF event interrupt when the USB device driver is going to
discard the event anyway. This prevents completely unnecessary interrupt
handler from executing 1000 times a second when device is connected.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-05-05 13:37:47 +02:00
Adam Wojasinski efa3ddd516 drivers: serial: uart_nrfx_uarte: Align use of TIMER macro in ASYNC API
nrfx 3.0 introduces parameter `_frequency` in
`NRFX_TIMER_DEFAULT_CONFIG()` macro. This patch aligns use of it.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski 09fa46ee4e drivers: sensor: qdec_nrfx: Add multi-instance support for QDEC SHIM
Reworked QDEC SHIM to suppor multi-instance peripheral. Patch includes
Kconfig alignment for proper instance handling.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski 9aa71977ee drivers: timer: nrf_rtc_timer: Align to renamed nrfx symbols
New nrfx release introduces renamed preprocesor symbols and macros
in nrf_rtc.h

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski 785fd9a0b5 drivers: i2s: i2s_nrfx: Align SHIM to nrfx_i2s multi-instance API
New nrfx release extended nrfx_i2s API and requires to specify
pointer to driver instance structure. This commit aligns SHIM
to reworked nrfx driver.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Andrzej Głąbek 7a54aed015 modules: hal_nordic: nrfx: Handle properly I2S0 instance
Although existing nRF SoCs have only one I2S instance, the nrfx_i2s
driver has now multi-instance API and the related nrfx configuration
symbols need to be used appropriately.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski 246393e830 drivers: spi: spi_nrfx_spim: Remove nrf_frequency_t handling
With new nrfx release SPIM driver stores frequency as a `uint32_t`
type representing frequency in `Hz` in its configuration structure.
Additionally `NRFX_SPIM_PIN_NOT_USED` has been removed,
`NRF_SPIM_PIN_NOT_CONNECTED` symbol is used instead.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski bb0284cdb5 drivers: pwm: Align SHIM to renamed fields in driver instance struct
New nrfx release aligns PWM fields in driver instance structure
to common nrfx naming convention.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski aafa4ba18e drivers: watchdog: wdt_nrfx: Align behaviour parameter
New nrfx release replaces `nrf_wdt_behaviour_t` type
to `nrf_wdt_behaviour_mask_t` enumerator. As a result function
setting behaviour accepts `uint32_t` bitmask of behaviour.

This commit aligns symbols used in SHIM to the ones introduced
with the nrfx release.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski 2fb78f7c63 counter: counter_nrfx_rtc: Align to renamed nrfx symbols
New nrfx release brings renamed macros and symbols in nrf_rtc.
This commit alligns RTC counter SHIM to it.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Adam Wojasinski beb7313fc4 drivers: clock_control_nrf: Align LF clock sources symbols to new nrfx
New nrfx release brings change of Low frequency sources symbols
in nrf_clock hal to uppercase. This commit aligns all occurrences.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-05 11:47:53 +02:00
Stefan Petersen 92a42d8f90 drivers: ethernet: eth_stm32_hal: Fix cppcheck warning
When running cppcheck on eth_stm32_hal.c it generated a warning for
shiftTooManyBitsSigned.

The solution is to make sure that the numeric value shifted is unsigned.

Updated to use BIT() macro as suggested by GeorgeGCV.

Fixes: #57336

Signed-off-by: Stefan Petersen <spe@ciellt.se>
2023-05-05 11:26:29 +02:00
Georgij Cernysiov 091f425cd1 drivers: flash: stm32 ospi: fix jedec id read
Flash not in OPI mode doesn't require extra
dummy cycles.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-05-05 11:26:21 +02:00
Alberto Escolar Piedras 0cd7fa31d3 drivers/modem sim7080 & ublox-sara: Fix link error
Fix link error when both modems' drivers are enabled
as they both define the same structure but did not
make it static.

This fixes the CI build failure of
tests/drivers/build_all/modem/drivers.modem.simcom_sim7080.build
on particle_boron

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-04 20:50:11 +02:00
Alberto Escolar Piedras fba4370a47 drivers/modem/ublox-sara: Fix build warning
Fix the following build warning:
include <fcntl.h> without CONFIG_POSIX_API
is deprecated. Please use CONFIG_POSIX_API
or #include <zephyr/posix/fcntl.h>

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-04 20:50:11 +02:00
Laczen JMS d496a17bb6 flash_simulator: add ability to use memory region
Add the ability for the flash simulator to store its contents in a
memory region.

This allows filesystems on the flash simulator to survive a reboot.
And allows subsystems (e.g. coredump) to store their info on ram while
using the (existing) flash partition backend.

Add a example (for nucleo_f411re) that shows how to configure the flash
simulator for hardware (cfg discussion #54166).

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2023-05-04 20:49:57 +02:00
Gerard Marull-Paretas 84fd4e671f drivers: sensor: ntc_thermistor: add support for generic NTC
Add support for a generic NTC, `ntc-thermistor-generic`. In this case,
the compensation table is provided via devicetree. Note that DT property
is prefixed with `zephyr,`, because while hardware related, it is linked
to a particular software implementation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-04 20:49:48 +02:00
Gerard Marull-Paretas 44f48f6da7 drivers: sensor: zephyr_thermistor: refactor driver
Refactor driver to align a bit more with its Linux counterpart, ie,
ntc_thermistor. This driver did quite a few _unconventional_ things,
like using "zephyr," compatibles, a dedicated node for pre-computed
compensation table (referenced by the actual pseudo-device node), etc.
The comparison helper function should likely be simplified as well (to
avoid the need for custom wrapper for bsearch), but this can be done
later.

In this refactor, each thermistor gets a compatible, e.g. "epcos,xxxx".
Compatibles are known by the driver, so are compensation tables. This
simplifies devicetree files. There's no need to bother about
compensation tables in **every** board file if Zephyr supports a certain
NTC model.

In general we should respect Linux bindings, which in the end influence
how drivers are implemented. In this case, this principle resulted in
simplified, easier to use code.

For future developers, this is how support for a new NTC can be added:

1. Add to the end of the driver:

```c
 #undef DT_DRV_COMPAT
 #define DT_DRV_COMPAT vnd_model

 static __unused const struct ntc_compensation comp_vnd_model[] = {
     { x, y },
     ...,
 };

 #define DT_INST_FOREACH_STATUS_OKAY_VARGS(NTC_THERMISTOR_DEV_INIT,
                                           DT_DRV_COMPAT, comp_vnd_model)
```
3. In driver's Kconfig make sure it depends on
   DT_HAS_$DT_DRV_COMPAT$_ENABLED

Note: $X$ means _value_ of X.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-04 20:49:48 +02:00
Gerard Marull-Paretas c60e4ec989 drivers: sensor: zephyr_thermistor: align connection type with Linux
It looks like the Zephyr thermistor driver bindings were half-copied
from Linux ntc-thermistor. Zephyr principle is to maintain compatibility
with Linux, when possible, so there's no reason to deviate here. Convert
the connection type from a custom enum to a boolean, as Linux does.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-04 20:49:48 +02:00
Benedikt Schmidt 6d6f6eb3ee drivers: adc: add driver for ADS114S08
Implement a driver for the ADC ADS114S08

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-05-04 10:47:56 +02:00
Filip Kokosinski a30862455e treewide: rename Microsemi to Microchip
Do a treewide Microsemi to Microchip rename and update obsolete links in
the board docs.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-05-04 10:47:07 +02:00
Frank Buss e34a784b5a drivers: flash: 4 byte address mode fix, if write enable is required
This fixes this bug:
https://github.com/zephyrproject-rtos/zephyr/issues/57498
If bit 1 is set, then a write enable is required before
sending the 0xb7 instruction to enable the 4 byte address
mode, which this PR implements.

Signed-off-by: Frank Buss <fb@frank-buss.de>
2023-05-04 10:45:19 +02:00
Armando Visconti 390c036900 drivers/sensor: lsm6dso: improve sensorhub code
1. Fix sensorhub names using the zephyr A.2 rule (use inclusive language).
   The only exception is names within STMEMSC API and h/w register names.

2. Extend the STMEMSC API usage. It is always better to not code again
   already existing functionalities.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-05-04 10:45:10 +02:00
Manoel Brunnen 2b4fdd1902 drivers: pinctrl: imx: Use sys_write32 function
sys_write32 does the exact same thing, but increases the readability.

Signed-off-by: Manoel Brunnen <mb@lee-brunnen.de>
2023-05-03 17:01:24 -05:00
Manoel Brunnen d6e26b8a0d drivers: pinctrl: imx: Add braces to if bodies
Putting the bodies in if statements inside braces increases the
readability.

Signed-off-by: Manoel Brunnen <mb@lee-brunnen.de>
2023-05-03 17:01:24 -05:00
Tom Burdick dba487e480 icm42688: Interrupt pulse for 4khz+ sampling
Always set the interrupt pulse settings when sampling at greater than 4khz
to better ensure the interrupt line is toggled and caught correctly.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-05-03 08:46:37 -05:00
Tom Burdick da5030eae1 adc: ADS7052 correct spi configuration
SPI configuration did not set bit ordering or more importantly the clock
polarity which seemed to be misconfigured. Setting this corrects one more
quirk when working with this part on the TDK Robokit1

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-05-03 08:46:37 -05:00
Andy Sinclair d700ab5a88 drivers: sensor: npm1300_charger: NPM1300 charger driver
Initial sensor driver for NPM1300 PMIC charger.
Includes basic configuration of charger voltage and current.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-05-03 15:04:18 +02:00
Francois Ramu 1f070c91cf drivers: timer: stm32u5 lptimer wait for ready only once
The stm32_lptim_wait_ready() is waiting for the DIEROK flag
with a while loop. It should not be repeated.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-05-03 12:40:02 +02:00
Andriy Gelman 760d1588e8 drivers: spi: xmc4xxx: Fix comp with interrupt enabled and dma disabled
When dma is enabled, spi_xmc4xxx_transcieve_dma() needs to disable the
isr used by spi_xmc4xxx_transceive(). Renable the isr at the
end of spi_xmc4xxx_transceive_dma() instead of in spi_xmc4xxx_transceive().
Doing this in latter function will fail compilation when interrupt
support is enabled but dma is disabled.

This is regression from 8494b6413a
but was only caught when xmc47_relax_kit was added which tested this
scenario in tests/drivers/spi/spi_loopback.

Fixes #57494

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-05-03 14:23:32 +09:00
Daniel DeGrasse f9fbd8a287 drivers: kscan: gt911: ignore touch events if TOUCH_STATUS mask is clear
Ignore touch events from GT911 IC when TOUCH_STATUS_MSK bit is not set
in status register. This resolves an error where the GT911 driver would
report a touch event end directly after a touch occured, as the touch
status register would be 0x0, which the driver incorrectly interpreted
as a touch release.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-05-02 21:03:05 +02:00
Declan Snyder 7ef5445e18 drivers: uart_mcux: Do not select async support
Commit f1b0b458b0 mistakenly selected the
SERIAL_SUPPORT_ASYNC kconfig for the kinetis uart
driver when enabling the lpuart driver. Revert this,
because the kinetis uart driver does not support async api.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-02 21:02:43 +02:00
Brian Juel Folkmann 7abcfc4e4c drivers: flash: bug fix select correct erase address mode
SPI / QSPI flash with density above 16MB must use 4 byte addressing mode
also on sector erase.

This patch selects the right addressing mode and opcode when 4 byte
addressing mode is selected

Signed-off-by: Brian Juel Folkmann <bju@trackunit.com>
2023-05-02 09:37:29 -05:00
Christopher Friedt 9ad78eb60c drivers: pcie_ep: iproc: compile-out unused function based on DT
Compile-out `iproc_pcie_pl330_dma_xfer()` if there are no active
DMA users in devicetree.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-05-02 09:10:33 -04:00
Jordan Yates ca6c08f960 Bluetooth: hci: spi: use level triggered interrupts
Use level triggered interrupts instead of edge triggered interrupts to
make it impossible for the interrupt line to be active without the RX
thread attempting to read pending data.

This fixes a race condition for re-enabling the interrupt in edge
triggered mode, where `gpio_pin_interrupt_configure_dt` is not called
before the controller re-asserts the interrupt line.

As a result the controller can be reset before booting the RX thread.

Fixes #53980.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-05-02 12:36:09 +02:00
Ryan McClelland 272c4e9a8d drivers: ethernet: eth_mcux: fix double-promotion warnings
Some single-precision float constants were being compared against
double-precision floats. Make the constants doubles.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-05-02 12:35:14 +02:00
Andriy Gelman 7ed4531dbb dts: arm: infineon: xmc4xxx: Add Port 14/15 to device tree
Add Port 14/15 to device tree. These ports can only be configured as input.
Error out in gpio driver if user sets them as output.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-05-02 12:34:55 +02:00
Henrik Brix Andersen 6ae5efd663 drivers: can: mcan: regenerate register field definitions
Regenerate/rewrite the Bosch M_CAN register field definitions using the
GENMASK() and BIT() macros.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-02 19:26:09 +09:00
Henrik Brix Andersen d7ae40bbc2 drivers: can: mcan: use uintptr_t for pointer mathematics
Use uintptr_t for doing pointer mathematics.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-02 19:26:09 +09:00
Henrik Brix Andersen c4ae88bea0 drivers: can: mcan: use FIELD_PREP/FIELD_GET macros
Use the FIELD_PREP() and FIELD_GET() macros instead of manual bitshifts and
masking. Be consistent in the use of register field definition macros.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-02 19:26:09 +09:00
Henrik Brix Andersen 522f87edf6 drivers: can: mcan: remove unused includes
Remove unused includes and sort the remaining includes alphabetically.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-02 19:26:09 +09:00
Henrik Brix Andersen 73ecdd9c91 drivers: can: mcan: use consistent #ifdef ... #else ... #endif comments
Use consistent comments for #ifdef ... #else ... #endif statements to
improve code readability.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-02 19:26:09 +09:00
Henrik Brix Andersen 98eac75cb2 drivers: can: mcan: rename local config struct variables
Rename the local "const struct can_mcan_config *" variables from "cfg" to
"config" to be consistent with Zephyr conventions.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-02 19:26:09 +09:00
Henrik Brix Andersen cb904c8a83 drivers: can: mcan: get rid of can_mcan_configure_timing() helper function
Get rid of the can_mcan_configure_timing() helper function as it provides
no benefit to just having the implementation split in can_mcan_set_timing()
and can_mcan_set_timing_data().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-02 19:26:09 +09:00
Henrik Brix Andersen df6eda64fb drivers: can: mcan: move the driver init function to the bottom of the file
Move the driver initialization function to the bottom of the file to be
consistent with Zephyr conventions.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-02 19:26:09 +09:00
Henrik Brix Andersen a3a4144697 drivers: can: mcan: use proper namespace for internal functions
Use the "can_mcan_*" namespace for all driver-internal functions to improve
code readability.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-02 19:26:09 +09:00
Henrik Brix Andersen 2c2165dba3 drivers: can: mcan: pass struct device pointer to internal functions
Pass a pointer to the struct device for internal driver functions instead
of passing around a pointer to the register struct.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-02 19:26:09 +09:00
Henrik Brix Andersen e1fe5e9a1c drivers: can: mcan: reformat source files
Reformat source files using clang-format prior to refactoring the driver
code.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-02 19:26:09 +09:00
Brian Juel Folkmann 065a8f25e1 drivers: stm32_temp stm32h5 device must disable icache to access cal
Reading the temperature calibration data requires disabling the icache
of the stm32h5x mcu.
Else a bus fault error occurs reading Address: 0x8fff8014-0x8fff818
Enable afterwards.

Signed-off-by: Brian Juel Folkmann <bju@trackunit.com>
2023-05-02 10:53:58 +02:00
Tom Burdick f923bf8662 spi: sam: Fix gpio chip select usage
When using gpio chip select the clock line seems to get stuck low after
some transactions. When attempting to use other SPI_CSR registers
the peripheral fails to work as expected.

Always using SPI_CSR[0] when using gpio chip selects resolves the issue.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-04-29 12:24:07 +02:00
Cong Nguyen Huu cad17ff933 drivers: can: support NXP S32 CANEXCEL
This patch introduces support for NXP S32 CANEXCEL (CANXL) peripheral.

CAN protocol supporting:
- CAN classic
- CAN FD

Remote transmission request is not supported as this feature is not
available on NXP S32 CANXL HAL.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-04-29 12:23:40 +02:00
Alberto Escolar Piedras e1fabfa9a4 bsim: cmake: Remove unnecessary references to environment
These variables are now provided by the FindBabbleSim
cmake module, which finds them in the environment or thru
west.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-28 20:38:48 +02:00
Gerard Marull-Paretas 7fa4776948 drivers: regulator: fixed: refactor initialization code.
In some cases, the enable pin may be already enabled by a previous
stage, e.g. bootloader. Therefore, it is not desirable to disable
the pin, as it could cause malfunctioning of the device. Refactor init
procedure so that we pick the right GPIO flags during the first
configuration stage.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-28 20:38:17 +02:00
Marek Metelski d55b0a410d drivers: pwm: stm32: Connect IRQ for input capture by 'cc' name
Some STM32 timers have more than one interrupt available.
When such timer is used it's likely that the first found interrupt
will not be the proper, 'cc' interrupt for input capture.

Existing implementation always connected the first irq, which worked
for timers with single, 'global' interrupt but broke input capture
for advanced timers with more interrupts.

Improve the IRQ connection logic by connecting the 'cc' interrupt
if it exists. Only if not found use the fallback mechanism of taking the
first index

Signed-off-by: Marek Metelski <marek@metelski.dev>
2023-04-28 20:38:02 +02:00
Jose Alberto Meza 15a1be1c5f drivers: espi: Distinguish mechanism to send regular VW notifications
Add another helper function to send VW notification that is
neither a warning or conveys a system state.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2023-04-28 09:47:13 -05:00
Aaron Massey 07ee466591 emul: Migrate all emulation use to use DT_HAS_
Remove all enabling of CONFIG_EMUL_.* in favor of automatically enabling
peripheral emulators based on the compatible string presence in the device
tree and the one true CONFIG_EMUL.

Zephyr has long since moved to a model of enabling drivers based on the
presence of their associated IC's compatible string in the final devicetree
overlay. There is no reason that emulators can't align in just the same
way, and probably ought to to remove superfluous enabling of configs.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-04-28 08:37:33 -05:00
Lucas Tamborrino 396f866a90 drivers: hwinfo: esp32_net: add support for esp32_net
Add guard for esp32_net so it can access the right registers.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-04-28 14:49:08 +02:00
Marek Vedral 86842dbab5 drivers: ethernet: xlnx_gem: fix PHY_MRVL_MODE_CONFIG_MASK
According to the datasheet for Marvell PHY [1], the mode field of the
General Control Register 1 Page 18 occupies bits [2:0]. However, the macro
PHY_MRVL_MODE_CONFIG_MASK specifies the mask as 0x3, which would
correspond only to [1:0]. The code in phy_xlnx_gem_marvell_alaska_cfg()
uses the mask to set the mode field to 0 to set "RGMII (System mode) to
Copper" mode. Unfortunately, different chips have different reset values
(111 or 000) and in first case, the code would set the field to 100,
instead of 000.

Without this change, ethernet on Avnet MicroZed (Marvel Alaska 88E1512 PHY)
does not work.

Signed-off-by: Marek Vedral <vedrama5@fel.cvut.cz>

[1]: https://www.marvell.com/content/dam/marvell/en/public-collateral/phys-transceivers/marvell-ethernet-phys-alaska-88e151x-datasheet.pdf
2023-04-28 14:48:52 +02:00
Sascha Silbe 7628bd9649 drivers: clock_control: stm32h7: disable PLL1 before configuring it
If the boot loader already switched the system clock to PLL1 we need
to switch back to HSI first and disable PLL1 before we can configure
PLL1. Otherwise the register writes will simply be ignored and we'll
end up with an inconsistent state.

Most of the code has been recycled from `clock_stm32_ll_common.c`.

Signed-off-by: Sascha Silbe <sascha-pgp@se-silbe.de>
Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
2023-04-28 10:10:19 +02:00
Lucas Tamborrino b24d9ca7a6 drivers: flash: esp32s3: Add spiflash support
Add support for spiflash to esp32s3

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-04-28 10:08:16 +02:00
Declan Snyder 4b45928e86 drivers: lpadc: Move SOC code out of driver
To be consistent with the current NXP clocking scheme,
move the LPADC clocking code to the SOC files where
all of the other peripheral clocking is done.

Also remove any other SOC-specific code to the
respective SOC file and out of this driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-04-28 10:08:05 +02:00
Declan Snyder af6b9d857f drivers: lpadc: re-add power level code
Code for power level property was accidentally
removed by accident from driver in commit 9921c59f40

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-04-28 10:08:05 +02:00
Daniel Gaston Ochoa 9eed160a06 drivers: stm32: SPI: cannot send several buffers if frame size is 16 bits
First `spi_context_buffers_setup` must use a `dfs` of 1 or 2 depending on
the frame size.

Signed-off-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
2023-04-28 10:05:30 +02:00
Daniel Gaston Ochoa 3003777810 drivers: stm32: SPI: cannot send several buffers if frame size is 16 bits
spi_context_get_next_buf must not divide `len` by `dfs` because, in SPI,
buffer lengths are given in units of data (in this case, 16 bits), not in
bytes.

Signed-off-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
2023-04-28 10:05:30 +02:00
Bill Waters 3e02d48e4e driver: adc: infineon: Adding ADC driver
- This includes the driver, test app, and sample app
- Only the boards\arm\cy8cproto_062_4343w board is supported for now

Signed-off-by: Bill Waters <bill.waters@infineon.com>
2023-04-27 10:16:23 -07:00
Anisetti Avinash Krishna bfeb5043ac drivers: rtc: rtc_mc146818: Added RTC driver for Motorola MC146818B
Added RTC driver that supports Motorola MC146818B
Enabled RTC set/get time and alarm, alarm callback
and update callback.

Counter and RTC uses same hardware in case of
Motorola MC146818, so they can't be used at a time.

Updated stand-alone mc146818 counter dts instances
to support rtc and counter with same compatible
string of "motorola,mc146818" on ia32, atom,
apollo_lake, elhart_lake and raptor_lake platforms.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-04-27 14:15:22 +02:00
Henrik Brix Andersen 11fc5d03d1 drivers: rtc: add driver for the nxp pcf8523 rtc
Add RTC device driver for the NXP PCF8523 Real-Time Clock (RTC) and
calendar.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2023-04-27 09:51:42 +02:00
Henrik Brix Andersen 8640f7be8b drivers: rtc: add RTC driver log level configuration
Add Kconfig for setting the RTC driver log level.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2023-04-27 09:51:42 +02:00
Henrik Brix Andersen 29d112c0ff drivers: rtc: allow configuring the RTC initialization priority
Add Kconfig to allow configuring the RTC device driver initialization
priority.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2023-04-27 09:51:42 +02:00
Wojciech Slenska 7271c3926f drivers: clock_control: stm32h5: Set HSI divider
By default HSIDIV is set to 0x01, so default frequency is 32 MHz.
This register should be always set based on dts value.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-04-27 09:51:00 +02:00
Brandon Del Bel 83fc732019 drivers: ethernet: sam0: Increase RX buffer count by one
The SAM GMAC driver is not able to use all of the receive buffers
concurrently. Frames larger than (buffer size) * (buffer count - 1) are
silently dropped. Fix it by adding one to MAIN_QUEUE_RX_DESC_COUNT.

Fixes #55701

Signed-off-by: Brandon Del Bel <delbel@umn.edu>
2023-04-27 09:50:39 +02:00
Chris Friedt 7212792295 drivers: pcie_ep: iproc: ensure config and api are const
The `config` and `api` members of `struct device` are expected
to be `const`. This also improves reliability, as `config`
and `api` are stored in rom rather than ram, which has the
potential to be corrupted at runtime in the absense of an MMU.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-04-26 17:54:59 -04:00
Tarun Karuturi 9d95f69a87 drivers: pcie_ep: iproc: enable based on device tree specs
There are use cases for the pcie_ep driver where we don't
necessarily need the dma functionality. Added ifdef's around
the dma functionality so that it's only available if we
specify the dma engines in the device tree similar to

```
dmas = <&pl330 0>, <&pl330 1>;
dma-names = "txdma", "rxdma";
```

Signed-off-by: Tarun Karuturi <tkaruturi@meta.com>
Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-04-26 17:54:59 -04:00
Maximilian Deubel 3746074073 drivers: sensor: Add driver for TI INA3221
This patch adds support for the TI INA3221 current monitor.
This is the datasheet used for reference:
https://www.ti.com/lit/gpn/ina3221

Since this device has three channels, there is a custom attribute to
select which channel is to be used when getting a sample.
Measurements are done on all enabled channels.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2023-04-26 20:08:04 +02:00
Łukasz Hejnak (LeHack) 1929eb3af7 drivers: sdhc: add support for using CPOL/CPHA SPI clock modes
Make it possible to use CPOL/CPHA SPI clock modes with the SDHC driver.
Some cards require the clock to switch to low when not active.

Signed-off-by: Łukasz Hejnak (LeHack) <lehack-ghub@lehack.pl>
2023-04-26 20:07:53 +02:00