Commit graph

11570 commits

Author SHA1 Message Date
Jamie McCrae 9a50c70113 drivers: watchdog: it8xxx2: Prevent Kconfig option being wrongly shown
The it8xxx2 watchdog Kconfig options are always shown, for every type
of device, they should only be shown when an it8xxx2 device is being
targeted.

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2022-04-28 14:18:16 +02:00
Derek Snell 16a09b026e drivers: i2s: mcux_sai: fixed SAI driver
Includes several driver fixes and improvement to leverage
scatter/gather mode of DMA.  Loads multiple DMA blocks into TCDs.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell 60dd576975 drivers: i2s: mcux_sai: fixed driver message pool sizes
Fixed bug if CONFIG_I2S_RX_BLOCK_COUNT and CONFIG_I2S_TX_BLOCK_COUNT
are different sizes.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell 4ff7df43a2 drivers: i2s: mcux_sai: fixed RX not completing end of stream
RX FIFO watermark setting causing issue where last 16 words received
were stuck in FIFO, and not requesting DMA to move to buffer.  Fixed by
setting watermark to 0.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell 984619b033 drivers: i2s: mcux_sai: fixed macro name for SAI_HAS_ON_DEMAND_MODE
corrected driver after HAL PR
https://github.com/zephyrproject-rtos/hal_nxp/pull/147

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell b052e657b8 drivers: i2s: mcux_sai: fixed i2s_mcux_config()
driver config settings were getting overwritten by APIs that set
default settings, like SAI_GetClassicI2SConfig().  Moved config code
after those APIs.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell 5df8ead428 drivers: i2s: mcux_sai: allow TX FIFO to drain before disabling
i2s_tx_stream_disable() was disabling SAI transmitter before FIFO
could complete transmission.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Derek Snell 56903cab63 drivers: i2s: mcux_sai: add control for purging buffers
stream_disable()'s should not always purge buffers.
And i2s_rx_stream_disable() needs separate control for
purging in_queue and out_queue since app owns buffers
after placed in out_queue for i2s_read()

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-04-28 14:18:00 +02:00
Marek Janus 6505cbc085 drivers: dac: add mcp4728 driver
MCP4728 is a 12-bit, Quad Digital-to-Analog Converter with EEPROM Memory.
Controlled via I2C interface.

Signed-off-by: Marek Janus <marek.janus@grinn-global.com>
2022-04-28 14:17:34 +02:00
Gerard Marull-Paretas ae91933c4a drivers: pwm: always use nanoseconds for set
In order to be consistent with what is possible in Devicetree, always
take a period in nanoseconds. Other scales or units may be specified by
using, e.g., the PWM_MSEC() macros (all of them converting down to
nanoseconds). This change then deletes the "_nsec" and "_usec" versions
of the pwm_set call.

Note that this change limits the period to UINT32_MAX nanoseconds,
~4.3s. PWM is, in generali, used with periods below the second so it
should not be a problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas 2bc6279866 drivers: led: led_pwm: use pwm_dt_spec
Simplify the driver by using pwm_dt_spec.

