Commit graph

18932 commits

Author SHA1 Message Date
Martin Kiepfer
aef1611e1f sensors: mpu6050: Add support for variant mpu6886
This commit adds support for mpu6886, which has compatible register
layout.

Signed-off-by: Martin Kiepfer <m.kiepfer@teleschirm.org>
2023-10-25 17:33:35 +02:00
Aleksandr Senin
d8b153e00f drivers: eth: eth_stm32_hal: Add DSA support
This commit adds DSA functionality support to the Ethernet driver
for the STM32 SoC.

Signed-off-by: Aleksandr Senin <al@meshium.net>
2023-10-25 09:55:42 -05:00
Jason Murphy
38f8a4db28 drivers: ethernet: fix adin2111 devicetree init to work with adin1110
The initialisation of the device data struct was giving a build error
when using the adi,adin1110 devicetree compatible.
Fixed to allow both adi,adin2111 and adi,adin1110 devices to
be defined.

Signed-off-by: Jason Murphy <jason.murphy@analog.com>
2023-10-25 09:57:37 +02:00
Antoniu Miclaus
89be1e948d drivers: adxl367: add support
Add driver support for adxl367 accelerometer.

The ADXL367 is an ultralow power, 3-axis microelectromechanical
systems (MEMS) accelerometer that consumes only 0.89 μA at
a 100 Hz output data rate and 180 nA when in motion-triggered
wake-up mode. Unlike accelerometers that use power duty cycling
to achieve low power consumption, the ADXL367 does not alias
input signals by undersampling, but samples the full bandwidth of
the sensor at all data rates.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
2023-10-25 09:57:02 +02:00
cyliang tw
b59810650d drivers: can: support for Nuvoton numaker series
Add Nuvoton numaker series can-fd controller based on mcan.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-10-24 09:31:47 -05:00
Mike J. Chen
01aa800464 drivers: mipi_dsi: dsi_mcux_2l add property to enable non-continuous hs clk
Allows device tree to enable usage of the controller feature
where HS clock is disabled when not in use, which is good
for reducing power consumption if MIPI DSI is mostly idle.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-10-24 11:37:41 +02:00
Mike J. Chen
4844d015a4 drivers: mipi_dsi: dsi_mcux_2l add msg flag for low power mode
Previous version of dsi_mcux_2l hardcoded some MIPI DSI
transfers to use high speed mode but others used low power mode.

Now dsi_mcux_2l will use high speed mode by default for all
transfers unless a new msg flag is set to indicate the
transfer must use low power mode. Note that the new flag
is different than the existing MIPI_DSI_MODE_LPM flag, which
so far only applied to cmd messages sent in video mode,
or could be interpreted as for all messages, but would not
allow per message mode control.

This new message flag allows client to control transfer
mode per message transfer.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-10-24 11:37:41 +02:00
Mike J. Chen
1e6866ed0b drivers: mipi_dsi: dsi_mcux_2l set SMARDMA slot from dev pixfmt
Previous version hardcoded the SMARTDMA slot to either
RGB565 or RGB565_SWAP, but that would be incorrect
if the pixfmt was RGB888. Use the mipi device
pixfmt to set the slot.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-10-24 11:37:41 +02:00
Nikodem Kastelik
6a315a4b17 drivers: sensor: qdec_nrfx: Revert spurious samplerdy evt workaround
Underlying nrfx driver was modified so now it forwards the event
to the user callback only if it was enabled.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2023-10-24 11:13:53 +02:00
Chen Xingyu
a2ef2f7605 drivers: gpio: Add GPIO driver for BCM2711
The BCM2711 SoC exposes 58 GPIOs. The first 28 (bank 0) are accessible
to users via the 40-pin header, while the others (bank 1) are used for
controlling on-board peripherals.

This also update doc of `rpi_4b` board.

Signed-off-by: Chen Xingyu <hi@xingrz.me>
2023-10-24 11:03:44 +02:00
Henrik Brix Andersen
4737706794 drivers: can: sja1000: add CAN statistics support
Add support for CAN statistics to the SJA1000 CAN controller driver. The
hardware does not support distinguishing between being unable to transmit
dominant versus being unable to transmit recessive bits.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-23 18:20:23 +02:00
Jordan Yates
322d4c1f98 bluetooth: hci: spi: avoid rxmsg re-use
Don't re-use the `rxmsg` buffer in the `bt_spi_send` function. This
buffer is still used by the RX thread after releasing the SPI semaphore.
The current re-use can result in buffer corruption if the RX thread is
swapped out as a result of the `k_sem_give`.

Moving the semaphore release later can result in deadlocks due to
buffer allocation being performed while holding the semaphore, so
instead just eliminate the re-use entirely.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-10-23 18:19:58 +02:00
Jordan Yates
00e67753ac bluetooth: hci: spi: extract message handling to func
Extract the HCI message handling out to a dedicated function to simplify
the main thread function. This also solves a bug as a side effect.

Previously `discardable` and `timeout` were never being reset after
an advertising report was received, resulting in ALL events after the
first advertising report being treated as discardable.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-10-23 18:19:58 +02:00
Tom Burdick
f0326f7249 tests: dma_loopback: Intel ADSP ACE15 disable PM
Disable power management for this particular test case as it expects a
particular pattern of pm get/puts that isn't matched by the driver and
usage in SoF.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-10-23 10:01:09 -05:00
Markus Becker
e51c044216 sensor: ltrf215a: LiteOn LTR-F216A
New driver for I2C illuminance sensor LiteOn LTR-F216A.

Datasheet:
https://optoelectronics.liteon.com/upload/download/DS86-2019-0016/LTR-F216A_Final_DS_V1.4.PDF

* Applied suggestions from code review
* Removed retry mechanism

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
Co-authored-by: Andy Sinclair <andy@aasinclair.co.uk>
2023-10-23 09:47:09 -05:00
Jason Wright
7e02a0379f drivers: counter native: Add top value conf and multi channel support
The counter_native_posix driver currently does not support top value
configuration, i.e. `ctr_set_top_value` returns `-ENOTSUP`. This commit
adds support for top value configuration, and with the counter API now
fully implemented, adds `counter` to `supported` peripherals for
native_posix target.
It also resolves an existing bug in which the
counter ISR did not reset upon reaching `TOP_VALUE`.
And adds support for multiple channels

Signed-off-by: Jason Wright <jason@jpw.nyc>
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-23 13:38:43 +02:00
Andy Sinclair
7cf4eff731 drivers: mfd: npm1300: Fixed race condition in event callback
If an event occurs between the status registers being read and
the event being cleared, the interrupt line will remain active.

As the interrupt is edge triggered,  all future interrupts
will being ignored.  This problem will also occur if an I2C
transation fails in the callback.

The state of the interrupt pin is now checked at the end of the
callback, and a retry is attempted if the interrupt has not
been cleared.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-10-23 12:55:04 +02:00
Andy Sinclair
733834851d drivers: mfd: npm1300: Added shiphold button release event
Added event for detecting release of shiphold button

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-10-23 12:55:04 +02:00
Bjarki Arge Andreasen
99ce7d071f drivers: rtc: Add atmel sam series RTC driver
This commit adds an RTC device driver for the atmel SAM
series chips.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-23 10:49:11 +01:00
Flavio Ceolin
b483c9251c drivers: adc: Fix misuse of const and k_tid_t
"const k_tid_t" is "struct k_thread * const" and not "const struct
k_thread *" as the code may be assuming. Just drop it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-23 11:35:33 +02:00
Andrei Emeltchenko
4e946262cb boards: ish: Continue to use HPET_TIMER for ISH and Qemu
Fot Qemu and intel_ish boards continue to use HPET_TIMER.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-10-23 10:34:03 +02:00
Andrei Emeltchenko
d6035f4a26 drivers: timer: Select APIC_TSC_DEADLINE_TIMER by default
Select APIC_TSC_DEADLINE_TIMER as default timer for x86.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-10-23 10:34:03 +02:00
Andrei Emeltchenko
19e32dc31e drivers: timer: Refactor x86 system timer selection
Refactor timer selection to allow to select only one timer.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-10-23 10:34:03 +02:00
Henrik Brix Andersen
d9b69f9d33 drivers: can: mcp2515: add CAN statistics support
Add support for CAN statistics to the Microchip MCP2515 CAN controller
driver. The hardware only supports reporting RX overruns.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-23 10:33:10 +02:00
Henrik Brix Andersen
1f779fa442 drivers: can: shell: print CAN statistics when showing CAN details
Print the CAN statistics when showing CAN controller details.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-23 10:33:04 +02:00
Henrik Brix Andersen
0cfca8be85 drivers: can: add accessor functions for the CAN statistics
Add accessor functions for the individual CAN statistics.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-23 10:33:04 +02:00
Jay Vasanth
7c43370997 microchip: ps2: fix compilation error
fix compilation error when CONFIG_PM_DEVICE is not enabled

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-10-22 20:40:24 +03:00
Andy Sinclair
be83225ee6 drivers: sensor: npm1300: Fixed charge current scaling
The scaling factor for current measurement was incorrect.
Full range scaling during charge is 1.25 * charge current
limit, and there is no additional scaling factor applied
in different charge modes.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-10-22 19:24:54 +02:00
Teoh Shi Lin
bfa0b52a84 drivers: serial: uart_intel_lw: add driver
Enable driver for intel lw uart.

Changes from review:
- refactor spinlock to inside of loop
- use menuconfig for kconfig
- add CONFIG_UART_INTEL_LW_AUTO_LINE_CTRL_POLL

Signed-off-by: Teoh Shi Lin <shi.lin.teoh@intel.com>
2023-10-21 11:54:23 +02:00
Jacob Preston
52c55177ba drivers: uart: nrf: rx_timeout_slab incorrectly set
When rx_timeout is set to a sufficiently small value,
rx_timeout_slab could potentially get set to a greater
than necessary value that causes spurious UART_RX_RDY
events.

Fixes #62828

Signed-off-by: Jacob Preston <jacob.preston@synapse.com>
2023-10-21 11:38:46 +02:00
Karthikeyan Krishnasamy
f5ed51c179 drivers: sensors: add MC3419 accel sensor support
add basic sensor support for 3-axis accelerometer, currently
this driver support data acquisition and motion detection
features.

Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
2023-10-20 15:25:16 -05:00
David Corbeil
0f5c6b7d74 drivers: flash: Fix union shadowing warning
Because shadow variable warning is turned on, a warning was thrown and
could fail some twister tests that don't use the -W option. This commit
gets rid of the warning.

Signed-off-by: David Corbeil <david.corbeil@dynon.com>
2023-10-20 19:25:41 +02:00
Jaroslaw Stelter
02deea0e80 ace: alh: Only ACE1.5 has OSEL feature
The OSEL bits in ALHASCTL register are present only
in ACE1.5 version - MTL. Platforms ACE2.0 do not have
the OSEL bits. Therefore DAI_ALH_HAS_OWNERSHIP
configuration option should be set only for
particular ACE1.5 version

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-10-20 15:21:01 +02:00
Martin Gritzan
ff2b827143 drivers: stm32-exti: do not lock hwsem on irq disable
Remove the HWSEM locking around stm32_exti_disable().

The STM32 EXTI driver uses the core-local interrupt mask regsiters on
STM32H7x7 asym. dualcore MCUs. There is no need to lock the HWSEM
guarding the EXTI when accessing these registers.

Some sensor drivers toggle their interrupt mask every time the sensor
triggers the IRQ line. Locking the HWSEM fails e.g. in situations where
one coprocessor serivces the sensor and the other coprocessor sets up
its interrupts initially during bootup. This prevents the sensor driver
from locking the HWSEM and causes a kernel panic on the corresponding
CPU.

Note: The opposing stm32_exti_enable() was already correctly without
locking.

Signed-off-by: Martin Gritzan <martin.gritzan@gmail.com>
2023-10-20 15:15:15 +02:00
Alberto Escolar Piedras
7e852d1708 drivers timer nrf: Correct dependencies for simulation
Let's make the nrf rtc kconfig depend on the SOC_COMPATIBLE
options which are set both by the real and simulated targets
so the configuration matches in both cases.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-20 15:14:30 +02:00
Dennis Grijalva
2516aa8b0b drivers: regulator: pca9420: Add support for configuring ASYS UVLO
Add support for configuring ASYS UVLO (under voltage lock out) threshold

Signed-off-by: Dennis Grijalva <dennisgrijalva@meta.com>
2023-10-20 15:14:04 +02:00
Tahir Akram
7c7c8f193e drivers: modem: introducing config for cereg/creg for gsm
This contribution addresses the support for various types of modems in
gsm driver. As some 4G modems have failed to return correct output
from AT+CREG?, so AT+CEREG? is the right AT command in such situation.
This commit provides the possibility for user to select one type of
AT command. This PR fixes zephyrproject-rtos#63917

Signed-off-by: Tahir Akram <mtahirbutt@hotmail.com>
2023-10-20 15:13:08 +02:00
Ioannis Karachalios
9f76879a0b drivers: rtc: smartbond: Support RTC peripheral.
Add support for the RTC peripheral.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2023-10-20 15:10:44 +02:00
Nick Kraus
0f50df41f1 drivers: uart_emul: Add Emulated Errors
Allows test code to set UART errors, for driver code wanting
to test proper error handling.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2023-10-20 15:10:27 +02:00
Nick Kraus
aeb85db627 drivers: uart_emul: Add IRQ Based TX
Added an interrupt based transmit routine and interrupt based
uart_emul tests.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2023-10-20 15:10:27 +02:00
Mulin Chao
0d59aa1ab4 sensor: adc_cmp: npcx: use BUILD_ASSERT to check thr-sel value
This CL uses BUILD_ASSERT macro to check whether `thr-sel` is out of
range instead of using NPCX series definitions.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-10-20 15:07:21 +02:00
Mulin Chao
a6496e056b soc: npcx: replace Nuvoton NPCX series definitions in the npcx drivers
Replace Nuvoton NPCX series definitions with new Kconfig definitions in
the npcx drivers. The benefit of this approach is that we won't touch
the npcx driver sources again during introducing a new npcx series next
time.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-10-20 15:07:21 +02:00
Lukasz Hawrylko
5d113be341 drivers: crypto: add support for stm32wb family
STM32WB MCUs have two AES peripherals: AES1 for application use and AES2
dedicated for network stack. This patch modifies stm32 crypto driver to
use AES1 peripheral when building for STM32WB.

Signed-off-by: Lukasz Hawrylko <lukasz@hawrylko.pl>
2023-10-20 15:05:26 +02:00
Andrei Emeltchenko
76c73938e7 drivers: ncp5623: Fix error check
num_colors cannot be not equal to different values at the same time.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-10-20 15:04:46 +02:00
Anas Nashif
85c4703a46 drivers: fake: now just check for CONFIG_ZTEST
Old ztest API is deprecated, so only check for CONFIG_ZTEST.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Adam Wojasinski
97b351fb66 drivers: i2c: i2c_nrfx_twim: Add support for new instances
This patch intoduces new instances in TWIM SHIM for i2c driver.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-10-20 15:04:10 +02:00
Dennis Grijalva
78b4735e07 drivers: led: led_pwm: Fix PM callback error logging
If the underlying PWM device does not have a PM callback,
the PWM LED driver will flood the console with error logs.
The change ignores the error if there is no PM callback
for the PWM device.

Signed-off-by: Dennis Grijalva <dennisgrijalva@meta.com>
2023-10-20 15:03:27 +02:00
Adam Wojasinski
30b8d4ca99 drivers: spi: spi_nrfx_spim: Add new SPIM instances in driver
Add support for new instances.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-10-20 15:03:17 +02:00
Adam Wojasinski
5c1daef5ab drivers: spi: nrfx: Add SPIM Kconfig symbols for new instances
Add support for upcomming SPIM instances.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-10-20 15:03:17 +02:00
Adrian Wojak
5b9a7d0553 drivers/sensor: lis2dw12: add wakeup_duration support
Add wakeup_duration support. (WAKE_DUR in WAKE_UP_DUR)
Value is configurable through DT per instance.

Signed-off-by: Adrian Wojak <adrian.wojak@outlook.com>
2023-10-20 15:02:41 +02:00
Jeppe Odgaard
921104042d drivers: flash: enable MPU_ALLOW_FLASH_WRITE for ARM MPUs
Select MPU_ALLOW_FLASH_WRITE to avoid write test failure for ARM MPUs.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-10-20 15:01:17 +02:00
Daniel DeGrasse
906ee53834 drivers: i2s: i2s_mcux_sai: use clock-mux property to select SAI mux
Use a new property, "clock-mux" to select the clock mux for the SAI.
Previously, the clock mux was being selected using the "bits" specifier
of the "clocks" phandle property, which is not the purpose of this
specifier. This can be shown by the regression introduced by 5bebbb91,
which changed the "bits" field to the clock gate shift (which is the
intended meaning).

This incidently worked for the SAI1 and SAI3 peripherals, as the lower 2
bits of the correct clock source selection (0b10) are the same as the new
value placed in the "bit" specifier. For SAI2, the clock source was
switched to PLL3 PDF0 by this change.

To resolve this, use an explict "clock-mux" property for this selection.

Fixes #63541

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-10-20 15:01:10 +02:00
Jukka Rissanen
c345f59910 drivers: eth: native: Add native-sim support to posix Ethernet driver
This will enable Ethernet driver to be used when compiling
for native-sim board.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-10-20 15:00:41 +02:00
Jukka Rissanen
28bd5423ff drivers: eth: native: Remove automatic start script support
As the automatic start requires that the zephyr exe is run as
a root user, it is somewhat cumbersome to use. Remove the script
support and require that the zeth device is created beforehand
by the net-setup.sh script found in net-tools zephyr project.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-10-20 15:00:41 +02:00
Florian Grandel
e9d5a98e9d drivers: ieee802154: improve CSL standard conformance
This change slightly simplifies the configuration of a CSL receiver and
generalized CSL_RX_TIME to EXPECTED_RX_TIME as a re-usable primitive
across several timing-sensitive IEEE 802.15.4 standard sub-protocols
(namely BE-PANs/DSME/CSL/RIT/TSCH).

This API change is based on the rules outlined in RFC #61227.

Fixes: #62918

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-20 14:58:32 +02:00
Florian Grandel
80da9ddfef drivers: ieee802154: improve ACK header IE config
Improves standard conformance of the IEEE802154_CONFIG_ENH_ACK_HEADER_IE
option and introduces certain "soft MAC" capabilities around header IEs:
 * Introduces types and helpers that allow driver maintainers to
   represent, parse, write and validate header IEs.
 * Introduces helper functions to access non-aligned fields in header
   IEs, namely element IDs.

Updates the only existing L2 and driver pair that uses
IEEE802154_CONFIG_ENH_ACK_HEADER_IE: OpenThread platform radio and nRF5
and improves header IE validation in the nRF5 driver.

This change should help further driver maintainers to support
OpenThread's CSL and vendor IE extensions. It is based on the rules
specified in RFC #61227.

It is also a precondition to generically support both, "soft MAC" and
"hard MAC", approaches to header IEs in the TSCH protocol, namely the
time synchronization IE.

Fixes: #62940

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-20 14:58:23 +02:00
Florian Grandel
62396443fc drivers: ieee802154: deprecate OT "sleep" nomenclature
"Sleeping" has a well defined meaning in Zephyr related to threading and
power management. This differs from OpenThread's definition:

- Deprecates the "SLEEP_TO_TX" capability as it is redundant and
  conflicts with all of Zephyr's nomenclature, #61227, RFC 2863, Thread
  standard and IEEE 802.15.4. This binds the API to an implementation
  detail of OpenThread, instead. See #63670 for the agreed migration path.

- Renames the "SLEEP" event to "RX_OFF" which conforms to the
  nomenclature in Zephyr, this API and IEEE 802.15.4.

Fixes: #62995

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-20 14:58:16 +02:00
Michał Barnaś
5246cea800 usbc: improve error handling in the ucpd_stm32 and vbus_adc
As noted in PR#63165 checking of result should use comparison to
success value instead of checking if result is negative. It will
allow to check if function returned invalid but positive value.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-10-20 14:57:32 +02:00
Michał Barnaś
fe0b6af337 usbc: merge the is_rx and get_rx_pending_msg functions
These two functions are used together so there is no need for
splitting them into two functions. This commit also makes this
function required to be implemented by the TCPC driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-10-20 14:57:32 +02:00
Michał Barnaś
88b6fc62d5 usbc: change type for functions that may return error code
TCPC API functions should be able to inform the caller if the function
is supported and successfully executed. Bool values doesn't allow this
so it is needed to change the type to int.
For is_rx_pending_msg function the return code should conform to
existing error codes, so in case of function being not supported,
the -ENOSYS should be returned. In case of successful execution,
if there is no pending message, the -ENODATA should be returned and
in case of message pending, the value of 0.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-10-20 14:57:32 +02:00
Michał Barnaś
2e3fcbfaa4 usbc: add "chip" subcommand for "tcpc" shell command
Add "chip" subcommand that displays the vendor, product and device
identifiers for all TCPC referenced by USB-C connectors.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-10-20 14:57:12 +02:00
Michał Barnaś
8270d0495d usbc: add "vbus" subcommand for "tcpc" shell command
Add "vbus" subcommand that displays VBUS voltages for all USB-C
connectors.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-10-20 14:57:12 +02:00
Michał Barnaś
24d152ace3 usbc: add "tcpc" shell command
Add "tcpc" shell command with "dump" subcommand used to dump
all registers of all the TCPCs.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-10-20 14:57:12 +02:00
Tim Lin
0bb77191c0 drivers/serial: ns16550: Add high speed baud rate support for IT8XXX2
Add the support of high speed baud rate 230.4k and 460.8k
for IT8XXX2 of ITE.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-10-20 14:56:06 +02:00
Ye Weize
2a86016aff drivers: spi: Add Intel SEDI driver
Add a new SPI shim driver for Intel SoCs. Builds upon the SEDI bare
metal SPI driver in the hal-intel module.

Co-Authored-By: Kong Li <li.kong@intel.com>
Signed-off-by: Ye Weize <weize.ye@intel.com>
2023-10-20 14:55:49 +02:00
Peter Ujfalusi
97bb67d66c drivers: intel: ssp: Revise receive FIFO draining
The receive FIFO needs to be drained in a different way depending when it
is done.
- before start
If the RX FIFO is in overflow state then we must read all the entries out
to empty it (it was after all full).

- before stop
The DMA might be already running to read out data. Check the FIFO level
change in one sample time which gives us the needed information to decide
to wait for another loop for the DMA burst to finish, wait for the DMA to
start it's burst (DMA request was asserted) or drain the FIFO directly.

No need to drain the RX fifo at probe time.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2023-10-20 14:55:43 +02:00
Peter Ujfalusi
d75127caa4 drivers: intel: ssp: Correct FIFO depth value for CAVS25 platforms
The actual FIFO depth in Tiger Lake platforms is 32 and not 16.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2023-10-20 14:55:43 +02:00
Ricardo Rivera-Matos
fd06cd7c97 drivers: charger: Introduces BQ24190 support
Adds support for the BQ24190 family of charging ICs.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2023-10-20 14:55:22 +02:00
TOKITA Hiroshi
90bd7863c7 drivers: spi: pl022: correcting error check condition
Only negative return values of pinctrl_apply_state are errors.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-10-20 14:55:03 +02:00
Daniel DeGrasse
9a63f39cd8 drivers: memc: update interface of memc flexspi driver for multi device
Update interface of memc flexspi driver to better handle multiple
devices. Previously, using multiple devices on one FlexSPI bus would
require the user to configure each device to install its command table
(referred to as a LUT table by the driver) at an offset, so that it did
not overlap with other devices on the bus.

This commit changes the interface of the memc flexspi driver to instead
configure the LUT and flash device in one call. This allows the memc
driver to record the port each LUT sequence is used with, so that
future FlexSPI transfer requests can have their LUT offsets adjusted
based on the target port (which will correspond to a target device)

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-10-20 14:53:10 +02:00
Daniel DeGrasse
f9b7f8c96d drivers: memc: memc_mcux_flexspi.c: update XIP state check
Check XIP state based on the value of CONFIG_FLASH_BASE_ADDRESS. This
check should be more reliable than the SOC based method currently
used.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-10-20 14:53:10 +02:00
Roland Lezuo
e7799eb551 drivers: flash: Add RDP (readout protection) support for STM32L4x flash
Add support for Flash readout protection on the STM32L4x series

Signed-off-by: Roland Lezuo <roland.lezuo@embedded-solutions.at>
2023-10-20 14:52:46 +02:00
Paweł Anikiel
2f7cb40dd2 drivers: sensor: Add driver for SB-TSI
Add a driver for the SB Temperature Sensor Interface. This is an I2C
temperature sensor on AMD SoCs.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
2023-10-20 14:51:59 +02:00
Daniel Evans
debc65fa63 drivers: flash: atmel SAM0 fix flash_write to handle smaller length.
Fix flash_sam0_write to handle byte lengths smaller than FLASH_PAGE_SIZE

Signed-off-by: Daniel Evans <photonthunder@gmail.com>
2023-10-20 14:51:17 +02:00
Kevin Wang
d3a73cdb0e drivers: dma: Add Andestech atcdmac300 driver.
Support the Andes atcdmac300 dma driver.

Signed-off-by: Kevin Wang <kevinwang821020@google.com>
2023-10-20 14:51:08 +02:00
Florian Grandel
f3cbd27e5a drivers: ieee802154: cc13xx_cc26xx_subg: buflen sanity check
Introduces a (currently redundant) buffer length sanity check to prepare
for L2s that support PHYs with PHY payloads > 127 bytes.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-17 19:15:56 +03:00
Florian Grandel
0269170420 drivers: ieee802154: b91: buflen sanity check
Introduces a (currently redundant) buffer length sanity check to prepare
for L2s that support PHYs with PHY payloads > 127 bytes.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-17 19:15:56 +03:00
Nando Galliard
b9748b5377 drivers: serial: Support STM32 LPUART if LPUART1 is not defined.
When LPUART1 is not defined, the driver did not compile even if
any other LPUART was defined. This patch fixes that.

Signed-off-by: Nando Galliard <nando.galliard@protonmail.com>
2023-10-17 14:30:38 +01:00
Emilio Benavente
17032a093d drivers: spi: spi_mcux_lpspi: Updated the Async api
Updated the Async API allowing the code path
for DMA while Async is enabled. Added common
DMA function that sets up both tx and rx dma
channels.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2023-10-14 10:55:02 +03:00
Martin Calsyn
12c0204b60 drivers: fuel_gauge: max17048: Fix overflow when calculating voltage
Annotate the calculation with type casts to force
promotion to uint32_t and then cast back down
to uint16_t for the return. This solves the issue
with invalid voltage (mV) values being returned
due to overflow during the conversion from the
register value on the max17048 chip.

Signed-off-by: Martin Calsyn <martin.calsyn@outcomex.com.au>
2023-10-13 19:07:38 +01:00
Andrei Emeltchenko
d661c86e35 drivers: modem_cellular: Fix missing break
There is no fallthrough statement or comment so I assume break is
missing.

Fixes build time warning from some tools.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-10-13 17:42:40 +03:00
Declan Snyder
7d5d4ed907 drivers: eth_mcux: cache must be dcache
Currently the Kconfig for eth_mcux selects nocache if
HAS_MCUX_CACHE is set. But, for platforms that have a flexspi
cache but not a CPU cache, this is invalid, so clarify this
in the Kconfig definition.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-10-13 10:06:33 +01:00
Erwan Gouriou
179d435a30 Revert "drivers: serial: stm32: Make it compatible with runtime PM ....
This reverts commit 1c2d326579.
which was limited to CONFIG_UART_ASYNC_API=y case and causing regression
otherwise.

Fixes #63885

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-10-13 10:06:04 +01:00
Henrik Brix Andersen
b9675b05d3 drivers: can: mcux: flexcan: override maximum HAL wait loop iterations
Add option for overriding the maximum number of wait loop iterations for
entering/leaving freeze mode. Set the default to 10000 (as opposed to a
default of 1000 used in the HAL).

Fixes: #56171

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-13 10:04:57 +01:00
Dmytro Semenets
d912be1c51 drivers/i2c: remove unnecessary includes
i2c_rcar.c includes soc.h header which doesn't need for this source
and exists not for all boards. soc.h header doesn't exist for rcar-gen3
soc based on arm64 core.
soc.h consists soc-depended defenitions and need to be included
by soc-depended sources.

Signed-off-by: Dmytro Semenets <dmytro_semenets@epam.com>
2023-10-13 09:46:34 +01:00
Henrik Brix Andersen
e6197fed5f drivers: can: stm32: bxcan: only copy frame data for non-RTR frames
Only copy frame data for non-RTR frames as RTR frames do not carry any
data.

Fixes: #57002

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-13 10:08:45 +03:00
Henrik Brix Andersen
cb207c4a11 drivers: can: sja1000: only copy frame data for non-RTR frames
Only copy frame data for non-RTR frames as RTR frames do not carry any
data.

Fixes: #57002

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-13 10:08:45 +03:00
Henrik Brix Andersen
bb4a22fdbc drivers: can: rcar: only copy frame data for non-RTR frames
Only copy frame data for non-RTR frames as RTR frames do not carry any
data.

Fixes: #57002

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-13 10:08:45 +03:00
Henrik Brix Andersen
443847f0f6 drivers: can: nxp: s32: only copy frame data for non-RTR frames
Only copy frame data for non-RTR frames as RTR frames do not carry any
data.

Fixes: #57002

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-13 10:08:45 +03:00
Henrik Brix Andersen
c986dcc027 drivers: can: mcux: flexcan: only copy frame data for non-RTR frames
Only copy frame data for non-RTR frames as RTR frames do not carry any
data. The limitation of how much data to copy is currently handled in the
NXP HAL.

Fixes: #57002

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-13 10:08:45 +03:00
Henrik Brix Andersen
66daf05435 drivers: can: mcp251xfd: only copy frame data for non-RTR frames
Only copy frame data for non-RTR frames as RTR frames do not carry any
data.

Fixes: #57002

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-13 10:08:45 +03:00
Henrik Brix Andersen
4d321448ad drivers: can: mcp2515: only copy frame data for non-RTR frames
Only copy frame data for non-RTR frames as RTR frames do not carry any
data. Limit the amount of data copied to the actual DLC.

Fixes: #57002

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-13 10:08:45 +03:00
Henrik Brix Andersen
27323a8af5 drivers: can: mcan: only copy frame data for non-RTR frames
Only copy frame data for non-RTR frames as RTR frames do not carry any
data.

Fixes: #57002

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-13 10:08:45 +03:00
Peter Mitsis
52f343c5c7 drivers: usb: Replace k_mem_block usage
The k_mem_block structure has been obsolete for some years with
a few loose ends still remaining. As its usage in the usb_dc_mcux
codebase was confined to needing its "void *" pointer field, it
was simple to enough to hoist that field to remove another loose end.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-10-13 09:56:02 +03:00
Peter Ujfalusi
8dfa116750 drivers: dma: intel-adsp-hda: Correct DGCS:SCS bit for 32bit sample size
If the channel was used for 16bit in the once, subsequent 32bit sample size
audio will be broken since the SCS bit remains set.

Example sequence with SOF:
normal audio playback with 16bit
ChainDMA audio playback with 16bit
normal audio playback with 16bit

The last playback results garbled audio.

Introduce intel_adsp_hda_set_sample_container_size() helper function
to handle the SCS bit and use it in the driver.


Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2023-10-12 17:31:23 +03:00
Nazar Palamar
4d76e26f17 drivers: pinctrl: Update Infineon CAT1 pinctrl driver
- if we have input enable use CY_GPIO_DM_xxxx else
CY_GPIO_DM_xxx_IN_OFF;

- added bias_high_impedance option

- Updated HIGHZ drive mode, now it sets if:
--- we have bias_high_impedance
--- or if input_enable and no addition bias mode

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-10-12 15:17:35 +03:00
Keith Packard
8be25e284a drivers/fdc2x1x: Depend on full C library, not just newlib
This driver uses the math library, so it cannot use the minimal C
library. However, it should be fine with any complete C library, not just
newlib.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-10-12 13:00:39 +01:00
Daniel Leung
04a0cf7d79 kernel: deprecate K_THREAD_STACK_MEMBER
The macro K_THREAD_STACK_MEMBER has actually been deprecated
since v2.4.0 in the macro doxygen description, but it was
never marked with __DEPRECATED_MACRO. Since this was being
used in various drivers, make it follow the deprecation
process.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-10-12 11:07:00 +01:00
Bjarki Arge Andreasen
0339f2d41f modem: modem_cellular: Adjust chat scripts
This commit adjust the chat scripts for the simcom
sim7080 and gsm_ppp compatibles to fix an issue found
when trying to use a sim7080 modem. The CMUX command
includes optional parameters which are not identical
for all modems, so the AT+CMUX command has been adjusted
to only contain the mandatory parameters.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-10-11 18:57:11 +03:00
Manuel Argüelles
a034cce23c gpio: nxp_s32: support passing external interrupts to WKPU
Extend the NXP S32 GPIO driver to be able to route external interrupts
to either SIUL2 EIRQ interrupt controller or, when available on the
SoC, WKPU interrupt controller.

Since WKPU can support up to 64 external interrupt sources and SIUL2
EIRQ up to 32, gpio_get_pending_int() is removed and the interrupt
controller specific API must be used instead.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-11 16:38:34 +01:00
Manuel Argüelles
ea08227dd0 gpio: nxp_s32: prepare to support multiple interrupt controllers
Refactor external interrupts infrastructure to prepare supporting
multiple interrupt controllers.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-11 16:38:34 +01:00
Manuel Argüelles
c8a5cf6728 intc: add NXP S32 WKPU interrupt controller driver
Introduce an interrupt controller for the NXP S32 WKPU peripheral
that can be integrated with GPIO to trigger interrupts through
external interrupt pad inputs.

WKPU can trigger interrupts from certain input pads that support this
function, as well as wake-up events to the power management domain. This
patch only adds WKPU functionality as an interrupt controller to extend
the number of input pads that can interrupt the core. Power management
functionalities are not supported.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-10-11 16:38:34 +01:00
Cyril Fougeray
49126e2aa9 sensors: vl53l1: fix compilation without xshut or interrupt pin
Fix compilation when CONFIG_VL53L1X_INTERRUPT_MODE=n or
CONFIG_VL53L1X_XSHUT=n

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-10-11 14:58:15 +01:00
Tomasz Moń
6b8b49c64a drivers: i2s_nrfx: Fix write race condition
There is inherent race condition between i2s_nrfx_write() and I2S
interrupt handler because I2S operates independently from the rest
of the system. If software takes too long to supply next TX pointer
then nRF I2S peripheral will simply resupply the previous buffer.

The race window is rather short. The failed race executes as follows:
  1. i2s_nrfx_write() checks state and loads next_tx_buffer_needed
  2. I2S interrupt handler executes and calls data_handler() which
     notices empty TX queue and therefore sets next_tx_buffer_needed
  3. i2s_nrfx_write() continues with the queue TX path (because the
     next_tx_buffer_needed was false when it was accessed)

If next i2s_nrfx_write() executes before next I2S interrupt:
  4a. i2s_nrfx_write() notices next_tx_buffer_needed is true and
      supplies the buffer directly to I2S peripheral. Previously queued
      buffer will remain in the queue until the just supplied buffer
      starts transmitting. Effectively swapping whole I2S block leads to
      clearly audible artifacts under normal circumstances.

If next I2S interrupt executes before next i2s_nrfx_write():
  4b. data_handler() notices that buffer was reused and stops despite
      having a buffer available in TX queue

Modify i2s_nrfx_write() to always queue the TX pointer first and only
supply the buffer to nrfx if the queue was empty when interrupt handler
executed. This prevents both the out-of-order TX and premature stop.

Fixes: #63730

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-10-11 15:36:15 +02:00
Rihards Skuja
153c418787 pinctrl: gecko: fix broken UART when SPI is enabled on Series 2
When SPI is enabled, pinctrl driver configures all the pins in UART pinctrl
config as gpioModeDisabled.

Signed-off-by: Rihards Skuja <rihards@skuja.eu>
2023-10-11 11:18:08 +01:00
Francois Ramu
1204b18aa3 drivers: sensor: stm32 vref sensor depends on ADC
Set the CONFIG_STM32_VREF depending on the ADC,
like the CONFIG_STM32_VBAT does

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-10-11 11:17:51 +01:00
Erwan Gouriou
1c2d326579 drivers: serial: stm32: Make it compatible with runtime PM on console
Since #53979, runtime PM can be applied on serial device used by console.
While it should be transparent on serial driver side as the application
(console in this case) is driving the PM runtime requests, on STM32
it requires some modification on serial driver as UART interrupts are
generated to handle internal power management house cleaning.
When these interrupts are generated, PM runtime should also be driven
to ensure clock availability when treating the uart ISR.
On STM32, some additional changes are required

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-10-11 11:12:03 +03:00
Stefan Petersen
416dde7dd1 drivers: ethernet: eth_stm32_hal.c Fix mixup of DMA error and MAC error
There seems to be a copy-paste error where GetDMAError() et al is used
twice. The comment states that it is actually getMACError() et al that
should be used in the second instance.

Signed-off-by: Stefan Petersen <spe@ciellt.se>
2023-10-10 15:26:52 +02:00
Andrej Butok
86d606ba2d flash: nxp: fix lpc55s36 flash read
Add additional check if page is erased,
to avoid a possible fault exception.
Fixes #63087

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2023-10-10 15:26:18 +02:00
Jukka Rissanen
493fe169a8 drivers: eswifi: Fix the SSID copying
The wrong ssid_len was used which causes build error.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-10-10 15:50:22 +03:00
Emil Lindqvist
97d608b98f display: stm32: fix bug where missing backlight pin causes crash
When backlight pin is not defined, a display suspend will cause
a crash since it looks at the wrong pin when deciding if
it exists.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2023-10-10 15:16:59 +03:00
Flavio Ceolin
e7bd10ae71 random: Rename random header
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.

Rename it to random.h and get consistently with other
subsystems.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 14:23:50 +03:00
Flavio Ceolin
ea109f6a20 drivers: eswifi: shell: Fix possible overflow
Limit the copied data to the buffer's size.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 11:41:49 +02:00
Flavio Ceolin
2504329b76 drivers: eswifi: Fix possible buffer overflow
Limit the number of the copied ssid to WIFI_SSID_MAX_LEN
and avoid a possible one byte overflow.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 11:41:49 +02:00
Daniel DeGrasse
daf6de7b99 drivers: flash: flexspi_mx25um513: enforce write size limit in DTR mode
Per the MX25UM51325G datasheet, all page programs in OPI DTR mode need to
start at an even address, and be of even length. Update the minimum
write size reported by the driver and check all writes when OPI DTR mode
is enabled, so that subsystems using the flash driver can align to this
requirement.

Fixes #63639

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-10-10 11:18:57 +02:00
Henrik Brix Andersen
fc078f9d02 drivers: can: sja1000: do not attempt to sleep in IRQ context
The can_sja1000_handle_error_warning_irq() function should only attempt to
start bus-off recovery, but not wait for the result.

Fixes: #63712

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-09 23:54:47 +03:00
Aleksander Wasaznik
f187d1bdf4 Bluetooth: drivers/rpmsg: Ensure coop prio bt_recv
Ensure that the Bluetooth rpmsg driver thread is temporarly in
cooperative mode using `k_sched_lock`.

The previous commit added the documentation on `bt_recv` stemming from
the general consensus among maintainers that `bt_recv` may not be called
from preemptible priorites.

Many uses may be affected by this race condition, since the default
configuration of rpmsg driver selects a preemtible priority.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-10-09 19:03:59 +03:00
Aaron Massey
32b27384a6 fuel_gauge: Fix desired current/voltage units
The desired current/voltage properties make use of milliamps/volts while
the present current/voltage properties make use of microamps/volts.

Fix the desired current/voltage properties to be consistent with the
present current/voltage properties where they're most likely to be used
with.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-10-09 19:01:49 +03:00
Fabio Baltieri
d53b1a1c0e sensors: default_rtio_sensor: fix build warning
Fix a build warning on 64 bit architectures:

zephyr/drivers/sensor/default_rtio_sensor.c:238:17: error: format '%zu'
expects argument of type 'size_t', but argument 2 has type 'uint32_t'
{aka 'unsigned int'}

num_channels type changed to uint32_t in 96175fcc47.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-09 10:48:55 +01:00
Stephan Linz
e7f399f4a3 drivers: can: avoid integer overflow in expression
Change the integer arithmetic to divide first before multiply.

The muliplication of sys_clock_hw_cycles_per_sec() by ten leads
to a really big number on boards with high-speed clocking, thus
to the overflow warning, and to errors for integration tests.

Fixes: #63678

Signed-off-by: Stephan Linz <linz@li-pro.net>
2023-10-09 10:39:43 +01:00
Flavio Ceolin
39068456c4 entropy: sam: Remove unused parameter
Do not propagate unused parameter. ISR callback is already handling
the given flags, there is not need to propagate it through internal
calls.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Flavio Ceolin
78af988546 entropy: sam: Fix get_entropy() behavior
entropy_get_entropy blocks if required to generate the necessary
random data.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Flavio Ceolin
1dcaf4637e entropy: fake_entropy: Fix return value in isr callback
get_entropy_isr() has to return the number of bytes copied or
a negative value in case of error.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Flavio Ceolin
58b0c8f4b7 entropy: neorv32: Return ENODATA on error
Return -ENODATA in neorv32_trng_get_entropy_isr when
there is no data available. This is consistent with other
drivers.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Flavio Ceolin
5133ac8af4 entropy: b91_trng: Fix callback return
get_entropy_isr() has to return the number of bytes copied or a negative
value for error. Since this driver is assuming that it will always
(????) get the number of requested bytes, change the function to return it
instead of 0.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Flavio Ceolin
ff074551b0 entropy: gecko_se: Remove unnecessary callback
get_entropy_isr is not implemented, just remove it and let the
driver interface handle it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-09 10:16:19 +02:00
Kai Meinhard
06f35916e1 i2c: silabs: Fix I2C target crash on long ISR execution
Long I2C target callback functions could lead to an unresponsive
I2C peripheral. This commit ports the official ISR implementation
from Silicon labs to Zephyr:
https://github.com/SiliconLabs/peripheral_examples/blob/master/series2/i2c/i2c_follower/src/main.c

Signed-off-by: Kai Meinhard <meinhard@gessler.de>
2023-10-09 10:15:37 +02:00
Daniel DeGrasse
a6adaedd51 drivers: i2s: mcux_sai: fix PCM data format and respect CLK format
This commit fixes the following issues with the PCM data format output
by the MCUX SAI driver:

- WS signal should be only one clock cycle in length for short PCM
  format
- Word count should not be fixed to 2, except for classic I2S format
- BCLK polarity should be on falling edge for PCM long and short format

Additionally, the I2S_FMT_CLK_ constants now flip the frame and bit
clock polarity from the normal value expected for the selected I2S
format, as expected by the API.

Fixes #63041

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-10-08 11:25:24 +01:00
Thomas Chiantia
4ebc963ed5 drivers: eth: gmac: Fixed ethernet startup when fixed-link
When upgrading to version 3.4, our hardware lost ethernet connectivity.
Our hardware assumes a fixed link and does not communicate with the
underlying phy via the mdio bus.

I confirmed that the atsame54_xpro board also will lose ethernet
functionality when the atsame54_xpro configures the phy via to use a
fixed link...

The eth_sam_gmac driver changed the initialization behavior to call
net_if_carrier_off and notes to wait until phy link is up (via
callback.)  However, when in a fixed link configuration, the callback is
never called. So the net_if_carrier_on event never occurs.

This patch adds a check to see if link is up already before calling
net_if_carrior_off. This check works because in fixed-link mode, link-up
is set synchronously during phy driver initialization.

I tested that atsame54_xpro with fixed-link configuration will now work
after this patch.

Signed-off-by: Thomas Chiantia <thomas.chiantia@gmail.com>
2023-10-08 11:16:39 +01:00
Henrik Brix Andersen
410c02ac57 drivers: can: sja1000: remove excessive debug logging
Remove excessive debug logging from the SJA1000 driver backend. Logging
each register access makes generic CAN debug logging unusable.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-06 17:43:36 +03:00
Yuval Peress
96175fcc47 sensors: Fix alignment issues
Add padding to the header and remove unnecessary memset in order to fix
alignment faults in cores such as M0 or ones that support
CONFIG_TRAP_UNALIGNED_ACCESS

Signed-off-by: Yuval Peress <peress@google.com>
2023-10-06 14:54:37 +01:00
Carles Cufi
c0a349eac4 drivers: bluetooth: rpmsg: Send reset only when the Host is included
The rpmsg_close() call uses the HCI reset command to reset the
controller. But when building as controller-only we do not bring in the
infrastructure to send HCI commands (nor should we) and rpmsg_close()
will not be called anyway.

Fixes #63534.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-10-06 16:18:58 +03:00
Abram Early
6e789e7492 drivers: can: mcan: Move RF0L and RF1L to line 1
The code is designed to handle RF0L and RF1L in
line 1, but they were being sent to line 0. Becuase
they weren't handled, the interrupts would never
be handled which locked up the chip.

Signed-off-by: Abram Early <abram.early@gmail.com>
2023-10-06 16:14:03 +03:00
Tomasz Moń
dbb4e8aa9d drivers: usb_dc_nrfx: Isochronous endpoint cannot be bulk
Prevent use of isochronous endpoints as bulk and/or interrupt endpoint.
The issue was observed when trying to use 4 CDC ACM instances where the
4th instance would claim the isochronous IN endpoint 0x88 to be bulk.
Because the isochronous endpoints cannot respond with handshake packet
the iso endpoints cannot be used as bulk or interrupt substitue.

Properly fail endpoint check and therefore make 4 CDC ACM instances not
enumerate at all because the hardware has endpoints that only allows up
to 3 CDC ACM instances.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-10-06 14:50:10 +02:00
Steve Jacot-Guillarmod
13d74677ba drivers: led: pca9633: disable allcall
The PCA9633 i2c LED controller offers an All Call address in its nominal
operation, allowing simultaneous communication with all instances present
on the same i2c bus. The default address is 0x70. While this functionality
is convenient, it is possible that the board uses another i2c component
that also uses this address (for example, the shtcx). In such cases, the
address conflict prevents the proper functioning of the system.

The idea is to add a "disable-allcall" property to the device tree. If this
option is present, the initialization of the PCA9633 forces the bit 0
(ALLCALL) to be set to false, thereby disabling this function. It is
necessary to add this property to all PCA9633 devices on the bus to free up
the address 0x70.

Signed-off-by: Steve Jacot-Guillarmod <steve@piziwate.net>
2023-10-06 12:24:23 +01:00
Carles Cufi
a5e7ba3564 Bluetooth: Controller: Remove legacy BT_CTLR_FAST_ENC option
When the legacy LLCP implementation was removed this Kconfig option was
mistakenly left over. Remove it now with all its users.

Fixes #63212.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-10-06 13:32:33 +03:00
Najumon B.A
e89b005368 drivers: pcie: add config for enable PRT
add config support for enable IRQ information retrieve via
ACPI PRT (PCI Routing Table)

Signed-off-by: Najumon B.A <najumon.ba@intel.com>
2023-10-06 10:40:14 +02:00
Grant Ramsay
236318332b drivers: systick: Fix Cortex-M SysTick dropping 1 cycle per tick
`last_load` is the full N cycles and `SysTick->LOAD` should
be loaded with `last_load - 1` for the calculations work
correctly.

Note: This only affects a kernel in ticked operation.
Tickless kernels periodically restart the timer correctly.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-10-05 15:30:20 +01:00
Grant Ramsay
e032f9520d drivers: systick: Fix Cortex-M systick jumping forward and back again
The existing implementation did not properly
handle when `SysTick->VAL` is zero.

This caused three subtle edge cases:
* val1=0,COUNTFLAG=0,val2=0
  This should result in no cycles elapsed,
  however `(last_load - val2) = last_load`.
  So an extra `last_load` cycles was returned.
* val1=0,COUNTFLAG=0,val2=(last_load-1)
  This should result in 1 cycle elapsed,
  however `val1 < val2` so an extra `last_load`
  cycles was returned.
* val1=[2,1,0],COUNTFLAG=1,val2=0
  This should result in `last_load` cycles elapsed.
  However, `last_load * 2` cycles was returned.

To fix the calculation, val1 and val2 are first
wrapped/realigned from [0:last_load-1] to [1:last_load].

Tidy comments to better reflect the SysTick
behaviour and link reference manuals.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-10-05 15:30:20 +01:00
Andrzej Głąbek
38470a4231 drivers: pwm_nrfx: Connect IRQ handlers for anomaly 109 workaround
The workaround for the nRF52 anomaly 109 that is implemented in
the nrfx_pwm driver uses interrupts generated by a selected EGU
instance and by the enabled PWM instances (even if the interrupts
are not used in generation of the PWM output signals).
Add required IRQ_CONNECT calls so that those interrupts are
properly handled.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-10-05 12:48:29 +01:00
Florian Grandel
4b0e730fb1 drivers: ieee802154: cc13xx_cc26xx_subg: check radio op status
Not only the return code of TI's RF command queueing mechanism but also
the command status need to be checked to assert that a command was
executed successfully. This change introduces additional checking of the
command status.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel
f2979edd5c drivers: ieee802154: cc13xx_cc26xx_subg: fix initial CMD_FS
The frequency synchronization command requires a proper frequency to be
set in order to be successfully executed. The command not being executed
leads to unnecessary internal error handling wrt command scheduling.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel
0c1c443fc6 drivers: ieee802154: cc13xx_cc26xx_subg: improve readability
Moves the RX callback closer to where it's actually being used also
removing the necessity to declare a function prototype.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel
fce4788415 drivers: ieee802154: cc13xx_cc26xx_subg: fix oper. state
The driver API now distinguishes between operational UP/DOWN states as
required by Zephyr's network API and receiver on/off states as an
internal driver state for improved standard conformance.

This change closes the gap between the driver API requirements and the
implementation in this respect.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel
016d3bed5c drivers: ieee802154: cc13xx_cc26xx_subg: improve locking
Replaces the mutex by a semaphore for ISR readiness as requested by the
driver API specification.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel
26a0ef15c4 drivers: ieee802154: cc13xx_cc26xx_subg: check for RX up
Checks whether the receiver is already on before trying to switch it on.
This also closes a gap wrt the driver API specification.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel
35cfe00e91 drivers: ieee802154: cc13xx_cc26xx_subg: remove redundant code
Removes redunant reset statements that update immutable data.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel
128354ae17 drivers: ieee802154: cc13xx_cc26xx_subg: simplify static funcs
Restructuring and renaming of driver-internal functions for improved
readability and maintainability:
- distinguish between externally exposed API methods
  (cc13xx_cc26xx_sub_* prefix) and internal helper methods
  (drv_* prefix).
- extract a few functions to reduce complexity and improve re-use

Also removes unnecessary initial runtime blanking of static (.bss) data
in the newly introduced extracted buffer initialization functions.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Florian Grandel
c81c38114a drivers: ieee802154: cc13xx_cc26xx_subg: minor cleanup
Cleans up includes and a few other minor non-functional errors in the
CC13/26xx driver.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-05 12:01:29 +03:00
Jun Lin
db8855aaa3 driver: crypto: SHA: npcx: change to support npcx4
The pre-alloacted size of the buffer for the SHA ROM API code increases
in npcx4 chip. This commit adds a new property context-buffer-size to
sha0 DT node in npcx9 and npcx4 separately. The driver can pre-allocate
buffer with the correct size based on the property.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-10-05 09:14:05 +01:00
Mario Jaun
01bdd845db drivers: i2c: stm32: disable reload mode at the end of a transfer
Fixes an issue that reload mode is not disabled in case of an error.
From this case the driver could not recover because in msg_init()
no new transfer could be initialized.

Signed-off-by: Mario Jaun <mario.jaun@gmail.com>
2023-10-04 20:25:20 +02:00
Daniel DeGrasse
d487794dd6 drivers: i2s: i2s_mcux_sai: fix logging statements for k_mem_slab
Since 2f003e59 reworked the structure of k_mem_slab information fields,
we need to update the logging statements in the i2s_mcux_sai driver to
access these fields correctly.

Fixes #63527

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-10-04 20:25:09 +02:00
Fabio Baltieri
6f0a5961e3 drivers: i2c: i2c_nrfx_twim: fail gracefully on dma max size
Different nRF52 devices have different maximum TWI DMA transfer size,
and it's easy to hit the limit with i2c displays on nrf52832 (8 bit) and
nrf52810 (10 bit). Currently neither the driver or the hal validate the
limit, leading to random NACK errors when trying to transfer more data.

Add a check on the driver to fail gracefully when going over the limit.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-10-04 16:17:15 +01:00
Yong Cong Sin
39433f0669 drivers: intc: plic: define all registers' offset in the driver
Define all the register offset directly in the driver according
to the RISCV PLIC specification as they are not configurable,
see: https://github.com/riscv/riscv-plic-spec.

Updated devicetrees that has PLIC accordingly.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-04 09:06:28 -04:00
Yong Cong Sin
8db1a5add2 drivers: intc: plic: support trigger type by default and hardcode offset
Removing the edge-trigger Kconfig as it is supported by default
in the RISCV PLIC specifications.

Define the edge-trigger register offset in the driver instead
of retrieving the value from devicetree as it is not something
configurable. The value 0x1080 is defined in Andes & Telink
datasheets.

Updated build_all testcase.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-04 09:06:28 -04:00
Benjamin Cabé
ba1af3f36b sensors: mpu6050: add missing break statement
Add missing break statement so that SENSOR_CHAN_DIE_TEMP is properly
supported.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-10-04 10:07:43 +02:00
Christopher Friedt
99ab1ab06c drivers: serial: uart_emul: make api implementation static
Keep uart API implementation of the uart_emul driver "private"
by adding the static keyword.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-10-03 14:58:19 -04:00
Christopher Friedt
9d79728c48 drivers: serial: uart_emul: support interrupt-driven receive
Previously, the uart_emul device did not support interrupt-driven
receive, which is an unwritten requirement for hooking up a uart to
the Zephyr console driver.

The console is a fairly high-traffic subsystem, and we should be able
to perform more extensive testing on it, aside from maching twister
output against a regular expression. With this change, we can use
the emulation uart within the body of a ZTest.

Testing Done:
```shell
west build -p auto -b qemu_riscv64 -t run tests/drivers/console_switching
...
*** Booting Zephyr OS build zephyr-v3.4.0-4277-gae0d63471be1 ***
Running TESTSUITE console_switching
===================================================================
START - test_read
read "Hello, uart_emul0!" from uart_emul0
read "Hello, uart_emul1!" from uart_emul1
read "Hello, uart_emul0!" from uart_emul0
read "Hello, uart_emul1!" from uart_emul1
 PASS - test_read in 0.005 seconds
===================================================================
START - test_write
wrote "Hello, uart_emul0!" to uart_emul0
wrote "Hello, uart_emul1!" to uart_emul1
wrote "Hello, uart_emul0!" to uart_emul0
wrote "Hello, uart_emul1!" to uart_emul1
 PASS - test_write in 0.003 seconds
===================================================================
TESTSUITE console_switching succeeded

------ TESTSUITE SUMMARY START ------

SUITE PASS - 100.00% [console_switching]: pass = 2, fail = 0, skip = 0...
 - PASS - [console_switching.test_read] duration = 0.005 seconds
 - PASS - [console_switching.test_write] duration = 0.003 seconds

------ TESTSUITE SUMMARY END ------

===================================================================
PROJECT EXECUTION SUCCESSFUL
```

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-10-03 14:58:19 -04:00
Henrik Brix Andersen
f91bfae0a7 drivers: can: mcux: flexcan: validate initial timing parameters
Validate the initial timing parameters set via devicetree.

Fixes: #61909

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-03 18:16:46 +01:00
Flavio Ceolin
15aa3acaf6 kconfig: Remove MP_NUM_CPUS usage
Zephyr's code base uses MP_MAX_NUM_CPUS to
know how many cores exists in the target. It is
also expected that both symbols MP_MAX_NUM_CPUS
and MP_NUM_CPUS have the same value, so lets
just use MP_MAX_NUM_CPUS and simplify it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-03 17:45:53 +01:00
Aaron Ye
a94422f686 drivers: spi: Fix the Ambiq apollo4p SPI transmission failure.
The instruction length can only be 0~5.
Use am_hal_iom_blocking_transfer and specify clearly the TX/RX direction.
Hold CS to continue to RX expected response after instruction transmission.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2023-10-03 15:24:20 +01:00
Aaron Ye
7cf21d1080 drivers: spi: Fix Ambiq apollo4p SPI reconfiguration.
The configured SPI should not be configured again.
Otherwise it would cause SPI transmission failure.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2023-10-03 15:24:20 +01:00
Aaron Ye
4e7d1b0f74 drivers: spi: Fix Ambiq apollo4p SPI mode configuration.
The commit fixes the SPI mode improper configuration.
Otherwise the MODE_3 and MODE_0 cases would never be entered as expected.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2023-10-03 15:24:20 +01:00
Erwan Gouriou
c5408ab51c drivers: clock_control: stm32: Use hclk freq for flash latency computation
Flash is clocked with HCLK, while CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
reflects SYSCLK. HCLK = SYCLK / AHB prescaler.
When dealing with flash latency, use HCLK instead of SYSCLK.

This changes reverts a abusive change done in an old commit (efd8ee465c)

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-10-03 15:19:12 +01:00
Erwan Gouriou
b99651df24 drivers: clock_control: stm32: Set flash latency before increasing clocks
Latency should be set before HCLK clock increase. Not doing so can result
in broken behavior.
For instance, at startup, MSI is @4MHz on L4 series.
If MSI is required to be configured at 48 MHz for future use a USB clock,
this will be done in set_up_fixed_clock_sources(). If flash latency is
not correctly set at this point fetching flash will fail..

Move flash latency configuration before setting up fixed clocks.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-10-03 15:19:12 +01:00
Bjarki Arge Andreasen
7cac905e57 drivers: modem: modem_cellular: extend CMUX timeout
This commit adds a timeout of 300ms to the generic (gsm_ppp) init
chat script. This delay is required for some modems (discovered on
a Telit ME910G1-WW) to allow it to enter CMUX mode. Without this
delay, the modem simply refuses to respond to any CMUX commands.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-10-03 15:13:47 +01:00
Maureen Helm
aab537c8e2 drivers: ethernet: Decouple generic MII PHY and adin2111 driver Kconfigs
Decouples the generic MII PHY driver from the adin2111 driver by making
it depend on an ethernet-phy compatible devicetree node rather than the
adin2111 driver not being enabled. This makes it possible to add the
adin2111 driver to tests/drivers/build_all/ethernet

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-10-03 15:10:12 +01:00
Maureen Helm
66a03e6a38 drivers: ethernet: Remove CONFIG_ETH_ADIN2111_INIT_PRIORITY
Simplifies the adin2111 ethernet driver to use the generic driver class
initialization priority instead of a driver-specific priority.

Suggested-by: Georgij Cernysiov <geo.cgv@gmail.com>
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-10-03 15:10:12 +01:00
Maureen Helm
e503ec4064 drivers: ethernet: Fix adin2111 multiple compatibles support
The adin2111 ethernet driver supports both adi,adin2111 and adi,adin1110
devicetree compatibles, however it failed to build when both compatibles
existed in the same devicetree. This may be an unusual configuration for
real systems, but was found when extending
tests/drivers/build_all/ethernet to cover both compatibles.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-10-03 15:10:12 +01:00
Florian Grandel
7ac34d0957 drivers: ieee802154: cc13xx_cc26xx_subg: fix timing regression
Fixes a timing regression introduced by commit
a12a6ab5b9.

This caused a massively increased package error rate.

Fixes: #63324.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-02 15:53:45 -04:00
Henrik Brix Andersen
9bf17f9276 drivers: can: remove unnecessary asserts in timing callbacks
Remove unnecessary calls to __ASSERT_NO_MSG() in CAN controller driver
timing setter callbacks. The CAN API functions can_set_timing and
can_set_timing_data() already provide run-time timing parameter validation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-10-02 16:59:42 +01:00
Sylvio Alves
b7fbec7920 drivers: i2c: esp32: check busy line before transfer
I2C scan might fail as peripheral is still busy completing last
operation. This makes sure transfer call waits for free line.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-10-02 16:57:39 +01:00
Tomasz Moń
113600eb4b drivers: i2s: use new k_mem_slab definition
Commit 2f003e59e4 ("kernel: Re-factor k_mem_slab definition") moved
block_size into from k_mem_slab to k_mem_slab_info without updating i2s
handlers. Use the new member to fix build failures.

Fixes: #63363

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-10-02 08:23:48 -04:00
Johann Fischer
9cb777b95e drivers: uhc: rework transfer buffer handling
The current approach is a bit impractical in the upper layer.
This patch removes the two fifos that hold the transfer buffers
and replaces them with a byte array for the setup packet and
a pointer to a data buffer. The data buffer is mandatory for
all types of transfers except control without a data stage.
The waste of eight unused bytes for non-control transfers should
be insignificant, since an additional pointer would be at least
half of it, and then there would be the overhead of handling it.

This patch also clean up the transfer flags, rename owner to callback
as it reflects the upper layer use case, and add an additional member
to hold the pointer to the USB device (peripheral on the bus).

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-10-01 09:26:07 +03:00
Johann Fischer
960e758e6b drivers: uhc: move transfer status to transfer structure
Aling with the changes in UDC done in the commit ad81b3b797
("drivers: udc: move transfer status to buffer info structure")
This allows us to get the result of synchronous transfer and
simplify uhc_submit_event().

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-10-01 09:26:07 +03:00
Andriy Gelman
31bef35897 drivers: can: mcp251xfd: Add driver
This continue PR #31270. The updated changes are:
- Updated to work with latest zephyr
- Inplace reads/writes of registers
- Batch read of RX messages when multiple messages can be read
- FIFO abstraction of RX/TEF queues
- Handle ivmif errors
- Use READ_CRC for register reads
- Use bitmasks instead of bitfield members
- Rename mcp25xxfd to mcp251xfd
- General cleanups

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-10-01 09:20:37 +03:00
Abram Early
33277f9b48 drivers: can: Implement MCP25xxFD driver
Implementation for Microchip MCP2517FD/MCP2518FD SPI based CAN-FD
controller.

Signed-off-by: Abram Early <abram.early@gmail.com>
2023-10-01 09:20:37 +03:00
Andrzej Kuros
d44e96e486 nrf53: pretick with NRF_802154_RADIO_DRIVER
The `SOC_NRF53_RTC_PRETICK` option is now allowed to be used with
`NRF_802154_RADIO_DRIVER`.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-09-30 18:48:19 +02:00
Andrzej Kuros
e03d5d4c6d nrf53: RTC pretick allows user channels and require just one CC
The nrf53 pretick can be used with non-zero
`NRF_RTC_TIMER_USER_CHAN_COUNT` Kconfig option.

The nrf53 pretick requires just one RTC1 CC channel.

The nrf53 pretick handles also RTC1 and RTC0 both CCs and OVERFLOW
events by examination of events scheduled on them. The pretick is set
based on number of ticks to the closest event scheduled that can trigger
an interrupt.

Because the operation in `z_arm_on_enter_cpu_idle` hook would
take too much time with interrupts disabled, the
`z_arm_on_enter_cpu_idle_prepare` hook enabled by Kconfig option
`ARM_ON_ENTER_CPU_IDLE_PREPARE_HOOK` is used. It performs RTC0 and RTC1
examination, and sets pretick without interrupts being blocked.

The LDREX/STREX are leveraged to detect if exception took place
between start of `z_arm_on_enter_cpu_idle_prepare` and
`z_arm_on_enter_cpu_idle`. If exception has not been taken, the pretick
calculation can be trusted because source data could not changed and
too much time could not pass. Otherwise the sleep attempt is disallowed,
the idle will loop again and try later.

Prompt for `SOC_NRF53_RTC_PRETICK` Kconfig option allows to control
this option by an user and turn the feature off if necessary.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-09-30 18:48:19 +02:00
Krzysztof Chruściński
31eaffdf05 nrf53: Add RTC pretick
Add RTC pretick option that triggers HW activity one tick before and
RTC event that leads to the interrupt. Option is active only on nrf53
network core.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-09-30 18:48:19 +02:00
Daniel Fladerer
9d1b7086d7 drivers: serial: uart_mcux_iuart: Add parity bit handling
Adding parity bit handling according to uart_mcux.c

Signed-off-by: Daniel Fladerer <d.fladerer@gmx.de>
2023-09-30 18:45:34 +02:00
Peter Mitsis
baea37aeb4 kernel: Re-factor sys_mem_blocks definition
Rearranges the sys_mem_blocks fields so that information that describes
how much of the memory block is used is co-located. This will allow
easier of its statistics into the object core statistics reporting
framework.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-09-30 08:04:14 +03:00
Anas Nashif
34e16225eb neural_net: remove unused experimental API
Experimental API is not being used anymore, remove it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-29 20:48:33 -04:00
Manuel Argüelles
b38dab48c6 counter: nxp_s32_sys_timer: use clock control APIs
Use clock control API to retrieve the counter module's frequency and
update the boards using it to provide the source clocks.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-29 16:29:31 +02:00
Najumon B.A
a14bc241c0 drivers: sdhc: add driver support for emmc host controller
add host controller driver support for emmc version 5.1.
The driver expose zephyr sdhc api interface for emmc host controller.

Signed-off-by: Najumon B.A <najumon.ba@intel.com>
2023-09-29 16:29:00 +02:00
Kelly Helmut Lord
12fa534089 drivers: flash: shell: adjusted load command prompt
Adjusted the prompt of the load command to make it more obvious that
the user is being prompted for keyboard input.

Signed-off-by: Kelly Helmut Lord <helmut@helmutlord.com>
2023-09-29 16:28:40 +02:00
Anisetti Avinash Krishna
c45b719442 drivers: misc: timeaware_gpio: Added intel PCH driver
Added intel PCH driver for timeaware GPIO.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-09-29 16:28:09 +02:00
Anisetti Avinash Krishna
667c35a019 qinclude: zephyr: misc: Added timeaware gpio header file
Added timeaware gpio interface.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-09-29 16:28:09 +02:00
Florian Grandel
36402b6d2a net: pkt: time: introduce ns timestamp helper
A little refactoring that simplifies dealing with nanosecond timestamp
values in packets and further decouples calling code from PTP:

Benefits:
- simplifies calling code by removing redundant conversions.
- prepares for removing PTP dependencies from net_pkt.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-29 16:27:15 +02:00
Guillaume Gautier
69fb18a19d drivers: adc: stm32: ADC nocache buffers can be in CONFIG_NOCACHE_MEMORY
CONFIG_NOCACHE_MEMORY is a valid way of declaring buffers in
nocache regions. Consider them valid in the STM32 ADC driver
nocache check.
Copied from commit 818aa2d

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-09-29 16:52:33 +03:00
Dat Nguyen Duy
0b0988db2d drivers: pwm_nxp_s32_emios: add support for pwm capture
This introduces pwm capture shim driver for NXP S32 EMIOS,
the driver uses SAIC mode that is supported for all channels,
to capture the counter value on each edge for period/pulse
measurement

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-29 15:40:04 +02:00
Dat Nguyen Duy
05fd40012f drivers: pwm_nxp_s32_emios: prepare for support pwm capture
This prepares support pwm capture APIs by extended current pwm
shim driver but use a differrence hal component:

- Introduce a Kconfig options that will be set when PWM pulse
  generation API is used, it is also used to select the hal
  component. Guarding current code inside this Kconfig option

- Increase #pwm-cells to 3, flags is supported for PWM capture

- Do not require duty-cycle and polarity be set in dt, PWM
  capture doesn't need it.

- Rename emum value for pwm-mode to keep only key information

- Add preprocessor in case no channel is configured for generate
  PWM output, to avoid warning when build

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-29 15:40:04 +02:00
Dat Nguyen Duy
e021108ace misc: nxp_s32_emios: enable and declare interrupt handler
This enables and declares interrupt handlers for eMIOS,
the handlers defined and implemented at HAL, the driver
takes the name for each id from interrupt-names devicetree

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-29 15:40:04 +02:00
Pawel Osypiuk
7bc93a62b8 drivers: bluetooth: rpmsg: implement .close()
Add .close() implementation for the HCI RPMsg driver.

When running on the nRF5340 application core, it will power-cycle the
network core.

Signed-off-by: Pawel Osypiuk <pawelosyp@gmail.com>
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-09-29 13:53:13 +02:00
Bernt Johan Damslora
9eac29d532 drivers: sensor: npm1300_charger: Correct temperature order of magnitude
Changes the interpreted unit of the threshold temperatures to match the
description (millidegrees).

Signed-off-by: Bernt Johan Damslora <Bernt.Damslora@nordicsemi.no>
2023-09-29 11:57:23 +02:00
Guillaume Gautier
85fa6746de drivers: clock_control: stm32u5: enable backup access before enabling lsi
LSI needs write access to backup domain to be enabled.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-09-29 10:33:42 +02:00
Wouter Horré
3bc531e9c6 drivers: i2c: stm32: Support wakeup from STOP
This commit adds support for wakeup from STOP mode when the i2c device is
configured as a target.

Signed-off-by: Wouter Horré <wouter@versasense.com>
2023-09-29 09:48:04 +02:00
Stefan Petersen
58ca047fa7 dts: stm32h7: flash-controller: Add default STM32 as compatible
Add "st,stm32-flash-controller" as compatible for STM32H7 so that
what is defined for STM32 in general  is also defined for STM32H7.
Already most of the other STM32 versions have this addition.

Also removed the specific STM32H7 flag check in
/flash/driver/Kconfig.stm32.

Signed-off-by: Stefan Petersen <spe@ciellt.se>
2023-09-29 09:47:46 +02:00
Maureen Helm
d5287578fe dts: bindings: boards: Update Ethernet PHY to use reg property
Updates Ethernet PHY devicetree bindings to be more consistent with
Linux by using the standard `reg` property for the PHY address instead
of a custom `address` property. As a result, MDIO controller bindings
now require standard `#address-cells` and `#size-cells` properties.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-09-29 09:47:15 +02:00
Maureen Helm
ce42ffcce0 dts: boards: Use ethernet-phy devicetree node name consistently
Some Ethernet PHYs used the devicetree node name `phy`, while others
used `ethernet-phy`. Be consistent and use `ethernet-phy` throughout.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-09-29 09:47:15 +02:00
Guillaume Gautier
e8e5d5554c drivers: adc: stm32: reset acquisition time between reads
For all STM32 ADC that use common sampling times, there is a check made to
ensure that all channels of a sequence use the same sampling time.
The value was not reset between reads, resulting in error if two
consecutive sequences used different values.
This commit adds a reset of this value once read is done.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-09-29 09:47:07 +02:00
Yong Cong Sin
8cd64fd791 drivers: gpio: sifive: use Kconfig to convert between levels
The number of IRQ first level bits is not necessarily 8 bits
now, so use `CONFIG_1ST_LEVEL_INTERRUPT_BITS` instead of
hardcoded value.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-09-29 09:46:24 +02:00
Bjarki Arge Andreasen
cc219c0132 drivers: serial: serial_test.c: Patch 64-bit incompat
The serial_test.c driver uses size_t to store read_size,
which becomes a 64-bit type when built for 64-bit
architectures. This is incompatible with the print
format %d which is 32-bit. Updated to %zd

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-09-28 16:38:30 -04:00
Bjarki Arge Andreasen
d118d19293 drivers: serial: serial_test: Move ring buf dep to Kconfig
This commit moves the dependency management between the
RING_BUFFER and UART_ASYNC_API or UART_INTERRUPT_DRIVEN
options to the Kconfig Kconfig.test.

If either UART API options listed are selected, the
RING_BUFFER option must be selected. This is now handled
automatically by Kconfig instead of causing a build
assert.

The asserts where added with this PR #59880, and are
removed in this commit.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-09-28 16:38:30 -04:00
Bjarki Arge Andreasen
ebd6681589 drivers: serial: serial_test: Patch irq_isr set to undefined
This commit fixes an error where the irq_isr callback is set
to an undefined variable instead of NULL.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-09-28 16:38:30 -04:00
Jeroen Reeskamp
1134245ac9 sensors: lsm6dso: Values now match better with the ODR values.
Values are specified in the datasheet(page 30, table 18).
Values match with values defined in lsm6dso-common.yaml

Signed-off-by: Jeroen Reeskamp <jeroen.reeskamp@vention.nl>
2023-09-28 12:21:54 -05:00
Henrik Brix Andersen
a9d3935fa0 drivers: can: solely use sjw from devicetree for initial timing
Update the CAN controller drivers to solely use the sjw and sjw-data
devicetree properties for setting the initial timing when devicetree timing
parameters are specified in Time Quanta (TQ).

Any timing set via the CAN timing APIs will contain either user-provided or
automatically calculated SJW values. This includes any timing parameters
calculated from bus-speed and bus-speed-data devicetree properties.

Update the CAN controller driver tests accordingly and remove the
CAN_SJW_NO_CHANGE definition as it has lost its meaning.

Fixes: #63033

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-09-28 16:28:56 +02:00
Henrik Brix Andersen
e397b85eb8 drivers: can: calculate a default SJW value
Change the CAN timing calculation APIs to automatically calculate a default
(Re-)Synchronization Jump Width (SJW) value. The calculated value can be
overwritten by the caller if desired.

This allows automatically scaling the SJW according to the number of Time
Quanta (TQ) used for phase segment 2 instead of relying on a compile-time
fallback value defined in devicetree.

This reduces the can_set_timing()/can_set_timing_data() API functions to
simple setters (with validation).

Fixes: #63033

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-09-28 16:28:56 +02:00
Mulin Chao
21d7c2db6d drivers: sensor: npcx: fix debug message when port B is captured
Fix wrong debug message when port B of tachometer is captured.

Signed-off-by: Evan Chang <MCCHANG1@nuvoton.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-09-28 09:08:29 -05:00
Dominik Ermel
1f3605de21 drivers/flash/nrf: Workaround for nrf91 errata 7
Fix UICR read access.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-09-28 15:33:52 +02:00
honglin leng
c4f102fd8b boards: arm64: add support for Raspberry Pi 4 Model B
This is an AArch64 board. We also add BCM2711 SoC support

Signed-off-by: honglin leng <a909204013@gmail.com>
2023-09-28 13:40:45 +02:00
Aleksander Wasaznik
4d926ac041 drivers: serial_test: Implement interrupt and async APIs
This allows testing code that uses the UART interrupt-driven API and
UART asynchronous API.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-09-28 14:07:52 +03:00
Anas Nashif
6d23a960db lib: os: build fdtable conditionally
Stop building fdtable by default, make it conditional and build it only
when needed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-28 06:25:16 -04:00
Fabiola Kwasowiec
02e4e60f2f dmic: add the correct gain values to the dmic registers
Zephyr increments the gain until it reaches the maximum value and
then sets the registers to zero which is incorrect.
The values set in the DMIC config should be restored.

Signed-off-by: Fabiola Kwasowiec <fabiola.kwasowiec@intel.com>
2023-09-28 09:34:44 +02:00
Manuel Argüelles
977ad483b4 mdio: shell: add Clause 45 commands
Add MDIO shell commands for Clause 45 read/write operations.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-28 09:33:10 +02:00
Manuel Argüelles
280ddaef4a mdio: introduce Clause 45 APIs
Add `mdio_read_c45()`/`mdio_write_c45()` APIs for Clause 45 access
and remove the `protocol` MDIO binding property so that MDIO bus
controller can support more than one protocol.

A new MDIO header is introduced with generic opcodes, MMD and
registers addresses, to be used by MDIO and PHY drivers.

Existing MDIO drivers that support both Clause 22 and Clause 45
access are migrated to the new APIs.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-28 09:33:10 +02:00
Manuel Argüelles
62b28cb443 mdio: rename argument devad to regad
Rename argument `devad` to `regad` to indicate this is the register
address in a given PHY device and to not be confused with the
Clause 45 device address within a port.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-28 09:33:10 +02:00
Francois Ramu
1d29a8c3c2 drivers: i2c: stm32 i2c driver supports 10-bit addressing
When slave_address is 10 bits, data type should be
uint16_t instead of uint8_t,
like the data typeof data->slave_cfg->address.
https://github.com/zephyrproject-rtos/zephyr/issues/55987

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-09-28 09:27:09 +02:00
Dat Nguyen Duy
8185faa0cb drivers: dma_mcux_edma: add support dma driver for s32k344
On S32K344, the offset in memory map between each channel
is 0x4000 for most channels, but there is specific case is
between channel 11 and 12 which is 0x1D4000 instead. As a
consequence, 32 channels are divided to two parts: one
starts from channel 0 -> 11. The other is from channel 128
to 145. The channel gap is from 12 -> 127.

For user and data structures in shim driver, the channel's
value comes from 0 --> 31. Above constraint will be counted
when interact with the mcux sdk

Beside that, the DMAMUX register in this platform is very
specific, not in identical with DMAMUX channel, so shim
driver is updated to cover this case

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-27 14:02:09 -05:00
Dat Nguyen Duy
d4a2b2244f drivers: dma_mcux_edma: add support for edma version 3
Add new dt binding for edma v3 that inherits whole dt
properties from current version. One more property is
added for SoCs that don't have separate error interrupt
id, use same id with channel interrupt

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-27 14:02:09 -05:00
Dat Nguyen Duy
a5cf757c9e drivers: dma_mcux_edma: improve interrupt handling
The current implementation iterates over all channels
even if only several channels share the same irq. This
introduces one more dt property to describe an offset
between two channels share the same interrupt id.

Beside that, the error interrupt must be put as last
element of "interrupt" dt property.

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-27 14:02:09 -05:00
Dat Nguyen Duy
03b5ba5990 drivers: dma_mcux_edma: add support for multiple DMAMuxes
This adds support for platforms that have multiple DMAMUXes
per DMA instance

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-27 14:02:09 -05:00
Dat Nguyen Duy
ad08d71efa drivers: dma_mcux_edma: correct valid values for dma channel/slot
The dma-channels devicetree value - 1 = maximum valid channel
The dma-requests devicetree value - 1 = maximum valid request

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-27 14:02:09 -05:00
Andrei Emeltchenko
d7fd3db32e drivers: smbus: pch: Simplify IRQ flags
Use COND_CODE_1() macro instead of macro trampoline.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-09-27 20:35:06 +03:00
Flavio Ceolin
eeea26d206 ipm: cavs: Fix possible buffer overflow
A buffer overflow happens in send() when size is negative because
it is promoted to signed when used in memcpy.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-09-27 11:51:34 -05:00
Flavio Ceolin
98857c267d ipm: imx: Initialize variable before using it
Since the driver is passing the whole buffer, let's zero it to avoid
pass garbage in case of size != buffer's size.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-09-27 11:51:34 -05:00
Flavio Ceolin
0a12a05e63 ipm: imx: Fix possible buffer overflow
It is possible to happen a buffer overflow in ipm_send due the lack
of a checking for negative value.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-09-27 11:51:34 -05:00
Flavio Ceolin
4ff32d9290 ipm: mcux: Initialize variable before using it
Since the driver is passing the whole buffer, let's zero it to avoid
pass garbage in case of size != buffer's size.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-09-27 11:51:34 -05:00
Flavio Ceolin
6654d18596 ipm: mcux: Fix possible buffer overflow
It is possible to happen a buffer overflow in ipm_send callback
due a wrong comparison between signed/unsigned types.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-09-27 11:51:34 -05:00
Florian Grandel
a12a6ab5b9 drivers: ieee802154: introduce channel pages
Replaces the previous approach to define bands via hardware capabilities
by the standard conforming concept of channel pages.

In the short term this allows us to correctly calculate the PHY specific
symbol rate and several parameters that directly depend from the symbol
rate and were previously not being correctly calculated for some of the
drivers whose channel pages could not be represented previously:
* We now support sub-nanosecond precision symbol rates for UWB. Rounding
  errors are being minimized by switching from a divide-then-multiply
  approach to a multiply-then-divide approach.
* UWB HRP: symbol rate depends on channel page specific preamble symbol
  rate which again requires the pulse repetition value to be known
* Several MAC timings are being corrected based on the now correctly
  calculated symbol rates, namely aTurnaroundTime, aUnitBackoffPeriod,
  aBaseSuperframeDuration.

In the long term, this change unlocks such highly promising functional
areas as UWB ranging and SUN-PHY channel hopping in the SubG area (plus
of course any other PHY specific feature).

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-27 12:44:15 -04:00
Florian Grandel
7c00b81705 drivers: ieee802154: cc13xx_cc26xx: readability improvement
Aligns the name of the return value variable with what is used elsewhere
in the driver and the subsystem for improved readability and
consistency.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-27 12:44:15 -04:00
Florian Grandel
ea6248b870 drivers: ieee802154: cc1200: SUN-FSK compatibility
Preparative change to introduce build-time configured channel pages.
This fixes the description of the driver's available PHYs and makes
channel page and channel range independent from runtime attributes.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-27 12:44:15 -04:00
Andrzej Głąbek
eafe6a9a31 drivers: spi_nrfx_spis: Handle empty spi_buf_set structures properly
SPI API allows `spi_buf_set` structures with no buffers linked to them
(with `.buffers = NULL`). Correct the spi_nrfx_spis driver so that it
is able to deal with such structures.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-09-27 17:49:28 +02:00
Aaron Massey
12cbfcf397 fuel_gauge: Repl property struct w/ union
Based on review of the similar charger driver API, it's been demonstrated
from the community that embedding a per value property type when fetching
properties. Separating off the property types from the property values
themselves also allow an array of property types to declared as static
const.

Break up fuel_gauge_property struct into a fuel_gauge_prop_val union and a
fuel_gauge_prop_t property type as inputs into fuel gauge API functions.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-27 12:07:59 +02:00
Aaron Massey
329ecd1e12 fuel_gauge: Remove status from fuel gauge properties
Based on review of the similar charger driver API, it's been demonstrated
from the community that embedding a per value status code when fetching
multiple properties isn't particularly wanted or needed. It was largely
considered not worth the additional maintenance to have the extra per
property error information.

Remove the status field from the fuel_gauge property value structs.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-27 12:07:59 +02:00
Aaron Massey
bddd88955d fuel_gauge: Add fuel_guage_set_props()
The fuel_gauge_set_prop() function prototype declares a function that sets
multiple fuel gauge properties at once. The naming suggests it ought to
fetch a singular property at a time. Moreso, some clients may just want to
set properties one at a time and may feel uncomfortable using a prototype
for fetching multiple properties when wanting to fetch them one at a time.

Modify fuel_gauge_set_prop() to fetch a single property and add
fuel_gauge_set_props() to support fetching multiple properties. Modify
existing tests/drivers/samples.

This is part of #61818 work.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-27 12:07:59 +02:00
Aaron Massey
e294b16a2f fuel_gauge: Add fuel_guage_get_props()
The fuel_gauge_get_prop() function prototype declares a function that
retrieves multiple fuel gauge properties at once. The naming suggests it
ought to fetch a singular property at a time. Moreso, some clients may just
want to fetch properties one at a time and may feel uncomfortable using a
prototype for fetching multiple properties when wanting to fetch them one
at a time.

Modify fuel_gauge_get_prop() to fetch a single property and add
fuel_gauge_get_props() to support fetching multiple properties. Modify
existing tests/drivers/samples.

This is part of #61818 work.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-27 12:07:59 +02:00
Sylvio Alves
bdda8ac48e soc: esp32s3: add esp32s3_appcpu for AMP support
Adds esp32s3_appcpu SoC and update default esp32s3 SoC
to support AMP feature.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-09-27 12:07:21 +02:00
Gerson Fernando Budke
037618a638 drivers: ieee802154: rf2xx: Fix rx promiscuous behaviour
When radio is set to promiscuous mode it is desirable to receive
invalid frames. This skip a few checks and allow an invalid and
non-standard frames be delivered for diagnose.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-09-27 09:53:08 +02:00
Jonas Otto
1402d2d8b4 drivers: i2c_ll_stm32_v2: add warning about i2c speeds above fast
The i2c_ll_stm32_v2 driver requires manual timing configuration for
"fast mode plus" speed.
This adds an error message linking to the appropriate documentation.

Signed-off-by: Jonas Otto <jonas@jonasotto.com>
2023-09-27 09:13:31 +02:00
Benjamin Cabé
14c92da96d doc: stm32: Update all st.com links to use HTTPS
While recent browsers seem to transparently try to use https for
http://www.st.com/... URLs, they are effectively not working anymore, so use
https://www.st.com/... URLs instead.

curl http://www.st.com/en/evaluation-tools/nucleo-g070rb.html -m 5 -v
*   Trying 104.89.117.48:80...
* Connected to www.st.com (104.89.117.48) port 80 (#0)
> GET /en/evaluation-tools/nucleo-g070rb.html HTTP/1.1
> Host: www.st.com
> User-Agent: curl/8.1.2
> Accept: */*
>
* Operation timed out after 5002 milliseconds with 0 bytes received
* Closing connection 0
curl: (28) Operation timed out after 5002 milliseconds with 0 bytes
received

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-09-26 16:55:08 +02:00
Jilay Pandya
4e262bf83a fix: drivers: remove redundant config checks in cmake files
This commit does not introduce any functional change to the
codebase. Just removes certain redundant checks from
various CMakeLists.txt files in order to bring more coherence
in the codebase.

Signed-off-by: Jilay Pandya <jilay.pandya@zeiss.com>
2023-09-26 16:54:58 +02:00
Iuliana Prodan
8148643881 ipm: imx: send firmware ready reply to check for fw boot completion
Send a fw ready reply message as soon as possible.
This is usually used on host side which is waiting
for this message in order to establish the
communication with the remote processor - see
imx_dsp_rproc driver from Linux.

This can be enabled by IPM_IMX_FW_READY_REPLY config,
which is by default N.

Set CONFIG_IPM_IMX_FW_READY_REPLY as Y for
openamp_rsc_table sample, running on nxp_adsp_imx8m.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-09-26 16:54:04 +02:00
Manuel Argüelles
ca3310145f drivers: select nocache only when supported
NOCACHE_MEMORY depends on ARCH_HAS_NOCACHE_MEMORY_SUPPORT, so
don't try to select the symbol if not supported.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-26 15:09:51 +02:00
Yong Cong Sin
0538411c09 drivers: mm: refine includes of the header
Refines the `system_mm.h` to include `zephyr/types.h` instead
of `zephyr/kernel.h` as that is all it needs.

Updated the includes of `mm_drv_ti_rat.c` accordingly.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-09-26 15:09:12 +02:00
Jatty Andriean
e364a095a6 drivers: clock_control: Add PLL fracn for STM32U5
Based on RM0456, each PLL in the STM32U5 has the
capability to work either in integer or fractional mode.
In this update, the fractional mode can be enabled
by setting the fracn value in the device tree.

Signed-off-by: Jatty Andriean <jandriea@outlook.com>
2023-09-26 15:06:56 +02:00
Dawid Niedzwiecki
68292b0310 counter: stm32 rtc: improve readability
Split the read function into 2 versions (date and no date) since they
don't have common code.

It improves readability.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Dawid Niedzwiecki
49f9aa7d12 counter: stm32 rtc: handle sub second registers
Add support for using the sub second registers. It allows reading and
setting alarm with the sub second tick resolution.

The RTC module is configured to get as high frequency as possible, which
equals the source clock (RTCCLK) divided by 2. To get such frequency,
the asynchronous prescaler is set to 1.

According to RM, setting the asynchronous prescaler to a high value
minimize consumption, so the change increase the power consumption.

Use a config to enable the sub second support.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Dawid Niedzwiecki
322f7980c5 counter: stm32 rtc: simplify calculation
RTC drivers uses only seconds, so transition to microseconds is
necessary.

Change way of calculation tick<->time to avoid unnecessary
conversations.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Dawid Niedzwiecki
c7d779f6e2 counter: stm32 rtc: fix indentations
Fix indentations of the API definition.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Dawid Niedzwiecki
16370a259a counter: stm32 rtc: improve reading registers
Synchronize reading two separate registers. In some edge cases the read
registers could point different dates.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Dawid Niedzwiecki
ad53863d1a counter: stm32 rtc: improve assigning configs
The config values have been hardcoded as magic values. Introduce
universal calculation based on the DTS entries.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-09-26 15:05:35 +02:00
Daniel Leung
3374e81438 uart: ns16550: separate IO/MMIO and PCIe init macros
This separates the DT device init macros into two: one for
UART accessed via IO port or MMIO, the other for PCIe UART.
All the conditions needed to setup the device structs are
getting complicated. Hopefully separating them would make
them easier to decode, and to avoid the conditions having
too many levels.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung
9f9b4a8afa uart: ns16550: use io-mapped DT property for IO port access
The old CONFIG_UART_NS16550_ACCESS_IOPORT has been used to
indicate whether to access the NS16550 UART via IO port
before device tree is used to describe hardware. Now we have
device tree, and we can specify whether a particular UART
needs to be accessed via IO port using property io-mapped.
Therefore, CONFIG_UART_NS16550_ACCESS_IOPORT is no longer
needed (and thus also CONFIG_UART_NS16550_SIMULT_ACCESS).
Remove these two kconfigs and modify code to use device tree
to figure out how to access the UART hardware.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung
3296956331 uart: ns16550: move setting .reset_spec inside initializer
This moves setting .reset_spec inside struct initializer
instead of using macro trampoline.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung
53bc95e218 uart: ns16550: refactor UART_NS16550_IRQ_CONFIG_*
Instead of PCIE0 and PCIE1, use no suffix for IO port/MMIO IRQ
configuration funct, and suffix PCIE for IRQ config on PCIE
bus.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung
566d21804c uart: ns16550: simplify DEV_DATA_FLOW_CTRL
Use COND_CODE_1() instead of macro trampoline and move it
into struct initializer.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung
8b54cb859e uart: ns16550: simplify BOOT_LEVEL
Use CODE_CODE_1() instead of macro trampolines when
CONFIG_UART_NS16550_PARENT_INIT_LEVEL is enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung
7d0e223112 uart: ns16550: simplify DEV_CONFIG_PCIE_INIT/DEV_PCIE_DECLARE
Use COND_CODE_1() instead of macro trampolines.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung
39f8b7d51d uart: ns16550: simplify UART_NS16550_IRQ_FLAGS
Using COND_CODE_1() is more intuitive when looking at the code,
instead of some macro trampoline magic.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung
fe10897f70 uart: ns16550: simplify DLF and PCP related macros
This simplifies DLF and PCP enabling devicetree macros with
DT_ANY_INST_HAS_PROP_STATUS_OKAY() instead of the complicated
ones.

Also, this moves the macro to initialize struct elements into
the struct initializer itself. This makes it clearer on which
element is being initialized directly inside the struct
initializer instead of having to do mental macro trampoline
to find the correct macro.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Daniel Leung
2899df629f uart: ns16550: remove unused forward declaration
Remove the unused forward declaration of the driver API struct.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-26 12:03:04 +02:00
Bindu S
79852e216e drivers: dma: dma_dw_common: Updated check condition of DMA channel
updating check condition for dma channel for correct limit

Signed-off-by: Bindu S <bindu.s@intel.com>
2023-09-26 12:02:23 +02:00
Bindu S
877208dc78 drivers: i2c: i2c_dw: Added intel lpss dma support for I2C
Enabled intel LPSS DMA interface using dw common to support
usage of internal DMA in LPSS I2C to transfer and
receive data.

Signed-off-by: Bindu S <bindu.s@intel.com>
2023-09-26 12:02:23 +02:00
Michal Morsisko
8e32b5ee0a drivers: sensor: Add suport for TMAG5170 3D Hall sensor
Introduce support for Texas Instruments TMAG5170
high-precision linear 3D Hall-effect SPI sensor.
This driver allows to configure measurements on
magnetic and temperature channels. It is also
possible to read rotation of the magnet.

Signed-off-by: Michal Morsisko <morsisko@gmail.com>
2023-09-26 08:36:09 +02:00
Anisetti Avinash Krishna
d7c353cdf4 drivers: dma: intel_lpss: Used phandle to get base address
Added usage of dma_parent phandle instead of using parent-child
method to get DMA base address.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-09-25 18:43:29 -04:00
Benjamin Cabé
4d10c960da drivers: sensor: Add initial support for hm330x dust sensor
Adds initial support for hm330x dust sensor series. Allows to read PM1,
PM2.5 and PM10 concentrations in atmospheric environment. A further
update to the driver may add support for also reading "standard" CF1
concentrations by exposing of a custom sensor attribute or a Kconfig
option. Tested with Grove - Laser PM2.5 Sensor (HM3301) attached to a
Wio Terminal.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-09-25 19:53:49 +02:00
Nick Ward
3dba54b92d drivers: current sense amp: add pm
Enable power management for current sense amp.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-09-25 11:23:45 -05:00
Jordan Yates
c667b43697 bluetooth: hci: enable backends by default
Enable backends by default, instead of requiring some other module to
turn them on. This aligns with the behaviour of sensor drivers and
`BT_RPMSG`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-09-25 16:43:42 +02:00
Jordan Yates
ca5931065c testsuite: boards: unit_testing: default HCI bus
Be explicit about the HCI backend that Bluetooth unit tests require.
Some unit tests depend on `BT_HAS_HCI_VS`, so also enable that.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-09-25 16:43:42 +02:00
Nick Ward
4fe5beb2c5 drivers: adc: shell: add differential command
Add differential command.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-09-25 16:42:10 +02:00
Nick Ward
f2af46aaa0 drivers: adc: shell: remove \n from logs
Remove \n from logs.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-09-25 16:42:10 +02:00
Nick Ward
50462228f2 drivers: adc: shell: fix - read result is signed
Previously negative read results were being printed
by the shell as large uint16_t.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-09-25 16:42:10 +02:00
Andrei Emeltchenko
11f0e59d19 drivers: wdt_tco: Use DT_DRV_COMPAT interface
DT_DRV_COMPAT was unused for this driver. To get a node identifier
DT_NODELABEL() macro was used. Refactor to use the correct interfaces
using instance number 0.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-09-25 16:41:42 +02:00
Goh Shun Jing
029e756009 drivers: gpio: altera_pio add spinlock
Add spinlock for write access to register

Signed-off-by: Goh Shun Jing <shun.jing.goh@intel.com>
2023-09-25 16:41:17 +02:00
Teoh Shi Lin
11a8c5cd9e drivers: gpio: altera_pio: enhancement
update to make interrupt optional since they are not always available

Signed-off-by: Teoh Shi Lin <shi.lin.teoh@intel.com>
2023-09-25 16:41:17 +02:00
Teoh Shi Lin
d98229c352 drivers: gpio: Add ALTERA PIO
Add driver for altera avalon pio.

Signed-off-by: Teoh Shi Lin <shi.lin.teoh@intel.com>
2023-09-25 16:41:17 +02:00
Anas Nashif
1640d37189 drivers: neural_net: remove obsolete driver
This driver is not being used by anything and is not being built or
tested, so remove it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-25 07:40:07 -04:00
Gerson Fernando Budke
12720fec51 drivers: ieee802154: rf2xx: Fix rf231 invalid frame
The at86rf231 frame buffer access mode read differs from all other
transceivers by only transfer one more byte after PSDU data instead
three. This difference is not evaluated in the current version of
the driver. The current change add the necessary check and read the
missing data (EQ, TRAC).

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-09-25 09:52:28 +02:00
Nick Ward
ead0c4f865 drivers: adc: use adc_read_dt api
Where struct adc_dt_spec is in use use adc_read_dt().

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-09-25 09:52:16 +02:00
Christopher Friedt
a05c88daa5 drivers: console: uart_console: avoid infinite loop in isr
Previously, the `uart_console_isr()` routine assumed that the
return value of several uart API functions would only ever
return the equivalent of a boolean value. In fact, an integer
is returned on occasion, and that integer can take on many
values.

Since unary operations would either go to "true" or "false"
and since any non-zero integer evaluates to "true", even a
return value of something like `-ENODEV` would evalueate
to true.

Explicitly compare against the integer-equivalent value of
the expected boolean output.

With this, in the case of errors, negative return values do
not evaluate to "true", and the infinite loop is avoied.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-09-25 09:51:45 +02:00
Dat Nguyen Duy
910d417a92 drivers: spi_mcux_lpspi: add support dma per instance
Currently, the driver imply understand that all instances
will use dma when CONFIG_SPI_MCUX_LPSPI_DMA is set. There
might be an instance doesn't need DMA, so instead of enforce
spi_transceive API to use DMA, add more flexible to enable
DMA only when required

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-25 09:50:01 +02:00
Tim Lin
dca9cbff08 ITE: drivers/pinctrl: Add alternate function additional setting
When the alternate setting is configured as func3, in addition to
the setting of func3-gcr, some pins require external setting.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-09-25 09:48:57 +02:00
Sri Surya
049aaac696 drivers: rtc: new ambiq am1805 rtc driver
Added RTC driver for am1805 with rtc time, alarm set/get,
callback and calibration.

Signed-off-by: Sri Surya <srisurya@linumiz.com>
2023-09-25 09:47:46 +02:00
Tristan Honscheid
80ed7afab2 sensors: akm09918c: Add RTIO one-shot implementation
Implement the RTIO/Sensors V2/Async API for the AKM09918C. Add a decoder
API implementation as well.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-09-25 09:47:26 +02:00
Tristan Honscheid
2b06884afe sensors: icm42688: Remove unused function from driver
This function is no longer used and causes a compiler error.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-09-25 09:47:26 +02:00
Yuval Peress
5e14088a3f sensors: vertically decode raw data
Update the decoder APIs to vertically decode the raw sensor data. This
means that instead of getting each channel on a frame by frame basis,
the API takes a channel specifier and returns as many frames of that
given channel as there's room.

The goal of this is to make the end decoded result the most useful and
usable for the Zephyr application. See #60944 for details.

Signed-off-by: Yuval Peress <peress@google.com>
2023-09-25 09:47:26 +02:00
Nick Ward
71db188091 drivers: sensor: voltage: add driver
Add voltage sensor driver.

Co-authored-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-09-25 09:47:03 +02:00
Daniel DeGrasse
36ad0b10b3 drivers: display: rm67162: write full buffer to MIPI_DSI
With update to handle DSI transfer length in MIPI_DSI driver, the logic
can be removed from the RM67162 driver. The driver now will simply
continue writing data until the full buffer is sent.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-09-25 09:46:55 +02:00
Daniel DeGrasse
61515cf31f drivers: mipi_dsi: dsi_mcux_2l add support for SMARTDMA, and byte swapping
Add support for SMARTDMA transfers, and byte swapping of RGB565 data.
Additionally, the limits on TX data size have been impelemented in the
MIPI DSI driver, as opposed to the RM67162 display where they were
previously added.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-09-25 09:46:55 +02:00
Daniel DeGrasse
8d2f4633f2 drivers: dma: introduce SMARTDMA dma driver
Introduce SMARTDMA dma driver. The SMARTDMA is a peripheral present on
some NXP SOCs, which implements a programmable DMA engine. The DMA
engine does not use channels, but rather provides a series of API
functions implemented by the firmware provided with MCUX SDK.

These API functions can be selected by the dma_config slot parameter. A
custom API is also provided to allow the user to install an alternate
firmware into the SMARTDMA.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-09-25 09:46:55 +02:00
Daniel DeGrasse
9bcd8e9b3e drivers: mipi_dsi: dsi_mcux: limit DSI TX to max payload size
Limit DSI data TX to the max payload size possible with this peripheral,
rather than relying on display drivers to respect this limitation.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-09-25 09:46:55 +02:00
Henrik Brix Andersen
c1ad82e5fb drivers: can: mcux: flexcan: fix initial of CAN-FD timing when using TQs
Fix the assignment of initial CAN bus timing parameters for the CAN-FD data
phase.

Fixes: #62979

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-09-24 20:47:32 -05:00
Aleksandr Senin
a1e2fdcc4d drivers: mdio: add bit-bang driver
Add MDIO driver that works through GPIO pins. This driver is
useful when a microcontroller doesn't have MDIO bus or when multiple
separate MDIO buses are required. The driver provides access to
the MDIO bus through GPIO pins for any SoC that has GPIO pin control
available.

Signed-off-by: Aleksandr Senin <al@meshium.net>
2023-09-24 08:28:10 -04:00
Nick Ward
ee3b9c117e sensor: vl53l0x: pm resume fix
When active XSHUT resets the chip so we must
re-initialise chip when resuming from PM suspend.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-09-22 08:40:05 -05:00
Henrik Brix Andersen
49ab0b22f0 drivers: can: switch to CAN_DEVICE_DT_INST_DEFINE for remaining drivers
Switch from using DEVICE_DT_DEFINE()/DEVICE_DT_INST_DEFINE() to using
CAN_DEVICE_DT_DEFINE()/CAN_DEVICE_DT_INST_DEFINE() for remaining drivers.

This unifies CAN controller device driver initialization regardless of the
driver implementing CAN statistics support or not.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-09-22 08:37:05 -05:00
Guillaume Gautier
e09c594711 drivers: adc: stm32: remove channel count limit
Remove CHANNEL_COUNT limit used to check the channel bitmask.
This value was not applicable on STM32L1 where channel can go up to 31.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-09-22 15:30:47 +02:00
Guillaume Gautier
c201d21964 drivers: adc: rework stm32 adc sequencer
Add sequencer support for all STM32 series.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-09-22 15:30:47 +02:00
Brunon Blok
bf830ba780 drivers: input: add driver for stmpe811 i2c touch controller
This commit adds STMPE811 I2C touch controller driver.

Signed-off-by: Brunon Blok <bblok@internships.antmicro.com>
Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-09-22 09:29:56 +02:00
Petr Hlineny
b2fb3d49bf drivers: i2c: stm32: Fix for i2c PM
Remove unwanted "pm_device_runtime_get" lock which makes i2c power
management working incorrectly.

Fixes: #62790
Signed-off-by: Petr Hlineny <development@hlineny.cz>
2023-09-22 09:27:46 +02:00
Manuel Argüelles
cdcba384bc spi: nxp_s32: use clock control APIs
Use clock control API to retrieve the module's frequency and
update the boards using it to provide the source clocks.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-22 09:24:40 +02:00
Manuel Argüelles
be08ce18d0 wdt: nxp_s32: use clock control APIs
Use clock control API to retrieve the module's frequency and
update the boards using it to provide the source clocks.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-22 09:24:32 +02:00
Daniel Baluta
b4998c357e mm_drv: tlb: Fix compile time warning
This fixes the following compile time warning;

drivers/mm/mm_drv_intel_adsp_mtl_tlb.c: In function 'sys_mm_drv_mm_init':
include/zephyr/sys/__assert.h:44:52: error: format '%p' expects argument
of type 'void *', but argument 2 has type
'long unsigned int' [-Werror=format=]
__ASSERT_PRINT("\t" fmt "\n", ##__VA_ARGS__)

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2023-09-22 09:24:02 +02:00
Manuel Argüelles
45c8cb2343 counter: nxp_pit: use clock control to obtain module's clock rate
Use standard clock control API to retrieve the PIT clock rate instead of
using the HAL.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-22 09:23:30 +02:00
Manuel Argüelles
ddaacd9ee8 counter: nxp_pit: allow to specify max load value
The PIT maximum load value may not be always 32-bit. Allow the SoC to
define this value from devicetree.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-22 09:23:30 +02:00
Manuel Argüelles
f8e16ae81a counter: nxp_pit: support flexible number of interrupts
Depending on the SoC design, the PIT channel interrupts can be
individual or OR'ed together to a single interrupt line.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-22 09:23:30 +02:00
Manuel Argüelles
d590fb2f78 counter: nxp_pit: support only top callback
This periodic timer (PIT) has a single load value register for each
channel, which is currently used for both alarm and top callback APIs.
If using both APIs together (which is a valid use-case) it will write
to the same register causing unexpected behavior of the timer.

The nature of the PIT is to trigger an event (like interrupts) at a
certain rate, and not to produce single-shot events. Hence keep only top
callback functionality.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-22 09:23:30 +02:00
Manuel Argüelles
e22f634f33 counter: nxp_pit: support multiple instances
Add support for multiple device instances.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-22 09:23:30 +02:00
Tomasz Bursztyka
95b8493857 drivers/nvme: Return an error in case of non dword-aligned data buffer
This is a specific case for NVMe where given data buffer pointers must
be dword (4 bytes) aligned.

There is no virtual memory management between the user thread and NVMe
driver (which one could detect such wrong alignement on physical memory
and thus reallocate the memory properly, so it would be fully
transparent for the user thread), thus the need to push that check to
the user.

This has been going under the radar so far as Qemu does not seem to
follow NVMe specifications where PRP1 (in DPTR) must always be
dword-aligned. It really does not follow the rule: specifications
details that if bits 1:0 of PRP1 are set, the controller may generate
an error or treat the address as if these bits were unset. Seems like
a bug in Qemu, I did not check the code there however.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-09-22 09:23:18 +02:00
Tomasz Bursztyka
2caced752a drivers/nvme: Rewrite how data pointer is filled
Former way was difficult to read, so let's have a better way which
easily follows the specifications.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-09-22 09:23:18 +02:00
Tomasz Bursztyka
f21760252a drivers/nvme: Make sure PRP2 value is encoded in little endian.
To avoid issue in address translation when CPU is running in big endian.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-09-22 09:23:18 +02:00
Tomasz Bursztyka
0b45688335 drivers/nvme: Rely on CONFIG_MMU_PAGE_SIZE for PRP
Getting rid of 4Kib page size hardcoded value on PRP handling.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-09-22 09:23:18 +02:00
Tomasz Bursztyka
eeea64a19c drivers/nvme: Add debug information in case of request error
This will provide a detailed error status report.

As for most of the original code of the driver, this is a backport of
the work done by Jim Harris in FreeBSD.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-09-22 09:23:18 +02:00
Fabio Baltieri
794893315a intc: loapic: convert DEVICE_DEFINE to DEVICE_DT_INST_DEFINE
Convert DEVICE_DEFINE to DEVICE_DT_INST_DEFINE, this allows the build
system to track the device dependencies and ensure that the interrupt
controller is initialized before other devices using it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-22 09:22:55 +02:00
Fabio Baltieri
ceb02b3f31 intc: intc_nxp_pint: convert SYS_INIT to DEVICE_DT_INST_DEFINE
Convert SYS_INIT to DEVICE_DT_INST_DEFINE, this allows the build system
to track the device dependencies and ensure that the interrupt
controller is initialized before other devices using it.

Adjust some DT_INST macro as well while at it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-22 09:22:55 +02:00
Fabio Baltieri
e9a67aabf7 intc: swerv_pic: convert SYS_INIT to DEVICE_DT_INST_DEFINE
Convert SYS_INIT to DEVICE_DT_INST_DEFINE, this allows the build system
to track the device dependencies and ensure that the interrupt
controller is initialized before other devices using it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-22 09:22:55 +02:00
Fabio Baltieri
aea618ebc0 intc: nuclei_eclic: convert SYS_INIT to DEVICE_DT_INST_DEFINE
Convert SYS_INIT to DEVICE_DT_INST_DEFINE, this allows the build system
to track the device dependencies and ensure that the interrupt
controller is initialized before other devices using it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-22 09:22:55 +02:00
Fabio Baltieri
a7e0cb0c80 intc: vexriscv_litex: convert SYS_INIT to DEVICE_DT_INST_DEFINE
Convert SYS_INIT to DEVICE_DT_INST_DEFINE, this allows the build system
to track the device dependencies and ensure that the interrupt
controller is initialized before other devices using it.

Fix an incorrectly declared compatible and adjust some DT macros as
well.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-22 09:22:55 +02:00
Fabio Baltieri
6fbe62bdb5 intc: arcv2: convert SYS_INIT to DEVICE_DT_INST_DEFINE
Convert SYS_INIT to DEVICE_DT_INST_DEFINE, this allows the build system
to track the device dependencies and ensure that the interrupt
controller is initialized before other devices using it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-22 09:22:55 +02:00
Fabio Baltieri
17ae9a7680 intc: gic: convert SYS_INIT to DEVICE_DT_INST_DEFINE
Convert SYS_INIT to DEVICE_DT_INST_DEFINE, this allows the build system
to track the device dependencies and ensure that the interrupt
controller is initialized before other devices using it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-22 09:22:55 +02:00
Fabio Baltieri
1539ca906e intc: irqmp: convert SYS_INIT to DEVICE_DT_INST_DEFINE
Convert SYS_INIT to DEVICE_DT_INST_DEFINE, this allows the build system
to track the device dependencies and ensure that the interrupt
controller is initialized before other devices using it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-22 09:22:55 +02:00
Fabio Baltieri
843f66f52d intc: plic: convert SYS_INIT to DEVICE_DT_INST_DEFINE
Convert SYS_INIT to DEVICE_DT_INST_DEFINE, this allows the build system
to track the device dependencies and ensure that the interrupt
controller is initialized before other devices using it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-22 09:22:55 +02:00
Guillaume Gautier
a1adc17b31 drivers: adc: stm32: move internal path setting to sensor drivers
On some STM32 families (such as F4), temperature and Vbat sensor share the
same ADC channel, which can lead to conflict when reading them, and wrong
measurement can follow.

To alleviate this problem, this commit moves the setting of the common
path internal channel to the sensor drivers themselves instead of doing
it in the ADC driver.

The teardown is still done in the ADC driver, systematically, instead of
channel by channel (which has the same result).

By moving this logic in the sensor drivers, the properties temp-channel,
vbat-channel and vref-channel becomes useless and are thus removed.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-09-22 09:21:34 +02:00
Piotr Dymacz
634416bc49 drivers: hwinfo: add driver for TI SimpleLink CC13xx/CC26xx series
Introduce hwinfo driver for Texas Instruments SimpleLink CC13xx/CC26xx
SOC series, with support for retrieving device's ID and cause of reset.

By default, the pre-programmed, 8-bytes length IEEE MAC address is used
for device's ID, with option ('HWINFO_CC13XX_CC26XX_USE_BLE_MAC') for
use 6-bytes length BLE MAC instead. By default, read-only values stored
in FCFG (Factory Configuration) are used but additional Kconfig option
('HWINFO_CC13XX_CC26XX_ALWAYS_USE_FACTORY_DEFAULT') is also provided,
which allows to use values from writable CCFG (Customer Configuration)
area. In all cases, device ID value is provided in big-endian which
matches what TI's UniFlash tool returns.

For reset cause, 'SysCtrlResetSourceGet()' function from TI's driver
library is used and its value is mapped to Zephyr's implementation.
Importantly, only root cause of reset is available on CC13xx/CC26xx
platform as described in MCU Technical Reference Manual ('RESET_SRC'
field in 'RESETCTL' register):

  "Shows the root cause of the last system reset. More than the
   reported reset source can have been active during the last
   system reset but only the root cause is reported."

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-09-21 08:07:35 -04:00
Manuel Argüelles
af7d972f4c can: nxp_s32_canxl: use clock control APIs
Use clock control API to retrieve the module's frequency and
update the boards using it to provide the source clocks.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-21 13:37:19 +02:00
Grant Ramsay
663826a9f9 drivers: can: mcan: Add CAN statistics
Add CAN stats for MCAN drivers.

Update MCAN drivers to use CAN_DEVICE_DT_INST_DEFINE
which initialises and registers CAN stats if enabled.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-09-21 13:36:52 +02:00
Ryan McClelland
646ef0b3b1 drivers: misc: ethos_u: rename init.c to ethos_u.c
A file just named `init.c` is not that descriptive inside of a project
that has a lot of files of already. Rename to `ethos_u.c`.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-09-21 13:36:12 +02:00
Ryan McClelland
f4993df937 drivers: misc: ethos_u: fix irq connect
The Ethos-U driver was using IRQ_DIRECT_CONNECT. This is not what the
driver needs as this will not detect a context switch when coming out
of the isr, and this is needed as the isr will release a semaphore.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-09-21 13:36:12 +02:00
Declan Snyder
fe8b112efd dts: bindings: lpadc: Add regulator phandle prop
Add phandle prop to reference any regulator that must
be enabled in order for the LPADC to function as intended.

Change LPADC driver to use this property if present.

LPADC on LPC55S36 depends on VREF peripheral, enable for this platform.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-09-21 09:26:57 +02:00
Declan Snyder
b1d2a8a9b6 drivers: regulator: Add NXP VREF driver
Add binding, include header, and driver for NXP VREF IP block.

NXP VREF is an internal voltage reference generator on some SOCs
that fits well with the regulator API in zephyr.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-09-21 09:26:57 +02:00
Jerzy Kasenberg
0d877e7855 drivers: counter: Fix Smartbond counter get_rate
When timer calibration for SmartBond(tm) was added, opaque type
clock_control_subsystem_t that used to have device tree ordinal
number was changed to enum to allow values that are not in device
tree (like no clock selection).

During this process counter driver for SmartBond(tm) was not updated
accordingly, resulting in wrong frequency being reported to counter
driver.

Failure could be seen when samples/drivers/counter/alarm was execute on
da1469x_dk_pro board.

With this fix counter driver uses correct type when
clock_control_get_rate is called and counter test works again.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-09-20 20:17:11 +01:00
Fabio Baltieri
0e765a9ef8 clock_control: mcux_ccm: include zephyr/arch/cpu.h
Add an explicit include of zephyr/arch/cpu.h before fsl_clock.h so that
the Zephyr cpu definitions are parsed before the hal ones.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-20 17:25:44 +01:00
Anas Nashif
759e07bebe intel_adsp: move memory window setup to PRE_KERNEL_1
PRE_KERNEL_1 is more suited for dealing with devices, so move out of
EARLY.
Verified on hardware and things seem to behave the same. Something was
changed since this was first introduced as this was not possible for
some reason.

Fixes #62627

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-20 15:17:14 +02:00
Ian Morris
a24460a7db drivers: sensor: tmp116: Added ability to read configuration register
Added ability to read contents of TMP116 configuration register by adding
an attribute get function that supports the SENSOR_ATTR_CONFIGURATION
option. Followed the same approach as the TMP108 driver. Interpretation of
the returned value is left up to the caller.

Tested using Nucleo-F401RE and Temp-Log 2 (TMP116) click board and
confirmed a read of the configuration register returned the expected
value.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2023-09-20 11:35:34 +01:00
Johan Lafon
469ba4e367 driver: rtc: stm23: fix build for STM32L1 Cat.1
The Cat.1 STM32L1 MCUs do not provide the subsecond feature. This disable
subsecond related code for these MCUs.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-20 11:34:52 +01:00
Johan Lafon
a63bb6317c drivers: rtc: stm32: allow new RTC driver to work with BBRAM
STM32 BBRAM depends on RTC to work. This changes STM32 RTC init stage to
PRE_KERNEL_1 to allow RTC driver to initialize before BBRAM driver.

Some adjustments are made so that kernel API is not used during the init
procedure.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-20 11:34:52 +01:00
Daniel Gaston Ochoa
0e72d63a01 drivers: spi: stm32h7 Fix SPI DMA 16 bits frames
Modify STM32H7 SPI driver so that it updates the rx/tx
pointers correctly (depending on the frame size) when DMA
is enabled. Also, make the dummy rx/tx buffer cache-coherent.

Signed-off-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
2023-09-20 11:33:28 +01:00
Daniel Gaston Ochoa
8e6b401ca4 drivers: spi: stm32h7 Check nocache memory correctly
The way of setting a nocache region in devicetree has changed.
Adapt the H7 SPI driver to this new circumstance.

Signed-off-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
2023-09-20 11:33:28 +01:00
Eivind Jølsgard
66069b3b39 drivers: serial: uart_nrfx_uarte: coexisting async and interrupt API
This commit fixes an issue with the nrfx uarte driver to allow the
async and interrupt driven UART APIs to coexist on different uart
instances. As both APIs cannot be used simultaneously for a given
instance, there is no need to handle
CONFIG_UART_EXCLUSIVE_API_CALLBACKS in this driver.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
2023-09-20 11:31:41 +01:00
Michał Barnaś
9608c8f667 usbc: fix conflicting Kconfigs for USB-C related init priority
There was a new Kconfig for USB-C init priority that is conflicting
with currently used Kconfig for init of VBUS and TCPC.
This commit changes the names to more specific related to the subsystem
they belong to.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-09-20 11:26:40 +01:00
Brett Witherspoon
4a250c26b1 drivers: counter: fix index of stm32 RTC source clock
The DT_INST_CLOCKS_CELL macro takes as the first argument the device
instance and not the cell index. This change correctly gets the second
index of the first device as intended.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2023-09-20 11:21:40 +01:00
Gerard Marull-Paretas
0660719346 drivers: nrf: select PINCTRL
Drivers for nRF SoCs using pinctrl did not select PINCTRL. This means
boards are forced to enable PINCTRL.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-20 08:57:09 +02:00
Mahesh Mahadevan
bf6ccbb9de drivers: dma_pxp: Select PXP driver when CONFIG_DISPLAY is enabled
The PXP DMA driver is only used by Display drivers.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-09-19 13:36:13 -05:00
Mahesh Mahadevan
2ea6130535 drivers: dma_pxp: Update to the PXP DMA per SDK 2.14 changes
Some macros have been redefined in SDK 2.14

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-09-19 13:36:13 -05:00
Mahesh Mahadevan
ded77bccb3 drivers: pwm: Use the SDK macro to check if wait field is available
Wait enable is available only for certain SoC's

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-09-19 13:36:13 -05:00
Mahesh Mahadevan
24f2dd059e drivers: eth_mcux: Avoid using deprecated SDK function
The SDK function ENET_SetCallback is deprecated and has
been removed in the latest SDK.
Update the driver to set the callback during Init by using
the callback config param.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-09-19 13:36:13 -05:00
Paweł Anikiel
cd67428fec drivers: sensor: ntc-thermistor: Add PM support
Add support for runtime power management.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
2023-09-19 09:28:50 -05:00
Paweł Anikiel
ebdfb6b5e2 drivers: sensor: ntc-thermistor: Add Murata NCP15WB473 thermistor
Add murata,ncp15wb473 property together with a compensation table. The
table can be found on the vendor's website
(Resistance VS. Temperature tab):
https://www.murata.com/en-us/products/productdetail?partno=NCP15WB473F03RC

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
2023-09-19 09:28:50 -05:00
Paweł Anikiel
5db05878ab drivers: sensor: ntc-thermistor: Remove r25-ohm property
Remove the r25-ohm property. It is not used by the driver, and it is
not present in linux.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
2023-09-19 09:28:50 -05:00
Paweł Anikiel
83be5fb596 drivers: sensor: ntc-thermistor: Simplify comp lookup
bsearch() tries to find the exact match for the key, otherwise it
returns NULL. However, here we want to find two elements our key lies
in-between. This requires some rather complicated logic that pretends
it found the exact match even if it didn't. Replace this with a simple
implementation of binary search.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
2023-09-19 09:28:50 -05:00
Paweł Anikiel
694b7fe822 drivers: sensor: ntc-thermistor: Fix wrong n_comp value
The value of n_comp is wrong for ntc-thermistor-generic. Introduce a
helper macro to compute n_comp correctly for both thermistor types.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
2023-09-19 09:28:50 -05:00
Paweł Anikiel
883a0c46a8 drivers: sensor: ntc-thermistor: Fix voltage & resistance calculation
The pullup resistance was assumed to be the maximum ADC value. This is
incorrect when the reference ADC voltage and the thermistor pullup
voltage differ. Use the pullup_uv property from DT instead.

The equations for the thermistor resistance are also wrong. The correct
equations are (see https://en.wikipedia.org/wiki/Voltage_divider):
R1 = R2 * (Vin / Vout - 1)
for the positive-connected resistor, and
R2 = R1 * (Vin / Vout - 1)^-1
for the negative-connected resistor. These were transformed so that
they can be computed using integer math.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
2023-09-19 09:28:50 -05:00
Paweł Anikiel
97e15f2923 drivers: sensor: ntc-thermistor: Fix flipped condition
Fix the flipped condition inside this if statement.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
2023-09-19 09:28:50 -05:00
Ryan Erickson
ea1cf4d2e1 drivers: console: deprecate uart_mux and gsm_mux
GSM_MUX and UART_MUX are being marked as deprecated.
The new modem subsystem MODEM_CMUX and MODEM_PPP
should be used instead.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-09-19 15:25:47 +01:00
Ryan Erickson
aaed347d60 drivers: modem: gsm: Mark as deprecated
The MODEM_GSM_PPP driver is now deprecated in favor of
using MODEM_CELLULAR.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-09-19 15:25:47 +01:00
Fabio Baltieri
196b1d6289 modem: hl7800: replace an snprintk with a strncpy
GCC format-truncation kicks in on this printk whenever the logging
configuration transforms the LOG_WRN below into a noop, and the snprintk
return argument become unused.

Fix that by switching to strncpy, fixes:

zephyrproject/zephyr/drivers/modem/hl7800.c:1786:74: warning: '%s'
directive output may be truncated writing up to 53 bytes into a region
of size 21 [-Wformat-truncation=]

reproduced with:

west build -p -b mg100 -T samples/net/telnet/sample.net.telnet

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-19 15:07:34 +01:00
Yong Cong Sin
7afbcdc619 drivers: intc: plic: fix the calculation of trig register
trig register should be independent of the `riscv,max-priority` property.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-09-18 20:35:22 +02:00
Yong Cong Sin
5b9f82668b riscv: telink_b91: fix compilation
Fix compilation failure due to multilevel interrupt.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-09-18 13:03:45 -04:00
Jilay Pandya
3384ebb00f driver: sensor: adds basic support for analog devices ltc2990
This commit adds Kconfig variables to configure ADLTC2990. This commit adds
basic driver code for analog devices ltc2990 sensor.

Signed-off-by: Jilay Pandya <jilay.pandya@zeiss.com>
2023-09-18 17:41:38 +02:00
Johann Fischer
f67dd39bb2 drivers: ramdisk: use devicetree to instantiate RAM disk
Rework RAM disk driver to be configured using devicetree and
support multiple instances.

This patch also removes a copy of the RAM disk driver,
tests/subsys/fs/fat_fs_dual_drive/src/disk_access_test_drv.c,
that was there for testing multiple disk drivers support.

Bonus: one SYS_INIT() less and a memory region can be exported to the
host.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-09-18 17:36:50 +02:00
Bjarki Arge Andreasen
328b588ceb drivers: modem: modem_cellular: Update script run function
This commit updates the modem_cellular driver to use the
new naming scheme for the modem_chat functions.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-09-18 14:11:40 +01:00
Brett Witherspoon
e363c5e26d drivers: rtc: stm32: use single instance driver
This driver only supports a single instance. This commit cleans up the
device definition and indicates this.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2023-09-18 10:54:04 +01:00
Brett Witherspoon
462a7262be drivers: rtc: stm32: add build assertion for source clock
Assert the source clock is defined in the device tree to ensure the
reference is valid.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2023-09-18 10:54:04 +01:00
Brett Witherspoon
0e8e7a0189 drivers: rtc: stm32: fix cell index of source clock
The DT_INST_CLOCKS_CELL macro takes as the first argument the device
instance and not the cell index. This change correctly gets the second
index of the first device as intended.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2023-09-18 10:54:04 +01:00
Dmytro Firsov
ac0f731b2e xen: add Kconfig option for Zephyr on Dom0less setups
Dom0less is Xen mode without privileged domain. All guests are created
according to hypervisor device tree configuration on boot. Thus, there
is no Dom0 with console daemon, that usually manages console output
from domains.

Zephyr OS contains 2 serial drivers related to Xen hypervisor: regular
with console shared page and consoleio-based. The first one is for
setups with console daemon and usually was used for Zephyr DomU guests.
The second one previously was used only for Zephyr Dom0 and had
corresponding Kconfig options. But consoleio is also used as interface
for DomU output on Dom0less setups and should be configurable without
XEN_DOM0 option.

Add corresponding XEN_DOM0LESS config to Xen Kconfig files and proper
dependencies in serial drivers.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
Co-authored-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
2023-09-18 10:43:45 +01:00
Hein Wessels
3e369ec8ed drivers: spi: stm32: LOG_INF should be LOG_DBG to not clutter console
Drivers should only log extra information during initialization if
debug logging is enabled. Otherwise it always clutters the console
when not required.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-09-18 10:41:41 +01:00
Aaron Massey
a7b25d599b fuel_gauge: Join get/set prop structs
The fuel gauge API uses separate get/set property structs to indicate what
properties are readable or writable. This lead to duplication in property
names and potential confusion for new users of the API. See issue #61818.
In addition to above, drivers already determine at runtime if a property is
supported for read or write actions.

Join the get/set fuel gauge property structs as a single struct.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-18 10:38:59 +01:00
Mathias Storck
4431c4755c drivers: sensor: lis2dh: add tap interrupt
add interrupt for single tap on ST LIS2DH
shared interrupt with any motion

Signed-off-by: Mathias Storck <mathias.storck@gwa-hygiene.de>
2023-09-15 14:42:26 -05:00
Gerard Marull-Paretas
4cf5d5cf8b drivers: misc: ft8xx: move to POST_KERNEL level
There's no need to use APPLICATION level. Also create a custom init
level that runs late in the process (depends e.g. on SPI which runs at
high priority level, 70).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 16:04:19 +02:00
Gerard Marull-Paretas
fe2bca3020 drivers: fpga: move to POST_KERNEL
Devices should be initialized either in pre-Kernel or post-Kernel
stages.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 16:04:19 +02:00
Gerard Marull-Paretas
222409fa49 drivers: display: move to POST_KERNEL
There's no need to use APPLICATION level here.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 16:04:19 +02:00
Benjamin Cabé
6be960ae71 drivers: rtc: drop printk statement from RTC Shell
Remove a printk forgotten in rtc get command.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-09-15 12:11:24 +01:00
Carlo Caione
e4a125b6a4 dt: Make zephyr,memory-attr a capabilities bitmask
This is the final step in making the `zephyr,memory-attr` property
actually useful.

The problem with the current implementation is that `zephyr,memory-attr`
is an enum type, this is making very difficult to use that to actually
describe the memory capabilities. The solution proposed in this PR is to
use the `zephyr,memory-attr` property as an OR-ed bitmask of memory
attributes.

With the change proposed in this PR it is possible in the DeviceTree to
mark the memory regions with a bitmask of attributes by using the
`zephyr,memory-attr` property. This property and the related memory
region can then be retrieved at run-time by leveraging a provided helper
library or the usual DT helpers.

The set of general attributes that can be specified in the property are
defined and explained in
`include/zephyr/dt-bindings/memory-attr/memory-attr.h` (the list can be
extended when needed).

For example, to mark a memory region in the DeviceTree as volatile,
non-cacheable, out-of-order:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_VOLATILE |
			       DT_MEM_NON_CACHEABLE |
			       DT_MEM_OOO )>;
   };

The `zephyr,memory-attr` property can also be used to set
architecture-specific custom attributes that can be interpreted at run
time. This is leveraged, among other things, to create MPU regions out
of DeviceTree defined memory regions on ARM, for example:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-region = "NOCACHE_REGION";
       zephyr,memory-attr = <( DT_ARM_MPU(ATTR_MPU_RAM_NOCACHE) )>;
   };

See `include/zephyr/dt-bindings/memory-attr/memory-attr-mpu.h` to see
how an architecture can define its own special memory attributes (in
this case ARM MPU).

The property can also be used to set custom software-specific
attributes. For example we can think of marking a memory region as
available to be used for memory allocation (not yet implemented):

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_NON_CACHEABLE |
			       DT_MEM_SW_ALLOCATABLE )>;
   };

Or maybe we can leverage the property to specify some alignment
requirements for the region:

   mem: memory@10000000 {
       compatible = "mmio-sram";
       reg = <0x10000000 0x1000>;
       zephyr,memory-attr = <( DT_MEM_CACHEABLE |
			       DT_MEM_SW_ALIGN(32) )>;
   };

The conventional and recommended way to deal and manage with memory
regions marked with attributes is by using the provided `mem-attr`
helper library by enabling `CONFIG_MEM_ATTR` (or by using the usual DT
helpers).

When this option is enabled the list of memory regions and their
attributes are compiled in a user-accessible array and a set of
functions is made available that can be used to query, probe and act on
regions and attributes, see `include/zephyr/mem_mgmt/mem_attr.h`

Note that the `zephyr,memory-attr` property is only a descriptive
property of the capabilities of the associated memory  region, but it
does not result in any actual setting for the memory to be set. The
user, code or subsystem willing to use this information to do some work
(for example creating an MPU region out of the property) must use either
the provided `mem-attr` library or the usual DeviceTree helpers to
perform the required work / setting.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-09-15 12:46:54 +02:00
Dmytro Firsov
3942e3ccff xen: add helper functions for Xen domain memory management
Add wrapper functions for Xen memory managment hypercall. They can be
used for unprivilaged Zephyr guest initialization and for domain
management, when Zephyr is used as Xen Domain 0.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2023-09-15 11:15:00 +01:00
Dmytro Firsov
74b271bc2a xen: change HVM functions signature to run it for other domains
This commit adds possibility to call hypervisor HVM parameter functions
for specified domain (instead of only DOMID_SELF). It is needed for
configuring domains, that were created from Zephyr control domain.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2023-09-15 11:15:00 +01:00
Dmytro Firsov
3581527b53 xen: implement Xen domain control interface
Add Xen domctl API implementation for Zephyr as control domain.

Previously Zephyr OS was used as unprivileged Xen domain (Domain-U),
but it also can be used as lightweight Xen control domain (Domain-0).
To implement such fuctionality additional Xen interfaces are needed.
One of them is Xen domain controls (domctls) - it allows to create,
configure and manage Xen domains.

Also, used it as a possibility to update files copyright and licenses
identifiers in touched files.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2023-09-15 11:15:00 +01:00
Dmytro Firsov
5852dd2b1a xen: events: add event channel allocation for domain-0
This commit adds interface for evtchn allocation that can be used by
privilaged domain. Domain 0 can specify both dom and remote_dom
parameters for hypercall, where in others domains dom should be always
DOMID_SELF. It is needed for creating pre-defined channels during
domain setup in Zephyr Dom0.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2023-09-15 11:15:00 +01:00
Dmytro Firsov
c9d2fb7d40 xen: refactor Xen hypervisor Kconfig options
Xen-related Kconfig options were highly dependand on BOARD/SOC xenvm.
It is not correct because Xen support may be used on any board and SoC.

So, Kconfig structure was refactored, now CONFIG_XEN is located in
arch/ directory (same as in Linux kernel) and can be selected for
any Cortex-A arm64 setup (no other platforms are currently supported).

Also remove confusion in Domain 0 naming: Domain-0, initial domain,
Dom0, privileged domain etc. Now all options related to Xen Domain 0
will be controlled by CONFIG_XEN_DOM0.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2023-09-15 11:15:00 +01:00
Mykola Kvach
62fd5ab3e1 drivers: xen: gnttab: do Xen node mapping inside driver
Move memory mapping of Xen node to Grant Table driver system init
function. After moving mapping we don't need anymore records of
xen-xen node into 'mmu_regions' array, so they were deleted from
all SoCs: Rcar Gen3/Gen4 and XenVM.

We need at least 16M of virtual address space to map memory of Xen
node, so the virtual memory sized has been increased to 32 MB, it
should be enough for basic use-cases and mapping of 16M mem region
of Xen node.

Unfortunately, after moving we also need to increase number of XLAT
tables. The previous code was more efficient if we talking about
usage of XLAT tables, because it mapped grant tables using a higher-
order table that allows mapping blocks of 2MB. And after the changes
is maps every 4KB page, so we need more XLAT tables.

Increase number of grant frames, it is needed to sync stage 1 and stage 2
memory mappings, previously we map only one page on stage 2 and further
usage of unmap regions can cause MMU translation errors.

Perform mapping stage 1 before mapping for stage 2 (add to physmap),
because right after stage 1 we can try to access memory and if it is
unmap in stage 2, error will be received during translation.

Note: Xen Grant Table driver doesn't use Zephyr Device Model.

Authored-by: Mykola Kvach <mykola_kvach@epam.com>
Co-authored-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-09-15 11:15:00 +01:00
Gerard Marull-Paretas
aaeb0a672e toolchain: only include <zephyr/toolchain.h>
It is wrong to use toolchain-specific header files.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 09:27:30 +02:00
Mahesh Rao
f816f787e2 drivers: sip_svc: sip_smc_intel_socfpga: Log execution time
Log execution time for each svc call.

Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
2023-09-15 09:26:49 +02:00
Mahesh Rao
629a6bf106 drivers: sip_svc: sip_smc_intel_socfpga: Fix type error
Fix typo error in code.

Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
2023-09-15 09:26:49 +02:00
Mahesh Rao
17cfcaea13 driver: sip_svc: Add RSU_UPDATE_ADDR function id
Add RSU UPDATE function id in sip_svc to set the RSU UPDATE
ADDRESS in sip_svc_v2 for Intel Agilex SOCFPGA platform.

Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
2023-09-15 09:26:49 +02:00
Mahesh Rao
c5d224abb6 dts: arm64: intel: Change compat string for Intel Agilex SiP SMC driver.
Change compat string from intel,agilex-socfpga-sip-smc
to intel,socfpga-agilex-sip-smc for Intel AGILEX SOC FPGA sip smc driver.

Signed-off-by: Mahesh Rao <mahesh.rao@intel.com>
2023-09-15 09:26:49 +02:00
Martin Jäger
6d67a56d5b drivers: serial: uart_nrfx_uart: fix NRFX_WAIT_FOR result type
This macro expects a bool variable to store the result.

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-09-14 16:51:32 -05:00
Vincent van Beveren
a6db78e2b3 driver: sdhc: added atmel SAM4E hsmci driver
This commit adds support for the ATMEL HSMCI peripheral
for the SAM4E MCU series, enabling native SD card support.

Signed-off-by: Vincent van Beveren <v.van.beveren@nikhef.nl>
2023-09-14 16:46:12 -05:00
Benedikt Schmidt
413267ea4f drivers: adc: add MAX11102-MAX11117 to ADC shell
Add all available instances of the ADC series
MAX11102-MAX11117 to the ADC shell.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-09-14 08:32:46 -05:00
Benedikt Schmidt
666520b8b6 drivers: adc: add driver for MAX11102-MAX11117
Add a driver for the following ADCs:
- MAX11102
- MAX11103
- MAX11105
- MAX11106
- MAX11110
- MAX11111
- MAX11115
- MAX11116
- MAX11117

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-09-14 08:32:46 -05:00
Andrew Sonzogni
9ae9ee7ec4 drivers: flash: stm32: change undefined variable causing build error
Replace an undefined variable.

Signed-off-by: Andrew Sonzogni <andrew@safehear.fr>
2023-09-14 14:35:58 +02:00
Johan Lafon
24a2b6b004 drivers: rtc: stm32: fix build warning
Use a mem_addr_t cast to avoid build warning.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-14 14:35:19 +02:00
Yicheng Li
6ead139b4b mbox: Add NXP MU as a MBOX device
Add a MBOX driver wrapper around the NXP MU, simular to
the existing wrapper around the NXP S32 MRU. This allows Zephyr IPC
to work based on the MU, on a number of NXP boards.

Also update the SHA of NXP HAL to enable the Kconfig for this driver.

Signed-off-by: Yicheng Li <yichengli@google.com>
2023-09-14 14:34:05 +02:00
Gerard Marull-Paretas
691facc20f include: always use <> for Zephyr includes
Double quotes "" should only be used for local headers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-14 13:49:58 +02:00
Daniel Leung
94cc1bf455 ipm: remove ipm_cavs_idc driver
The ipm_cavs_idc driver was used with the old intel_s1000
board which has been removed. On the audio DSP side,
the IDC under CAVS is being handled by SoC layer code.
Now the ipm_cavs_idc is not needed anymore for anything.
So remove it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-09-14 06:24:18 -04:00
TOKITA Hiroshi
9fcfb31c82 drivers: display: ssd1306: Support connecting SPI and I2C at the same
Support connecting different display for each SPI and I2C
at the same time.

In a case like DTS below.

```
&spi1 {
        ssd1306_spi: ssd1306@0 {
		compatible = "solomon,ssd1306fb";
                ...
        };

};

&i2c0 {
        ssd1306_i2c: ssd1306@3c {
		compatible = "solomon,ssd1306fb";
		...
	};
};
```

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-09-13 14:23:24 -07:00
TOKITA Hiroshi
2f7e822705 drivers: display: ssd1306: determin sh1106 by dts compatibility
Determine sh1106 from the `compatibility` value instead of
the SSD1306_CONTROLLER_TYPE setting.

Change the settings in `boards/shields/ssd1306/sh1106_128x64.overlay`
to follow this change.
Remove the SSD1306_CONTROLLER_TYPE from its Kconfig.defconfig,
and set the `compatibility` to `sinowealth,sh1106`.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-09-13 14:23:24 -07:00
TOKITA Hiroshi
91d750ea94 drivers: display: ssd1306: replace SSD1306_REVERSE_MODE by property
When multiple devices are connected, the SSD1306_REVERSE_MODE setting
cannot switch for each device.
Add an equivalent setting to the devicetree properties to replace it.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-09-13 14:23:24 -07:00
TOKITA Hiroshi
237c2aaa79 drivers: display: ssd1306: add dts properties to ssd1306_config
Store properties defined in dts in ssd1306_config's fields.
And replace code that uses DT_INST_PROP (0, ...) by config properties.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-09-13 14:23:24 -07:00
Marko Sagadin
3d5e660903 drivers: serial: native tty: Split in top and bottom
Split the native tty serial driver in a top and bottom to enable using it
with embedded libCs.

Signed-off-by: Marko Sagadin <marko.sagadin42@gmail.com>
2023-09-13 16:36:43 +02:00
Jeppe Odgaard
30a2326d0b drivers: sensor: qdec_mcux: update phase bit in register
Update single phase bit in register when changing data->qdec_config.
Otherwise the changed settings has no effect.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-09-13 16:35:07 +02:00
Ryan McClelland
10b85602e6 drivers: i3c: fix cdns-i3c builds with I3C_USE_IBI=n
The Cadence I3C was not building with CONFIG_I3C_USE_IBI, this fixes
the build and will give a small code size reduction when enabled.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-09-13 16:32:55 +02:00
Manimaran A
9b6c933678 drivers: mchp: kscan: low power mode enabled
KSCAN driver updated to support low power feature

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-09-13 16:32:37 +02:00
Ryan McClelland
1b63e49b3f drivers: i3c: cdns: fix transfers while not idle
If a transfer happen in rapid sucession. It was possible for
the core to not be ready to accept another command. Poll on
the idle status bit until the core is ready to accept new data.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-09-13 16:28:55 +02:00
Ryan McClelland
696acc78e0 drivers: i3c: cdns: fix reading error after transfer
Due to a bug, after a completed transfer happen. Only the first
command response error was read. This fixes the issue so all
commands are read for if an error occurred.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-09-13 16:28:55 +02:00
Benjamin Lemouzy
75bc80d86f drivers: audio: tas6422dac: add driver
Add Texas Instruments TAS6422 DAC driver.

Signed-off-by: Benjamin Lemouzy <blemouzy@centralp.fr>
2023-09-13 16:27:11 +02:00
Mourad Kharrazi
a85ffa8130 drivers: sdhc: allow bandwidth selection
The current implementation uses both, host and card capabilites to derive
the maximum bus width to be used. However, in cases where a MMC device is
not connected to the host via shdc using the full bus width of 8 lines,
device initialization fails. Introducing the `bus-width` property
circumvents this by reducing the host bus capabilites and forcing
communication with the MMC device using 1, 4 or 8 lines.

Signed-off-by: Mourad Kharrazi <mourad.kharrazi@ithinx.io>
2023-09-13 16:20:59 +02:00
TOKITA Hiroshi
cf242016b4 drivers: counter: Add support for rpi_pico timer
Adds support for rpi_pico timer

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-09-13 16:18:44 +02:00
Fabio Baltieri
c99f7ec019 drivers: fuel_gauge: fix i2c_dump_msgs_rw argument
Fix another i2c_dump_msgs_rw:

/drivers/fuel_gauge/bq27z746/emul_bq27z746.c:282:26: warning: passing
argument 1 of ‘i2c_dump_msgs_rw’ from incompatible pointer type

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-13 12:37:32 +01:00
Weiwei Guo
2779dd9d9b drivers: sensor: bmm150: Add trigger support for bmm150 magnetometer sensor
Add bmm150 magetometer sensor data ready trigger support.

Signed-off-by: Weiwei Guo <guoweiwei@syriusrobotics.com>
2023-09-13 12:07:57 +02:00
J.P. Hutchins
d7313388c9 drivers: flash: fix hw write protect before sw
This change sets write-protect pin disabled BEFORE SW write-protect disable
and  write-protect pin enabled AFTER SW write-protect enable.

Signed-off-by: J.P. Hutchins <jp@intercreate.io>
2023-09-13 12:07:27 +02:00
J.P. Hutchins
b403fdee00 drivers: flash: cleanup #ifs; fix missing ;
Fixes made running tests/drivers/flash

Signed-off-by: J.P. Hutchins <jp@intercreate.io>
2023-09-13 12:07:27 +02:00
J.P. Hutchins
a9ac01c457 drivers: flash: add LOG_ERR for pin init
-ENODEV returned in 4 cases, logs can distinguish

Signed-off-by: J.P. Hutchins <jp@intercreate.io>
2023-09-13 12:07:27 +02:00
J.P. Hutchins
19ba93c896 drivers: flash: implement wp-gpios and hold-gpios
Adds the wp-gpios & hold-gpios from jedec,spi-nor compatible to spi_nor.c.

Signed-off-by: J.P. Hutchins <jp@intercreate.io>
2023-09-13 12:07:27 +02:00
Nick Ward
17f2046821 drivers: sensor: current_amp: add driver
Add current sense amplifier driver.

Implements https://github.com/zephyrproject-rtos/zephyr/issues/60415

Co-authored-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-09-13 12:05:52 +02:00
Marcel Krüger
387f3c2092 drivers: fuelgauge: Add TI BQ27z746 driver
Add driver for the Texas Instruments BQ27z746 fuel gauge

Signed-off-by: Marcel Krüger <marcel.krueger@ithinx.io>
2023-09-13 12:05:04 +02:00
Manimaran A
b328e920b6 drivers: spi: Microchip MEC172x SPI fix for Zephyr 3.4 breakage
Zephyr version 3.4 changed the SPI context structure and macros
which broke the logic in the MEC172x SPI driver configuration API.
This was not detected by CI due to no tests for this driver are in
the tree. The driver now behaves like most other SPI drivers requiring
a different configuration structure pointer to be passed if any item
in the configuration changes.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-09-13 12:01:18 +02:00
Erwan Gouriou
9f52fac1ea driver: entropy: stm32: Enable PM
Enable PM on STM32 entropy driver.
Only supports PM_DEVICE for now, runtime support will be added later.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-09-13 11:50:04 +02:00
Andy Sinclair
dd52908fcf drivers: regulator: npm1300: Set voltage checks existing setting
Regulator voltage setting is not applied if the device output
is already configured for the requested voltage.
This change is needed to ensure correct device behaviour.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-09-13 11:48:33 +02:00
Andy Sinclair
49ef9be4b9 drivers: regulator: npm1300: Add PFM mode
Set regulator mode updated to support forced PFM mode

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-09-13 11:48:33 +02:00
Max van Kessel
5670bad505 drivers: clock: stm32: overdrive after sysclock
According to the reference manual the overdrive should be enabled after
setup of the sysclock (HSE or HSI) and enabling the PLL (PLLON).
The flash latency should be enabled after the PLL has been turned on,
but before switching the system clock to the PLL.

Signed-off-by: Max van Kessel <max_van_kessel@msn.com>
2023-09-13 11:37:05 +02:00
Huifeng Zhang
2c22e83dfb include: arch: arm: Remove aarch32 directory
This commit follows the parent commit work.

This commit introduces the following major changes.

  1. Move all directories and files in 'include/zephyr/arch/arm/aarch32'
    to the 'include/zephyr/arch/arm' directory.

  2. Change the path string which is influenced by the changement 1.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-09-13 10:08:05 +01:00
Declan Snyder
dbbdd3c6cf drivers: wdt_mcux_wwdt: Fix warning callback
Warning callback by default is configured to happen
at the same time as reset, which results in unexpected
behavior from the point of view of Zephyr API. Return
-ENOTSUP from install_timeout if trying to set up
callback with 0 warning time, and add kconfig to configure
the warning time.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-09-13 09:16:33 +02:00
Johan Lafon
244b437a0d drivers: rtc: stm32: disable calibration for STM32F2 and some STM32L1
STM32F2 and STM32L1 Cat. 1 only provide the coarse calibration feature
which is not supported by the code yet.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
b06a119f2f drivers: rtc: stm32: fill all rtc_time fields
Set tm_yday and tm_isdst to -1 as theses values are unknown.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
961c465efb drivers: rtc: stm32: use Zephyr BCD<->bin conversion functions
This replaces the verbose LL_RTC_CONVERT_BCD2BIN and LL_RTC_CONVERT_BIN2BCD
by the bcd2bin and bin2bcd Zephyr provided equivalent

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
a8b7076099 drivers: rtc: stm32: ensure thread safe operations
This adds mutex a lock in rtc_stm32_set_time and rtc_stm32_get_time to
ensure consistent data reading. Also performs register reading in a single
operation in rtc_stm32_get_calibration for the same reason.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
e46aff5902 drivers: rtc: stm32: avoid using LL_RTC_Init
LL_RTC_Init() internally uses LL_RTC_EnterInitMode() wich uses a blocking
while loop. This rewrite uses the less CPU time wasteful local
rtc_stm32_enter_initialization_mode() instead. As a side effect
LL_RTC_InitTypeDef in rtc_stm32_config is not needed anymore.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
a4f5f87e29 drivers: rtc: stm32: avoid infinite blocking loop
Use the less CPU intensive and timeout capable WAIT_FOR zephyr provided
macro

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
cdab80eece drivers: rtc: stm32: avoid reset induced time drift
Calling LL_RTC_Init causes the RTC to stop while being configured thus
inducing time drift. This commit avoids doing it at each reset if the RTC
is already properly configured.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
9e202e57e9 drivers: rtc: stm32: avoid potential erroneous readings
As shadow registers bypass is enabled, an erroneous reading may occur at
each day or second increment. This commit fixes this issue.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
4eac3db1b9 drivers: rtc: stm32: check if tm_wday is set
tm/rtc_time structure allow for tm_wday to be set to -1 if unknown but RTC
is expecting it

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
f0b3e4e850 drivers: rtc: stm32: check if year is supported by RTC
RTC does not support year before 2000 while tm/rtc_time structure
reference year is 1900

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
16de401e79 drivers: rtc: stm32: fix day of the week conversion
The conversion used was working but not consistent with values given by
reference manuals.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
29fa718941 drivers: rtc: stm32: fix wrong nanosecond value
SSR register does not contain direct nanosecond value. This adds the
necessary conversion.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Johan Lafon
8aa6531aed drivers: rtc: stm32: add calibration feature
This adds the set_calibration and get_calibration API functions to the
STM32 RTC driver

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-09-12 17:23:47 +01:00
Aaron Massey
c6fd21c5de emul: Remove unused ZTEST_DMEM in sbs emulator
The redefinition of ZTEST_DMEM in the SBS emulator is unused. We ought to
remove it as it's dead code.

Remove the unused #define ZTEST_DMEM.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-12 17:23:00 +01:00
Aaron Massey
8035ec69fa emul: Add syscall support for fuel gauge emulators
In order to ease user thread testing with fuel gauges, enable syscalls for
the fuel gauge emulator backend API.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-09-12 17:23:00 +01:00
Brian Juel Folkmann
8b6382e68d drivers: flash: stm32 ospi: jedec_id read wrongly
Manufacturer id is skipped when reading jedec_id, due to wrong
address mode.
Before: flash_stm32_ospi: Jedec ID = [60 20 00]
After:  flash_stm32_ospi: Jedec ID = [ef 60 20]

Signed-off-by: Brian Juel Folkmann <bju@trackunit.com>
2023-09-12 16:29:47 +02:00
Erwan Gouriou
9b56e8ac63 Revert "drivers/spi: stm32: fix TX-only mode"
This reverts commit 31cd3b1f61.

This change is causing regression in SPI loopback tests.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-09-12 14:45:37 +02:00
Marek Pieta
44c723e65d drivers: gpio_nrfx: Allow to disable interrupt support
Change introduces a new configuration option that can be used to disable
GPIO interrupt support to reduce memory footprint.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2023-09-12 14:38:06 +02:00
Markus Fuchs
ba57c1880c drivers: bluetooth: slz_hci: Set Number of Completed Packets threshold
Configure the Number of Completed Packets event threshold to 1, so the
SiLabs Bluetooth controller will always send the Number of Completed
Packets HCI event to the host, even for small numbers of transmitted
packets.

Fixes #62279

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2023-09-12 11:23:14 +02:00
Markus Fuchs
c33492655f drivers: bluetooth: slz_hci: Adapt to library BLOBs version 4.2.4
Make HCI driver compatible to the updated versions of the
EFR32 Bluetooth library BLOBs consisting of:
* libbluetooth_controller
* libbgcommon
* librail

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2023-09-12 11:23:14 +02:00
Fabio Baltieri
a1afaa8b47 drivers: ioapic: declare the device with DEVICE_DT_INST_DEFINE
Use DEVICE_DT_INST_DEFINE instead of DEVICE_DEFINE to declare the device
structure. This ensures that the device gets an ordinal and is
initialized before any device depending on it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-12 10:56:46 +02:00
Kong Li
2749b3beb0 drivers: gpio: Add Intel SEDI gpio driver
Add a new GPIO shim driver for Intel Socs. Builds upon the SEDI bare
metal gpio driver in hal-intel module.

Signed-off-by: Kong Li <li.kong@intel.com>
2023-09-12 10:56:08 +02:00
Sreeram Tatapudi
fd04f8cc81 drivers: spi: Initial version of the Infineon CAT1 SPI driver
Initial version of Infineon CAT1 SPI Driver supporting synchronous
and asynchronous data transfer API

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2023-09-12 10:55:01 +02:00
Jamie McCrae
72167f2acf drivers: flash: nrf_qspi_nor: Add support for XIP at boot
Adds support for forcing XIP support at boot time, and reduces the
init priority of the driver so that it inits earlier.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-09-12 09:35:21 +02:00
Declan Snyder
e48714949e drivers: pwm_mcux_sctimer: Use clock control API
Use zephyr clock control api instead of hal functions
directly in the sctimer driver

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-09-12 09:23:46 +02:00
Declan Snyder
97c2ef6666 drivers: clock_control_mcux_syscon: add sctimer
Add SCTIMER key to syscon clock control

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-09-12 09:23:46 +02:00
David Lamparter
a532dbab51 doc: list ST7735S alongside ST7735R
Throw ST7735S into a few places so people can find it.

Signed-off-by: David Lamparter <equinox@diac24.net>
2023-09-11 20:05:26 +02:00
David Lamparter
ea717bba21 drivers: display: st7735r: support ST7735S
ST7735S requires the COLMOD command be repeated as part of writing
pixels, otherwise it goes back to some kind of default which is likely
wrong.

ST7735S works correctly after this plus the previous two commits; tested
on STM32L462 + KD0096FM.

Signed-off-by: David Lamparter <equinox@diac24.net>
2023-09-11 20:05:26 +02:00
David Lamparter
19113d6e8c drivers: display: st7735r: hold CS for pixels
Use a continuous transaction with CS kept low for the entire batch of
row address, column address and actual pixel data write.  This is
required by ST7735S and shouldn't hurt elsewhere.

Signed-off-by: David Lamparter <equinox@diac24.net>
2023-09-11 20:05:26 +02:00
David Lamparter
64c46ae56a drivers: display: st7735r: add hold-CS transmit()
ST7735S support (separate commits) needs this.

Signed-off-by: David Lamparter <equinox@diac24.net>
2023-09-11 20:05:26 +02:00
David Lamparter
31cd3b1f61 drivers/spi: stm32: fix TX-only mode
When doing a TX-only SPI operation, the RX not empty flag will never get
set, thus this will just hang forever.

Found/tested on STM32L462 trying to drive some WS2812 RGB LEDs.

Signed-off-by: David Lamparter <equinox@diac24.net>
2023-09-11 19:56:25 +02:00
Henrik Brix Andersen
9bd62f16b6 drivers: can: add tcan4x5x CAN controller driver
Add driver for the TI TCAN4x5x series of CAN controllers. These CAN
controllers are based on the Bosch M_CAN IP and interfaced via an SPI bus.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-09-11 19:55:44 +02:00
Albort Xue
2ffead788b drivers: dac: Add driver for mcux lpdac
Create dac_mcxu_lpdac.c file to implement mcux lpdac, add binding for
the mcux lpdac, update Kconfig.mcux and CMakeLists.txt file to support
mcux lpdac.

Signed-off-by: Albort Xue <yao.xue@nxp.com>
2023-09-11 19:55:26 +02:00
Rick Talbott
a07b79a8bf drivers: sensor: tsl2540
Add the tsl2540 sensor to drivers.

Signed-off-by: Rick Talbott <richard.talbott1@t-mobile.com>
2023-09-11 19:54:59 +02:00
Fabio Baltieri
5e63058deb sensor: bq274xx: use K_TIMEOUT_ABS_MS for the startup delay
Use K_TIMEOUT_ABS_MS to control the startup delay. Same thing, more
compact.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-11 08:57:42 -05:00
TOKITA Hiroshi
e2f47c0c38 drivers: i2c: i2c_dw: Add capability for handling reset device
Reset the device on initializing if reset-node is available in dts.
`snps,desingware-i2c` does not define reset-node itself.
Add more of an element that inherits `reset-device.yaml` to
the `compatible` section to allow defining the reset-node
for using this feature.

For example.

```
compatible = "reset-device-inherit-node", "snps,designware-i2c";
```

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-09-11 11:10:12 +02:00
Martin Kiepfer
dbf3768af9 drivers: axp192_gpio: Fix for latest get_direction unit test
This commit resolves an internal dependecy between GET_DIRECTION and
GET_CONFIG configuration. GET_CONFIG api is internally needed by
GET_DIRECTION api.

Signed-off-by: Martin Kiepfer <m.kiepfer@teleschirm.org>
2023-09-11 11:06:36 +02:00
Keith Short
c9f822df27 gpio: nct38xx: Remove reg access wrappers
Remove the register access wrappers used to read/write the NCT38xx
register space.

Signed-off-by: Keith Short <keithshort@google.com>
2023-09-11 11:00:47 +02:00
Keith Short
ea40f3af24 mfd: Add NCT38xx multi-function driver
The Nuvoton NCT38xx is a multi-function device providing a TCPC
controller and a I/O expander (GPIO driver).  Add a multi-function
driver to manage exclusive access to the device.

Tested with "twister -T tests/drivers/build_all/gpio".

Signed-off-by: Keith Short <keithshort@google.com>
2023-09-11 11:00:47 +02:00
Keith Short
617c7cb337 gpio: nct38xx: Cleanup semaphore usage
Cleanup the semaphore usage in the NCT38xx GPIO driver.

Signed-off-by: Keith Short <keithshort@google.com>
2023-09-11 11:00:47 +02:00
Sven Ginka
bc695c6df5 drivers: sam dma xdmac: implemented dma device get_status()
the sam xdmac driver does not yet implement the
get_status() function. with this commit the function
will be implemented. Fixes #62003

Signed-off-by: Sven Ginka <sven.ginka@gmail.com>
2023-09-10 00:49:12 +02:00
Mateusz Sierszulski
8db11e6a0a drivers: spi: Add Ambiq MSPI driver
This commit adds MSPI driver for Apollo4 SoCs.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-09-08 14:44:12 +02:00
Fabio Baltieri
3d713a42e8 display: ssd1306: add some init delay
Seems like the SSD1306 controller needs a bit of time after power up
before it can take i2c commands. This causes problems with
microcontrollers that have no other delays in the startup sequence, like
rpi_pico.

There's currently no good way of modeling this in Zephyr right now, and
there's also no clear indication of how much time the device needs in
the datasheet that I could find, but it seems like 10ms is enough for
that to start reliably so add a delay in the ssd1306 init function to
ensure that at least that time has passed from system power up.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-08 14:44:03 +02:00
Mulin Chao
eacdadf270 driver: adc: npcx: remove threshold-reg-offset DT property
Remove `threshold-reg-offset` DT property and implement them with static
inline functions in `reg_def.h`

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-09-08 14:43:37 +02:00
Mulin Chao
d2892c1123 driver: sensor: npcx: add 'thr-sel' prop. for adc comparator
Add `thr-sel` prop. to select the relevant threshold register for adc
comparator since there're two adc modules in npcx4 series.

Signed-off-by: Kate Yen <htyen@nuvoton.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-09-08 14:43:37 +02:00
Mulin Chao
72ee4f75ef driver: adc: npcx: add multi-device support in npcx adc driver
Add multi-device support in npcx adc driver since there is more than one
adc module in npcx4 series. And each adc's reference voltage might be
different, this CL introduces the `vref-mv` prop. to select its own
reference voltage.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Signed-off-by: Kate Yen <htyen@nuvoton.com>
2023-09-08 14:43:37 +02:00
Jiang Wei W
a5f4beccd2 drivers: ipm: add init version of sedi ipm driver
add init version of sedi ipm driver

Signed-off-by: Jiang Wei W <wei.w.jiang@intel.com>
2023-09-08 14:43:17 +02:00
Florian Grandel
f7e5a103b6 drivers: serial: uart_cc13xx_cc26xx: fix race
Fixing a race in tx/rx_constrained flag access.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-08 09:26:34 +02:00
Fabio Baltieri
c03d0f83c8 drivers: charger: fix i2c_dump_msgs_rw argument
Fixes:

zephyr/drivers/charger/emul_sbs_charger.c:70:26: warning: passing
argument 1 of ‘i2c_dump_msgs_rw’ from incompatible pointer type
[-Wincompatible-pointer-types]

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-07 21:41:31 +02:00
Gerard Marull-Paretas
64968d7402 drivers: gpio: fix optional operations usage
Only provide implementations for optional operations if needed. This
patch deletes quite a few dummy `pin_interrupt_configure` ops (now
optional), and adjusts ifdeffery on some drivers so that optional ops
are only provided if they implement real functionality.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-07 20:18:33 +02:00
Jerzy Kasenberg
48c56cebaa drivers: gpio: Smartbond: Add pdc support
This change allows to have GPIO interrupts configured
that will work while chip enters low power modes where
PD_COM is turned off.

PDC controller can wake up system on GPIO changes even when
PD_COM is off.

This is done by adding PDC entries that will wakeup Cortex-M33
at the same time when WAKEUP controller is programmed to
handle GPIO state changes.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-09-07 20:16:56 +02:00
Jerzy Kasenberg
a9b44e08df drivers: gpio: Smartbond: add support for both edge triggers
Hardware supports only one edge for GPIO interrupt.
This adds software implementation that hides hardware restriction.

With this change user code can use GPIO_INT_TRIG_BOTH and does not
have to do it in application code.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-09-07 20:16:56 +02:00
Jerzy Kasenberg
766af4cc0c drivers: gpio: Smartbond: correct gpio init level
Init level for GPIO drivers is set PRE_KERNEL_1.
Smartbond(tm) driver had it set to POST_KERNEL by accident.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-09-07 20:16:56 +02:00
Ricardo Rivera-Matos
aee815f19d charger: Sample sbs charger driver with tests
Adds a sample sbs charger driver and basics tests.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2023-09-07 13:03:13 -04:00
Ricardo Rivera-Matos
a7adb06ff4 charger: Initial charger dedicated API
Add initial charger driver API with the most basic of native_posix
driver tests.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2023-09-07 13:03:13 -04:00
Benedikt Schmidt
536f8ae9cd drivers: dac: add driver for AD568xx
Implement a driver for the DAC AD56xx series.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-09-07 08:48:32 -05:00
Fabio Baltieri
22fbd73fab sensor: max17055: fix v_empty setting
Fix the whole v_empty setting code, this was using a wrong scaling
factor, but also incorrectly clearing the recovery voltage part of the
register.

Change the code to read the previous value and mask out the bits not
used by VE.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-07 14:25:47 +02:00
Fabio Baltieri
02afefe34a sensor: f75303: fix i2c_dump_msgs_rw argument
i2c_dump_msgs_rw argument should be the device pointer.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-07 13:41:12 +02:00
Tim Lin
8a779fc706 ITE: drivers/i2c/target: Introduce I2C target transfer using PIO mode
Introduce I2C target transfer using the PIO mode. Add an option
"target-pio-mode" in the yaml file, determined by the DTS, to dictate
whether I2C target transfer uses the PIO mode.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-09-07 09:43:06 +02:00
Tim Lin
3ae9a358fb ITE: drivers/i2c/target: Disable the timeout setting
Disable the timeout setting when both the clock and data are
in a low state. This allows for I2C host clock stretching
without a timeout limit.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-09-07 09:43:06 +02:00
Tim Lin
5de9203af3 ITE: drivers/i2c/target: Cleanup the clear status flow of I2C target
IT8XXX2_I2C_STR is a register of read-only, non-writable to clear.
Here we can set hardware reset bit in the IT8XXX2_I2C_CTR register
to clear the status of IT8XXX2_I2C_STR.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-09-07 09:43:06 +02:00
Paweł Anikiel
43668c6416 drivers: sensor: Add F75303 driver
Add driver for F75303 temperature sensor IC.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
2023-09-07 09:42:59 +02:00
Najumon B.A
a68204d8b8 arch: x86: update with new acpica lib interface
The old acpi implimentation is replaced with acpica interface
and updated x86 arch porting with the new interface.

Signed-off-by: Najumon B.A <najumon.ba@intel.com>
2023-09-07 09:42:38 +02:00
Hein Wessels
1732651062 drivers: pwm: stm32: support capturing on four channels
Previously the pwm capture only support capturing on channel 1
and 2, because the slave mode controller was used, which uses
the signal TIxFP which is not available for channel 3 and 4.

This commit adds optional support for four channel capturing by
changing the method of capturing PWM signals to not use the
slave mode controller to reset the counter register. Instead the
counter is reset in the ISR. This will result in a slight loss
of accuracy but is still within an acceptable range.

Co-authored-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-09-07 09:42:25 +02:00
Michał Barnaś
2bc7dcdc2e i2c: add filtering of i2c dumped messages
This commit adds option to dump i2c messages of only specified
devices. It makes it easier to debug communication of specific
i2c device instead of logging all i2c communication.
The filter of devices is specifiec in device-tree using the
node with "zephyr,i2c-dump-filter" compatible string.

Example of device-tree node:
i2c-dump-filter {
	compatible = "zephyr,i2c-dump-filter";
	devices = < &display0 >, < &sensor3 >;
};

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-09-06 17:54:53 +02:00
Michał Barnaś
4c49d095fc i2c: improve the message dumps messages
This commit changes the format of printed messages to align the
following strings and make it more readable.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-09-06 17:54:53 +02:00
Michał Barnaś
4aac1756a9 i2c: use device instead of name for i2c dump messages
This commit changes the parameter of i2c_dump_msgs function from
string name to pointer to the device structure.
It allows for comparison of device pointers and allow to use
the printed device name in i2c shell commands.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-09-06 17:54:53 +02:00
Diogo Correia
168791e08a winc1500: fix undefined declarations
LOG_LEVEL > LOG_LEVEL_OFF guards were protecting a couple of function
declarations. These functions were being used without taking this fact
into consideration. These guards are now applied around the stack_stats()
function only.

Signed-off-by: Diogo Correia <diogo.correia@fraunhofer.pt>
2023-09-06 11:44:20 +02:00
Dat Nguyen Duy
92f3fb79fe drivers: pwm: introduce PWM driver for NXP S32 EMIOS
This introduces PWM driver with supporting PWM output
APIs based on NXP S32 EMIOS peripheral. This supports
three mode: OPWFMB, OPWMCB and OPWMB.

OPWFMB uses internal counter, the new period and duty
cycle takes effect immediately.

OPWMCB and OPWMB use external counter as timebase, changing
PWM period at runtime will impact to all channels share the
same timebase. Also the new period and duty cycle take effect
in next period boundary of the timebase

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-06 11:44:00 +02:00
Dat Nguyen Duy
e5e2f2fad8 drivers: misc: add NXP S32 eMIOS driver
This PR adds a misc driver for NXP S32 eMIOS peripheral.
eMIOS provides multiple unified channels (UCs), there are
several channels can be used as reference timebase
(master bus) for other channels. At this time, the
driver does initialize global configuration for eMIOS

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2023-09-06 11:44:00 +02:00
Bjarki Arge Andreasen
2d2d3ececd drivers/modem/modem_cellular.c: Improve bus pipe usage
This commit improves the usage of the bus pipe (connected
to UART) to only open it when the modem is actually
powered and ready, not when leaving the idle state. This
ensures the pipe is flushed before sending the init script,
and re-enables the UART driver if it is disabled due to
errors.

While building a test platform based on the nRF9160 and a
Quectel BG95, it was discovered that the nRF9160 correctly
throws UART errors if the RX is enabled while the UART RX
line is low (which was due to the modem being powered
down).

The improvements should also help help remove the
"<wrn> modem_chat: receive buffer overrun" warning which
would occur during startup as the pipe was opened, but
nothing was receiving the data, causing the buffer to
overflow.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-09-06 09:35:34 +02:00
Albert Jakieła
dd4ef7d2b5 drivers: sensor: Add PM support to LM75 digital temperature sensor
Add support for device power management. When the sensor
is not powered, the fetch function will fail. When the
sensor is not connected to a power domain, it will behave
as usual.

Signed-off-by: Albert Jakieła <aja@semihalf.com>
2023-09-05 09:49:42 -05:00
Jordan Yates
72c94d982c bluetooth: hci: spi: warn about l2cap MTU values
`CONFIG_BT_L2CAP_TX_MTU` drives the maximum supported MTU on a Bluetooth
connection, but the SPI backend also imposes its own hidden limits.

Display a warning if a value is chosen that can result in failures to
send. This is done here instead of as a range on `BT_L2CAP_TX_MTU` as
ranges on that symbol are already defined in terms of software features,
which would conflict with this check.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-09-05 11:41:33 +02:00
Laczen JMS
c64e806b63 flash: correct missing erase handler
flash_handlers was missing the required z_vrfy_flash_erase function

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2023-09-05 11:40:43 +02:00
Chien Hung Lin
cad51f874c driver: wifi: eswifi: Fix spi buffer length
The eswifi spi driver sets up spi buffer length as number of frames,
but the length shall be number of bytes. Because eswifi use 16 bit as
frame size, so this turns out reading and writing half of data and
fails to sending any at command request and getting any responds from
eswifi module.

Fix it by setting up length as number of bytes.

Fixes #62056

Signed-off-by: Chien Hung Lin <chienhung.lin.tw@gmail.com>
2023-09-05 10:05:37 +02:00
Fabio Baltieri
1ddabfa8d8 dai: intel: dmic: fix shadow variable
Fix a shadow variable build error:

dmic_nhlt.c: In function 'dai_dmic_write_coeff':
dmic_nhlt.c:57:78: error: declaration of 'base' shadows a global
declaration [-Werror=shadow]

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-04 19:35:56 -04:00
Adrian Warecki
b26921d776 dai: intel: dmic: New functions for writing fir coefficients
Created set of new functions for configure fir coefficients with support
for packed format. This allowed to make the dai_dmic_set_config_nhlt
function simpler.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-09-04 15:30:00 -04:00
Adrian Warecki
cba9ec10c3 dai: intel: tgl: dmic: Refactor of dai_nhlt_dmic_dai_params_get function
Added reading of a necessary register values in
dai_nhlt_dmic_dai_params_get function to simplify its parameter list. The
code that calculates dai_params has been moved to it to simplify the
dai_dmic_set_config_nhlt function.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-09-04 15:30:00 -04:00
Adrian Warecki
c28e8ba9ba dai: intel: dmic: Add pdm_base and pdm_idx variables in blob parser
More verbose variable pdm_idx was used instead of n. The series of
references to the array of pdm base addresses has been replaced with
a pdm_base variable.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-09-04 15:30:00 -04:00
Adrian Warecki
2452aaad50 dai: intel: dmic: Separate fir configuration code into function
All fir filters have an identical set of registers so their definitions
were combined to simplify the code. From the dai_dmic_set_config_nhlt
function, a duplicate piece of code responsible for configuring fir was
separated into a new function.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-09-04 15:30:00 -04:00
Adrian Warecki
f74fd8edaf dai: intel: ace: dmic: Add dai_dmic_start_fifo_packers function
Created dai_dmic_start_fifo_packers function corresponding to an already
existing dai_dmic_stop_fifo_packers.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-09-04 15:30:00 -04:00
Adrian Warecki
76d03e798f dai: intel: ace: dmic: Using the WAIT_FOR macro in waiting functions
The while loop in the code fragments waiting for a bit to be cleared has
been replaced with the WAIT_FOR macro call. Added a warning in the case of
timeout.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-09-04 15:30:00 -04:00
Adrian Warecki
3fbaed4de9 dai: intel: ace: dmic: Refactor of dai_nhlt_dmic_dai_params_get function
Added reading of a necessary register values in
dai_nhlt_dmic_dai_params_get function to simplify its parameter list. The
code that calculates dai_params has been moved to it to simplify the
dai_dmic_set_config_nhlt function.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-09-04 15:30:00 -04:00
Adrian Warecki
d7672af838 dai: intel: dmic: Combine PDM registers definitions
All PDM controllers have the same set of registers. Their definitions have
been merged to simplify the code.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-09-04 15:30:00 -04:00
Adrian Warecki
8ea53d49b6 dai: intel: dmic: nhlt: Move debug print code to a separate functions
Moved code fragments responsible for logging and verification of the
configuration register values from the dai_dmic_set_config_nhlt function to
a separate functions. Behavior of the code verifying the correctness of
register values has been changed so that it only displays warnings.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-09-04 15:30:00 -04:00
Adrian Warecki
81944c5c62 dai: intel: dmic: Move definitions of nhlt structures to a new file
Definitions of a configuration blob structures were separated from the main
drivers header file and moved to a dedicated file to improve code
readability. Removed unnecessary nhlt_pdm_fir_coeffs structure.
The nhlt_pdm_ctrl_cfg structure was extended with nhlt_pdm_ctrl_fir_cfg
and fir coefficients.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-09-04 15:30:00 -04:00
Fabio Baltieri
5f0efb94fa modem: modem_chat,modem_cmux: fix mismatched CONTAINER_OF
Add a missing k_work_delayable_from_work to go from k_work to
k_work_delayable.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-04 16:54:56 +02:00
Prashanth S
05fe627d79 drivers: interrupt-controller: Add VIM Interrupt Controller support
Add TI VIM (Vectored Interrupt Manager) interrupt controller support.
VIM is a TI specific custom interrupt controller for ARM cores.
In J721E soc, VIM aggregates interrupts to Cortex R5 cores.

TRM for J721e https://www.ti.com/lit/zip/spruil1
File: spruil1c.pdf
VIM: section 6.3.3.6

Signed-off-by: Prashanth S <slpp95prashanth@yahoo.com>
2023-09-04 10:53:09 +02:00
Marc Herbert
f0fd9f1713 drivers: hda: insert an empty ";" statement before switch() labels
Only statements can be labeled in C, a declaration is not valid. This is
an FAQ.

While compilers currently in use don't seem to care, the "sparse" static
analyzer complains loudly (and cryptically):

https://github.com/thesofproject/sof/actions/runs/6052920348/job/16427323549

```
drivers/dma/dma_intel_adsp_hda.c:190:17: error: typename in expression
drivers/dma/dma_intel_adsp_hda.c:190:26: error: Expected ; at end of stmt
drivers/dma/dma_intel_adsp_hda.c:190:26: error: got rp
```

Add an empty ";" statement after each label makes `sparse` and probably
others happy.

Also add missing `const` to constants for clarity.

Fixes commit a026370461 ("drivers: hda: use interrupt for timing L1
exit on host DMA")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-09-04 09:49:38 +02:00
Carles Cufi
8c748fd005 kernel: Modify the signature of k_mem_slab_free()
Modify the signature of the k_mem_slab_free() function with a new one,
replacing the old void **mem with void *mem as a parameter.

The following function:
void k_mem_slab_free(struct k_mem_slab *slab, void **mem);

has the wrong signature. mem is only used as a regular pointer, so there
is no need to use a double-pointer. The correct signature should be:
void k_mem_slab_free(struct k_mem_slab *slab, void *mem);

The issue with the current signature, although functional, is that it is
extremely confusing. I myself, a veteran Zephyr developer, was confused
by this parameter when looking at it recently.

All in-tree uses of the function have been adapted.

Fixes #61888.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-09-03 18:20:59 -04:00
Maxmillion McLaughlin
0df085bb36 drivers: sensor: remove LOG_INF from ntc_thermistor_sample_fetch()
LOG_INF() inside of a sample_fetch create noise in the logs and is
inconsistent with other sensor driver implementations.

Signed-off-by: Maxmillion McLaughlin <github@maxmclau.com>
2023-09-02 15:10:31 +02:00
Richard Wheatley
13484b5bdc drivers: serial: uart_pl011_ambiq.h: Remove reserved CLK frequency
UART CLK does not support the 48MHz frequency option

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2023-09-02 15:10:19 +02:00
Robert Lubos
c7c86de621 drivers: wifi: Prevent CMake warnings for out-of-tree drivers
When Ethernet or Wi-Fi subsystems are enabled, but no driver source
files are provided in the Zephyr source tree (which is the case for
out-of-tree drivers), CMake throws warnings about empty libs, for
example:

  No SOURCES given to Zephyr library: drivers__ethernet
  No SOURCES given to Zephyr library: drivers__wifi

This commit sets ALLOW_EMPTY property for those libraries, to allow for
seamless out-of-tree drivers integration.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-09-02 15:09:24 +02:00
Steve Boylan
85cbc7a96e drivers: spi: spi_pico_pio: Add basic support for SPI via PIO
Add fundamental feature support for RP2040 PIO SPI peripherals.
This commit implements synchronous transfer with 8-bit MSB
format.  Using PIO allows any GPIO pins to be assigned the roles
of CS, CLK, MOSI, and MISO.

Optional features not implemented yet:

  - Interrupt based transfer
  - DMA transfer
  - Slave mode
  - Varying word size
  - 3-wire SPI support
  - LSB-first

Updated in response to review comments.
Further updates from second round of review.
Rename spi_pico_pio.c source to match zephyr/MAINTAINERS.yml
Remove unnecessary initialization code.
Resolve merge conflicts

Signed-off-by: Steve Boylan <stephen.boylan@beechwoods.com>
2023-09-01 16:36:41 +02:00
Umar Nisar
31a6594212 drivers: loapic: add device tree support for loapic
As per #26393, Local APIC is using Kconfig based option for
the base address. This patch adds DTS binding support in the driver,
just like its conunter part I/O APIC.

Signed-off-by: Umar Nisar <umar.nisar@intel.com>
2023-09-01 16:36:18 +02:00
Francois Ramu
4e070a0867 drivers: sensor: stm32 Vref sensor calibration on 12bit
The Calibration value of the VRef on stm32U5 is acquired on 14Bit by ADC1
and should be adjusted on 12bit becasue the resolution is 12bit
in this stm32_vref driver.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-09-01 13:22:24 +02:00
Ali Hozhabri
be5cf2ddb9 driver: bluetooth: hci: fix potential "block forever" issue
Interrupt is enabled before reset is released to make sure that the
first IRQ edge is captured, and rx thread can process it.

Remove delay in spi_open as it was redundant due to the "sem_initialised"
semaphore.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-09-01 13:22:08 +02:00
Ali Hozhabri
6d9f2a9143 drivers: bluetooth: hci: spi: Revert to edge sensitive interrupt. (#59459)
Solved also a mutex issue with SPI access.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2023-09-01 13:22:08 +02:00
Sreeram Tatapudi
09a07e42c0 drivers: cat1: Updates to support latest version of HAL/PDL
- Refactoring to support latest versions of HAL/PDL

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2023-09-01 09:52:25 +02:00
Kenneth J. Miller
044de03d57 drivers: serial: stm32: Fix flawed runtime config check
Replace incorrect and limited runtime parity/data bits conditional
configuration with build-time logic using BUILD_ASSERT. This allows for
more flexible UART configurations, while preventing invalid DTS
configurations at build-time.

Signed-off-by: Kenneth J. Miller <ken@miller.ec>
2023-09-01 09:51:55 +02:00
Kenneth J. Miller
5217a17214 drivers: serial: stm32: Consolidate UART config
Move overlapping UART parameter configuration to new
uart_stm32_parameters_set function. This function is called by
uart_stm32_configure upon application/subsystem configuration, and
uart_stm32_registers_configure upon (re-)initialization of driver
instances.

Signed-off-by: Kenneth J. Miller <ken@miller.ec>
2023-09-01 09:51:55 +02:00
Kenneth J. Miller
31a6e31cee drivers: serial: stm32: Refactor for PM handling
Move clock enable and register configuration to their own functions in
preparation for later uart_stm32_reinit function that will use these in
addition to uart_stm32_init.

Signed-off-by: Kenneth J. Miller <ken@miller.ec>
2023-09-01 09:51:55 +02:00
Kenneth J. Miller
c8ffeb47f7 drivers: serial: stm32: Add persistent uart_config struct
Add static uart_config struct to init macro with corresponding pointer
as uart_stm32_config struct member. This struct will store boot and
runtime UART configuration for reinitialization upon exiting low-power
modes, where register contents might be lost.

Remove hw_flow_control, parity, and baud_rate from uart_stm32_config and
uart_stm32_data structs, respectively, as the need for these is now
obviated by the presence of the uart_config struct, which contains
equivalent members.

Add default baudrate, parity, stop, and data bits constants, used to
initialize the uart_config struct, in case the corresponding UART DT
properties are not set.

Signed-off-by: Kenneth J. Miller <ken@miller.ec>
2023-09-01 09:51:55 +02:00
Kenneth J. Miller
bde1cd8d38 drivers: serial: stm32: Move boot-time config to data
Move reset configuration from uart_stm32_data to
const uart_stm32_config struct, as this is set once at boot and isn't
modified during runtime.

Signed-off-by: Kenneth J. Miller <ken@miller.ec>
2023-09-01 09:51:55 +02:00
Kenneth J. Miller
2531d70ad2 drivers: serial: stm32: Make header file self-contained
Move select include directives from source to header file, as these pull
data types required by the struct definitions contained within it.

This promotes a more modular file structure.

Signed-off-by: Kenneth J. Miller <ken@miller.ec>
2023-09-01 09:51:55 +02:00
Benjamin Lemouzy
a7135a6c3a drivers: watchdog: wdt_mcux_imx_wdog: add pinctrl support
i.MX RT SoC have some pins related to the watchdog.
For example, iomuxc_gpio_ad_b0_15_wdog1_rst_b_deb allows WDOG1_RST_B_DEB
signal to be used as reset source for i.MX RT10xx boards.

Signed-off-by: Benjamin Lemouzy <blemouzy@centralp.fr>
2023-08-31 20:19:33 +02:00
Florian La Roche
9f0f9b8875 drivers/serial/uart_xlnx_ps.c: uart_xlnx_ps_driver_api is defined twice
The var "uart_xlnx_ps_driver_api" is defined twice in the source,
so remove one definition of it.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
2023-08-31 20:18:56 +02:00
Andrei Emeltchenko
1eab46e36d ivshmem: shell: Remove redundant commands
Remove commands which are already defined as subcommands for command
ivshmem. Moreover those commands recursively include themselves as
subcommands.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-08-31 10:00:06 -04:00
Andrei Emeltchenko
f6d57e5210 ivshmem: shell: Fix crashing when device is not ready
Fix crash when device is not ready but ivshmem is not NULL.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-08-31 10:00:06 -04:00
Max van Kessel
efaf4a6b34 drivers: can: stm32: fix typo in phy dt assignment
To attach the correct phy, the instance must be givin instead of the id.

Signed-off-by: Max van Kessel <max_van_kessel@msn.com>
2023-08-31 09:59:36 -04:00
Adrian Bonislawski
a026370461 drivers: hda: use interrupt for timing L1 exit on host DMA
To properly setup L1 exit timing this patch will use buffer interrupt
for HOST DMA and wait for Host HDA to actually start
First interrupt will clear all others.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-08-31 09:59:10 -04:00
Gerard Marull-Paretas
e3e2a708b2 drivers: gpio: ite_it8xxx2: add missing init.h
File was using SYS_INIT without including init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-31 14:43:15 +02:00
Prashanth S
12996d5d4d drivers: gpio: Add Davinci gpio controller support
Davinci gpio controller support to add various soc gpio
support (J721E, AM654).

TRM for J721e https://www.ti.com/lit/zip/spruil1
File: spruil1c.pdf
GPIO: section 12.1.2

BeagleBone AI_64 https://beagleboard.org/ai-64

Signed-off-by: Prashanth S <slpp95prashanth@yahoo.com>
2023-08-31 10:31:37 +02:00
Chad Karaginides
47ffe578c8 drivers: gic: Redistributor Power Register
GIC-600 and later interrupt controllers have an additional
GICR_PWRR register that controls the power up sequencing
of the redistributors.  Added logic to gicv3_rdist_enable to
configure GICR_PWRR if required.

Signed-off-by: Chad Karaginides <quic_chadk@quicinc.com>
2023-08-31 10:24:48 +02:00
Gerard Marull-Paretas
99c19425d1 drivers: usb: device: add missing init.h
Some drivers were missing init.h, required for SYS_INIT.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-31 10:21:50 +02:00
Gerard Marull-Paretas
008f1c44e2 drivers: usb: device: s/device.h/init.h
Some drivers were not using any device.h API, but init.h (SYS_INIT).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-31 10:21:50 +02:00
Dino Li
003e0be6fb it8xxx2/linker: append h2ram_pool section at the end of used memory
Since __sha256_ram_block section must in the first 4KB,
h2ram_pool section is no longer included first inside the
RAMABLE_REGION.
Append h2ram_pool section at the end of used memory, so gap
due to alignment is still available for newly added variables.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-08-31 10:20:17 +02:00
Dino Li
423b5b2d42 espi/it8xxx2: extend h2ram offset mask
This extends h2ram offset mask to support chips with
128KB or 256KB of memory.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-08-31 10:20:17 +02:00
Jun Lin
4eb0b03a0f driver: ps2: npcx: add the missing kernel.h include
The npcx ps2 controller calls Kernel APIs without including the kernel.h
header file. This commit adds the header file to fix the issue.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-08-31 10:19:52 +02:00
Jun Lin
ad44c98cb7 driver: ps2: npcx: use the device Kconfig symbol
The npcx ps2 driver does not use the DT_HAS_<compat>_ENABLED Kconfig
symbol to enable the driver. This commits update the Kconig file to
use it and also drop the dependency on ESPI_PERIPHERAL_8042_KBC.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-08-31 10:19:52 +02:00
cyliang tw
449211a307 drivers: pwm: support for Nuvoton numaker series
Add Nuvoton numaker series pwm controller, including
capture feature.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-08-31 10:19:31 +02:00
Dong Wang
64e8411527 drivers: i2c_sedi: correct pending check condition
Previous check is wrong, need to reverse.

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2023-08-30 21:02:45 -04:00
Mario Paja
d72b79256c driver: input: gt911: Fix to properly handle touch events on esp32
This fix properly ignores a multitouch event on esp32 board

Signed-off-by: Mario Paja <mariopaja@hotmail.com>
2023-08-30 22:21:14 +02:00
Jamie McCrae
28ba8368ad auxdisplay: Fix handlers file
Fixes usermode access issues with the auxdisplay driver.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-30 15:54:05 -04:00
Jakub Michalski
f54a7b1602 drivers: mb85rc: support use of multiple modules as a single one
Allow use of multiple mb85rc frams at contiguous i2c addresses as a single
big fram module.
Tested on mb85rc1mt used as two 32K modules, where the first one was at
mb85rc1mt's first i2c address and the second one at mb85rc1mt's second i2c
address.

Signed-off-by: Jakub Michalski <jmichalski@internships.antmicro.com>
Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-08-30 17:38:21 +02:00
Jakub Michalski
a5c0a9656d drivers: add mb85rc fram driver
Add fujitsu mb85rc i2c fram driver.
Tested on mb85rc1mt.

Signed-off-by: Jakub Michalski <jmichalski@internships.antmicro.com>
Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-08-30 17:38:21 +02:00
Francois Gervais
96a887809c drivers: sensor: ism330dhcx: fix pulse mode interrupts
On my end, the ISM330DHCX was stopping working after a few seconds.

After investigation, it seems that the function used to set the device
in pulse mode only works for special modes like tap and embedded functions
and not for data-ready as intended.

The data-ready was then in the default latched mode which does not work
sustainably with the rest of the driver logic. In this mode, the driver
can miss an interrupt and be forever waiting on a new data-ready pulse
which will never happen as the interrupt line is already active.

This calls the correct function to enable pulsed data-ready mode as
described in the datasheet section 9.7 COUNTER_BDR_REG1 (0Bh).

Signed-off-by: Francois Gervais <francoisgervais@gmail.com>
2023-08-30 08:35:39 -05:00
Gerard Marull-Paretas
cb69a0a342 drivers: pinctrl: b91: add missing init.h
File was using SYS_INIT, from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-30 14:43:38 +02:00
Bjarki Arge Andreasen
b14c39f2c1 drivers/modem: Add generic cellular modem driver
The added cellular modem driver is a naive driver, which
shall serve as a template for implementing tailored
drivers for modems like the UBLOX-R4. It uses only
generic at commands, described in 3gpp, and protocols,
like CMUX and PPP.

A binding for the BG95 has been added, which replaces
the quectel,bg9x. This is neccesary since the BG95 does
not have a usable reset pin, the reset and powerkey are
internally connected to each other.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-08-30 13:48:51 +02:00
Guillaume Gautier
5f260591d8 drivers: clock_control: stm32wba: remove unneeded semaphore
Remove semaphore used for the setting of the LSE.
It is not used for STM32WBA.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-08-30 11:28:44 +01:00
Guillaume Gautier
4a46163055 drivers: clock_control: stm32wba: enable backup domain for lsi clock
LSI clock configuration for STM32WBA is located in backup domain.
The backup domain needs to be enabled before the LSI can be enabled.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-08-30 11:28:44 +01:00
Gerard Marull-Paretas
2f836ed788 drivers: intc: nxp_pint: s/device.h/init.h
File is just using APIs from init.h (SYS_INIT).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-30 11:54:31 +02:00
Gerard Marull-Paretas
0ce1091126 drivers: pinctrl: lpc_iocon: add missing init.h
File was using SYS_INIT without including init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-30 11:54:04 +02:00
Gerard Marull-Paretas
818c488fc9 drivers: pinctrl: stm32: add missing init.h
File was using SYS_INIT, from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-30 11:52:30 +02:00
Gerard Marull-Paretas
aa708738c7 drivers: gpio: it8xxx2: add missing init.h
File was using SYS_INIT without including init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-30 11:37:36 +02:00
Gerard Marull-Paretas
bfdd3f8537 drivers: pinctrl: gd32_afio: add missing init.h
File was using SYS_INIT, from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-30 11:37:24 +02:00
Piotr Dymacz
22f6c87afc drivers: ieee802154: cc13xx_cc26xx{_subg}: fix reversed extended address
Based on the 'Technical Reference Manual' for CC13x2/CC26x2 SimpleLink
MCU family, the device contains factory pre-programmed 64-bit IEEE MAC
address for 802.15.4 radio inside two FCFG 32-bit registers:

  1. MAC_15_4_0: first 32-bit of the 64-bit IEEE MAC address
  2. MAC_15_4_1:  last 32-bit of the 64-bit IEEE MAC address

The way current version of the driver setups the address results in
incorrect bytes order (the address is reversed):

  uart:~$ ieee802154 get_ext_addr
  Extended address: AF:03:B7:25:00:4B:12:00

This fixes the problem in both drivers (also in the Sub-GHz version)
which results in use of proper EUI-64 address:

  uart:~$ ieee802154 get_ext_addr
  Extended address: 00:12:4B:00:25:B7:03:AF

IEEE MAC address was confirmed with UniFlash, nRF Sniffer for 802.15.4
and IEEE OUI database (00:12:4B is one of registered OUI for Texas
Instruments).

To prevent confusion in future, short notice about bytes order for
'mac' field in driver's data structures was also included.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-08-30 10:23:50 +02:00
Fabio Baltieri
2a2b314fc4 drivers: fix few mismatched CONTAINER_OF
Fix few mismatched CONTAINER_OF, one missing k_work_delayable_from_work
conversion and few cases where the target should be pointing at the
first element explicitly.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:21:23 +02:00
Daniel Gaston Ochoa
d434693c15 stm32h7: spi: Use TXC instead of EOT
Check the TXC flag instead of EOT for the case of endless
transactions (TSIZE = 0), which in this case is always as
the stm32 SPI driver doesn't set TSIZE.

Signed-off-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
2023-08-30 10:21:05 +02:00
Erwan Gouriou
e35974c804 drivers: crypto: stm32: Replace buffer len assert by error logic
In case asserts are deactivated, no check is done on buffers length.
Remove asserts and return an error when lengths are not correct.

Check error in case length is set by API user.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-08-30 10:19:07 +02:00
Dominik Ermel
d647a85fb5 drivers/flash/stm32/Xspi: Fix llvm compilation error
Fix compilation error on variable used for size of array in
OSPI and QSPI drivers.

Fixes #61804

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-08-30 10:18:57 +02:00
Victor Chavez
80d4c76a1f Bluetooth: Userchan: Parse multiple hci packets
After conducting tests with a a virtual Bluetooth controller
over TCP it was noticed that some HCI packets may arrive on the
same buffer if sent over a short period of time.
This update ensures the hci packets are parsed correctly in the case
multiple packets are in the same recieving buffer according to
the Bluetooth Spec v5.4 Part E.

Signed-off-by: Victor Chavez <chavez-bermudez@fh-aachen.de>
2023-08-30 10:18:41 +02:00
Benjamin Lemouzy
d2e420029b drivers: sensor: add NXP TEMPMON driver
Add driver for the NXP TEMPMON to retrieve on-die operational
temperature.

Signed-off-by: Benjamin Lemouzy <blemouzy@centralp.fr>
2023-08-30 10:18:27 +02:00
Fabio Baltieri
e3f5e1f496 sensor: bq274xx: fix few data units
Change few data units that are currently reported three order of
magnitude off from what the sensors API specifies.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:17:27 +02:00
Fabio Baltieri
5d1a4d4589 sensor: bq274xx: add an initialization delay
The various BQ27xxx datasheet seems to indicate a typical power-up or
shutdown to communication time of 250ms typical.

Adjust the driver to include:
- a check to ensure that the MCU has been powered for at least 300ms
  before any communicaton
- the same delay when exiting shutdown state

Link: https://www.ti.com/lit/gpn/BQ27427
Suggested-by: Nick Ward <nix.ward@gmail.com>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:17:27 +02:00
Fabio Baltieri
72a2b81f75 sensor: bq274xx: implement the bq27427 ccgain workaround
The BQ27427 appears to work incorrectly with the ROM configuration
value, it battery power and current are the inverse of what they should
be, and SoC is decresing when charging and increasing when discharging
as a consequence.

At this time this only appears documented in the TI E2E forums, and the
workaround seems to be to invert the sign of the CC Sense register of
the device.

This register is not documented on the BQ27427 device technical
reference manual, as the device has an internal shut and the sense value
should not have to be tweaked, so the CC Sense details are taken from
the BQ27426 one instead, which is supposedly the same silicon with an
external shunt.

Also the CC Sense value, which is just documented as "F4" (as in 4 bytes
float) is actually in a proprietary floating point format, so instead of
trying to decode, just swap the known sign bit as documented in the E2E
forum post.

Link: https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/1215460/bq27427evm-misbehaving-stateofcharge
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:17:27 +02:00
Fabio Baltieri
34bae6c497 sensor: bq274xx: rewrite the configuration function
Rework the device configuration code. The current code has a bunch of
leftover functions that read data and compute checksums that are never
used, but that break the initialization sequence if removed because
there are also some missing delays in their place.

Redo the initialization code from scratch, this is mainly inspired from
the Linux driver and taking some part from the (somewhat confusing and
incomplete) datasheet.

This drops the dead code and adds the necessary sleeps to guarantee
correct operation.

The device configuration is also now changing the local copy of the data
block, and soft reset is also issued only if the device configuration
has changed, which should only happens if the battery is replaced or
went completely flat. This should also result in a consistent battery
measurement operation across resets.

Link: https://elixir.bootlin.com/linux/latest/source/drivers/power/supply/bq27xxx_battery.c
Link: https://www.ti.com/lit/ug/sluucd5/sluucd5.pdf
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:17:27 +02:00
Fabio Baltieri
69a5e64f8c sensor: bq274xx: use sys_put_le16 in bq274xx_ctrl_reg_write
Use sys_put_le16 in bq274xx_ctrl_reg_write to convert the two bytes
value. This is coherent with the rest of the file.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:17:27 +02:00
Fabio Baltieri
aae140cadb sensor: bq274xx: add few links to the device documentation
Link few docs to the top so they don't have to be referenced around.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:17:27 +02:00
Jeroen van Dooren
6ab706913a drivers: serial: stm32: add wide data support
Add wide data support to STM32.
Validated interrupt driven code on an STM32H743.

Signed-off-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
2023-08-30 10:17:17 +02:00
Jeroen van Dooren
435d5d1a94 drivers: serial: stm32: rework code for max re-use in wide data support
Restructuring code for poll_in/poll_out/fifo_fill/fifo_read because for
wide data support, all code is identical except the calls to
LL_USART_{ReceiveData8/TransmitData8}.
This allows both implementations, 8 and 9 bit data-width to call a
visitor function, passing the either the 8 bit or 9 bit data-width
function pointer.

Signed-off-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
2023-08-30 10:17:17 +02:00
Jeroen van Dooren
250e1f93ca drivers: serial: stm32: prevent stop/data-bits HW support code duplication
Preventing code duplication of macros checking for HW support on
stop bits and data-bits during runtime configuration.
Validated runtime configuration on an STM32H743.

Signed-off-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
2023-08-30 10:17:17 +02:00
Gerard Marull-Paretas
939e3d6149 drivers: usb: device: kinetis: s/device.h/init.h
File was not using any device.h API, but SYS_INIT from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-30 10:15:56 +02:00
Gerard Marull-Paretas
2202864f4f drivers: usb: udc: common: add missing init.h
File was using SYS_INIT, from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-30 10:15:49 +02:00
Gerard Marull-Paretas
41deaeeea8 drivers: intc: gic: add missing init.h
Driver uses SYS_INIT, from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-29 15:56:41 +01:00
Eric Holmberg
f5b78270bc drivers: sensor: ina230: fix current sign issue
Fix sign handling for ina230 current calculation.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2023-08-29 09:44:20 -05:00
Eric Holmberg
f0f7f8b146 dt-bindings: sensor: ina230: add configuration properties
Add properties to replace the configuration register value.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2023-08-29 09:44:20 -05:00
Eric Holmberg
19e44ae9a0 drivers: sensor: ina237: add shunt voltage support
Add ability to retrieve the shunt voltage if the end user wants to do
the power calculation manually to handle negative power values.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2023-08-29 09:44:20 -05:00
Eric Holmberg
a70d056513 drivers: sensor: ina237: add high-precision mode
The current-shunt calibration requires a factor of 4x if high-precision
mode is selected.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2023-08-29 09:44:20 -05:00
Eric Holmberg
2d3a391191 drivers: sensor: ina237: fix current sign issue
Fix current sign extension logic and consolidate sensor scaling code
into a single block.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2023-08-29 09:44:20 -05:00
Eric Holmberg
19da119c17 test: sensor: ina237: add emulator unit test
Add emulator unit test of the INA237.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2023-08-29 09:44:20 -05:00
Eric Holmberg
c7135a2ac5 dt-bindings: sensor: ina237: add configuration properties
Add properties to replace the configuration register values.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2023-08-29 09:44:20 -05:00
Gerard Marull-Paretas
e80f71a14d drivers: usb: device: nrfx: add missing init.h
File was using SYS_INIT, from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-29 12:28:04 +01:00
Gerard Marull-Paretas
0b8a7c0930 drivers: pinctrl: imx: add missing init.h
File used SYS_INIT API from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-29 12:21:00 +01:00
Gerard Marull-Paretas
1b361f9832 drivers: pcie: host: add missing init.h
File was using SYS_INIT from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-29 12:20:31 +01:00
Gerard Marull-Paretas
cdb36fdbd6 drivers: pinctrl: pfc_rcar: add missing init.h
File uses SYS_INIT API, from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-29 12:17:38 +01:00
Gerard Marull-Paretas
561efe5557 drivers: intc: gicv3: add missing init.h
File was using SYS_INIT, from init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-29 12:16:21 +01:00
Gerard Marull-Paretas
12b2ee54e3 drivers: timer: s/device.h/init.h
Timer "drivers" do not use the device model infrastructure, they are
singletons with a SYS_INIT call. This means they do not have to include
device.h but init.h. Things worked because device.h includes init.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-29 11:29:18 +01:00
Guillaume Gautier
7f8831aa7e drivers: adc: stm32: add support for kernel source clock
Add support for ADC kernel source clock, similar to other STM32 drivers.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-08-29 11:27:07 +01:00
Guillaume Gautier
484028306d drivers: adc: stm32: use dts to set the clock prescaler
Now that everything is in place, the prescaler value picked from dts is
used to properly configure the clock.
The code is moved into its own function.
There are four main cases:
- F1 and F37x don't have prescaler (in ADC register) so nothing is done.
- F0 only has individual registers.
- C0, G0, L0, WB1x and WL have both invidual and common registers. The
  individual one is used to define either synchronous mode with its
  prescaler, or asynchronous mode. The common one is only used to store
  the value of the asynchronous prescaler.
- All others only have a common register where both the mode and the
  prescaler is stored.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-08-29 11:27:07 +01:00
Guillaume Gautier
e8c4990639 drivers: adc: stm32: get prescaler value from dts
Get the STM32 ADC prescaler data from dts to create the appropriate LL
macro to use for the ADC clock.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-08-29 11:27:07 +01:00
Laczen JMS
95bdfb5c33 bbram: add support from user threads
Provide the necessary handlers to support bbram access from userthreads
solves #61868.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2023-08-29 10:26:07 +02:00
Martin Kiepfer
bda6656eca bugfix: esp32: spi: correct idle polarity and mode configuration
Possible fix for incorrection spi mode configuration
on esp32 (#61866)

Signed-off-by: Martin Kiepfer <mrmarteng@teleschirm.org>
2023-08-29 10:25:45 +02:00
Fabio Baltieri
5e01466d97 drivers: gpio: xlnx_ps: fix up initialization priorities
Current setup tries to initialize the bank driver before the parent one,
which is the inverse of what the devicetree hierarchy implies and
causes a bunch of:

ERROR: /soc/gpio@e000a000/psgpio_bank@3 PRE_KERNEL_1 40 32 <
/soc/gpio@e000a000 PRE_KERNEL_2 40 10

Change the bank driver to initialize at PRE_KERNEL_1 as the parent
drivers so that ordinals take care of priority between these two.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-28 15:43:06 -04:00
Fabio Baltieri
323ebef2de drivers: crypto: it8xxx2_evb: fix a shadow variable error
Fix a build error:

crypto_it8xxx2_sha.c:99:26: warning: declaration of 'i' shadows a
previous local [-Wshadow]
   99 |                 for (int i = 0; i < ARRAY_SIZE(sha256_k); i++) {
      |                          ^ crypto_it8xxx2_sha.c:88:13: note:
shadowed declaration is here
   88 |         int i;

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-28 19:17:46 +01:00
Fabio Baltieri
755bdf80c6 drivers: flash: spi_nor: fix build when a reset gpio is present
Fix a few issues with the reset-gpio functionality in spi_nor, missing
header, missing semicolon, unnecessary and not working condition on a
struct field that is not a pointer.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-28 16:01:23 +02:00
Martin Jäger
0fbbe02f07 drivers: serial: esp32_usb: don't use k_usleep in poll_out function
The previous implementation called k_usleep to wait if the fifo was not
empty. This leads to an exception if called from an ISR (e.g. for
for logging).

In addition to that, the k_usleep leads to noticeable interruptions
when printing strings longer than the 64 bytes of the fifo.

With this commit, the function will busy-wait until all characters are
sent or if the timeout is reached. The timeout will only be reached if
no USB host is connected to the port. After the timeout is reached
once, the function will return immediately for subsequent calls
(dropping the characters to be sent) until the USB host is connected
again.

Fixes #60825

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-08-28 16:00:20 +02:00
Fabio Baltieri
529798a1b2 drivers: watchdog: atcwdt200: fix shadow variable build error
Fix a shadow variable build error:

wdt_andes_atcwdt200.c:112:49: warning: declaration of 'counter_dev'
shadows a global declaration [-Wshadow]
  112 | static void wdt_counter_cb(const struct device *counter_dev,
      uint8_t chan_id, |
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ wdt_andes_atcwdt200.c:95:35: note:
shadowed declaration is here
   95 | static const struct device *const counter_dev = |
      ^~~~~~~~~~~

Make the outer variable more specific rather than the local one.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-28 16:00:00 +02:00
Nick Ward
2d65acca3a drivers: gpio: use gpio_is_ready_dt helper function
Update `struct gpio_dt_spec` use with gpio_is_ready_dt()

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-08-28 08:48:35 -05:00
Fabio Baltieri
3f0ee7f6db power_domain: intel_adsp: initialize after DMA
Change the power_domain_intel_adsp initialization priority so that it
initializes after the DMA driver that it depends on.

Fixes a few:

ERROR: /soc/dma@72c00 POST_KERNEL 40 69 <
	/soc/dfpmccu@71b00/hst_domain POST_KERNEL 75 65
ERROR: /soc/dma@72400 POST_KERNEL 40 66 <
	/soc/dfpmccu@71b00/hst_domain POST_KERNEL 75 65
...

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-28 14:10:17 +01:00
Fabio Baltieri
2401743c21 input: gpio_keys: fix CONTAINER_OF declaration
Fix CONTAINER_OF usage in gpio_keys_interrupt, this should go first to
struct gpio_keys_callback and then to struct gpio_keys_pin_data. It
happens to work right now because cb_data is the first field.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-28 10:12:21 +02:00
Fabio Baltieri
ec71be5d9d drivers,subsys: fix few missing k_work_delayable_from_work
Fix few instances of delayable work handlers using the k_work pointer
directly in a CONTAINER_OF pointing to a k_work_delayable.

This is harmless since the k_work is the first element in
k_work_delayable, but using k_work_delayable_from_work is the right way
of handling it.

Change a couple of explicit CONTAINER_OF doing the same work as the
macro in the process.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-28 10:12:21 +02:00
Grant Ramsay
12c568f43a drivers: can: mcan: fix format string warning
A warning was being produced on compilers where size_t is an unsigned long

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-28 08:23:37 +01:00
Grant Ramsay
12d6e268cd drivers: can: mcan: tidy TX complete semaphore usage
"callback != NULL" is used to determine if the callback is in use.
The TX complete semaphone should only be given back after setting the
callback to NULL.

This would likely only be a race condition if the ISR is processed on a
different core to the TX call.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-28 08:23:37 +01:00
Grant Ramsay
e9bc195bf4 drivers: can: mcan: manually track available TX buffers
The MCAN driver operates in TX queue mode (TXBC.TFQM = 1). In this mode
TXFQS.TFQPI returns the first available buffer (usually buffer zero).

Hardware is free to re-use a buffer as soon as TX completes, it does not
have to wait for the matching TX event to be processed.

If a TX completes and that TX buffer is re-used before processing the TX
event, two TX events for the same buffer occur. The first event calls the
second events TX callback, and the second event results in a NULL pointer
exception.

In a "normal" configuration, the TX event ISR will always preempt the
queuing of a TX frame to the same TX buffer.
However, this issue could occur if:
 * Sending a message with ISRs temporarily disabled.
 * The ISR is processed on a different core to the TX call.

The fix is to manually track which TX buffers are available, only freeing
a buffer after the TX event has been processed.

The MCAN user manual states that this is allowed:
"The application may use register TXBRP instead of the Put Index and may
place messages to any Tx Buffer without pending transmission request"

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-28 08:23:37 +01:00
Grant Ramsay
cff1496166 drivers: can: mcan: fix off-by-one error in assert
Fix off-by-one error in assert

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-28 08:23:37 +01:00
Grant Ramsay
08d19954b9 drivers: can: mcan: clear TX callback on failed TX
Elsewhere, "callback != NULL" is used to determine if the callback is in
use

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-28 08:23:37 +01:00
Grant Ramsay
e98f7b8fb7 drivers: can: mcan: give back semaphore on failed TX
Give back semaphore on failed TX

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-28 08:23:37 +01:00
Grant Ramsay
58e60a028f drivers: can: mcan: unlock mutex on failed TX mram write
Unlock mutex on failed TX mram write

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-28 08:23:37 +01:00
Mulin Chao
f942b44c56 soc: arm: npcx: move workaround methods for npcx series to its soc.c
Move workaround methods for npcx series to soc init functions. If
there's no workaround for this series, drop its soc.c file directly.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-08-28 08:22:10 +01:00
Ryan McClelland
7b6b1328a0 drivers: sensor: bmi08x: fix fs prop for gyro
The full scale prop was incorrectly using the enum idx which was then
to be used with a look up table which used the actual range number.
This changes it to use the int directly from the dts.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-08-25 13:48:26 -05:00
Tim Lin
7a2e86f563 ITE: drivers/gpio: Add critical section to avoid race condition
This gpio data register and keyboard scan out register are shared
register. To prevent race condition caused by access from different
thread, add critical section.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-08-25 13:14:47 +02:00
Mateusz Sierszulski
be149593c9 drivers: pinctrl: Add more config options for Ambiq Apollo4
This commits add more configuration options
for Ambiq Apollo4 pinctrl driver.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-08-25 10:31:58 +02:00
Mateusz Sierszulski
2b74109f20 drivers: spi: Add Ambiq SPI driver
This commits adds SPI master driver for Apollo4 SoCs.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-08-25 10:31:58 +02:00
Tim Lin
ed37374dac ITE: drivers/pwm: Add the flag of PWM output open-drain mode
This flag is used when the PWM output is set to open-drain mode.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-08-25 10:31:42 +02:00
Andy Sinclair
075a859869 drivers: sensor: npm1300: Additional charger configuration
Added configuration of termination current and trickle voltage
Added option to bypass low voltage charge inhibit
Added option to disable automatic recharge

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-08-24 18:42:37 -05:00
Andy Sinclair
e2dd071afc drivers: sensor: npm1300: Attributes and enable/disable
Added support for attribute get/set, and enabling/disabling
of charge.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-08-24 18:42:37 -05:00
Ryan McClelland
b05e104acb drivers: sensor: bmi08x: adjust logging level of certain issues
Some log messages could be too noisy, especially if the sensor shell was
used which would call all attr and samples even though just a few are
supported.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-08-24 18:24:39 -05:00
Kim Bøndergaard
44e18e8d47 drivers: rtc: rtc_fake: fff rtc driver added
Can be valuable for unit testing modules accessing the RTC

Signed-off-by: Kim Bøndergaard <kim.bondergaard@prevas.dk>
2023-08-24 22:06:51 +01:00
Kim Bøndergaard
eed23e8cb3 drivers: rtc: rtc_shell: rtc shell command suite
For now clock can be read and written.

Clock can be set in full iso8601 time format, like 2023-12-24T12:45:56
or by just providing either data or time

Alarms not accessible

Signed-off-by: Kim Bøndergaard <kim.bondergaard@prevas.dk>
2023-08-24 22:06:51 +01:00
Laczen JMS
c5b19cc44f retained_mem: add user thread support.
Fixes #61848.

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2023-08-24 16:57:26 +01:00
Manuel Argüelles
927360e4e4 gpio: nxp_s32: implement get config/direction APIs
Implement pin_get_config() and port_get_direction() GPIO APIs for NXP
S32 devices.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-24 17:21:18 +02:00
Daniel Stuart
d9e7af6cdd drivers: sensor: vl53l1x: Allow for SENSOR_CHAN_ALL channel to be used
It mirrors the functionality of the vl53l0x driver.
Also removes an assert not needed, as the channel is checked.

Signed-off-by: Daniel Stuart <daniel.stuart14@gmail.com>
2023-08-24 17:21:10 +02:00
Alberto Escolar Piedras
9eeb78d86d COVERAGE: Fix COVERAGE_GCOV dependencies
CONFIG_COVERAGE has been incorrectly used to
change other kconfig options (stack sizes, etc)
code defaults, as well as some samples behaviour,
which should not have dependend on it.

Instead those should have depended on COVERAGE_GCOV,
which, being the one which adds special code and
temporary RAM storage for embedded targets,
require changes to many features.

When building for the native targets, all this was
unnecessary.

=> Fix the dependency.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-08-24 15:36:31 +02:00
Daniel Gaston Ochoa
818aa2d0c7 drivers: stm32: SPI: SPI nocache buffers can be in CONFIG_NOCACHE_MEMORY
CONFIG_NOCACHE_MEMORY is a valid way of declaring buffers in
nocache regions. Consider them valid in the stm32 SPI driver
nocache check. Also, don't check NULL buffers as the SPI
interface states that such buffers will result in sending
zeroes.

Signed-off-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
2023-08-24 15:35:50 +02:00
Fabio Baltieri
f45e7eddaa drivers: fpga: add an init priority config option
Add a Kconfig option for FPGA device initialization priority.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-24 15:35:37 +02:00
Fabio Baltieri
49b8f95513 drivers: gpio: nct38xx: increase default init priority
Increase the default init priority of nct38xx so that they work well
with the default I2C init priority (50).

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-24 15:35:37 +02:00
Fabio Baltieri
2fea3fb0a9 drivers: modem: delay init priority
Change the default modem GSM init priority to make sure it's after
serial.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-24 15:35:37 +02:00
Fabio Baltieri
dce9f06265 drivers: spi: spi_test: use the subsystem common init priority
Use CONFIG_SPI_INIT_PRIORITY like all other SPI drivers for initializing
the test driver.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-24 15:35:37 +02:00
Gerard Marull-Paretas
94a4d38ed9 cmsis: remove unnecessary includes
Some files included <cmsis_core.h> for nothing, delete it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-08-24 13:20:21 +02:00
Gerard Marull-Paretas
9c961571a2 modules: cmsis: move glue code to modules/cmsis
The CMSIS module glue code was part of arch/ directory. Move it to
modules/cmsis, and provide a single entry point for it: cmsis_core.h.
This entry header will include the right CMSIS header (M or A/R).

To make this change possible, CMSIS module Kconfig/CMake are declared as
external, allowing us to add a new Zephyr include directory.

All files including CMSIS have been updated.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-08-24 13:20:21 +02:00
Jun Lin
df0646ed6e driver: flash: npcx: add support for npcx4 series
This CL introduces new Flash Interface Unit (FIU) hardware in npcx4
series. The different operations of npcx9 and npcx4 FIU include:

1. 4-byte mode support for DRA mode move to SPI_DEV reg
2. To access the second flash in DRA mode, we need to configure
   SPI_DEV_SEL field in BURST_CFG additionally.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-08-24 10:42:33 +01:00
Mulin Chao
5c7ab5c2bf driver: clock_control: npcx: add support for npcx4 series
This CL introduces new clock architectures in npcx4 series and wraps
clock configurations of different series by device tree files.

For example, the PWDWN_CTLx reg initialization relies on `pwdwn-ctl-val`
prop of pcc DT node now.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-08-24 10:42:33 +01:00
Daniel Leung
302f06534e fuel_gauge: sbs_gauge: fix uninitialized variable warning
The return variable rc in sbs_gauge_do_battery_cutoff() needs to
be initialized, or else it would return random value if the for
loop is never entered.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-23 19:36:41 -04:00
Ryan McClelland
b92e749c3e drivers: sensor: ina3221: fix double-promotion
channel_get was doing using floating point constants with it's calculation.
The result is changed to be a float as this was generating a double
promotion warning.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-08-23 07:51:53 -05:00
Peter Ujfalusi
ab0ed57711 mm: intel_adsp_tlb: Handle address space conversion warnings
There are various call to z_soc_cached_ptr() which returns values
in the cached address space and are stored in temporary variables
that are not marked as in the cached address space. This results
in sparse complaining about discarding the cached address space
attribute. These temporary variables are then passed to other
internal memory management related functions which do not have
the concept of cached address space (as it is currently Xtensa
specific). Because of this, we cannot change the signature of
these functions. Instead, we force a change of address space
when those temporary variables are being assigned to suppress
sparse warnings.

Reported-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2023-08-23 14:45:14 +02:00
Florian La Roche
5727503489 style: move ALWAYS_INLINE to the beginning to resolve compiler warnings
With gcc from the zephyr sdk and -Wold-style-declaration is giving this
output:
zephyr/arch/arm/core/aarch32/cortex_a_r/fault.c:101:1: warning:
  'inline' is not at beginning of declaration [-Wold-style-declaration]
  101 | static void ALWAYS_INLINE
                    z_arm_fpu_caller_save(struct __fpu_sf *fpu)
      | ^~~~~~

I searched to all of the source code to find these further occurances
where inline is not at the beginning of a function declaration.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
2023-08-23 14:44:23 +02:00
Christopher Friedt
64e6c90fc0 drivers: fpga: ice40: remove unnecessary include
The `<zephyr/posix/time.h>` header was unused in `fpga_ice40.c`
so remove it.

This fixes an error about `pthread_attr_t` not being defined.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-08-23 10:06:00 +02:00
Kai Vehmanen
f764e7e737 drivers: dai: alh: fix refcount logic for ALH ownership
Refcounting is used to track ALH block usage and to
call alh_claim_ownership()/alh_release_ownership() accordingly.
This is however incorrectly done on ALH instance basis, which
means when one instance is released, ownership can be released
even though one ALH instance is still active.

Fix the logic by tracking ALH usage as a global property
which matches the alh_claim_ownership/alh_release_ownership
semantics.

Link: https://github.com/thesofproject/sof/issues/7759
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-08-23 10:04:00 +02:00
Armando Visconti
e1ca18e757 modules/hal_st: Align sensor drivers to stmemsc HAL i/f v2.3
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v2.3

Requires https://github.com/zephyrproject-rtos/hal_st/pull/16

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-08-22 18:12:27 +02:00
Martin Kiepfer
74db02bad1 drivers: gpio: AXP192 GPIO driver
AXP192 is a small power management IC, that also
features 5 GPIOS.
Besides GPIO driver this commit also includes needed modifications
in axp192 regulator and mfd driver as LDOIO0 functioanlity
is multiplexed with GPIO0 pin.

Signed-off-by: Martin Kiepfer <mrmarteng@teleschirm.org>
2023-08-22 18:08:51 +02:00
Nicola Ochsenbein
e3654e045e drivers: eth: native_posix: Add Kconfig to Configure RX Timeout
Add Kconfig to set sleep timeout between empty read attempts in rx thread
for ethernet native posix driver.

Signed-off-by: Nicola Ochsenbein <Nicola.Ochsenbein@husqvarnagroup.com>
2023-08-22 18:06:18 +02:00
Aaron Massey
82bfb26446 fuel_gauge: Add battery cutoff support
Many fuel gauge ICs offer a battery cutoff/shipping mode functionality that
cutoff charge from the battery. This is often useful for preserving battery
charge on devices while in storage.

Add battery cutoff support to the fuel gauge API with a generic default SBS
driver showing an example of support in tests.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-08-22 18:05:50 +02:00
Victor Chavez
33c922a771 Bluetooth: Userchan: Add support for TCP Connection
Added support to connect to an HCI TCP Server. This
allows to do integration tests with other frameworks
that support a virtual hci interface.

Signed-off-by: Victor Chavez <chavez-bermudez@fh-aachen.de>
2023-08-22 15:50:56 +02:00
Diego Elio Pettenò
9a882f8b09 uart_sam0: fix shadowed variable.
This code was added to CI after the `-Wshadow` stack was prepared, so it
was not fixed together with the rest.

Signed-off-by: Diego Elio Pettenò <flameeyes@meta.com>
2023-08-22 14:26:59 +02:00
Jerzy Kasenberg
7a9744e169 drivers: clock_control: smartbond: Add calibration
RCX and RC32K oscillators are not precisely trimmed.
This code allows to measure actual frequency of those two
oscillators.

Device tree binding were extended to specify calibration
interval. This interval (in seconds) is used to periodically
call work that will perform oscillator frequency measurement.

For XTAL32K settle time can be provided in device tree.
After this time (depending on actual oscillator used)
XTAL32K is assumed to be stable and low power clock driven by
XTAL32K is considered OK for precise usage in bluetooth.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-08-22 12:16:16 +02:00
Fabio Baltieri
420d9563a4 drivers: watchdog_shell: fix compiler error
Fix wdt_shell.c:54:13: error: implicit declaration of function 'strtoul'

Tested with west build -p -b nrf52dk_nrf52832 samples/drivers/watchdog
-DCONFIG_SHELL=y.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-22 10:49:05 +01:00
Daniel Leung
e38fc6de8a cmake: enable -Wshadow partially for in-tree code
This enables -Wshadow to warn about shadow variables on
in tree code under arch/, boards/, drivers/, kernel/,
lib/, soc/, and subsys/.

Note that this does not enable it globally because
out-of-tree modules will probably take some time to fix
(or not at all depending on the project), and it would be
great to avoid introduction of any new shadow variables
in the meantime.

Also note that this tries to be done in a minimally
invasive way so it is easy to revert when we enable
-Wshadow globally. Source files under modules/, samples/
and tests/ are currently excluded because there does not
seem to be a trivial way to add -Wshadow there without
going through all CMakeLists.txt to add the option
(as there are 1000+ files to change).

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 11:39:58 +02:00
Daniel Leung
729fd4c574 counter: rename shadow variables
Rename shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 11:39:58 +02:00
Benjamin Lemouzy
d4e33c5708 drivers: watchdog: add WDT shell commands
Add shell commands to setup, disable, install timeout and feed a
watchdog device.
These commands reflect watchdog API.

Signed-off-by: Benjamin Lemouzy <blemouzy@centralp.fr>
2023-08-21 15:01:30 -05:00
Diego Elio Pettenò
4cada3ecaf uart_sam0: don't consume CONFIG_UART_ASYNC_API directly.
There are situations in which the async API for uart can be provided
by another driver (case in point, uart_rtt), and thus there is no valid
DMA controller for the uart_sam0 driver to talk with.

By separating the configuration, there's no need to exclude samd20-based
boards (that have no DMA peripheral) from the uart_async_api tests.

Signed-off-by: Diego Elio Pettenò <flameeyes@meta.com>
Co-authored-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-08-21 17:15:29 +02:00
Vincent Geneves
3b3528cd90 drivers: flash: spi_nor: Add reset pin
Add Reset pin initialization during Spi NOR driver start-up. Toggle
the pin to reset the device.

Signed-off-by: Vincent Geneves <vgeneves@kalray.eu>
2023-08-21 09:52:54 -05:00
Fabio Baltieri
19290e465d input: gpio_keys: drop struct gpio_keys_data
Drop the data data structure and use the pin data one directly, also add
a missing const qualifier in the main conf data structure, both save few
bytes of RAM on some platforms.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-21 16:08:42 +02:00
Fabio Baltieri
5b1b874206 regulator: shell: add device name completion
Add the code for the shell to complete the device name in the regulator
commands.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-21 10:56:12 +02:00
Mykola Kvach
5a87252c53 drivers: regulator: add regulator-gpio driver
Add basic support of 'regulator-gpio'. For now, it is support
only controling voltage and driver presents only six functions:
  * enable and disable the regulator;
  * set and get voltage;
  * count and list of voltage(s).

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-08-21 10:55:26 +02:00
Andy Sinclair
7a71ebe372 drivers: mfd: npm1300: Added event interrupt handling
Added support for npm1300 interrupt events

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-08-21 10:04:03 +02:00
Andrzej Kuros
04d3dcb116 drivers: ieee802154_nrf5: energy_detected api change adjust
The prototype of `nrf_802154_energy_detected` callout has changed.
This commit adjusts to this change.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-08-20 19:31:21 +02:00
Bjarki Arge Andreasen
f6fde45e09 drivers/modem/hl7800.c: Fix ictx reference
Use the symbol iface_ctx in place of ictx. This was
introduced seemingly by mistake in PR #61510

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-08-20 17:57:11 +01:00
Tomislav Milkovic
96869ff3ff drivers: flash: flash_stm32h7x: Fix STM32H7 unaligned read access
Due to source data pointer having no alignment constraint,
extra care needs to be taken when reading source data
as dword

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2023-08-18 12:13:41 +02:00
Mustafa Abdullah Kus
2e4e992644 drivers: adc: add max1125x driver
This adds support for the max1125x (max11254, max11254)
family of spi adc devices.

Signed-off-by: Mustafa Abdullah Kus <mustafa.kus@sparsetechnology.com>
2023-08-18 12:05:17 +02:00
Ryan Erickson
4885dae94d modem: hl7800: ensure the modem inits with radio on
Ensure the driver enables the LTE radio during init unless boot
in airplane mode is specified.
To ensure the settings applied during init are used, the LTE radio
is turned off during config.
Fix issue where PDP and GPRS connection config could have a mismatched APN.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-08-18 10:13:30 +02:00
Grant Ramsay
a6e1f89bda drivers: eth_e1000: Enable the correct IRQ for multi-instance
The code was always enabling DT INST 0 IRQ

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-18 10:13:12 +02:00
Grant Ramsay
8b703cab8c drivers: eth_e1000: Use IRQ "flags" if IRQ "sense" is not present in DT
Binding like "arm,gic" call these flags "flags" whereas binding like
"intel,ioapic" call them "sense". Allow either to work

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-18 10:13:12 +02:00
Anas Nashif
66b0472d6f drivers: imply CRC where applicable
Do not depend on CRC, imply it, as it is disabled by default now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-18 08:52:16 +03:00
Anas Nashif
bc03455f37 drivers: fpga: imply CRC
This driver needs CRC, so select it instead of relying on it set by
default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-18 08:52:16 +03:00
Dominik Ermel
0538041cd6 drivers: flash: nrf_qspi_nor: Process ret of qspi_device_init
Commit slters z_impl_nrf_qspi_nor_xip_enable to not call
qspi_device_init in case when xip_enabled has the same value
as requested.
In case when qspi_device_init returns non-zero no further actions
are taken and xip_enabled will not be to set requested value.

Fixes #59535.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-08-17 20:38:11 +02:00
Fabio Baltieri
243e84d155 ethernet: phy_mii: get the MDIO bus with DT_INST_BUS
Now that all in-tree phys are declared under their mdio bus, drop the
`mdio` property and use DT_INST_BUS to find the bus.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-17 13:29:45 -05:00
Antoniu Miclaus
a26a660e50 drivers: ethernet: adin2111: fix device assignment
`k_thread_create` function has the 'adin' device passed as 1st
entry pointer. Therefore the device configuration is obtained directly
from the `dev` structure.

Adujst the code accodringly.

Fixes: 75dde83 ("drivers: ethernet: adin2111: add adin1110 support")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
2023-08-17 16:51:28 +02:00
Bartosz Bilas
ac9c74aa7c drivers: hwspinlock: constify config struct
`DEVICE_DT_INST_DEFINE` requires to pass pointer to the device's
private constant data so make it const.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2023-08-17 15:40:17 +02:00
Mateusz Sierszulski
47d0e79444 drivers: i2c: Add Ambiq I2C driver
This commit adds I2C master driver for Apollo4 SoCs.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-08-17 15:15:45 +02:00
Daniel Leung
e3ecca5784 bluetooth: fixes shadow variables
Massaging code to fix shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-17 13:00:09 +02:00
Mulin Chao
524190154b npcx: espi: move DT nodes to specific files which support them
Since VWGPSM (Virtual Wire GPIO Target-to-Controller) registers are
introduced in npcx9 and later series, the CL moves the related DT nodes
from npcx-espi-vws-map.dtsi (Used for all npcx series) to the specific
dtsi files for npcx9 and npcx4 series.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-08-17 10:25:49 +01:00
Andrzej Głąbek
45dcc6c5db drivers: spi_nrfx_spis: Enable required SPI_SLAVE option in Kconfig
This is a follow-up to commit fa609e5844.

This driver implements SPI slave operations only and cannot be used
without the corresponding Kconfig option enabled.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-17 11:02:24 +02:00
Eric Holmberg
9452cbfe9d soc: esp32s3: add ADC single-shot support
Add support for single-shot ADC readings.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2023-08-17 10:36:20 +02:00
Eric Holmberg
38203f9cb0 drivers: adc: esp32: return unsupported for unsupported options
To allow the ADC API unit test to skip tests for non-implemented
features, return -ENOTSUP.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2023-08-17 10:36:20 +02:00
Aziz Idomar
f66b73197d drivers: hwspinlock: implement sqn hwspinlock driver
When we lock an hwspinlock, we must write the CPU identifier to
the hwspinlock register. If we want to unlock the locked hwspinlock,
we have to rewrite the same CPU identifier.

To define the CPU identifier, we use affinity 1 and affinity 2 fields
of the MPIDR register.

Signed-off-by: Aziz Idomar <aidomar@sequans.com>
2023-08-16 20:46:55 +02:00
Aziz Idomar
c3ac598c7f drivers: introduce hardware spinlock framework
The intention of hardware spinlock is to allow two processors,
that have no alternative mechanism for accomplish synchronization
and mutual exclusion operations, to share resources (such as
memory and/or any other element).

Here, we add the hwspinlock framework, that makes possible to use
those hwspinlock devices and stay platform-independent. Each
platform wishing to support hardware spinlock must describe a
driver using this framework.

Signed-off-by: Aziz Idomar <aidomar@sequans.com>
2023-08-16 20:46:55 +02:00
Antoniu Miclaus
a6e3829252 drivers: ethernet: adin2111: add adin1110 support
Add support for ADIN1110 10BASE-T1L Ethernet MAC-PHY.

The ADIN1110 is an ultra low power, single port, 10BASE-T1L
transceiver design for industrial Ethernet applications and is com-
pliant with the IEEE® 802.3cg-2019™ Ethernet standard for long
reach, 10 Mbps single pair Ethernet (SPE). Featuring an integrated
media access control (MAC) interface, the ADIN1110 enables direct
connectivity with a variety of host controllers via a 4-wire serial
peripheral interface (SPI). This SPI enables the use of lower power
processors without an integrated MAC, which provides for the
lowest overall system level power consumption. The SPI can be
configured to use the Open Alliance SPI protocol or a generic SPI
protocol.

Documentation:
https://www.analog.com/en/products/adin1110.html

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
2023-08-16 20:45:03 +02:00
Andriy Gelman
d330d97997 dts: bindings: Rename compatible infineon,xmc4-i2c->infineon,xmc4xxx-i2c
To be consistent with other xmc4xxx drivers.

A few other device tree changes:
- Rename clock signal option as it's handled by DX1.
- Remove clock-frequency option as it's already added in
  i2c-controller.yaml, and interrupts is already defined as array
  in base.yaml.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-08-16 20:43:50 +02:00
Andriy Gelman
16c40b16f3 drivers: i2c: i2c_ifx_xmc4: Configure I2C and other small fixes
Currently the driver is not configured as controller during initialization.
Any use of I2C in controller mode without an explicit i2c_configure() will
not work.

In this commit the driver is automatically configured.
But, delay the configuraition until first use instead of during init
because otherwise tests/drivers/i2c/i2c_target_api hangs without any
errors on xmc47_relax_kit (when internal pulls are used). This issue
needs to be investigated.

There are a few other fixes/cleanups:
- Change the default master_frequency from XMC4_I2C_SPEED_STANDARD to
  I2C_SPEED_STANDARD.
- Use devicetree clock frequency for target configuration instead of
  I2C_SPEED_STANDARD.
- Rename master_frequency to bitrate as it's also used by the target
  configuration now.
- Remove several uneeded casts.
- Forward backup config in get_config().

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-08-16 20:43:50 +02:00
Ritwika Dey
739788143f driver: watchdog: wdt_ifx_cat1: masking added
Masking is added so that WDT is not invoked multiple times

Signed-off-by: Ritwika Dey <Ritwika.Dey@infineon.com>
2023-08-16 20:42:45 +02:00
Tom Burdick
dae2f33e5e rtio: Remove references to simple executor
The simple executor was removed with the usage of the spsc queue but
some stray references remained. Remove those.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-08-16 20:41:18 +02:00
Tanmay Shah
732703688b drivers: ipm: xlnx: remove redundant code
Remove redundant function during child node initialization.
Move log related header file near log related macro.

Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
2023-08-16 20:31:17 +02:00
Florian Grandel
137a7edd6e drivers: ieee802154: nRF5: TX timestamp now refers to start of PHR
Based on the standard based definitions given in previous commits, the
TX timestamp used for timed TX now refers to the start of PHR. As OT
continues to calculate timestamps based on a "start of SHR" definition,
the duration of the PHY specific SHR is added in the OT adaptation layer
to make up for this OT quirk.

Fixes: #59245

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-16 17:06:16 +02:00
Florian Grandel
7db0184e1b drivers: ieee802154: nRF5: remove RX PHR offset workaround
Builds upon the newly introduced nrf_802154_phr_timestamp_get() function
to calculate RX timestamps according to the timestamp definitions
introduced in earlier commits and removes the prior workaround to
calculate the start-of-frame message timestamp point.

Fixes: #59245

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-16 17:06:16 +02:00
Florian Grandel
eacec3dad2 modules: openthread: radio: encapsulate OT 32-bit timestamp
OT does not have 64 bit timestamp support. This is a limitation of OT
and not of the IEEE 802.15.4 driver API. Therefore any workaround
related to such OT idiosyncracies should be encapsulated inside the OT
adapatation layer.

This change moves the OT-specific conversion of OT 32 bit timestamps to
Zephyr 64 bit timestamps into the OT adaptation layer.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-16 17:06:16 +02:00
Chris Collins
2bf231f39a adc: ads1x1x: improve behaviour during i2c errors
Fixes #61401

The ADS1x1x driver has a bad habit of assuming i2c operations will
always suceed - this fixes the two worse cases in the code I could
identify (there may yet be more).

* During initial ADC setup, if either of the two I2C operations
  (read or write) fails, raise the error immediately to the caller
  rather than letting it fall through to the acquisition thread.

  This ensures that we only ever attempt to give a result that was
  definitely connected to our attempt to start the capture.

* If the acquisition thread encounters an I2C error, raise the error
  but do not terminate the aquisition thread.  This ensures the
  application can attempt to fix the condition that caused the I2C
  error and try again.

Signed-off-by: Chris Collins <kuroneko@sysadninjas.net>
2023-08-16 17:05:44 +02:00
Andrzej Głąbek
88ab153ac4 drivers: pwm_nrf5_sw: Rename to pwm_nrf_sw
Since the driver can now be also used on nRF91 Series, its name need to
be updated to not cause confusion.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek
8c1c666bab drivers: pwm_nrf5_sw: Extend to work also with DPPI
Instead of directly configuring PPI channels, use the GPPI helper
provided by nrfx. This allows using the driver on nRF53 an nRF91
Series where DPPI is available instead of PPI.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek
9e860062b6 drivers: pwm_nrf5_sw: Use GPIOTE SET and CLR tasks when available
When possible, use separate GPIOTE tasks for setting the PWM output
high and low instead of using one task to toggle it. This is crucial
for DPPI where the same task cannot be used in more than one channel.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek
c43cef01fd drivers: pwm_nrf5_sw: Make proper use of 32-bit timers
When a 32-bit timer is configured as the generator, use its full
bit width.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek
b82f2d9ec2 drivers: pwm_nrf5_sw: Clear GPIOTE config only when switching to GPIO
Otherwise a glitch can appear on the PWM output when the GPIOTE channel
is reconfigured (when GPIOTE releases the pin, GPIO takes control and
drives it to the last written state which may be different than that
used recently by GPIOTE).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek
b04fd975b6 drivers: pwm_nrf5_sw: Use nrfx HALs instead of direct register accesses
This makes the code easier to maintain.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
YuLong Yao
0ad0dea200 driver: wifi: esp32: fix esp32_wifi_send not work in ap mode
use `ESP_IF_WIFI_AP` when call esp32_wifi_send in ap mode

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-08-16 14:56:27 +02:00
Anisetti Avinash Krishna
f6aa3e8adb drivers: gpio: gpio_intel: Corrected offset to check PMODE
Corrected offset to read PMODE to check function number.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-08-16 14:52:47 +02:00
Fabio Baltieri
f2e275639d ethernet: smsc91x: rework the device node hierarchy
Rework the devicetree definition for smsc91x to put the mdio and
ethernet device at the same level, and make the phy a child of the mdio
node.

This allows matching up the device initialization sequence with the
devicetree hierarchy.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-16 14:52:31 +02:00
Fabio Baltieri
e9e111b513 ethernet: smsc91x: fix a build warning
Move few variable inside a case statement to avoid build warning for
unused variables in some specific configuration.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-16 14:52:31 +02:00
Fabio Baltieri
acbb7a39bb ethernet: smsc91x: select MDIO
This driver implements an MDIO device. Enable the MDIO driver to avoid a
build error for:

orphan section `._device.static.3_CONFIG_MDIO_INIT_PRIORITY_'

Also set the proper compatible in mdio_shell so that the ethernet tests
build correctly.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-16 14:52:31 +02:00
Mateusz Sierszulski
171285140c drivers: watchdog: Add Ambiq wdt driver
This commits add watchdog driver for Apollo4 SoCs

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-08-16 13:03:33 +02:00
Henrik Brix Andersen
de172f88d0 drivers: can: stm32h7: fdcan: rename driver to match reference manuals
Rename the STM32H7 FDCAN driver Kconfig symbol and implementation file to
match the naming used in the ST reference manuals.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-08-16 13:03:00 +02:00
Henrik Brix Andersen
8b16dbe308 drivers: can: stm32h7: fdcan: fold Kconfig file into stm32 Kconfig file
Fold the Kconfig options for the STM32H7 FDCAN driver into the main
Kconfig.stm32 file.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-08-16 13:03:00 +02:00
Henrik Brix Andersen
8410e9ab85 drivers: can: stm32: fdcan: rename driver to match reference manuals
Rename the STM32 FDCAN driver Kconfig symbol and implementation file to
match the naming used in the ST reference manuals.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-08-16 13:03:00 +02:00
Henrik Brix Andersen
ff85523d04 drivers: can: stm32: fdcan: fold Kconfig file into stm32 Kconfig file
Fold the Kconfig options for the STM32 FDCAN driver into the main
Kconfig.stm32 file.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-08-16 13:03:00 +02:00
Henrik Brix Andersen
913e59c5ea drivers: can: stm32: bxcan: rename driver to match reference manuals
Rename the STM32 bxCAN driver DTS compatible, Kconfig symbol, and
implementation file to match the naming used in the ST reference manuals.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-08-16 13:03:00 +02:00
Henrik Brix Andersen
ff722597e8 drivers: can: stm32: bxcan: fold private header into implementation file
Fold the contents of the private header for the STM32 bxCAN driver into the
implementation file.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-08-16 13:03:00 +02:00
Thomas Stranger
cec279b5b6 drivers: can: stm32: correct timing_max parameters
The timing_max parameters defined in the stm32 bxcan driver don't match the
register description in the reference manuals.
- sjw does have only 2 bits representing 1 to 4 tq.
- phase_seg1 and phase_seg2 max is one tq higher.

I have checked the following reference manuals and all match:
- RM0090: STM32F405, F415, F407, F417, F427, F437 AND F429
- RM0008: STM32F101, F102, F103, F105, F107 advanced arm-based mcus
- RM0351, RM0394: all STM32L4
- RM0091: all STM32F0 with CAN support

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-08-16 10:24:26 +02:00
Manuel Argüelles
297b7efb33 intc: nxp_s32: initialize after core intc
Following #60410, the NXP S32 external interrupt controller device
initializes after the core interrupt controller. Bump the NXP S32 intc
init level to initialize after the core intc and before the GPIO
device driver.

Fixes #61218

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-16 10:21:33 +02:00
Balsundar Ponnusamy
8fae16f596 drivers: counter: Add shell commands for timer
add shell implementation for timer

Signed-off-by: Balsundar Ponnusamy <balsundar.ponnusamy@intel.com>
2023-08-16 10:20:31 +02:00
Balsundar Ponnusamy
e3f0ec6d41 drivers: counter: add snps apb timer
adding driver for snps dw timer

Signed-off-by: Balsundar Ponnusamy <balsundar.ponnusamy@intel.com>
2023-08-16 10:20:31 +02:00
Manimaran A
a3d6b423c6 drivers: tacho: mchp: low power feature enabled
Updated Tacho driver to support low power feature.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-08-16 10:20:12 +02:00
Keith Short
ee0c5f9161 tests: drivers: gpio: Add NCT38xx gpio-alert
Add support for the NCT38xx GPIO alert driver in the build all test.

This fixes issue:
https://github.com/zephyrproject-rtos/zephyr/issues/61436

Signed-off-by: Keith Short <keithshort@google.com>
2023-08-15 21:55:31 +00:00
Mourad Kharrazi
651c841faa drivers: hyperram: Add Winbond W956A8MBYA driver
Adding hyperram support for Winbond W956A8MBYA

Signed-off-by: Mourad Kharrazi <mourad.kharrazi@ithinx.io>
2023-08-15 21:51:57 +00:00
Matthias Hauser
6975262047 drivers: sensor: correct scale in WSEN_ITDS driver
correct scale in WSEN_ITDS driver to overcome sign extension issues

Signed-off-by: Matthias Hauser <Matthias.Hauser@we-online.de>
2023-08-15 12:26:28 -05:00
Flavio Ceolin
c5bb002f77 espi: mchp_xec_v2: Fix possible buffer overflow
Check the packet lenght in flash_write operation beforeSigned-off-by
copying it to an internal buffer.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-08-15 10:17:07 -07:00
Flavio Ceolin
4102179f3f espi: mchp_xec: Fix possible buffer overflow
Check the packet lenght in flash_write operation before
copying it to an internal buffer.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-08-15 10:17:07 -07:00
Thomas Stranger
8009ccce43 drivers: can: mcux: flexcan: can_set_mode supports can_mode_3_samples
In case CAN-FD mode is not enabled the mcux flexcan driver supports
CAN_MODE_3_SAMPLES.
This has been removed inadvertently while adding can-fd support.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-08-15 10:11:32 -07:00
Tanmay Shah
09e2a4e9eb drivers: ipm: add zynqmp r5f support
Add ipm driver to use Inter Processor Interrupts
on Xilinx ZynqMP platform. This patch also adds sample
application that shows use of xlnx ipm driver.

This driver uses default arm gic interrupt controller
and works only for lockstep mode of cortex-r5f
cluster for now.

In split mode the cortex-r5 cluster will
have two r5f cores and they are expected to work in AMP
mode. If both r5f cores run simultaneouly, only one of
the core is able to receive IPI interrupts at this time
and it will be the one that started later. In future
this limitation shall be removed.

Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
2023-08-15 11:23:04 +00:00
Jacob Siverskog
6f2e73a32f drivers: dma: remove unnecessary null check
the dev pointer is already dereferenced before this function is
called, so this check does not make any sense.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2023-08-15 11:16:19 +00:00
Fabio Baltieri
d55ea3aa72 drivers: regulator: shell: add a shipmode command
Add a shipmode regulator shell command to test shipmode on regulators.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-14 18:11:36 +00:00
Manuel Arguelles
35ad5358a4 spi: nxp_s32: use spi_cs_is_gpio() in config initializer
Following #56576, the `cs` field in `struct spi_config` is of type
`struct spi_cs_control` instead of a pointer to the same type.
This PR updated the driver to use `spi_cs_is_gpio()` helper to
check if SPI CS is controlled using a GPIO.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-14 18:11:04 +00:00
Florian Grandel
b954ce4903 drivers: cc13xx_cc26xx: pwm: introduce pwm driver
This change introduces a new PWM driver for all CC13/26xx SoC.

See the documentation in ti,cc13xx-cc26xx-timer-pwm.yaml for detailed
usage instructions.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-14 13:36:12 +00:00
Ievgen Ganakov
be779f2a61 intel_adsp: hda: fix usage of FIFORDY bit
In case of HDA Link DMA FIFORDY bit is RO according
to HW specification thus should be managed by HDA controller.

Add a logic to set FIFORDY for HDA Host DMA only

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2023-08-11 06:25:48 -04:00
Mykola Kvach
d9fe261f8e drivers: regulator-fixed: extend api of driver (list/count voltages)
Allow properties 'regulator-min-microvolt' and 'regulator-max-microvolt'
for fixed regulators: Note: they should be equal.

Add simple functions for getting list of allowed and count of voltages.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-08-10 18:11:35 +00:00
Mykola Kvach
ed9ca0f6d3 drivers: regulator-fixed: add possibility to work without enable pins
Possible situation is that in some driver, devices can be controlled in
different ways: in some, we can only turn the power on or off, in others,
we can only control the voltage, and in some, we can control power supply
or voltage level. There may also be devices where there is no control
over power supply at all. A clear example of this can be eMMC devices
where the voltage is usually fixed and they are always powered on.
However, we would like to have a common code for controlling all the
mentioned types of devices, at least the driver shouldn't worry about the
implementation details of voltage regulators. Therefore, there may exist
empty regulators - regulators that only contain information about the
supported voltage, and we cannot change anything in them. The device tree
node description for such a regulator is only necessary for compatibility
with other regulators. Hence, we need to add the possibility of the
existence of such a dummy fixed-regulator.

In this commit, support for a fixed dummy regulator without the ability
for any control has been added. Note that such support also exists in the
Linux kernel. In other words, the logic of the fixed regulator has been
aligned with the logic of the fixed regulator inside the Linux kernel.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-08-10 18:11:35 +00:00
Bjarki Arge Andreasen
12e79ca4ce drivers/modem/gsm_ppp.c: Remove direct call to PPP API
This commit removes the direct calls of the PPP API of the
network device used by gsm_ppp.c

These calls are now performed by the L2 PPP interface when it
is brought up or down using net_if_up() or net_if_down()

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-08-10 16:23:39 +00:00
Joshua Lilly
cce530cae4 scripts: build: gen_isr_tables: make bit masks configurable
Some architectures such as RISC-v support more than 255 interrupts
per aggrigator. This diff adds the ability to forgo the aggrigator
pattern and use a configurable number of bits for multilevel
interruts.

Signed-off-by: Joshua Lilly <jgl@meta.com>
2023-08-10 10:55:41 -04:00
Andrei Emeltchenko
e56c5b2eb2 drivers: smbus: Select PCIE and DYNAMIC_INTERRUPTS
Select PCIE and DYNAMIC_INTERRUPTS as they are needed for driver to
work. This allows to remove board configuration overlay files.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-08-10 13:59:15 +03:00
Fabio Baltieri
a534169ed4 input: rename callback define macro to INPUT_CALLBACK_DEFINE
Looking back at the current INPUT_LISTENER_CB_DEFINE api naming, it
feels like it's a bit overloaded. Rename it to a simpler
INPUT_CALLBACK_DEFINE.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-10 08:15:10 +00:00
Daniel Leung
5bc08ae3c6 net: rename shadow variables
Renames shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:43 +00:00
Daniel Leung
af325193b6 modem: renames shadow variables
Renames shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:43 +00:00
Daniel Leung
35cda1d5cb ethernet: rename shadow variables
This renames the shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:43 +00:00
Daniel Leung
6c85e615c5 usb: fixes shadow variables
This fixes a shadow variables found by -Wshadow.
The variable ep_ctx is only used in certain switch cases
so declare it when it is needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
caf6490d53 dai: rename shadow variables
Renames shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
80cd39faed spi: pl022: remove shadow variables
Removes the shadow variable found by -Wshadow. The value of this
variable is the same throughout the for loop, so there is no
need to assign it again for each iteration.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
efe27f577a flash: rename shadow variables
Renames shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
7c208be144 uart: renames shadow variables
Renames	shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
6b0d40b1a1 pinctrl: renames shadow variables
Renames	shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Daniel Leung
51ff4ced59 clock_control: renames shadow variables
Renames	shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-10 08:14:12 +00:00
Sreeram Tatapudi
b7e623c886 drivers: counter: cat1: Fix formatting issues
Minor format fixes for consistency

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2023-08-10 08:13:11 +00:00
Sreeram Tatapudi
fa471172b7 drivers: counter: cat1: Fix test_single_shot_alarm_notop
TC "test_single_shot_alarm_notop" is failing because there were 2 ISR
callbacks instead of one. this is because of invoking
ifx_cat1_counter_set_int_pending incorrectly. Updated
ifx_cat1_counter_set_alarm to fix this

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2023-08-10 08:13:11 +00:00
Manimaran A
aed0ecfd56 drivers: gpio: mchp: Twister fix for test_input_output failure
Added logic to return ENOTSUP, if input-output GPIO
direction requested.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-08-09 20:24:22 -04:00
Adam Wojasinski
9de69aabfd drivers: spi: spi_nrfx_spi: Add CPOL handling on SCK pin
Pin state after SPI deinitialization is based on pinctrl configuration.
On the other hand, CPOL is set during runtime. When the SPI instance
is disabled GPIO takes control over SCK and drives it to state set
by pinctrl driver. This might causes an invalid SCK state
when the transaction is configured with CPOL (Clock Polarity).

To address this issue, a patch was introduced to the SPI driver.
Now, when a SPI instance is configured with CPOL,
the driver is setting in the runtime the correct state of the SCK pin.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-08-09 18:31:28 +00:00
Adam Wojasinski
315dd0f41c drivers: spi: spi_nrfx_spim: Add CPOL handling on SCK pin
Pin state after SPIM deinitialization is based on pinctrl configuration.
On the other hand, CPOL is set during runtime. With the introduction
of the power-optimized SPIM driver, it disables the peripheral instance
once the transfer is completed.
As a result, the GPIO takes control over the SCK pin and drives it
based on pinctrl configuration which causes an invalid SCK state
when the transaction is configured with CPOL (Clock Polarity).

To address this issue, a patch was introduced to the SPIM driver.
Now, when a SPIM instance is configured with CPOL,
the driver is setting in the runtime the correct state of the SCK pin.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-08-09 18:31:28 +00:00
Jani Hirsimäki
83ea1e26a2 net: l2: ppp: ppp uart usage fixed
This fixes 3 issues that came within PR #59124 for ppp uart usage.

Earlier start/stop of ppp was done at enable() but that
was removed in PR #59124. Now putting enable/disable() back and
putting start/stop there.
Additionally, there was a double ppp carrier ON when NET_EVENT_IF_DOWN.
For that net_if_carrier_on/off is set in uart ppp.c driver.
Also, maybe worth to be mentioned that after PR #59124 there is no
ppp carrier off when lcp is disconnected, for workaround that change,
application should use ppp dead/running events.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2023-08-09 16:07:46 +00:00
Bjarki Arge Andreasen
2c2f1c4576 drivers/rtc/rtc_mc146818.c: Add input clock config to driver
This commit adds input clock selection to the RTC driver. This
is required to allow for the real hardware to operate. The
QEMU emulated hardware ignores the input clock settings.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-08-09 07:27:40 -04:00
Bjarki Arge Andreasen
588d39112d drivers/rtc/mc146818: Patch MC146818 driver
The MC146818 driver was not properly initialized
by the driver, interrupts where not handled correctly,
and the alarm feature was not implemented properly.

This commit fixes these issues, while removing some
code which became redundant as the MC146818 driver
was patched.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2023-08-09 07:27:40 -04:00
Fabio Baltieri
4488a41f8c Revert "sensors: Fix overflow in default decoder"
This reverts commit b2a78ff679.

Causes CI fail on:

west build -p -b native_posix_64 -T
	tests/drivers/build_all/sensor/sensors.generic_test

Assertion failed at
WEST_TOPDIR/zephyr/tests/drivers/build_all/sensor/src/generic_test.c:204:
run_generic_test: (expected_shifted not within actual_shifted +/-
epsilon_shifted)

Expected -105484396736, got -103734438144 (shift 6, ch 8, iteration 1/5,
Error -1749958592, Epsilon 3221184)

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-09 11:11:37 +00:00
YuLong Yao
af0583d87d driver: wifi: esp32: enable iface when enable ap mode
when ap mode is enable,
we don't enable iface by `net_eth_carrier_on` before,
this will cause wifi tx error.

this patch fix this issues.

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-08-09 08:34:56 +00:00
Manuel Argüelles
c031c9359e mbox: nxp_s32: fix semicolon typos
Replace unintended commas with semicolons.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-09 08:34:28 +00:00
Manuel Argüelles
dcb570985b gpio: nxp_s32: use CONFIG_GPIO_INIT_PRIORITY
Use `CONFIG_GPIO_INIT_PRIORITY` instead of the generic device driver
init priority.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-09 08:34:18 +00:00
YuLong Yao
28f5366e0e drivers: wifi: esp32: choose channel 0 by default
When channel set to WIFI_CHANNEL_ANY, ap will not work.
This patch choose channel 0 when channel is WIFI_CHANNEL_ANY.

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-08-09 08:32:39 +00:00
Eduardo Montoya
f4d54fa4b9 drivers: ieee802154: nrf5: fix handling multiple CCA
Fix a couple of bugs introduced with last commits related to multiple
CCA support.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2023-08-09 08:32:26 +00:00
Manuel Arguelles
3112b6de1a serial: nxp_s32: use CONFIG_SERIAL_INIT_PRIORITY
Use CONFIG_SERIAL_INIT_PRIORITY instead of the generic device driver
init priority.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-09 08:28:52 +00:00
Yuval Peress
b2a78ff679 sensors: Fix overflow in default decoder
The default decoder would take the micro-unit value of the old sensor
value and multiply it by INT32_MAX. This would, at times, cause an
overflow for the int64_t which is the cause of some bugs like when
-7952 was used (-7952000000 * INT32_MAX < INT64_MIN). Instead the new
math converts:
- `value_u * INT32_MAX / ((1 << header->shift) * 1000000)`

to a bitmap:
- `sample.val1` consumes the upper `N` bits
- `sample.val2 * BIT(32 - N) / 1000000` consumes the lower `32-N`
    bits

This both improves the accuracy, and avoids the overflow since
`shift` is guaranteed to be between 0 and 31.

Signed-off-by: Yuval Peress <peress@google.com>
2023-08-09 08:28:32 +00:00
Tristan Honscheid
128b466dd1 emul: icm42688: Implement backend sensor emul API
Implement the backend emul API for the ICM42688 motion sensor so it can
be automatically tested by the generic sensor test (see #60394).
Supports all channels (temp, accel XYZ, and gyro XYZ) at each of the
programmable full-scale accel and gyro ranges.

Also fixes an arithmetic bug in the driver that was causing a minor
error in the returned readings.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-08-09 08:27:59 +00:00
Fabio Baltieri
2cfffda32a sensor: max17055: support fetching individual channels
Add support for fetching individual channels rather than forcing the
application to always fetch them all. Potentially saves few i2c
transactions.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-09 08:27:13 +00:00
Fabio Baltieri
fa2481e6fb sensor: max17055: convert floating point operation to integer
Convert a few floating point operation to fixed point. May save some
stack and some flash as well on soft-fp systems.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-09 08:27:13 +00:00
Fabio Baltieri
2f9b120860 sensor: max17055: change register access function addr to uint8_t
The register space for the device is on 8 bit, use uint8_t for register
address to the low level read and write functions.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-09 08:27:13 +00:00
Fabio Baltieri
510a206cf0 sensor: max17055: use sys_get_le16 for data format conversion
Use sys_get_le16 instead of the manual byte order conversion.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-09 08:27:13 +00:00
Markus Fuchs
27af62603c drivers: counter: gecko: Add SYSRTC stimer support
SiLabs' sleeptimer driver supports several hardware peripherals, of
which the counter driver so far only supports the RTCC-based variant.

This patch adds support for the SYSRTC-based sleeptimer implementation,
which is required for Gecko SoCs that do not have an RTCC module.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2023-08-09 08:24:52 +00:00
cyliang tw
5148c98e83 drivers: spi: support for Nuvoton numaker series
Add Nuvoton numaker series spi controller, including
full and half duplex support.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-08-09 08:24:38 +00:00
Manimaran A
207e5c77d4 drivers: eeprom: mchp: Enable low power feature
Updated the driver to support low power mode

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-08-09 08:23:06 +00:00
Ryan McClelland
cea56b0409 drivers: sensor: icp10125 fix double-promotion warnings
sensor_value_from_double was used, but sensor_value_from_float
should be used as the parameter is a float

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-08-07 16:12:13 -07:00
Ryan McClelland
652cabeb85 drivers: serial: fix zephyr.h warning
When compiling the cadence uart, a warning is generated for the
zephyr/zephyr.h include. Fix it to be zephyr/kernel.h.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-08-07 18:51:28 +00:00
Jason Mitchell
74d08d69b2 drivers: serial: cmsdk_apb: fix irq_rx_ready deviation
The docstring for uart_cmsdk_apb_irq_rx_ready says "@return 1 if an
interrupt is ready, 0 otherwise" but the function actually returns 2 on
success. This commit fixes this to conform with serial driver API.

Signed-off-by: Jason Mitchell <jmitchell@radicalsemiconductor.com>
2023-08-07 12:01:25 -04:00
Maciej Sobkowski
9bc3ee67be drivers: counter: Add Ambiq counter driver
This commit adds Ambiq counter driver for Apollo4p SoCs.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
2023-08-07 16:12:58 +02:00
Madhurima Paruchuri
3bc694dd8d drivers: flash: npcx: Fix offset alignment check bug
Removed single offset alignment check mechanism and replaced it with
offset alignment check for each iteration

Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>
2023-08-07 13:08:27 +02:00
Aedan Cullen
5fc2586b8f drivers: sensor: lis3mdl: always use continuous mode
The LIS3MDL driver misunderstands the MD[1:0] bits in CTRL_REG3.
Correct this so that all ODR settings are functional.

Currently, single-conversion mode is enabled when fast ODR is set,
resulting in only one measurement being taken before the device
immediately returns to power-down mode. The result is that all fast-ODR
rates (155 and higher) are not usable when assigned to CONFIG_LIS3MDL_ODR.

Continuous mode is the only mode truly supported by this driver and should
always be used.

Signed-off-by: Aedan Cullen <aedan@aedancullen.com>
2023-08-07 11:28:02 +02:00
Fabio Baltieri
35e3bfcdef drivers: input: drop the zephyr,gpio-keys binding
This is now redundant and `gpio-keys` can be used instead.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-07 11:26:26 +02:00
Fabio Baltieri
2b489fd1f2 input: unify gpio-keys and zephyr,gpio-keys
Change the gpio-keys and zephyr,gpio-keys so that they can both be used
with the input subsystem driver. Make the zephyr,code property optional
so that existing out of tree board can still use this node with their
custom code, but change everything else so that an existin gpio-keys
node can be used with the input driver as long as the codes are defined.

From the application perspective, this means that the application can
still use the GPIOs directly, the input specific driver only gets
enabled if CONFIG_INPUT is enabled and the driver can always be turned
off manually.

This makes gpio-keys behave the same as gpio-leds with CONFIG_LED.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-07 11:26:26 +02:00
Fabio Baltieri
937116aef9 drivers: input: add missing GPIO_KEYS GPIO dependency
Add a missing dependency between GPIO_KEYS and GPIO.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-07 11:26:26 +02:00
Fabio Baltieri
13dfa0ac27 sensors: shell: implement rounding for q31_t
Since the sensor shell command was converted to use qt31_t, all the
integer values started to show up as rounded up by a fractional unit
when displayed, due to the conversion always rounding down.

Fix that by using the recently introduced DIV_ROUND_CLOSEST and handling
rounding up to next integer explicitly.

Before:

channel idx=44 gauge_state_of_charge value=83.999999

after:

channel idx=44 gauge_state_of_charge value=84.000000

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-07 11:26:02 +02:00
Peter van der Perk
86812b1551 sensors: ist8310: New driver
Adds support for the Isentek IST8310
3-axis magnetic sensor

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2023-08-04 17:30:02 -05:00
Peter Ujfalusi
009815e985 drivers: dma: intel-adsp-hda: Make sure channels are disabled before use
After boot the channel used for loading the basefw might be left enabled
by ROM.
Make sure that all channels are in stopped state to have consistency.

On TGL during Zephyr boot one channel is left running:
0:0x0x72800: Channel 0 of host out DMA (used for bassefw loading)
	dgcs: 0x4800100,
	dgbba 0x6000,
	dgbs 32768,
	dgbrp 8192,
	dgbwp 8192,
	dgbsp 0,
	dgmbs 0,
	dgbllpi 0x0,
	dglpibi 0x0

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2023-08-04 19:36:28 +00:00
Willian Wang
b7a4a927de drivers: modem: Remove unnecessary MODEM_SHELL dependency
MODEM_SIM_NUMBERS and MODEM_CELL_INFO don't depend on MODEM_SHELL.

Signed-off-by: Willian Wang <git@willian.wang>
2023-08-04 19:35:39 +00:00
Peter van der Perk
a095bd7328 drivers: led: Add Onsemi ncp5623c driver
The controller and the driver support two hardware configurations:
	   - one three-channel (RGB) LED
	   - or three single-channel LEDs

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2023-08-04 10:47:31 -05:00
Gerard Marull-Paretas
28c139f653 drivers: pm_cpu_ops: psci: provide sys_poweroff hook
Instead of implementing a custom power off API (pm_system_off),
implement the sys_poweroff hook, and indicate power off is supported by
selecting HAS_POWEROFF. Note that according to the PSCI specification
(DEN0022E), the SYSTEM_OFF operation does not return, however, an error
is printed and system is halted in case this occurs.

Note that the pm_system_off has also been deleted, from now on, systems
supporting PSCI should enable CONFIG_POWEROFF and call the standard
sys_poweroff() API.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-08-04 16:59:36 +02:00
Manuel Argüelles
ab346c08b5 drivers: nxp_s32_netc: fix init priorities
So far the init priories were:
enetc_psi0=60 < enetc_vsin=61 < emdio=70 < ethernet-phy=80
because the Ethernet PSI driver was doing global initialization for the
whole NETC complex, including enabling MDIO function (due to the way
the HAL works).

Change to use the default init priorities:
mdio=60 < phy=70 < eth=enetc_psi0=80 < enetc_vsin=81
by executing at an early stage the NETC global initialization. This also
allows to match the DT hierarchy representation of NETC with the
effective priorities assigned.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-04 13:55:45 +00:00
Mathieu Anquetin
ce674d9098 drivers: led: lp50xx: fix led index
The led identifer should refer to devicetree ordering, not to the index
used by the controller. This way, it will be possible to deactivate
some leds or to reorganize the indexing if necessary.

Signed-off-by: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com>
2023-08-04 13:18:01 +02:00
Mathieu Anquetin
d6c98db2cf drivers: led: lp50xx: add power management
Enable device power management using the low-power modes of the LP50XX
family.

Signed-off-by: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com>
2023-08-04 13:18:01 +02:00
Mathieu Anquetin
8807930248 drivers: led: lp50xx: add enable gpio
Some boards may have connected the enable pin of the chipset to a GPIO.
On these boards, it is necessary to configure and set this GPIO before
using the chipset, otherwise the I2C circuitry is disabled.

Based on initial work from:
  - Marek Janus <marek.janus@grinn-global.com>
  - Rico Ganahl <rico.ganahl@bytesatwork.ch>

Signed-off-by: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com>
2023-08-04 13:18:01 +02:00
Mathieu Anquetin
3c1b4d0a1f drivers: led: lp50xx: add reset
The LP50XX family has a specific register to reset the configuration to
default state from any other state. Use this instead of relying on the
manual configuration of registers during startup.

Based on initial work from: Marek Janus <marek.janus@grinn-global.com>

Signed-off-by: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com>
2023-08-04 13:18:01 +02:00
Mathieu Anquetin
26f4fab391 drivers: led: lp503x: extend driver to all lp50xx devices
Add support for LP5009, LP5012, LP5018 and LP5024 devices which only
differ by the number of LEDs they can control.

Also, update application sample to run on all these new supported
devices.

Based on initial work from:
  - Marek Janus <marek.janus@grinn-global.com>
  - Rico Ganahl <rico.ganahl@bytesatwork.ch>

Signed-off-by: Mathieu Anquetin <mathieu.anquetin@groupe-cahors.com>
2023-08-04 13:18:01 +02:00
Carles Cufi
6f8a1669cc drivers: bluetooth: hci: spi: Check and propagate return values
Check and propagate return values from GPIO calls.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/59529.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-08-04 11:56:48 +03:00
Maciej Sobkowski
5ffce32376 drivers: timer: Add driver for Ambiq system timer (STIMER)
This commit addst support for the system timer peripheral which
can be found in Apollo4 SoCs.

Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
2023-08-04 10:48:58 +02:00
Maciej Sobkowski
59b66b8b6a drivers: serial: pl011: Select PINCTRL for Apollo4 SoC family
PINCTRL needs to be enabled for the driver to work on the Apollo4 family
SoCs.

Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
2023-08-04 10:48:58 +02:00
Maciej Sobkowski
60591598e5 drivers: serial: pl011: Add support for Ambiq UART
UART controller present in Ambiq SoCs is mostly compatible with PL011, but
requires some quirks that are implemented in this commit:
- the peripheral needs to be powered on first, via the PWRCTRL core,
- peripheral clock needs to be enabled and configured via the CLKEN/CLKSEL.
  registers.

The quirks mechanism was inspired by support for STM32F4 SoC in the
usb_dc_dw driver (fce0b85eca).

Co-authored-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-08-04 10:48:58 +02:00
Maciej Sobkowski
a86ee2f2af drivers: serial: pl011: add definitions for CLKEN/CLKSEL registers
Add definitions for CLKEN/CLKSEL registers, which are used to control
peripheral clock on the variant of the PL011 UART present in Ambiq SoCs.

Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
2023-08-04 10:48:58 +02:00
Maciej Sobkowski
1c92b91fb4 drivers: serial: pl011: move register definitions into a header
The registers definitions will be needed when adding vendor-specific quirks
to this driver, so this commits moves them to a dedicated header file.

Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
2023-08-04 10:48:58 +02:00
Maciej Sobkowski
8a670d0713 drivers: pinctrl: Add pinctrl driver for Apollo4
This commit addst pinctrl support for Apollo4 SoCs.

Co-authored-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
2023-08-04 10:48:58 +02:00
Joshua Crawford
ea2dd9fc65 drivers: flash: spi_nor: select largest valid erase operation
The spi_nor erase op selection was based on the alignment of the end of
the region to be erased. This prevented larger erase operations being
selected in many cases

Closes #60904

Signed-off-by: Joshua Crawford <joshua.crawford@levno.com>
2023-08-04 10:46:39 +02:00
Dong Wang
b774b97ff9 drivers: i2c: Add Intel SEDI driver
Adds a new I2C shim driver for Intel SoCs. Builds upon the SEDI bare
metal I2C driver in the hal-intel module.

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2023-08-04 10:46:24 +02:00
Tim Lin
159fa4888b ITE: drivers/i2c: Channel C/i2c2 cannot use FIFO mode
Sometimes, channel C may write wrong register to the target device.
This issue occurs when FIFO2 is enabled on channel C. The problem
arises because FIFO2 is shared between channel B and channel C.
FIFO2 will be disabled when data access is completed, at which point
FIFO2 is set to the default configuration for channel B.
The byte counter of FIFO2 may be affected by channel B. There is a
chance that channel C may encounter wrong register being written due
to the FIFO2 byte counter wrong write after channel B's write operation.

The current workaround is that channel C cannot use FIFO mode.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-08-04 10:45:48 +02:00
Tom Burdick
0e373019d6 dma: intel_adsp_gpdma: Unmask interrupt on ACE
On ACE a seperate, soc specific, interrupt mask needs to be enabled
to unmask the interrupt. Do so for GPDMA.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-08-04 10:41:27 +02:00
Sylvio Alves
e544bdb5e2 drivers: spi: esp32: fix SOC_ESP32 reference
ESP32 SoC refactoring added new SOC_SERIES definition,
which was missed by #60183. This fixes it.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-08-03 18:14:33 +00:00
David Ullmann
bcc7499684 drivers: rt6xx ctimer pwm driver
using ctimer to implement pwm api
Signed-off-by: David Ullmann <davidu@meta.com>
2023-08-03 12:39:06 -04:00
Sylvio Alves
d7bcac091c drivers: spi: esp32: add option to handle lines state
SPI driver is current working for common SPI devices.
However, addressable LED like WS2812 requires MOSI line to be
default LOW during initialization. This PR adds such option.
This has no effect on common SPI operation.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-08-03 12:15:18 -04:00
Madhurima Paruchuri
9fab38dd04 drivers: flash: npcx: Update erase function to allow 0x1000 byte erase size
Modify the NPCX driver erase method to allow 0x1000 byte size erases
along with 0x10000 byte size erases based on input parameters

Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>
2023-08-03 10:29:14 +02:00
Cong Nguyen Huu
a872aa9a5e drivers: adc: support adc shell for mr_canhubk3
Add device nxp_s32_adc_sar  to adc shell list

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-08-03 08:28:31 +00:00
Manuel Argüelles
36f11627ce drivers: eth: add support for NXP S32 GMAC
Add initial support for NXP S32 GMAC/EMAC:
- it's a copy-implementation with DMA data buffers and buffer
  descriptors in non-cached memory (buf len and ring size configurable)
- PHY interface selection only implemented for S32K3 devices as it is
  SoC-specific
- no PHY driver integration, it works as a fixed link with speed/duplex
  configured through devicetree
- supports multicast hash filtering, promiscuous mode, MAC loopback

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-03 10:28:20 +02:00
Wei-Tai Lee
b69aea9f89 drivers: flash: add Andes qspi-nor driver
Add flash driver for Andes qspi.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2023-08-03 10:28:02 +02:00
Fabio Baltieri
d7504ab474 ethernet: esp32: make phy a phandle of the ethernet device
Change the eth-phy definition so that the phy is pointed by a phandle
rather than a child node, make the phy device a child of mdio. This
makes more sense from a devicetree hirearchy where the phandles have to
be initialized before the device itself, allows keeping the priorities
in check with CHECK_INIT_PRIORITIES.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-02 18:12:14 -04:00
Tristan Honscheid
cfc3a3b024 sensors: max17262: Run clang-format
Format the file `drivers/sensor/max17262/max17262.c` but exclude the
regsiter lookup table in `max17262_sample_fetch()`

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-08-02 09:53:45 +00:00
Tristan Honscheid
ef5899e5a0 sensors: max17262: Error-check init I2C operations
The init function of the MAX17262 sensor doesn't check the return value
of its I2C read and write functions. In case a read operation fails, the
output variable is not updated but the driver proceeds anyways. This can
cause unintended operation due to the potentially un-initialized memory,
such as getting stuck in the polling loop on line max17262.c:245. Update
the init function to abort and pass along the error code when I2C
transactions fail.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-08-02 09:53:45 +00:00
Fabio Baltieri
5037e3a902 ethernet: sam-gmac: make phy a phandle of the ethernet device
Make ethernet phys childs of the mdio device and move the mdio device up
a level on the tree. That makes the device hierarchy coherent with the
required initialization priority and allows keeping the sequence in
check with CHECK_INIT_PRIORITIES.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-01 15:37:59 +02:00
Maureen Helm
598fd31d51 drivers: sensor: Fix return value for unsupported channels
Fixes sensor drivers to consistently return -ENOTSUP when an unsupported
channel argument is passed to the sensor_channel_get function.

Signed-off-by: Maureen Helm <maureen.helm@analog.com>
2023-08-01 11:59:34 +02:00
Andrzej Głąbek
7974ff2665 drivers: spi_nrfx_*: Add support for optional WAKE line
Add option to use (by defining the `wake-gpios` devicetree properties)
an additional signal line between SPI master and SPI slave that allows
the latter to stay in low-power state and wake up only when a transfer
is to occur.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-01 11:07:21 +02:00
Andrzej Głąbek
f132f55e32 drivers: spi_nrfx_spis: Refactor prepare_for_transfer()
Refactor the function to make the execution flow in transceive()
clearer. In particular, return error codes directly, not through
spi_context_complete() which is unnecessary in this case.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-01 11:07:21 +02:00
Josep Puigdemont
eb3a56d8cd sensor: dht: return error if channel not supported
The driver would return the temperature for all channels requested
except relative humidity. Instead, ENOTSUP should be returned for
unsupported channels.

Signed-off-by: Josep Puigdemont <josep.puigdemont@gmail.com>
2023-08-01 09:51:25 +02:00
Manuel Arguelles
3d36af15fa drivers: watchdog: support NXP FS26 watchdog
Introduce support for NXP FS26 SBC watchdog. Both Challenger and
Simple watchdog types are supported. Only watchdog functionalities of
the device are supported and any other monitoring feature is either not
supported or disabled.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-01 09:51:16 +02:00
Manuel Arguelles
cd78028e15 drivers: spi: mcux_lpspi: allow to configure data pins
Add binding properties to allow configuring the direction of data pins
SDI and SDO.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-01 09:51:16 +02:00
Henrik Brix Andersen
de656c1169 drivers: can: sam: do not select cache management
Do not select CONFIG_CACHE_MANAGEMENT in the Microchip SAM CAN driver
Kconfig but rather leave it up to the SoC/platform Kconfig to enable it as
needed and enable CACHE_MANAGEMENT by default for the Atmel SAM E70/V71 SoC
series.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2023-07-31 19:38:22 +00:00
Dong D Wang
6fd3cf6a5b drivers: serial: sedi: cleanup init code
remove semaphores unused currently
remove two init helper maro

Signed-off-by: Dong D Wang <dong.d.wang@intel.com>
2023-07-31 13:13:47 -04:00
Dong D Wang
c896e1ed15 drivers: serial: sedi: add new dts attri peripheral-id
It's used to pass right device index to hal_intel module.
DT_INST_FOREACH_STATUS_OKAY() does not guarantee the node ordering.

Signed-off-by: Dong D Wang <dong.d.wang@intel.com>
2023-07-31 13:13:47 -04:00
Matthias Hauser
ee5c998257 drivers: sensor: fetch all channels on WSEN_ITDS sensor
fetch all channels on WSEN_ITDS sensor

Signed-off-by: Matthias Hauser <Matthias.Hauser@we-online.de>
2023-07-31 09:29:16 -05:00
Antoine Bout
dbea999347 soc/arm/silabs: Kconfig: add SOC_GECKO_USE_RAIL kconfig option
Currently on zephyr, RAIL is used only for bluetooth. RAIL library is
needed to use efr32 radio regardless of the protocol used. We add
SOC_GECKO_USE_RAIL kconfig option to indicate if we use radio.
FPU is needed when using RAIL, we configure it if SOC_GECKO_USE_RAIL
is set.

Signed-off-by: Antoine Bout <antoine.bout@silabs.com>
2023-07-31 09:05:17 +00:00
Fabio Baltieri
dfeb2d9027 ethernet: eth_stm32_hal: fix unused variable build warning
Fix an unused variable build warning that was happening in certain
configurations. Move the variables in the only condition where they are
actually used.

west build -p -b nucleo_f429zi \
	-T samples/net/cloud/aws_iot_mqtt/sample.net.cloud.aws_iot_mqtt

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-31 10:11:52 +02:00
Henrik Brix Andersen
b809d5ce10 drivers: can: stm32h7: fix message RAM address calculations
Calculate the Bosch M_CAN Message RAM addresses relative to the Message RAM
Base Address (MRBA), not the offset.

Fixes: #59624

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2023-07-31 10:09:47 +02:00
Fabio Baltieri
c2f4200ad5 bindings: ethernet: replace phy-dev with phy-handle
Rename the phy-dev property with phy-handle to match the Linux
ethernet-controller binding and move it up to ethernet.yaml so that it
can be used by other drivers.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-31 10:09:16 +02:00
Joshua Lilly
67268f5cbd drivers: interrupt_controller: plic: support edge triggered interrupts
This adds a check and option for edge triggered interrupts

Signed-off-by: Joshua Lilly <jgl@meta.com>
2023-07-31 10:08:52 +02:00
Nachiketa Kumar
9f6d6a0fa7 drivers: serial: Add Intel SEDI driver
Adds a new serial shim driver for Intel SoCs. Builds upon the SEDI bare
metal UART driver in the hal-intel module.

Signed-off-by: Nachiketa Kumar <nachiketa.kumar@intel.com>
Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2023-07-28 17:49:09 +02:00
Tristan Honscheid
171c1fc9d9 emul: Introduce emulator backend API and generic sensor test
This PR introduces a backend API to be implemented by sensor emulators
that creates a standardized mechanism for setting expected sensor
readings in tests. This unlocks the ability to create a generic sensor
test that can automatically set expected values in supported sensor
emulators and verify them through the existing sensor API. An
implementation of this API is provided for the AKM09918C magnetometer.

A generic sensor test is also created to exercise this implementation.
Observe that this test knows nothing about the AKM09918C; info about
supported channels and sample ranges is discovered through the backend
API. The test iterates over all devices attached to the virtual I2C and
SPI buses in the test binary's device tree, which (theoretically) covers
all sensors. Sensors whose emulator does not exist yet or does not
support the backend API are skipped.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-07-28 17:48:31 +02:00
Tristan Honscheid
4f8c90ead2 sensor: akm09918c: Fix conversion constant
The sensor driver uses the value 500 to convert bit counts to microgauss
values, but it should actually be 1500. Edit the driver unit test to use
the macro instead of a magic number.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-07-28 17:48:31 +02:00
Daniel Gaston Ochoa
1b3e2d98e4 drivers: stm32: SPI: Check that SPI buffers are in a nocache region
DMA only works with non-cached memory regions in H7. Check them
and return an error if they don't match this condition.

Signed-off-by: Daniel Gaston Ochoa <dgastonochoa@gmail.com>
2023-07-28 17:47:57 +02:00
Cong Nguyen Huu
f809614136 drivers: adc: add NXP S32 ADC SAR driver
Add support ADC SAR for NXP S32. ADC SAR diver
support 3 group channels (precision, standard
and external), run normal trigger in oneshot
conversion mode with 2 callbacks normal end
of conversion and normal end chain callbacks.
An instance only run on 1 group channel and
1 kind of callback at the same time.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-07-28 08:55:38 -05:00
Daniel DeGrasse
f9daa0397c drivers: sdhc: enable pwr-gpios property within SPI SDHC driver
Enable SPI SDHC driver to manage card power via pwr-gpios property.
Control for this property was previously partially implemented. When
this property is present, the SPI SDHC driver will use it to control
power to the SD card.

Power is toggled during SD init, so this power control can make SD init
more reliable as the power toggle will insure the SD card state is reset.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-28 09:07:55 +00:00
Florian Grandel
a4cd5cee40 drivers: ieee802154: consistent high res timestamps
The IEEE 802.15.4 API and networking subsystem were using several
inconsistent timestamp resolutions and types. This change defines all
timestamps with nanosecond resolution and reduces the number of
available types to represent timestamps to two:
* `struct net_ptp_time` for PTP timestamps
* `net_time_t` for all other high resolution timestamps

All timestamps (including PTP timestamps) are now referred to a
"virtual" local network subsystem clock source based on the well-defined
types above. It is the responsibility of network subsystem L2/driver
implementations (notably Ethernet and IEEE 802.15.4 L2 stacks) to ensure
consistency of all timestamps and radio timer values exposed by the
driver API to such a network subsystem uptime reference clock
independent of internal implementation details.

The "virtual" network clock source may be implemented based on arbitrary
hardware peripherals (e.g. a coarse low power RTC counter during sleep
time plus a high resolution/high precision radio timer while receiving
or sending). Such implementation details must be hidden from API
clients, as if the driver used a single high resolution clock source
instead.

For IEEE 802.15.4, whenever timestamps refer to packet send or receive
times, they are measured when the end of the IEEE 802.15.4 SFD (message
timestamp point) is present at the local antenna (reference plane).

Due to its limited range of ~290 years, net_time_t timestamps (and
therefore net_pkt timestamps and times) must not be used to represent
absolute points in time referred to an external epoch independent of
system uptime (e.g.  UTC, TAI, PTP, NTP, ...).

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-28 09:06:35 +00:00
Florian Grandel
29988b5c04 drivers: ieee802154: nRF5: fix return type
Adapts a return type to the API specification. The changed return type
is not referenced anywhere so it can be changed without breaking
backwards compatibility.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-28 09:06:35 +00:00
Daniel DeGrasse
a3b8f062f8 drivers: display: add driver for HX8394 TFT LCD controller
Add driver for HX8394 TFT LCD controller. This controller is driven via
MIPI DSI, and is configured for a 720x1280 display

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-28 09:06:17 +00:00
Daniel DeGrasse
918c79706d drivers: mipi_dsi: dsi_mcux_2l: add support for MIPI generic long write CMD
Add support for MIPI generic long write commands to DSI MCUX 2L driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-28 09:06:17 +00:00
Daniel DeGrasse
d620511c22 drivers: mipi_dsi: dsi_mcux: add support for MIPI generic long write CMD
Add support for MIPI generic long write commands to DSI MCUX driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-28 09:06:17 +00:00
Florian Vaussard
8bac51be1e drivers: flash: stm32: add a weak flash_stm32_valid_range()
Most implementations have the same logic, with only a different write
block size. Now that we are using write-block-size from the device tree,
it is possible to use a default implementation that can be overridden if
necessary.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2023-07-28 09:02:17 +00:00
Florian Vaussard
4c9e42925e drivers: flash: stm32l5: use write-block-size when writing
STM32L5 have a write block size of 8, but STM32U5 and STM32H5 have a
write block size of 16. Convert write_dword() and
flash_stm32_write_range() to write write-block-size data at a time.

Fixes #60724

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2023-07-28 09:02:17 +00:00
Florian Vaussard
199486546a drivers: flash: stm32l5: use write-block-size when validating
STM32L5 have a write block size of 8, but STM32U5 and STM32H5 have a
write block size of 16. Use write-block-size from the device tree
instead of hardcoding this value when validating the range of write
operations.

Fixes #60724

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2023-07-28 09:02:17 +00:00
Cong Nguyen Huu
3d1285bc40 drivers: i2c_mcux: update to compatible with S32K344
Update to shim driver compatible with the hardware block
in S32K344. Configure the pins before initializing I2C
to avoid happening bus busy.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-07-27 12:32:07 -05:00
Cong Nguyen Huu
a3fb2dcc2f drivers: can: add kconfig CAN_MAX_MB
Each CAN instance of S32K344 has different maximum number
of message buffers, depends on payload. Add kconfig that
defines maximum number of message buffers for concurrent
active instances and update driver to compatible
support S32k344.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-07-27 11:06:45 -05:00
Josep Puigdemont
677d377299 sensor: bme280: BMP280 has no humidity sensor
Return ENOTSUP when getting the humidity channel if the driver is used
with a BMP280, since this device does not provide humidity readings.

Signed-off-by: Josep Puigdemont <josep.puigdemont@gmail.com>
2023-07-27 08:46:40 -05:00
Josep Puigdemont
17fb2a1fb5 sensor: bme280: return ENOTSUP on invalid channel
ENOTSUP should be returned for unsupported channels.

Signed-off-by: Josep Puigdemont <josep.puigdemont@gmail.com>
2023-07-27 08:46:40 -05:00
Huifeng Zhang
0cf26615db drivers: eth_smsc91x: Fix the missing of selecting bank 3
Fix the missing of selecting bank 3 at the beginning of the function
`smsc_miibus_writereg`.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-07-27 13:27:47 +02:00
Wojciech Sipak
e473dd5333 pinctrl: gecko: fix compilation and UART handling
LEUART_Typedef isn't defined for every possible target.
It should be included in the conditional compilation part.

For proper handling of UART location, the driver needs
to remember pin configuration of both TX and RX.
This was broken in #60695 is brought back here.

Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
2023-07-27 10:51:31 +00:00
Sylvio Alves
41f16c3dd7 driver: wifi: esp32: increase default stack values
When testing Wi-Fi with MQTT/HTTP/Socket features,
network stacks can be full very fast, causing network issues
and eventual crash.

By analyzing used stacks,increasing the stack size described
in this PR fixes most use cases related above.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-07-27 10:17:53 +02:00
Marco Argiolas
5fc1777055 drivers: sensor: add mutex to cmd_get_sensor()
Add a mutex to protect shared data-structures, since shell can have
multiple backends.

Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
2023-07-26 09:35:57 -05:00
Andriy Gelman
d8f955e375 drivers: pwm: Add driver for xmc4xxx using ccu8 module
Adds driver for pwm on xmc4xxx using Capture Compare Unit 8 (CCU8)
module. There are two CCU8 nodes with each one having four slices.
Each slice has two output channels.

Unlike CCU4, this module can generate complementary high-side/low-side
signals for each output channel. A variable dead time can be added
during the off to on transitions to make sure that the
high-side/low-side signals are not on at the same time.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-07-26 15:09:41 +02:00
Andriy Gelman
23b6e4f507 drivers: pwm: Add driver for xmc4xxx using ccu4 module
Adds driver for pwm on xmc4xxx using Capture Compare Unit 4 (CCU4)
module. There are four CCU4 with each one having four channels
Thus it's possible to have up to 16 pwm output signals. The output of
each channel can only be connected to a specific port/pin. The possible
connection and gpio configurations are defined using pinctrl.

The CCU4 module also has a capture mode. Capture support will be added
in the future.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-07-26 15:09:41 +02:00
Wojciech Sipak
bff69f5384 drivers: pinctrl: add driver for EOS S3
This adds a new pinctrl driver for Quicklogic EOS S3 SoC

Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
2023-07-26 14:59:59 +02:00
Wojciech Sipak
40fa96506b drivers: pinctrl: Add pinctrl driver for Gecko Series 1
This adds a new pinctrl driver for EFM32.

Co-authored-by: Todd Dust <Todd.Dust@silabs.com>
Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
2023-07-26 14:33:03 +02:00
Florian Grandel
31fb5f53d2 drivers: cc13xx_cc26xx: pinctrl: fix header conflict
CC13/26xx's pinctrl_cc13xx_cc26xx.c driver included ioc.h and
(indirectly) pinctrl_soc.h which contained duplicate defines.

This change removes the header conflict and redundant definitions.

This prepares for subsequent changes in this change set that add
additional flags to the pinctrl driver which would otherwise trigger the
header conflict.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-26 14:32:53 +02:00
Oliver King
fbc6a91a5a drivers: sensor: a01nyub: added driver
Added a driver for the DFRobot A01NYUB distance sensor. This sensor
sends its readings via UART at 9600 baud. This driver uses interrupts
to read the data from the sensor.

Signed-off-by: Oliver King <oliver.king@steadconnect.com>
2023-07-26 13:28:28 +02:00
Kevin Wang
3744fe2d49 drivers: mbox: Add Andestech mailbox driver
Support the Andes mailbox driver via software plic.

Signed-off-by: Kevin Wang <kevinwang821020@google.com>
2023-07-26 10:51:41 +02:00
Johann Fischer
41e9547ead drivers: usb: fix common misspellings in USB drivers
Fix common misspellings in USB drivers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-07-26 10:46:01 +02:00
Jordan Yates
014760234b power_domain: gpio: init with pm_device_driver_init
Startup power domains according to the expected final state given the
power supply and PM device runtime support.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-26 08:16:44 +00:00
Jordan Yates
1ddadaf255 power_domain: gpio: compile without PM_DEVICE_POWER_DOMAIN
Let the driver compile without `PM_DEVICE_POWER_DOMAIN`, in which case
the driver only controls the GPIO, without notifying dependant devices.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-26 08:16:44 +00:00
Jordan Yates
86050556c0 gpio: stellaris: implement gpio_pin_get_config
Implement `gpio_pin_get_config` for the stellaris platform, and by
extension `qemu_cortex_m3`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-26 08:16:44 +00:00
Andrzej Głąbek
927dda06fa drivers: spi_nrfx_spis: Fix obtaining dev pointer in event handler
This is a follow-up to commit 4c20403629.

CONTAINER_OF() cannot be used to obtain the device pointer from its
data pointer as this data is not contained in the device structure.
Instead, use a dedicated member in the device data structure to store
the device pointer.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-07-26 09:52:24 +02:00
Manuel Argüelles
6d0a876525 drivers: flash: add NXP S32 QSPI flash NOR driver
Add support for flash NOR memory devices on a NXP S32 QSPI bus. The
driver uses a fixed LUT configuration assuming a default standard page
size and erase types, and allows to select between multiple read/program
instructions/modes. It is also possible to read the flash device
characteristics from the device at run-time as long as the memory is
JESD216 compatible, providing more flexibility.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-07-26 09:44:14 +02:00
Manuel Argüelles
5dad944351 drivers: memc: add NXP S32 QSPI controller
The NXP S32 QSPI controller acts as an interface to up to two serial
flash memory devices, each with up to eight bidirectional data lines,
depending on the platform. It is based on a LUT enginee to interface
through commands with different memory types including flash NOR and
Hyperram.

This patch adds support for the QSPI in S32K344 which supports a single
memory device (side A) with up to four bidirectional data lines and SDR
only. Nevertheless, the memory controller is implemented flexible enough
to be extended to support more feature-rich QSPI blocks.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-07-26 09:44:14 +02:00
Adam Wojasinski
368acbe2d1 drivers: i2c: i2c_nrfx_twim: Utilize memory-region prop from devicetree
This commit aligns TWIM shim to utilize memory-region property.
The memory-region is not required property that enables user
to specify placement of dma buffers in memory region.
It is done by assigning to memory-region property,
phandle to node with zephyr,memory-region and mimo-sram compatible.

When memory-region property is not specified for given
instance, buffer is placed in default RAM region with other data.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-07-26 09:36:31 +02:00
Adam Wojasinski
905a8ae402 drivers: i2c: i2c_nrfx_twim: remove redundant buffer size from config
There are two different i2c node properites `zephyr,flash-buf-max-size`
and `zephyr,concat-buf-size`. In the end max value of that two is used
to define size of the message buffer.
It's redundant to store both values in device config structure.
Changed config structure to contain only bigger value.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-07-26 09:36:31 +02:00
Pavlo Havrylyuk
f4a1d40924 drivers: counter: Add Infineon CAT1 counter driver
Add initial version of Infineon CAT1 counter driver
Add initial version of binding file for Infineon
Add counters to psco6 dtsi
Add external trigger pin that runs counter

Signed-off-by: Pavlo Havrylyuk <pavlo.havrylyuk@infineon.com>
2023-07-26 09:10:31 +02:00
Pieter De Gendt
6758777ddf drivers: crypto: Add NXP MCUX DCP driver
Add a shim driver for NXP's Data Co-Processor (DCP) driver.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-07-26 09:09:48 +02:00
Girisha Dengi
62dbe72cb7 drivers: pm_cpu_ops: Add support for multiple PSCI versions
Each PSCI interface versions have different DT compatible strings
like arm,psci-0.2, arm,psci-1.1 and so on. However, the same driver
can be used for all the versions by adding #define DT_COMPAT for
required version and #undef DT_COMPAT for default version.

Add support for PSCI cold reset, warm reset and cpu-on function IDs.

Signed-off-by: Girisha Dengi <girisha.dengi@intel.com>
Signed-off-by: Navinkumar Balabakthan <navinkumar.balabakthan@intel.com>
2023-07-25 16:58:01 +00:00
Girisha Dengi
f0ac2347da drivers: serial: Add optional reset line for uart_ns16550
If the optional hardware reset line is available, this change
will use that reset line to assert the uart module and bring
it out of reset state to use.

Signed-off-by: Girisha Dengi <girisha.dengi@intel.com>
2023-07-25 16:58:01 +00:00
Girisha Dengi
6639756fae drivers: reset: Add reset controller for Intel Agilex5 platform
This is Intel's proprietary IP which controls individual module
reset signals. During each system driver initialization, these
reset signals will be used to bring module out of reset state.

Signed-off-by: Navinkumar Balabakthan <navinkumar.balabakthan@intel.com>
Signed-off-by: Girisha Dengi <girisha.dengi@intel.com>
2023-07-25 16:58:01 +00:00
Girisha Dengi
2ca6ffcd79 drivers: clock_control: clock driver for Intel Agilex5 platform
This is Intel's proprietary IP which supply the clock for all the
system peripherals. Clock manager is initialized only one time
during boot up by FSBL (ATF BL2) based on external user settings.

Signed-off-by: Girisha Dengi <girisha.dengi@intel.com>
2023-07-25 16:58:01 +00:00
Marek Matej
938732c00d drivers: can: fix long lines
Change the line length to comply with the rules.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-07-25 18:12:33 +02:00
Marek Matej
6b57b3b786 soc: xtensa,riscv: esp32xx: refactor folder structure
Refactor the ESP32 target SOCs together with
all related boards. Most braking changes includes:

- changing the CONFIG_SOC_ESP32* to refer to
  the actual soc line (esp32,esp32s2,esp32s3,esp32c3)
- replacing CONFIG_SOC with the CONFIG_SOC_SERIES
- creating CONFIG_SOC_FAMILY_ESP32 to embrace all
  the ESP32 across all used architectures
- introducing CONFIG_SOC_PART_NUMBER_* to
  provide a SOC model config
- introducing the 'common' folder to hide all
  commonly used configs and files.
- updating west.yml to reflect previous changes in hal

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-07-25 18:12:33 +02:00
Marc Desvaux
76ba68cd18 drivers: ethernet: stm32 generate_mac
Ethernet MAC addresses are not unique enough
use unique_device_ID full range (96 bits)
call crc32_ieee() to generate last 3 bytes of mac address

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-07-25 16:45:53 +02:00
Markus Fuchs
fbe6ac852f drivers: bluetooth: slz_hci: Fix incoming HCI packet handling
Currently, HCI packet handling does not consider the BT_RECV_CONTEXT
choice selection. It calls bt_recv() and bt_recv_prio() only depending
on the HCI packet type and event flags.
However, for selections other than BT_RECV_BLOCKING, the "HCI driver
shall not call bt_recv_prio()". Fix that by only calling bt_recv_prio()
when CONFIG_BT_RECV_BLOCKING is enabled.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2023-07-25 14:41:13 +02:00
Jordan Yates
d63999af6e Revert "gpio: stellaris: implement gpio_pin_get_config"
This reverts commit c72577d709.
2023-07-25 14:17:11 +02:00
Jordan Yates
f613074283 Revert "power_domain: gpio: compile without PM_DEVICE_POWER_DOMAIN"
This reverts commit 1f1217e832.
2023-07-25 14:17:11 +02:00
Jordan Yates
226f1c5e4b Revert "power_domain: gpio: init with pm_device_driver_init"
This reverts commit 39b2ec57a0.
2023-07-25 14:17:11 +02:00
Andrzej Głąbek
481963489e drivers: wdt_nrfx: Clean up driver instantiation
- use CONFIG_HAS_HW_NRF_* symbols consistently in nRF multi-instance
  drivers when creating particular driver instances
- remove unnecessary hidden Kconfig options that indicated the type of
  peripheral to be used by a given instance (e.g. SPI, SPIM, or SPIS)
  and enabled proper nrfx driver instance; instead, use one option per
  peripheral type and include the corresponding shim driver flavor into
  compilation basing on that option (not the one that enables the nrfx
  driver as it was incorrectly done so far in some cases)

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-07-25 13:41:51 +02:00
Andrzej Głąbek
f89ca1164c drivers: sensor: qdec_nrfx: Clean up driver instantiation
- use CONFIG_HAS_HW_NRF_* symbols consistently in nRF multi-instance
  drivers when creating particular driver instances
- remove unnecessary hidden Kconfig options that indicated the type of
  peripheral to be used by a given instance (e.g. SPI, SPIM, or SPIS)
  and enabled proper nrfx driver instance; instead, use one option per
  peripheral type and include the corresponding shim driver flavor into
  compilation basing on that option (not the one that enables the nrfx
  driver as it was incorrectly done so far in some cases)

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-07-25 13:41:51 +02:00
Andrzej Głąbek
aa7d675935 drivers: serial: nrfx: Clean up driver instantiation
- use CONFIG_HAS_HW_NRF_* symbols consistently in nRF multi-instance
  drivers when creating particular driver instances
- remove unnecessary hidden Kconfig options that indicated the type of
  peripheral to be used by a given instance (e.g. SPI, SPIM, or SPIS)
  and enabled proper nrfx driver instance; instead, use one option per
  peripheral type and include the corresponding shim driver flavor into
  compilation basing on that option (not the one that enables the nrfx
  driver as it was incorrectly done so far in some cases)

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-07-25 13:41:51 +02:00
Andrzej Głąbek
fa609e5844 drivers: spi: nrfx: Clean up driver instantiation
- use CONFIG_HAS_HW_NRF_* symbols consistently in nRF multi-instance
  drivers when creating particular driver instances
- remove unnecessary hidden Kconfig options that indicated the type of
  peripheral to be used by a given instance (e.g. SPI, SPIM, or SPIS)
  and enabled proper nrfx driver instance; instead, use one option per
  peripheral type and include the corresponding shim driver flavor into
  compilation basing on that option (not the one that enables the nrfx
  driver as it was incorrectly done so far in some cases)

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-07-25 13:41:51 +02:00
Andrzej Głąbek
8bc0fdaf56 drivers: pwm_nrfx: Clean up driver instantiation
- use CONFIG_HAS_HW_NRF_* symbols consistently in nRF multi-instance
  drivers when creating particular driver instances
- remove unnecessary hidden Kconfig options that indicated the type of
  peripheral to be used by a given instance (e.g. SPI, SPIM, or SPIS)
  and enabled proper nrfx driver instance; instead, use one option per
  peripheral type and include the corresponding shim driver flavor into
  compilation basing on that option (not the one that enables the nrfx
  driver as it was incorrectly done so far in some cases)

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-07-25 13:41:51 +02:00
Andrzej Głąbek
fb7d40c757 drivers: i2c: nrfx: Clean up driver instantiation
- use CONFIG_HAS_HW_NRF_* symbols consistently in nRF multi-instance
  drivers when creating particular driver instances
- remove unnecessary hidden Kconfig options that indicated the type of
  peripheral to be used by a given instance (e.g. SPI, SPIM, or SPIS)
  and enabled proper nrfx driver instance; instead, use one option per
  peripheral type and include the corresponding shim driver flavor into
  compilation basing on that option (not the one that enables the nrfx
  driver as it was incorrectly done so far in some cases)

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-07-25 13:41:51 +02:00
Fabian Blatz
e1e4fcc701 input: remove cap1203 kscan-like state report
Previously the driver was retrofitted to the kscan api, handling it as a
input device with one row and three columns. With the move to the input
subsystem each input can have its proper input code instead.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2023-07-25 11:25:51 +02:00
Fabian Blatz
1d56b8e2aa input: convert cap1203 from kscan
Convert the CAP1203 driver to the input subsystem, add to build_all tests.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2023-07-25 11:25:51 +02:00
Kacper Dalach
305423ccb8 drivers: clock_control: stm32h5: Add MCO configuration
STM32H5 series lacked support for MCO configuration.
Added SOC_SERIES_STM32H5X to approperiate kconfig MCO source
configurations. Added new MCO sources from H5 series and
updated the clock_stm32_ll_h5.c with MCO configuration.

Signed-off-by: Kacper Dalach <dalachowsky@gmail.com>
2023-07-25 09:22:40 +00:00
Carlo Caione
15e84cbfac dts: Move to 'zephyr,memory-attr'
Move to 'zephyr,memory-attr' and use the newly introduced helpers.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-07-25 11:22:10 +02:00
Kai Meinhard
ea846e12bf i2c: Applied clang-format to i2c_gecko.c
Minor formatting changes in i2c_gecko.c with the
clang-format tool.

Signed-off-by: Kai Meinhard <kaimeinhard@hotmail.de>
2023-07-25 10:44:47 +02:00
Kai Meinhard
f345d6d1d8 i2c: add target mode to Silicon Labs Gecko I2C driver
This commits adds the ability to use Silicon Lab chips as an I2C
target. This could be used together with the EEPROM target
driver.

Signed-off-by: Kai Meinhard <kaimeinhard@hotmail.de>
2023-07-25 10:44:47 +02:00
Andrzej Kuros
9babac94a7 drivers: ieee802154: nrf5: multiple CCA support
The support for capability IEEE802154_OPENTHREAD_HW_MULTIPLE_CCA is added
to the ieee802154_nrf5 driver.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-07-25 09:13:41 +02:00
Andrzej Kuros
3f4da29a3c drivers: ieee802154: nrf5: Revert Add transmission with multiple CCA
This reverts commit 5443d4127b.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-07-25 09:13:41 +02:00
Jordan Yates
39b2ec57a0 power_domain: gpio: init with pm_device_driver_init
Startup power domains according to the expected final state given the
power supply and PM device runtime support.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 09:13:16 +02:00
Jordan Yates
1f1217e832 power_domain: gpio: compile without PM_DEVICE_POWER_DOMAIN
Let the driver compile without `PM_DEVICE_POWER_DOMAIN`, in which case
the driver only controls the GPIO, without notifying dependant devices.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 09:13:16 +02:00
Jordan Yates
c72577d709 gpio: stellaris: implement gpio_pin_get_config
Implement `gpio_pin_get_config` for the stellaris platform, and by
extension `qemu_cortex_m3`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-25 09:13:16 +02:00
Nicolas Pitre
531aa5786d drivers: move to timepoint API
Remove sys_clock_timeout_end_calc() usage.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-07-25 09:12:26 +02:00
Daniel DeGrasse
d2372139f3 drivers: display: display_mcux_elcdif: enable display rotation using PXP
Enable display rotation using the NXP pixel pipeline (PXP). The ELCDIF
will only utilize the PXP if a framebuffer equivalent in size to the
screen is provided to display_write. The rotation angle can be
configured via Kconfig at build time.

Fixes #59921

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-25 09:10:52 +02:00
Daniel DeGrasse
7fe5ce641a drivers: dma: add DMA driver for NXP PXP engine
The NXP Pixel pipeline engine (PXP) is a 2D DMA engine capable of
accelerating display rotation, color space conversion, and limited
2D blending operations. This DMA driver only supports rotation of a
framebuffer, via a set of custom dma_slot values. Only DMA channel 0
is supported or utilized.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-25 09:10:52 +02:00
Manimaran A
b4cd531e2c drivers: bbled: pwm: mchp: BBLED low power mode updated
Updated the driver to support low power mode.
Introduced "enable-low-power" flag in device tree to
control(on/off) low power mode.

If flag added in DTS, during sleep BBLED will switch off the LEDs.
Otherwise BBLED will continue the configured blinking pattern on LEDs.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-07-25 09:09:44 +02:00
Daniel DeGrasse
066c40bbb0 drivers: input: ft5336: Add support for reset GPIO and FT3267 IC
Add support for resetting controller at boot, and update FT5336
documentation to indicate that the FT3267 IC is also supported by this
driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-25 09:08:59 +02:00
Daniel DeGrasse
e692e57c68 drivers: display: add support for RM67162 controller
Add support for RM67162 MIPI display controller. This controller
is configured to run in MIPI command/DBI mode, driving a 400x392 OLED
display.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-25 09:08:59 +02:00
Daniel DeGrasse
35a210be48 drivers: mipi_dsi: dsi_mcux: fix support for DCS_LONG_WRITE command
Fix support for DCS long write command in DSI mcux driver, to enable use
with displays that require this command for full support.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-25 09:08:59 +02:00
Daniel DeGrasse
d1ef34440e drivers: mipi_dsi: dsi_mcux: make DPI mode optional
Only setup DPI input from LCDIF if MODE_VIDEO is set, as this
is the the only case where input from the LCDIF would be required to
drive the display. Do not populate the dpi_config structure unless a
reference the the NXP LCDIF device is provided, since this is the output
device providing DPI data.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-25 09:08:59 +02:00
Daniel DeGrasse
21469a30d2 drivers: mipi_dsi: dsi_mcux_2l: enable DCS_LONG_WRITE using interrupts
Fixup support for DCS_LONG_WRITE command in DSI MCUX 2L driver. Since long
DCS commands may benefit from nonblocking I/O, add support for non blocking
transfers to the DSI driver.

This commit also corrects the interrupt number for the RT595, which uses
the DSI_MCUX_2L IP block.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-25 09:08:59 +02:00
Daniel DeGrasse
867acef070 drivers: mipi_dsi: make DPI mode optional for dsi_mcux_2l driver
Make DPI mode an optional configuration for the DSI MCUX 2L driver.
DPI mode will only be enabled when the MIPI is attached in video mode,
since this is when DPI formatted packets are expected.

This will enable the DSI driver to also support DBI/command mode, for
displays that use this format.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-25 09:08:59 +02:00
Daniel DeGrasse
16f5665817 drivers: display: display_rm68200: add DSI video mode flag
Add DSI video mode flag to MIPI configuration, to indicate to MIPI
drivers that this display uses video mode and must be refreshed
constantly.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-25 09:08:59 +02:00
Benedikt Schmidt
44810b190c drivers: pwm: implement MAX31790
Implement a driver for the PWM controller MAX31790. This driver
also implements the RPM mode of the controller, which can
be accessed via setting pwm_flags_t accordingly to macros
defined in the driver specific header.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-07-25 09:08:30 +02:00
Fabio Baltieri
ab9028518e drivers: uart_nrfx_uart{,e}: on clear async pointers when enabled
Fix a build error introduced in 9f02eeadf8, the async pointers are only
available when UARTE_ANY_ASYNC is set.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-24 17:31:08 +00:00
Erwan Gouriou
00a9cb81c0 drivers: rtc: stm32: Exclude STM32F1 from current RTC driver
STM32F1 series RTC is not compatible with other STM32F1 series,
and it uses a different LL API.
Current implementation of the driver doesn't take this into account,
so we need to explicitly exclude STM32F1 series support until
some changes are made.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-24 14:38:47 +00:00
Peter van der Perk
2bf38b46ec drivers: sensor: qdec_mcux: fix fixed point conversion
Use macro to convert sensor q31 representation

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2023-07-24 08:29:21 -05:00
Francois Ramu
05a7ad1087 drivers: crypto: stm32h5 CRYP_DATATYPE_8B define in hal
Define only once the CRYP_DATATYPE_8B for the stm32h5 serie
This macro is in modules/hal/stm32/stm32cube/stm32h5xx/d
rivers/include/stm32h5xx_hal_cryp.h

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-07-24 13:25:23 +00:00
Benedikt Schmidt
332850a367 drivers: adc: configurable acquisition time for ADS114s0x
Implement a configurable acquisition time for the ADS114s0x.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-07-24 13:21:13 +00:00
Benedikt Schmidt
d2e89eb512 drivers: adc: make all enabled ADCs available in the shell
Previously, only a single type of ADCs was always available
in the ADC shell. This change enables the usage of the ADC
shell for different ADC types at the same time.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-07-24 08:14:03 -05:00
Peter van der Perk
aa7ed78827 sensors: bmp388: allow mix of instances with and without int gpio
makes int_gpios optional so we can mix both bmp388
with and without DRDY triggers

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2023-07-24 09:08:18 +00:00
Daniel Leung
80f079a2cd pcie: host: guard include of ACPICA header file
This puts a ifdef guard around the inclusion of ACPICA header
file. The ACPICA module is not active unless CONFIG_ACPI is
also enabled so we should not be using that header without
CONFIG_ACPI also being enabled.

This was discovered by Coverity.

Fixes #60484

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-07-24 09:07:45 +00:00
Daniel Leung
20021abf0a serial: ns16550: check return of clock_control_get_rate()
This adds a check of the return of clock_control_get_rate(),
and returns error in uart_configure() if unsuccessful in
getting clock rate.

Fixes #60478

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-07-24 09:07:11 +00:00
Armin Brauns
c094bd688a drivers: mcp23xxx: fix deadlock in interrupt callbacks
Interrupt callbacks may want to configure GPIO pins on the port expander,
e.g. to change the polarity of a level interrupt. This would cause a
deadlock because the callback handler would still be holding the lock.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-07-22 06:01:20 -04:00
Daniel Leung
343772213a serial: CONFIG_UART_USE_RUNTIME_CONFIGURE on API for cfg funcs
This adds the CONFIG_UART_USE_RUNTIME_CONFIGURE guard to
disable the API function pointers if the kconfig is not enabled.
Both .configure and .config_get should only be usable if runtime
(re-)configuration of UART is needed.

Ifdef guards are added to drivers previously lacking this guard.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-07-21 17:46:12 -04:00
Fabio Baltieri
1fd372737b hwinfo: gecko: fix warning when building for efr32bg27_brd2602a
When building the driver for efr32bg27_brd2602a none of the condition
matches and the compiler warns for:

hwinfo_gecko.c: In function 'z_impl_hwinfo_get_reset_cause':
hwinfo_gecko.c:38:18: warning: unused variable 'rmu_flags'
   38 |         uint32_t rmu_flags = RMU_ResetCauseGet();

This fails the bi-weekly build, add a __maybe_unused to silence the
warning.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 12:54:01 -04:00
Fabio Baltieri
502ecaeac5 sensors: icm42688: ensure SENSOR_ASYNC_API is selected
This fix a build issue where ICM42688_DECODER is enabled but
SENSOR_ASYNC_API is not, which results in some structures in an
orphan section:

warning: orphan section
`._sensor_decoder_api.static.invensense_icm42688__decoder_api_' from
`libdrivers__sensor__icm42688.a(icm42688_decoder.c.obj)'
being placed in section
`._sensor_decoder_api.static.invensense_icm42688__decoder_api_'

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 14:12:13 +00:00
Fabio Baltieri
bb0135b64c sensor: bq274xx: use two bytes write for settings
Use a combination of sys_cpu_to_be16 and i2c_burst_write_dt for setting
16 bits registers. Get rid of a bunch of temporary variables, custom
conversions and few bus writes.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
ec98bf7cbc sensor: bq274xx: add support for bq27427
The current ID for BQ274XX_DEVICE_ID is actually the one for the
BQ27421. The driver seems to work with the BQ27427 as well, at least the
common and extended commands are the same, so add that variant as well,
rename the existing one and print the currently read ID when the ID
check fails.

The configuration registers have a different offset though, so add a
register offset table and make the device rcognize the right one un
runtime based on the device ID.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
6390dd582a sensor: bq274xx: drop bq274xx_ctrl_reg_write
Use i2c_reg_write_byte_dt instead of bq274xx_cmd_reg_write. The wrapper
does not add anything anyway.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
4dc7437d45 sensor: bq274xx: support fetching all channels
Change bq274xx_sample_fetch to support SENSOR_CHAN_ALL. This makes it
possible to get the sensor data using the sensor shell, besides being
generally convenient.

Also drop a redundant comment.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
76509a73b1 sensor: bq274xx: clarify the unseal sequence
The device technical reference manual says "The Sealed to Unsealed key
has two identical words". Use two different defines with the same value
in the code so it's somewhat less ambiguous that the double write is
intentional.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
7b6430cc80 sensor: bq274xx: limit config update mode check loops
Add a retry count limit to config update mode loops, this way the system
can still boot if there's an issue with the device. The normal sleep
should be enough for correct operation, adding a conservative limit.

Rework the delays to be unambiguous while at it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
71bd63d007 sensor: bq274xx: fix few parameter calculations
Fix the calculation for designenergy_mwh, as right now it's using a
float casted straight to an int, which results in the factor rounded
from 3.7 to 3. Also rework both that and taperrate so that they don't
use floating point.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
35bb28abaf sensor: bq274xx: add few defines for magic numbers
Add a couple of define for the data memory block size and config flag
bit.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
9bc43ac3ce sensor: bq274xx: simplify i2c write code
Control reg write seems to support two bytes mode (the technical
reference shows example of that), so use a single i2c_write_dt there.
Also drop a couple alias variables from bq274xx_cmd_reg_write.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
2dcaed3252 sensor: bq274xx: drop a bunch of redundant initialization
Drop various unnecessarily initialized variables from the driver.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
1e2b7de13b sensor: bq274xx: remove forward declaration
Move bq274xx_gauge_configure up in the code, remove the forward
declaration.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
f6f568b712 sensor: bq274xx: drop unnecessary casting
Drop unnecessary casting from uint16_t to uint8_t.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Fabio Baltieri
e68e623963 sensor: bq274xx: re-add function prefixes
Add the bq274xx_ back to the static function prefixes for the bq274xx
driver.

These have been removed recently but every other sensor and most Zephyr
driver have static function prefixed, this helps avoiding ambiguity in
list files, stack traces, setting debugging breakpoints etc.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-21 09:07:46 -05:00
Emilio Benavente
a50c26d80f drivers: dma: dma_mcux_lpx: Added parameter in macro for 55S36
Added a parameter inside the Channel Number macro since
the LPC55S36 expects an address rather than a static number.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2023-07-21 08:58:27 -05:00
Johan Lafon
9c69368b1d driver: clock-control: st: allow PLL1Q support for G0 and WL
LL name for PLL1Q is not the same across STM32G0, STM32WL, STM32H5 and
STM32H7 families. This allows to choose the proper definition depending on
the family.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-07-21 10:58:48 +00:00
David Leach
a6a129c971 drivers: gpio: fix coverity memory overwrite error
memcpy of a sub-structure in a structure was using the structure size
of the parent structure instead of the sub-structure.

fixes: #59548

Signed-off-by: David Leach <david.leach@nxp.com>
2023-07-21 10:55:21 +00:00
Daniel DeGrasse
85a41ae88a drivers: led: added support for is31fl3733 led driver
Enabled support for is31fl3733 driver. This driver supports
the full LED API, and enables the following features of the is31fl3733:
- individual LED dimming
- individual LED enable/disable
- bulk writes of LED enabled and dimming states
- global LED current limit
- blanking (via custom API)

Signed-off-by: Daniel DeGrasse <daniel@degrasse.com>
2023-07-21 10:51:18 +00:00
cyliang tw
ecbaac60bd drivers: flash: support for Nuvoton numaker series FMC
Add Nuvoton numaker series flash memory controller(FMC) with erase,
 read & write features of soc-flash. Also update Nuvoton manifest
 to include zephyrproject-rtos/hal_nuvoton#6.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-07-21 10:41:40 +00:00
Tim Lin
995444d5a9 ITE: drivers/i2c: Modify the condition of assert
Channel B or C do not necessarily have to use FIFO mode.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-07-21 10:30:42 +00:00
Paul He
278563ed45 drivers: input: gt911: fix error 'ret' undeclared
When CONFIG_INPUT_GT911_INTERRUPT is set to 'y', it will get this
undeclared error, now fix it.

Signed-off-by: Paul He <pawpawhe@gmail.com>
2023-07-20 20:52:19 +00:00
Al Semjonovs
f856e7ba63 icm42688: Fix channels read BIT shift error
channel_pos_read bit was being cleared with a sensor channel enum value
instead of the encoded bit position.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-07-20 14:19:20 -05:00
Tom Burdick
0b6b970f0a sensors: icm42688: Do not force rc oscillator
Forcing the usage of the RC oscillator and keeping it on turns out
to have detrimental effects to the readings by default. The default
clock mode settings are perfectly fine.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-07-20 16:24:46 +02:00
Robert Lubos
5c5be08ba9 drivers: ieee802154_nrf5: Use generic symbols for packet size
Use generic symbols defined in ieee802154.h for packet/FCS size instead
of redefining them in the driver header.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-07-20 16:24:26 +02:00
Robert Lubos
cf58d11f8f drivers: ieee802154_nrf5: Add payload length check on TX
In case upper layer does not follow the convention, and the net_pkt
provided to the nRF 15.4 driver had a payload larger than the maximum
payload size of an individual 15.4 frame, the driver would end up with
buffer overflow.

Fix this by adding an extra payload_len check before attempting to copy
the payload to the internal buffer.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-07-20 16:24:26 +02:00
Mulin Chao
f34fff91bc driver: flash: npcx: introduce npcx flash driver
This CL attempts to implement npcx's flash driver instead of the
original one (npcx spi driver plus spi_nor flash driver).

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-07-20 16:22:47 +02:00
Mulin Chao
7411fbcb5b pinctrl: npcx: add DEV_CTLx configuration support
Add a new pinctrl type to control peripheral modules' specific IO
characteristics such as tri-state, the power supply type selection (3.3V
or 1.8V), and so on. In NPCX series, the corresponding registers/fields
are irregular. This CL wraps these definitions to dt nodes and put them
in pinctrl property if needed.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-07-20 16:22:47 +02:00
Sean Nyekjaer
d0651a8d96 drivers: serial: stm32: void return value from reset_line_toggle_dt
Suggested-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-20 10:57:12 +00:00
Sean Nyekjaer
09f4b6f3bd drivers: mipi_dsi: dsi_stm32: void return value from reset_line_toggle_dt
Suggested-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-20 10:57:12 +00:00
Sean Nyekjaer
f21526c5c9 drivers: counter: stm32: void return value from reset_line_toggle_dt
Suggested-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-20 10:57:12 +00:00
Johan Lafon
691b357b59 drivers: clock-control: st: add MCO support for H7 family
Create clock_stm32_ll_mco.h file to bring stm32_clock_control_mco_init,
mco1_prescaler, mco2_prescaler, MCO1_SOURCE and MCO2_SOURCE definitions
which were previously in clock_stm32_ll_common.{c,h}. This is done so that
stm32_clock_control_mco_init can be called from clock_stm32_ll_h7.c.

Also update Kconfig.stm32 and add new MCO sources to allow H7 support.

Signed-off-by: Johan Lafon <johan.lafon@syslinbit.com>
2023-07-20 10:46:34 +00:00
Felipe Neves
da3ae1af61 samples: drivers: ipm: added IPM over IVSHMEM sample
To demonstrate how to configure Zephyr to use the IPM
driver over the IVSHMEM subsystem. Since this driver
is intended to generate inter QEMU VM notifications
it was better to create a sample app using the shell
for quick demonstration for the users.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2023-07-20 10:44:57 +00:00
Felipe Neves
7ca59d7bfe drivers: ipm: added IPM over IVSHMEM driver
This driver is built on top of the IVSHMEM doorbell
notification mechanism providing an unified way
to generate inter VM interrupts.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2023-07-20 10:44:57 +00:00
Manimaran A
85a70c9847 drivers: pwm: mchp: Low power mode enabled
Updated the driver with low power feature

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-07-20 10:42:19 +00:00
Sean Nyekjaer
25d496949f drivers: pwm: pwm_stm32: reset timer using RCC before initialization
If a timer is left running on an stm32mp1, (most likely) on the next run
the timer is stuck.
A simple timer reset before initialization fixes the issue.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-20 10:36:10 +00:00
Sean Nyekjaer
63fa033d11 drivers: pwm: pwm_stm32: add macro for using DT_INST_PARENT()
Make device init more readable by adding a macro

Suggested-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-20 10:36:10 +00:00
Erwan Gouriou
32efdf9239 drivers: counter: stm32: Review use const TIM_TypeDef on few series
A recent Cube update moved C0/L1/WBA to use const TIM_TypeDef
Align counter driver implementation.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-20 09:20:57 +00:00
Chen Caidy
90b322761a drivers: ethernet: mcux: improve receive timestamp accuracy
When ENET_ENHANCEDBUFFERDESCRIPTOR_MODE enabled,
MAC will automatic capture receive nanosecond from 1588TMR
and return back to ENET_ReadFrame. It is a highest accuracy
recv timestamp_ns, we do not need manually read from 1588TMR.

By this change, receive timestamp accuracy increase
from 20us to 200ns above.

Signed-off-by: Chen Caidy <chen@caidy.cc>
2023-07-19 21:42:05 -04:00
Wojciech Sipak
545943310b drivers: pinctrl: remove unneeded TODO from Kconfig
This TODO seems to be no longer needed here.

Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
2023-07-19 21:32:44 -04:00
Fabio Baltieri
ebb1fa585f dma: iproc_pax_v2: delay initialization after pcie
The Broadcom pcie setup has a devicetree dependency like:

/pcie/paxdma -> /pcie/pcie -> /soc/pl330

Add a separate init symbol for iproc_pax_v2 so that these gets
initialized in order, fixes this error:

$ west build -p -b bcm958402m2_m7 tests/kernel/common \
	-DCONFIG_CHECK_INIT_PRIORITIES=y
...
ERROR: /pcie/paxdma@4e100800 POST_KERNEL 40 < \
	/pcie/pcie@4e100000 POST_KERNEL 50

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-19 20:22:03 +00:00
Fabio Baltieri
20e7c6db6c video: mcux_csi: set a dedicated init priority for video_mcux_csi
Set a dedicated priority for the video_mcux_csi instead of using the
default kernel device init priority. This allows initializing the device
in a sequence that matches the devicetree hirearchy compared to mt9m114.

Fixes the error:

ERROR: /soc/csi@402bc000 POST_KERNEL 50 <
	/soc/i2c@403f0000/mt9m114@48 POST_KERNEL 60

found using:

$ west build -p -b mimxrt1064_evk samples/subsys/video/capture \
		-DCONFIG_CHECK_INIT_PRIORITIES=y

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-19 18:00:20 +00:00
Mike J. Chen
7839eb524c drivers: dma: dma_lpc: fix bug with transfer size/width
Fix for bug:
https://github.com/zephyrproject-rtos/zephyr/issues/59802

The DMA controller only supports one transfer size, but
the Zephyr DMA driver api allows specifying a source_data_size
and dest_data_size which might be different. An old
version was always using dest_data_size for the transfer
size (variable is called "width"), but a recent change
made the driver use the MIN for the source and dest data
sizes. The MIN choice breaks the I2S driver because it
always set source_data_size to 1, but dest_data_size was
typically 4 for like two-channel 16-bit PCM data. So the
old driver worked using dest_data_size, but the new driver
broke I2S using MIN since source_data_size was 1.

To prevent confusion, change the DMA driver to assert that
source_data_size and dest_data_size are the same.

Also assert that the source_address and dest_address for
each block_config are properly aligned for the transfer size,
since that is a documentated requirement for the DMA controller.

Also rename max_xfer to max_xfer-bytes to be more clear what
the units are, and use this value in many places that
are comparing block_size in bytes rather than converting
block_size to words by dividing by width and
then comparing to NXP_LPC_DMA_MAX_XFER.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-07-19 10:36:23 -05:00
Mike J. Chen
04f488accf drivers: spi: mcux_flexcomm: fix DMA bug for 2-byte transfers
The MCUX DMA controller only supports a single data_size
for a DMA transfer, not separate ones for source and
dest. An older version of the DMA driver used
dest_data_size as the DMA transfer size, but the
current one uses MIN(dest/source) as the trasnfer
size, which breaks case when SPI wants to do 2-byte
transfers.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-07-19 10:36:23 -05:00
Mike J. Chen
f882d31ea7 drivers: i2s: mcux_flexcomm: fix multiple bugs
Fix for bugs described in:
https://github.com/zephyrproject-rtos/zephyr/issues/59803

1. the size argument passed to i2s_write() was being ignored.
   change the code so that the size is queued with the
   tx mem_block and the dma transfer is configured with this
   size.

2. change how CONFIG_I2S_MCUX_FLEXCOMM_RX_BLOCK_COUNT and
   CONFIG_I2S_MCUX_FLEXCOMM_TX_BLOCK_COUNT are used so that
   the queue buffers are allocated correctly when the two
   config values are not the same

3. set source_data_size and dest_data_size to be the same
   since the DMA controller can only set one size per
   DMA transfer. the driver was already computing a dest_data_size
   but always passing 1 for the source_data_size.
   For I2S RX case, I think source_data_size should be
   set to the expected FIFO read size instead of dest_data_size.

Also some smaller improvements like:
* don't allocate two dma_blocks for tx in the static dev_mem
  when it only needs one
* memset both rx_dma_blocks together instead of separtely
* set dma_cfg block_count for tx and rx statically instead
  of at runtime

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-07-19 10:36:23 -05:00
Benedikt Schmidt
0d33ecd56a drivers: adc: configurable wait for completion timeout
Depending on the ADC implementation it might happen that
the driver is waiting on an external interrupt. If this interrupt
gets lost, for instance due to a race condition with an external
port expander, the system will get stuck.
Making this configurable allows the user to recover from such
an error.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-07-19 15:22:33 +00:00
Erwan Gouriou
feef931fbb drivers: counter: stm32: Use const TIM_TypeDef on stm32f2 series
A recent factorisation moved F2 to non const TIM_TypeDef.
This is an error, move it back to const TIM_TypeDef.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-19 14:31:31 +00:00
Serhiy Katsyuba
1c0c2a095b drivers: intel_adsp_gpdma: Fix release ownership
Fixes a bug in intel_adsp_gpdma_release_ownership(). Before fix, this
function actually did nothing for ACE platform and the ownership was
not released. Now ownership is released to host CPU + DSP.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2023-07-19 06:54:43 -04:00
Francois Ramu
6254527343 drivers: timer: stm32 lptim driver check clock_control_on return code
This PR is Calling "clock_control_on" and checking return value
(as is done elsewhere 10 out of 11 times)
CID 322066:  Error handling issues  (CHECKED_RETURN)

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-07-19 10:14:30 +00:00
Guillaume Gautier
208d962eb8 drivers: clock_control: stm32 set adc prescaler in rcc
For STM32F1 and F3, set the ADC prescaler in RCC if defined in dts.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-07-19 10:13:26 +00:00
Martin Kiepfer
09da4cf89d driver: regulator: Add support for AXP192 power management IC
AXP192 is a small and simple power management IC featuring different
LDOs, DCDCs, AINs and also GPIOs. It also offers functionaltiy for
battery management.
This change includes the basic regulator driver functionaltiy for
LDO2-3 and DCDC1-3 as well as the mfd driver layer. Further drivers
for GPIO and ADC will follow.
Drivers have been developed and tested on M5StackCore2, an ESP32-based
board. Support for M5StackCore2 is still in progress.

Signed-off-by: Martin Kiepfer <mrmarteng@teleschirm.org>
2023-07-19 09:52:15 +00:00
Marcin Zapolski
820bc9267e drivers: flash: stm32l4: Fix STM32L4Q5 support in flash driver
Add STM32L4Q5xx to the list of MCUs that have 4kB flash pages,
instead of 2kB.

Signed-off-by: Marcin Zapolski <mz4pol@gmail.com>
2023-07-19 09:51:18 +00:00
Andy Sinclair
024196be9d drivers: regulator: npm1300: Added ship mode
npm1300 ship mode entry added

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-07-19 09:30:22 +00:00
Andy Sinclair
f6aa1c4321 drivers: regulator: Added ship mode to API
Added ship mode entry function to common regulator driver

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-07-19 09:30:22 +00:00
Fabio Baltieri
d95c12848d drivers: input: add few missing gpio_add_callback return check
Add few missing check on gpio_add_callback and gpio_add_callback_dt
calls, fixes a coverity warning.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-19 09:18:38 +00:00
Manimaran A
80d46c5f7e drivers: eeprom: mchp: Bug fix
Updated the DT macro to read EEPROM size property.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-07-18 19:19:14 +00:00
Valentin Korenblit
4648917be4 drivers: gicv3: GICR_TYPER_LAST mask width is 1 bit
Fix compiler warning: bitwise comparison always evaluates to false

Signed-off-by: Valentin Korenblit <vkorenblit@sequans.com>
2023-07-18 19:10:11 +00:00
Daniel DeGrasse
5862b38e99 drivers: input: gt911: enable fallback to alternate address
GT911 IC uses the INT pin to select the correct I2C address during
reset. However, some boards may not route this pin (or may only support
receiving inputs on it). This results in the I2C address selected by the
GT911 IC being arbitrary based on the state of the (floating) INT pin.

To resolve this, introduce an `alt-addr` property for this device. When
set, the INT pin will not be pulled low. Instead, the I2C address will be
probed at runtime, starting with the devicetree address and falling back to
`alt-addr`.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-18 18:49:13 +00:00
Andy Sinclair
f2735b6109 drivers: mfd: npm1300: Added reset and hibernate
New reset function which performs a full power reset

New hibernate function which powers down and wakes after
specified timeout

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-07-18 16:21:41 +02:00
Dipak Shetty
022b234356 drivers: spi: eliminate dead code in spi_mcux_lpspi
The `spi_mcux_transceive` had 2 return calls when the
`CONFIG_SPI_MCUX_LPSPI_DMA` flag was active. The first return would be
called and the later was unreachable. With the fix, now the return calls
are mutually exclusive. Also, the `transceive` call is not compiled with
the `CONFIG_SPI_MCUX_LPSPI_DMA` flag is active.
Fixes #59533

Signed-off-by: Dipak Shetty <dipak.shetty@zeiss.com>
2023-07-18 16:21:26 +02:00
Wojciech Sipak
48fc80fa79 drivers: adc: iadc_gecko: select proper bits from sample
Only 12-bit resolution is currently available in the driver,
and each of the 16-bit samples store the actual data
aligned to the left.
A sample should be shifted 4 bits to the right to allow
proper interpretation.

Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
2023-07-18 16:21:09 +02:00
Daniel DeGrasse
fa94dcd277 drivers: mipi_dsi: implement clock selection algorithm
With the phy-clock being specified in devicetree (and thus under user
control), there is no need to artificially enlarge the DPHY clock to
insure it is fast enough. Instead, we can calculate the DPHY clock
directly, selecting the closest realizable value that is at least as
fast as the value requested by the user.

Fixes #59215

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-07-18 16:20:28 +02:00
Fabian Blatz
723421b231 input: convert cst816s from kscan
Convert the cst816s capacitive touch screen driver to the input subsystem.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2023-07-18 08:55:26 -05:00
Daniel Leung
9f02eeadf8 serial: allow callback setting to be exclusive
Both the IRQ API and Asynchronous API support callback.
However, since they are both interrupt driven, having
callbacks on both API would interfere with each other
in almost all cases. So this adds a kconfig to signal
that the callbacks should be exclusive to each other.
In other words, if one is set, the other should not
be active. Drivers implementing both APIs have been
updated to remove the callbacks from the other API.
Though, this still leaves the option to disable
the kconfig and allows both APIs to have callbacks
if one desires.

Fixes #48606

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-07-18 11:13:02 +00:00
Guillaume Gautier
c9461ca783 drivers: clock_control: add support for stm32 hsi14 clock
Add support of the dedicated STM32F0 14 MHz HSI clock for ADC.
Also remove ADC clock source selection as it is obsolete.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-07-18 11:10:17 +00:00
Tristan Honscheid
f119d5341a drivers: fdc2x1x: Fix compilation error
When CONFIG_PM_DEVICE is enabled, the FDC2x1x driver includes code that
doesn't access the name of the shutdown pin's GPIO port correctly.
Correct this so the code derefences the right struct members.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-07-18 11:09:08 +00:00
Tristan Honscheid
4ac8000bf2 drivers: fdc2x1x: Loosen newlib dependency
The FDC2X1X driver depends on newlib in Kconfig. This prevents the
driver from being built in a native_posix testing environment, which uses
an external libc from the host. Allow the driver to be built with an
external libc as well.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-07-18 11:09:08 +00:00
Wojciech Sipak
c811a4f430 drivers: adc: add ADC driver for EFM32
This adds a driver for ADCs available on EFM32

Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
2023-07-18 11:05:39 +00:00
Kim Bøndergaard
b3c46083fb drivers: rtc: stm32: New stm32 RTC driver
STM32 RTC driver for the new RTC API.
Can't coexist with old COUNTER based RTC

Though supported by HW, RTC_ALARM still to be supported by driver

Signed-off-by: Kim Bøndergaard <kim.bondergaard@prevas.dk>
2023-07-18 11:05:23 +00:00
Kim Bøndergaard
6775b263f3 drivers: counter: stm32_rtc: Make dependent of !RTC
New RTC API seems to conflict with old RTC implementations based on
COUNTER

This scheme follows Zephyrproject-rtos issue 56599 while keeping backward
compatibility.

Signed-off-by: Kim Bøndergaard <kim.bondergaard@prevas.dk>
2023-07-18 11:05:23 +00:00
Fabio Baltieri
15a2cb5a2f drivers: intel: ssp: delay initialization after dma
The SSP driver depends on DMA as there are references in the devicetree,
but it currently initialize before the DMA driver itself. This is
exposed by the build time priority checking
(CONFIG_CHECK_INIT_PRIORITIES=y) and shows up as:

ERROR: /soc/ssp@77a00 POST_KERNEL 32 < /soc/dma@7c000 POST_KERNEL 40
ERROR: /soc/ssp@77800 POST_KERNEL 32 < /soc/dma@7c000 POST_KERNEL 40
ERROR: /soc/ssp@77600 POST_KERNEL 32 < /soc/dma@7c000 POST_KERNEL 40
...

Bumping up the SSP priority so the initialization is in sync with the
devicetree node hirearchy.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-18 10:45:37 +00:00
Simon Guinot
a4645908ee drivers: led_pwm: fix overflow in set_brightness
The set_brightness function of the led_pwm driver uses a default PWM
period (defined in the pwms DT property) to compute a pulse passed to
the pwm_set_pulse_dt function. If this default period is greater than
2^32/100 nanoseconds (about 43 milliseconds) then the calculation may
overflow.

This patch prevents this overflow by running the pulse computation under
a cast with a larger type (uint64_t).

Reported-by: Scott Worley <scott.worley@microchip.com>
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2023-07-18 10:45:05 +00:00
Armando Visconti
a29261c5f4 drivers/sensor: check xyz_mem_bank_set() ret value
Check xyz_mem_bank_set() API return value to catch and report as soon
as possible the error condition. Impacted stmemsc API:

  - lsm6dso_mem_bank_set()
  - lsm6dso16is_mem_bank_set()
  - lsm6dsv16x_mem_bank_set()

Fix:

  Coverity-CID: 316212 (issue #58579)
  Coverity-CID: 316224 (issue #58580)
  Coverity-CID: 316307 (issue #58586)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-07-18 09:54:44 +00:00
Declan Snyder
191ad08154 drivers: dma_mcux_lpc: Add Kconfig to reduce data
Add a Kconfig to have the ability to fine tune the amount of RAM that
the driver uses based on the number of channels expected to be used.

Most of the code is already there but just need this Kconfig to get the
benefit of it by reducing the size of the statically created arrays.

Also change the number of channels field in the configuration to a byte
instead of a 32 bit integer because that should be sufficient to
describe the number of DMA channels.

Rename LPC DMA Driver Kconfigs with namespace to MCUX_LPC

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-07-17 13:06:01 -05:00
Wei-Tai Lee
5f6ceefb8e drivers: hwinfo: andes: Improve hwinfo_andes driver
Check the driver's readiness at boot and in each
function that depends on the syscon driver.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2023-07-17 13:19:37 +00:00
Girisha Dengi
9ca543d7ae drivers: reset: kconfig: Change default init priority to 35 from 40
Setting higher priority to reset controller to initialize it before
other dependent drivers running at CONFIG_KERNEL_INIT_PRIORITY_DEFAULT
priority which is 40.

Signed-off-by: Girisha Dengi <girisha.dengi@intel.com>
2023-07-17 10:47:11 +00:00
Nick Ward
2bf091f8af drivers: usb-c: fix - check if adc_channel is ready before use
This will protect a user of this driver against driver initialisation
order misconfiguration.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-07-17 10:16:22 +00:00
Nick Ward
371f0f2503 drivers: adc: use adc_is_ready_dt helper function
Update  `struct adc_dt_spec` use with adc_is_ready_dt()

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-07-17 10:16:22 +00:00
Fabio Baltieri
29d0cef49f pinctrl: rv32m1: delay init priority after the clock controller
The rv32m1 pinctrl driver depends on clock controller, add a new symbol
and set it so it gets initialized after that, and before other devices.

Fixes:

$ west build -p -b rv32m1_vega_ri5cy tests/kernel/common \
		-DCONFIG_CHECK_INIT_PRIORITIES=y
...
ERROR: /soc/pinmux@41037000 PRE_KERNEL_1 1 < \
		/soc/clock-controller@41027000 PRE_KERNEL_1 30

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-14 16:48:52 +00:00
Andrzej Kuros
5443d4127b drivers: ieee802154: nrf5: Add transmission with multiple CCA
The Kconfig IEEE802154_NRF5_MULTIPLE_CCA option is added.
The new functions `z_ieee802154_nrf5_extra_cca_attempts_set` and
`z_ieee802154_nrf5_extra_cca_attempts_get` are added.
The ieee802154_nrf5.c is updated allowing to pass extra cca attempts
to nRF 802.15.4 Radio Driver.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-07-14 09:46:36 -04:00
Chen Xingyu
770e6dfaef drivers: auxdisplay: Add driver for PTC PT6314 VFD controller
Adds the driver for PT6314 dot character VFD controller/driver IC.

Signed-off-by: Chen Xingyu <hi@xingrz.me>
2023-07-14 12:09:03 +02:00
L Lakshmanan
8fca1cdb29 drivers: mm: Fix macro call in RAT driver
The macro used in an assert statement in the `sys_mm_drv_page_phys_get()`
function was using an older version of the naming scheme, fixed now.

Signed-off-by: L Lakshmanan <l-lakshmanan@ti.com>
2023-07-14 09:37:53 +02:00
L Lakshmanan
24759511f4 drivers: uart: Add support for UART_NS16550 TI K3 variant
TI K3 family of SoCs requires an extended set of registers to operate.
Extended functionality of the current driver to support the variant.

Signed-off-by: L Lakshmanan <l-lakshmanan@ti.com>
2023-07-14 09:37:44 +02:00
Fabio Baltieri
04e0e458c8 input: convert gt911 from kscan
Convert the GT911 driver to the input subsystem, fix the existing boards
to work in the default config.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-13 14:24:50 +00:00
Benjamin Cabé
db53c3fd2c doc: Drop asterisk from Doxygen @param
The name for Doxygen params that are pointers should not include an
asterisk.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-07-13 13:25:28 +00:00
Adam Wojasinski
6f201f03f6 drivers: pwm: pwm_nrfx: Revert workaround for stopping PWM instance
This reverts commit 36f4226b2f.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-07-13 13:21:41 +02:00
Andrzej Głąbek
41c33d7f32 drivers: flash: nrf_qspi_nor: Fix writing from unaligned RAM buffers
Flash API states that drivers should support write requests without
any restrictions on location or alignment of the source buffer.
Due to hardware limitations of the QSPI peripheral, the nrf_qspi_nor
driver currently fails to perform a write from a RAM buffer that is
not word-aligned. Fix this by using in such case the same mechanism
that is used when the source buffer is located in the internal flash
(copy data to a buffer located on stack).
Also correct the length parameter for writes from this stack-based
buffer to be the actual data chunk length, not always the size of
the buffer (as for CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE > 4
this may lead to overwriting of some data located next in the flash).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-07-13 12:09:02 +02:00
Loic Poulain
e8e2b53849 drivers: usb: udc: add STM32 UDC driver
Add UDC driver for STM32 based MCU, relying on HAL/PCD.
This has been tested with cdc_acm sample on the following boards:

- 96b_carbon (STM32F4)
- disco_l475_iot1 (STM32L4)
- nucleo_wb55rg (STM32WB)
- nucleo_h723zg (STM32H7)
- stm32f3_disco (STM32F3)

This fails at runtime for the following:

- b_u585i_iot2a (STM32U5)

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-07-13 10:44:42 +02:00
Wei-Tai Lee
f2e0f787bf drivers: i2c: add error handling
Return errors when failing at consecutive transactions and
missing targets.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2023-07-13 09:23:39 +02:00
Wei-Tai Lee
fc89a85c29 drivers: i2c: add thread-safe semaphore
Add a semaphore to ensure that only one transaction
happens at a time when threads want to transfer
simultaneously.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2023-07-13 09:23:39 +02:00
Jordan Yates
1c2dba2107 drivers: modem: cache delimiter string length
Cache the delimiter string length in `parse_params`, instead of
calculating it on each character in the match buffer.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-13 09:23:05 +02:00
Jordan Yates
76c1a2019a drivers: modem: skip quoted delimiters
Given the following response: `+CIPSTA:ip6ll:"FE80::EDC:7EFF:FEDD:110C"`

The response delimiter is `:`, but there is also a quoted string that
contains the delimiter character. These delimiters should not be
considered when searching for the end of a parameter.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-13 09:23:05 +02:00
Marcel Krüger
f2ba0b7ae2 drivers: fuel_gauge: max17048: Remov unused var
Remove the unused variable 'data' from function
max17048_emul_transfer_i2c()

Signed-off-by: Marcel Krüger <marcel.krueger@ithinx.io>
2023-07-13 09:21:52 +02:00
Ryan McClelland
f1a992c87a drivers: sensors: bmi08x: add initial support for bmi08x
This adds support for the bosch bmi085 and bmi088. This also includes
support for data sync mode.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-07-12 14:53:16 -05:00
Kacper Dalach
f9773859c4 drivers: clock_control: stm32h5: boot_clock_assert_fix
When the image is chain-loaded, clocks may already by initialized.
The driver was lacking support for already configured HSE and
PLL sources. When CONFIG_ASSERT=y get_startup_frequency was
failing since it did not recognize these sources.

It's the same issue that was addressed in #58109 for stm32u5.

Signed-off-by: Kacper Dalach <dalachowsky@gmail.com>
2023-07-12 21:11:00 +02:00
Thomas Stranger
ce74b60d77 drivers: sensor: adxl362: coverity: 316152 unchecked return value
Check and propagate two return values.
Don't need to check return of the part id request, but make
sure that the value is initialized before the comparison.

Fixes #58575
Coverity-CID: 316152

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-07-12 10:53:56 -05:00
Thomas Stranger
7c6a340413 drivers: sensor: tmd2620: coverity 316443 unchecked return value
The return value is consciously not checked, because the operation
is expected to fail. And the real request is executed afterwards.

Fixes #58593
Coverity-CID: 316443

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-07-12 10:53:56 -05:00
Andy Sinclair
910d43805b drivers: watchdog: npm1300: Added watchdog driver
Added watchdog driver for nPM1300

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-07-12 14:36:56 +02:00
Andy Sinclair
4048348e3e drivers: gpio: gpio_npm1300: Added reset and power loss modes
Added configuration of nPM1300 GPIO pins as reset or
power loss warning.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-07-12 14:36:56 +02:00
Andy Sinclair
c793764549 drivers: mfd: mfd_npm1300: Added timer configuration function
Timer configuration function added

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-07-12 14:36:56 +02:00
Anisetti Avinash Krishna
d982ea54b6 drivers: pwm: Add support for pch intel blink driver
This patch adds support for PWM blink which is found in intel's
PCH hardwares.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-07-12 14:50:16 +03:00
Jamie McCrae
563b4540fa drivers: retained_mem: Allow disabling mutex support
Changes the Kconfig option to allow disabling mutex support, this
is to allow other Kconfig options to disable the feature.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-12 11:51:30 +02:00
Fabio Baltieri
b5970d21f3 drivers: mbox: initialize before ipc
Change the default mbox initialization priority so that it initializes
before ipc, as some ipc drivers depends on it.

Found with:

$ west build -p -b nrf5340dk_nrf5340_cpuapp \
		samples/subsys/ipc/ipc_service/icmsg_me \
		-DCONFIG_CHECK_INIT_PRIORITIES=y
...
ERROR: /ipc/ipc1 POST_KERNEL 46 <
	/soc/peripheral@50000000/mbox@2a000 POST_KERNEL 50
ERROR: /ipc/ipc0 POST_KERNEL 46 <
	/soc/peripheral@50000000/mbox@2a000 POST_KERNEL 50

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-12 11:48:19 +02:00
Erwan Gouriou
3359259a69 drivers: timers: Add LPTIM support for STM32WBA
Add LPTIM support for STM32WBA

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-12 11:48:10 +02:00
Guillaume Gautier
d15f3448b5 drivers: adc: Update ADC driver for STM32WBA series
Update ADC driver for STM32WBA series

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-07-12 11:48:10 +02:00
Erwan Gouriou
829fa5e70a drivers: counter: stm32wba: Avoid warning at build
STM32WBA LL API defines non const TIM_TypeDef.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-12 11:48:10 +02:00
Marek Pieta
1601725354 drivers: sensor: qdec_nrfx: Workaround spurious samplerdy event
The underlying HAL driver may improperly forward an samplerdy event even
if it's disabled in the configuration. Ignore the event to prevent error
logs until the issue is fixed in HAL.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2023-07-12 10:16:41 +02:00
Declan Snyder
bb74b311fe drivers: dma_mcux_lpc: remove SDK based macro
remove the sdk based TOTAL_DMA_CHANNELS macro and instead just use the
zephyr driver's num_of_channels field

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-07-12 09:26:58 +02:00
Florian Grandel
5c4ec518ab driver: rtc: rtc_emul: remove redundant brackets
Change due to review comment: remove redundant brackets for pointer
value access.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-12 09:26:16 +02:00
Florian Grandel
ff2b5cebb7 drivers: rtc: rtc_emul: replace mutex with spinlock
Replaces the mutex with a lightweight spinlock.

Fixes: #59901

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-12 09:26:16 +02:00
Elisabeth Friedrich
f4356f3b2e drivers: lpadc: fix ADC command chaining
When reading multiple ADC channel in parallel, an ADC command chain will be
build. This is similar to a linked list, as every command references the
next command.

Before this patch every ADC command after the first, would always reference
this initial command. So that during execution only two commands (the last
and first) would be executed which resulted in readout of only two analog
values. As Zephyr expected more to come in, the `read_adc` function would
block endlessly.

The patch fixes the behaviour and allows a correct chain to build up.

Signed-off-by: Elisabeth Friedrich <auxsys@flowerpot.me>
2023-07-12 09:25:44 +02:00
Fabio Baltieri
5ea3f9a24e drivers: pcie: initialize after interrupt controllers
PCIe devices refer to interrupt nodes, but are initialized with the same
priority, making the sequence depending on the linking order. Add a new
symbol and set it to one unit after intc to ensure that the
initialization sequence is stable.

Found with:

west build -p -b qemu_cortex_a53 \
	samples/drivers/virtualization/ivshmem/doorbell \
	-DCONFIG_CHECK_INIT_PRIORITIES=y
...
ERROR: /soc/pcie@4010000000 PRE_KERNEL_1 40 <
	/soc/interrupt-controller@8000000/its@8080000 POST_KERNEL 40

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-12 09:25:35 +02:00
Fabio Baltieri
c2d049f56e intc_gicv3_its: anticipate initialization priority
The intc_gicv3_its driver is currently initializing in POST_KERNEL, but
PCIe device nodes depends on it and are initialized earlier. Change the
init level to PRE_KERNEL_1 to sort that out, and also put the driver in
line with other interrupt controller drivers.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-12 09:25:35 +02:00
Tristan Honscheid
8fd1ce7579 emul: Only add enabled DT nodes to bus emulators
The eSPI, I2C, and SPI emulators use devicetree macros to build an array
of devices on the virtual bus. Currently, they will add device nodes that
are not status-okay. This leads to linker errors because the respective
device drivers would not have instantiated device structs for these
nodes --assuming the driver was even compiled. This can be frustrating
if nodes need to be disabled for debugging or configuration purposes.

Update the bus emulators to only consider status-okay nodes by changing
the macros used to iterate over bus devices.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-07-12 09:25:18 +02:00
L Lakshmanan
934c6d7b33 drivers: mm: Fix cast warnings on build for RAT
Removed the unneccessary casts in the functions to remove warnings
during build for SoCs using RAT. Functionality reamins the same,
tested on board.

Signed-off-by: L Lakshmanan <l-lakshmanan@ti.com>
2023-07-11 18:20:26 +00:00
Tim-Marek Thomas
5d75940ae3 boards: riscv: neorv32: Updates compatibility to neoverse v1.8.6
With NEORV32 v1.8.2 the UART module was changed to a simpler
implementation. This updates the UART driver for the open-source NEORV32
RISC-V compatible processor system (SOC).

Signed-off-by: Tim-Marek Thomas <thomas@sra.uni-hannover.de>
2023-07-11 18:19:55 +00:00
Alvaro Garcia
b7f9fb8f82 drivers: added support for clock PCF8563
Added driver support

Signed-off-by: Alvaro Garcia <maxpowel@gmail.com>
2023-07-11 16:14:49 +02:00
Tim Lin
0960bb3066 ITE: drivers/i2c: Add I2C target driver used buffer mode
Add I2C target driver used buffer mode. The maximum accessible buffer
is 2044 bytes, the default is 256 bytes.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-07-11 15:50:13 +02:00
Tim Lin
42e9dd8fe9 drivers/i2c/target/eeprom_target: Add buffer mode callback function
Add the callback functions of buf_write_received and buf_read_requested
to support buffer mode.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-07-11 15:50:13 +02:00
Tim Lin
27e2ec8a95 drivers/i2c: Add callback functions to support buffer mode in header file
Add buf_write_received and buf_read_requested callback functions
to support buffer mode.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-07-11 15:50:13 +02:00
Mike J. Chen
2a4acb2c42 drivers: spi: mcux_flexcomm: fix chip select bug w/ dma transfers
Fix for bug:
https://github.com/zephyrproject-rtos/zephyr/issues/59575

The dma version of the version of the driver can
invoke multiple intermediate dma transfers, like
when the spi_buf_set count is greater than one.
However, there is a bug where chip select is not kept
asserted for all intermediate dma transfers required
to process the entire spi_buf_set.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-07-11 08:05:59 -05:00
Guillaume Gautier
cbf9f3d4c2 drivers: flash: stm32: add stm32wba support
Add Flash STM32WBA support

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-07-11 15:05:05 +02:00
Guillaume Gautier
daef7c9d1b drivers: clock_control: stm32: Add stm32wba clock control driver
Add clock control driver on STM32WBA.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-07-11 15:05:05 +02:00
Chaitanya Tata
a132487fec net: wifi: Move Wi-Fi ops to a separate struct
Decouple interface and Wi-Fi APIs, Wi-Fi APIs are common independent of
Wi-Fi offload or implemented natively (This is preparation for
introducing Native Wi-Fi).

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2023-07-11 14:55:30 +02:00
Aymeric Aillet
1ddc41e7dd drivers: i2c: tca954x: Add build assert avoiding prio issues
In order for TCA954X driver to work well, we know that
mux root must be initialized before channels.
(see #37786).

This commit is:
- Ensuring that this condition is met at build.
- Document needed values for menuconfig to help user.
- Edit these values for TCA954X test sample

Fixes #40833

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2023-07-11 14:46:23 +02:00
Mykola Kvach
38675f2b92 soc: arm64: add support of r8a77961
Add support of r8a77961 SoC to gen3 series.
Create a dtsi file with a common part for both r8a77951 and r8a77961.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-07-11 11:17:41 +02:00
Mykola Kvach
d0472aae7a soc: arm64: add Renesas Rcar Gen3 SoC support
Add files for supporting arm64 Renesas r8a77951 SoC.
Add config option CPU_CORTEX_A57.

Enable build of clock_control_r8a7795_cpg_mssr.c for
a new ARM64 SoC R8A77951.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-07-11 11:17:41 +02:00
Mykola Kvach
644b38a3b7 drivers: rcar_cpg: do MMIO mapping inside driver
Add MMIO mapping for Renesas CPG driver in order to avoid
mappings inside mmu_regions.c file. Remove MMU region for
Renesas CPG driver.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-07-11 11:17:41 +02:00
Mykola Kvach
f66212022d drivers: rcar_cpg: delete irq lock/unlock from mstp_clock_endisable
Delete IRQ lock/unlock calls from 'rcar_cpg_mstp_clock_endisable',
because 'rcar_cpg_mstp_clock_endisable' function is always called
under spin lock.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-07-11 11:17:41 +02:00
Mykola Kvach
32e09e7c00 drivers: rcar_cpg: redesign cpg driver for r8a7795
Add associative tables for core and mod clocks.

Add possibility to enable/disable any of core clocks which presents
in the associative table.

Add handler for setting rate to driver and use generic rcar cpg
function for getting rate.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-07-11 11:17:41 +02:00
Mykola Kvach
6f24edf5c8 drivers: rcar_cpg: add generic Renesas functions for get/set rate
Add associated tables of clocks and API for working with these tables,
from this moment the relationship between clocks and their divider are
built. After set rate of some Core clock, driver has to update all
in/out rates of all childrens recursively. During get/set rate calls
if out rate is unknown, we try to get parent in/out rates and its
divider, in case when parent doesn't have valid in/out rates we get
parent of parent and so on until we get parent with a valid in or out
rates.

Add generic Renesas functions for get/set rate of CPG.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-07-11 11:17:41 +02:00
Mykola Kvach
e747e236ec drivers: rcar_cpg: move cpg log module declare to common rcar cpg file
Move cpg log module declare to common rcar cpg file. If the module
consists of multiple files, then LOG_MODULE_REGISTER should appear
in exactly one of them. Each other file should use LOG_MODULE_DECLARE
to declare its membership in the module.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-07-11 11:17:41 +02:00
Mykola Kvach
de639ed34c drivers: pfc_rcar: do MMIO mapping inside driver
Add MMIO mapping for PFC Renesas driver in order to avoid
mappings inside mmu_regions.c file.

Add a new system init function pfc_rcar_driver_init to PFC
Renesas driver for invoking a memory mapping macro.
Note: PFC Renesas driver doesn't use Zephyr Device Model.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-07-11 11:17:41 +02:00
Mykola Kvach
cb9d1607b3 drivers: uart_rcar: do MMIO mapping inside driver
Add MMIO mapping for UART Renesas driver in order to avoid
mappings inside mmu_regions.c file(s).

There are a lot of changes inside SCIF driver inside this
commit, because reg addr and size may be stored in RAM or
ROM and appropriately in different driver structures data
or cfg, and, because the name of field reg base is changed.

Note: it is common approach according to Zephyr documentation.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-07-11 11:17:41 +02:00
L Lakshmanan
7fc6e331d8 drivers: mm: Add support for TI RAT module using system_mm API
Added Region based Address Translation (RAT) module driver. Required by
a few Texas Instruments SoCs to fucntion. Uses
sys_mm_drv_page_phys_get() API with device_map() for address translation.

Signed-off-by: L Lakshmanan <l-lakshmanan@ti.com>
2023-07-11 09:44:48 +02:00
Brett Witherspoon
33cb179b4f drivers: dma: stm32u5: set data length in bytes
The block data length field should be in bytes. Setting this to a value
that is not a multiple of the data size results in a user setting error.

Running the ADC DMA test prior to this commit:

west build -p -b nucleo_u575zi_q zephyr/tests/drivers/adc/adc_dma

E: Transfer Error.
I: tc: 0, ht: 0, dte: 0, ule: 0, use: 1
E: DMA sampling complete, but DMA reported error -5

Existing tests using DMA on the nucleo_u575zi_q were not effected
because they only use a data size of one and continue to function
as expected:

west build -p -b nucleo_u575zi_q zephyr/tests/drivers/spi/spi_loopback \
	-DOVERLAY_CONFIG="overlay-stm32-spi-dma.conf"

SUITE PASS - 100.00% [spi_loopback]: pass = 1, fail = 0, ...

west build -p -b nucleo_u575zi_q zephyr/tests/drivers/dma/loop_transfer

SUITE PASS - 100.00% [dma_m2m_loop]: pass = 3, fail = 0, ...

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2023-07-11 09:44:37 +02:00
Brett Witherspoon
6d9d44e2a5 drivers: dma: stm32u5: use correct tables for data width
The tables for the dest and src data width constants were incorrectly
swapped. This commit uses the correct constants and renames the tables.

This change is only cosmetic for the stm32u5 since these constants are
the same but the existing names were probably inherited from another
driver where the p_*/m_* prefix was more appropriate.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2023-07-11 09:44:37 +02:00
Brett Witherspoon
f629f2c270 drivers: dma: stm32u5: enable error interrupts
Enable DMA error interrupts so that transfer errors are logged and
reported to the callback.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2023-07-11 09:44:37 +02:00
Bill Waters
541482ff20 driver: i2c: infineon: Adding XMC4 I2C driver
- This includes the driver, test app, and sample app
- Only the boards\arm\xmc47_relax_kit board is supported for now

Signed-off-by: Bill Waters <bill.waters@infineon.com>
2023-07-11 09:43:19 +02:00
Thomas Stranger
cf29b8caad drivers: sensor: mx5837: address integer overflow.
Avoid integer overflow in temp_sq calculation.
For an analysis of the value ranges for the temp_sq calculation
of mx5837-02 see below:

calculation:
dT = adc_temperature - ((int32_t)(data->t_ref) << 8);
data->temperature = 2000 + (dT * data->tempsens) / (1ll << 23);
temp_sq = (data->temperature - 2000) * (data->temperature - 2000);

given needed storage sizes:
t_ref is uint16_t,
adc_temperature is uint24_t,
data->tempsens is uint16_t,

ranges
=> dT:                -16776960 <= dT <= 16777215         (25 bit)

=> data->temperature (TEMP):
  intermed.(mult): -1099478073600 <=  x   <= 1099494785025 (41 bit)
  TEMP:         2.000 - 131068 <= TEMP <= 2.000 + 131.069
  TEMP:                -129068 <= TEMP <= 133069     (17 bit)

So worst case we need 17 bit for TEMP, so the square of it would
overflow an int32_t. The nominal measurement range is
only -40 to 85°C, meaning a range of -4000 to 8500.
So normally the result for temp_seq would fit into a int32_t,
but we cast to be better safe than sorry. Also the 64-bit
multiplication won't be the dominating operation of the
whole calculation.

Fixes #58585
Coverity-CID: 316294
Fixes #58594
Coverity-CID: 316521

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-07-11 09:43:10 +02:00
Ambroise Vincent
b6af1ac66e drivers: eth_smsc91x: Implement promiscuous mode
Add the RCR_PRMS field to toggle the promiscuous mode in the Ethernet
controller.

Register a set_config function that can make use of the field when
CONFIG_NET_PROMISCUOUS_MODE is enabled.

Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2023-07-10 15:14:33 +02:00
Benedikt Schmidt
39391b4a16 drivers: spi: replace timeout for STM32 DMA slave mode
Replace the timeout for a SPI transceive in slave mode for STM32 DMA
operations with a K_FOREVER. Being an SPI slave means we do not
know when the transaction will start, hence it does not make sense
to have a timeout in such a case.
This will resolve issue #60000.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-07-10 15:13:19 +02:00
Wojciech Sipak
490281a1d0 drivers: adc: fix missing ref_internal in iadc_gecko
The adc_driver_api structure provides .ref_internal
which previously was unset.
Now .ref_internal is set to the proper value.

Signed-off-by: Wojciech Sipak <wsipak@antmicro.com>
2023-07-10 15:10:23 +02:00
Armando Visconti
76e5760545 drivers/sensor: lis2dh: move h/w reg debug print right after it is read
Move LOG_DBG print just after the printed h/w register is read, to avoid
coverity complaining about uninitialized variable.

  Fix:
     Coverity-CID: 316407 (issue #58591)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-07-10 10:00:48 +00:00
Alberto Escolar Piedras
1842c602ec drivers serial native ptty: Split in top and bottom
Split the native ptty serial driver in a top and bottom
to enable using it with embedded libCs.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-10 09:53:22 +02:00
Alberto Escolar Piedras
2d3c53f705 flash simulator: Refactor native part so it works with emb libC
Refactor the part of the flash simulator that interacts with the
host when build for native platforms, so it is possible to use
it also with the embedded libCs.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-10 09:50:56 +02:00
Gustavo Silva
4eedd45c85 drivers: pwm: pwm_mcux: fix for coverity 321142
Fix `PWM_SetupPwm` function being called with `numOfChnls`
argument equal to 2, when in fact only one channel is being set up.

Also add 'U' suffix to `pwmFreq_Hz` unsigned integer argument in
the function call.

Signed-off-by: Gustavo Silva <gustavograzs@gmail.com>
2023-07-10 09:30:05 +02:00
Jaroslaw Stelter
0bf467bbcd mm_drv: tlb: Fix context save for remapped pages
In case of remapped reference counter for physical page
is differ to zero, but TLB entry for virtual address equal to
physical address will be disabled. Valid entry will be somewhere
in virtual space where particular physical page is remapped.

Since in adsp_mm_save_context() routine we go through physical
memory range, we need to include these pages in context save loop.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-07-10 09:27:31 +02:00
Fabio Baltieri
fed377f622 drivers: mipi: delay initialization after display drivers
Currently MIPI devices are set to initialize before display drivers,
which is incoherent with how the mcux mipi-dsi device is declared in the
device tree.

This is detected with build time priority checking:

west build -p -b mimxrt595_evk_cm33 samples/drivers/display \
	     -DCONFIG_CHECK_INIT_PRIORITIES=y

ERROR: /soc/peripheral@50000000/mipi_dsi@31000 POST_KERNEL 40 <
		/soc/peripheral@50000000/lcdif@210000 POST_KERNEL 85

Note that this also changes the priority of dsi_stm32, though that
should be ok since does not appear to have other dependencies in
devicetree.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-07-08 12:39:53 -04:00
Najumon B.A
b4ed6c4300 drivers: serial: driver init level based on parent node
Boot level based on parent node (PCI or no PCI device). Some platforms the
PCI bus driver depends on ACPI sub system to retrieve platform information
such as interrupt routing information. But ACPI sub system currently
support only post kernel and hence such platforms the UART driver instance
init should be invoked only post kernel in case parent node is PCI.

Signed-off-by: Najumon B.A <najumon.ba@intel.com>
2023-07-08 09:00:03 +03:00
Florian Grandel
75c83edc48 dts: ti: cc13xx_cc26xx: devicetree sysclk alignment
This change introduces the "_rtc_timer" suffix for the system tick timer
driver "compatible" property and aligns naming conventions with the
actual CC13/26xx SoC series product policy.

This frees up the "_rtc" namespace to introduce additional APIs based on
the same peripheral in the future (not part of this PR):

rtc: rtc@... {
  compatible = "ti,cc13xx-cc26xx-rtc";
  ...

  timer {
    compatible = "ti,cc13xx-cc26xx-rtc-timer";
    ...
  };

  counter {
    compatible = "ti,cc13xx-cc26xx-rtc-counter";
    ...
  };

  pps {
    compatible = "ti,cc13xx-cc26xx-rtc-pps";
    ...
  };
};

Or alternatively an MFD pattern with similar requirements.

Fixing the namespacing now makes sense standalone as it reduces the
chance of custom drivers being broken in the future.

Redundant extension of the mandatory system clock devicetree node is
replaced with a single `status = "okay"` which seems to be the more
sensible default to avoid user error when defining custom boards.
Knowledgeable users can still override this if really needed.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-07 18:46:24 -04:00
Florian Grandel
38e2eb8fe6 soc: ti: cc13/26xx: clean up include hierarchy
Removes duplicate code and inconsistencies in the naming of the
cc13xx_cc26xx devicetree and RTC driver hierarchy and alignes it with
the actual TI product series naming hierarchy.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-07 18:46:24 -04:00
Alberto Escolar Piedras
8252e99608 drivers: entropy native: Refactor to support embedded libCs
Refactor the host libC accesses to use the native simulator
host trampolines.

In this way we support building this driver with embedded libCs.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-07 14:32:41 +02:00
Armin Brauns
b95cdb2a33 drivers: serial: stm32: add support for RS485 configuration
The stm32 UART can output a "driver enable" signal on the RTS pin that
allows controlling e.g. external RS-485 drivers.

This can already be configured through the devicetree using the `de-*`
properties, but not through uart_configure(). This commit enables the use
of .flow_ctrl=UART_CFG_FLOW_CTRL_RS485.

This is supported on all devices other than l1, f1, f2, and f4 as found by
this search:

$ grep -rLw USART_CR3_DEM ../modules/hal/stm32/stm32cube/*/soc/*.h |\
    grep -vE 'system_|partition_|stm32[^0-9]+[0-9]?xx\.h' |\
    cut -d/ -f6 |\
    sort -u

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-07-07 13:16:27 +02:00
Marc Desvaux
2e4d7ec5a8 drivers : ethernet: add SOC_SERIES_STM32H5X
add Ethernet SOC_SERIES_STM32H5X

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-07-07 10:06:54 +00:00
Damian Krolik
a6e9782b01 drivers: ieee802154: fix declaration in case blocks
The code declares variables in switch-case blocks. This
seems to compile without an error on GCC 11 and newer,
but older compilers don't accept this code.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2023-07-07 11:29:33 +02:00
Tristan Honscheid
3b59d6842f sensor: ism330dhcx: Incorrect handle passed to ctx struct in SPI mode
The ISM330DHCX driver immediately segfaults when run in SPI mode. A bad
pointer is being passed into the `dev` param of `ism330dhcx_spi_read`.
Tracing this back, it appears that the handle field of the ctx struct
is being set to the device's data struct while `ism330dhcx_spi_read`
expects `ctx->handle` to be a pointer to a device struct.

Modify `ism330dhcx_spi_init()` to insert the correct pointer into the
context struct. Unfortunately this requires a cast to discard the
`const` qualifier, but this is how it is done in I2C mode (see
`ism330dhcx_i2c_init()`). The only other way would be to change the
declaration of `stmdev_ctx_t`, which is owned by the HAL module.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-07-07 09:18:41 +00:00
Alberto Escolar Piedras
963422111c driver gpio nrfx: Fix undefined output in gpio_nrfx_port_get_direction
gpio_nrfx_port_get_direction() is meant to check which inputs
are enabled, and does so by checking one bit at a time
and setting that bit into the "input" parameter.
But "input" was never zeroed, so any garbage ones it
may have remains.
Zero it.

This fixes a problem where if the "input" parameter was not
zeroed by the caller, the result of the funcion call
is undefined.

Detected by valgrind on:
tests/drivers/gpio/gpio_get_direction

Conditional jump or move depends on uninitialised value(s)
   by gpio_get_direction_test_disconnect (main.c:64)

Conditional jump or move depends on uninitialised value(s)
   by gpio_get_direction_test_output (main.c:102)

When running this test for the nrf52_bsim.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-07 05:12:09 -04:00
Martin Kiepfer
4da1518108 regulator: shell: fix unitialized variable warning from SCA
Static code analysis it has highlighted that a variable is beeing
accessed before initializing. This is a very minor fix
to resolve this potential issue.

Signed-off-by: Martin Kiepfer <mrmarteng@teleschirm.org>
2023-07-07 10:51:53 +02:00
Ren Chen
f46453cabb drivers: usb: usb_dc_it82xx2: correct the resumed/suspended mechanism
This change corrects the it82xx2 resumed/suspended mechanism and power
policy flow. The sof package is used to judge if the device can be set as
suspended state. If there is no sof package received(suspended), the chip
power policy is set as standby(deep doze) mode. Meanwhile, the USB D+
interrupt is enabled. The interrupt is triggered at resume signal(from J
to K state). Chip sets its power state as active(doze) mode and disable
the interrupt.

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2023-07-07 10:50:34 +02:00
Dino Li
fa49f77973 drivers/crypto/it8xxx2: add support for SHA256 hardware accelerator
Add SHA256 accelerator support for it8xxx2 series.

This driver passes the following test:
tests/crypto/crypto_hash/

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-07-07 09:24:47 +02:00
Aaron Massey
3e33d6af89 emul: SBS Gauge emulator reset rule
Since we have state that gets mutated between tests in the SBS fuel gauge
emulator we ought to reset its state before each test.

Add a reset rule to the SBS fuel gauge emulator that resets the state
before each test. Note: This includes allowing the emulator state to be
modified by user-threads.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-07-07 09:22:20 +02:00
Aaron Massey
e1401fcf5e emul: Add SBS Gauge emulator backend_api
In order to support easier setup of test scenarios with fuel gauge
emulators, we should expose an API that can change internal emulator state.

Add a minimal fuel gauge emulator backend API for setting the charging
current and voltage with a sample implementation in the emul_sbs_gauge with
an associated driver test.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-07-07 09:22:20 +02:00
Benjamin Perseghetti
da95a407bf drivers: sensor: ina23x: calculate cal at compile.
Calculate the calibration value at compile for ina23x.
Maximizes the precision of the calcualtion value by
using 64bit math at compile, allows for removal
of rshunt config option.

Code cleaned up with clang-format.

Co-authored-by: Trent Piepho <tpiepho@gmail.com>
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
2023-07-07 09:21:23 +02:00
Benjamin Perseghetti
5336e7fd14 drivers: sensor: ina23x: Use micro-ohms for rshunt
Changes rshunt-milliohms to rshunt-micro-ohms allowing for current
sensing of greater than 16.4A (1mOhm resistor). This is commonly
set to 100 uOhm for VMU/FMU boards/applications.

Co-authored-by: James Goppert <james.goppert@gmail.com>
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
2023-07-07 09:21:23 +02:00
Mulin Chao
2cf3caa11c driver: wdt: npcx: add WDT_OPT_PAUSE_HALTED_BY_DBG support.
This CL adds WDT_OPT_PAUSE_HALTED_BY_DBG support by enabling freeze mode.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-07-07 09:19:50 +02:00
Tristan Honscheid
81310769a9 emul: spi: SPI_EMUL_INIT(n) hard-coded to instance #0
The `SPI_EMUL_INIT(n)` macro used to instantiate SPI bus emulators
builds an array of SPI devices attached to the bus, but always checks
instance #0 of the bus and not `n`. This makes multiple instances of an
emulated SPI bus unusable and popualtes them all with bus 0's devices.

Change the `0` to `n`, which matches how the I2C bus emulator does it.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-07-07 09:17:12 +02:00
Jordan Yates
3a10923bbf drivers: wifi: esp_at: use dormant states
Update ESP AT modem driver to control the network interface dormant
state based on the network connection status, as described in the docs.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-07 09:16:31 +02:00
Manuel Arguelles
671d857a60 drivers: intc: nxp_s32: support multiple interrupt handlers
SIUL2 may require multiple interrupt handlers instead of a single one as
currently supported for S32Z/E. This is needed to enable support on
S32K3.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-07-06 14:19:23 -05:00
Manuel Arguelles
d2b2996a34 boards: mr_canhubk3: support pinctrl
Support pin control for NXP S32K3 devices and enable it by default on
mr_canhubk3 board configuration.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-07-06 14:19:23 -05:00
Manuel Arguelles
523591a3d5 drivers: clock_control: add NXP S32 driver
The clock controller is a singleton controller for all the system-level
clocks (XOSC, PLL, CGM, etc) to provide run-time information to the
peripheral device drivers about the module's clocks.
Clock configuration is not yet supported.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-07-06 14:19:23 -05:00
Alberto Escolar Piedras
1457b361b6 drivers gpio SDL emul: Split in top and bottom
Split the SDL GPIO emulator driver in a top and bottom
to enable using it with embedded libCs.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-06 16:04:15 +02:00
Alberto Escolar Piedras
78ff21e1e1 input SDL: Split in top and bottom
Split the SDL input driver in a top and bottom
to enable using it with embedded libCs.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-06 16:04:15 +02:00
Alberto Escolar Piedras
1e66ca0de3 display SDL: Split in top and bottom
Split the SDL display driver in a top and bottom
to enable using it with embedded libCs.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-06 16:04:15 +02:00
Alp Sayin
3a4419eff0 drivers: uart_mcux_flexcomm: Merge conditions for enabling ISR
Merges the condition for `UART_INTERRUPT_DRIVEN || UART_ASYNC_API` into
`UART_MCUX_FLEXCOMM_ISR_SUPPORT`.

Signed-off-by: Alp Sayin <alpsayin@gmail.com>
2023-07-06 11:48:49 +02:00
Alp Sayin
657cbe3a8f drivers: uart_mcux_flexcomm: fix mcux_flexcomm_isr unused for polled uart
When UART_INTERRUPT_DRIVEN=n, mcux_flexcomm_isr and the data structure
inside is left unused. This patch turns off the build of the entire ISR.

Signed-off-by: Alp Sayin <alpsayin@gmail.com>
2023-07-06 11:48:49 +02:00
Jan Peters
ecc665247b drivers: uart_mcux_lpuart: move critical function call out of assert()
without the call of LPUART_ClearStatusFlags(), the interrupt can
immediately trigger again, blocking the application.
CONFIG_ASSERTS=n removes the assert() including the call of
LPUART_ClearStatusFlags().
Also removed LPUART_ClearStatusFlags call for unclearable
kLPUART_TransmissionCompleteFlag.

Signed-off-by: Jan Peters <peters@kt-elektronik.de>
2023-07-06 11:48:22 +02:00
Lucas Tamborrino
ae6b398f51 dts: xtensa: espressif: esp32s3: add USB CDC support
Enable USB CDC with self stack support for esp32s3.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-07-06 09:46:37 +00:00
Sean Nyekjaer
9eebaf8b60 drivers: pwm: stm32: read clock divider register for stm32mp1 boards
Since clocks aren't declared in the devicetree for the stm32mp1
co-processor. Read the resulting clock divider here instead.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-06 09:44:01 +00:00
Sean Nyekjaer
f1d91a24ac drivers: counter: stm32: read clock divider register for stm32mp1 boards
Since clocks aren't declared in the devicetree for the stm32mp1
co-processor. Read the resulting clock divider here instead.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-06 09:44:01 +00:00
Wei-Tai Lee
8560fb3192 drivers: gpio: andes_atcgpio100: cleanup redundant macros
Remove redundant macros.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2023-07-05 09:59:15 -04:00
Wei-Tai Lee
0e8477ed43 drivers: gpio: andes_atcgpio100: implement port_get_direction function
Add support for port_get_direction function in andes atcgpio100 driver.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2023-07-05 09:59:15 -04:00
Jordan Yates
b3f12b430f drivers: bluetooth: hci: spi: add small read delay
Add a small delay between reading the transport header and reading the
HCI data. Failing to do so on a nRF9160<->nRF52832 link was reliably
resulting in the nRF9160 trying to read data before the nRF52832 had
set up the SPI transaction, resulting in the host reading a buffer full
of 0x00 and having to run the entire read result again.

Transceiving a 10 byte packet takes at least 31uS, while 100 byte
packets are around 150uS (duration of `spi_transceive` call). Waiting
1 tick to eliminate the need for most retransmissions is a valid
tradeoff.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-05 14:15:18 +02:00
Jordan Yates
21ed808ba1 drivers: wifi: esp_at: handle external reset sources
Add an option that signifies that the ESP modem may be reset at the same
time as the SoC by an external source. When this is the case, we first
wait for an unsolicited "ready" message from the modem, before
attempting to reset the device. This prevents two initialisation
sequences attempting to run at the same time.

We still want to wait for the complete initialisation sequence to
complete before returning in this case.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-05 14:14:51 +02:00
Jordan Yates
542aec673d drivers: wifi: esp_at: don't disable carrier in init
Don't unconditionally set the carrier to the off state in
`esp_iface_init`, as this is already done in `esp_reset` and the
function may be called after the modem has already completed the init
sequence and called `net_if_carrier_on`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-05 14:14:51 +02:00
Jordan Yates
91d6561bf4 drivers: wifi: esp_at: wait for init again
Wait for the init process to finish again, previously removed in
a8e6fc0b83. The original reasoning (deadlock with net interface locking)
no longer applies now that `esp_reset` is called in the device init
function, not in `esp_iface_init` (332a6f084a).

Without this change, if `reset-gpios` or `power-gpios` is set,
`device_is_ready` will return true even if the chip has fallen off the
board, as no communication is validated with the board.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-05 14:14:51 +02:00
Jordan Yates
b0db69d622 drivers: flash: spi_nor: exit DPD in all cases
Exit DPD on init in all cases, even when `CONFIG_SPI_NOR_IDLE_IN_DPD` is
not enabled.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-05 14:13:43 +02:00
Jordan Yates
ec44816ae7 drivers: flash: spi_nor: support device PM
Support device power management in spi_nor driver. Only use
SUSPEND/RESUME if `CONFIG_SPI_NOR_IDLE_IN_DPD` is not enabled to avoid
state conflicts.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-05 14:13:43 +02:00
Alberto Escolar Piedras
abf6da6318 drivers for POSIX arch: Add external libc dependencies
Quite a few of the drivers meant for the POSIX arch
interacted with the host directly, and will not
work when we use an embedded libC.

Until we fix them, let's add the appropriate
kconfig dependencies to avoid users trying to build them.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-07-05 07:01:19 -04:00
Jerzy Kasenberg
b896ca5771 drivers: counter: Add Smartbond basic support
This adds support for the TIMER1-4 counter.
Each counter has 24bits and can run on LP_CLK (15-32KHz)
or DIVN clock (32MHz) with prescaler 1-32.
Each counter can have one alarm set.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-07-05 13:00:50 +02:00
Andy Sinclair
7e3f6f1290 drivers: sensor: npm1300_charger: Added Ntc threshold config
The NTC thresholds (cold, cool, warm, hot) are now configured
during initialisation

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-07-05 12:59:38 +02:00
Andy Sinclair
725d45e6d4 drivers: sensor: npm1300_charger: Auto temp measurements
Enable automatic temperature measurements during charging.
Allows the PMIC to charge when the host is in low power mode.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-07-05 12:59:38 +02:00
Andy Sinclair
f93da64ec8 drivers: sensor: npm1300_charger: Startup vbus current limit
The vbus current limit is now written to the vbus startup
register. It is now applied at all times and does not need
to be updated on charger insertion.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-07-05 12:59:38 +02:00
Tomislav Milkovic
a459e56cc5 drivers: clock_control: Export initialization function for STM32H7
Because they are needed in SoC power.c, clock control init functions
for all other STM32 series has been exported as global.
This commit exports stm32_clock_control_init function as global for
STM32H7 series as well, making custom power management
implementations for STM32H7 series possible.

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2023-07-05 09:13:35 +02:00
Marek Matej
6e72e401f2 drivers: wifi: Fix esp32 driver
Fix compilation issue on esp_wifi_drv.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-07-04 15:28:03 +02:00
Mahesh Mahadevan
074fdbb4f7 drivers: mcux_usb: Fix selection of NO_CACHE
NO_CACHE cannot be selected for certain cores.
Use ARCH_HAS_NOCACHE_MEMORY_SUPPORT as the condtion
to select NO_CACHE config

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-07-04 11:07:55 +00:00
Eric Holmberg
acde5fe199 driver: gpio: fix shell blink command
The blink command should blink until the user presses a key, however on
some systems a pending keypress is present when entering the loop
causing it to immediate exit before getting a chance to blink.

Add a dummy read to clear the buffer before starting the blink loop.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
2023-07-04 08:13:34 +00:00
Brett Witherspoon
8f73a479d1 drivers: adc: stm32: use correct device in dma callback
The device passed to the DMA callback is the DMA device. Instead use
the ADC device available in the private data.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2023-07-03 13:50:37 +00:00
Moritz Fischer
28ed7f057d drivers: clock_control: Add clock_fixed_rate driver
Add fixed-clock clock control driver. This is a first step towards
making fixed-clocks a first-class citizen in the clock control
framework.

Since the change is hidden behind a Kconfig enable this is opt-in
for now.

Signed-off-by: Moritz Fischer <moritzf@google.com>
2023-07-03 12:49:27 +02:00
Caspar Friedrich
9291c9f7d6 drivers: tla2021: Add driver
This adds a driver for Texas Instruments Cost-Optimized, Ultra-Small,
12-Bit, System-Monitoring ADCs. Currently only TLA2021 is supported,
TLA2022 and TLA2024 may follow based on this driver.

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2023-07-03 09:30:54 +02:00
Guennadi Liakhovetski
db1a718341 drivers: dma: intel-adsp-hda: add a missing "break"
A "switch" statement in intel_adsp_hda_dma_status() seems to be
missing a "break". The second "break" is unneeded but seems to be a
part of the coding style.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-07-01 12:38:02 +02:00
Nicolas Pitre
49580bd374 drivers: systick: implement option for sys_clock_cycle_get_64()
This driver, due to its limited 24-bits counter, is already tracking a
cycle count in software. Allow that count to be a 64-bits value so this
won't wrap in a matter of only a few seconds when the hardware clock
is fast.

This is very cheap to do as expensive math operations (i.e. divisions)
are performed only on counter intervals whose values fit in 32 bits like
before.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-07-01 12:04:10 +02:00
Najumon Ba
b3d78de656 arch: x86: updated acpi config macro
renamed x86 CONFIG_ACPI config macro to CONFIG_x86_ACPI.

Signed-off-by: Najumon Ba <najumon.ba@intel.com>
2023-06-30 17:53:01 +03:00
Najumon Ba
a72271f27f drivers: pcie: add prt support for pci legacy interrupt
add support for obtain irq number from pci irq routing table

Signed-off-by: Najumon Ba <najumon.ba@intel.com>
2023-06-30 17:53:01 +03:00
Najumon Ba
f25dfcf88c lib: acpi: added acpi support using acpica lib
Add ACPI support for Zephyr using acpica open source
project. ACPI subsystem use to discover and configure
hardware components, perform power management (e.g. putting
unused hardware components to sleep), auto configuration (e.g.
Plug and Play and hot swapping) etc.

Signed-off-by: Najumon Ba <najumon.ba@intel.com>
2023-06-30 17:53:01 +03:00
Alberto Escolar Piedras
9445ca017c drivers gpio_nrfx: Don't use directly CMSIS instrunction intrinsic
To ease building for workstation tests, instead of using
the ARM CMSIS instructions instrinsics directly,
use the NRFX macro that uses the compiler builtins when
necessary.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-06-30 16:04:51 +02:00
Alberto Escolar Piedras
7d5eea869d drivers gpio_nrfx: Get peripheral address from HAL
Instead of getting the hardcoded address from the DT structure
use its symbolic name (Also from DT) which will be resolved
by the nRF HAL definitions.

This allows the GPIO peripherals' addresses to be redefined
for the simulated targets.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-06-30 16:04:51 +02:00
Ibe Van de Veire
007dc6d98f drivers: uart: atmel_sam: Added reset after error check
Following the sam4s datasheet, the OVRE, PARE and FRAME flags should be
cleared after a uart error occured. This is done writing a 1 to the
RSTSTA bit in the UART_CR.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2023-06-29 21:07:32 +02:00
Ajay Parida
69fead1998 net: mgmt: Support for forced Passive scan
Default scan mode is Active. User can force the scan mode to passive
through Kconfig option or using 'passive' option from shell.
Using either of this option will override regulatory settings and
forces all scan channels to be passive only.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2023-06-29 21:05:41 +02:00
Al Semjonovs
2a31c4c530 sensors: icm42688 async API
Implementation of the async API for the icm42688

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-06-29 21:04:33 +02:00
Kevin Wang
a9955d3e17 drivers: watchdog: Add Andestech ATCWDT200 driver.
Support the Andes atcwdt200 watchdog driver.

Signed-off-by: Kevin Wang <kevinwang821020@google.com>
2023-06-29 10:13:05 +00:00
cyliang tw
51d57f612d drivers: pinctrl: add pin group for NuMaker pinctrl
Update Nuvoton numaker series pinctrl, let support pin group.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-06-28 06:49:38 +00:00
Fabio Baltieri
9065c2d156 input: convert xpt2046 from kscan
Convert the XPT2046 driver to the input subsystem, change the api,
remove the callback and enable logic.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-06-27 12:17:06 +00:00
Manojkumar Subramaniam
d78c0e538c drivers: serial: add uart_efinix_sapphire initial version
Add UART driver for Efinix Sapphire SoCs

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2023-06-27 12:09:57 +00:00
Manojkumar Subramaniam
1ca6a5d77f drivers: gpio: gpio_efinix_sapphire: initial version
Add GPIO driver for Efinix Sapphire SoCs.

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2023-06-27 12:09:57 +00:00
Casper Egholm Jørgensen
4beb51c52f drivers: src: hwinfo: Report reset cause for lockup_sysresetreq
Fix  incomplete reset cause to be reported for NXP MIMXRT1062-evkb.

In the event of a reset due to core lockup
or software reset request on a 1062 board,
the current NXP hwinfo driver reports an incomplete
reset cause (only Ipp reset pin).

This is happening because the 1062 uses a combined CPU lockup
and system reset request register bit that should be checked,
whereas the current driver only checks for the existence
of a lockup-only status bit.

This commit adds a check on the flag
FSL_FEATURE_SRC_HAS_SRSR_LOCKUP_SYSRESETREQ
already present in MIMXRT1062_features.h,
to report such a reset cause should it occur.

Signed-off-by: Casper Egholm Jørgensen <cjo@trackman.com>
2023-06-26 16:14:14 +02:00
Chaitanya Tata
7987098497 drivers: wifi: Register Wi-Fi architecture type
Identify the Wi-Fi capability to the networking stack and also the type
of Wi-Fi (Native vs Offloaded), this helps identifying Wi-Fi interfaces
that can be used by applications.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2023-06-26 16:12:32 +02:00
Mark Kettner
a0418f1821 modem_shell: fix compilation error.
fix error: 'struct modem_shell_user_data' has no member named 'shell'

Signed-off-by: Mark Kettner <mark@kettner.io>
2023-06-26 08:31:42 +00:00
Alexander Razinkov
cb491cacad drivers: support 64-bit addresses from devicetree for PLIC, MTIMER, UART
Usage of 64-bit address constants from devicetree without
an UINT64_C wrapping macro results in the following warning
and the cut-off of the address value:

"warning: integer constant is so large that it is unsigned"

This change fixes such issue for PLIC, MTIMER and UART in case
they are used with some 64-bit RISC-V platforms

Signed-off-by: Alexander Razinkov <alexander.razinkov@syntacore.com>
2023-06-25 03:29:54 -04:00
Daniel DeGrasse
3a6045271f drivers: kscan: use zephyr_syscall_header
Add call to zephyr_syscall_header to kscan driver CMakeLists.txt, so
that the required syscalls will be generated when kscan drivers are
used.

Fixes #59710

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-06-24 18:55:32 +02:00
Anas Nashif
7584c17374 intel_adsp: restructure dmic headers and move regs to soc
The ifdefs in in dmic headers is getting out of control and makes
maintainence very ddifficult, especially when having to maintain out of
tree SoCs sharing the same data and information.

Keep header clean and per SoC and share some common registers in one
place instead avoiding confusion and making it easier to read and
maintain.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-23 14:27:44 -04:00
Conor Paxton
a810d27935 drivers: i2c: add Microchip PolarFire SoC I2C driver
This patch adds driver support for Microchip's PolarFire SoC I2C. This
initial support implements the Controller API only.

Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
2023-06-23 12:31:36 -04:00
Francois Ramu
06b8f4b994 drivers: flash: stm32 qspi driver with read SFDP ID from quadflash
This commit adds the jedec216 read sfdp and Read ID
function API. The qspi commands are issued to the
quad flash device.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-06-23 10:51:06 +00:00
Andy Sinclair
7bc99e246c drivers: led: npm1300: nPM1300 LED driver
Added LED driver for nPM1300 PMIC

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-06-23 08:55:13 +00:00
Fabio Baltieri
bb5f421ade gpio: npm1300: lower init priority
Lower the priority of the npm1300 gpio driver. The GPIOs are used by
some regulator nodes in the default shield config, but regulators are
initialized before the gpios. Lowering the GPIO priority to sort thigs
out.

Found with the build time priority checking feature:

$ west build -p -b nrf52dk_nrf52832 samples/shields/npm1300_ek \
  -DCONFIG_CHECK_INIT_PRIORITIES=y
...
ERROR: /soc/i2c@40003000/pmic@6b/regulators/LDO2 POST_KERNEL 76 <
  /soc/i2c@40003000/pmic@6b/gpio-controller POST_KERNEL 80
ERROR: /soc/i2c@40003000/pmic@6b/regulators/LDO1 POST_KERNEL 76 <
  /soc/i2c@40003000/pmic@6b/gpio-controller POST_KERNEL 80
ERROR: /soc/i2c@40003000/pmic@6b/regulators/BUCK2 POST_KERNEL 76 <
  /soc/i2c@40003000/pmic@6b/gpio-controller POST_KERNEL 80
ERROR: /soc/i2c@40003000/pmic@6b/regulators POST_KERNEL 75 <
  /soc/i2c@40003000/pmic@6b/gpio-controller POST_KERNEL 80
ERROR: /soc/i2c@40003000/pmic@6b/regulators POST_KERNEL 75 <
  /soc/i2c@40003000/pmic@6b/gpio-controller POST_KERNEL 80
ERROR: /soc/i2c@40003000/pmic@6b/regulators POST_KERNEL 75 <
  /soc/i2c@40003000/pmic@6b/gpio-controller POST_KERNEL 80

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-06-23 09:23:22 +02:00
Francois Ramu
e802779d86 drivers: clock control: stm32h5 set the clock freq for voltage scaling
According to the stm32h5x product specifications, the values of the
voltage ragulator depends on the system clock as follows:
• VOS0 (Vcore = 1.35V) with CPU and peripherals running at up to 250 MHz
• VOS1 (Vcore = 1.2V) with CPU and peripherals running at up to 200 MHz
• VOS2 (Vcore = 1.1V) with CPU and peripherals running at up to 150 MHz
• VOS3 (Vcore = 1.0V) with CPU and peripherals running at up to 100 MHz

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-06-23 09:22:06 +02:00
Francois Ramu
a5532f9fd9 drivers: dma: stm32 dmamux device must be initialized after dma
Add specific init priority for the stm32 DMAMUX device higher
than the CONFIG_DMA_INIT_PRIORITY, to be sure that the DMAMUX
 initialization always comes after the stm32 DMA device init.
Its default value is set to 41 when the DMA_INIT_PRIORITY is
KERNEL_INIT_PRIORITY_DEFAULT (=40).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-06-23 09:21:59 +02:00
Florian Grandel
7232c38828 drivers: ieee802154: cc13/26xx_subg: fix PHY overrides
PHY overrides have been checked against the latest version of TI's
SmartRF(TM) Studio. The result was regression tested (PER/performance)
against LAUNCHXL-CC1352P1 boards.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
fe03bb5f1a drivers: ieee802154: cc13/26xx_subg: fix subg_start() return value
The radio API should indicate errors when the interface is started.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
122a10fdaa drivers: ieee802154: cc13/26xx_subg: fix header len const
The length field in the header refers to the size of the MAC so it
shouldn't rely on constants describing PHY header length. While
currently both constants have the same value this will no longer be true
for enhanced PHYs and/or MAC frames as the number of FCS bytes may then
be four.

Also introduces an assertion that ensures that the given package buffer
does not exceed the TX buffer's length. An assertion is enough as the
package buffer is allocated at compile time.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
ea89a1f9b5 drivers: ieee802154: cc13/26xx_subg: conditional RX after set_channel
The call to radio_api->set_channel() must not switch on RX if it was
previously off.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
0ea5658491 drivers: ieee802154: cc13/26xx_subg: remove unused radio commands
The CMD_CLEAR_RX and CMD_SET_TX_POWER commands are declared and
initialized but not used anywhere. They are therefore removed to reduce
RAM/flash footprint.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
a94877b8b1 drivers: ieee802154: cc13/26xx_subg: improve CSMA/CA compliance
Switch the driver to the soft CSMA/CA algorithm as an intermediate
compromise for improved standard compliance (namely expontential
backoff) until true hardware support can be implemented by chaining
radio commands.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
8a86f0c30e drivers: ieee802154: cc13/26xx_subg: fix CCA method
The driver's CCA method had various issues and would always return an
error code. This is fixed in this change.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
f0cb607a87 drivers: ieee802154: cc13/26xx_subg: inline documentation
This change introduces inline documentation with references to the
current version of the IEEE 802.15.4 standard.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
6bb03b5e3b drivers: ieee802154: cc13/26xx_subg: fix/document non-standard CSMA/CA
The CC13xx/CC26xx Sub-GHz driver announces a hardware CSMA/CA capability
which it provides only partially. This change documents the gap.

The change also fixes two related issues with the current CCA
implementation:

- The given default ED threshold was above the allowed threshold
  defined in the specification.

- The CCA timeout was not calculated according to the requirements
  defined in the standard.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
0f21a18f4b drivers: ieee802154: cc13/26xx_subg: readability improvements
This change introduces standard variable names used elsewhere in the
stack for improved naming consistency and readability.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
f05277a367 drivers: ieee802154: cc13/26xx_subg: fix invalid KConfig reference
The driver contained references to KConfig variables w/o the required
CONFIG_ prefix. This change introduces the missing prefixes.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
6683c2833c drivers: ieee802154: cc13/26xx_subg: remove dead code
The channel-to-frequency conversion had unreachable code which is
removed in this change.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
154ac22608 drivers: ieee802154: cc13/26xx_subg: remove redundant configuration
The low-level configuration of the chip's radio commands was mostly
redundant. This change removes redundant configuration code.

This is also relevant as a preparation to supporting further frequency
bands and operating modes on the same SUN FSK channel page with
similar but slightly different settings (center frequencies, channel
spacing, modulation index as defined in the standard). The SUN FSK
standard defines plenty of such variations with different physical
characteristics and trade-offs. Such variations are highly relevant in
industrial applications which will be targeted by TSCH. Using the
correct settings is required for additional features (e.g. frequency
hopping) and interoperability.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel
81fa03f7a3 drivers: ieee802154: cc13/26xx_subg: clean up constants
The CC13xx/CC26xx Sub-GHz driver header file defined several constants
that were not used in the driver.

Other constants could be replaced with generic constants which were
introduced in the prior commit.

This change removes and/or replaces redundant definitions.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Fabio Baltieri
a7490d2762 pinctrl: kinetis: use kernel default init priority
Set the initialization priority for the pinctrl_mcux_init to
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT.

The pinmux nodes depend on pcc, which is currently initializing at a
later stage, using the default priority fixes it.

Found the error with:

$ west build -p -b frdm_k64f samples/basic/blinky \
  -DCONFIG_CHECK_INIT_PRIORITIES=y
...
ERROR: /soc/pinmux@4004d000 PRE_KERNEL_1 0 <
  /soc/pcc@40065000 PRE_KERNEL_1 30
ERROR: /soc/pinmux@4004c000 PRE_KERNEL_1 0 <
  /soc/pcc@40065000 PRE_KERNEL_1 30
ERROR: /soc/pinmux@4004b000 PRE_KERNEL_1 0 <
  /soc/pcc@40065000 PRE_KERNEL_1 30
ERROR: /soc/pinmux@4004a000 PRE_KERNEL_1 0 <
  /soc/pcc@40065000 PRE_KERNEL_1 30
ERROR: /soc/pinmux@40049000 PRE_KERNEL_1 0 <
  /soc/pcc@40065000 PRE_KERNEL_1 30

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-06-22 17:29:44 -04:00
Jaroslaw Stelter
225e8c09ac mm_drv: tlb: Fix driver tests
Previous fix https://github.com/zephyrproject-rtos/zephyr/pull/58891
introduced failure in driver tests suite. This patch corrects the error
and reverts max_mapped_page field definition.
Adds max_mapped_pages stats reset after unmaping of unused memory.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-06-22 17:23:56 -04:00
Andrey Borisovich
23b3cae1b1 inte_adsp: ipc: prevent ipc message send during Device power transition
When CONFIG_PM_DEVICE is enabled IPC Device may be during power transition
during a call to intel_adsp_ipc_send_message function.
Changed signatures of intel_adsp_ipc_send_message and its sync version
to return int and negative error codes on error.
On attempt to send IPC message during Device power transition
-ESHUTDOWN error code is returned, on busy state -EBUSY.
Updated all function references.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2023-06-22 06:14:57 -04:00
Andrey Borisovich
7595cafb02 intel_adsp: timer: implemented sys_clock_idle_exit function
Generic header for system clock allows to define a sys_clock_idle_exit
function for the clock implementation.
Implemented the function in the intel_adsp_timer to reinitialize
device driver after the idle exit state.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2023-06-22 06:14:57 -04:00
Declan Snyder
7e44efe70a drivers: gpio_mcux_lpc: Guard NXP Pint code
Guard NXP PINT related code with #ifdef CONFIG_NXP_PINT.

This prevents build errors on platforms that do not have a PINT but have
LPC GPIO.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-06-22 10:48:24 +02:00
Armin Brauns
2fc212c2a0 bluetooth: hci: spi: initialize IRQ callback before registering it
GPIO callbacks need to be initialized before being registered with a GPIO
driver, otherwise the NULL `handler` hits an assert.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-06-22 10:48:07 +02:00
Fabio Baltieri
2790106c33 input: add a gpio qdec input driver
Add a GPIO based quadrature decoder driver that reports relative axes
movements using the input subsystem.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-06-22 10:46:15 +02:00
Lucas Tamborrino
e229898caf drivers: pinctrl: esp32xx: allow internal loopback
Provides a way to use pinctrl to allow internal loopback
on a peripheral pin for testing purposes.
This is done by using output-enable on a input pin and
input-enable on a output pin.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-06-22 08:13:36 +00:00
Lucas Tamborrino
8acedc61d1 drivers: flash: esp32xx: use K_NO_WAIT when in ISR
Avoid timeout when taking semaphores in ISR.

This enables flash operations inside interrupted context
such as exceptions, allowing operations like saving core
dump to flash for instance.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-06-21 16:06:06 -04:00
Tomasz Bursztyka
257deba9c2 drivers/pcie: Fix copyright year
Trivial update that was missed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-06-21 13:57:01 -04:00
Adrian Warecki
d13dfb9d23 dmic: Allow use of reserved bits in CIC_CONTROL register
Since the mtl platform, the stereo bit has been removed from the
CIC_CONTROL register and now it is marked as reserved. On some platforms
(mtl and above), the configuration blob still has this bit set, causing the
dmic driver to report an error. This commit changes the behavior of the
driver to only display a warning.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-06-21 13:56:16 -04:00
Jaska Uimonen
c022f41c1e drivers: dai: intel: dmic: fix irq argument cast
The argument to the dmic irq is of type "struct device *" and dmic data
is actually part of it, thus make the cast correctly.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2023-06-21 16:06:44 +02:00
Georgij Cernysiov
f09e3abbcb drivers: flash: stm32 ospi: configure ospim io ports
Allows to configure OSPI Manager IO ports with devicetree.

If properties are absent, then original default values
are preserved for compatibility.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-06-21 16:06:00 +02:00
Georgij Cernysiov
0ea2e7c906 drivers: flash: stm32 ospi: move STM32 OSPI node
Move `STM32_OSPI_NODE` to the top.
That allows its usage in other macros that require
OSPI bus.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-06-21 16:06:00 +02:00
Christopher Friedt
bf4977e41b drivers: rtc: mc146818: changes for y2k test
The year needs to be corrected to an offset from 1900.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-21 08:20:45 -04:00
sukrit buddeewong
c5bb959b25 driver: uart: Fix Modbus data currupted by DE-RE signal
Add UART_UARTFR_BUSY_BITS To fix modbus data was currupted

Signed-off-by: sukrit buddeewong <sukrit.omu@gmail.com>
2023-06-21 09:34:08 +00:00
cyliang tw
0fd564ef7f drivers: gpio: support for Nuvoton numaker series GPIO
Add Nuvoton numaker series GPIO support, including interrupt mode and
also integrate clock control.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-06-21 09:26:00 +00:00
cyliang tw
6176687c88 drivers: serial: support for Nuvoton numaker series UART
Add Nuvoton numaker series UART support, including interrupt-driven,
also apply pinctrl and clock-control.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-06-21 09:26:00 +00:00
cyliang tw
c448dceb57 drivers: reset: add support for NuMaker series reset
Add Nuvoton numaker series reset controller support.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-06-21 09:26:00 +00:00
cyliang tw
4ad399d54d drivers: clock_control: add support for Nuvoton numaker series CLK
Add Nuvoton numaker series clock controller support, including:
1.  Do system clock initialization in z_arm_platform_init().
2.  Support peripheral clock control API equivalent to BSP
    CLK_EnableModuleClock()/CLK_SetModuleClock().

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-06-21 09:26:00 +00:00
cyliang tw
5879810137 drivers: pinctrl: add support for NuMaker series pinctrl
Add Nuvoton numaker series pinctrl support.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2023-06-21 09:26:00 +00:00
Gerard Marull-Paretas
48b201cc53 device: make device dependencies optional
Device dependencies are not always required, so make them optional via
CONFIG_DEVICE_DEPS. When enabled, the gen_device_deps script will run so
that dependencies are collected and part of the final image. Related
APIs will be also made available. Since device dependencies are used in
just a few places (power domains), disable the feature by default. When
not enabled, a second linking pass will not be required.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-21 09:32:05 +02:00
Marko Sagadin
54cbf45c74 drivers: uart: add support for serial ports on native posix
Add support for communication with serial ports on native POSIX platform
via UART driver API. Serial port driver supports polling API,
configuration of the serial ports used via devicetree and command line
options, and runtime configuration with `uart_configure`.
Multiple instances of the driver are supported.
Example use and configuration is also demonstrated in the
`samples/drivers/uart/native_tty` sample.

Closes: #56586

Signed-off-by: Marko Sagadin <marko.sagadin42@gmail.com>
2023-06-21 09:27:22 +02:00
Adrian Warecki
2958a407f8 adsp: dmic: Add source clock selection support
The dmic driver has been expanded to support different clock sources.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-06-20 14:19:13 -04:00
Adrian Warecki
1a4bc7580b adsp: Rename cpu clock related functions
The word cpu was added to the names of functions, structs, types
and definitions to disambiguate the names and make room in the namespace
for soc clock control functions.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-06-20 14:19:13 -04:00
Adrian Warecki
0ee6452816 adsp: ace: dmic: Add missing registers definitions
Added definitions with description of missing registers for ace platforms.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-06-20 14:19:13 -04:00
Adrian Warecki
fbb55d1d5e adsp: dmic: Moved registers definitions to a separate file
Moved dmic register definitions to a separate file dmic_regs.h and added
their description. Platform-dependent registers definitions are placed in
separate files. Used standard macros FIELD_PREP, FIELD_GET in operations on
registers.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-06-20 14:19:13 -04:00
Tomasz Bursztyka
0c9e762cee drivers/pcie: Add VC/TC mapping and VC enablement
Note that only the the hardware round robin port arbitration capability
is being used.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-06-20 14:01:43 -04:00
Tomasz Bursztyka
6a1e19cf86 drivers/pcie: Add virtual channel details output to shell module
Helps to see how many VCs are supported and the related ressources.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-06-20 14:01:43 -04:00
Tomasz Bursztyka
5e4e6bc486 drivers/pcie: Add Virtual Channel configuration support
Basic support of VC capability, where a driver can enable VC and map its
traffic classes.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-06-20 14:01:43 -04:00
Jaroslaw Stelter
faadbc42ee mm_drv: tlb: Fix mapped page in bank calculation
The initial implementation was broken during improvements.
There was incorrect assumption that all pages are unmapped at
initials state. In reality at the beginning whole memory is
powered on, so we should mark all pages as mapped. Later in
initialization code unused pages are unmapped and if after this
some banks become empty (all pages unmapped), the power is
switched off.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-06-20 14:00:59 -04:00
Nick Ward
e0cdb0178c drivers: sensor: bmm150: add PM
Add PM

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-06-20 15:15:47 +02:00
Nick Ward
ce9eb7a353 drivers: sensor: bmm150: improve initialisation
Update driver with low level power control and OpMode
functions to better represent operations used in power
mode transition diagram Figure 2 from the datasheet.
This also prepares the driver for use of these functions
for PM actions.

Extend the soft reset at initialisation to a full POR.

Add defines for maximum POR time and start up time.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-06-20 15:15:47 +02:00
Nick Ward
49ff2a5add drivers: sensor: bmm150: fix soft reset
Bit 7 and 1 is 0x82 not 0x81.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-06-20 15:15:47 +02:00
Nick Ward
264d3f0b1a drivers: sensor: bq274xx: apply clang format
Fix unnecessarily broken lines.
Also make logging sentences more concise.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-06-20 15:15:40 +02:00
Oleh Lozynskyy
845d880773 drivers: sensor: bq274xx: shorten macro names
Shorten lines lengths.

Signed-off-by: Oleh Lozynskyy <oleh.lozynskyy@gmail.com>
2023-06-20 15:15:40 +02:00
Oleh Lozynskyy
0f37378a95 drivers: sensor: bq274xx: remove bq274xx prefixes
Shorten lines lengths.
Remove bq274xx prefixes from static function names.
Removes repetition of bq274xx in logging.

Signed-off-by: Oleh Lozynskyy <oleh.lozynskyy@gmail.com>
2023-06-20 15:15:40 +02:00
Oleh Lozynskyy
765698e3a2 drivers: sensor: bq274xx: rename bq274xx to data
Shorten lines lengths.

data is a common driver data struct point name.

Signed-off-by: Oleh Lozynskyy <oleh.lozynskyy@gmail.com>
2023-06-20 15:15:40 +02:00
Oleh Lozynskyy
f3668dfdff drivers: sensor: bq274xx: rename status to ret
Shorten lines lengths.
ret is a more common return variable name.

Signed-off-by: Oleh Lozynskyy <oleh.lozynskyy@gmail.com>
2023-06-20 15:15:40 +02:00
Christopher Friedt
c8e0022d4b drivers: rtc: mc146818: fix y2k bug
That's correct. We are still fixing the Y2K bug in 2023 \o/

* write century to RAM register 0x32
* ensure year register is in [0,99] (inclusive)

Aside from that, there were a few other errors in the driver.

* translate epoch-centric RTC API year to begin at 1900
* fix off-by-one error with month limit
* fix off-by-one error with wday
* fix off-by-one-hundred error with year limit
* adjust timeptr values in rtc_mc146818_validate_time()
* adjust timeptr values in rtc_mc146818_validate_alarm()

With the above, the testsuite passes!

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-20 15:14:08 +02:00
Serhiy Katsyuba
6c9a360647 drivers: intel_adsp_gpdma: Fix typo in reg name
The correct short name for Dynamic Clock Gating Disable register is DCGD,
not DGCD.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
2023-06-20 07:57:37 -04:00
Michael Grand
78d3f2a6a0 stm32,i2c: Fix large I2C transactions on I2C V1
Previous commit added support of large transactions on I2C v2,
this commit implements some changes to also add support
of large transactions on I2C v1. Some refactoring is also done
to put the code in the right source files.

Fixes zephyrproject-rtos#58866

Signed-off-by: Michael Grand <m.grand@trustngo.tech>
2023-06-20 10:43:36 +00:00
Filip Kokosinski
d644bebd93 drivers/entropy/gecko_trng: select the correct RNGOUT_FIFO_MEM_BASE
This commit introduces a preprocessor checking mechanism for selecting the
correct RNGOUT FIFO memory base address depending on whether SL_TRUSTZONE
is used.

Fixes #59197.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-06-20 09:25:45 +02:00
Andrei Emeltchenko
0adfe5531e drivers: gsm_ppp: Fix possible NULL pointer dereference
Assign api value after NULL check.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-06-20 09:25:30 +02:00
Andy Sinclair
68589ca0f1 drivers: gpio: npm1300: Use MFD register functions
Local register read/write functions have been removed and replaced
with calls to the new MFD functions.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-06-19 11:02:58 +02:00
Andy Sinclair
b31f60470f drivers: sensor: npm1300_charger: use MFD register functions
Local register read/write functions have been removed and replaced
with calls to the new MFD functions.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-06-19 11:02:58 +02:00
Andy Sinclair
5e6f82c872 drivers: regulator: npm1300: Now uses MFD register access functions
Local register read/write functions have been removed and replaced
with calls to the new MFD functions.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-06-19 11:02:58 +02:00
Andy Sinclair
d7964cd212 drivers: mfd: npm1300: Initial version
Added an MFD driver for the nPM1300.
This driver has register access helper functions that can be used
by subsystems.  This will avoid each subsystem having to duplicate
the register access code.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-06-19 11:02:58 +02:00
Guy Morand
890363a6fb drivers: led: Add lumissil is31fl3216a driver
The IS31FL3216A is a fun light LED controller. The LED current of each
channel can be set in 256 steps by adjusting the PWM duty cycle through
an I2C interface.

Signed-off-by: Guy Morand <guy.morand@bytesatwork.ch>
2023-06-19 11:02:36 +02:00
Jonas Remmert
49707dfca2 drivers: led: add power management for ti lp5569
Adding device power management for the ti lp5569 led controller driver.
Allow the option to either use device power managemnt while keeping the
voltage on or to use device power management including using e.g. a voltage
domain that controls the led controller voltage on-demand.

Signed-off-by: Jonas Remmert <j.remmert@phytec.de>
2023-06-19 09:17:52 +01:00
Jonas Remmert
99751b1d98 drivers: led: Add lp5569 led controller driver
Add a minimal driver for the ti lp5569 led controller. The driver supports
multiple instances. Commands on|off|set_brightness are supported.

Signed-off-by: Jonas Remmert <j.remmert@phytec.de>
2023-06-19 09:17:52 +01:00
Andrzej Kuros
a6615ac11f drivers: timer: add z_nrf_rtc_timer_exact_set
The function `z_nrf_rtc_timer_exact_set` is added to allow
setting compare channel without possible creeping of cc val.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-06-19 08:53:06 +02:00
Mykola Kvach
0ef6454c6f drivers: gpio_rcar: add memory mapping to driver
Add memory mapping to driver in order to use driver with platforms based
on Cortex A with enabled MMU.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
2023-06-19 08:39:14 +02:00
Florian Grandel
7571be3261 net: l2: ieee802154: deprecate NET_L2_IEEE802154_ACK_REPLY
Acknowledgment is mandatory if legitimately requested by the package's
"ACK requested" flag. The L2 layer will have to ensure that compliant
ACK packages will always be sent out automatically as required by the
standard.

For IEEE 802.15.4 compliance, the NET_L2_IEEE802154_ACK_REPLY option is
therefore being deprecated.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-17 16:20:21 -04:00
Florian Grandel
f96b620d12 net: l2: ieee802154: properly handle TX HW capabilities
The existing calls to ieee802154_radio_send() and soft MAC ACK handling
were inconsistent and/or not properly integrated with more recent
radio driver capabilities as CSMA/CA and ACK in hardware.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-17 16:20:21 -04:00
Florian Grandel
1ee4d3ed77 net: l2: ieee802154: document L1/L2 sep. of concerns
The method ieee802154_radio_handle_ack() does not belong to the
PHY/radio layer but to the L2 layer. It is a callback called from the
radio layer into the L2 layer and to be implemented by all L2 stacks.
This is the same pattern as is used for ieee802154_init(). The
'_radio_' infix in this function is therefore confusing and
conceptually wrong.

This change fixes the naming inconsistency and extensively documents
its rationale.

It is assumed that the change can be made without prior deprecation of the
existing method as in the rare cases where users have implemented custom
radio drivers these will break in obvious ways and can easily be fixed.

Nevertheless such a rename would not be justified on its own if it were
not for an important conceptual reason:

The renamed function represents a generic "inversion-of-control" pattern
which will become important in the TSCH context: It allows for clean
separation of concerns between the PHY/radio driver layer and the
MAC/L2 layer even in situations where the radio driver needs to be
involved for performance or deterministic timing reasons. This
"inversion-of-control" pattern can be applied to negotiate timing
sensitive reception and transmission windows, it let's the L2 layer
deterministically timestamp information elements just-in-time with
internal radio timer counter values, etc.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-17 16:20:21 -04:00
Sahaj Sarup
c7af24a065 drivers: i2c: target: Virtual EEPROM add ability to change i2c address
This patch adds the ability to change virtual i2c eeprom target address
at runtime using a single function.
Added CONFIG_I2C_EEPROM_TARGET_RUNTIME_ADDR as an optional Kconfig.

Signed-off-by: Sahaj Sarup <sahaj.sarup@linaro.org>
2023-06-17 08:02:29 -04:00
Piotr Wojnarowski
2f5ac45e53 dts: bindings: interrupt-controller: GIC: Allow specifying version in DT
Currently, only the presence of a GIC is reflected in the device tree,
and its version must be set separately in each SoC's Kconfig.
This patch adds separate bindings for each GIC version whose presence
in the device tree automatically enables the corresponding Kconfig symbol.

Signed-off-by: Piotr Wojnarowski <pwojnarowski@antmicro.com>
2023-06-17 08:01:46 -04:00
Daniel DeGrasse
6c10da7957 drivers: sensor: introduce driver for TCN75A temperature sensor
Add driver for TCN75A temperature sensor. The following features are
supported:
- TCN75A oneshot mode, which allows single shot conversions with lower
  power consumtion
- Resolution selection, up to 12 bit resolution (9 bit default)
- Triggering based on temperatue thresholds. If the TCN75A exits a set
  threshold range, the application can be notified via a callback.

Signed-off-by: Daniel DeGrasse <daniel@degrasse.com>
2023-06-17 08:01:16 -04:00
Lucas Tamborrino
97be30cccb drivers: uart: esp32s3: add async support
Add uart async api support for esp32s3.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-06-17 08:00:31 -04:00
Daniel DeGrasse
bd1cf25821 drivers: regulator: regulator_shell: add command to set DVS mode
Add command to set DVS mode, to aid in testing regulators that expose
this functionality. Since DVS modes are device specific, take an integer
as the mode identifier and pass it to the driver directly.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-06-17 07:59:26 -04:00
Manimaran A
0f6cb5edcd drivers: ps2: microchip: Low power and wakeup enabled
ps2 driver updated to support low power and wakeup.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-06-17 07:59:07 -04:00
Tomasz Bursztyka
d39645a206 drivers/pcie: Add capabilities output to shell module
This help to decipher PCIe capabilities supported by each listed device.
Shown only on a selected device and not on the general list.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-06-17 07:58:41 -04:00
Daniel Leung
26ecaba4af drivers: syscalls: use zephyr_syscall_header
This adds a few line use zephyr_syscall_header() to include
headers containing syscall function prototypes.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-06-17 07:57:45 -04:00
Daniel Leung
e488c9e42d entropy: use CONFIG_ENTROPY_GENERATOR to guard cmake include...
...instead of using CONFIG_ENTROPY_HAS_DRIVER. Since kconfigs
are guarded by CONFIG_ENTROPY_GENERATOR anyway, drivers are not
built unless CONFIG_ENTROPY_GENERATOR is also enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-06-17 07:57:45 -04:00
Daniel Leung
e7726bfc00 serial: use CONFIG_SERIAL to guard cmake include...
...instead of using CONFIG_SERIAL_HAS_DRIVER. Since kconfigs
are guarded by CONFIG_SERIAL anyway, drivers are not built
unless CONFIG_SERIAL is also enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-06-17 07:57:45 -04:00
Daniel Leung
19d5aa89d3 flash: use CONFIG_FLASH to guard cmake include...
...instead of using CONFIG_FLASH_HAS_DRIVER_ENABLED. Since
kconfigs are guarded by CONFIG_FLASH anyway, drivers are not
built unless CONFIG_FLASH is also enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-06-17 07:57:45 -04:00
Gerard Marull-Paretas
49c4973d8e drivers: i2c: cc32xx: enable I2C module clock
The I2C driver clock was initialized in board specific code, move it to
the driver as it is part of its responsabilities.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-17 07:55:43 -04:00
Gerard Marull-Paretas
ecc241e0ce drivers: serial: cc32xx: add support for pinctrl
Driver will configure pins using the pinctrl API now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-17 07:55:43 -04:00
Gerard Marull-Paretas
a3ab08b7ce drivers: i2c: cc32xx: add support for pinctrl
Driver will configure pins using the pinctrl API now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-17 07:55:43 -04:00
Gerard Marull-Paretas
c0bc9f974f drivers: pinctrl: add TI CC32XX driver
Add a new pinctrl driver for TI CC32XX SoC. The driver has not been
tested, just implemented following datasheet specs and checked that it
compiles. Consider this as a best-effort driver to remove custom pinmux
code in board files.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-06-17 07:55:43 -04:00
Nick Ward
f14d06f82e drivers: sensor: bmm150: use common conversion function
Better to reuse.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-06-17 07:52:09 -04:00
Nick Ward
bb87a875c2 drivers: sensor: adxl362: remove \n from logs
Tidy

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-06-17 07:52:09 -04:00
Jordan Montgomery
b1e9a813fe drivers: adc: adc-shell: Add support for ADS111x ADCs to adc-shell.c
The adc-shell uses a hardcoded list of defines to check whether it should
throw a compile-time error. The ADS1119 and ADS1112 driver both support
the APIs needed by the shell, so this commit enables support for them in
the hardcoded support list.

Signed-off-by: Jordan Montgomery <jordan.montgomery@getcruise.com>
2023-06-17 07:49:59 -04:00
Jordan Montgomery
a7014d01da drivers: adc: Add support for TI ADS1112 ADCs
This PR adds a custom driver for the ADS1112 ADCs. Unlike ADS1113/4/5
family served by the ADS1x1x driver, the ADS1112 does not use an address
pointer to address config registers. Instead, there is only one writable
register and all i2c writes will set it. The registers resemble the
ADS1119 device, but config bitmap is different, include a distinct data
rate table, gain table, and input multiplexing table. There is also not a
status register to be monitored with the ADS1112, as it uses config bit 7
for the same purpose instead of a separate register.

The driver was tested on hardware using the ADC shell interface. Manual
probing validated the voltages for the MUX_SINGLE configs at datarate 15
in CM_SINGLE. Higher gains were not tested and CM_CONTINUOUS is not
supported in this initial implementation.

The new driver has also been added to the existing ADC test using adc_emul
for completeness.

Origin: original
License: Apache 2.0
Purpose: Adding support for ADS1112 ADCs

Signed-off-by: Jordan Montgomery <jordan.montgomery@getcruise.com>
2023-06-17 07:49:59 -04:00
Eduardo Montoya
574a533cb6 net: openthread: allow to configure CSL debugging
Add new `IEEE802154_CSL_DEBUG` Kconfig option that, when enabled,
prevents the radio to sleep after a delayed reception is finished.

This allows to debug CSL timing issues due to accuracy drifts in
communications between receiver and transmitter.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2023-06-17 07:48:25 -04:00
Bjarki Arge Andreasen
22152915ab drivers/gsm_ppp: Update existing modules to use PPP L2
This commit replaces the workarounds spread around the
drivers and subsystems with the updated PPP L2
interface.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-06-17 07:46:21 -04:00
Jordan Yates
607efa8edd Bluetooth: hci: spi: don't block on IRQ line
Don't wait for the IRQ line to be de-asserted in `bt_spi_send`. As this
function can be called by the RX processing thread, the previous
behaviour could cause deadlocks under heavy load:
 * SPI RX thread starts blocking on `bt_buf_get_evt` due to load
 * BT controller generates another event, asserting the IRQ line
 * RX processing thread calls `bt_spi_send` in reponse to event
 * RX processing thread blocks forever on the removed condition

There is no need to attempt to rate-limit how often `bt_spi_send` is
called to allow the RX thread to run. If the bus is so congested that
there is no remaining capacity, prioritising RX over TX is not going to
improve the situation.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-06-17 07:37:59 -04:00
Florian Grandel
b224a099fd net: l2: ieee802154: standardize RSSI value
The RSSI value in net_pkt (net_pkt_cb_ieee802154.rssi) was used
inconsistently across drivers. Some drivers did cast a signed dBm value
directly to net_pkt's unsigned byte value. Others were assigning the
negative value of the signed dBm value and again others were offsetting
and stretching the signed dBm value linearly onto the full unsigned byte
range.

This change standardizes net_pkt's rssi attribute to represent RSSI on
the RX path as an unsigned integer ranging from 0 (–174 dBm) to 254 (80
dBm) and lets 255 represent an "unknown RSSI" (IEEE 802.15.4-2020,
section 6.16.2.8). On the TX path the rssi attribute will always be
zero. Out-of-range values will be truncated to max/min values.

The change also introduces conversion functions to and from signed dBm
values and introduces these consistently to all existing call sites. The
"unknown RSSI" value is represented as INT16_MIN in this case.

In some cases drivers had to be changed to calculate dBm values from
internal hardware specific representations.

The conversion functions are fully covered by unit tests.

Fixes: #58494

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-17 07:16:32 -04:00
Divin Raj
733a35864a drivers: ethernet: Fix typo in comment
Update typo in the code comments.

Signed-off-by: Divin Raj <divin.raj@arm.com>
2023-06-16 05:43:17 -04:00
Thomas Stranger
3822870d28 drivers: mdio: adin2111: correct prompt
The prompt is referring to another existing driver(NXP S32),
now the correct name is displayed.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-06-16 05:42:36 -04:00
Aedan Cullen
785d9bdc67 drivers: display: fix zero-buffers-in-SRAM case in DCNANO LCDIF
If CONFIG_MCUX_DCNANO_LCDIF_EXTERNAL_FB_MEM is not set and
CONFIG_MCUX_DCNANO_LCDIF_FB_NUM is zero, a division by zero occurs.
Use the same framebuffer size definition as in the external-framebuffer
case to resolve this.

Fixes #58908.

Signed-off-by: Aedan Cullen <aedan@aedancullen.com>
2023-06-15 10:10:03 -04:00
Thomas Stranger
c9f8b8b78a drivers: sensor: shtcx: fix val2 calculation
The calculation of the sensor val2 did not correctly take the sign into
account.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-06-15 08:47:30 -04:00
Peter McGaughey
3104ad0e39 drivers: serial: uart_sam0: fix uart_sam0_irq_update TXC reset
drivers: serial: uart_sam0: fix uart_sam0_irq_update TXC reset bug

uart_sam0_irq_update function resets flags that will cause int. re-entry
existing implementation also clears the TXC flag if it is set
this breaks transmit complete detection

Per the SAMD5x/E5x Datasheet Sect. 34.8.6, writing '1' to the TXC will
clear the flag and disable TX complete interrupts, this should be
preserved through the irq_update for use in the tx_complete check function

The proper fix will cache the TXC value before conditionally clearing the
flag based on that cached value. If you do not condition this on the
cached value a race condition will periodically occur where
the TXC is cleared but never cached.

Fixes zephyrproject-rtos#55386

Signed-off-by: Peter McGaughey <peter.mcgaughey@daikincomfort.com>
2023-06-13 15:09:28 -04:00
Siyuan Cheng
24efa6720d drivers: pinctrl_emsdp: fix definition location
Mux Control Register Index are internals of driver, now
moved from dt-binding header to driver itself.

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-06-13 07:02:08 -04:00
Siyuan Cheng
1a6b6e7b84 drivers: pinctrl_emsdp: add dummy mux for unmuxed peripheral
ARC EMSDP board has some peripherals are internal connected,
such as DW spi1 and DFSS i2c0. They are unmuxed and have fix
connection to spi-flash or sensor. For these peripheral, add
dummy mux type to avoid pinctrl ENOENT error.

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-06-13 07:02:08 -04:00
Daniel Leung
d88840a8aa Revert "drivers: serial: ns16550: Add support for Async APIs"
This reverts commit 2d03aaf99f.

The async API for NS16550 is incomplete. We are near the next
release so it is better to revert it for now, and a proper
correct implementation can be done before next-next release.

Relates to #57103

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-06-13 06:59:33 -04:00
Bjarki Arge Andreasen
7c339e91a1 drivers/clock_control: SAM PMC missing soc.h
The source clock_control_sam_pmc.c can not build without the
symbol SOC_ATMEL_SAM_MCK_FREQ_HZ which is contained in soc.h

This bug only shows itself if CONFIG_ARM_MPU is not enabled,
which probably includes soc.h through the <zephyr/arch/cpu.h>
which is not desired behavior.

This commit adds the missing header, making the source build
regardless of CONFIG_ARM_MPU.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-06-13 06:57:33 -04:00
Daniel DeGrasse
aefecf1a40 drivers: pwm: pwm_mcux: improve resolution by writing match register
Write PWM match registers directly instead of using the frequency and
duty cycle fields of the MCUX HAL driver. This allows the driver to take
full advantage of the resolution supported by the FlexPWM when setting
duty cycle and carrier frequency.

Fixes #59080

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-06-13 06:56:53 -04:00
Henrik Brix Andersen
5e9de122c5 drivers: gpio: pca95xx: check gpio_add_callback() return value
Check the return value from gpio_add_callback() and fail driver
initialization if non-zero.

Fixes: #58584

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-06-13 06:56:24 -04:00
Declan Snyder
bdaa870e59 drivers: uart_mcux_flexcomm: Unlock IRQ if error
Currently the flexcomm uart driver will not unlock IRQ
if there is an error, which might cause some problems, fix this.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-06-12 14:03:43 -04:00
Henrik Brix Andersen
c05d629841 drivers: can: mcan: remove excessive debug on register access
Remove excessive debug output on Bosch M_CAN register access. This was
accidentially included in commit bbfc1f905c.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-06-12 07:28:57 -04:00
Benjamin Cabé
7ebe4889f3 drivers: auxdisplay: Fix rows/columns inversion
JHD1313 is 16 columns x 2 rows.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-06-09 13:23:36 -04:00
Benjamin Cabé
0445c7e7d5 drivers: auxdisplay: Set background to white
Fixed inconsistency between code & comments and actually set
background to black

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-06-09 13:23:36 -04:00
Benjamin Cabé
3b181641d2 drivers: auxdisplay: Fix text direction handling
Fixed Input Set handling.
Flag had misleading names: whether "entry" happens to the left or to the
right is dependent on whether increment mode is active or not), so
switched to just using a "SHIFT" y/n flag instead. It also reflects better
the contents of the datasheet).
Updated romance text direction accordingly ("increment, no shift").

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-06-09 13:23:36 -04:00
Benjamin Cabé
f307e200c2 drivers: auxdisplay: Fix jhd1313 compilation issues
Added several missing undeclared config variables causing the driver to
not compile properly.
Fixes #59078.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-06-09 13:23:36 -04:00
Carlo Caione
edd3437826 riscv: Rename Kconfig symbol to *_PRIVILEGED
Rename SOC_FAMILY_RISCV_PRIVILEGE to SOC_FAMILY_RISCV_PRIVILEGED because
the spec is "privileged".

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-06-09 11:46:29 -04:00
Mahesh Mahadevan
e94b6f901b drivers: usb_mcux: Fix disable and reset functions
1. Fix the reset function to reset correctly.
2. Ensure the controller handle is initialized before
   calling the SDK functions.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-06-09 11:45:55 -04:00
Tomasz Moń
3b14268e41 drivers: usb_dc_native_posix: Check data length before copy
Fail requests if the data does not fit inside buffer.

This commit only adds missing sanity checks but the native posix driver
remains broken at the design level. The amount of work to fix the native
posix driver in legacy USB stack is deemed too great to be worth it.

Coverity-CID: 195841, GitHub issue #58564
Coverity-CID: 240244, GitHub issue #58570

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-06-09 11:45:16 -04:00
Jacob Siverskog
9a26ab44fb drivers: dma_mcux_lpc: Fix potential NULL pointer dereferences
Dereference variables after NULL checking.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2023-06-07 13:38:19 -04:00
Daniel DeGrasse
402d4eb0da drivers: regulator: pca9420: fix support for DVS modes
Fix support for DVS modes, as the dvs_state_set implementation
previously had the mask and value parameters in the
i2c_reg_update_byte_dt function swapped.

Also, record the active DVS state and update the voltage get/set and
regulator enable/disable function to target the active DVS mode. This
will enable a user to configure multiple run modes, and modify target
voltages for those modes when in the new mode. When a user is utilizing
the MODESEL pins, update the active state but return an error so that
the application can still edit settings for the new DVS mode once it has
reconfigured the appropriate pins.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-06-07 05:48:11 -04:00
ferar alashkar
7920c6a8f4 drivers: intc: stm32: clarify controlling expression
add explicit boolean type to 'if' statement controlling expression,
consolidating it with 'stm32_exti_is_pending' function return type, thus
improving code readability and maintainability, complying with required
[misra-c2012-14.4] rule which states; The controlling expression of an
if statement and the controlling expression of an iteration-statement
shall have essentially boolean type.

Found as a coding guideline violation (Rule 14.4) by static code
scanning tool.

Note: Tested on STM32L5 Nucleo-144 board (stm32l552xx).

Signed-off-by: ferar alashkar <ferar.alashkar@gmail.com>
2023-06-07 04:40:17 -04:00
ferar alashkar
b6d8989236 drivers: intc: stm32: add break to switch-clause
add an unconditional break to switch-clause's default case, complying
with required [misra-c2012-16.3] rule which states; An unconditional
break statement terminate every switch-clause.

Found as a coding guideline violation (Rule 16.3) by static code
scanning tool.

Note: Tested on STM32L5 Nucleo-144 board (stm32l552xx).

Signed-off-by: ferar alashkar <ferar.alashkar@gmail.com>
2023-06-06 09:41:52 -04:00
ferar alashkar
9d9386307a drivers: intc: stm32: use BIT macro with type cast argument
1. use 'BIT' macro instead of explicit left shift operations, since
'BIT' macro implicitly adds unsigned type suffix, avoiding possible
[shiftTooManyBitsSigned] scenarios, and

2. add an explicit uint32_t cast to 'BIT' macro argument, complying with
required [misra-c2012-10.1] rule which states; operands shall not be of
an inappropriate essential type.

Found as a coding guideline violation (Rule 10.1) by static code
scanning tool.

Note: Tested on STM32L5 Nucleo-144 board (stm32l552xx).

Signed-off-by: ferar alashkar <ferar.alashkar@gmail.com>
2023-06-06 09:41:31 -04:00
Erwan Gouriou
290777b2b5 drivers: interrupt_controller: Use macros to access line_range prop values
Compiling previous code using LLVM reveals that accessing line_range
values in runtime is not clean, as the following error is generated:
"error: initializer element is not a compile-time constant"

Replace runtime method by compile time using UTIL_INC and UTIL_x2
macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-06-06 06:52:42 -04:00
Caspar Friedrich
24622f36c8 drivers: gpio: fxl6408: Fix Kconfig dependency for log level config
This makes Kconfig logging options for this driver depending on whether
the driver is enabled or not.

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2023-06-06 06:51:48 -04:00
Andrzej Głąbek
5a57fa2c79 drivers: uart_nrfx_uart: Request next buffer only when needed
Recent refactoring of the uart_async_api test (see commit
eb44414af9) revealed an issue
in the uart_nrfx_uart driver that it requested the next RX
buffer even if one was already set up (such request was just
ignored in the previous form of the test, so the problem did
not come out so far).
This patch prevents such incorrect requests from appearing.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-06-06 09:34:29 +02:00
ferar alashkar
42d7d114ae drivers: intc: stm32: clarify controlling expression
add explicit boolean type to 'if' statement controlling expression,
consolidating it with 'stm32_exti_callback_t' (function pointer), thus
improving code readability and maintainability, complying with required
[misra-c2012-14.4] rule which states; The controlling expression of an
if statement and the controlling expression of an iteration-statement
shall have essentially Boolean type.

Found as a coding guideline violation (Rule 14.4) by static code
scanning tool.

Note: Tested on STM32L5 Nucleo-144 board (stm32l552xx).

Signed-off-by: ferar alashkar <ferar.alashkar@gmail.com>
2023-06-05 13:55:10 -04:00
ferar alashkar
23cb9c0be8 drivers: intc: stm32: correct for counter type
change for loop iterator/counter type to unsigned int, thus matching
that of struct stm32_exti_range's len member var, complying with
required [misra-c2012-10.4] rule which states; Both operands of an
operator in which the usual arithmetic conversions are performed shall
have the same essential type category.

Found as a coding guideline violation (Rule 10.4) by static code
scanning tool.

Note: Tested on STM32L5 Nucleo-144 board (stm32l552xx).

Signed-off-by: ferar alashkar <ferar.alashkar@gmail.com>
2023-06-05 13:52:43 -04:00
ferar alashkar
e99becd2b7 drivers: intc: stm32: explicitly set operator precedence
add enclosing parentheses enforcing and clarifying precedence of
operators, thus improving code readability and maintainability,
complying with *advisory* [misra-c2012-12.1] rule which states; The
precedence of operators within expressions should be made explicit.

Found as a coding guideline recommendation (Rule 12.1) by static code
scanning tool.

Note: Tested on STM32L5 Nucleo-144 board (stm32l552xx).

Signed-off-by: ferar alashkar <ferar.alashkar@gmail.com>
2023-06-05 10:49:51 -04:00
Guillaume Gautier
c73c7d5728 drivers: spi: stm32h7: add a small delay after enabling
Add a small delay after enabling SPI to prevent transfer stalling.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-06-05 10:48:59 -04:00
TOKITA Hiroshi
c7cdd84688 drivers: clock_control: gd32: Refer to the CPU Frequency from the DTS
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC is not always the same as CPU frequency.
Referring to the `/cpus/cpu@0,clock-frequency` in DTS to determine
the CPU frequency.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-06-05 07:08:02 -04:00
Alvaro Garcia
4d854a562c drivers: fixed div by zero when reading max17048
Avoid divsion by zero when current rate is zero

Signed-off-by: Alvaro Garcia <maxpowel@gmail.com>
2023-06-02 18:51:25 -04:00
Declan Snyder
0a6c072b77 drivers: usb_dc_mcux: Debug log needs more stack
Increase the size of the MCUX USB driver thread stack if using
the CONFIG_USB_DEVICE_LOG_LEVEL_DBG Kconfig, to avoid stack overflow
caused by many stack frames coming from the debug logs.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-06-02 18:46:39 -04:00
Henrik Brix Andersen
bb513c974b drivers: can: mcan: fix IRQ acknowledge
Change the Bosch M_CAN ISRs to only acknowledge the IRQs handled in the
given loop iteration (and not all IRQs supported by the given ISR) and move
IRQ acknowledge to the front of the ISRs.

Fixes: #58631

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-06-02 15:06:40 -04:00
Henrik Brix Andersen
defdbc2fae drivers: can: mcp2515: increase default stack size
Increase the default stack size for the MCP2515 CAN controller driver from
512 to 1024 bytes.

Fixes: #58761

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-06-02 09:43:16 +02:00
Henrik Brix Andersen
bab0c0879d drivers: can: mcp2515: set thread name
Set the thread name for the MCP2515 CAN controller driver to aid in
debugging.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-06-02 09:43:16 +02:00
Henrik Brix Andersen
b12eb78f35 drivers: can: increase default initialization priority from 50 to 80
Increase the default CAN controller driver initialization priority from
KERNEL_INIT_PRIORITY_DEVICE (50) to 80 to allow CAN controllers on SPI
busses have their bus initialized prior to initializing the CAN controller
driver.

The only in-bound dependency on CAN controller drivers - apart from
application level code - is the drivers/net/canbus.c driver, which already
defaults to an initialization level of 81.

Fixes: #55745

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-06-01 19:03:12 -04:00
Andrei Emeltchenko
cd2fe8c186 doc: smbus: Correct syntax in sources and headers
Correct syntax in SMBus sources and headers used to generate the SMBus
documentation.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-06-01 18:04:58 -04:00
Henrik Brix Andersen
c9f97cf386 drivers: can: mcan: move header file to public includes
Move the Bosch M_CAN header file to include/zephyr/drivers/can/can_mcan.h
for use in out-of-tree drivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-06-01 18:04:42 -04:00
Henrik Brix Andersen
3932b9f124 drivers: can: mcan: document remaining header
Add documentation for the remaining functions, structs, and definitions in
the Bosch M_CAN header file. Fix a few mistyped Message RAM field names
along with misnamed macros and function found while adding documentation.

No functional changes.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-06-01 18:04:42 -04:00
Alberto Escolar Piedras
294ccc1cb8 drivers: uart_native_posix: Check return values of system calls
Let's check the return values of all system calls
to ensure they do not error, or handle it gracefully
if they do.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-06-01 18:04:25 -04:00
Gerson Fernando Budke
612d5b3796 drivers: ieee802154: rf2xx: Check gpio_add_callback return
The rf2xx does not check the return value from gpio_add_callback
function, which can prevent it from detecting unexpected states and
conditions. This add error processing check and log.

Fixes: #58595

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-06-01 18:04:08 -04:00
Nick Ward
fe2de0a8c0 drivers: sensor: mcp970x: fix temperature conversion
Fractional part of the conversion was a thousandth of
what it should have been.

Also removes LOG_ERR use which causes excessive output
when logging enabled and using the sensor shell.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-06-01 13:44:28 -04:00
Declan Snyder
0daad872fd drivers: dma_mcux_lpc: Replace sem with spinlock
Replace the otrig configuration semaphore with a spinlock.

This will allow the dma_config function to be called from an ISR
and it will no longer shift the burden of waiting to be able to configure
the dma otrigs to the caller of the function, since the driver
will just spin on the lock until it can configure them, instead of
returning an error.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-06-01 13:43:56 -04:00
Nick Ward
941e4f000b drivers: modem: modem_receiver: fix wake PM
mdm_receiver_wake() needs to PM resume.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-06-01 10:04:14 -04:00
Fabio Baltieri
cda5b175fa input: check for gpio_add_callback error codes.
Add two error code check for gpio_add_callback functions to avoid
triggering a coverity warning.

Drop a redundant initialization in the process.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-06-01 06:33:27 -04:00
Nicolas Pitre
df6084fec1 riscv_machine_timer: remove unused config option
This should have been removed in commit 11a2107d99 ("riscv: timer:
driver revamp").

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-06-01 04:53:19 -04:00
Robert Lubos
f3bdac91b2 net: ieee802154: Remove IEEE802154_2015 option usage
The IEEE802154_2015 option is misleading, as it does not introduce full
802.15.4-2015 standard compliance but only random bits, plus it's
defined at the radio driver level, which brings yet another confusion.
Because of that, the option will be deprecated, and respective parts of
code that made use of it converted to use more specific configurations:

* nRF driver will now use CONFIG_NRF_802154_ENCRYPTION to specify
  whether to compile in TX security
* net_pkt will only add extra 802.15.4 control block fields if
  OpenThread is used, as they were solely used by this L2
* OpenThread radio layer will now use the OpenThread version to
  determine whether to compile in TX security.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-06-01 04:53:02 -04:00
Patryk Duda
6fc58718bd interrupt_controller: Fix clang compilation issues in intc_exti_stm32.c
Clang reports 'initializer element is not a compile-time constant' when
trying to initialize structure with elements of constant array. The
compiler is wrong in this case because the elements of the array are
known at compile time, so there are no obstacles to initialize structure
using it.

The problem was fixed by removing 'range' array and using
DT_PROP_BY_IDX() to get values directly from DT.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-05-31 14:41:25 -04:00
Patryk Duda
5cb40310f4 drivers: entropy: Make entropy_stm32.c clang compatible
Clang doesn't support push_options, pop_options and optimize pragmas.
Since "Ofast" is only applied to rng_pool_get() we can use function
attributes instead of pragmas.

Please note that clang doesn't support applying optimizations to
functions.

This change was verified by comparing assembler output.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-05-31 14:41:25 -04:00
Patryk Duda
c0e1c5e09b drivers: dma: Remove double parentheses in if statements
This patch fixes following compilation error when compiling using clang

drivers/dma/dma_stm32.c:364:42: error: equality comparison with
extraneous parentheses [-Werror,-Wparentheses-equality]
        if ((config->head_block->source_address == 0)) {
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
drivers/dma/dma_stm32.c:364:42: note: remove extraneous parentheses
around the comparison to silence this warning
        if ((config->head_block->source_address == 0)) {
            ~                                   ^   ~

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-05-31 14:41:25 -04:00
Henrik Brix Andersen
17f0356c36 drivers: can: mcan: change asserts to match updated timing parameters
Update the asserts to match the updated Bosch M_CAN minimum/maximum CAN
timing parameters.

Fixes: #58429

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-31 06:16:00 -04:00
Henrik Brix Andersen
fd6ba71076 drivers: can: stm32fd: use bosch m_can timing parameter initializers
The minimum/maximum CAN timing parameters for the STM32 FDCAN driver uses
the wrong values for the minimum, nominal phase segment values.

Using the static initializers fixes these and aligns them to the Bosch
M_CAN manual. The STM32G4 reference manual contains contradicting limits
for these register values.

Fixes: #58429

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-31 06:16:00 -04:00
Henrik Brix Andersen
52a8f821fa drivers: can: stm32h7: use bosch m_can timing parameter initializers
The minimum/maximum CAN timing parameters for the STM32H7 FDCAN driver uses
the wrong values for the minimum, nominal phase segment values.

Using the static initializers fixes these and aligns them to the Bosch
M_CAN manual. The STM32H7 reference manual contains contradicting limits
for these register values.

Fixes: #58429

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-31 06:16:00 -04:00
Henrik Brix Andersen
56b90e3f63 drivers: can: sam0: use bosch m_can timing parameter initializers
The minimum/maximum CAN timing parameters for the Atmel SAM0 CAN driver
uses the wrong values for the minimum, nominal phase segment values. The
same goes for the maximum, nominal SJW value.

Using the static initializers fixes these and aligns them to the Bosch
M_CAN manual. The Atmel SAM C20/C21 family data sheet contains
contradicting limits for these register values.

Fixes: #58429

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-31 06:16:00 -04:00
Henrik Brix Andersen
6d2a42c21e drivers: can: sam: use bosch m_can timing parameter initializers
The minimum/maximum CAN timing parameters for the Atmel SAM CAN driver uses
the wrong values for the minimum, nominal phase segment values. The same
goes for the maximum, nominal SJW value.

Using the static initializers fixes these and aligns them to both the Bosch
M_CAN manual and the Atmel SAM E70 family data sheet.

Fixes: #58429

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-31 06:16:00 -04:00
Henrik Brix Andersen
1871fa7823 drivers: can: mcux: mcan: use bosch m_can timing parameter initializers
Some NXP SoC reference manuals contain a bug regarding the minimum values
for nominal phase segments. Valid Bosch M_CAN nominal phase segment
register values are 1 and up. Same goes for the maximum value for data
phase segment 2. Here, valid Bosch M_CAN register values are 0 to 31.

Using the static initializers fixes these.

Fixes: #58429

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-31 06:16:00 -04:00
Henrik Brix Andersen
6b13900618 drivers: can: mcan: add static initializer macros for timing parameters
Add static initializers for the Bosch M_CAN minimum/maximum CAN timing
parameter values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-31 06:16:00 -04:00
Daniel DeGrasse
19829ace7d drivers: usb: usb_dc_kinetis: reconfigure USB endpoint 0 after reset
Per Kinetis USB reference manual, when USB reset interrupt is asserted,
the driver should configure and enable the default USB control endpoint
0. Generally, when the reset interrupt is asserted, endpoint 0 is
already configured so the driver only needs to reenable it.

However, when usb_dc_detach is called and the module is reset, all endpoint
configuration will be reset. Thus, we need to manually configure USB
endpoint 0 when a USB reset interrupt is received, or the USB driver
will not function correctly after usb_dc_detach has been called.

Additionally, do not zero out all BDT entries in the usb_dc_reset
function. BDT entries are zeroed when an endpoint is configured, and
clearing BDT buffer pointers during device reset will cause a memory
leak.

Fixes #58407

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-05-31 10:25:36 +01:00
Francois Gervais
5962830969 drivers: led_strip: apa102: add multi instances support
This allows for multiple apa102 strips on multiple spi ports.

For example:

```
&spi1 {
	led_strip_0: apa102@0 {
		compatible = "apa,apa102";
		reg = <0>;
		spi-max-frequency = <5250000>;
	};
};
&spi2 {
	led_strip_1: apa102@0 {
		compatible = "apa,apa102";
		reg = <0>;
		spi-max-frequency = <5250000>;
	};
};
```

Signed-off-by: Francois Gervais <francoisgervais@gmail.com>
2023-05-31 10:23:22 +01:00
Ryan McClelland
77fb2025a8 drivers: adc: ads1x1x: fix pga enum comment
The pga enum internal reference voltage and gain values
were fixed in the code, but a comment was forgotten to be
updated. Correct the comment to match how the code uses
the enum.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-05-31 10:35:53 +02:00
Tomasz Leman
9515a5228b drivers: hda: power management changes
This patch ensures that the power domain to which the current HD DMA
instance belongs is power-up first.

In addition, it initializes the channels when coming out of SUSPEND
state, so this operation will be performed also when the stream is
started after the DSP comes out of D3 state.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-05-30 20:24:30 -04:00
Francois Ramu
d69f7636e3 drivers: serial: stm32 uart driver asserts when baudRate >=16
Change the assertion when evaluating the baudrate to trig if
result is greater or equal to 16.
This will also match the comment : checking BRR.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-05-30 13:16:05 -04:00
Kornel Dulęba
057888836e drivers: sensors: npcx_tach: Clear stale data
The tachometer collects the data continuously setting a "data ready" bit
when it's ready. The availability bit has to be cleared before the
register is updated.
The driver also supports underflow detection, when the bit indicating it
is set the reading of "0" is returned.
The problem here is that there is that once the underflow bit is cleared
we might end up reading stale data.
To prevent that clear the "data ready" bit when underflow is detected

Signed-off-by: Kornel Dulęba <mindal@semihalf.com>
2023-05-30 13:04:28 -04:00
Declan Snyder
86fcc5de97 drivers: dma_mcux_lpc: Fix OTRIG build error
Fix the OTRIG related build error in the DMA LPC
by defaulting num_of_otrigs to 0 if a plarform using
the LPC DMA does not specify this property in devicetree.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-30 11:07:02 -04:00
Kai Vehmanen
aa5b66be5f intel_adsp: cavs25: configure access to ALH
For Intel cavs2.5, access from LPGPDMAC to Audio Link Hub
RX/TX registers needs to be explicitly enabled before use.

The logic follow hardware initialization done in
SOF project sof/src/platform/intel/cavs/platform.c

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-05-30 10:50:02 -04:00
Siyuan Cheng
d2e91c6b8f drivers: spi: fix spi_dw interrupt mask
Found EMSDP board SPI-FLASH sample broke after adding DFSS
into spi_dw. Found wrong interrput mask resulting in false
interrupt enabled. Now fixed it to fit both DFSS and DW.

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-05-30 10:49:47 -04:00
Xudong Zheng
147d4067e6 drivers: serial: rpi_pico: add support for hardware flow control
Flow control will be enabled for UART if hw-flow-control is set.

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2023-05-30 09:00:09 -04:00
Andrzej Głąbek
b6f266a500 drivers: sensor: qdec_nrfx: Add missing REPORTRDY interrupt activation
This is a follow-up to commit 09fa46ee4e.

Before nrfx 3.0, the QDEC interrupt on REPORTRDY event was activated
implicitly when a `reportper` value other than `DISABLED` was used.
Now, the `reportper_inten` field needs to be used to activate this
interrupt.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-05-30 14:01:04 +02:00
Henrik Brix Andersen
5f67426b93 drivers: can: mcan: do not iterate all filter elements to find free one
There is no need for iterating all the Bosch M_CAN filter elements in
Message RAM in order to find a free filter as the driver already keeps
track of assigned filters.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-29 14:34:19 -04:00
Henrik Brix Andersen
0f36f1a3ee drivers: can: mcan: use per-instance message RAM configuration
Restructure the Bosch M_CAN driver backend to use per-instance Message RAM
configuration.

This removes the need for a common, artificial "can" devicetree node for
SoCs with multiple Bosch M_CAN-based CAN controllers and allows for
per-instance configuration of the number of e.g. standard (11-bit) and
extended (29-bit) filter elements.

As part of the restructure, software handling of CAN filter flags was moved
from per-flags bitfields to per-filter bitfields, solving an issue when
using more than 32 standard (11-bit) filter elements or more than 16
extended (29-bit) filter elements.

Fixes: #42030, #53417

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-29 14:34:19 -04:00
Henrik Brix Andersen
d112e08f0c drivers: can: mcan: remove unused message marker split
The Bosch M_CAN Message Marker, an 8-bit field copied from Tx Buffer
elements to Tx Event FIFO elements to aid software in identifying Tx frame
status, need not be split into an index and a count, as the count is
unused.

Remove this split and replace "struct can_mcan_mm" with a simple "uint8_t".

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-29 14:34:19 -04:00
Henrik Brix Andersen
d452a0043d drivers: can: mcan: add build asserts for message RAM configuration
Add build asserts to ensure the Message RAM configuration meets the
IP core restrictions.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-29 14:34:19 -04:00
Henrik Brix Andersen
de659f9f61 drivers: can: stm32: fdcan: message RAM layout is fixed
The Message RAM layout used by the STM32 FDCAN IPs contains a fixed number
of elements, even though the software can opt to use less standard/extended
filter elements. Change the BUILD_ASSERT() statements to reflect this.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-29 14:34:19 -04:00
Henrik Brix Andersen
3ed354eea1 drivers: can: mcan: let front-end drivers supply message RAM functions
Let the Bosch M_CAN front-end drivers supply their own Message RAM
read/write/clear functions.

This is preparation for supporting per-instance Bosch M_CAN Message RAM
layouts and for accessing Bosch M_CAN IP cores over peripheral busses.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-29 14:34:19 -04:00
Henrik Brix Andersen
6cd67e67fe dts: bindings: can: mcan: switch to using bosch,mram-cfg property
Switch the Bosch M_CAN devicetree binding to use a bosch,mram-cfg property
for specifying the memory layout of the Bosch M_CAN Message RAM. This is
identical to the Linux kernel devicetree binding for Bosch M_CAN IP core
based CAN controllers.

This introduces an offset cell which can be used for controllers with
shared Message RAM between Bosch M_CAN instances.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-29 14:34:19 -04:00
Henrik Brix Andersen
c52499e447 drivers: can: mcan: document return values from typedef API functions
Document that the Bosch M_CAN read/write register functions are allowed to
return -ENOTSUP for unsupported registers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-29 14:34:19 -04:00
Henrik Brix Andersen
78f956f308 drivers: can: mcan: reindent register definitions
Reindent the Bosch M_CAN register definitions.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-29 14:34:19 -04:00
Siyuan Cheng
4babd545cc drivers: pinctrl: add pinctrl driver for ARC emsdp
Add Synopsys ARC EMSDP board Pin controller for its Pmod
and Arduino shield interface.

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-05-29 09:21:07 -04:00
Nick Ward
8b9204035a drivers: clock control litex: fix spelling of below
Fix spelling of below

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-05-29 05:21:10 -04:00
Henrik Brix Andersen
183e0f854b drivers: can: sam0: remove unused variable
Remove unused variable (only ever assigned) from the Atmel SAM0 CAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-05-28 14:20:21 -04:00
Vincent Geneves
06e4ba88b4 drivers: gpio: pca95xx: add latch for interrupt pins
Basically, once a pin is configured for interrupt, we enable the latch
on it, in order not to miss short pulses.
The bottom half of the interrupt then reads the input port twice, to
read the latch and then read the potentially new state of the pins, to
compute the posedge, negedge, and level callbacks accordingly.

Signed-off-by: Vincent Geneves <vgeneves@kalray.eu>
2023-05-28 04:05:31 -04:00
Vincent Geneves
6612f1e4d5 drivers: gpio: pca95xx: Reduce data transfer over I2C
When accessing GPIO by pin, access only the required port register
(instead of systematically accessing both PORT0 and PORT1).

Signed-off-by: Vincent Geneves <vgeneves@kalray.eu>
2023-05-28 04:05:31 -04:00
Andrei Hutanu
27ad7111cd drivers: modem: quectel-bg9x: fix reset BG95 mdm
In case of BG95 where there is no reset pin, reseting the board
which uses a BG95 modem could result in powering-off the modem
(as oposed to "reset" the modem). This commit is an attempt
to handle this case and re-power the modem.

Signed-off-by: Andrei Hutanu <andrei.hutanu.i@gmail.com>
2023-05-27 06:28:33 -04:00
Andrei Hutanu
3cf92bce11 drivers: modem: quectel-bg9x: mdm unsol ready
Using bg9x driver with bg95 specifically has the issue that BG95
modem replies with "RDY" when it's not fully initialized and AT
commands sent to the modem after this point would result in modem
reply of "ERROR". This commit adds a new prj.conf field in the build
configuration for custom unsolicited app ready string, with
the default being BG96 one ("RDY").

Signed-off-by: Andrei Hutanu <andrei.hutanu.i@gmail.com>
2023-05-27 06:28:33 -04:00
Andrei Hutanu
cf3df2b840 drivers: modem: quectel-bg9x: fix for bg95 pinout
The BG95 pin configuration does not internally ever use the reset pin.
Because of this, there is no need to make reset pin mandatory.
Commit removes reset pin dependency [e.g. in case of BG95].

Signed-off-by: Andrei Hutanu <andrei.hutanu.i@gmail.com>
2023-05-27 06:28:33 -04:00
Benjamin Björnsson
bd7929ce1a drivers: dma: dma_stm32: add stm32c0-series support
Add support for dma on the stm32c0-series.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-05-27 06:21:39 -04:00
Nick Ward
65bbca4a07 drivers: sensor: vl53l0x: small fixes
Remove redundant casts.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-05-27 06:19:29 -04:00
Nick Ward
7f01f65cd5 drivers: sensor: vl53l0x: add PM
Add power management code utilising XSHUT pin.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-05-27 06:19:29 -04:00
Nick Ward
af4363bc47 drivers: sensor: vl53l0x: use datasheet specified fw boot time
Improve boot time.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-05-27 06:19:29 -04:00
Nick Ward
c5f725e672 drivers: sensor: vl53l0x: fix XSHUT pin as active low
Also utilises gpio_pin_configure_dt() API to configure and set pin
state at the same time.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-05-27 06:19:29 -04:00
Benedikt Schmidt
4540c833a8 drivers: adc: Implement the current sources of ADS114S08
Implement support for the current sources of ADS114S08.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-05-27 05:33:52 -04:00
Benedikt Schmidt
bb679532f4 dts: bindings: adc: Add configurable current source pin for ADCs
Add a property to the ADC channels which allows the configuration
of the current source pin.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-05-27 05:33:52 -04:00
Tristan Honscheid
dc9bd3afe3 sensors: Create sensor trig subcommand
This PR relocates the sensor trigger sample application from the
`sensor_shell` sample to a subcommand in the actual sensor shell. The
subcommand has a UI for enabling a given trigger on a given sensor.
A built-in handler for the data_ready trigger is included that prints
the latest data to the log. Currently, only `SENSOR_TRIG_DATA_READY` is
supported but the groundwork is there to add others. Tested on a
`tdk_robokit1` board.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-05-27 05:33:11 -04:00
Robert Hancock
fc73d6a7b9 drivers: gpio: xlnx: run clang-format
Clean up whitespace etc. using clang-format after previous changes. No
functional changes intended.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2023-05-26 21:32:23 -04:00
Robert Hancock
ca3a3c1783 drivers: gpio: xlnx: Add interrupt support
Added support for interrupt-driven GPIO for this driver if an interrupt
line is defined. Note that interrupt support is optional in the GPIO
core so it may or may not be present.

The core provides a single state change notification whenever any line
changes state on a given bank, so we need to check the states of the
lines ourselves to determine what has actually changed.

Also, the driver treats the first and second GPIO banks as mostly
separate devices, but a single interrupt is shared by both banks, so the
ISR ends up being registered by the first bank which also triggers
handling on the second bank if required.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2023-05-26 21:32:23 -04:00
Robert Hancock
1f59cd26be drivers: gpio: xlnx: Fix property reading for second channel
The properties being read for the all-inputs and all-outputs flags in
the driver for the second GPIO channel did not match the ones listed in
the DT schema or the existing device tree files. Fix this.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2023-05-26 21:32:23 -04:00
Emilio Benavente
73b1705eb7 drivers: dma: dma_mcux_lpc: Adjusted dma driver for channel chaining.
Added to the configuration function to enable
channel chaining for the DMA_LPC that utilizes
the total of the SOC OTrig channels.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2023-05-26 17:22:43 -05:00
Mahesh Mahadevan
d5775ea7ba drivers: usb_dc_mcux: Use CONFIG_USB_DC_NXP_LPCIP3511 define
Use CONFIG_USB_DC_NXP_LPCIP3511 instead of FSL_FEATURE_USB_USB_RAM
as the behaviour variation is based on the SDK driver used and not
if the SoC has a dedicated USB SRAM.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 17:53:37 -04:00
Mahesh Mahadevan
f05bbd09be drivers: usb_dc_mcux: Add Pinctrl defines
Add Pinctrl code

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 17:53:37 -04:00
Mahesh Mahadevan
ec5d3b7bff drivers: nxp_usb: Enable USB_DC_HAS_HS_SUPPORT conditionally
Conditionally enable the USB_DC_HAS_HS_SUPPORT as the
USB_DC_NXP_LPCIP3511 controller can have both HS and FS only.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 17:53:37 -04:00
Jamie McCrae
212a4857ba drivers: auxdisplay: Add Hitachi HD44780 driver
Adds an auxiliary display driver for Hitachi HD44780-based (and
compatible) LCD displays.

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2023-05-26 23:05:58 +02:00
Jamie McCrae
71c727e92e drivers: auxdisplay: Port Jinghua Display JHD1313 driver
Ports the Jinghua Display JHD1313 LCD (with RGB backlight) driver
to use the new auxdisplay driver interface. This driver is used on
the seeed grove LCD RGB display, and replaces it.

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2023-05-26 23:05:58 +02:00
Jamie McCrae
7d1c79aa8c drivers: auxdisplay: Add noritake itron VFD auxiliary display
Adds the driver for a Noritake Itron VFD auxiliary display.

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2023-05-26 23:05:58 +02:00
Jamie McCrae
bdf2e56ce1 drivers: Add auxdisplay (text) interface
Adds the base driver include file and base auxiliary display
dts file.

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2023-05-26 23:05:58 +02:00
Sigvart Hovland
95f82c60e5 clock_control: clock_control_nrf.c: Add size_t to casts from void *
If you compile this code with Clang it will complain about casting a larger
type into a smaller enum.

```C
zephyr/drivers/clock_control/clock_control_nrf.c:120:37:
warning: cast to smaller integer type 'enum clock_control_nrf_type'
from 'clock_control_subsys_t' (aka 'void *') [-Wvoid-pointer-to-enum-cast]
enum clock_control_nrf_type type = (enum clock_control_nrf_type)subsys;
```

Adding `size_t` to the cast removes this issue. Another option could be to
add `-Wno-void-pointer-to-enum-cast` flag to the compile flags.

Signed-off-by: Sigvart Hovland <sigvart.hovland@nordicsemi.no>
2023-05-26 14:58:13 -04:00
Antoniu Miclaus
eda63195f4 drivers: sensor: adxl372: fix software reset delay
The indended value for the delay after the software reset of adxl372 is
1ms. Adjust the value accordingly.

Fixes: a3e7cea
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
2023-05-26 14:56:55 -04:00
Abram Early
a59c948256 drivers: serial: stm32 uart implements driver enable
Enables the use of the hardware DE pin provided by an stm32 UART using
device tree flags.

Signed-off-by: Abram Early <abram.early@gmail.com>
2023-05-26 14:55:30 -04:00
Declan Snyder
cf34d2cbdc drivers: uart_mcux_flexcomm: Add ASYNC API
Support ASYNC API on Flexcomm UART

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-26 13:15:24 -05:00
Declan Snyder
2af408b8fa drivers: dma_mcux_lpc: Fix busy status
Driver should just say the channel is not busy if
it is not setup rather than returning an error.

Also, change the channel index to int8_t rather
than uint32_t since it is being assigned negative
values and that width is more appropriate.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-26 13:15:24 -05:00
Declan Snyder
e9a8389639 drivers: uart_mcux_flexcomm: Clean up
Clean up slashes in init macro to be less messy

Update copyright to reflect recent code changes by NXP

Update outdated driver description comment

Change irq driven api variables naming to be more specific

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-26 13:15:24 -05:00
Declan Snyder
4f290e6173 drivers: uart_mcux_flexcomm: Simplify init macros
The flexcomm uart mcux driver init macros have a lot
of unnecessary and confusing redundancy, so let's
simplify them.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-26 13:15:24 -05:00
Fabio Baltieri
c56a3615ee driver: npcx: i2c: set a dedicated priority for the port driver
The NPCX I2C controller has a port-controller hierarchy and the driver
is split in two files, with separate device struct and init functions.

These are currently initialized at the same level and priority, so the
actual order depends on what the linker does.

To avoid relying on the linking order, add a dedicated priority option
for the port that is set to go after the normal I2C one by default.

Found this by building with CONFIG_CHECK_INIT_PRIORITIES.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-26 14:08:12 -04:00
Fabio Baltieri
2ebad47eaa drivers: serial: ite_it8xxx2: add a dedicated priority symbol
The uart_ite_it8xxx2 is relying on a node that depends on a matching
ns16550 symbol, such as:

ite_uart1_wrapper: uartwrapper@f02720 {
        compatible = "ite,it8xxx2-uart";
	...
        uart-dev = <&uart1>;
};

But the two are currently setup to initialize at the same level and
priority. Add a dedicated priority symbol so that the wrapper device is
always initialized after the main one, regardless of the linker order.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-26 13:51:08 -04:00
Yuval Peress
3e9b750d85 icm42699: Only clear interrupt status when setting trigger
Always clearing the interrupt status register was causing issues for
the sensor shell when interrupts were enabled but trying to read
one-off samples.

Signed-off-by: Yuval Peress <peress@google.com>
2023-05-26 11:04:54 -05:00
Yuval Peress
ca5bf10143 sensor_shell: Update to new sensor_read API
Update the sensor shell logic to use the new sensor_read() APIs and
make triggers an option of the sensor_shell sample (this avoids the
trigger stealing the interrupt status from one-shot reads).

Signed-off-by: Yuval Peress <peress@google.com>
2023-05-26 11:04:54 -05:00
Yuval Peress
ed380de152 sensors: Add new async one-shot reading API
Add a new async API based on the RTIO subsystem. This new API allows:
1. Users to create sampling configs (telling the sensor which channels
   they want to sample together).
2. Sample data in an asynchronous manner which provides greater control
   over the data processing priority.
3. Fully backwards compatible API with no driver changes needed for
   functionality (they are needed to improve performance).
4. Helper functions for processing loop.

Signed-off-by: Yuval Peress <peress@google.com>
2023-05-26 11:04:54 -05:00
Daniel DeGrasse
a688fb109d drivers: display: enable direct framebuffer rendering with DCNANO LCDIF
Enable direct framebuffer rendering using DCNANO LCDIF, to improve
performance when the call to display_write is attempting to refresh
the full display.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-05-26 10:21:34 -05:00
Daniel DeGrasse
4ae5edcf84 drivers: display: mcux_elcdif: enable directly writing framebuffer
Enable the ELCDIF driver to directly write the framebuffer using
hardware, when an entire framebuffer update is requested. This will
enable better performance for applications that avoid partial
display updates.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-05-26 10:21:34 -05:00
Anisetti Avinash Krishna
5925a4670b drivers: dma: dma_intel_lpss: Added intel LPSS DMA interface
Added intel LPSS DMA interface using dw common to support
usage of internal DMA in LPSS UART, SPI and I2C for
transfer and receive operations.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-05-26 10:06:00 -04:00
Anisetti Avinash Krishna
c828e8cd02 drivers: dma: dma_dw_common: Added 64bit address transfer
Added support for 64bit address source and destination
usage for dw common.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-05-26 10:06:00 -04:00
Anisetti Avinash Krishna
54ecda63cf drivers: dma: dma_dw_common: Added missing break in switch
Added a break and corrected wrong usage of source
instead of destination.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-05-26 10:06:00 -04:00
Mahesh Mahadevan
0260d6daa4 drivers: mcux_i2s: Use the DMA reload flag
Use the DMA reload flag to indicate we wish to use
a circular chain of DMA descriptors to reload DMA
receive buffers.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 10:05:24 -04:00
Mahesh Mahadevan
b8c21a6d88 drivers: dma_mcux: Add support for big data transfers
1. Transfers are not limited by XFERCOUNT transfer length of
   LPC DMA descriptor. Added code to handle block sizes
   greater than XFERCOUNT.
2. Use the reload_en flag to decide if we should setup
   a circular descriptor chain.
3. Improve handling of source and destination width.
4. Number of DMA descriptors are defined by a Kconfig value.
5. Changed the dma_reload function to handle transfers
   greater than XFERCOUNT.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 10:05:24 -04:00
Mahesh Mahadevan
723224f086 drivers: dma_mcux: Rename variables in NXP MCUX driver
Rename the variables to help understand the code flow.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 10:05:24 -04:00
Georgij Cernysiov
b0acced124 drivers: phy: add adin2111
Adds PHY driver. Works via MDIO API and
exposed ADIN2111 MDIO Clause 45
functions.

Link status detection is triggered by
ADIN2111 driver within offloaded IRQ
handler.

Supports:
  - LED0, LED1 enable/disable
  - Fatal HW error detection
  - AN 2.4V tx mode enable/disable

The initialization order is important.
PHY 2 must be initialized after PHY1.
Therefore, it shall be defined after the 1st one
in the devicetree.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-05-26 09:50:09 -04:00
Georgij Cernysiov
238785ed2a drivers: mdio: shell: support adin2111
Adds supprot of ADIN2111 MDIO.

The shell allows to access Clause 22 registers.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-05-26 09:50:09 -04:00
Georgij Cernysiov
943bc1cebc drivers: mdio: add adin2111
Adds MDIO driver. Works via exposed
ADIN2111 functions.

It is possible to access Clause 45 and 22 registers.

Due to MDIO API limitation Clause 45 access
is done using driver specific MDIO functions.

Provides API and functions for PHY driver.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-05-26 09:50:09 -04:00
Georgij Cernysiov
9a15d72b32 drivers: ethernet: add adin2111
Adds initial ADIN2111 2-Port 10BASE-T1L (SPE)
switch support. Works over SPI.

The driver creates 2 interfaces, 1 per port (PHY).
Configures multicast and broadcast filters.
The same unicast is applied to both ports.

Supports:
  - Link state detection
  - CRC enable/disable
  - Ports config set
  - Ports ETH stats

Provides functions for MDIO driver.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-05-26 09:50:09 -04:00
Tyler Ng
06ef4f6f66 drivers: watchdog: Add the OpenTitan watchdog driver
The OpenTitan watchdog driver is a watchdog driver that can be configured
with two stages: a watchdog "bark", which generates an interrupt, and a
watchdog "bite", which resets the system. The two-stage watchdog can be
enabled by setting CONFIG_WDT_MULTISTAGE=y. Otherwise, the driver
functions as a single-stage watchdog.

A callback function may be set for the bark interrupt through the
wdt setup interface, but will only be used if the two-stage watchdog is
enabled. It must be configured for the first watchdog stage.

The driver controls only the watchdog portion of the OpenTitan AON timer.

Signed-off-by: Tyler Ng <tkng@rivosinc.com>
2023-05-26 09:45:25 -04:00
Alberto Escolar Piedras
0ae060d174 drivers: Console: Move all posix arch boards to same driver
All posix arch boards are required to provide the same
tracing/print API.
So, instead of having a different driver for native_posix and the
bsim boards, let's have a common one which uses this API.
This in turn results in the printk strings being printed in
the same underlaying backend as before with individual drivers.

A part from this, the native_posix console driver was a full
backend for the now long gone Zephyr console shell
(named legacy_shell from 527256501f
until it was retired in fd0b7f7767).
The whole input handling in this driver was dead code
(since 140a8d0c8a)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-26 12:57:41 +02:00
BJ Chen
215f180296 ITE: drivers/usb/device: Add USB Device Controller Support
Add USB Device Driver (usb_dc) of ITE IT82xx2

TEST=west build -p always -b it82xx2_evb
1. zephyr/sample/subsys/usb/hid
2. zephyr/sample/subsys/usb/hid-mouse

Signed-off-by: BJ Chen <bj.chen@ite.com.tw>
2023-05-26 12:40:18 +02:00
Filip Kokosinski
abd1817366 drivers/bluetooth/hci: enable BT_SILABS_HCI on EFR32BG27
This commit enabled the Silicon Labs Bluetooth interface driver on the
EFR32BG27 SoC series in the Kconfig.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-05-26 05:54:40 -04:00
Filip Kokosinski
93b7e492bf drivers/bluetooth/hci/slz_hci: bump blobs to version 4.1
This commits adapts the driver to the newer version of the EFR32 BT
blobs:
* libbluetooth_controller
* libbgcommon
* librail

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-05-26 05:54:40 -04:00
Tim Lin
f7d9ce081b ITE: drivers/pinctrl: Add condition of support voltage selection
Since not all GPIOs support voltage selection, configure voltage
selection register only if it is present.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-05-26 05:51:09 -04:00
Niek Ilmer
b79d65aaca drivers: usb_device: Add USB driver for smartbond
This adds support for the USB interface for the
Renesas Smartbond DA1469x device family.

Co-authored-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>

Signed-off-by: Niek Ilmer <niek.ilmer.aj@renesas.com>
2023-05-26 10:19:15 +02:00
Daniel DeGrasse
095d453d7a drivers: flash: flash_mcux_flexspi_*: copy LUT to ram when updating
Copy the LUT to SRAM before updating it. This avoids the application
reading LUT entries from FlexSPI while trying to write them to FlexSPI
configuration registers, which could result in invalid LUT entries being
added.

This update is applied to all in tree flash FlexSPI drivers, although
the failure has only been observed with the flash_mcux_flexspi_nor
driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-05-25 21:37:18 -05:00
Mulin Chao
42a509b812 driver: npcx: i2c: add i2c target mode support for npcx i2c drivers
Add I2C target mode support for NPCX i2c driver. Verified with
i2c_target_api test suite on npcx9m6_evb.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-05-25 16:32:07 -04:00
Fabio Baltieri
37c2a0d4a6 sensor: use ALLOW_EMPTY instead of the conditional for empty library
This should be the proper way of allowing an empty library for CMake.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-25 12:32:17 -05:00
Fabio Baltieri
83db8c17ab sensors: clean up CMakeLists and Kconfig
Clean up the include/source lists in the sensors subsystem. Sort the
list, drop the empty lines that makes it look super long for no good
reason, get away with the tabs to align the file names that does not
really work anyway.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-25 12:32:17 -05:00
Marek Matej
4796746b5e soc: esp32: MCUboot support
This make MCUboot build as Zephyr application.
Providing optinal 2nd stage bootloader to the
IDF bootloader, which is used by default.
This provides more flexibility when building
and loading multiple images and aims to
brings better DX to users by using the sysbuild.
MCUboot and applications has now separate
linker scripts.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-05-25 16:15:54 +02:00
Francois Ramu
dced627c28 drivers: flash stm32 qspi driver dma callback for positive statuses
Like other stm32 drivers, especially the stm32 flash ospi,
the DMA callback accepts a null or positive status.
It returns an error in case of negative.
BTW it also sets variable as unused, like stm32 flash ospi does.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-05-25 13:33:58 +00:00
Guillaume Gautier
ec73e7dae5 drivers: adc: stm32: use feature macros instead of series macros
Define two macros for calibration and oversampling for STM32 series that
possess these features, and use these macros instead of a list of series.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-05-25 13:32:08 +00:00
Guillaume Gautier
3ee6ddff29 drivers: adc: rework oversampling for stm32 adc
Rework oversampling by creating a const table containing possible
oversampling values and using this table instead of switch case.
Also disable ADC for all series before setting oversampling.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-05-25 13:32:08 +00:00
Fabio Baltieri
3431c1b59d drivers: sensors: add a sensor driver for TCS3400
Add a sensor driver for the TCS3400 color light-to-digital converter.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-25 13:30:45 +00:00
Jaxson Han
894f1b1fd7 drivers: gic: Add irq pending check and clear function
Implement irq pending check and clear function for both gic and gicv3.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2023-05-25 08:25:11 +00:00
Petr Sharshavin
2489416ec2 drivers: lora: shell: fix invalid range in config bw param
'bw' parameter in 'lora config' command has a range of 0 to INT8_MAX.
However possible values of 'bw' (125, 250, 500) don't fit this range
and we need to extend it to 0 to INT16_MAX.

This fix has been tested on custom board with STM32L4 and SX1276.

Signed-off-by: Petr Sharshavin <sharshavin@mail.ru>
2023-05-25 08:22:08 +00:00
Aymeric Aillet
8959b838bf drivers: can: Fix R-Car driver can_stop behavior
Calling for can_stop() method was not emptying FIFOs
and tx_msgq.
Resetting TX FIFO to empty it.
Emptying tx_msgq with "ENETDOWN" return code.

Fixes #50546

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2023-05-24 19:43:45 -04:00
Sreeram Tatapudi
d9e4f8fa1d drivers: watchdog: Driver for Infineon watchdog
Initial version of the driver for Infineon CAT1 devices

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2023-05-24 19:42:50 -04:00
Gerard Marull-Paretas
9494981181 drivers: regulator: npm6001: remove common device
Common device part is now handled by the nPM6001 MFD device driver.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 19:39:55 -04:00
Gerard Marull-Paretas
5521db3576 drivers: regulator: npm6001: format code
Format code using clang-format. This will ease incoming refactor.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 19:39:55 -04:00
Gerard Marull-Paretas
9c340776ff drivers: watchdog: npm6001: select MFD and adjust init priority
Make sure MFD driver for nPM6001 gets built, and, that watchdog driver
comes later in the init sequence.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 19:39:55 -04:00
Gerard Marull-Paretas
76412f6aa0 drivers: gpio: npm6001: select MFD and adjust init priority
Make sure MFD driver for nPM6001 gets built, and, that GPIO driver comes
later in the init sequence.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 19:39:55 -04:00
Gerard Marull-Paretas
753bc2b785 drivers: mfd: npm6001: initial version
Add an API-less MFD driver for nPM6001. In this case, the MFD device
driver doesn't expose any API as plain I2C API is used within other
device drivers (regulator, GPIO, watchdog). This driver just initializes
some device properties.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 19:39:55 -04:00
Gerard Marull-Paretas
0d3f18d3c4 drivers: mfd: add class skeleton
Introduce the skeleton for multi-function device drivers. This driver
class is inspired by the same class found in Linux. Multi-function
devices expose multiple functionalities, for example, a LED driver,
regulator, GPIO controller, etc. The MFD driver class serves as a kind
of "parent" device where common functionality can be managed: bus
access, IRQ sharing, initialization code, etc.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 19:39:55 -04:00
Roman Dobrodii
defb159ab1 soc/arm/silabs: support BLE with PM in Series 2 SoCs
Using EM2 or deeper sleep states (where HF clocks are off) requires
special care if BLE radio is used, since BLE radio relies on that clock,
and its power/clock requirements need to be taken into account
On SiLabs, radio PM is implemented as part of RAIL blob, which relies
on sl_power_manager HAL service. I've implemented SoC PM
state changes using sl_power_manager instead of emlib, and added
call to RAIL PM initialization in Gecko HCI driver.

Signed-off-by: Roman Dobrodii <rdobrodii@antmicro.com>
2023-05-24 13:31:44 -04:00
Roman Dobrodii
549358255f drivers/timer/gecko_burtc: allow queries prior to timer initialization
Before BURTC is initialized, clock to its APB CSR file is stopped, so
any attempt to read BURTC regs results in BusFault. However,
many parts of Zephyr may call sys_clock getters even before sys_clock
driver itself is initialized. This change adds support for that:
sys_clock_elapsed() and sys_clock_cycle_get_32() simply return 0
if BURTC is not init yet.

Signed-off-by: Roman Dobrodii <rdobrodii@antmicro.com>
2023-05-24 13:31:44 -04:00
Gerard Marull-Paretas
d99afcd0da drivers: regulator: adp5360: remove unused init priority
The common init priority is a leftover from a previous implementation.
Remove it as it's not used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 13:14:52 -04:00
Carlo Caione
6f3a13d974 barriers: Move __ISB() to the new API
Remove the arch-specific ARM-centric __ISB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
cb11b2e84b barriers: Move __DSB() to the new API
Remove the arch-specific ARM-centric __DSB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Carlo Caione
2fa807bcd1 barriers: Move __DMB() to the new API
Remove the arch-specific ARM-centric __DMB() macro and use the new
barrier API instead.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-05-24 13:13:57 -04:00
Florian Grandel
32e1213b0c net: l2: ieee802154: improve inline documentation
Over time, some non-standard concepts and extensions were introduced
into the stack (in KConfig, in drivers, in the internal API and into the
implementation) which makes introduction of additional standard-
compliant extensions like TSCH (and others) unnecessarily difficult.

To introduce extensions like TSCH it is required for the IEEE 802.15.4
stack to become more structurally aligned with the standard again which
will be the focus of some of the upcoming preparatory changes.

One way to check and prove standard compliance is to reference the
standard from within the source code. This change therefore introduces
inline references to the IEEE 802.15.4-2020 standard wherever possible.
Deviations from the standard are documented with TODO or deprecation
labels to be addressed in future changes.

In the future, new code introduced to the IEEE 802.15.4 stack should
be documented and reviewed for standard-compliance to avoid further
divergence. Most importantly:
* MAC/PHY configuration (via net mgmt, radio API, devicetree or
  KConfig) should always be directly linked to well-defined MAC/PHY
  PIB attributes if visible to the MAC API or the end user.
* Net management/shell/radio API commands should have a documented
  reference to the corresponding MLME action from the standard.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-05-24 16:41:57 +02:00
Andrzej Kuros
174b7f4775 nrf_802154: nrf_802154_serialization_error never returns
Functions nrf_802154_serialization_error and
nrf_802154_sl_fault_handler shall never return.
However `__ASSERT()` might expand to an empty instruction
CONFIG_ASSERT=n and is not enough to stop execution.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
2023-05-24 16:41:39 +02:00
Benjamin Björnsson
bbbfc0a96d drivers: i2c: stm32: Add I2C support for STM32C0-series
Add STM32C0 SOC to combined interrupt config in order to
make it support the I2C driver.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-05-24 16:40:07 +02:00
Gerard Marull-Paretas
e05df8faf1 drivers: regulator: adp5360: initial version
Add a new regulator driver for Analog Devices ADP5360. While it is a MFD
device, only support for BUCK/BUCKBOOST regulators is added in this
patch.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 11:54:30 +00:00
Qipeng Zha
bc3ea1bb99 drivers: spi: add SPI device statistics
Enable below statistics for SPI by follow Zephyr STATS subsystem,
    rx_bytes, tx_bytes, transfer_error.

and add SPI_DEVICE_DT_DEFINE helper macro to define SPI device.

Signed-off-by: Xiaolu Sun <xiaolu.sun@intel.com>
Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
2023-05-23 22:15:25 -04:00
Andy Sinclair
d82781acb9 drivers: regulator: npm1300: Fixed ldo2 device source
Fixed error which meant that ldo2 referenced the wrong source

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-05-23 22:08:46 +02:00
Maxmillion McLaughlin
477e7264ca drivers: sensor: mcp9600 add intial driver support
Implementation of MCP9600 i2c thermoouple amplifier - K, J, T, N, S, E, B
and R type T

Signed-off-by: Maxmillion McLaughlin <github@maxmclau.com>
2023-05-23 13:33:45 -05:00
Benedikt Schmidt
940ddba8bd drivers: dac: make output buffer for STM32 DAC configurable
If an operational amplifier is used on the DAC output it is
preferrable to disable the DAC output buffer.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-05-23 13:02:25 +02:00
Stefan Petersen
945d074ec0 drivers: ethernet: eth_stm32_hal: Configurable speed and duplex
Make it possible to be able to change speed and duplex for the
STM32H7xx and API_V2 from the configuration settings.

This exists for the non-STM32H7x already today, so this is basically
copying the code for the other STM32's.

Please note that ST has a series incompability. For F1 and F2,
the duplex settings are named ETH_MODE_FULLDUPLEX respective
ETH_MODE_HALFDUPLEX. For F4, H7 and F7 the duplex settings are named
ETH_FULLDUPLEX_MODE respective ETG_HALFDUPLEX_MODE.

This should really be queried from the PHY (as previous programmer have
written in the code). But while waiting for a proper PHY solution,
this is intended as a stop-gap solution.

Signed-off-by: Stefan Petersen <spe@ciellt.se>
2023-05-23 13:02:05 +02:00
Alberto Escolar Piedras
4b0d691a37 drivers console native_posix: Do not set buffering mode anymore
Since aadca692b3
the board code already sets the stdout/err buffering,
even if there is no console driver;
So there is no need to set it also in the console driver.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-23 12:56:38 +02:00
Lucas Tamborrino
2f718dd369 drivers: dma: esp32xx: Fix get interrupts from DT
Simplify get interrupt numbers array by using DT_INST_PROP.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-05-23 08:55:51 +02:00
Andrei Emeltchenko
f6211e2641 drivers: sbs_gauge: Fix buffer overflow
Fixes buffer overflow when trying to copy 5 bytes to 4 bytes array.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-05-23 08:55:43 +02:00
Denis Mingulov
b5785f3545 drivers: clock_control: stm32u5: fix chain-load with asserts
It is possible that stm32_clock_control_init function is started
when the image is chain-loaded and hardware clocks are already
initialized to some state (PLL1).

Currently due to an assert in get_startup_frequency function
(which will trigger k_fatal_halt) the boot will stop on the
early stage if CONFIG_ASSERT=y. This is reproducible for example
with standalone MCUboot and TF-M with MCUboot.

Fixed by adding support for HSE and PLL1 clock sources at
get_startup_frequency.

Signed-off-by: Denis Mingulov <denis@mingulov.com>
2023-05-23 08:55:00 +02:00
Kenneth J. Miller
e2c0e220fd drivers: sensor: Add STM32 VREF+ sensor
Add VREF+ sensor driver and DT node definition.

This driver allows determining the actual voltage applied to an SoC's
VREF+ pin, by comparing the VREFINT internal bandgap voltage reference
with its factory calibration data.

In packages where VREF+ is bonded to VDDA, this permits direct measurement
of VDDA voltage.

Signed-off-by: Kenneth J. Miller <ken@miller.ec>
2023-05-23 08:54:20 +02:00
Vincent Geneves
2a97a0a95c drivers: i2c_ll_stm32_v2: Fix logic in target_unregister
Logic was wrong when testing if a slave is still attached. And i2c
driver was never disabled.

Test if one of the two slave_cfg pointer is not NULL to return
immediately.

Signed-off-by: Vincent Geneves <vgeneves@kalray.eu>
2023-05-22 15:26:35 +02:00
Vincent Geneves
b8b1d75a54 drivers: i2c_ll_stm32_v2: Test slave_cfg pointer before using it
Since the introduction of the second slave address support, slave_cfg
pointer may be NULL when entering slave event function.
It happens when both targets are registered and then the first one is
unregsitered.

Test the pointer vs NULL before using it.

Signed-off-by: Vincent Geneves <vgeneves@kalray.eu>
2023-05-22 15:26:35 +02:00
Rihards Skuja
ecc3315cf8 drivers: adc: stm32: allow to use multiple ADCs with STM32F3 series
STM32F3 have multiple ADCs that share the same IRQ.

Signed-off-by: Rihards Skuja <rihards.s@origin-robotics.com>
2023-05-22 15:26:26 +02:00
Ole Morten Haaland
80bfed3b44 drivers: ethernet: stm32: Disable HW checksums by default
Without this change, there's a difference between what the V2 Ethernet
HAL claims to be its capabilities in eth_stm32_hal_get_capabilities()
and what is actually enabled when CONFIG_ETH_STM32_HW_CHECKSUM is
disabled. This difference somehow causes the checksum in outgoing
packets to become 0, and hence seems to break networking at least on
some PHYs.

This commit disables HW checksums by default even when V2 driver is in
use, and this hence fixes networking when CONFIG_ETH_STM32_HW_CHECKSUM
is disabled.

This fixes #57629.

Signed-off-by: Ole Morten Haaland <omh@icsys.no>
2023-05-22 15:25:29 +02:00
Siyuan Cheng
cbdd2f38da drivers: spi: add Data Fusion Subsystem SPI driver
Introduce DesignWare ARC Data Fusion IP Subsystem(DFSS) SPI
driver for ARC boards, i.e. EMSDP, which uses DW SPI to controll
SPI-Flash and DFSS SPI to connect external devices. Both drivers
share most source code, but DFSS uses ARC auxiliary registers.
Move FIFO depth setting to device tree.

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-05-22 15:25:19 +02:00
Jerzy Kasenberg
ce4018511f drivers: adc: add adc support for Smartbond devices
Renesas Renesas SmartBond(tm) have two ADC blocks:
GPADC and SDADC.
This change adds drivers for both.
Each ADC supports only one channel setup, drivers allow
to have multiply channels in sequence. Switching
between ADC sources in done in software.

GPADC has 10 bit resolution (accuracy can be increase
with oversampling). Values up to 3.6V can be measured
on selected pins. V30 and VBAT1 can also be measured.
SDADC has 14 bit resolution and can take measurements
from 8 pins (single of differential) and VBAT.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-05-22 12:41:42 +02:00
Andrzej Głąbek
3fed0510a6 drivers: pinctrl_nrf: Fix disconnecting of pins
This is a follow-up to commit 223cc3c6bd.

When a peripheral pin is disconnected, the pinctrl driver should skip
applying of GPIO configuration, as there is no pin number available in
such case, but due to an incorrect check, it actually did not skip it
and used an incorrect pin number for that. In nrfx prior to 3.0.0, this
caused an assertion failure, but because of a fallback routine, things
could still work in most cases (when assertions were disabled) as that
GPIO configuration was just applied to P0.31. Hence the bug was not
discovered until now. In the recent nrfx, this causes a null pointer
dereference, so always a crash.
This commit corrects the mentioned check and also uses the term "psel"
instead of "pin" where it is possible that the value is not a correct
pin number, in the hope of preventing a similar problem in the future.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-05-22 12:02:45 +02:00
Gerard Marull-Paretas
dacb3dbfeb iterable_sections: move to specific header
Until now iterable sections APIs have been part of the toolchain
(common) headers. They are not strictly related to a toolchain, they
just rely on linker providing support for sections. Most files relied on
indirect includes to access the API, now, it is included as needed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-22 10:42:30 +02:00
Fabio Baltieri
e3a429e27e driver: i2c: npcx_controller: use the non I2C device init macro
The i2c_npcx_controller does not actually implement the i2c API, that's
implemented in the port driver and the controller one is in support of
that. This means there's no need to use the I2C specific instance
define, as that would end up adding the stats structure that would never
get used.

This was originally added in 7b1349cfe6.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-22 10:16:39 +02:00
Andy Sinclair
29d6149ca6 drivers: gpio: npm1300: Added status readback
Status readback has been added in the latest silicon revision.
.port_get_raw and .port_toggle_bits are now supported

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-05-22 10:15:46 +02:00
Jeppe Odgaard
6b0a4cc204 drivers: flash: fix memcpy and invalidate dcache in hyperflash
Replace memcpy usage in write since it is not linked to non-external
flash which might cause read-while-write issues.
Move the function that invalidated the data cache inside the critical
section to avoid context switch before it is invalidated.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-05-22 10:15:03 +02:00
Daniel DeGrasse
e58d0c3bb5 drivers: flash: hyperflash driver no longer stores controller data in ROM
Store controller reference in RAM, to avoid flash access in critical
section.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-05-22 10:15:03 +02:00
Jeppe Odgaard
0ad95994c1 drivers: flash: check xip before configure device in hyperflash init
Check memc_flexspi_is_running_xip before calling
memc_flexspi_set_device_config in hyperflash init.
This aligns with the nor flash driver.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-05-22 10:15:03 +02:00
Jeppe Odgaard
ecd2f51386 drivers: flash: fix hyperflash write operations
Hyperflash write operations resulted in invalid writes. This commit
fixes the issue by temporarily lowering the clock during writes.
This aligns with the mcux-sdk-examples.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/53855

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-05-22 10:15:03 +02:00
Jeppe Odgaard
cd59e74412 drivers: memc: add update clock function
Add a function to update the flexspi bus clock. This is
needed when write operations are done to the hyperflash.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-05-22 10:15:03 +02:00
Kamil Serwus
b63a9af07d can: mcan: fix setup configuration ram
SAM0 required can module was in init state before configure
pointers to ram which handle can frames.

Signed-off-by: Kamil Serwus <kserwus@gmail.com>
2023-05-22 08:03:58 +00:00
Kamil Serwus
632704e04b sam: can: CAN driver for SAM0 socs
Driver was based on can_sam. SAMC21 has only 1 interrupt for one
can "output", so can interrupt has to executes two lines of
interrupts.
CAN is configured to use OSC48M clock via GLCK7. GLCK7 is set
by divider configured from dts.

Signed-off-by: Kamil Serwus <kserwus@gmail.com>
2023-05-22 08:03:58 +00:00
Peter Rowley
d01780fc94 drivers: fuel_gauge: sbs_gauge: Fix copy/paste error in RTTF
Looks like a copy/paste error when copying runtime to empty to runtime
to full.  Fixing so that we're assigning to the right union member.

Signed-off-by: Peter Rowley <perowle@microsoft.com>
2023-05-20 05:59:16 -04:00
Peter Rowley
66c568e300 drivers: fuel_gauge: sbs_gauge: Add support for buffer registers
The buffer registers (chemistry, manufacturer name, device name) were
not implemented. Implemented by adding a new api interface for
retrieving buffer properties. fuel_gauge_get_block_property has been
added, and uses a memory buffer allocated in the app in order to
store the fuel gauge information.

Signed-off-by: Peter Rowley <perowle@microsoft.com>
2023-05-19 16:39:25 -04:00
Peter Rowley
ff36548616 drivers: fuel_gauge: Add support for RSOC and ASOC
Current driver only allows state-of-charge.  Adding relative-state-
of-charge and absolute-state-of-charge to differentiate between the
different types.  Updated sbs and max drivers to support new enum.
Discussed in issue #57523

Signed-off-by: Peter Rowley <perowle@microsoft.com>
2023-05-19 13:40:19 -04:00
Pavel Hübner
83d031c024 drivers: w1: Make 1-Wire Skip ROM cmd. optional
For systems with a true dynamic 1-Wire nature, the 1-Wire devices
cannot be defined in the DeviceTree (the number of slaves in
the system is not known during the build time).

In other words, there are no pre-defined 1-Wire devices on the bus in
DeviceTree, and thus the slave_count variable is always zero.

That means the skip_rom functionality will always be called even if
there are multiple devices connected to the bus.

This commit allows the user to override this original behavior and avoid
the skip_rom call by ignoring the slave count variable.

Also, this work preserves full backward compatibility.

Signed-off-by: Pavel Hübner <pavel.hubner@hardwario.com>
2023-05-19 16:29:35 +02:00
Robert Hancock
e57bab59ff drivers: watchdog: add Xilinx AXI Timebase WDT driver
Add a driver for the Xilinx AXI Timebase WDT logic core. This can be
instantiated on various Xilinx FPGA-based platforms such as the
Digilent Arty, although it is not part of the default image used with
the Zephyr board configuration.

The driver can also optionally implement the HWINFO API to allow
determining whether the last system reset was initiated by the WDT.
Since this is a standalone IP core which could be used a variety of
configurations, this support is optional in case the system/SoC it is
used with already implements this support.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2023-05-19 16:14:24 +02:00
Tom Burdick
a106a5e606 i2c: SAM Add RTIO support for I2C
Support i2c with a seperate driver for sam twihs that implements RTIO.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-05-19 16:10:51 +02:00
Tom Burdick
a560d47078 i2c: Add RTIO support to the I2C API
Adds the needed calls and macros required to enable supporting RTIO
with an I2C bus.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-05-19 16:10:51 +02:00
Jeronimo Agullo
e64129d910 video: mt9m114: YUV pixel format support
Added YUV pixel support to mt9m114 camera

Signed-off-by: Jeronimo Agullo <jeronimoagullo97@gmail.com>
2023-05-19 15:45:50 +02:00
Mohamed ElShahawi
6a2bfa422c drivers: display: ili9342c display driver
This driver implement basic functions of ili9342c controller
which comes mostly with IPS displays.

Signed-off-by: Mohamed ElShahawi <ExtremeGTX@hotmail.com>
2023-05-19 15:24:56 +02:00
Gaël PORTAY
2be2fa8bd6 i2c: shell: Fix shell error output
The i2c shell write command outputs the error "Failed to read from
device" while it tries to write data to device.

This fixes the error by outputting "Failed to write to device" instead.

Fixes:

	uart:~$ i2c write i2c@3ff53000 23 01
	Failed to read from device: 23

Signed-off-by: Gaël PORTAY <gael.portay@rtone.fr>
2023-05-19 10:06:38 +02:00
Sumit Batra
7dce14632d soc: arm: nxp_imx: support enet2 interface on RT106x series
This patch enables the PLL clock output and PLL ref clock
for second ethernet module in NXP's i.MxRT106x SoCs

Signed-off-by: Sumit Batra <sumit.batra@nxp.com>
2023-05-18 14:08:06 -05:00
Armando Visconti
2b6dc7d778 drivers/sensor: lsm6dso16is: fix coding style issues
1. spi.h is included twice. Remove one of the two "#include"
   declarations.

2. The 'if' clause requires braces even for one line body.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-05-18 11:43:36 -05:00
Armando Visconti
e5b7799ce3 drivers/sensor: add support to LSM6DSV16X IMU sensor
The LSM6DSV16X is a system-in-package featuring a 3-axis digital
accelerometer and a 3-axis digital gyroscope for industrial and IoT
solutions. The LSM6DSV16X embeds advanced dedicated features such as
a finite state machine (FSM) for configurable motion tracking and a
machine learning core (MLC) for context awareness.

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

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

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-05-18 11:43:36 -05:00
Gerard Marull-Paretas
2725155832 drivers: dma: mcux_lpc: remove unused device config
Device config is no longer used after
32da420126.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-18 11:09:29 -05:00
Adam Wojasinski
36f4226b2f drivers: pwm: pwm_nrfx: Apply workaround for stopping PWM instance
Current implementation of `nrfx_pwm_stopped_check()` doesn't work
as expected when user doesn't provide event handler.
Workaround for that is to use low level function for checking whether
STOPPED event arrived.

The workaround should be removed when `nrfx_pwm_stopped_check()`
will contain needed functionality.

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2023-05-18 12:01:30 +02:00
Fabio Baltieri
72617437d0 input: npcx_kbd: set the thread name
Set a thread name for the npcx keyboard scan task so it can easily be
identified in the stack dump shell command.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-18 09:32:33 +02:00
Fabio Baltieri
d48d4a53e7 input: npcx_kbd: various coding style fixes
Various coding style fixes, typos, and others on the NPCX keyboard scan
driver. No functional changes.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-18 09:32:33 +02:00
Fabio Baltieri
e4780ef02d input: convert the Nuvoton npcx keyboard scan driver to input
Convert the NPCX keyboard scan driver to the input subsystem and add the
input to kscan compatibility driver to maintain functionality with the
current API.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-05-18 09:32:33 +02:00
Michele Balistreri
f87313bf0f drivers: video: change initialization order of CSI and cameras
video_mcux_csi_init, which setups the CSI pins (i.e: calls
pinctrl_apply_state) was called after mt9m114_init which tries to do i2c
communication with the camera to read the chip id. But since one of the
CSI pins is the camera master clock, doing things in this order won't
work. This PR inverts the order in which the devices are initialized.

Signed-off-by: Michele Balistreri <michele@bitgamma.com>
2023-05-17 15:08:31 -05:00
Mahesh Mahadevan
b72b99f49a drivers: timer: nxp: Conditionally compile the wakeup source
The function to enable wakeup from deep sleep modes is not
available on all SoC's. Hence compile this only when the
wakeup_source property is enabled.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-17 14:35:10 -05:00
Declan Snyder
32da420126 drivers: dma_mcux_lpc: Change init level
Change init level of the mcux lpc dma driver to be
PRE_KERNEL_1 because some other hardware drivers
used on the same platforms as the lpc dma will be
dependent on the LPC DMA and are also initialized
in PRE_KERNEL_1, such as the Flexcomm UART driver
when using UART_ASYNC_API.

Therefore, remove k_malloc from init function and
make those variables statically defined instead of
heap allocated.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-17 14:25:13 -05:00
Declan Snyder
d8ca4e9e8f drivers: dma_mcux_lpc: Status fixes
Some miscellaneous fixes to LPC DMA driver regarding status tracking:

- If a DMA channel has not been configured for any transfer,
  there will be a bug caused by the virtual channel being -1
  and then trying to index -1 into the driver data structs.
  Add -EACCES return code to indicate this situation.

- Return -EINVAL from get_status if channel number is invalid

- Update the busy flag in the LPC DMA callback function.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-17 14:25:13 -05:00
Mike J. Chen
42b121ee95 drivers: i3c: mcux: fix issues when only i2c devices are on the bus
Fixes for bug:
https://github.com/zephyrproject-rtos/zephyr/issues/57560

* don't do CCC if no i3c devices in device tree
* don't wait for MCTRLDONE status when issuing stop
* don't do data part of transfer if buf_sz is 0
* don't limit transfers to only i2c devices in the device tree
  so "i2c scan" shell cmd works as expected

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-05-17 09:34:31 -05:00
Johann Fischer
fdb631c5d7 drivers: spi_nrfx_spim: bring back get_nrf_spim_frequency
Commit 246393e830
("drivers: spi: spi_nrfx_spim: Remove nrf_frequency_t handling")'
introduced two changes, one of them is removing the function
get_nrf_spim_frequency with a strange justification.
This change  breaks support for peripherals written in a common way,
where the maximum frequency is set to the maximum supported
by the peripheral, not the controller, see shields for example.

On the occasion of bringing it back, the original function was
refactored to be easier to read and understand.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-05-17 16:21:52 +02:00
Johann Fischer
1a30cd8f1c drivers: udc: add USB device controller driver skeleton
Add a USB device controller driver skeleton to use as a starting point
for implementing a specific driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-05-17 12:26:48 +02:00
Huifeng Zhang
26d8714eed driver: uart: pl011: fix interrupt driven API
API function:
    - `pl011_irq_tx_enable` is expected to enable and trigger TX interrupt.
    Due to HW limiation, PL011 won't trigger TX interrupt if some data
    wasn't filled to TX FIFO at the beginning. So that `isr_cb` must be
    called at first time to enable TX irq.

    - `pl011_irq_tx_ready` will return true when FIFO can accept more
    data. Here we don't need wait TX FIFO to be empty.

    - `pl011_irq_tx_complete` will return true when all data have been
    sent from the shift register.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-05-17 09:49:03 +02:00
Huifeng Zhang
0da7e06992 driver: uart: pl011_sbsa: refine creating device instance
Create pl011_sbsa device instance via the DT_INST_FOREACH_STATUS_OKAY
macro.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-05-17 09:49:03 +02:00
Mulin Chao
9da9c90639 intc: miwu: npcx: improve interrupt latency of miwu input events
To reduce the interrupt latency of MIWU events, the driver prepares a
dedicated callback function item list for each MIWU group in this PR. We
needn't check the MIWU table and group of the event in ISR. And the
maximum item number of each list is also limited to 8. After applying
this PR, the interrupt latency reduces to ~10us consistently.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-05-17 09:48:54 +02:00
Sreeram Tatapudi
ea591e2899 drivers: bluetooth: Add Infineon Bluetooth driver
Add initial version of the Bluetooth driver for
the cy8cproto_063_ble board

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2023-05-17 09:59:36 +03:00
Manimaran A
f8c8ee65be drivers: pinctrl: Microchip XEC PINCTRL glitch fix
Glitches were observed if a GPIO pin was configured by
ROM to a non-default state and then Zephyr PINCTRL
reconfigured the pin. The fix involves using the correct
PINCTRL YAML output enable and state flags. Reading the
current spin state and reflecting into new pin configuration
if the pin is output and the drive low/high properties are
not present. We also take advantage of GPIO hardware reflecing
the alternate output value in the parallel output bit before
enabling parallel output mode. Interpret boolean flags with
both enable and disable as do not touch if neither flag is
present. We give precedence to enable over disable if both
flags mistakenly appear. Note, PINCTRL always clears the
GPIO control input pad disable bit.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-05-16 18:52:44 -04:00
Manimaran A
79ee5a876f drivers: gpio: Microchip MEC172x GPIO driver glitch fix
A glitch was observed if a GPIO PIN was configured to a
non-default state by ROM and then Zephyr programs the pin
for the same configuration. Root cause is GPIO hardware
implementing two output bits for each pin. The alternate
output bit is in the pin control register and is r/w by
default. The other bit exists in the GPIO parallel ouput
register and is read-only by default. The hardware actually
reflects the pin's output value into both bits. The fix is
to configure the pin with alternate output bit read-write
and the last step is to disable alternate output which
enabled read-write of the parallel bit. GPIO API's can
then use the GPIO parallel out registers. Add logic to
return an error from the GPIO interrupt configure API if
a pin is not configured as an input. Hardware only performs
interrupt detection if the input pad is enabled.
Hardware supports a pin being configured for both input
and output. Applications should add the GPIO_INPUT flag
to all pin configuration requiring interrupt detection.
The interpretation of input and output flags for the
get configuration API appears to be only one of the
flags can be set. Please refer to the GPIO driver tests.
Updated GPIO interrupt configure to clear the input pad
disable bit due to interrupt detection HW is connected
only to input side of pin.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-05-16 18:52:44 -04:00
Jackie Yang
38e81e38f9 drivers: sensor: lsm6dsl: Fix lsm6dsl gyroscope full range setting
Bug 1: Fix lsm6dsl_gyro_set_fs_raw does not clear FS125 to register when
setting the full range to be other values.

Bug 2: Fix lsm6dsl_gyro_channel_get does not use the current
gyro_sensitivity when getting data from the gyroscope.

Signed-off-by: Jackie Yang <jackie@jackieyang.me>
2023-05-16 11:22:58 -05:00
Wojciech Slenska
80217de14e dts: arm: stm32h5: Add aes node
Add hw crypto support in stm32h5 dtsi. Add missing define in driver.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-05-16 18:19:26 +02:00
Guillaume Gautier
b5e750851e drivers: adc: make use of new stm32 adc compatibles
Several sections of the STM32 ADC driver are #ifdef by a combination of the
same SOC defines that share similar IPs. These are F2/F4/F7/L1, and
F1/F37x.
Each of these combinations is now replaced by a specific compatible, which
makes the code a bit lighter and more succinct.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-05-16 18:18:51 +02:00
Guillaume Gautier
649742f47e drivers: adc: add ifdef for stm32f37x adc
Add ifdef around some functions that don't exist for STM32F37x (ADC_V2_5)
like it is done for STM32F1x.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-05-16 18:18:51 +02:00
Guillaume Gautier
c1a601397f drivers: adc: cleanup stm32 adc driver
Inverts the logic of some #ifdef, replacing lists of newer series by a
list of NOT older series. This makes it shorter, and more future-proof as
future series are more likely to work out of the box, without need to
manually add a new define in each place.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-05-16 18:18:51 +02:00
Guillaume Gautier
bab52fbc81 drivers: adc: clean stm32 adc calibration
Rework and clean some code around STM32 ADC calibration

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-05-16 18:18:51 +02:00
Guillaume Gautier
5180b6fac6 drivers: adc: rewrite stm32 adc enable
Some STM32 families that need to check the ADRDY flag after enabling the
ADC were not doing it. The #ifdef has been updated to fix that.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-05-16 18:18:51 +02:00
Guillaume Gautier
291e4c2561 drivers: adc: add comment to describe different adc versions
Add comment to describe different ADC versions

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-05-16 18:18:51 +02:00
Luca Fancellu
d36cbab7ae drivers: eth_smsc91x: Fix compilation error for assert
Fix a compilation error for the ethernet driver smsc91x that
prevents the build with asserts enabled.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
2023-05-16 11:18:22 -05:00
Mahesh Mahadevan
f2fd5c3779 drivers: uart_mcux: Do not enable and disable the transmitter
Do not enable and disable the UART transmitter

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-16 12:08:32 +02:00
Manimaran A
3cc7d37b70 drivers: crypto: MEC172x crypto driver supporting hash
Implement zephyr crypto driver hash API's using calls to
MEC172x ROM hash API's. Hardware supports zephyr driver
hash modes: SHA-224, 256, 384, and 512. Driver supports
synchronous (blocking) mode at this time.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-05-16 12:07:24 +02:00
Madhurima Paruchuri
f8d9cd67c8 drivers: sbs_gauge: Reformat the changes
Reformat the files touched by code changes using clang

Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>
2023-05-16 12:07:14 +02:00
Madhurima Paruchuri
2432c94186 drivers: sbs_gauge: Add support for Alarm properties
RemainingCapacityAlarm(r/w) and RemainingTimeAlarm(r/w)

Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>
2023-05-16 12:07:14 +02:00
Mahesh Mahadevan
d3a3e54f55 drivers: i3c: Fix Build failure on MCUX I3C
Fix build failure introduced by commits
989d103d53 and
62f22f8d3b

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-15 15:26:32 +02:00
Filip Kokosinski
a4902b1c35 boards/arm/efr32xg24_dk2601b: add BLE support
This commit adds BLE support to the `efr32xg24_dk2601b` board. It also
modifies the SiLabs BT HCI driver to accomodate the EFR32xG24 SoC
series.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-05-15 13:09:34 +02:00
Kay P
c48422f523 drivers: clock_control: stm32f3: Enable PWR clock to access BDCR and PWR_CR
BDCR and PWR_CR could be required for LSE or RTC for instance.
Enable it here as for now, no sophisticated PM handling is available
on F0 and F3 series.

Fixes #56449
Fixup for #56505

Signed-off-by: Kay P <kayo@illumium.org>
2023-05-15 09:15:30 +00:00
Savent Gate
e2c39313ac drivers: pwm: pwm_stm32: Add 6-PWM support
User can use 6-PWM motor driver in dts like this below:
```dts
pwms =
 // ch1,ch2,ch3,ch1n,ch2n,ch3n
 <&pwm 1 PWM_USEC(50) PWM_POLARITY_NORMAL>, // ch1
 <&pwm 2 PWM_USEC(50) PWM_POLARITY_NORMAL>, // ch2
 <&pwm 3 PWM_USEC(50) PWM_POLARITY_NORMAL>, // ch3
 <&pwm 1 PWM_USEC(50) (PWM_POLARITY_NORMAL|STM32_PWM_COMPLEMENTARY)>,
 <&pwm 2 PWM_USEC(50) (PWM_POLARITY_NORMAL|STM32_PWM_COMPLEMENTARY)>,
 <&pwm 3 PWM_USEC(50) (PWM_POLARITY_NORMAL|STM32_PWM_COMPLEMENTARY)>;
```

Signed-off-by: Savent Gate <savent_gate@outlook.com>
2023-05-15 09:15:01 +00:00
Andrei Emeltchenko
7119cc1605 drivers: adc: adc_ads114s0x: Fix missing assignment
Fixes assignment before error check.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-05-15 09:58:28 +02:00
Armin Brauns
c5701ffa62 drivers: ethernet: eth_stm32: avoid race condition in interface init
rx_thread() is started by eth_initialize(), while dev_data->iface is
populated by eth_iface_init() (called by net_init()).

Usually eth_iface_init() has completed by the time rx_thread() hits its
idle timeout and accesses dev_data->iface, but in case of a time-intensive
SYS_INIT item between eth_initialize() and net_init(), this is not
necessarily the case, causing a NULL dereference. This can be forced by
putting a k_sleep(K_SECONDS(5)) at the top of eth_iface_init().

Start rx_thread() in eth_iface_init() instead (which runs after
eth_initialize() due to init priorities) to make sure everything is
initialized properly.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-05-15 09:17:11 +02:00
Grant Ramsay
6b5a994068 drivers: ethernet: Add Jailhouse IVSHMEM Ethernet support
Allows Ethernet communication between "cells"
in the Jailhouse hypervisor.

The vring queue deviates from a standard virtqueue
so is implemented separately.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-05-14 18:17:33 -04:00
Grant Ramsay
244f4f2034 drivers: pcie: Enable filtering PCIe devices by class-rev
This allows finding the correct PCIe device when multiple devices
have the same vendor-id/device-id but differ in the class-rev register

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-05-14 18:17:33 -04:00
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
Anas Nashif
6388f5f106 xtensa: use sys_cache API instead of custom interfaces
Use sys_cache instead of custom and internal APIs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-26 07:31:22 -04:00
Anas Nashif
e195739565 intel_adsp: move utils to a new header
Move utility code into a new header and cleanup soc.h

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-26 07:31:22 -04:00
Ryan McClelland
eb5a52070b drivers: ieee 802.15.4:: fix double-promotions warnings
some floats were getting promoted to doubles or they needed to be
casted as doubles to be used by printf

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-04-26 12:58:28 +02:00
Tristan Honscheid
7803a3a5c5 xec: spi: Remove .cs = NULL in spi_config initializer
Following #56576, the `cs` field in `struct spi_config` is of type
`struct spi_cs_control` instead of a pointer to the same type.
`spi_xec_qmspi_ldma.c:qmspi_xec_init` tries assigning `NULL` to the
`.cs` field through a designated initializer, which causes a compilation
error.

This PR simply removes the `.cs = NULL` line. The designated initializer
will automatically zeroize the underlying GPIO pin info, which should
have the same effect that setting the pointer to NULL did previously.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-04-26 12:58:21 +02:00
Tim Lin
1a2874affb ITE: drivers/i2c: Disable pre-detect on IT82xx2 family
Disable the hardware I2C target detection on the IT82xx2 SoC family.

Note: The register setting of I2C target detection is different in
IT81XX2 and IT82XX2 SOC.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-04-26 12:55:02 +02:00
Guillaume Gautier
f3a8279996 drivers: adc: get resolutions from dtsi for stm32 adc
Simplify the STM32 ADC driver code by using the new ADC resolutions
property in dtsi files.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-04-26 12:53:03 +02:00
Andreas Kilian
a665fc0829 drivers: sensor: Vishay VEML7700 ambient light sensor
Added support for Vishay VEML7700 ambient light sensor
See https://www.vishay.com/doc?84286

Signed-off-by: Andreas Kilian <andreas_kilian@gmx.net>
2023-04-26 12:52:46 +02:00
Declan Snyder
9921c59f40 drivers: lpadc: Make DT props match RM
- Remove build asserts in favor of DT enums
- Remove power level property since it is unused by SDK
- Correct voltage ref value in DT to correspond to
  chip specific values documented in reference manuals
  instead of corresponding to SDK enum names.
- Fix SOC devicetrees affected by these changes.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-04-25 19:59:23 +02:00
Declan Snyder
90570c6b9d drivers: usb_dc_mcux: Fix write performance issues
The MCUX USB device driver currently suffers from
some performance related issues caused by the removal
of the intermediate buffer in commit 4e6f80d37a.
This buffer was essential in the case when some USB
descriptors or data were in a slow access memory,
for example a flash memory accessed over flexspi.
USB DMA as AHB master would try to fetch the data,
but it would be too slow and USB peripheral
could not meet deadlines on the USB bus waiting for it,
and so it would send null packets instead causing errors.

This problem can be fixed by re-introducing an intermediate
buffer in RAM with the data copied from the slow memory by
the core before the USB transfer begins, so that USB DMA
is not responsible for fetching it from flexspi/flash.

Changes to MCUX USB Device Driver:
- Re-add intermediate buffer for USB writes in RAM
- Buffer is not needed for reads, add runtime check
  to avoid copy overhead
- Buffer is not needed for platforms with USB RAM,
  since the USB RAM itself acts as an intermediate buffer.
  Compile with buffer code only when USB RAM is not present on
  the platform, to avoid unecessary copy overhead.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-04-25 12:43:17 -05:00
Francois Ramu
403279cc76 drivers: timer: stm32 adjust lptimer with slow LPTIM clock
Commit to adjust the next_arr with slow LPTIM clock
The next_arr must not be < 0.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-25 10:37:13 -07:00
Francois Ramu
39fab29c10 drivers: timer: stm32 lptim can divide its input clock freq
This PR will divide the LPTIM clock freq to increase the max timeout.
Only one LPTIM instance is considered for PM timer.
The input freq becomes a fraction of the internal PCLK
source (mainly LSE clock). As the tick per sec does not change,
the minimum lptim counter must always be >0.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-25 10:37:13 -07:00
Francois Ramu
23f03c8030 drivers: timer: stm32u5 lptimer waits for DIER complete
On the stm32U5, when modifying the DIER register of the LPTIM peripheral,
a new write operation to can only be performed when the previous write
operation is completed and before going-on.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-25 10:37:13 -07:00
Tomasz Leman
9028ad5d71 drivers: gpdma: pm runtime works only on ace
CAVS platforms are not fully integrated with zephyr. Some of the
registers are still programed from SOF side. This feature can be enabled
for those platforms later when integration is fully done.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-25 16:19:45 +02:00
Tomasz Leman
8575a6037b drivers: gpdma: enable clock gating
This patch is adding function enabling DMA clock gating.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-25 16:19:45 +02:00
Tomasz Leman
77805f3be4 drivers: gpdma: release dma ownership
Adding function that is allowing to release ownership of the DMA. When
DSP is no longer using dma instance it ownership can be released.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-25 16:19:45 +02:00
Tomasz Leman
9ef378f8d2 drivers: gpdma: power off
This patch allows device power manager to disable GPDMA instance when
its no longer in use.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-25 16:19:45 +02:00
Tomasz Leman
705d1c2c04 drivers: gpdma: power flow refactor
This patch is refactoring device power flow routine. DMA instance will
not be power up after kernel initialization if device power management
is enabled. Power menager will power up device and its power domain if
device will be in use and disable it when it's no longer needed.

The DMA disabling part has not yet been implemented.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-25 16:19:45 +02:00
Kumar Gala
4805d7b1ce modem: hl7800: Fix build issue with arm-clang
When building drivers.modem.build we get a link error since
log_source_id_get() is not defined when CONFIG_LOG_MODE_MINIMAL
is defined.

Change ifdef protection to be CONFIG_LOG_RUNTIME_FILTERING
instead of CONFIG_LOG in the code to handle this case.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-25 23:18:54 +09:00
Andrzej Głąbek
7b8170dd27 drivers: flash: nrf_qspi_nor: Mark device as busy when locked
Mark the device as busy when it is locked to perform a flash operation
so that the PM subsystem does not try to suspend it. Also refuse to run
a PM action when the device is busy (in case `qspi_nor_pm_action()` is
called directly, not by the PM subsystem).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-04-25 08:46:50 -05:00
Yonatan Schachter
b5a7949e8a drivers: serial: Added rpi_pico driver over PIO
Implements a UART driver using PIO. Both PIOs are supported.
Only polling API is supported. Only 8N1 mode is supported.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2023-04-25 13:12:02 +02:00
Yonatan Schachter
5abb1b1ec0 drivers: misc: Add driver for RaspberryPi Pico PIO
Added a generic driver for RaspberryPi Pico PIO.
This driver is an intermediate driver for abstracting the PIO
device driver from physical pin configuration.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
Signed-off-by: Ionut Catalin Pavel <iocapa@iocapa.com>
2023-04-25 13:12:02 +02:00
Andriy Gelman
0695c089b5 drivers: spi: spi_xmc4xxx: Use spi_xmc4xxx_flush_rx() and minor cleanups
Re-use spi_xmc4xxx_flush_rx(), remove extra \n and align function
arguments.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-04-25 12:23:26 +02:00
Andriy Gelman
8494b6413a drivers: spi: xmc4xxx: Add DMA support
Adds DMA support for synchronous SPI transfers.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-04-25 12:23:26 +02:00
Gerard Marull-Paretas
9faa60aeda drivers: regulator: allow non-thread-safe reference counting
In some cases, it may be desirable to not have thread-safe reference
counting. For example, when CONFIG_MULTITHREADING=n.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-25 12:23:07 +02:00
Georgij Cernysiov
57cf528418 drivers: flash: fix stm32 ospi prescaler
Original computation seems to be based on
QSPI that has prescaler range [0, 255].
However, OSPI clock prescaler has different
value range [1, 256].

Adapt prescaler computation to valid OSPI
domain and add min value assert.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-04-25 12:21:59 +02:00
Erwan Gouriou
1ea132d95d drivers: ethernet: stm32: Set API V2 as default
Set STM32CubeHAL ethernet version in use as V2 by default, on series
supporting it (H7, F7, F4). Not yet available on F2 series.

Add a choice symbol to explicit V1 version as deprecated.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-04-25 12:20:30 +02:00
Brandon Del Bel
5beb86865e drivers: ethernet: sam0: Fix receive buffer initialization
The SAM GMAC driver is not utilizing the entire receive buffer, causing
large packets to be dropped. Fix it by setting Receiver Packet Buffer
Memory Size Select to Full (RXBMS = 3) in the GMAC_DCFGR register.

Fixes #55701

Signed-off-by: Brandon Del Bel <delbel@umn.edu>
2023-04-25 12:19:52 +02:00
Kumar Gala
1a5d47ef6d modem: wncm14a2a: fix warning with isalpha/isdigit
When building with arm-clang we get warnings of the type:

wncm14a2a.c:828:14: error: array subscript is of type
			   'char' [-Werror,-Wchar-subscripts]:
                } else if (isalpha(c2) != 0) {
                           ^~~~~~~~~~~

Fix this by adding explicit casts to (int) when callinng isalpha()
or isdigit().

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-25 12:19:21 +02:00
Mariusz Skamra
6a92ebfc8e drivers: i2c: rv32m1: Fix compilation errors
This fixes compilation errors caused by using invalid macro parameters.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-25 08:55:57 +00:00
Gerard Marull-Paretas
1e0028ae3d drivers: spi: add spi_cs_is_gpio(_dt) helpers
Add spi_cs_is_gpio(_dt) helpers to check whether SPI CS is controlled by
GPIO or not. This both improves code readability and isolates SPI
internals.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 21:29:55 +02:00
Gerard Marull-Paretas
3f2c2d4130 drivers: spi: make SPI dt-spec macros compatible with C++
As of today it is not possible to use SPI dt-spec macros in C++,
something known and documented. The main reason is because `cs` property
is initialized using a compound literal, something not supported in C++.
This PR takes another approach, that is to not make `cs` a pointer but a
struct member. This way, we can perform a regular initialization, at the
cost of using extra memory for unused delay/pin/flags if `cs` is not
used.

Fixes #56572

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 21:29:55 +02:00
Chen Xingyu
1939a46629 drivers: led: shell: Correct command help of set_brightness
The help text indicates the range of value is 0-255, while the actual
maximum value acceptable is 100.

This commit updates the text to accurately reflect the acceptable
value range for the set_brightness API.

Signed-off-by: Chen Xingyu <hi@xingrz.me>
2023-04-24 16:29:30 +02:00
Gerard Marull-Paretas
f6061a5ea0 drivers: sensor: lm77: use DT_ANY_INST_HAS_PROP_STATUS_OKAY
Replace custom macrology that was checking if any instance had the
int_gpios property with DT_ANY_INST_HAS_PROP_STATUS_OKAY.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 09:21:36 -05:00
Lucas Tamborrino
9eef7996b9 drivers: hwinfo: esp32xx: implements get_reset_cause
Add support for all esp32xx boards and implements
get_reset_cause.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-04-24 15:44:31 +02:00
Roman Dobrodii
f9e2d064c4 drivers/entropy/entropy_gecko_trng: support BG27
Add TRNG support for BG27, which has slightly different register
definitions in HAL, compared to BG22.

Signed-off-by: Roman Dobrodii <rdobrodii@antmicro.com>
2023-04-24 13:35:46 +02:00
Brian Juel Folkmann
f05b6f412e drivers: adc: stm32h5 adc driver must wait about 1ms after enabling
port commit f7f47dc to stm32h5

Without this fix, ADC driver will hang when reading internal channels.

Signed-off-by: Brian Juel Folkmann <bju@trackunit.com>
2023-04-24 13:34:50 +02:00
Mahesh Mahadevan
2612e85753 drivers: spi_mcux: Add DMA support when using ASYNC mode
Enable DMA support when using ASYNCH mode

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-04-24 13:34:29 +02:00
Gerard Marull-Paretas
c66f594c41 drivers: all: rv32m1: remove conditional support for pinctrl
The rvm32m1 platform always uses pinctrl, there's no need to keep
extra macrology around pinctrl. Also updated driver's Kconfig to `select
PINCTRL`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 13:34:22 +02:00
Gerard Marull-Paretas
c4c5f57d59 drivers: all: imx: remove conditional support for pinctrl
The iMX platform always uses pinctrl, there's no need to keep
extra macrology around pinctrl. Also updated driver's Kconfig to `select
PINCTRL`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 13:34:22 +02:00
Gerard Marull-Paretas
b2d9212ea0 drivers: all: mchp_xec: remove conditional support for pinctrl
The Microchip XEC platform always uses pinctrl, there's no need to keep
extra macrology around pinctrl. Also updated driver's Kconfig options to
`select PINCTRL`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 13:34:22 +02:00
Gerard Marull-Paretas
989d103d53 drivers: all: mcux: remove conditional support for pinctrl
The MCUX platform always uses pinctrl, there's no need to keep extra
macrology around pinctrl. Also updated driver's Kconfig options to
`select PINCTRL` (note that some already did).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 13:34:22 +02:00
Findlay Feng
b0baa92f8b drivers: clock_control: stm32: LSE fix in stm32f1x
Power supply and clock need to be enabled before operating BKP

Signed-off-by: Findlay Feng <i@fengch.me>
2023-04-24 13:34:00 +02:00
Kenneth J. Miller
e78e8d7c3f drivers: lora: sx126x: Support fine-grained STM32WL PA config
Add STM32WL-specific sx126x_set_tx_params function based on the
STM32CubeWL modifications to LoRaMac-node.

Add the "power-amplifier-output" DT property to
"st,stm32wl-subghz-radio" for selecting between the RFO_LP and RFO_HP
output configurations provided by the above mentioned function.

Add the "rfo-lp-max-power" and "rfo-hp-max-power" DT properties for
defining the maximum design power of the respective outputs' matching
networks.

closes #48511

Signed-off-by: Kenneth J. Miller <ken@miller.ec>
2023-04-24 13:33:25 +02:00
Francois Ramu
6932838b24 drivers: clock control: stm32f4, stm32f7 driver requires LL_RCC
The stm32f4 and stm32f7 serie has to compile the stm32_ll_rcc
layer to get the LL_RCC_GetSystemClocksFreq function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-24 13:32:29 +02:00
Francois Ramu
a77851b73e drivers: counter: stm32 timer counter driver LL prototype
Adapt the stm32 counter-timer driver to the stm32_ll function
prototype. Some stm32 families have
LL_TIM_OC_GetCompareCHx(TIM_TypeDef some others have
LL_TIM_OC_GetCompareCHx(const TIM_TypeDef.
This will fix compilation warning.
Adds the macro for stm32L0 16bit timers.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-24 13:32:29 +02:00
Alberto Escolar Piedras
157596acf4 nrf52_bsim: drivers/console: Refactor printk backend
Fix a very old cmake warning for the nrf52_bsim due to the
console library being empty.
The printk backend was originally provided by the board
code for simplicity, but this left the console library
empty when building for this board.
Instead refactor that code to where all printk backends are.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-24 13:29:53 +02:00
Alberto Escolar Piedras
7a541714f9 drivers: native_posix_console: Fix if printk is not selected
We should only try to register a printk backend
if printk is compiled in, otherwise we get a link
error.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-24 13:29:53 +02:00
Jamie McCrae
4cdfa7bdd5 retention: Add optional mutex disablement
Adds an optional Kconfig to disable use of mutexes in the
retention subsystem.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-04-24 13:27:53 +02:00
Jamie McCrae
0bf39f4a94 drivers: retained_mem: Add optional mutex disablement
Adds an optional Kconfig to disable use of mutexes in the retained
memory driver.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-04-24 13:27:53 +02:00
Kai Vehmanen
e59e65dc75 drivers: dai: ssp: fix power-up flow for Intel cAVS platforms
A recent commit broke the power-up sequences for other Intel
platforms.

Fixes: 1e5550d262 ("intel_adsp: ace20_lnl: ssp: Program new HW registers")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-04-21 14:02:02 -04:00
Kai Vehmanen
6403c9414b drivers: dai: intel: dmic: fix dmic power-up on cAVS2.5 and ACE1.5
The logic to poll on CPA bit is not working on non-ACE2.0
platforms. This is causing regressions in SOF test suite with
dmic.

Fixes: 2547948544 ("intel_adsp: ace20_lnl: dmic: Program new HW registers for dmic")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-04-21 14:02:02 -04:00
Kumar Gala
fdf78377cd i2c: i2c_xilinx_axi: Fix armclang compile warning
Use PRIxPTR macros to fix compiler warnings of the form:

i2c_xilinx_axi.c:266:50: warning: format specifies type 'unsigned long'
but the argument has type 'mem_addr_t' (aka 'unsigned int') [-Wformat]
        LOG_INF("Configuring %s at 0x%08lx", dev->name, config->base);
                                     ~~~~~              ^~~~~~~~~~~~
                                     %08x

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-21 16:28:09 +02:00
Andrei Emeltchenko
c1fa65eec7 smbus: Change init priority from DEVICE to DEFAULT
Change init priority for SMBus from KERNEL_INIT_PRIORITY_DEVICE (50)
to KERNEL_INIT_PRIORITY_DEFAULT (40) since other devices which depend
on SMBus (like EEPROM) have the same priority.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-04-21 16:26:28 +02:00
Mateusz Sierszulski
0417d38d4d drivers/adc: add Gecko IADC driver
This commit adds the Gecko IADC driver and support for it to the
efr32bg_sltb010a board.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Signed-off-by: Roman Dobrodii <rdobrodii@antmicro.com>
2023-04-21 16:24:39 +02:00
Roman Dobrodii
cb14d8b099 soc/arm/silabs_exx32: fix PM implementation - wake up using BURTC timer
- Add Gecko BURTC sys_clock driver to handle wake up from EM2,3 states
- Remove custom PM policy and dependency on HAL sl_power_manager service
- EM1 supported in all configurations
- EM2,3 supported only if SysTick is replaced by BURTC

Signed-off-by: Roman Dobrodii <rdobrodii@antmicro.com>
2023-04-21 16:24:05 +02:00
Alberto Escolar Piedras
bdb8024df3 drivers: flash simulator: Add more options for POSIX arch
For the POSIX architecture, add options to:
* Clear the flash content at boot
* To delete the file on exit
* To just keep the flash in RAM instead of a file in disk

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-21 16:23:45 +02:00
Matthias Hauser
73ed8ccb5f drivers: sensor: Added driver for the Würth Elektronik WSEN-PDUS sensor
Added driver for the Würth Elektronik WSEN-PDUS sensor

Signed-off-by: Matthias Hauser <Matthias.Hauser@we-online.de>
2023-04-21 07:16:15 -05:00
Filip Kokosinski
0355e085c4 drivers/bluetooth/hci/slz_hci: remove unused const struct device
This commit removes the unused argument form the `slz_bt_init` function,
and makes it consistent with what `SYS_INIT` expects - `int (*)(void)`.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-04-21 12:55:56 +02:00
Kumar Gala
30653bfbed console: uart_mux: Use TYPE_SECTION macros for uart_mux
Clean up uart_mux to utilize TYPE_SECTION macros for handling sections.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-21 12:55:38 +02:00
Krzysztof Boronski
df7f10422e boards: arm: efr32bg27_brd2602: Initial support
Adds initial support for efr32bg27_brd2602 - Thunderboard-style board.
Supported features are:
* counter
* gpio
* uart

Signed-off-by: Krzysztof Boronski <kboronski@antmicro.com>
2023-04-21 12:55:06 +02:00
Aaron Massey
75b2f5abed emul: Fuel gauge tests direct access to emul_sbs
The fuel gauge tests should *not* have to enable CONFIG_SENSOR in order to
get access to the sbs gauge emulator.

Allow fuel_gauge sbs_gauge direct access to emul_sbs_gauge.c

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-04-21 09:39:00 +02:00
Johan Hedberg
02655e5b15 drivers: wdt_tco: Change init level from PRE_KERNEL_1 to POST_KERNEL
All other watchdog drivers also use POST_KERNEL, and it seems on some
platforms where the TCO watchdog is used not all dependencies are yet set
up by the PRE_KERNEL_1 level.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2023-04-20 11:15:12 -04:00
Filip Kokosinski
4a614de289 drivers/bluetooth/hci: add SiLabs BLE HCI driver
This commit adds the SiLabs Bluetooth HCI driver. It also enables this
BLE HCI driver on the efr32bg_sltb010a board.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2023-04-20 16:13:14 +02:00
Alberto Escolar Piedras
905443e8f9 drivers: clock_control_nrf: Fix link error with ASAN and no SHELL
When ASAN is used cmd_status is kept, but it cannot be linked
as the shell module is not present, this prevents ASAN
being used with the nrf52_bsim.
Fix it by conditionally compiling this code only if the shell is
being used.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-20 16:11:34 +02:00
Mahesh Mahadevan
eebd665150 drivers: spi: Fix DMA overflow in NXP MCUX driver
When using a dummy buffer on the RX side, do not
increment the destination memory buffer address.
This issue was uncovered when running the SPI
loopback test.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-04-20 09:07:37 -05:00
Mahesh Mahadevan
629f8d83b5 drivers: dma: mcux_lpc: Update address increment logic
The address increment logic was looking at both source
and destination parameters together. Separate them so
we can set one.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-04-20 09:07:37 -05:00
Yves Vandervennet
788ba12137 nxp: hal: code update to reflect changes in SDK 2.13
HAL API changes in ethernet and pwm
SoC RT595 power management code change
west.yml update

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2023-04-20 08:11:19 -05:00
Ranjani Sridharan
03a91ccc39 drivers: intel: ssp: Fix checked expression in WAIT_FOR()
The function dai_ssp_poll_for_register_delay() is meant to poll the
register until the value of the mask bits is equal to the "val"
argument or until poll timeout has occured. WAIT_FOR() returns the value
of the checked expression, so the check should be modified accordingly.
This should prevent the errors seen during every SSP trigger as below:

<err> dai_intel_ssp: dai_ssp_poll_for_register_delay poll timeout reg 487432 mask 4 val 4 us 125
<err> dai_intel_ssp: dai_ssp_poll_for_register_delay poll timeout reg 487496 mask 63 val 0 us 937

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-04-20 07:26:14 -04:00
Benjamin Björnsson
f08b80054e drivers: adc: adc_emul: Move semicolon to allow for multi-instancing
Move semicolon from end of DT_INST_FOREACH to DEVICE_DT_INST_DEFINE
to make multi-instancing possible. This caused some problems with
CI after adding adc node to native_posix dts.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-20 10:48:33 +02:00
Brandon Del Bel
93930eac90 drivers: spi: sam0: fix DMA init for parts with MCLK peripheral
The spi-sam0 driver does not initialize DMA parameters when the MCLK
peripheral is defined in the microcontroller header file. Fix it by
copying the initialization code from the non-MCLK case.

Signed-off-by: Brandon Del Bel <delbel@umn.edu>
2023-04-20 10:48:21 +02:00
Jackie Yang
c8c67feab0 drivers: sensor: lsm6dsl: Added support for lis3mdl as a external sensor
Added code to support lis3mdl to be used as an external sensor for
lsm6dsl in sensorhub mode

Signed-off-by: Jackie Yang <jackie@jackieyang.me>
2023-04-20 10:48:03 +02:00
Sreeram Tatapudi
185aa1c2c5 drivers: i2c: Add Infineon CAT1 i2c driver
- Add initial version of Infineon CAT1 i2c driver.
 - Add initial version of binding file for Infineon
   CAT1 I2C driver

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2023-04-20 10:44:18 +02:00
Francois Ramu
1b2942ffee drivers: serial: stm32U5 uart driver do not toggle the DMA Tx request
Errata sheet of the stm32U5 (ES0499) recommends to avoid clearing
the DMAT bit with LL_USART_DisableDMAReq_TX to re-start
a DMA transfer on the UART Tx block. The function becomes empty.
This is also seen for stm32H5.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-20 10:44:07 +02:00
Ben Lauret
9cdc5d38b2 drivers: spi: Add driver for smartbond
This adds the SPI driver for the Renesas SmartBond(tm) DA1469x MCU family.
The driver only supports controller mode. All four SPI modes are supported.
Note that the lowest supported speed is 2285714Hz.
Requesting speeds higher than 16MHz, will result in a 16MHz SCLK.

Co-authored-by: Stan Geitel <stan@geitel.nl>

Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2023-04-20 10:32:40 +02:00
Francois Ramu
89636416b5 drivers: flash: stm32 ospi driver defines the dlyb-bypassed property
The delayblock is bypassed when the <dlyb-bypass> property is true.
DT_NODE_HAS_PROP tests whether the property is defined at all,
not whether a boolean property is true or false.
To get a boolean property’s truth value,
use DT_PROP(node_id, prop) instead.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-19 17:13:07 +02:00
Gerard Marull-Paretas
09c5f09109 drivers: counter: mcux_qtmr: fix SYS_INIT call signature
Use the new int f(void) SYS_INIT call signature.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 07:18:54 -05:00
Gerard Marull-Paretas
1eb683a514 device: remove redundant init functions
Remove all init functions that do nothing, and provide a `NULL` to
*DEVICE*DEFINE* macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 10:00:25 +02:00
Tim Lin
bcb173becd tests: drivers: Unit test for it82xx2_evb board
The below is the unit test result for the driver and kernel of
it82xx2_evb board.

GPIO/gpio_basic_api: PASS
I2C/i2c_api: PASS
Flash: PASS
UART/uart_basic_api: PASS
PWM/pwm_api: PASS
WDT/wdt_basic_api: PASS
KSCAN/kscan_api: PASS
kernel/sched/schedule_api: PASS
kernel/sched/preempt: PASS
kernel/timer/timer_api: PASS
kernel/sleep: PASS
ADC/adc_api: PASS.
ADC note: conversion time~=61.6us
          sample time delay~=60us
          wait voltage stable time~=202.8us
Set sampling time to 500us will pass for ADC test.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-04-19 03:48:38 -04:00
Tim Lin
491e3e6477 ITE: drivers/gpio: Add gpio_ite_it8xxx2_v2 driver
This driver is made for it82xx2 series.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-04-19 03:48:38 -04:00
Tim Lin
051bd7098a ITE: dts: it82xx2: Add pinctrl node and kscan's pinctrl
Add the pinctrl node that has been remapped in the chip of it82xx2.
And modify kscan's pinctrl for the it82xx2.
And swap I2C default pins.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-04-19 03:48:38 -04:00
Ruibin Chang
b9a7340ded ITE drivers/interrupt_controller: add intc_ite_it8xxx2_v2 driver
This driver is made for it82xx2 series.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-04-19 03:48:38 -04:00
Hiroki Tada
943158326c drivers: sensor: Support Hamamatsu Photonics S11059 Color Sensor
DataSheet:
https://datasheetspdf.com/pdf/1323325/Hamamatsu/S11059-02DT/1

Testing Environment:
esp32

Signed-off-by: Hiroki Tada <tada.hiroki@fujitsu.com>
2023-04-18 17:07:48 -05:00
Daniel DeGrasse
36cc74e7e8 drivers: gpio: gpio_mcux_lpc: add support for module interrupts
On iMX.RT devices, the number of GPIO pins exceeds the maximum of
64 that the PINT interrupt controller can support. Therefore, two
interrupt lines are now shared between the GPIO modules.

This patch allows the user to set the interrupt source for a GPIO
peripheral. For most LPC devices, this will always be the PINT. For some
RT devices, the PINT cannot use pins on GPIO modules other than 0 and 1
as input, and thus the INTA and INTB sources should be used.

Since Zephyr does not support sharing these interrupt between all GPIO
controllers, the user must configure a subset of all GPIO controllers to
use the shared module interrupts. An example of how to do so is provided
for the RT595 EVK.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-04-18 16:14:57 -05:00
Daniel DeGrasse
b8a99a27cc drivers: gpio: gpio_mcux_lpc: remove PINT code
Remove PINT management code from the LPC GPIO driver, as this code is
now contained within the PINT interrupt controller driver, which exposes
an interface to install interrupt callbacks.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-04-18 16:14:57 -05:00
Daniel DeGrasse
6f938f347b drivers: interrupt_controller: introduce PINT driver
Introduce PINT driver, for NXP pin interrupt and pattern match engine.
The driver currently supports only the pin interrupt feature of the
PINT.

Add DTS entires for the PINT on LPC and RT devices that support this
peripheral, and remove the interrupt defintions that are PINT specific
from the GPIO module on these devices.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-04-18 16:14:57 -05:00
Guillaume Gautier
ceebbf8bcf drivers: bluetooth: hci: update macro name after stm32 hal update
Update macro name that changed in latest STM32 HAL update.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-04-18 18:55:26 +02:00
Pierre-Louis Bossart
6d9afd36af drivers: dai: intel: ssp: don't set ACE2.x LCTL::OFLEN
The OFLEN bit has to be set by the host driver for ACE2.x. The
ownership of the IP is now handled at the host driver level, no longer
the firmware.

Setting it at the firmware level is a no-op if the bit is already set
by the host driver, and will fail it isn't already set.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2023-04-18 10:48:18 -04:00
Jaroslaw Stelter
1659aa2e0c intel_adsp: ace20_lnl: Fix i2svss DT field initialization
This patch fixes i2svss field initialisation in Device Tree for LNL
platform. It fixes this bug: #482

Problem is observed only when using SSP_BLOB_VER_1_5 version.
Unfortunatelly this version is not tested in FW validation tests.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-04-18 10:48:18 -04:00
Jaroslaw Stelter
b75b4153d6 intel_adsp: ace20_lnl: Add I2S clock source configuration
Add I2CLCTL_MLCS programming in SSP driver.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-04-18 10:48:18 -04:00
Jaroslaw Stelter
b252673f13 intel_adsp: ace20_lnl: Fix hang issue on SSP power off
Clearing SPA bit together with OFFLEN bit causes FW hang.
This patch changes sequence to avoid that situation.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-18 10:48:18 -04:00
Jaroslaw Stelter
3b518743d2 drivers: ssp: Program slot number basing on blob
The upper ssp slot number should be retrieved from configuration
blob to support all possible settings. This patch fix this issue.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-18 10:48:18 -04:00
Jaroslaw Stelter
99d5d9aaa8 drivers: ssp: Repleace shim2 with hdamlssp
Repleace usage of shim2 device tree field with hdamlssp.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-18 10:48:18 -04:00
Jaroslaw Stelter
1e5550d262 intel_adsp: ace20_lnl: ssp: Program new HW registers
In LNL platform GPDMA and ALH is no longer used. SSP uses LINK HDA
as a DMA engine. Therefore new shim, new register definitions and new
programming flows were defined.

This patch implements new SSP programming requirements for LNL.
Since HDA is shared between Host and DSP, link_config field was added to
dai_config structure. This one is provided by Host in new IPC4 fields
during interface configuration.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-04-18 10:48:18 -04:00
Andriy Gelman
b8244fdabd drivers: sensor: Add adt7310 temperature sensor
Adds adt7310 temperature controlled via spi.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-04-17 10:06:04 -05:00
Andrzej Głąbek
8fba8aa535 drivers: flash: nrf_qspi_nor: Add custom API function to allow XIP
Normally, the driver deactivates the QSPI peripheral for periods when
no QSPI operation is performed. This is done to avoid increased current
consumption when the peripheral is idle. For the same reason, the base
clock on nRF53 Series SoCs (HFCLK192M) is configured for those periods
with the default /4 divider that cannot be used otherwise. However,
when XIP accesses are used, the driver must be prevented from doing
both these things as that would make XIP to fail. Hence, a function
is provided so that applications can inform the driver that XIP is
needed and the above idle actions should be suppressed.
This function (`nrf_qspi_nor_xip_enable()`) replaces the old one
(`nrf_qspi_nor_base_clock_div_force()`) that was intended for similar
purpose but after deactivation of the peripheral was introduced in
commit 95d867e8ed it became useless.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-04-17 16:43:16 +02:00
Henrik Brix Andersen
36249451ba drivers: rtc: update the RTC menuconfig title to unified format
Update the RTC driver menuconfig title to match the unified format
introduced in c41dd36de2.

Move the RTC driver menuconfig entry so the menuconfig list is still
(mostly) alphabetically sorted.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-04-17 16:34:46 +02:00
Henrik Brix Andersen
407eedbafa drivers: ethernet: add dependency to CONFIG_ETH_INIT_PRIORITY
Add a dependency on CONFIG_NET_L2_ETHERNET for
CONFIG_ETH_INIT_PRIORITY. This hides the Ethernet driver initialization
priority option in menuconfig unless CONFIG_NET_L2_ETHERNET is selected.

CONFIG_ETH_INIT_PRIORITY cannot currently be moved inside the
CONFIG_ETH_DRIVER if-statement in Kconfig as it is used outside the
Ethernet driver source files.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-04-17 16:31:47 +02:00
Martin Jäger
d655d00e8c drivers: eeprom: at2x: initialize after I2C/SPI
Introduce dedicated init priority for AT2X EEPROMs connected via
I2C or SPI to ensure they are initialized after I2C/SPI by default.

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-04-17 16:31:00 +02:00
Matthias Hauser
6789c0d400 drivers: sensor: Added driver for the Würth Elektronik WSEN-PADS sensor
Added driver for the absolute pressure sensor WSEN-PADS

Signed-off-by: Matthias Hauser <Matthias.Hauser@we-online.de>
2023-04-17 11:49:35 +02:00
Robert Hancock
b1c0bf8499 drivers: i2c: add Xilinx AXI I2C driver
Add a driver to support the Xilinx AXI IIC Bus Interface logic core, as
described in Xilinx document PG090. This can be configured for use on
most Xilinx FPGA-based platforms such as the Digilent Arty.

Both the 2.00a and 2.1 versions of the core are supported. The 2.00a
revision has a bug causing dynamic read mode to not be reliable. With
this version of the core the driver falls back to reading only 1 byte
per interrupt.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2023-04-17 11:39:21 +02:00
Thomas Stranger
f8a439561f drivers: clock_control: stm32 common: implement get_status api
The get_status api allows to query whether clock is turned on or off.
Like the get_rate call, the status of gated clocks (for specific
peripherals), as well as domain clock sources(HSE, PCLK, PLL_P,..)
can be checked this way.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-04-17 11:33:15 +02:00
Henrik Brix Andersen
1cfc85bab8 modules: segger: move Kconfig to modules/segger
Move the Segger RTT module Kconfig to modules/segger/kconfig. The Segger
debug library is not a driver and should not reside under drivers/debug.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-04-17 11:21:48 +02:00
Peter Johanson
1432b6e870 drivers: sensor: qdec_nrfx: Typo fix from trigger work.
Fix a typo introduced during move to store pointer to the
user supplied trigger.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2023-04-17 10:20:06 +02:00
Alberto Escolar Piedras
83377046ba drivers: temp_nrf5: Fix warning in ISR prototype
The ISR prototype was changed some time ago
(6df8b3995e)
to (const void*) => fix isr function definition
to avoid a compile warning.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-17 10:19:33 +02:00
Marc Desvaux
3392eb6af3 drivers: hwinfo: modification into hwinfo_get_reset_cause()
add retrieve flag SB into hwinfo_get_reset_cause()
add Clear flag SB into clear_reset_cause()

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-04-17 10:15:35 +02:00
Andy Sinclair
0d68c86c95 drivers: gpio: npm1300: Initial driver for nPM1300 PMIC
Initial GPIO driver for NPM1300 PMIC

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-04-17 10:14:40 +02:00
Andy Sinclair
d1e201ccf6 drivers: regulator: npm1300: Initial driver for nPM1300 PMIC
Initial regulator driver for Nordic NPM1300 PMIC.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-04-17 10:14:40 +02:00
Armando Visconti
15389ea902 modules/hal_st: Align sensor drivers to stmemsc HAL i/f v2.02
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v2.02. Please note that now a new function
callback, mdelay(), must be provided in case the stmemsc HAL requires
to wait for a certain amount of milliseconds before or after some
special operations.

Requires https://github.com/zephyrproject-rtos/hal_st/pull/13
(merged as 5948f7b3304f1628a45ee928cd607619a7f53bbb)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2023-04-14 10:51:15 -05:00
Marcus Folkesson
10818f75e2 drivers: dac: add support for ltc1660/ltc1665
LTC1665/LTC1660 is a 8/10-bit Digital-to-Analog Converter
(DAC) with eight individual channels.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
2023-04-14 08:21:23 -04:00
Erwan Gouriou
8e5a2cd45c drivers: entropy: stm32: Move clock check to post kernel operations
Don't check clock configuration before kernel was started since it
will prevent message to be displayed.
After kernel initialization, message is still valid and then ASSERT
more valuable to the user.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-04-14 14:04:26 +02:00
Gerard Marull-Paretas
667eeb11fb shell: fix MISRA 5.7 violations on struct shell
MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-14 12:21:08 +02:00
Ibe Van de Veire
5fd08a3348 drivers: ethernet: eth_mcux: fixed sleep after carrier activation
The sleep after carrier activation was badly ported so the time
was 1000 ms instead of 1 ms.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@gmail.com>
2023-04-14 09:57:29 +02:00
Ibe Van de Veire
0927250fd2 drivers: ethernet: eth_mcux: fix phy_event state diagram sequence
When the phy_event state diagram ends up in the
eth_mcux_phy_state_read_status case, the eth carrier
is enabled. However, this step only happens when an
interface is available in the context.

Regardless of the state of the iface, the state machine
will switch to eth_mcux_phy_state_read_duplex in the next
iteration. Thus, the states diagram never returns to the
previous state. As a result, the eth carrier will never
be enabled in the future.

This problem is fixed by setting the wait state if the
iface is not available.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@gmail.com>
2023-04-14 09:57:29 +02:00
Pierre-Louis Bossart
a744e8eaf3 drivers: dai: intel: dmic: don't set ACE2.x LCTL::OFLEN
The OFLEN bit has to be set by the host driver for ACE2.x. The
ownership of the IP is now handled at the host driver level, no longer
the firmware.

Setting it at the firmware level is a no-op if the bit is already set
by the host driver, and will fail it isn't already set.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2023-04-13 20:51:10 -04:00
Jaroslaw Stelter
b8d9b833a2 intel_adsp: ace20_lnl: dmic: Add HDA channel map programming
Add new field to dai_config structure and function that
program it in HW register.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-04-13 20:51:10 -04:00
Jaroslaw Stelter
2547948544 intel_adsp: ace20_lnl: dmic: Program new HW registers for dmic
In LNL platform GPDMA and ALH is no longer used. DMIC uses LINK HDA
as a DMA engine. Therefore new shims, new register definitions and new
programming flows were defined.

This patch implements new DMIC programming requirements for LNL.
Since HDA is shared between Host and DSP, link_config field was added to
dai_config structure. This one is provided by Host in new IPC4 fields
during interface configuration.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-04-13 20:51:10 -04:00
Jaroslaw Stelter
dc9f7b44fe intel_adsp: ace20_lnl: dmic: Add new DMIC shims to driver
Add initialization of new DMIC shims to driver for LNL
platform only.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2023-04-13 20:51:10 -04:00
Anisetti Avinash Krishna
79f2b5471c drivers: serial: ns16550: Fixed a bug related to shell failure
Updated boot priority to PRE_KERNEL_1 for all instances
and removed dependency on PCIe. As shell is not working
in a situation where console is using a UART instance
under PCIe and boot priority set to POST_KERNEL.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-04-13 20:50:41 -04:00
Declan Snyder
65aad527b7 drivers: lpadc: Enable VREF in init
Enable VREF peripheral in the LPADC init
so that ADC can measure voltages properly.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-04-13 16:13:25 +02:00
David Leach
70d045fd7a drivers: adc: Add LPADC driver support to lpc55s36
Add LPADC support to LPC55S36 SOC platform

Signed-off-by: David Leach <david.leach@nxp.com>
2023-04-13 16:13:25 +02:00
Guillaume Gautier
b323c0f227 drivers: sensor: stm32_temp: add negative temperature coefficient
Add support for negative temperature coefficient for single calibration
chips in the STM32 temperature driver.
That feature is necessary for STM32F0x0.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-04-13 09:11:45 -05:00
Alberto Escolar Piedras
659e2292a5 soc_inf: Refactor native tasks into own header
The native_tasks definition was directly in the soc_inf soc.h
header. But soc.h pulls a lot of other headers.
Some of those could cause conflicts, say with application
headers, for users who only wanted the be able to register
native tasks in a module.

Let's refactor the native tasks definitions into their own header
and include that header from soc_inf's soc.h.
In this way users who need only need to register a native tasks
can just include posix_native_tasks.h, and all previous users
see no change.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-13 13:35:20 +02:00
Georgij Cernysiov
44e4b077ad drivers: flash: stm32 ospi add dlyb bypass prop
Allows to bypass delay block (DLYB).

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2023-04-13 12:15:13 +02:00
Hake Huang
e01586a03a driver: adc16 dma support async and repeat sample
add support for async call and repeat sample test

1. change the DMA req to 2 byte each
2. increase the buffer pre-dma
3. add protection on invalid buffer

depends on: PR #56104
fixing: issue #56070

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2023-04-13 10:00:24 +02:00
Henrik Brix Andersen
95b8bf3121 drivers: can: mcux: flexcan: add FlexCAN CANFD variant support
Add support for CAN-FD capable variants of the FlexCAN IP core.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-04-13 10:00:03 +02:00
Henrik Brix Andersen
a082565dca dts: bindings: can: rename nxp,kinetis-flexcan binding to nxp,flexcan
Rename the nxp,kinetis-flexcan devicetree compatible to nxp,flexcan as it
is not specific to the NXP Kinetis series.

This is preparation for adding a nxp,flexcan-fd binding.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-04-13 10:00:03 +02:00
Benjamin Björnsson
818738b366 drivers: sensor: stm32_temp: Add support for STM32C0-series
Add new compatible to separate production calibrated sensors
with single and dual calibration temperatures. Also update
stm32_temp driver to support single calibration sensors.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-13 09:59:52 +02:00
Benjamin Björnsson
2f20bcfa0a drivers: sensor: stm32_temp: Remove multi-instancing
STM32 only has one temp instance in hardware.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-13 09:59:52 +02:00
Hein Wessels
6427ba861c drivers: adc: stm32h7: remove oversampling workaround
Removes a workaround that was required while there was a bug in
upstream STM32 HAL drivers where the oversampling was not set
correctly in all cases. This has since been fixed, and also
added to the Zephyr STM32 HAL.

The upstream issue:
https://github.com/STMicroelectronics/STM32CubeH7/issues/177

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-04-13 09:59:42 +02:00
Martin Jäger
d52f6ab025 drivers: i2c: ite: use correct I2C init priority
Use CONFIG_I2C_INIT_PRIORITY instead of
CONFIG_KERNEL_INIT_PRIORITY_DEVICE as introduced in
c8f9f53322.

Looks like the priority was accidentally changed in
f2c42663b4.

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-04-12 20:35:08 -04:00
Maxmillion McLaughlin
840c976760 drivers: disk: sdmmc_stm32 support for clock divisor
Adds support for a devicetree property that controls the ClockDiv
value provided to the SDIO during init.

Signed-off-by: Maxmillion McLaughlin <github@maxmclau.com>
2023-04-12 17:44:48 +02:00
Gerard Marull-Paretas
4863c5f05b sys/util: extend usage of DIV_ROUND_UP
Many areas of Zephyr divide and round up without using the DIV_ROUND_UP
macro. Make use of it, so that we make use of a tested system macro and
at the same time we make code more readable.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 16:42:29 +02:00
Gerard Marull-Paretas
ba9b280893 drivers: can: mcan: remove unused CAN_DIV_CEIL
Macro is not used, so delete it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 16:42:29 +02:00
Gerard Marull-Paretas
a5fd0d184a init: remove the need for a dummy device pointer in SYS_INIT functions
The init infrastructure, found in `init.h`, is currently used by:

- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices

They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:

```c
struct init_entry {
	int (*init)(const struct device *dev);
	/* only set by DEVICE_*, otherwise NULL */
	const struct device *dev;
}
```

As a result, we end up with such weird/ugly pattern:

```c
static int my_init(const struct device *dev)
{
	/* always NULL! add ARG_UNUSED to avoid compiler warning */
	ARG_UNUSED(dev);
	...
}
```

This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:

```c
static int my_init(void)
{
	...
}
```

This is achieved using a union:

```c
union init_function {
	/* for SYS_INIT, used when init_entry.dev == NULL */
	int (*sys)(void);
	/* for DEVICE*, used when init_entry.dev != NULL */
	int (*dev)(const struct device *dev);
};

struct init_entry {
	/* stores init function (either for SYS_INIT or DEVICE*)
	union init_function init_fn;
	/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
	 * to know which union entry to call.
	 */
	const struct device *dev;
}
```

This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.

**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

init: convert SYS_INIT functions to the new signature

Conversion scripted using scripts/utils/migrate_sys_init.py.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

manifest: update projects for SYS_INIT changes

Update modules with updated SYS_INIT calls:

- hal_ti
- lvgl
- sof
- TraceRecorderSource

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: devicetree: devices: adjust test

Adjust test according to the recently introduced SYS_INIT
infrastructure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: kernel: threads: adjust SYS_INIT call

Adjust to the new signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 14:28:07 +00:00
Zhang Lixu
9c9304218b drivers: sensor: lsm6dso: round up to the nearest odr
It was too strict to require the caller to pass in an accurate odr as a
parameter. This patch is to round the odr up to the nearest one, when odr
does not match.

Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
2023-04-12 09:17:05 -05:00
Franciszek Zdobylak
71a6c22731 drivers: memc: implement sifive ddr mem controller
Implementation for DDR memory controller for FU740 SoC.

Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
2023-04-12 13:05:55 +02:00
Thomas Stranger
77d2490164 arch: arm: core: aarch32: rename z_NmiHandlerSet
rename the function that sets the handler for the nmi.
It should be namespaced and not camel-case:
z_NmiHandlerSet to z_arm_nmi_set_handler

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-04-12 08:59:36 +02:00
Andriy Gelman
e537410a74 drivers: serial: uart_xmc4xxx: Minor cleanups
Forward return of dma_start() instead of assigning to ret.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-04-12 08:59:20 +02:00
Andriy Gelman
321254f433 drivers: serial: uart_xmc4xxx: Fix race condition
Fixes a race condition between uart_xmc4xxx_dma_rx_cb() and rx timeout.
Although uart_xmc4xxx_dma_rx_cb() called k_work_cancel_delayable()
to cancel the timeout callback, it would not actually be cancelled if
the callback was already in a running state.

Fix the race condition by checking if dma transaction is already
completed in the timeout callback.

This also fixes unit test tests/drivers/uart/uart_async_api on
xmc45_relax_kit which started to fail after commit
f3afd5a4c9.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-04-12 08:59:20 +02:00
Maureen Helm
e0915eb6ac drivers: sensor: Fix sx9500 build with trigger disabled
Extending tests/drivers/build_all/sensor/ to include missing driver
trigger configurations revealed that some sensor drivers failed to build
with triggers disabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-11 19:25:46 -04:00
Maureen Helm
4c6478dcea drivers: sensor: Fix bmg160 build with trigger disabled
Extending tests/drivers/build_all/sensor/ to include missing driver
trigger configurations revealed that some sensor drivers failed to build
with triggers disabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-11 19:25:46 -04:00
Maureen Helm
ca3e667ac2 drivers: sensor: Fix icm42688 build with trigger enabled
Extending tests/drivers/build_all/sensor/ to include missing driver
trigger configurations revealed that some sensor drivers failed to build
with triggers enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-11 19:25:46 -04:00
Maureen Helm
6643733f26 drivers: sensor: Fix ccs811 build with trigger enabled
Extending tests/drivers/build_all/sensor/ to include missing driver
trigger configurations revealed that some sensor drivers failed to build
with triggers enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-11 19:25:46 -04:00
Maureen Helm
b562807d4f drivers: sensor: Fix bmi270 build with trigger enabled
Extending tests/drivers/build_all/sensor/ to include missing driver
trigger configurations revealed that some sensor drivers failed to build
with triggers enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-11 19:25:46 -04:00
Scott Worley
5c00a83b99 drivers: spi: Microchip XEC QMSPI-LDMA fix spi buffer usage
Zephyr SPI driver model for full-duplex operation assumes
data will be transmitted and received during each clock period.
The QMSPI driver for the XEC family also supported dual and
quad I/O use cases which are inherently half-duplex. To
support dual/quad the driver incorrectly processed spi buffers
as all transmit buffers first then all receive buffers. This
worked if only the SPI driver was used. It did not work with
the Zephyr flash SPI NOR driver which assumes SPI drivers
follow the SPI driver model. This commit implements a QMSPI
driver that follows the Zephyr SPI driver model resulting in
a slightly smaller driver. Dual/quad SPI transactions are
supported if the experimental SPI extended mode Zephyr
configuration flag is enabled. We also remove the QMSPI full duplex
driver added previously to support the flash SPI NOR driver.
Added board to spi loop-back test and spi_flash sample.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2023-04-11 16:57:56 +02:00
Erwan Gouriou
3abb0c9b4b drivers: clock_control: stm32f3: Enable PWR clock to access BDCR
BDCR could be required for LSE or RTC for instance.
Enable it here as for now, no sophisticated PM handling is available
on F3 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-04-11 14:12:22 +02:00
Jamie McCrae
7924c667f3 drivers: timer: nrf_rtc_timer: Implement stop function
Implements functionality to stop the nRF RTC system timer source.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-04-11 12:02:47 +02:00
Gerard Marull-Paretas
6ec50005db drivers: i3c: cdns: remove local DIV_ROUND_UP
The definition is already provided by zephyr/sys/util.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-11 12:00:37 +02:00
Gerard Marull-Paretas
0ebe14beb4 sys: util: migrate all files to DIV_ROUND_UP
ceiling_fraction is deprecated, use DIV_ROUND_UP.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-11 12:00:37 +02:00
Bjarki Arge Andreasen
b0d8f5ec7f drivers/modem/modem_socket: Updated API
The internal socket context struct modem_socket_config
currently has members accessed directly by user. The
modem_socket_init() function has been updated to take all
user configurations as args. Thus removing the need for
the user to directly access the internal context for
initialization.

The user also currently needs to know of internal modem
socket libary behavior to determine if a socket has been
allocated and assigned an id, this is documented, and is
not safe. The functions:
 modem_socket_is_allocated()
 modem_socket_id_is_assigned()
 modem_socket_id_assign()
have been added to the modem socket library API to perform
these checks, and to assign socket ids.

This commit makes use of the modem socket library safer and
adds documentation to the API.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-04-11 11:42:00 +02:00
Bjarki Arge Andreasen
aa6ecc59d1 drivers/modem/modem_cmd_handler: Update API
There is currently not a clear separation between
user configuration and internal context when using the
modem_cmd_handler library. This update adds a clear
separation, placing user configuration in a seperate
struct passed to modem_cmd_handler_init alongside the
internal context modem_cmd_handler_data.

There is also a lack of documentation of the user
configurations, these have been added to the new config
struct.

The new API function modem_cmd_handler_process has been
added to remove the need for the user to directly access
the process member of the internal context. This ensures
that the user is not encouraged to access any internal
context members.

Some whitespace errors exist in the modem_cmd_handler.c
file, these are outside of the scope of this PR. These
can be addressed in a later PR as they are not functional
changes.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-04-11 11:42:00 +02:00
Bjarki Arge Andreasen
a4afcf8c93 drivers/modem/modem_iface_uart: Update API
The UART IFACE API currently exposes the context struct
modem_iface_uart_data, expecting the user to fill in some
of the fields, with no documentation specifying which fields
and what they mean.

This API update moves all user configurable values in the context
out into a config struct, modem_iface_uart_config, within which
members are documented.

This prevents the user from interacting directly with the context
making use of the library safer and more readable.

The config structure helps make code readable by using "named args"
in a const struct instead of a long, nameless, parameter list passed
to the modem_iface_uart_init function.

The new API function modem_iface_uart_rx_wait is added to prevent the
user from having to interact with the rx sem in the context directly.

The context can now be safely interated with without direct access to
any of its members.

Pointers to the ring buffer params in the context have been moved to
config struct, as these are only useful during initialization of the
context.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-04-11 11:42:00 +02:00
Huifeng Zhang
28ff3e1d8c drivers: eth_smsc91x: Add driver for SMSC91C111 aka LAN91C111 chip
Arm fvp_baser_aemv8r and fvp_base_revc_2xaemv8a boards are using
SMSC91C111 as their ethernet adapters.

Portions of the codes are based on FreeBSD code from its
'src/sys/dev/smc/if_smc.c' and 'src/sys/dev/smc/if_smcreg.h'.

This driver has two parts, one is the ethernet controller driver, which
is MAC layer driver. The other is the MDIO driver, which is the PHY
layer driver. Both of them are in the same source file due to that they
need to share the same reading and writing register functions and
the smsc object.

The mdio driver is needed by the existing 'phy_mii' driver, which is
a driver for the generic MII-compliant PHY.

This driver was developed under the fvp_base_revc_2xaemv8a target and
has been tested on the fvp_baser_aemv8r target.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-04-11 11:27:05 +02:00
Huifeng Zhang
3d58697d7d drivers: phy_mii: Remove the unneeded header file
Remove the 'soc.h' to fix the compiling error as the 'phy_mii.c'
doesn't need it.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-04-11 11:27:05 +02:00
Weiwei Guo
08ece57b9e sensor: bmm150: Add I2C-base or SPI-base interface in build time
move DT_DRV_COMPAT to bmm150.h. so that can be decide which interface
to use.

define struct bmm150_bus_io interface for bmm150_i2c.c and bmm150_spi.c
in bmm150.h.

redefined bus operation interface in bmm150.c, this allow the driver
to decide which interface to use during construction.

Signed-off-by: Weiwei Guo <guoweiwei@syriusrobotics.com>
2023-04-11 11:26:47 +02:00
Fabio Baltieri
b76ac9a851 input: convert the kscan_sdl driver from kscan to input
Convert the SDL driver to use the input subsystem. This is specifically
meant to emulate touchscreen drivers, so it's setup to send triplet of
x, y, touch for touch-on events and just touch off on touch off events.

Renamed the driver to input-sdl-touch since now we can also develop an
sdl driver for simulating key events.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-04-11 09:34:23 +02:00
Maureen Helm
da633c6148 drivers: sensor: wsen_tids: Store sensor trigger as a pointer
Fixes the wsen_tids sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
a392d8727c drivers: sensor: wsen_itds: Store sensor trigger as a pointer
Fixes the wsen_itds sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
cb28e8321e drivers: sensor: wsen_hids: Store sensor trigger as a pointer
Fixes the wsen_hids sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
078024515b drivers: sensor: vcnl4040: Store sensor trigger as a pointer
Fixes the vcnl4040 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
07632a931f drivers: sensor: tmp108: Store sensor trigger as a pointer
Fixes the tmp108 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
e43edc95d5 drivers: sensor: tmp007: Store sensor trigger as a pointer
Fixes the tmp007 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
56927686b3 drivers: sensor: sx9500: Store sensor trigger as a pointer
Fixes the sx9500 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
5ca231ae91 drivers: sensor: stts751: Store sensor trigger as a pointer
Fixes the stts751 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
4a97373f15 drivers: sensor: sm351lt: Store sensor trigger as a pointer
Fixes the sm351lt sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
0c1c77889c drivers: sensor: sht3xd: Store sensor trigger as a pointer
Fixes the sht3xd sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
6836d03dc0 drivers: sensor: qdec_nrfx: Store sensor trigger as a pointer
Fixes the qdec_nrfx sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
ddf78eb7b8 drivers: sensor: pcnt_esp32: Store sensor trigger as a pointer
Fixes the pcnt_esp32 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
19b9bb800a drivers: sensor: mpu9250: Store sensor trigger as a pointer
Fixes the mpu9250 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
b7e97e2807 drivers: sensor: mpu6050: Store sensor trigger as a pointer
Fixes the mpu6050 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
6ae88621d2 drivers: sensor: mcux_acmp: Store sensor trigger as a pointer
Fixes the mcux_acmp sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Maureen Helm
958b7abd26 drivers: sensor: mcp9808: Store sensor trigger as a pointer
Fixes the mcp9808 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-04-08 18:38:02 +02:00
Al Semjonovs
5d4352f322 sensor: Generic driver for NTC Thermistor
Driver for NTC Thermistors attached to ADC

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-04-07 16:23:17 -05:00
Al Semjonovs
9fa35bc9a0 adc: Add TI ADS7052 SPI driver
Add driver for TI ADS7052.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-04-07 16:23:17 -05:00
Benjamin Lindqvist
7d23e03566 drivers: sensor: bmi270: Add support for motion, DRDY triggers
This commit adds support for ANY_MOTION and DATA_READY interrupts for
the BMI270. To implement this, a different config blob than the
"max_fifo" blob has to be used.

Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
2023-04-07 18:58:16 +02:00
Ben Lauret
6cf3fe1d3f drivers: i2c: Add driver for smartbond DA1469x device family
This adds the i2c driver for the Renesas SmartBond(tm) MCU family.
It supports blocking transfers and callback transfers.
Currently only supports controller mode.

Co-authored-by: Stan Geitel <stan@geitel.nl>

Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2023-04-07 10:09:37 -05:00
Nick Ward
162c47ffc4 drivers: sensor: add mcp970x thermistor IC
Add driver for:
  MCP9700/9700A and MCP9701/9701A
  Low-Power Linear Active Thermistor ICs

http://ww1.microchip.com/downloads/en/devicedoc/20001942g.pdf

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-04-07 13:30:59 +02:00
Manimaran A
535d64cd44 drivers: peci: microchip: Enabled low power mode
Updated the PECI driver to support low power mode.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-04-07 13:30:40 +02:00
Andrei Emeltchenko
15738e5b2c edac: ibecc: Use GENMASK64() macro
Use recently introduced GENMASK64() macro. Although it does not make
difference for the target platform, it makes code clearer.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-04-07 13:30:27 +02:00
Tomasz Bursztyka
a8fc5f4c53 drivers/nvme: Add concurrent access control over Disk API functions
This is currently the only end-point where multiple threads can access
the NVMe device (all calls are synchronous).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-04-07 13:28:47 +02:00
Tomasz Bursztyka
a413af54f6 drivers/nvme: Integrate to disk subsystem
Hooking each namespace to the disk subsystem at runtime.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-04-07 13:28:47 +02:00
Tomasz Bursztyka
e348415d1c drivers/nvme: Support data bigger than a memory page
Pre-allocating PRP list for such purpose. Which PRP list is relevantly
filled in depending on the data size and data pointer page alignment.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-04-07 13:28:47 +02:00
Tomasz Bursztyka
22db7b76ad drivers/nvme: Add namespace support
Based on FreeBSD's implementation made by James Harris, Intel Copyright
2012-2016.

Namespace in this context, will be a disk. It's not exposed from DTS, as
an actualy NVMe hardware controller card can bring more than one
namespace (disk).

Thus namespace are not instanciated through the device driver model, but
statically allocated and runtime configured, depending on what the
controller exposes.

By default the amount of namespace supported is one as it is the most
common setup.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-04-07 13:28:47 +02:00
Tomasz Bursztyka
7499fae5cd drivers/nvme: Add command infrastructure
Based on FreeBSD's implementation made by James Harris, Intel Copyright
2012-2016.

This is the corner stone of the whole NVMe logic: sending commands and
getting replies, all through memory shared from the host to the
controller.

Then using it to inialize admit/IO queues and identifying the
controller.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-04-07 13:28:47 +02:00
Tomasz Bursztyka
b7d4d74e03 drivers/disk: Add NVMe controller support
Based on FreeBSD's implementation made by James Harris, Intel Copyright
2012-2016.

Since Zephyr does not propose any advanced interfaces as FreeBSD (bus
abstractions, memory and DMA abstraction and many more), this comes with
a much simplified and Zephyr-ish way to instanciate, initialize and use
NVMe controller.

ToDo: IO Queues cannot be more than 1. Macros will need to be improved to
manage the case of 2+ IO queues.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-04-07 13:28:47 +02:00
Loic Poulain
df7871c412 wifi: eswifi: Add support for wifi mgmt status command
Implement wifi iface status interface.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-04-07 13:27:12 +02:00
Loic Poulain
78940f52fc wifi: eswifi: Add status work to track connection
There is no event reporting WiFi disconnect, create a polling
work for this and report the event.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-04-07 13:27:12 +02:00
Loic Poulain
c8f48681ed wifi: eswifi: Fix socket client initialization
It has been observed that sockets can be in bad state after
boot. Be sure to correctly reset local port and any 'server'
mode before configuring client mode.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-04-07 13:27:12 +02:00
Loic Poulain
836ace829b wifi: eswifi: Fix infinite offloaded poll
- We should wait indefinitely if msecs is -1 (FOREVER).
- We can directly return if data is already available in FIFO.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-04-07 13:27:12 +02:00
Loic Poulain
54e8d10e61 wifi: eswifi: Fix UDP receiving
There is no listen or accept for UDP, we need to enable the UDP
server mode (P5=1) as soon as bind is complete.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2023-04-07 13:27:12 +02:00
Rodrigo Cataldo
04f519a7c3 drivers: interrupt_controller: imply the need for dynamic memory in ITS
The implementation of GIC v3 ITS uses k_aligned_malloc(), which will
only work if dynamic memory is available (system heap). Tell the user
that a dynamic memory pool is required.

The amount of memory will depend on registers probed during runtime.

Signed-off-by: Rodrigo Cataldo <rodrigo.cataldo@huawei.com>
Co-authored-by: Henri Xavier <datacomos@huawei.com>
2023-04-07 13:26:01 +02:00
Sylvain Chouleur
705e1e7916 dma_dw: separate intel specific registers from synopsys ones
CFG register uses fields that are not defined in Synopsys databook of
Designware AHB DMA Controller.

Since current Zephyr code uses this driver only for the
intel_adsp_gpdma driver I assume that those fields are specific to
this DMA which is not the standard Designware one.

This patch allows to use either the standard Designware register or
the Intel one.

Signed-off-by: Sylvain Chouleur <schouleur@graimatterlabs.ai>
2023-04-07 13:22:25 +02:00
Armin Brauns
82d6fe700c drivers: ethernet: stm32: avoid unnecessary casts, silence warnings
There is no need to use *_cmp_raw() functions here, all they do is cast the
pointers to in(6)_addr* and call the non-raw functions. Additionally, this
fixes a warning for the net_ipv6_addr_cmp_raw() call, which didn't cast the
arguments correctly.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-04-07 13:21:07 +02:00
TOKITA Hiroshi
d4feadc329 drivers: spi: pl022: Add support DMA transfer
Add supporting DMA-based transfer for PL022 SPI.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-04-07 13:20:16 +02:00
Alexander Razinkov
1e9c7a9ad6 drivers: timer: added MTIMER_DIVIDER register initialization
Syntacore RISC-V platforms have dedicated MTIMER_DIVIDER register which
should be configured during the Timer initialization.

The configuration of dedicated MTIMER_DIVIDER register could now
be performed during initialization if its address is provided.

Signed-off-by: Alexander Razinkov <alexander.razinkov@syntacore.com>
2023-04-07 13:19:56 +02:00
Corey Wharton
46ba5e5518 drivers: i2c: i2c_dw: add bus mutex
This change adds a mutex to protect against simultaneous access to the bus
instead of returning an error during transfers. Since most I2C code doesn't
handle retries (especially with a -EIO code) not blocking on a mutex can
cause a number of problems.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2023-04-07 13:17:43 +02:00
Weiwei Guo
88f0793025 sensor: bmp388: Add I2C-base or SPI-base interface in build time
move DT_DRV_COMPAT to bmp388.h. so that can be decide which
interface to use.

define struct bmp388_bus_io interface bmp388_i2c.c and bmp388_spi.c.

redefined bus operation interface in bmp388.c, this allow the driver
to decide which interface to use during construction

Signed-off-by: Weiwei Guo <guoweiwei@syriusrobotics.com>
2023-04-07 13:14:00 +02:00
Shun Jing Goh
9d7c51e3fb drivers: console: uart_console.c: add LF detection
Add case \n, so that new line from unix or linux host can be detected.

Signed-off-by: Shun Jing Goh <shun.jing.goh@gmail.com>
2023-04-07 13:13:40 +02:00
Marc Reilly
d485824926 sensor: ms5837: support -02 variant
This adds support for the -02 variant, as well as the existing -30.
The sensor type is automatically read from configuration register at
device init, an appropriate compensation func is set up

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2023-04-07 13:13:01 +02:00
Marc Reilly
99ce8cf910 sensor: ms5837. fix unsigned underflow in compensation calc
This fixes a bug where the temperature difference was being done as
unsigned and so could underflow.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2023-04-07 13:13:01 +02:00
Marc Reilly
b4c31fd438 sensor: ms5837: pressure values in kPa
The sensor interface specifies pressure values in units of kPa, so change
here to be consistent.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2023-04-07 13:13:01 +02:00
Caspar Friedrich
691228ce01 drivers: ds2482-800: Add driver
This adds a driver for the DS2482-800 1-wire multi channel bus driver.
The driver uses a split architecture in order to share a common lock
among all configured channels of a single IC.

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2023-04-07 13:11:54 +02:00
Caspar Friedrich
8b621e3bde drivers: ds248x: Fix naming
ds248x no longer applies to all drivers. Therefore the naming indicates
compatibility with DS2482 and DS2484 drivers.

Also
- Fix some code formatting

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2023-04-07 13:11:54 +02:00
Francois Ramu
10e296f3f1 drivers: flash: stm32 ospi driver for the stm32h5x
With the stm32h5x, hal driver is xspi for octospi
Add a header file to map functions and constants.
The ospi driver of the stm32H5x serie does not support DMA yet.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-07 08:33:51 +00:00
Benjamin Björnsson
05e9387663 drivers: adc: adc_stm32: Add support for C0-series
Add support for ADC on STM32C0-series.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-04-07 08:18:03 +00:00
Mahesh Mahadevan
174824f1cb drivers: gpio: Update NXP GPIO driver for the updated IP Block
1. Move the GPIO mux setting to the soc layer. The GPIO MUX
value may vary based on the SoC Family
2. Enable the digital input buffer if available

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-04-06 14:14:11 -05:00
Anas Nashif
402ac9e409 drivers: remove references to old CAVS platforms
Remove reference to all dropped CAVS platforms in drivers.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-04-06 18:51:56 +02:00
Sung-Chi Li
532bd562fa drivers: gpio: numicro: Implement enable/disable pin interrupt
Implement the GPIO_INT_MODE_ENABLE_ONLY and GPIO_INT_MODE_DISABLE_ONLY
on numicro GPIO driver.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Sung-Chi Li
db379eee6f driver: gpio: npcx: Implement enable/disable pin interrupt
Implement the GPIO_INT_MODE_ENABLE_ONLY and GPIO_INT_MODE_DISABLE_ONLY
on npcx GPIO driver.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Sung-Chi Li
ab77ce0cb8 drivers: gpio: stm32: Implement enable/disable pin interrupt
Implement the GPIO_INT_MODE_ENABLE_ONLY and GPIO_INT_MODE_DISABLE_ONLY
on stm32 GPIO driver.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Sung-Chi Li
1f7b0c440d drivers: gpio: it8xxx2: Implement enable/disable pin interrupt
Implement the GPIO_INT_MODE_ENABLE_ONLY and GPIO_INT_MODE_DISABLE_ONLY
on it8xxx2 gpio driver.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Sung-Chi Li
21b2d3aa63 drivers: gpio: Implement pin interrupt enable and disable
Implement the driver method pin_interrupt_enable and pin_interrupt_disable.
This commit fixes getting the get_pending_int by updating the interrupts
field in the gpio_emul_data filed when interrupt is triggered. Also,
introduces a new filed enabled_interrupts to better simulate the
behavior of the interrupt pending and whether the interrupt is
enabled/disabled.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Sung-Chi Li
b78208960d drivers: gpio: Add APIs for enabling/disabling interrupt
Add pin_interrupt_enable and pin_interrupt_disable in gpio_driver_api,
and add corresponding APIs in gpio.h for application to enable/disable
an interrupt without reconfiguring again.
This CL also Create a new Kconfig option for this feature.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Rico Ganahl
bd5960da1d drivers: display: ltdc: add window property
Allow to use only a part of the display.

Signed-off-by: Rico Ganahl <rico.ganahl@bytesatwork.ch>
2023-04-06 11:51:06 +02:00
Rico Ganahl
84fc689d48 drivers: display: introduce otm8009a
Initial support for otm8009a display.

Signed-off-by: Rico Ganahl <rico.ganahl@bytesatwork.ch>
2023-04-06 11:51:06 +02:00
Rico Ganahl
06c58fdcc2 drivers: mipi_dsi: Introduce STM32H7 DSI host driver
Initial STM32 MIPI DSI host driver.

Signed-off-by: Rico Ganahl <rico.ganahl@bytesatwork.ch>
2023-04-06 11:51:06 +02:00
Rico Ganahl
a9c59d417e drivers: display: stm32_ltdc: pinctrl optional
Use the LTDC in combination with the DSI HOST makes the pinctrl obsolete.
DSI HOST has dedicated pins.

Signed-off-by: Rico Ganahl <rico.ganahl@bytesatwork.ch>
2023-04-06 11:51:06 +02:00
Ranjani Sridharan
c56f5d53b7 drivers: ssp: Ignore link clock_source for non-ACE platforms
Ignore the link clock_source for non-ACE platforms instead of throwing
an error when it is set in the topology.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-04-06 11:50:27 +02:00
Kumar Gala
161ca0376f drivers: intc: mchp_ecia_xec: Ensure correct device init order
We need to ensure that the XEC GIRQs are initialized after the
XEC ECIA device.  Right now we depend on the linker ordering
things correctly since everything is at INTC_INIT_PRIORITY
priority

Set the XEC GIRQs to 41 so the init priority is one more than
INTC_INIT_PRIORITY that is used by xec-ecia.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-06 11:50:13 +02:00
Anisetti Avinash Krishna
2d03aaf99f drivers: serial: ns16550: Add support for Async APIs
Added support for async APIs for ns16550. This will be
enabled by kconfig CONFIG_UART_ASYNC_API.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-04-06 07:50:42 +00:00
HaiLong Yang
3d5de8920b drivers: spi: gd32 fix a transceive error
There have an extral TBE interrupt event though we have cleared the
SPI_CTL1_TBEIE bit. To cover this situation, add a on_going check
before enter exchange function.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2023-04-05 20:44:54 +00:00
Jerzy Kasenberg
884d7ea706 drivers: clock_control: smartbond: initial support
This commit adds basic support for the clock controller used in
SmartBond MCUs.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-04-05 15:09:04 +02:00
Pawel Czarnecki
3c44d380e4 drivers: watchdog: gecko: enable watchdog clock
This clock signal needs to be enabled after it was selected.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-04-05 12:48:24 +00:00
Francois Ramu
d574636b78 drivers: counter: add the support of the RTC to the stm32h5
Add the stm32h5 serie to the stm32 RTC counter driver
EXTI Line is 17 (for stm32h50x or non-secure stm32h56x/h57x).
The drivers must Enable access to the BackUp Domain.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-05 10:39:19 +00:00
Pieter De Gendt
6b532ff43e treewide: Update clock control API usage
Replace all (clock_control_subsys_t *) casts with (clock_control_subsys_t)

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-05 10:55:46 +02:00
Keith Packard
6dd86fdb39 drivers/ieee802154: Cast float abs param to int first
This case takes a float value and passes it to the integer abs function,
storing the result in an integer type variable. That looks like a possible
error to clang, so insert an explicit cast to int to make the compiler
happy.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-05 10:38:34 +02:00
Tomasz Leman
98b89d5f9a drivers: dmic: set initial state as off
With this patch DMIC device after init will be in OFF state. When power
domain will be powered-up device will switch into suspended state and
change it to active only when is used.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-05 08:31:16 +02:00
Tomasz Leman
0a00253313 driver: ssp: set initial state as off
Since the device need to be first powered-up by the power domain, it has
more sense that device is in off state at the beginning.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-04-05 08:31:16 +02:00
Francois Ramu
64f6503eba drivers: flash: stm32 qspi driver with a valid dma and its channel
Fix the dma instance when a DMAMUX is enabled.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-04 10:08:07 -05:00
Bjarki Arge Andreasen
ae36da516a boards/posix/native_posix: Add emulated RTC device driver
The emulated RTC device driver is used to emulate a real
RTC device. Note that it is not a replacement for the
native_rtc module, which is used to control simulated time,
get time from the host system, etc.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-04-04 17:03:38 +02:00
Bjarki Arge Andreasen
ac697d153d tests/drivers/rtc: Add unit tests for RTC devices
This test suite adds tests for the following:

- Setting and getting time
- Validating time is incrementing correctly
- Validating behavior of alarms with callback disabled
- Validating behavior of alarms with callback enabled
- Validating update callback

The test suite uses the devicetree  alias rtc to find
the device to test.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-04-04 17:03:38 +02:00
Bjarki Arge Andreasen
b557a1d711 include/drivers: Add RTC API header and handlers
This commit adds the rtc.h header file which contains
API functions for real-time-clocks, which are low power
devices which track and represent broken-down time.

It also changes one line of doxygen documentation in the
maxim_ds3132.h file to place it in its own group.

The handlers for use of the API from userspace is also
added with this commit.

The API is split into one mandatory section, setting and
getting time, and three optional sections, alarms, update
event callback, and clock calibration.

Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
2023-04-04 17:03:38 +02:00
Sylvio Alves
4c86a44bcd driver: usb_serial: esp32c3: fix USB port behavior
- Fixes missing poll out events when UART interrupt is enabled
- Fixes blocking USB interface during board start up.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-04-04 14:30:15 +02:00
Kumar Gala
a29bc8d086 adc: fix armclang compiler warnings with is*() functions
We get compile warnings of the form:

error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
 [-Werror,-Wint-in-bool-context]
                if (!isprint(byte)) {
                     ^

Since isprint (and the other is* functions) return an int, change check
to an explicit test against the return value.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-04 14:07:14 +02:00
Henrik Brix Andersen
2ff049d652 drivers: peci: move CONFIG_PECI_INTERRUPT_DRIVEN inside if statement
Move CONFIG_PECI_INTERRUPT_DRIVEN inside the CONFIG_PECI if statement to
avoid showing it in menuconfig when PECI drivers are disabled.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-04-04 13:49:52 +02:00
Kumar Gala
77f6e0a501 wncm14a2a: fix armclang compiler warnings with is*() functions
We get compile warnings of the form:

error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
 [-Werror,-Wint-in-bool-context]
                if (!isprint(byte)) {
                     ^

Since isprint (and the other is* functions) return an int, change check
to an explicit test against the return value.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-04 13:48:09 +02:00
Andrzej Głąbek
7058f3722e drivers: uart_nrfx_uarte: Revert workaround for bytes dropping
This effectively reverts the following three commits:
- 0f9f18843f
- 6812441099
- 326f7bd450
and also the changes that got copied to the nrf5340_audio_dk_nrf5340
board.

The workaround brings more harm than good. It already required many
tweaks in various tests to make them pass (because it introduced
a significant overhead in processing of the console UART interrupt)
and now it makes the I2S driver tests to fail. It's not reasonable
to add more tweaks in Zephyr tests just to keep this workaround in
the tree. Instead the root cause should be fixed (if the original
problem still occurs).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-04-04 13:45:17 +02:00
Pawel Czarnecki
9f10881f1d drivers: uart: gecko: add support for efr32xg24
Add missing case when there is only one USART

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-04-04 13:34:45 +02:00
Pawel Czarnecki
a56ca2df97 drivers: gpio: gecko: add support for efr32xg24
Add defined() check for EFR32MG24

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-04-04 13:34:45 +02:00
Jeppe Odgaard
1ef0649825 drivers: sensor: mcux qdec add filter parameters
Add optional filter value properties. The filter is disabled by default
but can be enabled by setting the filter-sample-period > 0 in the dts
file. A latency is introduced if the filter is enabled. The latency can
be printed by setting sensor log level to debug.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-04-04 08:54:43 +00:00
Jeppe Odgaard
8820f95199 drivers: sensor: mcux qdec improve counts_per_revolution checks
Fix inconsistency between compile-time and runtime check on
counts_per_revolution. Add macro to simplify compile-time prop value
checks.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-04-04 08:54:43 +00:00
Fabio Baltieri
aac23e5bf7 input: convert the ft5336 driver from kscan to input
Convert the ft5336 to the input subsystem, fix all the config in the
repository and add the Kscan compatibility driver to the current dts
driver instances.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-04-04 08:43:06 +02:00
Tom Burdick
2a5de5fc30 spi: Remove extranous logging message for SAM
Mistakenly left a log message in with the RTIO work, remove.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-04-03 21:53:17 +00:00
Pieter De Gendt
cd6fe580b0 drivers: gpio: Add NXP SC18IM704 GPIO support
Implement external GPIO controller driver with NXP's SC18IM704 device.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-03 20:02:51 +02:00
Pieter De Gendt
9b36e723f4 drivers: i2c: Add NXP SC18IM704 I2C support
Implement external I2C controller driver with NXP's SC18IM704 device.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-03 20:02:51 +02:00
Fin Maaß
cabc30c725 drivers: sensors: Implement MAX31865 sensor
This commit implements the temperature sensor interface for
the Maxim MAX31865 SPI Temperature Sensor.

Signed-off-by: Fin Maaß <fin.maass@haw-hamburg.de>
Co-authored-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-04-03 12:32:50 -04:00
Madhurima Paruchuri
2535b1542b drivers: sbs_gauge: Rename atRate properties to include 'SBS'
Add the term 'SBS' in atRate properties and Battery mode property name,
as they are specific to SBS

Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>
2023-04-03 17:53:42 +02:00
Madhurima Paruchuri
9727cafb41 drivers: sbs_gauge: Add support for AtRate properties
BatteryMode(w), AtRate(r/w), AtRateTimeToFull(r), AtRateTimeToEmpty(r)
and AtRateOK(r)

Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com>
2023-04-03 17:53:42 +02:00
Mahesh Mahadevan
793f1dacec drivers: adc_mcux_lpadc: Fix the config initilization
offset_b of the config structure was never initialized.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-04-03 10:22:27 -05:00
Armin Brauns
f57c97ee2d drivers: intc: stm32: allow same callback to be set again
Setting the same callback with the same data as is already configured
should not cause an error.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-04-03 14:48:36 +00:00
Tom Burdick
dcd9322d43 spi: SAM add RTIO support
Implements the SPI RTIO API. Refactors many of the internal transfer
functions to work on simple types to allow for both the RTIO and existing
SPI API functions to co-exist.

Removes the unneeded shift_master specialization. Either a polling or DMA
transfer flow is used when used with RTIO as all operations are normalized.

When SPI_RTIO is enabled the spi_transceive blocking call translates
the request into an RTIO transaction placed in the queue of transactions
the device is meant to do.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-04-03 09:51:02 +02:00
Tom Burdick
d9d24b4d65 spi: Add RTIO support to SPI
Provides a macro and submit API for SPI drivers to support RTIO.

A copy function enables compatibility with the existing blocking API
and very easily the existing async API as well.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-04-03 09:51:02 +02:00
Francois Ramu
3f6a3d6031 drivers: adc stm32adc driver for the new stm32h5 serie
Add the support of the new stm32h5 to the stm32 ADC driver
Note : LL_ADC_CLOCK_ASYNC_DIV6 is the value for getting the
expected results of ADC.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-03 09:50:43 +02:00
Lucas Tamborrino
b100ffb1df drivers: spi: esp32xx: Fix word size issue
This commit fixes the word size configuration issue
described in #54746 by considering the data frame size
when trasmitting in case the configuration is applied.

It also fixes an heap corruption problem when using
SPI DMA with a buffer that is not multiple of 32 bits
in lenght and GDMA instance in initialization.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-04-02 22:07:55 -04:00
Kumar Gala
d82175eadd gpio: fix armclang compiler warnings with is*() functions
We get compile warnings of the form:

error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
 [-Werror,-Wint-in-bool-context]
                if (!isprint(byte)) {
                     ^

Since isprint (and the other is* functions) return an int, change check
to an explicit test against the return value.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-01 12:31:58 -04:00
Ryan McClelland
28bb21cfe6 drivers: i3c: cdns: set tx fifo threshold interrupt to half the fifo
When a controller is running at full SDR speed at 12.5MHz, there needs
to be enough time for the processor get around to writing more data in
the fifo. Previously at -1 the size, this was enough for 1MHz with a
decent processor, but not enough at a 12.5MHz SCL.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-04-01 07:37:03 -04:00
Francois Ramu
93a1b61684 drivers: dma: stm32u5 dma driver with two dma instances
Add a second instance of DMA to the stm32 dma driver from the DTS
That can be found in the stm32H5 serie, where 2 GPDMA with 8 channels
are available. Rebuilding with Macro.
Use the dma_channels property of the dedive tree to count the nb
of dma channels: 16 or 8 (like in stm32h5).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-31 14:02:15 +02:00
Kumar Gala
8d5392513e console: fix armclang compiler warnings with is*() functions
We get compile warnings of the form:

error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
 [-Werror,-Wint-in-bool-context]
                if (!isprint(byte)) {
                     ^

Since isprint (and the other is* functions) return an int, change check
to an explicit test against the return value.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-03-31 07:05:07 -04:00
Peter Fecher
924ac2265d drivers: sensor: Add tmd2620 driver
Adds tmd2620 driver and devicetree bindings to work in
trigger and polling mode supporting Power management.

Signed-off-by: Peter Fecher <p.fecher@phytec.de>
2023-03-31 09:20:36 +02:00
Jordan Yates
41d83d7ea2 lora: compile drivers based on devicetree
Similar to the changes made in #48048, compile in the appropriate lora
modem driver when `CONFIG_LORA=y`. The `LORA_SX12XX` symbol has no
use now so remove. LoRa and LoRaWAN subsystems are still marked as
unstable so no additional deprecation cycle is needed.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-31 09:20:22 +02:00
Lucas Tamborrino
ed0d242bb7 dts: esp32s3: add LEDC device
Add LEDC device for esp32s3
Update PWM LED binding
Remove invalid comment from driver source file

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-03-31 09:19:56 +02:00
Kenneth J. Miller
41db73dc80 Revert "drivers: hwinfo: modification into hwinfo_get_reset_cause()"
This reverts commit b523e33c48.

Signed-off-by: Kenneth J. Miller <ken@miller.ec>
2023-03-31 09:18:54 +02:00
Keith Short
9b8c4ee847 emul: pi3usb9201: Create pi3usb9201 emulator
Create an emulator for the pi3usb9201 USB charging detector.

Signed-off-by: Keith Short <keithshort@google.com>
2023-03-30 17:34:36 -04:00
Keith Short
e0dd45ba31 bc12: API and 1st driver implementation.
Add portable-device mode to the Diodes PI3USB9201 USB charging detector.

Signed-off-by: Keith Short <keithshort@google.com>
2023-03-30 17:34:36 -04:00
Tom Burdick
171e5159b8 sensor: bmi160: Runtime power management support
Add support for device runtime power management. When suspended sampling
is suspended. When active sampling resumes at the configured rate.

When suspended fetch/get will return an errno and 0'ed out samples.

By default the device will start in a suspended state when
PM_DEVICE_RUNTIME is enabled.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-30 17:33:22 -04:00
Adrian Warecki
600e7b7f21 wdt: wdt_intel_adsp: Remove unused variable
In the intel_adsp_wdt_isr function was an unused dev_config variable.
The variable was removed. This was caught by the sof CI.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-03-30 11:29:33 -04:00
Nicolas Pitre
16770c743e riscv: timer: avoid possible tick announcing overflow on boot
If for any reason the timer counter didn't hold a value close enough to
zero on boot then the cycle delta could overflow and the reported ticks
won't be right. Those who really want the hardware uptime where this
makes sense (as opposed to Zephyr's uptime) can still rely on
sys_clock_cycle_get_64().

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-03-30 11:22:31 -04:00
Anisetti Avinash Krishna
26133e995d drivers: serial: ns16550: Enable simultaneous support of IO, MMIO and PCIe
Enabled simultaneous support by adding a DTS variable named “io-mapped”.
There are 3 possibilities through instance in dtsi file.
Under PCIe, PCIe ns16550.
Under soc and has a variable io-mapped, legacy(IO mapped).
Under soc and don’t have a variable io-mapped, MMIO mapped.
Simultaneous access can be enabled by a Kconfig.
For PCIe instances UART initialization should be done post-kernel as it
depends on PCIe initialization.

Co-authored-by: Najumon BA <najumon.ba@intel.com>
Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-03-30 09:43:29 -04:00
Guillaume Gautier
7ad2012ddf drivers: i2s: remove now unused kconfig for stm32 i2s
Now that PLLI2S is configured in the dts, these Kconfig are not useful
anymore.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-03-30 13:47:55 +02:00
Guillaume Gautier
4bbd89df26 drivers: i2s: use dt instance for stm32 i2s driver
Update the STM32 I2S driver to use DT_INST macros instead of DT_NODELABEL

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-03-30 13:47:55 +02:00
Guillaume Gautier
87f3e331a6 drivers: i2s: add support for i2s domain clock on stm32 devices
Add support for I2S domain clock for STM32 devices.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-03-30 13:47:55 +02:00
Martin Jäger
5e2d71315e drivers: dac: sam: add missing zephyr/kernel.h include
The missing include was detected when adding the driver to the
CI build tests.

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-03-30 10:37:26 +00:00
Andrei Emeltchenko
1679faaa0e smbus: Move smbus_utils.h from includes to driver area
Move smbus_utils.h header from generic includes to the driver's area
in order to have in include/zephyr/drivers only smbus.h header.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-30 09:45:02 +00:00
Dylan Hung
3cccf45507 cache: aspeed: Fix typo of CACHE_ENABLE bit
Fix the typo "CCHE_EANABLE" in cache_instr_line_size_get.

Fixes: 74e1b1781a ("cache: aspeed: Rework driver")

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
2023-03-30 09:43:13 +00:00
Jordan Yates
f423ec255f serial: rtt: select SERIAL_SUPPORT_ASYNC
The RTT serial drivers support the async API, so select the approriate
symbol.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-30 09:51:18 +02:00
Daniel DeGrasse
f3a35c58d8 drivers: timer: mcux_gpt_timer: rewrite timer to use free run mode
GPT timer driver previously used "restart mode", where the timer would
count to a given value, then rollover. In this mode,  "Any write access
to the Compare register of Channel 1 will reset the GPT counter". Since
a write to the compare register takes affect after 1 cycle of the
module's bus clock, and the bus clock is not synchonized with the GPT
module's low frequency counter clock, writing to the compare register
will induce a counter reset, and can cause the GPT to lose time
synchronization. This can induce time drift over time.

To fix this, rework the GPT driver to use "free run" mode. Note that
free run mode is not used directly, rather the GPT is configured to
reset on a tick boundary at boot, and then the second compare register
is used to set capture points. This way, the GPT interrupt will always
fire at a tick boundary, and no calculations are needed to handle
the counter rollover.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-30 09:51:04 +02:00
Marc Desvaux
b523e33c48 drivers: hwinfo: modification into hwinfo_get_reset_cause()
add retrieve flag SB into hwinfo_get_reset_cause()
add Clear flag SB into clear_reset_cause()

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-03-30 09:50:55 +02:00
Tomasz Leman
3024bc5b19 power_domain: intel_adsp: wait for the power domain wake up
Waiting till power domain will wake up from power gating state.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-03-29 19:59:07 -04:00
Tomasz Leman
cdc39c9482 power_domain: intel_adsp: correct function call order
Changing function call order. We need to first power-up the power domain
before we turn on the devices.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-03-29 19:59:07 -04:00
Armin Brauns
65b8ce5ae2 drivers: clock_control: stm32: remove duplicate #include
It was being included twice. Now it's included once. CI requires a commit
description.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-29 15:53:08 +00:00
Armin Brauns
a40c5f9918 drivers: clock_control: stm32: clear mask bits before setting them
Without this, setting a value of 0 leaves the bits unchanged rather than
zeroing them.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-29 15:53:08 +00:00
Adrian Warecki
ea405eb49e drivers: wdt: Add wdt_intel_adsp driver
Added a new watchdog driver which can handle a multiple wdt_dw instances
and can control the pause signal.

The mlt platform has three designware watchdogs, one for each core.
I decided to create a separate intel watchdog driver for the following
reasons:

1. All three devices share the same interrupt number. Each watchdog reports
an interrupt to the core to which it has been assigned. The same interrupt
number cannot be used by multiple devices in the device tree. So, it would
be assigned to only one device. The other dw watchdog devices would use
this assignment, even though it would not be described for them in the dt.
The interrupt handler function in dw watchdog checks the interrupt flag.
If the interrupt was connected to the first watchdog, and the second or
third watchdog signal an interrupt, the interrupt handler of the first
device would ignore it because it would not have set the interrupt flag.
The watchdog device don't knows anything about the existence of the others
devices.

2. The designware watchdog only supports a hardware pause signal. It cannot
be paused programmatically. On the mtl platform, there is a separate group
of control registers for all per-core watchdogs. There are GPIO-like
registers that allows control of a hardware pause signal for subordinate
watchdogs. This separate block is shared by all three watchdogs.

3. The base addresses of the subordinate watchdogs are read from the
aforementioned control registers. As a result, in the device tree we have
only one base address for the intel watchdog, which points to the pause
control registers and containing the base addresses of the subordinate
devices.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-03-29 09:45:49 -04:00
Adrian Warecki
1d964d8fba wdt: dw: Extraction of common functions from the wdt_dw driver
Functions that can be used by other wdt_dw based drivers have been moved to
wdt_dw_common.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-03-29 09:45:49 -04:00
Ryan McClelland
b68492166a drivers: i3c: cdns: add attach/detach api implementation
The cadence i3c ip requires it's retaining registers to be updated
when a device is detached or attached.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-03-29 07:46:37 -04:00
Ryan McClelland
62f22f8d3b drivers: i3c: i3c attach/detach api
There are some needs to attach and reattach i3c/i2c devices at runtime
Some I2C devices can have special registers where the address can be
changed at runtime. Also some I3C devices can be powered off at runtime
freeing up the address space they take up. These new APIs allow for these
to be changed at runtime. This also moves some config/data in to a common
i3c config/data structure which would allow the api to operate on to be
common for all I3C drivers.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-03-29 07:46:37 -04:00
Ryan McClelland
2f02d6ca81 drivers: i3c: cdns: add reattach api implementation
This adds the reattach api necessary for writing the i3c retaining
registers within the cdns i3c when the dynamic address changes.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-03-29 07:46:37 -04:00
Ryan McClelland
1f757bc67f drivers: i3c: add SETNEWDA ccc helper function
This is a ccc helper function for setting a new dynamic addr for
a Target.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-03-29 07:46:37 -04:00
Ryan McClelland
71c5ccb1ef drivers: i3c: add reattach_i3c_device api
Some I3C controllers have retaining registers which are used to contain
the DA of the i3c device. This needs to be updated every time the DA is
updated with SETNEWDA or SETDASA

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2023-03-29 07:46:37 -04:00
Francois Ramu
8d5ff8cb68 drivers: hwinfo stm32h5 device must disable icache to access UID_BASE
Reading the UID_BASE_ADDRESS requires disabling the icache
of the stm32h5x mcu.
Else a bus fault error occurs reading Address: 0x8fff800-0x8fff808
Enable afterwards.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-29 10:04:39 +02:00
Fabio Baltieri
a9735abf84 kscan: input: add input to kscan adapter
Add a driver that listens for input events and reports them on a kscan
API. This allows porting kscan drivers to the input APIs while
maintaining compatibility with the existing kscan based applications.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-03-28 20:57:53 -04:00
Anas Nashif
286f10323c drivers: intel_gna: use cache APIs directly
This macro just uses an existing cache API and is not widely being used.
Use the API directly which will be changed to use a public cache API in
a later commit.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-03-28 18:14:37 -04:00
Henrik Brix Andersen
4ec054aa45 drivers: can: mcux: flexcan: add missing mutex unlock in error path
Add missing mutex unlock to error handling path in
mcux_flexcan_add_rx_filter().

Fixes: #56284

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-28 21:45:43 +00:00
Jordan Yates
5e09f5b1f1 adc: adc_mchp_xec: fix CONFIG_PM_DEVICE compilation
Replace pointer construction macro with value from config struct.
Fixes what appears to be an oversight from #55522.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-28 17:36:32 -04:00
Fred Oh
1851950977 drivers: dmic: clear MIC_MUTE bit for ACE
When releasing a paused stream, clearing MIC_MUTE bit is necessary.
Without unmuting there will be no input data after resume.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2023-03-28 16:34:40 -04:00
Fred Oh
98bf16a569 drivers: dmic: clear SOFT_RESET bit for ACE as well
Clearing SOFT_RESET bit applies to ACE as well. In case of ACE,
this should be done before setting start bits for CIC and FIR.

Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
2023-03-28 16:34:40 -04:00
Patryk Duda
78ce5784eb drivers: flash: Add ex ops for STM32 option/control register block
Introduce flash extended operations that can be used to disable access
to option and control registers until reset. Disabling access to these
registers improves system security, because flash content (or protection
settings) can't be changed even when exploit was found.

On STM32 devices, registers can be locked until reset by writing wrong
key during unlock procedure. It triggers a bus fault, so during the
procedure we need to ignore faults and clear bus fault pending bit.

Please note that option register disabling was implemented for devices
that have OPTCR register (F2, F4, F7 and H7). Implementation on other
devices requires more testing, since documentation is not precise
enough. Disabling control register was implemented for devices that
have CR register.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-03-28 15:43:16 +00:00
Patryk Duda
417368e63d drivers: flash: Add support for defining custom RDP1 byte value
This patch makes possible to choose custom byte which should be used
to enable non-permanent readout protection (RDP1). Actually, any byte
except 0xAA and 0xCC (which are used by RDP0 and RDP2 respectively)
can be used to enable RDP1 but in multi-image environment, some other
image could check if RDP1 is enabled by comparing it to some hardcoded
value.

If property is not defined, 0x55 will be used to enable RDP1. The
default value comes from STM32 HAL.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-03-28 15:43:16 +00:00
Patryk Duda
d652da5acb drivers: flash: Introduce readout protection support for STM32F4
This patch adds flash readout protection support for STM32F4 devices
family. These devices can enable protection on entire flash content.

Readout protection functionality was exposed as vendor extended
operation. To change readout protection state, caller should provide a
structure which describes desired RDP state.

Enabling readout protection permanently or disabling readout protection
(changing from level 1 to level 0) is guarded by
CONFIG_FLASH_STM32_READOUT_PROTECTION_PERMANENT_ALLOW and
CONFIG_FLASH_STM32_READOUT_PROTECTION_DISABLE_ALLOW respectively.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-03-28 15:43:16 +00:00
Patryk Duda
b6078cc906 drivers: flash: Introduce write protection support for STM32F4
This patch adds sector write protection support for STM32F4 devices
family. These devices can protect flash content with sector precision.

Write protection functionality was exposed as vendor extended operation.
To change write protection state, caller should provide mask of enabled
and disabled sectors.

Function responsible for locking/unlocking option bytes was implemented
for all STM32 devices supported by this driver.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-03-28 15:43:16 +00:00
Francois Ramu
a62fc404be drivers: flash: stm32 flash drivers supports the new stm32h5 serie
Introduce the stm32h5 serie to the the existing flash driver
It is based on the stm32l5 model.
 Add a function to check if the flash is in dual
or single bank mode.
Some stm32 devices can map 2 or 1 flash banks.
Adapt the FLASH register names for the stm32h5 mcu.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-28 15:07:51 +02:00
Francois Ramu
4a6a703f0f drivers: clock control for the new stm32h5 serie
Add the driver for the clock control of the new stm32h5.
See the corresponding Ref Man to get the clock scheme :
HSI, CSI, HSI48, HSE, LSE, and 2 or 3 PLLs

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-28 15:07:51 +02:00
Eduardo Montoya
570110e672 drivers: ieee802154: remove not useful log
Remove a warning log which shows on every delayed transmission and
it is not helpful.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2023-03-28 15:07:33 +02:00
Henrik Brix Andersen
c41dd36de2 drivers: kconfig: unify menuconfig title strings
Unify the drivers/*/Kconfig menuconfig title strings to the format
"<class> [(acronym)] [bus] drivers".

Including both the full name of the driver class and an acronym makes
menuconfig more user friendly as some of the acronyms are less well-known
than others. It also improves Kconfig search, both via menuconfig and via
the generated Kconfig documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-28 15:06:06 +02:00
Nicolas Pitre
a6809ef93a timer: hpet: a few improvements
- That MIN_DELAY is a magic arbitrary number that is never going to be
  right for all cases. Get rid of it in favor of a smarter solution.

- `sys_clock_set_timeout()` should not base its next match value on the
  current time. Tracking the `last_tick` and `last_elapsed` values avoids
  the need for all the tick rounding computation.

- Clamp the next timeout to HPET_MAX_TICKS/2. This leaves room for the
  added elapsed time and any possible IRQ servicing delay.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-03-28 07:26:08 -04:00
Declan Snyder
3af095b122 drivers: pinctrl: pinctrl_kinetis: Fix port array
Fix port array definition in kinetis pinctrl driver
so that it handles more flexibly the cases where the
number of PORT peripherals is more than 3, rather than only
handling the case where there are 5.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-03-28 10:23:46 +02:00
Francois Ramu
f7f47dc437 drivers: adc: stm32 adc driver must wait about 1ms after enabling
After enabling the ADC, the peripheral has a certain delay (about 1ms)
to set its ADC Ready flag in the ADC ISR register.
In between, the ADRDY is still 0 and the ADEN is 1 in the CR.
The ADC can be used for conversion, only when the ADRDY bit is set

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-28 09:57:28 +02:00
Romain Mahoux
b096e092fa drivers/apbuart: correct the baud formula
The formula of set_baud first function was not consistent with the get_baud
one.

Signed-off-by: Romain Mahoux <romain@mahoux.fr>
2023-03-27 22:15:33 +00:00
Krzysztof Chruscinski
e0082eded7 drivers: timer: nrf_rtc_timer: Add guard against conflict
Add missing guard which prevents use of nrf_rtc_timer on
the same RTC instance (RTC1) as counter driver instance.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-03-27 22:15:15 +00:00
Jeppe Odgaard
40ec70fd2a drivers: sensor: mcux qdec single-phase option
Add binding and sensor attribute to allow single phase
mode where only one signal is required from the encoder.
The signal must be connected to Phase A input.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-03-27 22:13:56 +00:00
Henrik Brix Andersen
e440b023dd drivers: gpio: test: use CONFIG_GPIO_INIT_PRIORITY for init priority
Use the dedicated CONFIG_GPIO_INIT_PRIORITY for vnd,gpio test driver
initialization priority.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-27 13:20:03 +00:00
Henrik Brix Andersen
2c5d7d78dd drivers: gpio: test: add driver config and data structs
Add config and data structs to the vnd,gpio test driver as these are
required by the GPIO API.

Fixes: #55884

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-27 13:20:03 +00:00
Fabian Blatz
6180f96799 serial: Add driver for emulated UART
The emulated UART controller will aid in automated
integration testing.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2023-03-27 09:50:44 +02:00
Henrik Brix Andersen
718099607e drivers: can: common: document sample point calculation function
Add documentation for the update_sampling_pnt() function and rename a few
internal variables to improve readability.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-27 09:50:24 +02:00
Henrik Brix Andersen
ffefc6441b drivers: can: common: respect the range limits of phase_seg1
Respect the range limits of phase_seg1 when attempting to distribute ts1
between prop_seg and phase_seg1.

Even distribution may not be possible if the allowed ranges of prop_seg and
phase_seg1 are not equal.

Fixes: #55919

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-27 09:50:24 +02:00
Henrik Brix Andersen
7073da0257 drivers: can: common: include sync segment in timing calculation
Always include the SYNC segment of 1 time quanta when calculating ts1 and
ts2.

Fixes: #55919

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-27 09:50:24 +02:00
scott worley
6b8bc83f54 tests: adc: Microchip XEC fix ADC API test and ADC shell
Microchip XEC ADC and ADC V2 driver were merged into one
That PR did not change the ADC API test and ADC shell resulting
in twister build failures. Fixed both ADC API test and ADC shell.

Signed-off-by: scott worley <scott.worley@microchip.com>
2023-03-24 11:28:20 -04:00
Rainer Paat
2d26baaeb1 drivers: ethernet: w5500: MAC change support
Devicetree local-mac-address and zephyr,random-mac-address support added.

Updated w5500_set_config() to support ETHERNET_CONFIG_TYPE_MAC_ADDRESS
and change the MAC address at runtime.

Signed-off-by: Rainer Paat <rapaat@gmail.com>
2023-03-24 12:55:49 +01:00
Rainer Paat
88c3fe894f drivers: ethernet: w5500: Fix promiscuous mode
Enabling MAC filtering by default on hw start and
disabling it when promiscuous mode is activated.

Signed-off-by: Rainer Paat <rapaat@gmail.com>
2023-03-24 12:55:49 +01:00
Gerard Marull-Paretas
92d6df6620 dts: arm: nordic: introduce easydma-maxcnt-bits
The number of available EasyDMA MAXCNT bits is now defined per-instance
in Devicetree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-03-24 10:31:32 +01:00
Benedikt Schmidt
1009b9152a drivers: gpio: remove doxygen comments in MCP23S17 driver
Remove the doxygen comments in the driver
for the MCP23S17.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-03-24 09:22:32 +01:00
Benedikt Schmidt
a8b2ff88de drivers: gpio: remove not required header
Move the content of the header for the MCP23S17
into the source file.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-03-24 09:22:32 +01:00
Guennadi Liakhovetski
4e822592b8 mm: intel: adsp: simplify code in mm_drv_intel_adsp_regions.c
temporary_table is a trivial copy of virtual_memory_regions, it isn't
clear why it's needed. All the more that it's freely mixed with
virtual_memory_regions itself. Also change a variable name to avoid
confusion and improve indentation.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-03-23 16:31:08 -04:00
Jay Vasanth
ff10046382 include: espi.h: Update OCB virtual wires mappings
update espi_vwire_signal enum to refer all platform specific
usage virtual wires to ESPI_VWIRE_SIGNAL_SLV_GPIO_x
Virtual wires used for USB-C port over current (OCB)
have been defined as macros mapped to the corresponding
espi_vwire_signal enum

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-03-23 11:58:26 -04:00
Jay Vasanth
b0ce525b90 drivers: espi: Microchip MEC172x eSPI VW initialization update
Change device tree VW routing to a form allowing overrides.
Add two new DT optional properties for specifying the reset
source and reset value of each virtual wire. Only virtual
wires that are enabled using the status property are modified.
NOTE: eSPI virtual wires are controlled in groups of 4 by
hardware. The optional reset signal source properties applies
to all four virtual wires in the group. If this field is
changed from the hardware default, it should be changed for
only one virtual wire in the group. If the property exists
in more than one wire in the group it must be set to the
same value.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-03-23 11:58:26 -04:00
Jay Vasanth
f6619a8688 drivers: espi: Update Microchip MEC172x eSPI virtual wires to use DT
Modify Mircrochip MEC172x eSPI driver to get eSPI virtual wire
hardware routing from device tree.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-03-23 11:58:26 -04:00
Manimaran A
c42a155988 driver: clock control: Microchip XEC fix missing domain parameter
The clock control driver requires three pieces of information:
PCR register index, bit position, and clock domain. Clock domain
was missing from DT information and MCHP macros.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-03-23 11:55:19 -04:00
Manimaran A
c3b2dbd1fb driver: adc: microchip: Keep single adc driver for MEC devices
Deleted adc_mchp_xec.c and microchip,xec-adc.yaml file.
DTSI, yaml, CMakeLists.txt and Kconfig.xec files are
updated for compatible.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-03-23 11:43:30 -04:00
Manimaran A
51b1c5b9d6 driver: adc: microchip: Merged MEC172x and MEC15xx version drivers.
Updated the "adc_mchp_xec_v2.c" adc driver to support both MEC172x and
MEC15xx SOC.
ADC smapling clock configuration updated using DTS.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-03-23 11:43:30 -04:00
Manimaran A
f6a0d9c7f7 driver: adc: microchip: MEC172x driver clean up
adc_mchp_xec_v2.c driver clean up by variable name change
and redundant macro removal.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-03-23 11:43:30 -04:00
Maureen Helm
59fe77a6b4 drivers: sensor: lsm9ds0_gyro: Store sensor trigger as a pointer
Fixes the lsm9ds0_gyro sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
0d4f0deaad drivers: sensor: lsm6dso: Store sensor trigger as a pointer
Fixes the lsm6dso sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
1157df85a7 drivers: sensor: lsm6dsl: Store sensor trigger as a pointer
Fixes the lsm6dsl sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
5354bffc6b drivers: sensor: lps22hh: Store sensor trigger as a pointer
Fixes the lps22hh sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
54433a9610 drivers: sensor: lis3mdl: Store sensor trigger as a pointer
Fixes the lis3mdl sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
8cb81ff371 drivers: sensor: lis2mdl: Store sensor trigger as a pointer
Fixes the lis2mdl sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
363b1876f8 drivers: sensor: lis2dw12: Store sensor trigger as a pointer
Fixes the lis2dw12 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
281f61672b drivers: sensor: lis2ds12: Store sensor trigger as a pointer
Fixes the lis2ds12 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
5bb2323435 drivers: sensor: lis2dh: Store sensor trigger as a pointer
Fixes the lis2dh sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
0461ff22d5 drivers: sensor: ite_vcmp_it8xxx2: Store sensor trigger as a pointer
Fixes the ite_vcmp_it8xxx2 sensor driver to store the user-supplied
sensor trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
0ed618c609 drivers: sensor: ism330dhcx: Store sensor trigger as a pointer
Fixes the ism330dhcx sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
16140bf485 drivers: sensor: isl29035: Store sensor trigger as a pointer
Fixes the isl29035 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
0c3bfc2762 drivers: sensor: ina23x: Store sensor trigger as a pointer
Fixes the ina23x sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Maureen Helm
c2951ef7c6 drivers: sensor: iis3dhhc: Store sensor trigger as a pointer
Fixes the iis3dhhc sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-23 12:56:20 +01:00
Johann Fischer
9d91333a43 drivers: udc: simplify udc_submit_event()
Since we have a dedicated function for UDC_EVT_EP_REQUEST type
events, we can now simplify udc_submit_event() and remove
buf parameter.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-03-23 10:08:03 +01:00
Johann Fischer
ad81b3b797 drivers: udc: move transfer status to buffer info structure
This allows us to get the result of synchronous transfer without
any hacks, just from the net_buf structure.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-03-23 10:08:03 +01:00
Johann Fischer
39218112ab drivers: udc_nrf: do not use UDC_EVT_EP_REQUEST without net_buf pointer
Do not use UDC_EVT_EP_REQUEST event without a valid pointer
to a request buffer. No changes needed in the upper layer because
it requires valid buffer pointer for this type of event anyway.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-03-23 10:08:03 +01:00
Johann Fischer
4a53645448 drivers: udc: add helper function to send UDC endpoint event
Add helper function to send UDC endpoint event to a higher level
that takes fewer arguments.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-03-23 10:08:03 +01:00
Daniel DeGrasse
e587047dc6 drivers: adc: rewrite mcux LPADC driver
Rewrite MCUX LPADC driver, to better utilize hardware.
the following changes have been applied:
- channel numbers now correspond to hardware channel command slots,
  use "input_positive" and "input_negative" fields along with channel
  definitions in dt-bindings/adc/mcux-lpadc.h to select a channel
- the number of channel command slots available is configurable via
  CONFIG_LPADC_CHANNEL_COUNT
- Side A and side B channels are now supported
- differential channel mode is now supported
- ADC channels now are sampled via hardware, without additional
  software triggering

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-23 08:58:44 +00:00
Pieter De Gendt
0b45710219 drivers: adc: adc_sam: Introduce Atmel SAM ADC driver
This commit adds support for Atmel SAM ADC driver with up to
16 channels.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-03-23 09:41:00 +01:00
Henrik Brix Andersen
d5672c9ee3 drivers: can: check timing parameters
Check the requested CAN timing parameters against the min/max values
supported by the driver and return an error if they are out of range.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-23 09:40:34 +01:00
Henrik Brix Andersen
9dc9f0a0fd drivers: can: common: add missing static for sample_point_for_bitrate()
Add missing static keyword for internal function
sample_point_for_bitrate().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-23 09:40:34 +01:00
Tristan Honscheid
368f2e729c microchip: espi: Fix bug in dependency on ESPI Kconfig
`Kconfig.xec` for the ESPI drivers requires
DT_HAS_MICROCHIP_XEC_ESPI_SAF_ENABLED and
DT_HAS_MICROCHIP_XEC_ESPI_SAF_V2_ENABLED for ESPI_XEC and ESPI_XEC_V2,
respectively, but SAF is not mandatory for using ESPI. This is a bug and
should be dependent on DT_HAS_MICROCHIP_XEC_ESPI_ENABLED and
DT_HAS_MICROCHIP_XEC_ESPI_ENABLED, respectively. Also make these default
to `y` so they can be automatically enabled by the device tree.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2023-03-23 08:24:18 +00:00
Andy Sinclair
a00713bc45 drivers: regulator: Added initial voltage configuration
The regulator driver has a configured min/max range that is used
to limit set values, and to initialise the regulator.

A new init value has been added, so that the startup voltage can
be higher than the lowest permitted value.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-03-22 21:19:51 +01:00
Alvaro Garcia
2380710020 drivers: Added fuel gauge max17048
Added support for fuel gauge max17048

Signed-off-by: Alvaro Garcia <maxpowel@gmail.com>
2023-03-22 14:51:33 -04:00
Nazar Palamar
f91e35d447 driver: bluetooth: Added Infineon cyw43xxx BT driver
Added initial version of Infineon cyw43xxx BT (
H4 HCI extension drivers/bluetooth/hci/CMakeLists.txt)

Add initial version of binding file for Infineon CYW43xx BT
HCI extension driver.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-03-22 16:40:55 +01:00
Dean Sellers
8eddd48615 drivers: uart: esp32: Add RS485 half duplex hardware mode
Support for the hardware mode where pin configured as DTR
is asserterted when UART transmits.

Signed-off-by: Dean Sellers <dsellers@evos.com.au>
2023-03-22 13:52:25 +01:00
Andrei Emeltchenko
e829b72ad5 drivers: smbus: pch: Wrap respective code with ifdefs
Wrap code for SMBALERT and HOST_NOTIFY with configuration ifdefs.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Andrei Emeltchenko
a42ab2729f smbus: Convert to use runtime BDF lookup
Convert PCH SMBus driver, tests and samples to use new dynamic BDF
lookup.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Andrei Emeltchenko
14923f4131 smbus: Refactor callbacks API
The callbacks API was similar to gpio / espi callbacks API. Refactor
it to use more intuitive names for set / remove callbacks.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Andrei Emeltchenko
fe46408ff2 drivers: smbus: Implement Host Notify and SMBALERT for PCH
Implement SMBus Host Notify and SMBALERT for Intel PCH driver.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Andrei Emeltchenko
2146b19cc7 smbus: Add Host Notify and smbalert API
Add API for SMBus Host Notify and SMBALERT.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Andrei Emeltchenko
2de1936acc drivers: smbus: pch: Add Block Process Call operation
Add SMBus Block Process Call implementation for Intel PCH SMBus
driver.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Andrei Emeltchenko
4099bc2e63 drivers: smbus: Add Intel ICH / PCH SMbus driver
Add driver supporting Intel I/O Controller Hub (ICH), later renamed
to Intel Platform Controller Hub (PCH).

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Andrei Emeltchenko
af984aa58b drivers: smbus: Add Intel PCH driver register header
Add header file for Intel PCH SMBus driver.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Andrei Emeltchenko
5fc55364a2 smbus: shell: Add SMBus subsystem shell module
Add SMBus shell module for testing. This allows arbitrary boards with
SMBus driver supported exploring the SMBus communication with
peripheral devices.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Andrei Emeltchenko
adff73d618 smbus: Introduce SMBus subsystem driver API
Introduces SMBus driver API for SMBus controllers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-22 08:16:23 -04:00
Johan Hedberg
2fe4a4a218 drivers: watchdog: Add Intel TCO Watchdog driver
This adds a basic Intel TCO watchdog driver. The driver doesn't support
windowed timeouts (a non-zero window.min value) or callbacks. The driver
currently assumes TCO version 6, which can be found e.g. on Elkhart Lake
and Raptor Lake platforms. The driver also expects the TCOBA base
address to be specified through DTS, rather than doing runtime lookup
(using e.g. ACPI or PCIe).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2023-03-22 11:38:59 +01:00
Raul Pando
a7c011b0be Drivers: I2S: STM32: Mishandling of Master Clock output (MCK)
Remedial rework to handle the enabling of the I2S master clock
output based on the presence of an introduced DT property.
For details see issue/54841.

Signed-off-by: Raul Pando <raul.pando@bytegrity.co.uk>
2023-03-22 10:06:11 +01:00
Hein Wessels
36f592ddbc drivers: adc: stm32: only handle OVR flag when supported
STM32 ADC DMA support added in #52965 incorrectly assumed
that all ADC devices have a OVR flag. This commit changes
the driver to only account for it if it's found in the
LL drivers.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-03-22 09:34:42 +01:00
TOKITA Hiroshi
08606eac44 drivers: dma: rpi_pico: add support for RaspberryPi Pico DMA
Adding RaspberryPi Pico DMA driver.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-22 09:33:52 +01:00
Gerson Fernando Budke
6951160dd2 drivers: afec: sam: Enable sam4e SoCs
Add support to Atmel SAM SAM4E AFEC feature.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
6634d6b4ff drivers: afec: sam: Update to use clock control
This update Atmel SAM afec driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
dc45d7a922 drivers: sensors: qdec_sam: Update to use clock control
This update Atmel SAM QDEC driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
f1b68beca1 drivers: ssc: sam: Update to use clock control
This update Atmel SAM ssc driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
d2e9b4682c drivers: pwm: sam: Update to use clock control
This update Atmel SAM pwm driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
5522e65581 drivers: usb: sam: Update to use clock control
This update Atmel SAM usbhs driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
033c7eddec drivers: memc: sam: Update to use clock control
This update Atmel SAM SMC driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
bf46696057 drivers: dma: sam: Update to use clock control
This update Atmel SAM xdmac driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
3bc47d77b2 drivers: dac: sam: Update to use clock control
This update Atmel SAM dac driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
41ab680a4f drivers: can: sam: Update to use clock control
This update Atmel SAM can driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
4f59d50441 drivers: spi: sam: Update to use clock control
This update Atmel SAM spi driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
91e219c644 drivers: entropy: sam/sam0: Update to use clock control
This update Atmel SAM trng driver to use clock control driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
c4f1d98ef6 drivers: i2c: sam: Update to use clock control
This update Atmel SAM twi, twihs and twim drivers to use clock control
driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
6d4c0da459 drivers: hwinfo: sam: Make compatible whole series
This update devicetree entries and Kconfig definition to allow use of
reset cause on all SAM series.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
08015c8f57 drivers: hwinfo: sam: Update to use clock control
This update Atmel SAM hwinfo reset cause driver to use clock control
driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
eb2c6d7e2c drivers: timer: sam: Update to use clock control
This update Atmel SAM timer driver to use clock control drivers.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
3c7988c52a drivers: eth: sam: Update to use clock control
This update Atmel SAM ethernet driver to use clock control drivers.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
c77c1cc197 drivers: gpio: sam: Update to use clock control
This update Atmel SAM gpio and pinctrl drivers to use clock control
drivers.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
f21c936d49 drivers: serial: sam: Update to use clock control
This update Atmel SAM uart and usart  drivers to use clock control
drivers.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Gerson Fernando Budke
88cedcf5c5 drivers: clock: Add Atmel SAM PMC driver
Add initial version of clock control for Atmel SAM SoC series. This add
support to Power Management which allows control peripherals clock.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Tomasz Leman
fbe930ad0e driver: gpdma: balance the pm usage
Because the DMA driver allows multiple start and stop calls for the same
instance and the same channel, we cannot rely on the error codes
returned by these functions to notify the device's power manager that a
device is still in use.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2023-03-21 18:10:41 +00:00
Anisetti Avinash Krishna
00991e4720 drivers: serial: ns16550: Moved PCIe probe to init function
Moved PCIe probe from configure function to init function
because whenever uart_configure api is called MMIO address
is getting updated.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-03-21 18:10:12 +00:00
Anisetti Avinash Krishna
712dab4f04 drivers: serial: ns16550: Fixed set_baud_rate usage in line ctrl set
Added pclk parameter to set_baud_rate function in line_ctrl_set api
which was missed during update of set_baud_rate function definition
update.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-03-21 18:10:12 +00:00
Kai Vehmanen
e40859f787 Revert "dma: dw: Do not program SAR/DAR and CTL_HI/LO when using HW LLI"
Failures are seen with SOF digital mic capture test cases on Intel cAVS2.5
platforms if the SAR/DAR/CTL writes are skipped.

This reverts commit 08d9efb202.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-03-21 13:50:08 -04:00
Ramesh Babu B
3d44508c38 drivers: spi: Add Intel SPI penwell driver
Added support for intel pch penwell spi driver.

Signed-off-by: Ramesh Babu B <ramesh.babu.b@intel.com>
2023-03-21 13:39:33 +01:00
Vinayak Kariappa Chettimada
643723479f drivers: flash: nRF: Move sync ticker to Subsys Bluetooth Controller
Move the SoC Flash nRF sync ticker implementation into
Bluetooth Controller Subsystem folder, as internal headers
are included.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-03-21 12:33:32 +01:00
Benjamin Björnsson
a52bd0d2e9 drivers: pwm: pwm_stm32: Add PWM support on STM32C0-seris
Add support for PWM on the STM32C0-series.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-21 09:38:25 +01:00
Marc Desvaux
0548584d4d drivers: gpio/exti: stm32: Use st,stm32g0-exti compatible
remove all #ifdef CONFIG_SOC_SERIES_STM32xx
before to add a st,stm32g0-exti compatible
added to the matching targets:
C0/G0/U5/L5/MP1:

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-03-21 09:37:30 +01:00
Jeppe Odgaard
4d57f64193 drivers: watchdog: Add TI TPS382x driver
Add support for the TI TPS382x series. The IC has an input pin which
should be toggled by the processor and a output pin which should be
connected to the RESET input of the processor. The timeout is not
configurable.

This device can be used by devices which does not have any internal
hardware watchdog device.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-03-21 09:35:58 +01:00
Evgeniy Paltsev
d4d0907ede ARC: SMP: simplify CPU mask generation with BIT_MASK
Simplify CPU mask generation by replacing GENMASK with BIT_MASK.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-03-21 08:56:41 +01:00
Evgeniy Paltsev
16e9362ba0 ARC: SMP: fix IDU mask setup
Fix IDU mask setup:
 * fix GENMASK usage to avoid generating mask to one extra cpu (which
   doesn't exist in configuration)
 * use arch_num_cpus() instead of CONFIG_MP_NUM_CPUS to allow having
   some cpu's disabled (with detection in runtime)

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-03-21 08:56:41 +01:00
Krzysztof Chruscinski
9a73b9c80d hal_nordic: Change scheme for RTC and TIMER reservation
In general, RTC and TIMER driver implements counter API but there
are exception when those peripherals are used in a custom way
(e.g. for system timer or bluetooth). In that case, system must
prevent using counter based on a reserved instance. Previously,
it was managed by Kconfig options but that cannot be maintained
when switching to devicetree configuration of the counter driver.

A new approach removes Kconfig options and instead adds static
asserts in the files which are using direct peripherals. Those
asserts check if given node is not enabled in the device tree.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-03-20 16:59:40 +01:00
Krzysztof Chruscinski
656b0e6426 drivers: counter: Adapt to use device tree
Modifying counter drivers (rtc and timer) to rely completely on
device tree and not on Kconfig of MDK flags.

Adapting dtsi for all SoCs and adapting test configuration.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-03-20 16:59:40 +01:00
Krzysztof Chruscinski
93619d7b73 drivers: counter: nrfx_rtc: Use clock control when driver enabled
RTC shall enabled LF clock only if CLOCK_CONTROL driver is enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-03-20 16:49:50 +01:00
Zack Cornelius
a3288252ff drivers: flash: nrf_qspi_nor: Add runtime PM
Add PM_DEVICE_RUNTIME support to nordic QSPI NOR flash driver, putting
the QSPI peripheral and flash ship into DPD if available

Signed-off-by: Zack Cornelius <zcornelius@securityesys.com>
2023-03-20 16:29:47 +01:00
Hein Wessels
a2dd232410 drivers: adc: stm32: dma support
Sampling multiple adc channels at once using dma

Only verified to be working on nucleo_h743zi

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-03-20 16:29:24 +01:00
Jamie McCrae
5bae23b891 drivers: retained_mem: Add RAM driver
Adds a non-initialised RAM-based retained memory driver.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-20 15:02:09 +01:00
Jamie McCrae
9bda013e5d drivers: retained_mem: Add nRF GPREGRET driver
Adds a driver for the Nordic nRF GPREGRET registers and adds
entries to the SoCs for this peripheral.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-20 15:02:09 +01:00
Jamie McCrae
2fedb306f7 drivers: Add retained memory driver interface
Adds a new driver interface for retained memory devices which
can be used to store data and have it retained whilst the device is
powered thorugh different application execution states (though this
data may be lost in low power states).

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-20 15:02:09 +01:00
Benjamin Björnsson
db193332fa drivers: clock_control: correct enable / disable of backup domain on STM32
The U5-series was missed when adding if-defs around enable / disable
of the backup domain access, this patch makes sure the U5-series
is handled correctly.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-20 14:02:02 +00:00
Marcin Niestroj
a2e5d1dcd2 drivers: wifi: esp32: register rxcb after wifi init
Move esp_wifi_internal_reg_rxcb() after esp_wifi_init(), so that
wifi_connect() is successful.

Fixes: 690f65dbd9 ("drivers: wifi: esp32: fix possible interface null
  pointer")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-03-20 11:43:49 +01:00
Benjamin Björnsson
b308d83d45 drivers: watchdog: add watchdog support on STM32C0-series
Add support for independent watchdog and window watchdog
on the STM32C0-series.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-20 10:19:29 +00:00
Maciej Baczmanski
bcf1e8150b drivers: ieee802154: Fix csl_rx_time overflow issue for NRF5 and
clean up redundant static functions

convert `csl_rx_time` to uint32_t and remove redundant `nrf5_schedule_rx`
`nrf5_config_csl_period` and `nrf5_receive_at` static functions.

`csl_rx_time` has been passed as uint32. It is compared to uint64 value
returned by `nrf_802154_sl_timer_current_time_get` in
`nrf_802154_ie_writer.c` which leads to wrong calculation of phase in CSL.

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2023-03-20 10:47:33 +01:00
Armin Brauns
01e8b3445e drivers: gpio: mcp23xxx: add support for reset pin
This allows the device to be reset to a known state before initialization.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-20 10:43:12 +01:00
Armin Brauns
07af23c1c6 drivers: gpio: mcp23xxx: support single-edge interrupts
An interrupt is triggered for every edge, but only the desired edges cause
a callback to be called.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-20 10:43:12 +01:00
Armin Brauns
0db9785892 drivers: gpio: mcp23xxx: support pin interrupts
No single-edge interrupts for now, since they are not supported in
hardware.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-20 10:43:12 +01:00
Armin Brauns
1a566e6a7f drivers: gpio: mcp23xxx: fix typo
Should be the Output LATch register. "IK" is one key away from "OL" on
QWERTY keyboards.

This define wasn't actually used anywhere.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-20 10:43:12 +01:00
Robert Hancock
86e1740cfc serial: xilinx: uartlite: Fix infinite spin in xlnx_uartlite_fifo_read
The xlnx_uartlite_fifo_read function would spin indefinitely if there
was less data available in the RX FIFO than the size of the passed-in
buffer. This call is supposed to be non-blocking.

Fixed to break out of the loop if there are no more bytes left in the RX
FIFO.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2023-03-20 10:21:37 +01:00
Benjamin Björnsson
c02688a308 drivers: counter: add support for rtc in STM32C0-series
This commit extends the rtc counter driver to work on
the STM32C0-series.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-20 09:53:49 +01:00
Benjamin Björnsson
6c8ef27a77 drivers: counter: stm32_rtc: enable backup domain only when supported
The STM32C0-series does not have a backup domain, this patch
enables us to extend this driver to the C0-series.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-20 09:53:49 +01:00
Georges Oates_Larsen
3c6b7dc35a net: dummy L2 for offloaded ifaces
Adds dummy link layer for offloaded ifaces, allowing
ifaces to directly receive l2_enable calls

Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
2023-03-20 09:53:25 +01:00
Henrik Brix Andersen
37b3a11d72 drivers: can: shell: add debug log for calculated timing parameters
Add debug logs for the timing parameters calculated by the shell commands.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-20 09:53:14 +01:00
Henrik Brix Andersen
1c7feb3fd4 drivers: can: shell: show min/max timing parameters
Include the minimum/maximum timing parameters when showing details about a
CAN controller.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-20 09:53:14 +01:00
Henrik Brix Andersen
3c89bbf876 drivers: can: reset statistics when starting the CAN controller
Reset CAN controller statistics when starting the CAN controller.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-20 09:52:50 +01:00
Maureen Helm
b079316b4e drivers: sensor: iis2mdc: Store sensor trigger as a pointer
Fixes the iis2mdc sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
99f9ef36af drivers: sensor: iis2iclx: Store sensor trigger as a pointer
Fixes the iis2iclx sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
7b4ea85a0b drivers: sensor: iis2dlpc: Store sensor trigger as a pointer
Fixes the iis2dlpc sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
e0e4fa5d43 drivers: sensor: iis2dh: Store sensor trigger as a pointer
Fixes the iis2dh sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
1ea5bb32f3 drivers: sensor: icm42605: Store sensor trigger as a pointer
Fixes the icm42605 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
466c5501bc drivers: sensor: hts221: Store sensor trigger as a pointer
Fixes the hts221 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
73ddc98ea0 drivers: sensor: hmc5883l: Store sensor trigger as a pointer
Fixes the hmc5883l sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
1b05a2ce8b drivers: sensor: grow_r502a: Store sensor trigger as a pointer
Fixes the grow_r502a sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
e20357e7ac drivers: sensor: fxos8700: Store sensor trigger as a pointer
Fixes the fxos8700 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
2a72e0eaf3 drivers: sensor: fxas21002: Store sensor trigger as a pointer
Fixes the fxas21002 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
77cb3aeeb5 drivers: sensor: fdc2x1x: Store sensor trigger as a pointer
Fixes the fdc2x1x sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
c45595e164 drivers: sensor: ccs811: Store sensor trigger as a pointer
Fixes the ccs811 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
9024a3cf97 drivers: sensor: bq274xx: Store sensor trigger as a pointer
Fixes the bq274xx sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
7f59286f98 drivers: sensor: bmp388: Store sensor trigger as a pointer
Fixes the bmp388 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
eac3ac2d87 drivers: sensor: bmi160: Store sensor trigger as a pointer
Fixes the bmi160 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
666a0dffd2 drivers: sensor: bmg160: Store sensor trigger as a pointer
Fixes the bmg160 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
7875025cdb drivers: sensor: bmc150_magn: Store sensor trigger as a pointer
Fixes the bmc150_magn sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
ad07044679 drivers: sensor: bma280: Store sensor trigger as a pointer
Fixes the bma280 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
9d74370e74 drivers: sensor: amg88xx: Store sensor trigger as a pointer
Fixes the amg88xx sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
a8b74ff5e7 drivers: sensor: adxl372: Store sensor trigger as a pointer
Fixes the adxl372 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
cb51090d3a drivers: sensor: adxl362: Store sensor trigger as a pointer
Fixes the adxl362 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Maureen Helm
ae5342afba drivers: sensor: adt7420: Store sensor trigger as a pointer
Fixes the adt7420 sensor driver to store the user-supplied sensor
trigger as a pointer rather than a copy. This enables the trigger
handler to use CONTAINER_OF to retrieve a context pointer when the
trigger is embedded in a larger struct.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2023-03-20 09:52:35 +01:00
Kumar Gala
388d522c32 drivers: clock: Microchip XEC: Fix enum usage
We get a compiler warning in this code with arm clang due to using
the wrong enum type for the variable.  The enum should be of
type `enum periph_clk32k_src` so replace VBR_CLK32K_SRC_PIN_XTAL
with PERIPH_CLK32K_SRC_PIN_XTAL.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-03-17 19:59:28 +01:00
Oleg Ryjkov
c194cb76ad drivers: sensor: bmi270: Use bulk SPI reads
BMI270 supports bulk register reads, use them to make
trasnfers faster.
See the discussion on
6cbb84c3ee (r104543405)
Tested on an nrf52840 board connected to a bmi270 sensor via SPI.

Signed-off-by: Oleg Ryjkov <oryjkov@gmail.com>
2023-03-17 13:17:08 -05:00
Evgeniy Paltsev
56572687c7 drivers: serial: add virtual uart over ARC hostlink channel
Add support for virtual UART device that uses ARC Hostlink channels
for data transfers. Due to the Hostlink principle, this driver
supports only polling API.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-03-17 11:49:02 +01:00
Kumar Gala
831bd2f841 armclang: fix compiler warnings with isprint()
We get compile warnings of the form:

drivers/console/uart_console.c:508:8: error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
 [-Werror,-Wint-in-bool-context]
                if (!isprint(byte)) {
                     ^

Since isprint returns an int, change check to an explicit test against
the return value.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-03-17 09:30:01 +01:00
Aaron Massey
a2e0a860a6 fuel_gauge: Add init priority
Add an device driver initialization priority for fuel gauge drivers.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-03-17 09:29:39 +01:00
Ranjani Sridharan
b32b321f50 dma: dw: Poll to check for channel disable with timeout
After disabling the channel, it is recommended to poll with timeout to
ensure that the channel has actually been disabled. Without this,
reconfiguring the DMA again while the channel is active could lead to
unexpected behavior and/or DMA underruns.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-03-17 09:29:25 +01:00
Ranjani Sridharan
6226f9e6e4 dma: dw: fix the return value check
The WAIT_FOR() function returns the value of checked expression. So fix
the return value check to log and return the timeout error when checking
if the FIFO is empty during stop.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-03-17 09:29:25 +01:00
Ranjani Sridharan
08d9efb202 dma: dw: Do not program SAR/DAR and CTL_HI/LO when using HW LLI
When using the HW LLI, there is no need to program these resgisters.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-03-17 09:29:25 +01:00
Ranjani Sridharan
045c686734 dma: dw: Add a debug utility function
Add a helper function to dump the GPDMA SHIM and channel registers for
debug along with a config option to enable it.

Co-developed-by: Tom Burdick <thomas.burdick@intel.com>
Singed-off-by: Tom Burdick <thomas.burdick@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-03-17 09:29:18 +01:00
Nick Ward
f3cbd34d3f drivers: sensor: bq274xx: add CONFIG_BQ274XX_PM
This symbol allows users of the driver to disable the
power management feature of just this sensor if they are
not using the int_gpios pin of the BQ274XX.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-03-16 21:40:18 -04:00
Felipe
a92478f4bd drivers: ipm_esp32: add set enabled
default implementation, it is required to be present
when using openamp on zephyr.

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
2023-03-16 16:42:13 +01:00
Michael Kaplan
a818d06cf2 drivers: sensors: apds9960 fix trigger callback context
In the current implementation, the apds9960 trigger callback function
is called with the pointer of a driver-internal allocated trigger
structure. This structure is not initialized anywhere, so essentially
the trigger callback gets called with junk data.

Besides the missing initialization, it would be better instead to hold
a const pointer to a user allocated sensor_trigger object.
This way user code can establish a context with related user data (for
example a pointer to a C++ object) by storing its sensor_trigger object
within a structure alongside the user data, and then using
CONTAINER_OF() macro to get the pointer of the container struct (and
thus the user data).

Signed-off-by: Michael Kaplan <m.kaplan@evva.com>
2023-03-15 22:39:45 +00:00
Francois Ramu
c37272b321 drivers: dma: stm32 disabling stream waits for disable
Add the loop to wait until the stream is really disable after disabling
and also cleared the TCIF flag.
This is a specifity of the dma of type V1.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-15 15:01:15 +01:00
Pieter De Gendt
11574c0a6b drivers: spi: sam: Fix DMA build
A MACRO argument naming mismatch causes a bug when trying to use DMA.

Fix the MACRO argument and conditional DMA configuration.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-03-15 08:48:52 -04:00
Artur Rojek
14912d241c nxp: imx: Implement iuart clock gating
Add clock control support for UART controllers found in i.MX SoC family.
This change moves clock gating out of respective `soc.c` files and into
clock controller's `clock_control_on`/`_off` methods, allowing for
dynamic clock state control, and setup via Device Tree bindings.

This is especially important on SoCs, where Zephyr is sharing the bus
with cores running other OSes, such as might be the case for i.MX 8MM.

Unfortunately, Zephyr doesn't possess an ability to represent clock
hierarchy (e.g. via DT's `assigned-clocks` property), so clock source
and frequency still need to be hardcoded in aforementioned `soc.c`
files.

Signed-off-by: Artur Rojek <artur@conclusive.pl>
2023-03-15 09:13:10 +01:00
Artur Rojek
1bc6045fd9 drivers: clock_control: imx: Simplify pointer casting.
Use `uintptr_t` to cast a pointer to integer type for `clock_name`.
While at it, also remove an unused variable.

Signed-off-by: Artur Rojek <artur@conclusive.pl>
2023-03-15 09:13:10 +01:00
Andrei Emeltchenko
4bb9ad929f drivers: fxos8700: Remove unneeded assignment
Remove unneeded assignment fixing issue with using uninitialized
variable.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-15 09:12:22 +01:00
Henrik Brix Andersen
7442637201 drivers: can: shell: add support for setting SJW
Add support for setting the Synchronization Jump Width (SJW) for both the
classic/arbitration phase and the CAN-FD data phase.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-15 09:12:04 +01:00
Yuval Peress
517a977e84 spi: initialize spi_sam spin locks
Uninitialized sam spinlocks were causing an error if the stack
happens to have 'thread_cpu' memory set to something other than 0.

Signed-off-by: Yuval Peress <peress@google.com>
2023-03-15 09:11:53 +01:00
Fabio Baltieri
2815f96440 drivers: move gpio_keys from gpio to input
Port the gpio_keys_zephyr driver from the gpio subsystem with a
dedicated API to the input subsystem reporting input events.

Move the test as well, simplify the cases a bit since the API is simpler
now.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-03-14 17:15:09 -04:00
Benjamin Björnsson
f38a75f753 drivers: clock_control: add STM32C0 support
Add STM32C0 support to clock_control driver.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-14 17:35:37 +00:00
Benjamin Björnsson
074a6c0f20 drivers: interrupt-controller: intc_exti_stm32: Add STM32C0 Support
Add STM32C0 support to interrupt-controller driver.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-14 17:35:37 +00:00
Benjamin Björnsson
cc03cb3790 drivers: gpio: gpio_stm32: Add STM32C0 Support
Add STM32C0 support to gpio driver.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-14 17:35:37 +00:00
Andrei Emeltchenko
c626070ae6 drivers: mt9m114: Fix value type
Fixes value type conversion from uint16_t to uint32_t.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-14 15:12:22 +00:00
Armin Brauns
a6e5135381 drivers: fpga: ice40: fix busy delay loop
This was being optimized out entirely by certain compiler configurations.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-14 11:17:35 +01:00
Armin Brauns
d0762e5439 drivers/fpga: ice40: use microsecond resolution for reset time
The 200ns reset time specified in the datasheet are a minimum time; and the
nanoseconds were being rounded to whole microseconds anyway.

Also make it the same type as `config_delay_us` (`uint16_t`).

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-14 11:17:35 +01:00
Armin Brauns
2f6dff59c5 drivers/fpga: ice40: use k_usleep instead of busy loop in SPI mode
The 200ns reset time are a minimum value, there is no need to enforce
precise timing (and thus manual per-device calibration) here.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-14 11:17:35 +01:00
Armin Brauns
8aec9dd552 drivers/fpga: ice40: fix minimum config delay
From FPGA-TN-02001-3.3 "iCE40 Programming and Configuration":

> After driving CRESET_B High or allowing it to float High, the AP must
> wait a minimum of 1200 µs, allowing the iCE40 FPGA to clear its internal
> configuration memory.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-14 11:17:35 +01:00
Patryk Duda
8a85f0e87f drivers: flash: Introduce API function for flash extended operations
Besides of standard flash operations like write or erase, flash
controllers also support additional features like write protection or
readout protection. These features are not available in every flash
controller, what's more controllers can implement it in a different way.

It doesn't make sense to add a separate flash API function for every
flash controller feature, because it could be unique (supported on small
number of flash controllers) or the API won't be able to represent the
same feature on every flash controller.

Extended operation interface provides flexible way for supporting flash
controller features. Code space is divided equally into Zephyr codes
(MSb == 0) and vendor codes (MSb == 1). This way we can easily add
extended operations to the drivers without cluttering the API or
problems with API incompatibility. Extended operation can be promoted
from vendor codes to Zephyr codes if the feature is available in most
flash controllers and can be represented in the same way.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-03-14 11:17:13 +01:00
Ionut Catalin Pavel
867c254801 drivers: regulator: common: skip voltage change at init if already valid
The current implementation always sets the voltage before enabling,
even if the current voltage is in the allowed range.

This has some side effects, i.e. for PMIC regulators that are
pre-programmed for a specific value but allow voltage changes during
runtime. The side effect being that the regulator will always be reset
to the lower value of the voltage range at init.

Another usecase would be when a bootloader sets a specific voltage then
loads an application that uses the same driver.

The proposed fix is to evaluate the current voltage and try to bring
the actual voltage in range if the current voltage is not valid
according to the min/max constraints.

Tested on custom SAMD20 board with a custom RK816 PMIC driver.

Signed-off-by: Ionut Catalin Pavel <iocapa@iocapa.com>
2023-03-13 18:33:26 +00:00
Andriy Gelman
6c3998d494 drivers: spi: spi_esp32_spim: Remove check for NULL before freeing
As per k_free() documentation it accepts a NULL argument.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-03-13 14:03:35 +01:00
Andriy Gelman
1eff8e76bd drivers: spi: spi_esp32_spim: Fix potential tx_temp leak
If rx_temp allocation fails then tx_temp needs to freed.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-03-13 14:03:35 +01:00
Lucas Tamborrino
7f4dadee3a drivers: spi: esp32xx: add support for dedicated CS
Currently the driver only support software controlled CS
defined by cs-gpios property.
This commit enables the possibility of using dedicated CS
by setting the pins on pinctrl and omitting the cs-gpios
property.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-03-13 14:02:06 +01:00
Lucas Tamborrino
1adec07f01 drivers: spi: esp32xx: refactor SPI DMA preprocessor identifiers
Change the preprocessor identifier from CONFIG_SOC_ESP32C3 to
SOC_GDMA_SUPPORTED so it can include ESP32S3 in GDMA routines.

Remove hardcoded values from hal calls to use dma_host instead.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-03-13 14:02:06 +01:00
Henrik Brix Andersen
641b89801a drivers: can: mcan: add support for CAN-FD ESI flag
Add support for the CAN-FD Error State Indicator (ESI) flag in received
frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-11 19:45:14 +01:00
Henrik Brix Andersen
e08546fe98 drivers: can: shell: add support for the CAN-FD ESI flag
Print the CAN-FD Error State Indicator (ESI) flag as "P" for "Passive" in
received frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-11 19:45:14 +01:00
Emilio Benavente
5081f6aa28 drivers: pwm: pwm_mcux_sctimer: duty cycle fix
This is a fix for a driver bug that assumes a
user will want a new pwm channel for a new
pwm signal if they decide to change the
period length of the pwm. In some cases,
this creates a noticable change of
duty cycle accuracy.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2023-03-11 19:44:27 +01:00
Henrik Brix Andersen
0f2b17b5e1 drivers: can: shell: add support for CAN-FD frame format filters
Add shell support for adding filters for CAN-FD format frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-10 12:21:03 -08:00
Gerard Marull-Paretas
aced3bb2ac drivers: i2c: gpio: cast io context to void*
i2c_bitbang_init takes a context as void *, so discarding const
qualifier of the driver's config. Explicitely cast to void * to fix the
problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-03-10 12:20:22 -08:00
Declan Snyder
109e03eb4e drivers: memc: fix flexspi init priorities
Fix flexspi memc drivers init priorities

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-03-10 13:10:30 -06:00
Vaishnav Achath
c6da2ebe77 drivers: ieee802154: cc13xx_cc26xx: Allow both radios to coexist
Currently the 2.4G radio driver for CC1352 has few implementations which
prevents both the radios to be used in a single build, thus preventing
applications to have different builds to switch the RF bands even though
the hardware supports dual bands simultaneously.

The following updates are made:
 * Remove RF patches from stack.
 * Implement if_stop() to stop the interface and yield the interface.
 * Use RF_runCmd() instead of RF_runImmediateCmd() so that two RF handles
 can work simultaneously.

All the updates are similar to the more recent cc13xx subg driver which
implements all these recommended practices already.

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2023-03-10 10:22:16 -05:00
Vaishnav Achath
2535a46995 drivers: ieee802154: cc13xx_cc26xx_subg: Skip CRC for invalid packets
During extended testing, rx_done() callback was seen to be invoked with
zero-length packets.When RAW_MODE is enabled, CRC is being appended to
these packets thus making downstream consumers think the packet is valid.
Root cause of the callback being invoked with zero-length packet is
unknown, but appending CRC to these packets is incorrect, thus fix it.

Also fix a minor error which causes build failure when
CONFIG_NET_L2_IEEE802154_SUB_GHZ is not defined.

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
2023-03-10 10:22:16 -05:00
Manojkumar Subramaniam
f75c5b8c3b drivers: gpio: sifive: Update to use the available common IRQ API and
remove obsolete code.

Fixes issue: #20338

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2023-03-10 07:59:42 -06:00
Rainer Paat
ed2c25effc drivers: counter: MCP7940N: initialization fix
This PR fixes MCP7940N initialization failure on Sunday if
external battery is used to keep the RTC running over the
MCU or Zephyr OS restarts.

Signed-off-by: Rainer Paat <rapaat@gmail.com>
2023-03-10 14:09:49 +01:00
Sylvio Alves
4701581776 drivers: timer: esp32c3: fix dtick counter increment
System uptime is not getting incremented when TICKLESS_KERNEL is enabled.

This fixes it by changing the clock_annouce and updating
last_count increment accordingly.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-03-09 17:22:34 +01:00
Attie Grande
cf20ff0765 drivers: i2c: sam0: add support for I2C_MSG_RESTART
This support was accidentally removed in the re-shuffle in de18f97

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2023-03-09 09:22:02 +01:00
Aditya Bhutada
7d9da1c687 drivers: espi: espi_mchp_xec: removed redundant state variables
Removed struct variables for storing states: sx, plt_rst, espi_rst.
While Sx & espi_rst state variables were totally redundant, plt_rst
variable had a use-case to prevent sending multiple callbacks to app.
Experimentally proven that use-case was not valid, as plt_rst isr
itself gets called only upon rising/falling edge.
Removing the condition to check plt_rst's current and previous state,
also solves the problem where global reset do not update plt_rst state.

Signed-off-by: Aditya Bhutada <aditya.bhutada@intel.com>
2023-03-09 09:21:43 +01:00
Jeppe Odgaard
c3b6ad07c1 drivers: uart: mcux_lpuart: add parity support
Read and use device tree parity value.
If the property is not set parity none is used.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-03-09 09:20:44 +01:00
Sam Hurst
430990ee3f usb-c: tcpc: Disable Dead Battery after system starts
The Dead Battery resistors interfere with port partner
detection. So, Dead Battery is disabled after the system
starts and sets the Rd or Rp resistors on the CC lines.

Tested on b_g474e_dpow1 with JP5 set to USBC.
Tested on stm32g081b_eval with JP17 set to D5V.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-03-09 09:20:35 +01:00
Przemyslaw Bida
dc5155e5a5 openthread: ieee802154_nrf5: Add implementation of new api.
Adding an Openthread radio API `otPlatRadioSetMacFrameCounterIfLarger`
implementation and the corresponding call to the IEEEE802154 driver.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-03-08 11:07:22 +01:00
Francois Ramu
551be5c7f6 drivers: adc: stm32 adc driver disable before calibration
In the adc_stm32_init() function, when adc_stm32_calib() is called,
the ADC is not yet enabled but still disabled.
This patch makes sure to Disable the ADC before  its calibration.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-03-08 11:06:27 +01:00
Armin Brauns
821fddc2e1 drivers: bluetooth: hci_spi: fix condition causing infinite loop
With a size of 0, the inner loop will never terminate, so don't try to
enter it.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-08 08:58:33 +01:00
Chen Xingyu
7ae7847643 soc: arm: Add support for STM32H730xxQ
The STM32H730 series has a variant built with SMPS. It uses
`stm32h730xxq.h` header file instead of `stm32h730xx.h`, which has the
SMPS macro defined.

This commit adds the `SOC_STM32H730XXQ` configuration option to allow
the build system include the proper header file. With this change,
boards can enable `CONFIG_POWER_SUPPLY_DIRECT_SMPS` to set up the power
supply for the CPU.

Signed-off-by: Chen Xingyu <hi@xingrz.me>
2023-03-07 15:49:47 +01:00
Declan Snyder
e72d1bf970 drivers: memc: flexspi: Update init priority
Update flexspi driver init priority to be the
memc driver init priority. This fixes a bug where
the flexspi flash drivers on i.MX RT platforms were
being initialized before the flexspi memc driver.
Since those flash drivers depend on the flexspi
spi bus controller being initialized, the flash drivers
would fail to initialize and cause runtime failures.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-03-07 08:32:48 +01:00
Purdea Andrei
f4e0f9004f drivers: usb_dc_rpi_pico: implement remote wakeup support
This change implements the following, necessary for remote wakeup to be
supported:

- implement usb_dc_wakeup_request() call to trigger remote wakeup
- implement interrupts to detect supsended/resumed state
- implement extra logic to simulate resumed state when the resume
  is a result of remote wakeup. In this case the rp2040 chip doesn't
  send a USB_INTR_DEV_RESUME_FROM_HOST interrupt, or any other
  interrupts when the resume condition is detected to be extended
  by the upstream port, so we need to simulate this event when we
  see activity on the bus.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-03-06 21:18:38 +01:00
Yuval Peress
d6c45ad27b sensor: implement drdy trigger for icm42688
Add support for the data ready trigger in the icm42688 driver.

Signed-off-by: Yuval Peress <peress@google.com>
2023-03-06 10:44:52 -06:00
Seppo Takalo
edae1bed3d drivers: kscan: Add driver for XPT2046
Add driver for Xptek XPT2046 resistive touch controller on SPI.
Only interrupt driven mode supported, does not do polling.

Signed-off-by: Seppo Takalo <seppo.takalo@iki.fi>
2023-03-06 17:21:17 +01:00
Sylvio Alves
690f65dbd9 drivers: wifi: esp32: fix possible interface null pointer
esp32_wifi_dev_init() currently starts Wi-Fi stack before
the interface is properly configured, which happens in function
esp32_wifi_init(). This can trigger a ESP32_WIFI_EVENT_STA_START event
before interface initialization, causing a crash.
Moving esp_wifi_start() to esp32_wifi_init() will guarantee that
this won't happen.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-03-06 16:44:45 +01:00
Giancarlo Stasi
654d2176d7 drivers: nrf_rtc_timer: force init of interrupt and event enabling
Make sure that the interrupt and event routing enable bits have the
reset values in case the Zephyr firmware image is chain-loaded.
When started by MCUboot, these registers values aren't the reset values,
but then Zephyr initializes them in same way. Yet, when the Zephyr
firmware image is chain-loaded by nRF5 bootloader, they may have values
that cause the scheduler to behave in unexpected ways.

Signed-off-by: Giancarlo Stasi <giancarlo.stasi.co@gmail.com>
2023-03-06 12:34:08 +01:00
Daniel DeGrasse
7daba22c41 drivers: kscan: fix GT911 support when not using interrupt
Fix support for GT911 touchscreen driver when not using interrupt.
The controller still requires that the INT pin be set to input in
order to correctly respond to I2C queries.

Also, the GT911 requires that the INT pin is not configured until the
RESET pin has been low at least 10 ms after reset, so add an additional
delay during initialization to account for this.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-04 09:19:26 +01:00
Daniel DeGrasse
d8b8566daf drivers: clock_control: add clock rate definitions for MIPI and LCDIF
Add clock rate definitions for MIPI and LCDIF peripherals, to enable
retrival of these peripheral clock rates at runtime.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-04 09:19:26 +01:00
Daniel DeGrasse
0105a85ed2 drivers: display: introduce driver for NXP DCNANO LCDIF peripheral
Introduce driver for NXP DCNANO LCDIF (lcd interface) peripheral,
present on iMX.RT500. Currently this driver only supports updating
the primary framebuffer, and does not implement support for the cursor
buffer present on this IP.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-04 09:19:26 +01:00
Daniel DeGrasse
5cc33d2a3c drivers: mipi: introduce MCUX MIPI DSI 2L driver
Introduce driver for MCUX MIPI DSI 2L. This IP block differs slightly from
the existing MCUX MIPI peripheral, and uses a different hardware
abstraction layer. For these reasons, a new driver was introduced rather
than extending the existing mcux_dsi implementation.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-04 09:19:26 +01:00
Daniel DeGrasse
5455c556f1 drivers: memc_mcux_flexspi: enable configuring AHB RX buffer allocation
Allow configuration of AHB RX buffer allocation. This allows sections
of the AHB RX buffer to be reserved for specific masters, which can
enhance performance.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-04 09:19:26 +01:00
Andriy Gelman
33d1792e3d drivers: spi: Add xmc4xxx driver
Adds spi driver for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-03-03 17:20:17 +01:00
Mark Watson
1f178ca935 drivers: sensor: VL53L1X time-of-flight sensor.
The driver utilizes ST Microelectronics library (which
exists in modules\hal\st\sensor\vl53l1x. Platform specific
headers and source files used by the library are included
and adapted for Zephyr.

The driver can be configured in proj.conf to use a
interrupt/polling methods and the use of the XSHUT pin on
the VL53L1X. All uses were tested successfully.

Signed-off-by: Mark Watson <mwatson@prosaris.ca>
2023-03-03 10:01:55 -06:00
Ben Lauret
70c6befa88 drivers: watchdog: implement Smartbond watchdog driver
This patch adds watchdog driver for Renesas Smartbond SOCs.

Co-authored-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>

Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2023-03-03 11:02:37 +01:00
Ben Lauret
36ac1ee2a2 drivers: entropy: add Renesas SmartBond entropy generator driver
This adds driver for SmartBond TRNG peripheral that with separate
ISR an thread data pools.

Co-authored-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>

Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2023-03-03 11:01:36 +01:00
Matthias Hauser
d4e9e5f46c drivers: sensor: Added driver for the Würth Elektronik WSEN-TIDS sensor
Added sample for the WSEN-TIDS temperature sensor.

Signed-off-by: Matthias Hauser <Matthias.Hauser@we-online.de>
2023-03-03 11:01:10 +01:00
Jeppe Odgaard
9a2997fac9 drivers: sensor: mcux qdec rework rotation
Remove modulus feature and return degrees larger than
count_per_revolution.
This makes it possible to detect if a full rotation has occured.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-03-03 10:59:55 +01:00
Daniel DeGrasse
01b9a9cdbb drivers: sdhc: add support for configurable power on delay to SPI SDHC
Add support for configuring power on delay when using SPI SDHC. This
allows cards that reliably initialize with a shorter (1ms) delay to
avoid the long initialize delay otherwise imposed.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-03 09:18:47 +01:00
Maxmillion McLaughlin
2f9335d20a drivers: i2c: stm32: add bus recovery support
Add I2C bus recovery support to the STM32 v1 and v2 driver. The STM32 i2c
peripheral does not natively support I2C bus recovery so recovery is
performed using GPIO bitbanging. This mirrors the bus recovery
implementation for NXP MCUX LPI2C driver.

Fixes: zephyrproject-rtos#54917

Signed-off-by: Maxmillion McLaughlin <github@maxmclau.com>
2023-03-03 09:18:29 +01:00
Jordan Yates
0561d0dd59 console: uart_console: handle runtime PM
Allow the uart_console console_out implementation to integrate with
'Device Runtime Power Management'.

Without using runtime PM, it is impossible for the application to manage
the power state of a UART instance, given that any module in the
application could theoretically LOG_* or printk at any point in time.

This removes the need to manually call `pm_device_state_set` when the
lowest power states must be reached, while still allowing console and
printk messages to be output.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-03 09:17:49 +01:00
Nicolas Pitre
0fc9c9f46a drivers/timer/arm_arch_timer: driver revamp
Couple issues:

- `sys_clock_set_timeout()` should not base its `mtime` on the current
  time either. Tracking the `last_tick` and `last_elapsed` values avoids
  the need for all the tick rounding computation.

- The MIN_DELAY thing is pointless. The hardware performs a signed
  comparison. If the delay gets close or even behind current time then
  the IRQ will be triggered right away. This is unlikely to happen very
  often anyway so the constant overhead is uncalled for.

- Runtime 64-bits divisions on 32-bits hardware are very expensive.

- The timer must be enabled before the count can return a sensible
  value during driver init (at least on qemu_cortex_a9).

Discussion in PR #54919 applies here too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-03-02 15:37:35 -05:00
Aaron Massey
1657860320 emul: Fix endianness fault in sbs gauge emulator
The sbs gauge emulator intercepts SMBus messages for an sbs gauge
compatible IC. However, it was incorrectly interpreting the byte order of
received register write values based on the endianness of the SoC
architecture instead of SMBus' defined little-endianness. This fault was
not caught earlier because native posix and the majority of qemu
architectures use little-endian.

Explicitly interpret the write values as little-endian.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-03-02 21:14:44 +01:00
TOKITA Hiroshi
47f52bba42 drivers: regulator: add support for RaspberryPi Pico regulator.
Add support for rpi_pico regulator.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-02 21:14:34 +01:00
Dominik Ermel
94af3a88ee drivers: flashdisk: Change page info verification log message
Change message to make allow distinguishing between error while
getting page info for disk configuration and page layout
verification.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-02 17:08:39 +01:00
Grant Ramsay
9df37fff79 drivers: serial: Add pinctrl support to the NS16550 driver
This enables configuring pins for the UART

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-03-02 13:50:06 +01:00
Grant Ramsay
026105c883 drivers: pinctrl: Add pinctrl support for TI K3 devices
K3 is a common architecture used between different TI
processor families

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-03-02 13:50:06 +01:00
Purdea Andrei
73a800f7dd drivers: usb_dc_rpi_pico: fix stability issue related to control transfers
Description of the bad behaviour before this change:

The arming of the control EP0_OUT endpoint was not kept under
control. It could happen that the EP0_OUT endpoint was left
armed, after the completion of a complete control transfer.

It is clear that the intention was to NOT keep EP0_OUT constantly
armed while idle, because usb_dc_ep_enable() doesn't arm it,
and the intention was for when usb_dc_ep_read() is called to
collect the Setup-Stage 8-byte data, that is when EP0_OUT is armed,
and before this call is performed, the host will keep getting NAKs
for the Data-Stage of the to_device control transfer.

This happens correctly on the first to_device control transfer with
wLength > 0. However, because usb_dc_ep_read_continue() indiscriminately
re-arms all OUT endpoints, in the case of to_device control transfers
with wLength > 0, on the Data-Stage, the endpoint is also re-armed,
which is wrong, because then the endpoint will be left armed after
the control transfer is over.

In this case when a new to_device control transfer starts, the
Data-Stage will be accepted on the first try. This would still
have worked without a failure if the Setup-Stage would have been
processed immediately, but because we process everything in a work
queue at a later time, when the Setup-Stage associated 8-byte data
buffer is read both the Setup-Stage and Data-Stage have arrived.
At the end of handling the Setup-Stage we try to re-arm the EP0_OUT,
which already contains data, thereby corrupting the received length
portion of the buf_ctl register. (Obviously other fields are changed
too, but the length field is the one that first causes chaos, cause
it's written to the maximum, which is 64.) The above mentioned Data-Stage
already has a message in its workqueue for it to be processed, but
it is picked up only after the length field has been corrupted.
Because of this usb_dc_ep_read() thinks there is more data in the buffer
than there really is, and everything becomes de-synchronized, with
later reads accessing uninitialized parts of the buffer.

This sounds like a fundamental failure, that should make it impossible
to operate USB, however the reason this behaviour doesn't make it
impossible to enumerate the device is that this only affects
to_device control transfers with wLength > 0, and during enumeration
there are not many of those happening.
When enumerating a HID keyboard, there is only _one_ of those
happening, and it is the initial setting of the lock light led status.
And that first one succeeds because it's the first one. (However, later
lock light setting control transfers can cause problems, which is how
this problem was encountered.)

The solution in this commit is to keep better control over when EP0_OUT
is armed. This forces the Data-Stage to arrive later (the host will keep
re-trying), and that way the corruption of the buffer control register
is avoided.

Summary of the changes:
 - Rework the logic around deciding wether to re-arm the out endpoint
   after a read. For non-0 endpoint the previous behaviour is kept,
   however for EP0 it is only re-armed if more OUT transactions are
   expected for that SETUP transfer (be it data-stage or status-stage)
 - Force un-arm the EP0_OUT endpoint in case a stall condition is observed.
 - When a setup transfer is received check if EP0_OUT is already armed.
   If armed then log a warning message, and force-disarm it.
 - When a setup req interrupt fires, don't immediately force the next
   read to get it, instead, it will be read only after a setup message
   is extracted from the message queue.
 - When a setup packet is received abort any unfinished previous control
   transfers:
    - cancel any data buffers given to the EP0_IN endpoint
    - drop any new ep0_in writes that are attempted before this newest
      setup packet's associated message is extracted from the message
      queue.
 - In the ISR, check buffer interrupts before setup req interrupts.
   This is to make sure that the final 0-length status message from the
   previous setup packet is consumed before the new setup packet.
   (this is the only case now when both interrupts could be seen as
   having fired by the time the interrupt handler routine executes.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
Co-authored-by: Johann Fischer
2023-03-02 12:58:24 +01:00
Jeff Daly
3acdc971fb drivers: pwm: mchp_xec: fix PWM control register updates
The pwm_mchp_xec driver doesn't clear the divisor or clock select fields
of the config register value before writing it back.  If the register
was previously written, the new values were being logically OR'd with
the prior values.

Signed-off-by: Jeff Daly <jeffd@silicom-usa.com>
2023-03-02 10:55:33 +01:00
Ruibin Chang
f77f02c032 ITE drivers/sensor/vcmp/it8xxx2: add work queue for voltage comparator
Voltage comparator driver submits notifications into system work queue,
this change will make driver to use dedicated work queue, and priority
of dedicated work queue are configurable as well.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-03-01 09:12:49 -06:00
Hein Wessels
7d76842fdf drivers: dma: stm32: dmamux: support dmamux2 and bdma
Extends dmamux driver to support DMAMUX 2,
which supports the BDMA on STM32H7 devices.

Co-authored-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-03-01 15:58:27 +01:00
Hein Wessels
c4f88a9d6e drivers: dma: stm32: dmamux: abstact calls to dma drivers
Wrap calls to DMA drivers through fops to allow
different dmamuxes to point to different types of
dma with different function calls.

In preperation to add support for BDMA and DMAMUX2.

Co-authored-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-03-01 15:58:27 +01:00
Hein Wessels
e01270793e drivers: dma: stm32: bdma support for H7
Implement STM32H7 BDMA driver.

Co-authored-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-03-01 15:58:27 +01:00
Jay Vasanth
f8d9465332 pm: adc: MEC172x adc device PM support
update MEC172x adc driver to support device PM.
Implement pm resume and suspend actions to put adc
pins in proper state for suspend and resume.
Notify kernel of busy when adc sampling is in progress.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-03-01 08:41:16 -06:00
Nazar Palamar
bc638f38db drivers: gpio: Add Infineon CAT1 GPIO driver
Added initial version of Infineon CAT1 GPIO driver.
Added initial version of binding file for Infineon CAT1 GPIO driver.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-03-01 11:44:57 +01:00
Nazar Palamar
f956e81bb6 drivers: serial: Add Infineon CAT1 UART driver
Added initial version of Infineon CAT1 UART driver.
Added initial version of binding file for Infineon CAT1 UART driver.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-03-01 11:44:57 +01:00
Nazar Palamar
81822e0501 drivers: clock_control: Add Infineon CAT1 clock control driver
Add initial version of Infineon CAT1 clock control driver.
- supports clock initialization based on board DT configuration.

Added initial version of system_clocks.dtsi for Infineon PSoC 6 SOC.
Includes: clk_imo, path_mux0..4, fll0, pll0, clk_hf0..4, clk_fast,
clk_slow and clk_peri.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-03-01 11:44:57 +01:00
Nazar Palamar
dcf52fd566 drivers: pinctrl: Add Infineon CAT1 Pin controller driver
Added initial version of Infineon CAT1 Pin controller driver.
Added initial version of binding file for Infineon CAT1 Pinctrl driver.
Added initial version of dt header for Infineon CAT1 pinctrl driver.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-03-01 11:44:57 +01:00
Erwan Gouriou
8b4407ab7c drivers: clock_control: stm32: Implement F412 PLL I2S Support
Add PLLI2S support within clock_control driver.
This implementation is compatible with "st,stm32f412-plli2s-clock"
binding.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-03-01 08:56:05 +01:00
Erwan Gouriou
e04ff4c3db drivers: clock_control: stm32: Implement F4 PLL I2S Support
Add PLLI2S support within clock_control driver.
This implementation is compatible with "st,stm32f4-plli2s-clock"
binding.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-03-01 08:56:05 +01:00
Jeff Daly
bd1a8141e5 drivers: pwms: pwm_xec: add polarity support to XEC PWM driver.
Polarity support added to XEC PWM driver.  This allows (for example) PWM
controlled LEDs that are active low to actually be turned off when set
to off.

Signed-off-by: Jeff Daly <jeffd@silicom-usa.com>
2023-03-01 08:55:49 +01:00
Jamie McCrae
f9fd899da0 drivers: bbram: Add Microchip MCP7940N driver
Adds Microchip MCP7940N battery-backed RAM support.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-01 08:55:39 +01:00
Benedikt Schmidt
ecafade8ae drivers: gpio: add driver for PCAL6416A
Generalize the driver for PCAL6408A into a more abstract base
and reuse this abstraction to implement a driver for
PCAL6416A.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-02-28 20:09:19 -05:00
Benjamin Cabé
ca90bdacf3 drivers: sensor: th02: Handle unsupported channels
Fixed th02_channel_get() code to return -ENOTSUP when the channel is not
supported.
Fixes #55160.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-02-28 10:58:52 -06:00
Gerard Marull-Paretas
27b73a116f soc: arm: nordic_nrf: replace NRF_DT_CHECK_PIN_ASSIGNMENTS
Since PINCTRL and pinctrl-0 is now required, there's no point in doing
extra validation at driver level. Modify the macro to just check that
sleep state is present when needed, since it was the only remaining
assertion that was not covered. Renamed the macro to make it more clear
what it does: NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
1efaa94bc6 drivers: audio: dmic_nrfx_pdm: drop -pin support
Driver will always use pinctrl now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
708a00d587 drivers: flash: nrf_qspi_nor: drop -pin support
Driver will now use pinctrl only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
401334446d drivers: sensor: qdec_nrfx: drop -pin support
QDEC driver will only use pinctrl now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
868c25de76 drivers: pwm: nrfx: drop -pin support
PWM driver will now use pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
a8efe38c43 drivers: i2s: nrfx: drop -pin support
Driver will now use pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
dea028a0da drivers: i2c: nrfx_twi/m: drop -pin support
TWI/M drivers will use pinctrl now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
55ac2f91f6 drivers: spi: nrfx_spi/s/m: drop -pin support
SPI/S/M drivers will only use pinctrl now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Gerard Marull-Paretas
aa9df1abc0 drivers: serial: nrfx_uart/e: drop -pin support
UART/E driver will only support using pinctrl now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-28 08:42:05 -08:00
Lucas Tamborrino
be577cfef0 drivers: i2c: esp32xx: Remove direct REG access
Remove direct register access and use hal functions instead.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-02-28 14:44:47 +01:00
Seppo Ingalsuo
8ef2cd20d9 Drivers: DAI: Intel: DMIC: Shorten unmute ramp time
This change produces more quickly in the stream valid
audio samples. The start fade-in ramp can be shortened to
100 ms for 48 kHz and 200 ms for 16 kHz. It was before 200 ms
and 400 ms. The updated DMIC hardware in allows to do this
change.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@intel.com>
2023-02-28 11:43:14 +01:00
Dawid Niedzwiecki
e734adfb78 subsys/mgmt/ec_host_cmd: update directory structure
The Host Commands can be used with different transport layers e.g. SHI
or eSPI. The code that provides the peripheral API and allows sending
and receiving Host Commands via different transport layers is not
actually drivers of a peripheral, so move it to the
subsys/mgmt/ec_host_cmd folder.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2023-02-28 10:42:23 +01:00
Sylvio Alves
d4ef6aa713 drivers: interrupt: add esp32s3 interrupt controller
Enables SoC specific interrupt controller.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-02-27 19:41:33 +01:00
Sylvio Alves
f1cc21a146 driver: uart: esp32s3: enable ESP32S3 uart interface
Includes additional SoC specific headers.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-02-27 19:41:33 +01:00
Sylvio Alves
da66cffd3a clock: esp32s3: add peripheral initialization
Update clock control source to enable proper
ESP32S3 clock init.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-02-27 19:41:33 +01:00
Julien D'Ascenzio
704ca8f1b4 drivers: timer: stm32_lptim: fix sys_clock_* return value
This commit finish to fix the bug describe by 85e2a0679a68f02f7ef.
With the previous correction, the uptime read could be in the past:
if the counter rewinds just after testing ARRM flag, we had lost
some counts.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2023-02-27 17:31:03 +01:00
Pieter De Gendt
a6ff01cc3d drivers: flash: spi: Move to using select in Kconfig for SPI bus
Move to using 'select SPI' instead of 'depends on SPI'
(see commit df81fef for more details)

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-02-27 14:35:15 +01:00
Benedikt Schmidt
fd44b2eb2d drivers: gpio: add driver for BD8LB600FS
Add a driver for BD8LB600FS

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-02-27 06:44:23 -05:00
Lucas Tamborrino
1eda399c44 drivers: gpio: esp32: fix reset interrupt status on new config
The interrupt status of the GPIO was not cleared when a new
interrupt configuration was set. This prevents the driver from
passsing all the gpio tests.

Fixes #54833

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-02-27 11:35:26 +01:00
Purdea Andrei
38f554ef4f drivers: gpio_rpi_pico.c: add support for single-ended IO
Note: RP2040 can support single-ended IO, by setting the GPIO_OUT
register to a constant value, and then changing the GPIO_OE register
instead, when the output has to change. To do this, the output-setting
functions need to know which pins have been configured as single-ended,
and for that reason the data structure has been extended to include
this information.

Another change is the PR, is that setting of the pull-ups/pull-downs
now applies to both inputs and outputs as well. Previous solution was
wrong, because if the user wanted to set up an input with a pull
resistor enabled, and then reconfigure it to an output without any
pulls, then the pulls remained in place for the output. Now pulls
are correctly set based on the gpio flags for outputs too, and this
is especially useful for single-ended outputs too.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-26 18:38:08 -05:00
Jordan Yates
b83cf1f1ee drivers: serial: uart_rtt: fix multi-channel
Populate the `channel` index when constructing configuration structs for
secondary RTT channels. Originally missed in #27704.

Fixes #54955.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-02-25 06:55:58 -05:00
Yuval Peress
ebfd9aaba5 sensor: Implement driver and tests for akm09918c
Add the implementation for the akm09918c magnetometer driver.
Additionally, add the appropriate node to the TDK robokit1 device
tree. In order to prevent regressions, add the sensor to the sensor
build_all tests and specific tests using an emulator.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 17:00:14 -05:00
Jonathan Rico
f8e5e17246 drivers: led_strip: add WS2812 I2S-based driver
Add a driver implementation that uses the I2S peripheral.
Based off this blog post:
https://electronut.in/nrf52-i2s-ws2812/

Should help with #33505, #29877 and maybe #47780, as there is no garbage
data at the end of transmissions on nRF52832, and no gaps.

Signed-off-by: Jonathan Rico <jonathan@rico.live>
2023-02-24 10:12:47 -08:00
Grant Ramsay
f92dd6d357 drivers: serial: Name the NS16550 variant Kconfig choice
Naming this choice allows setting a default value in defconfig.

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-02-24 18:11:56 +01:00
Yuval Peress
0e003cdbee test: verify accel/gyro data for icm42688
Verify the conversion of register values in both accel and gyro to
sensor_value for the icm42688.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
e6514d4dc9 icm42688: Add test for data read and temperature regisers
Add tests that verify the behavior of the REG_INT_STATUS, REG_TEMP_DATA1,
and REG_TEMP_DATA0 registers

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
591958752a icm42688: fix configure call
The icm42688 introduced a safe configure function to make the
configuration more atomic, but the main driver was never updated
to call it so the new config values were discarded.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
a3f59fd86f icm42688: Fix temperature calculation
Fix the calculation which was adding the 25 degree offset too late.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
8ac822e69c emul: Cleanup emul directory
Avoid implementations in the subsys emul directory to keep the directory
focused on emulator subsystem instead of consumers. Consumers should be
implemented side-by-side to their drivers

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
a6326f1f7f bmi160: move emulator to driver directory
Allow the emulator to sit in the same directory as the driver
implementation. This will make working on the emulator much easier and
keep the emulator subsystem directory clean by allowing it to focus on
the actual subsystem and not the use cases of the subsystem.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Yuval Peress
2bb4de9a0b emul: Add emulator for icm426888
Add an implementation for the icm42688 emulator that supports reading
any registers.

Signed-off-by: Yuval Peress <peress@google.com>
2023-02-24 11:50:10 +01:00
Maciej Baczmanski
01884c857a drivers: ieee802154: nrf5: added continuous_carrier API call
implemented `nrf5_continuous_carrier()` which starts continuous
carrier wave transmission

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2023-02-24 09:26:01 +01:00
Francois Ramu
9363a9319e drivers: flash: stm32 qspi Enter 4-Byte Address Mode
No need to read back the CR (NOR flash config or control register)
to check if entering the 4-Byte Address Mode is effective.
The action of this command is immediate and the result
(bit field of the CR) is NOR flash vendor-specific.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-02-24 09:13:44 +01:00
Gerard Marull-Paretas
a1e983fef0 drivers: pinmux: drop driver class
Pinctrl is the new pinmux.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
f436aeb12c drivers: spi: xec_qmspi: remove unused pinmux.h include
Driver did not use pinmux API.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
d76f4f2c8a drivers: pinmux: mchp_xec: drop driver
Drop Microchip XEC driver in favor of pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
9ca624eb13 drivers: pinmux: mcux: drop driver
Drop the MCUX driver in favor of Kinetis pinctrl driver.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
099012a59f drivers: pinmux: lpc11u6x: drop driver
Drop LPC11U6X pinmux driver in favor of pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
33372b9e48 drivers: pinmux: mcux_lpc: drop driver
Drop MCUX LPC pinmux driver in favor of pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
d925c660ed drivers: pinmux: stm32: drop driver
Drop STM32 pinmux driver in favor of pinctrl. Some definitions located
in pinmux headers were used by the pinctrl driver, so they have been
moved there.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Gerard Marull-Paretas
f1539b48cf drivers: pinmux: rv32m1: drop driver
Drop RV32M1 pinmux driver in favor of pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Andrei Emeltchenko
8e84d840b5 usb: Fix build for 64 bit platforms
Use proper format for size_t type eliminating warnings of type:

...
error: format '%u' expects argument of type 'unsigned int', but
argument 2 has type 'size_t' {aka 'long unsigned int'}
[-Werror=format=]
...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-02-23 17:51:31 +01:00
Andrei Emeltchenko
ddf9854bfb usb: udc_virtual: Adapt to updated API
Commit 00adb2a539 ("drivers: udc: remove no more required pending
state flag") removed state parameter from udc_buf_peek and udc_buf_get.
Adapt udc virtual driver so the code compiles.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-02-23 17:51:31 +01:00
Petr Hlineny
94847be172 drivers/disk: sdmmc stm32: Enable SDMMC Internal DMA on STM32L4plus mcu
STM32L4plus mcu has SDMMC internal DMA which works without any
configuration and it's handled by SDMMC HAL driver. This commit adds
option to enable it and use it.

Signed-off-by: Petr Hlineny <development@hlineny.cz>
2023-02-23 10:48:50 +01:00
Goh Shun Jing
9ecfa4decc drivers: serial: uart_altera: add driver
Add driver for altera avalon uart core.

Signed-off-by: Goh Shun Jing <shun.jing.goh@intel.com>
2023-02-23 09:26:33 +01:00
Petr Sharshavin
f5ae6ccfa8 drivers: lora: fix busy after sx12xx_lora_test_cw
The LoRa modem has been staying in STATE_BUSY
after sx12xx_lora_test_cw() call
because Radio.SetTxContinuousWave() doesn't configure the PHY
to raise 'TX done' event.

It runs TxTimeoutTimer instead,
so we have to handle 'TX timeout' event to correctly release the modem.

This fix has been tested on custom board with STM32L4 and SX1276.

Signed-off-by: Petr Sharshavin <sharshavin@mail.ru>
2023-02-23 09:25:39 +01:00
Garrett Battaglia
65e3f5b23d drivers: sensor: add MAX31855
add MAX31855 cold-junction compensated thermocouple-to-digital
converter sensor driver and sample

Signed-off-by: Garrett Battaglia <garrett@garrettbattaglia.com>
2023-02-23 09:06:28 +01:00
Henrik Brix Andersen
eb9bbf4490 drivers: can: sja1000: move public header file to public include path
Move the can_sja1000.h header file to the public
include/zephyr/drivers/can/ include path. This allows writing out-of-tree
SJA1000 based driver front-ends.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-02-23 09:00:34 +01:00
Henrik Brix Andersen
36bffb20ae drivers: can: move CAN utility function to public header
Rename the can_utils_filter_match() utility function to
can_frame_matches_filter(), move it to the public
include/zephyr/drivers/can.h header file, and add a missing mismatch for
standard (11-bit) ID frames passing extended (29-bit) filters.

This allows using the utility function in out-of-tree CAN drivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-02-23 09:00:12 +01:00
Tim Lin
00e6c19ab5 ITE: drivers/adc: Add config of ADC reference voltage full-scale 3300mV
This option can enable ADC internal reference voltage as
full-scale 3300mV.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-02-23 08:59:54 +01:00
Alexander Wachter
244f623f8c drivers: gpio: emul: replace mutex with spinlock
Replace all mutex with spinlocks to make the driver usable
from ISRs.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2023-02-22 21:48:30 +01:00
Mulin Chao
809e63a91a driver: uart: npcx: add missing tx/rx interrupt enabled checks
When checking if any UART TX/RX IRQs are pending, the driver should also
consider whether these IRQs are enabled. Or we still get pending status
set even if the related interrupts are disabled.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-02-22 16:30:08 +01:00
Mulin Chao
dbc614ee10 driver: uart: npcx: avoid concurrency writing UFTCTL register
In order to avoid concurrency situation during writing UFTCTL register,
this CL adds critical sections to prevent the unexpected result if the
driver wants to set/clear bits of this register.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-02-22 16:30:08 +01:00
Logiase Song
4b135fe911 drivers: clock_control: stm32: fix error pll freq calculation
The origin pll freq calculation leads to an uint32_t overflow

Signed-off-by: Logiase Song <logiase.syx@gmail.com>
2023-02-22 15:39:54 +01:00
Krishna T
186fbc33a2 drivers: ieee802154: Fix build error for variable net buffers
The assert is only applicable for fixed network buffers, so, add a
protection.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2023-02-22 12:18:24 +01:00
Cyril Fougeray
f43292a01a adc: stm32: stop ADC before disabling it
It is advised to stop any ongoing ADC conversion before
disabling the peripheral.
Added some comments so that ADC state isn't left into
intermediate state that would prevent correctly
enabling or disabling the peripheral

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-02-22 12:05:32 +01:00
Jonathan Rico
894275c098 Bluetooth: HCI: Make driver stack sizes configurable
This is necessary to prevent stack overflows when building with
non-standard configurations (e.g. CONFIG_DEBUG).

Adding them as hidden kconfig options to avoid the stuck kconfig syndrome.
Users are free to redefine them in their app to force a value.

The userchan.c driver is only built for posix, and the help text for
ARCH_POSIX_RECOMMENDED_STACK_SIZE states that the real stack comes from
somewhere else (the pthread stack), hence why it doesn't use the new
kconfig options.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-22 11:58:15 +01:00
Fabio Baltieri
8c6137d7a7 build: sort and compact drivers and subsys CMakeLists and Kconfig
There are just list of child files to include, right now there's a hint
of that trying to be alphabetical but then entries have been added with
various logic, so one has to figure where stuff has to be added.

Rewrite these to:
- keep the list alphabetical, for CMakeLists unconditional first,
  conditional after so one just has to select and sort
- drop the spaces in the Kconfig
- use a single space between  target and directory
- rename from "Sub Systems" to "Subsystems" (single word)

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-22 10:25:11 +01:00
Aaron Massey
6cdef0894f drivers: fuel_gauge: kernel drivers use syscalls
The fuel gauge API doesn't make use of syscalls with device drivers, which
is not congruent with Zephyr's security model.

Correct the fuel gauge API to only allow access to fuel gauge device
drivers functionality via syscalls to keep with Zephyr's security model.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-02-22 08:51:55 +01:00
Aaron Massey
7d83bf7d54 drivers: fuel_gauge: Rename API struct
Fuel gauge API struct type is currently named battery_driver_api, this is
inaccurate as the API struct represents functions for interacting with fuel
gauge drivers in particular.

Rename the API struct type to fuel_gauge_driver_api to clearly signal its
functionality.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-02-22 08:51:55 +01:00
Tom Burdick
2ae6b7bd75 sensor: icm42688 configuration and regmap fixes
The int config and fifo config register addresses were wrong, fix those.

Adds lots of debug information (when LOG_DBG=y) to the configuration of the
device which is incredibly helpful for diagnosing configuration issues.

Disables the device interrupts while reconfiguring. Adds a safely
reconfigure function which will rollback to previous configuration
on misconfiguration.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-02-22 08:51:30 +01:00
Nicolas Pitre
11a2107d99 riscv: timer: driver revamp
Several issues:

- `last_count` should not be updated with current time or this will
  cause a time drift and induce jitter due to IRQ servicing latency.

- `sys_clock_set_timeout()` should not base its `mtime` on the current
  time either. Tracking the `last_tick` and `last_elapsed` values avoids
  the need for all the tick rounding computation.

- The MIN_DELAY thing is pointless. If the delay gets close or even behind
  current time then the IRQ will be triggered right away. This is unlikely
  to happen very often anyway so the constant overhead is uncalled for.

- Runtime 64-bits divisions on 32-bits hardware are very expensive.

Fix the above, and improve the following:

- Prime the accounting by simply invoking the IRQ handler from the init
  code. That will make the "ticks since boot" counter right.

- Remove excessive casts, especially a few wrong ones.

- Simplify the code overall.

Here's the output from the timer_jitter_drift test.

Before this patch:

|timer clock rate 60000000, kernel tick rate 10000
|period duration statistics for 10000 samples (0 rollovers):
|  expected: 1000 us,            60000.000000 cycles
|  min:      907.600000 us,      54456 cycles
|  max:      1099.750000 us,     65985 cycles
|  mean:     1008.594633 us,     60515.678000 cycles
|  variance: 2.184205 us,        7863.136316 cycles
|  stddev:   1.477906 us,        88.674332 cycles
|timer start cycle 995589, end cycle 606152369,
|total time 10085946.333333 us, expected time 10000000.000000 us,
|expected time drift 0.000000 us, difference 85946.333333 us

After this patch:

|timer clock rate 60000000, kernel tick rate 10000
|period duration statistics for 10000 samples (0 rollovers):
|  expected: 1000 us,            60000.000000 cycles
|  min:      992.116667 us,      59527 cycles
|  max:      1030.366667 us,     61822 cycles
|  mean:     1000.001902 us,     60000.114100 cycles
|  variance: 0.105334 us,        379.201081 cycles
|  stddev:   0.324551 us,        19.473087 cycles
|timer start cycle 987431, end cycle 600988572,
|total time 10000019.016667 us, expected time 10000000.000000 us,
|expected time drift 0.000000 us, difference 19.016667 us

The mean, variance and standard deviation number differences speak for
themselves, even in the absence of competing ISRs and/or IRQ-disabled
periods which would have made the comparison even worse.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-02-21 18:04:55 -05:00
Bartosz Bilas
2b4a6e52d5 drivers: i2c: eeprom_target: switch to dedicated driver compatible
Create and use a new `zephyr,i2c-target-eeprom` compatible
within I2C  eeprom target driver that allows to use
that driver along with real atmel at24 EEPROM simultaneously.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2023-02-21 18:03:11 -05:00
Andriy Gelman
4e13e6ada7 drivers: serial: xmc4xxx: Fix Kconfig help entry
The configurations are no longer hard coded for UART_0.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00
Andriy Gelman
30b11260be drivers: uart_xmc4xxx: Add async support
Adds async uart for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00
Andriy Gelman
cfeaada65e drivers: uart_xmc4xxx: Change order of functions
This patch is in preparation of uart async support. There are no
functional changes. The patch changes the ordering of functions to
organize shared functions between async/interrupt driven in the same order.
Also move uart_xmc4xxx_init() so that a forward declaration can be
removed.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00
Andriy Gelman
3dac715569 drivers: uart_xmc4xxx: Split up tx/rx into separate service requests
In preparation for async support. In async uart, service requests are
forwarded to separate dma lines. This patch splits up tx/rx into
separate service requests to enable this.

Also put service request enable code into a separate function. Before,
the same code was generated for different uart devices.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00
Andriy Gelman
8a97da056b drivers: dma: Add infineon xmc4xxx dma support
Adds dma drivers for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-21 21:15:53 +01:00
Marcin Niestroj
2087579d8e drivers: wifi: esp_at: support WiFi 'iface_status' callback
This allows to fetch information about currently connected WiFi network,
e.g. with WiFi mgmt shell commands:

  uart:~$ wifi status
  Status: successful
  ==================
  State: COMPLETED
  Interface Mode: STATION
  Link Mode: UNKNOWN
  SSID: Tp-Link
  BSSID: xx:xx:xx:xx:xx:xx
  Band: 2.4GHz
  Channel: 13
  Security: UNKNOWN
  MFP: UNKNOWN
  RSSI: -39

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-02-21 18:09:40 +01:00
Marcin Niestroj
650b244215 drivers: wifi: esp_at: fetch version of ESP-AT firmware
For development and debugging purposes it is good to know what is the
version of ESP-AT firmware used on modem. This can be fetched with AT+GMR
command.

Fetch this information during driver init and log all available version
strings, so they look like that:

  wifi_esp_at: AT version: 2.1.0.0(883f7f2 - Jul 24 2020 11:50:07)
  wifi_esp_at: SDK version: v4.0.1-193-ge7ac221
  wifi_esp_at: compile time: (0ad6331):Jul 28 2020 02:47:21
  wifi_esp_at: Bin version: 2.1.0(WROOM-32)

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-02-21 15:04:08 +01:00
Andrzej Głąbek
68bd036947 drivers: entropy_nrf5: Eliminate direct use of WFE instructions
Use the appropriate kernel function, i.e. `k_cpu_atomic_idle()`,
instead of directly executing the WFE instruction.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-02-21 15:02:54 +01:00
Fabio Baltieri
d4c8de514f drivers: net: initialize logging for the slip module
This fixes a regression introduced in:

16a0e314ea drivers: net: Move Ethernet device definition for SLIP to
	   ethernet

Where the module would fail to build with:

log_core.h:153:20: error: '__log_level' undeclared (first use in this
function)

Registering a module fixes the build.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-20 16:44:23 +01:00
TOKITA Hiroshi
0324a2fb24 drivers: display ssd1306: Remove referencing to cfb.h
It is undesirable referencing to cfb.h because it form
reverse dependency from the driver layer to the subsystem layer.
Including drivers/display.h can solves all references in this file,
so replace it with this.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-02-20 16:29:25 +01:00
Khor Swee Aun
c93c853cba drivers: timer: Machine timer driver enablement for NIOSV
Update machine timer drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on NIOSV devicetree.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
2023-02-20 09:29:13 -05:00
Gerard Marull-Paretas
86a0f80c57 drivers: usb: udc: nrf: fix declaration after label
C language does not allow declarations after labels, only statements are
allowed. Add {} around the `NRFX_USBD_EVT_SETUP` case to fix build
issues (`error: a label can only be part of a statement and a
declaration is not a statement`)

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-20 13:22:02 +01:00
Adrian Warecki
9af2789cad watchdog: dw: Fixed interrupt configuration
An invalid macro name was used to check whether the watchdog device has
configured interrupts. As a result, the interrupt were never configured.
This issue has been fixed.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-20 06:53:06 -05:00
Armin Brauns
b2c75f423a drivers: disk: sdmmc_stm32: handle DMA errors instead of ignoring them
One was clearly a typo, the other should also be handled properly.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-02-20 12:40:45 +01:00
Emil Gydesen
ab6a26ab17 flash: flash_shell: Fix check_arr size
The check_arr used the TEST_ARR_SIZE value for the size, but
has been removed and replaced with CONFIG_FLASH_SHELL_BUFFER_SIZE.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-20 19:41:17 +09:00
Andriy Gelman
0079cabb49 drivers: sensor: Add infineon xmc4xxx die temperature sensor
Adds die temperature driver for infineon xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-02-20 11:14:15 +01:00
Adrian Bonislawski
1243fa7f2d drivers: counter: align ace rtc get_value with api
This will align ace rtc get_value parameter with counter api
and fix build warning

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2023-02-20 11:13:45 +01:00
Adrian Bonislawski
c1b216d3bf drivers: counter: return status in ace rtc counter
This will align return value with counter API and fix build warning

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2023-02-20 11:13:45 +01:00
Adrian Bonislawski
9952576945 drivers: counter: fix ace counters build errors
This will fix includes and allow to successfully build ace counters

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2023-02-20 11:13:45 +01:00
Dominik Ermel
a33186a8f9 drivers: flash: spi_nor: Return EINVAL when erase out of range
Fixes spi_nor_erase to return -EINVAL instead of -ENODEV
when erase requested is out of flash range.
This makes the SPI NOR return the same error as all other errors.

Fixes #54897

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-20 10:54:00 +01:00
Robert Lubos
16a0e314ea drivers: net: Move Ethernet device definition for SLIP to ethernet
Currently, if CONFIG_SLIP_TAP is enabled (default for QEMU), and no
other Ethernet driver is enabled, the following warning is printed by
CMake:
    No SOURCES given to Zephyr library: drivers__ethernet

This happens because SLIP_TAP enabled Ethernet L2, but has no actual
sources in drivers/ethernet. This commit fixes this, by moving the
actual definition of the SLIP TAP Ethernet interface into a separate
file, within drivers/ethernet. Technically, in that configuration SLIP
defines a Ethernet device, implementing Ethernet API, so such a change
is justifiable, and prevents unwanted warning from being generated.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-02-20 10:52:20 +01:00
Ryan Erickson
75926dacb3 modem: hl7800: Fix DNS resolver for all address families
Fix DNS resolver config for IPv6 only setup.
Check validity of the DNS addresses before trying to
configure the resolver.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-20 09:51:38 +01:00
Tim Lin
6ae75b6d00 ITE: drivers/i2c: Mutex issue in I2C transfer
These global variables should be under the mutex lock, otherwise they
will be overwritten by other transfers.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-02-20 09:50:36 +01:00
Ryan Erickson
dd195d6ea5 modem: hl7800: fix power off
Ensure DNS resolver is stopped if modem is turned off.
All IO connected to the HL7800 need to be de-asserted
in order for the HL7800 to power off.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-20 09:49:43 +01:00
Hein Wessels
e2c9d30578 drivers: flash: shell: default test repeat parameter when not supplied
Previously when the repeat argument wasn't supplied to the shell
command it would falsely seem to succeed, even though the
test was never run. Instead of displaying an error message this
rather overrides the repeat to 1, so that the test is run once.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-02-20 09:49:22 +01:00
Hein Wessels
636a1615b3 drivers: flash: shell: add verify step to cmd_test
Previously cmd_test could falsely give the indication that the
flash driver is functioning properly, because the written data
isn't validated and could have silently failed.

This commit adds a verify step to ensure the data was written successfully.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-02-20 09:49:22 +01:00
Peter Mitsis
5760523091 drivers: mm: Use mm_drv_bank module
Updates the meteor-lake TLB MM driver to use the memory bank module
to track page usage statistics.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-02-20 09:48:44 +01:00
Peter Mitsis
87899c07f7 drivers: mm: Add module for tracking page usage
Adds a module for tracking page usage within a memory bank.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-02-20 09:48:44 +01:00
Jamie McCrae
3c9d529899 flash: flash_shell: Add flash read/write/erase speed test commands
Adds commands which can be used for timing flash device tasks and
outputting a rough speed.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-02-20 09:48:24 +01:00
Jun Lin
2e961102c1 driver: Port80: npcx: defer Port80 code sending to workqueue thread
If the host sends Port80 postcodes frequently while EC is busy handling
other tasks, the Port80 FIFO (16-byte depth) might overflow easily,
especially when the host sends the postcode with the 4-byte format.
This change defers the handling and sending (to the upper layer)
postcodes to the system workqueue thread. It can reduce a lot of
(but not all) the overflow case. Also in practice, we usually care
about the latest postcodes. The older codes are not significant to the
developer. This commit also lowers the printing of the overflow warning
to LOG_DEBUG.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-02-20 09:43:20 +01:00
Ruibin Chang
e3b57c392c ITE drivers/pinctrl/it8xxx2: add default mode function
Add default mode function for pin control.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-02-19 21:00:14 -05:00
Zachary J. Fields
c29dcb3a98 cortex-m: warnings: Address -Wextra warnings
`#defines` do NOT sepecify a type. They will either adopt a native
system type or type of the value that was passed into the expression.
This can lead to warnings such as, "warning: comparison of integer
expressions of different signedness: 'uint32_t' {aka 'unsigned int'}
and 'int' [-Wsign-compare]".

By casting expressions, such as `MAX_TICKS` to `k_ticks_t`, we can
force the appropriate types and resolve these warnings.

Signed-off-by: Zachary J. Fields <zachary_fields@yahoo.com>
2023-02-19 20:58:44 -05:00
Muhammed Ahmed
3f0fc7fe6b drivers: serial: Add PM support for UART MCUX
Adding PM support to uart_mcux by gating clock and disabling transmitter

Signed-off-by: Muhammed Ahmed <muhammed.ahmed@intel.com>
2023-02-19 20:56:16 -05:00
Giuliano Franchetto
67767df8c0 drivers: iis2dlpc: adding activity interrupt
This commit adds the activity/inactivity recognition as well as the
stationary/motion detection as defined in the IIS2DLPC application
note.

For now, there is no possibility to configure this interrupt using
device tree binding, as I would like to keep the configuration updatable
and not set at boot time. This behaviour is fine for prototypes and
samples, but is too restrictive on products that may want to change the
interrupt configuration at run-time.

The interrupt is configured using the attributes SENSOR_ATTR_SLOPE_TH and
SENSOR_ATTR_SLOPE_DUR.

Signed-off-by: Giuliano Franchetto <giuliano.franchetto@intellinium.com>
2023-02-19 20:55:09 -05:00
Michal morsisko
2e4d8761be drivers: sensor: Add support for BH1750 ambient light sensor
This commit adds support for BH1750 ambient light sensor.
The driver works using I2C peripheral in one-time mode.

Signed-off-by: Michal morsisko <morsisko@gmail.com>
2023-02-19 20:44:34 -05:00
Jaska Uimonen
26e4da9511 drivers: dai: intel: ssp: add aux data support
Intel SSP configuration can have auxiliary data embedded after it in a
variable length tlv array. Enable the parsing of this data and add the
data structs to describe the contents.

For now add support only for new version 1.5 blob. This is because
legacy blob doesn't have size field to describe its variable size.
Auxiliary data parsing has currently only 1 setting for link clock
needed in ACE platforms.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2023-02-19 20:43:34 -05:00
Jaska Uimonen
c64f91de1a drivers: dai: intel: ssp: add blob 1.5 support
Add support for newer data blob version 1.5. Refactor the code to re-use
the common register setting. Clock setting will be handled differently
with legacy and version 1.5 blob.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2023-02-19 20:43:34 -05:00
Jaska Uimonen
3b7f9c320d drivers: dai: modify dai_config_get API func
Modify dai_config_get function to have the config struct as argument.
This was not a showstopper but a request in the API review.

In the same patch modify all Intel dai drivers using the API to preserve
bisect/compile.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2023-02-19 20:43:14 -05:00
Adrian Warecki
f230a887da drivers: watchdog: Add a new driver for Synopsys DesignWare watchdog
This commit adds a base version of the driver for Synopsys DesignWare
watchdog.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-02-19 20:42:52 -05:00
Rajavardhan Gundi
09d8123d0a drivers: sbs_gauge: Add support for additional properties
Fuel Gauge mode, status, charge current, charge voltage, design
capacity and design voltage are added.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2023-02-19 20:42:10 -05:00
Zhang Lixu
b67e33fc50 sensor: bmi160: fix the issue of missing gpio cfg for i2c
Add BMI160_TRIGGER_CFG in bmi160_cfg for i2c instance when
trigger mode enabled.

Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
2023-02-19 20:41:56 -05:00
Zhang Lixu
21436b27bf sensor: bmi160: fix the issue with interrupt status
When enabling trigger mode of bmi160 on i2c bus, I've come across
an issue where the readings register STATUS. The issue comes from
the dummy byte in the beginning of the buf.raw which is not necessary.
In addition, for bmi160 on spi bus, the dummy byte has already been
handled in bmi160_transceive while reading register.
So the dummy byte should be removed.

Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
2023-02-19 20:41:56 -05:00
Jay Vasanth
f3714825ad drivers: pwm: Add Microchip XEC BBLED PWM driver
The Microchip XEC (MEC172x and MEC152x) have a breathing-blinking
LED (BBLED) block which implements a simple PWM mode. The BBLED
PWM frequencies are 32KHz and 48MHz selectable in device tree.
Frequency divider is 12-bit resolution from 256 to (256 * 4096).

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-02-19 20:40:22 -05:00
Jay Vasanth
c504e1e5cd drivers: dma: Add Microchip XEC DMA driver
The Microchip XEC family of microcontrollers includes a
simple DMA block implementing multiple channels. DMA supports
memory to memory, memory to peripheral, and peripheral to
memory transfers. Peripheral support is limited by each
chip to I2C and SPI controllers. DMA hardware does not support
scatter-gather or linked transactions.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-02-19 20:38:21 -05:00
Kai Vehmanen
0c0d73721e dma: dw: allow to stop in DW_DMA_SUSPENDED state
Allow DMA channel to be stopped even if it is in suspended state.
The current code in dw_dma_stop() supports this, but the recently
added early check for dw_dma_is_enabled() results in DMA stop
sequence to be skipped if the channel was in suspended state.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-02-19 20:37:26 -05:00
Kai Vehmanen
6422b2b094 dma: dw: fix include for chan_data
The conditional definitions are not correct as "chan_data"
is used without any include guards, but defined only if
CONFIG_DMA_DW_HW_LLI or CONFIG_DMA_DW_SUSPEND_DRAIN is defined.
Correct the declaration to match usage.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-02-19 20:37:26 -05:00
Andrzej Głąbek
31c11a5dc0 drivers: nrf_rtc_timer: Fix handling of COMPARE events in set_alarm()
This is a follow-up to commits cf871aec64
and 205e684958.

It turns out that the current implementation of the nrf_rtc_timer may
still fail to properly handle a timeout if that timeout is set in very
specific conditions - when a previously set timeout is about to expire.
When that happens, the new timeout is handled 512 seconds later (when
the system timer overflows) than it should be.

A recently added nrf_rtc_timer test case (test_tight_rescheduling)
exposes this problem and this commit fixes it by adding examination
of COMPARE events that appear during setting of the CC register value
for a given timeout.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-02-14 08:28:28 +01:00
Andrzej Głąbek
d6ba49e298 drivers: nrf_rtc_timer: Rename set_absolute_alarm() to set_alarm()
This function name is misleading as the absolute time values handled
by the driver are 64-bit and this function receives a 32-bit parameter,
which is supposed to be a CC register value, not the target time.
Correct the name of this function and its parameter, and remove a now
unnecessary masking from its body.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-02-14 08:28:28 +01:00
Purdea Andrei
158ee9139c drivers: usb_dc_rpi_pico: cleanup incorrect comment and condition
I believe this comment and condition may have found its way into the
rp2040 driver from other drivers where it makes more sense. For
example for the stm32 driver performing a read on the EP0_IN endpoint
turns it silently into a read on the EP0_OUT endpoint. As far as I can
tell, this really was only used to consume 0-length Status-Stages of
to_host control transfer in the other drivers.

Note that usb_dc_ep_start_read() is never called in an IN endpoint
in the rp2040 driver, and furthermore, even if it would have been
called like that, the current implementation would not do the silent
change into actually performing a read on the EP0_OUT endpoint instead,
so the condition and comment is just wrong.

Note that 0-length Status-Stage of to_host control transfers is
currently consumed in this driver by usb_dc_ep_read_continue().

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-11 08:23:03 +09:00
Dino Li
e442a15c32 gpio/it8xxx2: do not set flag if register does not exist
Since not all GPIOs support voltage selection, voltage flag
is only set if voltage selection register is present.

fixes: #54366

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-02-11 08:20:40 +09:00
Purdea Andrei
4fcbba2fb1 drivers: usb_dc_rpi_pico: fix toggle data1/0 on to_device control transfers
The data stage of Control transfers that are sent from Host to Device, can
be made out of multiple OUT transactions, if the amount of data to be
transmitted is larger than the endpoint size. When this happens, the DATA
pid should be toggling. The USB Device driver of the pico must correctly
prime the EP0_OUT buffer with the correct data PID, otherwise the hardware
will reject the received transaction.

Before this change the driver used to always prime EP0_OUT with a DATA1
pid.
After this change the driver only uses DATA1 pid after a setup transaction,
and then toggles the pid for each transaction.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-11 08:00:43 +09:00
Francois Ramu
4de473e4c9 drivers: dma for stm32u5 returns from a repeated start or stop command
On a repeated dma_start, the stm3u5 dma driver should return
immediately if it is already started.
On a repeated dma_stop, the stm3u5 dma driver should return
immediately if it is already stopped.
This like the dma driver does for other stm32 series.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-02-11 07:57:44 +09:00
Andrei Emeltchenko
9c1076e7f7 drivers: ieee802154_rf2xx: Remove magic number
Define and use RF2XX_TRAC_STATUS instead of magic number.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-02-10 18:13:48 +01:00
Andrei Emeltchenko
72c5bc3ae2 drivers: ieee802154_rf2xx: Correct bit mask
Correct bit mask for RF2XX_RX_TRAC_BIT_MASK. Current mask produce dead
code warnings when comparing to value:

RF2XX_TRX_PHY_STATE_TRAC_INVALID = 0x07

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-02-10 18:13:48 +01:00
Siyuan Cheng
1a5676d338 ARC: boards: hsdk: fix cy8c95xx I2C GPIO port init
cy8c95xx I2C GPIO support was broken in commit 4b30008 due
to wrong i2c bus and addr were wrote during GPIO_PORT_INIT.
Now fix this issue.

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-02-10 10:19:19 +01:00
Ramon Aerne
a5e04ccd4a drivers: serial: rp2040: fix rpi pico address mapping
Address map used for config item `uart_dev` and `uart_regs` is
currently derived using the rpi hal macros `uart0` and `uart1`
which map to the same register address as given in the `reg` property
of the devicetree.

However, the sdk macro is generated using `uart##idx` which zephyr does
not necessarily map to uart0 or uart1.
This is, for example, the case when disabling uart0 with the devicetree
status "disabled"
and enabling uart1 for which then the idx==0 and not 1 which therefore
maps to the wrong controller address space.

This can simply be fixed by deriving the base address from
`DT_INST_REG_ADDR(idx)` instead

Signed-off-by: Ramon Aerne <ramon.aerne@axelera.ai>
2023-02-09 23:40:38 +01:00
Björn Stenberg
dcbc56cfe7 ethernet: stm32h7: Move DMA buffers from sram3 to sram2
PR #30403 implemented nocache regions for ethernet DMA buffers in sram3 to
fix issue #29915. Unfortunately, some STM32H7 variants do not have any
sram3 so they still suffer from #29915.

All H7 variants have sram2 though, so use that for targets without sram3.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
2023-02-09 22:14:07 +09:00
Marc Desvaux
7851c3c26b drivers: ethernet: eth_stm32_hal.c ETH_MAC_config issue
ETH MAC config for STM32H7X and STM32_HAL_API_V2
too late and fails #54409
call HAL_ETH_SetMACConfig before HAL_ETH_Start_IT()
check the return of HAL_ETH_SetMACConfig()

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-02-09 13:18:21 +01:00
Francois Ramu
df4fa7088d drivers: timer: stm32u5 lptimer waits for DIER complete
On the stm32U5, when modifying the DIER register of the LPTIM peripheral,
a new write operation to can only be performed when the previous write
operation is completed and before going-on.
This is done with a function call for better readability.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-02-09 13:17:03 +01:00
Francois Ramu
7dff172519 drivers: serial: stm32 uart driver avoid LOG_WRN when going to sleep
When the LOG_WRN is used on stm32 uart driver it could block
execution : when pin state for sleep mode is not defined by the DTS
even if no error is raised, LOG_ msg is crashing when entering sleep mode.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-02-09 13:14:46 +01:00
Guillaume Gautier
60fc300195 drivers: counter: Do not keep RTC value between resets on STM32
This commit changes the ability to keep the RTC value between resets, and
turns it off by default.
Though this feature makes sense for an RTC counting the time and date,
here it is used as a counter. As such the registers used for coutning
should be reset after each MCU reset.

This change puts back in place the previous behavior before the Kconfig
CONFIG_COUNTER_RTC_STM32_BACKUP_DOMAIN_RESET was removed.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-02-08 12:10:34 +01:00
Armin Brauns
a0026d1589 drivers: ethernet: stm32: fix multicast filter configuration
With CONFIG_ETH_STM32_MULTICAST_FILTER=n, MACFFR was being set to 0 instead
of ETH_MULTICASTFRAMESFILTER_NONE, blocking all multicast traffic.

Instead, reset all the relevant bits first, then set either
ETH_MULTICASTFRAMESFILTER_HASHTABLE or ETH_MULTICASTFRAMESFILTER_NONE
depending on Kconfig.

This issue was introduced in #53850, `git diff a5f9fc2~2 a5f9fc2` (the
total diff of that PR) shows what happened - the
`tmp |= ETH_MULTICASTFRAMESFILTER_NONE;` line was removed completely
instead of being gated by `!defined(CONFIG_ETH_STM32_MULTICAST_FILTER)`.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-02-08 11:24:02 +01:00
Maciej Zagrabski
7ca8accdc6 drivers: flash: fix uninitialised layout_size
Requesting page layout triggers filling bank array
only once, and returns pre-filled array on consequential calls.
But ignores array size.

Remember size of this array as well.

Fixes #54563

Signed-off-by: Maciej Zagrabski <mzi@trackunit.com>
2023-02-08 19:01:32 +09:00
Declan Snyder
0744e42e22 drivers: disk: Decouple SDMMC and MMC Kconfigs
MMC was using SDMMC kconfigs to build disk driver.
This is incorrect, MMC and SDMMC should not be sharing
Kconfigs. Split the drivers/disk/Kconfig.sdmmc into
drivers/disk/Kconfig.mmc and drivers/disk/Kconfig.sdmmc.

Also update disk tests to account for new MMC Kconfigs.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-02-08 10:18:13 +01:00
Tom Burdick
86af9bcce1 spi: SAM add spin lock around all tx/rx/txrx funcs
The fast tx/rx/txrx functions will leave the SPI bus in an
inoperable state if interrupted, potentially spinning forever waiting on
some data. Wrapping these operations in what amounts to a critical section
using spin locks to avoid the issue.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-02-08 01:08:59 +09:00
Daniel DeGrasse
f7d9ea889b drivers: adc: support side B channels in LPADC driver
Add support for side B channels in MCUX LPADC driver. Given
that no instances of the IP block have more than 8 a side channels,
use channel numbers over 8 to indicate side B channel is desired.

Fixes #51076

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-02-08 01:08:08 +09:00
Ryan Erickson
bec12a098d modem: hl7800: fix low power mode
PSM hibernate mode would draw excessive current
because the UART would be enabled if CTS went low.
In hibernate mode, do not use CTS to power on the UART.

Fix reading of input pin states for low power by reading
the raw value.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-07 00:25:53 -08:00
Ryan Erickson
8aeb821a4e modem: hl7800: emit event on band change
Ensure an event is triggered any time the LTE bands change.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-07 00:25:53 -08:00
Ryan Erickson
6e58ba5dd8 modem: hl7800: Improve set bands API
Change the API to not block waiting for a reboot.
Reboot asynchronously.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-07 00:25:53 -08:00
Ryan Erickson
57b52adc15 modem: hl7800: Improve RAT API
Change the API to not block waiting for a reboot.
Reboot asynchronously.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-07 00:25:53 -08:00
Ryan Erickson
fe76aa0959 modem: hl7800: Fix event lock
Change event callback lock to a semaphore to avoid
priority issues the mutexes can cause.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2023-02-07 00:25:53 -08:00
Purdea Andrei
9a7f9ec0ba drivers: usb_dc_rpi_pico: avoid infinite unhandled irq retriggers
This driver enables a number of interrupts it does not attempt to handle.
This results in "unhandled IRQ: 0x...." messages being printed, and the
interrupt handler retriggers immediately again, and this happens again
and again forver, because nothing ends up clearing the interrupt.

This change implements very limited handling of these interrupts. A custom
warning is logged, and the interrupt is cleared.

This change does not imply that doing this is sufficient. More changes may
need to be implemented to more gracefully re-start transactions or
re-arm some endpoints, but this is one step in the right direction,
and at least the OS doesn't freeze up.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-06 22:07:03 +09:00
Tomasz Bursztyka
d5a6011589 drivers/interrupt_controller: Move VT-D to new cache API
Just a left-over from previous API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-02-06 10:07:53 +01:00
Adam Kondraciuk
dac3a42063 drivers: counter: align to NRF_TIMER hal
Align driver with changes introduced in the hal. `nrf_timer_frequency_set`
was changed to `nrf_timer_prescaler_set`, update driver accordingly.

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-06 10:07:17 +01:00
Fabio Baltieri
47874e2f6e gpio: gpio_keys_zephyr: drop one instance of num_keys
The driver currently stores num_keys in both config and data. Drop the
data copy, save 4 bytes of RAM.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-06 10:06:36 +01:00
Daniel DeGrasse
844685224b drivers: dma: remove unused mutex from edma driver
Mutex initialized by edma driver is not used. Remove it from the
driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-02-06 10:05:44 +01:00
Sam Hurst
cc416a8b9b usb-c: tcpc: Add support for Dead Battery
Add Dead Battery functionality to the TCPC drive

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-02-06 10:03:13 +01:00
Andrzej Głąbek
8eba36dd56 drivers: spi_nrfx_spi[m]: Handle transaction timeouts properly
Add code that acts accordingly when a transaction does not complete
in the expected time. It makes sure that the transaction is aborted
so that no unexpected interrupt occurs afterwards and it also cleans
up after that abort so that the driver can handle further requests.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-02-03 10:34:27 -08:00
Marcin Szkudlinski
44222b7dfc mtl: bugfix: tlb driver should allow remapping all unused pages
UNUSED_L2_START_ALIGNED is a marker of first page not used by the
linker. Starting from this page, the memory may be re-mapped.
assertion <= is banning remapping of the first unused page
changing to <

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2023-02-03 20:59:08 +09:00
Mahesh Mahadevan
5d7051f173 drivers: kscan: Fix the kscan gt911 driver
Update the calculation of the row and column.
Issues were seen when running the LVGL sample.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-02-03 02:24:48 +09:00
Fabio Baltieri
5d9c65fe7f gpio: gpio_keys_zephyr: add missing gpio initialization
The driver is missing the GPIO initialization entirely, meaning that
flags like PULL_UP are not currently being applied. Add the missing
call.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-01 09:25:40 +00:00
Henrik Brix Andersen
63850804f1 drivers: timer: mcux: lptmr: add dependency on CONFIG_PM
The introduction of cc2c05a90c caused
CONFIG_MCUX_LPTMR_TIMER to always be enabled for boards where the NXP LPTMR
is enabled in the board devicetree.

Using this low-power timer as system timer only makes sense when using
power management. Otherwise, it just results in a lower tick resolution and
non-tickless operation.

Add dependency on CONFIG_PM for CONFIG_MCUX_LPTMR_TIMER.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-31 22:10:28 -06:00
Stancu Florin
236084df70 drivers: ti: cc13xx/cc26xx: implement watchdog timer
New Zephyr WDT driver for TI CC13xx/CC26xx family.
Supports interrupts & MCU soft reset on timeout.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2023-01-31 16:08:00 -05:00
Fabio Baltieri
48a6f160f2 gpio: gpio_keys_zephyr: fix build warning with assertion disables
Fix two "unused variable" warnings when compiling with assertions
disabled. The two variables are used only in the __ASSERT() call.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-31 06:08:02 -05:00
Fabio Baltieri
20644536b9 uart: microchip: fix build error with PM_DEVICE=n
Fix a build error when the driver is built with:

CONFIG_PM=y
CONFIG_PM_DEVICE=n
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_CONSOLE_INPUT_EXPIRED=y

due to uart_xec_pm_policy_state_lock_get() and rx_refresh_timeout_work()
declared under different configuration options.

Fixes: 343d1919f1 "uart: microchip: add low power & wake support"
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-30 18:54:59 +00:00
Francois Ramu
842a6ba02d drivers: watchdog: stm32 iwdt enable and update during setup
To follow the IWDG configuration sequence, the timeout install is
just preparing the reload and prescaler parameters.
Then during the iwdg setup the watchdog is enabled and configured
at the same time.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-30 15:05:39 +00:00
Mahesh Mahadevan
4e6f80d37a drivers: usb: mcux: Fix the write operation
1. Do not copy over the data to the local buffer,
it can be directly sent to the controller. The
cache is flushed before calling the HAL send
function. Also do not allocate a buffer from
the heap pool for the write operation.
2. Remove a length check as this is handled by
the HAL driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Mahesh Mahadevan
9bef7d07e7 drivers: usb: mcux: Remove unnecessary while loop
The while loop is changed to an if check.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Mahesh Mahadevan
17da2015bc drivers: usb: Cleanup MCUX driver
1. Remove unused ep_type structure member
2. Add more direction checks

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Siyuan Cheng
59130b11dc driver: gpio: Add pin_configure api for creg_gpio driver
Update pin_configure api for creg_gpio driver

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-01-27 19:52:25 -05:00
Henrik Brix Andersen
cb274e6a3c drivers: gpio: add GPIO hog support
Add support for automatically configuring GPIO hogs defined in the
devicetree during system initialization.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Conor Paxton
6b641c3483 drivers: timer: get mtime cmp reg by reading mhartid
It is not guaranteed that a multi-core RISC-V hart numbering scheme
will match Zephyr's sequential cpu numbering scheme. Read the hartid and
use that value in calculation to get mtime_cmp reg, instead of the
current_cpu id.

Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
2023-01-27 12:49:56 -08:00
Jay Vasanth
343d1919f1 uart: microchip: add low power & wake support
changes to support low power and wake support in microchip xec uart
driver. Add support for wakerx_gpio config in dts to select the wake gpio.
Configure for wake in PM_DEVICE_ACTION_SUSPEND state and clear
interrupt in wake isr. Also added support for
CONFIG_UART_CONSOLE_INPUT_EXPIRED

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-01-27 14:25:58 -05:00
Goh Shun Jing
5858cca8b8 drivers: serial: uart_altera_jtag: enhancement
implement uart poll in and interrupt driven api.

Signed-off-by: Goh Shun Jing <shun.jing.goh@intel.com>
2023-01-27 14:24:43 -05:00
Johann Fischer
2f310dc424 drivers: udc: add capability for MPS of control endpoint
New capability is to be used by the stack to adjust the corresponding
field in the device descriptor.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-27 16:11:20 +01:00
Johann Fischer
373d660d96 drivers: udc: remove unused and unsupported udc_ep_flush()
udc_ep_flush() is not implemented by the driver and is not
used by the USB device stack. Remove it for less confusion
when porting drivers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-27 16:11:20 +01:00
Mario Jaun
e3c1747d80 drivers: flash: stm32_qspi: handle 4-byte addressing only chips
Correctly initialize driver if flash chip supports 4-byte addressing
only.

Signed-off-by: Mario Jaun <mario.jaun@gmail.com>
2023-01-27 23:31:39 +09:00
Alberto Escolar Piedras
0de83109de drivers: ieee802154_nrf5: Fix warning in ISR prototype
The ISR prototype was changed some time ago
(6df8b3995e)
to (const void*) => fix the prototype used when
CONFIG_IEEE802154_NRF5_EXT_IRQ_MGMT is not set
to avoid a compile warning.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-01-27 12:35:33 +01:00
Shawn Nematbakhsh
cd0f54fb88 drivers: timer: riscv_machine_timer: Add support for OpenTitan
OpenTitan uses a timer compliant with the RISC-V privileged
specification.

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2023-01-27 19:25:26 +09:00
Shawn Nematbakhsh
1d3fb5490f drivers: serial: Add support for OpenTitan serial UART
UART output confirmed to work in simulation.

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2023-01-27 19:25:26 +09:00
Jeroen van Dooren
77824a1820 drivers: display: ili9341: add 4th parameter in DISCTRL command
As stated in the datasheet https://www.crystalfontz.com/controllers/Ilitek/ILI9341/142/
there's a 4th parameter in DISCTRL command

Signed-off-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
2023-01-27 19:24:13 +09:00
Wouter Cappelle
0934f705eb sensor: SHT3x: Fix low repeatability in single shot mode
Fix the low readability read command which was swapped with high
readability. This should fix an issue which caused a sensor fetch
fail in low repeatability single shot mode (no data ready)

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2023-01-27 18:11:02 +09:00
Andrei Emeltchenko
3f0487b725 drivers: adc_ads1119: Fix using wrong status bit
Fixes using wrong status bit for ADS1119_STATUS_MASK_ID. Moreover
using BIT(8) does not make much sense for working with uint8_t.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-27 18:09:49 +09:00
Stancu Florin
817e41f965 boards: cc1352p1_launchxl: new board, support antenna switching
Added new CC1352P1 LaunchXL board supporting 20dBm TX for its
sub-GHz radio.

Note that the board has a multiplexer circuit to switch between
2.4GHz, High-Power TX and Sub1GHz states, for which a custom board
module was implemented, together with board-specific device-tree
bindings and pinctrl definitions for each of the RF states.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2023-01-27 17:44:38 +09:00
Stancu Florin
e41de9235a drivers: ieee802154: cc13xx_cc26xx_subg: PA TX amplifier support
Enhance IEEE802154 Sub-GHz driver to support CC13x2P's internal power
amplifier (20dBm) for TX.

Note: requires board-specific antenna switching for it to work
properly.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2023-01-27 17:44:38 +09:00
Trent Piepho
43781ba2a0 i2c: Add an option to dump all I2C messages to the log
When turned on, the existing i2c dump code is use to log every I2C
transaction at debug level.

This can be very useful for detecting problems with I2C peripherals.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-26 14:55:44 -05:00
Trent Piepho
0c7ff3b728 i2c: Improve formatting of i2c dump function
If an i2c message is for just one byte, instead of logging it with a
hexdump after logging the other message info, just added the one byte to
the same log message.

Since most i2c messages are one byte, this significantly reduces the
number of messages and lines needed to log i2c transactions, from three
line per message to just one.  It's also a lot easier to read.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-26 14:55:44 -05:00
Trent Piepho
c09f6918fa i2c: Allow dumping the data of read messages
Add an argument to i2c_dump_msgs() to log the data from reads too.  And
then rename the function to i2c_dump_msgs_rw() so the API doesn't
change.  If the dump is done after a transaction is processed, as
opposed to before, then the read data is valid and can be very useful.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-26 14:55:44 -05:00
Andrzej Głąbek
37665b5e95 drivers: spi_context: Refactor spi_context_wait_for_completion()
Refactor the code of this function to make it a bit easier to read.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-27 01:22:15 +09:00
Andrzej Głąbek
f36c15e2e3 drivers: spi_context: Use total transfer length in timeout calculation
When estimating the time that a given SPI transfer will take, whole
buffer sets for TX and RX need to be taken into account, not only their
first parts. Correct `spi_context_wait_for_completion()` accordingly.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-27 01:22:15 +09:00
Michael Larson
0267612305 drivers: flash: spi_nor: Fix spi_nor_sfdp_read conditional
spi_nor_sfdp_read is now called from spi_nor_process_sfdp for the
CONFIG_SPI_NOR_SFDP_RUNTIME case and that could be defined without
CONFIG_FLASH_JESD216_API being defined

Signed-off-by: Michael Larson <larson@whisper.ai>
2023-01-27 01:21:52 +09:00
Francois Ramu
05da8d7a7a drivers: flash: stm32 page layout size differs in stm32u5 or stm32l5
Adjust the size of the stm32_flash_layout[] table depending on the
bank configuration of the stm32u5 or stm32l5 devices.
That will avoid div by zero error in flash_get_page_info()
if the layout_size is not correct.
Assign the *layout_size only once with the correct value : 3 or 1.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-27 01:05:44 +09:00
Cyril Fougeray
4d7e150189 drivers: i2c: stm32: format
Detected by checkpatch.pl

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-01-27 01:02:08 +09:00
Cyril Fougeray
400fa70ca2 drivers: i2c: stm32: PM device runtime support
Lock I2C device state when used so that Power Manager doesn't
suspend the device.
Initial state is a suspended device.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-01-27 01:02:08 +09:00
Cyril Fougeray
7710082e87 drivers: i2c: stm32: PM device support
Clock and pins used by the I2C device are suspended when power
manager requires it.
Do not compile function i2c_stm32_suspend when PM_DEVICE isn't
 enabled as it is left unused and will make the compiler throw
 a warning.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-01-27 01:02:08 +09:00
Cyril Fougeray
51fa86bb98 drivers: exti: stm32: expose STM32_EXTI_LINE_NONE
Common STM32_EXTI_LINE_NONE for declaration and setting
of wakeup EXTI line when configured.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-01-27 01:02:08 +09:00
Benjamin Björnsson
500809f8fa drivers: can: can_loopback: Abort pending messages when stopped
This commit aims at updating the drivers stop function to better
follow the CAN header file which specifiec that stopping the CAN
controller should "abort any pending CAN frame transmissions".

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-01-27 00:58:59 +09:00
Johann Fischer
e60a4efbb0 drivers: udc: do not update MPS for isochronous endpoints
Zero data payload size for isochronous endpoints is a
is a valid setting for default interface.
Also do not update MPS of control endpoint since it is
set by the driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-27 00:57:22 +09:00
Chamira Perera
da3e3d3ed3 drivers: ethernet: stm32: Enabling stats for the driver.
The change enables the ethernet driver to save statistics in a
structure in the ethernet driver API structure. In addition, the
change also attempts to update error statistics based on errors
reported in the STM32 ethernet HAL API.

Fixes #53995

Signed-off-by: Chamira Perera <chamira.perera@audinate.com>
2023-01-27 00:56:06 +09:00
David Leach
cde1573619 drivers: entropy: use non-cache intermediate buffer for RNG
The CAAM hardware needs to read RNG values into a non-cache
buffer. Since the contract to Zephyr RNG functions do not
require non-cache buffers, we use an intermediate non-cache
buffer to retrieve results.

Added a Kconfig to control the size of the intermediate buffer.

Fixes #53035

Signed-off-by: David Leach <david.leach@nxp.com>
2023-01-26 09:46:20 -06:00
Brian Juel Folkmann
8d11d183f6 drivers: flash: bug fix stm32 ospi flash erase
This commit fixes a bug in the STM32 ospi flash driver when attempting
to erase an area that spans more than one erase sector.
Without this fix, only the first sector is actually erased, the rest
silently fails the erase.
Issue is that the write enable latch command is only sent for the first
erase command.

Signed-off-by: Brian Juel Folkmann <bju@trackunit.com>
2023-01-26 09:39:59 +00:00
Armin Brauns
219dd436d1 drivers/clock_control: stm32l4: allow enabling MCO output
This enables the MCO clock output pin to be configured through Kconfig on
stm32l4 devices.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-01-26 09:39:33 +00:00
Armin Brauns
706f5caf0e drivers/clock_control: stm32f7: allow enabling MCO outputs
This enables the MCO clock output pins to be configured through Kconfig on
stm32f7 devices.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-01-26 09:39:33 +00:00
Yuval Peress
e7443bb203 sensors: Add attribute configuration for icm42688
Implement the attribute get/set for the icm426888

Signed-off-by: Yuval Peress <peress@google.com>
2023-01-25 09:48:05 -06:00
Yuval Peress
ad4cb88494 sensor_shell: add attribute support
Add 2 new sub-commands to the sensor command (attr_get and attr_set).
These commands can be used to access the driver's attr_set and attr_get
functions.

Signed-off-by: Yuval Peress <peress@google.com>
2023-01-25 09:48:05 -06:00
Yuval Peress
3f4c568f71 sensor_shell: run clang-format
Run clang-format on the sensor_shell.c to make diffs easier for the
next commit.

Signed-off-by: Yuval Peress <peress@google.com>
2023-01-25 09:48:05 -06:00
Henrik Brix Andersen
55d0ffa874 drivers: can: remove CAN_HAS_CANFD Kconfig helper
Remove the CAN_HAS_CANFD Kconfig helper symbol in order to allow enabling
CAN-FD support in the API regardless of driver support.

Change default to CAN-FD support being disabled and have samples and tests
that require CAN-FD support turn it on. This aligns the default
configuration across CAN controller drivers regardless of their
capabilities.

The rationale behind this is that we are starting to see MCUs with multiple
CAN controllers, some CAN-FD compatible, some not (e.g. NXP i.MX RT1060 and
FPGAs). Automatically enabling CAN-FD support based on the presence of a
CAN-FD capable CAN controller leads to different application default
settings based on the CAN controller(s) in use.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-25 15:00:39 +00:00
Henrik Brix Andersen
f1a7ec96db drivers: can: remove CAN_HAS_RX_TIMESTAMP Kconfig helper
Remove the CAN_HAS_RX_TIMESTAMP Kconfig helper symbol in order to allow
enabling CAN RX timestamps in the API regardless of driver support.

This simplifies application prj.conf settings across board supporting/not
supporting RX timestamps considerably.

CAN drivers not supporting RX timestamps already initialize the timestamp
to 0 for received frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-25 15:00:39 +00:00
Guillaume Gautier
6deebdd13a drivers: adc: Remove now unused variables for STM32 ADC
Remove boolean variables for internal channels now that we use channel
number directly

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-25 15:00:21 +00:00
Guillaume Gautier
9c6d44ef5a drivers: adc: Simplify STM32 ADC channels setup
Now that we have the information of internal channel number for STM32
ADCs in the dts, we can use it to remove a lot of specific code and
make it clearer.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-25 15:00:21 +00:00
Erwan Gouriou
34e49a7c54 drivers: adc: stm32: Refactor driver init section
Slightly refactor STM32_ADC_INIT macro.
adc_stm32_cfg_##index declaration is now part of ADC_STM32_INIT
and extracted from CONFIG_ADC_STM32_SHARED_IRQS #ifdef.

Aim is to minimize code duplication when adding new adc_stm32_cfg_X
or adc_stm32_data_Y entries

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-25 15:00:21 +00:00
Andrei Emeltchenko
ec8c9f05fc drivers: ieee802154_rf2xx: Fix logical operation
Fix using AND instead of OR.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-25 14:58:09 +00:00
Andrzej Głąbek
cf871aec64 drivers: nrf_rtc_timer: Adjust set_absolute_alarm to prevent CC misses
This is a follow-up to commit 205e684958.

The recently added nrf_rtc_timer test case (test_next_cycle_timeouts)
revealed a problem in the current implementation of this function.
Adjust it to avoid missing COMPARE events in specific circumstances.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-25 11:25:01 +00:00
Marcin Jabrzyk
61916c69dd drivers: watchdog: Fix RP2040 watchdog load time
RP2040 requires watchdog load time in us, but Zephyr
watchdog window values are in ms. Make sure that it is
adjusted to hardware requirements.

Signed-off-by: Marcin Jabrzyk <marcin.jabrzyk@gmail.com>
2023-01-24 19:01:34 -08:00
Evgeniy Paltsev
9eb8baeff9 ARC: irq: idu: mask IRQ before level setup
Currently we setup irq trigger type (pulse or level) in IDU
before we Mask (disable) IRQ line.

The IDU is disabled at this moment, however we still may
accidentally generate interrupt by trigger setup.

To avoid that let's mask (disable) IRQ before trigger type setup.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-01-24 18:57:50 -08:00
Benjamin Kyd
ee1e514b3b driver: ethernet: cvsx remove ugly whitespace
Remove the ugly whitespace in drivers/ethernet/eth_cyclonev.c

Signed-off-by: Benjamin Kyd <benjamin.kyd@intel.com>
2023-01-24 17:46:17 -06:00
Benjamin Kyd
f3a610fffe drivers: ethernet: cvsx change bit label
Change the bit label to include the BIT() macro to tidy up the code.

Signed-off-by: Benjamin Kyd <benjamin.kyd@intel.com>
2023-01-24 17:46:17 -06:00
Benjamin Kyd
aad76523e1 drivers: ethernet: bugfix for Cyclone V Ethernet
bugfix for Cyclone V Ethernet Phy error and timeout overflow.
 - p->instance was incorrectly assumed to be a reference to
   the emac device, this is ammended
 - the volatile uint16_t timeout would often overflow
 - code cleanup and added more macros for housekeeping

Signed-off-by: Benjamin Kyd <benjamin.kyd@intel.com>
2023-01-24 17:46:17 -06:00
Jeppe Odgaard
a76b908f4c drivers: sensor: add mcux quadrature encoder
Add a driver for the NXP MCUX Quadrature Decoder. The driver
is simple and only implements the phase a and phase b inputs. The
module has additional features which can be added in future PRs.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2023-01-24 10:21:39 -06:00
Marc Desvaux
d72f65f358 drivers: ethernet: PTP clock CONFIGURATED
Set PTP Configuration done on ETH_STM32_HAL_API_V2

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-01-24 14:34:34 +00:00
Francois Ramu
210e0b76bf dts: bindings: pwm custom macro for STM32 vendor
Change the name of the custom macro defined for the stm32 devices
to fit the VND_PWM_xxx model
Keeping old deprecated macro, though.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-24 14:49:53 +01:00
Manuel Arguelles
8d2778f326 drivers: ethernet: add support for NXP S32 NETC
Introduce Ethernet low-level driver for NXP S32 Network Controller
(NETC). Current driver allows to manage from Zephyr a Physical Station
Interface (SI) and/or a Virtual SI. The NETC has an integrated Ethernet
Switch. Currently the Switch is initialized from this driver with a
default configuration, and all ports are enabled and transparent for
the user. A separate Switch driver should be addressed in future patches.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Manuel Arguelles
1d6452c57b drivers: mdio: add support for NXP S32 NETC EMDIO
Introduce NXP S32 NETC External MDIO controller driver. Driver supports
a single instance, as current support is based on NXP S32Z/E SoCs.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Manuel Arguelles
642303ac7e drivers: eth: phy_mii: support Gigabit ethernet
Advertise Gigabit Ethernet if the PHY supports it. As with the
other speeds, it is assumed the PHY supports both duplex modes.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Manuel Arguelles
60608b7a31 drivers: mbox: add support for NXP S32 MRU
Introduce NXP S32 Message Receive Unit (MRU) driver based
of Mbox API. The MRU couples with a processor and allows to
receive messages from senders, which are other modules or
processors.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Manuel Arguelles
47de21d5c0 drivers: mbox: separate NRFx specific Kconfig
Separate NRFx Mbox driver Kconfig to make place for other drivers.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-24 14:37:20 +01:00
Sam Hurst
6b4b7a02e7 usb-c: tcpc: Enable ISR Hard Reset sent bits
This change enables the ISR Hard Reset sent bits, so that
an interrupt is generated when a Hard Reset is sent or
the Hard Reset failed.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-01-24 09:43:20 +01:00
Sam Hurst
603ac13145 usb-c: tcpc: Correctly detect Hard Reset sent detection
The Hard Reset sent signal was tested twice in the same
"if else" structure but only handled in the last test. This
change removes the first detection so that Hard Reset can
be correctly detected.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-01-24 09:43:20 +01:00
Sam Hurst
e3365e961d usb-c: tcpc: Simplify Hard Reset complete logic
This change simplifies the Hard Reset complete logic

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-01-24 09:43:20 +01:00
Erwan Gouriou
7b221fbe45 drivers: clock_control: stm32: Can't get MSI freq
Update driver to allow MSI frequency retrieval.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-24 09:42:51 +01:00
Erwan Gouriou
e67b2fa60d drivers/disk: sdmmc stm32: Fix compilation issues
Fix a bunch of issues which were blocking driver compilation.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-24 09:42:51 +01:00
Jordan Yates
addf405fe6 power_domain: gpio: only run actions for children on domain
Only run the `PM_DEVICE_ACTION_TURN_ON` and `PM_DEVICE_ACTION_TURN_OFF`
actions for child devices that have refered to the domain via the
`power-domain` property.

This prevents multiple actions being run for devices that refer to
several power domains, e.g.

```
	test_dev: test_dev {
		compatible = "test-device-pm";
		status = "okay";
		power-domain = <&test_reg_1>;
		alternate-domain = <&test_reg_chained>;
	};
```

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-01-24 09:42:11 +01:00
Mahesh Mahadevan
3b7e7575a9 drivers: usb: Enable High speed Kconfig for NXP controllers
Enable the USB_DC_HAS_HS_SUPPORT Kconfig for NXP controllers
that support High speed.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-23 19:40:44 -08:00
Benjamin Lindqvist
7ffc200820 drivers: sensor: bmi270: don't force val2 > 0
The struct sensor_value type does NOT require val2 to be positive. The
removed code is in fact a rather serious bug, probably put in place
because it makes printing sensor_values easier.

Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
2023-01-23 12:02:30 -08:00
Trent Piepho
c45bc68e5c drivers/sensor: lsm6dso: Remove busy wait on bank change
It's not necessary to busy wait 150 µs after changing register banks.
Nothing in the data sheet nor app note suggests this.  ST's own HAL,
which is used by this driver, does not delay when changing banks.  It
does a bank change around every function that accesses a non-user bank
register (it's quite inefficient).

So if it was necessary it would be broken now, as most of the bank
changes have no delay.

One of the few page changes that did have this delay are the those done
before and after reading a sensor sample.  Which is where the speed is
significant and is limiting the update rate the driver is capable of.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
0cfe9560d9 drivers/sensor: lsm6dso: Remove unneeded read/modify/write in shub read
The code in the ST HAL does a read/modify/write to change the bits in
the LSM6DSO_FUNC_CFG_ACCESS register that control which register bank is
active.

All the other bits in the register are defined as zero.  It's possible
to simply set the register to the desired value without reading the
contents first.

This bank switch needs to be done twice for every sensor read when the
sensor hub is used.  The driver as it is can not keep up with the higher
update rates of the lsm6dso.  So any speed increase in this code allows
for a higher update rate as well as reduced latency.

Previously, a read of the lsm6dso's accel and gyro on a 400 kHz I2C bus
with a 3-axis magnetometer on the sensor hub takes 2.69 ms.  This drops
that to 2.26 ms.  This is enough to support the 417 Hz ODR.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
8e80661db7 drivers/sensor: lsm6dso: Fix shub init and configuration failures
There is a flaw with I2C communication to peripherals behind the shub
that causes sporadic failures.  Especially calls to configure a device
after the lsm6dso initialization is finished, e.g. to set the ODR, can
fail to work correctly.

Access to shub peripheral registers is done by putting the parameters of
the operation into SLV0 and then waiting for the lsm6dso to perform the
xfer on the shub I2C bus.  The lsm6dso does this in sync with the
accelerometer update rate.  Once the shub is enabled, it peforms the
xfer repeatedly as the accelermeter is sampled.

The wait has a problem:  It might detect that a previous shub xfer has
finished, which was done before SLV0 was programmed with new parameters.

The shub status register is read-to-clear.  This isn't in the data sheet
or app note, but it is.  By reading the status before enabling the
sensor and after programming SLV0, we can be sure when it becomes set it
has finished the current operation and not a previous one.

Also set the write-once flag before shub init.  This causes the shub to
only perform I2C writes once instead of continuously.  This was set at
the end of init, so any writes done during it would repeat until the
shub was disabled.

Put a timeout in the code that polls for the sensor hub op complete.  It
could possibly poll forever.  More importantly, if there is no device
connected to the sensor hub, the lsm6dso does not timeout on the
operation for ~13 seconds.  Since the shub init does a probe for devices
on startup, this will happen if shub support is enabled but a lsm6dso
has no sensor hub devices.  There could be multiple devices, some with
additional sensors and some without.  Initialization of the devices
without additional sensors takes tens of seconds without this timeout
being added.

Add a 300 µs wait after disabling the sensor hub.  This is necessary
according to the ST app note AN5192 §7.2.1.

Read the shub status from the main bank register instead of the shub
bank register.  This avoids an extra bank switch before and after each
status poll.  Actually two bank switches on each side, since the lsm6dso
driver switched banks and then the ST HAL function to get the status
register switches again.

The wait for the shub I2C transaction to finish is not needed when the
shub is enabled at the end of init.  We aren't starting a new I2C write
or reading the result of a read.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
c379f86dbd drivers/sensor: lsm6dso: Set to user bank on init
The lsm6dso initialization will fail if the device is not already set to
the user register bank.  All the registers used will be the wrong ones
from whatever bank it is in, e.g. sensor hub bank.  This includes the
registers to reset the device!

The bank will default to the user bank on reset, but the chip has no
hardware reset line.  On a reboot it will be in whatever bank it was
last in.  If the sensor hub is enabled, it will switch banks on every
sample, so it's entirely possible to reset or reboot when it happens
to be set to the sensor hub bank, which will cause the driver to
fail to initialize.  It will not work again until the lsm6dso is power
cycled.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
25579d95b1 drivers/sensor: lsm6dso: Disable sensor hub before reset
Per an ST app note, the sensor hub I2C controller should be disabled
before doing a software reset.  Possibly, this is because the sensor hub
could be in the middle of the an I2C transaction to a sensor when it is
reset.  Disabling it and then waiting makes sure it has quiesced before
resetting.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
7cf6d75a11 drivers/sensor: lsm6dso: Move interrupt config to after chip reset
The initialization code would configure the lsm6dso interrupt, then
configure the rest of the chip.  The chip init includes a reset that
would undo the register setting done during interrupt configuration.

It's also not a good idea to enable the interrupt on the SoC when the
lsm6dso has not yet been reset or configured.  It might be generating
interrupts.

The lsm6dso has no hardware reset line, so it will not be reset on
reboot unless a power cycle is involved.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Trent Piepho
d14732b541 drivers/sensor: lsm6dso: Set thread name
When the driver creates its own thread, set the name.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2023-01-23 11:52:39 -08:00
Tom Burdick
58312e6104 dma: Repeated start/stop support for gpdma
Allows for repeatedly calling start/stop on designwares gpdma.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-23 11:51:21 -08:00
Tom Burdick
b14296af38 dma: HDA ignore repeated start/stop requests
The DMA API contract specifies that start/stop may be called multiple
times. Prior to adding power management this was perfectly fine as it was.
In adding power management, there are additional side effects that can
cause issues. Instead check the state of the channel prior to start/stop
and do nothing if already in the desired state.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-01-23 11:51:21 -08:00
Gerson Fernando Budke
97967f0526 drivers: ieee802154: rf2xx: Fix hang on 0x2c isr_status
When transceiver is overload on reception a frame can be stored on
the internal buffer without processing a frame start interrupt. The
frame will complete and system will received a interrupt and signal
receiver thread with an isr_status equal to 0x2c.

The current implementation process one flag at time and it may hang
when status is 0x2c. This issue can be reproduced using two nodes
where one perform a regular TX broadcast and tThe other one should
be wait for frames. The receptor should run on debug mode and system
should be started normally. The problem happens when pressing CTRL+C
on the debugger, which will cause system to stop. However, the
transceiver still can receive one last frame. After a few transmission
user can continue application and a isr_status of 0x2c will be visible
if CONFIG_IEEE802154_DRIVER_LOG_DEBUG is enabled.

This fixes the current issue by processing all RF2XX_TRX_END events.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-01-23 09:33:53 -08:00
Nickolas Lapp
be2906a64c NRF_QSPI_NOR: Exit DPD mode regardless of CONFIG_PM_DEVICE.
A call to exit_dpd mode for the nrf QSPI nor flash should always be
made, even if the currently executing image is compiled with
CONFIG_PM_DEVICE=n, because a previously executing image could have set
the device into DPD mode, and a call to exit_dpd is required for proper
functionality. Call `exit_dpd` regardless of the setting of
CONFIG_PM_DEVICE during QSPI nor initialization.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2023-01-23 10:10:49 +00:00
Hein Wessels
6724c8d1fe drivers: adc: stm32: only teardown channel after context complete
Previously channels could be tore down before a sequence completes,

either when using async, or when ADC_ACTION_REPEAT was specified

The teardown is now moved to after an entire context is complete

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-01-23 09:59:46 +00:00
Hein Wessels
cbe52e9027 drivers: adc: stm32: support multiple channels
Support sequencing multiple channels into a single read

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-01-23 09:59:46 +00:00
Hein Wessels
dce0eb7e8f drivers: adc: adc_context: add optional context_on_complete
This optional function allows a driver to do operations

after a complete sampling sequence is completed.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-01-23 09:59:46 +00:00
Andrei Emeltchenko
63f360c7fc drivers: gpio_nct38xx_port: Fix checking wrong return
Fix error check for previous function return code.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-21 21:27:38 -05:00
Joakim Andersson
8703ec6e86 drivers: timers: Add dependency on SYS_CLOCK_EXISTS to all timer configs
Add dependency on SYS_CLOCK_EXISTS to all timer configurations.
This would avoid a situation where a possible timer configuration would
be wrongfully selected but SYS_CLOCK_EXISTS is disabled.

This simplifies code that wants to check for system clock capabilities
don't have to check if the system clock exists in addition.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2023-01-20 20:02:20 +01:00
Rami Saad
1d8681965c drivers: spi: fix 16 bit spi dma transfers for the STM32 driver
Calculate the correct dma segment length for STM32 16 bit spi dma transfers
Fixes zephyrproject-rtos#52563

Signed-off-by: Rami Saad <rami.saad@morgansolar.com>
2023-01-20 16:11:48 +01:00
Wojciech Slenska
fdae56dc6a drivers: watchdog: stm32 iwdg: max prescaler value
In some stm32 MUCs maximum prescaler value can be 1024.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-01-20 16:11:39 +01:00
Raul Pando
0acc7fdd58 drivers: i2s: Improve precision in PLLI2S VCO calculation
Minor rework to perform the PLLI2S VCO computations in floating point as
per the original seemingly intent.

Signed-off-by: Raul Pando <raul.pando@bytegrity.co.uk>
2023-01-20 14:35:36 +01:00
Erwan Gouriou
b8917cdbf6 drivers: ethernet: stm32f7: Enable use of HAL V2 API
Point to the modified version of hal_stm32 which allow to use
ETH HAL V2 on stm32F7.
Update zephyr driver to allow it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-20 13:03:27 +00:00
Mateusz Sierszulski
5744709c9c drivers: watchdog: Enable Gecko wdt driver efr32bg_sltb010a
This commit enables the Gecko Watchdog Timer driver on the
efr32bg_sltb010 board.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-01-20 12:22:56 +01:00
Erwan Gouriou
29a4eb3acc divers: disk: stm32 sdmmc: Configure clock through device tree
Similarly to what was done in USB or RNG drivers, configure 48MHz domain
clock using device tree.
By default a freq clock check is enabled.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-19 20:58:15 -08:00
Henrik Brix Andersen
51cac9e04f drivers: can: rcar: add RX overrun counter statistic support
Add support for the RX overrun statistics counter to the Renesas R-Car
CAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-19 16:51:22 -08:00
Henrik Brix Andersen
8b896fdf01 drivers: can: stm32: add RX overrun counter statistic support
Add support for the RX overrun statistics counter to the ST STM32 bxCAN
driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-19 16:51:22 -08:00
Henrik Brix Andersen
5517a935d0 drivers: can: mcux: flexcan: add RX overrun counter statistic support
Add support for the RX overrun statistics counter to the NXP FlexCAN
driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-19 16:51:22 -08:00
Henrik Brix Andersen
46136b3c12 drivers: can: mcux: flexcan: fix handling of failed RX MB reads
Fix handling of failed NXP FlexCAN RX mailbox reads. Instead of re-enabling
the RX MB in the ISR, we need to handle a failed RX MB read (e.g. due to a
busy MB bit).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-19 16:51:22 -08:00
TOKITA Hiroshi
10ef1a7cba drivers: sensors: Add support for RaspberryPi Pico CPU temperature
Support for the measuring the CPU die temperature
for the RaspberryPi Pico.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-19 15:32:41 -06:00
Felipe Neves
cd04926d6b sensors: as5600: added as5600
magnetic angle sensor driver.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2023-01-19 15:18:24 -06:00
Declan Snyder
33ffda4dd6 drivers: i2c_mcux_flexcomm: Add thread safe lock
Add a locking semaphore so that multiple threads
doing transfers with the same i2c will not produce
unexpected results. The lock will ensure that only one
transfer will happen at a time and it must be completed
before another thread can request a new transfer.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-19 14:25:02 -06:00
Jay Vasanth
6bd7f781a3 mec150x: clk ctrl: fix clock trim register update
Program the right trim control register for mec150x.
This fixes uart debug console output issue.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-01-19 12:45:56 -06:00
Erwan Gouriou
d7631a60ec drivers: interrupt_controller: stm32: Generate irq_table and isr from dt
This change takes advantage of line information coming from new properties
to simplify exti_irq_table definition and isr routing related code.

All __stm32_exti_isr_x routing functions are removed and instead,
stm32_exti_isr is now taking a exti_range structure which provides,
for each irq, start line and range length.
This argument is provided by IRQ_CONNECT macro instead of previous
dev info (which is constant and doesn't need to be provided as argument).

line_range_x variables are generated at driver init thanks to a
mix of dt magic and runtime implementation:
DT_FOREACH_PROP_ELEM iterates over each irq line (counted as
interrupt-names property) call a macro which instantiates populated
line_range_x variables, and calls IRQ_CONNECT for each IRQ.
Additionally, at each iteration stm32_fill_irq_table() is called to
fill exti_irq_table.

Since not required anymore, Kconfig symbols EXTI_STM32_EXTIX_Y_IRQ_PRI
are removed. IRQ prio is now supposed to be configured in device tree.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-19 17:20:48 +00:00
Adrian Warecki
5d902ea621 dma: dw: Align error code for xrun reporting
The hda driver uses -EPIPE to signal xrun, as proposed in the alsa lib
https://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html. This commit
changes the xrun error code in dw dma driver from -ENODATA to -EPIPE to
make it consistent across drivers.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-01-19 15:45:16 +00:00
Jukka Rissanen
c21299ad53 drivers: uart_mux: Fix documentation of uart_mux_recv()
The uart_mux_recv() documentation was wrong, the function parameters
were incorrectly documented.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2023-01-19 08:44:34 -06:00
Daniel Leung
422250d3b1 mm: intel_adsp_mtl_tlb: suppress sparse address space warnings
There are various call to z_soc_cached_ptr() which returns values
in the cached address space and are stored in temporary variables
that are not marked as in the cached address space. This results
in sparse complaining about discarding the cached address space
attribute. These temporary variables are then passed to other
internal memory management related functions which do not have
the concept of cached address space (as it is currently Xtensa
specific). Because of this, we cannot change the signature of
these functions. Instead, we force a change of address space
when those temporary variables are being assigned to suppress
sparse warnings.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-01-19 06:52:23 -05:00
Francois Ramu
227226313a drivers: dma: stm32 dma driver support repeated start/stop
To support the repeated start/stop, the stm32 dma driver is
returning 0 if the channel is already started/stopped.
This is not done at the dmamux level if any.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-19 12:03:50 +01:00
Daniel DeGrasse
158f63794f drivers: i2c: enable i2c target mode for LPI2C driver
Enable I2C target mode for LPI2C driver. Verified with i2c_target_api
test, on RT1060 EVK.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-19 10:16:13 +01:00
Chamira Perera
a5f9fc2382 drivers: ethernet: stm32: Updated original multicast hash filter change
- Applied changes on the most recent version of the driver
 - Using CONFIG_ETH_MULTICAST_FILTER to enable/disable the hash filter
 - Using read-modify-write the hash table for a single address
when joining
 - When leaving rebuild the entire hash table and ensure that multicast
addresses used for the hash calcuation doesn't have the joined flag set

I have tested these conditions:
 - IGMP enabled and disabled on my ethernet network
 - Observed the network utilisation on a STM32H7 device running these
changes with the hash filter enabled and disabled while the device is
on a ethernet network with high rate multicast traffic
 - When the application closes a socket for a multicast receive, ensure
it doesn't affect the receiption of existing sockets as well as IGMP

Fixes #53773

Signed-off-by: Chamira Perera <chamira.perera@audinate.com>
2023-01-18 16:17:27 +01:00
Markus Fuchs
c76aaf3818 drivers: ethernet: stm32: Enable multicast address filter
Use the MAC's hash table to filter incoming multicast frames that are
targeted to subscribed multicast groups and discard all others.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>

# Conflicts:
#	drivers/ethernet/eth_stm32_hal.c
2023-01-18 16:17:27 +01:00
Mulin Chao
5973a944af Revert "driver: uart: npcx: add missing tx/rx interrupt enabled checks"
This reverts commit 271b306.

In rare conditions, this commit causes the uart shell mechanism to
corrupt on Cros ec system. Revert this commit on upstream repo first to
avoid blocking the development. Will dig out why this symptom occurs
later.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-01-18 16:08:49 +01:00
Andrei Emeltchenko
4d2914c5c2 drivers: eeprom: Fix splitting format string
Fix splitting format string to arguments.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-18 07:27:00 -05:00
Andrzej Głąbek
8b391dc438 drivers: audio: dmic_nrfx_pdm: Fix a race condition in the driver
When the PAUSE or STOP command was triggered, the driver was first
requesting the PDM peripheral to stop by calling nrfx_pdm_stop() and
then it was setting a flag that was in turn checked in an interrupt
that was generated when the PDM actually stopped (what happens a moment
after the stop request is made). But that setting of the flag could get
preempted and the interrupt handler could get executed first causing
the stopping to be not handled properly and leaving the driver falsely
considering the peripheral as still active.
This commit reverses the order of these two operations to avoid
the described race condition.
Same sequence is corrected also in event_handler(), but this is
done only for consistency (it is in the interrupt handler itself
so there is no race possible in this case).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-18 12:14:07 +01:00
Adrian Warecki
0e17395bbf mtl: drv: mm: tlb: Add reporting of memory usage to PMC
The number of HPSRAM memory blocks in use is reported to the
PMC via the sideband channel supported by the communication widget.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2023-01-18 10:47:21 +01:00
Francois Ramu
9400de333e drivers: watchdog: stm32 iwdg starts with wdt_setup()
the watchdog is enabled by the wdt_setup()
coming after the wdt_install_timeout.
Due to PR #44972, the code did not follow that.
This PR fixes the correct other in the sequence.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-18 09:56:14 +01:00
Erwan Gouriou
8725edc134 drivers: entropy: stm32: Check clock config at runtime
RNG clock configuration constraints differ between each series.
Rather than providing complex build time code to verify RNG clock
configuration is correct, take advantage of CECS bit (Clock error
current status) to assess clock configuration.

This check is implemented under a specific ENTROPY_STM32_CLK_CHECK
Kconfig option. This allows user to disable this feature in specific
conditions:
- CED bit disabled in application (in which case CECS status is not valid)
- Clock configuration is deemed as correct by user. Note that RNG number
  are always generated, whatever the clock status.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-18 09:56:03 +01:00
Erwan Gouriou
b9da848c0b drivers: entropy: stm32: Configure clock source using clock_control driver
RNG domain source clock is now configured via call to clock_control
driver.
Besides, add static checks to verify domain clock configuration
is correct:
- If HSI48 is used because it is default domain clock config,
it should be enabled
- If no HSI48 is available, a specific domain clock should be set
- In L0 case, PLL could be used as domain clock only at a specific freq.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-18 09:56:03 +01:00
Erwan Gouriou
5cbff34e35 drivers: entropy: stm32: Allow to configure clock source from dt
Use STM32_DT_INST_CLOCKS to populate device clock information.
This will allow to add clock source information in next commits.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-18 09:56:03 +01:00
Dino Li
a41a4e5e24 espi: it8xxx2: enable espi transaction interrupt
The interrupt is used to wake up EC from low power mode.
So EC does not defer eSPI bus while transaction is accepted.
Fixes EC host commands slow issue.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-01-18 09:55:44 +01:00
Piotr Makaruk
00b5114344 dma: hda: enable xrun handling
Enable link under/overruns handling and reporting such events in dma
status

Signed-off-by: Piotr Makaruk <piotr.makaruk@intel.com>
2023-01-17 18:50:15 -05:00
Pawel Czarnecki
04ec6d72e7 dts: spi: silabs: make peripheral-id property optional
This commit makes the peripheral-id property optional and removes it's
usage from the Gecko SPI driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-01-17 15:37:27 -06:00
Pawel Czarnecki
06245f3653 drivers: spi: gecko: add support for CPOL and CPHA
This commit adds support for CPOL/CPHA configuration in the Gecko SPI
driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-01-17 15:37:27 -06:00
Pawel Czarnecki
f1d3011ae1 drivers: spi: gecko: add support for pinctrl configuration
This commit adds support for pinctrl configuration in the Gecko SPI
driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-01-17 15:37:27 -06:00
Pawel Czarnecki
eb4a0ae225 drivers: pinctrl: silabs: add spi handling
This commit adds pinctrl configuration for SPI on USART.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-01-17 15:37:27 -06:00
Daniel DeGrasse
47271ce8be treewide: update usage of zephyr_code_relocate
Update usage of zephyr_code_relocate to follow new API. The old method
of relocating a file was the following directive:

zephyr_code_relocate(file location)

The new API for zephyr_code_relocate uses the following directive:

zephyr_code_relocate(FILES file LOCATION location)

update in tree usage to follow this model. Also, update the NXP HAL SHA,
as NXP's HAL uses this macro as well.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-17 18:08:37 +01:00
Andrzej Głąbek
3454a2547e drivers: nrf_rtc_timer: Remove unnecessary interrupt locking
There is no need to disable interrupts while just checking if
a channel needs to be processed in the ISR, as that section
does not contain anything that needs to be protected against
overwriting from some other context. In particular, if a given
timeout is changed or even aborted while its event is being
checked, this will be correctly handled in the code that follows
and that checks the expiration time.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
eb0cbb433c drivers: nrf_rtc_timer: Correct initial timeout value
Values to be set to the comparator need to be specified in RTC cycles,
not ticks, so the initial value used in the tickless mode needs to be
MAX_CYCLES, otherwise when CONFIG_SYS_CLOCK_TICKS_PER_SEC is set to
a value less then the RTC frequency, the initially configured timeout
will be unnecessarily shorter.
On the occassion, remove also the call to counter() when setting the
initial timeout value in non-tickless mode. RTC is cleared a few lines
above, so at this point it will most likely be 0, and even if it was
not, compare_set() would properly handle a target time value that had
already passed.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
3ffaaa989a drivers: nrf_rtc_timer: Always announce actual number of elapsed ticks
In non-tickless mode, the timeout handler always announced maximum 1
tick to kernel, but in fact it cannot be guaranteed that the handler
execution is not delayed and that the number of elapsed ticks does not
exceed 1. Use the actual number instead.
Switch also to using a 32-bit value for `dticks` to get a bit simpler
generated code (ticks delta is not supposed to be that huge).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
a98316ba09 drivers: nrf_rtc_timer: Fix checking of maximum timeout value
Align the condition checked in compare_set_no_locks() with what
set_absolute_alarm() actually provides (and slightly correct the
latter function so that it provides what it is supposed to).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
e5aa0ab796 drivers: nrf_rtc_timer: Check channel bit when handling force_isr_mask
Add missing masking against `BIT(chan)` when handling a forced ISR
to avoid unnecessary processing of multiple channels instead of just
the one that actually requires it.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
ac96b86493 driver: nrf_rtc_timer: Remove unnecessary setting of comparator
Remove a piece of code that was supposed to bring an extra update
of the anchor value but which in fact was not able to provide it,
because of the target time checking performed in process_channel(),
and which is anyway unnecessary because the timeout span is limited
to MAX_CYCLES in sys_clock_set_timeout(), so the timeout handler is
guaranteed to be executed at least twice per each RTC overflow.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
205e684958 drivers: nrf_rtc_timer: Rework set_absolute_alarm()
Eliminate waiting for a potential COMPARE event when setting a CC
value close to the previously set one and rely instead on checking
target time when processing channel events in the ISR.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Andrzej Głąbek
bf1d3db1d4 drivers: nrf_rtc_timer: Simplify sys_clock_set_timeout calculations
Remove unnecessary decreasing of the number of ticks by 1 (it was then
increased by 1 when it was converted to the number of cycles) and add
a comment that clarifies the way that ticks < 1 are handled.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-01-17 17:00:16 +01:00
Armin Brauns
fc0157f97c drivers: disk: reset stm32 SDMMC peripheral during init
This is important for applications which are chain-loaded by a broken
bootloader which doesn't reset the peripheral before handing over control.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-01-17 11:27:16 +01:00
Gerard Marull-Paretas
e59e38532a drivers: regulator: shell: fix fp number parsing
Parser did not handle decimals correctly (multiplier was not decreased).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
Gerard Marull-Paretas
0c28da26ba drivers: regulator: npm6001: handle LDO0 set voltage correctly
Even if the regulator is fixed, allow valid voltage input (1.8V).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
Gerard Marull-Paretas
240be492fa drivers: regulator: common: set regulator voltage before enabling
Regulator voltage needs to be within allowed range before enabling. It
could happen that regulator default voltage is out of the allowed range,
so the regulator could be enabled at boot time producing a not-allowed
voltage.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
Gerard Marull-Paretas
4eb74c8ed2 drivers: regulator: remove ONOFF dependency
The regulator drivers no longer depend on ONOFF.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
Gerard Marull-Paretas
e086738b88 sys: linear_range: allow out-of-range values/windows
The existing linear_range API did not allow values or windows outside of
the linear range (returned -EINVAL). With this change values are allowed
outside of the range, being adjusted to the edge values (min/max)
instead. In the case of windows, it is allowed to have partial
intersection. In both cases, the API assigns a valid index (nearest) and
returns -ERANGE. This change is useful because the main client of the
linear range API, regulators, needs such behavior. For example, If an
application specifies a voltage range from 1.0V to 1.5V and the
regulator supports from 1.2V to 2.7V, the regulator can configure a
voltage that satisfies the condition: 1.2V.  With the current API, the
input would be refused because 1.0V lies outside of the 1.2V-2.7V range.

Also, for constant ranges, the minimum index is returned.

Tests have been updated/extended accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-16 16:52:35 +01:00
Erwan Gouriou
419adeaeed drivers: usb: stm32: Replace static clock check by a runtime check.
In order to clean up clock related code, replace static build time
clock configuration code by a runtime check.
Since I'm not able to guarantee this check will provide a correct
verdict in 100% of the cases (I'm thinking to ULPI or exotic configurations
like F7 OTG-HS), add a config option to disable it if needed.
It also doesn't apply on F1/F3 series. Keep the build time check for now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Erwan Gouriou
4899c104e0 drivers: usb: stm32: Configure domain clock using device tree
This change doesn't consider STM32F1 series.

There are 5 categories of STM32 regarding USB domain clock:
A] USB domain clocks directly driven by CK48 clocks
B] USB domain clocks which can select either CK48 or an alternative clock
C] USB domain clocks which can select between MSI or PLL
D] USB domain clocks relying statically on a PLL output
E] USB domain clocks which can be set on 2 different PLL ouputs

For case A], there is nothing to be done. Clk48 was already configured
in a previous change (51c7643295b02ba26ddcd0fd915484114db7101c).
For case B] and C] USB domain clocks will need to be configured in
each board.
For case D] and E] relying on existing dts configuration. Though
there is no easy build time chekc that can be done.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Erwan Gouriou
cbc44075b7 drivers: usb: stm32: Store dt clock information into an array
Use STM32_DT_INST_CLOCKS() to access usb device clock information.
This will help accessing domain clock information from dt nodes.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Erwan Gouriou
fccf4c95c0 drivers: usb: stm32: Remove HSI48 activation related code
Remove this code to clean up the driver.
Clock activation is done from device tree configuration in clock_control
driver.
Users are informed by warning about missing configuration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Erwan Gouriou
bef7a89823 drivers: clock_control: stm32wb: Lock CLK48 hsem
On stm32wb, M0 core may enable and disable CLK48 when using RNG.
Lock related hsem to prevent M0 to disable CLK48 when it doesn't need it
anymore.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-16 11:23:55 +00:00
Grixa Yrev
15a83fe0a0 drivers: pwm: pwm_mcux: Reload mode option
DTS property "nxp,reload" selects how to load the buffered-registers
with new values.

Signed-off-by: Grixa Yrev <grixayrev@yandex.ru>
2023-01-16 09:26:23 +01:00
Ruibin Chang
7b5780e007 ITE drivers/kscan/it8xxx2: set KSI/KSO kbs mode by pinctrl driver
Set KSI/KSO kbs mode by pinctrl driver.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-01-14 09:22:39 +01:00
Ruibin Chang
344c9c67f9 ITE drivers/pinctrl/it8xxx2: extend pinctrl driver for kscan pins
Extend pinctrl driver for kscan pins.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-01-14 09:22:39 +01:00
Ruibin Chang
d7f482a022 ITE driver/gpio/it8xxx2: add kscan pins gpio driver
Add kscan pins gpio driver for KSI[7:0], KSO[15:0] pins that
they can be configured to gpio mode. These pins registers address,
bit fields and function are different from GPIO group, so I create
a new compatible driver for these pins.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-01-14 09:22:39 +01:00
Declan Snyder
4fe04f9a85 drivers: sdhc: Support HS400 mode on IMX driver
Enables HS400 mode on mimxrt595_evk

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder
f7e026f655 drivers: sdhc: Adds MMC functionality to IMX USDHC
Adds MMC support to IMX USDHC driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder
e1d309c17b drivers: disk: Framework for eMMC
Framework for using eMMC with disk subsystem.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder
26ad12f55e drivers: sdhc: Fixes IMX SDHC DMA support
Enables DMA support for cacheless IMX systems.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Declan Snyder
a838eef33b sd: Changed KConfig Structure
Changed KConfig structure for SD:
- Better Menu Interface
- Changed symbol dependency structure

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-14 09:22:22 +01:00
Daniel DeGrasse
b7cd970493 sd: add stub for SDIO support
Add stub code for SDIO support, capable of verifying card responds to CMD5.
This commit also changes the architecture of the SDIO probe step to make
adding new protocol support more streamlined, and enable compiling out
support for undesired protocols.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-14 09:22:22 +01:00
Gerard Marull-Paretas
3bd9352b24 drivers: regulator: npm1100: regulator device may be unused
Since nPM1100 may be configured statically in some circuits, BUCK node
may note be defined, so neither API ops or init call are used in the
code. Add __unused attribute to account for such case.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-13 16:14:35 +01:00
YuLong Yao
aed1f1ac5b drivers: gd32_adc: add support for gd32a50x series.
add support for gd32a50x series.

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-12 21:45:38 +01:00
YuLong Yao
2a013216eb drivers: gd32_spi: drop APB marco
drop APB marco because clock_control driver is added.

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-12 21:45:38 +01:00
YuLong Yao
d048c44918 drivers: gd32-dac: add support for gd32a50x
add macro for gd32a50x

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-12 21:45:38 +01:00
YuLong Yao
caa4721dc4 drivers: clock: gd32: add gd32a50x support
add gd32a50x support

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-12 21:45:38 +01:00
YuLong Yao
e5d35910f4 drivers: pinctrl: gd32: add gd32a50x support
set port speed for `gd32a50x`

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-12 21:45:38 +01:00
Lucas Tamborrino
41b431a01a drivers: uart: esp32c3: Add async support
Add UART async support for ESP32C3

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-01-12 19:09:01 +01:00
Lucas Tamborrino
17fbdc55b5 drivers: dma: esp32c3: add gdma driver
Add GDMA driver for esp32c3.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-01-12 19:09:01 +01:00
Gerard Marull-Paretas
8c73db666c drivers: regulator: npm1100: add initial support
While nPM1100 is to be operated in fixed configuration for some
applications, it has some degree of configuration via GPIOs. For
example, mode (auto/PWM) can be configured via MODE pin. VBUS current
can also be adjusted using ISET pin, even though there is no API yet to
limit the PMIC input current.

This patch adds a new regulator class driver for nPM1100 PMIC, so that
it can be used with the standard regulator API when needed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-12 19:07:05 +01:00
Michał Barnaś
cc3faf27ca ec_host_cmd: add missing name to choice in Kconfig
It is recommended that choices in Kconfig have names
so this commit adds missing one for the type of
host commands peripheral.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-01-12 16:12:55 +00:00
Mateusz Sierszulski
b36a31fd7a drivers: entropy: Add Gecko trng driver for EFR32BG22
This commit enables entropy driver on EFR32BG22 SoC.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-01-12 15:22:11 +00:00
Erwan Gouriou
6cbb3f5eec drivers: clock_control: stm32: Fixed domain clock configuration
In some case, we may need to describe a domain clock for a device
while there is no way to configure it (ex: USB clock set on PLL_Q output
on F405 devices > It is not selectable).
Then, configuring a device clock domain in the clock_control driver
will allow to retrieve its subsys rate.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-12 12:46:53 +01:00
Kai Vehmanen
8374325062 drivers: dai: intel: dmic: don't use assert for error handling
The dai.h interface does not prohibit calling dai_config_get()
with different direction values. The dmic driver should handle
invalid direction value explicitly and not rely on an assert.

Link: https://github.com/thesofproject/sof/issues/6896
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-01-12 10:01:41 +01:00
TOKITA Hiroshi
e55cbb8ce6 drivers: spi: gd32: Add support DMA transfer
Add supporting DMA-based transfer for GD32 SPI.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-01-11 08:50:56 -08:00
Johann Fischer
b5bfd3b12c drivers: udc: fixup parameter endpoint description
The description was still from the early stages of development.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Johann Fischer
2cab3a8243 drivers: usb: udc_kinetis: fix race condition in Kinetis USBFSOTG
Periodic enqeueu of buffers can cause a attempt to start
a new transfer even though an endpoint is already busy.

Split usbfsotg_xfer_start() into two function, one to start
next transfer and another to continue the transfers, and use
busy state flags to explicitly mark an endpoint busy.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Johann Fischer
00adb2a539 drivers: udc: remove no more required pending state flag
Pending state flag was only used by the UDC nRF USBD driver.
With the introduction of busy state flag it is no longer needed
and can be removed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Johann Fischer
a033784c7e drivers: usb: udc_nrf: fix race condition in nRF USBD
Periodic enqeueu of buffers can cause a attempt to start
a new transfer to host even though an IN endpoint is already busy.
Use busy state flags to explicitly mark an endpoint busy.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Johann Fischer
baef621bed drivers: udc: add helper functions to set/check endpoint busy state
Add helper functions to set and check endpoint busy state.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Johann Fischer
c1860326d1 drivers: udc: avoid NULL pointer dereferencing if endpoint is invalid
Immediately return NULL if endpoint configuration is not available.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2023-01-11 17:44:50 +01:00
Erwan Gouriou
3b92034b57 drivers: ethernet: stm32_hal: Rework data provisionning style
Use more concise and readable style.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-11 17:07:20 +01:00
Erwan Gouriou
8eee0afa1f drivers: stm32_hal: Add option to enable HW checksum
Provide a Kconfig option to enable HW RX and TX checksum, which
can increase throughput performances.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-11 17:07:20 +01:00
Fabio Baltieri
afd766d2b3 drivers: xec_qmspi: add missing default y to SPI_XEC_QMSPI_FULL_DUPLEX
Add missing "default y" to the Kconfig option so that it gets selected
automatically when a matching devicetree node is enabled.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-11 09:11:03 -06:00
Marc Desvaux
ae2cf06f0b drivers: ethernet: fix error UDP server on STM32
With ETH_STM32_HAL_API_V2 avoid log error message
if error log report:
we have problems if the traffic is high


Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-01-11 09:42:00 +01:00
Mulin Chao
b1214ead19 driver: i2c: npcx: simplify smb bank registers with union
For NPCX SMB/I2C SMB modules in FIFO mode, the registers include:

* Common registers, offset 0x00-0x0f, accessible regardless of the value
  of BNK_SEL
* Bank 0 registers, offset 0x10-0x1e, accessible if BNK_SEL is set to 0
* Bank 1 registers, offset 0x10-0x1e, accessible if BNK_SEL
is set to 1

In the current driver, it uses two structures, `smb_reg` and
`smb_fifo_reg`, to access `Common + Bank 0` and `Common + Bank 1`
registers. But It might be easy to misunderstand that they are two
different modules.

This CL tries to simplify this by the following steps:

1. Use `union` to combine `Bank 0/1` registers in the same structure.
2. Remove `smb_fifo_reg`. We needn't use two structures to present
   SMB registers.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-01-11 09:40:36 +01:00
Francois Ramu
302983fd7d drivers: flash: stm32 qspi driver correct device size
The find_lsb_set is giving the position of the first '1' found,
starting from 1. "Bits are numbered starting at 1
from the least significant bit."
So that the find_lsb_set(64MBytes) is 27.
The HAL_QSPI_Init() accepts Init.FlashSize where "FlashSize+1
is effectively the number of address bits
required to address the flash memory."
To get 64MBytes = 2^26, the value of the Init.FlashSize must be 25.
and bit written to the DCR = 25.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-11 09:39:47 +01:00
Francois Ramu
4500dba078 drivers: flash: stm32 ospi driver correct device size
The find_lsb_set is giving the position of the first '1' found,
starting from 1. "Bits are numbered starting at 1
from the least significant bit."
So that the find_lsb_set(64MBytes) is 27.
To get 64MBytes = 2^26, the value of the Init.DeviceSize must be 26.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-11 09:39:47 +01:00
Francois Ramu
2cca8b54a3 drivers: flash: stm32 ospi driver prepare sfdp command
Change the stm32_ospi_read_sfdp to have AddressSize
prepared in one single condition.
Add more debug msg.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-11 09:39:47 +01:00
Michał Barnaś
0918442ba6 ec_host_cmd: add ITE SHI peripheral for the host commands
This commit adds the support for host commands being transported
by the Serial Host Interface on the IT8xxx2 SoC.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-01-11 09:38:45 +01:00
Michał Barnaś
3ae105e76b ec_host_cmd: add NPCX SHI peripheral for the host commands
This commit adds the support for host commands being transported
by the Serial Host Interface on the NPCX SoC.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-01-11 09:38:45 +01:00
Michał Barnaś
cbb6742855 ec_host_cmd: add Kconfig to set ec host commands logging level
This commit adds Kconfig CONFIG_EC_HC_LOG_LEVEL that sets the logging
level of host commands subsystem.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-01-11 09:38:45 +01:00
Nick Ward
658b618289 drivers: pwm: add NXP PCA9685 controller
Adds PCA9685 16-channel, 12-bit PWM Fm+ I2C-bus LED controller

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-01-11 09:38:18 +01:00
Tom Burdick
15786ce648 sensor: tdk 42688 driver
Adds a driver for TDK InvenSense 42688 six axis IMU. Verified using
the sensor shell sample app via:

- sensor info
- sensor get icm42688p@0

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Signed-off-by: Yuval Peress <peress@google.com>
2023-01-10 14:45:36 -06:00
Francois Ramu
c14670abea drivers: timer: lptim timer clock on stm32u5 has a prescaler
The stm32 devices shows a x2 factor on the LPTIM1,3,4
clock source but it acts as a prescaler.
The max lptim counter (timebase) is counting 4 sec
In that case, the LPTIM count unit is double.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-10 15:54:25 +00:00
Mathis Raemy
c4b07e8321 drivers: flash: bug fix inline function was not inlined
During flash operation, you have to disable XiP which force function
to be located in RAM. On top of that, the function `flash_put_cmd_addr`
is time critical so we need to declare as inline. For some reason,
sometimes the function was not really inline. Changed it to
ALWAYS_INLINE fixed the bug.

Signed-off-by: Mathis Raemy <mathis.raemy@gmail.com>
2023-01-10 09:26:37 +01:00
TOKITA Hiroshi
c1fc906599 drivers: counter: gd32_timer: Remove is_bit_mask() implementation
Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
TOKITA Hiroshi
33963c43ca drivers: counter: nrfx_timer: Remove is_bit_mask() implementation
Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
TOKITA Hiroshi
21dc3f58e4 drivers: counter: nrfx_rtc: Remove is_bit_mask() implementation
Replace is_bit_mask() with IS_BIT_MASK() and remove the implementation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
TOKITA Hiroshi
429b05a79a drivers: counter: stm32_timer: remove counter_stm32_is_bit_mask() function
Remove implementation of counter_stm32_is_bit_mask() and
Use IS_BIT_MASK() macro.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
Chris Friedt
8659e2f69e libc: minimal: include: move fcntl.h to posix
The `fcntl.h` header has never been a part of ISO C so move it to
`include/zephyr/posix`.

To ensure a smooth migration, a header was left in
`lib/libc/minimal/include` that prints a deprecation warning.

Users should either include `<zephyr/posix/fcntl.h>` or switch to
`CONFIG_POSIX_API=y`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-01-10 09:02:21 +09:00
Erwan Gouriou
773f96b763 drivers: stm32: stm32_hal: Generate device id based mac address
In case user didn't set mac address in any way (locally defined or
randomly generated), define mac address using device unique id.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou
179963899e drivers: ethernet: stm32_hal: Move mac address configuration to dt
Deprecate Kconfig mac address related symbols and replace by existing
device tree properties:
- local-mac-address
- zephyr,random-mac-address

User who wants to keep using deprecating method of defining random
MAC address using Kconfig should set CONFIG_ETH_STM32_HAL_RANDOM_MAC=y.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou
eee1d7fc66 drivers: ethernet: stm32_hal: Centralize mac address configuration
Get the mac address be set in a central function rather than split
between 2 places.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Erwan Gouriou
ddb457a8d9 drivers: ethernet: stm32_hal: Make MAC address setting method a K choice
In order to ease deprecation of these methods (in favor of dt based
configuration), introduce a choice for MAC address configuration method.

Default to random method (no change).

User wanting to still use ETH_STM32_HAL_MACX symbols should define
CONFIG_ETH_STM32_HAL_USER_STATIC_MAC=y

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 19:22:54 +01:00
Jani Hirsimäki
e92b067b7f net: ip: net_context: AF_PACKET/SOCK_RAW/IPPROTO_RAW: set pkt family
Setting a detected packet family (ipv4 or ipv6) in net_context level
instead in lower layers for AF_PACKET/SOCK_RAW/IPPROTO_RAW type sockets
when sending data.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2023-01-09 19:21:18 +01:00
Marco Peter
ec3857dbcf drivers: flash: stm32: Use consistent log priorities
Any error erasing the flash might want to log
the event with "ERROR" priority.

Signed-off-by: Marco Peter <marco.peter@joylab.ch>
2023-01-09 19:19:49 +01:00
Flavio Ceolin
24cb520698 timer: hpet: Remove deadcode
Move hpet_int_sts_set to inside HPET_INT_LEVEL_TRIGGER guard.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-01-09 12:07:28 -05:00
Gerard Marull-Paretas
a6575e5834 drivers: regulator: npm6001: add support for BUCK1/2 disable
BUCK1/2 are defined as "always on" regulators, however, there is a
special override register that allows to turn them on/off.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-09 16:19:09 +00:00
Gerard Marull-Paretas
7feb008c85 drivers: regulator: common: allow to specify on by default
Some regulators are enabled by default, however, such condition cannot
be captured now by the regulator driver API. Refactor
regulator_common_init_enable to regulator_common_init (enable removed,
as it also sets mode) and add a new argument to specify such condition.
With this change, regulator_disable() and regulator_is_enabled() work as
expected without a first call to regulator_enable().

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-09 16:19:09 +00:00
Raul Pando
cd1d7e4bb8 drivers: usb: make USB VBUS sensing configurable for STM32 devices
Vbus detection is required by self-powered, with external non-USB
supply, devices to have an operational USB peripheral. The voltage
sensing, when enabled, is performed via a designated pin (PA9 is
the most common).

For greater details see section 2.6, ST application note AN4879.

Signed-off-by: Raul Pando <raul.pando@bytegrity.co.uk>
2023-01-09 15:26:21 +00:00
Erwan Gouriou
079470be02 drivers: clock_control: stm32: Fix HSI48 oversights
Take into account HSI48 when computing susbys rate.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-09 14:01:28 +00:00
Patryk Duda
09277d44e3 drivers: watchdog: Make SOC reset as an option in counter watchdog
When using watchdog which doesn't support callbacks (e.g. STM32 IWDG)
it's very useful to have counter based watchdog with shorter timeout.
This way we can gather useful information before IWDG resets SOC.

In above case it's usually not desired to reset SOC when counter
watchdog is triggerd, because we can lose information about reset cause.
For example, STM32 can determine if the reset was caused by watchdog.

Another use case for counter watchdog without SOC reset is to detect
slow code paths.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-01-09 10:15:33 +01:00
Guillaume Gautier
3e6c9c40aa drivers: counter: Properly deprecate Kconfig symbols in STM32 RTC driver
Now that both RTC source clock Kconfig symbols are disabled by default,
we invert the ifdef so that in the absence of configuration we still
fall in the LSI configuration.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-09 10:14:35 +01:00
Guillaume Gautier
1cbc1c14f0 drivers: counter: Deprecate Kconfig STM32 source clock
Following #50104, properly deprecates old Kconfig symbols concerning
RTC source clock and makes them optional to have them disabled by
default.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-09 10:14:35 +01:00
Erwan Gouriou
af0576b7ea drivers: flash: stm32: Remove useless Kconfig
SOC_FLASH_STM32_V1 is not used anymore.
Remove it

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:49:12 +01:00
Erwan Gouriou
cc1601fde7 driver: flash: stm32: Use compat information to select file to build
Now that compatible is directly linked with driver version,
use DT compat based Kconfig flag to build the correct flash driver
version.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:49:12 +01:00
Erwan Gouriou
a934cce35b drivers: flash: stm32: Rename v1 driver into f1x
Instead of introducing a vX driver version, use series name.
With this commit F0, F1, F3, L0 and L1 series are using F1 flash driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:49:12 +01:00
Daniel DeGrasse
29c53f4f6a drivers: adc_mcux_lpadc: add clock setup for RT5xx SOC
Add clock setup code for RT5xx series SOC to LPADC driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-08 19:48:54 +01:00
Erwan Gouriou
c5ab922f50 drivers: hci: stm32wb: Use clock_control driver for clock configuration
Instead of relying on STM32Cube API, use clock_control framework
for clock configuration inside this driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
f3e788e84e drivers: hci: stm32wb: Refactor c2_reset()
In preparation of the introduction of dt configured clock in this
driver, refactor clock related clocks.
- remove start_ble_rf()
- Move  IPCC clock activation in c2_reset()

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
079a43d9f8 drivers: hci: stm32wb: LSE clock configuration not required
As long as LSE clock is set in device tree, configuration will be
done in clock control driver, no need to do it here.
Besides, remove back up domain related code as this is also already
handled in clock_control driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
52b9724a88 drivers: hci: stm32wb: LSI is not an allowed clock for BLE RF.
Remove code related to LSI used as clock source for RF wakeup,
it isn't a valid clock source.
Also don't disable LSI when LSE is selected.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
f1dfeff282 drivers: hci: stm32wb: Don't mess with RTC Clock source
No reason to update RTC clock source in this driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Aaron Massey
c4be38dec1 fuel_gauge: sbs_gauge: Enable MFR ACC write
Update the SBS Gauge driver that implements the fuel_gauge API to implement
a set_property function allowing the writing of an SBS word to the
manufacturer access register per the SBS spec.

Includes an update to the SBS Gauge emulator and SBS fuel gauge tests to
weakly verify the code runs.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-01-08 19:48:12 +01:00
Aaron Massey
c0762d003a fuel_gauge: Implement sbs gauge read for mfr acc
Implement and weakly test fetching the manufacturer access word from an SBS
compatible fuel gauge.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-01-08 19:48:12 +01:00
Chris Wilson
18d47316ed drivers: clock_control: esp32: fix cpu_freq divisor typo.
Current divisor is 10000000 (should be 1000000).

For example, ESP32_CLK_CPU_240M / 10000000 == 24 MHz (incorrect).

Signed-off-by: Chris Wilson <christopher.david.wilson@gmail.com>
2023-01-05 12:43:17 +01:00
Dino Li
5bcd47f9b9 espi: it8xxx2: make sure h2ram offset is configured correctly
This change for addressing the below symptoms.
Two FW images have different h2ram offset settings.
Jumping to each other will cause offset setting errors.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-01-04 18:41:29 +00:00
Dino Li
02578cb834 it8xxx2/espi: protect clear OBF request
At default, IBF (input buffer full) interrupt status will be cleared
after reading keyboard data input register (KBHIDIR) in ISR.
For request to clear OBF (output buffer full), we need to enable clear
mode. In the mode, IBF status cannot be cleared by reading KBHIDIR
register. It means that if AP output data to 60h/64h port during the
mode enable, IBF interrupt will keep triggering until the watchdog is
reset. This patch addresses this issue.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-01-04 18:40:55 +00:00
Mahesh Mahadevan
3f38b011c3 drivers: counter: Update NXP LPC RTC for wakeup source
Add support to wakeup from low power modes

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-04 11:03:42 -06:00
Mahesh Mahadevan
db7dedaead drivers: memc: Add device PM to MCUX Flexspi driver
Add Device level power manangement support to the
MCUX FlexSPI driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-04 11:03:42 -06:00
Manuel Arguelles
a7743a49aa drivers: pinctrl: rename S32 to NXP S32
Following updates previously done for other drivers, rename all
occurrences of S32 to NXP S32 to avoid ambiguity.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-04 16:51:38 +01:00
Manuel Arguelles
415131c2e4 drivers: serial: rename S32 to NXP S32
Following updates previously done for other drivers, rename all
occurrences of S32 to NXP S32 to avoid ambiguity.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-04 16:51:38 +01:00
Manuel Arguelles
492e196e8a drivers: gpio: rename S32 to NXP S32
Following updates previously done for other drivers, rename all
occurrences of S32 to NXP S32 to avoid ambiguity.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-04 16:51:38 +01:00
Cong Nguyen Huu
d167d3a29a driver: can: add new filter to match CAN-FD frames
Add support FD frame filter to configure type frame for
each Rx msg to receive corresponding frames (classic, FD frames).

The Bosch M_CAN driver does not support FD frame filter,
so inmplement driver to handle it in software.

Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
2023-01-04 08:18:13 -06:00
Martin Jäger
c8c0879963 drivers: can: mcan: Fix flag overflow for some MCUs
The number of extended filters can be up to 15 for MCUs like the NXP
LPC55Sxx series, so the flags don't fit into uint8_t.

Fixes #53417

Signed-off-by: Martin Jäger <martin@libre.solar>
2023-01-04 14:24:35 +01:00
Sylvio Alves
cff71c8d2b driver: systimer: increase esp32c3 tick resolution
hal_espressif systimer HAL calls are based on 1MHz reference.
This changes systimer driver to allow max clocking reference of 16MHz
and increases soc tick resolution by reducing min delay interval.

This also sets all ESP32-C3 socs to 16MHz hardware cycles reference.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-01-04 14:24:25 +01:00
Gerard Marull-Paretas
24f2c30678 drivers: regulator: shell: fix isdigit() usage
ISO/IEC 9899:1999 (C Standard), §7.4 Character handling <ctype.h>:

In all cases the argument is an int, the value of which shall be
representable as an unsigned char or shall equal the value of the macro
EOF. If the argument has any other value, the behavior is undefined.

So add a cast to unsigned char to make sure we do not trigger UB.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-01-04 11:19:25 +01:00
Al Semjonovs
211e4d276e gpio: Add driver support for software based gpio debounce
Software based GPIO debounce driver implementation.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-01-04 10:36:00 +01:00
Daniel DeGrasse
64a14a8c1c drivers: memc: introduce driver for APS6408L PSRAM
Introduce driver for APS6408L PSRAM, built on top of the MCUX memc
driver for flexSPI. This driver supports operating the PSRAM in high
speed mode (200MHz or more). Note that in order to support this
PSRAM's alignment requirements, either ahb-read-addr-opt or
ahb-prefetch must be set for the FlexSPI instance.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-04 10:35:25 +01:00
Daniel DeGrasse
41acdc1078 drivers: memc: fix XIP active logic for RT6xx/RT5xx
memc driver was setup to always assume the flexSPI would be in XIP mode,
and skip init. This is only true for the active flexSPI, which is
typically FlexSPI1. Fix this check to only skip init for FlexSPI1

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-04 10:35:25 +01:00
Daniel DeGrasse
0aba1a80b1 drivers: memc: rename flexspi-hyperram driver to flexspi-s27ks0641
Rename flexspi-hyperram driver to flexspi-s27ks0641, and update
function names. This driver is only capable of supporting the
s27ks0641 HyperRAM chip, as the lookup table given in this driver
is specific to the s27ks0641.

Rename the flexspi-hyperram binding to reflect this, to
prevent confusion from users.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-04 10:35:25 +01:00
Tim Lin
c7d9f2ba5f ITE: drivers/i2c: Don't spam NACK error messages
Printing of NACK messages should be set to LOG_DBG to avoid spamming.
When we scan whether there is a target device through I2C, if we use
LOG_ERR, it will frequently print out NACK messages. So it is set to
LOG_DBG in the case of NACK.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-01-04 10:34:46 +01:00
Dawid Niedzwiecki
4a2a512c11 drivers: serial: fix STM32 async uart driver
Fix a bug that causes not handling an IDLE line detection interrupt for
some STM chips, e.g. STM32F412. It impacts the async UART
communication - an information that data have been recieved is lost.

The issue occurs when the IDLE flag is set during handling another UART
interrupt, e.g Transmission complete. The ISR calls uart_stm32_err_check
function, which clears the noise error flag with LL_USART_ClearFlag_NE
without any additional checks. Unfortunately, clearing the noise flag
also clears the IDLE flag for some chips(an read to the USART_SR
register followed by a read to the USART_DR register for STM32F412
clears PE, FE, NF, ORE and IDLE flags), hence the ISR is not called
again for the IDLE event. The IDLE flag is no longer set.

Add checking the noise flag before clearing it.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2023-01-04 10:33:49 +01:00
Sylvio Alves
42b33382f7 driver: clock: esp32: retrieve HW clock from DTS
ESP32 and ESP32-S2 HW clock are tied to DTS clock configuration.
This changes updates the default configuration to retrieve
this information from DTS.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-01-03 17:12:06 -05:00
Daniel DeGrasse
a5994dbd1a drivers: memc: don't relocate MEMC functions unless CONFIG_FLASH=y
Only relocate memc driver when CONFIG_FLASH=y.
CONFIG_FLASH_MCUX_FLEXSPI_XIP previously was dependent on
CONFIG_FLASH, but the scope of this Kconfig has changed.

Due to this, the memc driver now must have two checks, as it should not
relocated when the driver is being used for a memory controller that does
not expose the flash driver interface.

Since the NXP HAL also relocates the underlying FlexSPI driver
using a similar check, it is updated in this commit as well.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-03 12:20:39 -06:00
Antonio Tessarolo
e614a38cbd nxp/imx: fix imx6sx gpio pull up-down configuration
To enable pin pull up/down with the new pinmux APIs bit 13 must be set.

Signed-off-by: Antonio Tessarolo <anthonytexdev@gmail.com>
2023-01-03 10:46:52 -06:00
Erwan Gouriou
4b67b98830 drivers: flash: stm32: Fix CmakeLists issue
Missing "x" prevents to find the right file.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-03 11:18:55 -05:00
Yonatan Schachter
abe50cc929 rpi_pico: Fix DTC warnings concerning the flash
The addresses of the flash and flash controller of the RP2040
SoC were mixed up. There was no clear distinction between the
flash and the flash controller, which was unclear but also
caused a DTC warning.
This commit makes the distinction clearer: The SSI peripheral at
0x18000000 is the flash controller, and the flash itself starts
at 0x10000000. The flash driver and rpi_pico.dts were fixed
accordingly.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2023-01-03 13:37:23 +01:00
Chao Song
96271c77bf drivers: crypto: don't return uninitialized local variable
It should never be intended to return an uninitialized
variable from a function.

Remove the use of the uninitialized variable to fix the bug.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-01-03 13:36:46 +01:00
Hein Wessels
3210541c86 toolchain: gcc: rename popcount to avoid conflict with C++20
The macro conflicts with the C++20 feature std::popcount

fixes zephyrproject-rtos/zephyr#53421

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-01-03 11:06:45 +01:00
Francois Ramu
fd9902be2d drivers: adc: stm32g4 also have a shared IRQ for ADC instances
The adc1 & 2 of the stm32g4 devices share the same irq

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2023-01-03 11:02:34 +01:00
Erwan Gouriou
cbef00587b drivers: flash: stm32: Rename _l5_u5.c driver to _l5x.c
This will simplify addition of new series that share the same driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-03 11:01:44 +01:00
Mikhail Siomin
d4f65e4031 mcux: flexcan: fixes the race condition
Since the FLEXCAN_TransferSendNonBlocking() function has
read-modify-write operations on global resources, then
if interrupts are enabled and/or if there is more than
one thread with a different priority, threads with
a lower priority can overwrite global resource changes
made by higher priority threads.
Fixes #52673.

Signed-off-by: Mikhail Siomin <victorovich.01@mail.ru>
2023-01-03 11:01:31 +01:00
Oliver Barta
e4fcb32451 drivers: pwm: rpi_pico: fix setting of cycle count per period
pwm_set_wrap() sets the TOP value, not the number of cycles.
Counter will run from 0 to TOP inclusive, generating TOP + 1 cycles.
To get n cycles, we need to set TOP to (n - 1).

The wrong setting made it impossible to achieve 100 % duty cycle, as
there was always one extra cycle.

Fixes: 7e0fff24c7 ("drivers: pwm: add pwm driver for rpi_pico")
Signed-off-by: Oliver Barta <o.barta89@gmail.com>
2023-01-02 13:03:46 +01:00
Carlo Caione
d4c7f04a41 cache: kconfig: Reorder and fix entries
The general Kconfig is at the moment a bit messy. Reorder and fix it.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-12-30 10:53:22 +00:00
Gerard Marull-Paretas
4d9b6c4e2e drivers: gpio: sx1509b: add multi-instance support
The driver only supported one instance. Update it to support multiple
instances.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-28 18:47:25 +01:00
Mizuki Agawa
687d1f0ae5 drivers: sensor: Add support ICP10125 pressure and temperature sensor
Product Homepage:
https://invensense.tdk.com/products/1-axis/icp-10125/

DataSheet:
https://3cfeqx1hf82y3xcoull08ihx-wpengine.netdna-ssl.com/wp-content/uploads/2021/04/DS-000329-ICP-10125-v1.1.pdf

Testing Environment:
STMicroelectronics NUCLEO-F401RE

Signed-off-by: Mizuki Agawa <agawa.mizuki@fujitsu.com>
2022-12-28 10:44:16 +01:00
Dennis Wang
357c6dba45 driver: i2c: Fix Controller Initialization
Change Summary: The TX/RX FIFO was not flush on initialization thus
causing bad transactions. Thus, we need to flush the FIFO, and
according to Synopsys DW I2C spec, we can flush TX/RX FIFO by clearing
the enable bit. This is verified with our own I2C test on the SoC with
Synopsys DW I2C IP.

Signed-off-by: Dennis Wang <dennisjw@fb.com>
2022-12-28 10:43:34 +01:00
Jay Vasanth
c7e0d727d7 drivers: clock: Microchip XEC clock driver add MEC15xx support
Add support for Microchip MEC15xx to the XEC clock control driver.
MEC15xx 32KHz clock support uses the same 32KHz source for both the
PLL and peripherals. MEC152x does not include the PCR clock monitor
present in MEC172x.  MEC15xx and MEC172x support internal silicon
oscillator, parallel and single ended crystal inputs, and the
32KHZ_PIN input. MEC152x supports fall back to internal silicon
OSC when VTR and 32KHZ_PIN are turned off. Therefore in MEC152x the
internal silicon oscillator can only be disabled if using an external
32KHz which is always on. For MEC152x the driver will only use the
PLL source clock device tree value.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-12-28 10:43:03 +01:00
Jay Vasanth
ed52729a4b drivers: clock: Microchip MEC172x clock control driver support all modes
Fix Microchip XEC clock control driver single-ended XTAL2 pin
initialization. Add support for external 32KHZ_IN pin as a
clock source including PINTRL to switch the GPIO to 32KHZ_IN
function. Add device tree option to disable internal silicon
oscillator if it is not required by the configuration. Add
device tree tuning options based on crystal and board layout.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-12-28 10:43:03 +01:00
Marcin Szymczyk
6e5f432eee drivers: serial: nrfx: ifdef optional baudrates
Some baudrates are not supported in certain SoCs.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-28 10:38:09 +01:00
HaiLong Yang
2b75aa1f8d drivers: adc: gd32: adc gd32l23x series
gd32 adc support gd32l23x series.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-12-28 10:37:52 +01:00
HaiLong Yang
2feac2a0f0 drivers: clock_control: gd32: add gd32l23x series
gd32 clock_control support gd32l23x series.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-12-28 10:37:52 +01:00
HaiLong Yang
83f38bd52a drivers: pinctrl: gd32_af: add gd32l23x series
gd32_af pinctrl support gd32l23x series.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-12-28 10:37:52 +01:00
Gerard Marull-Paretas
ea7293e464 drivers: regulator: shell: fix printing of first voltage
The first supported voltages was not printed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 16:50:36 +00:00
Francois Ramu
b7266f2b26 drivers: adc: stm32 driver for the stm32U5 configuration for the ADC4
The ADC4 requires particular sequencer configuration.
Clean section that are not used for the configuration.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-27 15:33:06 +01:00
Francois Ramu
847338baa8 drivers: adc: stm32u5 adapt resolution range for ADC1 and ADC4
Adding the possible 6 bit resolution format for the ADC4
of the stm32U5 serie.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-27 15:33:06 +01:00
Francois Ramu
ddd7047b29 drivers: adc: stm32 driver for the stm32U5 instance 1 or 4
Depending on the ADC instance, internal channels
temperature sensor or vbat differ.
That must be adapted so that each internal channels
of ADC4 are operational.
ADC4 is using CommonChannel config for the Sampling time.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-27 15:33:06 +01:00
Marin Jurjević
b99b66fba2 drivers: modem: gsm: fix RSSI check condition
Fixes invalid condition introduced in #48533 when FSM implementation
was added.

Signed-off-by: Marin Jurjević <marin.jurjevic@hotmail.com>
2022-12-27 15:32:07 +01:00
Gerard Marull-Paretas
2c9a9c3671 drivers: regulator: shell: refactor shell
- Refactor the regulator shell so that it exposes all regulator APIs
- vset/iset commands allow to specify a single value (equal min/max) or
  a range
- Voltage/current input is now more user friendly, e.g. user can specify
  units and decimals: 3.3v, 200mv, -4mv, etc.
- Reported values are also printed in a more user friendly way, e.g.
  1800000 uV will be printed as 1.800 V.
- Added new command to list supported voltages

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Gerard Marull-Paretas
5ec95ef35e drivers: regulator: npm6001: add support for get_mode
Allow to query operating mode on each BUCK converter (PWM or
Hysteretic).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Gerard Marull-Paretas
1ca1f25918 drivers: regulator: add get_mode API
Add a new API to query the configured regulator mode. Updated fake
driver and API tests.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Gerard Marull-Paretas
fbba106a23 drivers: regulator: apply initial mode
Apply initial mode (regulator-initial-mode) as part of the
regulator_common_init_enable call. Update tests to cover this change.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Gerard Marull-Paretas
6f4c019312 drivers: regulator: common: remove redundant cast
Unlike in C++ code, explicit casts from void* are not needed, so remove
them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-27 13:12:55 +01:00
Quang Bui Trong
17d86aed80 drivers: watchdog: add support for NXP S32 S32ZE
Add driver shim for the NXP S32 SWT module.

Signed-off-by: Quang Bui Trong <quang.buitrong@nxp.com>
2022-12-27 10:36:42 +01:00
Guillaume Gautier
ba9636027e drivers: i2c: Fix clock value for STM32 I2C
If present, get the clock value for STM32 I2C from the clock source defined
in the dts.
Otherwise, use pclk.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-12-24 16:58:54 +01:00
Guillaume Gautier
f8f77e456b drivers: i2c: Use domain clock support macro for STM32 I2C
Add support of STM32_DT_INST_DEV_DOMAIN_CLOCK_SUPPORT to condition the
configuration of an source clock for STM32 I2C.


Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-12-24 16:58:54 +01:00
Guillaume Gautier
16a6520278 drivers: i2c: Use device tree instance for STM32 I2C driver
This commit modifies the way we define the I2C driver by using device tree
instance macros instead of node label names.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-12-24 16:58:54 +01:00
Marek Matej
937ea00e7a drivers: adc: esp32: Add support for single-shot conversion
Allow single-shot adc conversion on all supported targets.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2022-12-23 23:45:05 +00:00
Erwan Gouriou
56d93e3fef drivers: usb: stm32f1: USB clk prescaler config done in clock_controller
Now that USB clock prescaler is done is clock_control driver.
Remove similar part in USB driver.

Note that behavior is different: it is now up to the user to provide
the proper configuration.
Add a warning during the transition period.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-22 14:43:26 +01:00
Erwan Gouriou
961e4303a7 drivers: clock_control: stm32f1: Configure USB prescaler
On STM32F1 series, configure USB(/OTGFS) prescaler based on DT.
When prescaler is set, PLL output clock is not divided.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-22 14:43:26 +01:00
TOKITA Hiroshi
1690326268 dts: bindings: dma: gd32: split gd,gd32-dma-v1 for support F4xx feature
Split gd,gd32-dma-v1 from gd,gd32-dma to support F4xx specific features.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-22 13:43:49 +01:00
TOKITA Hiroshi
498ef65242 dts: bindings: gd32-dma-base: add gd,mem2mem property
Add `gd,mem2mem` property to indicate the DMA controller supports
memory to memory transfer.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-22 13:43:49 +01:00
TOKITA Hiroshi
ad055bd5fc drivers: dma: dma_gd32: Use dma_slot for peripheral request
Use dma_slot for peripheral request instead of linked_channel.
This is a more suitable usage as described in dma_config.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-22 13:43:49 +01:00
Dominik Ermel
db34adf9c3 mgmt/mcumgr: Standardise MCUmgr Kconfig names
Standardise Kconfig options for MCUmgr.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-22 12:36:34 +01:00
Emilio Benavente
39762716d4 boards: arm: rtxxx: moving the instances FLASH_MCUX_FLEXSPI_XIP
This Kconfig is moved to the soc level since it determines
the flexspi clock initialization for XIP.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2022-12-22 11:07:08 +01:00
Fabio Baltieri
551c632ac4 drivers: espi: enable ESPI_EMUL automatically
Enable ESPI_EMUL automatically based on the corresponding devicetree
compatible.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-12-22 11:06:18 +01:00
Daniel DeGrasse
21c4957cde drivers: gpio: fix gpio-reserved-ranges handling in MCUX iGPIO driver
Fix handling of gpio-reserved-ranges within MCUX iGPIO driver, to ensure
that the configuration IDX will be correctly calculated for pins where
multiple reserved ranges are present on the GPIO controller

Fixes #52506

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-12-22 11:05:52 +01:00
Lukasz Mazur
f7ab9a8c52 pinctrl_stm32: GPIO output info in Z_PINCTRL_STM32_PINCFG_INIT
Added information about pin output direction into
Z_PINCTRL_STM32_PINCFG_INIT if output_low or output_high is provided.
GPIO output flag is set in configuration struct and this will end up
being loaded into MODE register. Because of that it is no longer
required for pinctrl_configure_pins() to set MODE register value for
GPIO input/output.
Fixes #53141.

Signed-off-by: Lukasz Mazur <lukasz.mazur@hidglobal.com>
2022-12-22 11:00:45 +01:00
Erwan Gouriou
46378b7ff2 drivers: clock_control: stm32: Use zephyr functions for bit operations
Use builtin functions for bit operations to increase readability.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-22 10:58:27 +01:00
Declan Snyder
f2e0ac5c58 drivers: uart_mcux_flexcomm: Add runtime configure
Add uart_configure and uart_config_get functionality to
MCUX flexcomm driver to be able to dynamically configure
flexcomm uart at runtime.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-12-21 09:38:33 -06:00
Pawel Czarnecki
d45cd9afea drivers: eth: gecko: fix GPIO configuration
This fixes errors in samples/net/sockets/big_http_download for SiLabs
platforms.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-21 23:32:57 +09:00
TOKITA Hiroshi
bafbc75270 drivers: gpio: sifive: Reset iof_en and iof_sel on init
If the bootloader changes iof_en/iof_sel settings before zephyr launching,
GPIO does not behave correctly.
These values should be 0 initially, Initialize to 0 at GPIO initialize.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-12-21 12:19:27 +01:00
Mulin Chao
271b306b2d driver: uart: npcx: add missing tx/rx interrupt enabled checks
When checking if any UART TX/RX IRQs are pending, the driver should also
consider whether these IRQs are enabled. Or we still get pending status
set even if the related interrupts are disabled.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-12-21 12:19:13 +01:00
Guillaume Gautier
2f4c790a51 drivers: i2c: Use dts to determine i2c clock source for STM32
Add the possibility to use the clock parameter in dts to set the clock
source of I2C devices for all STM32 MCUs.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-12-21 12:17:38 +01:00
Andrzej Głąbek
c984a343af drivers: uart_nrfx_uarte: Prevent re-enabling RX until UART_RX_DISABLED
Fix the driver so that after a call to uart_rx_disable() it does not
allow re-enabling RX until the UART_RX_DISABLED is generated (what
means that the disabling procedure is complete). Otherwise, it is
possible that the RXTO event from the previous RX is handled right
after a new RX is started, and the RX buffer pointer gets corrupted
in the `rx_flush()` function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-12-21 11:47:34 +01:00
Jun Lin
885695f425 drivers: crypto: SHA: npcx: add support for SHA hardware accelerator
NPCX9 series chips include a SHA hardware accelerator, which supports
SHA256/SHA384/SHA512 hashing and a library (APIs) in the on-chip ROM.
This commit adds the driver support by wrapping the on-chip ROM APIs.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-12-21 10:10:10 +01:00
Erwan Gouriou
66d4c64966 all: Fix "#if IS_ENABLED(CONFIG_FOO)" occurrences
Clean up occurrences of "#if IS_ENABLED(CONFIG_FOO)" an replace
with classical "#if defined(CONFIG_FOO)".

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-21 10:09:23 +01:00
Cyril Fougeray
6b4a4381de drivers: timer: stm32_lptim: load counter after checking for autoreload
Bug occurs when polling kernel uptime. Uptime was suddenly
jumping because lptim counter was counted twice
(from CNT and ARR registers) in case reload happens between
values are fetched.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2022-12-20 22:51:01 +01:00
Pawel Czarnecki
0095eed3a1 dts: uart: silabs: make peripheral-id optional
peripheral-id property should be eventually removed.
For now set it as optional and allow skipping the usage
in UART driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki
83b9e53bb6 dts: gpio: silabs: make peripheral-id optional
peripheral-id property should be eventually removed entirely.
For now set it as optional and allow skipping the usage
in GPIO driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki
5c3ce5a21f drivers: watchdog: silabs: include zephyr/irq.h
Add missing include

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Mateusz Sierszulski
ea4746fc68 drivers: hwinfo: Fix Gecko hwinfo driver building
do not build hwinfo driver for this board - it does not have support for it

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-12-20 22:50:19 +01:00
Paweł Czarnecki
dc153b3bcb drivers: gpio: gecko: stop using deprecated function
change GPIO_IntConfig to GPIO_ExtIntConfig

Signed-off-by: Paweł Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki
067f3766da drivers: gpio: gecko: enable GPIO clock
Enable GPIO clock so that other drivers could
configure their I/O pins

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki
0892293b58 drivers: gpio: gecko: initialize driver earlier
Common GPIO driver needs to be initialized before e.g UART driver
to ensure correct GPIO clock configuration when configuring UART pinout

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Mateusz Sierszulski
d4a6a14926 drivers: counter: Add counter_gecko_stimer driver
This commit adds initial support for Silabs Real-Time counter

Co-authored-by: Filip Kokosinski <fkokosinski@antmicro.com>
Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-12-20 22:50:19 +01:00
Filip Kokosinski
9756766892 drivers: serial: uart_gecko: Make driver dependent on pinctrl
This commit adds a series of driver-related changes to
Gecko pinctrl.

Co-authored-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-12-20 22:50:19 +01:00
Filip Kokosinski
6058f4972d drivers: pinctrl: Add Silabs Gecko pin controller
This commit adds initial support for gecko pinctrl driver

Co-authored-by: Mateusz Sierszulski <msierszulski@antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki
e8d3673c13 soc: arm: silabs: remove soc_gpio_configure wrapper
It would be better to use GPIO_PinModeSet() functions directly
in the drivers.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Erwan Gouriou
11836dd4c1 dts: bindings: usb stm32: Remove deprecated prop 'enable-pin-remap'
Property is deprecated since more than one year.
Remove it and clean up related driver code.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-20 17:05:26 +00:00
Andriy Gelman
2d3493bff0 drivers: adc: Add ADC xmc4xxx drivers
The ADC module has four conversion groups, each one is set up as a zephyr
device. The start-up calibration is initiated globally for all groups
and it is run in each device init function. The ADC module supports post
calibration per group. Post calibration is run automatically after each
group acquires the samples.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-12-20 14:17:23 +01:00
Jakub Dabek
72f626046d memory manager: add region calculation for virtual memory
Add region calculations and implementation of
sys_mm_drv_query_memory_regions to pass calculated regions down
the line.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2022-12-20 07:03:55 -05:00
Jakub Dabek
9531f96627 memory manager: refactor
Separate definitions from function code by creating header file for statics
managment.

Signed-off-by: Jakub Dabek <jakub.dabek@intel.com>
2022-12-20 07:03:55 -05:00
Gerard Marull-Paretas
1080afa680 drivers: regulator: add fake driver
Add FFF-based fake regulator driver. This driver can be used as a stub
or mock in testing.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-20 10:15:29 +00:00
Gerard Marull-Paretas
63c005d3b4 drivers: regulator: fix set_current_limit limits check
Only current ranges out of the allowed range have to be skipped.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-20 10:15:29 +00:00
Gerard Marull-Paretas
8c6819120e drivers: regulator: fix set_voltage limits check
Only voltage ranges out of the allowed range have to be skipped.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-20 10:15:29 +00:00
Gerard Marull-Paretas
2b6a211946 drivers: regulator: fix is_supported_voltage return code
If a voltage is not supported we need to return false, not a negative
errno.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-20 10:15:29 +00:00
Gerard Marull-Paretas
491a132369 drivers: regulator: common: fix is_supported_voltage comparison
The edge voltages within a range need to be included as part of the
supported comparison.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-20 10:15:29 +00:00
Jiafei Pan
dc2d6b833a drivers: pinctr_imx: add imx93 support
Add i.MX93 support for pinctrl driver.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-12-20 09:22:40 +01:00
Jiafei Pan
d963900dbd drivers: mcux_ccm: add support for lpuart on imx93
Add support for i.MX93 support for CCM driver.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-12-20 09:22:40 +01:00
Jiafei Pan
9d6bda0ec1 drivers: mcux_lpuart: fix compile warning
Fixed the following compile warnings:
../include/zephyr/sys/util.h:108: warning: "ARRAY_SIZE" redefined
hal/nxp/mcux/mcux-sdk/drivers/common/fsl_common.h:236: note:
this is the location of the previous definition

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-12-20 09:22:40 +01:00
Jiafei Pan
e8d3e7d544 drivers: mcux_lpuart: remove unsed soc.h
soc.h will not used anymore, remove it.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-12-20 09:22:40 +01:00
Sam Hurst
77e1638c3c drivers: usb_c: tcpc: stm32: Add VCONN functionality
Add VCONN discharge functionality to TCPC and driver

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst
a19cf99aa3 drivers: usb_c: tcpc: stm32: Explicitly set the unconnected CC line to OPEN
Explicitly set the unconnected CC line to OPEN, so that it can be
used for VCONN.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst
21f28eacbc drivers: usb_c: tcpc: stm32: Add GoodCRC timer
When operating as a Source, the driver will wait indefinitely for
a GoodCRC message from a Sink. This PR adds a timer to trigger a
no response when a GoodCRC message isn't received.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst
c659f3d8d7 drivers: usb_c: tcpc: stm32: Enable ISR after all UCPD devices initialized
Since all UCPD devices share the same ISR, the interrupt
should be enabled after all UCPD devices are initialized.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst
9750951dd1 drivers: usb_c: tcpc: stm32: Simplify shared ISR detection
Remove unnecessary code used during shared ISR detection

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst
029dc41acb drivers: usb_c: tcpc: stm32: Read UCPD Status Reg for source of IRQ
At system startup, the SYSCFG ITLINE registers might not
indicate an interrupt even though a UCPD interrupt is pending.
This cause the ISR to be called repeatedly without being serviced,
resulting in a system lockup. Reading the UCPD Status Reg instead
of the SYSCFG ITLINE register fixes the issue.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Erwan Gouriou
39e6d62b66 drivers: flash: stm32: Kconfig clean up
FLASH_PAGE_LAYOUT and FLASH_HAS_PAGE_LAYOUT are systematically
selected, whatever the series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-19 18:15:45 +01:00
Andrzej Głąbek
5def5e6edf drivers: nrf_qspi_nor: Avoid using QSPI with HFCLK192M divided by 4
The nRF5340 product specification states that the QSPI peripheral
supports 192 MHz and 96 MHz PCLK192M frequency, thus the default /4
divider for HFCLK192M (from which PCLK192M is derived) can only be
used when the QSPI peripheral is idle. Correct the shim accordingly
and improve related comments.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-12-19 18:11:59 +01:00
BJ Chen
108d516397 ITE: drivers/espi: fix the VW valid flag issue in MAFS mode
Add CONFIG_ESPI_SET_VW_VALID_WITH_LEVEL to fix the VW Valid Bits Issue

fixes #52776

Signed-off-by: BJ Chen <bj.chen@ite.com.tw>
2022-12-19 09:44:31 +00:00
Erwan Gouriou
50473ec0a9 drivers: hwinfo: stm32: Deal with iwdgX and wwdgX instances
On some STM32 series (H7, MP1), iwdg and wwdg have multiple instances.
Due to current driver implementation, these wdg instances were not
checked in the function.

Fixes #53002

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-19 09:22:28 +00:00
Fabio Baltieri
4b48d91cce drivers: usb_dc_stm32: implement usb_dc_wakeup_request
Implement usb_dc_wakeup_request for STM32 USB DC and default to enable
remote wakeup functionality when the drivers is selected.

This allows the device to wake the host up by calling
usb_wakeup_request().

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-12-16 14:46:25 +01:00
Johann Fischer
e939c1d8ae drivers: uhc: add driver for virtual USB host controller
Add support for virtual USB host controller intended for use
together with virtual bus and virtual device controllers.
This driver is not an emulation of any real host controller.
The driver has initial support for handling control and bulk
transfers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-16 13:21:12 +01:00
Johann Fischer
ac649c35fd drivers: udc: add driver for virtual USB device controller
Add support for virtual USB device controller intended for use
by virtual bus and virtual UHC controllers. This driver is not
an emulation of any real host controller.
The driver has initial support for handling control and bulk
transfers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-16 13:21:12 +01:00
Johann Fischer
deb637eb8a drivers: usb: add support for virtual USB bus
Add support for virtual USB bus (UVB) intended for use
by virtual UDC and UHC controllers. UVB is not an emulation
of the USB bus or protocol but a simplified service to connect
a virtual host controller to one or more virtual device
controllers.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-16 13:21:12 +01:00
Johann Fischer
da639954c1 drivers: usb: add common layer of UHC API and MAX3421E driver
Add common layer of UHC API and MAX3421E host controller driver.
This implements the bare minimum necessary to communicate with
one peripheral device.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-16 13:21:12 +01:00
Tomasz Leman
af6d827b64 drivers: hda: enable runtime power mgmt in intel hda dma
Enable Zephyr device runtime power management mechanisms in Intel HDA
DMA driver. This allows Zephyr to track usage reference for power domain
gating.

PM action handler is currently empty and will be fill out later.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-12-16 11:03:15 +00:00
Gerard Marull-Paretas
7568749c8c drivers: regulator: initial driver for nPM6001
Add initial driver for the nPM6001 PMIC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-16 11:26:47 +01:00
Daniel DeGrasse
4be1fb81ce soc: arm: nxp: switch imxrt boards to use systick timer unless CONFIG_PM=y
Switch all imxrt boards to use the systick timer by default, and only
enable the GPT timer when using low power modes. This is desirable
because the systick has a higher resolution, but the GPT can run
while the core clock is gated, making it useful for low power modes.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-12-16 09:31:48 +01:00
Tomasz Leman
de1bd1fa04 drivers: gpdma: enable runtime power mgmt in intel gpdma
Enable Zephyr device runtime power management mechanisms in Intel GP DMA
driver. This allows Zephyr to track usage reference for power domain
gating.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-12-15 19:17:21 +01:00
Marek Matej
45d55205db drivers: esp32: temp: CPU die temperature sensor
Support for the measuring the CPU die temperature
for the ESP32 targets S2,C3. The ESP32 support
was ommited due to lack of offset calibration.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2022-12-15 18:21:39 +01:00
Cyril Fougeray
00ceb258d3 drivers: flash: clear stm32 status register errors
In case of errors in the status register and to
unblock Flash, it is advised to clear the errors.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2022-12-15 14:31:37 +00:00
Ryan McClelland
1f489cf03a drivers: usb: stm32: add usb hs ulpi support
Add support for the STM32H7 USB OTG HS and support for the ULPI PHY.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-12-15 14:28:00 +00:00
Dinesh Kumar K
f050e18798 drivers: sensor: Add support for grow_r502a fingerprint sensor
Add driver support for grow_r502a fingerprint sensor

Signed-off-by: Dinesh Kumar K <dinesh@linumiz.com>
2022-12-14 18:44:29 +01:00
Gerard Marull-Paretas
539d4aa6e6 drivers: regulator: add common init enable API
Add a new API for drivers that can be called to initialize the regulator
at init time if `regulator-boot-on` or `regulator-always-on` are set.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
9b5152153b drivers: regulator: add regulator_is_enabled
Add a new API to check if a regulator is enabled or not.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
305ce33b77 drivers: regulator: add parent DVS API
PCA9420 PMIC offers of multiple operation states, or DVS (Dynamic
Voltage Scaling). Such states may be automatically changed by hardware
using MODESEL0/1 pins. Certain MCUs allow to automatically configure
certain output pins when entering low power modes so that PMIC state is
changed without software intervention.  This means that application just
needs to configure the voltages for each state using
`nxp,modeN-microvolt`, set `nxp,enable-modesel-pins` in devicetree and
forget about configuring regulators.

This patch introduces a new _parent_ API to expose such functionality in
a vendor agnostic way. Consider this API as experimental for now, until
we have other usecases.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
10ce9684c3 drivers: regulator: fix/improve usage of devicetree properties
Most of devicetree properties for regulator, such as:

- regulator-min/max-microvolt
- regulator-min/max-microamp
- regulator-allowed-modes
- etc.

Are meant to specify limits on what consumers may set. They are **NOT**
meant to describe the hardware capabilities. For example, I could have a
BUCK converter that supports 0-5V output voltage, but my circuit may
only allow working on the 2.7-3.3V range.

This patch reworks the API so that the API class layer manages this
information. This is done by drivers collecting all such fields in a
common configuration structure that is later accessed by the class
layer. This simplifies drivers implementation. For example, if A
consumer calls regulator_set_voltage() with a voltage that is supported
but not allowed, driver code won't be called. Similarly, if a regulator
is configured to be `always-on`, enable/disable driver code will never
be called.

Drivers have been adjusted. PCA9420 mode settings have been removed from
devicetree in this commit as they are not actual modes but PMIC states.
This will be refactored in a follow-up commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
1029a4db6f drivers: regulator: pca9420: some minor improvements
- Remove redundant comments
- Remove internal *_mode functions, as they were only used once.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
8e60c2df0c drivers: regulator: add regulator_mode_t opaque type
Define regulator mode as an opaque type, same as we do in other
subsystems like GPIO (e.g. gpio_flags_t).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
2bd6d50934 drivers: regulator: improve regulator_get_current_limit
- Function returns now the value by reference, similar to voltage
  counterparts.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
8db7e046c5 drivers: regulator: clarify regulator_set_mode interface
Clarify the API for regulators that have the option to set mode
externally, such as PCA9420. Adjust the PCA9420 driver to comply with
the interface.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
3d47b6dfba drivers: regulator: improve regulator_get_voltage
- Function now returns error, value is obtained by reference. This
  allows to propagate potential bus errors.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
b909d0e560 drivers: regulator: drop mode specific APIs
- Mode specific APIs repeat the same functionality offered by non-mode
  specific APIs
- The same functionality can be achieved by the non-mode APIs, since
  they apply to the active mode which can be set using
  regulator_set_mode() first.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
4e8795a8ce drivers: regulator: provide generic regulator_is_supported_voltage
The function can be implemented by using regulator_count_voltages() +
regulator_list_voltage(), so there's no need to defer the job to each
driver.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
c77c3ac7d6 drivers: regulator: improve regulator_list_voltages
- Rename to regulator_list_voltage (it is listing a single voltage)
- Function returns the value via a parameters, so that we can indicate
  wether the given index is valid or not. If a driver doesn't implement
  this call, function returns -EINVAL (as it should be).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
aab28d735f drivers: regulator: drop regulator_count_modes
The regulator_count_modes was an API that was not useful. Unlike with
voltages where the interface guarantees they are zero-indexed, modes can
take an arbitrary identifier. So counting supported modes doesn't
provide any useful information such as if a mode is allowed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Gerard Marull-Paretas
9a73be82c4 drivers: regulator: improve regulator_count_voltages specs
- Interface guarantees that voltage indices start from zero to
  regulator_count_voltages()
- Function always return an unsigned number. If the device doesn't
  implement the API returned value is zero, as expected.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-14 17:01:44 +01:00
Johann Fischer
95717520bf drivers: udc: do not call driver's dequeue on empty fifo
Do not call driver's dequeue implementation if endpoint fifo
is empty.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-14 12:06:03 +01:00
Johann Fischer
721b8c22d8 drivers: udc_nrf: dequeue instantly when endpoint is not busy
In the case that IN endpoint is not busy there will be
no notification from the HAL driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-14 12:06:03 +01:00
Michal Moskal
d46b9bd124 drivers: hwinfo: Implement hwinfo_get_device_id for ESP32-C3
ESP32-C3 uses different fuse addresses for storing the MAC addr,
but the the format is the same.

Signed-off-by: Michal Moskal <michal@moskal.me>
2022-12-14 09:51:44 +01:00
Tom Burdick
603cc27045 dma: Add max block count attribute
Adds an attribute that describes the maximum number of scatter gather
blocks that the DMA will accept. Useful in cases where DMA is used as
the abstraction for moving data around (e.g. SoF audio streams) and
variances of the hardware need to inform decisions about how to use
the DMA API.

Co-authored-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Co-authored-by: Jaska Uimonen <jaska.uimonen@intel.com>
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-12-14 09:51:10 +01:00
Marek Matej
f86a7d2c25 drivers: dac: esp32: Add support for DAC controller
Initial DAC driver for the ESP32/ESP32-S2 SOCs

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2022-12-13 16:29:38 +00:00
Aaron Massey
5e33f833ed fuel_gauge: Fix sbs_gauge err to conform to API
The SBS fuel gauge driver did not return a count of the number of
properties that failed.

Fix this and add a test that verifies the sbs_gauge returns the number of
failing properties as well as a test that verifies a negative return code
if all properties failed.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-12-13 11:10:44 +01:00
Huifeng Zhang
12fa8335a3 drivers: gicv3: add zephyr kernel header file
zephyr kernel header file should be included otherwise gcc will report
the warning: implicit declaration of function 'k_aligned_alloc' and
the return value of 'k_aligned_alloc' will be treated as an int type,
which will cause an error on the 64 bits platform.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2022-12-13 18:08:40 +09:00
Ryan McClelland
672a401f20 i3c: add cdns i3c driver
This gives initial support to the cadence i3c controller

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-12-12 15:51:16 -05:00
Ryan McClelland
371470d608 i3c: GETMWL and GETMRL may be optionally supported if no settable limit
According to section 5.1.9.3.5 and 5.1.9.3.6 of the I3C Specification
v1.1.1. This CCC is may be optionally supported if the target device
has no settable limit.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-12-12 15:51:16 -05:00
Ryan McClelland
b7dc01cd48 i3c: rename is_primary to is_secondary
Rename is_primary to is_secondary. The justification for this is
because it is less likely to have something configured to be
secondary, and the 0 value would be if it is primary.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2022-12-12 15:51:16 -05:00
Erwan Gouriou
428700f709 drivers: gpio: stm32: Keep port clock in input configuration
When pin is configured in input mode, clock is also required.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-12 15:50:21 -05:00
Ravik Hasija
22e2b004df drivers: serial: Add Driver for CDNS UART IP6528
Adding New Serial/UART driver for Cadence UART IP6528.

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-12-12 12:19:35 -05:00
Marco Argiolas
3540ae1df9 drivers: sensor: bmm150: fix mispelling
Build error appearing only when enabling CONFIG_BMM150_PRESET_LOW_POWER

Signed-off-by: Marco Argiolas <marco.argiolas@ftpsolutions.com.au>
2022-12-12 10:54:40 -06:00
Brian Dunlay
491933b185 drivers: wifi: eswifi: Guard net_ctx state change
Previously, a call to set the net_context state was added here to
accommodate a new KConfig scenario that permitted disabling offload
sockets. This code path is used by both local and offloaded sockets.
While it is necessary to update the state of the net_context for a
locally managed socket, setting the net_context for an offloaded socket
is an error, as the net_context is invalid (in fact, it points to a
hard-coded dummy socket), as observed in #52346 and #38544.

A prior commit (a9ac0a88) attempting to remedy the offload socket
scenario removed this line, which resulted in problems for the local
socket scenario. The socket never got updated to the connected state,
and thus was unusable.

Adding this guard allows the eswifi socket to set the socket net_context
only if the socket is NOT offloaded.

Signed-off-by: Brian Dunlay <brian@nubix.io>
2022-12-12 14:55:03 +01:00
Andriy Gelman
a9481bdbe1 drivers: gpio_xmc4xxx: Use interrupt controller for edge/level interrupts
Use the XMC4XXX interrupt controller for edge/level gpio interrupts.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-12-12 10:51:29 +01:00
Andriy Gelman
727e589448 drivers: interrupt_controller: Add XMC4XXX ERU driver
In Infineon XMC4XXX SoCs, gpio interrupts are triggered via an
Event Request Unit (ERU) module. A subset of the gpios are
connected to the ERU. The ERU monitors edge triggers and creates
a SR.

This driver configures the ERU for a target port/pin combination
for rising/falling edge events. Note that the ERU module does
not generate SR based on the gpio level. Internally the ERU
tracks the *status* of an event. The status is set on a positive
edge and unset on a negative edge (or vice-versa depending on
the configuration). The value of the status is used to implement
a level triggered interrupt; The ISR checks the status flag and
calls the callback function if the status is set.

The ERU configurations for supported port/pin combinations are
stored in a devicetree file dts/arm/infineon/xmc4xxx_x_x-intc.dtsi.
The configurations are stored in the opaque array
uint16 port_line_mapping[].

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-12-12 10:51:29 +01:00
Duong Vu Nam
b24f4625f0 arch: support nocache for Cortex-R52
Config NOCACHE_MEMORY depend on ARCH_HAS_NOCACHE_MEMORY_SUPPORT. Enable
ARCH_HAS_NOCACHE_MEMORY_SUPPORT for Cortex-R52 to run NXP S32Z/E with
nocache attibute.

Enable nocache in each driver use it.

Signed-off-by: Duong Vu Nam <duong.vunam@nxp.com>
2022-12-12 10:39:31 +01:00
TOKITA Hiroshi
e965db984d samples: counter: alarm: add support for GD32 boards
Add support for boards that implements the GD32 SoCs.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-12 10:08:12 +01:00
TOKITA Hiroshi
981d88bf7b drivers: counter: add support for GD32 timer
Adds support for GD32 timer

Note: Currently, it is not supporting RISC-V(GD32V) devices.
It needs some work on the interrupt controller first.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-12 10:08:12 +01:00
TOKITA Hiroshi
d38a1fe2fa drivers: clock_control: gd32: timer should recognize with entire id
The timer_ids contain timers that belong to any bus.
So, It should recognize with entire id, not only the CLOCK_ID_BIT part.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-12 10:08:12 +01:00
TOKITA Hiroshi
79451c221a drivers: clock_control: gd32: Correcting timer node detection
DT_COMPAT_GET_ANY_STATUS_OKAY is not suited for the node's existing check.
(This macro returns the stem of the DTS macro name,
 the stem part is not a defined symbol.)
Instead, it should use the DT_HAS_COMPAT_STATUS_OKAY macro.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-12 10:08:12 +01:00
Ravik Hasija
96da6f2234 driver: dw: Use base_addr variable to set dir.
Change Summary:
Update Base addr to set direction to use Aligned IP base address instead
of Port Base Address. Port Base Address + offset to direction register
will set incorrect value for Port B,C & D. For ex: In cases when more than
1 port is configured on the same IP, the DTS node for port B will start
at offset 0xC. Calculating the port using Port Base will yield offset of
PORTB DIR register which is at offset 0x10 from Aligned Base, and as a
result will result in setting DIR register of PORTC instead.

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-12-11 20:37:33 -05:00
Ravik Hasija
7ba1925d97 driver: gpio: Fixing Pin Direction Setting.
Change Summary:
Moving the setting of Pin direction before setting/clearing the pin
configured as output for the change to correctly take place.

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-12-11 20:37:33 -05:00
Rodrigo Cataldo
bcb3961567 drivers: pcie: late initialization of pcie when PCIe controller is used
For architectures that rely on a PCIe controller (for example, ARM64),
scanning the PCI space will only succeed after the controller has
initialized. Therefore, in the presence of PCIe controller, the PCIe
initialization is bumped to the next system init level.

In the past, drivers like ivshmem would do a late scan of the PCI space
in case the early scan failed; however, the cited commit removed this
feature and ivshmem fails for ARM64. This commit fix this by making the
early scan succeed.

Fixes: a96016d747 ("drivers: ivshmem: Remove unnecessary BDF lookup ...")
Signed-off-by: Rodrigo Cataldo <rodrigo.cataldo@huawei.com>
Co-authored-by: Henri Xavier <datacomos@huawei.com>
2022-12-10 09:47:26 +01:00
Rodrigo Cataldo
0efb0f55b3 drivers: ivshmem: msi.h header only required for ivshmem-doorbell
Only include the MSI header when ivshmem-doorbell is employed, as the
ivshmem data structures already use the same protection for msi-related
structures.

Signed-off-by: Rodrigo Cataldo <rodrigo.cataldo@huawei.com>
Co-authored-by: Henri Xavier <datacomos@huawei.com>
2022-12-10 09:47:26 +01:00
Rodrigo Cataldo
eb4dee62c5 drivers: ivshmem: remove unnecessary platform dependency
The ivshmem code does not use any platform-specific code; therefore,
remove the dependency to the soc interface.

No functional change intended.

Signed-off-by: Rodrigo Cataldo <rodrigo.cataldo@huawei.com>
Co-authored-by: Henri Xavier <datacomos@huawei.com>
2022-12-10 09:47:26 +01:00
Andrzej Głąbek
1a6e26db33 drivers: i2c_nrfx_twi[m]: Make transfer timeout value configurable
Add a Kconfig option allowing users to configure the transfer timeout
value, as the default 500 ms may not be sufficient in specific cases.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-12-10 09:46:45 +01:00
Patryk Duda
1aebcec02f drivers: serial: Reset UART using RCC before initialization
In multi-image environment, after jump to the image we can have UART in
unexpected state. Reset UART to default state to make sure that UART is
initialized properly and won't cause system to crash or hang.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 09:43:36 -08:00
Patryk Duda
227ac76828 drivers: counter: Reset timer using RCC before initialization
In multi-image environment, after jump to the image we can have running
timer with interrupts enabled. If interrupt is triggered, the asserts
in the driver can cause a crash.

This patch also adds 'resets' property for all timer nodes.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 09:43:36 -08:00
Patryk Duda
3cbbcefb12 drivers: reset: Add support for reset clear register
To deassert reset in STM32MP1 RCC the driver needs to set the bit in
reset clear register.

This patch extends existing implementation to support this type of
register.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 09:43:36 -08:00
Patryk Duda
d6f8e9ae5b drivers: reset: Introduce STM32 reset controller
This driver exposes STM32 RCC reset functionality through reset API.

Information about RCC register offset and bit is encoded just like GD32.
The first 5 least significant bits contains register bit number.
Next 12 bits are used to keep RCC register offset. Remaining bits are
unused.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 09:43:36 -08:00
Patryk Duda
e4b8dce1e5 drivers: dma: Simplify stm32_dma_check_fifo_mburst() function
This function is responsible for checking if combination of msize,
mburst and FIFO level is allowed. Possible combinations can be found in
ST documentation, eg. Table 36. FIFO threshold configurations, RM0402
9.3.13 FIFO chapter.

Previously there was no 'break' or '__fallthrough' in msize switch which
caused compilation errors. Since we are confirming that combination is
correct, 'break' statements should be used.

Besides of introducing missing 'break' statements, this patch moves
'return false' from switch to the end of the function. This makes code
shorter and easier to understand, because we have only correct
combinations.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 11:18:01 +01:00
Filip Brozovic
c60e100ab3 drivers: serial: numicro: fix poll_in function
The poll_in function of the NuMicro UART driver was using the UART_Read
function from the Nuvoton HAL, which is blocking. Replace it with a
non-blocking implementation.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2022-12-08 18:46:33 +01:00
Filip Brozovic
617aa8cc65 drivers: serial: numicro: use pinctrl instead of hard-coded values
This commit enables the numicro serial driver to configure the UART
pins using the pinctrl API.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2022-12-08 18:46:33 +01:00
Filip Brozovic
3453a3b247 drivers: pinctrl: add numicro pinctrl driver
This commit adds a pinctrl driver for the Nuvoton NuMicro family
of processors.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2022-12-08 18:46:33 +01:00
Filip Brozovic
8577bb3e84 drivers: gpio: add driver for nuvoton numicro
This commit adds a GPIO driver for the Nuvoton NuMicro family
of processors.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2022-12-08 18:46:33 +01:00
Francois Ramu
9c49ee3e48 drivers: dma: stm32u5 dma with resume API function
Add the resume API function for the dma driver of the stm32U5 serie.
That completes the suspend API function.
Controlling the SUSPF bit of the GPDMA CR register is enough
to suspend/resume the channel.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-08 14:59:01 +00:00
Francois Ramu
e5306ed8e3 drivers: dma: stm32u5 do not reset the dma channel when suspending
There is no need to reset the channel else DMA config is lost and
channel should be enabled again in case of resume.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-08 14:59:01 +00:00
Georgij Cernysiov
581a50e000 drivers: usb: stm32: Simplify Kconfig help message
The USB_DC_STM32 help message started to miss some
STM32 MCU families. Overtime, the message will
get bigger if we continue to list family names.
Removed family names to simplify the message and
avoid periodic modifications.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-12-08 09:58:58 +00:00
Maciej Zagrabski
e31c0d0ff4 Revert "drivers: gpio: STM32U5 independant IO supply"
This is already fixed in zephyrproject-rtos/hal_stm32#147.

This reverts commit 5b4ad9127f.

Signed-off-by: Maciej Zagrabski <mzi@trackunit.com>
2022-12-08 09:56:35 +00:00
Patryk Duda
f7fca220ba drivers: bbram: Introduce BBRAM shell
Add 'bbram' command which is very convenient tool for examining and
modyfying BBRAM content.

Examples:

Write one byte:
$ bbram write backup_regs 0x1 0xaa

Write many bytes (starting from 0x13):
$ bbram write backup_regs 0x13 0xa 0xb 0xc 0xd 0xe 0xf 0xaa 0xab 0xac

Read whole BBRAM:
$ bbram read backup_regs

Read many bytes (4 bytes starting from address 0x14 in this case):
$ bbram read backup_regs 0x14 4

Read one byte (from 0x14 address):
$ bbram read backup_regs 0x14

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-08 16:47:09 +09:00
Patryk Duda
e02456a52d drivers: bbram: Introduce STM32 BBRAM driver
STM32 battery-backed RAM is organized in 4 byte registers. Number of
registers can vary between models from 5 to 32 registers.

Usually, the registers are part of RTC. On some variants they are part
of tamper module. On STM32F1 the registers are in separate module. For
now, only backup registers from RTC are supported.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-08 16:47:09 +09:00
Bartosz Bilas
e077fb73ec drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt
`spi_is_ready` function is being deprecated in favor of
`spi_is_ready_dt` so let's replace the old usage in the tree.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-12-07 09:40:23 -06:00
Patryk Duda
a9ed11ab8d drivers: counter: Add __fallthrough in STM32 counter driver
STM32 counter driver uses switch statement in which cases don't end
with break or return intentionally.

Affected switches in counter driver check status of all timer channels
(maximum 4 channels), but the number of channels is not determined
during compilation. In switch, we jump to channel with highest number
and then check other channels with lower numbers.

Compiler can warn about it, so this patch adds information that it was
intentional.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-07 14:26:42 +00:00
Maciej Zagrabski
ec7237c38a drivers: gsm_ppp: replace DT_INST with DT_DRV_INST
Replace error prone DT_INST with proper DT_DRV_INST.

Signed-off-by: Maciej Zagrabski <mzi@trackunit.com>
2022-12-07 10:29:34 +00:00
Lucas Tamborrino
b196edf55d drivers: spi: esp32xx: Fix buffer length for DMA
Fixes #52588

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-12-07 10:13:38 +00:00
Grixa Yrev
4fe862e396 drivers: lpuart: enable rs485 mode
NXP LPUART IP supports rs485 mode when transceiver driver enable
using RTS. Allow setting rs485 mode up via the "nxp,rs485-mode"
dts property. "nxp,rs485-de-active-low" dts property can be used
for set RTS polarity.

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
2022-12-07 10:12:14 +00:00
Francois Ramu
2ed292e1be drivers: stm32: do not enable the HSI48 locally
The HSI48 is enabled by clock control driver.
It is no more done by each driver that requires this clock
However when using rng or sdmmc or bluetooth/ipm or usb,
the HSI48 clock must be present in the DTS.
Add a warning for this particular check but keep the deprecated
HSI48 clock enable : keeping for legacy but to remove later.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-07 10:03:11 +00:00
Francois Ramu
8eb55b3416 drivers: clock_control: some stm32 have a HSI48 fixed clock
For the stm32 devices that have a HSI48 clock,
the driver enables it, like any other fixed clock,
if needed and supported by the serie.
For stm32L0, SYSCFG VREFINT is also required.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-12-07 10:03:11 +00:00
Michał Barnaś
23a04b8b0a gpio: cleanup the nct38xx driver
Reorganize includes and fix the indentation of code.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-12-06 10:10:36 -05:00
Michał Barnaś
59766b52be gpio: add support for get_config and get_direction in nct38xx
This commit adds support for get_config and get_direction functions
for the nct38xx IO expander family.
Also applies the clang-format changes.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-12-06 10:10:36 -05:00
Michał Barnaś
c11af96135 gpio: fix the nct38xx driver
This commit fixes the comment and adds the missing assignment of
return value from i2c read byte command in the nct38xx driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-12-06 10:10:36 -05:00
Daniel DeGrasse
7d1f435a2a drivers: ipc: Enable messaging unit driver for iMX.RT multicore SOCs
Enable MU messaging unit driver for RT11xx socs.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-12-05 19:54:37 +01:00
Gerard Marull-Paretas
649a8195b3 drivers: regulator: pca9420: refactor mode handling
- Similar to what was done for other parts of the driver, remove any
  register specification from Devicetree (modesel-reg/mask)
- Keep all the information in the driver, and define modes as "numbers",
  e.g. PCA9420_MODE0: 0, PCA9420_MODE1: 1, etc.
- Bindings provide IC defaults now (all modes allowed 0/1/2/3 and
  initial mode set to 0).
- When mode is controlled via the MODESEL0/1 pins (ie directly by an iMX
  MCU using the dedicated PMIC_MODE0/1 pins), the driver will not allow
  to select a mode (it is not possible). This mode is now enabled by
  setting `nxp,enable-modesel-pins` in Devicetree. When enabled, all the
  allowed modes are configured to be selectable via pins. When disabled,
  mode can be set via I2C (using TOP_CNTL3 MODE0/1_I2C fields)

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-05 19:10:55 +01:00
Xinyang Tan
535f5a6c04 shell: support setting help string for each entry in a dictionary command
Add support for setting the help description for each entry in a dictionary
command. Currently the syntax string alone may not provide sufficient
description of its entry. This commit also helps keep the help messages
consistent with existing style.

Signed-off-by: Xinyang Tan <xinyang.tan@delve.com>
2022-12-05 18:40:46 +01:00
Bjarne von Horn
e24e6454e9 drivers: ethernet: stm32: initialization routine for the new driver
Setup has to be adapted, too

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
aa5353a901 drivers: ethernet: stm32: Enable receiving with new driver
Use the new API in the receive method

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
202abc9acc drivers: ethernet: stm32: Transmit frames larger than one buffer
Now, multiple tx buffers can be used to send packets,
so that the packet size can exceed tx buffer size.

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
1a9420af8d drivers: ethernet: stm32: Enable transmitting with new driver
Use the new API in the transmit method

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
ac1821bb21 drivers: ethernet: stm32: Add Error Callback
The new HAL API provides a different error propagation method

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
1771f58a5b drivers: ethernet: stm32: Add transmit callbacks
These callbacks are also used by the stm32cube HAL driver

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
853bca1031 drivers: ethernet: stm32: Add receive callbacks
Callbacks which will be used by stm32cube driver

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
ae87d8c74f drivers: ethernet: stm32: Disable autonegation for new api
As it is not supported

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
ee43d13b77 drivers: ethernet: stm32: Make tx semaphore available for new api
The new HAL API also has a TxCpltCallback, so we need the semaphore too.

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
aa78951016 drivers: ethernet: stm32: Additional structures for new HAL driver
They allow managing the tx and rx buffers from both
driver parts (zephyr and stm32cube)

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
f9158ab5ea drivers: ethernet: stm32: Add Kconfig to select new HAL API
STM32H7X and STM32F4X ETH HAL Drivers now provide a new api.
This commit only adds a new Kconfig option

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Bjarne von Horn
dcec4608d8 drivers: ethernet: stm32: check tx packet size before locking mutex
The transmit mutex is not needed while checking the packet size,
so we acquire the lock after checking the size and
return early if it is too big.

Signed-off-by: Bjarne von Horn <B.von_horn@wzl.rwth-aachen.de>
2022-12-05 18:31:38 +01:00
Mark Watson
5381e0b716 drivers: usb: usb_dc_nrfx: add usbd worker thread name.
I added a thread name to the usbd worker thread.

Signed-off-by: Mark Watson <mwatson@prosaris.ca>

Fixes: #43330
2022-12-05 18:03:39 +01:00
Tomasz Moń
22168bd45c drivers: usb_dc_nrfx: Do not uninit on detach
It is possible for nrfx usbd driver to send NRFX_USBBD_EP_ABORTED during
endpoint disable. The event is passed to event handler registered with
nrfx_usbd_init(). The nrfx_usbd_uninit() removes the registered event
handler, replacing it with NULL. If any event is sent after uninit, the
NULL pointer is executed and device crashes.

Do not uninit nrfx usbd driver on detach so it is possible for the
usb_disable() to disable all the endpoints.

Fixes: 460ca86527 ("drivers: usb_dc_nrfx: Always allow endpoint disable")

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-12-05 15:50:43 +01:00
Henrik Brix Andersen
b4912ea997 drivers: pwm: mcux: ftm: fix pwm capture timer overflow count edge cases
Depending on the timing of the edges of the signal to be captured, a timer
overflow interrupt flag may appear in the same ISR as a channel event (1st
or 2nd edge capture complete) flag. Change the timer overflow math to
compensate the timer overflow count based on whether the channel event
happened before or after the overflow flag occured.

For continuous PWM period captures, only the very first edge of the first
period requires an interrupt to be captured. Subsequent "first edges" are
the same edges as the second edge of the previous period. Depending on the
timing of the captured signal, enabling the 1st edge interrupt in this case
can cause the overflow count for subsequent first edges to be captured at
the wrong point in time.

Fixes: #52452

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-12-05 08:06:44 -06:00
Dylan Hung
f5794923a1 drivers: reset: add Aspeed AST10x0 reset control
AST10x0 series SOCs provide the reset controller through the syscon
hardware block.  The current driver supports the reset line assert,
deassert and status for the hardware IPs embedded in the SOC.  Each
reset line has an ID that can simply map to a bit in syscon registers
RESET_CTRL0_ASSERT (group 0) or RESET_CTRL1_ASSERT (group 1). Write bits
to RESET_CTRL0_DEASSERT or RESET_CTRL1_DEASSERT will clean the
corresponding bits in RESET_CTRL0_ASSERT or RESET_CTRL1_ASSERT
registers.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
2022-12-05 14:36:16 +01:00
Georgios Vasilakis
0bdc2811c2 drivers: entropy: PSA crypto RNG driver default
Enable the PSA RNG driver by default. This option
will only be enabled when BUILD_WITH_TFM is enabled
and a device with the required compatible field
(zephyr,psa-crypto-rng) is defined in the device tree.
When a vendor includes such a device and enables the
ENTROPY_GENERATOR subsystem it is fair to assume
that wants to use the PSA Crypto RNG driver.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2022-12-05 14:20:52 +01:00
Andriy Gelman
9b43e3ac0f drivers: serial: uart_xmc4xxx: Fix write to fifo with more than one byte
Currently only the first byte was written when pushing more than
one byte into the fifo.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-12-05 11:03:22 +01:00
Daniel DeGrasse
95d8943c69 drivers: regulator: support for regulator mode APIs in regulator shell
Add support for regulator mode related APIs to regulator shell, so that
the user can select new operation modes for the regulator and configure
target voltages

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-12-04 19:56:34 +01:00
Daniel DeGrasse
9d1bcc6126 drivers: regulator: cleanup device_is_ready and atoi usage
Cleanup regulator shell to use strtol() over atoi(), as strtol features
error detection. Remove device_is_ready() checks, and replace them with
NULL checks as device_get_binding() calls device_is_ready() interally

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-12-04 19:56:34 +01:00
Gerard Marull-Paretas
8fb0f3e3f1 drivers: regulator: pca9420: use standard I2C API
The I2C API already provides APIs to read/modify registers, so there is
no need to provide custom wrappers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-02 16:18:05 +01:00
Johann Fischer
1083e61163 drivers: udc: add USBFSOTG UDC driver for Kinetis SoCs
Add USBFSOTG UDC driver for Kinetis SoCs.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-02 12:55:18 +01:00
Johann Fischer
1f11fbc1aa drivers: udc_nrf: do not abuse HAL events for the driver's concerns.
HAL events were also used for the shim driver's concerns
during the prototyping of API. Fix it now and use specific
shim driver events. That also allows new transfers to be
triggered from a single point.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-02 12:55:18 +01:00
Johann Fischer
292951da4b drivers: udc_nrf: implement method to distiguish hal and shim events
Implement method to distiguish hal driver and UDC shim driver events.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-02 12:55:18 +01:00
Johann Fischer
1fa31bbc30 drivers: usb: add new USB device controller API (UDC API)
Add new USB device controller API and nRF USBD controller driver.
The new UDC API brings support for multiple instances and asynchronous
transfer model, transfers use net_buf and store methadata in the
user data area.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-12-02 12:55:18 +01:00
TOKITA Hiroshi
9f12f2cd51 drivers: display: st7735r: Add rgb-is-inverted property
Set the inverted value of pixel format setting in MADCTL register to
current_pixel_format in display capabilities structure
if rgb-is-inverted enabled.

This make enables support for a module that mismatches the RGB setting
in the MADCTL register and the actual display color format.
(Such as Longan Nano built-in LCD module.)

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-12-02 11:32:25 +01:00
Jay Vasanth
b15f01ddce drivers: led: Microchip XEC LED driver using BBLED controller
Implement a LED driver for Microchip XEC using the breathing,
blinking LED controller. The driver supports LED on, off, and
blink API's. The BBLED block uses the 32768 Hz clock domain
allowing the module to operate in light and deep sleep states.
Blink frequency is 32768 divided by 256 * (prescale + 1) where
prescale is a 12-bit value. Duty cycle is specified by an 8-bit
value where 0 = full off, 127 is 50%, and 255 is full on.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-12-02 11:31:50 +01:00
Carlo Caione
cc427b4bb0 cache: Fix libraries and drivers
Fix the usage to be compliant to the new cache API.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-12-01 13:40:56 -05:00
Carlo Caione
74e1b1781a cache: aspeed: Rework driver
To be compliant to the new cache API.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-12-01 13:40:56 -05:00
Carlo Caione
189cd1f4a2 cache: Rework cache API
The cache operations must be quick, optimized and possibly inlined. The
current API is clunky, functions are not inlined and passing parameters
around that are basically always known at compile time.

In this patch we rework the cache functions to allow us to get rid of
useless parameters and make inlining easier.

In particular this changeset is doing three things:

1. `CONFIG_HAS_ARCH_CACHE` is now `CONFIG_ARCH_CACHE` and
   `CONFIG_HAS_EXTERNAL_CACHE` is now `CONFIG_EXTERNAL_CACHE`

2. The cache API has been reworked.

3. Comments are added.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-12-01 13:40:56 -05:00
Declan Snyder
b5708e273b drivers: entropy: Fix MCUX CAAM Entropy
Re-enable the CAAM for entropy
now that the HAL driver has been fixed

Job descriptors must be accessed coherently
between CAAM DMA and core.

The M4 Cores still do not work
because of mpu/cache/kconfig arch complications,
disable caam for M4 cores in DTS

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-12-01 17:57:12 +01:00
Ruibin Chang
a56504a434 ITE drivers/pwm/it8xxx2: don't gate pwm clock when set cycle
When pwm_it8xxx2_set_cycles() is called, we disable the pwm clock
at the beginning and enable it at the end, so there is a more than
1ms pwm low pulse when every time changing the cycle. The low pulse
would let some fans go to idle mode, so we don't gate the pwm clock.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-12-01 15:49:37 +01:00
Tomasz Leman
56284d7017 drivers: dmic: add dependency for runtime pm
Adding dependency for runtime power management needed by power domains.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-11-30 17:46:17 -05:00
Tomasz Leman
f659d46e9d drivers: dmic: enable runtime power mgmt in intel dmic
Enable Zephyr device runtime power management mechanisms in Intel DMIC
driver. This allows Zephyr to track usage reference for power domain
gating.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-11-30 17:46:17 -05:00
Tomasz Leman
d9a416f38d power_domain: intel_adsp: code update
This patch contains several small changes to the intel adsp power
domain.

- include missing header,
- replacing sys_write32/sys_read32 with sys_write16/sys_read16 since
  DfPWRCTL is a 16 bit register,
- renaming struct to be more representing what it is,
- passing register address, not a value to the sys_read/sys_write
  functions,
- pd_intel_adsp_init is now returning actual status.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-11-30 17:46:17 -05:00
Peter Maxwell Warasila
55ce3026c9 drivers: flash: stm32l5_u5: refactor flash_stm32_page_layout() for clarity
While diagnosing a problem on the STM32U585 in this function in
flash_stm32l5_u5.c, I had difficulty sussing out the flow of the
function and conditional logic.

This refactor seeks to improve clarity through a simplified flow control
using an early return to short circuit logic on subsequent calls to the
function and slightly more thorough comments.

Tested using tests/drivers/flash on the b_u585i_iot02a and in a
proprietary application and board which uses the STM32U585 and littlefs.

Signed-off-by: Peter Maxwell Warasila <madmaxwell@soundcomesout.com>
2022-11-30 17:30:36 +01:00
Peter Maxwell Warasila
ed3ad75a7a drivers: flash: stm32l5_u5: fix L5/U5 difference in FLASH_PAGE_NB
In flash_stm32_page_layout, the FLASH_PAGE_NB macro is used to set the
page count in the flash layout returned to the caller. On STM32L5
platforms this is defined in stm32l5xx_hal_flash.h to be (FLASH_SIZE /
FLASH_PAGE_SIZE). However, on STM32U5 platforms the macro is defined in
the soc headers (such as stm32u585xx.h) define the macro as
(FLASH_BANK_SIZE / FLASH_PAGE_SIZE). This results in the flash layout
only reflecting the first bank on STM32U5 platforms with the maximum 2
MB of flash.

This commit resolves this discrepancy by directly calculating the number
of pages by dividing FLASH_SIZE by FLASH_PAGE_SIZE.

Tested on a proprietary board using the STM32U585 which mounts a
littlefs partition in the last 256 kB of its 2 MB of flash.

Signed-off-by: Peter Maxwell Warasila <madmaxwell@soundcomesout.com>
2022-11-30 17:30:36 +01:00
Gerard Marull-Paretas
a29bdc262c drivers: regulator: drop async enable
Drop the async enable function. This feature is rarely/never used,
complicates driver design, and doesn't really follow the sync/async API
design/naming used in other areas. In the future we can introduce
regulator_enable_async if needed, with support from the driver class (no
onoff). Note that drivers like PCA9420 did not implement any
asynchronous behavior. regulator-fixed implemented in the past
asynchronous behavior using work queues, an overkill for most GPIO
driven regulators. Let's keep things simple for now and extend the API
when needed, based on specific usecases.

In the current implementation, reference counting is managed by the
driver class. \isr-ok attribute is dropped, since calls are potentially
blocking. Note that drivers like PCA9420 already violated such rule.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-30 15:49:30 +01:00
Gerard Marull-Paretas
e0c8de1e39 drivers: regulator: fixed: simplify implementation
Remove regulator-fixed-sync specialization, create a single driver that
is always synchronous. The asynchronous part is rarely/never used, so
let's keep things simple for now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-30 15:49:30 +01:00
Sylvio Alves
831ecd4096 driver: wifi: esp32: disable optimization by default
Do not set wifi optimizations by default in order
to free up IRAM room region. In case higher throutput
is necessary, one can enable this flags to optmize it.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-11-30 13:40:10 +01:00
Sylvio Alves
b7b8830c7c driver: wifi: esp32: remove build warning
Removes strnlen implicit declaration when newlibc
is enabled.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-11-30 13:40:10 +01:00
Manuel Arguelles
4fbf940019 drivers: counter: support NXP S32 System Timer Module
NXP S32 System Timer module includes a 32-bit count-up timer and four
32-bit compare channels with a separate interrupt source for each
channel. The timer is driven by the module clock divided by an 8-bit
prescale value.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-11-30 11:29:39 +01:00
Jay Vasanth
38ad230aec drivers: pinctrl: Microchip XEC PINCTRL add invert pin
Microchip XEC GPIO pins support inverting the output of
alternate pin functions. This feature may be useful for
those peripherals that do not implement output inversion
in the peripheral. GPIO control register pad input and
parallel input register values are not affected by the
function output invert feature. GPIO interrupt detection
of an output is inverted if the invert polarity is enabled.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-11-30 11:29:22 +01:00
Jonas Otto
d3415e2ce1 drivers: spi_mcux_lpspi: fix baudrate change when switching devices
When configuring an LPSPI module for a new device with different baud rate,
the module needs to be disabled for the baud rate change to take effect.
This adds the necessary call to LPSPI_Enable before initializing the
module.

Fixes #51177

Signed-off-by: Jonas Otto <jonas@jonasotto.com>
2022-11-30 11:28:22 +01:00
Gaël PORTAY
ffed8388e7 drivers: spi_context: fix some LOG_DBG warnings
This casts the char * buffers to void * before giving them to the
LOG_DBG function to fix a warning at runtime.

Signed-off-by: Gaël PORTAY <gael.portay@gmail.com>
2022-11-29 22:52:40 -08:00
Adrian Bonislawski
a45caf868f drivers: dai: add Intel HDA dai
add Intel HDA DAI driver
Long device list in dtsi needs to be refactored in the future

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-11-29 19:42:33 -05:00
Ederson de Souza
9c55195235 drivers/mm: Only remap unused RAM on Kconfig on Intel ADSP MTL
Remapping by default can confuse things that dynamically manage RAM,
such as newlib heap - since unused memory will be powered off by
default. So this patch shields this behaviour behind a non-default
Kconfig.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-11-29 18:03:09 -05:00
Gerson Fernando Budke
e68f568f86 drivers: counter: Enable support to stm32l5 mcu
Add driver entries to enable stm32l5 rtc driver.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2022-11-29 13:40:27 +00:00
Georgij Cernysiov
2b0727d550 drivers: clock_control: stm32h7: add PLL2 support
Adds PLL2 support.

The driver configures and enables PPL2 when
it is enabled in the DTS.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-11-29 11:54:52 +01:00
Gerard Marull-Paretas
a78bdbce89 dt-bindings: regulator: pca9420: reorganize headers/macros
pca9420_i2c.h has neem remamed to pca9420.h (device only has I2C, so
it's kind of redundant to have i2c in the header name).

pmic_i2c.h was again not generic but designed specifically for PCA9420.
All its macros have been renamed, s/PMIC/PCA9420, and moved to the
pca9420.h header.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
709f7c88f7 drivers: regulator: pca9420: store common config in parent device
Store all common configuration settings in the parent device. This
change should save ROM, since it avoids duplication.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
9219d3d2b5 drivers: regulator: pca9420: fix VIN current limit setting
The driver had a conceptual issue regarding current limitation. PCA9420
is able to limit the current flowing through VIN, ie input current. This
is a global setting, not individual to each regulator. This patch
creates a new DT property: nxp,vin-ilim-microamp to specify such limit.
It is applied when the device is initialized.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
dcd63d288f drivers: regulator: pca9420: refactor voltage range handling
Voltage ranges were hardcoded in Devicetree, however, things can be
significantly simplified by using the recently introduce linear ranges
API. All values are now computed using information stored in the driver,
so there is no need to store any lookup table in ROM. Code should now
both be faster in average and consume less ROM.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
1caedf12dd drivers: regulator: pca9420: do not expose registers in DT
Regulator registers were set for each BUCK/LDO in DT, likely because of
the way the devices were instantiated. When using a generic iterator,
ie, DT_INST_FOREACH_CHILD, there's no way to differentiate the child
being _parsed_. Since instantiation happens now based on child node
names, we are able to know which registers each devices gets assigned at
the driver level. This greatly simplifies Devicetree, and it actually
removes information that is not strictly hardware description from it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
9235ab90cc drivers: regulator: pca9420: remove unused modesel offset
The property was not used, and not defined in the bindings either.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
f4713fb7fb drivers: regulator: pca9420: fixed child instantiation
Right now the PCA9420 driver instantiates by iterating over all
children. This is somewhat problematic, for a few reasons:

- Since instantiation is generic code, we're forced to put internal
  details on Devicetree, e.g. reg-masks. After this change, this will no
  longer be necessary.
- We take all children, regardless of what is defined in DT.

While we have no means to validate Devicetree node names as in Linux
dtschema, this approach allows us to have per-child specific
initialization code. This is somewhat similar to the Linux approach.

Note: nodelabels have been removed, since they were not used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
9f1d25a2d1 drivers: regulator: pca9420: do not use DT_PROP_OR for booleans
DT_PROP() will evaluate to 0 when a boolean property is missing, so
there is no need to use DT_PROP_OR(..., false). Using _OR also has
side-effects, such as no errors when property is not defined in the
bindings.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
f89405ca8d drivers: regulator: pca9420: use standard regulator-min|max-microvolt
regulator.yaml provides now standard properties for minimum/maximum
voltage.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
d4566ce2b6 drivers: regulator: pca9420: sort includes
Sort includes: stdc, Zephyr.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
ac7c8c810a drivers: regulator: pca9420: fix voltage|current_range types
- voltage/current needs to be stored using int32_t
- reg_val is a 8-bit unsigned register value
- Also removed __packet, it is not required here

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
7569de6af9 drivers: regulator: pca9420: rename some internal structs/funcs
Rename some internal structures/functions to clearly indicate they
belong to the PCA9420 driver.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Gerard Marull-Paretas
af590c4500 drivers: regulator: pca9420: improve instantiation code
- Constify configuration and curr. limits/voltage range/modes arrays
- Use common argument names: node_id, inst to make code more readable
- Improve macro names to make things clear

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-29 11:54:31 +01:00
Francois Ramu
acd582e456 drivers: flash: stm32 ospi flash driver for stm32l4plus mcus
Adaptation of the ospi nor flash driver for stm32l4 plus
where the peripheral is slighty different.
Configure the OSPIM peripheral for mcu embeddingthis peripheral
in front their octospi instances.
Add LOG for read access command like for write access.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-29 09:32:22 +00:00
Patryk Duda
b9f495282e drivers: flash: Do not unlock CR at the end of initialization
Unlocking CR at the end of initialization was added in commit
a9183cd518. It was probably copied
from previous flash driver implementation.

Unlocking and locking CR in write and erase functions was added in
commit 6e4cdb0c99. Since we always unlock
the register before writing or erasing, and lock it after the operation
is finished, there is no need to unlock it after initialization.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-11-29 09:50:28 +01:00
Arsen Eloglian
3659c2db4b intel_common: clean up & rename cavs_* to adsp_*
ADSP common definitions has been fixed
and changed from CAVS_* to  ADSP_*

Signed-off-by: Arsen Eloglian <ArsenX.Eloglian@intel.com>
2022-11-28 17:45:20 -05:00
Evgeniy Paltsev
d2488d2160 ARC: control shared (common) interrupts via IDU
Control shared interrupts enabling/disabling via IDU.
With that we can easily enable and disable them for all cores
in one place.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2022-11-28 17:44:54 +01:00
Jaska Uimonen
f13b6bc125 drivers: dai: intel: dmic: fix periodic start
This fixes an issue with periodic_start feature that is only
present in newest dmic hw (starting from ACE).

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-11-28 17:43:58 +01:00
Andrei Emeltchenko
c0440c4706 drivers: eth_e1000: Allow several instances
Allow to enable several e1000 instances.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-28 13:19:51 +01:00
Andrei Emeltchenko
54bb10cf20 drivers: eth_e1000: Remove zero hadrcoded TDBAH, RDBAH
Though at the moment the driver works with high registers initialized
to zeroes it does make sense to do it right way. The double 16 shifts
are used to suppress warnings with 32 bit shift.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-11-28 13:19:51 +01:00
Mulin Chao
0893ca8c2f driver: gpio: npcx: correct the usage of npcx voltage flags
In npcx ec series, two detection levels, 3.3V (default) and 1.8V are
supported during gpio configuration. But the current implementation
always selects default detection level whether NPCX_GPIO_VOLTAGE_1P8 is
set. This PR is a fix for this issue.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-11-28 09:56:33 +00:00
Attie Grande
5f9cab9e80 drivers: flash: sam0: Resolve write issues in the first row
Previously, while writing close to the start of flash (i.e: in the first
row), the write was never committed - due to zero being used as the
"empty buffer" marker.

This patch also incorporates some performance improvements, as well as
observing any errors reported by `flash_sam0_commit()`.

Fixes #52309

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-11-28 10:49:09 +01:00
Dawid Niedzwiecki
2d93f03c25 driver: gpio: rt1718s: Add RT1718S GPIO driver
RT1718S is an i2c-based TCPC chip that supports 3 additional GPIOs.
The pins can be used for USB-C operations e.g. handling FRS, but they
can also work as usual GPIOs.

Add a driver for the RT1718S GPIO and a handler for an alert signal from
the chip. The handler reads the alert register once asserted and calls
the GPIO interrupt handler if needed(Vendor-defined alert).

gpio_rt1718s.c file and "richtek,rt1718s" node collect common properties
and data for all RS1718S functionalities. The file can be extended for
TCPC driver. rt1718s.h file also defines inline functions with i2c
operations common for all drivers. The common header and source files
can be moved to tcpc directories once the tcpc driver is added since it
is the main functionality.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2022-11-28 10:48:53 +01:00
Brian Dunlay
a9ac0a884e drivers: wifi: eswifi: Offload sockets regression
This change fixes a regression from commit 1cbc0acd.

Socket offload uses a dummy socket context, and setting
the socket state in this dummy context is invalid.

Fixes #52317

Signed-off-by: Brian Dunlay <brian@nubix.io>
2022-11-28 10:48:10 +01:00
Armando Visconti
20ea61be35 drivers/sensor: lsm6dso: Add drdy_pulsed property in DT
Add drdy_pulsed property in Device Tree in order to select how
data ready irq should behave (either pulsed or latched mode).
Moreover change/fix the API called to set drdy irq mode.
(fix #51944)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2022-11-25 20:03:21 +01:00
Artur Lipowski
c88e157c46 clock_control: stm32: Add extern C to allow including from C++.
The stm32_clock_control_init is needed for implementation of custom
pm_state_exit_post_ops.

Signed-off-by: Artur Lipowski <Artur.Lipowski@hidglobal.com>
2022-11-25 20:03:10 +01:00
Tomasz Moń
12e244b184 drivers: usb_dc_native_posix: Allow endpoint disable after detach
There is no reason to prevent endpoint disable after detach.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-11-25 20:02:42 +01:00