TODO: decide if pwm_dt_spec should also store period.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas 10ee44c94b drivers/samples/tests: remove usage of deprecated PWM APIs
Use the new API calls that remove pin naming.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas e2852ef985 drivers: pwm: use new API naming (no pin)
Use the API names without `_pin`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas 95b56cdffd drivers: pwm: remove _pin from API calls
In a first place, the PWM API operates on "channels", not "pins". While
the API calls could have been changed by _channel, this patch takes the
approach of just dropping _pin. The main reason is that all API calls
operate by definition on a channel basis, so it is a bit redundant to
make this part of the name. Because the `_dt` variants of the calls are
going to be introduced soon, the change to `_channels` + `_dt` would
make API function names quite long.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas fbf73334f3 drivers: pwm: make all drivers use channel variable name
The variable indicating the PWM channel is now names "channel" instead
of "pwm", adjust all drivers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas 6f39b08343 drivers: pwm: gecko: fix access to timer register
The timer registers are accessible via the device config field, driver
code was wrong in one case (pwm is the variable indicating PWM channel).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas aa37dedcaf drivers: pwm: ite_it8xxx2: remove wrong ARG_UNUSED
The pwm arg is used in the function, so placing ARG_UNUSED is wrong.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Gerard Marull-Paretas c11516ae90 drivers: pwm: ite_it8xxx2: add missing braces
Multiple if/else blocks had missing braces, add them as this violates
Zephyr coding guidelines.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 11:29:38 +02:00
Mahesh Mahadevan 5a5c1ae76d drivers: counter: Update NXP CTimer to implement set_top_value
Implement the set_top_value. This reserves one of the Match channels
to set the top value and to reset the counter.
Therefore the number of channels available to the user is reduced by 1.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-04-28 10:26:54 +02:00
Lukasz Maciejonczyk 5d5dcfa0b9 drivers: ieee802154_nrf5: fix target time for indirect transmission
After change in RD into 64-bit time, target time must be express in
absolute 64-bit time. Upper layer e.g. OpenThread still utilizes only
LSB of the RD time therefore the conversion is required.
Make sure that target time is absolute 64-bit target time.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-04-28 10:25:38 +02:00
Hake Huang 07d6adde51 driver: adc: fix build error for adc_dma
fsl_sim.h is not required as SDK upgrade

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-04-27 11:15:43 -05:00
Maxime Vincent 307a60e217 drivers/sensor: lis2dw12: add drdy pulsed/latched config
Add DT option to configure the data ready interrupt mode.
Latched is the default; pulsed can be enabled through
the drdy-pulsed DT, if desired.

Signed-off-by: Maxime Vincent <maxime@veemax.be>
2022-04-26 15:53:58 -04:00
Maxime Vincent bf1334bafb drivers/sensor: lis2dw12: add threshold interrupt support
Add optional threshold interrupt support.
Implemented using SENSOR_TRIG_THRESHOLD sensor trigger type.
The features can be optionally enabled through Kconfig,
or disabled for smaller code size.

Signed-off-by: Maxime Vincent <maxime@veemax.be>
2022-04-26 15:53:58 -04:00
Maxime Vincent 652ab7f2d4 drivers/sensor: lis2dw12: add fds + hp_ref support
Add FDS (Filtered Data Type Selection) + High-Pass reference mode support
(FDS in CTRL6, HP_REF_MODE in CTRL7)
Values are configurable through DT per instance.

Signed-off-by: Maxime Vincent <maxime@veemax.be>
2022-04-26 15:53:58 -04:00
Maxime Vincent 2d2a708bc8 drivers/sensor: lis2dw12: add low_noise support
Add low_noise support. (LOW_NOISE in CTRL6)
Value is configurable through DT per instance.

Signed-off-by: Maxime Vincent <maxime@veemax.be>
2022-04-26 15:53:58 -04:00
Maxime Vincent 47021a608d drivers/sensor: lis2dw12: add bw_filt support
Add bandwidth filter support. (BW_FILT in CTRL6)
Value is configurable through DT per instance.

Signed-off-by: Maxime Vincent <maxime@veemax.be>
2022-04-26 15:53:58 -04:00
Huifeng Zhang bd55003f70 driver: uart_pl011: refine creating device instance code
Old code only create one pl011 device instance though there are two or
more pl011 device defined in devicetree. This patch can fix this issue.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2022-04-26 14:20:57 -05:00
Marcin Niestroj 03d0b982a4 drivers: sensor: lis3mdl: return -ENOTSUP on unsupported channels
sensor_channel_get() API should return -ENOTSUP when requested channel
is not supported. This behavior allows to use `sensor get DEVNAME` shell
command easily, as all unsupported channels are filtered out.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-26 13:14:44 -05:00
Herman Berget bfbbaf2cdb Bluetooth: Fix compilation for entropy_bt_hci
An application with the following config fails to link on nrf53 app
core:

```
CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_ENTROPY_GENERATOR=y
```

This happens because `entropy_bt_hci.c` uses functions from
`hci_core.c`, which is only compiled if `BT_HCI_HOST` is selected.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-26 09:00:03 +02:00
Maureen Helm 5769dffc01 drivers: mm: Use dt_compat_enabled for Intel ADSP TLB driver default
Enables the Intel TLB driver by default when the MM driver class is
enabled (CONFIG_MM_DRV=y) and a compatible devicetree node
("intel,adsp-tlb") is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-04-25 11:41:31 -07:00
Xavier Chapron bfcb181b49 drivers: gpio: pca95xx: Add support for PCAL95xx
Introduce has-interrupt-mask-reg DTS property for nxp,pca95xx driver.
This additionnal property allow to specify that the gpio expander has an
interrupt mask register that must be configured by the driver.
This allow to use this driver with PCAL95xx.
This fixes issue #44834.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2022-04-22 14:19:21 -05:00
Jose Alberto Meza 09ca5cc9cb drivers: espi: Correct default eSPI to UART mapping
Correct default mapping for eSPI UART virtual port to SoC UART
for MEC172x.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-04-22 10:46:18 -05:00
Daniel DeGrasse 557a0c766c drivers: lpuart: enable loopback mode
NXP LPUART IP supports loopback mode, where TX is internally connected
to RX input. Allow setting loopback mode up via the "nxp,loopback" dts
property.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-22 09:44:19 +02:00
Daniel DeGrasse 17d9bea474 drivers: edma: allow transfer descriptors to be placed in SRAM
SOCs using the EDMA IP that supported caching must locate EDMA transfer
control descriptors (TCDs) in non cacheable memory. For M7 cores, this
can simply use the "nocache" section. For M4 cores, where the nocache
section does not exist, the chosen SRAM section must be a tightly
coupled memory block which cannot be cached. Add a note to all boards
with M4 SOCs that support caching explaining this issue, and enable EDMA
driver to locate TCDs in SRAM.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-22 09:44:19 +02:00
Daniel DeGrasse fdc247fed3 drivers: mcux_lpuart: make async api use common LPUART ISR
LPUART driver should use shared ISR for all possible use cases,
including ASYNC API, so that multiple features requiring ISR can be
enabled simultaneously.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-22 09:44:19 +02:00
Andrzej Głąbek 5609bc48dd drivers: pwm_nrf5_sw: Add support for PWM_POLARITY_INVERTED flag
Add support for inverting of PWM channel outputs in the pwm_nrf5_sw
driver by properly handling the `PWM_POLARITY_INVERTED` flag.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-22 09:43:26 +02:00
Andrzej Głąbek c23a449bfb drivers: pwm_nrf5_sw: Treat pwm parameter as PWM channel, not SoC pin
Align with other PWM drivers and treat the `pwm` parameter (described
ambiguously as "PWM pin") of the `pwm_pin_set_cycles` function as a PWM
channel, not an SoC pin. This will also make the driver consistent with
the `pwm-cells` property definition in the "nordic,nrf-sw-pwm" binding
and with related `DT_PWMS_*` macros.
The change described above requires also providing a way to specify
SoC pins that are to be assigned to the PWM channels. Hence, the commit
introduces in the "nordic,nrf-sw-pwm" binding the `channel-gpios`
property that replaces the `channel-count` one.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-22 09:43:26 +02:00
Andrzej Głąbek e7a075f460 drivers: pwm_nrfx: Add support for PWM_POLARITY_INVERTED flag
Add support for inverting of PWM channel outputs in the pwm_nrfx driver
by properly handling the `PWM_POLARITY_INVERTED` flag.
The dts properties that were used so far for inverting of the outputs
("nordic,invert" and "chX-inverted") are kept as they are needed for
setting of the initial polarity, i.e. for setting the inactive state
of the outputs before any PWM signal generation is requested for them.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-22 09:43:26 +02:00
Andrzej Głąbek dbdbc79b36 drivers: pwm_nrfx: Treat pwm parameter as PWM channel, not SoC pin
Align with other PWM drivers and treat the `pwm` parameter (described
ambiguously as "PWM pin") of the `pwm_pin_set_cycles` function as a PWM
channel, not an SoC pin. This will also make the driver consistent with
the `pwm-cells` property definition in the "nordic,nrf-pwm" binding
and with related `DT_PWMS_*` macros.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-22 09:43:26 +02:00
Johannes Meister 7d1c15d09e drivers: peci: xec: Handle PECI command PING properly
Handle PECI command PING properly, also get Write FCS Byte as a check.
Now it is possible to perform a PECI Ping without crashing the bus or
blocking it for subsequent PECI transactions.
It is also possible to check whether the Ping was sucessful
or not with the Write FCS Byte.

Signed-off-by: Johannes Meister <johannes.meister@kontron.com>
2022-04-21 07:45:45 -05:00
Erwan Gouriou e476fcff78 include/dt-bindings: clocks: stm32h7: Use _C1_ registers offset
STM32H7 series offer alias addresses to access some registers that could
be accessed by the M4 core on dual core variants.
For instance RCC_AHB3ENR could be accessed at following offsets:
- 0x0D4: Accessible from both cores
- 0x134: Accessible from C1 (M7) core
- 0x194: Accessible from C2 (M4) core (if any)

For most single core H7 variants, the two first addresses were accessible,
but for some others (stm32h7ax/stm32h7bx), only the 'C1 accessible'
was available.

This fact used to be hidden by the use of LL API to access these registers,
providing the required abstraction (an mainly using the first alias
when possible to simplify implementation).

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou f6c665bac3 drivers/clock_control: stm32u5: Fix on flash latency procedure
Instead of computing hclk freq use for flash latency setting after
setting the PLLs, do it right at the beginning of the function.
Indeed, first step of PLL configuration is to switch back sysclock
to HSI source (in case it was initially PLL).
In that case, flash latency is theoretically set in consistency with PLL
driver hclk. So we should "measure" hclk freq at that step rather than
once sysclock is back on HSI.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou efd8ee465c drivers/clock_control: stm32 common: Remove intermediate hclk variable
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC is the actual hclk freq (ie core clock);
Remove use of intermediate new_hclk_freq to fix and simplify code.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou 18b3fcd86d drivers/clock_control: stm32 common: Set flash latency code under switch
Some specific F1 variants don't handle flash latency.
Put flash latency dealing code under dedicated switch.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou b636e4c799 drivers/clock_control: stm32 common: Use new bus clock bindings
Make use of new bus clocks bindings and make subsequent code
simplifications.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou 92a741c2ae drivers/clock_control: stm32: style edits on set_up_fixed_clock_sources()
Review code style in set_up_fixed_clock_sources() for better
readability.
Use of 'if (IS_ENABLED(STM32_MSI_ENABLED))' inside '#if STM32_MSI_ENABLED'
is redundant but intentional as it is in line with remaining part of the
function (HSE/HSI cases).

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou 693ba04796 dts: stm32: Add rcc prop undershoot-prevention
On some parts,  it could be required to use steps before applying
highest frequencies.
This was previously done as part of LL_PLL_ConfigSystemClock_FOO
utility functions which are no more used.
Use device tree to mention when this is required and implement it
in stm32_clock_control_init().

Additionally, fix the calls tp LL_RCC_SetAHBPrescaler, which require
use of ahb_prescaler helper.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou c4ff7d1e19 drivers/clock_control: stm32_common: Add elementary PLL configuration step
Introduce a set_up_pll configuration function and make PLL configuration
an elementary step of the whole system clock configuration.

To implement this new, function make use of the existing series specific
files which allows series specific configuration when required.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou f94ad7538e drivers/clock_control: stm32 common: Group fixed clocks init
Group fixed clocks inits in a unique set_up function.
Each clock is initialized depending on its dts status.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou f6db7afb60 drivers/clock_control: stm32 common: Use DT macros for bus prescalers
Simplify and clean up driver code using STM32 clocks DT based macros.

Added STM32_FLASH_PRESCALER macro for this purpose.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00