Commit graph

18932 commits

Author SHA1 Message Date
Guillaume Gautier
aba432348b drivers: Cleans variable scopes for STM32 drivers
Fix the scope of some variables in various STM32 drivers including:
 - SDMMC
 - DMA
 - OSPI/QSPI Flash
 - Interrupt controller

The variables are set static instead of global and const if appropriate.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-10-12 18:41:48 +02:00
Florian Grandel
631f117ed1 drivers: ieee802154: document endianness
The IEEE 802.15.4 radio driver encodes attributes in:

* little endian for everything that is close to the protocol as
  IEEE 802.15.4 frames are little endian encoded.

* mixed big and little endian in its configuration where extended
  addresses are being represented. These inconsistencies are unfortunate
  but cannot be easily fixed in a backwards compatible way so will be
  left untouched in this change.

Endianness was almost nowhere documented which explains these
inconsistencies and led to several bugs where assignments of different
byte order are not converted (or sometimes converted, sometimes not).

This change documents intended endianness within the realm of the
IEEE 802.15.4 radio driver code. Conversion bugs are fixed in a separate
commit.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-10-12 18:40:59 +02:00
Pierre-Emmanuel Novac
105cca639d drivers/ethernet: stm32: Make PTP clock optional
STM32F107 has an Ethernet MAC but no PTP clock, so remove hard requirement
on PTP clock definition in preparation for STM32F107 Ethernet MAC support.

Signed-off-by: Pierre-Emmanuel Novac <piernov@piernov.org>
2022-10-12 18:40:49 +02:00
Daniel DeGrasse
f37c8cc77e drivers: regulator: add support to PMIC regulator driver for modes
Add support for setting the target mode for a PMIC regulator. Some
regulators support multiple modes, each with distinctive voltage and
current configuration data. This function allows the consumer to switch
the PMIC into a new mode. The PMIC can then be configured to use a new
set of voltages.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Daniel DeGrasse
30d71d5457 drivers: regulator: move I2C reg reads to regulator_read_register
Move I2C register reads to regulator_read_register in regulator driver,
to enable better abstraction of regulator I2C reads

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Daniel DeGrasse
f367897bce drivers: regulator: refactor PMIC binding to use physical PMIC IC
Refactor binding to use root PMIC IC, so that properties can be shared
between regulator devices. Each individual regulator output is still
created as an individual device, since the regulator API aligns with
these devices better than the PMIC IC itself.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-12 18:40:24 +02:00
Pawel Czarnecki
6cc8f31310 drivers: counter: add missing includes
Add missing irq.h, spinlock.h and kernel.h headers

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-10-13 00:07:37 +09:00
Adrian Warecki
ed661a6c69 dai: dmic: Add missing include header
The code was missing #include <zephyr/kernel.h> which
caused a compilation error. Missing header has been added.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
2022-10-12 10:08:54 -04:00
Jordan Yates
23fbdf35b1 bluetooth: hci: spi: propagate vendor specific events
Propagate vendor specific events that are not handled by the SPI driver
up the host stack, so that `bt_hci_register_vnd_evt_cb` can work
correctly.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-10-12 18:47:48 +09:00
Enjia Mai
dcda15d17d drivers: timer: use sys_read64 to read HPET counter on 64 bits cpu
For 32 bit processor to read the 64 bits hpet counter, the HPET spec
2.4.7 suggest to read HPET counter high and low then checking the
high bits to decide if it rollovers or not.

But this logic seems to cause problem for 64 bits processor under SMP,
there is a possible one tick earier under tickless mode. It is likely
to be the cache coherence issue, because a mfence instruction before
reading the timer works.

So we change to read the 64 bits counter by sys_read64 on 64bit
processor to prevent this issue.

Fixes #49611

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-10-12 18:47:19 +09:00
Manuel Arguelles
e7384974c8 drivers: gpio: xlnx: add missing headers
Add missing headers for sys_* and IRQ related API's.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-10-12 17:41:11 +09:00
Gerard Marull-Paretas
e42f58ec94 init: s/ARCH/EARLY, call it just before arch kernel init
The `ARCH` init level was added to solve a specific problem, call init
code (SYS_INIT/devices) before `z_cstart` in the `intel_adsp` platform.
The documentation claims it runs before `z_cstart`, but this is only
true if the SoC/arch takes care of calling:

```c
z_sys_init_run_level(_SYS_INIT_LEVEL_ARCH);
```

Which is only true for `intel_adsp` nowadays. So in practice, we now
have a platform specific init level. This patch proposes to do things in
a slightly different way. First, level name is renamed to `EARLY`, to
emphasize it runs in the early stage of the boot process. Then, it is
handled by the Kernel (inside `z_cstart()` before calling
`arch_kernel_init()`). This means that any platform can now use this
level. For `intel_adsp`, there should be no changes, other than
`gcov_static_init()` will be called before (I assume this will allow to
obtain coverage for code called in EARLY?).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-12 17:16:27 +09:00
Christopher Friedt
582f77ea38 drivers: serial: gecko: fix impmlicit declaration of IRQ_CONNECT
Previously, the build was failing due to implicit declaration
of `IRQ_CONNECT`. Simply include `<zephyr/irq.h>` to fix.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2022-10-11 21:25:59 -04:00
Anas Nashif
3d85ae37b6 arm: add missing includes
Add missing includes that were previously included indirectly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 18:37:53 -04:00
Anas Nashif
1e7548eeda intel_adsp: add missing headers
add headers previously included indirectly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 18:37:53 -04:00
Anas Nashif
c75ac38f6c drivers: intc_dw_ace: use CONFIG_DW_ICTL_ACE
Use CONFIG_DW_ICTL_ACE instead of a version kconfig.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
b4a44fdcb4 drivers: intc_dw_ace: rename functions
No need for version functions, this will be used by multiple versions of
ACE.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
ede94516b0 drivers: intc_dw_ace: rename file
No need for the version in the file name, this will be used by multiple
versions of ACE.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
6c3277eada intel_adsp: ace: rename namespace: MTL -> ACE
MTL is just one platform and this code is going to be used in multiple
platforms currently under development, so reduce the confusion and move
to a common namespace.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
0869e62539 intel_adsp: cleanup ace_v1x-regs.h more and prep for removal
File still not being removed due to out-of-tree usage. We will drop it
once the external code has stopped referencing it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
52297422fc timer: intel_adsp: use DTS for hardware information
Convert timer driver to use a light weight syscon and DTS and convert
register information to use offsets and sys_read/sys_write instead of
structs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
059dc41cc6 intel_adsp: put interrupt defines in own headers/cleanup namespace
Cleanup soc.h and move interrupt defines into own headers. Rename some
of the defines for ACE to have a unified namespace.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Anas Nashif
100090832d drivers: intc: ace: use DW structure already defined in the driver
The DW register block was duplicated into the ACE header while we had
the same thing in the driver. Move everything to the driver as the first
step with further improvements planned on top of this.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 12:50:05 -04:00
Gerard Marull-Paretas
140f014bed drivers: clock_control: mcux_syscon: fix define collision
mcux HAL pollutes namespace with stuff like ARRAY_SIZE, MIN, MAX, etc.
Luckily it only defines them if not already defined, so we can play with
include order to "fix" the problem. Move the infamous soc.h (which
includes HAL) after other Zephyr includes.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
e4fdc2761a drivers: pinctrl: it8xxx2: add missing chip_chipregs.h
Include was missing for some register definitions.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
1992699e07 drivers: gpio: it8xxx2: add missing chip_chipregs.h/soc_common.h
Register definition header was missing, SoC common header as well (for
ite_intc_get_irq_num).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
ac63bca423 include: add missing sys_clock.h include
Some headers made use of types defined in sys_clock.h (e.g. k_timeout_t)
without including it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
357b362824 include: add missing sys/time_units.h include
Some files using time_units.h API did not include it, e.g. for
sys_clock_hw_cycles_per_sec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
edfa4f1324 include: add missing sys/arch_interface.h include
Some files were using arch interfaces (e.g. arch_curr_cpu) without
including necessary headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
597dd5901c include: add missing spinlock.h include
Some files are using the spinlock API without including the necessary
headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
4649e2347e include: add missing soc.h include
Some SoCs define stuff in soc.h, used in drivers or SoC code. Note that
soc.h is not introduced here as a catch-all header. soc.h optimizations
or removal is out of the scope of this patch.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
4ba74c2ec9 include: add missing limits.h include
Some files used definitions found in limits.h (e.g. INT_MAX) without
including it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
6a0f554ffa include: add missing kernel.h include
Some files make use of Kernel APIs without including kernel.h, fix this
problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
acc8cb4bc8 include: add missing irq.h include
Some modules use the IRQ API without including the necessary headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
e63b0bb3fe include: add missing errno.h include
With the incoming removal of kernel.h/types.h from init.h, lots of files
start to show compile errors because they relied on indirect
definitions, including errno.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
f7a5b47dff include: add missing devicetree.h include
Some files make use of DT APIs without including devicetree.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas
34a6848887 include: add missing arch/cpu.h include
The sys* ops like sys_clear_bit are indirectly included via arch CPU
header. Other stuff like find_msb_set end up included via this header as
well.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
David Leach
9e5ee5d998 drivers: gpio: remove pinmux dependency in lpc11u6x Kconfig
Previous commit removed pinmux from the platform but neglected to
remove the dependency in this Kconfig resulting in build failures
when target application configures GPIO support.

Fixes #51144

Signed-off-by: David Leach <david.leach@nxp.com>
2022-10-11 08:25:46 -05:00
Anas Nashif
3db1c59f44 ipm: intel_adsp: use memory window from DTS
Use memory window setup from DTS.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 08:28:25 -04:00
Anas Nashif
9cd53958ce intel_adsp: mem_window: rename defines CAVS_ -> ADSP_
Fix namespacing of memory window defines. Not all platforms are CAVS
based anymore.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 08:28:25 -04:00
Anas Nashif
46af0620b3 console: move winstream console to drivers/
This was all done as part of the soc and called from the soc. Define
this type of console under drivers/console and use it in the SoCs
supporting that via SYS_INIT instead of calling the console code
directly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 08:28:25 -04:00
Immo Birnbaum
29a9ffe777 drivers: ethernet: xlnx_gem: fix dev data access missed by #41918
Fixes a compiler error in eth_xlnx_gem_stats() caused by the
automated replacement of device run-time data pointer accesses
by #41918. The device run-time data access in eth_xlnx_gem_stats()
was likely missed as this function is not usually compiled - its
existance depends on CONFIG_NET_STATISTICS_ETHERNET being set.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-10-11 11:15:20 +02:00
Ole Morten Haaland
667a3f9de9 qspi: stm32: Add support for reset cmd on init
If the flash is used in 4-byte addressing, reading SFDP will fail after
a system reset if the flash isn't power cycled or hardware reset, since
Zephyr will try to use 3-byte addressing while the flash (still) expects
4-byte addressing.

This commit adds the ability to send a reset command to the flash as part
of initialization, which complements the existing reset-gpio
functionality, and is useful on low-pincount flashes which do not have a
hardware reset.

Signed-off-by: Ole Morten Haaland <omh@icsys.no>
2022-10-11 11:14:46 +02:00
Carles Cufi
e50a859625 drivers: sensor: qdec_nrfx: Fix build with no optimizations
The build of this driver fails when `CONFIG_NO_OPTIMIZATIONS=y` is set:

error: expression in static assertion is not constant
   98 |  BUILD_ASSERT(steps > 0, "only positive number valid");

error: expression in static assertion is not constant
   99 |  BUILD_ASSERT(steps <= 2048, "overflow possible");

Fix this by using a simple macro to avoid the compiler from getting
confused.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-10-11 11:07:28 +02:00
Dipak Shetty
e97e24e7a6 drivers: flash_mcux_flexspi_nor: Add block erase
Change reduces time consumed when a block needs to be erased.
The change was tested on a mimxrt1060_evk board.

Signed-off-by: Dipak Shetty <dipak.shetty@zeiss.com>
2022-10-10 13:23:12 -05:00
Daniel DeGrasse
9d7039f9e9 drivers: regulator: add regulator shell
Add shell for interacting with regulator devices, to enable
users to test power management settings quickly and verify that their
regulator is functioning as expected. Also allows users to interact with
regulator PMIC devices

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-10 13:13:27 -05:00
Gerson Fernando Budke
5c484e28f9 drivers: eth: sam0: Fix missing devicetree dependency
The #48905 introduce a regression on gmac ethernet driver. The GMAC
driver matches two compatibles. This add missing compatible for SAM0
variant.

Fixes: #50970.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-10-10 11:23:35 -05:00
Anisetti Avinash Krishna
8df2568a20 soc: x86: Clean up GPIO related defines
Clean up and refactor x86 SoC headers in preparation of adding
new platforms in the future.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2022-10-10 19:17:03 +03:00
Jay Vasanth
f87acb5bdd soc: arm: microchip: add common mec_gpio.h
add common mec_gpio.h to allow access to common gpio_regs
structure for both mec15xx and mec17xx, used in pinctrl driver

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-10-08 18:32:33 +02:00
Peter Mitsis
d308ca5695 drivers: timer: adsp: Improve elapsed ticks calculations
It is better to use 64-bit variable types for calculating the number
of elapsed ticks than 32-bit variable types. This guards against the
propagation of calculation errors should the lower 32-bits of the timer
counter roll over multiple times before the timer ISR is serviced.

(Such a scenario can easily occur when pausing the system for an
extended period of time with a debugging device such as a Lauterbach.)

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2022-10-07 18:34:50 -04:00
Robert Lubos
b76c35d809 modules: mbedtls: Replace select statement with depends on for EC
Instead of using "select" on certain EC configurations, which is
considered unsafe for various reasons, use a "depends on" and rely on
the user to set a proper configuration in the config file.

Update the respective project configurations to comply with the new
configuration scheme.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-10-07 15:12:42 +02:00
James Johnson
0eaff5a11d drivers: sensor: add ams AS621x Temperature Sensor driver support
Added support for the AMS AS621x series of temperature sensors as a
variant of the TI TMP108 temperature sensor.

Signed-off-by: Jared Baumann <jared.baumann8@t-mobile.com>
Signed-off-by: James Johnson <james.johnson672@t-mobile.com>
2022-10-07 10:01:47 +02:00
Jun Lin
ea066d35b0 driver: eSPI: drop interrupts enabling during driver initialization
Host interface interrupts should be enabled explicitly via eSPI API
after the eSPI configuration and callbacks are set.
If we enable them during driver initialization and the host sends a eSPI
transaction before the eSPI configuration and callbacks are set, we may
encounter unexpected behavior.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-10-07 10:01:09 +02:00
Esteban Valverde
c4be0c51de drivers: ethernet: adding support for Cyclone V SoC DK ethernet
Adding support for Cyclone V SoC ethernet device.

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-10-06 20:19:43 -07:00
Nick Kraus
05f3e87280 drivers: serial: Runtime Configure for SAM USART
Implements dynamic configuration for the atmet,sam-usart driver and
enables the new API calls if CONFIG_UART_USE_RUNTIME_CONFIGURE is set.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2022-10-06 22:37:54 +00:00
Nick Kraus
48559f6e2f drivers: serial: Runtime Configure for SAM UART
Implements dynamic configuration for the atmet,sam-uart driver and
enables the new API calls if CONFIG_UART_USE_RUNTIME_CONFIGURE is set.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2022-10-06 22:37:54 +00:00
Franciszek Zdobylak
64feccf23d drivers: flash: shell: Add flash shell tools
This commit adds two new commands to flash shell tools: flash load and
flash page_info.

Signed-off-by: Franciszek Zdobylak <fzdobylak@internships.antmicro.com>
2022-10-06 22:35:57 +00:00
Gerard Marull-Paretas
d1686dfbfb drivers: gpio: it8xxx2: log error instead of printing
printk must not be used to log, we have log API for that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-06 15:35:00 +02:00
Gerard Marull-Paretas
97ef197d05 include: add missing zephyr/ prefix
Some files still manage to get into the tree without the zephyr/ include
prefix (likely because they lack CI coverage).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-06 10:41:02 +02:00
Jaska Uimonen
ec0ec72428 drivers: dai: intel: dmic: misc fixes and changes
Fix misc issues and warnings found with sof native drivers compilation.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-10-05 12:41:45 +02:00
Jaska Uimonen
88941a1f71 drivers: dai: intel: dmic: add cavs15 and 25 support
Add support for older platforms like cavs15 and 25 into intel dmic dai.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-10-05 12:41:45 +02:00
Jaska Uimonen
4ee1386fd2 drivers: dai: intel: dmic: use fifo address from devicetree
Use fifo address from device tree to create the device structs.
Also modify shim initialization as it was changed from array to
int. Fix cosmetic tab in device init macro.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-10-05 12:41:45 +02:00
Attie Grande
de18f97f42 drivers: i2c: sam0: Resolve spurious trailing 0xff on reads
Previously, the I2C bus would have an extended idle period on write
operations, and a spurious trailing byte on read operations (after a
final NACK).

This patch relocates the issuance of the stop condition from the driving
thread's context, into the ISR.

Thanks to @benediktibk for discovery and initial patch.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-10-04 19:16:02 +00:00
Jay Vasanth
f6e2cb9b84 drivers: uart: microchip: add support for mec15xx
update uart mchp xec driver to support mec15xx and add
pinctrl support for mec15xx uart

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-10-04 09:21:58 -05:00
Andrei Emeltchenko
a657abae23 espi: Fix gpio_manage_callback() logic
espi_manage_callback() returns -EINVAL if it could not remove
callback. However if the list is empty success is returned when trying
to remove callback.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-10-04 14:10:05 +00:00
Andrei Emeltchenko
005a4d8a31 gpio: Fix gpio_manage_callback() logic
gpio_manage_callback() returns -EINVAL if it could not remove
callback. However if the list is empty success is returned when trying
to remove callback.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-10-04 14:10:05 +00:00
Andrei Emeltchenko
9de7cb4147 eeprom: shell: Add device autocompletion support
Add autocompletion for device names.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-10-04 14:08:09 +00:00
Jan Hilsdorf
c888d6a365 drivers: pwm: rpi_pico: Use “pico_channel” instead of “ch”
pwm_set_chan_level uses slice channels A(=0) or B(=1) and not Zephyr
channel (0..15). So PWM doesn't work for channels > 1. There is already
a function (pwm_rpi_channel_to_pico_channel) which does the right thing,
but it isn't used for pwm_set_chan_level.

Signed-off-by: Jan Hilsdorf <jan.hilsdorf@gmail.com>
2022-10-04 10:36:20 +02:00
Lucas Tamborrino
a29ebef6ce drivers: spi: esp32c3: add DMA support
Add SPI DMA support for esp32c3.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-10-04 10:35:14 +02:00
Lucas Tamborrino
a11a103518 drivers: spi: esp32/s2: add DMA support
Add SPI DMA support for esp32/s2.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-10-04 10:35:14 +02:00
Gerard Marull-Paretas
cfd3560e1b device: s/Z_DEVICE_DT_DEV_NAME/Z_DEVICE_DT_DEV_ID
Rename Z_DEVICE_DT_DEV_NAME to Z_DEVICE_DT_DEV_ID to make it more clear,
as the macro is generating a token that identifies the created struct
device.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-04 10:13:34 +02:00
Bartosz Bilas
57310cba87 arm: nxp: take PWM prescaler from device tree
Replace the hardcoded kPWM_Prescale_Divide_128
driver prescaler with the ones defined in the dtsi file
that allow overriding them by the user.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-10-03 15:04:31 -05:00
Nick Ward
0ad0af70ef drivers: pwm: Use a common initialization priority
As per other peripheral driver types.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2022-10-03 15:24:38 -04:00
TOKITA Hiroshi
fd1dfceb95 drivers: watchdog: Add GD32 Window watchdog timer driver
Add support for GD32 Window watchdog timer.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-10-03 18:07:16 +02:00
TOKITA Hiroshi
3b6e9743b7 drivers: watchdog: Add GD32 Free watchdog timer driver
Add support for GD32 Free watchdog timer.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-10-03 18:07:16 +02:00
Andriy Gelman
072a428f78 drivers: flash: Add xmc4xxx flash drivers
Add xmc4xxx flash drivers.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-10-03 13:56:49 +02:00
Josia Strack
ba7eb1025a drivers: gpio: Add driver for pcf8574
Adds a driver for pcf8574 via i2c.

Signed-off-by: Josia Strack <josia.strack@ithinx.io>
2022-10-03 13:56:32 +02:00
Wojciech Slenska
003ee34593 drivers: adc: stm32: removed duplicated code
The same code exist few lines above, this is probably merge error.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2022-10-03 10:20:21 +02:00
Anas Nashif
a5bd666f4e lib: notify: build sys-notify conditionally.
Add a new Kconfig and build this code conditionally, so we do not end up
with this file being built for each zephyr app.

Partial fix for #50654

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-03 10:18:15 +02:00
Anas Nashif
a81b322828 lib: onoff: add a config for on-off and build conditionally
Do not build this service unconditionally.

Partial fix of #50654

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-03 10:18:15 +02:00
Jun Lin
a55c9f8ce7 driver: kscan: npcx: add driver support for kscan
Add keyboard scan driver support.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-10-03 10:14:51 +02:00
Pieter De Gendt
ff8a90b1de drivers: gpio: Add SDL emulated GPIO support
This commit adds a driver to simulate GPIO state and interrupts
using the keyboard when using SDL.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-10-03 10:12:03 +02:00
Pieter De Gendt
bd71698a66 drivers: gpio: pca953x: select I2C
Select I2C instead of depending on it, following upstream policy.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-10-03 10:12:03 +02:00
Pieter De Gendt
70e99fe575 drivers: sensor: lis2dh: Configurable latch and mode for any movement
Add 2 properties to configure the "any movement" event.
* Ability to disable the interrupt latch
* Select movement mode

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-10-03 10:11:45 +02:00
Valerio Setti
1b78f2dfbd drivers: sensor: adding driver for STM32 quadrature encoder
This driver configures STM32's internal timers in order to use
the quadrature encoder mode.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-10-03 10:10:31 +02:00
Peter Marheine
5eb75b81f7 arm: rename default RAM region from 'SRAM' to 'RAM'
It's useful for RAMABLE_REGION to have a uniform name when
CODE_DATA_RELOCATION is supported, because otherwise the build system
needs to be aware of how the region name differs between architectures.
Since architectures tend to prefer one of 'SRAM' or 'RAM' for that
region, prefer to use 'RAM' as the more general term.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
2022-10-03 10:09:53 +02:00
Dominik Chat
67c6f26c93 sensor: Refactor bmi270 driver data names
Make driver data names consistent in code.

Signed-off-by: Dominik Chat <dominik.chat@nordicsemi.no>
2022-10-03 10:06:46 +02:00
Dominik Chat
6cbb84c3ee sensor: dts: Add SPI capability to bmi270 driver
Added SPI bus support for BMI270 gyroscope driver.

Signed-off-by: Dominik Chat <dominik.chat@nordicsemi.no>
2022-10-03 10:06:46 +02:00
Adrian Bonislawski
87954ad12f drivers: dai: alh: fill fifo depth in dai properties
This will fill missing field in dai properties

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-10-01 14:54:43 -04:00
Adrian Bonislawski
4968b687c0 drivers: dai: dmic: fill fifo depth in dai properties
This will fill missing field in dai properties

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-10-01 14:54:43 -04:00
Adrian Bonislawski
c3659da65a drivers: dai: alh: set rate and channels from config blob
This will use config blob to set rate and channels params

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-10-01 14:54:43 -04:00
Adrian Bonislawski
e7f32329ba drivers: dai: alh: enable ownership control for ACE
Enable ownership control for ACE by default

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-10-01 14:54:43 -04:00
Adrian Bonislawski
40db94b8a4 drivers: dai: ssp: enable power control for ACE
Enable power control for ACE by default

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-10-01 14:54:43 -04:00
Ederson de Souza
edd524b4e3 drivers/mm: Add API to query memory regions
Some systems may need to query the available memory regions in runtime.
For those, this patch adds a simple API that memory management drivers
can implement to provide such discovery.

A small test also added to exercise the default, empty implementation.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-10-01 14:52:29 -04:00
Grant Ramsay
897952370e drivers: ethernet: Add ESP32 Ethernet driver
This is to enable ESP32 Ethernet support

Signed-off-by: Grant Ramsay <grant.ramsay@hotmail.com>
2022-10-01 14:51:28 -04:00
Grant Ramsay
113f868ddf drivers: mdio: Add ESP32 MDIO driver
The MDIO driver is required to for ESP32 Ethernet

Signed-off-by: Grant Ramsay <grant.ramsay@hotmail.com>
2022-10-01 14:51:28 -04:00
Adrian Bonislawski
e5e7ee88a3 dma: gpdma: fix channel config
This will use DW_CFGH_DST instead of DW_CFGH_DST_PER
to correctly setup cfg_hi. This is critical for ALH transfer.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-30 15:18:20 +00:00
Adrian Bonislawski
9bb0b6dba2 dma: gpdma: fix llp config
This will setup llp config properly with dma_slot

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-30 15:18:20 +00:00
Adrian Bonislawski
feffb245fa dma: hda: fix buffer address for hda link
This will set correct buf address for hda link in&out

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-30 15:18:20 +00:00
Adrian Bonislawski
7eeeff5ce9 dma: hda: trigger link commit at dma_start
This will trigger link commit immediately after start
to fix hda start flow.
Applies to link out only.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-30 15:18:20 +00:00
Adrian Bonislawski
8c90c40c0e dma: hda: add suspend api for hda link
For HDA link suspend is exactly the same as stop
but the same api is used also to control gpdma with unique suspend

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-30 15:18:20 +00:00
Andrei Emeltchenko
2e56f955db trivial: Remove empty files
Remove empty files.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-30 09:41:55 +00:00
Dino Li
db50a7aca7 drivers: gpio: it8xxx2: add support for GPIO_DISCONNECTED flag
This change was made to support the flag.
fixes: #50681

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-09-29 14:33:53 +00:00
Daniel Leung
4bbd3c7ef5 interrupt_controller: intc_dw_ace_v1x: fix multi-level IRQs
Zephyr encodes multi-level interrupts in a certain way, and
the driver is not utilizing the encoding correctly. So fix
it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-29 10:15:53 +00:00
Thad House
f37db90541 drivers: Correct tx and rx error counts in mcan
TX and RX error counts are swapped in the mcan driver.

Signed-off-by: Thad House <thadhouse@fb.com>
2022-09-28 20:34:36 +00:00
Adrian Bonislawski
62b01ff061 drivers: dai: ssp: fix mdivr register for ACE platform
Set correct offsets for CAVS&ACE

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-09-28 14:07:19 +00:00
Sylvio Alves
82bd341018 drivers: gpio: esp32: fix error when using input only pins
Input pins in ESP32 (34 to 39) have no pull-up / pull-down internally.
Current behavior is that gpio driver fails when "disabling it", which
should not happen. It need to fail only when enabling this feature.

Fixes #50615

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-28 07:52:29 +00:00
GUITTER Pierrick
2ef94ec479 drivers: gsm_ppp: fix modem_cmd_handler_tx_lock
Remove modem_cmd_handler_tx_lock lock when CONFIG_GSM_MUX
is disabled, as modem_cmd_handler_tx_unlock is under the same
conditions.

Signed-off-by: GUITTER Pierrick <pguitter@silicom.fr>
2022-09-27 14:12:57 +00:00
Dino Li
68d08980af it8xxx2: intc: make sure IER disabling to take effect.
Add fake read to synchronize interrupt enable register (IER)
of SOC before enabling global interrupt.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-09-27 10:05:09 +00:00
Jan Peters
a80fa5163b drivers: serial: uart_mcux_lpuart: fix IRQ-driven API with ASYNC_API
this allows usage of the interrupt-driven API when CONFIG_UART_ASYNC_API
is enabled.

Signed-off-by: Jan Peters <peters@kt-elektronik.de>
2022-09-27 10:04:10 +00:00
Jose Alberto Meza
bccc4e62f2 drivers: adc: xec: Handle incomplete ADC channel conversions
Report an error when the ADC # channels conversion is not
complete.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-09-26 08:07:37 +00:00
Marcin Niestroj
1b0d97574a wifi: esp32: remove unused ESP32_WIFI_{SSID,PSK}
Those Kconfig options are no longer used after ESP32 WiFi driver was
converted to Zephyr WiFi mgmt and the removal of platform specific
`samples/boards/esp32/wifi`.

Fixes: d524015f82 ("samples: boards: remove esp32 wifi sample code")

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-26 08:05:58 +00:00
Marcin Niestroj
35ba982d84 wifi: esp32: make ethernet carrier on after ESP32_WIFI_EVENT_STA_START
Driver is not ready to handle NET_REQUEST_WIFI_CONNECT wifi_mgmt events
before ESP32_WIFI_EVENT_STA_START event is received. Revert back to setting
NET_IF_NO_AUTO_START flag for interface and call net_eth_carrier_on() after
ESP32_WIFI_EVENT_STA_START event is received. This makes it possible for an
application to wait for network interface to be ready, e.g. with:

  while (!net_if_is_up(iface)) {
     k_sleep(K_MSEC(100));
  }

before making a connect request with:

  net_mgmt(NET_REQUEST_WIFI_CONNECT, iface ...).

Fixes: 7d9edc8bf0 ("wifi: esp32: add support to wifi api mgmt")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-26 07:58:09 +00:00
Henrik Brix Andersen
6d08944ac1 drivers: can: mcp2515: abort transfers before entering configuration mode
Abort any pending transmissions before entering configuration mode and
notify the senders.

Poll for mode change completion instead of assuming mode changes take
immediate effect. This is needed for successfully entering configuration
mode with recently aborted transmissions.

Fixes: #50545

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
f239c3d0e9 drivers: can: stm32: abort transfers after entering init mode
Abort any pending transmissions after entering init mode and notify the
senders.

Fixes: #50545

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
6cf34d0d33 drivers: can: mcan: notify of aborted transmission on can_stop()
Notify of any aborted transmission when entering init mode via can_stop().

Fixes: #50545

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
b8eb11de3b drivers: can: mcux: flexcan: abort transfers before entering freeze mode
Abort any pending transmissions before entering freeze mode and notify the
senders.

Fixes: #50545

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
94d4638ccc drivers: can: sja1000: notify of aborted transmission on can_stop()
Notify of any aborted transmission when entering reset mode via can_stop().

Fixes: #50545

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
a99a55eefb drivers: can: npl: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
50d77ab854 drivers: can: mcan: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

This saves approximately 500 bytes of SRAM on the lpcxpressso55s16 board
when running in default configuration.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
d3427d991a drivers: can: rcar: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
10cd28a61a drivers: can: loopback: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
4165186d13 drivers: can: stm32: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
78d6ba5ce3 drivers: can: mcp2515: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
eb06e6aed0 drivers: can: sja1000: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
fcf7c6e6d1 drivers: can: mcux: flexcan: assume can_send() always provides callback
Given the recent change to the CAN controller can_send() API wrapper,
assume that a callback is always provided at the driver level.

This saves approximately 500 bytes of SRAM on the frdm_k64f board, while on
the mimxrt1024_evk board the saving is approximately 2.5 kbytes of SRAM,
both when running in default configuration.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Henrik Brix Andersen
d6fc3f6596 drivers: can: provide default callback to can_send() if NULL
Provide a default, internal callback to CAN controller drivers
implementation of can_send() if no callback was provided by the caller.

This allows for simplifying the CAN driver implementations of can_send() as
these no longer need special handling for callback/no callback operation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-23 17:25:01 +00:00
Francois Ramu
dca9c2b165 drivers: adc: stm32f3 adc driver set common clock to HCLK
Set the synchronous clock mode to HCLK/1 (DIV1) or HCLK/2 (DIV2)
Both are valid common clock setting values.
The HCLK/1 (DIV1) is possible only if the ahb-prescaler = <1>
in the RCC_CFGR (see DTS).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-23 10:47:23 +00:00
William MARTIN
8bbe016f46 drivers: Fix BMI270 initialization
On power on reset, after disable advanced power safe mode,
you need to wait a delay before write again in the device.
The missing wait produce random initialization failure.
See §4.4 of the datasheet "bst-bmi270-ds000.pdf"

Signed-off-by: William MARTIN <william.martin@power-lan.com>
2022-09-23 12:08:24 +02:00
Tomasz Moń
8c7eba346a driver: usb_dc_sam_usbhs: Restore EP0 after detach
SAM V71 Xplained Ultra failed to re-enumerate on the bus after device
detach-attach sequence. The device was recognized by the host, but it
was not responding to control transfers, i.e. it was not acknowledging
SETUP data. Make device acknowledge SETUP data by reconfiguring EP0
when necessary.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-09-23 11:52:18 +02:00
Tomasz Moń
37705bc554 driver: usb_dc_sam_usbhs: Actually set detach bit
Device physically detaches when the DETACH bit is set. Fix the
assignment to actually set the bit instead of clearing it.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-09-23 11:52:18 +02:00
Gerhard Jörges
1e87837f2a drivers: spi: pl022: fix dropping RX bytes
If the thread that submits data over spi is interrupted by a higher
priority thread while pushing data to the tx fifo the hardware pushes
data to spi and frees up space in the fifo. In this case more than
8 Bytes are written to the tx fifo and bytes in the rx fifo get lost
before they are collected in the rx while loop.
To avoid this, the tx loop is exited after a maximum of 8 bytes and the
rx loop will run until it collected all bytes from the rx fifo.

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2022-09-22 17:16:45 +02:00
Francois Ramu
6507afd07e drivers: adc: driver for stm32wl configure sampling
This Commit makes the adc configuration correct
for using the adc with 12b conversion on the stm32wl.
TriggerSource must be set to SW.
The ADC clock must be disabled by clock gating during CPU1 sleep/stop.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-22 15:06:20 +00:00
Tim Lin
3474ba919f ITE: drivers/i2c: FIFO2 can be selected to support channel of B or C
FIFO2 can be selected to support channel of B or C by dtsi.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-09-22 14:58:42 +00:00
Tim Lin
c30ec3ba4d ITE: drivers/i2c: Rename the parameter in data struct
Rename the parameter in data struct to avoid confusion.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-09-22 14:58:42 +00:00
Tim Lin
de1fc0ca89 ITE: drivers/i2c: Fix the bug of msgs in I2C transfer
1. To explicitly set the MSG_START flag on the first message.
2. Remove redundant declare.
3. Using data->msgs->flags is the correct address instead of
   msgs->flags.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-09-22 14:58:42 +00:00
Fabio Baltieri
7b64f63139 drivers: kscan_ite_it8xxx2 fix wrong comment reference
The note refers to the wrong API, that has been replaced by a pinctrl
call, update the comment.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-09-21 13:54:54 -05:00
Daniel DeGrasse
5980aa0196 drivers: gpio: gpio_mcux_igpio: handle gpio-reserved-ranges property
Add code to handle parsing the gpio-reserved-ranges property present on
iMX GPIO controllers, so that gpio controllers with gaps in their pin
indexing can still have pinmux settings applied correctly.

Fixes #50142

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-09-21 13:50:26 -05:00
Antoniu Miclaus
9dda350e24 drivers: sensor: adxl372: update driver
Handle SPI/I2c interface in the dts.

Support multiple instances.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
2022-09-21 18:40:06 +00:00
Erwan Gouriou
2d740d42e0 drivers: timer: stm32_lptim: Change clock source config check sanction
A specific check is implemented lptim driver in order to ensure global
platform clock/tick configuration is in line with recommendations.
To respect portability principles, don't error out when a config
conflict is detected but generates a warning instead.
Also, since these are only recommendations, provide an option to override
the check. Besides automatically override when ZTEST is enabled, as some
kernel tests specifically configure tick freq to 100.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-21 18:39:07 +00:00
Jay Vasanth
d6ba6a5fac spi: mec15xx: add pinctrl for mec15xx/mec1501 qmspi
Remove pinmux calls and add pinctrl support for mec15xx
and mec1501 qmspi. Update board dts, pinmux and driver files.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-09-21 18:05:32 +00:00
Jay Vasanth
a2de15e5cc adc: mec15xx: add pinctrl for mec15xx/mec1501 adc
Remove pinmux calls and add pinctrl support for mec15xx
and mec1501 adc. Update board dts, pinmux and driver files.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-09-21 18:05:32 +00:00
Jay Vasanth
d684425d4d i2c: mec15xx: add pinctrl for mec15xx/mec1501 i2c
Remove pinmux calls and add pinctrl support for mec15xx
and mec1501 pwm. Update board dts, pinmux and driver files.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-09-21 18:05:32 +00:00
Jay Vasanth
e46c56e117 espi: mec15xx: add pinctrl for mec15xx/mec1501 espi
Remove pinmux calls and add pinctrl support for mec15xx
and mec1501 espi. Update board dts, pinmux and espi driver
files.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-09-21 18:05:32 +00:00
Jaxson Han
f11e6d9c23 drivers: gicv3: Refine the rdist matching function
Introduce a function to do the matching job. Add the config for some
platforms to match the mpdir with aff0 only.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2022-09-21 15:21:29 +02:00
Jaxson Han
2866e2a4cc drivers: gicv3: Introduce aff0 matching config for rdist
Some platforms only use aff0 to match mpdir and GICR.aff. Introduce
GIC_V3_RDIST_MATCHING_AFF0_ONLY to set the matching method only using
aff0. With this config enabled, the matching function will find the
target redistributor by comparing the aff0 only.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2022-09-21 15:21:29 +02:00
Tomasz Moń
0d4aa49766 drivers: usb_dc_nrfx: Do not uninit endpoints on detach
Sometimes it is desired for the USB device to detach and reattach itself
to the host. USB device controller driver interface supports detach with
usb_dc_detach() function. Subsequently the device can be reattached to
the bus by calling usb_dc_attach().

USB device stack sets the control transfer callbacks in usb_enable().
Nordic usb_dc_detach() implementation inadvertedly overwrote registered
callbacks with zeroes by clearing endpoint configuration structure. This
lead to a NULL pointer dereference during enumeration after device has
reattached inself to the host.

Preserve the callbacks by removing the eps_ctx_uninit() function.
Endpoints runtime data is initialized in usb_dc_attach() so this should
pose no problems.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-09-21 12:56:39 +02:00
Enjia Mai
24f989cd90 drivers: ioapic: fix the cast for the offset
The cast for the offset variable will make incorrect register
access when it is over 0x80. Change the char cast to unsigned
char to fix it.

Fixes #49803.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-21 12:28:30 +02:00
Francois Ramu
4c36f3aeaf drivers: adc: stm32 driver enabling adc for the stm32U5
The ADC of the stm32U5 should also waits for the ready Flag
before enabling the peripheral, then wait for the ready Flag
set.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-21 08:57:58 +00:00
Henrik Brix Andersen
5ec7acca86 drivers: can: rcar: remote transmission request filters are not supported
The receive path for the Renesas R-Car CAN controller supports two RX
FIFOs, which are currently configured for standard 11-bit CAN ID data
frames in FIFO0, and extended 29-bit CAN ID data frames in FIFO1.

As this leaves no room for matching remote transmission request (RTR)
frames, have the driver return -ENOTSUP instead of silently accepting RTR
filters.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-21 08:50:47 +00:00
Erwan Gouriou
e1cb0845b4 drivers: gpio: stm32: Apply GPIOG specific code to U5 series
In STM32U5 as well it is required to enable VDD before use.
Difference is that U5 enables this under PWR_SVMCR_IO2SV flag.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-20 10:00:02 +00:00
Steven Slupsky
32f4f8d987 drivers: usb: usb_dc_sam0: fix memory leak
The usb_dc_sam0 driver is leaking memory when the usb device is detached
using usb_disable().

When a device is detached, the driver does not reliably deallocate the
descriptor bank memory. Therefore, upon the next attach and configure,
another block of memory is allocated. After several connect /
disconnect sequences, the usb interface becomes unresponsive.

This commit adds a static function to release all memory allocated
to the ep descriptors when usb_dc_detach() is called.  Since detach is
called from usb_disable(), this releases the memory when the
interface is disabled.

Avoid calling k_free() if buffer pointer is already
set to NULL.

Fixes #49177

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
2022-09-19 15:20:53 -05:00
Sylvio Alves
e4969ec52e drivers: esp32: add check for absolute alarm configuration
ESP32 counter based on Timer or RTC misses the
COUNTER_ALARM_CFG_ABSOLUTE flag check.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-19 18:37:28 +02:00
Andrzej Głąbek
6d8172f4e9 drivers: pinctrl_nrf: Configure QSPI CSN pin as output set high
... so that the pin keeps the inactive state of the CSN line when it is
not controlled by the QSPI peripheral and the driver is not suspended.

Currently, the nrf_qspi_nor shim deinitializes the nrfx_qspi driver
after each operation, what leaves the pin uncontrolled until a new
operation is requested (and the nrfx_qspi driver is initialized again)
or the driver is suspended (and the pin is put into low-power state).
This can cause the flash chip to needlessly consume current when there
is no pull-up resistor on its CSN line and the line appears active.
Prevent this by keeping the pin in a defined (inactive) state.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-09-19 15:30:02 +02:00
Andrzej Głąbek
3a6584b0ae drivers: i2c_nrfx_twim: Fix compilation with disabled PINCTRL
This is a follow-up to commits 9974bb043f
and 00ecc66677.

Add one missing `#ifdef CONFIG_PINCTRL` and remove a no longer needed
one to restore the possibility to use this driver without PINCTRL.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-09-19 12:52:16 +02:00
Mahesh Mahadevan
4c30c82ead clock: mcux: Use FSL_FEATURE_MCG_FFCLK_DIV to conditionalize
Use the FSL_FEATURE_MCG_FFCLK_DIV define to decide if we should
call the api to get Fixed Frequency Clock.

This fixes Issue #49924

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-09-16 13:21:04 -05:00
Francois Ramu
9926b90bf6 drivers: uart: stm32 uart driver must include ll_exti with CONFIG_PM
Missing include to compile correctly when the
CONFIG_PM && IS_UART_WAKEUP_FROMSTOP_INSTANCE are defined

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-16 10:49:18 +00:00
Andrzej Puzdrowski
102583ab7f drivers/flash: move JESD216 option into FLASH
This option is part of FLASH API configuration.
I moved it where it belongs.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-09-16 08:41:40 +00:00
Jeremy Bettis
bf845a273b gpio_emul: Fail at build time if ngpios is too big
Add BUILD_ASSERT to check max val of ngpios. If someone sets ngpios to
more than 32, and acts on pin 32 or higher, memory corruption will
result. This is only a problem with the emulator, real hardware
will have limits that are probably much smaller.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2022-09-16 09:02:01 +01:00
Thomas Stranger
5521c53848 drivers: wifi: esp32: sp32_wifi_ap_enable: fix ret value overwritten
The return values of esp_wifi_set_mode(), and esp_wifi_set_config() were
overwritten once esp_wifi_start() is executed.

This commit fixes that by ORing the return value to the others.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-15 17:26:31 +01:00
Sylvio Alves
b801a83d92 drivers: gpio: esp32: fix missing rtcio pin mapping
PR #49550 missed adding proper RTCIO pin mapping
in a few rtcio functions calls, which causes board
to crash. This fixes it.

Closes #50238

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-15 17:26:18 +01:00
Thomas Stranger
fc33325fc7 drivers: can: native_posix_linux: drop rx frames while stopped
The driver should drop rx frames while in stopped state.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-15 16:20:04 +00:00
Thomas Stranger
0c365ac0ea drivers: can: mcan: don't enabled trasceiver in init
With the move to start/stop functions the transceiver is not expected
to be enabled after driver initialization.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-15 16:19:32 +00:00
Francois Ramu
0e119b53c6 drivers: serial: stm32 uart driver set EXTI line for wakeup from lowPower
The USART or LPUART, especially on stm32wl, must set the EXTI
lines corresponding to the wakeUp source.
This LL_EXTI_LINE_xx is given by the Device Tree property.
This makes the system exiting lowpower stop mode on EXTI irq.
The LL_EXTI_LINE_x is exactly the bit(X) set.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-15 15:02:47 +00:00
Xinyang Tan
904181a6a9 drivers: flash: spi_nor: fix driver initialization error
Fix the issue that the initialization will fail when both
CONFIG_SPI_NOR_SFDP_RUNTIME and CONFIG_SPI_NOR_IDLE_IN_DPD are enabled.
The cause of this problem is simply calling the wrong function.

Fixes #33015

Signed-off-by: Xinyang Tan <xinyang.tan@delve.com>
2022-09-14 16:13:35 +01:00
Lauren Murphy
85445474f2 boards, dts: fix filenames and dts refs for adsp clock
Changes filenames and DTS references from CAVS clock to
ADSP clock.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2022-09-14 07:23:08 -04:00
Lauren Murphy
1983a4c50c boards, dts: fix namespace for intel adsp cavs, ace
Fixes namespace for Intel ADSP CAVS and ACE boards.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2022-09-14 07:23:08 -04:00
Attie Grande
c75fe75a23 drivers: lora: Return error from lora_send()
Previously, the lora_send() function would have returned zero regardless
of any error encountered while waiting for the transmit to complete.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-09-14 09:34:40 +00:00
Henrik Brix Andersen
6f1ff5ea83 drivers: can: shell: add CAN start/stop shell commands
Add shell commands for starting/stopping a CAN controller.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-13 16:06:50 +00:00
Henrik Brix Andersen
180cdc105e drivers: can: add start and stop CAN controller API functions
Up until now, the Zephyr CAN controller drivers set a default bitrate (or
timing) specified via devicetree and start the CAN controller in their
respective driver initialization functions.

This is fine for CAN nodes using only one fixed bitrate, but if the bitrate
is set by the user (e.g. via a DIP-switch or other HMI which is very
common), the CAN driver will still initialise with the default
bitrate/timing at boot and use this until the application has determined
the requested bitrate/timing and set it using
can_set_bitrate()/can_set_timing().

During this period, the CAN node will potentially destroy valid CAN frames
on the CAN bus (which is using the soon-to-be-set-by-the-application
bitrate) by sending error frames. This causes interruptions to the ongoing
CAN bus traffic when a Zephyr-based CAN node connected to the bus is
(re-)booted.

Instead, require all configuration (setting bitrate, timing, or mode) to
take place when the CAN controller is stopped. This maps nicely to entering
"reset mode" (called "configuration mode" or "freeze mode" for some CAN
controller implementations) when stopping and exiting this mode when
starting the CAN controller.

Fixes: #45304

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-13 16:06:50 +00:00
Florian Grandel
2a6d82b2d8 drivers: console: rtt_console: undefined reference
Disabling PRINTK with RTT enabled caused a compile error (undefined
reference to __printk_hook_install').

Fixes: #50108

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-09-12 15:08:47 +01:00
Daniel Leung
34ccd88c12 sensor: lps22hh: extend to support being on I3C bus
This extends the lps22hh driver to support being on I3C bus.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Daniel Leung
eb9cd9242c sensors: stmemsc: add I3C access functions
This adds I3C access functions so that STM sensors connected
on I3C bus can utilize I3C.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Daniel Leung
3e8f97009d i3c: add I3C controller driver for MCUX
This adds a very basic driver to utilize the I3C IP block
on MCUX (e.g. RT685). Note that, for now, this only supports
being the active controller on the bus.

Origin: NXP MCUXpresso SDK
License: BSD 3-Clause
URL: https://github.com/zephyrproject-rtos/hal_nxp
Commit: 2302a1e94f5bc00ce59db4e249b688ad2e959f58
Purpose: Enabling the I3C controller on RT685.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Daniel Leung
66a9a15104 i3c: add a global workqueue for IBI
Adds support for a global workqueue so drivers can defer
IBI callbacks instead of doing it in interrupt context.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Daniel Leung
ce7058d2f5 drivers: i3c: introduce I3C API for controllers
This introduces the I3C API for I3C controllers. Currently,
this supports one controller per bus under Zephyr.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-09-09 17:42:33 -04:00
Ivan Herrera Olivares
2c2b8c3422 SD: Implement sdhc_card_busy in SDHC SPI-driver
Currently, the sdhc_card_busy function is unimplemented in the
SDHC SPI-driver. This causes some functions which rely on f_sync(),
such as fs_close(), to fail as it will timeout the busy-check. This PR
implements sdhc_card_busy by checking if the MISO-line is kept high to
check if the SD-card is idle (not busy).

Solves https://github.com/zephyrproject-rtos/zephyr/issues/49982

Signed-off-by: Ivan Herrera Olivares <ivan.herreraolivares@uantwerpen.be>
2022-09-09 16:32:52 -04:00
Hu Zhenyu
3f9131ff5f tests: Enable the counter_basic_api test on mec172x board
1. enable timer5 on dts
2. Replace all BTMR_Type with struct btmr_regs, to make it compatiable
   on both mec 15 and 17
3. As MEC15 and MEC17 have different ways to access the register, use
   "#if defined" to access counter_cfg->girq_id on different board.

Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
2022-09-09 16:32:07 -04:00
Nick Kraus
dd1d367f34 driver: usb_dc_sam_usbhs: Initialize Endpoint FIFO
Ensure that the FIFO of each endpoint is initialized during endpoint
configuration, to prevent a NULL FIFO from being encountered during the
first call to usb_dc_ep_write() for a given endpoint.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2022-09-09 16:31:43 -04:00
Mulin Chao
839031271f driver: espi: npcx: add the controller attached flash sharing API
Add the flash channel support by implementing the controller attached
flash sharing APIs, including flash_read, flash_write, and flash_erase.
For flash_read, the max data payload the module can support is 64 bytes
in one transaction.
For flash_write, the max data payload the module can support is 16
bytes in one transaction.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-09-09 16:30:51 -04:00
Andriy Gelman
888a17cfda drivers: serial: uart_xmc4xxx: Use pinctrl driver
Use xmc4xxx pinctrl in uart driver.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-09-09 16:28:41 -04:00
Andriy Gelman
5feae0eafc drivers: pinctrl: Add pinctrl driver for xmc4xxx
Add pinctrl driver for infineon xmc4xxx devices.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-09-09 16:28:41 -04:00
Andriy Gelman
105cd84eb7 drivers: serial: uart_xmc4xxx: Get input source from dts
Get input source config from devicetree.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-09-09 16:28:41 -04:00
Pierre-Emmanuel Novac
0e510cc2a6 drivers/clock_control: stm32: Configure and enable PLL2
DT node "st,stm32f105-pll2-clock" already exists but was not actually used
and PLL2 was not being configured.
PLL2 is available on STM32F105/F107 and should be turned off after turning
off PLL and turned on before turning on PLL again since PLL2 can be
used as a source for PLL. Source for PLL2 is always HSE.

Signed-off-by: Pierre-Emmanuel Novac <piernov@piernov.org>
2022-09-09 16:28:15 -04:00
Flavio Ceolin
45465708f0 soc: intel_adsp: Add ACE soc series
ACE15_MTPM is one SOC from the ACE series. Organize
it following cavs pattern.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-09-09 16:03:59 -04:00
Jamie McCrae
c56b45c3e8 mgmt: mcumgr: Fix output packet to frame issue on serial transport
Fixes an issue with outgoing mcumgr frames that are larger than the
transport MTU size whereby they would wrongly be split up into multiple
frames with multiple start frame headers, which affected SMP over
console transports.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-09-09 19:47:12 +00:00
Gerson Fernando Budke
6d5cdc17b4 drivers: ieee802154: rf2xx: Add support to Sub-Giga
Add support to at86rf212[b] sub-giga devices. This work enables use of
pages 0, 2 and 5 in accordance with IEEE-802.15.4/2003/2006/2011. The
proprietary speeds can be object of future work.

Note: It is recommended that user define a power table for better
performance, low emissions and to save power. A reference power table
can be found in the datasheet and should be used for tests only and
not on a final product.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-09-09 10:31:35 -07:00
Gerson Fernando Budke
65960c4d32 drivers: ieee802154: rf2xx: Move power table to devicetree
The current version of power table is hardcoded in the driver which is a
problem when use devices in production. This change remove all hardcode
from driver and reimplement the feature to allow people create a table
which is defined in devicetree. The big advantage is that each board can
define their own table based on lab tests and allows use of FEM devices
inclusive.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-09-09 10:31:35 -07:00
Huifeng Zhang
68b10e8572 drivers: intc_gicv3: fix gic_rdists[cpu] points to a wrong address
In old way, gic_rdists[cpu] is calculated via MPIDR_TO_CORE(), but in
real hardware, MPIDR_TO_CORE() isn't a value increment from 0 one by
one, and that will lead gic_rdists[cpu] to point to a wrong address.

GICv3 provides the register GICR_TYPER[1] and it has a field named
Affinity_Value. This field can help to determine where gic_rdists[cpu]
should point.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2022-09-09 16:36:37 +00:00
Andrei Emeltchenko
b6c50f5347 i2c: Print more flags for i2c_dump
Add more usable information for i2c_dump_msgs() helper.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-09 10:13:12 -05:00
Andrei Emeltchenko
69d1b21d47 i2c: shell: Add help to command description
Makes i2c shell usable by showing command syntax.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-09 10:13:12 -05:00
Mahesh Mahadevan
9966181510 drivers: usb: mcux: Restructure driver for SDK updates
1. Move the defines from usb_dc_mcux.h to usb_device_config.h
   and fsl_os_abstraction.h. These headers are used by
   the SDK USB driver. usb_dc_mcux.h header file is not longer
   needed and hence deleted.
2. Delete the Zephyr implementation of the usb_device_struct
   driver and use the one implemented inside the SDK USB
   driver. This requires updating the references to
   usb_device_struct inside the USB driver
3. Move defines and structures used by the driver
   out of the header file that is included by the SDK and
   into the MCUX USB driver.
4. Use end point defines provided by Zephyr instead of adding
   them locally.
5. Add a Kconfig to set the thread stack size
6. Move code to enable interrupts back to usb_attach function.
   Interrupts should be enabled after the init is successful,
   else we see errors of the ISR getting called before the
   init is complete causing Faults
6. Update west.yml to update the NXP HAL to get the updated
   SDK USB driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-09-09 09:44:46 -05:00
Mahesh Mahadevan
c5f44f94f8 drivers: usb: Update MCUX controller identification
Use device tree to identify the controller type

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-09-09 09:44:46 -05:00
Thomas Stranger
81bf4f98f7 drivers/w1: driver for ds2485 1-Wire master
This commit introduces the 1-wire master driver for maxim ds2485.

The ds2485 master has nearly the same (1-wire) feature set and
i2c-interface as the ds2477.
Therefore the common parts are extracted, but to avoid
any nda troubles only the ds2485 specific part is included.

Compared to older 1-wire masters, the ds2485 supports higher level
commands, supporting multi byte operations, search next, automatic crc
calculation.

In this driver only basic read and write operations are supported,
further hardware features are not yet utilized by the driver.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-09 14:11:30 +00:00
Erwan Gouriou
d62450886b drivers: timer: stm32_lptim: Initialize static global variable
In some configurations, a udf instruction may be generated
when compiling code where static global variable lptim_clock_freq is
used as a divisor.
To avoid this, initialize variable on declaration so that compiler
could see that it can't be used uninitialized in this division.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-09 14:09:22 +00:00
Kumar Gala
cc2c05a90c drivers: timer: Update drivers to use devicetree Kconfig symbol
Update timer drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-09 09:58:48 +00:00
Gerson Fernando Budke
fba21ecfd9 drivers: disk: sdmmc: Enable STM32L5X support
* Enable hardware flow control on Kconfig
 * Enable HSI48 clock on sdmmc_stm32 driver

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2022-09-09 09:56:51 +00:00
Francois Ramu
1816e0c7ea drivers: clock_control: stm32 fixed LSE system clock enable
On some stm32 mcus, the LSE is enabled as system clock (LSESYS)
only when the LSEON and LSERDY are both set.
The bit LSESYSEN is set in the RCC BDCR register
and the driver is waiting for the LSESYSRDY to be set.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-09 09:27:11 +00:00
Francois Ramu
7b95803218 drivers: serial: stm32 uart check baudrate register value
The baudrate register (BRR) of a stm32 USART cannot be lower than 16.
The baudrate register (BRR) of a stm32 LPUART cannot be lower than 0x300
and greater than 0xFFFFF.
Add assertion to check the range.
This could be the case when configuring a baudrate of 9600 on usart
clocked by LSE (32768Hz).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-09 10:11:23 +02:00
Diwakar C
6c6c496a82 espi: driver: Config spare espi vw register to OCP index
USBC port (Port 0/1/2/3) OCP (Over Current Protection) status
should be sent to PCH over eSPI VW index 0x50h. But there is
no dedicated VW register mapped to VW index 0x50h.
In this patch, configuring spare VW register SMVW06 to OCP VW
index 50h.

Signed-off-by: Diwakar C <diwakar.c@intel.com>
2022-09-09 10:11:02 +02:00
Martin Jäger
77e4c6515a drivers: can: native_posix_linux: initial implementation
This driver provides an interface to SocketCAN interfaces of the Linux
system running a Zephyr application with the native_posix board. These
interfaces may be virtual or actual CAN buses.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-09-09 10:08:59 +02:00
Ederson de Souza
67a6837efd drivers/mm: Remove redundant ifdef for MTL ADSP TBL implementation
An `ifdef CONFIG_SOC_SERIES_INTEL_ACE1X` currently always evaluates to
true, as `drivers/mm/mm_drv_intel_adsp_mtl_tlb.c` is only built when
`CONFIG_MM_DRV_INTEL_ADSP_MTL_TLB=y`, which depends on
`CONFIG_SOC_SERIES_INTEL_ACE1X`. So remove the ifdef.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-09-08 18:03:33 -04:00
Ederson de Souza
03a947850d drivers/mm: Get some bit configurations from DTS instead of SoC version
Migrate information to DTS and get it from there on the code. Note that
for CAVS 15, the information is not migrated as there's no DTS entry for
it. It can be brought back (in the DTS) if TLB support is enabled for
it.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-09-08 18:03:33 -04:00
Ederson de Souza
c1dc2683b9 drivers/dai/intel/ssp: Get number of SSP ports from Kconfig
Instead of using SoC versions, define the information about base and
extended ports on Kconfig, and use this information from there.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-09-08 18:03:33 -04:00
Ederson de Souza
79980f250c drivers/dai/intel/ssp: Decide about clock gating based on Kconfig
Instead of using version of the SoC, declare on Kconfig the need for it,
and use this information to decide upon enabling the code or not.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-09-08 18:03:33 -04:00
Henrik Brix Andersen
b01ea7c0c9 drivers: can: transceiver: Update drivers to use dts Kconfig symbol
Update the GPIO-controlled CAN transceiver driver to use the
DT_HAS_CAN_TRANSCEIVER_GPIO_ENABLED Kconfig symbol to expose the driver and
enable it by default based on devicetree.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-09-08 15:30:23 +00:00
Jeremy Bettis
da9448396c drivers/serial: Make serial_test a proper emul
Add emulator functionality to the serial_test driver, so that it can be
used to simulate a device on the other end of the uart.

If you don't set the buffer-size property in the dts node, there should
be effectively no change from the previous behavior.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2022-09-08 15:26:41 +00:00
Jeremy Bettis
672c7e5caf drivers/serial: clang-format serial_test.c
Format serial_test.c with clang-format.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2022-09-08 15:26:41 +00:00
Francois Ramu
b6ee1dfe6e drivers: flash: octo spi for stm32 with DMA
Introducing the dma transfer (also through dmamux)
to transfer data to/from the NOR octo-flash
With a DMAMUX, the DMA channel is given by the DTS.
Note that STM32U5X does not support DMA here.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-08 10:07:21 +00:00
HaiLong Yang
51363ae7c2 drivers: flash: introduce gd32 fmc driver
This supports three types GD32 FMC flash memory. GD32 FMC v1,
GD32 FMC v2 and GD32 FMC v3.

GD32 FMC v1 for small flash memory, flash size can be up to 512KB.

GD32 FMC v2 for large flash memory, flash size can be up to 3072KB.

GD32 FMC v3 not use page but sector as minimum block, flash size can
be up to 3072KB.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-09-08 10:13:05 +02:00
Daniel DeGrasse
04773864a8 drivers: sdhc: add SD host controller driver for LPC SDIF
add SD host controller driver for LPC SDIF IP block, using NXP SDIF
HAL driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-09-08 10:06:28 +02:00
Marcin Niestroj
326c685986 drivers: mcux_lpuart: clear Received Overrun Flag
According to i.MX RT1060 Reference Manual:

  While the OR flag is set, no additional data is stored in the data
  buffer even if sufficient room exists. To clear OR, write logic 1 to
  the OR flag.

Clear OR (Overrun) flag whenever it is set, so that data continues to be
received after potential data overrun.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-07 16:46:30 -05:00
Pieter De Gendt
bcbd8ff7ff drivers: pwm: pwm_mcux: Add WAIT/debug run options to devicetree
Add properties to allow PWM to keep running in WAIT or debug modes.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-09-07 16:28:10 -05:00
Pieter De Gendt
eb78a884d7 drivers: pwm: pwm_mcux: Add inverted polarity support
Add support for the PWM_POLARITY_INVERTED flag.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-09-07 16:28:10 -05:00
Andrei Emeltchenko
3f36584c72 i2c: shell: Update outdated help
Mention currently supported operations in I2C shell.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-07 16:04:39 -04:00
Andrei Emeltchenko
95037b996d i2c: shell: Remove forward declaration
Remove unneeded forward declaration.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-09-07 16:04:39 -04:00
Pierre Marzin
1d2752f4ee drivers: pwm: add Renesas R-Car driver
Add R-Car Gen3 PWM driver.

Clock diviser is automatically adjusted according to requested period
and duty-cycle in order to obtain as much accuracy as possible.
Indeed, in order to improve PWM accurancy, the PWM clock has to fit
the requested period. So use the given period_cycle to define if the
clock as to be adapted. In such case, increase/decrease the clock
diviser to adapt the period_cycle and be sure that it fits into the
10 bits counter of the PWM controller.

Tested on H3ULCB on pwm0 and pwm4.

Signed-off-by: Pierre Marzin <pierre.marzin@iot.bzh>
2022-09-07 15:50:49 +02:00
Erwan Gouriou
ec6f932ad2 drivers/timer: stm32 lptim: Fix frequency check
Aim is to error out on misconfifurations, not the other way round.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-07 15:39:16 +02:00
Francois Ramu
e133ebfe2e drivers: sdmmc: stm32 enables HSI48 MHz clock by default
For some stm32 devices, the SDMMC clock selection is HSI 48MHz
by default (reset value). It must be enabled before acccessing
the peripheral.
The ErrorCode is reported when Init fails.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-07 15:35:10 +02:00
Kevin Wang
c01dcacb6f drivers: spi: add Andes atcspi200 driver
Support the Andes atcspi200 spi driver

Signed-off-by: Kevin Wang <yunkai@andestech.com>
2022-09-07 15:34:47 +02:00
Francois Ramu
86ede2b679 drivers: spi : driver with DMA for the stm32u5
This commit is the adaptation of the stm32 SPI driver with DMA
transfer for the stm32u5 soc.
Use the DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_spi)
also valid for the stm32U5 serie.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-09-07 15:34:35 +02:00
Thomas Stranger
16242e9c32 drivers/w1: add 1-wire shell
This commit implements shell support for 1-Wire.
Commands for bus-reset, bit-, byte-, and block- communication,
as well as search and configuration are implemented.

- write_byte, and write_block perform a reset before,
in case the option "-r" is passed.
- using read_io_options() function to parse the reset option,
as this allows to easily add further options in the future.
- configuration type can be specified either as number or as name.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-07 15:33:52 +02:00
Gerard Marull-Paretas
8081d7f2a4 drivers: s/DT_CHILD(DT_DRV_INST(n), ...)/DT_INST_CHILD(n, ...)
Use instance version of DT_CHILD when possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-06 08:45:25 -07:00
Piotr Kmiecik
0acd68247f drivers: ace_v1x wallclock driver
Wallclock driver with functionality required by ACE v1x base firmware.

Signed-off-by: Piotr Kmiecik <piotrx.kmiecik@intel.com>
2022-09-06 17:44:03 +02:00
TOKITA Hiroshi
f3fd686b96 drivers: adc: shell: Support RaspberryPi Pico ADC
Add ADC shell support for RaspberryPi Pico.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-09-06 17:11:19 +02:00
TOKITA Hiroshi
6df65f569d drivers: adc: Add support for RaspberryPi Pico ADC
Introducing RaspberryPi Pico ADC driver.
This driver was created with reference to the adc_emul implementation.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-09-06 17:11:19 +02:00
Tatsuroh Hayashi
cc434a9fe1 drivers: counter: STM32F1RTC support
Add RTC support of STM32F1 family.

Fixes #31175

Signed-off-by: Tatsuroh Hayashi <tatzu884@gmail.com>
2022-09-06 09:43:54 -05:00
Pierre-Emmanuel Novac
7ac8dd87e4 drivers/clock_control: stm32: Configure MCO1 on STM32F1
MCO1 is also available on STM32F1 series (on top of STM32F4), allow
selection of MCO1 source with CLOCK_STM32_MCO1_SRC_* Kconfig parameters.
Available MCO1 sources are slightly different between STM32F4
(LSE, HSE, HSI, PLLCLK) and STM32F103 (HSE, HSI, PLLCLK/2, SYSCLK), and
STM32F105/F107 have a few more (EXT_HSE, PLL2CLK, PLLI2SCLK, PLLI2SCLK/2).
MCO1 on STM32F1 does not have a configurable divider (unlike STM32F4),
HAL call only configures source.
STM32F1 do not have MCO2.

Signed-off-by: Pierre-Emmanuel Novac <piernov@piernov.org>
2022-09-06 09:57:35 +02:00
Gerard Marull-Paretas
64eb350e5e drivers: spi: gd32: use clock control API
Use the clock control API to enable/get rate of SPI clocks.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
0aadc2dd44 drivers: serial: gd32: use clock control API
Use the clock control API to enable the UART clock.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
22e64fddfd drivers: pwm: gd32: use clock control API
Use the clock control API to enable/get rate of timer clocks.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
4fcc1dae0d drivers: i2c: gd32: use clock control API
Use the clock control API to enable/get rate of I2C clock.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
455b95b6c2 drivers: gpio,pinctrl: gd32: use clock control API
Use the clock control API to enable peripheral clocks. Note that both
GPIO and pinctrl drivers are updated at once since they share some IP
blocks.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
8d100f4f98 drivers: dma: gd32: use clock control API
Use the clock control API to enable DMA clock.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
8693a0b63f drivers: dac: gd32: use clock control API
Use the clock control API to enable peripheral clock.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
86654dbeae drivers: adc: gd32: use clock control API
Use the clock control API to turn on ADC clocks. Note that clock
selection is not yet implemented, so we still rely on custom rcu
properties for that.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
1c7138fbb1 drivers: adc: gd32: fix ADC clock source retrieval
The clock source is specified via rcu-clock-source in DT.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas
4aa31b4526 drivers: clock_control: gd32: initial support
This patch adds a clock control driver for GD32 platforms. It is
important to note that the driver is only able to handle peripheral
clocks, but not "system clocks" (e.g. PLL settings, SYS_CK, etc.).  On
some similar platforms (STM32) this task is embedded in the same clock
driver, performed at init time but with no options to do any
manipulation at runtime via the API calls. The clock control API as-is
is really orthogonal to "system clocks", and it is arguably a bad idea
to embed system clock init code in a clock control driver. It can be
done at SoC level still using Devicetree as a source of hardware
description/initial configuration.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Declan Snyder
4baf7b9552 drivers: entropy: Disable CAAM driver
Temporarily disable CAAM driver because of bug in init on rt11xx

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-09-06 09:56:48 +02:00
Vinayak Kariappa Chettimada
3e5ea793b7 drivers: flash: nrf: Fix ticker stop user id value
Ticker stop callback are executing in ULL_HIGH priority,
correct the value to 1U instead of 0U which is for LLL
execution context of the Bluetooth Controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-09-05 17:36:48 +02:00
Vinayak Kariappa Chettimada
67cf435ae1 drivers: flash: nrf: Fix ticker stop synchronization
Fix usage fault due to spurious ticker timeout expiry post
enqueuing of ticker stop operation.

Use ticker operation callback to handle completion of ticker
stop operation and then give the semaphore to thread to
notifying the completion of flash operation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-09-05 17:36:48 +02:00
Sylvio Alves
7fdde112d1 wifi: esp32: update enum naming reference
Due to Zephyr's WiFi updates, common private
enums used in `hal_espressif` are now being used.

This updates private internal values to meet hal_espressif
changes.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-05 15:32:34 +00:00
Sylvio Alves
a8cacfa530 wifi: esp32: add config to enable automatic DHCPV4 negotiation
ESP32 wifi connection uses Zephyr's net stack. Once WiFi connects
in station mode, is requires the application to handle DHCPv4
negotiation. This PR adds support to automatic negotiation by
handling the dhcpv4 calls in driver layer.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-05 15:32:34 +00:00
Sylvio Alves
7d9edc8bf0 wifi: esp32: add support to wifi api mgmt
Moved all MBEDTLS dependencies from prj.conf
to Kconfig as WiFi depends on it.

Update esp32 wifi driver to enable `samples/net/wifi`
to work. Commands as such as `wifi connect` and `wifi scan` are now
available.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-05 15:32:34 +00:00
Thomas Stranger
402752c07c drivers/can: move STM32FD clock divider configuration to dts
Remove the CAN_STM32FD_CLOCK_DIVISOR configuration option,
and add configuration via dts property clk-divider instead.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-05 14:44:45 +00:00
Thomas Stranger
09f45840f1 drivers/can: stm32fd fix not applied clock divider
The configurable CAN clock divider CAN_STM32FD_CLOCK_DIVISOR
was not applied during initialization, because write protection
was not disabled.

While the clock divider was not applied, it was still used in clock rate
calculation, therefore resulting in incorrect bus speed setup.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-05 14:44:45 +00:00
Thomas Stranger
a5cc6c2e16 drivers/can: stm32_fd: convert domain clk src sel. from kconfig to dts
Use domain clocks if they are defined in dts.

Until now domain clock sources could be selected via kconfig.
STM32 platform now can configure domain clock sources via
clock control driver, therefore this commit makes use of it.

The configuration is shared between canfd instances, so a domain clock
has to be defined for only one instance. Otherwise, only the
configuration from the latest initialized instance will remain.

The dependency on clock source PCLK1 for CAN_STM32FD_CLOCK_DIVISOR
was removed, because the divider also divides other clocks.
Note that setting that divider does not work at all at the moment,
because the write protection is not disabled.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-09-05 14:44:45 +00:00
Florian Grandel
c57650c403 net: context: clean up net_context_get()
* reduced cyclomatic complexity
* group validation by family to make the validation easier to understand
and extend
* change preprocessor markup where possible to allow for complete code
elimination when features (esp. IP) are disabled
* renamed net_context_get/set_ip_proto() to net_context_get_proto()

While the latter is formally part of the public API and might therefore
have to be deprecated rather than renamed, it is considered internal API
by the net developers, see
https://github.com/zephyrproject-rtos/zephyr/pull/48751#discussion_r942402612

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-09-05 14:35:17 +00:00
Florian Grandel
e608e92112 net: context: properly namespace can-related methods
The net_context_set/get_filter_id() methods are CAN specific and should
say so.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-09-05 14:35:17 +00:00
Gerard Marull-Paretas
79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Erwan Gouriou
54302ac67d drivers: flash: stm32 ospi: Limit bytes read from DT SFDP table
In case SFDP table is provided via device tree, take care not reading
more than expected by the function caller as the result is written
in a structure which size is predefined by one specific byte in the
table, and could be smaller than the table size.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-05 10:17:21 +02:00
Jiafei Pan
8700d925b3 drivers: serial: remove soc.h from iuart
soc.h has been removed for ARM64 SoC platforms and it is also needed by
ARM32, so remove it from related drivers.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-09-05 10:17:13 +02:00
Jiafei Pan
1cf9858b4f drivers: pinctrl: remove soc.h from pinctrl_imx
soc.h has been removed for ARM64 SoC platforms and it is also needed by
ARM32, so remove it from related drivers.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-09-05 10:17:13 +02:00
Jiafei Pan
af0c47f7d8 drivers: clock_control: remove soc.h from mcux_ccm
soc.h has been removed for ARM64 SoC platforms and it is also needed by
ARM32, so remove it from related drivers.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-09-05 10:17:13 +02:00
Jiafei Pan
66414ef6e7 drivers: pinctrl: fix imx pinctrl 64bit compatible
Make imx pinctrl driver to be aarch64 compatible.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-09-05 10:17:13 +02:00
Andrey Borisovich
2e04bfdfe0 soc: intel_adsp: Refactored IPC/IDC
Changes to code:
1. Renamed CAVS_IPC API from common/include/cavs_ipc.h to
common/include/intel_adsp_ipc.h. Renamed all API functions and structs -
added "intel_adsp_" prefix.
2. Moved definitions from intel-ipc-regs.h and ace-ipc-regs.g to SOC
specific headers include/<soc_name>/adsp_ipc_regs.h.
3. Added new common intel_adsp_ipc_devtree.h header with new
macros to retrieve IPC and IDC nodes and register addresses.
Put those new macros in code replacing hardcoded values outside of
devicetree.
4. Changed documentation of IDC and renamed IDC register struct
to have common name between all intel adsp socs.
5. Removed excessive docs description on cAVS IPC protocol.

Changes to Devicetree:
1. Renamed in all CAVS boards .dtsi files content in IPC nodes:
   - "cavs_host_ipc" node labels to "adsp_ipc" labels.
   - compatible "intel,cavs-host-ipc" renamed to
     "intel,adsp-host-ipc".
2. Added (previously missing) yaml file for "intel,adsp-host-ipc"
   compatible.
3. Renamed in all CAVS boards .dtsi files content in IDC nodes:
   - "idc" node labels to "adsp_idc" labels.
   - compatible "intel,cavs-idc" renamed to "intel-adsp-idc"
4. Renamed intel,cavs_idc.yaml file to intel,adsp_idc.yaml
   so it is suitable for both CAVS and ACE SoC family.
   Moved it from ipm bindings to ipc bindings where it belongs.

Changes to Kconfig:
1. Renamed existing Kconfig option CONFIG_CAVS_IPC to
   INTEL_ADSP_IPC.
2. For renamed INTEL_ADSP_IPC addded default value based on
   status of the "adsp-ipc" and "adsp-ipc" node.

Signed-off-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-09-02 08:18:32 -04:00
Gerard Marull-Paretas
082043c6e8 drivers: display: intel_multibootfb: convert to DT
Convert the device to be Devicetree based. Adjusted tests and other
areas that were using old Kconfig properties.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-02 14:16:08 +02:00
Gerard Marull-Paretas
6a4409d8a0 drivers: display: intel_multibootfb: remove data accessor
config/data accessors have been removed from all (or most) in-tree
drivers, do the same here.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-02 14:16:08 +02:00
Gerard Marull-Paretas
11860face3 drivers: display: framebuffer: rework to make it self-contained
The "framebuf" driver was an incomplete driver expecting _clients_ to
implement missing functionality (i.e. init and device definition)
outside of the driver. This pattern of scattering driver code throughout
the tree is not common (if used at all). If certain drivers share
functionality, one can create a common module within the subsystem (see
e.g. ILI9XXX drivers).

The _generic_ framebuffer code was only used to implement the Intel
Multiboot framebuffer driver. This patch centralizes all the scattered
code in the subsystem and adjusts the driver name to "intel_multibootfb"
to make things clear. If there's ever another framebuffer driver that
shares code, it can be split into multiple modules.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-02 14:16:08 +02:00
Kumar Gala
576d3fe84f drivers: ec_host_cmd_periph: Update Kconfig
Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-02 11:22:39 +00:00
Andrew Hedin
715c2e63a0 modem: hl7800: Configure name for work queue
Prevent blank entry in kernel stacks shell command output.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2022-09-02 11:06:11 +00:00
Marcin Niestroj
cf4578bdda drivers: usb_dc_rpi: set thread name
Thread name is useful when debugging or using shell with
CONFIG_THREAD_NAME=y.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Marcin Niestroj
966738db2c drivers: usb_dc_mcux: set thread name
Thread name is useful when debugging or using shell with
CONFIG_THREAD_NAME=y.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Marcin Niestroj
de36a7d7f4 drivers: usb_dc_kinetis: set thread name
Thread name is useful when debugging or using shell with
CONFIG_THREAD_NAME=y.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Marcin Niestroj
1e982fffd2 drivers: usb_dc_rpi: create thread and connect IRQ during init
So far thread was created as part of usb_dc_attach() by k_thread_create().
This means that if following function were executed:

 * usb_enable()
 * usb_disable()
 * usb_enable()

then k_thread_create() was called second time. This results in undefined
behavior.

Fix above issue by moving k_thread_create() invocation to function called
during system initialization.

While at it, move IRQ_CONNECT() and irq_enable() invocations to init as
well.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Marcin Niestroj
e4480d6ab6 drivers: usb_dc_mcux: create thread and connect IRQ during init
So far thread was created as part of usb_dc_attach() by k_thread_create().
This means that if following function were executed:

 * usb_enable()
 * usb_disable()
 * usb_enable()

then k_thread_create() was called second time. This results in undefined
behavior.

Fix above issue by moving k_thread_create() invocation to function called
during system initialization.

While at it, move IRQ_CONNECT() and irq_enable() invocations to init as
well.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Marcin Niestroj
9de245a588 drivers: usb_dc_kinetis: create thread and connect IRQ during init
So far thread was created as part of usb_dc_attach() by k_thread_create().
This means that if following function were executed:

 * usb_enable()
 * usb_disable()
 * usb_enable()

then k_thread_create() was called second time. This results in undefined
behavior.

Fix above issue by moving k_thread_create() invocation to function called
during system initialization.

While at it, move IRQ_CONNECT() and irq_enable() invocations to init as
well.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-09-02 11:00:48 +00:00
Erwan Gouriou
e8e72882e1 drivers: timer: stm32: Check return of clock functions
That will speed up debugging.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:41:59 +00:00
Erwan Gouriou
7f2cb0fd22 drivers: timer: stm32: Specific handling for L0 LSI
On L0 series, LSI runs at 37KHz while LPTIM driver only supports speeds
up to 32768Hz (to avoid counter overflow). Consequence is a time running
faster than reality (x1.13)
Solution to this is the implementation of the LPTIM prescaler support.

While moving driver configuration from Kconfig to DT, this case was
not taken into account and the effect was LPTIM counter overflow which
consequence is worse than the slightly faster timer.
Reproduce the initial behavior with this piece of code that will be
removed once prescaler support is available.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:41:59 +00:00
Erwan Gouriou
16c11138d5 drivers: timer: stm32: Adapt SYS_CLOCK_TICKS_PER_SEC
When using LPTIM as tick source, tick freq (SYS_CLOCK_TICKS_PER_SEC)
needs to be adapted to get a precise tick to LPTIM freq ratio.

This adaptation was done easily using Kconfig up to now (under
soc/st_stm32/common/Kconfig.defconfig.series).
Since driver is configured using device tree, this method should
be adapted. For the LSI case (default Kconfig case), rely on the
existing mecanism, which is also still used by OOT users.
For the LSE case, force the value manually in boards forlder.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:41:59 +00:00
Erwan Gouriou
d056be2b38 drivers/timer: stm32: Re-instantiate warning message on lptim configuration
Following transition of lptim timer configuration from Kconfig to DT,
a warning message was set to inform users about this deprecation.
Due to errors in CI this message had to be removed while fixing the related
issues.
Now these issues are fixed, set the deprecation message again.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:41:59 +00:00
Erwan Gouriou
f818b0478d drivers/timer: stm32: Enable lptim driver based on dt status
Similarly to other drivers, use auto generated DT_HAS_<COMPAT> Kconfig
symbol to control use of STM32 lptim driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:41:59 +00:00
Erwan Gouriou
680574f960 drivers: ethernet: stm32_hal: Rename flag.
Last HAL udpdates came with a fix on two ethernet flags:
- ETH_PTPTS*S*R_TSSARFE > ETH_PTPTS*C*R_TSSARFE
- ETH_PTPTS*S*R_TSSSR > ETH_PTPTS*C*R_TSSSR

Update driver to be aligned with these changes.

Fixes #49763

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-02 10:37:49 +00:00
Vijay Hiremath
f262b795b8 eSPI: npcx: Enable platform specific Virtual Wire GPIOs
Added code to enable platform specific Virtual Wire GPIOs. With this
change, able to send the USB-C overcurrent Virtual Wire event to
Meterolake SOC.

Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
2022-09-02 10:36:24 +00:00
Andreas Sandberg
f62dc249a0 drivers: uc81xx: Add workaround for chips without autocopy
The UC8176 doesn't automatically copy writes to the buffer containing
the old SRAM contents. In this case, we need to manually copy data to
the back buffer.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
c276f834e0 drivers: uc81xx: Make it possible to override PLL/VDCS
Some custom refresh profiles need to set the PLL and VDCS
registers. Add them as optional DT properties.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
d571b3136d drivers: uc81xx: Add support for overriding LUTs
Add support for overriding display LUTs in the UC81xx driver. This
makes it possible to use different LUTs for the full and partial
refresh profiles.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
21208aae1d drivers: uc81xx: Add a separate partial refresh profile
Add a separate profile for partial refreshes. This makes it possible
to specify a separate refresh configuration for partial and full
refreshes.

The driver now transitions to full refresh mode when blanking is
turned on. It transitions back to partial refresh mode when there is a
write while blanking is off.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
957e22976d drivers: uc81xx: Specify overrides in a DT child node
Introduce the concept of refresh profiles which are specified as a
child node in the device tree. This makes it possible to use different
overrides for different types of refreshes (full/partial).

The only profile that is currently supported is the "full" profile.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
35eaa1c36c drivers: uc81xx: Make busy wait implicit in most cases
Some commands need to signal that the chip is busy using the busy
pin. We generally need to wait for the chip to exit the busy state
before issuing a new command. Call uc81xx_busy_wait() from
uc81xx_write_cmd() just before issuing a new command instead to avoid
sprinkling wait calls everywhere.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Andreas Sandberg
b9ebf3397b drivers: uc81xx: Don't produce debug output while waiting
The UC81xx driver prints a debug message on every iteration of its
busy wait loop. This makes debug output almost useless. Modify this
code to print a debug message on entry and exit instead.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-09-02 11:21:08 +02:00
Sylvio Alves
7a00f7b793 west.yml: update hal to v4.4.1 base
west.yml: update hal_espressif to use latest v4.4.1 updates.
This change needs to be insync with esp32c3 timer changes, otherwise it
breaks it.

drivers: timer: update esp32c3 systimer to meet API changes.
Systimer API was refactored in hal v4.4.1, which
requires updates in esp32C3 systimer. Timer behavior is maintained
as is.

mcpwm: add v4.4.1 include reference, which was refactored as well.

driver: spi: esp32: update internal structs to meet API changes.

cmake: updated esp32 board to use HAL_ prefix as from west blobs
requirement.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-01 21:48:18 +00:00
Sylvio Alves
4928a69a06 drivers: wifi: esp32: remove supplicant init call
Supplicant start call is part of esp_wifi_init, which
would become duplicated if kept in here.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-01 21:48:18 +00:00
Sylvio Alves
61d03e1bb0 driver: intc: esp32: use hal calls in interrupt driver
Updates ESP32 to use hal interrupt funcions provided by 4.4.1
release. Removed redefinition of interrupt FLAGS.

This also includes interrupt definitions for ESP32C3

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-01 21:48:18 +00:00
Sylvio Alves
b80c277796 clock: esp32: update clock init functions
Add device specific clock initialization, which uses
reset reason cause information to proper define
peripherals clock state.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-01 21:48:18 +00:00
Christopher Friedt
13a2294f9d sys_clock: define NSEC_PER_MSEC
NSEC_PER_MSEC should be defined along with the rest of the
per-sec macros in sys_clock.h. Currently, it's defined
multiply in a few separate locations.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-09-01 16:29:25 -04:00
Boon Khai Ng
c3dd728c26 drivers: flash: Add Cadence QSPI NOR Flash Driver
This patch is to enable new driver, Cadence QSPI NOR
flash for Intel SoC FPGA Agilex Family

Signed-off-by: Boon Khai Ng <boon.khai.ng@intel.com>
2022-09-01 14:30:59 -04:00
Adrian Wojak
fb57a4876f drivers: sensor: lsm6dsl: disable high performance in initialization
To reduce energy consumption for accel and gyro frequencies 52 Hz and
lower, disable high performance mode by default.
It doesn't affect for higher frequencies.

Signed-off-by: Adrian Wojak <adrian.wojak@grinn-global.com>
2022-09-01 13:19:08 -05:00
Erwan Gouriou
aa8a89a216 drivers: sensors: hts221: Fix trigger mode
1. Use #ifdef around CONFIG_HTS221_TRIGGER instead of #if

2. According to binding (which is in line with datasheet), name of the pin
used for trigger mode should be drdy, not irq.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-01 13:15:14 -05:00
Yong Cong Sin
411079cf1d drivers: adc: stm32: teardown internal channel after read
Internal channel should be torn after ADC read, this is
especially the case for VBAT, where the connection of internal
channel will introduce current drainage.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-09-01 12:29:58 +00:00
Wei-Tai Lee
0f8d12d4ed drivers: i2c: add Andes atciic100 driver
Add I2C driver for Andes atciic100. Driver supports I2C target mode and
tested on adp_xc7k_ae350 in runtime.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2022-09-01 10:29:12 +02:00
Anas Nashif
88fb9ee727 ipm: split kconfig options into multiple files
Main Kconfig becoming too busy, split it into vendor specific files
where it makes sense.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-09-01 10:28:16 +02:00
Kumar Gala
45a436f372 drivers: disk: sdmmc: Update Kconfig
Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:26:19 +02:00
Kumar Gala
1bee3326ad drivers: dai: Update drivers to use devicetree Kconfig symbol
Update dai drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:26:06 +02:00
Kumar Gala
3cc8183c52 drivers: gpio: Cleanup Kconfig.test
Use DT_HAS_VND_GPIO_ENABLED for GPIO_TEST similar to what we
do for SPI_TEST, I2C_TEST, etc.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:25:57 +02:00
Kumar Gala
91fedca6e2 drivers: lora: Update drivers to use devicetree Kconfig symbol
Update lora drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:25:51 +02:00
Kumar Gala
8423f23b9c drivers: intc: Update drivers to use devicetree Kconfig symbol
Update intc drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:25:36 +02:00
Kumar Gala
10d39b0356 drivers: serial: rtt: Remove DT_COMPAT_<compat> defines
We auto-generate DT_COMPAT_<compat> defines so we dont need to
explicitly define them anymore.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-31 21:57:52 +00:00
Kumar Gala
25cb2bff74 drivers: wifi: Update drivers to use devicetree Kconfig symbol
Update Wifi drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-31 21:57:06 +00:00
Florian Grandel
c3b080166e drivers: ieee802154: introduce consistent MTU definition
This change applies the newly introduced consistent MTU definition to
all IEEE 802.15.4 radio drivers.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-08-31 21:52:37 +00:00
Bartosz Bilas
d6cf6e7bb2 dt-bindings: sensor: ina237: rename the operating modes
Adjust the names of the operating modes to match them
with the datasheet and INA230 pattern. While at it add
the missing INA237_OPER_MODE_TEMP_TRIG mode.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-08-31 21:51:14 +00:00
Yannick Thesen
754c578d79 drivers: sensor: Added driver for the Würth Elektronik WSEN-HIDS sensor.
Added driver for the WSEN-HIDS humidity and temperature sensor.

Signed-off-by: Yannick Thesen <Yannick.Thesen@we-online.de>
2022-08-31 21:47:58 +00:00
Andrzej Kaczmarek
bd5edb6775 drivers: flash: Add driver for smartbond
This adds flash driver for Renesas SmartBond(tm) family.

This technically uses QSPI controller but since default and most
commonly used configuration is to boot from external QSPI flash (DA1469x
do not have built-in flash) and that flash is mapped into memory space,
it can be represented as internal flash.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2022-08-31 20:32:03 +02:00
Andrzej Kaczmarek
6ba6e713cb drivers: serial: Add driver for smartbond
This adds serial driver for Renesas SmartBond(tm) family. Both polling
and interrupt APIs are supported.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2022-08-31 20:32:03 +02:00
Andrzej Kaczmarek
f19252567c drivers: pinctrl: Add driver for smartbond
This adds pinctrl driver for Renesas SmartBond(tm) MCU family.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2022-08-31 20:32:03 +02:00
Andrzej Kaczmarek
6af5533ca5 drivers: gpio: Add driver for smartbond
This adds GPIO driver for Renesas SmartBond(tm) family.

Driver supports pin configuration (input/output) and interrupts on edge.
Interrupts on level are not supported by hardware.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2022-08-31 20:32:03 +02:00
Nils Larsen
a3bae01e74 drivers: sdhc: add clock init for USDHC2-block of NXP i.MX-processors
The missing init is added analog to existing init of USDHC1 block.

Signed-off-by: Nils Larsen <nils.larsen@posteo.de>
2022-08-31 13:21:17 -05:00
Kumar Gala
0ee0269848 drivers: mm: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-31 11:17:37 -05:00
Kumar Gala
fab8d25fd3 drivers: mm: Add dts binding specific for ADSP Meteor Lake TLB
Add a specific compatiable and binding for intel,adsp-mtl-tlb.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-31 11:17:37 -05:00
Stephanos Ioannidis
e9b29a6f83 drivers: spi: psoc6: Fix spi_psoc6_transceive calls
The commit 4c20403629 updated the
`spi_psoc6_transceive` function signature but forgot to update its
usages.

This commit updates the `spi_psoc6_transceive` function invocations
to properly provide the callback and user data parameters.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Stephanos Ioannidis
a25257fcef drivers: spi: sifive: Migrate spi_context_{complete,lock} usage
This commit updates the SiFive SPI driver to reflect the
`spi_context_complete` and `spi_context_lock` function signature
changes introduced in the commit
4c20403629.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Stephanos Ioannidis
da570f871f drivers: spi: mchp_mss_qspi: Migrate spi_context_{complete,lock} usage
This commit updates the Microchip MSS QSPI SPI driver to reflect the
`spi_context_complete` and `spi_context_lock` function signature
changes introduced in the commit
4c20403629.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Stephanos Ioannidis
068006e1dc drivers: spi: litespi: Migrate spi_context_complete usage
This commit updates the LiteSPI SPI driver to reflect the
`spi_context_complete` function signature change introduced in the
commit 4c20403629.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Stephanos Ioannidis
fedf0faac0 drivers: spi: gecko: Migrate spi_context_complete usage
This commit updates the Gecko SPI driver to reflect the
`spi_context_complete` function signature change introduced in the
commit 4c20403629.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Stephanos Ioannidis
c4840535b6 drivers: spi: gd32: Migrate spi_context_{complete,lock} usage
This commit updates the GD32 SPI driver to reflect the
`spi_context_complete` and `spi_context_lock` function signature
changes introduced in the commit
4c20403629.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-09-01 01:02:50 +09:00
Gerard Marull-Paretas
fe561f02db drivers: clock_control: nrf: fix unused variable warning
prev_temperature was only used if USE_TEMP_SENSOR is true. Make its
definition conditional.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-01 00:47:41 +09:00
Gerard Marull-Paretas
0612dd433d drivers: clock_control: nrf: fix temperature sensor usage
The temperature sensor was only needed when
CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP > 0. Implementation did
not reflect this dependency correctly, and sensor sampling code was
always compiled. Also removed CONFIG_MULTITHREADING checks, since this
driver is only compiled if CONFIG_MULTITHREADING=y.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-31 14:11:44 +02:00
Gerard Marull-Paretas
0cd311c4a1 include: fix files using legacy include paths
Some files were still using the already deprecated include path, fix
this.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-31 06:49:00 -04:00
Henrik Brix Andersen
b0c1b9715f drivers: can: shell: add command for showing CAN controller information
Add a "can show <device>" command for showing information about a CAN
controller.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-31 10:45:35 +02:00
Henrik Brix Andersen
2f73225aa8 drivers: can: rewrite the CAN shell module
Rewrite the CAN shell module to catch up with the added CAN controller API
functionality.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-31 10:45:35 +02:00
Adam Wojasinski
63ab9b3c6d drivers: Replace deprecated nrfx API
This commit replaces API that became deprecated with the release
of nrfx2.9 - see CHANGELOG in zephyrproject-rtos:hal_nordic repository

Signed-off-by: Adam Wojasinski <adam.wojasinski@nordicsemi.no>
2022-08-31 10:43:14 +02:00
Gerard Marull-Paretas
d19875e510 drivers: intc: gic: use DT_FOREACH_CHILD_STATUS_OKAY_SEP
Remove the need for an auxiliary macro by using
DT_FOREACH_CHILD_STATUS_OKAY_SEP.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas
9c8cd560f0 drivers: gpio: xlnx_ps: use DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP
Simplify driver by using DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP (avoids
DT_DRV_INST and auxiliary macro).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas
1bc794c7d4 drivers: gpio: nct38xx: use DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP
Simplify driver by using DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP (avoids
both DT_DRV_INST and auxiliary macro).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas
40542638fd drivers: led: gpio: use DT_INST_FOREACH_CHILD_SEP_VARGS
Avoid auxiliary macros by using DT_INST_FOREACH_CHILD_SEP_VARGS

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas
44552df4f5 drivers: led: pwm: use DT_INST_FOREACH_CHILD_SEP
Remove the need for auxiliary macros by using DT_INST_FOREACH_CHILD_SEP.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Kumar Gala
310190ca01 drivers: crypto: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-30 10:43:12 +00:00
Jun Lin
ab9febcf3c driver: i2c: npcx: add recover_bus API support
Add I2C bus recovery support by emitting 9 SCL clock pulses.
It implements the equivalent logic of the i2c_unwedge function in the
ChromiumOS legacy-EC.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-08-30 10:26:19 +02:00
Holger Schurig
331572b3f2 drivers: sensors: fix DRDY usage
hts221_trigger.c is pulled in by the CMakeLists.txt file when
CONFIG_HTS221_TRIGGER is defined. Therefore make the source in hts221.c use
the some define.

This removes also the (wrong) warning

    <inf> HTS221: Cannot enable trigger without drdy-gpios

even when "drdy-gpios" is defined in the device-tree.

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
2022-08-30 10:26:09 +02:00
Sylvio Alves
20c3256016 net: wifi: Allow to use offloaded wifi_mgmt API with native stack
wifi drivers that depends on native ethernet stack cannot perform
wifi API calls missing availability. This changes adds the ethernet_api
interface in wifi_mgmt so that it becomes possible.

Naming "offload" in "struct net_wifi_mgmt_offload" is kept because
Zephyr still has no supplicant to handle a full non-offloaded driver.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-08-29 17:31:17 +02:00
Gerard Marull-Paretas
d55bc1f7ba drivers: spi: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
0337905c7a drivers: serial: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
2c740b4392 drivers: pwm: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
7002351b58 drivers: i2c: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
5aa5af8ec2 drivers: gpio: gd32: use reset API
Use the reset API to restore the peripheral to its initial state before
configuring it.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
382c1f2338 drivers: dma: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
e779767b25 drivers: dac: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
6894a6c7ed drivers: adc: gd32: use reset API
Use the reset API to reset the peripheral state before initialization.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Gerard Marull-Paretas
28b59890a6 drivers: reset: gd32: add initial support
Add a new reset driver for GD32 platforms. This driver controls the
reset registers from the RCU peripheral. It can be used to restore
peripherals to their initial state when initializing a device.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Sylvio Alves
3c50237460 drivers: gpio: esp32: fix config function to allow changes
Current implementation misses disabling input/output mux
once GPIO has already been configured. It means that after 1st
configuration, if GPIO is reconfigured, it won't disable previous
definitions, causing unexpected behavior.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-08-26 21:27:50 -04:00
Gerard Marull-Paretas
ac89fce3be drivers: gpio: sx1509b: select I2C
Select I2C instead of depending on it, following latest upstream policy.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-26 10:06:43 -07:00
Kumar Gala
0a57488719 drivers: dma: Update drivers to use devicetree Kconfig symbol
Update DMA drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-26 14:27:23 +00:00
Tom Burdick
4c20403629 spi: callback API for asynchronous transcieve
Adds a new spi_transcieve_cb API which enables asynchronous
SPI transactions with callback notification.

The exist spi_transcieve_async API remains and uses the new
spi_transcieve_cb API to provide a k_poll_signal notifier.

The driver API changes to provide a callback and userdata
parameter to async transcieve. All drivers in the tree
have been updated to the change.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-26 09:29:48 -04:00
Wei-Tai Lee
00b97feb56 drivers: hwinfo: add Andes hwinfo driver
Add hwinfo driver for Andes.

Signed-off-by: Wei-Tai Lee <wtlee@andestech.com>
2022-08-26 11:55:55 +02:00
Jimmy Zheng
a2cc4b702f drivers: counter: add Andes atcpit100 counter driver
atcpit100 counter driver support 4 32-bit PIT channel, using channel 3 as
the default counter.

Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
2022-08-26 11:55:36 +02:00
Gerard Marull-Paretas
223cc3c6bd drivers: pinctrl: nrf: add support for disconnecting a pin
It was not possible to disconnect a pin using the nRF pinctrl driver.
That is, it was not possible to set PSEL to 0xFFFFFFFF (indicating pin
is not connected). This can be useful in certain scenarios, e.g. a
bootloader configures all signals of a certain peripheral but
application then needs to disconnect certain signals.

A new DT macro has been introduced to accomplish this:
NRF_PSEL_DISCONNECT. It can be used like this to explicitely disconnect
a peripheral signal:

```
&pinctrl {
	uart0_default: uart0_default {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 1)>,
				<NRF_PSEL_DISCONNECTED(UART_RX)>;
		};
	};
};
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-25 14:38:26 -07:00
Andrei Emeltchenko
7c81ee9d18 pcie: shell: Add help and argument check
Use SHELL_CMD_ARG() for argument check and add help, looking like:

...

$ pcie -h
  pcie - PCI(e) device information
  Subcommands:
    ls  :List PCIE devices
         Usage: ls [bus:device:function] [dump]

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-08-25 21:14:51 +00:00
Andrei Emeltchenko
d46c7595d9 pcie: shell: Verify command parameters
Exit on wrong parameter for pcie ls command.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-08-25 21:14:51 +00:00
Andrei Emeltchenko
e224e4c4fe i2c: shell: Fix SHELL_CMD_ARG() parameter count
The command uses 1 optional parameter and this parameter can be at
maximum MAX_I2C_BYTES.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-08-25 21:08:20 +00:00
Francois Ramu
f106465741 drivers: flash: ospi driver erase command on 24bits in SPI mode
When configuring the octo-flash in SPI/STR mode, the address size
must be on 24bits (and not on 32bits).
Despite the dev_data->address_width which is always seen as 4, the
erase command must reduce the AddressSize for this transfer mode.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-25 21:05:27 +00:00
Kumar Gala
324ee290f8 drivers: i2s: Update drivers to use devicetree Kconfig symbol
Update I2S drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-25 15:03:11 -05:00
Yves Vandervennet
6b66d7f266 flash: nxp: enabling lpc55s36's FMC
This commit enables the SoC's flash memory controller.

 - added lpc55s36 specific code in the NXP MCUX driver
   to take advantage of the SoC's check-before-read
   capability
 - enabled the FMC node in the SoC's dtsi (iap)
 - added the flash controller chosen node to the board's dts

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2022-08-25 10:24:41 -05:00
Daniel DeGrasse
d70db21760 drivers: flash: soc_flash_lpc: enable support for lpc54xxx IAP
Add support for LPC54xxx IAP flash driver to soc_flash_lpc.c
Driver is tested on M4 core only, and is therefore disabled on the M0 core.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-25 08:26:53 -05:00
Daniel DeGrasse
03cc56d5f8 drivers: flash: flash_mcux_flexspi_hyperflash: Fix incorrect printf format
Use correct printf format specifier for LOG_DBG calls using offsets, as
these offsets are long int and thus require the %lx format specifier rather
than %x.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-25 08:26:53 -05:00
Kumar Gala
2ac45e09db drivers: usb: device: Update drivers to use devicetree Kconfig symbol
Update usb device drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-25 08:05:54 -05:00
Flavio Ceolin
180f50feda intel_adsp: gpdma: Fix driver initialiaziation
cavs15 does not need to request ownership of the dma controller.

Fixes #49203

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-08-24 18:08:39 -04:00
Henri Xavier
dfededeadf cache: Fix build warning 'No SOURCES given to Zephyr library'
Following 4806e1087e ,
the following warning appears for some boards (e.g. `qemu_cortex_a53`)
```
CMake Warning at /zephyr/CMakeLists.txt:798 (message):
  No SOURCES given to Zephyr library: drivers__cache

  Excluding target from build.
```

Allow this driver to have no sources.

Signed-off-by: Henri Xavier <datacomos@huawei.com>
2022-08-24 10:36:40 +00:00
TLIG Dhaou
546218ad2b drivers: sensor: stm32_temp add the ts cal resolution to the driver
Add the ts cal resolution in the driver in order to calculate temperature
value.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-24 11:35:45 +02:00
TLIG Dhaou
7b102a9993 drivers: adc: stm32 init the Regular group for stm32wl
The stm32wl mcu requires the REG group of the ADC
to be initialized before starting the conversion.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-24 11:35:45 +02:00
TLIG Dhaou
df364cc372 drivers: adc: stm32 init the Regular group for stm32u5
The stm32u5 mcu requires the REG group of the ADC
to be initialized before starting the conversion.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-24 11:35:45 +02:00
Martí Bolívar
0c198f97a1 drivers: entropy: fail mcux CAAM init on error
Commit d556a0c8a6
("drivers: entropy: Add entropy driver for MCUX CAAM")
added a shim entropy driver whose initialization function
always returns 0, even when the underlying HAL API fails.

This is wrong; if the device initialization function fails, it must
return nonzero by contract. Papering this over with an assert is not
enough. Fix it by returning -ENODEV on error.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-24 10:07:28 +02:00
Caspar Friedrich
598de06165 drivers: ds2484: Fix wrong early exit during suspend/resume
The sleep pin is optional and the driver checks for availability during
runtime. Currently the logic is inverted and therefore the driver exits
early if the pin is actually available. This pr fixes this behavior.

Also: Add `fallthrough` flags to switch/case

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2022-08-24 10:06:58 +02:00
Francois Ramu
8bc8b8eec1 drivers: dma: stm32 Kconfig with the new DT_HAS_<COMPAT>_ENABLED.
This commit is converting the DMA kconfig for the stm32 dma driver
with new macro DT_HAS_<COMPAT>_ENABLED.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-24 10:05:32 +02:00
Francois Ramu
3fafe7fdee drivers: dma: new dma peripheral driver for stm32u5
It includes the definition for the DMA peripheral of this type,
present on stm32U5 devices.
A particular DMA_STM32U5 config is selected for that purpose.
The driver is derived from the existing dma_stm32.c
The GPDMA is counting channels (0-15) ; stream offset is 0.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-24 10:05:32 +02:00
TLIG Dhaou
402ebb3df0 drivers: counter: Patch for the stm32 counter
Fix the TIM_Typedef types.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-23 20:08:35 +02:00
TLIG Dhaou
cc9b6bb0b4 drivers: ethernet: patch for the stm32 drivers
This commit is a patch to fix the ETH buffer redefined in many files.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-23 20:08:35 +02:00
Tim Lin
822c37745e soc: it8xxx2: pull more function into ram code section
Pull more function into ram code section to effectively improve
access speed and performance.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-08-23 10:16:36 +02:00
Tim Lin
cb041d062f ITE: drivers/i2c: Add I2C FIFO mode
Adding I2C FIFO mode can reduce the time between each byte to
improve the I2C bus clock stretching during I2C transaction.
The I2C master supports two 32-bytes FIFOs, channel A and C
are supported now.

I2C FIFO mode of it8xxx2 can support I2C APIs including:
i2c_write(), i2c_read(), i2c_burst_read.

Test:
1. tests\drivers\i2c\i2c_api --> pass
2. Reading 16 bytes of data through i2c_burst_read() can reduce
   0.52ms(2.4ms->1.88ms) compared to the original pio mode when the
   frequency is 100KHz.
3. It is normal to read sensor data through I2C on Nereid's platform.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-08-23 10:16:36 +02:00
Carlo Caione
4806e1087e cache: Fix cache API calling from userspace
When a cache API function is called from userspace, this results on
ARM64 in an OOPS (bad syscall error). This is due to at least two
different factors:

- the location of the cache handlers is preventing the linker to
  actually find the handlers
- specifically for ARM64 and ARC some cache handling functions are not
  implemented (when userspace is not used the compiler simply optimizes
  out these calls)

Fix the problem by:

- moving the userspace cache handlers to a their logical and proper
  location (in the drivers directory)
- adding the missing handlers for ARM64 and ARC

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-08-23 10:14:17 +02:00
Ravik Hasija
4a18e6f581 drivers: gpio: Updating driver to Enable Multiple Interrupts.
Change Summary:
- Updating GPIO_CFG_IRQ define to enable multiple interrupts to
  accomodate for IP configuration where each pin when interrupted
  can trigger CPU interrupt.
- Removing gpio_dw_unmask_int define as it is NO OP

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-08-22 19:38:37 +02:00
Bartosz Bilas
755c0d57e8 drivers: sensor: ina237: add support for triggered mode
Add missing support for the triggered mode using GPIO
interrupt alert pin. It uses mode detection at runtime
which allows working multiple sensors with different
modes simultaneously.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-08-22 19:38:06 +02:00
Kumar Gala
98922a0269 serial: uart_cc13xx_cc26xx: Remove dead code
Remove unused/referenced UART_CC13XX_CC26XX_DEVICE_INIT macro.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-22 12:40:17 -04:00
Tim Lin
001aa3a351 ITE: drivers/i2c_enhance: CQ mode isn't allowed to enter power policy
I2C CQ mode cannot enter power policy during transfer.

test: tests\driver\i2c\i2c_api--> pass

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-08-22 16:30:45 +00:00
Gerard Marull-Paretas
a202341958 devices: constify device pointers initialized at compile time
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
Gerard Marull-Paretas
5825c8c5ab drivers: i2c: ll_stm32: s/clock/clk
Fix reported compliance issue: WARNING: Violation to rule 21.2 (Should
not used a reserved identifier) - clock

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
Henrik Brix Andersen
fda3f54002 drivers: can: return -ENETUNREACH from can_send() if in bus off state
Change the error code for can_send() when the CAN controller is in bus off
state from -ENETDOWN to -ENETUNREACH.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-22 14:33:17 +00:00
Andrzej Głąbek
32a87215d7 drivers: pinctrl_nrf: Fix nrf_pin_configure() implementation
This is a follow-up to commit fd07675574.

The above commit was supposed to introduce overriding of the S0S1
drive setting with S0D1 for TWI/TWIM peripherals, but since it did
not properly update the `nrf_pin_configure()` function (the `drive`
parameter was only added in the function signature, but then it was
not used...), the drive setting was in fact not overridden.
This commit corrects this embarrassing oversight.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-08-22 16:17:59 +02:00
Francois Ramu
0f0a3743d2 drivers: adc: stm32U5 channel preselection
The stm32U5 LL function name differs from stm32H7 serie but must
still be enabled in the PCSEL.
This is done with the LL_ADC_SetChannelPreselection function
until the LL changes its name.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-22 10:23:53 +00:00
Francois Ramu
d9b78e0959 drivers: entropy: stm32 rng driver configuration for NIST
The driver is writing the DTS nist-config to the RNG periph.
following the validation sequence described by the RefMan.
It depends on the he RNG IP version and is present on some
mcu devices : all with CONDRST bit.
Depends on the RNG CR Autoreset.
Takes the Health test control Register if property is given.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-22 10:22:20 +00:00
Francois Ramu
2fd6f76301 drivers: entropy: stm32 driver waits for the CondRst reset
For the stm32 mcu with a CONDRST bit in its RNG_CR
for conditioning Soft Reset, the driver must wait for
the bit to be 0 after disabling. This could take
about 2 AHB clock cycles + 2RNG clock cycles.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-22 10:22:20 +00:00
Kumar Gala
5851a7b7de drivers: gpio: xlnx_ps: Fix compiler warning
Recent change to constify struct devices pointers introduced a
compile warning in gpio_xlnx_ps driver.  Update driver to fix a
case that got missed in the constification that fixes the warning.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-20 11:32:37 -05:00
Immo Birnbaum
1738e9e928 drivers: serial: uart_xlnx_ps: switch over to DEVICE_MMIO API
Switch the Xilinx PS UART device driver over to the use of the
DEVICE_MMIO_... macros instead of just using the physical base
address from the device tree.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-08-19 20:41:26 +00:00
Kumar Gala
de894f8aab dts: Replace DT_LABEL(node) with DT_PROP(node, label)
Toward deprecated DT_LABEL() macro, replace the handful of cases
that use DT_LABEL(node) with DT_PROP(node, label).

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-19 06:49:50 -05:00
Jaska Uimonen
108b76eb16 drivers: dai: intel: ssp: add dai index to config
Dai index should be added to config as it can be queried by the
application like sof. Also check for dynamically allocated params
when returning the config.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-08-19 12:09:14 +02:00
Jaska Uimonen
6b8c387246 drivers: dai: intel: dmic: use dai dir enum
Use dai direction enum instead of internal define.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-08-19 12:09:14 +02:00
Jaska Uimonen
7299e1798f drivers: dai: intel: alh: add dai index to config
Dai index should be added to config as it can be queried by the
application like sof.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-08-19 12:09:14 +02:00
Adam Zelik
d0bb17ab37 drivers: timer: Increase default user-allocable channel count to 3
Increase the default user-allocable number of RTC channels to meet
the nrf_802154 driver requirements.

Signed-off-by: Adam Zelik <adam.zelik@nordicsemi.no>
2022-08-19 12:08:59 +02:00
Gerard Marull-Paretas
e0125d04af devices: constify statically initialized device pointers
It is frequent to find variable definitions like this:

```c
static const struct device *dev = DEVICE_DT_GET(...)
```

That is, module level variables that are statically initialized with a
device reference. Such value is, in most cases, never changed meaning
the variable can also be declared as const (immutable). This patch
constifies all such cases.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
f9ab078dd0 drivers: serial: pipe: init device at compile time and check if ready
Initialize UART pipe device at compile time, allowing to constify the
device pointer. Also fix device ready check (was checking for NULL, an
always true condition when using DEVICE_DT_GET).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
9db97fc08f drivers: intc: miwu: remove redundant declarations
Remove redundant definitions by defining at the top before variable is
used. Also constify device array.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
4c575fa37d drivers: intc: ioapic: initialize vtd device at compile time
Initialize the vtd device at compile time. Also removed unnecessary
macro hackery. As a result, vtd pointer can be constified.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
a3b01b00d4 drivers: gpio: npcx: remove redundant declarations
Remove redundant declarations by definining and initializing before
variables are used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
6b1e4baee4 drivers: counter: mcux_qtmr: initialize timer devices at compile time
Initialize timer devices at compile time. This allows to constify the
array of timer devices.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
a0039a8134 drivers: console: initialize uart devices at compile time
A few drivers could initialize chosen UART at compile time, allowing to
constify device pointer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
82e75f8c3a drivers: clock_control: nrf: initialize temp sensor at compile time
Initialize temperature sensor at compile time, allowing to constify
device pointer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas
9dcd5a78df drivers: bluetooth: hci: initialize uart device at compile time
The UART device can be initialized at compile time, allowing to constify
the device pointer. Also fix return value to -ENODEV if device is not
ready.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Henrik Brix Andersen
590cd5cb72 drivers: can: rename can_state enumerations
Rename the can_state enumerations to contain the word STATE to make their
meaning more clear:
- CAN_ERROR_ACTIVE  => CAN_STATE_ERROR_ACTIVE
- CAN_ERROR_WARNING => CAN_STATE_ERROR_WARNING
- CAN_ERROR_PASSIVE => CAN_STATE_ERROR_PASSIVE
- CAN_BUS_OFF       => CAN_STATE_BUS_OFF

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 21:41:11 +00:00
Henrik Brix Andersen
7e3814b262 drivers: can: expand return values reported by the CAN timing functions
Expand the error return values reported by the CAN timing calculation
functions to be able to distinguish between an an out of range
bitrate/sample point, an unsupported bitrate, and a resulting sample point
outside the guard limit.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 21:39:16 +00:00
Henrik Brix Andersen
2b99b05d0a drivers: can: move bitrate limit checks to arbitration/data functions
Move the check for the maximum allowed CAN bitrate to the corresponding
can_calc_timing()/can_calc_timing_data() function.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 21:39:16 +00:00
Andrzej Głąbek
ec1ae253aa drivers: i2c_tca954x: Fix transfer function
This is a follow-up to commit e1c0a494b3.

The `tca954x_transfer()` function cannot call `i2c_transfer_dt()`,
because the I2C device address used in the transaction must be the one
passed as the `addr` parameter, not the address of the TCA954xA switch
itself. Hence, this commit restores the call to `i2c_transfer()`.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-08-18 15:14:16 -05:00
Tom Burdick
efc0928570 dma/hda: Use the correct register block size for each IP block
Previous versions were using, incorrectly, the host in/out regblock size
of 40 bytes for all peripherals when in fact the link in/out regblock size
is 20 bytes in size.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-18 14:54:57 -05:00
Andrzej Głąbek
ca4d8cf4ab drivers: sensor: mpu9250: Fix initialization routine
Fix a call that writes Register 29 - Accelerometer Configuration 2.
Due to an obvious copy-paste mistake in the code, this register was
written with a DLPF setting from devicetree intended for gyroscope,
not for accelerometer (and the latter was effectively ignored).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-08-18 16:08:23 +02:00
Fabio Baltieri
8c55073d59 gpio: move gpio_cmsdk_ahb.h from drivers to include/drivers
Move gpio_cmsdk_ahb.h out of drivers/gpio and into include/drivers/gpio.
This is used by few board files so it should be in include.

This allows to remove few odd
"zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)".

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:13:14 +00:00
Fabio Baltieri
bf47c2a763 drivers: drop few unused pinmux.h include
Drop few unused include pinmux header from drivers that don't seem to be
using it anymore.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:13:14 +00:00
Fabio Baltieri
681372bb3d board: v2m_beetle: drop CONFIG_PINMUX=y
There's no actual pinmux subsystem driver for v2m_beetle, and
CONFIG_PINMUX is only used as a proxy to build pinmux.c.

Drop the config and change the file to be built unconditionally (same as
mps2_an521 and mps2_an385.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:13:14 +00:00
Benjamin Björnsson
7bd1451a18 drivers: mdio: mdio: Update mdio_shell to use DEVICE_DT_GET
Update mdio_shell to use DEVICE_DT_GET to remove usage of
device_get_binding.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-08-18 11:32:02 +00:00
Jan Kuliga
2ddd221120 bme680: Rework setting the spi_mem_page accordingly to the datasheet
According to the BME680 datasheet, only the spi_mem_page bit can be
changed in its 8-bit register. Therefore we shouldn't just write 0s
to the remaining bits, but update the register content in read-modify-write
fashion instead.
Rework the bme680_set_mem_page(), bme680_init() and register-access
macros.

Signed-off-by: Jan Kuliga <jtkuliga@gmail.com>
2022-08-18 12:44:18 +02:00
Piotr Kmiecik
2ce143a3e5 drivers/counter: return 64-bit value
Extend the API to add the possibility
to return value of 64-bit counter.

Signed-off-by: Piotr Kmiecik <piotrx.kmiecik@intel.com>
2022-08-18 12:42:30 +02:00
Fabio Baltieri
0cba9cb8e9 drivers: sensor: max17055: add VFOCV support
Add support for reading the VFOCV register, which contains the model
estimated open circuit voltage for the cell.

Link: https://pdfserv.maximintegrated.com/en/an/AN6358.pdf
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:39:20 +02:00
Aymeric Aillet
df7ca2a24e drivers/clock/rcar: Move ASSERT to module clock function
ASSERT was failing when `r8a7795_cpg_mssr_start_stop` was
called for a "core" clock.

This ASSERT statement and "mstpcr" table of registers are
only meant to be used when starting or stopping a "module" clock.

Moved ASSERT statement to `rcar_cpg_mstp_clock_endisable`
as well as "reg" & "bit" calculation.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-08-18 12:31:12 +02:00
Kumar Gala
9a7e4b162d pwm: stm32: Remove support for deprecated st,prescaler prop
Remove code that supported deprecated st,prescaler devicetree property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-18 10:20:32 +02:00
Andrei Emeltchenko
054b6d7287 pcie: shell: Replace shell argument with sh
Fix Zephyr coding guidelines warnings.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-08-18 10:19:49 +02:00
Andrei Emeltchenko
3029d2fba8 pcie: shell: Add dump and BDF string arguments
Add argument dump for dumping first 16 PCI configuration space
registers same way lspci -x is doing. Also parse bdf string as
argument. pcie can be called following way:

  uart:~$ pcie 0:1f.4
   ...
  uart:~$ pcie 0:1f.4 dump
   ...

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-08-18 10:19:49 +02:00
Henrik Brix Andersen
d1d48e8304 net: socketcan: rename SocketCAN header from socket_can.h to socketcan.h
Rename the SocketCAN header from socket_can.h to socketcan.h to better
match the naming of the functionality.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
2431060116 drivers: can: mcux: flexcan: rename internal funtions to not use zcan
Rename the NXP FlexCAN driver internal functions and macros to not use
"zcan", "zframe", and "zfilter" to avoid confusion after "struct can_frame"
and "struct can_filter" renaming.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
bcd936b3b1 drivers: can: mcp2515: rename internal funtions to not use zcan
Rename the mcp2515 driver internal functions to not use "zcan" to avoid
confusion after "struct can_frame" renaming.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
Henrik Brix Andersen
13c75417ba drivers: can: remove z prefix from public CAN API types
Remove the "z" prefix from the public CAN controller API types as this
makes them appear as internal APIs.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 10:19:29 +02:00
TOKITA Hiroshi
a7721aa30d drivers: spi: pl022: Support interrupt based transfer
Add interrupt based transfer feature for the PL022 SPI.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-08-18 10:18:16 +02:00
TOKITA Hiroshi
da32e26a3d drivers: spi: Add basic support for PL022
Add fundamental feature support for PL022 SPI peripheral.
This commit implements synchronous transfer with 8bit-MSB format.

Optional functions are not currently implemented yet.

- interrupt based transfer is not implemented yet.
- DMA transfer is not implemented yet.
- Slave mode is not implemented yet.
- Currently support only 8-bit data transfer.

Hardware limitation:

- LSB-first format is not supported by hardware.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-08-18 10:18:16 +02:00
Declan Snyder
84f3a0a8c6 drivers: Fixes MCUX clock assignment
In clock_control_mcux_syscon.c,
add a break statement.

Fixes #48367

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-08-17 17:53:06 -05:00
Daniel DeGrasse
2a53abd511 drivers: soc_flash_mcux: remove dependency on CONFIG_HAS_MCUX_IAP
Remove flash driver dependency on CONFIG_HAS_MCUX_IAP for determining
if the SOC uses an NXP IAP flash controller, and instead use the
devicetree compatible to determine this.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-17 22:02:15 +00:00
Kumar Gala
8160f052d4 drivers: regulator: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-17 09:58:55 -05:00
Brian Dunlay
9f94db1805 drivers: eswifi: fix spi initialization
This change reverts a portion of a prior change that results
in an uninitialized eswifi_spi_data struct to be passed to
the `is_spi_ready` function.
See commit 48c87f2bf8

Signed-off-by: Brian Dunlay <brian.dunlay@gmail.com>
2022-08-17 12:10:02 +02:00
Crist Xu
17089a2e14 drivers: kscan_touch: enable the touch panel for rt1170
Enable the touch panel for the rt1170_evk

Signed-off-by: Crist Xu <crist.xu@nxp.com>
2022-08-17 12:07:44 +02:00
Gerard Marull-Paretas
f3017aa787 drivers: gpio: make gpio_utils.h a self-contained header
gpio_utils.h header relied on other files including its dependencies.
This patch adds all necessary includes to make it self-contained.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-17 08:14:57 +00:00
Kumar Gala
ecd6632f36 drivers: bbram: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-16 18:08:42 -05:00
Yves Vandervennet
6f8ee2cdf7 flash: nxp: removal of deprecated binding nxp,lpc-iap
The binding 'nxp,lpc-iap' is no longer used, which is confirmed
by running:

$ find ${ZEPHYR_BASE}/dts/arm/nxp -type f | egrep -e '\.dts(i)*$' | \
  xargs grep -nH nxp,lpc-iap

Changes in this commit:
 - remove DT_HAS_NXP_LPC... in drivers/flash/Kconfig.mcux
 - remove schema file for nxp,lpc-iap

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2022-08-16 13:45:08 -05:00
Yves Vandervennet
da3d0b3492 flash: nxp: updating drivers, Kconfig and device trees with new bindings
The lpc and mcux drivers' DRV_COMPAT is updated for the new bindings
introduced in the previous commit. The drivers' Kconfig files also
reflect this change (DT_HAS_ENABLED_NXP_...).
The SoC device trees are updated with the new bindings

Signed-off-by: Yves Vandervennet <yves.vandervennet@nxp.com>
2022-08-16 13:45:08 -05:00
Tim Cooijmans
4c285fc53c drivers: lora: Add support for setting sync-word and iq-inverted
Add support for setting sync-word and iq-inverted in lora_modem_config. By
being able to set the sync-word it's possible to send "raw" public-network
packets using lora_send and using iq-inverted both uplink and downlink
messages can be sent.

Signed-off-by: Tim Cooijmans <timcooijmans@gmail.com>
2022-08-16 18:06:18 +02:00
Felipe Neves
d94dc98fd6 soc: xtensa: esp32_net: fixes include paths
that were changed with zephyr prefix  after rebasing.
Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-08-16 18:06:02 +02:00
Felipe Neves
a5379b71f8 drivers: ipm: ipm_esp32: remove hardcoded nodelabels
by making shared memory property  of IPM binding.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-08-16 18:06:02 +02:00
Felipe Neves
4bff7ecab3 drivers: ipm: esp32: added IPM driver
implemented by software for esp32 dual core
variants.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-08-16 18:06:02 +02:00
Maureen Helm
0514c3b139 drivers: sensor: Fix apds9960 device pointer initialization
Fixes a bus fault observed in samples/boards/reel_board/mesh_badge
caused by dereferencing an uninitialized device pointer in the apds9960
sensor driver. The device pointer needs to be initialized regardless of
how CONFIG_APDS9960_TRIGGER is configured.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-08-16 14:11:30 +00:00
Kumar Gala
e5de3ac656 drivers: reset: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-16 09:10:37 -05:00
Pieter De Gendt
e328c2bb7d drivers: memc: Introduce Atmel SAM SMC/EBI driver
Add a driver to support external memory connected to the SMC port
for Atmel SAM devices.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-08-16 12:53:50 +02:00
Andreas Sandberg
a43fd92c4e drivers: ssd16xx: Make SSD1673 registers optional
The SSD16xx driver currently hard-codes a couple of register overrides
that aren't relevant or even correct for many devices. Make them
optional device tree properties instead.

Note that this changes the behavior for panels that expect
SSD16XX_CMD_DUMMY_LINE and SSD16XX_CMD_GATE_LINE_WIDTH to be set by
the driver. This fixes a bug where the incorrect value
was written to all SSD16xx panels except for GDEH0213B1 and GDEH029A1.

The overlay files for devices that need dummy line and gate line width
to be specified have been updated as a part of this commit.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Andreas Sandberg
532ab8c13d drivers: ssd16xx: Make voltage overrides optional
The OTP in most SSD16xx-based displays normally contain default
VCOM/GDV/SDV values. Make all of these optional in the device tree.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Andreas Sandberg
aa68ebf1d4 drivers: ssd16xx: Add a helper for uint8 writes
Many register writes only use 8 bits of data. A common pattern in the
driver is to assign a constant to a temporary variable and write that
to the device. Simplify this pattern by adding a helper function that
writes an uint8 to a device.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Andreas Sandberg
0c343344eb drivers: ssd16xx: Refactor activation
Device activation always follows the same sequence, we first write the
SSD16XX_CMD_UPDATE_CTRL_2 register followed by
SSD16XX_CMD_MASTER_ACTIVATION. Create a helper function that performs
both of these actions.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-08-16 11:32:26 +02:00
Daniel Leung
ca4c2c9b7f console: uart_mux: uart_mux_send to return number of bytes sent
This changes the return value of uart_mux_send() to return
how many bytes sent instead of simply zero for any bytes sent.
This would make it consistent with other UART send commands where
they return number of bytes sent.

Fixes #48470

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-16 08:28:03 +00:00
Kumar Gala
210044b788 drivers: peci: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-16 08:26:11 +00:00
Hari Haran Babu
470c447cd7 Revert "drivers: ethernet: w5500: Toggle reset gpio"
This reverts commit 17f8f62789.

Signed-off-by: Hari Haran Babu <hariharan@linumiz.com>
2022-08-15 17:48:57 +00:00
Jordan Yates
2df6ac09de bluetooth: hci: spi: minimum reset duration
Add the option to specify the minimum duration that the `reset-gpios`
pin is held low on boot. This lets devices with additional capacitance
on the reset line still reboot the Bluetooth controller.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-08-15 14:33:01 +02:00
Kumar Gala
d36125654e drivers: ethernet: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-15 14:32:45 +02:00
Kumar Gala
150332be1a drivers: ethernet: remove duplicate CMake entry
Building for dsa_ksz8xxx.c was listed twice.  Remove duplicate.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-15 14:32:45 +02:00
John Kjellberg
6076991fdb drivers/disk: sdmmc: Add DMA support.
This fixes underrun issues when hardware flow control can't be used.

Only tested on STM32F4.

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>

...
2022-08-15 14:31:35 +02:00
Flavio Ceolin
b39d897b09 adsp: gpdma: Move gpdma code to driver
DMA controller ownership can be done in the driver
initialization, it does not need to be part of the SoC. It simplify
the code and remove duplicated definitions.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-08-15 08:21:53 +00:00
Thomas Stranger
a50814dc9d drivers: w1: use select SERIAL in Kconfig for w1-zephyr-serial driver
Use 'select SERIAL', as a serial driver is supported by practically
all boards, and avoids using extra overlays in samples and tests.

The pattern of using select was introduced for SENSORS in df81fef944,
and the only 1-wire I2C sensor was converted in 465b7615a9.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-08-14 09:08:19 -05:00
Kumar Gala
baaf904885 video: Move to using select in Kconfig for I2C bus
Move to using select I2C' instead of 'depends on'
(see commit df81fef944 for more
 details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-14 09:05:36 -05:00
Kumar Gala
b37f393079 drivers: audio: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using 'select I2C'/'select I2S' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-14 09:05:09 -05:00
Kumar Gala
6573f9e195 drivers: syscon: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-14 09:04:33 -05:00
Kumar Gala
01c4e02240 kscan: sdl: Convert driver over to devicetree
Move kscan SDL driver to be based on devicetree.  This is similar to
how the display SDL driver works.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 17:54:03 -05:00
Navin Sankar Velliangiri
9315aef26d drivers: hwinfo: Exclude SYSCON driver on LPC51U68
The hwinfo_mcux_syscon driver isn't relavant for LPC51U68 SoC
series. Add a Kconfig exclusion so the driver isn't available
on LPC51U68 SoC.

Signed-off-by: Navin Sankar Velliangiri <navin@linumiz.com>
2022-08-12 16:15:42 -05:00
Navin Sankar Velliangiri
6ed5653365 drivers: gpio: gpio_mcux_lpc: Allocate no of gpio ISR using macro
Allocate no of gpio ISR using macro INPUTMUX_PINTSEL_COUNT.

Signed-off-by: Navin Sankar Velliangiri <navin@linumiz.com>
2022-08-12 16:15:42 -05:00
Erwan Gouriou
f2b3be172b drivers: timer: lptim: Remove deprecation warning
It appears that some in tree boards still enable lptim w/o configured
domain clocks.
Remove this deprecation message the time a clean up is done fully.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 14:25:51 -05:00
Erwan Gouriou
6b14c4bdb0 drivers: uart: stm32: Enable wakeup source only if supported
LL_USART_EnableInStopMode may not be available on some series.
Since PM is not enabled on those series and might never be, use a
shortcut for this case.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 11:43:48 -05:00
Bo Svangård
93e8d9a16a fix: boards: sam0: uart: fix collision_detect parsing
fix collision detect property from devicetree parsing

Signed-off-by: Bo Svangård <bo.svangard@sylog.se>
2022-08-12 17:40:48 +02:00
Jamie McCrae
9433555f0d drivers: sensor: adxl372: Fix default bus issue
The adxl372 device does not select the correct bus that it is on, which
causes undefined operation (usually a fault). This driver should not be
using Kconfig to determine which bus to use, that should be done by
dts, however this works as a quick fix in the interim until the driver
can be fixed properly.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-08-12 17:39:28 +02:00
Kumar Gala
e438da8a36 adc: Move to using select in Kconfig for I2C & SPI busses
Move to using 'select SPI'/'select I2C' instead of 'depends on'
(see commit df81fef944 for more
 details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 17:39:21 +02:00
Kumar Gala
e4db24b891 drivers: sdhc: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 17:39:15 +02:00
Kumar Gala
45a80d3442 drivers: mipi_dsi: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 10:23:31 -05:00
Kumar Gala
18a1db193d drivers: dac: Update Kconfig for 'select I2C/SPI'
* Move to using 'select I2C/SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 16:18:35 +02:00
Ryan Erickson
3c3a857f79 modem: hl7800 fix runtime log level control
mdm_hl7800_log_filter_set uses LOG_MODULE_NAME which
is undefined.
log_source_id_get() will fail to get the correct source id.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-08-12 16:18:27 +02:00
Kumar Gala
19801debc5 peci: ite_it8xxx2: Move interrupt select to driver Kconfig
The driver really should select PECI_INTERRUPT_DRIVEN instead
of doing it in the SoC Kconfig.defconfig.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 14:16:59 +01:00
Kumar Gala
89f356a0ff peci: ite_it8xxx2: Rename compatiable to match other compatiables
All the of the ITE it8xxx2 devicetree compatiables are of the form
ite,it8xxx2-<DEV>.  However the PECI device was ite,peci-it8xxx2,
rename the compatiable to match the pattern used everywhere else.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 14:16:59 +01:00
Kumar Gala
465b7615a9 drivers: w1: Move to using select in Kconfig for I2C bus
Move to using select I2C' instead of 'depends on'
(see commit df81fef944 for more
 details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 14:15:53 +01:00
Henrik Brix Andersen
c11326300f drivers: can: remove option for configuring CAN-FD max DLC
Remove the Kconfig option for configuring the maximum value of the CAN-FD
Data Length Code in order to ensure standard compliance.

Allowing users to configure the max DLC allows the user to save a number of
bytes per CAN frame in RAM, but it also renders the Zephyr CAN-FD
implementation non-compliant with the CAN-FD standard.

There are no guarantees that a Zephyr CAN-FD node will not receive a CAN
frame with a DLC higher than the Kconfig limit, which opens up for all
sorts of bugs when trying to handle received CAN-FD frames.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-12 14:15:10 +01:00
Henrik Brix Andersen
c3c1bc1ae5 drivers: can: utils: change can_utils_filter_match() return type to bool
Change the return type for can_utils_filter_match() to bool and add
documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-12 14:14:52 +01:00
Francois Ramu
cb196fe02b drivers: gpio: stm32F1x serie does not provide the pin get config
The stm32F1x serie does not provide the pin_get_config function,
Even if the CONFIG_GPIO_GET_CONFIG is set, the -ENOSYS error code
is returned by the z_impl_gpio_pin_get_config().

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-12 14:13:37 +01:00
Francois Ramu
99f8579c0b drivers: gpio: stm32 driver uses a structure to hold the pin configuration
Define a pin structure to carry the pin configuration elements
such as push/pull, opendrain, input/output, high/low.
This structure will give the gpio_flags_t to the gpio_stm32_get_config.
Only the stm32F1x serie does not provide the pin config get function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-12 14:13:37 +01:00
Francois Ramu
bb299b1194 drivers: gpio stm32 driver also get the pin state
In the stm32 gpio driver, the gpio_stm32_get_config function
also returns the pin state HIGH or LOW) to match gpio_pin_get_config
This is valid with CONFIG_GPIO_GET_CONFIG.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-12 14:13:37 +01:00
Kumar Gala
78745b2de9 flash: nios2_qspi: Convert driver to be devicetree based
Do simple conversion of driver to have driver enabled by devicetree
in Kconfig and struct device created based on basic devicetree
data.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 08:11:42 -04:00
Kumar Gala
9e9aab3bcf drivers: can: Move to using select in Kconfig for SPI bus
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:34:31 +02:00
Kumar Gala
a96ef8a631 drivers: misc: ft8xx: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:34:21 +02:00
Kumar Gala
d9882ff422 eeprom: Move to using select in Kconfig for I2C & SPI busses
Move to using 'select SPI'/'select I2C' instead of 'depends on'
(see commit df81fef944 for more
 details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:34:16 +02:00
Kumar Gala
f835bc21f5 drivers: pm_cpu_ops: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:34:10 +02:00
Kumar Gala
6124ccfccf drivers: ethernet: provide Kconfig means to disable ethernet drivers
There are several test cases that create fake ethernet devices and
expect the fake device to be the only ethernet device enabled.  Some
tests handle this be explicitly disabling actual ethernet drivers,
but this doesn't scale well.

Change drivers/ethernet/Kconfig to utilze a menuconfig option that
wraps all the drivers.  This allows us for those test cases that
don't want any actual ethernet drivers to disable them with a
simple CONFIG_ETH_DRIVER=n.

Note, the fake ethernet devices utilize CONFIG_ETH_INIT_PRIORITY so
we have it outside of the 'if ETH_DRIVER' block.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:33:43 +02:00
Kumar Gala
616342d58b drivers: ieee802154: Move to using select in Kconfig for SPI bus
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:33:02 +02:00
Erwan Gouriou
e89e4b529e drivers: serial: stm32: Don't block PM if pinctrl sleep state is absent
When dealing with pm action 'suspend', driver applies device pinctrl sleep
state.
Using PM_DEVICE modes should allow to save more current consumption, and
applying pinctrl sleep state is one of the gains, but sleep state not being
available on a device is not a sufficient reason to block PM transition
to lower power mode.
If this pin state is not provided for the device, warn but don't block
pm transition. This will save some time to users setting up this feature
for the first time. Warning will give the opportunity to users to fine
tune their setup in a later step.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:51:38 +01:00
Erwan Gouriou
a439c04eb4 drivers: serial: stm32: Implement PM_DEVICE mode support
Implement PM_DEVICE support and treatment of _pm_action hook.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:51:38 +01:00
Erwan Gouriou
4422de5692 drivers: serial: stm32: Add wakeup capability support
Add wakeup capability support.
wip comment

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:51:38 +01:00
Erwan Gouriou
bbac316be7 drivers: timer: stm32: Use dt to configure LPTIM domain clock
Instead of relying on Kconfig, use dt inputs to configure LPTIM domain
clck (LSI/lSE).
Clock control dedicated APIs are used for configuration and get the
frequency of domain clock in use.
Constants macros used previously to store frequency and time base are
converted to static global variables.

Some code was set up specifically to keep compatibility with targets
that still use Kconfig to configure domain clock. This will be removed
after a deprecation period.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:50:29 +01:00
Erwan Gouriou
7f6d3e5336 drivers: timer: stm32: Use dt instance for LPTIM bus clock
Continue conversion of LPTIM driver to device tree based configuration.
Get clock configuration from device tree and use clock_control API for
bus clock configuration

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:50:29 +01:00
Erwan Gouriou
f8b1a18271 drivers: timer: stm32: Use dt instance for LPTIM base address /IRQ
Start converting LPTIM driver to device tree based configuration and
support of other instances.
First: get base address and IRQ using dt instance

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 08:50:29 +01:00
Declan Snyder
d556a0c8a6 drivers: entropy: Add entropy driver for MCUX CAAM
Added entropy shim driver for MCUX CAAM and Kconfig symbol

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-08-11 17:14:43 -05:00
Tom Burdick
006d9ffceb i2c: mcux transfer with callbacks
Implements i2c_transfer_cb for the mcux driver

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-11 14:12:13 -04:00
Tom Burdick
a45ece6984 i2c: Adds i2c_transfer_async API for I2C
i2c_transfer_async is the asynchronous version of i2c_transfer where
the completion of the transfer is notified to the caller using a callback.

This can be used in conjuction with the common callbacks and datatypes
in async.h for directly doing an async transfer with an IPC object
to notify a thread.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-11 14:12:13 -04:00
Kumar Gala
db0a8c63fe drivers: led: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using select I2C' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-11 17:46:43 +02:00
Benjamin Bigler
b9c6ca1d43 drivers: clock_control: stm32u5: Fix frequency calculation overflow
STM32u5 pllout frequency calculation overflows. Fix by changing
order of operations

Signed-off-by: Benjamin Bigler <benjamin.bigler@securiton.ch>
2022-08-11 17:46:33 +02:00
Benjamin Bigler
a6a774c9f1 drivers: clock_control: stm32h7: Fix frequency calculation overflow
STM32h7 pllout frequency calculation overflows. In the
worst case pllsrc_freq can be 50Mhz and plln_mul 512 which will cause
an overflow of the intermediate result which leads to wrong frequency
returned. As no intermediate result can be bigger than 960MHz only the
order of operations is changed.

Signed-off-by: Benjamin Bigler <benjamin.bigler@securiton.ch>
2022-08-11 17:46:33 +02:00
Gerson Fernando Budke
9562e3f794 drivers: flash: sam: Fix driver support
The current atmel sam flash driver was develop based on the cortex-m7
version of smart arm microcontroller. The driver support write
protection and cache functions which is not supported by other cortex-m
variants. This fixes current driver implementation and devicetree
entries for all sam variants.

Notes:
 * The cortex-m3 doesn't have support erase pages flash command and
   because of that the driver still not not compatible. Keep it disabled
   until a patch be send. The hwinfo driver is not affected by this
   restriction.
 * The sam4l variation requires a specific driver because uses another
   flash controller (flashcalw). Added another compatible to
   differentiate and keeped node disabled until a driver be available.

Fixes #48516

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-08-11 07:41:09 -05:00
Erwan Gouriou
341844979e drivers: clock_control: stm32: LSE Propagation
When supported, LSE propagation should be enabled

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-11 13:22:58 +01:00
Declan Snyder
462d87c619 drivers: entropy: cleaned up mcux code
cleaned up some code in 3 mcux entropy drivers,
removing unnecessary void casts and function declarations

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2022-08-11 12:20:12 +02:00
Krzysztof Chruscinski
13ae1c1c9e drivers: serial: nrf: Tweak default values for workaround
Relax a bit default values used for DK serial workaround.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-08-11 12:15:11 +02:00
Wojciech Slenska
aebd68ea41 drivers: counter: stm32u5 family compatibility
In STM32U5X family there is no EXTI line for RTC.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2022-08-11 07:24:27 +01:00
Bryce Wilkins
405ebc0cd0 drivers: spi: Set spi context for mcux flexcomm spi slave configuration
This is a bug fix. A pointer to the spi configuration is not saved when
the spi driver is configured for slave operation and it can lead to
runtime errors.

Signed-off-by: Bryce Wilkins <bryce.wilkins@gmail.com>
2022-08-10 22:01:11 -05:00
TOKITA Hiroshi
a70627a621 drivers: sensor: adxl345: Correct converting counts to sensor value
Sensor value unit is [m/s^2].
Currently calcs as [g/1000] unit.

Correcting calculation to convert [m/s^2].
Store the integer part to val1, and the fractional part to val2.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-08-10 10:54:16 -05:00
Romain Mahoux
4618ad53c7 drivers/apbuart: fix polling mode
Header file generation from device tree was failing in pulling mode.
Restrict the interrupt node usage to interrupt mode only.

Signed-off-by: Romain Mahoux <romain@mahoux.fr>
2022-08-10 16:11:11 +02:00
Francois Ramu
317ce524f8 drivers: clock control: stm32U5 set flash latency before clocks
As mentionned here, setting flash latency before any clock setting,
and especially before the PLL.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-10 14:32:14 +02:00
Francois Ramu
7edcd8d364 drivers: clock control: stm32U5 set regulator voltage before clocks
The regulator voltage should be set before the clocks are enabled.
This is especially the case when the MSIS at 48MHz is selected as
SYSCLK.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-10 14:32:14 +02:00
TOKITA Hiroshi
eca3b1067e dts: riscv: gd32vf103: Use IRQ7 for interrupt of riscv_machine_timer
IRQ7 is placed on the second element of interrupt definition.
Select it by DT_INST_IRQ_BY_IDX() explicitly.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-08-10 13:08:27 +02:00
Stephanos Ioannidis
681eec4cd8 drivers: counter: Fix infinite recursion in alarm cancel function
This commit fixes an infinite recursion in the
`z_vrfy_counter_cancel_channel_alarm` function.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-10 13:07:58 +02:00
Krzysztof Frydryk
8dd57467cc drivers: dai: Enable Zephyr runtime power mgmt in Intel SSP driver
Enable Zephyr device runtime power management mechanisms in Intel SSP
driver. This allows Zephyr to track usage reference for power
domain gating.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2022-08-10 11:58:45 +02:00
Krzysztof Frydryk
078de4e021 power_domain: Intel ADSP: Add power gating mechanism for Intel ADSP devices
This adds power domain gating mechanisms for Intel ADSP devices.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2022-08-10 11:58:45 +02:00
Kumar Gala
287043cddb drivers: kscan: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using select I2C' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 23:37:46 -05:00
Kumar Gala
f2fa572561 entropy: remove Kconfig.defconfig* setting of entropy drivers
Now that entropy drivers are enabled based on devicetree
we need to remove any cases of them getting enabled by
Kconfig.defconfig* files as this can lead to errors.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 23:37:33 -05:00
Henrik Brix Andersen
b5a79fa4ad drivers: watchdog: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
5a61e664b7 drivers: usb: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
e9f4c91a02 drivers: timer: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
d6776fe169 drivers: spi: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
9456eca5c0 drivers: serial: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
78dd25e79e drivers: sensor: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
9c1833b2e8 drivers: sdhc: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
c8a5d058aa drivers: pwm: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
9c626a07d4 drivers: memc: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
59fc838532 drivers: ipm: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
5a7eb0ccfc drivers: intc: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
2e1f25f355 drivers: i2s: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
e84636d010 drivers: i2c: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
9c71615f83 drivers: gpio: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
c1a35b7b39 drivers: flash: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
5ade8908a7 drivers: ethernet: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
88614ecf4f drivers: espi: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
d0e34899a6 drivers: entropy: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
dc0b907f4b drivers: dma: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
31681269c0 drivers: display: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
e7df446f64 drivers: disk: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
d4a2f316cb drivers: dac: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
987ec97663 drivers: crypto: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
e885ead428 drivers: counter: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
035c7d2190 drivers: can: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Henrik Brix Andersen
68230cb1a7 drivers: adc: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Francois Ramu
0852cf9eee drivers: flash: ospi for stm32 mcu
Fixes command configuration to have samples/drivers/spi_flash
passed on stm32l562 and stm32u585 disco kits.
In OctoSPI STR/DTR and SPI/STR modes

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-09 15:59:18 +01:00
Julien D'Ascenzio
a703cbe9ce drivers: timer: stm32 lptim fix long time interrupt locking
The waiting of the flag ARROK could be quite long (100µs-200µs in my
test). During this time, the interrupts are locked that is not
recommended. To avoid this, we manage the update of the autoreload value
in interruption

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2022-08-09 12:31:28 +02:00
XiNGRZ Chan
7109632046 drivers: spi_esp32_spim: Add support for IOMUX mode
In order to work on a clock speed higher than 20 MHz, IO MUX is required.

Co-authored-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
Signed-off-by: XiNGRZ Chan <hi@xingrz.me>
2022-08-09 12:31:23 +02:00
Erwan Gouriou
ec37ced258 drivers: bluetooth: stm32wb: Cleanup unused definition
This definition is not used anymore, clean it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-09 12:31:16 +02:00
Erwan Gouriou
946304e799 drivers: bluetooth: stm32wb: Put HCI messages under CONFIG_BT_HCI_HOST
HCI message sending in this hci driver as these actions require hci_host
to be available and could be performed by the remote host if required.
Explicit this dependency using CONFIG_BT_HCI_HOST.
This is is required to be able to compile BT_HCI_RAW mode.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-09 12:31:16 +02:00
Erwan Gouriou
41422f99fe drivers: bluetooth: hci: stm32wb: Take advantage of host drivern reset
Don't perform HCI reset in the driver but get the host to perform it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-09 12:31:16 +02:00
Gerard Marull-Paretas
a7c3e7e84a doxygen: remove redundant usages of def
The def command Indicates that a comment block contains documentation
for a #define macro. This is useful if the comment block documents a
macro not adjacent to it, e.g.

```c
/**
 * @def MAX(x,y)
 * @brief Computes the maximum of @a x and @a y.
 */
 #ifdef XXX
 #define MAX(x,y) ...
 #endif
```

However, it is not necessary if the comment is adjacent to the
definition, e.g.

```c
/**
 * @brief Computes the maximum of @a x and @a y.
 */
 #define MAX(x,y) ...
```

This patch removes all unnecessary def entries in-tree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-09 12:29:28 +02:00
Daniel DeGrasse
d29e34c7c9 drivers: eth_mcux: remove interrupt clearing code
Remove code that clears spurious interrupt flags, as this step is
not required.

Performance change (as tested with iperf on RT1050)
TCP RX: 50.8Mbps->50.6Mbps
TCP TX: 46.2Mbps->49.5Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse
ee4a338bfd drivers: eth_mcux: move intermediate driver buffers into DTCM
move intermediate driver buffers into DTCM, to reduce copy latency

Performance change (as tested with iperf on RT1050)
TCP RX: 48.6Mbps->49.1Mbps
TCP TX: 40.7Mbps->40.8Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse
5dd5fab2b6 drivers: eth_mcux: remove TX thread and allow for multiple TX buffers
remove the TX thread, as this thread can become starved and unable to
reclaim TX buffers from the hardware. Instead reclaim buffers in ISR.
Change eth_tx function to first take from the tx_buf_sem, so that multiple
TX buffer descriptors can be used effectively.

Performance change (as tested with iperf on RT1050)
TCP RX: 44.6Mbps->48.6Mbps
TCP TX: 38.1Mbps->40.7Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse
af62fbc105 drivers: eth_mcux: move dma buffers and buffer descriptors to DTCM
Move dma buffers and buffer descriptors to DTCM, to improve hardware
and software access speed during network TX/RX

Performance change (as tested with iperf on RT1050)
TCP RX: 40.6Mbps->44.6Mbps
TCP TX: 36.8Mbps->38.1Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Daniel DeGrasse
f595279bd7 drivers: eth_mcux allow network buffers to be cached
Do not force network buffers into noncacheable memory, as these buffers
are internal to the driver and not used by the hardware.

Performance change (as tested with iperf on RT1050):
TCP RX: 23.7Mbps->40.6Mbps
TCP TX: 22.3Mbps->36.8Mbps

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-08-09 12:29:18 +02:00
Attie Grande
51b22060c9 drivers: i2c: sam0: Lock bus before referencing messages
The I2C bus lock did not previously enclose the referencing of the
transfers to conduct. If two attempts are made to use the bus at a
similar time, then one set of messages may have been transferred twice.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-08-09 12:29:13 +02:00
Kumar Gala
63769bd1c1 drivers: display: Remove unnecessary Kconfig settings
Have the display enabled in devicetree will now get the driver
enabled by default when CONFIG_DISPLAY=y is set.  So we can remove
setting driver enabling Kconfig values in various .conf and
defconfig files.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 12:27:44 +02:00
Kumar Gala
902f42f491 drivers: display: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers
* Move to using 'select SPI' instead of 'depends on'
  (see commit df81fef944 for
   more details)

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 12:27:44 +02:00
Bartosz Bilas
e0101e244d drivers: pinctrl: stm32: Kconfig: add missing dependency
Add a missing `PINCTRL_STM32` dependency
for `PINCTRL_STM32_REMAP_INIT_PRIORITY` option to use
that option only when STM32 pinctrl driver is being used.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-08-08 14:17:45 +02:00
Erwan Gouriou
1ef9e9eb9b include: drivers: stm32 clock_control: Replace OPT by DOMAIN
In the continuation of the previous commit, replace _OPT_ by _DOMAIN_
in macros relating to this feature.
hen, adapt drivers and tests to this new wording.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-08 14:17:07 +02:00
Kumar Gala
5a4d1f7ac3 i2c: shell: Remove prefix filtering of device list
The I2C shell would filter the list of devices it knows about to
ones that have a device name that starts with "I2C_".  It was the
case that the majority of I2C bus controller devices happened
to be named with the "I2C_" prefix, however there is no guarantee
that is the case.  With the remove of label properties from the
devicetree this is even more true.

For now remove the prefix filter and just return the full list
of devices.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-08 10:51:51 +02:00
Lucas Tamborrino
ffa1c92131 drivers: sensor: esp32: pcnt driver
Add new pcnt peripheral driver.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-08-08 10:51:41 +02:00
Kumar Gala
df81fef944 drivers: sensor: Convert Kconfig bus 'depends on' to 'select'
This change in pattern is meant to address a misconfiguration issue
that can occur for sensors that support being on multiple busses
like I2C & SPI.

For example, you can have a configuration in which such a sensor is
on the I2C bus in the devicetree and the sensor is enabled.  However
the application configuration enables CONFIG_SPI=y and CONFIG_I2C=n
and this will cause the sensor driver to be built by default, however
since we don't have the I2C bus enabled the driver will not compile
correctly.

Previously we had been adding to board Kconfig.defconfig something
like:

	config I2C
		default y if SENSOR

This pattern doesn't scale well and may differ from what an application
specific need/use is.

So instead move to a pattern in which we leave the default enablement
up to the devicetree "status" property for the sensor.  We then have
the Kconfig move from 'depends on <BUS>' to 'select <BUS>' and in
the case of drivers that support multiple busses we have the Kconfig
be: 'select <BUS> if $(dt_compat_on_bus,$(<DT_COMPAT>),<BUS>) for
each bus type the sensor supports.

This removes the need to add Kconfig logic to each board and enables
the bus subsystem and bus controller driver if the sensor requires
it by default in the build system.

Fixes: #48518

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-08 06:58:18 +01:00
Ayan Kumar Halder
25ed2875a8 serial: uart_pl011: Fix compile error for CONFIG_UART_INTERRUPT_DRIVEN=n
When the uart is configured in non interrupt mode, then the mmio address
should be provided via DEVICE_MMIO_ROM_INIT.

Signed-off-by: Ayan Kumar Halder <ayankuma@amd.com>
2022-08-08 06:57:45 +01:00
Reto Schneider
1c1801ee7f drivers: eeprom: Fix format strings
Building for native_posix_64 exposes faulty format strings.

Changes in this commit also ensure that the shell code gets built in CI,
thus this kind of problem can not be introduced again later on.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-08-07 14:29:36 +01:00
Bryce Wilkins
5ff80ef2b1 drivers: spi: Add default char to mcux flexcomm spi driver
Adds optional device tree property to specify a default character
to clock out when the TX buffer pointer is NULL. If the property is
not set the existing behavior (default char of 0x00) is used.

I verified the expected behavior using an i.MX RT685 board and
logic analyzer that the def-char character is transmitted when
TX buffer pointer is NULL.

Signed-off-by: Bryce Wilkins <bryce.wilkins@gmail.com>
2022-08-05 09:28:39 -05:00
Stephanos Ioannidis
4004475e7f drivers: timer: nrf_rtc_timer: Fix assert conditions
This commit fixes the incomplete assert conditions for the `chan`
argument passed to the nRF RTC timer functions.

Note that the `chan` argument for this driver is of a **signed**
integer type, so it is necessary to check that its value is
non-negative.

This fixes the warnings generated by the GCC 12 such as:

  error: array subscript -1 is below array bounds of '...'

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-05 15:15:34 +02:00
Florian Grandel
4f8c952c4a drivers: ieee802154: Make raw mode and l2 mutually exclusive
Activating both, the IEEE 802.15.4 raw mode /and/ the L2 mode is not
possible and in fact leads to a build error.

It should therefore not be possible to activate both options at the same
time. This is achieved by only offering the (rather exotic) raw mode
once the L2-support for the IEEE 802.15.4 has been switched off.

Fixes: #48715

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-08-05 15:04:43 +02:00
Andriy Gelman
af6179d567 drivers: gpio: Add xmc4xxx drivers
Adds gpio drivers for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-05 13:00:21 +02:00
Gerard Marull-Paretas
a6058dc4b1 drivers: ieee802154: IEEE802154 depends on NETWORKING
Previous to this change, each individual driver option depended on
NETWORKING. Instead, move dependency one level up.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-05 12:56:47 +02:00
Gerard Marull-Paretas
352c9c34ee drivers: ieee802154: depend on DT status and default to y
Make all drivers default to 'y' and dependent on being enabled in DT.
This will allow simplifying many samples/tests.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-05 12:56:47 +02:00
Gerard Marull-Paretas
bbda65a99a drivers: counter: increase COUNTER_INIT_PRIORITY
Some counter devices depend on buses (e.g. I2C for Maxim DS3231). Bus
devices are tipically initialized with KERNEL_INIT_PRIORITY_DEVICE as
well, so there's no guarantee counter will be initialized be initialized
before without manually tweaking priorities.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-05 12:55:51 +02:00
Bartosz Bilas
e7eee79e7e drivers: modem: gsm: adjust logs level
Let's switch to the LOG_DBG for +CREG, +CESQ and +CSQ
AT commands responses because they flood the console so much.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-08-05 11:43:11 +01:00
Jay Vasanth
8014a026d1 drivers: eeprom: MEC172x - Add read/write APIs support
Add functions to support EEPROM read and EEPROM write.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-08-04 18:36:18 +02:00
Jay Vasanth
ccb77af3b7 eeprom: Add Microchip eeprom driver skeleton
Prepare for Microchip eeprom driver addition. Update
dtsi, kconfig, cmake and relevant soc files for eeprom
driver addition.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-08-04 18:36:18 +02:00
Glauber Maroto Ferreira
af5310d500 esp32: drivers: counter: update build references
Updates build references of the Counter API
implementation based on Espressif's General
Purpose Timers to differentiate from the one
based on RTC.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-08-04 15:30:18 +02:00
Pieter De Gendt
114c133fde drivers: sensor: bq274xx: Add interrupt trigger for data ready
Add an optional data ready trigger for the BQ274XX fuel gauge.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-08-04 14:17:55 +02:00
Lucas Tamborrino
b44572aaec drivers: i2c: esp32: fix node identification
This PR fixes the instances indexing in the driver's
initialization macros.

The use of DT_INST macros along with other node identifiers
was preventing the driver from initialize correctly in some
cases.

The driver requires the signal mux number value. Hence the need
to use the SoC's peripheral number information and DT_NODELABEL
macro for node id.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-08-04 13:45:23 +02:00
Yong Cong Sin
b707785411 drivers: modem: gsm: Goto fail state if iface errors after setup
Patches the driver such that if the iface errors after init, the
driver will enter FSM error state.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Yong Cong Sin
a0a80c350c drivers: modem: gsm: Make the precedence explicit
Add brackets to make the precedence of if conditions
explicit.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Yong Cong Sin
7685301df6 drivers: modem: gsm: If condition should be bool
Compare these variables properly so that the condition in an if
statement will be boolean.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>

Update gsm_ppp.c
2022-08-04 13:43:45 +02:00
Yong Cong Sin
e5fb94e4a0 drivers: modem: gsm: Cast unhandled functions to void
The return value of these functions are not handled,
cast them to void to make that explicit.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Yong Cong Sin
4b59ba8fe3 drivers: modem: gsm: Test against NULL
Test these pointer against NULL explicitly

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Yong Cong Sin
21bf04c29b drivers: modem: gsm: Rename r to ret
Rename the variable `r` to `ret` for better consistency
with the rest of the driver.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Yong Cong Sin
f5d646e204 drivers: modem: gsm: FSM implementation
Introduce FSM implemention for the gsm_ppp driver.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-04 13:43:45 +02:00
Dat Nguyen Duy
eb0428a64a drivers: intc_gicv3: configuring affinity to PE
For Arm Cortex-family processors that only support single
sercurity state, (GICD_CTRL.ARE is set to '1'), so need to
set SPI's affinity for the PE which it is enabled.

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2022-08-04 13:43:29 +02:00
Gerard Marull-Paretas
e6a345f967 drivers: ieee802154: uart_pipe: make driver DT-based
Use Devicetree to describe the UART UPIPE IEEE 802.15.4 driver. This
allows to remove usage of IEEE802154_UPIPE_DRV_NAME in preparation for
the removal of NET_CONFIG_IEEE802154_DEV_NAME.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
d904b5d908 drivers: ieee802154: uart_pipe: split Kconfig
As all other drivers, keep uart_pipe driver Kconfig settings into its
own file.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
1d6862c4e9 drivers: ieee802154: rf2xx: remove unused IEEE802154_RF2XX_DRV_NAME
The option is no longer used (driver is DT-based).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
2df965f490 drivers: ieee802154: nrf5: make driver DT-based
Use Devicetree to describe the radio and IEEE 802.15.4. This allows to
remove usage of IEEE802154_NRF5_DRV_NAME in preparation for the
removal of NET_CONFIG_IEEE802154_DEV_NAME.

All SoC files have been updated with the addition of an ieee802154 node
(disabled and only on those SoCs that define ieee802154-supported. The
peripheral has been enabled in the nRF52840DK board (used for testing
ieee802154).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
7d5272db62 drivers: ieee802154: kw41z: make driver DT-based
Use Devicetree to describe the radio and IEEE 802.15.4. This allows to
remove usage of IEEE802154_KW41Z_DRV_NAME in preparation for the removal
of NET_CONFIG_IEEE802154_DEV_NAME.

KW41Z files have been updated with the addition of radio and an
ieee802154 nodes The peripheral has been enabled in the frdm_k41z board
(used for testing ieee802154).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
dc0728fb2a drivers: ieee802154: cc2520: drop IEEE802154_CC2520_CRYPTO_DRV_NAME
The crypto driver is used internally, so there's no real need to expose
its name as a Kconfig option. Just drop it in favor of a plain string
with the same previous value.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
fb9dbdd60e drivers: ieee802154: cc13x2_cc26x2_subg: make driver DT-based
Use Devicetree to describe the radio and IEEE 802.15.4. This allows to
remove usage of IEEE802154_CC13XX_CC26XX_SUBG_DRV_NAME in preparation
for the removal of NET_CONFIG_IEEE802154_DEV_NAME.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
fa16891625 drivers: ieee802154: cc13x2_cc26x2: make driver DT-based
Use Devicetree to describe the radio and IEEE 802.15.4. This allows to
remove usage of IEEE802154_CC13XX_CC26XX_DRV_NAME in preparation for the
removal of NET_CONFIG_IEEE802154_DEV_NAME. All boards used in testing
have been updated to enable the peripheral in DT as well.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Gerard Marull-Paretas
1ff6577e30 drivers: ieee802154: cc1200: make driver DT-based
Use Devicetree to describe the radio and IEEE 802.15.4. This allows to
remove usage of IEEE802154_CC1200_DRV_NAME in preparation for the removal
of NET_CONFIG_IEEE802154_DEV_NAME.

In this case, the driver already had bindings, however, it was still
using NET_DEVICE_INIT.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-04 13:25:35 +02:00
Yong Cong Sin
588277c43a drivers: adc: stm32: Disable ADC before setting common path
According to the reference manual, the ADC should not be
converting when setting the common path, we disable the adc
directly in this driver for the sake of simplicity.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-03 18:43:20 +02:00
Yong Cong Sin
36a73d7704 drivers: adc: stm32: Use k_usleep variant
Convert these k_sleep calls to use the k_usleep instead.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-03 18:43:20 +02:00
Yong Cong Sin
d4205f46dd drivers: adc: stm32: remove unnecessary VREFINT path
Remove unnecessary VREFINT path connection during the init.
Internal paths should be setup before reading the channel.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-03 18:43:20 +02:00
Yong Cong Sin
4ae32b1020 drivers: adc: stm32: Move adc_stm32_setup_channels to start_read
Move the `adc_stm32_setup_channels` function to `start_read`
so that we can guarantee that the internel path is connecte
before reading.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-08-03 18:43:20 +02:00
Gerard Marull-Paretas
149fe06341 drivers: arc/designware: remove unused <soc.h>
The <soc.h> header is not required by a few ARC/Designware drivers, so
remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-03 07:46:14 -04:00
Gerard Marull-Paretas
5f40a9f40f soc: arc: synopsys: move secure timer0 definition to DT
Use Devicetree to describe secure timer0 instead of hardcoding values in
<soc.h>.

DT files have been structured to match the following requirements: In
case of sectimer0 - it's should be only enabled for:

- emsdp_em7d_esp.dts
- em_starterkit_em7d.dts
- nsim_sem_mpu_stack_guard.dts
- nsim_sem.dts

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-03 07:46:14 -04:00
Gerard Marull-Paretas
44250fe3d3 soc: arch: synopsys: move timer0/1 IRQ information to DT
timer0/1 IRQ information was hardcoded in soc.h, however, Devicetree is
nowadays a better place to describe hardware. Note that I have followed
existing upstream Linux code to do these changes.

Ref.
- https://elixir.bootlin.com/linux/latest/source/arch/arc/boot/dts/
  hsdk.dts
- https://elixir.bootlin.com/linux/latest/source/Documentation/
  devicetree/bindings/timer/snps,arc-timer.txt

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-03 07:46:14 -04:00
Nickolas Lapp
3feebd6571 Nordic nRF GPIO: Fixup race condition in GPIO pin Toggle
This PR fixes up a race condition which could cause GPIO writes to be
dropped when one thread was toggling a gpio on a port, and a different
thread was also modifying a (different) gpio on the same port.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2022-08-03 12:39:02 +02:00
Tom Burdick
13aae8c61a i2c: NPCX Port use correct device define macro
I2C has its own set of device define macro wrappers to provide
automatic stats tracking when enabled for the device class. This
particular driver happened ot be missed in the transition.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-03 05:05:23 +01:00
Gerard Marull-Paretas
732c00e29a drivers: timer: riscv_machine_timer: fix compatible comment
The andestech,machine-timer comment was incorrectly set to
neorv32-machine-timer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-03 05:03:50 +01:00
Martin Jäger
c56b1dbca1 drivers: can: stm32: rework filter handling
The previous driver implementation aimed to maximize the amount of
filters, which resulted in a fairly complex implementation.

Background: The bxCAN assigns a number to the filters in the order they
appear in the filter banks. This number is used to match messages in
the FIFO with their filter. If the scale or mode of a filter bank is
changed, all following filter numbers get an offset and the assigned
callbacks have to be shifted accordingly.

The required additional space for the shifting operations resulted in
non-deterministic behaviour and the maximum number of filters could not
be determined at compile-time, which made several tests like
tests/drivers/can/api fail.

This implementation uses a more simple but reliable approach for
filtering and and reserves fixed space for extended and standard ID
filters in the available banks (configurable via Kconfig).
The list mode is not used, which may reduce the total number of usable
filters depending on the application.

The maximum amount of filters is 14 if all filters use ext. IDs,
28 if all use std IDs and something in between if mixed IDs are used.

Also see issue #47986 for more detailed background information.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-08-03 05:02:09 +01:00
Martin Jäger
3524958083 drivers: can: stm32: naming clean-up
Namespace local functions, enums, structs and defines with stm32/STM32
to distinguish them from global CAN API.

Also rename some internal conversion functions to make their meaning
more clear and delete unused defines.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-08-03 05:02:09 +01:00
Bryce Wilkins
b5a95bad3d drivers: hwinfo: Fix mcux device id
This fixes an issue where the unique device identifier is incorrectly
copied from an address on the AHB bus to memory using memcpy.

I verified corrected behavior by comparing `hwinfo devid` command
output to memory view of the SoC using the debugger.

Signed-off-by: Bryce Wilkins <bryce.wilkins@gmail.com>
2022-08-02 13:40:04 -05:00
Fabio Baltieri
24d09d363c include: fix the remaining legacy #include paths
Add the "zephyr/" prefix to various #include statements that are
preventing the CI form running with LEGACY_INCLUDE_PATH=n.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Kai Vehmanen
0aa116a914 drivers: dai: intel: reduce log clutter in ssp_trigger
With addition of DAI_TRIGGER_COPY, the trigger callback may
be called at a very high rate.

Reduce the logging level from INF to DBG for the logs in
dai_ssp_trigger().

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-08-02 07:11:51 -04:00
Christoph Coenen
81694a25ed segger: Resolve circular include dependencies
Zephyr kernel is dependent on trace.
Trace is dependent on segger rtt.
Segger rtt MUST NOT be dependent on zephyr kernel.

Move lock functions from header into c file to avoid circular
dependency. This fix needs an update of the segger repository.

Fixes #43887.

Signed-off-by: Christoph Coenen <ccoenen@baumer.com>
2022-08-02 13:09:21 +02:00
Kumar Gala
3c35faae36 drivers: ethernet: sam_gmac: Convert to using dts for I2C EEPROM
Introduce a simple binding for atmel,24mac402 EEPROM that the SAM
GMAC ethernet driver can utilize to get MAC address out of.  We
introduce a 'mac-eeprom' phandle into GMAC ethernet devicetree
node that will provide a pointer to the MAC eeprom to utilize.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-02 13:02:42 +02:00
TOKITA Hiroshi
3a1d188a9e drivers: dma: Add GD32 DMA driver
Add support for GD32 DMA

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-08-02 09:13:21 +02:00
Kamil Gawor
e6da6e9133 drivers: bluetooth: hci: Add BT_HAS_HCI_VS selection for RPMSG.
Add explicit selection of the BT_HAS_HCI_VS for
the BT_RPMSG HCI driver. When the HCI over RPMSG
is used this dependency will not be solved automatically.
It is required to handle correctly Bluetooth identity
initialization.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2022-08-02 09:13:12 +02:00
Gerard Marull-Paretas
3a19948510 drivers: intc: litex: remove machine timer IRQ usage
This platform does not use RISC-V machine timer, however, the interrupt
controller had references to its IRQ. Remove them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-02 09:12:31 +02:00
Gerard Marull-Paretas
1c41423210 drivers: timer: riscv_machine_timer: obtain registers/IRQ from DT
Obtain machine timer addresses and IRQ from Devicetree. Note that driver
supports multiple compatibles because mtime/mtimecmp registers are
implemented in different ways depending on the vendor. That means
Devicetree representations can be slightly different and so code to
collect the information needs to treat each compatible differently.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-02 09:12:31 +02:00
Fabio Baltieri
21900c4c33 drivers: sensor: max17055: fix TTE and TTF time units
The unit for SENSOR_CHAN_GAUGE_TIME_TO_EMPTY and
SENSOR_CHAN_GAUGE_TIME_TO_FULL are defined in
zephyr/drivers/sensor.h as being in minutes.

Change the max17055 implementation to match the API spec, fix the
annotation for time register units.

Link: https://datasheets.maximintegrated.com/en/ds/MAX17055.pdf
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-01 14:49:59 -05:00
Krzysztof Chruscinski
0f9f18843f drivers: serial: nrfx_uarte: Add workaround for bytes dropping
Add workaround for development kits on which interface chip (segger chip)
is dropping bytes when they are sent in bursts. Issue has been seen on
DK which have multiple virtual com ports on the USB.

A workaround is adding periodic busy waits to introduce gaps in the
transmission.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-08-01 18:06:46 +02:00
David Jablonski
855a489a1c usb_dc_stm32: fix init on soft reset
Soft resetting a STM32 device currently does not reset the USB
connection, which causes a few problems: The endpoints do not respond
anymore, and within zephyr any kind of status information like
CDC_SET_CONTROL_LINE_STATE is also missing as they are not
re-negotiated.

This is fixed by stopping the USB device from zephyr side, right after
initialising the USB device.

Signed-off-by: David Jablonski <dayjaby@gmail.com>
2022-08-01 18:03:42 +02:00
Pieter De Gendt
bef0010e69 drivers: memc: mcux_flexspi: Always try to apply pinctrl state
This commit fixes an issue introduced in 5ee9392 where FlexSPI
pinctrl states where applied based on the SoC type.
However multiple FlexSPI instances can be active, some of which
are not pre-configured from ROM.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-08-01 18:03:10 +02:00
Kumar Gala
84575930f5 i2c: Remove unncessary HAS_I2C_DW Kconfig symbol
The HAS_I2C_DW was to limit Kconfig visibility to only platforms
that utilize the I2C DW IP.  The Kconfig for I2C_DW depends on
DT_HAS_SNPS_DESIGNWARE_I2C_ENABLED which will cause the same
visbility limitation to only platforms that have I2C DW devicetree
nodes.  Thus we can remove HAS_I2C_DW and its references.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-01 18:01:44 +02:00
Caspar Friedrich
ddb1971fe3 drivers: w1: Add driver for Maxim DS2484 Single-Channel 1-Wire Master
This adds a driver for Maxims DS2484 Single-Channel 1-Wire master
driver. The DS2484 features an extra pin to enable sleep modes which
is available if the pin is configured in the device tree.

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2022-08-01 10:33:10 +02:00
TOKITA Hiroshi
49522c061f drivers: spi: gd32: support interrupt-driven mode
Add supporting interrupt-based asynchronous operation for GD32 SPI.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-08-01 10:32:33 +02:00
Krzysztof Frydryk
6254274420 ssp: Use sampling rate from config
Use sampling rate passed in config instead of a default one when using
config blob.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2022-08-01 10:31:42 +02:00
Conor Paxton
aba67c3329 drivers: gpio: add Microchip PolarFire SoC GPIO driver
This patch adds driver support for Microchip PolarFire
SoC GPIO.

Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
2022-08-01 10:29:21 +02:00
Jay Vasanth
3e0f738cb2 mec15xx: pinctrl for both mec15xx and mec17xx
Changes to compile pinctrl driver for both mec15xx
and mec17xx. Also add mec15xx pinctrl dtsi

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-08-01 10:28:23 +02:00
Henrik Brix Andersen
aeb9fd68e7 drivers: can: add ESP32 TWAI CAN controller driver
Add ESP32 TWAI CAN controller driver. The TWAI is register-compatible with
the NXP SJA1000 CAN controller.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-07-30 17:32:04 +01:00
Henrik Brix Andersen
491e831436 drivers: can: add NXP SJA1000 common driver backend
Add a common driver backend for NXP SJA1000 compatible CAN controllers.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-07-30 17:32:04 +01:00
Kumar Gala
a529c4511d drivers: flash: Update drivers to use devicetree Kconfig symbol
Update flash drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-30 08:27:13 -05:00
Erwan Gouriou
8325752e27 drivers: clock_control: stm32u5: Get MSIS freq from SoC registers
MSIS frequency at boot time can be different from the one we intent to
set from device tree configuration.
In order to avoid issues, read MSIS configuration from registers to get
the actual freq rather than the devicetree one which may be not yet
configured (which is the case at startup).

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-07-30 08:23:35 -05:00
Erwan Gouriou
eb52d8dca2 drivers: clock_control: stm32u5: Switch to HSI only when needed
When configuring PLL, we should first make sure we're not running on PLL,
and if running on PLL, first switch to a fixed clock before proceeding
with PLL configuration.
Current code is doing the switch systematically which is not useful as
default startup case is to use MSI as sysclk source.
So add a test before doing this switch.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-07-30 08:23:35 -05:00
Erwan Gouriou
98e6789cd9 drivers: clock_control: stm32u5: Update condition on PLL1R values
Unlike stated in 57df225b396e43358aac4cc998ed2e99fdb57780, RM0456.pdf
reference manual mentions about PLL1R that "Only division by 1 and even
division factors are allowed."
Though, in reference manual, there is one issue on PLL1R values
description, which should actually be:
0000000: pll1_r_ck = vco1_ck
0000001: pll1_r_ck = vco1_ck / 2 (default after reset)
0000010: Not allowed
0000011: pll1_r_ck = vco1_ck / 4
...
This description will be fixed.

Reflect this in binding and driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-07-30 08:23:35 -05:00
Kumar Gala
0779a932f4 drivers: w1: Update drivers to use devicetree Kconfig symbol
Update w1 drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-29 14:25:27 +02:00
Martin Jäger
c40ec11ab4 drivers: dac: update drivers to use devicetree Kconfig symbol
Update dac drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-29 14:11:18 +02:00
Sylvio Alves
4120601a6c soc: esp32: allow wifi and net stack into spiram
This PR adds a KConfig option that allows moving
all .noinit content related to wifi a net stack into external
ram. This free dram space to application.

Linker script files are also modified so that the content
are mapped into external ram.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-07-29 14:11:00 +02:00
Jun Lin
ec4f700202 driver: PECI: npcx: add driver support for Nuvoton npcx family
This commit add the PECI driver for Nuvoton npcx family to support PECI
APIs.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-07-29 14:09:17 +02:00
Kumar Gala
dc3e86e7dc drivers: i2c: Update drivers to use devicetree Kconfig symbol
Update i2c drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-28 16:12:43 -05:00
Jun Lin
ed12786ee0 driver: clock_control: npcx: fix the power down of eSPI module
This power down bit of eSPI module is loacted in the bit 7 of PWDWN_CTL6
register rather than the bit 4. This commit fixs the incorrect setting.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-07-28 19:54:34 +01:00
Andrzej Głąbek
e99b323aa2 drivers: pwm_nrfx: Improve tracking of PWM peripheral usage
This is a follow-up to commit 63d6cfd654.

Use a bit mask to store information about channels that need to be
driven by the PWM peripheral instead of inspecting the `seq_values`
array each time.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-07-28 20:52:41 +02:00
Gerard Marull-Paretas
3dd0904ea6 drivers: ieee802154: cmake: remove TI compile definitions
Compile definitions are now injected by the HAL automatically.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-28 20:51:55 +02:00
Gerard Marull-Paretas
307415664d soc: riscv: sifive-freedom: remove unused pinmux definitions
These definitions are now part of the pinctrl DT headers, remove them
from soc.h

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-28 20:50:57 +02:00
Kumar Gala
fbc0289733 drivers: bluetooth: hci: spi: Replace DT_INST_LABEL
As we phase out label properties from devicetree the devicetree
node may not have a label so utilize DEVICE_DT_NAME instead
which will use a label if it exists and the node name if not.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-28 20:50:38 +02:00
Anas Nashif
728d8eb2c0 intel_adsp: rename clock registers due to possible conflict
SOF using the same defines and in some cases generating conflicts.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-28 14:11:23 -04:00
Dylan Hung
b374bd0a5d drivers: clock_control: add Aspeed AST10x0 clock control
AST10x0 series SOCs provide the clock controller through the syscon
hardware block.  The current driver supports the clock gating capability
for the hardware IPs embedded in the SOC.  Each clock source has a
clock ID that can simply map to a bit in syscon registers CLK_STOP_CTRL0
(group 0) or CLK_STOP_CTRL1 (group 1).  There are some clock sources
that don't have associated clock gating control, which are always on,
are grouped to into group 2.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
2022-07-28 08:30:27 +02:00
Andrzej Głąbek
d5222f318d drivers: pwm_nrfx: Fix PWM_NRFX_CH_VALUE() macro
This is a follow-up to commit 63d6cfd654.

Revert unwanted PWM_NRFX_CH_POLARITY_MASK to PWM_NRFX_CH_COMPARE_MASK
replacement that was accidentally done in the above commit.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-07-27 17:03:38 +00:00
Francois Ramu
b165f10795 drivers: flash: octospi drivers for stm32h7 serie
With the introduction of the OSPI NOR flash controller
the stm32H7 serie requires the HAL MDMA in anycase.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-27 18:46:25 +02:00
Andreas Sandberg
61306aedb4 drivers: ssd16xx: Add an API to read raw RAM contents
Add the ssd16xx_read_ram() function that can be used to read the raw
contents of the two display RAM in the controller. This function is
similar to display_read(), but lets the caller specify the RAM to
operate on. The intention is that this can be used to read out the
contents of the old frame buffer after a partial refresh that
automatically swaps the black/red buffers.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:47 +02:00
Andreas Sandberg
8312db7734 drivers: ssd16xx: Implement basic read support
Read operations only work on SPI controllers that support half
duplex. To enable read operations, set the device mode to half duplex
by adding the following to the device's DTB node:

  duplex = <SPI_HALF_DUPLEX>;

If read requests will fail with -ENOTSUP if the device isn't in half
duplex mode.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:47 +02:00
Andreas Sandberg
25cff5edc3 drivers: uc81xx: Avoid using auto sequencing
The UC8179 supports automatic power management where the DC-DC is
enabled automatically. This is not supported on the UC8176. Explicitly
call PON/DRF/POF from uc81xx_update_display instead. This ensures that
the DC-DC is only enabled while actually updating the display for all
supported chips.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Andreas Sandberg
f4a6c75087 drivers: uc81xx: Fix incorrect UC8176 CDI layout
The CDI register in UC8176 and UC8179 have different layouts. Add a
helper function to the quirks structure to handle CDI updates.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Andreas Sandberg
f6bbbc3c7d drivers: uc81xx: Use device-specific compatibles
The UC8176 and UC8179 chips that exist in tree have subtly different
register layouts. Use separate compatible strings for these chips and
a quirks structure that describe device-specific behavior.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Andreas Sandberg
8f0093aaf8 drivers: Rename GD7965 to UC81xx
The GD7965 driver is really just a vendor name for the UltraChip
UC8179. Rename the driver to UC81xx since there are other chips in the
family (e.g., the UC8176) with an almost identical register interface.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-27 18:45:02 +02:00
Thomas Stranger
0d7abdf012 drivers/clock_control: stm32 common fix STM32_SRC_PLLCLK calculation
Some Series were calculating the pll output frequency from an
clock source index instead of the clock source frequency.

This commit resolves this issue for l0, l1.

get_pllout_frequency() is only used for PLLCLK, therefore remove it.
F2, F4, and F7 have several pll dividers and might decide to implement
these as clock sources won't need PLLCLK.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-27 18:44:49 +02:00
Glauber Maroto Ferreira
dbbfcfc22d esp32: driver: counter: add RTC-based implementation
add RTC-based implementation of the counter driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-07-27 09:48:33 +02:00
Kumar Gala
47bb8c14dc drivers: clock_control: Update drivers to use devicetree Kconfig symbol
Update clock_control drivers to use DT_HAS_<compat>_ENABLED Kconfig
symbol to expose the driver and enable it by default based on
devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-27 09:47:16 +02:00
Kumar Gala
83a2b590fe drivers: clock_control: nxp: Fix building MCG on KW40Z/KW41Z
The KW40Z/KW41Z don't have a Fixed Freq MCG clock so the code
associated with that in get_rate fails to build.  ifdef around
the code with enum kCLOCK_McgFixedFreqClk so things work
correctly.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-27 09:47:16 +02:00
Kumar Gala
8b101e236d drivers: clock_control: Remove old ESP32C3 code
The ESP32 clock control for ESP32C3 was unified into a single
driver a while back.  However the files associated with the
ESP32C3 didn't get removed than.  Remove them now.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-27 09:47:16 +02:00
Simon Hein
d0921018fc drivers: Fix coding guidelines MISRAC:2012 Rule 14.4 do-whiles/Zero checks
MISRA C:2012 Rule 14.4 (The controlling expression of an if statement
and the controlling expression of an iteration-statement shall have
essentially Boolean type.)

Use `do { ... } while (false)' instead of `do { ... } while (0)'.
Use comparisons with zero instead of implicitly testing integers.

The commit is a subset of the original auditable-branch commit:
5d02614e34a86b549c7707d3d9f0984bc3a5f22a

Signed-off-by: Simon Hein <SHein@baumer.com>
2022-07-26 15:30:24 -04:00
Kumar Gala
35d93ef7bc drivers: i2c: esp32: Rework SDA/SDL pins as gpios in devicetree
For the !SOC_I2C_SUPPORT_HW_CLR_BUS in which we implement bus
reset via GPIOs, change the devicetree properties to be actual
gpio properties and update the code to reflect this.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-26 12:10:58 -05:00
Thomas Stranger
1dd76ac08c drivers/clock_control: stm32u5: typo hsi, hse clock source
A typo prevented the usage of hsi and hse as direct clock source.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-26 07:40:42 -05:00
Andrzej Głąbek
63d6cfd654 drivers: pwm_nrfx: Refactor pwm_set_cycles to fix on/off issues
This commits refactors implementation of the pwm_set_cycles function
to fix the following issues:
- when a channel was already set with a non-zero pulse width, setting
  cycles for another one required specifying a matching period value,
  even if that value was to be ignored anyway when the channel was to
  be set to constant inactive or active level; due to this limitation,
  it was not possible to e.g. use the LED driver API and turn off a LED
  while another one (within the same PWM instance) was blinking
- the above limitation also applied when a channel was set with a pulse
  width equal to period (duty 100%); even though such channel was not
  in fact using the PWM peripheral, other channels within the same PWM
  instance were forced to use the same period
- after a PWM generation was started for a channel, it was not possible
  to change its pulse width before two PWM periods passed (while it
  should be possible to change it after every period); this was caused
  by a looping mechanism that was unnecessarily activated in the PWM
  peripheral

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-07-26 11:11:13 +00:00
Kumar Gala
737b1fa25a drivers: gpio: sam: Fix Kconfig default for SAM4L
In update the Kconfig to depend on devicetree, the SAM4L
driver was missing a 'default y'.

Also remove unnecessary 'depends on GPIO'.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-26 08:49:38 +02:00
Benjamin Björnsson
506cff9a27 drivers: console: ipm_console: Update driver to use DEVICE_DT_GET
Update driver to use DEVICE_DT_GET to remove usage of device_get_binding.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-26 08:49:20 +02:00
Thomas Stranger
b2b67258f9 drivers/clock_control: stm32u5 add pll2, pll3 support(setup/clk-src)
This commit adds required code to setup pll2 and pll3 as defined
in dts. Also these plls can now be used as alternate clock sources.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-25 15:57:12 -07:00
Thomas Stranger
8ae3f0bfd5 dts/bindigns/clock: allow stm32u5 DIVQ & DIVR PLL divider values to be 1
This commit changes the range for stm32u5 pll divider values
to allow divider value of 1.
- DIVQ is allowed to beconfigured 1 for all PLL instances
- DIVR can be 1 for PLL2 and PLL3, but is not valid for PLl1.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-25 15:57:12 -07:00
Francois Ramu
7f894f781b drivers: dma: stm32 dma channel with the busy flag
This commit controls the stream busy flag of the dma channnel
Set as true : stream is busy each time the channel is
started or reloaded.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-25 21:02:13 +00:00
Francois Ramu
5412c2126d drivers: dma stm32 keep the channel busy if overriden
When the channel is overriden by the HAL,
the dma irq must always be handled (even if not busy).
Only when the dma channel is not overriden by the HAL
the irq is exiting when the channel is no more busy.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-25 21:02:13 +00:00
Anas Nashif
43371d0414 intel_adsp: move cavs to be a series
Intel ADSP CAVS is now a proper series with all CAVS SoCs running under
it. This will give us to Intel ADSP series:
- CAVS
- ACE v1.x

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-25 16:50:24 -04:00
Anas Nashif
e33bb9b6c5 drivers: dmic: remove old intel dmic driver
We now have another intel dmic driver under DAI.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-25 13:14:49 -04:00
Jan Kuliga
a10e5547df serial: uart_pipe: Get rid of redundant check in uart_pipe_isr().
The uart_pipe_isr() double-checks whether rx interrupt occured by
calling uart_irq_is_pending() first. Get rid of that function call since
it is redundant (i.e. nothing more is done or checked inside that
conditional).

Signed-off-by: Jan Kuliga <jtkuliga@gmail.com>
2022-07-25 13:02:22 -04:00
Aurelien Jarno
808603f47c drivers: adc: stm32: wait for internal channels stabilization
The VREFINT and TEMPSENSOR internal channels have a stabilization time
after they are enabled. Right now this just causes the first measure to
be a bit off, however with PR #47691 which stops the internal channels
after each readout, this is something important to respect. Fortunately
the stabilization time is available as constants in the HAL, so just
wait the time specified by the constants.

Note that the VBAT internal channel does not have any stabilization
time.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-25 15:17:35 +02:00
Kumar Gala
ce2635f410 drivers: virt: ivshmem: Convert to use DEVICE_DT_GET_ONE
Replace Kconfig (IVSHMEM_DEV_NAME) based named device_get_binding
with DEVICE_DT_GET_ONE.  Since there is only one driver for ivshmem
use the qemu,ivshmem for that.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 15:16:05 +02:00
David Leach
88ba2fe3a9 drivers: lpuart: clear noise status flag on errors
The LPUART driver activates the "noise" error interrupt but
neglects to clear the error bit when the interrupt occurs. This
causes the device to freeze. Clear the "noise" status to avoid
the lockup and track instances of this as a UART_ERROR_PARITY.

fixes #47568

Signed-off-by: David Leach <david.leach@nxp.com>
2022-07-25 15:14:43 +02:00
HaiLong Yang
efa0973473 drivers: i2c: improve gd32 i2c driver stability
This split the repeated START condition to STOP + START conditions.

The old implement may cause undefined behavior for gd32 i2c, like
enter STOP condition accidentally.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-07-25 15:14:21 +02:00
Kumar Gala
b2dacedbe8 drivers: memc: Update drivers to use devicetree Kconfig symbol
Update memc drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 15:14:08 +02:00
Tobias BA
2c183f269b drivers: crypto_stm32: include soc.h in driver
include soc.h in crypto driver for stm32 for fixing
build errors when enabling cryp/AES nodes in devicetree

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/47379
Signed-off-by: Tobias BA <ext-tba@trackunit.com>
2022-07-25 11:05:15 +00:00
Kumar Gala
0fa7907f3e drivers: pinctrl: Update drivers to use devicetree Kconfig symbol
Update pinctrl drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 05:46:42 -05:00
Maximilian Deubel
d8e0dd1804 ADXL372: add names for KConfig choices
This patch adds names to the KConfig choices of the ADXL372 driver.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2022-07-25 09:33:54 +00:00
Fabio Baltieri
c370c0299b drivers: gpio: nrfx: ensure ch variable stays allocated during use
Inside gpio_nrfx_pin_interrupt_configure, the "ch" variable is allocated
inside the "if", but then it gets dereferenced and the pointer saved in
trigger_config, which is used in the outer context.

This works fine right now, but that memory location could possibly be
reused by another automatic variable if the code gets changed.

Moving it in the function context to avoid any potential problem.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-07-25 09:40:22 +02:00
Kumar Gala
2245bf89b7 drivers: entropy: Update drivers to use devicetree Kconfig symbol
Update entropy drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 09:39:10 +02:00
Kumar Gala
0f1ed0f4a0 drivers: counter: Update drivers to use devicetree Kconfig symbol
Update counter drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 09:38:57 +02:00
Alex Sergeev
269f664a98 drivers: i2c: gd32: Use correct FAST speed
Fixed bug where configured FAST speed causes FAST_PLUS speed to be applied.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2022-07-25 09:38:41 +02:00
Kumar Gala
0be3a7604b drivers: spi: Update drivers to use devicetree Kconfig symbol
Update spi drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-25 09:38:30 +02:00
Kumar Gala
957e263120 drivers: gpio: Update drivers to use devicetree Kconfig symbol
Update gpio drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-23 09:26:09 -05:00
Kumar Gala
5eca3922d5 drivers: regulator_pmic: Fix compile issue
The regulator-pmic node is a child of the I2C device.  When this
was converted to i2c_dt_spec that was missed.

Also fixed a few minor formatting issues.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-23 09:23:37 -05:00
Kumar Gala
bdff3e76e5 drivers: watchdog: Update drivers to use devicetree Kconfig symbol
Update watchdog drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-22 14:06:00 +00:00
Kumar Gala
3aa0a174b8 drivers: serial: nrfx: Update drivers to use devicetree Kconfig symbol
Update serial drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-22 07:51:44 -05:00
Kumar Gala
d734f273ba drivers: adc: Update drivers to use devicetree Kconfig symbol
Update adc drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-22 07:51:24 -05:00
Kumar Gala
885087b328 drivers: pwm: Update drivers to use devicetree Kconfig symbol
Update pwm drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-22 07:50:44 -05:00
Mulin Chao
9267655f42 driver: gpio: npcx: Support GPIO_VOLTAGE_1P8 flag
This CL configures low-voltage (1.8V) detection via GPIO driver with
GPIO_VOLTAGE_1P8 flag. It also adds support for this flag in
pin_get_config() function.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-07-22 10:33:03 +02:00
Mulin Chao
a5fee4c6de driver: scfg: npcx: cleanup low-voltage detection configuration
Cleanup npcx low-voltage (1.8V) detection configuration. It removes
unused soc utilities, macros, and DT node. We will configure this
feature by GPIO driver with GPIO_VOLTAGE_1P8 flag later.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-07-22 10:33:03 +02:00
Kumar Gala
f0441fba58 drivers: sensor: Update drivers to use devicetree Kconfig symbol
Update sensor drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-22 02:20:18 -05:00
Anas Nashif
2af59e7d44 intel_adsp: unify timer registers and simplify timer driver
Declare clock control in the shim header per SoC and remove ifdeffry
from the driver simplifiying it and making it ready for the next
platform.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-21 17:55:41 -04:00
Anas Nashif
af3d5331a1 intel-adsp: migrate cavs-mem.h to adsp_memory.h
Move header and make it soc specific.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-21 17:55:41 -04:00
Anas Nashif
423264b96b intel_adsp: make shim header soc specific
using once single header to support multiple socs and product
generations is error prone and not easily maintained.

Over time we have been adding conditional code in headers and extending
structs  to support new HW features which becomes a problem.

Goal is to keep platform headers in sync with hardware specification and
allow of introduction of new platforms and hardware features by just
introducing a new SoC with its own set of headers.

This is now just a copy of existing cavs-shim.h with slight changes,
goal is to clean this up long term and sync with hardware datasheets and
align on naming as well.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-21 17:55:41 -04:00
Kumar Gala
2d88414c4e drivers: serial: pl011: Remove unused Kconfig symbols
The driver has be DT_INST based for a while so the Kconfig
symbols CONFIG_UART_PL011_PORT0<n> aren't used.  So lets
remove them.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-21 16:40:28 +00:00
Kumar Gala
894e8814af drivers: serial: rv32m1_lpuart: Remove unused Kconfig symbols
The driver has be DT_INST based for a while so the Kconfig
symbols CONFIG_UART_RV32M1_LPUART_<n> aren't used.  So lets
remove them.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-21 16:40:28 +00:00
Benjamin Björnsson
45adae9118 drivers: gpio: gpio_fxl6408: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-21 06:07:02 -05:00
Henrik Brix Andersen
bda6455234 drivers: eeprom: Update drivers to use devicetree Kconfig symbol
Update EEPROM drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-21 06:03:04 -05:00
Henrik Brix Andersen
8746b2cb33 drivers: can: Update drivers to use devicetree Kconfig symbol
Update CAN drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol to expose
the driver and enable it by default based on devicetree.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-21 06:02:28 -05:00
Jaroslaw Stelter
fe5ed68356 soc: ace_v1x: check physical memory bounds on page unmap.
This patch fix issue with unmapping of virtual addresses mapped
to non-existing physical memory. MTL TLB table is initialised with
1:1 mapping, however virtual space is much wider than available
physical space. We should not try to free and manage of power for
non-existing physical pages.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-07-21 05:32:03 -04:00
Kumar Gala
7d5215ff19 drivers: serial: Update drivers to use devicetree Kconfig symbol
Update serial drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-21 10:29:06 +02:00
Ryan Erickson
3d7f267d4a modem: hl7800: Fix TCP server closed interrupting TX/RX
If TCP server closed notification is received it
could interrupt the TCP socket RX or TX data sequence.
Remove the SOCK_SERVER_CLOSED state and instead
use a unique error code to know if the socket
has been closed by the server.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-07-21 10:28:38 +02:00
Anas Nashif
554eb03cb9 kconfig: guard usbc logging macros
Logging kconfig options should only appear when this driver is being
used.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-20 18:28:43 +02:00
Anas Nashif
3133666c9a kconfig: guard grove lcd logging macros
Logging kconfig options for this lcd should appear when the hardware is
enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-20 18:28:43 +02:00
Daniel DeGrasse
cb3d1313e5 drivers: lpuart: prevent spurious transmission complete interrupts
Correct issue where transmission complete interrupt was not disabled when
using interrupt driven serial API with power management enabled,
resulting in continuous spurious interrupts that effectively locked
the system.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-07-20 09:29:38 -05:00
Pieter De Gendt
d01934f9e9 drivers: sensor: bq274xx: convert lazy load Kconfig option to dts property
This change allows per-instance configuration of lazy loading and
fixes build issue.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-20 08:39:45 -05:00
Tim Lin
d7ccea6357 ITE: drivers/i2c: Add command queue mode not allowed condition
If the transaction of write or read is divided into two transfers
(not two messages), the command queue mode does not support.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-07-20 11:08:56 +02:00
Benjamin Björnsson
f195b910b2 drivers: gpio: gpio_pcal6408a: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-19 22:53:37 +00:00
Kumar Gala
8fb2210cfb emul: remove name param from bus register APIs
Rework the <BUS>_emul_register calls to not pass the name param.  The
name param is only used for logging and we can get it from the
struct <BUS>_emul instead.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 15:52:36 -05:00
Gerard Marull-Paretas
20177daa0f drivers: spi: nrfx_spi(m|s): add common init function
Having a per-instance init function makes code cluttered and hard to
read. Just create a per-instance IRQ connect function (required to
resolve IRQ_CONNECT parameters at compile time).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
a8b444f956 drivers: spi: nrfx_spi(m|s): s/_DEVICE/_DEFINE
Use SPI_NRFX_SPI(M|S)_DEFINE, since the macro _defines_ a device.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
7d42a8ff18 drivers: spi: nrfx_spim: remove unused definitions
SPIM_NRFX_MISO_PULL_DOWN and SPIM_NRFX_MISO_PULL_UP were not used,
delete them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
e5ba80733a drivers: spi: nrfx_spi(m|s): drop NRFX_SPI(S|M)_INSTANCE usage
Stop using NRFX_SPI(S|M)_INSTANCE helper so that peripheral address from
Devicetree is used. We should not rely on HAL for hardware description
but Devicetree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
2cfb5012db drivers: spi: nrfx_spim: move rx delay to DT
Move the RX (MISO) delaying capability information to Devicetree. It is
done using 2 properties:

- rx-delay-supported: enabled on SPI nodes that support delaying RX.
  This property can be used by the driver to determine if this
  capability is supported or not on a given instance.
- rx-delay: the actual RX delay value

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
ee8d8b3c6e drivers: spi: nrfx_spis: max buffer length is SoC specific
The maximum transfer buffer length is SoC specific, not instance
specific. This patch defines MAX_BUF_LEN at driver level in a SoC
specific manner instead of using HAL values that are instance specific
but that always take the same value depending on the SoC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
72cc583dc9 drivers: spi: nrfx_spim: max chunk length is SoC specific
The maximum transfer chunk length is SoC specific, not instance
specific. This patch defines MAX_CHUNK_LEN at driver level in a SoC
specific manner instead of using HAL values that are instance specific
but that always take the same value depending on the SoC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
3c6649f631 drivers: spi: spi_nrfx_spi(m|s): move ORC to DT
Specify the overrun character in Devicetree. Since 0xFF is the most
common value, DT property contains such default.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
4ad3a96059 drivers: spi: nrfx_spim: move maximum frequency parameter to DT
Devicetree is the natural place to describe hardware, so move the
maximum frequency the SPI can work with to Devicetree instead of relying
on values from HAL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Gerard Marull-Paretas
717f81795b drivers: spi: nrfx_spim: use DT_IRQN
Driver was not using Devicetree to obtain the SPIM IRQ number.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 13:20:00 -07:00
Andreas Sandberg
fa6fe0274c drivers: gd7965: Use packed structs where appropriate
There are a few registers that map nicely onto structs. Switch from
using index constants and byte arrays in those cases.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg
544c0b22dd drivers: gd7965: Make tcon/cdi/pwr/softstart optional
Some panels using this driver don't provide tcon/cdi/pwr/softstart
values in their reference code. It is normally expected that the right
values will be loaded from OTP in such cases. Make these values
optional to support such panels.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg
dc860cd6aa drivers: gd7965: Make it possible to use multiple instances
Add instance-specific data and config structs, and remove all other
global variables.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg
376973423f drivers: gd7965: Remove the need to use heap memory
The GD7965 driver uses malloc to allocate a single line buffer when
clearing the display. This buffer is used to clear the display line by
line. This as two problems. First, it means that the driver introduces
an unnecessary requirement to support heap allocations. Second, it
causes a lot of weird and unnecessary SPI transactions that look like
partial updates without the actual refresh. This is very inefficient
since the same action can be performed in a single SPI transaction.

Add a gd7965_write_cmd_pattern() helper function that writes a pattern
of a specified length to a register in the device.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Andreas Sandberg
589b83a745 drivers: gd7965: Lock the SPI bus
The protocol used by the GD7965 driver requires that SPI transactions
are split into two phases, a command phase and a data phase, to change
the state of a GPIO signaling commands/data.

We currently don't lock the bus which means that other drivers could
potentially take over the bus and introduce unpredictable delays
between the command and data phase.

Add the necessary locking.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-19 13:06:47 -07:00
Kumar Gala
7d95eb0ac9 drivers: espi_emul: Fix formatting
Fix formatting of emul_espi_driver_api initializer

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 13:21:45 -05:00
Aaron Massey
fc98549952 emul: Use DEVICE_DT_GET instead of DT_LABEL
DT nodes aren't guaranteed to define a label property. But emulated bus
controllers currently make use of this property to dispatch to the
associated emulator.

Have emulated bus controllers use DEVICE_DT_GET(node_id) to dispatch to
right target peripheral emulator. This also change makes emul_get_binding
and device_get_binding synonymous in behavior with respect to their
parameters.

This also strictly enforces a 1:1 correspondence between invocations of
DEVICE_DT_DEFINE and EMUL_DEFINE.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-07-19 11:43:30 -05:00
Aaron Massey
76ae0ba270 emul: Remove or declare unused args
In several locations of the emulator code there are unused function
arguments that were never caught.

Declare these as unused or remove the unused function parameters entirely.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-07-19 11:43:30 -05:00
Aaron Massey
9d7b9dc807 emul: Simplify emulator bus initialization and API
Allow emulator creators to write an init function that can be used
across multiple busses so as to reduce the boilerplate and cognitive
load in creating an emulator.

Part of this change includes allowing access to the emul struct from a
field in a {bus}_struct api (e.g. i2c_struct), which removes the need for
sporadic usages of CONTAINER_OF to access the emul struct.

Overall, this change simplifies and reduces the amount of boilerplate
code to get a device emulator up and running, thus reducing excise work
to writing tests.

TEST=twister on accel,espi, and eeprom drivers tests

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-07-19 11:43:30 -05:00
Aaron Massey
1028459afd emul: Run clang-format
Run clang-format on all files touched by improved emulator API pull-request
that allowed access to the target device emulator from its bus api without
CONTAINER_OF usage.

drivers/i2c/i2c_emul.c
drivers/spi/spi_emul.c
include/zephyr/drivers/emul.h
include/zephyr/drivers/espi_emul.h
include/zephyr/drivers/i2c_emul.h
include/zephyr/drivers/spi_emul.h
subsys/emul/emul.c
subsys/emul/emul_bmi160.c
subsys/emul/espi/emul_espi_host.c
subsys/emul/i2c/emul_atmel_at24.c

TEST=twister on accel,espi, and eeprom drivers tests

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2022-07-19 11:43:30 -05:00
Kumar Gala
f6013818ec drivers: video: Update drivers to use devicetree Kconfig symbol
Update video drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 09:39:49 -07:00
Kumar Gala
6f5e75ba31 samples: usb: dfu: Fix building of sample on a few platforms
Fix building this sample on bl5340_dvk_cpuapp_ns and
pinnacle_100_dvk.  On these boards the NORDIC_QSPI_NOR
driver needs to be enabled for the sample to build.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 15:29:41 +00:00
Kumar Gala
d77389464b drivers: sensor: shell_battery: Convert to DEVICE_DT_GET
Move to using DEVICE_DT_GET so we can phase out DT_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 08:45:13 -05:00
Benjamin Björnsson
4e841aea8d drivers: regulator: regulator_pmic: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-19 12:28:55 +00:00
Benjamin Björnsson
6098e1894b drivers: sensor: ms5607: Update driver to use spi_dt_spec
Simplify driver by using spi_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-19 12:28:29 +00:00
Benjamin Björnsson
e6f9ef4cc7 drivers: sensor: ms5607: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-19 12:28:29 +00:00
Gerard Marull-Paretas
cad6865aaa drivers: i2c: nrfx_twim: constify twim_config
The twim_config structure is no longer modified at runtime, so it can be
placed in driver's config (const).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
9974bb043f drivers: i2c: nrfx_twim: disable and restore state for bus recovery
TWIM peripheral needs to be disabled for bus recovery, otherwise SCL/SDA
lines will not be released. This patch makes sure to disable peripheral
if active, and, restore its state afterwards (including pin
configuration).

It is worth to note that a better solution would be to:

1. Define scl/sda pins as `-gpios` in DT
2. Use GPIO API in the driver to perform recovery (as some other drivers
   do)
3. Potentially use a "gpio" pinctrl state for this case

Unfortunately HAL is doing everything under the hood, so we have little
options to improve this unless we don't use it for such case. GPIO based
recovery should likely be generalized as many drivers seem to replicate
such _algorithm_.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
6f26fa2912 drivers: i2c: nrfx_twim: enable device runtime PM
Enable device runtime PM on the I2C driver. Note that this mechanism
replaces the old nrfx_twim_enable/disable calls with
pm_device_runtime_get/put, which means that driver will not save power
unless CONFIG_PM_DEVICE_RUNTIME=y.

Some quick measurements on thingy_52 running the samples/sensor/hts221
show a decrease of ~2-3uA in average when enabling device runtime PM.
Note that the driver already had implicit PM before, so the change for
users will be ~none, except that they now must enable the PM subsystem
features. While this case is not the best example, the PM subsystem will
turn to be beneficial as a whole when all devices in the board implement
it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
81f1bbacf4 drivers: i2c: nrfx_twim: drop init_twim shim
The function was just a shim to nrfx_twim_init, call it directly
instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
a1f6163a58 drivers: i2c: nrfx_twim: create common init function
The device definition macro defined per-device init function, resulting
in a cluttered and hard to extend init function. Create a per-instance
IRQ connect function instead, which is called at init time by a common
function.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
00ecc66677 drivers: i2c: nrfx_twim: enable/disable when resuming/suspending
The driver already implemented some sort of runtime PM by
unconditionally calling nrfx_twim_disable/enable. Perform the same
operations in the PM callback instead of doing a full init/deinit every
time.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
d3251c28aa drivers: i2c: nrfx_twim: remove redundant deinit_twim shim
The shim had no value, just call nrfx_twim_uninit directly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
9d649a5a74 drivers: i2c: nrfx_twim: drop twim_initialized usage
The driver re-initialized itself on the twim_transfer call if it wasn't.
This condition was likely added because of some manual/custom PM
schemes. Drop it in preparation for runtime PM.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Gerard Marull-Paretas
7fad89f020 drivers: i2c: nrfx_twim: avoid init/deinit to update frequency
nrfx HAL does not support updating frequency at runtime, which means we
need to do a full init/deinit to update it when it is a matter of a
simple register write. Fix this by using the lower level HAL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-19 12:25:13 +00:00
Kumar Gala
e99652b67d drivers: ieee802154: cc2520: Convert to DEVICE_DT_INST_DEFINE
Move driver to use {NET_}DEVICE_DT_INST_DEFINE.  This lets us
remove the IEEE802154_CC2520_DRV_NAME Kconfig symobl.

We also update the ieee802154 build_all test to actually enable
the CC2520 driver.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 10:32:21 +02:00
Kumar Gala
5cca6ed087 drivers: ieee802154: b91: Convert to DEVICE_DT_INST_DEFINE
Move driver to use {NET_}DEVICE_DT_INST_DEFINE.  This lets us
remove the IEEE802154_B91_DRV_NAME Kconfig symobl.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-19 10:32:09 +02:00
Freddie Yang
eca27824f3 drivers: fix race condition in SPI-based HCI driver
Give the semaphore after transceiving the message.

Signed-off-by: Freddie Yang <freddie.yang325@outlook.com>
2022-07-19 10:31:36 +02:00
Henrik Brix Andersen
b407b5697f drivers: can: loopback: add CAN-FD loopback support
Add support for CAN-FD frames in the CAN loopback driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-18 18:43:36 +02:00
Benjamin Björnsson
4b30008f5b drivers: gpio: gpio_cy8c95xx.c: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 18:43:17 +02:00
Benjamin Björnsson
ff327c419d drivers: gpio: gpio_pca953x: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 18:43:03 +02:00
Benjamin Björnsson
21cf889c87 drivers: led: tlc59108: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 18:42:52 +02:00
Tomislav Milkovic
0fe2c1fe90 everywhere: Fix legacy include paths
Any project with Kconfig option CONFIG_LEGACY_INCLUDE_PATH set to n
couldn't be built because some files were missing zephyr/ prefix in
includes
Re-run the migrate_includes.py script to fix all legacy include paths

Signed-off-by: Tomislav Milkovic <milkovic@byte-lab.com>
2022-07-18 16:16:47 +00:00
Benjamin Björnsson
0649679b98 drivers: sensor: bmp388: Rename spi variable
Rename variable for consistency across drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 10:24:35 -05:00
Benjamin Björnsson
b6c8148e7e drivers: sensor: bmp389: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 10:24:35 -05:00
Henrik Brix Andersen
657f34d073 drivers: can: mcan: increase maximum supported bitrate
According to the Bosch M_CAN datasheet, the M_CAN IP supports up to
8Mbit/s.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-18 14:30:47 +00:00
Sylvio Alves
f0623f88be drivers: serial: esp32c3: fix duplicated definition
Removes redefinition when uart interrupt is enabled.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-07-18 09:13:49 -05:00
Andrew McRae
008859a6ba drivers: sensor: npcx_tach: Remove underflow LOG_INF
A LOG_DBG already exists for the underflow check,
and given that reading 0 edges is a valid case, remove
the noisy underflow log.

Signed-off-by: Andrew McRae <amcrae@google.com>
2022-07-18 09:11:04 -05:00
Henrik Brix Andersen
588f06d511 drivers: can: loopback: check frame ID type and RTR bit in filters
Check the frame ID type and RTR bit when comparing loopback CAN frames
against installed RX filters.

Fixes: #47904

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-18 13:24:54 +00:00
Henrik Brix Andersen
3e5aaf837e drivers: can: mcux: flexcan: fix handling of RTR frames
When installing a RX filter, the driver uses "filter->rtr &
filter->rtr_mask" for setting the filter mask. It should just be using
filter->rtr_mask, otherwise filters for non-RTR frames will match RTR
frames as well.

When transmitting a RTR frame, the hardware automatically switches the
mailbox used for TX to RX in order to receive the reply. This, however,
does not match the Zephyr CAN driver model, where mailboxes are dedicated
to either RX or TX. Attempting to reuse the TX mailbox (which was
automatically switched to an RX mailbox by the hardware) fails on the first
call, after which the mailbox is reset and can be reused for TX. To
overcome this, the driver must abort the RX mailbox operation when the
hardware performs the TX to RX switch.

Fixes: #47902

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-18 13:24:54 +00:00
Henrik Brix Andersen
5e74f72220 drivers: can: mcan: acknowledge all received frames
The Bosch M_CAN IP does not support RX filtering of the RTR bit, so the
driver handles this bit in software.

If a recevied frame matches a filter with RTR enabled, the RTR bit of the
frame must match that of the filter in order to be passed to the RX
callback function. If the RTR bits do not match the frame must be dropped.

Improve the readability of the the logic for determining if a frame should
be dropped and add a missing FIFO acknowledge write for dropped frames.

Fixes: #47204

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-18 13:24:54 +00:00
TOKITA Hiroshi
189c8a82d4 drivers: sensor: adxl345: Add support SPI connection
Support SPI connection for ADXL345.
It works as well as an I2C connection.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-07-18 10:37:14 +00:00
Attie Grande
7ded40de84 soc: atmel_sam0: The ADC reference is locked while enabled for SAML21
For SAML21-based parts, the REFCTRL register is locked while the ADC is
enabled. Permit some parts to declare that they need the ADC to be
disabled before modifying REFCTRL.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-07-18 10:35:46 +00:00
Martin Jäger
e448561f95 drivers: serial: esp32_usb: improve Kconfig documentation
Clarify that this driver does not use the Zephyr USB stack, but the
one built into the Espressif MCU.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-16 16:17:11 +00:00
Martin Jäger
802f749697 drivers: serial: esp32_usb: remove UART config
The built-in USB serial peripheral is a virtual serial and does not
allow to be configured like a normal UART.

Removing the unused UART config parameters.

Also reducing initialization to single-instance only.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-16 16:17:11 +00:00
Martin Jäger
e8250ea17b drivers: serial: esp32_usb: clean-up
The struct serial_esp32_usb_pin, the uart_reg.h header and the
two defines are not used or required.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-16 16:17:11 +00:00
Martin Jäger
014f878e88 drivers: serial: esp32_usb: remove peripheral number
This peripheral is single-instance only, so there is no peripheral
number required.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-16 16:17:11 +00:00
Martin Jäger
0088641994 drivers: serial: esp32: remove unused stubs.h include
This include is only required if typeof() macro is used, which
is not the case for the serial / uart driver.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-16 16:17:11 +00:00
Tomasz Duda
5f84be56ae gpio_shell: support for input pull down/up
Add pull up/down in gpio shell.

Signed-off-by: Tomasz Duda <tomaszduda23@gmail.com>
2022-07-15 17:43:54 -05:00
Benjamin Björnsson
704e366fcf drivers: sensor: iis2mdc: Move bus union inside device config
Simplify driver by moving auxiliary bus union inside device config.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 15:35:54 +02:00
Benjamin Björnsson
bbff6eb592 drivers: sensor: iis2mdc: move driver to use i2c_dt_spec and spi_dt_spec
Simplify driver by using i2c_dt_spec and spi_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 15:35:54 +02:00
Benjamin Björnsson
e304695d2f drivers: led: ht16k33: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 15:35:33 +02:00
Jimmy Ou
78f876ef03 drivers: display: max7219: add driver
This commit implements the display interface for the MAX7219 LED Display
drivers.

Signed-off-by: Jimmy Ou <yanagiis@gmail.com>
2022-07-15 10:10:48 +02:00
Benjamin Björnsson
e1c0a494b3 drivers: i2c: i2c_tca954x: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 10:05:40 +02:00
Benjamin Björnsson
59ecc97b82 drivers: counter: rtc_mcp7940n: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 10:05:28 +02:00
Kumar Gala
dad7c3a240 drivers: misc: ft8xx: Convert to DEVICE_DT_INST_DEFINE
Move driver to use DEVICE_DT_INST_DEFINE.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-15 10:02:43 +02:00
Benjamin Björnsson
a372be6eda drivers: gpio: stmpe1600: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 10:00:44 +02:00
Benjamin Björnsson
ed84e45526 drivers: dac: dac_mcp4725: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 10:00:36 +02:00
Bartosz Bilas
9da5538f92 drivers: dac: mcp4728: set explicitly init priority
Since this DAC is connected via I2C bus the init priority
value must be higher than the default 50 so it can be initialized
later than the bus itself so add a dedicated init config
symbol for that.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-15 09:59:51 +02:00
Bartosz Bilas
5cf7adeb5b drivers: dac: mcp4725: set explicitly init priority
Since this DAC is connected via I2C bus the init priority
value must be higher than the default 50 so it can be initialized
later than the bus itself so add a dedicated init config
symbol for that.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-15 09:59:51 +02:00
Bartosz Bilas
035c75200e drivers: dac: dacx3608: set explicitly init priority
Since this DAC is connected via I2C bus the init priority
value must be higher than the default 50 so it can be initialized
later than the bus itself so add a dedicated init config
symbol for that.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-15 09:59:51 +02:00
Bartosz Bilas
43b38b348b drivers: dac: dacx0508: set explicitly init priority
Since this DAC is connected via SPI bus the init priority
value must be higher than the default 50 so it can be initialized
later than the bus itself so add a dedicated init config
symbol for that.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-15 09:59:51 +02:00
Adrian Bonislawski
0f90e8ed58 drivers: dmic: add gain ramping and unmute delay
This will add dmic gain ramping and unmute delay using
DAI's pre_copy trigger

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-07-14 16:25:39 -04:00
Marcin Szkudlinski
ae8b17d2bb Drivers: dmic-dai: Driver for Intel DMIC
This is a driver for Intel Digital Microphone

TODO:
 - volume rampup
 - TPLG config

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2022-07-14 16:25:39 -04:00
Johann Fischer
5e5ea9a21d drivers: use unsigned int for irq_lock()
irq_lock() returns an unsigned integer key.
Generated by spatch using semantic patch
scripts/coccinelle/irq_lock.cocci

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-07-14 14:37:13 -05:00
Tom Burdick
c225cf3b8a dma: HDA rename prefix from cAVS to ADSP
HDA is a common IP used across the entire ADSP line and deserves
a name respecting that alongside similiar IP drivers such as the
ADSP GPDMA driver.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-07-14 17:53:46 +00:00
Yannis Damigos
f845d9ac02 drivers: spi_esp32_spim: Support more CS pins per SPI instance
Support more CS pins per SPI instance

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2022-07-14 15:51:00 +00:00
Bjarki Arge Andreasen
52dd2bb3a3 drivers/modem: Patch fix for sock id and fd
There is is an error in the way that the sock id is
determined. A unique fd is reserved and assigned appropriatly, but
the id, which should correspond to a socket number within the modem,
is set to an invalid, and identical for all sockets, value, and then
not used appropriatly in the drivers, instead, the sock_fd is used,
which can be any value really, it is not related to the socket number
in any way.

This results in the drivers only working if the reserved fd happens
to be between base_socket_num and (socket_len - 1)

This patch assignes the id to the index of the socket + the
base_socket_num, the socket at index 0 will get the id 1 if the
base_socket_num is 1, and the modem_socket_from_id should then
be used to get a pointer to the socket, since the id is not
neccesarily equal to the index.

The FIXME has been solved by adding a note both at the start
of the modem_socket_get function and inside the Kconfig file
for the MODEM_SOCKET option description. It is not an error,
but the user must be aware that it uses the POSIX file
descriptors, for which only 4 are allocated by default.

This patch fixes the bug, without breaking the brittle modem
drivers which currently are built around this bug.

The modem drivers should be updated to use the id as the
socket num instead of the sock_fd after this fix has been merged.

The "socket # needs assigning" has been removed, as that is what
this patch is doing

I also added comments to the id and sock_fd in the modem_socket
structure to help developers use the id and fd appropriately.

Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com>
2022-07-14 16:23:33 +02:00
Kumar Gala
861b14bd2e drivers: eeprom_emulator: Remove dead code
Remove unused PART_DEV_NAME macro.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:40:07 +02:00
Benjamin Björnsson
2259c6771f drivers: sensor: fxas21002: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-14 10:39:40 +02:00
Kumar Gala
3caaf8c935 drivers: crypto: ataes132a: Convert to devicetree
Move driver to be devicetree based and use struct i2c_dt_spec.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:37:26 +02:00
Kumar Gala
e8624849c3 drivers: adc: adc_ads1119: Convert to use DEVICE_DT_INST_DEFINE
Convert driver to use DEVICE_DT_INST_DEFINE.  Its already devicetree
based so trivial change over to use DEVICE_DT_INST_DEFINE.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:32:27 +02:00
Kumar Gala
5cdfd12726 drivers: clock_control: beetle: Use devicetree for clock control
Add simple clock control node in devicetree for beetle to handle
relationship between drivers (uart, timers, gpio) and clock controller
device.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:50 +02:00
Kumar Gala
762eadc15d drivers: gpio: dw: rework init to use DT_INST_FOREACH_STATUS_OKAY
Use DT_INST_FOREACH_STATUS_OKAY to reduce duplicated code for each
instance.

We make interrupts optional since they aren't always available.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Kumar Gala
8a97bbd1f5 drivers: gpio: dw: determine instances from devicetree
Remove Kconfig symbols that determine which instances and just use
the number of enabled instance in the devicetree to determine which
instances to build.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Kumar Gala
4773bb45b0 drivers: gpio: dw: Remove dead clock gate code
Remove dead clock gate code and associated PM code as the platforms
that used the clock gate code are no longer supported in Zephyr.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Kumar Gala
ef78470e4a drivers: gpio: dw: Remove dead shared IRQ code
The shared IRQ code has been broken for several releases and no one
seems to have noticed.  The platforms that this was used on are not
supported in Zephyr anymore so remove the code.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Kumar Gala
0b5b74da82 drivers: video: video_mcux_csi: Use phandle for devicetree sensor ref
Replace sensor_label property in devicetree with just a sensor phandle
property.  This is more generic and allows driver to use DEVICE_DT_GET
instead of device_get_binding.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:27 +02:00
Lucas Tamborrino
80fbef9677 drivers: pwm: esp32: mcpwm driver
Add new mcpwm peripheral driver

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-07-14 10:29:26 +02:00
Henrik Brix Andersen
5c16ba05c2 drivers: can: mcux: flexcan: add triple sampling mode support
Add support for triple sampling mode to the NXP FlexCAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 19:06:59 +02:00
Henrik Brix Andersen
97d9ab8c18 drivers: can: shell: add support for setting triple sampling mode
Add support for setting triple sampling mode.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 19:06:59 +02:00
Benjamin Björnsson
05a6c0fe68 drivers: sensor: stm32_temp: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-13 19:06:41 +02:00
Henrik Brix Andersen
7b6ca29941 drivers: can: mcux: mcan: add pinctrl support
Add pinctrl support to the NXP LPC driver front-end.

Fixes: #47742

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 18:10:52 +02:00
Tom Burdick
3824024f77 dma: hda link driver fixups
Fixes configured DMA direction for HDA link in/out drivers.

Adjusts the number of channels for link in/link out to safe value
that seems to work on all tested parts.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-07-13 10:55:17 -04:00
Jaroslaw Stelter
afb156a1eb soc: ace_v1x: unmap entire unused virtual space
This patch corrects the initial unmapping of unused l2 memory
to unmap until the end of virtual address space instead
of unmapping until the end of l2 physical memory.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-07-13 09:46:48 -05:00
Jaroslaw Stelter
8b598539f2 soc: ace_v1x: correct the move_region behavior
This patch introduces sys_mm_drv_move_region implementation
which stops usage of the sys_mm_drv_simple_move_region.
The sys_mm_drv_simple_move_region is unsuitable becuase
it iterates through physical pages in linear fashion.
The new implementation queries the tlb for each virtual
page of the requested region to find the physical page
to be remapped.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-07-13 09:46:48 -05:00
Andreas Sandberg
237de99da4 drivers: ssd16xx: Refactor busy pin handling
The SSD16xx driver needs to wait for the chip to complete commands
before issuing new commands. The datasheet doesn't specify which
commands cause the chip to raise the busy pin. The current driver has
ssd16xx_busy_wait() calls after commands that are known to take a long
time. This is very fragile and scatters a lot of boiler plate around
the driver.

Include an ssd16xx_busy_wait() call in ssd16xx_write_cmd() instead of
after commands that are suspected to take a long time. This makes the
driver more robust and is more in line with the expectations set out
in the data sheet.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-13 15:57:04 +02:00
Benjamin Björnsson
597be4d4f7 drivers: sensor: ak8975: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-13 15:53:26 +02:00
Jaroslaw Stelter
cf24124efa mm: introduce update memory flags api
There are cases when attributes of mapped virtual memory need
to be updated. E.g. in case there is loadable library/module
code loaded to the l2 memory then memory needs to be read-write.
After the code is loaded and is ready to be executed then
attributes of mapped memory should be updated to
read-only/executable without loosing memory contents.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
2022-07-13 15:53:14 +02:00
Glauber Maroto Ferreira
2bc16b9918 soc: esp32: drivers: counter: code refactor
Refactors counter driver code, bringing:

- more readability through the removal of abused macros
- better use of the devicetree, by moving peripheral node's
info defined on macros and Kconfigs to dts bindings
- less dependence from dynamic allocations, making counter
instances fully statically-allocated
- better use of DT_INST_* macros

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-07-13 15:53:04 +02:00
Henrik Brix Andersen
e143c8b916 drivers: can: stm32: list one-shot capability
List the one-shot capability as supported.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 15:51:39 +02:00
Pieter De Gendt
bdf3322de8 drivers: display: display_mcux_elcdif: Rework double framebuffer
Improved the eLCDIF driver implementation:
* Optional (working) double framebuffers
* Statically allocated framebuffer(s)
* Removed obsolete Kconfig entries

Also modified the mimxrt1170 EVK default config.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-13 07:58:58 -05:00
Benjamin Björnsson
9ed194a00b drivers: sensor: ak8975: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-13 05:39:37 -05:00
Henrik Brix Andersen
d22a9909a1 drivers: net: canbus: move CAN bus network driver to drivers/net
Move the CAN bus network driver from drivers/can to drivers/net as it
implements a network driver, not a CAN controller driver.

Use a separate Kconfig for enabling the CAN bus network driver instead of
piggybacking on the SocketCAN Kconfig. This allows for other
(e.g. out-of-tree) SocketCAN transports.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 10:34:51 +02:00
Andreas Sandberg
4a09967517 drivers: ssd16xx: Implement blanking support
Implement support for display blanking by inhibiting display refresh
while blanking is on. Writes to the display are still sent to the
internal RAM in the display controller. Once blanking is turned off,
the contents of the RAM are written to the display. This behavior is
makes it possible to compose a frame buffer in the display controller
without flickering.

Other e-paper drivers such as the GD7965 already implement this
behavior.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-13 10:27:45 +02:00
Henrik Brix Andersen
ef804d8408 drivers: can: mcan: use generic dcache API
Use the generic dcache API for doing cleaning and invalidating data cache.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 10:18:30 +02:00
Tim Lin
04c6d7569f ITE: drivers/i2c: Add command queue mode
Adding command queue mode can reduce the time between each byte to
improve the I2C bus clock stretching during I2C transaction.

I2C command queue mode of it8xxx2 can support I2C APIs including:
i2c_write(), i2c_read(), i2c_burst_read.

Test:
1. tests\drivers\i2c\i2c_api --> pass
2. Reading 16 bytes of data through i2c_burst_read() can reduce
   0.72ms(2.54ms->1.82ms) compared to the original pio mode when the
   frequency is 100KHz.
3. krabby platform can boot normally.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-07-13 10:15:32 +02:00
Kumar Gala
ca2f491b22 modem: wncm14a2a: Update driver to use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.

As part of this use logical values of 0/1 for gpio_pin_set_dt
and handle any inversions as GPIO flags that might be required
at a board level (in dts config).

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-13 10:15:06 +02:00
Andreas Sandberg
d33b89befe drivers: spi: spi-bitbang: Add support for half duplex
Implement support for half duplex communication in the bit bang SPI
driver. The SPI driver will use the MOSI pin is for both TX and RX
operations when using half duplex mode.

In half-duplex mode, the driver configures the MOSI pin as an input
pin for input only transactions. Transactions that are bidirectional
are forbidden. After an SPI transaction, the MOSI pin is left as an
input if it was an RX transaction or an output after a TX
transaction. Like before, the MOSI pin is initialized as an
(inactive) output pin when the bus is initialized.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-13 10:15:00 +02:00
Henrik Brix Andersen
bb08e4251a drivers: can: add API for getting supported capabilities
Add API function for getting the supported capabilities of a CAN
controller. This allows for writing portable CAN applications.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 10:13:56 +02:00
Henrik Brix Andersen
7a5f96d844 drivers: can: shell: add support for setting one-shot mode
Add support for setting one-shot mode.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 10:13:42 +02:00
Henrik Brix Andersen
c0cba8f21a drivers: can: stm32: switch to supporting CAN_MODE_ONE_SHOT
Switch from using a driver-specific, compile-time devicetree one-shot
property to supporting the newly added CAN_MODE_ONE_SHOT flag for
enabling/disabling one-shot mode at run-time.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-13 10:13:42 +02:00
Kumar Gala
1eeae77621 sensors: ak8975: remove passthrough support for MPU9150
Remove the support for enabling passthrough mode support for MPU9150
on the AK8975.  We don't have a proper MPU9150 driver and the MPU9150
has been EOL.  So its highly unlikely this code is being used.

Additonally we remove the device tree binding for the MPU9150 since
we don't have a proper driver for it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-12 17:57:18 -05:00
Michał Barnaś
4978717d44 gpio: implement pin_get_config in stm32 driver
This commit adds support for pin_get_config function in stm32 driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś
7a7fdffdfd gpio: implement pin_get_config in gecko driver
This commit adds support for pin_get_config function in gecko driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś
634944ac66 gpio: implement pin_get_config in ite driver
This commit adds support for pin_get_config function in ite driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś
0f60d5ae30 gpio: implement pin_get_config in npcx driver
This commit adds support for pin_get_config function in npcx driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś
f9c9d537a8 gpio: implement pin_get_config in emul driver
This commit adds support for pin_get_config function in emul driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś
b1ba284b83 gpio: add function to get current configuration
Add gpio_pin_get_config function to gpio_driver_api.
This function is used to read current configuration of pin.
The gpio_pin_get_config checks if driver implements this function and
returns -ENOSYS if it isn't implemented.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Bartosz Bilas
819079a2c6 drivers: dac: mcp4728: fix indentation of the help section
The help section must start with 2 spaces so let's
add them.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-12 16:35:59 +00:00
Bartosz Bilas
e5a0c19f0e drivers: dac: mcp4728: remove not neccessary DAC guard
It is guarded by the parent so this symbol does not need it.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-12 16:35:59 +00:00
Gerard Marull-Paretas
0aea96dbca drivers: pwm: minor formatting enhancements
Some formatting tweaks to improve the outcome of clang-format.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
c82d71e7ff drivers: pwm: npcx: remove unused include <assert.h>
<assert.h> is not used, so remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
dac7093529 drivers: pwm: npcx: use register type
Custom accessors like HAL_INSTANCE() have been gradually removed
in-tree. Instead, store a pointer with the right type (struct pwm_reg
*).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
f9ff805e3b drivers: pwm: add log level to LOG_MODULE_REGISTER
LOG_MODULE_REGISTER accepts log level as an argument.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
45ca8090c0 drivers: pwm: mcux: fix register casting
Register was wrongly casted to (void *) in one case, and unnecessarily
casted in another case.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
4df3b22934 drivers: pwm: mchp_xec: fix include list
Include what is needed, and sort includes properly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
a0ff40ca4b drivers: pwm: imx: remove redundant DEV_BASE accessor
The base variable type stored in config already has the right type. Such
kind of accessors have been removed in many other places.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Gerard Marull-Paretas
6bd248d005 drivers: pwm: gecko: fix non-local includes
HAL includes are not local, so use <> instead of "".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-12 17:51:23 +02:00
Guillaume Lager
f6f52d3842 drivers: adc: Add ADS1119 driver
The driver support both synchronous and asynchronous reading.

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2022-07-12 12:29:45 +02:00
Guillaume Lager
ac1eab55ef drivers: adc: Add runtime adc context initialization function
In some case the structure enclosing the adc context
can be quite big, making static initialization quite
resource consuming

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2022-07-12 12:29:45 +02:00
Benjamin Björnsson
6c82570f62 drivers: sensor: ccs811: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-12 12:28:53 +02:00
Benjamin Björnsson
bf4b30e848 drivers: sensor: iis3dhhc: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-12 10:56:15 +02:00
Benjamin Björnsson
0364f3ae4d drivers: sensor: ti_hdc: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-12 10:18:29 +02:00
Pieter De Gendt
850cdc9196 drivers: memc: mcux_flexspi_hyperram: Fix multiple log module definition
Enabling the FlexSPI HyperRAM results in a build error, due to a logging
module re-definition. Fixed by changing the log module name.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-12 09:54:07 +02:00
Daniel DeGrasse
5dcb5e0f67 drivers: ethernet: mcux: Increase available RX buffers
increase available RX buffers to MCUX ethernet driver.
improves measured performance on RT1050 EVK zperf download
from 500Kbps to 22Mbps.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-07-12 09:53:56 +02:00
Maximilian Deubel
3d2b04c9a8 ADXL362: add dynamic inact time setting
This patch extends the adxl362 driver by adding an option
to change the inactivity detection timeout at runtime.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2022-07-11 18:19:45 +00:00
Peter Ujfalusi
e243122c1e dma/cavs_hda: Configure DGMBS only for host DMA configuration
The DGMBS should be only set for the host side and not on the link DMA.

Fixes: #46632
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-07-11 18:04:54 +00:00
Kiril Petrov
44f651d315 drivers: nordic_nrf_temp: nrfx: Fix build warning into temp_nrf5_init
Building lwm2m_client with CONFIG_NET_L2_OPENTHREAD=y leads to
following warning during build:

west build -s samples/net/lwm2m_client -b nrf52840dk_nrf52840 -- \
				-DCONFIG_NET_L2_OPENTHREAD=y

zephyr/drivers/sensor/nrf5/temp_nrf5.c:115:10:
warning: zero-length gnu_printf format string [-Wformat-zero-length]
115 |  LOG_DBG("");

Signed-off-by: Kiril Petrov <retfie@gmail.com>
2022-07-11 17:57:12 +02:00
Gerard Marull-Paretas
c2d699ec2d drivers: spi: sifive: remove CONFIG_SIFIVE_SPI_0_ROM
CONFIG_SIFIVE_SPI_0_ROM (default y) was an option to disable spi0 if
used to access SPI Flash ROM. However, its design had a problem: it
relied on instance numbers. You had to set status okay for spi0 to make
it work (incongruent with the purpose of the option itself). This patch
makes things simpler: if such SPI0 is not available, simply keep it
disabled in DT. Bindings have been updated to mention this case.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-11 17:56:55 +02:00
Gerard Marull-Paretas
457fa9d463 drivers: flash: shell: remove unused soc.h
The flash shell included soc.h for no reason, remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-11 17:56:55 +02:00
Kumar Gala
97281913f5 modem: hl7800: Cleanup gpio assert/deassert
Use logical values of 0/1 for gpio_pin_set_dt and handle any
inversions as GPIO flags that might be required at a board level.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-11 07:46:22 -05:00
Kumar Gala
6100eadd4b modem: hl7800: Update driver to use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-11 07:46:22 -05:00
Carlo Caione
5d104f20ab riscv: Introduce API for CLIC and PLIC
Introduce a new interface for CLIC and PLIC to be used by the drivers.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-11 14:31:39 +02:00
Carlo Caione
56466a14e1 riscv: Decouple CLIC and PLIC
Try to decouple CLIC and PLIC as much as possible.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-11 14:31:39 +02:00
Carlo Caione
31c5dc2230 Kconfig: Introduce RISCV_HAS_CLIC
Introduce a new RISCV_HAS_CLIC symbol for platforms using CLIC,
reorganize the Kconfigs and make the Nuclei ECLIC depending on the new
symbol.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-07-11 14:31:39 +02:00
Aurelien Jarno
2ea4516a4a drivers/flash: stm32g0: Prepare for unaligned accesses in flash writes
When using the settings subsystem, the data argument argument passed to
flash_stm32_write_range() might not be 8-bytes aligned, causing an
unaligned memory access fault.

Fix that the same way as it was done for the STM32L4 in commit
652efa530f.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-11 13:28:45 +02:00
Gerard Marull-Paretas
2533b13cd2 drivers: gpio: nrfx: add custom drive flags
Now that we have 8 bits reserved for vendor specific GPIO flags,
introduce a new set of flags for nRF platforms to configure pins drive
mode. These new flags are equivalent to the previous existing ones, but
use a naming scheme the fits better with vendor hardware capabilities.

The table below shows the equivalence between old and new flag

| Old flags                 | New flags             |
|---------------------------|-----------------------|
| `NRF_GPIO_DS_DFLT_LOW`    | `NRF_GPIO_DRIVE_S0`   |
| `NRF_GPIO_DS_DFLT_HIGH`   | `NRF_GPIO_DRIVE_S1`   |
| `NRF_GPIO_DS_ALT_LOW`     | `NRF_GPIO_DRIVE_H0`   |
| `NRF_GPIO_DS_ALT_HIGH`    | `NRF_GPIO_DRIVE_H1`   |
| `NRF_GPIO_DS_DFLT`        | `NRF_GPIO_DRIVE_S0S1` |
| `NRF_GPIO_DS_ALT`         | `NRF_GPIO_DRIVE_H0H1` |
| `NRF_GPIO_DS_DFLT_LOW \|` | `NRF_GPIO_DRIVE_S0H1` |
| `NRF_GPIO_DS_ALT_HIGH`    |                       |
| `NRF_GPIO_DS_ALT_LOW \|`  | `NRF_GPIO_DRIVE_H0S1` |
| `NRF_GPIO_DS_DFLT_HIGH`   |                       |

Documentation has been written to explain in more detail the meaning of
the flags and how they can be used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-11 13:22:24 +02:00
Gerard Marull-Paretas
e29055a225 drivers: gpio: nrfx: remove custom DS flags
The naming of the custom DS flags is not clear for nRF platforms. This
patch removes all the NRF_GPIO_DS* flags. New flags will be
re-introduced in a follow-up commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-11 13:22:24 +02:00
Francois Ramu
085cdd9277 drivers: adc: stm32f1 adc driver enable peripheral
This commit avoid re-enabling the ADC,
because this starts conversion.
According to the RefMan (RM0008) of the stm32F10x mcu,
enabling the ADC will start the conversion
if the ADC is already enabled. "Conversion starts when
this bit holds a value of 1 and a 1 is written to it."
That's not what we want.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-11 10:49:01 +02:00
Flavio Ceolin
ad8ae7f735 dma: intel: Merge cavs and ace gpdma
cAVS and ACE gpdma driver have several similarities. This commit merge
this two drivers into a single one for Intel ADSP devices.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-07-11 10:21:17 +02:00
Flavio Ceolin
d8c7aed261 dma: ace: Add ace gpdma driver
Add ace gpdma driver.

Co-authored-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-07-11 10:21:17 +02:00
Bruno Achauer
bc8419e20a drivers/timer/apic_tsc: Select the 64-bit cycle counter in deadline mode
When using the APIC imer in TSC deadline mode, also enable reading the
full 64-bit cycle counter value (via the k_cycle_get_64() call).

Signed-off-by: Bruno Achauer <bruno.achauer@intel.com>
2022-07-08 21:59:06 -04:00
Andrzej Głąbek
e530ba9152 drivers: i2c: nrfx: Fix i2c_recover_bus implementation for PINCTRL
When PINCTRL is enabled, the SCL and SDA pin numbers are not available
in configuration structures used for nrfx drivers initialization.
In this case, these pin numbers need to be obtained from peripheral
registers.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-07-08 20:05:49 +00:00
Tom Burdick
572ccd531d intel_adsp: Use device tree to enable/disable each HDA driver
Uses the dt_compat_enabled Kconfig preprocessor to set defaults
for each HDA driver.

Each direction is uniquely selectable which can be useful when building
with SOF where only some directions may wish to be enabled at any given
time.

By default, given the device tree (intel_cavs.dtsi) only the host
directions are enabled but an overlay may adjust that as needed.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-07-08 14:33:06 -04:00
Fabio Baltieri
151d840f1e driver: timer: stm32_lptim: only set LSE drive if supported
Not all platforms support setting the LSE driving capability, causing
the build to fail for platform such as the STM32L072 if compiled with
CONFIG_STM32_LPTIM_CLOCK_LSE=y.

Adding an #ifdef guard around the call to skip it if not defined in the
HAL.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-07-08 11:48:07 +00:00
Mulin Chao
6f108d7f76 driver: gpio: npcx: Add checking whether pad's configuration is valid
In npcx series, not all GPIO pads support Multi-Input Wake-Up Unit
(MIWU) functionality. Hence, this CL adds checking whether GPIO's pad
configuration is valid first before using it.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-07-08 12:05:09 +02:00
Yuriy Vynnychek
99479ecbda drivers: adc: introduce new Telink B91 ADC driver
ADC driver basic support for Telink B91 SoC.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-07-08 11:07:18 +02:00
Benjamin Björnsson
78af3f39ec drivers: sensor: ism330dhcx: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-08 10:57:18 +02:00
Kumar Gala
244519b497 i2c: xec: Update driver to use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.  Mostly
gpio_dt_spec is used as a common struct and lets us move
away from DT_INST_GPIO_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-08 10:57:03 +02:00
Francois Ramu
95c00f4d7a drivers: clock_control: no PLLEN on some stm32 soc
Some stm32 devices, like stm32F4, do not have
a PLL Enable bit on the PLLP nor PLLQ divider
in their PLL config register (PLLCFGR).
The result is a empty function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-08 10:48:54 +02:00
Francois Ramu
388c36e5d6 drivers: clock: get_pllsrc_frequency for stm32f2/f4/f7
The function get_pllsrc_frequency is added
with possible source HSI or HSE.
With STM32_PLL_P_ENABLED or STM32_PLL_Q_ENABLED,
this function is used by the clock control driver.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-08 10:48:54 +02:00
Piotr Dymacz
20cb405e17 drivers: adjust cc13xx_cc26xx drivers for hal_ti update
The TI SimpleLink SDK got updated to version '4.40.04.04' in 'hal_ti'.
This introduced renames of some functions in HAL and has to be reflected
in Zephyr drivers which make use of them.

This renames 'PRCMPowerDomainStatus' to 'PRCMPowerDomainsAllOn' in all
affected 'cc13xx_cc26xx' drivers.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-07-08 09:37:43 +02:00
Kumar Gala
92ad49e173 drivers: flash: spi-nor: Set driver Kconfig default based on dts
Change Kconfig default to be based on if the devicetree has the
jedec,spi-nor driver enabled.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-08 09:36:43 +02:00
Adrian Bonislawski
ef2644d40d dma/cavs_hda: add missing hda link files to CMakeLists
This patch will allow to build hda link in&out files

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-07-07 15:04:31 -04:00
Pieter De Gendt
90af62243e drivers: hwinfo: shell: Add missing reset cause strings
The hwinfo shell commands was missing human readable names for
* RESET_HARDWARE
* RESET_USER
* RESET_TEMPERATURE

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-07 17:59:19 +00:00
Benjamin Björnsson
e0cc66ab6f drivers: sensor: amg88xx: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-07 09:21:34 -05:00
Mulin Chao
851e357aa4 pinctrl: npcx: add pinctrl support for psl pads
This CL introduces how to configure PSL (Power Switch Logic) pads
properties such as input detection mode/polarity, pin-muxing and so
on via pinctrl mechanism. It includes:

1. Add two pinctrl properties and their enums for PSL input
   detection configuration.
    psl-in-mode:
      - "level"
      - "mode"
    psl-in-pole:
      - "low-falling"
      - "high-rising"

2. Add macro functions to get PSL input detection and pin-muxing
   configurations from 'pinmux', 'psl-offset' abd 'psl-polarity'
   properties.

Here is an example to configure PSL_IN2 as the PSL detection input and
its mode and polarity.

/* A falling edge detection type for PSL_IN2 */
&psl_in2_gp00 {
	psl-in-mode = "edge";
	psl-in-pol = "low-falling";
};

A device will be introduced later which uses this pinctrl node to
configure PSL input detection settings and how to turn off VCC1 power
rail by PSL_OUT.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-07-07 14:12:52 +00:00
Joep Buruma
7e0fff24c7 drivers: pwm: add pwm driver for rpi_pico
Add pwm driver implementation for rpi pico family.
Adds myself as codeowner of drivers/pwm/*rpi_pico*

Signed-off-by: Joep Buruma <burumaj50@gmail.com>
2022-07-07 15:17:26 +02:00
Martin Jäger
2ed42b3555 drivers: serial: esp32_usb: Add USB serial / JTAG interface
This peripheral combines a hardware-based USB CDC ACM serial interface
and a JTAG interface.

It is present in the ESP32-C3.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-07-07 13:14:00 +00:00
Yann Roth
c640392211 typo: fix LSM6DSL_SHIFT_MD2_CFG_INT2_WU
The register MD2_CFG contains INT2_WU and not INT1_WU

Signed-off-by: Yann Roth <yannroth@msn.com>
2022-07-07 10:16:35 +02:00
Pieter De Gendt
e381170282 uart_pipe: Remove obsolete UART_PIPE_ON_DEV_NAME Kconfig
The UART pipe device is selected with devicetree chosen zephyr,uart-pipe

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-07 09:59:49 +02:00
Pieter De Gendt
aba4c4ea3e uart_pipe: move driver from console to serial
The uart_pipe driver is not dependent on any console driver,
however a serial driver is required.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-07 09:59:49 +02:00
Flavio Ceolin
e4a3e2d8b6 intel_adsp: Unify cavs and ace timers
These two timers were sharing pretty much the same code. Actually
mtl timer was a "superset" of cavs timer. Just merge them into a
single one called intel audio dsp timer (intel_adsp_timer).

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-07-06 15:11:07 -04:00
Anas Nashif
b330a05539 intel_adsp: add a new series to support Meteorlake
Meteorlake support as part of the Intel ADSP family.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Co-authored-by: Michal Wasko <michal.wasko@intel.com>
Co-authored-by: Konrad Leszczynski <konrad.leszczynski@intel.com>
Co-authored-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Co-authored-by: Enjia Mai <enjia.mai@intel.com>
Co-authored-by: Flavio Ceolin <flavio.ceolin@intel.com>
Co-authored-by: Tomasz Leman <tomasz.m.leman@intel.com>
Co-authored-by: Bonislawski Adrian <adrian.bonislawski@intel.com>
Co-authored-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
Co-authored-by: Andrey Borisovich <andrey.borisovich@intel.com>
2022-07-06 15:11:07 -04:00
Anas Nashif
17a0f81bfc intel_adsp: meteorlike: add timer driver
Add timer driver based on CAVS driver and adapted for Meteor Lake.

Co-authored-by: Michal Wasko <michal.wasko@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 15:11:07 -04:00
Anas Nashif
b951a0ebed drivers: Add ACE V1X interrupt controller
Add Designware Interrupt Controller for ACE v1x platform

Co-authored-by: Ederson de Souza <ederson.desouza@intel.com>
Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 15:11:07 -04:00
Anas Nashif
3ccafb1af3 intel_adsp: meteorlake: add memory driver
Add TLB driver specific for Meteorlake.

Add missing kconfig resource and fix include path
add hpsram power up and ref counter

Use memblock to track physical page usage in mtl tlb driver. The
applications that will be using the tlb memory driver should not
track the physical page mapping to virtual address space:
 - adds an option to use the phys argument value of 0 to tell the
   driver to autonomously assign physical pages upon map request
 - makes the tlb driver use memblock to track mapped physical pages

Co-authored-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Co-authored-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Co-authored-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
Co-authored-by: Michal Wasko <michal.wasko@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 15:11:07 -04:00
Benjamin Björnsson
092251017f drivers: sensor: stts751: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 18:00:21 +00:00
Benjamin Björnsson
0ce4d8b2da drivers: sensor: stm32_vbat: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 18:00:02 +00:00
Kumar Gala
1cce353536 drivers: eswifi: Remove unused 'csn' field from struct
The 'csn' field is not being used so remove it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 12:42:45 -05:00
Anas Nashif
49b36ead95 drivers: add mising braces to single line if statements
Following zephyr's style guideline, all if statements, including single
line statements shall have braces.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 11:00:45 -04:00
Benjamin Björnsson
1cd8a0fb34 drivers: sensor: lsm9ds0_gyro: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 09:49:32 -05:00
Benjamin Björnsson
ccf9292a52 drivers: sensor: iis2dh: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 09:11:06 -05:00
Benjamin Björnsson
6e62bd070f drivers: sensor: bmg160: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 09:09:38 -05:00
Benjamin Björnsson
2cff424bea drivers: sensor: tmp007: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 09:07:33 -05:00
Kumar Gala
48c87f2bf8 wifi: eswifi: spi: Move spi bus into config
Move 'struct spi_dt_spec bus' into the config struct so it
can be const and than possibly placed in ROM.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 08:45:25 -05:00
Kumar Gala
c4f5439221 wifi: eswifi: Update driver to use gpio_dt_spec
Replace eswifi_gpio with gpio_dt_spec.  We can replace devicetree
label based access with this change as we try and phase out the
usage of the 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 08:45:25 -05:00
Francois Ramu
a20aa34301 drivers: dma: no irq when stopping dma channel
when the dma channel is stopped, the irq is no more
relevant ; clear any irq but do not process it.
Fix Typo on comments and add LOG_DBG on channel increment.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-06 11:19:47 +00:00
Andreas Sandberg
f5932657dd drivers: ssd16xx: Fix CS glitch
The SSD16xx uses a separate pin to indicate if an SPI transfer is a
command or data. This means that driver needs to split most SPI
transactions into two distinct transactions, one for commands and one
for data. The driver currently doesn't request SPI_HOLD_ON_CS which
means that the chip select will be released momentarily between the
command and data phase.

Update the driver to request SPI_HOLD_ON_CS and SPI_LOCK_ON to lock
the bus and complete both phases of a command in one atomic operation.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-06 11:14:49 +02:00
Andreas Sandberg
f922a580f7 drivers: ssd16xx: Remove unused include
Remove the unused zephyr/display/cfb.h include.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-06 11:14:49 +02:00
Andreas Sandberg
a05e8dcc5e drivers: spi: spi-bitbang: Fix CS glitch in transceive
spi_context_cs_configure_all() is currently called from
spi_bitbang_transceive(). This causes a glitch when combined with
SPI_HOLD_ON_CS is used.

Move the initialization to spi_bitbang_init which is what the other
SPI drivers seem to do.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-06 11:11:14 +02:00
Andreas Sandberg
65252ffd95 drivers: spi: spi-bitbang: Initialize CS GPIOs
The SPI bitbang driver doesn't correctly initialize the list of CS
GPIOs. As a consequence, SPI buses using the bitbang driver won't
drive CS low. Add the missing initialization.

Signed-off-by: Andreas Sandberg <andreas@sandberg.uk>
2022-07-06 11:11:14 +02:00
Aurelien Jarno
869c60e208 drivers: sensor: stm32_vbat: get vref-mv through the ADC API
Get the vref-mv through the ADC API instead of the device tree. This
saves 8 bytes of SRAM and will be future proof in case, one day, support
for a variable vref is added.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-06 11:10:42 +02:00
Aurelien Jarno
fd8042d88f drivers: adc: stm32: remove vref_mv from adc_stm32_cfg
The value is unused in this structure is unused and can be accessed
through the adc_ref_internal() function.

This saves 4 bytes of SRAM.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-06 11:10:42 +02:00
Aurelien Jarno
ef05063e62 drivers: adc: stm32: enable battery voltage input without CONFIG_STM32_VBAT
Allow the battery voltage to be read through the ADC even if the
CONFIG_STM32_VBAT driver is not enabled.

I guessed this part of code is conditionally compiled depending on
CONFIG_STM32_VBAT because this feature, and hence the
LL_ADC_CHANNEL_VBAT constant is not available on all families. As the
feature is already checked at runtime (as the same driver supports
multiple instances), we can conditionally compile it depending on
LL_ADC_CHANNEL_VBAT instead.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-06 11:10:42 +02:00
Richard Yim
1b4e5b8d35 ITE drivers/pwm: fix target frequency below 324Hz on it8xxx2
after the second times will not operating in correct output frequency.

Signed-off-by: Richard Yim <yimjiajun@icloud.com>
2022-07-06 11:04:02 +02:00
Jamie McCrae
a20eb66742 drivers: watchdog: Add Raspberry Pi Pico watchdog driver
This adds basic support for the watchdog timer on the RP2040 MCU and
Raspberry Pi Pico development board

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2022-07-06 10:52:29 +02:00
Kumar Gala
927d6b620d video: ov2640: cleanup unused struct fields
When we moved to gpio_dt_spec forgot to remove the older
fields used for gpio related access.  Remove them as they
are used by the driver anymore.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-06 10:50:01 +02:00
Jun Lin
d4abe64766 driver: i2c: npcx: clear FIFO status before a transaction starts
When an I2C transaction completes, the driver should clear all the FIFO
status. Otherwise, it has the chance to break the operation of the next
transaction. This commit sets the CLR_FIFO bit in the SMBFIF_CTS
register to clear all the FIFO status at the beginning of an I2C
transaction.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-07-06 10:46:28 +02:00
Rodrigo Cataldo
089ed23a32 drivers: pcie: fix inverted translation for PCIe controller
Invert the physical address given to pcie_ctrl_region_translate() to
match the PCI BAR layout. Previously, physical addresses for memory
space BAR were exposed to bit 3 (prefetchable bit) and 2 (1 type bit) of
the header.

Signed-off-by: Rodrigo Cataldo <rodrigo.cataldo@huawei.com>
2022-07-06 10:45:54 +02:00
Benjamin Björnsson
251755e21d drivers: sensor: iis2dh: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 10:43:10 +02:00
Benjamin Björnsson
5c9f5a12f4 drivers: sensor: iis2dh: Update driver to use spi_dt_spec and i2c_dt_spec
Move driver to use spi_dt_spec and i2c_dt_spec for SPI and I2C bus
access, respectively.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 10:43:10 +02:00
Benjamin Björnsson
619c0ee17b drivers: sensor: iis2dh: Change parameter list of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-06 10:43:10 +02:00
Pieter De Gendt
8bef504163 drivers: display: st7789v: Support 3-line serial interface
The sitronix ST7789V serial interface can operate with 3- or 4-line
protocol.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-06 10:42:15 +02:00
Kumar Gala
51b4df60a2 drivers: ethernet: eth_mcux: Replace use of DT_INST_LABEL
As we work to phase out devicetree 'label' properties, convert
driver to just use ETH_0/ETH_1 instead of DT_INST_LABEL for
logging purposes.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-05 22:24:09 -05:00
Thomas Stranger
3d70711c04 drivers: sensor: add support for ds18b20 1-wire temperatue sensor
This commit adds support for the ds18b20 1-wire temperature sensor.

The sampling resolution of the sensor can be set in DT.
In case only a single device is on the bus, the driver issues
skip_rom commands. However, in case DT defines several devices,
the driver will use match_rom commands and therefore it is necessary
to set the rom_id of the device via the sensor attribute interface before
being able to sample sensor values.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Thomas Stranger
d668281b4a drivers: w1: add zephyr-serial driver
The zephyr-serial w1 driver introduced in this commit implements
all routines for the w1 api on top of the zephyr serial driver.
W1 bit read, write, and reset operations are executed by issuing
polling zephyr serial byte read and write operations.

The driver should be usable on most platforms in zephyr that have
implemented support for the polling procedures of the serial driver.
As not all serial drivers are implemented exactly the same minor
additional quirks may be needed on some platforms.
The most notable difference of polling serial driver implementations
seems to be that some return immediately from poll_out after the
transmission was started(e.g. STM32) and others wait until
the transmission was completed before returning from poll_out
(e.g. NRF). While this has influence on the timeout, both types
are supported by this driver because the driver waits for a
configurable time period until it terminates the read.

The driver needs an appropriate open drain interface to be able
to communicate with slaves.
In the simpliest case this might be achived by configuring the mcu pins
in open-drain configuration with a (sufficiently small) pull-up to 3V3/5V.
Otherwise an external circuit needs to provide this interface.

Overdrive and Standard Speed modes are supported by this driver.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Thomas Stranger
ae8543269a drivers: w1: add vnd,w1 driver for ci testing
This commit adds the vnd,w1 dummy host driver used for ci builds of
1-wire devices.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Thomas Stranger
bb4f7b5a31 drivers: w1 introduce 1-wire net layer api
This commit introduces a new api for the net layer of Dallas
1-wire protocol.
For single drop configurations w1_read_rom, and w1_skip_rom commands are
provided.
For multidrop configurations w1_match_rom, w1_resume_command,
w1_search_rom, and w1_search_alarm routines are provided as well.
Additionally, the reset_select routine, conditionally depending on the
bus configuration, either executes a match_rom, or a skip rom command.
A w1_write_read command simplifies the typical scenario of addressing
a device, writing a few bytes to the device and reading back the answer.

Additionally w1_crc8, and w1_crc16 are added as wrappers around the
zephyr in-tree crc8 and crc16_reflect implementations.
The former may be used to verify the validity of the rom id, while the
latter is used for integrity checking of many eeprom, and authenticator
commands.

The general search command does not support filtering on
the family code.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Thomas Stranger
d63cf82a46 drivers: w1 introduce 1-wire api and common code
This commit introduces a new api for the Dallas 1-wire protocol.
The api includes link functions for read and write operations on
bit, byte, and block level, as well as functions to reset and
lock the bus.

The bus configuration is derived from the device tree and can be
queried using w1_slave_count routine.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-05 23:06:45 +02:00
Enjia Mai
89a9eab652 drivers: console: add a minimal EFI console driver to support printf
Add a minimal EFI console driver to support printf, this console driver
only supports console output. Otherwise the printf will not work.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-07-05 16:52:32 -04:00
Benjamin Björnsson
c2861ffda2 drivers: sensor: th02: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 15:41:10 +00:00
Benjamin Björnsson
f5b9635e31 drivers: sensor: adxl345: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 15:39:33 +00:00
Benjamin Björnsson
1d0e5e17d3 drivers: sensor: ams_iAQcode: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 15:39:15 +00:00
Teik Heng Chong
f551c29576 drivers: serial: Uart ns16550 get clock frequency from clock manager
This patch is to enhance the uart ns16550 driver to get clock frequency
from clock manager or devicetree if clock_frequency is defined.

Signed-off-by: Teik Heng Chong <teik.heng.chong@intel.com>
2022-07-05 15:38:54 +00:00
Teik Heng Chong
89075f42bb drivers: clock_control: Use Agile clock sub system as clock id
This patch is to direct use Agile clock sub system as clock id

Signed-off-by: Teik Heng Chong <teik.heng.chong@intel.com>
2022-07-05 15:38:54 +00:00
Benjamin Björnsson
803fdf6a46 drivers: sensor: vcnl4040: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 09:14:50 -05:00
Benjamin Björnsson
b4dffbfb40 drivers: sensor: mcp9808: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 09:10:06 -05:00
Benjamin Björnsson
b2b7665b9c drivers: sensor: mpu6050: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 09:08:43 -05:00
Benjamin Björnsson
1409a8f86b drivers: sensor: lis3mdl: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 09:06:13 -05:00
Benjamin Björnsson
131aedc769 drivers: sensor: isl29035: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 09:02:05 -05:00
Benjamin Björnsson
0ab5e7964c drivers: sensor: bmc150_magn: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 08:59:13 -05:00
Benjamin Björnsson
3f42a6a75f drivers: sensor: hmc5883l: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 08:57:59 -05:00
Benjamin Björnsson
ff7aa22217 drivers: sensor: adt7420: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 08:53:08 -05:00
Benjamin Björnsson
d0a5f5a08d drivers: sensor: adxl362: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 08:51:13 -05:00
Benjamin Björnsson
4e0dbc7c14 drivers: sensor: bma280: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 08:49:07 -05:00
Andrzej Głąbek
fd07675574 drivers: pinctrl_nrf: Use S0D1 drive by default for TWI/TWIM pins
The default S0S1 drive setting is not suitable for TWI/TWIM pins.
Override it with S0D1 as for some SoCs (e.g. nRF52833) without
this the peripheral will not work properly.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-07-05 13:52:19 +02:00
Benjamin Björnsson
b552a003b6 drivers: sensor: dps310: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:43:15 +02:00
Benjamin Björnsson
acb22c72e7 drivers: sensor: lsm303dlhc_magn: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:42:21 +02:00
Benjamin Björnsson
6f6fba5e73 drivers: sensor: bmm150: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:31:45 +02:00
Benjamin Björnsson
d4cf841622 drivers: sensor: dht: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:30:45 +02:00
Benjamin Björnsson
5983d8b762 drivers: sensor: grove: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:28:43 +02:00
Benjamin Björnsson
927633a819 drivers: sensor: hp206c: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:27:40 +02:00
Benjamin Björnsson
21b371f531 drivers: sensor: lps22hb: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:25:57 +02:00
Benjamin Björnsson
33634e4539 drivers: sensor: lps25hb: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:25:33 +02:00
Benjamin Björnsson
b48c760e3d drivers: sensor: lsm6ds0: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:24:39 +02:00
Benjamin Björnsson
a94db52f55 drivers: sensor: lsm9ds0_mfd: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:24:07 +02:00
Benjamin Björnsson
e2690f033e drivers: sensor: max44009: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:23:44 +02:00
Benjamin Björnsson
6d2d34bdad drivers: sensor: mpr: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:22:55 +02:00
Benjamin Björnsson
8d08148c7f drivers: sensor: ms5837: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:22:31 +02:00
Benjamin Björnsson
6746da203b drivers: sensor: nrf5: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:22:17 +02:00
Benjamin Björnsson
82018dfd9c drivers: sensor: opt3001: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:21:34 +02:00
Benjamin Björnsson
b568372c73 drivers: sensor: pms7003: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:21:03 +02:00
Benjamin Björnsson
97ca9ce0be drivers: sensor: si7006: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:20:40 +02:00
Benjamin Björnsson
08d86ff251 drivers: sensor: si7055: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:20:25 +02:00
Benjamin Björnsson
d116187fd7 drivers: sensor: si7060: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:20:12 +02:00
Benjamin Björnsson
454c7a1916 drivers: sensor: sx9500: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-05 12:11:09 +02:00
Bartosz Bilas
a7ecf70353 drivers: adc: adc_stm32: fix comment indendations
Fix indentations of `adc_stm32_oversampling` function comments
to have everything aligned properly.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-07-05 04:24:34 -05:00
Francois Ramu
1654f81740 drivers: adc: stm32g0 fix sampling time due to errata sheet
According to the ES0418 about the ADC of the stm32G071
or other stm32g0x devices:
for sampling time set to 1.5 or 3.5 cycles,
the sampling in a single ADC conversion or in the first
conversion of a sequence takes one extra cycle.
Minimizing to 7.5 is fine.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-04 17:32:10 +00:00
Alexandre Duchesne
b4034adec7 hal: gigadevice: Update gd32f4xx to firmware 3.0.0
Fix to support gd32f4xx update to firmware 3.0.0

Signed-off-by: Alexandre Duchesne <alexandre.duchesne@rtone.fr>
2022-07-04 18:07:51 +02:00
Chris Collins
3a0f8a3d45 drivers: usb: device: stm32: Use macros for frequencies
Rather than explicitly setting out the frequnecy in full, use the MHZ()
macro.

Signed-off-by: Chris Collins <chris@realsimgear.com>
2022-07-04 18:07:06 +02:00
Chris Collins
f1e4d7bbef drivers: usb: device: stm32: Configure USB Prescaler for F103
- If the HAL headers expose the USBPRE flag, then we're probably
  dealing with a F103 - using the same fundamental logic as the
  code for the OTG models, set-up the USB Prescaler correctly.

- Fixes #47146

Signed-off-by: Chris Collins <chris@realsimgear.com>
2022-07-04 18:07:06 +02:00
Aymeric Aillet
81cc1abe75 drivers: i2c: tca954X: Enable driver if needed
TCA954X driver was not enabled since introduction of
new compatibility fields.

We now set I2C_TCA954X depending on related "okay"
compat fields in DT.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-07-04 16:53:41 +02:00
Kumar Gala
e23fa30e7e drivers: wifi: winc1500: Update driver to use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 16:50:20 +02:00
Kumar Gala
a9978398f3 drivers: wifi: winc1500: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 16:50:20 +02:00
Thomas Stranger
eb44da9879 drivers/clock_control: stm32 g0, g4, l4, remove get_pllout_frequency()
After replacing STM32_SRC_PLLCLK by the STM32_SRC_PLL_x sources
this function is no longer needed and are therefore removed.

Also, those functions returned a wrong frequency.
They should have used get_pllsrc_frequency() instead of get_pll_source()
to get the input frequency.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
ddf3f2d735 drivers/clock_control: stm32 common allow pll also when it is not sysclk
The SOC specific implementations of the clock_stm32_ll_common driver
included the PLL specific functions only when PLL was selected as sysclock.

This commit changes the condition from "STM32_SYSCLK_SRC_PLL"
to "defined(STM32_PLL_ENABLED)".
As a result the pll could also be used as peripheral clock source
in case it is not the sysclock.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
15430252bf drivers/clock_control: stm32 common pll src support(g0,g4,l4,l5,wb,wl)
This commit adds support to select pll outputs as peripheral clock
sources to the stm32 common driver.
With this commit they are only available on
STM32G0, STM32G4, STM32L4, STM32L5, STM32WB, and STM32WL.

Support for STM32F2, and STM32F4, which also have p,q,r dividers,
is not enabled in this commit.

Also, stm32_clock_control_get_subsys_rate is extended to return
the configured frequency in case they are enabled, otherwise 0.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
c959b58bf1 drivers/clock_control: stm32 common: enable PLL_P/Q and set PLL_P div
This commit configures the PLL_P divider for SOCs compatible to the
stm32_ll_common driver in case a value was defined via a dts property.

Additionally, in case the divider value is defined in the device
tree, the respective pll output is enabled during initialization
in set_up_plls().

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
2801c9969a drivers/clock_control: fix stm32 common pll_q divider setup
In the stm32_ll_common driver the PLL_Q divider should not
be directly written to RCC->PLLCFGR->PLLQ, but should be
translated to the matching register value.
i.e. shifting the value to the correct position of the register
is not enough.

This commit makes sure the divider value taken from device tree, is
correctly translated ot the matching register register value by
converting it to a STM32CUBE LL definition LL_RCC_PLLQ_DIV_xx.

Typcial divider to register value mapping:
G0, WB, WL:
Dividers 2-8 mapped to register values 1-7(0 reserved).
G4, L4, L5:
Dividers 2,4,6,8 mapped to reg values 0,1,2,3.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
c112afa6a7 drivers/clock_control: stm32 common move pllx defines to common header
All these series share the same defines, and while they are not used
by all socs of the common-driver, this is not exptectd to lead to
any conflict.
By moving the defines they can also be used in clock_stm32_ll_common.c

Additionally, the stm32g0 pll_div define was renamed to pllm
in order to match the other series.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
d5146e65c7 dt-bindings/clock: remove STM32_SRC_CLOCK_MIN / MAX definitions
The STM32_SRC_CLOCK_MIN and STM32_SRC_CLOCK_MAX defines
are not really needed because non valid clock sources are already
filtered out by the precompiler.

Only STM32_SRC_CLOCK_MIN was used once in code and can be replaced.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Jedrzej Ciupis
8ed202b43d drivers: ieee802154: fix freeing Rx buffer
This commit fixes a bug where an already received Rx frame could not be
processed by the IEEE 802.15.4 driver.

In the current implementation, buffer is marked as free and released to
the buffer pool after `nrf_802154_buffer_free_raw` finishes executing.
However, delays caused by thread scheduling might result in a new frame
being already received and provided to the driver before
`nrf_802154_buffer_free_raw` returns. Such a situation ends in an
assertion now.

This commit changes that behavior by marking the buffer as free before
calling `nrf_802154_buffer_free_raw`.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-07-04 16:39:14 +02:00
Jedrzej Ciupis
c5df601ed5 drivers: ieee802154: print serialization error on nRF5340
This commit increases verbosity of serialization error handler for
nRF5340 application core. The handler prints the error code now.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-07-04 16:39:14 +02:00
Ryan McClelland
86bb6abbd0 adc: ads1x1x: run clangformat
run clangformat on adc_ads1x1x.c

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-07-04 16:28:43 +02:00
Ryan McClelland
3d7fc77678 adc: ads1x1x: macro cleanup
clean up the unique macros using existing macros

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-07-04 16:28:43 +02:00
Kumar Gala
123c088c4a drivers: serial: uart_native_posix: Replace use of DT_INST_LABEL
As we work to phase out devicetree 'label properties, convert
driver to just use dev->name instead of DT_INST_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 14:26:30 +00:00
Erwan Gouriou
890d42759b drivers: spi: stm32: Use 'st,stm32h7-spi' compatible input when possible
Instead of using or'ed list of Kconfig options listing the compatible
series with what can be called "stm32h7 variant", use the matching
compatible information.
This will prevent to update the driver next time that a compatible series
is ported into zephyr.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-07-04 14:23:34 +00:00
Jose Alberto Meza
b4d82289e1 drivers: spi: xec: mec172x: Reflect update device tree properties
Propagate update device tree properties.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-07-04 16:18:42 +02:00
Matthias Freese
938eae3372 drivers: gpio: ti: add gpio extender sn74hc595
Add driver for spi based gpio extender ti sn74hc595.

Signed-off-by: Matthias Freese <m.freese@web.de>
2022-07-04 16:10:37 +02:00
Aleksandar Markovic
9b0a506cf0 wifi: esp_at: Fix Coverity issues related to ESP_MAX_DNS
If the preprocessor constant ESP_MAX_DNS is defined as 0,
Coverity reports a condition that can never be true, and some
dead code as well. This also violates MISRA rules on dead code.

This is caused by this segment in drivers/wifi/esp_at/esp.h:

 #if defined(CONFIG_WIFI_ESP_AT_DNS_USE)
 #define ESP_MAX_DNS	MIN(3, CONFIG_DNS_RESOLVER_MAX_SERVERS)
 #else
 #define ESP_MAX_DNS	0
 #endif

Fix this by never setting ESP_MAX_DNS to 0, as is the currently
case. Define ESP_MAX_DNS only if it is configured through
CONFIG_WIFI_ESP_AT_DNS_USE and CONFIG_DNS_RESOLVER_MAX_SERVERS:

 #if defined(CONFIG_WIFI_ESP_AT_DNS_USE)
 #define ESP_MAX_DNS	MIN(3, CONFIG_DNS_RESOLVER_MAX_SERVERS)
 #endif

Since CONFIG_DNS_RESOLVER_MAX_SERVERS is 1 or greater, ESP_MAX_DNS
will always be greater than 0.

If, on the other hand, ESP_MAX_DNS is not defined, relevant
functions will be reduced to empty stubs, since in that case
they do not make sense.

There could be a cleaner solution to this, but this one is the
least intrusive (involves less code changes).

Coverity-CID: 219490
Coverity-CID: 219513
Coverity-CID: 219520
Coverity-CID: 219524

Signed-off-by: Aleksandar Markovic <aleksandar.markovic.sa@gmail.com>
2022-07-04 16:06:41 +02:00
Steven Lemaire
c40dc7d380 drivers: entropy: gecko: add driver using Secure Element module of EFR32
Some EFR32 SoCs use a secure element subsystem to manage
security features (i.e., TRNG, secure bootloader or cryptographic
functions).

This driver relies on the SE Manager high-level API provided by Silicon
Labs. The API interacts with the SE subsystem, provides helper functions
to achieve cryptographic operations and ensures that only one operation
is running at a time by using mutexes and semaphores.

Instead of relying on the SE Manager from Silicon Labs, one could
recreate the behaviour of the Manager and put the code in the crypto
driver folder and create a dependency for other drivers using the crypto
manager (e.g., keys, entropy).

I went for the SE Manager API as it is already there and supported by
Silicon Labs.

Tested using the random subsystem.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2022-07-04 15:47:35 +02:00
TLIG Dhaou
9a27cc3867 drivers: clock_control: clock stm32 set up the hsi div clock source
Add the hsi divider as a clock source when is ready.


Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-07-04 15:20:06 +02:00
Francois Ramu
764dbbf355 drivers: flash: stm32 ospi driver configures peripheral clock
The clock of the octospi peripheral is directly defined
by the DTS and configured by the clock_control_on function.
No specific stm32cube function is required then.
The clock control is taking this clock source to calculate
the clock rate.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-04 15:18:50 +02:00
Benjamin Björnsson
d96f361175 drivers: sensor: ens210: Add multi-instance support
Move driver to use DT_INST_FOREACH_STATUS_OKAY to add
multi-instance support.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-04 14:07:52 +02:00
Kumar Gala
0cb22dfa1d drivers: disk: sdmmc_stm32: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 06:40:02 -05:00
Kumar Gala
82c65315d3 drivers: ppp: Move to DTS for uart device
Move from using Kconfig NET_PPP_UART_NAME to a devicetree chosen
property ("zephyr,ppp-uart").  This is similar to a number of other
functions like "zephyr,shell-uart" or "zephyr,bt-uart".

As part of this we rework the init code a little to use
DEVICE_DT_GET for the modem gsm-ppp case.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 12:43:23 +02:00
Kumar Gala
3cbf653b0e counter: native_posix: Convert driver to use DT_INST
Rather than using a devicetree node label, utilize the driver
compat and thus DT_INST which is standard means for most drivers.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 12:42:54 +02:00
Marcin Niestroj
ec116a97cc drivers: adc: stm32: suppress stm32h7 build warning
There is a build warning of unused `adc_stm32_oversampling_ratioshift`
function: [-Werror=unused-function]. This makes twister fail, as all
warnings are treated as errors.

Fix that by ifndef'ing adc_stm32_oversampling_ratioshift().

Fixes: c57a41c5d2 ("drivers/adc: stm32: do not disable the ADC if
  resolution is unchanged")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-07-04 09:49:40 +02:00
Kumar Gala
75f44cf991 drivers: usb: usb_dc_stm32: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 09:49:29 +02:00
Kumar Gala
e70933d7dc drivers: sensor: sx9500: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 09:49:01 +02:00
Kumar Gala
5c93b3d79a drivers: sensor: sx9500: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-04 09:49:01 +02:00
HaiLong Yang
cd8e8f3826 drivers: adc: introduce gd32 adc driver
This driver based on single conversion mode with regular channel.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2022-07-04 09:48:32 +02:00
Kumar Gala
998c03a603 drivers: lora: sx126x: Replace use of DT_INST_LABEL
As we work to phase out devicetree 'label' properties, convert
driver to just use sx126x instead of DT_INST_LABEL for logging
purposes.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-02 18:11:10 -05:00
Jordan Yates
f12d36a51e lorawan: move REQUIRES_FULL_LIBC dependency
Move the `REQUIRES_FULL_LIBC` dependency from `config LORA` to
`config LORAWAN`. The commit that added the `select` (f590d4fa) mentions
that this is required by `loramac-node`, which is only used by LoRaWAN,
not the base LoRa code.

This results in small FLASH savings when compiling the samples, but can
result in larger savings in more complex applications:
```
// With REQUIRES_FULL_LIBC
west build -b 96b_wistrio zephyr/samples/drivers/lora/send/
[162/162] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       37708 B       128 KB     28.77%
            SRAM:        8832 B        32 KB     26.95%
        IDT_LIST:          0 GB         2 KB      0.00%

// Without REQUIRES_FULL_LIBC
[181/181] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       37444 B       128 KB     28.57%
            SRAM:        8832 B        32 KB     26.95%
        IDT_LIST:          0 GB         2 KB      0.00%
```

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-07-02 14:16:18 +02:00
Jeppe Odgaard
4503377cac drivers: modem: delay after each AT command
Change logic in `modem_cmd_handler_setup_cmds` and
`modem_cmd_handler_setup_cmds_nolock` to always sleep
after each sent AT command.

The issue was found using a logic analyzer while debugging 'NO CARRIER'
from a BG95 modem while being in data mode.
The reason 'NO CARRIER' occured was due to crosstalk to DTR which
terminated data mode.

The logic analyzer also revealed that without the delay the next AT
command is sent before the whole 'OK\r\n' is received. This is not
addressed in this commit.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/47082

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2022-07-02 14:15:49 +02:00
Maureen Helm
627c253cab drivers: gpio: Change DW driver to use depends on instead of select
In prepration for configuring I2C/SPI defaults at the board level,
change the DesignWare GPIO driver's clock gate option to depend on clock
control instead of selecting clock control. This breaks a Kconfig
dependency loop when adding the following to a board's
Kconfig.defconfig:

config SPI
	default y if SENSOR

There aren't any in-tree users that enable the clock gate option, so
there aren't any places in-tree that now need to enable the clock
control driver. Out-of-tree users that set CONFIG_GPIO_DW_CLOCK_GATE=y
will now also need to set CONFIG_CLOCK_CONTROL=y.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-07-02 06:03:33 -04:00
Maureen Helm
7954fab248 drivers: sensor: Use dt_compat_enabled for magnetometer drivers
In preparation for extending samples/sensor/magn_polling to support
additional magnetometer drivers, enable these drivers by default when
the sensor driver class is enabled (CONFIG_SENSOR=y) and a compatible
devicetree node is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-07-02 06:03:33 -04:00
Maureen Helm
b789c11775 drivers: sensor: Change fxos8700 default mode from accel-only to hybrid
The fxos8700 device supports 3 modes: accelerometer-only,
magnetometer-only, or hybrid (accelerometer and magnetometer) modes. The
accelerometer-only mode is register compatible with mma8451q, mma8652fc,
and mma8653fc, which allows the fxos8700 driver to be used with these
devices as well.

Most in-tree boards can use hybrid mode because they have the fxos8700
device, therefore we change the driver default to match the common case.
For the handful of boards that have an mma86xx or mma84xx device, we
override the driver default to accelerometer-only mode. As a result, we
can enable the magn_polling sample application for the fxos8700 driver
without having to add a bunch of board-specific configuration overlays
for hybrid mode.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-07-02 06:03:33 -04:00
Maureen Helm
c969547527 drivers: i2c: Fix deprecated use of I2C_MODE_MASTER in mcux lpi2c driver
The I2C API recently updated terminology to replace "master" with
"controller", but this instance in the mcux lpi2c driver was missed.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-07-01 15:37:12 -05:00
Kumar Gala
287acdbb9d i2c: sam0: Set driver Kconfig default based on devicetree
Change Kconfig default to be based on if the devicetree has the
atmel,i2c-sam0 driver enabled.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 15:05:55 -05:00
Kumar Gala
d200321767 video: mcux_csi: Set driver Kconfig default based on devicetree
Change Kconfig default to be based on if the devicetree has the
nxp,imx-csi driver enabled.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 14:56:33 -05:00
Andrei Emeltchenko
0466ac2bb1 drivers: wncm14a2a: Remove unneeded assignment
Assignment is not needed here.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-01 21:36:01 +02:00
Andrei Emeltchenko
4628dc60c8 drivers: wncm14a2a: Remove setting unused error code
Function returns void.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-01 21:36:01 +02:00
Andrei Emeltchenko
4015b91226 drivers: wncm14a2a: Remove unused variable
Remove dead code.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-07-01 21:36:01 +02:00
Kumar Gala
51c7777529 drivers: video: ov2640: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:37 +00:00
Kumar Gala
32d27153ba drivers: video: ov2640: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:37 +00:00
Kumar Gala
745752a374 drivers: video: ov7725: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:20 +00:00
Kumar Gala
0d245c90ef drivers: video: ov7725: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:39:20 +00:00
Kumar Gala
d29c8a45ff drivers: video: mt9m114: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 16:38:55 +00:00
Benjamin Björnsson
8f1ba96b7d drivers: sensor: ism330dhcx: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 16:35:03 +00:00
Benjamin Björnsson
0fb0f1a937 drivers: sensor: ism330dhcx: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 16:35:03 +00:00
Benjamin Björnsson
a30a150a71 drivers: sensor: ism330dhcx: Change parameter of functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 16:35:03 +00:00
Benjamin Björnsson
7e943fc06e drivers: sensor: ism330dhcx: Remove unused struct
Simplify driver by removing unused struct declaration.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 16:35:03 +00:00
Jeppe Odgaard
41ff2373e1 drivers: modem: gsm: set AT+IFC if hw-flow-control is enabled
If hw-flow-control is set in the uart section of the device tree source,
it is read by gsm_ppp.c and AT+IFC=2,2 is sent to the modem.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/46928.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2022-07-01 16:32:17 +00:00
Aymeric Aillet
eaa278b305 drivers/can/rcar: Cleanup
CAN R-Car driver code cleaning by uncrustify.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-07-01 16:24:55 +00:00
Aymeric Aillet
b6701c0c45 drivers/can/rcar: Add delay to mode switching
Fix issue #45168.

When setting high bit timing, the controller is timing
out when trying to switch from an internal mode to another.
To fix this issue, we add some delay when switching modes.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-07-01 16:24:55 +00:00
Aymeric Aillet
f2a039e8bb drivers/can/rcar: Fix setting bit timing
Fix issue #45169.

With this CAN controller, changing bit timing has to be done in controller
reset mode, resetting some registers to their default values.
TCR register, that is enabling loopback mode is one of these.
Because of this reset, the controller switch back from loopback
to normal mode without the test suite being notified, preventing
receiving sent frames afterwards.

To fix this issue, we are now storing useful registers values before
switching to reset mode and restoring these values in halt mode
before going back in operation mode.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-07-01 16:24:55 +00:00
Bartosz Bilas
9c251fc9ac nxp_imx: rt: add XBARA Inter-Peripheral Crossbar Switch Kconfig option
Add missing MCUX XBARA module Kconfig option.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2022-07-01 16:23:11 +00:00
Kumar Gala
2c60426639 drivers: sensor: tmp007: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 10:20:55 -05:00
Kumar Gala
d184190863 drivers: sensor: tmp007: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-01 10:20:55 -05:00
Benjamin Björnsson
9d726c2226 drivers: sensor: stts751: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 09:59:28 -05:00
Benjamin Björnsson
d32d681882 drivers: sensor: stts751: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 09:59:28 -05:00
Benjamin Björnsson
a663aa4e2a drivers: sensor: stts751: Change parameter of read/write functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 09:59:28 -05:00
Benjamin Björnsson
d2aeb94630 drivers: sensor: lis2dh: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 09:34:41 -05:00
Ryan Erickson
5495dae455 drivers: modem: hl7800: Add runtime control of log level
Default mode must be debug or it can't ever be enabled.
Allow debug log messages to be printed when using
mdm_hl7800_send_at_cmd API.
Add logging to active bands and network coverage commands.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-07-01 16:30:30 +02:00
Aurelien Jarno
f00ddfeb76 drivers: sensor: stm32_temp: drop ts-cal-offset property
According to the formulas found in the reference manuals of the SoC
families using the "st,stm32-temp-cal" version of the temperature sensor
(i.e. G0, G4, H7, L0, L1, L4, L5, U5, WB, WL), the temperature is
computed with the following formula:

T = ((TS_CAL2_TEMP - TS_CAL1_TEMP) / (TS_CAL2 - TS_CAL1))
    * (TS_DATA - TS_CAL1) + TS_CAL1_TEMP

What is called ts-cal-offset in the stm32_temp driver is therefore the
same value as TS_CAL1_TEMP1. Use it directly instead of defining another
property.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-01 11:38:02 +02:00
Aurelien Jarno
52893d5f0f drivers: sensor: stm32_temp: use the ADC reference voltage
The stm32_temp driver defines the ts-voltage-mv property to determine
the reference voltage of the ADC in the temperature computation. However
this information is already available in the device tree at the ADC
level (even with the same default value). Use it through the ADC API
instead of duplicating the information.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-01 11:38:02 +02:00
Benjamin Björnsson
616f2fb36e drivers: sensor: iis3dhhc: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 11:37:24 +02:00
Benjamin Björnsson
da63820203 drivers: sensor: iis3dhhc: Remove SPI from driver data struct
Remove SPI related things from driver data struct for consistency
with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 11:37:24 +02:00
Benjamin Björnsson
e6b87cc275 drivers: sensor: iis3dhhc: Change parameter of read/write functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-01 11:37:24 +02:00
Dino Li
7c7611d17d it8xxx2: intc: Look for pending interrupt
The AIVECT (All Interrupt Vector Register) register provides us a quick
way to determine SOC interrupt number. But sometimes we get interrupt
number 0 from the register and caused assertion of unhandled interrupt.
To avoid the assertion, we look for all ISRs (Interrupt Status Register)
and IERs (Interrupt Enable Register) to find the highest priority pending
interrupt and return it to caller.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-07-01 11:36:55 +02:00
Ryan Erickson
bf37acc3c0 modem: hl7800: Fix socket error race condition
Using a global error flag could lead to an error on one
socket appearing as an error with a separate socket instance.
Socket errors moved into the socket context.
Continue to use global error flag for commands not
related to sockets.
For TCP sockets closed by the server, don't try and close
the socket again when offload_put is called.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-07-01 11:36:44 +02:00
Aurelien Jarno
d576b7f3d3 drivers: i2c_ll_stm32_v2: add support for second target address
The Zephyr API supports multiple I2C targets addresses, and the STM32
I2C v2 implementation allows to define up to 2 targets addresses.

This patch adds support for a second I2C target address. It adds a new
config entry in the i2c_stm32_data structure, and uses the fact that
both addresses can be enabled and disabled independently. In the
interrupt, the target being addressed is determined using the address
match code from the interrupt status register.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-07-01 11:35:28 +02:00
Francois Ramu
726c0ea5bd drivers: adc: stm32 internal channel for VBat measurement
It allows the path for VBATEN on stm32 series
to monitor the Vbat voltage, in case of CONFIG_STM32_VBAT
Add the common Vref value as a property of the ADC.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-01 11:34:17 +02:00
Francois Ramu
32222e07a4 drivers: sensor: add a stm32 sensor driver for the internal VBat
Similar to the internal temperature sensor of the stm32
this driver controls the Vbat monitoring in Volts,
using an ADC internal input and the stm32-vbat node of the DTS.
The ref voltage is given by the ADC.
Note that stm32F1x does not propose the feature.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-07-01 11:34:17 +02:00
Maxim Adelman
c9ad6dbc7e drivers: gpio: gpio_mcux_lpc: fix lost interrupts
if ISR is called for an event on pin X but
another event occurs on pin Y in between the call
to GetStatus() and ClrStatus(), pin Y event wil get
cleared without being processed

Signed-off-by: Maxim Adelman <imax@fb.com>
2022-06-30 15:19:53 -05:00
Andrzej Głąbek
0a9a638f09 drivers: gpio_nrfx: Fix handling of GPIO_DISCONNECTED
The driver returns -EIO when a pin to be disconnected was not earlier
configured as input or output, what is not in line with the GPIO API.
This commit changes the driver to return 0 in such case.
Also -EIO is incorrectly returned when an interrupt trigger cannot be
configured in the nrfx_gpiote driver. This commit corrects this value
to -EINVAL.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-06-30 18:27:33 +02:00
Kumar Gala
5f7790fc23 sensor: iis2mdc: spi: Fix use of deprecated spi_cs_control field
The gpio_dev field of struct spi_cs_control is deprecated.  The
driver was already using SPI_CONFIG_DT_INST, so we should be
using the associated gpio member of spi_cs_control.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 11:19:40 -05:00
Andrzej Głąbek
22f524d874 drivers: gpio_nrfx: Add support for gpio_port_get_direction
Add implementation of this new GPIO API function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-06-30 18:12:54 +02:00
Kumar Gala
06bd942191 misc: ft8xx: convert to gpio_dt_spec
Convert SPI usage to `struct gpio_dt_spec`.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 04:30:21 -05:00
Kumar Gala
a2ffdaf2b9 misc: ft8xx: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 04:30:21 -05:00
Kumar Gala
e63643d212 drivers: serial: lpc11u6x: Remove DT_LABEL usage
Remove DT_LABEL usage that is needed for device_get_binding, replace
this with DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 10:32:33 +02:00
Kumar Gala
78b1d950be drivers: i2c: lpc11u6x: Remove DT_LABEL usage
Remove DT_LABEL usage that is needed for device_get_binding, replace
this with DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 10:32:33 +02:00
Kumar Gala
93f2fedc12 drivers: gpio: lpc11u6x: Remove DT_LABEL usage
Remove DT_LABEL usage that is needed for device_get_binding, replace
this with DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 10:32:33 +02:00
Tom Burdick
88ca215eed i2c: Update API terminology
Updates the API and types to match updated I2C terminology. Replaces master
with controller and slave with target.

Updates all drivers to match the changed macros, types, and API signatures.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-06-29 17:51:31 +02:00
Kumar Gala
355da1dd84 drivers: sdhc: Rework SPI config initialization
Move to using SPI_CONFIG_DT_INST macro to initialization the
struct spi_config cfg_a.  This fixes an issue with how the old
code was initializing the deprecated fields of spi_cs_control.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-29 14:59:43 +00:00
Lucas Tamborrino
1333787d8f drivers: pwm: refactor esp32 pwm ledc driver
Use hal function for low level access.
Use device tree for hardware configuration.
Support for esp32s2.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-06-29 14:48:25 +00:00
Lucas Tamborrino
02675bbc80 dts: esp32: full ledc configuration in binding
This commit moves the hardware configuration for ledc
peripheral to the device-tree instead of Kconfig.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-06-29 14:48:25 +00:00
Aurelien Jarno
c57a41c5d2 drivers/adc: stm32: do not disable the ADC if resolution is unchanged
In case the resolution is already correct (probably the common use
case), do nothing instead of disabling the ADC.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-29 14:43:29 +00:00
Aurelien Jarno
897554bd39 drivers/adc: stm32: avoid disabling and reenabling the ADC multiple times
The ADC is currently disabled and re-enabled multiple time during each
read. Enabling the ADC is not a free operation on some series and some
internal channels like VREFINT take even longer. This patch improve the
situation by removing the calls to adc_stm32_enable(), replacing it by a
single call just before triggering the conversion.

This also open the possibility to not reconfigure the ADC if it is
already configured, implemented in the following patches.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-29 14:43:29 +00:00
Aurelien Jarno
c9d3efabe7 drivers/adc: stm32: streamline code to disable ADC
This avoid repeating (slight different) code.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-29 14:43:29 +00:00
Jamie McCrae
4e20669aa9 drivers: sensor: sm351lt: Fix global thread triggering bug
This fixes a bug in the sm351lt driver whereby global triggering will
cause an MPU fault due to an unset pointer.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2022-06-29 14:40:53 +00:00
Kumar Gala
a52f7a4e3a drivers: ieee802154: mcr20a: Remove unused variable
Since the driver uses spi_dt_spec there is no need for an explicit
spi_cs_control variable.  The variable is unused.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-29 06:02:28 -05:00
Anas Nashif
ab24be5552 drivers: timer: provide timer irq to tests
As with previous commit, make the timer irq a simple integer variable
exported by the timer driver for the benefit of this one test
(tests/kernel/context).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-06-29 10:31:00 +02:00
Andy Ross
fb3b434438 drivers: timer: update TIMER_IRQ for tests/kernel/context
This test has gotten out of control.  It has a giant #if cascade
enumerating every timer driver in the Zephyr tree and extracting its
interrupt number.  Which means that every driver needs to somehow
expose that interrupt in its platform headers or some other API.

Make it a simple integer variable exported by the timer driver for the
benefit of this one test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-06-29 10:31:00 +02:00
Francois Ramu
80dd57a49d drivers: flash: stm32 ospi driver align erase on sector size
When erasing the flash, the size to erase must be
compared to a multiple of SECTOR_SIZE.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-06-29 10:30:04 +02:00
Dmytro Firsov
f4cea5da70 xenvm: drivers: xen: add Xen grant table driver
This commit introduces driver for granting access for own grant
table and for mapping/unmapping foreign gref. Grant tables are used
for data exchange between Xen domains via shared memory page(s) (e.g.
for sharing ring buffer with driver data) This functionality is
widely used and needed for implementing PV backend/frontend drivers.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2022-06-28 22:34:26 -04:00
Henrik Brix Andersen
a833d87994 drivers: serial: xilinx: uartps: add pinctrl support
Add pinctrl support to the Xilinx Zynq-7000/ZynqMP PS UART driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-06-28 20:46:11 +02:00
Henrik Brix Andersen
66998e7445 drivers: serial: xilinx: change prompt to reflect supported SoCs
Change the Kconfig prompt for the Xilinx Zynq-7000/ZynqMP PS UART driver to
indicate whichs SoCs it supports.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-06-28 20:46:11 +02:00
Henrik Brix Andersen
23857d9b8e drivers: pinctrl: add pinctrl driver for the Xilinx Zynq-7000
Add pinctrl driver for the Xilinx Zynq-7000 series SoCs.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-06-28 20:46:11 +02:00
Henrik Brix Andersen
ea433a4803 drivers: ethernet: xlnx: gem: do not lock/unlock the SLCRs
Do not lock/unlock the System Level Control Registers (SLCRs) in the Xilinx
GEM ethernet driver. The SLRCs are unlocked once at boot time.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-06-28 20:46:11 +02:00
Kumar Gala
02060f7f72 sensor: pms7003: Convert to DEVICE_DT_GET
Move to using DEVICE_DT_GET so we can phase out DT_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 13:54:32 -04:00
Kumar Gala
5d8f958b4e sensor: pms7003: Fix compile errors with driver
We get type mismatch errors because of use of K_MSEC.  As the timeout
is defined in terms of milliseconds and k_uptime_get() returns
milliseconds we can just remove K_MSEC usage.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 13:54:32 -04:00
Aymeric Aillet
9a7040303a drivers: clock: rcar: Rename global includes file
Rename r-car clock driver global include file
in order to match other files names.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-06-28 18:11:44 +02:00
Aymeric Aillet
14ff2b1f88 drivers: clock: rcar: Deploy a driver for each soc
This commit rewrite renesas R-Car clock driver in order
to be able to support any new SoC easier.

This work is so creating a clock driver per soc alongside a
common driver for all reneasas r-car boars.

- drivers: create a driver per soc
  - create a common driver
  - create a common header used by soc & common driver
  - create a soc specific driver calling for common driver

- dts: use new compatible
  - use old yaml as common yaml
  - create a new "child" yaml to define the new compatible field
  - change compatible in device tree

As in Linux, the driver can support both r8a77951 and r8a77950
SoC's so we decided to name the new driver as in Linux with Zephyr
prefix : "clock_control_r8a7795_cpg_mssr.c".

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-06-28 18:11:44 +02:00
Aymeric Aillet
d8f66b7343 dts: rcar: Rework clock definition
This commit is reworking clock definition in
order to match linux filetree and definition
as much as possible.

- dt-bindings: rework renesas clocks dt-bindings
  - regroup renesas related dt-bindings in a folder
  - rename renesas rcar common dt-binding to match linux name
  - add soc specific dt-binding matching linux name
  - soc dt-bindings are defining clocks matching linux names

- dts: use new clocks names
  - move clocks definitions in SoC layer for each core clock entry

- driver: use new clocks names

As seen in this commit, we are declaring clocks for "R8A7795" SoC
to match linux names.
Linux is not declaring "R8A77951" SoC specific files because
its also supporting the first H3 SoC version numbered "R8A77950".

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-06-28 18:11:44 +02:00
Jeppe Odgaard
8d71e8f5de drivers: led_strip: ws2812: allow settings cpol and cpha
Some boards require settings cpol and/or cpha.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/44980
2022-06-28 16:50:26 +02:00
Gerard Marull-Paretas
88f9039747 drivers: pwm: b91: fix non-local headers include
pwm.h and clock.h are HAL headers, so use <> instead of "" (for locals).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-28 16:17:46 +02:00
Gerard Marull-Paretas
4324974281 drivers: pwm: b91: fix multi-instance support
Driver was in a weird state: it made use of
DT_INST_FOREACH_STATUS_OKAY, however, it had an assertion to support a
single instance and used instance 0 properties.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-28 16:17:46 +02:00
Kumar Gala
97f0570c67 drivers: sensor: vcnl4040: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Added check to vcnl4040_trigger_set to handle case of trigger
mode enabled but the devicetree doesn't have an int_gpios property.

Also, moved up the checking/handling of gpio port device in
vcnl4040_trigger_init so that if we error out its before we
setup any threads and such.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 08:22:24 -05:00
Kumar Gala
a31c6070de drivers: sensor: vcnl4040: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 08:22:24 -05:00
Khor Swee Aun
04b7e8ed15 drivers: serial: uart_altera_jtag: Fix wrong register address used
Fix wrong control register address used in uart_altera_jtag_init
function which caused memory corruption.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
2022-06-28 07:34:29 -04:00
Kumar Gala
9dfbae0ba5 wifi: eswifi: Convert to DEVICE_DT_GET
Move to using DEVICE_DT_GET so we can phase out DT_LABEL.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 11:09:03 +02:00
Benjamin Björnsson
6318d29035 drivers: sensor: max17055: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-28 11:07:57 +02:00
Benjamin Björnsson
805ad30324 drivers: sensor: max17055: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-28 11:07:57 +02:00
Kumar Gala
ed738ed096 drivers: sensor: ti_hdc: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for DRDY GPIO handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 11:07:50 +02:00
Kumar Gala
c738c99b33 drivers: sensor: ti_hdc: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-28 11:07:50 +02:00
Erwan Gouriou
bced529f78 include: stm32: clock_control: Ease usage of STM32_DT_CLOCKS macro
STM32_DT_CLOCKS was designed to take a device tree node label name as
argument: STM32_DT_CLOCKS(uart1)
Change its implementation to take a node identifier instead:
STM32_DT_CLOCKS(DT_NODELABEL(uart1)).

This make its usage more flexible since the argument can now be extracted
from other DT macros such as DT_PARENT. Then, the following can be done:
STM32_DT_CLOCKS(DT_PARENT(child_node_label)).

Since it is now possible implement STM32_DT_INST_CLOCKS using
STM32_DT_CLOCKS.

Finally, update existing STM32_DT_CLOCKS users and convert
STM32_INST_CLOCK_INFO users to STM32_CLOCK_INFO.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-06-28 11:07:29 +02:00
Huifeng Zhang
eb949061ce drivers: timer: arm_arch_timer: assign a initial value to last_cycle
On FVP platform, when parameter 'bp.refcounter.use_real_time' is set
to 1, cntvct_el0 isn't count from 0 and may cause overflow issue in
first timer compare interrupt.

'bp.refcounter.use_real_time' is 0 by default.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2022-06-28 11:06:31 +02:00
Huifeng Zhang
79d076be7f drivers: timer: arm_arch_timer: Fix round up issue
Fast hardware with slow timer hardware can trigger and enter an
interrupt and reach 'sys_clock_set_timeout' before the counter has
advanced.

That defeats the "round up" logic such that we end up scheduling
timeouts a tick too soon (e.g. if the kernel requests an interrupt
at the "X" tick, we would end up computing a comparator value
representing the "X-1" tick!).

Choose the bigger one between 1 and "curr_cycle - last_cycle" to
correct.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2022-06-28 11:06:31 +02:00
Loris Schmit
e1c2f2cfb6 drivers: mpu9250: magnetometer data read fix
The magnetometer data read from AK9863 is assumed to be big endian
(like the accelerometer & gyroscope data).
However it is in little endian, which means the appropriate byteorder
function is sys_le16_to_cpu().
See the MPU925 register map:
https://3cfeqx1hf82y3xcoull08ihx-wpengine.netdna-ssl.com/wp-content/uploads/2017/11/RM-MPU-9250A-00-v1.6.pdf
At 5.6 HXL to HZH: Measurement Data

Signed-off-by: Loris Schmit <loris.schmit@inovex.de>
2022-06-28 11:06:06 +02:00
Erwan Gouriou
343fdddfdd drivers: i2c: stm32: Use device tree as single source of compatibility
Some text in help section was documenting the compatibility of driver
variants with stm32 series.
This is duplicate of information versus device tree which should be
used as single source of information for hardware description.
Remove these lines, so we don't have to touch this driver each time
a series is added.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-06-27 15:43:14 -05:00
Benjamin Björnsson
8f5d247a71 drivers: sensor: sm351lt: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:59:53 -05:00
Benjamin Björnsson
935bf6fa25 drivers: sensor: sm351lt: Move variable declaration
Move variable declaration inside if-def to remove compiler
warning when building the driver without trigger.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:59:53 -05:00
Benjamin Björnsson
3e4e4eaf75 drivers: sensor: si7060: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:57:34 -05:00
Benjamin Björnsson
0f7751049f drivers: sensor: si7060: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:57:34 -05:00
Benjamin Björnsson
4e30743d28 drivers: sensor: si7055: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:49:45 -05:00
Benjamin Björnsson
7937345afd drivers: sensor: si7055: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:49:45 -05:00
Benjamin Björnsson
00fac1e91b drivers: sensor: si7006: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:48:06 -05:00
Benjamin Björnsson
f8aef61793 drivers: sensor: si7006: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:48:06 -05:00
Benjamin Björnsson
5eb99ac36c drivers: sensor: shtcx: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:46:06 -05:00
Benjamin Björnsson
dd5cf763ab drivers: sensor: shtcx: Remove wrapper functions
Remove wrapper functions for getting i2c bus and i2c bus
address. This is done here to make it easier to move this
driver to i2c_dt_spec while still having clear separation
between commits.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:46:06 -05:00
Benjamin Björnsson
fa75491aca drivers: sensor: sht3xd: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:43:51 -05:00
Benjamin Björnsson
238d5ad291 drivers: sensor: sbs_gauge: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:40:19 -05:00
Benjamin Björnsson
04ce7bca33 drivers: sensor: opt3001: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:38:56 -05:00
Benjamin Björnsson
b4b02c1b42 drivers: sensor: opt3001: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:38:56 -05:00
Benjamin Björnsson
e3e1bd19a3 drivers: sensor: ms5837: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:36:31 -05:00
Benjamin Björnsson
762db471c0 drivers: sensor: ms5837: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:36:31 -05:00
Benjamin Björnsson
96b460d546 drivers: sensor: mpr: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:34:13 -05:00
Benjamin Björnsson
e84aa19c86 drivers: sensor: mpu6050: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:31:14 -05:00
Benjamin Björnsson
62c4cf91e6 drivers: sensor: mpu6050: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:31:14 -05:00
Benjamin Björnsson
9d8f852729 drivers: sensor: mcp9808: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:28:20 -05:00
Benjamin Björnsson
34238059a5 drivers: sensor: mcp9808: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:28:20 -05:00
Benjamin Björnsson
ba90450974 drivers: sensor: max44009: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:23:48 -05:00
Benjamin Björnsson
c4ac3613fb drivers: sensor: max44009: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:23:48 -05:00
Benjamin Björnsson
220d136235 drivers: sensor: max30101: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:20:09 -05:00
Benjamin Björnsson
00e22733a1 drivers: sensor: max17262: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:18:27 -05:00
Benjamin Björnsson
c71ee90ec2 drivers: sensor: isl29035: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:10:44 -05:00
Benjamin Björnsson
6c8161a00d drivers: sensor: isl29035: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:10:44 -05:00
Benjamin Björnsson
1e51107577 drivers: sensor: isl29035: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 10:10:44 -05:00
Kumar Gala
892b43f038 drivers: sensor: th02: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-27 10:01:59 -05:00
Kumar Gala
1f34441c2d drivers: sensor: wsen_itds: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.  Since
the driver can support multiple instances its possible that some
have irq's in dts and some don't.  So we add a check in
itds_trigger_set to make sure we have a GPIO device if we are
trying to set a trigger.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-27 09:47:06 -05:00
Kumar Gala
ce41b3c82f drivers: sensor: wsen_itds: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-27 09:47:06 -05:00
Benjamin Björnsson
dbff3f0124 drivers: sensor: lsm6ds0: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:42:55 -05:00
Benjamin Björnsson
45b70fc8cf drivers: sensor: lsm303dlhc_magn: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:40:16 -05:00
Benjamin Björnsson
129e7d5cda drivers: sensor: lsm9ds0_gyro: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:38:06 -05:00
Benjamin Björnsson
2710355553 drivers: sensor: lsm9ds0_gyro: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:38:06 -05:00
Benjamin Björnsson
bbd7b3fe72 drivers: sensor: lsm9ds0_gyro: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:38:06 -05:00
Benjamin Björnsson
d35c55d437 drivers: sensor: lps22hb: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 09:34:37 -05:00
Benjamin Björnsson
692b0ead74 drivers: sensor: lsm9ds0_mfd: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-27 12:47:44 +02:00
Ederson de Souza
b56088ba6d drivers/clock_control: Add cAVS clock driver
Simple driver that allows one to choose the clock speed of xtensa cores.
It's basically a shim layer on top of SOC level driver.
Also, a really simple test case was added, mainly to ensure things are
build and are sane.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-06-27 12:42:04 +02:00
Benjamin Björnsson
1a0159518b drivers: sensor: lsm6dsl: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-24 20:29:54 +02:00
Benjamin Björnsson
07587e7826 drivers: sensor: lsm6dsl: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-24 20:29:54 +02:00
Benjamin Björnsson
bae6af4acc drivers: sensor: lsm6dsl: Remove unused variable and label
Remove variable and label that are not used to remove compiler
warnings.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-24 20:29:54 +02:00
Benjamin Björnsson
20b1fdb39c drivers: sensor: lm75: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-24 20:29:46 +02:00
Aurelien Jarno
b2f969e562 drivers: usb: device: stm32: only disable the ULPI clock for USB FS
On SoCs with two USB controller, Zephyr selects the FS one, and in that
case the ULPI clock needs to be disabled in sleep mode for the
controller to work.

On SoCs with a single USB HS controller, this operation is not needed.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-24 20:25:52 +02:00
Aurelien Jarno
e19be674fc drivers: usb: device: stm32: fix disabling the ULPI clock on STM32H7X
The ULPI clock uses slightly different names on STM32H7X as those
SoC can have more than one USB controller.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-24 20:25:52 +02:00
Aurelien Jarno
a9f044e0d2 drivers: usb: device: stm32: fix a wrong comment STM32H7X and ULPI clock
On STM32H7X SoCs, both USB controllers are HS capable, however it is not
possible to connect an ULPI PHY to the USB2 one, which limit it to FS.
Therefore the ULPI clock in sleep mode has to be disabled for USB2 in
all cases. The ULPI clock for USB1 is already disabled when needed in
the usb_dc_stm32_clock_enable() function like for other SoCs.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-24 20:25:52 +02:00
Aurelien Jarno
58674926a9 drivers: usb: device: stm32: do not manually enable the clock on STM32H7
Do not manually enable the USB clock on STM32H7, as it is already done
in usb_dc_stm32_clock_enable() using the values in the device tree.

This partially fixes the build for STM32H7 devices with a single USB
controller.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-24 20:25:52 +02:00
Aurelien Jarno
278bf9883f drivers: usb: device: stm32: do not disable ULPI clock in run mode
The ULPI clock is disabled by default in run mode, there is no need to
disable it again. It is however enabled by default in sleep/low power
mode, so it needs to be disabled.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-24 20:25:52 +02:00
Alex Kolosov
ef418aab40 drivers: serial: telink_b91: fix uart unknown state after boot from mcuboot
mcuboot may use a uart as logger. After application boot from mcuboot,
uart remains in some unknown state. It could leads to some unpredictable
uart behaviour. This commit fixes the issue by resetting of uart state
at the beginning of uart init.

Signed-off-by: Alex Kolosov <rikorsev@gmail.com>
2022-06-24 20:25:33 +02:00
Christopher Friedt
f88264d7ca drivers: gpio: mcux: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
00004fb976 drivers: gpio: sifive: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
1d823c77c9 drivers: gpio: litex: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
22d2fc1e64 drivers: gpio: eos_s3: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
3f96752005 drivers: gpio: cc13xx_cc26xx: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
9526437e64 drivers: gpio_emul: support gpio_port_get_direction
Support querying the direction of emulated GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt
27c431ff7e api: gpio: add gpio direction query functions and driver api
Some services require the ability to query whether a GPIO pin
is configured as an input, output, both, or neither prior to
performing any operations at the service level. This is done
in order to reduce state tracking within the service.

To that end, this change adds
* `gpio_port_get_direction()`
* `gpio_pin_is_input()`, and
* `gpio_pin_is_output()`

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Benjamin Björnsson
d4f00fe3c4 drivers: sensor: ccs811: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:52:26 -05:00
Benjamin Björnsson
3ac870b03b drivers: sensor: ccs811: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:52:26 -05:00
Benjamin Björnsson
15aefccf17 drivers: sensor: ccs811: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:52:26 -05:00
Benjamin Björnsson
3b2f21e291 drivers: sensor: bmi270: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:46:01 -05:00
Benjamin Björnsson
fc7e67966a drivers: sensor: bmi270: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:46:01 -05:00
Benjamin Björnsson
8c2a6e34a8 drivers: sensor: bmc150_magn: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:40:03 -05:00
Benjamin Björnsson
c145539b54 drivers: sensor: bmc150_magn: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:40:03 -05:00
Benjamin Björnsson
f06ea0e12e drivers: sensor: dht: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:34:28 -05:00
Benjamin Björnsson
4edf96d40b drivers: sensor: dps310: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:32:19 -05:00
Benjamin Björnsson
481fe82fa9 drivers: sensor: dps310: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:32:19 -05:00
Benjamin Björnsson
b22c6a8867 drivers: sensor: hmc5883l: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:24:43 -05:00
Benjamin Björnsson
be1e512aad drivers: sensor: hmc5883l: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 16:24:43 -05:00
Benjamin Björnsson
d4731daaf6 drivers: sensor: lps25hb: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-23 15:46:00 -05:00
Dmytro Firsov
d48f99f01f xenvm: evtchn: fix undefined value during event handling
This commit fixes issue with undefined value during position calculations.
Shift for positions may be >32, so we need to explicitly use unsigned long
casting to prevent unexpected behavior during event handling.

Thanks @jgrall for suggestion.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2022-06-23 13:09:40 -04:00
Dmytro Firsov
5f4fd311fc xenvm: evtchn: use proper barrier during events handling
This commit fixes barrier usage in Xen event channel driver. Previously
compiler_barrier() was used and it did not prevent processor from
re-ordering of the write operations, that is needed for correct event
handling. It is now changed to data memory barrier (dmb()), which will
work as expected in this situation.

Thanks @jgrall for suggestion.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2022-06-23 13:09:40 -04:00
Maximilian Deubel
1c1c72ea08 ADXL362: Add separate activity/inactivity triggers
This patch modifies the ADXL362 driver to use the new
SENSOR_TRIG_MOTION trigger for activity detection
and SENSOR_TRIG_STATIONARY for inactivity detection.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2022-06-23 10:28:34 -05:00
Krzysztof Chruscinski
041f0e5379 all: logging: Remove log_strdup function
Logging v1 has been removed and log_strdup wrapper function is no
longer needed. Removing the function and its use in the tree.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 13:42:23 +02:00
Francois Ramu
7f10bd6340 drivers: flash: stm32 qspi driver setting dma priority
This adds a table to set the dma channel priority from the DTS
The config bits are converted through the table_priority
to match the DMA_Priority_level of the stm32cube HAL.
Fixes #46725

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-06-23 09:11:15 +02:00
John Kjellberg
27179a53f8 drivers/disk: sdmmc: Fix build for STM32F4
Closes #46734

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>
2022-06-23 09:10:43 +02:00
Abramo Bagnara
d1d5acd2cd coding guidelines: comply with MISRA C:2012 Rule 8.2
MISRA C:2012 Rule 8.2 (Function types shall be in prototype form with
named parameters.)

Added missing parameter names.

Signed-off-by: Abramo Bagnara <abramo.bagnara@bugseng.com>
2022-06-22 17:17:39 -04:00
Dmytro Firsov
a76b492f04 xenvm: evtchn: expand Xen event channel driver functionality
This commit adds new functions, which can be used for Xen event channel
management (allocation, interdomain binding etc.). Such functionality
is needed for Xen PV driver development in Zephyr.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2022-06-22 17:53:45 +02:00
Benjamin Björnsson
73ca3c72bc drivers: sensor: adxl345: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 14:37:07 +02:00
Benjamin Björnsson
82901bd563 drivers: sensor: fxos8700: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:27:17 +02:00
Benjamin Björnsson
47b3e65290 drivers: sensor: fxos8700: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:27:17 +02:00
Benjamin Björnsson
1e44af1e2c drivers: sensor: lis3mdl: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:27:02 +02:00
Benjamin Björnsson
37b59c3427 drivers: sensor: lis3mdl: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:27:02 +02:00
Benjamin Björnsson
e06359f616 drivers: sensor: fxas21002: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:25:52 +02:00
Benjamin Björnsson
5f4be73ba0 drivers: sensor: fxas21002: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-22 12:25:52 +02:00
Martin Jäger
1bd9e366be drivers: can: stm32: support for dual CAN instances
CAN1 and CAN2 share the memory for the filter banks.

This commit adds an offset for filters installed for CAN2, allowing to
use both CAN instances simultaneously.

The hardware allows to freely split the avalable 28 filters between
CAN1 and CAN2. In order to simplify the driver implementation, it only
supports an equal split of 14 filters per instance. This is the same
amount of filters as available in MCUs with only a single CAN.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-06-22 12:25:26 +02:00
Martin Jäger
c02454ef03 drivers: can: stm32: rework internal functions
Remove two functions which were only called from one place and did
not improve readibility of the code.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-06-22 12:25:26 +02:00
Martin Jäger
b666afa13e drivers: can: stm32: use DT_INST_FOREACH for driver setup
This commit unifies the driver initialization for can1 and can2
instances so that a single macro can be used.

Enabling the master clock for can2 as introduced in 8ab81b02 had to
be moved to devicetree in order to have the same CAN_STM32_CONFIG_INST
macro for all instances.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-06-22 12:25:26 +02:00
Wojciech Slenska
e757f188c8 drivers: serial: atmel_sam: Added hw flow control
Patch added hw flow control to usart driver

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2022-06-22 12:24:22 +02:00
Henrik Brix Andersen
b7624bc5cf drivers: i2c: mcux: lpi2c: add bus recovery support
Add I2C bus recovery support to the NXP MCUX LPI2C driver. Since the LPI2C
peripheral block does not natively support I2C bus recovery, recovery is
performed using GPIO bitbanging.

Fixes: #42574

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-06-22 12:24:08 +02:00
Gerard Marull-Paretas
4946a15f15 soc: arm: gigadevice: use common API headers
Stop relying on <soc.h> to access HAL APIs. Use generic, per-API headers
instead. Note that <soc.h> has been left as is for now, since ARM MPU
relies on a fragile chain of includes/type definitions.

This change should improve compilation efficiency, as we no longer pull
APIs that are not needed. A similar approach is followed by STM32
drivers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-06-22 18:41:19 +09:00
Andrei Emeltchenko
662cea4638 edac: shell: Update Copyright to 2022
Update Copyright.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Andrei Emeltchenko
8390ae5d70 edac: shell: Do not show error on ENODATA
In a case with ENODATA do not show error.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Andrei Emeltchenko
d0d87a213b edac: shell: Refactor edac shell
Removing code duplicates.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Andrei Emeltchenko
75eba3fdb9 edac: shell: Update edac shell comments
Update edac shell comments reflecting devmem move from edac to a
special shell module.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Andrei Emeltchenko
179cf801c3 edac: ibecc: Exclude logging lcov branch
Make code 100% lcov covered.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Andrei Emeltchenko
0caed0e5e7 edac: ibecc: Remove outdated comments
The issue with logging is fixed in PR #31535

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-06-22 10:28:44 +03:00
Maximilian Deubel
ad3d8e8581 ADXL362: fix write to FIFO_SAMPLES register
This patch removes a superfluous write to the INTMAP1 register
that happens because the byte count was previously wrong.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2022-06-21 10:48:52 +02:00
Thomas Stranger
8891943117 drivers/clock_control: stm32: clock_control_on: check cc-sub_system
This commit adds a check for the validity of the "sub_system" param in
clock_control_on.

While for clock_control_off there was a check if the clock_subsytem
parameter is in range of STM32_PERIPH_BUS_MIN and STM32_PERIPH_BUS_MAX
this check was missing for clock_control_on.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-06-21 10:48:46 +02:00
Jun Lin
d4a5203c18 driver: adc: npcx: prevent sleep when ADC is operating
Entering deep sleep mode stops the source clock of the ADC module and
could corrupt the ongoing ADC conversion. This commit lets ADC driver
acquire the PM lock during the ADC operation (either single conversion
or repetitive scan) and release it when the ADC conversion stops.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-06-21 10:47:15 +02:00
TLIG Dhaou
cefd74f044 drivers: can: stm32: fix return type missed
the return is missing at the end of function which causes compilation
warning and block the build on github.
"warning: control reaches end of non-void function [-Wreturn-type]
   92 | }| ^"

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-06-20 11:34:18 -04:00
Benjamin Björnsson
0f62594f65 drivers: sensor: ens210: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-20 08:46:01 -05:00
Benjamin Björnsson
5afcea07b2 drivers: sensor: ens210: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-20 08:46:01 -05:00
Kumar Gala
e3f991b7b8 drivers: sensor: ams_iAQcore: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-20 08:25:32 -05:00
Benjamin Björnsson
6cff868c70 drivers: sensor: fdc2x1x: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-20 08:18:55 -05:00
Benjamin Björnsson
9bb7c9771f drivers: sensor: fdc2x1x: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-20 08:18:55 -05:00
Aurelien Jarno
e245a213df drivers: flash: stm32h7x: simplify wait_write_queue()
wait_write_queue() get passed a device and an offset to compute the
sector number and verify it is valid. However both operations are
already done by the caller, so let's pass directly the
flash_stm32_sector_t value instead.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-20 09:18:23 -04:00
Aurelien Jarno
c337b9f80b drivers: flash: stm32h7x: use barriers to ensure the writes are flushed
The STM32H7 flash driver read-back a register after writing it to ensure
it is flushed. This is very fragile and might break if a new compiler
version slightly reorder the instructions. Instead use a __DSB()
barrier like done on other STM32 SoC, which ensures that the registers
and the data writes are flushed at the compiler level, but also at the
Cortex-M7 level.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-20 09:18:23 -04:00
Aurelien Jarno
67bceb0257 drivers: flash: stm32h7x: use max-erase-time instead of hard-coded timeout
As the erase time for a sector differs by a few order of magnitude for the
various SoCs of the STM32H7 family, use the just added max-erase-time
property from the device tree instead of the hard-coded 4 seconds value.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-20 09:18:23 -04:00
Stephanos Ioannidis
11d27f12ad drivers: gpio_esp32: Drop IRAM_ATTR from forward declarations
This commit drops the `IRAM_ATTR` macro from the function declarations
because:

1. `IRAM_ATTR` macro makes use of the `__COUNTER__` preprocessor macro,
   which increments for every macro invocation and causes the section
   specified in the forward declaration to not match that of the
   function definition.

2. Section attributes need not be specified for forward declarations.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-20 10:28:06 +02:00
Tim Lin
19724ba002 ITE: drivers/i2c: Enable I2C interrupt after completing configuration
Fix the flow of I2C enable interrupt. We should enable the interrupt
after I2C configuration is completed to avoid pending interrupts and
cause errors irq.

Test port:
i2c_ite_it8xxx2: i2c0
i2c_ite_enhance: i2c4
Test:
tests\drivers\i2c\i2c_api --> pass

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-06-20 10:24:27 +02:00
Benjamin Björnsson
534988ffcf drivers: sensor: bmm150: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 11:09:19 -05:00
Dan Higginbotham
922e83ecf9 drivers/clock_control: stm32_common: Fixed PLL configuration
-Kept getting an error on STM32g0xx chips that didn't have q-divisor.
-Changed to set prescaler only if it's being used.

Signed-off-by: Dan Higginbotham <daniel@dedesignworks.com>
2022-06-17 10:36:54 -05:00
Benjamin Björnsson
94861280f6 drivers: sensor: bq274xx: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 08:52:44 -05:00
Benjamin Björnsson
0c42b0f1a6 drivers: sensor: bq274xx: Change parameters of helper functions
Change parameter list of functions for consistency with other drivers.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 08:52:44 -05:00
Benjamin Björnsson
4974a2d165 drivers: sensor: bmg160: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 08:48:40 -05:00
Benjamin Björnsson
0db8f22892 drivers: sensor: bmg160: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 08:48:40 -05:00
Benjamin Björnsson
67d53d9232 drivers: sensor: bma280: Update driver to use gpio_dt_spec
Simplify driver by using gpio_dt_spec for gpio access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 10:18:16 +02:00
Benjamin Björnsson
3be45afe79 drivers: sensor: bma280: Update driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-06-17 10:18:16 +02:00
Stephanos Ioannidis
745b7d202e drivers: i2c: Fix infinite recursion in driver unregister function
This commit fixes an infinite recusion in the
`z_vrfy_i2c_slave_driver_unregister` function.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-17 02:19:51 +09:00
Kumar Gala
7a9a5f525f drivers: sensor: apds9960: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-16 10:51:42 -05:00
Kumar Gala
cf947c5b13 drivers: sensor: apds9960: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-16 10:51:42 -05:00
Kumar Gala
fa74cadbf0 drivers: sensor: hp206c: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Also removed unused gpio.h header include.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-16 10:37:59 -05:00
Kumar Gala
ef6146d802 drivers: sensor: adt7420: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-16 10:35:48 -05:00
Kumar Gala
6563245300 drivers: sensor: adt7420: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-16 10:35:48 -05:00
Aurelien Jarno
6209f4cb6e drivers: clock_control: stm32h7: wait for VOS change
After changing the voltage scale, wait for it to be applied before
returning.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-06-16 11:26:35 +02:00
Gerard Marull-Paretas
bd39b63760 drivers: can: stm32: use clock control API for FDCAN driver
The FDCAN clock was being enabled using HAL APIs instead of the generic
clock control API.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-16 11:26:18 +02:00
Georgij Cernysiov
bf974902bf drivers: flash: stm32: ospi: writing single, dual and quad modes
Support writing to NOR-Flash over OSPI using
the following modes:

* 1-1-1
* 1-1-4
* 1-4-4

Supports 4-Byte opcodes conversion for write opcodes.

Allows users to set what write/program opcode is used
in the DTS (not for OPI mode).
Will use some default PP opcodes based on the mode.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-16 10:29:15 +02:00
Georgij Cernysiov
f278db7071 drivers: flash: stm32: ospi: support SFDP quad enable requirements
Adds support for `quad enable requirements` DTS property.

Parses SFDP:BFP DW15 (QER related) and uses it (if available),
it bypasses the DTS property.

Automatically enables quad mode (if required).

Supports every DW15 QER modes.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-16 10:29:15 +02:00
Georgij Cernysiov
871ded0e65 drivers: flash: stm32: ospi: read/erase single, dual and quad modes
Adds support to read and erase NOR-Flash over OSPI using
the following modes:

* 1-1-2
* 1-2-2
* 1-1-4
* 1-4-4

Supports 4-Byte opcodes conversion and gets address width
from the SFDP:BFP.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-16 10:29:15 +02:00
Georgij Cernysiov
e6ec77a243 drivers: flash: spi_nor: adds missing PP and Read cmd defines
Adds:
* PP and Read 4-Byte command defines
* PP 1-1-2 define
* Missing 1-2-2 (0xBB) and Read Fast (0x0B) command defines

Re-arranges the commands so that they stay in order.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-06-16 10:29:15 +02:00
Benedikt Schmidt
36b9da8874 drivers/disk: sdmmc: stm32: configurable SDMMC bus width
Make the SDMMC bus width for STM32 configurable.
Fixes #45021.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-06-16 10:28:26 +02:00
Kumar Gala
f78a081066 drivers: ethernet: dsa_ksz8xxx: use NET_DEVICE_DT_DEFINE_INSTANCE
Move to using NET_DEVICE_DT_DEFINE_INSTANCE instead of
NET_DEVICE_INIT_INSTANCE as the driver is devicetree based and it
lets us remove DT_LABEL usage in the driver itself.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-15 17:05:33 -05:00
Thomas Stranger
38b23fd825 drivers: shtc3: fix normal mode measurement time.
The measurement time in normal mode was too short.
With this commit the maximum value of the datasheet is applied.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-06-15 17:02:27 -05:00
Gerard Marull-Paretas
985bdcd076 drivers: serial: ns16550: simplify reg-shift code
The driver supported getting register shift from Devicetree, from a
custom definition in SoC headers (fragile) or, it took a default value.
This change simplifies things by making reg-shift property required in
all instances.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-15 16:59:02 -05:00
Piotr Binkowski
5774228819 drivers: serial: sam0: fix baudrate assignment to config_cache in init
Fix baudrate field assignment in config_cache in uart_sam0_init

Signed-off-by: Piotr Binkowski <p.binkowski@cthings.co>
2022-06-15 16:57:57 -05:00
Martin Jäger
8ab81b02dd drivers: can: stm32: enable can1 clock also for can2
For devices with more than one CAN peripherals, CAN1 is the master and
its clock has to be enabled also if only CAN2 is used.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-06-15 09:13:34 +02:00
Gerard Marull-Paretas
fd2052d524 drivers: remove redundant <zephyr/zephyr.h> includes
Files including <zephyr/kernel.h> do not have to include
<zephyr/zephyr.h>, a shim to <zephyr/kernel.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-15 09:13:11 +02:00
Abramo Bagnara
ada9ca4c93 coding guidelines: comply with MISRA C:2012 Rule 7.2
MISRA C:2012 Rule 7.2 (A `u' or `U' suffix shall be applied to all
integer constants that are represented in an unsigned type)

Added missing `U' suffixes in constants that are involved in the
analyzed build, plus a few more not to introduce inconsistencies
with respect to nearby constants that are either unused in the
build (but implicitly unsigned) or are used and are immediately
converted to unsigned.

Signed-off-by: Abramo Bagnara <abramo.bagnara@bugseng.com>
2022-06-14 13:36:14 -04:00
Kumar Gala
61c2b35335 drivers: sensor: amg88xx: Update driver to use gpio_dt_spec
Move driver to use gpio_dt_spec for GPIO interrupt handling.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-14 09:21:21 -05:00
Kumar Gala
1fbc9632c1 drivers: sensor: amg88xx: Update driver to use i2c_dt_spec
Move driver to use i2c_dt_spec for I2C bus access.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-14 09:21:21 -05:00
Luca Fancellu
58efbc6f4f drivers: xen: keep track of missed events on event channels
The current implementation for events channel is using an empty
callback for every unbind channel and the interrupt is clearing
every event and calling the callback.
However in a scenario where a domain fires a notification when
another has not yet bind the channel, the event will be missed.

To address this limitation, this commit is keeping track of
missed event channel notification when the empty callback is
used, a function to retrieve and clear the missed event is
introduced.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
2022-06-14 09:31:03 +02:00
Jedrzej Ciupis
847f68ae10 drivers: ieee802154: nrf: set TX power selectively
This commit extends Nordic's ieee802154 driver with the possibility to
set Tx power for every transmission separately.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-06-14 09:30:43 +02:00
Jedrzej Ciupis
644da741f4 net: pkt: add IEEE 802.15.4 TX power field
This commit extends the `struct net_pkt` structure with
`ieee802154_txpwr` field that contains signed value of the desired
transmission power of a IEEE 802.15.4 frame in dBm.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-06-14 09:30:43 +02:00
Anas Nashif
2d87948818 drivers: ipm/spi/intc: remove Intel S1000 support
Remove intel_s1000_crb support. The board is no longer available or
supported in the zephyr tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-06-13 16:19:51 -04:00
Anas Nashif
8d04b86dc6 pinmux: remove s1000 i2s driver
Remove intel_s1000_crb pinmux driver. The board is no longer available
or supported in the zephyr tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-06-13 16:19:51 -04:00
Anas Nashif
fa843d308e i2s: remove s1000 i2s driver
Remove intel_s1000_crb drivers. The board is no longer available or
supported in the zephyr tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-06-13 16:19:51 -04:00
Keith Packard
c4d71b3fc0 drivers/flash: Use array instead of char for _ram_code_start
When defined as 'char', the compiler notices that the memcpy targeting that
address will write more than one byte which generates a warning. Use an
array instead so that the compiler doesn't assume a specific size.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-14 01:50:36 +09:00
Keith Packard
7c6fe0735d drivers/adxl372: Fix computation of sensor value
Sensor value computation was creating a 64-bit integer value, passing
that to 'abs' and assigning that to an int32_t result and then sanity
checking the result. If the computation goes badly wrong, then the range
reduction of 64-bit to 32-bit values could generate a falsely in-range
value.

Instead, perform the computation in 64-bits, range check that value and
then assign to a 32-bit variable.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-14 01:50:36 +09:00
Keith Packard
0970cda906 drivers: Report correct errno in uart_native_posix driver
This driver carefully saved the errno value from the failing call and
then didn't use it in the ERROR report, using the potentially invalid
current errno value (which may have been set by the close call).

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-14 01:50:36 +09:00
Kumar Gala
9bdf81102f led_strip: ws2812: Remove dead code
Remove unused WS2812_GPIO_CLK macro that references DT_LABEL.  The
WS2812_GPIO_CLK macro isn't used anywhere so remove it since we
want to minimal DT_LABEL references in drivers.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-13 12:12:18 +02:00
Wojciech Slenska
363989a40d drivers: i2c: sam_twi: Implement bus locking
Added bus locking mechanism, this patch resolves deadlocks
for more than one device on i2c bus, it is based on i2c_sam0 code.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2022-06-13 12:11:41 +02:00
Naga Sureshkumar Relli
248047323e drivers: spi: Add support for Polarfire SOC QSPI
This patch adds driver for the Microchip Polarfire SOC MSS QSPI
controller.
The interrupts of the MSS QSPI are routed through PLIC(Platform level
interrupt controller).

Tested with generic spi-nor flash driver(spi_flash) with both Fixed
flash configuration and Read flash parameters at runtime(using SFDP).

Signed-off-by: Naga Sureshkumar Relli <nagasuresh.relli@microchip.com>
2022-06-13 12:11:28 +02:00
Chay Guo
a4c9e13ea8 boards: arm: Enable flash for storage on mimxrt595_evk
- The MX25UM51345G flash is connected to FLEXSPI PortA for
  mimxrt595_evk.
- Updated flexspi_mx25um51345g driver to support DTR OPI mode.
- Tested with tests/drivers/flash.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
2022-06-13 12:10:57 +02:00
Chay Guo
c846537820 boards: arm: Add wdog support on mimxrt595_evk
Add watchdog support to the mimxrt595 platform.
The mimxrt595 platform is excluded from the watchdog
test case because the test case uses variables in the
noinit section that need to be retained through a reset
but the rt595 does not retain this memory through a
reset.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
2022-06-13 12:10:57 +02:00
Chay Guo
b47a8a428f drivers: clock_control: mcux_lpc_syscon_clock: Add flexcomm16 suppport
Added FlexCOMM16(HS SPI1) clock for MIMXRT5xx.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
2022-06-13 12:10:57 +02:00
Artur Hadasz
2094bfa183 drivers: ieee802154: nrf5: Fix DRX_ADJUST workaround
This PR introduces a fix for DRX window being triggered to early during
CSL. Fixes were also introduced in the nrf 802154 radio
driver, so removed the unneeded DRX_ADJUST constant.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2022-06-13 12:09:57 +02:00
Bartosz Bilas
c343da5161 nxp_imx: rt: add ADC External Trigger Control Kconfig option
Add missing ADC External Trigger Control module Kconfig option.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-06-10 09:48:50 +02:00
Kumar Gala
bb03af637c drivers: gpio: remove unused HAS_DTS_GPIO Kconfig symbol
All the gpio drivers are based on devicetree and thus we always set
HAS_DTS_GPIO, thus we don't need this Kconfig option anymore.  Remove
uses as its safe to assume DTS is supported for GPIO.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-10 09:47:31 +02:00
Kumar Gala
5c905fd094 drivers: clock_control: mcux_sim: Remove dead code
The define NXP_KINETIS_SIM_LABEL is not used so lets remove it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-10 09:47:21 +02:00
Kumar Gala
04622c8b6f edac: shell: Remove use of DT_LABEL
Remove DT_LABEL usage that is needed for device_get_binding, replace
this with DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-10 09:46:15 +02:00
Kumar Gala
7bb17e6fb7 lora: shell: Remove use of DT_LABEL
Remove DT_LABEL usage that is needed for device_get_binding, replace
this with DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-09 22:01:00 -05:00
Keith Packard
9b2aed731a drivers/wifi/esp_at: Increase sprintk buffers to hold parameter types
This driver uses stack buffers to hold AT command strings which are
generated at runtime using sprintk. The buffers are only sized for the
expected range of values, not the full possible range given the datatypes
involved. Values outside this expected range could cause a buffer overflow.

To mitigate this, increase the size of each buffer to hold the full range
of each parameter type.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-09 11:33:09 +02:00
Keith Packard
87367afa80 drivers/modem: Increase sprintk buffers to hold parameter types
These drivers use stack buffers to hold AT command strings which are
generated at runtime using sprintk. The buffers are only sized for the
expected range of values, not the full possible range given the datatypes
involved. Values outside this expected range could cause a buffer overflow.

To mitigate this, increase the size of each buffef to hold the full range
of each parameter type.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-06-09 11:33:09 +02:00
Chay Guo
08641f0616 driver: sensor: mcux_acmp: add discrete mode
The ACMP on i.MXRT11xx support discrete mode,
updated the driver to support discrete mode configuration.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
2022-06-09 11:30:49 +02:00
Moritz Fischer
8f16b05999 drivers: watchdog: cmsdk_apb: Drop dependency
The Kconfig encodes a dependency on SOC_FAMILY_ARM
even though there is no actual dependency.

This is generic ARM IP and can be used in any SoC.

Signed-off-by: Moritz Fischer <moritzf@google.com>
2022-06-08 15:57:01 -05:00
Kumar Gala
23bcc0d107 drivers: watchdog: remove unused HAS_DTS_WDT Kconfig symbol
All the watchdog drivers are based on devicetree and we dont utilize
HAS_DTS_WDT anywhere so we can remove it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-08 16:44:01 -04:00
Marek Metelski
d046ea281c drivers: gsm_ppp: Fix null pointer dereference in log message
Log message references gsm->context.data_rssi which is NULL
when CONFIG_MODEM_SHELL=n. Use gsm->minfo.mdm_rssi which is
internally used when accessing RSSI value.

Signed-off-by: Marek Metelski <marek@metelski.dev>
2022-06-07 19:04:48 +02:00
Marek Metelski
7ade471a47 drivers: gsm_ppp: Wait for NET_IF_DOWN in gsm_ppp_stop only if iface was up
Check if ppp iface was actually up before taking it down and waiting
for NET_EVENT_IF_DOWN. This allows to call gsm_ppp_stop() even if
the PPP was never started, which previously caused the call to lock
forever. This case is useful, for example, if the modem didn't attach
to network in desirable time and user wants to abort PPP setup.

Signed-off-by: Marek Metelski <marek@metelski.dev>
2022-06-07 18:57:18 +02:00
Hari Haran Babu
17f8f62789 drivers: ethernet: w5500: Toggle reset gpio
add toggle reset gpio in w5500_init function

Signed-off-by: Hari Haran Babu <hariharan@linumiz.com>
Signed-off-by: Marcel Graber <marcel@clever.design>
2022-06-07 18:56:31 +02:00
Hari Haran Babu
d8e3affe7b drivers: ethernet: w5500: keep thread blocking in command read-back
add changes for command read-back and change from k_sleep to k_busy_wait
which will allow other threads to wakeup

Signed-off-by: Hari Haran Babu <hariharan@linumiz.com>
Signed-off-by: Marcel Graber <marcel@clever.design>
2022-06-07 18:56:31 +02:00
Luca Fancellu
d62645200b driver: pl011: use new device model to map MMIO
Use the new device model introduced by device_mmio.h to map
pl011 MMIO space.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
2022-06-07 11:54:13 +02:00
Marcin Niestroj
b27bf92234 modem: ublox-sara-r4: do not truncate outgoing datagrams
Do not truncate outgoing datagrams if they do not fit in maximum handled
packet size. Set EMSGSIZE errno and return -1 instead.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-07 11:52:52 +02:00
Piotr Dymacz
360d70a91e drivers: flash: introduce on-chip flash driver for TI CC13xx/CC26xx
This includes a basic driver for built-in flash on the Texas Intruments
SimpleLink CC13xx/CC26xx SoC series.

The driver makes use of driverlib HAL from TI's SDK and was tested on
two LaunchXL development boards with CC1352R and CC2652R SoCs:

- CC1352R1 LaunchXL
- CC26x2R1 LaunchXL

Tests were done using:

- flash shell sample (samples/drivers/flash_shell)
- littlefs filesystem sample (samples/subsys/fs/littlefs)*
- MCUboot (bootloader/mcuboot/boot/zephyr)*

  * additional changes in DTS for the boards were required (partitions
    table) and are not part of this changeset (will be introduced later)

Some additional information about the implementation:

1. TI's Technical Reference Manual for CC13x2 and CC26x2 points out that
   "An individual 64-bit word can be programmed to change bits 1 to 0"
   but it seems this 'alignment' requirement is handled internally by
   the ROM function and thus 'write-block-size' is set to 1.

2. Interrupts, VIMS and line buffers are disabled during flash content
   update (write or erase) and restored afterwards as recommended by TI.

3. Only RAM to flash write is supported (source of data to be written to
   flash can't point to flash).

4. The driver doesn't take care of flash sector protection disable as
   that functionality is handled by CCFG. Write or erase requests which
   refer to a protected area will fail.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-06-06 14:01:27 -07:00
Sean Madigan
8d9ca6ab1c drivers: clock_control: Calibration default on if not BOARD_ENABLE_CPUNET
To prevent both net and app core calibrating.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2022-06-06 22:45:44 +02:00
Aleksandar Markovic
4b0252eab3 drivers: modem: Fix Coverity issue in ublox-sara-r4.c
Coverity reported unused value for a variable "ret" in the function
send_socket_data(). Indeed there were two subsequent assignments
to "ret", meaning that the first one was unused.

The root cause of the problem is not checking the value of "ret"
after correctly invoking a function within send_socket_data(). Fix
this by adding appropriate checks.

Coverity-CID: 215249

Signed-off-by: Aleksandar Markovic <aleksandar.markovic.sa@gmail.com>
2022-06-06 22:45:05 +02:00
Marcin Niestroj
df5d1f220b modem: simcom-sim7080: do not send fragmented data as multiple datagrams
Check if there are multiple non-empty data fragments passed to sendmsg()
function. If positive, then set EMSGSIZE errno and return -1, as that case
is not handled properly with current implementation.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 10:26:53 -07:00
Marcin Niestroj
032b90845e modem: simcom-sim7080: fix handling failed fragment send in sendmsg()
If one data fragment was not sent successfully in sendmsg(), then
attempting to send the rest does not make any sense, as it would introduce
hole in data stream.

Currently if one fragment was not sent successfully, then there is a
'break' in inner loop, but that moves the execution to sending the
following data fragments.

Return early in case of fragment sending failure, so that there are no more
send attempts.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 10:26:53 -07:00
Bjarki AA
ab00842e42 drivers/modem: add user_data to modem_cmd_handler_data
added user_data field to modem_cmd_handler_data

this allows for multiple instances of modem drivers which use
the modem cmd handler. currently, the only identifiable
parameter passed to the modem command handlers is the
modem_cmd_handler_data struct.

The added user_data variable allows for the a modem driver to
pass its dev or data pointer to the modem_cmd_handler_data
struct to be retrieved from within the modem command callbacks.

Signed-off-by: Bjarki AA <baa@trackunit.com>
2022-06-06 17:59:35 +02:00
Marcin Niestroj
ec6026ccdd modem: remove 'modem_pin' abstraction
All drivers using 'modem_pin' abstraction were converted already, so remove
its implementation now.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:52 +02:00
Marcin Niestroj
41c618dbf7 modem: simcom-sim7080: use 'gpio_dt_spec' instead of 'modem_pin'
Move away from 'modem_pin' abstraction as it has not obvious value compared
to generic 'gpio_dt_spec'.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:52 +02:00
Marcin Niestroj
9353b6e98a modem: ublox-sara-r4: use 'gpio_dt_spec' instead of 'modem_pin'
Move away from 'modem_pin' abstraction as it has not obvious value compared
to generic 'gpio_dt_spec'.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:52 +02:00
Marcin Niestroj
10ebfb3877 modem: quectel-bg9x: use 'gpio_dt_spec' instead of 'modem_pin'
Move away from 'modem_pin' abstraction as it has not obvious value compared
to generic 'gpio_dt_spec'.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:52 +02:00
Marcin Niestroj
9ec661b206 wifi: esp_at: use 'gpio_dt_spec' instead of 'modem_pin'
Move away from 'modem_pin' abstraction as it has not obvious value compared
to generic 'gpio_dt_spec'.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:52 +02:00
Marcin Niestroj
1ae3302b78 wifi: esp_at: use UART device pointer directly instead of label
UART device pointer is already used directly when configuring modem
interface. Convert the case when UART is reconfigured when 'target-speed'
DT property is specified.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 17:58:37 +02:00
Marcin Niestroj
774a3cd756 drivers: spi: spi_nrfx_spim: fix !LEGACY_INCLUDE_PATH
Add missing zephyr/ prefix to fix CONFIG_LEGACY_INCLUDE_PATH=n build.

Fixes: d64dc771f3 ("drivers: spi: spi_nrfx_spim: utilize EasyDMA property
  from devicetree")

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 12:07:22 +02:00
Marcin Niestroj
8d66185249 drivers: serial: uart_nrfx_uarte: fix !LEGACY_INCLUDE_PATH
Add missing zephyr/ prefix to fix CONFIG_LEGACY_INCLUDE_PATH=n build.

Fixes: f6a880a2f9 ("drivers: serial: uart_nrfx_uarte: utilize EasyDMA
  property from dts")

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-06 12:07:22 +02:00
Jonathan Hahn
a34c7d680b drivers: serial: removes unused TIMEOUT constant
The TIMEOUT constant is unused since
da210ba0ba,
so removed it.

Signed-off-by: Jonathan Hahn <Jonathan.Hahn@t-online.de>
2022-06-06 12:07:01 +02:00
Krzysztof Frydryk
93e9b5c49d Drivers: crypto_intel_sha: Add support for hw intel sha driver
Adds support for intel ADSP SHA hw accelerator.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2022-06-06 12:05:12 +02:00
Lucas Tamborrino
9f77cc5a89 drivers: pwm: fix esp32 pwm led driver
Fix mapping between channel and gpio.

Remove obsolete functions.

Closes #46167

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-06-05 14:49:12 +02:00
Ryan Erickson
d4a16768bf modem: hl7800: Enable multi-user callbacks
Change callback registration so it can support multiple users.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-06-05 14:48:47 +02:00
Gerard Marull-Paretas
46ee043a39 drivers: pm_cpu_ops: psci: remove redundant <soc.h> include
<soc.h> was not required.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:48:40 +02:00
Gerard Marull-Paretas
63c15efa62 drivers: clock_control: agilex: remove redundant soc.h include
<soc.h> has been traditionally been used as a proxy to HAL headers,
register definitions, etc. Nowadays, <soc.h> is anarchy. It serves a
different purpose depending on the SoC. In some cases it includes HALs,
in some others it works as a header sink/proxy (for no good reason), as
a register definition when there's no HAL... To make things worse, it is
being included in code that is, in theory, non-SoC specific.

This patch is part of a series intended to improve the situation by
removing <soc.h> usage when not needed, and by eventually removing it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:48:40 +02:00
Gerard Marull-Paretas
7de5f47e1a drivers: serial: pl011: improve include list
<soc.h> was included because some CMSIS helpers (__DMB/__ISB) were
needed. In ARM SoCs, inclusion of CMSIS headers depends mainly on how
HALs decide to do it, being usually an inefficient and fragile include
chain. Note that on ARM64 we're in a better position, as those are
defined in-tree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:48:40 +02:00
Gerard Marull-Paretas
4cafd8df7e drivers: serial: ns16550: remove redundant soc.h include
<soc.h> has been traditionally been used as a proxy to HAL headers,
register definitions, etc. Nowadays, <soc.h> is anarchy. It serves a
different purpose depending on the SoC. In some cases it includes HALs,
in some others it works as a header sink/proxy (for no good reason), as
a register definition when there's no HAL... To make things worse, it is
being included in code that is, in theory, non-SoC specific.

This patch is part of a series intended to improve the situation by
removing <soc.h> usage when not needed, and by eventually removing it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:48:40 +02:00
Gerard Marull-Paretas
92f488497f drivers: serial: ns16550: use MMIO device depending on Kconfig option
Add a new selectable Kconfig option to decide wether the device driver
is a MMIO device or not. Previous to this patch, the decision was maded
based on the existence of a definition in <soc.h>. The design was
fragile, as code compiled anyway if the definition was not present.

All platforms/boards that had the definition in <soc.h> select the
Kconfig option in their respective defconfig files.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-05 14:48:40 +02:00
Peter Marheine
95fb984f0b driver: i2c: npcx: prevent sleep during I2C transactions
Deep Sleep mode stops SMB module clocks which could interrupt ongoing
I2C transactions, so have the I2C driver acquire a PM lock at the
beginning of a transaction and release it at the end in order to ensure
the module remains active.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-06-05 14:47:58 +02:00
Daniel DeGrasse
2675fb4ce3 drivers: gpio: pca95xx: do not write to output regs if pin is input
Remove unconditional write to PCA95xx output registers in setup_pin_dir,
and only write to output registers if selected pin is configured as
an output.

Fixes #45774

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-06-05 14:47:41 +02:00
Arsen Eloglian
d4c1c1ebef ssp: SSCR reset - hardware specific flow
hardware specific flow using bit 20 (SSCR2_SFRMEN)  for reset

Signed-off-by: Arsen Eloglian <ArsenX.Eloglian@intel.com>
2022-06-05 14:45:59 +02:00
Yuriy Vynnychek
e36d481893 drivers: flash: Improve Telink B91 Flash Write and Erase APIs
- Fixed from Flash to Flash write issue (added heap usage).
- Speed up Flash Erase operation (based on erase size).

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-06-05 14:45:38 +02:00
Mahesh Mahadevan
d801323e23 drivers: hyperflash: Use write-block-size property
Use the write-block-size devicetree property instead
of a #defined value

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-06-05 14:45:18 +02:00
Yuriy Vynnychek
cca221e928 drivers: bluetooth: hci: introduce new Telink B91 HCI driver
Telink B91 Bluetooth HCI driver basic support.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-06-05 14:45:10 +02:00
Loic Poulain
9b3e6042d9 wifi: eswifi: Fix socket offload TCP server
- The listen callback was not implemented.
- EOF packet not reported
- accept cb was broken

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2022-06-05 14:44:46 +02:00
Loic Poulain
8923fc3186 wifi: eswifi: Implement listen helper
The listen helper will be used by eswifi socket offload layer.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2022-06-05 14:44:46 +02:00
Loic Poulain
2bcd469ca2 wifi: eswifi: Fix missing peer addr family on TCP connect
The sin_family was not filled properly.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2022-06-05 14:44:46 +02:00
Marcin Niestroj
14ca35b859 modem: quectel-bg9x: remove unwanted space after comma in AT cmd
Remove unwanted space in AT+QICSGP command just after comma and before
password.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-05 14:42:46 +02:00
Maximilian Deubel
3530fc088b ADXL362: Add DTS properties for low-power modes
This patch adds DTS properties for using wake-up mode
and the autosleep function to the ADXL362 driver.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2022-06-05 14:42:40 +02:00
Jay Vasanth
b22b206438 driver: i2c: MEC15xx: improve debug logging
Add extra parameters for logging to improve debugging

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-06-05 14:42:11 +02:00
Jay Vasanth
fad437973c driver: i2c: mec15xx: recover from error for LAB
For lost arbitration error condition add recover from
error logic to reset the i2c controller

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-06-05 14:42:11 +02:00
Andriy Gelman
0fc92370fa drivers: uart_xmc4xxx: Remove unnecessary cast
The compiler will perform an implicit cast from unsigned char to uint16_t.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-06-05 14:29:26 +02:00
Andriy Gelman
aa91500aee drivers: uart_xmc4xxx: Check that receive buffers have data in poll_in
As per XMCLib documentation we need to check that data has been received
before reading the buffers.

Fixes test_uart_poll_in test in tests/drivers/uart/uart_basic_api.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-06-05 14:29:26 +02:00
Andriy Gelman
4c2ff6dc2f drivers: uart_xmc4xxx: Don't recast to uint16_t* when returning value
Casting to uint16_t* can cause an unaligned usage fault when c is not
aligned to 2 bytes and can unintentionally overwrite data when c has a 1
byte memory size. Also there's no need to cast to uint16_t* because
returned words are 8-bit characaters as setup in the configuration.

Fixes the following usage fault error in tests/drivers/uart/uart_basic_api:
START - test_uart_poll_in
Please send characters to serial console
E: ***** USAGE FAULT *****
E:   Unaligned memory access
E: r0/a1:  0x00000000  r1/a2:  0x2000078f  r2/a3:  0x0c00453c
E: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x0c003de5
E:  xpsr:  0x41000000
E: Faulting instruction address (r15/pc): 0x0c003de4
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x20000118 (unknown)
E: Halting system

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-06-05 14:29:26 +02:00
Dylan Hung
c880db1725 cache: Add Aspeed AST10x0 external cache driver
The CPU in Aspeed AST10x0 SOC is a ARM Cortex-M4 which doesn't internal
cache memory.  Aspeed implements an integrated system level cache to
accelerate instruction and data memory accesses.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
2022-06-05 14:28:50 +02:00
Mark Holden
44c388fb33 coredump: drivers: Add coredump device
Add a pseudo device diver with device tree bindings for coredump.
The device tree bindings exposes memory address/size values to be
included in any dump. And the driver exposes an API to add/remove
dump memory regions at runtime.

Signed-off-by: Mark Holden <mholden@fb.com>
2022-06-05 14:28:34 +02:00
Ole Morten Haaland
5fd2457561 drivers: wifi: winc1500: Update function name
The close function was renamed in the hal to avoid a name clash with an
internal POSIX function.

Signed-off-by: Ole Morten Haaland <omh@icsys.no>
2022-06-05 14:27:58 +02:00
Adam Wojasinski
d64dc771f3 drivers: spi: spi_nrfx_spim: utilize EasyDMA property from devicetree
This commit aligns SPIM shim to utilize memory-region property from
nordic,nrf-uarte compatible. 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>
2022-06-05 14:27:29 +02:00
Adam Wojasinski
f6a880a2f9 drivers: serial: uart_nrfx_uarte: utilize EasyDMA property from dts
This commit aligns UARTE shim to utilize memory-region property from
nordic,nrf-uarte compatible. 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>
2022-06-05 14:27:29 +02:00
Adrian Bonislawski
638cfbbdbf drivers: dai: add ALH dai driver
The ALH is an intermediary device, which acts as a hub and provides an
abstracted support for numerous sound interfaces (e.g. SoundWire).

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-06-05 14:27:15 +02:00
Jamal Davis
54c311e5b3 drivers: led: lp5562: Allow support for multiple instances
Driver originally only allowed one instance to be created.
Updated to allow for multiple.

Signed-off-by: Jamal Davis <jamaldavis@fb.com>
2022-06-05 14:16:25 +02:00
Shawn Nematbakhsh
3386b853ac drivers: spi_sifive: Optimize xfer to minimize downtime between frames.
The SPI peripheral on SiFive parts uses FIFOs for Rx and Tx (FIFO size
undocumented, but empirically found to be 8 bytes on FE310, likely
identical on FU540 / FU740). Make use of these FIFOs in order to
continuiously feed Tx data as available.

Verified to transmit 1 MHz SPI @ 200 MHz coreclk / tlclk on FE310
continuously without downtime between frames.

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2022-06-05 14:14:59 +02:00
Shawn Nematbakhsh
e17d5ed282 drivers: spi_sifive: Use uint8_t data/buffer types to match spi_context.
spi_context uses uint8_t buffers, and HW rxdata / txdata registers only
contain 8 bits of data (along with b31 full / empty flag), so uint8_t is
appropriate.

Suggested-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2022-06-05 14:14:59 +02:00
Yong Cong Sin
c7267dc26a drivers: modem: gsm: remove mux_enabled flag and checks
mux_enabled check in the gsm_configure is unnecessary since it
is init and scheduled by gsm_ppp_start which means that the
mux must be disabled. The IS_ENABLED(CONFIG_GSM_MUX) check
should be good enough to determine whether or not the
mux_enable function should be ran.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-06-05 14:13:45 +02:00
Yong Cong Sin
b7eb2202e3 drivers: modem: gsm: introduce lock
After the introduction of start/stop & rssi query work, these
additional functions can be invoked from different threads.

Things can quickly become hard to analyze when an interrupt
fires during one of these functions and upon return the
scheduler schedules another thread and run another function.

This PR introduces a simple mutex lock that guarantees thread
safety. Similar implementation can be found in hl7800 driver,
which has lots of public APIs that can be invoked from different
threads.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>

Update gsm_ppp.c
2022-06-05 14:13:45 +02:00
Yong Cong Sin
975bc85b14 drivers: modem: gsm: move the rssi query an individual function
Move the rssi query part out from the rssi_handler work item as
an individual function, so that it can be used directly without
referencing the work.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-06-05 14:13:45 +02:00
Sylvio Alves
7c2305612d drivers: i2c: fix esp32 fifo rx value
Fix #46112 introduced a regression regarding rx fifo length.
This fixes it so that the last byte is not placed in
wrong buffer index.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-06-02 12:56:33 +02:00
Lucas Tamborrino
092406b08d esp32: drivers: i2c: fix command sequence
Closes #45008

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2022-05-31 10:38:43 +02:00
Michal Sieron
dc98691c97 drivers: i2s: i2s_litex: Calculate offsets from DT
To support both 8-bit and 32-bit Control/Status register variants, register
offsets need to be calculated from device tree.

Updated register data in device tree to the 32-bit CSR variant.
Renamed defines to be similar to other LiteX drivers.

Changed frequencies in clock-outputs nodes, so i2s/litex sample works.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-27 15:27:11 -07:00
Michal Sieron
17a2c6d647 drivers: ethernet: eth_liteeth: Update driver
Correct width when accessing LITEETH_RX_LENGTH register.

Also update register data in device tree to the 32-bit CSR variant.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-27 15:27:11 -07:00
Michal Sieron
e088d05159 drivers: i2c: i2c_litex: Use LiteX HAL
LiteX HAL should be used when accessing Control/Status registers to provide
compatibility between different data widths of CSRs.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-27 15:27:11 -07:00
Michal Sieron
9f6c531da0 drivers: spi: spi_litespi: Update driver registers
Make driver take register info from device tree so it can work with both
8-bit and 32-bit CSRs.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-27 15:27:11 -07:00
Andrzej Puzdrowski
95d867e8ed drivers/flash/nrf_qspi_nor: fix for missing device deactivation.
anomaly_122_init() and anomaly_122_uninit() procedures implement
proper activate and deactivate procedures which are required for
achieve low power consumption.
The real workaround for the anomaly is buried inside hal function
nrf_qspi_disable() is called indirectly by the anomaly_122_uninit().

Therefore anomaly_122_init/uninit should be called for any
nrf QSPI device.

This patch renames functions and make call to them mandatory.
This fixes increased power consumtion issue on nRF53 device when
qspi was used.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-05-27 15:23:12 -07:00
Fabio Baltieri
e24314f10f include: add more missing zephyr/ prefixes
Adds few missing zephyr/ prefixes to leftover #include statements that
either got added recently or were using double quote format.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-27 15:20:27 -07:00
Dino Li
5a1c084447 driver/serial: ns16550: set NS16550 as default variant
This add UART_NS16550_VARIANT_16550 configuration inside the choice
of UART_NS16550_VARIANT_NS16750 and UART_NS16550_VARIANT_NS16950.
The configuration is enabled by default to make NS16550 device to get
correct FIFO size configuration (16 bytes).

fixes #45783

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-05-27 11:55:31 -07:00
Andrei-Edward Popa
d82c10f197 include: drivers: changed API function names for reset controller
assert API function needed to be changed because of newlib assert
macro name conflict

Signed-off-by: Andrei-Edward Popa <andrei.popa105@yahoo.com>
2022-05-26 13:02:19 -07:00
Gerson Fernando Budke
5b7734c926 drivers: adc: sam0: Fix adc_reference implementation
The current sam0 adc driver not implement correctly the adc_reference
enum values. This try homonize adc input referece by tracking VDDANA
at ADC_REF_VDD_1. The ADC_REF_VDD_1_2 were fixed with correct INTVCCx
channel selection.

Fixes #45443

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-05-25 13:36:10 -07:00
Trent Piepho
094345629b drivers/sensor: lsm6dso: Add support for lsm6dso32
This sensor is virtually identical to the lsm6dso.  The only difference
is the accelerometer ranges are double those of the lsm6dso.

Use the same driver.  The difference is detected by using "st,lsm6dso32"
as the first compatible entry, followed by "st,lsm6dso".

An bit flag in the existing accel_range config field is used to check if
the chip is the doubled range or not.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2022-05-25 13:16:04 -07:00
Trent Piepho
5edd4221ad drivers/sensor: lsm6dso: Refactor common config out of I2C/SPI macros
Move common settings out of the SPI and I2C instantiation macros and
into a common macro, which the aforementioned two macros can then use.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2022-05-25 13:16:04 -07:00
Trent Piepho
c269692b1d drivers/sensor: lsm6dso: Remove LE to CPU conversions
In ST HAL v2.00, the functions to get the raw sensors values, e.g.
lsm6dso_acceleration_raw_get(), convert from little-endian to CPU.

Previous versions of ST HAL didn't do this.

The conversion here in the driver is converting a second time.  It's not
an issue on a LE system, the conversion is a no-op, but on a BE system
it would be broken.

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
2022-05-25 13:16:04 -07:00
Janco Kock
d611284271 drivers: ethernet: w5500: Check W5500 int pin after processing interrupt
Check if W5500 int pin is still active after processing the interrupt.
If not doing correctly, the W5500 driver can deadlock because it is not
receiving any more interrupts.

Signed-off-by: Janco Kock <jancokock@gmail.com>
2022-05-25 21:46:17 +02:00
Michael Schmitz
043a31a1c6 drivers: pwm: esp32: rename internal channel to avoid redeclaration
Unifying the method signature introduced a redeclaration of variables,
fixes redeclaration of variables by renaming the inner ones

Signed-off-by: Michael Schmitz <michaelschmitz@live.de>
2022-05-25 14:21:12 +02:00
Georgij Cernysiov
e8dece902f drivers: flash: stm32_ospi: fix includes
Adds `zephyr/...` prefix to `toolchain.h` include.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-25 11:13:40 +09:00
Filip Kokosinski
70c978bb97 soc/riscv/sifive-freedom/fe310: use correct SYS_CLOCK_HW_CYCLES_PER_SEC
This commit introduces changes in three places in order to fix the
problem with timer-related tests on FE310-based boards:
* tests/kernel/sleep/kernel.common.timing
* tests/kernel/tickless/tickless_concept/kernel.tickless.concept
* tests/kernel/workq/work_queue/kernel.workqueue

The first change is the modification of the SYS_CLOCK_HW_CYCLES_PER_SEC
value back to 32768 Hz to match FE310's datasheet description.

The second change is CLINT frequency reduction in Renode simulation
model to 16 MHz to correspond with the oscillator frequency given by the
FE310's datasheet and the HiFive1 board schematic. This fixes the first
two tests.

The last change is reducing the MIN_DELAY define to 100. This causes the
RISC-V machine timer driver to update the mtimecmp register more often,
which in turn addresses the `work_queue/kernel.workqueue` problem with
work items finishing prematurely, causing the above-mentioned test to
fail.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-05-24 08:58:43 -07:00
Erwan Gouriou
af483c37fc drivers/clock_control: stm32u5: Wrong bus check in _get_rate()
Checking that provided pclken->bus fits bus range in
clock_control_get_rate() is wrong as it could actually be a source
clock and hence not belong to this range.
Also, this kind of check is just not needed since this function should
not be used before call to clock_control_on() or clock_control_configure()
which do the required verification.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-24 08:51:52 -07:00
Tomislav Milkovic
fc7598fa04 drivers: can: can_stm32h7: Fix min timings
Assertions in can_mcan failed because the driver expects values
strictly greater than 0

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-05-24 08:49:41 -07:00
Mahesh Mahadevan
70dbf7e695 drivers: uart_imx: Fix the poll_in function
Current poll_in function implementation blocks when there is
no data available. The Zephyr documentation for poll_in
expects the function to return -1 when no data is available.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-23 15:00:14 -05:00
Mahesh Mahadevan
649bb3bb44 drivers: counter: Update CTimer to fix alarm setting
1. Make sure the relative alarm value is set correctly
2. Add a Kconfig to give user the option of reserving
   a CTimer channel for implementing the set_top_value
   function

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-23 08:38:59 -05:00
Armando Visconti
f91471640e drivers/sensor: lsm6ds0: Fix typo when configuring FS at 16G
Fixed a typo when selecting LSM6DS0_ACCEL_FULLSCALE_16G.
(Fixes #45583)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2022-05-23 15:16:15 +02:00
Fabio Baltieri
69a13bbb5d drivers: pwm_nrfx: fix incoherent config struct name
Fix the instance config structure name so that it's coherent with the
data one (missing underscore after the instance idx).

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-20 19:22:20 -07:00
Mulin Chao
0f18c4c4ab pinctrl: npcx: config pwm open-drain without enabling STORE_REG
Config pwm open-drain mode without enabling STORE_REG. This CL
collects all active PWM's base address and related index in an
array. Then, pinctrl driver configs its open-drain mode by
finding the corresponding 'channel' index.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-20 12:36:22 +02:00
Jose Alberto Meza
d2361e8441 drivers: sensor: mchp_tach: Correct spelling header
Correct spelling in copyright.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-05-20 12:35:37 +02:00
Chris Collins
ce84c782dc drivers: usb: device: stm32: fix disconnect-gpios configuration.
For some reason, rather than testing for the presence of
disconnect-gpios in the devicetree, the STM32 USB Device driver was
relying on a hidden Kconfig flag to be set.

This patch removes the Kconfig option completely and simply tests for
the DT property - if it's set, you obviously know what you're doing and
obviously need the pull-up GPIO behaviour.

Signed-off-by: Chris Collins <chris@realsimgear.com>
2022-05-19 11:28:38 -07:00
Nickolas Lapp
521e093cde I2S_MCUX: Fixup I2S MCUX Audio PLL Rate Calculation and Reg Writes
This PR Fixes the Audio PLL Rate Calculation (there was an additional
divide / 8 which is not necessary and does not appear in similar
calculations in example code from the SDK).

Additionally, it adjusts the SAI .dtsi to more correctly configure the
mclk rate, and adds comments specifying what the regististers mean.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2022-05-19 11:01:53 -05:00
Evgeniy Paltsev
3b0517bbd3 ARC: HSDK: remove pinmux_hsdk driver
Pinmux is depricated (see #39740) and shouldn't be used anymore

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2022-05-18 17:20:26 +02:00
Daniel DeGrasse
f7986835e8 drivers: gpio: gpio_mcux_igpio: add workaround for non contiguous pins
some iMX RT SOCs have non contiguous sets of gpio pins available, which
caused issues when selecting appropriate pinmux for these parts. Add
workaround code to adjust offset of pinmux settings when configuring
these pins.

Fixes #44391

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-18 10:55:22 +02:00
Christoph Heller
382ee011d5 drivers: flash: stm32h7x: Fix wrong flash write offset
The flash_stm32_write_range() function of the STM32H7x flash
driver partially uses a wrong flash program word size for certain
SOC types when calculating the flash write offset. If the used
SOC is not having a flash program word size of 256 bits / 32 bytes
the written data might get corrupted, as the flash write offset
value does not match the number of bytes that were actually
written.

Fixes #45568

Signed-off-by: Christoph Heller <chris@metanetics.de>
2022-05-18 10:54:36 +02:00
Sylvio Alves
f3d2dd2b6c soc: esp32: move phy tx power to soc config
PHY TX power configuration must be added into soc level.
It was previously hardcoded in hal_espressif, which was removed.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-05-17 18:11:50 +02:00
Sjors Hettinga
ae31773ddd drivers: net: loopback: Add counting of number of dropped packets
When the loopback drops driver packets, the number of dropped
packets is counted and can be requested externally.

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
2022-05-16 16:55:51 +02:00
Wael Barakat
4b3fe99b83 drivers: gpio: nrf: fix pin number used in getting GPIOTE channel
Incorrect GPIOTE channel was being freed because the pin number
being used is not the absolute pin but the pin within the port.

Signed-off-by: Wael Barakat <waelsbarakat@gmail.com>
2022-05-16 09:41:04 +02:00
Felipe Neves
44631ebada drivers: wifi: esp_at: add support for firmware
V2.1 for ESP At and make it to coexist
with the current versions.

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
2022-05-15 21:34:32 +02:00
Keiya Nobuta
5d662ae3f8 drivers: kscan: Add CAP1203 driver
Add driver for Microchip CAP1203 3-Channel Capacitive Touch Sensor

datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/00001572B.pdf

Signed-off-by: Keiya Nobuta <nobuta.keiya@fujitsu.com>
2022-05-15 21:31:54 +02:00
Andrzej Głąbek
77edc2c852 dts: Include ADC DT binding headers from nRF SoC dtsi files
Add inclusions of header files with devicetree related ADC definitions
to the nRF SoC dtsi files so that those definitions can be used also
for nRF SoC based boards.
Provide definitions of nRF ADC and SAADC analog inputs suitable
for use in devicetree.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-05-13 12:46:06 -07:00
Nazar Palamar
d940d23c10 modules: hal_infineon: added initial Kconfig and CMakeLists.txt
- added initial Kconfig
- added initial CMakeLists.txt (root, core-lib,  mtb-pal-cat1)
- updated module, driver and soc to use CONFIG_USE_INFINEON_xx
  defines from modules/hal_infineon/Kconfig

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-05-13 21:34:59 +02:00
TOKITA Hiroshi
7e4cf8308d drivers: display: st7735r: added inversion-on property
Add 'inversion-on' property to st7735r.
Issue INVON(21h) command on initializing if inversion-on was enabled.
As a result of this command, the display color is inverted.
Otherwise, INVOFF(20h) will be issued.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-05-13 11:04:21 -07:00
Georgij Cernysiov
4f10178f3d drivers: flash: stm32: qspi: use ternary and asserts in quad prepare
Use ternary operation and asserts to reduce the footprint
and code size.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
c54e7d162a drivers: flash: stm32: qspi: remove flag_quad_io_en field
There is no need in the `flag_quad_io_en` field.
When QE enabling failed, then the driver `init` fails as well.

There is no way to use qspi in quad mode if qe is not enabled.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
a8e0699972 drivers: flash: stm32: qspi: always include gpio header
Always include gpio header.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
13af1ca9f1 drivers: flash: stm32: qspi: support SFDP quad enable requirements
Parses SFDP QER related DW15 to use as the source for QER.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
685f2098c4 drivers: flash: stm32: qspi: support DTS quad enable requirements
Adds support for DTS quad_enable_requirements property.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
706697168b drivers: flash: stm32: qspi: move prepare cmd is enable check
Moves IS_ENABLE check from prepare program and read to the caller.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
bbdfe6d9e0 drivers: flash: stm32: qspi: support 1-4-4 and 1-1-4 quad read modes
Adds support for 1-4-4 and 1-1-4 read modes.

SFDP is used to query for available read instructions, then the
fastest one is used.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
0216353263 drivers: flash: stm32: qspi: support DTS writeoc
Adds support for DTS writeoc.

Uses 1-4-4 mode by default (as the original driver).

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
4ef6b82681 drivers: flash: stm32: qspi: minor cleanup
Removes double line and log output regarding
device initialization.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
c2dfeb11c1 drivers: flash: jesd216: correct comment mistake
Corrects type name in the comment for the DW15 QER field.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
b43741cd5d drivers: flash: spi_nor: add SR3 read and write defines
Adds Status Register 3 read and write opcode defines.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
22c8022b54 drivers: falsh: spi_nor: add PP_1_1_4 and rename 4PP
* Renames 4PP define to PP_1_4_4
* Adds PP_1_1_4 define

That matches linux kernel defines a bit more.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Georgij Cernysiov
78ecf65267 drivers: flash: spi_nor: remove not used QE bit define
Removes unused QE bit define.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-13 08:44:54 -07:00
Thomas Altenbach
cc51031445 drivers/entropy: stm32: fix inter-core race condition
On STM32WB and dual-core STM32H7 MCUs, the RNG peripheral is shared
between the cores and its access is protected by a hardware semaphore.
Locking was not performed in the current entropy driver, leading to a
race condition when multiple cores concurrently used the RNG. This
commit implements the necessary logic for locking the HSEM during entropy
generation on multi-core STM32 MCUs. It also reconfigures the RNG in case
the configuration was changed by the other core, as this can happen e.g
on STM32WB MCUs.

Signed-off-by: Thomas Altenbach <taltenbach@witekio.com>
2022-05-13 10:28:53 -05:00
Peter Johanson
43b77a2191 drivers: usb: Add RP2040 USB device support.
Add USB device driver for Rasberry Pico family of controllers.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2022-05-13 16:28:27 +02:00
Jonathan Hahn
05cc2e1ac3 drivers: serial: add pin inversion to stm32 u(s)art
Additional properties are added to stm32 u(s)art to allow
for signal inversion.

Signed-off-by: Jonathan Hahn <Jonathan.Hahn@t-online.de>
2022-05-13 08:45:55 -05:00
Jordan Yates
993cad1b4a wifi: esp_at: cleanup sockets at network close
Some sockets (UDP sockets at least) do not generate "<N>,CLOSED"
messages when the WiFi network drops. As a result the networking stack
thinks these sockets are still open after the network has dropped, and
after any subsequent reconnections.

This affects the DNS resolver library in particular, which leaves UDP
sockets open permanently by default.

Manually close these sockets when the network drops to ensure a clean
state the next time the network connects.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-13 14:53:48 +02:00
Jordan Yates
a2c0bd8dd1 wifi: esp_at: notify receivers on async close
`esp_close_work` can be queued from the `on_cmd_closed`, which clears
`ESP_SOCK_CONNECTED` and sets `ESP_SOCK_CLOSE_PENDING`, but does no
further work. The receive callback should still be run with no data when
the socket is closed through this mechanism.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-13 14:53:48 +02:00
Jordan Yates
c28874657b spi: spi_b91: use new DT_INST_STRING_TOKEN macro
Use the dedicated `DT_INST_STRING_TOKEN` macro instead of manually
retrieving `DT_DRV_INST`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-13 14:17:08 +02:00
Yasushi SHOJI
f14e9e408b serial: xilinx: uartlite: Fix bus fault
Xilinx AXI UART Lite v2.0[1] has the following clause for both RX and TX
FIFO respectively:

    When a read request is issued to an empty FIFO, a bus error (SLVERR) is
    generated and the result is undefined.

    When a write request is issued while the FIFO is full, a bus
    error (SLVERR) is generated and the data is not written into the FIFO.

To protect this, we have:

    xlnx_uartlite_read_status(dev) & STAT_REG_RX_FIFO_VALID_DATA, and
    xlnx_uartlite_read_status(dev) & STAT_REG_TX_FIFO_FULL

but these are not enough for multi-threaded apps.  Consider two threads
calling poll_out(), it is always possible for a thread to be swapped out
right after reading the status register, the other thread fill the TX FIFO,
and the original thread is swapped back to write more data to the FIFO
because previously read status doesn't indicate the FIFO is full.

To close this race condition, this commit uses a spinlock for each FIFO.
This ensures that only one thread accesses the FIFO even for SMP cases.

This closes #45302.

[1] https://docs.xilinx.com/v/u/en-US/pg142-axi-uartlite

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2022-05-12 19:05:15 -04:00
Daniel DeGrasse
ddee8d7f4e drivers: pwm_imx: add pin control support
Add pin control support to pwm_imx driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
7299a2994a drivers: i2c_imx: add pin control support
Add pin control support to i2c_imx driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
c4a7985064 drivers: uart_imx: add pin control support
Add pin control support to uart_imx serial driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
694637a83c drivers: uart_mcux_iuart: add pin control support
Add pin control support to mcux_iuart driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
0f7145e037 drivers: gpio_imx: Add pin control support
Add pin control support to gpio_imx driver, so that GPIO pin muxes will
be selected when the use configures a pin as GPIO.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
a4ad9d4c60 drivers: gpio_mcux_igpio: add additional SOC pin control settings
Add additional pin controller settings for iMX application core SOCs, as
well as a "fallback" pin control setting.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse
bc841e1fb7 drivers: pinctrl: refactor pin control support for imx rt
Refactor iMX RT pin control support to use more generic names, as the
IOMUXC peripheral is present on non RT iMX application cores.
Additionally, make selection of the pin control driver occur at the SOC
level.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Francois Ramu
084dc3f0dd drivers: flash: ospi factorized for stm32 devices
Simplifies the driver and Gives a generic function to prepare the Regular
commands for each instruction.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu
16754378fb drivers: flash : introduce a new driver for the OCTOSPI
This is the stm32 octospi driver based on the exisitng quadspi
 for stm32 devices and source code from the STM32Cube.
This drivers initialized the peripheral and the NOR memory
in SPI or OctoSPI mode with STR or DTR data Transfer rates.
The NOR-flash can provide the SDFP table directly (if supported)
or through the DeviceTree.
 Limitation: no DMA transfer.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu
712d2537be drivers: flash: JESD216 ospi command for SFDP
Includes the 16bit command to read the SFDP in the NOR flash.
according to the JEDEC standard.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Francois Ramu
5b029377ab drivers: flash: spi nor header includes definition for OSPI commands
With the introduction of the OSPI NOR flash controller
more octal commands and parameters are defined.
It completes the existing SPI commands

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-12 14:56:25 -05:00
Jose Alberto Meza
3ebe2a8e80 drivers: pinctrl: xec: Prevent glitch for QMSPI on MAF
Whenever EC bootloader already configured a pin as output and
high, any further reconfiguration via pinctrl driver causes a
glitch in said pin with current sequence.

Defer pin direction configuration to be last operation over
gpio control register to avoid the glitch.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-05-12 14:49:45 -05:00
Jordan Yates
9d58fa7ac9 wifi: esp_at: log message on async close
Log a message when the modem asynchronously closes a link. This is
useful information to the user as it can explain the root cause of later
failures.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-12 15:27:01 -04:00
Mulin Chao
33c7119e87 drivers: espi: host_subs: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in npcx eSPI and host_subs driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
7ef371b2e7 drivers: adc: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in npcx adc driver. Please notice users need to
configure the corresponding pinctrl nodes in 'pinctrl-0' property in the
adc0 DT node. For example, if ADC0 and ADC2 channels are selected for
the application, please add the follwoings in your board DT layout file.

&adc0 {
	status = "okay";
	/* Use adc0 channel 0 and 2 for 'adc_api' driver tests */
	pinctrl-0 = <&adc0_chan0_gp45
		     &adc0_chan2_gp43>;
	pinctrl-names = "default";
};

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
22f9036577 drivers: sensor: npcx_tach: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in npcx tachometer driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
95f6dc6c35 drivers: ps2: add Zephyr pinctrl support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in ps2 driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
8f65bdabab drivers: pwm: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in pwm driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
a4b07c396d drivers: i2c: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in i2c driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
8efc935288 drivers: uart: add pinctrl driver support
Replace soc-specific pin functions with Zephyr pinctrl api functions for
pin-mux configuration in uart driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mulin Chao
d53d574bf0 drivers: pinctrl: npcx: add initial pin-controller driver
This CL is the initial version for npcx pinctrl driver and introduces
pinctrl nodes for both IO-pads and peripheral devices for each npcx
series. Users can set pin configuration via these nodes in the board
layout DT file. It also wraps all configurations related to pin-muxing
in pinctrl_soc.h. Regarding the other pin properties, we will implement
them later.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-05-12 14:24:03 -05:00
Mahesh Mahadevan
8157e4bebf display: Update ELCDIF driver to use a config
Update the MCUX ELCDIF driver to use CONFIG_MCUX_ELCDIF_POOL_BLOCK_NUM
for the number for frame buffers to allocate.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-12 09:26:50 -05:00
Mahesh Mahadevan
450a1c0982 drivers: display: Add support for Raydium RM68200
Add support for the Raydium RM68200 MIPI DSI panel.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-12 09:26:50 -05:00
Mahesh Mahadevan
27800c2fd7 drivers: mipi: Add MIPI DSI driver for MXRT devices
Add a MIPI DSI driver for the MIPI controller on
NXP MXRT SoC'sUpdate MIPI_DSI

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-12 09:26:50 -05:00
Gerard Marull-Paretas
83cfd295b9 drivers: mipi_dsi: initial support for MIPI-DSI drivers
Add initial support for MIPI-DSI drivers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-05-12 09:26:50 -05:00
Andrzej Głąbek
36845b6168 drivers: adc_common: Add missing gain values in adc_gain_invert()
This is a follow-up to commits e15bdaa1bd
and 07bf22cc94.

The above two commits added some enumerated gain values and those
are not currently handled by the inverting function. Add the missing
entries to the conversion array in the function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-05-12 09:22:39 +02:00
Tomislav Milkovic
a5429ac988 drivers: display: temporary fix for PLLSAI on STM32F7
Temporary fix to configure PLLSAIR multipliers for correct
LTDC pixel clock on STM32F746G Discovery board

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-05-12 09:21:46 +02:00
Jun Lin
51978d9d61 driver: eSPI: npcx: workaround the errata rev1_2, No.3.10
Enabling an eSPI channel (r.g. Peripheral Channel, Virtual Wire Channel,
etc.) during an eSPI transaction might (with low probability) cause the
eSPI_SIF module to transition to a wrong state and therefore response
with FATAL_ERROR on an incoming transaction.
This CL workarounds this issue by clearing the bit 4 of NPCX eSPI
specific register#2.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-05-12 09:21:24 +02:00
Jan Peters
8a4aeeb11e drivers: gpio: fix gpio_emul driver to allow multiple instances
A missing semicolon caused compiler errors when more than one emulated
gpio device was defined in the device tree.

Signed-off-by: Jan Peters <peters@kt-elektronik.de>
2022-05-12 09:21:14 +02:00
Artur Lipowski
bb8575962d stm32: Allow UARTs to use alternate clocks.
Add support for an alternate clock. If available,
alternate clock is enabled and used to get the
device clock rate.
Based on: #45053.

Signed-off-by: Artur Lipowski <Artur.Lipowski@hidglobal.com>
2022-05-11 14:58:37 -05:00
Peter Maxwell Warasila
3c09c21fda drivers: serial: uart_stm32: tx/rx swap in init()
Previously, the uart_stm32 driver was extended in #44487 to support
swapping the tx and rx pins of supported STM32 UART peripherals.
However, the original change applied this configuration during the
call to the uart_stm32_configure() function. This has now been added to
the uart_stm32_init() function to ensure this behavior on startup for
ports like the virtual com port.

Signed-off-by: Peter Maxwell Warasila <madmaxwell@soundcomesout.com>
2022-05-11 14:45:34 -05:00
Georgij Cernysiov
b11fcc8e0c drivers: display: stm32_ltdc: fix set orientation API
Refactors invalid switch into if statement.
Fixes orientation set return value for normal
display orientation.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-11 10:49:23 +02:00
Ruibin Chang
f3204b7326 ITE drivers/pwm: don't divide-by-zero
Make sure cxcprs isn't zero, or we will have
divide-by-zero on calculating actual_freq.

Test:
1.tests/drivers/pwm/pwm_api pattern
2.GPA0(pwm0) output 79201Hz, 324Hz, 100Hz, 1Hz waveform

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-05-11 10:49:13 +02:00
Henrik Brix Andersen
9bd97eb0b8 drivers: can: add CAN_MODE_FD
Add support for enabling/disabling CAN-FD frame transmission/reception at
run-time.

Fixes: #45303

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-11 10:47:54 +02:00
Henrik Brix Andersen
3f97d11afd drivers: can: convert enum can_mode to a bit field
Convert the can_mode enum to a bit field to prepare for future extensions
(CAN-FD mode, transmitter delay compensation, one-shot mode, 3-samples
mode, ...).

Rename the existing modes:
- CAN_NORMAL_MODE   -> CAN_MODE_NORMAL
- CAN_SILENT_MODE   -> CAN_MODE_LISTENONLY
- CAN_LOOPBACK_MODE -> CAN_MODE_LOOPBACK

These mode names align with the Linux naming for CAN control modes.

The old CAN_SILENT_LOOPBACK_MODE can be set with the bitmask
(CAN_MODE_LISTENONLY | CAN_MODE_LOOPBACK).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-11 10:47:54 +02:00
Henrik Brix Andersen
2f7c01ba21 drivers: can: rename API functions from timing_*_data to timing_data_*
Rename the CAN data phase API functions to timing_data_* for consistency:
- can_get_timing_min_data() -> can_get_timing_data_min()
- can_get_timing_max_data() -> can_get_timing_data_max()
- .timing_min_data -> timing_data_min
- .timing_max_data -> timing_data_max

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-11 10:47:54 +02:00
Henrik Brix Andersen
18890828b8 drivers: can: split CAN classic and CAN-FD syscalls
Split CAN classic and CAN-FD syscalls into two:
- can_set_timing() -> can_set_timing() + can_set_timing_data()
- can_set_bitrate() -> can_set_bitrate() + can_set_bitrate_data()

Fixes: #45303

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-11 10:47:54 +02:00
Georgij Cernysiov
d2a792dd39 drivers: clock_control: stm32h7: add stm32h730xx
Add STM32H730xx SoC.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-11 10:47:43 +02:00
Daniel DeGrasse
7e89ce9f19 drivers: serial: enable pin control for lpc11u6x serial driver
Enable pin control api for lpc11u6x serial driver, and remove pinmux api
usage.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-10 17:27:44 -05:00
Daniel DeGrasse
069280c8a4 drivers: i2c: i2c_lpc11u6x: enable pin control
Enable pin control for lpc11u6x i2c driver, and remove pinmux usage from
board level DTS files.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-10 17:27:44 -05:00
Daniel DeGrasse
8e07e21424 drivers: clock_control: convert lpc11u6x syscon driver to pinctrl
convert lpc11u6x syscon clock driver to pin control, and remove all
pinmux usage from driver and syscon dts node.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-10 17:27:44 -05:00
Daniel DeGrasse
1916fb21dd drivers: pinctrl: update lpc pinctrl driver for lpc11u6x
Update pin control driver for lpc11u6x. This SOC does not have a HAL,
so fsl_clock is not available. It also lacks a slew-rate field in the
IOCON register, so this property must be optional.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-10 17:27:44 -05:00
Daniel DeGrasse
81c209dc2d drivers: gpio_lpc11u6x: use pio nodes to configure pin mux for gpio
switch gpio driver to use pio nodes to configure pin control settings,
and stop using pinmux driver within gpio driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-10 17:27:44 -05:00
Jordan Yates
e5c391fad6 power_domain: gpio: improve logging
Improve the power domain logging by making the log level configurable
and boosting the log level of the messages printed when the domain turns
on and off.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 17:59:56 -04:00
Esteban Valverde
b9313cab1b drivers: counter: Setting I2C as depends in DS3231 config file
When using DS3231 counter, its enablement should depend on I2C

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-05-10 13:29:47 -04:00
Esteban Valverde
03ec46889b drivers: usb: Adding support to GIC_V1 in dc_dw USB driver
Adding support for the GIC_V1 to the dc_dw USB driver
to be used by Cyclone V SoC FPGA Development Kit

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-05-10 13:29:47 -04:00
Esteban Valverde
797b6784bb drivers: serial: modify ns16550 to use extended FIFO
Cyclone V SoC FPGA supports 128Byte FIFO for UART communication,
this modification adds a feature to use 128byte FIFO serial UART

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-05-10 13:29:47 -04:00
Erwan Gouriou
09217865ce drivers/clock_control: stm32_common: Implement clock source selection
Similarly to what was done on U5 and H7 clock_control drivers, enable
device clock source selection.
This is done by:
-providing implementation for clock_control_configure().
-updating clock_control_get_rate() to support various possible clock
sources (SYSCLK, PLLCLK, LSE, LSI, HSI, HSE).
-providing enable_clock() to verify requested clock source exists and
is enabled.
-adding LSI and LSE device tree based initialization to
set_up_fixed_clock_sources().

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
c2ee8209ab drivers/clock_control: stm32_common: Remove unused definitions
STM32WL_DUAL_CORE and RCC_CALC_MSI_RUN_FREQ are not used anymore.
Clean up those definitions

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
e579027d20 include/dt-bindings/clock: stm32: Factorize Clock source binding accessors
Rename and factorize clock source bindings accessors by moving them
in common header file stm32_clock_control and remove them from
include/dt-bindings/clock/stm32XY_clock.h files

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
424f937c2b drivers/clock_control: stm32u5: Add support for optional clocks config
This change updates stm32u5 driver to support configuration of
optional clocks on peripherals.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
b22dd170e6 drivers/clock_control: stm32h7: Add support for CKPER clock mux
Add support for CKPER clock mux.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
d71b89b398 drivers: clock_control: Add STM32 clock multiplexer driver
Add a clock multiplexer driver.
Its only function is to select a clock input.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
0b65c1c619 drivers/spi: stm32: Use alt clock freq if available
Add support for an alternate clock. If available,
alternate clock is enabled and used to get the
device clock rate.

Fixes #41650

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Erwan Gouriou
833eda84d3 drivers/clock_control: stm32h7: Add support for alt clocks
Add support for alternate clocks configuration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-05-10 18:42:30 +02:00
Michal Sieron
eff89c6b24 drivers: timer: litex_timer: Fix sys_clock_cycle_get functions
e8e88dea incorrectly changed registers
used in `sys_clock_cycle_get(32|64)` functions.

This commit fixes that.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-10 18:41:20 +02:00
Bernardo Perez Priego
2fc78a9b39 drivers: adc: Add threshold_reg_offset to NPCX adc config structure
ADC threshold control register offset is provided by devicetree, this
change will add this property into `adc_npcx_config` structure and
update macro to access register accordingly. Driver behavior is not
meant to be impacted.

Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
2022-05-10 18:40:24 +02:00
Bernardo Perez Priego
aa875b3766 drivers: adc: Add threshold_count to NPCX adc config structure
Number of supported ADC thresholds is provided by devicetree, this
change will add this property into `adc_npcx_config` structure and
replace macro usage. Driver behavior is not meant to be impacted.

Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
2022-05-10 18:40:24 +02:00
Jordan Yates
95d8deb572 modem: modem_iface_uart_async: added
Adds a communications backend based on the asynchronous UART API,
instead of the interrupt-driven UART API. The primary advantage of this
backend is an improved robustness to dropping bytes under high interrupt
or critical section loads.

Under all loads system efficiency is improved by:
 * Reducing the time spent writing out individual bytes.
 * Reducing the number of UART interrupts fired.
 * Waking up the RX thread much less often.

When utilising this backend over `nordic,nrf-uarte` on a nRF52840, the
baudrate of an esp-at modem could be pushed to at least 921600 without
dropping bytes, compared to a maximum of 230400 with the interrupt API.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 10:44:04 +02:00
Jordan Yates
5228de3af5 modem: choice symbol for UART backend
Add a choice symbol that is used to select which UART backend to use.
This allows backends that don't use the interrupt API to be implemented.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 10:44:04 +02:00
Jordan Yates
a6081eeedf wifi: esp_at: fix pointer logging
Use the proper `%p` printf specifier when printing memory addresses,
instead of casting to an integer, which may not be the same size as a
pointer.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 10:44:04 +02:00
Jordan Yates
a9087936ac serial: test: update selected symbols
Pretend that the serial test driver supports the interrupt and async
API's, as these can be required for various drivers. Also select
`SERIAL_HAS_DRIVER` so that the serial library will be included.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 10:44:04 +02:00
Jordan Yates
7a86ee50fd serial: litex: remove irrational dependency
Depending on `!SERIAL_SUPPORT_INTERRUPT` to enable the driver does not
make any sense, as this is a symbol selected by drivers to signify that
they support interrupts. Simply not selecting this symbol is enough to
convey the desired intention.

This fixes Kconfig problems when the driver is compiled together with
a dummy serial driver which does select `SERIAL_SUPPORT_INTERRUPT`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-10 10:44:04 +02:00
Georgij Cernysiov
64c804ad3b drivers: uart_stm32: fix device is ready for tx dma in async init
Fixes TX DMA device is ready check in async initialization function.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-09 11:55:20 -05:00
Gerard Marull-Paretas
0e5bc82b84 drivers: pinctrl: it8xxx2: update include paths
Use the <zephyr/...> prefix.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 12:45:29 -04:00
Gerard Marull-Paretas
e00ad413d9 drivers: hwinfo: mcux: update include paths
Use the <zephyr/...> prefix.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 12:45:29 -04:00
Gerard Marull-Paretas
4b91c2d79f asm: update files with <zephyr/...> include prefix
Assembler files were not migrated with the new <zephyr/...> prefix.
Note that the conversion has been scripted, refer to #45388 for more
details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-09 12:45:29 -04:00
Daniel DeGrasse
5ee93929b9 drivers: memc: don't check pin control return code
Some SOCs, such as the RT1064 and RT1024, use internal flash and don't
define pinmux settings for the flexspi. Don't check the return code of
pinctrl_apply_state, because the flexspi driver will fail to initialize
when the pin mux settings are simply not required.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-09 08:54:30 -05:00
Daniel DeGrasse
e2fe582d62 drivers: sdhc: Add SD response type masks
Add SD response type masks, to allow drivers to mask out the
SPI or SD native mode response type based on the SD host controller
mode they use.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-09 08:46:29 -05:00
Henrik Brix Andersen
ebbb4b67b9 drivers: can: sam: use UPLL clock instead of PLLA clock
Use the UPLLCK clock for the CAN controller as recommended by the Atmel SAM
E70 data sheet.

Move the configuration of the clock prescaler from Kconfig to devicetree
and limit it to the values recommended by the SAM E70 datasheet.

Fixes: #45012

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-09 09:27:40 +02:00
Andrzej Głąbek
5d9e31e739 drivers: pinctrl_nrf: Add missing break statements
This is a follow-up to commit fd7633126e.

For some reason the above commit added several switch cases without
required break statements. In effect, the same pin could get assigned
to multiple signal lines in QDEC or QSPI peripherals if not all pins
were defined for them in devicetree, and consequently these peripherals
could not work properly.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-05-09 09:26:34 +02:00
Ryan Erickson
ab9715031c modem: hl7800: fix UART shutdown
Allow CTS line to determine UART shutdown for any sleep mode.
This allows lower average current consumption for LITE
HIBERNATE mode.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-05-06 20:17:23 +02:00
Gerard Marull-Paretas
fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Kamil Piszczek
d87552a128 drivers: bluetooth: hci: rpmsg: use chosen to abstract ipc instance
Added chosen syntax in Device Tree to abstract the IPC device that is
used with the IPC service module in the Bluetooth HCI RPMsg driver.
Ported affected boards to declare this alias.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2022-05-06 14:15:27 +02:00
Daniel DeGrasse
58a2b15972 drivers: hwinfo: implemented hardware info support for RT11xx SOC
RT11xx SOC uses same system reset controller as RT10xx series. Add
support for SRC on RT11xx

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-06 11:33:26 +02:00
Jordan Yates
9b59721ab3 power_domain: gpio: update include paths
Update the Zephyr include paths to be compatible with removing
`CONFIG_LEGACY_INCLUDE_PATH` in the future.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-06 11:33:10 +02:00
Jordan Yates
d1ab0f6b6e power_domain: gpio: use on-off and startup time
Respect the configured values for how long the domain takes to turn on,
and how long the domain needs to be off for before it can be repowered.

As these actions can block, guard the transition function with
pm_device_action_can_block. To avoid system PM being able to turn the
domain off but not back on again, guard the entire implementation.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-06 11:33:10 +02:00
Jordan Yates
31ad7e2bd4 power_domain: gpio: remove unused strings
Remove unused power domain transition strings.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-05-06 11:33:10 +02:00
Tim Lin
4cf45f4770 ITE: drivers/pinmux: Remove it8xxx2 pinmux driver
Remove the driver related it8xxx2 pinmux.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
bd8afe7ef0 ITE: drivers/kscan: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
3670977158 ITE: drivers/peci: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
5551872047 ITE: drivers/sensor: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
8ecd5bb2f7 ITE: drivers/pwm: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
64ff1a8efe ITE: drivers/i2c: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
74321f11d6 ITE: drivers/adc: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
07d9a4292d ITE: drivers/serial: Use pinctrl instead of pinmux driver
Use pinctrl instead of pinmux driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Tim Lin
efaeed6cb2 ITE: drviers/pinctrl: Add pinctrl driver for IT8XXX2
Add pinctrl driver for ITE IT8XXX2.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-05-06 11:32:40 +02:00
Maureen Helm
f4a0854481 drivers: dai: Use dt_compat_enabled for Intel SSP driver default
Enables the Intel SSP driver by default when the DAI driver class is
enabled (CONFIG_DAI=y) and a compatible devicetree node
("intel,ssp-dai") is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-05-06 11:32:04 +02:00
Michal Sieron
72a2ec253e clock_control: litex: Use register names
Use `DT_REG_ADDR_BY_NAME` and `DT_REG_SIZE_BY_NAME` to access register
properties from dts.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-06 11:31:54 +02:00
Michal Sieron
bd892bd963 ethernet: eth_liteeth: Add and use register names
Adds addresses and names for individual CSR registers to device tree.
This way liteuart driver no longer depends on CSR data width being 8
bits.
Also when register names or their number changes, then overlay generated
by LiteX will be incompatible with one defined here.
This should make finding breaking changes easier.

I also appended `_ADDR` suffix to defines, to distinguish them from
normal values like `LITEETH_EV_RX`.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-06 11:31:54 +02:00
Michal Sieron
081e201219 serial: uart_liteuart: Add and use register names
Adds addresses and names for individual CSR registers to device tree.
This way liteuart driver no longer depends on CSR data width being 8
bits.
Also when register names or their number changes, then overlay generated
by LiteX will be incompatible with one defined here.
This should make finding breaking changes easier.

I also appended `_ADDR` suffix to defines, to distinguish them from
normal values like `UART_EX_TX`.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-06 11:31:54 +02:00
Michal Sieron
e8e88dead9 timer: litex_timer: Add and use register names
Adds addresses and names for individual CSR registers to device tree.
This way timer driver no longer depends on CSR data width being 8 bits.
Also when register names their number changes, then overlay generated by
LiteX will be incompatible with one defined here.
This should make finding breaking changes easier.

I also updated register names to those used in current LiteX and
appended `_ADDR` suffix to defines which lacked them.

Because register `total` was renamed to `value` and `update_total` to
`update_value` I updated variables accordingly as well.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-05-06 11:31:54 +02:00
Dino Li
3f6be01484 it8xxx2: espi/kbc: read kbc event type before read input buffer
Host might send command or data immediately after EC read the
KBC input buffer (IBF gets cleared).
This change make sure EC won't get wrong event type in IBF ISR.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-05-06 11:31:13 +02:00
Georgij Cernysiov
1520820bff drivers: pwm: stm32: fix PWM channel disabling
Move period and pulse computation to right before
the channel enable code.

That fixes the inability to disable the channel by
providing the period of 0.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-05-05 14:36:56 -05:00
Peter Maxwell Warasila
c91a70e130 driver: can: stm32fd: add stm32u5 clock selection
The STM32u% series of processors has a unique set of clock sources for
the FDCAN peripheral. This brings the selection in line with the
existing can_stm32fd clock selection Kconfigs.

This change was tested on a proprietary board using the STM32U5 series
which exposes the CAN pins of the SOC using a transciever on a live CAN
bus as well as on the nucleo_g474re board from ST in loopback mode.

HSE and PLL1Q tests run and all passed.

PLL2P is not currently supported by the clock drivers for STM32U5, and
as such is currently untested. When this support is added, the driver
should be able to use this clock without issue.

When changes from #42097 are merged this fix should be deprecated in
favor of using the methods outlined there.

Signed-off-by: Peter Maxwell Warasila <madmaxwell@soundcomesout.com>
2022-05-05 14:35:37 -05:00
Henrik Brix Andersen
64c9fadc7c drivers: pwm: rv32m1: tpm: add pinctrl support
Add pinctrl support to the OpenISA RV32M1 TPM PWM driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Henrik Brix Andersen
c83a0d5d1f drivers: spi: rv32m1: lpspi: add pinctrl support
Add pinctrl support to the OpenISA RV32M1 LPSPI SPI driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Henrik Brix Andersen
7b33d4af6c drivers: i2c: rv32m1: lpi2c: add pinctrl support
Add pinctrl support to the OpenISA RV32M1 LPI2C I2C driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Henrik Brix Andersen
738e9f57f9 drivers: serial: rv32m1: lpuart: add pinctrl support
Add pinctrl support to the OpenISA RV32M1 LPUART serial driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Henrik Brix Andersen
9ba953d13a drivers: gpio: rv32m1: configure pin mux as GPIO
Set the PCR[MUX] field to kPORT_MuxAsGpio as part of configuring a GPIO
pin. This removes the need to explicitly call pinmux_pin_set() in board
code.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Henrik Brix Andersen
1dc3b237fa drivers: pinctrl: add OpenISA RV32M1 pinctrl driver
Add OpenISA RV32M1 pinctrl driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-05-05 13:34:39 -05:00
Tom Burdick
6913da9ddd logging: cAVS HDA based logger
Adds a log backend that maintains a ringbuffer in coordination
with cAVS HDA.

The DMA channel is expected to be given some time after the logger
starts so a seperate step to initialize the dma channel is required.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-05-04 18:56:13 -04:00
Daniel DeGrasse
2551a75c9e boards: imx_rt: Don't default FLASH_MCUX_FLEXSPI_XIP to enabled
Do not default FLASH_MCUX_FLEXSPI_XIP to enabled when code is not
located in flash, this will cause issues if code is executing from ITCM,
as the zephyr_code_relocate macro will relocate the flash driver code
into itcm, and overwrite the zephyr image.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-04 10:46:03 -05:00
Ryan Erickson
b8aa44ec46 modem: hl7800: do not query SIM if not present
Do not query SIM card parameters if the SIM
card is not present.
This shortens the driver initialization time
significantly if a SIM card is not present.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-05-04 09:49:17 -05:00
Daniel Leung
170c9026cb counter: cmos: use device tree to instantiate driver
This changes the CMOS RTC driver to use device tree to
instantiate the driver instance.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-05-04 09:42:26 -05:00
Bernardo Perez Priego
4c34331b4c drivers: sensor: Store sensor trigger structure reference for client use
Store sensor trigger structure reference provided on `trigger_set`, and
pass reference back to client when trigger callback is invoked.

This will enable client to use `CONTAINER_OF()` inside its trigger
callback code.

Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
2022-05-04 09:22:52 -05:00
Andrei Emeltchenko
f6069aa8fa edac: ibecc: Add support for EHL SKU13, SKU14, SKU15
Add support for missing EHL SKUs. The information about SKUs is
already public and available in Linux kernel:
https://github.com/torvalds/linux/blob/
38f80f42147ff658aff218edb0a88c37e58bf44f/drivers/edac/
igen6_edac.c#L197-L208

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-05-04 08:05:02 -05:00
Jan Peters
253cec5c95 drivers: counter: add driver for NXP QTMR counters
The driver is implemented using the MCUXpresso SDK.

Signed-off-by: Jan Peters <peters@kt-elektronik.de>
2022-05-03 20:41:23 -05:00
Jay Vasanth
b7f60b2354 drivers: ps2: Microchip XEC PS2 driver add PINCTRL support
Add optional PINCTRL support to the Microchip XEC PS2 driver
shared between MEC15xx and MEC172x families.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-05-03 14:13:20 -05:00
Jay Vasanth
60a41f6878 drivers: ps2: Microchip XEC PS2 add MEC172x support
Update the Microchip XEC PS2 driver to support MEC172x.
NOTE: MEC15xx has two PS2 controllers and
MEC172x has one.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-05-03 14:13:20 -05:00
Jay Vasanth
bacf4ff730 drivers: ps2: Standarize device tree and structure
Standardize PS2 device tree properties. Standardize device
structure usage. Abstract GIRQ and PCR register access.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-05-03 14:13:20 -05:00
Daniel DeGrasse
e8f7181c50 drivers: flash_mcux_flexspi_mx25um51345g: move all device data to RAM
since the flexspi driver interacts with the flash device, storing
device data in flash can cause RWW hazards when running in XIP mode.
Move all device data to RAM to limit these RWW hazards.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-03 13:38:55 -05:00
Daniel DeGrasse
836f0f5ee5 drivers: flash_mcux_flexspi_hyperflash: move all device data to RAM
since the flexspi driver interacts with the flash device, storing
device data in flash can cause RWW hazards when running in XIP mode.
Move all device data to RAM to limit these RWW hazards.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-03 13:38:55 -05:00
Daniel DeGrasse
7aa883b5df drivers: flash_mcux_flexspi_nor: Move all device data to RAM
Move all device data to RAM. Since the flexspi driver accesses the
flash device that is being used for XIP, various RWW hazards can occur
if the flexspi driver is interacting with the flash device, while
running in XIP mode.

Fixes #45182

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-03 13:38:55 -05:00
Bernardo Perez Priego
cfe4d51b4f drivers: sensor: Add adc-comparator binding and implementation for NPCX
Comparator will monitor signal though ADC channel, based on
user configuration, callback will be triggered.
This will enable comparator functionality for nuvoton MCU utilizing its
ADC threshold detection feature. Implementation is exported through
sensor trigger API. Use of CONFIG_ADC_CMP_NPCX is required.

Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
2022-05-03 08:51:53 -05:00
Sam Hurst
3122a2c8b8 drivers: adc: Refactor code to remove warning
Refactor code so that an unused variable 'adc' warning
is not generated when building for CONFIG_SOC_SERIES_STM32G4X
and not using adc1 or adc5.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-05-03 09:37:28 +02:00
Henrik Brix Andersen
41a77be91c drivers: can: mcan: add shared initializer macros
Add shared initializer macros for struct can_mcan_config and struct
can_mcan_data.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-03 09:36:34 +02:00
Henrik Brix Andersen
5b3712a9ac drivers: can: mcan: refactor to get rid of wrapper functions
Refactor the Bosch M_CAN shared driver functions to get rid of the
front-end driver wrapper functions.

This requires flipping the relationship between shared config/data
structs and front-end config/data structs. Front-end drivers can now
store a pointer to their custom config/data structs in the .custom
fields of the can_mcan_config and can_mcan_data data structures.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-03 09:36:34 +02:00
Henrik Brix Andersen
7ea0951052 drivers: can: mcan: rename private header file
Rename the private header file for the Bosch M_CAN shared driver code
from can_mcan_int.h to can_mcan_priv.h to follow the common naming
scheme.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-05-03 09:36:34 +02:00
Mahesh Mahadevan
8566b00df3 drivers: counter: Add error checking to MCUX CTImer
Improve the error checking for the set_top_value function.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-05-02 13:33:54 -05:00
Daniel DeGrasse
a24f9f2e5a drivers: pinctrl: update help text for mcux rt pinctrl driver
update help text for mcux rt pinctrl peripheral driver, to clarify it
does not support RT600/RT500 parts and only RT1xxx series parts.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-02 13:28:10 -05:00
Daniel DeGrasse
dc9c886683 drivers: gpio: gpio_mcux_lpc: add pinmux setting support for IOPCTL
add support for setting pinmux when using IOPCTL peripheral, as well as
setting pin configuration properties.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-02 13:28:10 -05:00
Daniel DeGrasse
d5b719e084 drivers: pinctrl: add pin control driver for NXP RT600/RT500 SOCs
add pincontrol headers for IOCON peripheral present on NXP iMX RT600
and RT500 SOCs, and update LPC pin control driver for iMX RT family
differences.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-02 13:28:10 -05:00
Sylvio Alves
7022dcfd95 drivers: flash: esp32: add flash encryption support
Add flash encryption function check to redirect
flash write and read calls properly.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-05-02 10:30:24 -05:00
Sylvio Alves
6c6b688b91 driver: spi: esp32: update flash driver to use hal
This modification is required to enable flash encryption.
Using hal implementation of spi_flash calls maintains
compability amongs different socs while offering
latest esp-idf enhancements.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-05-02 10:30:24 -05:00
Francois Ramu
c2db84ee8a drivers: watchdog: stm32 iwdg starts with timeout install
It Follows the sequence to configure and launch the IWDG watchdog
for the stm32 mcus

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-02 10:27:44 -05:00
Francois Ramu
005968a81f drivers: dma: stm32 driver is using the STM32_DMA_STREAM_OFFSET
Includes the definition of the STM32_DMA_STREAM_OFFSET
depending on the peripheral to adjust the first DMA channel
in the list of streams.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-02 10:57:15 +02:00
Jun Lin
788714de20 driver: clock_control: npcx: don't gate the eSPI clock if eSPI is defined
In the EC application, the system may jump between two built Zephyr
images when necessary. If we gate the eSPI clock at initialzation, it
will make the eSPI configuration which established by previous image
break and lost the communication between EC and host.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-05-02 10:56:36 +02:00
Daniel DeGrasse
102f4c25f8 drivers: disk: remove legacy SDMMC SPI driver
remove existing SDMMC SPI driver, since it is replaced by the SPI mode
SD host controller driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
c91d473ead drivers: imx_usdhc: change DT_COMPAT string to imx-usdhc
with the legacy USDHC driver fully removed from the tree, the
nxp,imx-usdhc binding can now be used for the new SD host controller
driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
409cc23022 drivers: disk: remove legacy nxp USDHC driver
all in tree SOCs with the USDHC peripheral have now been converted to
use the new SD host controller USDHC driver, so remove legacy NXP disk
USDHC driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
a3182ced7a drivers: sdhc: add SD SPI mode host controller driver
Add SDHC driver implementing spi mode support for SD cards. This driver
implements the standard SD host controller APIs, and sets the host
property "is_spi" to indicate to the SD subsystem the card will be
running in SPI mode.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
a18338bf45 soc: rt11xx: Enable USDHC SD host controller on RT1170
Enable SD host controller driver for RT1170, so the EVK can use the new
SD subsystem.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
a79f485487 drivers: disk: add SDMMC zephyr disk driver
Add generic sdmmc zephyr disk driver, which uses the SDMMC subsystem

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Daniel DeGrasse
6aaa2b5d33 drivers: sdhc: Implement NXP USDHC SDHC driver
Implement SDHC driver for NXP USDHC peripheral, supporting all api calls
available in the sdhc driver. This implementation leverages NXP's HAL,
and simply implements a shim layer over the HAL itself.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 14:21:36 -05:00
Michal Sieron
5098aaa2d1 hwinfo: hwinfo_litex: Make compatible with both 8 and 32-bit CSRs
LiteX CSRs can only be accessed on addresses aligned to 4 bytes.
That's why in 32-bit CSRs case there is bit shifting needed.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
2485c0232b pwm: pwm_litex: Use LiteX HAL
Removed register sizes from config struct, as they are known.
This allowed to remove driver specific function reading from CSR and use
`litex_write*` functions from LiteX HAL.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
0bfa223c68 entropy: entropy_litex: Use LiteX HAL
Use `litex_read` instead of separate implementation in driver.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
34a4b2b916 serial: uart_liteuart: Use LiteX HAL
Use LiteX HAL functions instead of `sys_read*` or `sys_write*`
functions.
They use them inside, but choose which one to use according to
configured CSR data width.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
e3db9a49c8 ethernet: eth_liteeth: Avoid bitwise operations
With universal LiteX HAL working, there is no need to perform multibyte
reads and writes using bitwise operations.
Just use appropriate `litex_read*` or `litex_write*` function.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
0c738b7f79 ethernet: eth_liteeth: Use LiteX HAL
Use LiteX HAL functions instead of `sys_read*` or `sys_write*`
functions.
They use them inside, but choose which one to use according to
configured CSR data width.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
b9c836b70a timer: litex_timer: Use LiteX HAL
Use LiteX HAL functions instead of `sys_read*` or `sys_write*`
functions.
They use them inside, but choose which one to use according to
configured CSR data width.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Michal Sieron
2e9154a418 soc: litex-vexriscv: Rewrite litex_read/write
Changes signature so it takes uint32_t instead of pointer to a
register.
Later `sys_read*` and `sys_write*` functions are used, which cast
given address to volatile pointer anyway.

This required changing types of some fields in LiteX GPIO driver and
removal of two casts in clock control driver.

There was a weird assert from LiteX GPIO driver, which checked whether
size of first register in dts was a multiple of 4.
It didn't make much sense, so I removed it.

Previous dts was describing size of a register in terms of subregisters
used. New one uses size of register, so right now it is almost always
4 bytes.

Most drivers don't read register size from dts anyway, so only changes
had to be made in GPIO and clock control drivers.

Both use `litex_read` and `litex_write` to operate on `n`bytes.
Now GPIO driver calculates this `n` value in compile time from given
number of pins and stores it in `reg_size` field of config struct like
before.

Registe sizes in clock control driver are hardcoded, because they are
tied to LiteX wrapper anyway.

This makes it possible to have code, independent of CSR data width.

Signed-off-by: Michal Sieron <msieron@internships.antmicro.com>
2022-04-29 16:11:53 +02:00
Benedikt Schmidt
86469b1d0b drivers: clock_control: Make LSE driving configurable
Make the LSE driving capability configurable for the STM32 series.
Fixes #44737.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-04-29 16:11:34 +02:00
Yong Cong Sin
fbd0cd01d5 drivers: sensor: stm32_temp: setup channel before adc_read
Currently the driver only setup the ADC to read from the
internal temperature channel on init. However, it is possible
that some other application that uses the ADC can setup the
ADC to read from some other channel and therefore subsequent
stm32_temp_sample_fetch will fail to read the targeted channel.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-04-29 16:10:51 +02:00
Yong Cong Sin
94624dc0c5 drivers: sensor: stm32_temp: No need to calibrate ADC
The ADC should be calibrated on init, there is no requirement
to calibrate ADC again on stm32_temp_init, remove it.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-04-29 16:10:51 +02:00
Adrien Rouault
bc47f66062 drivers: lora: sx127x: fix missing reset gpio instantiation
Instantiate the value of `sx127x` reset GPIO

Signed-off-by: Adrien Rouault <adrien.rouault@nemeus.fr>
2022-04-29 15:30:10 +02:00
Henrik Brix Andersen
44f3f2e49b drivers: can: initialize CAN transceivers prior to CAN controllers
Change the default initialization priority for CAN transceiver from 70 to
45 to initialize them before the CAN controllers (with default a
initialization priority of 50).

Fixes: #45219

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-04-29 12:34:28 +02:00
Francois Ramu
41efe865ed drivers: dma: stm32 dma driver valid override control
This change is controlling of function parameters before
configuring the STM32_DMA_HAL_OVERRIDE mode.
Then, in case the DMA channel is not valid (wrong ID) or busy,
an error occurs before overriding the DMA channel.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-04-29 08:56:55 +02:00
Esteban Valverde
426c1f6aff drivers: i2c: Fix get_regs() to happen after DEVICE_MMIO_MAP
Fixing a bug where get_regs() was being executed before MMIO mapping
moving the declaration of reg_base after DEVICE_MMIO_MAP

Signed-off-by: Esteban Valverde <esteban.valverde.vega@intel.com>
2022-04-29 08:56:49 +02:00
Daniel DeGrasse
b0ec63fe01 drivers: led_pwm: fix build error
Remove stray parenthesis causing build error in led_pwm driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-29 08:56:42 +02:00
Leonard Pollak
35b55175cc drivers: sensor: bme680: Add SPI interface
This enables the SPI interface for the BME680 sensor driver.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2022-04-28 18:11:50 +02:00
Leonard Pollak
4e804bfa73 drivers: sensor: bme680: prep work
Consolidate the initialization routines and change the include guard to
conform with the coding guidelines as a preparation for the following
commits which add support for the SPI interface.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2022-04-28 18:11:50 +02:00
Leonard Pollak
8e7907aa6f drivers: sensor: bme680: fix constants
This fixes the constant for the mem page and replaces a
magic number with the already defined `BME680_LEN_COEFF2` constant.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2022-04-28 18:11:50 +02:00
Carlo Caione
69b28bfd07 pm: policy: Consider substates for state lock functions
Extend the current pm_policy_state_lock_*() functions to support
substates.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-04-28 16:32:23 +02:00
Gerard Marull-Paretas
04836af2a9 drivers: pwm: shell: fix pwm_set calls
PWM has a single set function now, macros like PWM_USEC() can be used to
specify other units than nanoseconds. This conversion was missed during
API updates.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 09:08:41 -04:00
Gerard Marull-Paretas
61f2ed8356 drivers: pwm: shell: fix struct variable name
The pwm field in struct args_index was missed when pwm was renamed to
channel in all drivers. As a result, the PWM shell could no longer be
built.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-28 09:08:41 -04:00
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
Erwan Gouriou
30f0af97f8 drivers/clock_control: stm32 common: Factorize flash latency setting
Make use of LL_SetFlashLatency in all cases to update flash latency.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
4b062ca15e drivers/clock_control: stm32 common: Factorize freq bus setting
Factorize setting of frequency for busses.
Additionally, factorize SysCoreClock update.

The operations are now done twice in case of PLL since they are part
of LL utils PLL configuration function, but they are removed in next
commits.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
d04802283b drivers/clock_control: stm32 common: Don't disable fixed clocks
Each clock should be configured individually by device tree,
don't disable them blindly.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
8594be2cb3 drivers/clock_control: stm32u5: Use fixed clocks set up to configure PLLs
Take advantage of previous work to configure PLL and remove
usage of LL_PLL1_ConfigSystemClock_FOO utils functions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
e97d608282 drivers/clock_control: stm32u5: Clean up fixed clocks functions.
Now that fixed clocks are enabled in a single function, a
bunch of functions could now be removed.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
ebb1d79e8f drivers/clock_control: stm32u5: Move clock init to a single function
Move fixed clocks initialization to a single function.
Benefit is they could now be enabled independently of the
main clock configuration based on dts status and then be
used by peripherals even is not part of the main clock tree.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
30b3a5ffe7 drivers/clock_control: stm32u5: Centralize regu voltage setting
Similar to other general settings, centralize regu voltage
setting.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
6dfe13120c drivers/clock_control: stm32u5: Centralize flash_latency update
Flash latency setting could be factorized in a single location,
rather than split in each clock setting function.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
7175da2645 drivers/clock_control: stm32u5: Don't disable other clocks
Don't disable other clocks after a clock is configured.
This should be left to the API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
41ecdb9d14 drivers/clock_control: stm32u5: Factorize bus prescalers settings
Move prescaler settings to the clock_control_init function.
At this step they will be set up twice in PLL case, this will
be fixed in a next step.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
2efcabbc4c drivers/clock_control: stm32u5: Update SystemCoreClock at a single place
Move update of CMSIS variable SystemCoreClock at a single place
in a more direct way.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
0c60fcd40d drivers/clock_control: stm32u5: Use new clock bindings
This change updates stm32u5 driver to make use of new clock bindings.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
bc37d41051 drivers/clock_control: stm32h7: Fixes on function declarations
Fix minor issues on some functions headers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Erwan Gouriou
61a9016f88 drivers/clock_control: stm32h7: Change clock bus bindings values
Set bus binding values using registers offset values.
As a consequence update driver to take this into account
in clock_on and clock_off functions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-04-21 14:09:44 +02:00
Thomas Altenbach
c5ebea590f drivers/flash: stm32h7: fix fault when cache disabled
Add a check to avoid invalidating the cache when the latter is disabled.
Indeed, doing so can lead to a bus fault.

Signed-off-by: Thomas Altenbach <taltenbach@witekio.com>
2022-04-21 13:05:08 +02:00
Jordan Yates
f280114f0e console: semihost_console: use semihost API
Update the semihost_console implementation to use the semihost API
instead of manually constructing the supervisor calls.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-04-21 13:04:52 +02:00
Jordan Yates
070422db46 arch: common: dedicated SEMIHOST symbol
Control the usage of semihosting with a dedicated symbol, instead of
implying semihosting from the usage of `SEMIHOST_CONSOLE`. This allows
semihosting to be used without the semihost console.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-04-21 13:04:52 +02:00
Mateusz Sierszulski
06e4f36b4b fpga controller: drivers: add ZynqMP driver
This commit adds support for fpga driver on ZynqMP SoC.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-04-21 13:00:57 +02:00
Henrik Brix Andersen
e4c93c3a60 drivers: can: mcp2515: do not soft-reset device when changing timing
Do not soft-reset device when changing timing parameters as the
soft-reset will discard the configured CAN controller mode.

Fixes: #44837

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-21 13:00:46 +02:00
Henrik Brix Andersen
45d4909024 drivers: can: stm32fd: rename CONFIG_CAN_STM32_CLOCK_DIVISOR
Rename CONFIG_CAN_STM32_CLOCK_DIVISOR to
CONFIG_CAN_STM32FD_CLOCK_DIVISOR to match driver Kconfig name.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-21 13:00:20 +02:00
Henrik Brix Andersen
322b436b30 drivers: can: stm32fd: add clock source selection
Add support for selecting the CAN clock source. Change previously
hardcoded value of PCLK1 to HSE.

Fixes: #44985

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-21 13:00:20 +02:00
Andreas Pettersson
cd9c82bff2 drivers: sensor: lsm6dso: Remove usage of undefined variable
Remove usage of undefined variable, and remove unused variable.

Fixes issue https://github.com/zephyrproject-rtos/zephyr/issues/42588

Signed-off-by: Andreas Pettersson <andreaspettersson95@gmail.com>
2022-04-20 08:59:35 -05:00
Glauber Maroto Ferreira
7064e31101 esp32: drivers: uart: remove uart_num
When using pin states, uart_num is no
longer required.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
84c6edd247 esp32: driver: pinmux: driver removal
Removal of ESP32's pinmux driver since it
was deprecated by pinctrl.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
5e549b57b6 esp32: drivers: gpio: remove pinmux dependency
Refactor the GPIO driver code to remove dependency
from the pinmux API.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
9354749cb5 esp32c3: drivers: spi: removal of unused definitions
Clean up of pin signals definitions previously used
by the pinmux driver, now deprecated by the use of
the pinctrl API.

Refactor device tree macros usage to make usage of
SPI instances more general.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
00bdbb52c5 esp32c3: drivers: pinctrl: initial support
add initial pinctrl driver support for ESP32C3.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
52dbd305da esp32s2: drivers: i2c: tweak FSM-related logic
Differently from ESP32, the ESP32-S2 SoC has native
hal support to reset its own I2C FSM in case of failure.
This commit removes warnings related to unused reset
logic, which does not really apply to ESP32-S2.

It also removes code and data structures related to pin
information from the build when the target SoC supports
hardware mechanisms to reset the I2C FSM.

Finally, it checks at compile time if the preconditions
for correct bus recovery are being met.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
6303118260 esp32s2: drivers: spi: removal of unused definitions
Clean up of pin signals definitions previously used
by the pinmux driver, now deprecated by the use of
the pinctrl API.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
2b44028777 drivers: pinctrl: esp32s2: initial support
add initial pinctrl driver support for ESP32S2.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
bcf79464fa esp32: drivers: i2c: use pinctrl
though using pinctrl's subsystem, the I2C driver
keeps pin information in case of communication
failure. This information is needed in case of
FSM failure.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
40a80d236e drivers: spi: esp32: use pinctrl API
and removes references/usage of old pinmux properties.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
a9aef448ab drivers: serial: esp32: use pinctrl API
and removes references/usage of old pinmux properties.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Glauber Maroto Ferreira
135f4f772a drivers: pinctrl: esp32: initial support
add initial pinctrl driver support for ESP32.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2022-04-20 13:27:47 +02:00
Robert Lubos
7946988b16 net: sockets: Add separate macro for registering offloaded sockets
Add a separate macro for registering offloaded sockets implementation,
along with information in the structure whether the implementation is
offloaded or not. This allows to differentiate between native and
offloaded socket implementations, which is critical for binding socket
API with an interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-04-20 11:27:05 +02:00
Robert Lubos
fa8ba73833 net: if: Connect interface with offloaded socket implementation
Instead of keeping a boolean informing whether a network interface is
offloaded at socket layer or not, keep a pointer to a function which
allows to create an offloaded socket. Native interfaces keep this as
NULL, while for offloaded interfaces it allows to connect an offloaded
socket implementation with an interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-04-20 11:27:05 +02:00
Daniel DeGrasse
916c059f3d drivers: pinctrl: update lpc pin control implementation to use offsets
update pin control implementation to use offsets for pin registers
instead of pin/port combination, to permit additional flexibility for
lpc devices with non contiguous register layouts. Update LPC55s69 pin
control names to align with newly generated pin control header.

This change also requires an update to the NXP HAL to use the new pin
control headers with offsets.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-19 15:53:50 -05:00
Henrik Brix Andersen
17dcc73944 drivers: can: mcp2515: fail when trying to set unsupported mode
Do not silently ignore attempts to set an unsupported mode. Return
-ENOTSUP instead.

Fixes: #44706

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-19 11:47:49 +02:00
Henrik Brix Andersen
3d433cca26 drivers: can: add missing can_get_max_filters() syscall handler
Add missing syscall verification handler for can_get_max_filters().

Fixes: #44687

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-19 11:47:40 +02:00
Henrik Brix Andersen
d311af4bf4 drivers: can: mcan: report error on no available extended CAN-ID filters
Only add the filter ID offset for extended CAN-ID filters if the filter
was added successfully. Raise log level from info to warning if filter
addition failed but only log it once.

Fix bounds check for removing an extended CAN-ID filter.

Fixes: #44721

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-19 11:47:40 +02:00
Henrik Brix Andersen
51053932a3 drivers: can: mcux: flexcan: fix mailbox allocation for errata 5461/5829
Commit a50b69dfb7 introduced a work-around
for FlexCAN errata 5461 and 5829, but neglegted to take the RX mailbox
offset into account when calculating maximum number of mailboxes
allocated for RX/TX.

Fixes: #44724

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-19 11:47:40 +02:00
Henrik Brix Andersen
085ee2b0b8 drivers: can: stm32: remove can_get_max_filters() support for now
Remove support for the optional API function can_get_max_filters() from
the STM32 bxCAN driver for now.

The function returns the Kconfig value for the maximum number of filters
but the true number of supported filters may be different due to the
filter nature of the STM32 bxCAN driver implementation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-19 11:47:40 +02:00
Georgij Cernysiov
cf9df290da drivers: memc: stm32: add FMC NOR/PSRAM driver
Adds STM32 FMC NOR/PSRAM controller driver.

The implementation follows FMC SDRAM driver
approach and uses HAL API. Tested on H7 series.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-04-19 11:47:06 +02:00
Henrik Brix Andersen
d5f3f20edb drivers: can: allow calling can_set_bitrate() from userspace
Add syscall to allow calling can_set_bitrate() from userspace.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-18 17:23:28 -07:00
Tom Burdick
2f320730a1 dma/cavs_hda: Adds link in/link out compatibles
Adds hda link in and out drivers. The link in and link
out channels of HDA have small differences
with the host channels. Updates the existing
cavs_hda drivers and code to account for these
differences.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-18 19:19:40 -04:00
Vaishnav Achath
98f1a98cf5 drivers: pinmux: remove cc13xx_cc26xx pinmux driver
all the consumers of the obsolete pinmux driver is
updated to use pinctrl API, this commit removes
the pinmux driver and assosciated sections.

Signed-off-by: Vaishnav Achath <vaishnav@beagleboard.org>
2022-04-18 18:19:46 -04:00
Vaishnav Achath
ace77c71e9 drivers: CC1XX/CC26XX based boards: transition to pinctrl driver
This commit has the necessary changes to update the consumers
of pinmux driver(SPI, I2C, UART) and update the board specific
files to use the pinctrl interface.

Signed-off-by: Vaishnav Achath <vaishnav@beagleboard.org>
2022-04-18 18:19:46 -04:00
Vaishnav Achath
e2ed8cf130 drivers: pinctrl: add CC13XX/CC26XX pinctrl driver
Add pinctrl driver for CC13XX/CC26XX family of SoCs
to facilitate transition from pinmux to pinctrl.

`IOCPortConfigureSet()` from TI hal driverlib used to
implement the generic pinctrl driver.

Signed-off-by: Vaishnav Achath <vaishnav@beagleboard.org>
2022-04-18 18:19:46 -04:00
Oliver Stäbler
74c1d35900 drivers: i2c: flexcomm: Add i2c slave support
Add i2c slave support to mcux_flexcomm driver.

Signed-off-by: Oliver Stäbler <oliver.staebler@bytesatwork.ch>
2022-04-15 14:07:30 -05:00
Georgij Cernysiov
3650664875 drivers: pwm: stm32: support counter modes
Adds support for different timer counter modes.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-04-15 11:59:16 -07:00
Georgij Cernysiov
366bf47c27 drivers: pwm: stm32: remove obvious comments
Removes obvious comments from the PWM
configuration struct.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-04-15 11:59:16 -07:00
Ruibin Chang
7b43deedd5 ITE drivers/watchdog: clean up the #ifdef
Use if(IS_ENABLED(...)) {...} instead.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-04-15 10:35:35 -07:00
Ruibin Chang
4aa6e98292 ITE drivers/kscan: clean up it8xxx2 kscan driver
1.Declare the member type to match the kscan_it8xxx2_regs, so
we needn't to transform the local structure in the function.
2.Stop using DRV_CONFIG, DRV_DATA, DRV_REG macros.
3.Delete unused register defines.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-04-15 10:35:35 -07:00
Bartosz Bilas
e4950bc729 drivers: serial: xen: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
6f6ef91fa7 drivers: watchdog: it8xxx2: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
7c77e7ee08 drivers: sensor: qdec_sam: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
f5f110bb36 drivers: pcie: iproc: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
fbb275d246 drivers: interrupt_controller: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
4e59730728 drivers: i2s: litex: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
ec9122b649 drivers: gpio: sx1509b: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
e627d409af drivers: gpio: pca95xx: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
1afccdf3f1 drivers: ethernet: stm32_hal: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
6540964e55 drivers: espi: xec_v2: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
4c033df0f5 drivers: espi: xec: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
c51210beb0 drivers: dma: mcxuc_edma: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Bartosz Bilas
55d4282e44 drivers: dac: sam0: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07:00
Nickolas Lapp
f1b0b458b0 uart_mcux_lpuart: Enable Asynchronous UART API.
This PR enables the Ansynchronous UART API for using the MCUX drivers.
It is tested on the RT1062EVKB.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2022-04-14 15:21:58 -05:00
Nickolas Lapp
c959ae81d6 dma_mcux_edma: Fixup Scatter-Gather EDMA Mode
This PR fixes up the Scatter-Gather EDMA mode for the MCUX EDMA Driver,
as well as enabling the dma reload feature for the same EDMA Driver.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2022-04-14 15:21:58 -05:00
Immo Birnbaum
673b79440f drivers: ethernet: xlnx_gem: remove unnecessary "EOF" comments
remove unnecessary EOF comment lines at the end of each file.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-04-14 14:43:52 -05:00
Tom Burdick
06cc6fe7a0 dma: dw: Use a LLI pool per device
Multiple instances of the device would have inadvertently shared the
LLI pool potentially causing nasty bugs.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-14 15:06:02 -04:00
Jaska Uimonen
8d38b64fdc drivers: dai: add dai driver subdir and ssp driver
Add Intel ssp driver using dai interface.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-04-14 11:42:08 -04:00
Henrik Brix Andersen
ce18e41400 drivers: can: mcux: flexcan: only initialize the FlexCAN IP once
Only initialize the FlexCAN IP core once since initialzing it has the
side effect of resetting the IP core and thus clearing previous settings
such as RX filters.

Fixes: #44680

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-14 09:06:11 +02:00
Francois Ramu
bf49a04dcf drivers: flash: stm32 definition of all registered bitfield
redefine all the stm32 flash register bit Name from
FLASH_NSCR_xxx to FLASH_STM32_FLASH_NSCR_xxx
in all the zephyr drivers.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-04-13 13:55:34 -07:00
Francois Ramu
623b0418b6 drivers: flash for the stm32l5x or stm32u5 serie with max 2MB
Adds the stm32u5 flash controller driver for this serie
to the existing stm32l5 flash driver part
Only 1 or 2 MB devices exist today (4MB is possible in the future).
This flash controller driver is adapted from the flash_stm32l5.c

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-04-13 13:55:34 -07:00
Francois Ramu
269adf5ca8 drivers: flash stm32 flash driver includes stm32u5 serie
This adds the stm32U5 soc family to the flash driver
The flash controller has particular register names in the Non-Secure
area to be adapted for the driver.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-04-13 13:55:34 -07:00
Attie Grande
cfad60d4dd spi: sam0: fix fast-rx path, and refresh comments
The SAM0 fast-path implementation was broken, and partially fixed in
commits 8181eed and 8a99bd0...

This patch resolves an issue where the MSB is always zero on SAML21
parts, and appears to follow suit with the previous patches.

This patch also refreshes the commentary, and removes mention of the
"interleaved" operation that is no longer used - which appears to have
been problematic in the past.

In addition to this, it also resolves an off-by-one error in both the
fast_rx and fast_rxrx paths, which would have been tripped when
transmitting a zero-byte buffer.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-04-13 13:32:45 -07:00
Henrik Brix Andersen
fba27b4bde drivers: can: change sample point for can_set_bitrate() at high bitrates
CAN in Automation (CiA) 301 v4.2.0 recommends a sample point location of
87.5% percent for all bitrates. However, some CAN controllers have
difficulties meeting this for higher bitrates.

Change can_set_bitrate() to use a sample point of 75.0% for bitrates
over 800 kbit/s, 80.0% for bitrates over 500 kbit/s, and 87.5% for all
other bitrates. This is in line with the sample point locations used by
the Linux kernel.

Regard a sample point error of more than +/- 5.0% as an error in setting
the bitrate. Previously, any sample rate error was accepted without
providing any feedback to the caller. This is in line with the CAN
sample point calculation criteria used by the Linux kernel.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-13 13:28:06 -07:00
Diogo Correia
70e1f97ca4 drivers: sensor: bmi160: fix waiting time before reading CHIP_ID
Value changed from 100us to 150us. Value was not enough upon softreset.
This value was arbitrarily chosen and should be changed if more
information on the subject is provided.

Fixes #43794

Signed-off-by: Diogo Correia <dcorreia@protonmail.com>
2022-04-13 12:57:31 -07:00
Hu Zhenyu
2824696d11 dts: mec172xevb_assy6906: Add pwm-0 alias to mec172xevb dts file
Enable tests/drivers/pwm/pwm_api test case on both west and twister

Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
2022-04-13 12:02:46 -05:00
Jay Vasanth
32bc328f8b espi: mec172x kbc: Enable custom configs
Enable custom configs for KBC IBF event data and KBC
OBF callback from ISR.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-13 08:52:57 -05:00
Jay Vasanth
b530be4591 espi: mec172x: kbc0_ibf_isr: read sts before data
Read KBC Status register before reading KBC Data register
in kbc0_ibf_isr; since read data will clear status.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-13 08:52:57 -05:00
Jay Vasanth
3abfb58741 espi: mec172x: Read ACPI EC data in IBF ISR
Handle ACPI EC0 and ACPI EC1 IBF ISR by reading input
data in the ISR

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-13 08:52:57 -05:00
Jay Vasanth
9431e7d128 espi: mec172x: (ACPI EC0 / custom) opcodes support
Add support for ACPI EC0 and custom opcodes

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-13 08:52:57 -05:00
Jay Vasanth
e24e643977 espi: align Mec172x ec_host_cmd_sram buffer
Make ec_host_cmd_sram[] buffer align on a 8-byte
boundary

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-13 08:52:57 -05:00
Jay Vasanth
a6f7158617 drivers: i2c: Microchip MEC172x support device tree clock frequency
Modify the Microchip MEC172x I2C driver to use the device tree I2C
clock-frequency property and driver initialization time. Also, fixed
missing idle scaling register programming.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-12 13:27:14 -05:00
Dominik Ermel
92b299ff28 drivers/flash/flash_shell: Check for read error before verification
The cmd_write contains write verification that compares what has
been written with what it can read; the flash read operation
status was not checked which means that the bus or communication
problem was reported the same way as malformed write.
There have also been some optimization done by removal
of multiplications.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-12 10:05:40 -05:00
Dominik Ermel
35616d1e63 drivers/flash/flash_shell: Write buff size dependent on shell
The commit changes default buffer size for flash write operations
to be CONFIG_SHELL_ARGC_MAX dependent; there is no point to define
buffer longer than number of write bytes that will be extracted
from command line arguments.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-04-12 10:05:40 -05:00
Dino Li
13a2e8200e it8xxx2: intc: ensure IER disabling to become effective
We put disabling SOC interrupt enable register (IER) sequence in
between disable and enable core's global interrupt to prevent race
condition.
After core interrupt enable instruction has been executed, the new
configuration of IER has not yet been fully processed due to
asynchronization between core and SOC's source clock.

If SOC interrupt is fired under the above condition, we will get
IRQ number 0 in ISR due to IER disabling taken effect.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-04-12 09:55:12 +02:00
Andrzej Głąbek
42275c263b drivers: pwm_nrf5_sw: Use the PPI FORK feature when available
This way, when RTC is used as the generator, one PPI channel per each
configured PWM channel can be saved.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-12 09:51:53 +02:00
Andrzej Głąbek
d683ad0300 drivers: pwm_nrf5_sw: Correctly use all channels provided by generator
Use compare channel 0 in the generator for handling the PWM period.
This way all other channels offered by the generator can be easily
used for handling pulses on particular PWM channels.
So far the driver allowed to configure more than 3 channels for certain
TIMER instances, but since channel 3 was always used for the period,
the generation could not work in such setups.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-12 09:51:53 +02:00
Andrzej Głąbek
f73618906d drivers: pwm_nrf5_sw: Correctly use allocated GPIOTE channels
The driver improperly uses the PWM channel index to reference
the GPIOTE channel to be used for the PWM signal generation.
Consequently, the PWM signal on a given channel can be correctly
generated only if both those indexes are by chance the same.
Fix this by switching to use the stored index of the actually
allocated GPIOTE channel.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-12 09:51:53 +02:00
Lingao Meng
37e561f42e Bluetooth: Host: Add choice select whether BT RX
Change CONFIG_BT_RECV_IS_RX_THREAD into a
choice:CONFIG_BT_RECV_CONTEXT with the following options
(names can be discussed further of course):

    CONFIG_BT_RECV_BLOCKING
    CONFIG_BT_RECV_WORKQ_BT
    CONFIG_BT_RECV_WORKQ_SYS

This way users would be able to choose what to run most of
the BLE stack on, they wouldn't be forced to a single model.

We would default to CONFIG_BT_RECV_BLOCKING so that we wouldn't
need to change the system workqueue stack size by default, instead
asking users to do so if they select the CONFIG_BT_RECV_WORKQ_SYS option

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-04-11 10:58:09 +02:00
Georgij Cernysiov
2dca9d859a drivers: memc: stm32: add support for st,mem-swap
Implements H7 FMC binding memory remap
or swap configuration.

Enables:
* sdram-sram - swaps the NOR/PSRAM and SDRAM banks.
* sdramb2 - remaps SDRAM bank 2.

Does nothing for 'disabled' value (default mapping, reset state).

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-04-09 12:58:57 +02:00
Mateusz Sierszulski
6d56b82942 drivers: fpga: connect dts node with fpga driver
This commit connects the eos_s3 fpga driver with fpga dts node.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-04-08 15:54:33 -07:00
Marcin Niestroj
bc5432bd43 wifi: simplelink: implement 'is_supported' socket offload cb
Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

Reuse switch statements checking valid parameter values that were
already part of simplelink_socket() function, by creating 3 helper
functions for conversion of each parameter (family, type and protocol)
from Zephyr to Simplelink values.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:24 -07:00
Marcin Niestroj
9531db73d0 wifi: eswifi: implement 'is_supported' socket offload cb
Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

There is explicit support for UDP, TCP and TLS on top of IPv4.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:24 -07:00
Marcin Niestroj
f9e2fad7e3 modem: quectel-bg9x: implement 'is_supported' socket offload cb
Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

There is explicit support for TCP on top of IPv4 and IPv6.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:24 -07:00
Marcin Niestroj
61dfdf1d60 modem: sim7080: implement 'is_supported' socket offload cb
Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

There is explicit support for UDP and TCP on top of IPv4 and IPv6.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:24 -07:00
Marcin Niestroj
a0c5c176a0 modem: ublox-sara-r4: implement 'is_supported' socket offload cb
Check if requested socket family, type and protocol are all supported by
the driver, instead of blindly acknowledging every possible variant.

There is explicit support for UDP, TCP and TLS on top of IPv4 and IPv6.
TLS seems to be supported only in 1.2 version, so allow just that
version.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:51:24 -07:00
Marcin Niestroj
a905ceb99e wifi: simplelink: use NET_SOCKETS_OFFLOAD_PRIORITY
Use NET_SOCKETS_OFFLOAD_PRIORITY instead of
NET_SOCKETS_OFFLOAD_PRIORITY, so that by default offloaded sockets will
be used instead of native sockets.

Addiitonally this allows to select relative priority of offloaded TLS
versus native TLS when used together with NET_SOCKETS_TLS_PRIORITY.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:50:11 -07:00
Marcin Niestroj
fe90e4932b wifi: eswifi: use NET_SOCKETS_OFFLOAD_PRIORITY
Use NET_SOCKETS_OFFLOAD_PRIORITY instead of
NET_SOCKETS_OFFLOAD_PRIORITY, so that by default offloaded sockets will
be used instead of native sockets.

Addiitonally this allows to select relative priority of offloaded TLS
versus native TLS when used together with NET_SOCKETS_TLS_PRIORITY.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:50:11 -07:00
Marcin Niestroj
19b75f47c0 modem: quectel-bg9x: use NET_SOCKETS_OFFLOAD_PRIORITY
Use NET_SOCKETS_OFFLOAD_PRIORITY instead of
NET_SOCKETS_OFFLOAD_PRIORITY, so that by default offloaded sockets will
be used instead of native sockets.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:50:11 -07:00
Marcin Niestroj
aae48b5c32 modem: sim7080: use NET_SOCKETS_OFFLOAD_PRIORITY
Use configurable NET_SOCKETS_OFFLOAD_PRIORITY instead of hardcoded value
in the driver itself. This allows to select relative priority of
offloaded TLS versus native TLS when used together with
NET_SOCKETS_TLS_PRIORITY.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:50:11 -07:00
Marcin Niestroj
6e81f891c6 modem: ublox-sara-r4: use NET_SOCKETS_OFFLOAD_PRIORITY
Use configurable NET_SOCKETS_OFFLOAD_PRIORITY instead of hardcoded value
in the driver itself. This allows to select relative priority of
offloaded TLS versus native TLS when used together with
NET_SOCKETS_TLS_PRIORITY.

Drop the build assert, as always prioritizing offloaded TLS over native
TLS should be application developer choice.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-04-08 15:50:11 -07:00
Konstantinos Papadopoulos
b8604024f7 drivers: display: stm32_ltdc temporary patch for LTDC clock
LTDC clock on F4/F7 series, is generated from PLLSAI which yet is not
implemented into Zephyr.

Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
2022-04-08 15:49:42 -07:00
Konstantinos Papadopoulos
5e519fef40 drivers: ILI9341 add interface control registers
This enables the option through dts to drive the display
with RGB interface.

Signed-off-by: Konstantinos Papadopoulos <kostas.papadopulos@gmail.com>
2022-04-08 15:49:42 -07:00
Mikkel Jakobsen
0b0c2e78e0 drivers: sensor: add icm42670 6-axis accelerometer driver
the icm42670 from Invensense/TDK is a 6-axis accelerometer with
gyroscope and temperature sensing capabilities.

this initial driver does not support the devices 2K FIFO or many of the
other advanced features. Instead, only basic features are implemented.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-04-08 15:49:08 -07:00
Jiafei Pan
07c6ad3349 divers: clock_control: refine multiple uart instance support
Refine the code to support multile uart instance.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2022-04-08 10:31:04 -05:00
Julien D'Ascenzio
2a510361a3 drivers: watchdog: iwdg_stm32: fix wdg install timeout
In the function iwdg_stm32_install_timeout, the test on watchdog ready
was inverted. So, if 2 successive calls were made to this function, the
value of the prescaler or counter reload was not taken into account.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2022-04-08 09:59:34 -04:00
Alexander Wachter
e24b087918 drivers: can: socketCAN: Move socket code to own file
Move the code for socket instanciation from each driver
to a generic driver, that makes an instance of a socketCAN
net device for the chosen node.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-04-08 09:31:51 +02:00
Lukasz Maciejonczyk
e661f6e96a drivers: ieee802154_nrf5: fix rx failure error propagation for CSL
For delayed reception only NRF_802154_RX_ERROR_DELAYED_TIMEOUT is
expected to happen, others rx errors should be handled in regular
manner.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-04-08 09:31:17 +02:00
Lukasz Maciejonczyk
55c3afab1c drivers: ieee802154_nrf5: add log for rx failure
Some failures are possible and expected from fime to time e.g.
NRF_802154_RX_ERROR_TIMESLOT_ENDED. Add informational log for the frame
reception failure to differentiate the specific case.
It can be helpful for analizing failure in network trafic.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-04-08 09:31:17 +02:00
Nicolas Pitre
5d929bac43 console: semihosting: add RISC-V support
The RISC-V version is supported by qemu and openocd.
Tested on qemu only.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2022-04-08 09:30:11 +02:00
Mahesh Mahadevan
a8f8c1c185 drivers: display: Add blanking support for NXP ELCDIF driver
Implement the blanking_on and blanking_off API functions for
NXP's MCUX ELCDIF display driver

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-04-07 16:37:50 -05:00
Titouan Christophe
93d06330c5 drivers: sensor: vl53l0x: add support to reprogram I2C address
The I2C address of the VL53L0X distance sensor can only be programmed
over the I2C bus. To do this:

1. The sensor is powered off or in standby mode
2. Power up the sensor, it boots with a default I2C address (0x29)
3. The I2C master sends a configuration command to set the new address
4. The sensor now communicates at the new address

In case there are more than one such sensor on the bus, they all have
the same address when starting up. We therefore need to first apply
step 1. on all of them. Then, sensor by sensor apply steps 2. to 4.

Because simple designs may not need to reprogram the address, we
introduce a new configuration option CONFIG_VL53L0X_RECONFIGURE_ADDRESS

If this setting is disabled, then the driver behaves as before.

If CONFIG_VL53L0X_RECONFIGURE_ADDRESS is enabled, then the driver does
the following:

- In vl53l0x_init(), apply step 1. This is done when the driver is
  brought up when starting the system
- in vl53l0x_start(), apply steps 2. to 4. This is done when fetching
  a sample, if the sensor has not been started yet.

Also, as cosmetic changes:
- add parenthesis around sub conditions in call to __ASSERT_NO_MSG
- gracefully handle unknown sensor channels in vl53l0x_channel_get

Signed-off-by: Titouan Christophe <moiandme@gmail.com>
2022-04-07 14:30:01 -05:00
Titouan Christophe
b2172b4251 drivers: sensor: vl53l0x: add driver support for multiple sensors
Up until now, the vl53l0x driver only supported a single device, ie.
the first entry st,vl53l0x in the device tree. To be able to use
multiple sensors at the same time, create one driver data instance per
vl53l0x node in the device tree. Also split the constant driver config
from the runtime data.

Because the vl53l0x address is only configurable with an I2C command,
and is not persisted if the sensor is rebooted, multiple sensors can
be handled only if either:
- They are on different I2C buses
- Their addresses are coonfigured (by some external code) before
  vl53l0x_init is called

Also use the i2c_dt_spec and gpio_dt_spec APIs, as it makes
the code more concise and readable.

Finally, to distinguish the logs mesages from different sensors,
prefix the text with the sensor name.

Signed-off-by: Titouan Christophe <moiandme@gmail.com>
2022-04-07 14:30:01 -05:00
Titouan Christophe
e24899a485 drivers: sensor: vl53l0x: wait only 2ms for tboot
As per the VL53L0X datasheet, in 2.9.1 "Power up and boot sequence",
time to boot is 1.2ms max, so we only have to wait at most 2ms.

Signed-off-by: Titouan Christophe <moiandme@gmail.com>
2022-04-07 14:30:01 -05:00
Titouan Christophe
1267d51dda drivers: sensor: vl53l0x: run uncrustify
Apply uncrustify on the driver source code before going further

Signed-off-by: Titouan Christophe <moiandme@gmail.com>
2022-04-07 14:30:01 -05:00
Joakim Andersson
2dae1823ab hwinfo: Add dependency handling for HWINFO_NRF in nonsecure
The limitation on HWINFO_NRF depending on not nonsecure was removed in
52be3030aa.
This caused problems when TF-M was not enabled.

This happens on the thingy53_nrf5340_cpuapp_ns board since this board
is not supported by TF-M.

Introduce proper dependency handling for the soc secure functions
to make HWINFO_NRF unavailable when no secure services exist in
nonsecure.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-04-07 11:02:52 -04:00
Khor Swee Aun
0431d10b10 drivers/serial: Extend Altera Jtag Uart driver support
Extend Altera Jtag Uart driver support without Altera HAL driver
by default. uart_altera_jtag_hal.c renamed to uart_altera_jtag.c and
new config, CONFIG_UART_ALTERA_JTAG_HAL is introduced to allow driver
to use Altera HAL driver when needed.

Signed-off-by: Khor Swee Aun <swee.aun.khor@intel.com>
2022-04-07 06:58:16 -04:00
Jordan Yates
ad25e77698 serial: uart_nrfx_uarte: async compilation warning
Only compile in async related code when at least one UARTE instance has
enabled async mode. This fixes an "unused function" warning when
`CONFIG_UART_ASYNC_API` is enabled but no UARTE instances has async
enabled. This is possible when the async API is being used for an RTT
UART driver.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-04-07 11:53:29 +02:00
Henrik Brix Andersen
9f4bb75af6 drivers: can: handlers: copy outbound argument structs
Pass a copy of outbound argument structs to the implementation functions
as recommended for Zephyr system calls.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-07 09:38:18 +02:00
Henrik Brix Andersen
ad34c670d8 drivers: can: handlers: unify naming of local argument copies
Unify the naming scheme for local copies of user provided arguments.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-07 09:38:18 +02:00
Gerard Marull-Paretas
8ff797b850 drivers: pwm: litex: remove redundant config 'helper'
All these sort of helpers were removed from tree a while ago, this one
was missed as it uses a custom name.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-07 09:35:05 +02:00
Gerard Marull-Paretas
e3fde6b01a drivers: pwm: sifive: remove redundant checks
If dev was null, caller would have faulted before since dev->api needs
to be accessed before reaching this point. Also, a well-defined device
will never have a NULL dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-07 09:35:05 +02:00
Gerard Marull-Paretas
ccc12be0a5 drivers: pwm: return -ENOTSUP if inactive level is not supported
The API spec states that calling pin_set() with period set to 0 is
equivalent to set the PWM channel to an inactive level. Some drivers
treat this input as invalid (-EINVAL), however, it's an unsupported
feature. Maybe it's due to copy&paste effect? This changes error message
to be clear and changes return value to -ENOTSUP for this case.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-07 09:35:05 +02:00
Gerard Marull-Paretas
0c908706fb drivers: pwm: remove duplicated pulse > period checks
The API call checks for this condition before calling the pin_set driver
OP call, so drivers don't have to do this check now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-04-07 09:35:05 +02:00
Daniel DeGrasse
e4becf1c7b drivers: i2s: i2s_mcux_flexcomm: add pinctrl support to lpc i2s driver
Add pinctrl support to i2s flexcomm driver for lpc.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
415b2bdac0 drivers: pwm: pwm_mcux_sctimer: Add pinctrl support for lpc pwm
add pinctrl support for lpc sctimer pwm driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
c637d7d672 drivers: spi: spi_mcux_flexcomm: add pinctrl support to lpc spi driver
add pinctrl support for spi_mcux_flexcomm driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
1d33b6b86b drivers: i2c: i2c_mcux_flexcomm: enable pinctrl for i2c flexcomm driver
enable pinctrl for i2c flexcomm driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
f8828a4434 drivers: gpio: gpio_mcux_lpc: Add pinmuxing control to gpio driver
Add pinmux control to gpio driver for LPC, so that pin control can work
correctly.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
58008b3085 drivers: serial: Add pinctrl support to usart flexcomm driver
Add pinctrl support to LPC USART flexcomm driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Daniel DeGrasse
c133e357ef drivers: pinctrl: Add LPC IOCON pinctrl driver
Add lpc iocon pinctrl driver. Driver handles IOCON clock initialization as
well as IOCON pin configuration

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-04-06 20:57:22 -07:00
Kai Vehmanen
91516a2be3 drivers: intc: intc_cavs: use correct per-core register set for all ops
Current code uses per-core register to check interrupt status and
dispatch handlers. However to disable/enable the interrupt, core
zero register is always used.

While the handlers in _sw_isr_table are common for all cores,
the status bits should still be handled separate for each core.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-04-06 22:00:14 -04:00
Adrian Bonislawski
cd11910201 dma/cavs_hda: Support channel filtering
Support channel filtering to find the requested channel
if filter_param provided

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-04-06 14:08:01 -04:00
Casper Meijn
c33d1b55f8 drivers: display: st7789v: Add multi-instance support
Replace the config and data struct with a macro. Execute the macro
for each instance.

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-04-06 10:58:26 +02:00
Casper Meijn
ac9cd9e89a drivers: display: st7789v: Remove compile time reset selection
Replace the compiletime `#if` with a runtime decision. This makes
a multi-instance driver possible.

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-04-06 10:58:26 +02:00
Casper Meijn
7f5c5cf317 drivers: display: st7789v: Move params to struct config
Move the const configuration parameters to `struct st7789v_config`.

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-04-06 10:58:26 +02:00
Henrik Brix Andersen
81152d0aae drivers: can: handlers: verify timing parameter access
Verify read access to the timing and timing_data parameters in
z_vrfy_can_set_timing() and pass a copy of these structs to the
implementation as recommended for Zephyr system calls.

Remove unnecessary typecasts.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-05 10:33:08 -07:00
Henrik Brix Andersen
c389594e12 drivers: can: mcp2515: correct min/max timing values
The MCP2515 requires phase segment 2 to be at least 2 time quanta.

The prescaler has a 6 bit register, allowing for real-world prescaler
values between 1 and 64.

Fixes: #44484

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-05 10:33:08 -07:00
Henrik Brix Andersen
a1e33d8868 drivers: can: mcan: fix bounds check for data phase prescaler
Fix the bounds check for the data phase prescaler timing parameter. The
maximum allowed value is 0x20, not 20 decimal.

Fixes: #44483

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-05 10:33:08 -07:00
Henrik Brix Andersen
47119333e1 drivers: can: mcan: allow sjw == CAN_SJW_NO_CHANGE
Take CAN_SJW_NO_CHANGE into account when bounds checking the sjw timing
parameter values.

Fixes: #44482

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-05 10:33:08 -07:00
Shawn Nematbakhsh
c74526919d soc: riscv: sifive-freedom: Get coreclk and peripheral clock from DTS.
Rather than specify input clock for each peripheral individually, instead
specify the relevant clocks in DTS.

This will enable easier support for non-default coreclk on fe310 in a
follow-up CL.

Signed-off-by: Shawn Nematbakhsh <shawn@rivosinc.com>
2022-04-05 12:00:03 +02:00
Jose Alberto Meza
33fde4b10a drivers: espi: xec: mec172x: Handle eSPI bus host enable
Add eSPI bus host enable/disable events from eSPI host.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-04-05 11:19:03 +02:00
Jay Vasanth
89d6695f7c drivers: i2c: MEC15xx i2c error handling
Updates to MEC15xx i2c error handling:
1. timeout_seen handling is simplified. For all errors we
continuously poll
2. error flag is not set for timeout_seen handling and hence
recover_from_error() call is not required.
3. In i2c_xec_poll_write(), ETIMEDOUT for (START + ADDRESS) byte
is treated as default error and error_seen flag is set (instead
of timeout_seen flag)

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-05 11:18:56 +02:00
John Kjellberg
81d1be76ea drivers/disk: sdmmc: stm32: DMA header requested on F4 serie
Even if not used DMA HAL is required in F4 SD HAL driver. Just
as for L4/F7 series that have been added before.
Add it for this specific serie.

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>
2022-04-05 11:17:08 +02:00
Ruibin Chang
f6965ac930 ITE drivers/timer: clean up sys_clock_set_timeout()
Setting event timer count at least 1 hw count, it's redundant,
so I clean up this else {} case. And add the comment about
the K_TICKS_FOREVER and INT_MAX case.

NOTE:
CONFIG_TIMEOUT_64BIT = y, then k_ticks_t type is int64_t.
K_FOREVER is (k_timeout_t) { .ticks = (K_TICKS_FOREVER) },
and K_TICKS_FOREVER is ((k_ticks_t) -1),
so K_FOREVER is a k_timeout_t type structure, and
the member ticks: type int64_t,
                  value (= K_TICKS_FOREVER) 0xFFFF FFFF FFFF FFFF.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-04-05 11:16:51 +02:00
Jay Vasanth
bbec77c982 drivers: peci: Microchip XEC PECI driver add PINCTRL support
Add PINCTRL support to Microchip XEC PECI driver shared by
MEC172x and MEC15xx families.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-05 11:16:41 +02:00
Jay Vasanth
9777c5e90e drivers: peci: Microchip XEC PECI driver add MEC172x support
Update Microchip XEC PECI driver to support MEC172x.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-05 11:16:41 +02:00
Jay Vasanth
822e3bb612 drivers: peci: Microchip XEC PECI driver standardize
Standarize device structure usage for mchp peci driver

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-04-05 11:16:41 +02:00
Alexander Mihajlovic
4ff4991e16 drivers: uart_stm32: Add support for tx/rx swap
Add a new boolean devicetree property `tx-rx-swap` to the
st,stm32-usart binding, used to control TX/RX swap during
device initialization.

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-04-04 13:44:23 -07:00
Henrik Brix Andersen
78a855b418 drivers: can: add missing can_set_mode() syscall handler
Add missing syscall verification handler for can_set_mode().

Fixes: #44361

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-04 09:41:35 -05:00
Joakim Andersson
52be3030aa drivers: hwinfo: Remove HWINFO_NRF limitation for non-secure config
Remove the limitiation in HWINFO_NRF not working in non-secure
configuration. Use the exposed soc_secure_read_deviceid function
that accesses the device ID through the secure services.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-04-04 11:15:28 +02:00
Joakim Andersson
4b80afdd27 drivers: ieee802154: Use secure services
Allows the setting of ieee802154 EUI64 address in non-secure processing
environment by reading the FICR device ID through the secure service.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-04-04 11:15:28 +02:00
Henrik Brix Andersen
49424574c5 drivers: can: handlers: can_get_max_bitrate() is an optional
The can_get_max_bitrate() is an optional API function. Limit validation
to the CAN device driver pointer.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-04 11:15:10 +02:00
Andrzej Głąbek
586e26e8fc soc: nrf: Use data from DTS to populate HAS_HW_NRF_* Kconfig options
Instead of selecting appropriate HAS_HW_NRF_* options for particular
nRF SoCs (and simulated nRF52 target), set their values basing on
information from devicetree.
Correct also semantics of those options so that they are set only when
a corresponding DT node is enabled. This allows using them directly in
Kconfig dependencies of Zephyr drivers for nRF peripherals. Update
appropriately these dependencies.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-02 15:14:38 +02:00
Andrzej Głąbek
cd00a3a3c9 scripts: kconfigfunctions: Redefine dt_nodelabel_has_compat()
The function in its current form is confusing because unlike other
similarly named functions (dt_nodelabel_has_prop(), dt_node_has_prop())
or devicetree macros (DT_NODE_HAS_COMPAT(), DT_NODE_HAS_PROP()), this
function takes into account the status of the checked node and returns
"y" only when the node is enabled.
This commit redefines dt_nodelabel_has_compat() so that it no longer
checks the node status, and for cases where the previous functionality
is needed, a new function named dt_nodelabel_enabled_with_compat()
is introduced as a replacement.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-02 15:14:38 +02:00
Sylvio Alves
e04172fcef drivers: spi: esp32c3: add master init call
ESP32C3 requires master init call to enable its clock
gate. Without this, SPI interface may not initialize
properly.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-04-01 13:00:16 -05:00
Dino Li
5b9db5a251 it8xxx2: re-factor idle routine
Don't leave idle state if soc isn't waked-up by an interrupt.
(We change to check interrupt controller register)

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-04-01 12:49:09 -05:00
Henrik Brix Andersen
e1290bedeb drivers: can: handlers: verify API call in z_vrfy_can_get_state()
Verify the get_state API call in z_vrfy_can_get_state(). Adjust sizeof()
arguments to match the rest of the file.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-01 12:47:04 -05:00
Henrik Brix Andersen
d64a02656d drivers: can: handlers: Remove unnecessary typecasts
Remove unnecessary typecasts from from z_vrfy_can_remove_rx_filter().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-01 12:45:39 -05:00
Henrik Brix Andersen
422a2a8204 drivers: can: handlers: verify API call in z_vrfy_can_add_rx_filter_msgq()
Verify the add_rx_filter API call in z_vrfy_can_add_rx_filter_msgq() as
this is used by the underlying implementation. Remove unnecessary
typecasts.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-01 12:45:39 -05:00
Henrik Brix Andersen
c1477f9b38 drivers: can: handlers: do not verify void pointer
Do not attempt to verify that the current thread has access to the void
*user_data argument to z_vrfy_can_send(). The size of the data is not
known and no driver code will try to dereference it (it may not even be
a valid pointer).

Remove unnecessary typecasts from z_vrfy_can_send().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-04-01 12:45:39 -05:00
Sjors Hettinga
951983191b drivers: net: loopback: Add interface to simulate packet drop
To allow for high level robustness tests on protocols, add an interface
to control the packet drop rate. A rate of 0 means no packet dropped, a
rate of 1 means all packets being dropped.

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
2022-04-01 12:36:14 -05:00
Ruibin Chang
a5fc945fd2 ITE drivers/timer: check HW cycles per second by build assert
ITE RTOS timer HW frequency is fixed at 32768Hz, because this
clock source is always active in any EC mode (running/doze/deep doze).

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-04-01 12:33:11 -05:00
Ruibin Chang
0ec0ac109a ITE drivers/timer: don't divide free run count
We don't need to convert the free run clock count,
that will be converted by the kernel
(base on CONFIG_SYS_CLOCK_TICKS_PER_SEC),
so we should return the HW register count value directly.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-04-01 12:33:11 -05:00
Krzysztof Chruscinski
0b4e5b6d8b drivers: serial: nrf_uarte: Fix NO_OPTIMIZATION compilation
When NO_OPTIMIZATIONS is set and asynchronous API is used but
HW counting is not enabled then linking fails because of lack of
nrfx_timer code. When optimization is enabled, linker is smart
enough to figure out that nrfx_timer is not used.

Converting decision function from static inline function to macro
which is handled correctly with optimization off.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-04-01 16:03:56 +02:00
Tom Burdick
9933f18ad3 dma/cavs_hda: Provide pending/free byte lengths
In status the pending/free byte lengths are now provided

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-01 09:12:20 -04:00
Tom Burdick
c0b63d6afb dma/cavs_hda: Support source/dest width setting
Support adjusting the sample size to 16bits if the source
or destination width is set 3 or less.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-01 09:12:20 -04:00
Tom Burdick
602ef3fb0e soc/intel_adsp: Require definitions for cavs_hda.h
Rather than defining them in the header, require a set of defines
be provided to cavs_hda.h as part of the expected input to the API.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-01 09:12:20 -04:00
Tom Burdick
e018a3dff7 dma/cavs_hda: DMA driver for HDA on cAVS
Adds an initial driver for HDA streams on cAVS. A common code base is
provided for all HDA streams while the drivers are identified
differently as they have small behavior differences.

Uses dma_status to describe the positions for read/write. Uses dma_reload
to inform when to move the read/write positions. This closely follows
how HDA is being used in SoF

Simple test case is provided for both drivers.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-04-01 09:12:20 -04:00
Dino Li
e2ce171bed it8xxx2: espi: fill OOB header at driver level
With this change, app code has not to fill/prepare OOB header.
fixes #43568

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-04-01 13:30:33 +02:00
Carles Cufi
00636682ca Bluetooth: host: Introduce a new bt_hci_le_rand() call
In order to get rid of the duplication of the code that we had until now
in the tree, consolidate the handling of multiple calls to
bt_hci_cmd_send_sync(BT_HCI_OP_LE_RAND, ...) in a single location,
namely in hci_core.

This allows all of the users of this HCI command to use a single
implementation of the iterated sending of the HCI command to fill a
buffer with random bytes.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-04-01 11:21:51 +02:00
Carles Cufi
eb0de3384d drivers: entropy: bt_hci: Add missing netbuf unref
bt_hci_cmd_send_sync() requires the caller to unref the buffer that is
sent back as a response. Add the missing call to net_buf_unref()
accordingly.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-04-01 11:21:51 +02:00
Henrik Brix Andersen
e0aaaea473 drivers: can: mcan: fix compiler warning
Fix compiler warning with CONFIG_CAN_AUTO_BUS_OFF_RECOVERY=y.

Fixes: 4e41d89c7b

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-31 18:11:13 -04:00
Jun Lin
caadb33202 driver: clock: npcx: remove the guard for npcx_clock_get_sleep_ticks
The function npcx_clock_get_sleep_ticks is currently guarded by
CONFIG_PM && CONFIG_NPCX_PM_TRACE. The other codes guarded by
CONFIG_NPCX_PM_TRACE is used to trace and will print a lot of messages.
The user who wants to use npcx_clock_get_sleep_ticks has to enable this
flag and get a lot of console spam. This commit removes the guard
CONFIG_NPCX_PM_TRACE and makes this function is available when
CONFIG_PM is defined.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-03-31 14:38:28 -05:00
Ruibin Chang
199eaac0a4 ITE drivers/sensor/vcmp: don't connect shared irq multiple times
This driver exectue connecting the shared irq one time for
every status "okay" vcmp nodes, then it will show enable
the same irq multiple times when build.

So I check whether the irq is enabled or not, if yes,
we needn't to enable again. And we will figure out the
triggered channel in vcmp_it8xxx2_isr().

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-03-31 12:20:11 -05:00
Lukasz Maciejonczyk
00a6d4cf78 drivers: ieee802154_nrf5: limit IEEE802154_NRF5_DELAY_TRX_ACC
Currently IEEE802154_NRF5_DELAY_TRX_ACC can exceed the max possible
value. Add upper bound to limit this.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-03-31 16:23:59 +02:00
Gerard Marull-Paretas
fa874db8a5 drivers: flash: shell: improve flash device choice
Store an optional reference to the zephyr,flash-controller choice. If
available and no user input is provided, it will be used as the default
flash device. If not available, error message will be more explicit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-31 13:55:10 +02:00
Henrik Brix Andersen
99964fab45 drivers: can: add missing static keywords
Add missing static keywords for functions internal to the drivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-31 10:31:37 +02:00
Henrik Brix Andersen
21faabc314 drivers: can: handlers: fix z_vrfy_can_recover() compilation
Fix compilation (and improve checks) in z_vrfy_can_recover().

Fixes: #44348

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-31 10:31:15 +02:00
Henrik Brix Andersen
4e41d89c7b drivers: can: mcan: fix bus recovery functions
Fix the signature of the CAN bus recovery functions in the Bosch M_CAN
driver frontends.

Fixes: #44345

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-31 10:31:15 +02:00
Henrik Brix Andersen
6f910ae41e drivers: can: mcp2515: do not force CONFIG_CAN_AUTO_BUS_OFF_RECOVERY=y
Do not force CONFIG_CAN_AUTO_BUS_OFF_RECOVERY=y. Instead fix the return
type of the mcp2515_recover() function and return -ENOTSUP.

Fixes: #44344

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-31 10:31:15 +02:00
Lukasz Maciejonczyk
8c6f49c845 drivers: ieee802154_nrf5: fix delayed operation accuracy
Align clock accuracy used in CSL calculations to the value in platform.
This is recomended setting for devices working in wide range
temperature. Nevertheless it can be profiled in end product to decrease
CSL window duration and finally the power consumption.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-03-31 10:30:31 +02:00
Jay Vasanth
a94760d9b4 drivers: tach: Microchip XEC TACH driver add PINCTRL support
Add build time optional PINCTRL support to the Microchip XEC TACH
driver shared by MEC15xx and MEC172x families.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-31 10:30:17 +02:00
Jay Vasanth
b0cfaa44cd drivers: tach: Microchip XEC TACH driver add MEC172x support
Update Microchip XEC TACH driver to support MEC172x.
Standardize device tree properties between chips.
Standardize device structure usage.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-31 10:30:17 +02:00
Francois Ramu
90d1644a10 drivers: pwm: stm32 can initialize the PWM complementary output
If the dts defines the PWM complementary output, then the OCN
must be init in place of the OC state and polarity.
This is an exclusive setting for this pin.
The channel in LL_TIM_OC_SetPolarity can be the complementary one.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-31 10:28:47 +02:00
Thomas Stranger
c128a89690 can: stm32fd: correct timing min/max for prop_seg and sjw
This commit changes the timing_min_data prop_seg
initialization of st,stm32-fdcan drier to zero.
Additionally the nominal sync jump width limits
are also adopted to new values 1 and 128.

This was not tested until recently and therefore
caused the can timing test to fail on stm32g4
after PR #44197 got merged.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-03-31 10:28:14 +02:00
Ruibin Chang
78b027f765 ITE drivers/timer: fix tests/drivers/flash build error
There wasn't the build error in PR#44060,
but now tool chain isn't happy about putting the arch_busy_wait()
to __ram_code section, then it shows a build error:
https://github.com/zephyrproject-rtos/zephyr/runs/5755633537?check_suite_focus=true#step:10:933

So I remove __ram_code of arch_busy_wait(), and this will need
extra fetch code time when arch_busy_wait() code isn't in
the dynamic cache.

Verified by follow test pattern:
west build -p auto -b it8xxx2_evb tests/drivers/flash

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-03-31 16:13:19 +09:00
Ryan Erickson
69ffc1f228 modem: hl7800: add API to set bands
Add API to set LTE bands at runtime.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-03-30 11:39:06 +02:00
Ruibin Chang
43213a16a8 ITE drivers/timer: customize busy wait timer
Customize busy wait timer for micro-seconds accuracy.

Verified by follow test pattern:
west build -p auto -b it8xxx2_evb tests/kernel/timer/timer_api
west build -p auto -b it8xxx2_evb tests/kernel/timer/timer_error_case
west build -p auto -b it8xxx2_evb tests/kernel/timer/timer_monotonic
west build -p auto -b it8xxx2_evb tests/kernel/timer/starve
west build -p auto -b it8xxx2_evb tests/kernel/context
west build -p auto -b it8xxx2_evb tests/drivers/adc/adc_api

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-03-30 11:31:06 +02:00
Robert Lubos
823ac60c70 drivers: net: loopback: Increase MTU to match IPv4 MTU
net_pkt_alloc_buffer() will use the maximum packet length of
NET_IPV4_MTU in case the interface MTU is smaller than this. Because of
this, the using the loopback interface with smaller MTU leads to
additional fragmentation at the TCP layer, which impacts performace and
requires more network buffers for tests to execute.

Fix this by matching the loopback interface MTU with NET_IPV4_MTU.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-03-30 11:08:22 +02:00
Robert Lubos
e80a662ac7 drivers: net: loopback: Allocate the loopback packet from proper poll
Use the new function to allocate a packet for the RX path from the RX
packet poll.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2022-03-30 11:08:22 +02:00
Tomislav Milkovic
9f0fa15bb7 drivers: display: add stm32_ltdc driver
Add Kconfig for STM32 LTDC driver
Add STM32 LTDC driver C source
Update display drivers CMakeLists with the new driver
Update display drivers Kconfig with the new driver

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-03-29 18:30:02 -07:00
Henrik Brix Andersen
3874a0d1e3 drivers: can: use correct size in z_vrfy_can_get_core_clock()
Use the correct size in z_vrfy_can_get_core_clock().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-29 17:05:56 -07:00
Henrik Brix Andersen
372cee4268 drivers: can: convert can_calc_timing*() to syscalls
Convert can_calc_timing() + can_calc_timing_data() to syscalls and use
the newly added syscalls calls for determing the minimum/maximum
supported timing parameter values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-29 17:05:56 -07:00
Henrik Brix Andersen
15fde0a357 drivers: can: add syscalls for getting min/max timing values
Add CAN system calls for getting the minimum/maximum timing values
supported by a given CAN controller device driver instance:
- can_get_timing_min()
- can_get_timing_max()
- can_get_timing_min_data()
- can_get_timing_max_data();

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-29 17:05:56 -07:00
Jordan Yates
332a6f084a wifi: esp_at: reset the modem in device init
Reset the ESP modem inside the device initialisation function so that
errors can be detected through the use of `device_is_ready`.

Fixes #43891 for this driver.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-29 12:32:43 -07:00
Jordan Yates
06960750c7 wifi: esp_at: return modem reset result
Return an error code indicating whether the modem was successfully reset
or not.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-29 12:32:43 -07:00
Jordan Yates
9cd80bb732 wifi: esp_at: move network device inst macro
Move the network device instantiation macro to above the esp_init
function so that static variables declared by the macro are visible to
the init function.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-29 12:32:43 -07:00
Emil Obalski
d877e1dded ipc_service: Automatically include source files for backends
The purpose of this change is to allow to enable more than one
backend at once by removing choice from ipc-service backend Kconfig
and depending backend Kconfig option on existing of correct compatible.

Overwriting IPC_SERVICE_BACKEND option in some places is removes
as no longer needed.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2022-03-29 12:30:50 -07:00
Tom Burdick
2f792c2de5 dma/dw_common: Update dma_dw_common from sof
Ports the SOF DesignWare DMA code to Zephyr.

Effectively replaces much of what was the designware driver as this
driver enables scatter gather which the older driver did not.

* Enables cyclic transfer description lists when the cyclic config
  param is given.
* Enables linear link position usage with cAVS GPDMA.
* Passes suspend/resume, scatter/gather tests.
* Provides status updates of the transfer through dma_get_status()
* Enables reloading a cyclic transfer with dma_reload()
* Enables dma handshakes using the dma_slot config param.
* cAVS specifics remain in the dma_cavs_gpdma driver.

Co-authored-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Co-authored-by: Tom Burdick <thomas.burdick@intel.com>
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-03-29 14:33:48 -04:00
Bartosz Bilas
1d40d4fa5a drivers: spi_handlers: switch to gpio_dt_spec member
Don't use the old gpio_dev spi_cs_control's member
since it's been deprecated in favor of gpio_dt_spec.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-03-29 10:24:56 -05:00
HaiLong Yang
9d2425c186 drivers: spi: introduce gd32 spi driver
Add a simple gd32 spi driver.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2022-03-29 10:21:15 -05:00
Daniel DeGrasse
328e0be132 drivers: memc: memc_mcux_flexspi: make pinctrl support conditional
Make pinctrl support conditional for memc flexspi driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-26 03:41:02 -05:00
Erwan Gouriou
48039bc555 drivers/pinctrl: stm32: Allow plain GPIO configuration
Based on introduction of plain GPIO configurations in STM32 pinctrl
bindings, update STM32 pinctrl/gpio drivers to make this functionality
available.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-25 15:52:02 -07:00
Erwan Gouriou
79ba037891 drivers/gpio: stm32: Clarify pin config functions headers
Before updating stm32 pinctrl/gpio drivers to support plain GPIO
feature, rework pin configuration functions headers to provide
more clarity on the arguments and the information they convey:
- pin configuration
- pin function

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-25 15:52:02 -07:00
Ruibin Chang
a21d043f5b ITE drivers/sensor: add voltage comparator driver
Add voltage comparator driver for ITE it8xxx2 chip.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-03-25 15:00:35 -07:00
Daniel DeGrasse
0f939d350d drivers: ethernet: eth_mcux: add support for resetting phy
add support for resetting phy at boot via GPIO reset pin.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
9824721680 drivers: display: display_mcux_elcdif: add backlight-gpios property
Add backlight gpios property to mcux display driver, so that the driver
can correctly initialize the backlight gpio control.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
61b83c88b8 drivers: gpio: gpio_mcux_igpio: enable pinmuxing in gpio driver
In order for pinctrl support to be complete, RT series GPIO driver must
support pinmuxing within the driver level. RT series pinmux settings do
not correspond directly to gpio port/pin numbers, so use DTS mappings to
pinctrl nodes to select and apply pinmux settings in the gpio driver.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
54eb607392 drivers: disk: usdhc: enable pinctrl for usdhc driver
Enable pinctrl driver for usdhc. USDHC driver uses custom pinctrl states
for fast, slow, and medium signal frequencies, as well as pin pull for
SD detection.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
5ec576fb04 drivers: display: display_mcux_elcdif: add pinctrl support
add pinctrl support for display_mcux_elcdif driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
108188312d drivers: video: video_mcux_csi: enable pinctrl
Enable pinctrl for mcux_csi video driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
459495aa84 drivers: memc: enable pinctrl for flexspi driver
Enable pinctrl for flexspi driver. Note that when flexspi is being using
in XIP mode, pinctrl settings are not required and will not be applied.
Pinctrl settings are only required when the flexspi device being used is
not the one used for XIP.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
dbb4ad8eb1 drivers: pwm: enable pinctrl for nxp imx_pwm driver
Enable pinctrl for nxp imx_pwm driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
053eaf7545 drivers: lpc_lpadc: enable pinctrl for lpadc driver
enable pinctrl for mcux lpc lpadc driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
6c0bcdc6e9 drivers: mcux-12b1-adc: enable pinctrl for mcux-12b1 adc
Enable pinctrl for mcux_12b1msps_sar adc driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
1cee7be552 drivers: pinctrl: Enable pinctrl for RT11xx series
RT11xx series has similar pin configuration peripheral to RT10xx, with
some differences in register layout. Create new pinctrl definition
header file, and reuse existing driver code for RT10xx.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Daniel DeGrasse
3a6919e3aa drivers: pinctrl: update rt pinctrl to support GPR register
iMX.RT parts use a GPR register for some pinmux settings. Update pinctrl
driver to support this GPR register definition.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-25 15:47:54 -05:00
Konstantin Mochalov
104a668fe8 drivers: sensor: mhz19b: fix all channels fetch
mhz19b_sample_fetch() from mhz19b sensor driver didn't support
SENSOR_CHAN_ALL chan parameter value, so sensor_sample_fetch() didn't
work, always returning -ENOTSUP (sensor_sample_fetch_chan() worked, if
called with SENSOR_CHAN_CO2).

This change enables mhz19b sensor to work both with
sensor_sample_fetch() and with sensor_sample_fetch_chan() with
SENSOR_CHAN_CO2.

Signed-off-by: Konstantin Mochalov <incredible.angst@gmail.com>
2022-03-25 08:22:33 -05:00
Neil Armstrong
d89efe0434 pcie: ecam: implement MSI/MSI-X interrupts setup
This implements the msi_device_setup() callback for ECAM controllers
used with an ARM GIC ITS MSI message translater.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-03-25 12:56:25 +01:00
Neil Armstrong
acd38cb30e pcie: controller: add generic controller MSI/MSI-X API core functions
Define the MSI/MSI-X APIs to be used with the Generic PCIe Controller API.

It notably adds the msi_device_setup() callback to the PCI Express
Controller API used to allocate and setup the MSI/MSI-C vectors on the
MSI message translater HW.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-03-25 12:56:25 +01:00
Neil Armstrong
318999d656 interrupt_controller: gicv3_its: add get_msi_addr API
Add get_msi_addr() callback to ITS API to retrieve the GITS_TRANSLATER
physical address to be set in the MSI message address field.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-03-25 12:56:25 +01:00
Jordan Yates
6d1a08b3a8 pm: device: move pm_device_runtime_init_* funcs
Move the `pm_device_runtime_init_*` functions from <pm/device_runtime.h>
to <pm/device.h>. The initial device state should be settable
independently of whether `CONFIG_PM_DEVICE_RUNTIME` is enabled.

This also resolves a compilation error when attempting to use these
functions without also including <pm/device.h>.

Function documentation is also updated to be more general than only
referencing runtime PM, as this also applies to system PM and manually
run actions.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-25 10:39:55 +01:00
Gerson Fernando Budke
0521aa0fbc drivers: pinmux: Drop sam0 pinmux in favor of pinctrl
Drop sam0 pinmux driver and all related entries in favor to use new
pinctrl API.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
be387aa1c2 drivers: eth: Update sam/sam0 eth drivers to use pinctrl
This update Atmel sam and sam0 ethernet gmac and mdio drivers to use
pinctrl driver and API. It updates all boards with new pinctrl groups
format.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
4c5e94317c drivers: rtc: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 rtc driver. It allows to
define pins to be used for tamper detection.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
8427f5e9b1 drivers: timer: Add sam0 tc32 support to pinctrl
This add support to pinctrl at Atmel sam0 timer tc32 driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
171440b029 drivers: adc: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 adc driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
978e578008 drivers: dac: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 dac driver. It updates all
boards with new pinctrl groups format and drop pinmux entries.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
8961172e6d drivers: usb: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 usb dc driver. It updates
all boards with new pinctrl groups format and drop pinmux entries.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
8c51ad6c6f drivers: pwm: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 tcc pwm driver. It updates
all boards with new pinctrl groups format and drop pinmux entries.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
63b2a38f16 drivers: i2c: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 i2c driver. It updates all
boards with new pinctrl groups format and drop pinmux entries.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
fbddf7847d drivers: spi: Add sam0 support to pinctrl
This add support to pinctrl at Atmel sam0 spi driver. It updates all
boards with new pinctrl groups format and drop pinmux entries.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
9b40960926 drivers: serial: Update sam0 drivers to use pinctrl
This update Atmel sam0 serial drivers to use pinctrl driver and API. It
updates all boards with new pinctrl groups format.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
10aa57857d drivers: pinctrl: Update Atmel sam0 driver to new API
This update current Atmel sam0 pinctrl initiative to current Zephyr
pinctrl API. It update current devicetree bindings and add the sam0
pinctrl driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
3a940cea79 drivers: dac: Add sam support to pinctrl
This add support to pinctrl at Atmel sam dac driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
0f472f6d1b drivers: sensors: Update sam qdec driver to use pinctrl
This update Atmel sam qdec sensor driver to use pinctrl driver and API.
It update board and sample with new pinctrl groups format.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
dc172849fa drivers: pwm: Update sam pwm driver to use pinctrl
This update Atmel sam pwm driver to use pinctrl driver and API. It
updates all boards with new pinctrl groups format. In addition this
remove all remaining manual pinmux at board level.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
d7c37d1f12 drivers: can: Update sam canfd driver to use pinctrl
This update Atmel sam canfd driver to use pinctrl driver and API. It
updates all boards with new pinctrl groups format. In addition this
add missing entries to run automated tests for can/canfd drivers.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
e1d88706bb drivers: i2s: Update sam ssc driver to use pinctrl
This update Atmel sam ssc driver to use pinctrl driver and API. It
updates all boards with new pinctrl groups format. In addition this
remove DEV_NAME macro at sam xdma driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
bd485ea960 drivers: adc: Update sam afec driver to use pinctrl
This update Atmel sam afec driver to use pinctrl driver and API. It
updates all boards with new pinctrl groups format. In addition, it
add overlay files to allow run samples/drivers/adc example.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
3c4a9ef47d drivers: usb: Update sam usb drivers to use pinctrl
This update Atmel sam usb drivers to use pinctrl driver and API. It
updates all boards with new pinctrl groups format.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
986388453f drivers: counter: Update sam driver to use pinctrl
This update Atmel sam counter driver to use pinctrl driver and API. It
updates all boards with new pinctrl groups format.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
a27304b658 drivers: i2c: Update sam drivers to use pinctrl
This update Atmel sam i2c drivers to use pinctrl driver and API. It
updates all boards with new pinctrl groups format. This add missing
i2c-0 alias into sam4l_ek board.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
38d0659931 drivers: spi: Update sam driver to use pinctrl
This update Atmel sam spi driver to use pinctrl driver and API. It
updates all boards with new pinctrl groups format.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
bfaf027dde drivers: serial: Update sam drivers to use pinctrl
This update Atmel sam serial drivers to use pinctrl driver and API. It
updates all boards with new pinctrl groups format.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Gerson Fernando Budke
cb201430cf drivers: pinctrl: Update atmel sam driver to new api
This update current Atmel sam pinctrl initiative to current Zephyr
pinctrl API. It update current devicetree bindings and add the sam
pinctrl driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-03-24 15:45:37 -07:00
Henrik Brix Andersen
69238dbfee drivers: can: mcux: flexcan: fail init if clock device is not ready
Fail the NXP MCUX FlexCAN driver initialization of the clock controller
device is not ready.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-24 13:39:55 -05:00
Andrzej Głąbek
44adeba75e drivers: counter: Fix dt_node_bool_prop calls in Kconfig.nrfx
This is a follow up to commit a1ab8da862.

Several calls to the dt_node_bool_prop function in Kconfig.nrfx for
the counter drivers are done with wrong parameters. The function
expects a full node path, but it is provided with only the node name
component.
Fix those by using dt_nodelabel_bool_prop instead, as such function is
available now and it is more suitable for such cases.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-24 15:13:32 +01:00
Zack Cornelius
790e2bdb02 drivers: nrf_qspi_nor: Add support for S2B1 QER
Add support for S2B1 quad-enable-requirements.
Add wrsr call for various QER modes

S2B1v6 mode tested with Winbond W25Q128JV series and pp4o and read4io
commands.

Signed-off-by: Zack Cornelius <zcornelius@securityesys.com>
2022-03-24 14:54:05 +01:00
Kamil Gawor
ba6d9139bb drivers: uart_nrfx_uarte: Fix double Rx buffer releasing
Fixes a case for the asynchronous UART API where
only single buffer was attached to the UART, after
filling this buffer release event was trigger first
time and after disabling UART the release event was
triggered again for the same buffer.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2022-03-24 14:16:29 +01:00
Gerard Marull-Paretas
d965f0a578 drivers: display: ili9xxx: default based on DT compatible
Enable the ILI9XXX display driver based on DT compatible status.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-24 13:36:54 +01:00
Dino Li
0d9c1c2516 it8xxx2: pinmux: correct i2c3 alt function locate on GPF2/F3
Enable the alt function with setting both bit5@0xf016f1 and
bit6@0xf02046 bits will cause internal leakage.
Only bit6@0xf02046 bit is required to enable the alt function,
so fix it.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-03-24 08:17:16 -04:00
Jordan Yates
c064006ecc drivers: pwm: test driver
Add a dummy driver for the `vnd,pwm` compatible to allow compilation of
drivers utilising PWM when running "build_all" tests.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-24 12:56:28 +01:00
Filip Kokosinski
0a9e8a5463 drivers: pinmux: remove SiFive pinmux driver
After transitioning to the new pinctrl driver, it is now obsolete.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-03-24 10:46:34 +01:00
Filip Kokosinski
38f38e0be8 boards: FE310-based boards: transition to pinctrl driver
This commit makes the transition from the pinmux driver to the pinctrl
driver. It also modifies UART, SPI and I2C drivers used in FE310-based
boards to use the new pinctrl API.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-03-24 10:46:34 +01:00
Filip Kokosinski
a5cc185b9b drivers: pinctrl: add SiFive pinctrl driver
Add a pinctrl driver used in FE310-based boards.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2022-03-24 10:46:34 +01:00
Navin Sankar Velliangiri
b69dadb6e5 drivers: clock_control: lpc: syscon: Add BUSCLK support
Add support for the LPC BUS clock to the LPC SYSCON clock controller
driver.

Signed-off-by: Navin Sankar Velliangiri <navin@linumiz.com>
2022-03-24 10:44:27 +01:00
Alexandre Bourdiol
2c4d55042c drivers: bluetooth: hci: BlueNRG-MS: Hold on CS
In case of BlueNRG-MS, it is necessary to prevent SPI driver to release CS,
and instead, let current driver manage CS release.
So, add SPI_HOLD_ON_CS to operation field

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2022-03-24 10:44:15 +01:00
Alexandre Bourdiol
8538b835f3 drivers: bluetooth: hci: use logic (and not pin value) kick/release CS
Use logic (and not pin value) for kick_cs() and release_cs()
because potential pin value invertion (Active LOW)
is handled in gpio_pin_set()

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2022-03-24 10:44:15 +01:00
Mulin Chao
8a4013b2e1 drivers: adc: Set correct interrupt type and remove spurious interrupts
In npcx adc driver, we select 'Scan' (Multiple Channels Operation Mode)
mode by default. It means that selected channels in ADCCS will be
converted automatically. Then, read the measured data from CHNDAT
registers if EOCCEV (Event is set after all selected channels are
converted.) flag in ADCSTS is set.

But we enable the wrong interrupt type, INTECEN, during adc
initialization. Ec will send the interrupt after each channel in ADCCS
is converted. It has no harm to the current driver since the driver
reads all selected channels and turns off ADC converter only after
EOCCEV is set in ISR. But it does generate spurious interrupts.

This CL enables the correct interrupt type, INTECCEN, during adc
initialization. Ec only sends the interrupt after all of channels in
ADCCS are converted.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-03-24 10:43:54 +01:00
Johann Fischer
a713315f0c drivers: ssd16xx: propagate errors where possible
Fix error propagation on several places.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Johann Fischer
75fb9ee143 drivers: ssd16xx: rework function to clear panel buffer at init
Rework function to clear panel buffer to use less memory
and propagate the errors.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Johann Fischer
e36c2699e4 drivers: ssd16xx: use usual scheme struct foo *data = dev->data
Use usual scheme "struct foo *data = dev->data;".

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Johann Fischer
a2e7e9a0e0 drivers: ssd16xx: add multi-instance support
Get rid of all DT_INST_PROP(0,...) and rework
the driver to support multiple instances.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-03-23 18:40:08 +01:00
Avi Green
1d46332b39 bmi160: Added I2C to Kconfig dependency
bmi160 driver code supports i2c, but is not selectable by Kconfig

Signed-off-by: Avi Green <avigreen1978@yandex.com>
2022-03-23 10:01:47 -07:00
Xudong Zheng
2a4144d063 drivers: clock_control: nrf_clock_calibration: remove errata workaround
Workaround for errata 192 is unnecessary as it is applied within
nrfx_clock_calibration_start().

Fixes #43930

Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
2022-03-23 17:16:12 +01:00
Andrzej Puzdrowski
3fc7182555 drivers/flash/nrf_qspi_nor: add support for enter 4-byte addressing mode
Added basic support for enter 4-byte addressing command.
Patch  supports command 0xB7 (Enter 4-Byte Address Mode),
with or without preceding WREN.

Similar as for SPI-NOR the `enter-4byte-addr` property of
memory node is used or describing how to Enter 4-Byte Addressing
mode.
Worth to notice that along with that property the `address-size-32`
property is expected as it switch the driver to use 4-byte addressing
in operations.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-03-23 16:02:49 +01:00
Jordan Yates
80e7ad7a23 entropy: bt_hci: driver added
Adds an entropy driver that uses Bluetooth HCI commands as its source
of randomness. As this method is blocking, the ISR API is not supported.

As this method will range from relatively slow (same core Bluetooth HCI
controller) to extremely slow (UART HCI Bluetooth controller), use the
xoshiro PRNG by default for RNG generation.

Implements #37186

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-23 13:38:47 +01:00
Michał Barnaś
a1ab8da862 kconfig: fix dt_node_has_prop and add nodelabel functions
The Kconfig function "dt_node_has_prop" was using label as its
parameter, where other functions use either chosen or path.
The documentation says that the parameter is path, so this patch
makes the function as documentation says and as other functions
in the file.
The additional nodelabel functions were added as counterparts that
are using nodes labels instead of paths.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-03-23 13:25:21 +01:00
Jonathan Rico
f4ea0651ac Bluetooth: hci: rpmsg: do not drop hci buffers
This fixes an issue where we would drop the hci event if allocation from
the hci event buffer pool didn't immediately succeed.

The behavior is now to block on allocation, and warn the user every 10
seconds.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-03-23 12:54:26 +01:00
Andrei-Edward Popa
12fa630844 drivers: serial: rpi_pico: added reset support for UART devices
added reset controller for Raspberry Pi Pico UART devices

Signed-off-by: Andrei-Edward Popa <andrei.popa105@yahoo.com>
2022-03-23 12:51:39 +01:00
Andrei-Edward Popa
3d24f62c05 drivers: reset: added Reset Controller for Raspberry Pi Pico
added Reset Controller driver for Raspberry Pi Pico board

Signed-off-by: Andrei-Edward Popa <andrei.popa105@yahoo.com>
2022-03-23 12:51:39 +01:00
Andrei-Edward Popa
8645de581e drivers: added file structure for Reset Controller Driver
added needed files for reset controller driver

Signed-off-by: Andrei-Edward Popa <andrei.popa105@yahoo.com>
2022-03-23 12:51:39 +01:00
Mikkel Jakobsen
959afcc93a drivers: led_strip: add tlc5971 driver
the tlc5971 driver uses spi for controlling the global brightness
and individiual pixel brightness of a daisy chain of tlc5971
devices.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-03-23 12:50:11 +01:00
Håkon Øye Amundsen
7aeef175e8 dts: nrf_qspi_nor: add option for specifying size in bytes
If a user has a 1GB external flash it is currently not possible
to configure this through DTS. To allow for such a configuration
we add an option which specifies the size in bytes not bits.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2022-03-23 12:48:08 +01:00
Daniel DeGrasse
69ff24ce97 drivers: memc: memc_mcux_flexspi: move device data into RAM
flexspi driver should not interact with flash whenever possible, and
should never use flash while in a critical write or erase section.
Move device data to RAM to prevent this read-while-write hazard.

Fixes #44043

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 23:14:00 -05:00
Daniel DeGrasse
8d556c0623 drivers: memc: memc_mcux_flexspi_hyperram: move device data to RAM
flexspi driver should not interact with flash whenever possible, and
should never use flash while in a critical write or erase section.
Move device data to RAM to prevent this read-while-write hazard.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 23:14:00 -05:00
Daniel DeGrasse
61c3f0aa44 drivers: flash: flash_mcux_flexspi_nor: move device data to RAM
flexspi driver should not interact with flash whenever possible, and
should never use flash while in a critical write or erase section.
Move device data to RAM to prevent this read-while-write hazard.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 23:14:00 -05:00
Daniel DeGrasse
8ab17128e1 drivers: flash: flash_mcux_flexspi_mx25um51345g: move device data to RAM
flexspi driver should not interact with flash whenever possible, and
should never use flash while in a critical write or erase section.
Move device data to RAM to prevent this read-while-write hazard.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 23:14:00 -05:00
Daniel DeGrasse
6e1b8435ab drivers: flash: flash_mcux_flexspi_hyperflash: move device data to RAM
flexspi driver should not interact with flash whenever possible, and
should never use flash while in a critical write or erase section. Move
device data to RAM to prevent this read-while-write hazard.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 23:14:00 -05:00
Tim Lin
0b9c0a0b23 ITE: drivers/i2c: implement i2c specified speed option of 50 KHz
Implement i2c specified speed option of 50 KHz in ITE i2c driver.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-22 20:30:38 -04:00
Jordan Yates
840bcd802d wifi: esp_at: disable CWMODE auto connect
In the newer ESP32 AT command versions, the CWMODE command takes an
optional parameter (<auto_connect>) which controls whether the module
will automatically attempt to connect to an AP when switching modes.

This parameter defaults to enabling auto-connect if not specified.

Without this change, modules can successfully connect to an AP before
the `CWAUTOCONN=0` command is processed, resulting in a
`NET_EVENT_WIFI_CONNECT_RESULT` before `NET_EVENT_IF_UP`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-22 12:36:50 +01:00
Daniel DeGrasse
c29b602675 drivers: pwm: add pinctrl support to kinetis tpm driver
add pinctrl support for kinetis tpm driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
9e12d23f11 drivers: dac: add pinctrl support to dac_mcux_dac32 driver
add pinctrl support to dac_mcux_dac32 driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
31406c13f2 drivers: sensor: Add pinctrl support for mcux acmp sensor
Add pinctrl support for mcux acmp sensor driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
a9587deaa4 drivers: adc: adc_mcux_adc12: enable pinctrl for adc12 driver
enable pinctrl for adc12 driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
9b9450d8f3 drivers: pwm: add pinctrl support for mcux PWT driver
Enable pinctrl support for mcux pwm capture pwt driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
6545a3d0fa drivers: spi: enable pinctrl for spi_mcux_lpspi
Enable pinctrl for lpspi driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
756abe308c drivers: i2c: enable pinctrl for mcux lpi2c driver
Enable pinctrl for mcux lpi2c driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
00793592eb drivers: serial: Enable pinctrl for kinetis lpsci driver
Enable pinctrl for kinetis lpsci uart driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
180a9d221e drivers: adc: enable pinctrl for kinetis adc_16 mcux driver
Enable pinctrl for kinetis adc16 mcux driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
a7f85f1ca1 drivers: can: Enable pinctrl for mcux_flexcan
Enable pinctrl support for mcux flexcan driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
55f1d5ba73 drivers: enet: Enable pinctrl for eth_mcux driver
Enable pinctrl for ethernet mcux driver, and update kinetis DTS node to
include labelling for PTP node, to enable driver to access pinctrl
properties.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
f400aa41cd boards: remove spi pinmux setting for kinetis boards
Remove spi pinmux setting for kinetis boards with dspi, as dspi driver
supports pinctrl

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
f90c356025 drivers: spi: enable pinctrl for kinetis dspi driver
Enable pinctrl unconditionally for kinetis dspi driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
e11bed5ff2 drivers: i2c: enable pinctrl for kinetis i2c
Enable pinctrl for kinetis i2c mcux driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Daniel DeGrasse
6537a867e3 drivers: pwm: Enable pinctrl for kinetis ftm PWM driver
Enable pinctrl for kinetis ftm PWM driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-22 12:36:04 +01:00
Yong Cong Sin
23af6008be drivers: gsm_mux: Namespace macros to prevent compilation errors
Namespace the macros to prevent collision with nuvoton's hal
macros.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-22 12:34:57 +01:00
Yong Cong Sin
5707c1978a drivers: uart_mux: Change size_t log var type to %ld
Change the logging variable type to %ld to prevent compilation
errors.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-22 12:34:57 +01:00
Yong Cong Sin
0de5c085c7 drivers: gsm_mux: Change size_t log var type to %ld
Change the logging variable type to %ld to prevent compilation
errors.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-22 12:34:57 +01:00
Cezar Burlacu
27da68cfb2 hwinfo shell: reset_cause fix
`reset_cause` with no arguments will print the device id.
Change it to print the reset cause.

Tested on nucleo_f767zi.

Signed-off-by: Cezar Burlacu <cezar@embeddedp.ro>
2022-03-22 12:33:11 +01:00
Vinayak Kariappa Chettimada
2214e39821 drivers: timer: nrf_rtc_timer: Dont__disable_irq if BT_LL_SW_SPLIT
Do not use __disable_irq when Zero Latency IRQs are enabled
and the Zephyr open source Bluetooth Controller is used with
Zero Latency IRQs support.

Application shall ensure their Zero Latency IRQ ISRs do not
invoke any kernel APIs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-22 11:36:28 +01:00
Vinayak Kariappa Chettimada
4eb5c375e1 drivers: timer: nrf_rtc_timer: Add Lock Zero Latency IRQs Kconfig
Add an explicit Kconfig option to enable use of
__disable_irq() in nRF RTC timer driver to prevent higher
priority contexts (including ZLIs) that might preempt the
handler and call nrf_rtc_timer API from destroying the
internal state in nrf_rtc_timer.

Relates to commit fcda8699cb ("drivers: timer: extend
nrf_rtc_timer").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-22 11:36:28 +01:00
Jay Vasanth
7c65268f3e drivers: pwm: Microchp XEC PWM driver add PINCTRL support
Add build time optional PINCTRL support to common PWM driver
for Microchip XEC MEC15xx and MEC172x families.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-21 21:49:50 -04:00
Jay Vasanth
845c1185a2 drivers: pwm: Microchip XEC PWM add MEC172x support
Add support for MEC172x series to Microchip XEC PWM driver.
Standardize device tree properties for both SoC families.
Standardize device structure usage.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-21 21:49:50 -04:00
Ruibin Chang
cebcaeed55 ITE drivers/kscan: use wakeup interface for WUC pins
Use wakeup interface for WUC pins in it8xxx2 kscan driver.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-03-21 16:35:03 -07:00
Ruibin Chang
4b75cf8f47 ITE drivers/interrupt_controller: add wuc interface
Add wakeup controller interface for ITE it8xxx2 chip.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2022-03-21 16:35:03 -07:00
Erwan Gouriou
d66c1d9b54 drivers/adc: stm32: Update setup_channels() for G4 series
G4 series have specific LL ADC API that discriminate ADC1 and ADC5
channels. Take this into account in adc_stm32_setup_channels().

Additionally, fix this function to use LL defines as argument of macro
__LL_ADC_CHANNEL_TO_DECIMAL_NB, as good practice.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-21 16:31:27 -07:00
Gerard Marull-Paretas
c1ad91405d drivers: pinctrl: nrf: fix nordic,nrf-twi handling on nRF51/52
The NRF_TWI_Type struct doesn't have an homogeneous layout between
nRF51/52 series. This patch tries to select the right layout based on
selected SoC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-21 15:09:28 +01:00
Alex Sergeev
49edd8558b drivers: ethernet: stm32: avoid segfault if cannot get RX buffer
Avoids segfault in situations when we can't acquire an RX buffer, and VLAN
or PTP code is enabled which tries to inspect packets by adding a pkt
check.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2022-03-21 08:44:58 -05:00
Henrik Brix Andersen
03accdb6a8 drivers: can: guard against bitrate of zero
Guard against attempts to set a bitrate of zero as this will lead to
division-by-zero.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-21 10:15:45 +01:00
Derek Snell
785971b5a0 drivers: gpio: fix when 4 or less PINT IRQs
driver required PIN_INT4_IRQ.  Some devices have 4 or less PINT IRQs.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2022-03-21 10:15:13 +01:00
Henrik Brix Andersen
67ba9900f0 drivers: can: add struct device argument to callback functions
Include a pointer to the CAN controller device for the CAN
transmit, receive, and state change callback functions.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-19 14:31:22 -04:00
Henrik Brix Andersen
5fd079bd68 drivers: can: mcan: add generic support for can_get_max_filters()
Add generic support for can_get_max_filters() to the Bosch M_CAN
base driver and use it in all driver frontends.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-18 16:14:40 -04:00
Nazar Kazakov
f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Andrzej Głąbek
a5234f3647 soc_nrf_common: Extend and rename the NRF_DT_ENSURE_PINS_ASSIGNED macro
Extend the macro with checks for DT properties related to pin
assignments that are defined but would be ignored, depending on
whether PINCTRL is enabled or not, what presumably indicates
a resulting configuration different from what the user expects.

Add also a possibility to indicate that the pinctrl-1 property
should not be checked because the caller does not support the
sleep state.

Rename the macro so that its name better reflects its function.
Update accordingly all drivers that use it.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-18 16:26:21 +01:00
Francois Ramu
29d0660585 drivers: adc: stm32 adc API has a valid internal reference
extend the stm32 adc api to set the ref_internal of 3.3V

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-18 10:21:13 +01:00
Henrik Brix Andersen
a2ee4a3968 drivers: can: stm32h7: fix compilation
Fix compilation of the STM32H7 CAN-FD driver front-end.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-17 18:39:52 -04:00
Francois Ramu
5d9cbbc658 drivers: pwm capture with stm32 can have no callback
When configuring the pwm capture,  the callback function might
be reset, this i not an error. However the isr should not call it
and enabling the capture should always provide a callback function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-17 16:34:54 -05:00
Tim Lin
14bac3f7ac ITE: drivers/i2c: adjust timing registers to pass SI test
Timing registers of I2C 0/1/2 can be adjusted to pass SI test.

We can control the tSU;STA and tHD;DAT simultaneously by changing
the value of the register IT83XX_SMB_4P7USL, and we can control
the tSU;DAT by changing the value of the register IT83XX_SMB_250NS
as well.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-17 15:53:34 -05:00
Tim Lin
f2c42663b4 ITE: drivers/i2c: I2C driver divided into two compatibles
As mentioned in #42882, the I2C of IT8XXX2 is designed for two different
IP blocks, so this PR divides this I2C driver into two compatibles.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-17 15:53:34 -05:00
Rodrigo Brochado
da3ec7dbfa drivers: flash: Fix regression on nrf52840 anomaly 122 workaround
A nordic hal update was made around the same time that anomaly 122 on
nrf52840 was fixed. This update introduced qspi_pins_deconfigure() in
the nrfx_qspi_uninit(). With that, the CS pin from QSPI becomes a
floating pin after anomaly 122 uninit is executed.

Set the CS pin high after the uninit to fix this.

I'm assuming that floating CS pins that are likely to experience EMI
can impact power consumption. That was the case with my custom board.

My custom board with nrf52840 and MX25R3235F running the hello_world
sample was consuming 2.3 mA before this patch, and 30 uA after
applying it.

Signed-off-by: Rodrigo Brochado <git.rodrigobrochado@gmail.com>
2022-03-17 19:04:19 +01:00
Armando Visconti
e8f93a915d drivers: sensor: lsm6dsl: FIX bugs on few registers definition
FIX bugs on few registers definition
Fixes: #43669

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2022-03-17 08:43:39 -05:00
Andrzej Głąbek
c18c5cabf1 drivers: uart_nrfx_uart: Fix incorrect uses of DT_NODE_HAS_PROP
Values of boolean DT properties need to be checked with DT_PROP(),
not DT_NODE_HAS_PROP(). Fix two such incorrect calls in the nRF UART
driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-17 11:43:13 +01:00
Andrzej Głąbek
88ec25b7ee drivers: uart_nrfx_uarte: Fix USE_LOW_POWER macro for PINCTRL case
This macro incorrectly uses DT_NODE_HAS_PROP() to check the truth value
of the "disable-rx" boolean property. In consequence, it always assumes
that RX is disabled and the low power mode needs to be used. Fix this
by replacing the check with DT_PROP().

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-17 11:40:39 +01:00
Sylvio Alves
30c45b0dae intc: esp32c3: use source as interrupt value
Using IRQ as source for interrupt values can
fail when installing irq_connect_dynamic, as
IRQ can previously be enabled. This updates
the logic to use source map and allows
default irq_enable() and irq_disable() to call
esp32c3 interrupt allocator implementation.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-03-17 11:40:31 +01:00
Gerard Marull-Paretas
87b982d878 drivers: adc: shell: use DEVICE_DT_GET
ADC instances can be obtained at compile time, so use DEVICE_DT_GET.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-17 11:37:33 +01:00
Tim Lin
12ac3fde4a ITE: drviers/adc: Adjust the wait time for acquiring a semaphore
After the ADC interrupt is enabled, the interrupt will be triggered
and the ADC channel valid data will be read, so there is no time
limit here.
Refer to the timeout is also set to K_FOREVER in the function of
adc_context_wait_for_completion().

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-17 11:36:48 +01:00
Xavier Chapron
5cc583bf3a drivers: modem: modem_cmd_handler.c: Drop cmd from buf if args are missing
In 90c6dc5e7f, a change was introduced to
allow modem commands determine if they have enough data or not.
In a situation where some data is missing, the command should return
-EAGAIN and this should lead to another call of the command with more
data.
In this commit, the argument parser was also allowed to return -EAGAIN
to request more data due to missing arguments.

However, this can't work because in cmd_handler_process_rx_buf() before
calling process_cmd():
- we make sure that a CR/LF has been found.
- we compute match_len which can't be greater than the distance to the
  next CR/LF.
Therefore, even if the command argument parser ask for more data by
returning -EAGAIN, next call will have the same value for match_len,
meaning that the parsing of argument will result in the same missing
argument situation.
This leads to an infinite loop of parsing the same data over and over in
an infinite loop.

This commit change this behavior to always drop the data in such a
situation. The command will not be answered and will therefore timeout,
but at least, next commands will correctly parse their returned data.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2022-03-17 11:33:17 +01:00
Tim Lin
bec83df576 ITE: drivers/flash: remove flash write protection API
This API has be removed in Zephyr 2.8, and does not need to be used
as a static function. Because flash_it8xxx2_write_protection(false)
is not supported. If the IT83XX_GCTRL_EPLR register in the
flash_it8xxx2_write_protection(false) is written as 1, the flash
write region will not be protected later, only be cleared by
power-on reset.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-17 11:32:51 +01:00
Henrik Brix Andersen
e3f93d7680 drivers: can: stm32fd: fix compilation
Fix compilation of the STM32 CAN-FD driver front-end.

Fixes: #43899

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-17 11:07:55 +01:00
Gerard Marull-Paretas
b618bdbaad drivers: spi: cc13xx_cc26xx: remove CONFIG_PM guards
API provides no-op fallback when CONFIG_PM=n

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-16 15:26:47 +01:00
Gerard Marull-Paretas
a0ade1d856 drivers: i2c: cc13xx_cc26xx: remove CONFIG_PM guards
API provides no-op fallback when CONFIG_PM=n

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-16 15:26:47 +01:00
Gerard Marull-Paretas
5a71eeb35c pm: policy: move constraints to policy API
The pm_constraint_* APIs were effectively used by the policy manager
only. This patch renames the API to the policy namespace and makes its
naming more explicit:

- pm_constraint_set -> pm_policy_state_lock_get()
- pm_constraint_release -> pm_policy_state_lock_put()
- pm_constraint_get -> pm_policy_state_lock_is_active()

The reason for these changes is that constraints can be of many types:
allow/disallow states, impose latency requirements, etc. The new naming
also makes explicit that the API calls will influence the PM policy
behavior.

All drivers and documentation have been updated accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-16 15:26:47 +01:00
Mikkel Jakobsen
0c6cf9a84e drivers: sensor: icm42605: fix arg passing bug in trigger thread
the device data struct pointer is passed to the thread function when
creating the thread, but the thread function did a int-to-pointer cast
which did not work as intended, causing exception during runtime.

now, we just pass the pointer directly without casting, which is the
pattern seen in other sensor drivers.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-03-16 08:58:06 -05:00
Mikkel Jakobsen
f502d21634 drivers: sensor: icm42605: convert to usinggpio_dt_spec
for the interrupt gpio, now use gpio_dt_spec instead of raw gpio.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-03-16 08:58:06 -05:00
Tomasz Bursztyka
9a18fdea3f drivers: Check and fix device const qualifier on ISR
Re-running the script that checks for the const qualifier missing on
struct device ISR's parameter.

The script also changes the parameter 'arg' to 'dev' when relevant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-16 12:33:12 +01:00
Tomasz Bursztyka
16062c2e5a drivers: constify all device instances
Run cocci script to constify device instances.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-16 12:33:12 +01:00
Flavio Ceolin
d2a101cf01 x86: Remove Jailhouse references in this arch
Jailhouse support in X86 was removed long time ago. Just removing some
leftovers.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-16 04:20:26 -07:00
Georgij Cernysiov
44e6fee5d7 drivers: pinmux: stm32: fix MAPR remap
- Move SWJ_CFG initialization into pinmux.
- Don't disable the AFIO clock after SWJ_CFG
  initialization.
- Apply '111' to the SWJ_CFG bits upon remap
  application, that fixes the remap usage.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-03-16 10:26:37 +01:00
Georgij Cernysiov
e17c42bd42 drivers: pinctrl: stm32: fix MAPR remap
- Move SWJ_CFG initialization into pinctrl.
- Don't disable the AFIO clock after SWJ_CFG
  initialization.
- Apply '111' to the SWJ_CFG bits upon remap
  application, that fixes the remap usage.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-03-16 10:26:37 +01:00
Georgij Cernysiov
678017bdb7 drivers: gpio: stm32: remove SWJ from Kconfig
The Serial Wire JTAG configuration is moved to
F1 pinctrl DTS.

The configuration in GPIO didn't apply to the
majority of the STM MCUs except F1.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-03-16 10:26:37 +01:00
Georgij Cernysiov
01aea842b0 drivers: gpio: stm32: remove SWJ CFG init
Removed SWJ_CFG initialization. The functionality
is moved into pinctrl / pinmux modules.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-03-16 10:26:37 +01:00
Dino Li
a39f640b54 it8xxx2: espi: add support for CONFIG_ESPI_OOB_CHANNEL_RX_ASYNC
This makes the driver to support the configuration option.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-03-16 10:26:22 +01:00
Yonatan Schachter
72c61f1005 drivers: hwinfo: Added reset cause support for RPi Pico
Added support for hwinfo's reset cause functions, for the Raspberry Pi
Pico series.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-03-16 10:24:32 +01:00
Yonatan Schachter
90b20fffa4 drivers: hwinfo: Added unique ID support for RPi Pico
Added support for hwinfo's hwinfo_get_device_id for the
RPi Pico series.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-03-16 10:24:32 +01:00
Yong Cong Sin
2befd6ef87 drivers: modem: gsm: Use Kconfig macros directly
Use the Kconfig macros of MODEM_GSM_RX_STACK_SIZE and
MODEM_GSM_WORKQ_STACK_SIZE directly without another macros.

They are well within the column limit and this make them
more obvious that they are actually configurable by Kconfig.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-16 10:23:32 +01:00
Yong Cong Sin
9ee8c12a24 drivers: modem: gsm: wait for cellular registration
The driver should check for cellular registration before
attempting to attach to packet service, otherwise it will just
fails.

This patch waits for registration for 300 seconds, configurable
by CONFIG_MODEM_GSM_REGISTER_TIMEOUT, if it isn't registered by
then, it would toggle the airplane mode using AT+CFUN & wait
again, until it is registered, or `gsm_ppp_stop` is invoked.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-16 10:23:32 +01:00
Hristo Mitrev
b64a83822c drivers: eth_smsc911x_priv: Remove obsolete macros
Back with commit a1b77fd589 huge chunk of code was automatically
refactored using a script, which in turn left some macros meaningless

Signed-off-by: Hristo Mitrev <hr.mitrev@gmail.com>
2022-03-16 10:22:55 +01:00
Gerard Marull-Paretas
9953c194b9 drivers: remove redundant DEV_NAME helpers
Just use dev->name. This change follow same principles applied when
DEV_CFG and DEV_DATA macros were removed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-15 17:31:51 -04:00
Henrik Brix Andersen
d8e88b61eb drivers: can: mcan: add transceiver support
Add support for CAN transceivers to the Bosch M_CAN CAN drivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
000661db21 drivers: can: mcp2515: add transceiver support
Add support for CAN transceivers to the Microchip MCP2515 CAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
63358621bd drivers: can: rcar: add transceiver support
Add support for CAN transceivers to the Renesas R-Car CAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
b9a5e78deb drivers: can: stm32: add transceiver support
Add support for CAN transceivers to the ST STM32 bxCAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
43c02b1e16 drivers: can: mcux: flexcan: add transceiver support
Add support for CAN transceivers to the NXP MCUX FlexCAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
58ff3f08dd drivers: can: move can_set_bitrate() to can_common.c
Move the can_set_bitrate() function to can_common.c as it is getting
quite long for a static inline function.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
0bae208778 drivers: can: add support for getting the maximum supported bitrate
Add support for getting the maximum supported bitrate in bits/s for CAN
controller/transceiver combination and check that a requested bitrate is
within the supported range.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Henrik Brix Andersen
0783b51ee1 drivers: can: add generic GPIO controlled CAN transceiver driver
Add generic driver for GPIO controlled CAN transceivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-15 14:32:29 -05:00
Andrzej Głąbek
44feb7d527 drivers: pwm_nrfx: Add support for pinctrl
Add support for the new pinctrl API to the nRF PWM driver.
Update code of the driver and the related devicetree binding.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
1a01ca2adf drivers: sensor: qdec_nrfx: Add support for pinctrl
Add support for the new pinctrl API to the nRF QDEC driver.
Update code of the driver and the related devicetree binding.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
7d0a2ffcb7 drivers: flash: nrf_qspi_nor: Add support for pinctrl
Add support for the new pinctrl API to the nRF QSPI NOR flash driver.
Update code of the driver and the related devicetree binding.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
fd7633126e drivers: pinctrl: nrf: Add support for PWM, QDEC, and QSPI peripherals
Add support for configuring pins to be used by the nRF PWM, QDEC, and
QSPI peripherals.
A new custom property "nordic,invert" is added to the pin configuration
group binding to allow configuring PWM channel outputs as inverted.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
1c20443ce0 drivers: audio: dmic_nrfx_pdm: Add support for pinctrl
Add support for the new pinctrl API to the DMIC driver that handles
the nRF PDM peripheral. Update code of the driver and the related
devicetree binding.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
3966a33c5c drivers: i2s_nrfx: Add support for pinctrl
Add support for the new pinctrl API to the nRF I2S driver. Update code
of the driver and the related devicetree binding.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Andrzej Głąbek
0e2af43fc6 drivers: pinctrl: nrf: Add support for I2S and PDM peripherals
Add support for configuring pins of the nRF I2S and PDM peripherals.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 18:38:01 +01:00
Gerard Marull-Paretas
03137a6152 drivers: gpio: pca95xx: fix build errors
I introduced some errors during the gpio_dt_spec/i2c_dt_spec conversion
process. This patch fixes the issues so that driver builds.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-15 09:39:45 -07:00
Immo Birnbaum
ca33905248 drivers: gpio: Xilinx PS MIO / EMIO GPIO driver
Driver implementation for the Xilinx Processor System MIO / EMIO GPIO
controller as contained in the Zynq-7000 and ZynqMP (UltraScale) SoCs.

The driver is split up into source and header for a parent controller
device and source and header for 1..n child GPIO pin bank devices.
The parent device driver takes care of IRQ handling, the GPIO pin bank
driver provides pin / bank access according to the API defined by the
GPIO subsystem.

More than one device for this type of GPIO controller is required as
it provides access to a number of GPIO pins well in excess of the 32
pins addressable by the current GPIO API (whereever parameters or
return values come in the form of a bit mask):

- Zynq-7000: 54 MIO GPIO pins, 64 EMIO GPIO pins in 4 banks.
- ZynqMP:    78 MIO GPIO pins, 96 EMIO GPIO pins in 6 banks.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-03-15 08:44:46 -07:00
Hake Huang
8c5a4fc3b0 drivers: sai: add pinctrl support in mcux sai
enable i2s pinctrl

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-03-15 10:12:57 -05:00
Hake Huang
40f3ab9f72 drivers: uart: add pinctrl support in mcux lpuart
enable pinctrl in lpuart driver, and clean up driver instance definition
macros

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-03-15 10:12:57 -05:00
Hake Huang
3fc6353b36 drivers: pinctrl: add mcux_rt pinctrl driver
Add pinctrl driver for rt1xxx

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-15 10:12:57 -05:00
Benedikt Schmidt
09d2199589 stm32: adc: use ADC properties to configure temp and vref channels
Use the devicetree properties to determine if the dedicated temperature or
voltage reference channels should be configured for the ADC.
Fixes #43750.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-03-15 10:50:52 +01:00
Frank Terbeck
1f0b1403f5 stm32,i2c: Fix large I2C transactions
The stm32's I2C peripheral has a maximum transmission size. Larger trans-
action, that I2C itself allows, can be achieved be using the peripheral's
reload-mode.

In order to do that, st's low-lever drivers need to be informed according-
ly. The previous iteration of the code mishandled the next_msg_flags para-
meter, causing the issue to manifest itself.

This refactors the inner loop of i2c_stm32_transfer() into its own func-
tion. This passes the message parameter by value in order to be able to
mutate its state while keeping the original datum from the user intact
during the entire procedure.

Fixes #43235

Signed-off-by: Frank Terbeck <ft@bewatermyfriend.org>
2022-03-15 10:05:48 +01:00
Jordan Yates
ad959bc2bb wifi: esp_at: claim net_context in rx
Claim the net_context mutext associated with a socket before claiming
the socket mutex. The receive callback claims the net_context mutex
internally, which will now always succeed immediately.

The TX path claims the net_context mutex before the socket mutex, and if
we don't use the same order, we can end up in a deadlock.

Fixes #43470.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-03-15 10:05:36 +01:00
Andrzej Głąbek
6014be589e drivers: nrf_qspi_nor: Exit DPD at driver initialization
It may happen that after the flash chip was previously put into
the Deep Power Down mode, the system was reset but the flash chip
was not. Consequently, the flash chip can be in the DPD mode when
the QSPI driver is initialized. Some flash chips will just exit
the DPD mode on the first CS pulse, but some need to receive the
dedicated command to do it and they will not respond to any other
commands including those that the driver need to perform to complete
its initialization ("Read status register" and "Read JEDEC ID").
This commit adds sending of the "Release from Deep Power Down"
command right after initialization of the QSPI interface to avoid
the problem described above.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-15 09:58:46 +01:00
Daniel Leung
e186ebc314 wifi: fix build error on wifi_winc1500_nm_bsp_internal.h
Previous commit 579ca90e25 to
build wifi drivers as a library changed the include path for
the WINC1500 driver, which results in the include path being
local to the library. However, the Atmel HAL requires
wifi_winc1500_nm_bsp_internal.h to in the search path. So
change the include path to be global.

Fixes #43456

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-03-14 22:04:54 -04:00
Nazar Kazakov
9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Hristo Mitrev
8fddea97de drivers: uart_mux: Fix build issue
The build failed when CONFIG_GSM_MUX=y

Signed-off-by: Hristo Mitrev <hr.mitrev@gmail.com>
2022-03-14 09:37:42 -05:00
Maureen Helm
c3ae364467 drivers: i2s: Refactor drivers to use shared init priority
Refactors the remaining I2S drivers to use the shared driver class
initialization priority configuration, CONFIG_I2S_INIT_PRIORITY, to
allow configuring I2S drivers separately from other devices. This is
similar to other driver classes.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to be
consistent with other driver classes.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-03-14 10:37:28 -04:00
Francois Ramu
1c7c4506d8 drivers: clock_control of the stm32l0x or stm32l1x devices
Fix register bit field when clock source is MSI
on the stm32L0x or stm32L1x mcus
Use RCC_CR_MSIRGSEL bit field instead of not soc stm32wbx serie
That bit of the RCC CR is common to several stm32 mcus

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-14 08:56:19 -05:00
Attie Grande
66e8eae66a drivers: i2c: sam0: Implement bus locking
After experiencing a few deadlocks, it was discovered that this bus does
not implement any form of mutual exclusion... this patch addresses this
and resolves potential deadlocks.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-03-14 11:31:32 +01:00
MohanKumar Kumar
a2e3774e54 drivers: eth: stellaris: Fix build error
Use the correct variable name in eth_stellaris, which fixes
the build error.

Signed-off-by: MohanKumar Kumar <mohankm@fb.com>
2022-03-14 11:28:41 +01:00
Maureen Helm
41634c82cc drivers: interrupt_controller: Refactor drivers to use shared init prio
Refactors interrupt controller drivers to use the shared driver class
initialization priority configuration, CONFIG_INTC_INIT_PRIORITY, to
allow configuring interrupt controller drivers separately from other
devices. This is similar to other driver classes.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEFAULT to preserve
the existing default initialization priority for most drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-03-14 11:28:06 +01:00
Maureen Helm
c8f9f53322 drivers: i2c: Refactor drivers to use shared init priority
Refactors the remaining I2C drivers to use the shared driver class
initialization priority configuration, CONFIG_I2C_INIT_PRIORITY, to
allow configuring I2C drivers separately from other devices. This is
similar to other driver classes.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-03-11 15:45:28 -08:00
Daniel DeGrasse
4f792714a8 drivers: usb_dc_mcux: Enable second USB EHCI
Enable second usb EHCI if usb2 node has status="okay" Note that this
driver is still an single instance driver, this change simply enables
the driver to work with the usb2 peripheral if that one is enabled, and
usb1 is disabled.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-11 14:50:11 -08:00
Pete Dietl
90c3693005 stm32: adc: Improve handling of voltage ref and internal temp
This change includes special handling of the internal voltage
reference and internal die temperature channels for all currently
defined STM32 models

The code now looks for specific ADC + channel ID pairs instead
of just a channel ID to determine if the caller is trying to
configure an internal channel.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2022-03-11 11:27:55 -08:00
Henrik Brix Andersen
0bdc2983d0 drivers: can: stm32: only call state change callback if state is changed
Only call the state change callback if the state has changed. Reuse the
existing function for retrieving the CAN controller state instead of
having the same code twice.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-11 11:27:09 -08:00
Henrik Brix Andersen
00a3a0f184 drivers: can: stm32: add statistics support
Add CAN controller statistics support to the STM32 bxCAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-11 11:27:09 -08:00
Carles Cufi
af9a6a6924 drivers: clock_control: nrf: Fix missing dependency to mt
The temperature sensor used in the clock_control driver requires
multithreading, but this is not compatible with mcuboot builds with
multithreading disabled.

Fixes #41597.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-03-11 08:22:31 -06:00
Avi Green
a2190cc92b bmi160: bmi160_bus union bugfix
bmi160.c module defines DT_DRV_COMPAT, but bmi160_trigger.c doesn't.
This causes a catastrophic chain of events.
The bmi160.c module includes bmi160.h,
in which the macro DT_ANY_INST_ON_BUS_STATUS_OKAY
affects the size of bmi160_bus union.
So bmi160.c defines a bmi160_cfg struct which contains that union.
Now, in bmi160_trigger_init we get a pointer to that config struct.
The fact that this module now includes bmi160.h without
DT_DRV_COMPAT, causes it to think the union is empty.

That doesn't cause compilation error, just undefined behaviour,
In which you address an empty struct fields.

In general, I suggest that someone makes sure it doesn't happen
in other drivers as well. The problem presented here is general,
meaning that if an h file assumes someone defined DT_DRV_COMPAT
before and it doesn't,
it may lead to some weird behaviour, like the one described.

Signed-off-by: Avi Green <avigreen1978@yandex.com>
2022-03-11 07:05:12 -06:00
Peter Marheine
1cf884786b drivers: it8xxx2: fix GPIO interrupt enables
gpio_pin_interrupt_configure asserts that one of GPIO_INT_ENABLE or
_DISABLE is specified by the caller, and also that GPIO_INT_EDGE is
requested if both states (GPIO_INT_TRIG_BOTH) should interrupt. This
change corrects the misuses in it8xxx2 drivers that cause assertion
failures.

When assertions are disabled the existing code works correctly because
the it8xxx2 GPIO driver assumes that a pin interrupt should be enabled
if _DISABLE is not requested, and the driver only supports edge
triggers but assumes the absence of GPIO_INT_MODE_LEVEL indicates
an edge trigger was requested.

Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Change-Id: I1aaee190ec4cf063f36e25c0c293a91d280e71bb
2022-03-11 11:00:22 +01:00
Julien Massot
03dffa5434 drivers: intc_gicv3: use BIT64_MASK instead of BIT_MASK
On 32bit compiler the BIT_MASK(32) generate a warning,
after discussion on #42226 and #42163, advise was to use
BIT64_MASK instead.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-03-11 10:59:48 +01:00
Julien Massot
dd74db46e4 arch: arm: cortex_a_r: add MPIDR and SG1R definition
These definitions are required to be able to use GICv3
interrupts controller on an ARMv8 AArch32 processor.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-03-11 10:59:48 +01:00
Francois Ramu
61bef2087f drivers: spi: stm32 spi with dma must enable cs after periph
When using DMA to transfer over the spi, the spi_stm32_cs_control
is done after enabling the SPI. The same sequence applies
in the transceive_dma function as in transceive function

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-11 10:59:05 +01:00
Jay Vasanth
3e25b36979 driver: i2c: mec15xx: i2c clk and data same group
I2C clock and I2C gpio could be on same gpio group.
Remove assertion that required them to be on different
group.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-10 16:08:37 -05:00
Peng Fan
d1b8743b37 drivers: console: add jailhouse debug console
Support jailhouse hypervisor debug console

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-03-10 14:05:00 -05:00
Peng Fan
f6b608798f clock_control: mcux_ccm: fix build warning for ARM64
Fix below warning:
"warning: cast from pointer to integer of different size"

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-03-10 12:57:37 -06:00
Peng Fan
827f472560 clock: mcux_ccm: support uart1/2/3
Add UART1/2/3 clock support, also update uart4 to read clock root
mux to get clock rate.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-03-10 12:57:37 -06:00
Peng Fan
06b8dc6790 nxp: imx: rename IMX_CCM_UART_CLK to IMX_CCM_UART4_CLK
The code is actually using uart4, so rename
IMX_CCM_UART_CLK to IMX_CCM_UART4_CLK

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-03-10 12:57:37 -06:00
Pete Dietl
060e39e75a uart: logging: Add configurable log level to UART drivers
This change adds compile-time selection of log level for
the UART drivers.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2022-03-10 13:49:43 -05:00
Henrik Brix Andersen
d4023b3c1b drivers: gpio: move non-standard dts flags to be soc specific
Reserve the upper 8 bits of gpio_dt_flags_t for SoC specific flags and
move the non-standard, hardware-specific GPIO devicetree flags (IO
voltage level, drive strength, debounce filter) from the generic
dt-bindings/gpio/gpio.h header to SoC specific dt-bindings headers.

Some of the SoC specific dt-bindings flags take up more bits than
necessary in order to retain backwards compatibility with the deprecated
GPIO flags. The width of these fields can be reduced/optimized once the
deprecated flags are removed.

Remove hardcoded use of GPIO_INT_DEBOUNCE in GPIO client drivers. This
flag can now be set in the devicetree for boards/SoCs with debounce
filter support. The SoC specific debounce flags have had the _INT part
of their name removed since these flag must be passed to
gpio_pin_configure(), not gpio_pin_interrupt_configure().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-10 13:46:34 -05:00
Bernd Weiberg
fd8702474d drivers: fixed return code bug in eth_stm32_hal_set_config()
The function eth_stm32_hal_set_config() located in
drivers/ethernet/eth_stm32_hal.c always returns -ENOTSUP,
even if everything is fine. This commit fixes the return statement
so that the real result (ret) will be returned.

Signed-off-by: Bernd Weiberg <bernd.weiberg@siemens.com>
2022-03-10 13:44:48 -05:00
Erwan Gouriou
3a041ca5c8 drivers/bluetooth: stm32wb: Allow sequential C2 start
Set up a c2_reset procedure in order to allow sequential
open/close/open calls and keep c2_reset done at init (required
for flash access).
Move reinit out of the reset procedure, so flash could be
accessed after bt_disable().

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-10 13:28:41 -05:00
Erwan Gouriou
045c986314 drivers/bluetooth/hci: stm32wb: Implement close api
Add treatment for close api.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-10 13:28:41 -05:00
Erwan Gouriou
49b15c8306 drivers/bluetooth/hci: stm32wb: Move RX thread creation to open
In order to enable RX thread abortion on close, move creation
to from init to open.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-10 13:28:41 -05:00
Jose Alberto Meza
ee1653985d drivers: espi: xec: mec172x: Handle eSPI peripheral channel error
Handle eSPI periperal channel error to avoid continous interrupt
beyond the bus error.

Whenever an eSPI access causes an internal bus error,
PC_BUS_ERROR bit is set, it remains set until cleared by written
with an 1.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-03-10 13:25:13 -05:00
Tomislav Milkovic
7f365f46b8 drivers: clock_control: clock_stm32_ll_h7: Fix PLL3 PQR output init
Due to typo in macro name, PLL3P, PLL3Q and PLL3R outputs
are never enabled

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-03-10 09:44:52 -05:00
Tom Burdick
ad2799ed15 drivers: dma: nios2: const device driver config
Moves the nios2 msgdma driver device config struct to the device data
struct for mutable data. The config struct is expected to be const.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-03-09 14:13:02 -05:00
Tom Burdick
82449f6749 drivers: i2c: nios2: const driver config
Moves the nios2 msgdma driver device config struct to the device data
struct for mutable data. The config struct is expected to be const.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-03-09 14:13:02 -05:00
Henrik Brix Andersen
e9c9caa80d net: remove unmaintained 6LoCAN implementation
Remove the unmaintained, experimental 6LoCAN (IPv6 over CAN bus)
implementation.

Fixes: #42559

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-09 18:07:31 +01:00
Jeremy Wood
2331b76b9b drivers: lis2dh: power management
* Add support for power management.

Signed-off-by: Jeremy Wood <jeremy@bcdevices.com>
2022-03-09 10:19:22 -06:00
Henrik Brix Andersen
9fe466f4b0 drivers: can: rcar: add statistics support
Add CAN controller statistics support to the Renesas R-Car CAN driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-03-09 09:51:05 -06:00
Gerard Marull-Paretas
034b705745 drivers: counter: native_posix: use tabs in Kconfig
Kconfig used spaces instead of tabs, leading to compliance failures.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Gerard Marull-Paretas
dffaf5375c kconfig: tweak Kconfig prompts
Tweak some Kconfig prompts after the removal of "Enable...".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Gerard Marull-Paretas
95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Andrzej Głąbek
89cc06e588 drivers: gpio_pcal6408a: Fix handling of the GPIO_INT_DEBOUNCE flag
Ignore the flag instead of rejecting it with -ENOTSUP, as this is what
the GPIO API expects from drivers that do not support debouncing.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:06:20 +01:00
Andrzej Głąbek
b2a4a3672f drivers: i2c: nrfx: Add support for pinctrl
Add support for the new pinctrl API to the I2C drivers that handle
the nRF TWI and TWIM peripherals. Update code of the drivers and
related devicetree bindings.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:05:22 +01:00
Andrzej Głąbek
32b9e65e4b drivers: spi: nrfx: Add support for pinctrl
Add support for the new pinctrl API to the SPI drivers that handle
the nRF SPI, SPIM, and SPIS peripherals. Update code of the drivers
and related devicetree bindings.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:05:22 +01:00
Andrzej Głąbek
2a87e04ce6 drivers: spi: nrfx: Clean up code
- clean up registration of the drivers with the logging subsystem
- use consistent naming of local variables accessing configuration
  and runtime data of driver instances, for easier code maintenance

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:05:22 +01:00
Andrzej Głąbek
fa22634880 drivers: pinctrl: nrf: Add support for SPI and TWI peripherals
Add support for configuring pins of the following nRF peripherals:
SPI, SPIM, SPIS, TWI, and TWIM.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:05:22 +01:00
Andrzej Głąbek
70fb3124db drivers: serial: nrfx: Ensure that instances have some pins assigned
Add build assertions that will ensure that every peripheral for
which a driver instance is created has some pins assigned to it.
Neither pinctrl-0 nor *-pin properties can be currently marked as
required in devicetree, so these assertions will help users avoid
invalid configurations where it could be hard to figure out why
the UART is not working.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-09 12:05:22 +01:00
Simon Frank
4d4bc67243 gpio: mcp23s17: use gpio_driver_data not config
fix incorrect gpio driver struct used in driver data.
This should not have caused any issue as currently
sizeof(gpio_driver_data) == sizeof(gpio_driver_config).

Signed-off-by: Simon Frank <simon.frank@lohmega.com>
2022-03-08 09:20:15 -06:00
Sam Hurst
6458649137 stm32: Add STM32 USB TCPC Driver
This commit adds a USB Type-C Port Controller Driver for
the STM32 USB Type-C / USB Power Delivery (UCPD) peripheral

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-03-08 11:08:43 +01:00
Krzysztof Chruscinski
47ae656cc1 all: Deprecate UTIL_LISTIFY and replace with LISTIFY
UTIL_LISTIFY is deprecated. Replacing it with LISTIFY.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-08 11:03:30 +01:00
Yegor Yefremov
1155d4679b drivers: serial: fix typos
Typos were found with codespell utility.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2022-03-08 10:24:23 +01:00
Mikkel Jakobsen
da514737d0 drivers: sensor: icm42605: fix default kconfig issues
by default, a global trigger thread was enabled in kconfig but
the thread priority and stack size depended on a local thread
being enabled.

the local thread option was never used anywhere so it is removed.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-03-07 16:23:36 -06:00
Mikkel Jakobsen
9d3f9e3921 drivers: sensor: icm42605: make trigger mode choice named
convert choice to named choice to allow setting from Kconfig.* files

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-03-07 16:23:36 -06:00
Daniel DeGrasse
694e6493af timers: mcux_gpt_timer: Change MCUX GPT timer to use indirect ISR
Indirect ISR automatically calls power management functions, which GPT
timer direct ISR was not calling. Calling these functions means that the
kernel will recognize that it is exiting low power mode when the GPT
timer interrupt fires that wakes the SOC up, and will call
pm_power_state_exit_post_ops, which can in turn raise the clock
frequencies and voltage of the SOC as early as possible.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-07 13:53:14 -06:00
Daniel DeGrasse
6696d834cf drivers: serial: Add pm constraint setting to mcux lpuart driver
System entering sleep state before uart tx is complete can result in
characters being dropped from the transmission. Add pm constraint
setting to the lpuart driver to prevent character drops

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-07 13:53:14 -06:00
Jay Vasanth
3034693509 drivers: i2c: MEC15xx: Improved error handling
1. Check I2C Clock and Data is high through GPIO driver instead
of the I2C bitbang registers
2. i2c_xec_poll_write() and i2c_xec_poll_read() will poll to
check I2C clock and data lines are high before initiating the
transaction. The polling will be every 25us for a cumulative
max of 2.5ms
3. wait_completion() will not call recover_from_error() to reset
the controller. Instead will poll for 10ms for the PIN bit to
clear before returning error.
4. wait_completion() will send STOP if the 9th bit is NACK
5. If any errors with current transaction:
(a) Set error_seen flag.
(b) In the next transaction do the recovery process (reset the
i2c controller) if the clk and data lines are high.
Note: error_seen flag is set for Address NACK with Repeated
Start as well.
6. If timeout error occurs in wait_completion():
(a) Set timeout_seen flag;
(b) Wait till the slave will release the clock.
(c) Once slave releases clock send STOP on the bus. If the
timeout occurred while master read, read the I2C DATA register
for the hardware to proceed.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 14:13:34 -05:00
Bartosz Bilas
718225dadf drivers: ethernet: dsa_ksz8xxx: fix spi bus initialization
spi_dt_spec structure initialization should not be done
in the runtime during spi bus initialization because it
causes kernel panic.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-03-07 09:54:21 -06:00
Rafał Kuźnia
1a0fed70d5 drivers: timer: Set user RTC channel count conditionally
The RTC user channel count is increased contitionally to 2 when
nrf_802154 radio driver is enabled.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2022-03-07 09:26:52 -06:00
Rene Bredlau
876ea8d215 modem: hl7800: use correct timeouts on KTCPSND to avoid internal deadlock
The response of a KTCPSND has two phases. According to documentation by
wireless the timeout is 60 seconds. The fix respects the timeout on the
second phase, too (waiting for OK or errors from modem). Previously only
the first phase used 60 seconds and the second phase used 5 seconds.

Without this fix the hl7800 will lock the tcp stack for the current
socket indefinitely if another socket operation is performed before the
response from the modem is received.

Additionally all timeouts are adjusted to be at least one second longer
as the documented timeout from wireless. This avoids races between the
hl7800 and the driver.

Signed-off-by: Rene Bredlau <git@unrelated.de>
2022-03-07 09:24:25 -06:00
Andrzej Głąbek
70a9e2055c drivers: Remove undesirable irq_enable calls from nrfx driver shims
Shims for nrfx drivers should only connect the related IRQ handlers,
they should not enable the IRQs, as this could lead to a situation
where the interrupt handler is called before the driver had a chance
to properly initialize the peripheral and install the provided event
handler. nrfx drivers will enable the interrupts appropriately on
their own by calling the NRFX_IRQ_ENABLE macro which is implemented
in nrfx_glue.h as a call to irq_enable().
This commit fixes the above issue spotted in the following shims:
- dmic_nrfx_pdm
- clock_control_nrf
- i2s_nrfx

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-03-07 09:19:56 -06:00
Erwan Gouriou
d74cb2a3df drivers/clock_control: stm32h7: Simplify SysClk freq computing
Instead of reading registers query the info on sysclock configuration
from existing configuration symbols.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
2116606ce2 drivers/clock_control/stm32h7: Independent clocks configuration
Rework clock start up functions in order to allow configuration
and enabling of individual clocks.
This way, each clock defined with a "okay" status will be enabled
even if not part of the sysclock clock tree.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
ceb8579854 include/drivers/clock_control: stm32: Add XXX_ENABLED and XXX_FREQ
Add STM32_FOO_ENABLED and STM32_FOO_FREQ to STM32 fixed clocks:
HSI, HSE, MSI(S), CSI, LSI, LSE..

Replace STM32_LSE_CLOCK by STM32_LSE_FREQ and when possible
replace by new STM32_LSE_ENABLED when making sense.

Fix STM32_PLL3_FOO_ENABLE to STM32_PLL3_FOO_ENABLED

Additionally, add STM32_PLL_FOO_ENABLED definitions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
348070e4ea drivers/clock_control: stm32u5: Use LL API for LSESYS programming
Use LL API when possible.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
5a1fe914ff drivers/clock_control stm32h7: Move RCC HW semaphore unlock
PLL3 setting should also be protected CFG_HW_RCC_SEMID.
Move semaphore unlock after we're done with PLL3.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
87eba815dd drivers/clock_control: stm32h7: Complementary readability changes
- Factorize elementary clocks setup code.
- Put conditional logic on CONFIG_CPU_CORTEX_M4 outside init function

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
12404f7668 drivers/clock_control: stm32h7: Make driver more readable
Re-arrange code using benefits of IS_ENABLED.
Change some #if to #ifdef when possible.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Erwan Gouriou
a911b81a2e drivers/clock_control: stm32u5: Make driver more readable
Use benefits of IS_ENABLED.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Jay Vasanth
73f24056d5 kscan: update mchp keyscan module to use pinctrl
Changes to keyscan module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
9138d81365 adc: updates to MEC172x adc to support pinctrl
Changes to adc module to support pinctrl.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
535c20e490 qmspi: MEC172x: fix unused variable warning
Fix unused variable warning when CONFIG_SPI_ASYNC
is not defined

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
99c89ebb78 qmspi: update MEC172x qmspi module for pinctrl
Changes to qmspi module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
156440f3f0 serial: update mchp uart module to use pinctrl
Changes to uart module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
f8130d5ce3 espi: updated MEC172x espi module for pinctrl
Changes to espi module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
63ac835988 i2c: update MEC172x i2c module for pinctrl
Changes to i2c module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
5cccbb13bc gpio: MEC172x: update gpio module for pinctrl
Changes to gpio module to support pinctrl

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Jay Vasanth
2cd02bd826 drivers: pinctrl: Microchip MEC172x pinctrl driver
Add core files for Microchip MEC172x pinctrl driver

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-07 11:03:06 +01:00
Sylvio Alves
a4a2b9f1cd pinmux: esp32: check only for pullup
Current implementation checks for pulldown and
pullup. As pinmux configuration is related to PU only,
this PR checks for PU feature instead of PD.
This also fix missing PU check when PD is present.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-03-07 10:54:18 +01:00
Dino Li
d8c2c2cbb8 it8xxx2: timer: to unified method of enabling event timer.
This enable timer and also reset it.

fixes #42851
fixes #42953

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-03-07 10:51:29 +01:00
Artur Hadasz
5451c8b70f modules: hal_nordic: 802.15.4 make possible to disable CSMA-CA
Currently if an attempt to disable CSMA-CA in by setting an
appropriate flag in another (for example application)
CmakeLists.txt it caused lots of warnings. This fix allows
higher level CMakeLists.txt to disable CSMA-CA without
warnings.

Signed-off-by: Artur Hadasz <artur.hadasz@nordicsemi.no>
2022-03-07 10:51:21 +01:00
Francois Ramu
8e99151937 drivers: entropy: stm32 rng driver should not block if Seed error occurs
When a Seed error occurs during the random nb generation,
the driver tries to recover and exit without providing a random data
This avoids looping endlessly on the DRDY bit of the RNG status reg
because it remains 0 in case of error.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-03-07 10:49:19 +01:00
Andrew Hedin
c64783f29d drivers: sensors: lis2dh: Allow any movement on interrupt 1
Allow movement detection to be used on hardware
that only has one interrupt line connected.
Change hardware configuration to a bitmask.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2022-03-07 10:46:17 +01:00
Gerard Marull-Paretas
ee30559f07 soc: arm: nuvoton_npcx: s/SOC_POWER_MANAGEMENT_TRACE/NPCX_PM_TRACE
Rename CONFIG_SOC_POWER_MANAGEMENT_TRACE to CONFIG_NPCX_PM_TRACE so that
it is clear that it's a NPCX specific option.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-04 09:05:45 -06:00
Tim Lin
056738514a ITE: drivers/adc: implement ADC channels 13-16
The ADC driver of IT81302 chip can support channels 0-7 & 13-16.
This PR adds to implement ADC channels 13-16.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-03-04 09:03:04 -06:00
Gerard Marull-Paretas
cb9a279050 drivers: dma: dw_common: fix style issue
Fix a couple of issues reported by checkpatch:

ERROR:POINTER_LOCATION: "(foo*)" should be "(foo *)"

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-04 08:55:45 -06:00
Emil Lindqvist
8b4a3e2328 sensor: vcnl4040: add missing semicolon
Adding missing semicolon to vncl4040 driver

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2022-03-03 18:52:28 -05:00
Daniel DeGrasse
1fd4205eee drivers: serial: Add pinctrl support to mcux uart driver
Add pinctrl support to mcux uart driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-03 13:00:20 -06:00
Daniel DeGrasse
fc8877187e drivers: pinctrl: Add kinetis pinctrl driver
Add kinetis pinctrl driver. Driver initializes clocks for each port, and
exposes the pinctrl_configure_pins function required for pinctrl
support.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-03-03 13:00:20 -06:00
Kamil Piszczek
cf6a58d3f6 bluetooth: hci: rpmsg: use ipc service library
The Bluetooth HCI driver based on the RPMsg transport now uses the IPC
service module. The compatible Bluetooth sample - HCI RPMsg - has also
been migrated to the new IPC solution.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2022-03-02 17:03:01 +01:00
Carlo Caione
5e810dd34d mbox: Fix function syscall check
The syscall check is done using a wrong function name. Fix it.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-03-02 07:55:32 -08:00
Dino Li
7a9a5cec0b it8xxx2: espi: reduce h2ram pool size
This saves 1280 bytes memory space by default eSPI configurations.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-03-02 09:45:14 -06:00
Krzysztof Chruscinski
d13ab8b367 drivers: mbox: Add configurable init priority
Add configurable initialization priority.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-02 09:42:09 -06:00
Flavio Ceolin
d2a56c5047 drivers: crypto: Add multipart hash support
Add a new API to support multipart hash calculation. The API allows
split the data input to be split in small chunks.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin
64f6a5ec37 drivers: crypto: mtls: Add support for hashing
Add support for hashing on mtls driver.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin
981ea3042e drivers: crypto: Keep namespace consistent
The API to set a callback has the namespace cipher but the driver
function pointer was using the namespace crypto. As this API belongs
to the cipher subgroup, just rename the function pointer in the driver
to be consistent.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin
ce48b8c3d1 drivers: crypto: s/cipher_struct/cipher
Just give a better name to this file since now we have changed the
file where crypto driver API is defined.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin
df3d1f83f7 drivers: crypto: Rename cipher file
This file defines the crypto driver API, cipher is supposed to be just
one type of capability (other can be hash) of these drivers, just
change the file name to be consistent with it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Flavio Ceolin
d1628ba035 drivers: crypto: Add cipher namespace in some API
Add 'cipher' namespace in some in the driver API since these
operations are for cipher.

Set a namespace to make it clear that these are cipher operations,
this allow further functionalities, like hash, to be added in this
driver API.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-03-01 16:32:43 -05:00
Casper Meijn
2eb1feea91 drivers: display: st7789v: fix gpio_dt_spec initialization
The `gpio_dt_spec` structures where never initialised, therefore the driver
would always fault with "E: Reset GPIO device not ready" printed to the
console.

Fixes: 069bf6be44
("drivers: display: st7789v: use gpio_dt_spec")

Signed-off-by: Casper Meijn <casper@meijn.net>
2022-03-01 14:38:21 -06:00
Qingsong Gou
b0eb3207a9 drivers: kscan: add support for cst816s touch panel driver
Add touch panel driver support for pinetime

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
2022-03-01 14:24:27 -06:00
Aymeric Aillet
732f829f69 drivers: pinctrl: rcar: Rework pin configuration
Rework pin configuration to meet documented procedures.
3 procedures are covered here:
  - GPIO -> Peripheral (+select peripheral function)
  - Peripheral -> GPIO
  - Change from Peripheral function 1 -> Peripheral function 2

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-03-01 12:20:25 -08:00
Jay Vasanth
8c193743ac drivers: bbram: mec: fixed compilation error
Fixed compilation error when building bbram driver
for MEC15xx

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-03-01 14:18:55 -06:00
YuLong Yao
344e7284c3 drivers: pinctrl_gd32_afio: add header file.
add soc.h include in pinctrl_gd32_afio.c

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2022-03-01 18:06:14 +01:00
Andy Ross
27a59ec9d5 drivers/ipm: Add ipm_cavs_host: host/DSP communication on adsp_intel
Intel Audio DSPs have "IPC" interrupt delivery and shared memory
window hardware.  The Sound Open Firmware project has historically
used the combination of these to implement a bidirectional
message-passing interface.  As it happens, this protocol is an
excellent fit for Zephyr's somewhat geriatric but still useful IPM
interface.

This implements a SOF-protocol-compatible transport that will
hopefully prove a bit more futureproof for non-Intel SOF
architectures.  It is a software-only device, built on top of the
underlying SOC APIs for the SRAM windows (in cavs-shim) and IPC
(cavs_ipc).

Note that SOF actually has two protocol variants (ipc3 and ipc4): in
both, the command header (passed as the "id" parameter in IPM) is sent
via the hardware doorbell register.  But in ipc4, the second hardware
scratch register is used to transmit the first four bytes of the
command before involving the SRAM window (in ipc3, it's ignored).
Both modes are supported by this driver, set IPM_CAVS_HOST_REGWORD to
choose the "ipc4" variant.

Finally: note that the memory layout for the windows in question is
inherited from SOF, and for compatibility (with both SOF and with the
offsets used by the host!) these can't be changed without major
surgery.  They're defined in kconfig, but should be treated as
read-only until we get a chance to rework the way Zephyr does its SRAM
window management (and probably in concert with the host drivers).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-03-01 09:59:15 -05:00
Andy Ross
ebf48d7112 drivers/ipm: Add IPM_CALLBACK_ASYNC mode
Some IPM devices support asynchronous command processing, where
acknowledgment of an IPM message can be delayed while handling
happens in a context other than the ISR that invoked the callback.
Expose this via a kconfig that can be selected by the driver, and add
a new "complete" call (a zero-overhead stub on non-supporting devices)
to signal the end of message handling.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-03-01 09:59:15 -05:00
Bartosz Bilas
a3af7007f7 drivers: sensor: iis3dhhc: convert to spi_dt_spec
Convert icm42605 driver to use spi_dt_spec helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-03-01 11:54:07 +01:00
Yong Cong Sin
d8c9033e22 drivers: console: gsm_mux: gsm_mux_state_str should be static
`gsm_mux_state_str` is only used internally and therefore
should be 'static'.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-03-01 11:53:15 +01:00
Mikkel Jakobsen
daeaf9b89a drivers: clock_control: add stm32h725 support
the stm32h725 has the same maximum clock frequencies as the stm32h723.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
2022-02-28 09:15:33 -06:00
Michał Barnaś
521cb6d88a i2c: allow shell commands to operate on up to 32-bit registers
Improve shell commands to support up to 32-bit addresses.
The check if function should use 8/16/24/32-bit address is basing
on the length of address used in function parameter. To address
registers below 256 using 16-bit, one should write them left-padded
with zeroes. Address is sent in big endian.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-02-28 11:09:05 +01:00
Michał Barnaś
d9a657dee5 i2c: fix for MISRA in i2c shell commands
This commit changes the shell parameter name to meet the MISRA
check requirements.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-02-28 11:09:05 +01:00
Yong Cong Sin
6e6009ea55 drivers: modem: gsm: define retry delay in macro
Define the delay used to reschedule work when AT command failed
in a macro.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
a5394e865a drivers: modem: gsm: Define tx_lock timeout at the top
The tx_lock timeout is closely related to GSM_CMD_AT_TIMEOUT
& GSM_CMD_SETUP_TIMEOUT, and should be longer than both of
them, otherwise the gsm_ppp_stop might fail to lock the tx.

Define the timeout at the top of the driver and added a comment
to make it clear for the user.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
7a6764987e drivers: modem: gsm: remove use of preprocessor directives for rssi
The rssi_work_handle always exists in the gsm struct, so use

```
if (IS_ENABLED(CONFIG_GSM_MUX))
```
instead of

```
#if defined(CONFIG_GSM_MUX)
```

for better code readability.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
f505028280 drivers: modem: gsm: cancel rssi work only if GSM_MUX is enabled
There's no need to cancel rssi work when CONFIG_GSM_MUX isn't
enabled, since it is not scheduled.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
62c383d062 drivers: modem: gsm: rssi_work should be submitted to gsm workq
The rssi_work_handle should be submitted to the gsm workqueue
using the gsm_work_reschedule, fix that.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
cd216b17e0 drivers: modem: gsm: Reset attached flag on stop
The 'attached' flag should be reset on gsm_ppp_stop, or else
some part of the gsm_finalize_connection won't be executed
during the next gsm_ppp_start.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
db31558c7d drivers: modem: gsm: Convert gsm_finalize_connection to work
Convert gsm_finalize_connection into a work so that the caller
work won't have to run again when gsm_finalize_connection
reschedule gsm_configure_work on error.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
c063c44028 drivers: modem: gsm: Go to next state if mux_attach successfully
Currently the mux_setup set the state to the next one after
uart_mux_alloc is successful even if the mux_setup fails which
can be a problem.

Set the state after both mux_setup & uart_mux_alloc are
successful.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
ef2d51c076 drivers: modem: gsm: Remove unnecessary mux_enabled check
Remove redundant mux_enabled checks, the code execution will
not reach here if mux_enabled is false in the first place.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
2984a9c322 drivers: modem: gsm: Customize error logs to ease debugging
Customize the error logs in each connection finalization steps
so that it is easier to trace the error.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
499412a60d drivers: modem: gsm: Reorder gsm mux logs so that it will be printed
The gsm_configure will return if it fails to perform mux_enable,
therefore the disable part of the log will not be printed.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
00513c90c5 drivers: modem: gsm: Remove unused flags
The `setup_done` and `mux_setup_done` aren't being used
anywhere in the driver, therefore should be removed.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
7dc1e790a8 drivers: modem: gsm: Init rssi_work_handle on gsm_init only
Initializing rssi_work_handle on gsm_start would (re)init it
unnecessarily everytime the gsm_start is invoked, we only need
to initialize it once in the gsm_init.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Yong Cong Sin
b2dd782879 drivers: modem: modem_cmd_handler: Fix missing documentations
Fix missing documentations.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-28 11:05:06 +01:00
Immo Birnbaum
27cefa657f drivers: xlnx_gem: remove Zynq/ZynqMP distinction for DMA placement
With the unification of OCM declaration & assignment between Zynq-7000
and Ultrascale/ZynqMP, remove the distinction between those two SoC
families so that the DMA area is always set up in the OCM regardless
of the current SoC type.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-02-28 11:04:57 +01:00
Pieter De Gendt
1e747eca0d drivers: hwinfo: sam: Introduce RSTC driver
Add a new hwinfo driver to get the reset cause on
SAM4S/SAME70/SAMV71 SoC series.

The user-nrst dts property has been added to enable external user
resets.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-02-28 10:53:57 +01:00
Jordan Yates
d9a74dda54 lora: sx126x: fix missing GPIO instantiation
Instantiate the values of `sx126x` GPIO's when they are present in
devicetree. This was missed in #42230.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-02-28 10:52:23 +01:00
Bartosz Bilas
b5497d7d2f drivers: wifi: eswifi: fix spi bus initialization
spi_dt_spec structure initialization should not be done
in the runtime during spi bus initialization because it
caues kernel panic.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/43046

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-02-28 10:52:17 +01:00
Tom Burdick
d5e6027131 dma/cavs_gpdma: Revert IRQ_CONNECT changes
It turns out XCC didn't like this change as it doesn't have a
__COUNTER__ builtin. Bummer.

This reverts commit e8389f2f53.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-02-25 22:20:31 -05:00
Ederson de Souza
d27cdd1a1e drivers/timer: Use correct timer for CPU in SMP Risc-V
With SMP, it shouldn't be assumed that there's only one CPU to set
timers.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-02-25 19:13:50 -05:00
Mahesh Mahadevan
45cc1d6fc7 drivers: display: Update the MCUX ELCDIF driver
1. Rename device data to dev_data to fix variable
   name clash
2. Use Device Tree properties to setup the display
3. Delete unused Kconfigs

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-02-25 13:35:58 -06:00
Mahesh Mahadevan
3489a39631 dts: Rename NXP LCDIF dts node
Rename fsl,imx6sx-lcdif to nxp,imx-elcdif as it
used by imxrt and imx platforms.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-02-25 13:35:58 -06:00
Ryan Erickson
34acbceef5 modem: hl7800: CTS to monitor sleep
Use CTS input to monitor HL7800 sleep state
when in SLEEP mode.
When CTS is high, shutdown the UART to
save power.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-25 10:10:22 -08:00
Ryan Erickson
48cca618fb modem: hl7800: fix +CFUN handler
Fix the +CFUN command handler to find
the end of the message properly.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-25 09:56:43 -08:00
Nicolas Pitre
c2543320d8 ring_buffer: rationalize the item-based put and get methods
Conceptually, ring_buf_item_put() and ring_buf_item_get() are specialized
versions of ring_buf_put() and ring_buf_get(). Make it so to rationalize
the code to open the way for more optimizations.

This means we need specialized wrappers on top of ring_buf_init()
accordingly, given that the core machinery is now common and byte based.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2022-02-24 14:49:00 -08:00
Yong Cong Sin
176bd02a56 drivers: modem: gsm: +CSQ shouldn't give sem_response
The +CSQ: is followed by 'OK' or 'ERROR', so its handler
should not give sem_response.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-24 13:57:48 -08:00
Yong Cong Sin
6bf44c5af5 drivers: modem: gsm: +CGATT shouldn't give sem_response & set error
The +CGATT: is followed by 'OK' or 'ERROR', so its handler
should not set error code and give sem_response.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-24 13:57:48 -08:00
Rafał Kuźnia
c8e68f62e7 drivers: timer: Increase user channel count to 3 on nRF52
Increase the default user-allocable number of RTC channels to 3,
which is the numer of physical RTC CC channels not used by Zephyr
on nRF52 series SoCs.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2022-02-24 13:50:42 -08:00
Rafał Kuźnia
81f2f36149 drivers: ieee802154_nrf5: Align shim layer to 64-bit time
The updated nrf_802154 API accepts 64-bit time in microseconds.
The shim layer is updated to use 64-bit time.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2022-02-24 13:50:42 -08:00
Henrik Brix Andersen
cf1879bfac drivers: can: remove deprecated APIs
Remove the CAN APIs deprecated in Zephyr v3.0.0.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-24 13:49:53 -08:00
Ryan Erickson
8c1387ef1a modem: hl7800: Make RSSI rate configurable
Improve ability to sleep.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-24 13:46:33 -08:00
Ryan Erickson
05e818c51c modem: hl7800: Add callbacks for sleep IO
Allows mapping of sleep signals to user
accessible test points on the development
board.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-24 13:46:18 -08:00
Simon Frank
ba7af2f780 include: sensor: sensor_value from double overflow
sensor_value_from_double had a early overflow when converting the
fractional part (val2).  This occured when input was more then
2147.493647 (inp >= INT32_MAX/1000000.0 + 0.01).

return value -ERANGE as this is what errno is set to by `strtod` and
similar posix functions.

fixes issue #39176

Signed-off-by: Simon Frank <simon.frank@lohmega.com>
2022-02-24 13:45:29 -08:00
Fabio Baltieri
eb7b3b66a2 drivers: can: mcp2515: fix build break
Fix build break introduced in 03ab730347:

/zephyr/drivers/can/can_mcp2515.c:871:55: error: 'const struct
mcp2515_config' has no member named 'int_pin'; did you mean 'int_gpio'?
  871 |   LOG_ERR("Unable to configure GPIO pin %u", dev_cfg->int_pin);

/zephyr/drivers/can/can_mcp2515.c:942:14: error: 'GPIO_DT_SPEC_INST_GET'
undeclared here (not in a function)
  942 |  .int_gpio = GPIO_DT_SPEC_INST_GET(0),
      |              ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-02-24 09:09:02 -08:00
Fabio Baltieri
824bb337d5 drivers: display: ls0xx: fix compiler warning
Fix a compiler warning introduced in 0fa2c45037:

/zephyr/drivers/display/ls0xx.c: In function 'ls0xx_init':
/zephyr/drivers/display/ls0xx.c:294:9: error: passing argument 5 of
'k_thread_create' discards 'const' qualifier from pointer target type
[-Werror=discarded-qualifiers]
  294 |         config, NULL, NULL,
      |         ^~~~~~

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-02-24 09:09:02 -08:00
Fabio Baltieri
1b370eead8 drivers: display: gd7965: fix build break
gd7965 broke after 42bbb30ecf:

/zephyr/drivers/display/gd7965.c: In function 'gd7965_init':
/zephyr/drivers/display/gd7965.c:379:23: error: passing argument 1 of
'device_is_ready' from incompatible pointer type
[-Werror=incompatible-pointer-types]
  379 |  if (!device_is_ready(&config->reset_gpio.port)) {
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       const struct device * const*

Fix all the occurrences.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-02-24 09:09:02 -08:00
Fabio Baltieri
1c2d72cfad drivers: display: st7735r: fix build break
display_st7735r broke after cd1fb2972e:

/zephyr/drivers/display/display_st7735r.c: In function 'st7735r_write':
/zephyr/drivers/display/display_st7735r.c:191:34: error: initialization
discards 'const' qualifier from pointer target type
[-Werror=discarded-qualifiers]
  191 |  struct st7735r_config *config = dev->config;
      |                                  ^~~
/zephyr/drivers/display/display_st7735r.c: In function 'st7735r_lcd_init':
/zephyr/drivers/display/display_st7735r.c:318:26: error: passing
argument 1 of 'st7735r_set_lcd_margins' from incompatible pointer type
[-Werror=incompatible-po
inter-types]
  318 |  st7735r_set_lcd_margins(dev, data->x_offset, data->y_offset);
      |                          ^~~
      |                          |
      |                          const struct device *
/zephyr/drivers/display/display_st7735r.c:60:58: note: expected 'struct
st7735r_data *' but argument is of type 'const struct device *'
   60 | static void st7735r_set_lcd_margins(struct st7735r_data *data,
      |                                     ~~~~~~~~~~~~~~~~~~~~~^~~~
/zephyr/drivers/display/display_st7735r.c: In function 'st7735r_init':
/zephyr/drivers/display/display_st7735r.c:441:24: error: passing
argument 1 of 'device_is_ready' from incompatible pointer type
[-Werror=incompatible-pointer-types]
  441 |   if (!device_is_ready(&config->reset)) {
      |                        ^~~~~~~~~~~~~~
      |                        |
      |                        const struct gpio_dt_spec *

and few others. Fix all of them.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-02-24 09:09:02 -08:00
Pete Dietl
5dddf9f0f8 drivers: sensors: Implement MAX31875 sensor
This commit implements the temperature sensor interface for
the Maxim MAX31875Low-Power I2C Temperature Sensor.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2022-02-24 08:49:40 -06:00
Yong Cong Sin
71707745b2 drivers: modem: gsm: Kconfig: Add MODEM_GSM_TYPE to choice
Add a name for the choice of gsm modem so that it can be
default to a certain type in board's Kconfig.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-24 08:45:16 -06:00
Peter Johanson
562e79780a drivers: gpio_rpi_pico: fix pull ups and disabling interrupts
Properly set both pull up and down flags explicitly when
making changes.

Properly implement disabling interrupts on a given pin.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2022-02-24 08:44:19 -06:00
Jose Alberto Meza
ace858bc29 drivers: espi: xec: mec172x: Fix compilation when OOB RX async is enabled
Correct MEC172x OOB register access that causes compilation error,
Use device-tree-based register access instead of HAL access
This occurs whenever CONFIG_ESPI_OOB_CHANNEL_RX_ASYNC is
enabled.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-02-24 08:40:07 -06:00
Michał Barnaś
c2f9e2b0d5 shell: fix i2c commands definitions
I2C scan and recover functions didn't have mandatory parameters
specified, which resulted in not displaying the I2C controllers in
help message. Instead, the command was executed, and argv was
dereferenced outside of the bounds, providing invalid data to
device_get_binding function.
Other functions had defined mandatory parameters without taking their
names into account, they are provided as argv[0].

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-02-24 08:29:52 -06:00
Bartosz Golaszewski
0f09360456 lvgl: change the prefix of Zephyr-specific LVGL config options
We're now using the Kconfig copied from the upstream lvgl repository. It
uses the LV_ prefix for all options while we're using LVGL_ for
Zephyr-specific ones. Make the latter consistent with upstream but also
make sure they're distinct from lvgl's by using LV_Z_ as the prefix.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@huawei.com>
2022-02-24 11:51:33 +01:00
Chris Trowbridge
52bee41bba drivers: ipm: Add support for NXP i.MX rev2 MU
With a number of the i.MX SoCs (e.g., the i.MX8M Plus), NXP has moved to
supporting the integrated Cortex-M cores with the MCUXpresso SDK (MCUX).
As a result, certain Zephyr drivers (such as the IPM driver) need to be
updated to utlize this new MCUX-based SDK.

This change adds support for the MCUX Messaging Unit driver pulled in by
this PR:
https://github.com/zephyrproject-rtos/hal_nxp/pull/130

Additionally, this change enables the new IPM_IMX_REV2 config for the
mimx8ml8_m7 SoC target which utilizes this new revision of the driver.

Signed-off-by: Chris Trowbridge <chris.trowbridge@lairdconnect.com>
2022-02-22 16:34:06 -06:00
Gerard Marull-Paretas
9df8151623 drivers: misc: grove_lcd_rgb: use custom log level
The driver was re-using the display log level, however, it is no longer
part of the display driver category.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Gerard Marull-Paretas
0bc64307d4 drivers: misc: grove_lcd_rgb: cleanup driver
- Cleanup list of includes
- Remove unused structs/definitions
- Make init function static (is called by system init)
- Make config/data naming and access consistent
- Remove redundant zero initialization of data

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Gerard Marull-Paretas
825655f0dc drivers: misc: grove_lcd_rgb: use k_sleep
The driver is sleeping in milliseconds using a custom wrapper around
k_busy_wait, move to k_sleep.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Gerard Marull-Paretas
498579ae25 drivers: misc: grove_lcd_rgb: use i2c_dt_spec
Modernize the driver a little bit by using i2c_dt_spec. Note that the
RGB on its own is another I2C device connected to the same bus. Ideally,
both should be defined in Devicetree, but this has not been done for
now.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Gerard Marull-Paretas
0bb486aa29 drivers: misc: grove_lcd: port to Devicetree
The driver was never migrated to Devicetree, this patch converts the
driver to a proper Devicetree based device.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Gerard Marull-Paretas
9a00b99884 drivers: display: grove_lcd_rgb: move to misc
The driver does not implement a display API, it has a custom API. Having
it under display is confusing, since display API consumers may expect
they can use it. These sort of custom drivers fit better under
drivers/misc.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-22 11:58:33 -08:00
Henrik Brix Andersen
4f90a9aa86 drivers: can: mcux: flexcan: add statistics support
Add support for CAN controller statistics to the NXP MCUX FlexCAN
driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-22 11:54:27 -08:00
Henrik Brix Andersen
28b5cfd46c drivers: can: add statistics support
Add CAN controller device statistics support.

Initially the following per-device statistics are supported:
- Dominant bit transmission errors
- Recessive bit transmission errors
- Bit stuffing errors
- CRC errors
- Format errors
- Acknowledge errors

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-22 11:54:27 -08:00
Chris Trowbridge
f401be157f drivers: gpio: Add GPIO support for mimx8ml8_m7 (NXP i.MX8M Plus SoC)
The current MCUX IGPIO driver assumes that the target SoC supports
the DR_SET, DR_CLEAR, and DR_TOGGLE functionality, but some do not
(namely, the M7 core of the i.MX8M Plus SoC). Current releases of
the MCUXpresso SDK IGPIO driver contain utility functions to set,
clear, and toggle pins which include provisions to support SoCs
with and without DR_SET, DR_CLEAR, and DR_TOGGLE, and this change
switches to using these utility functions.

Additionally, this change enables GPIO support on the mimx8ml8_m7
target.

Signed-off-by: Chris Trowbridge <chris.trowbridge@lairdconnect.com>
2022-02-22 10:13:31 -08:00
Jun Lin
0bbf394ced driver: i2c: npcx: don't print the err log when SMBST is zero
In the I2C ISR, it prints the error message when SMBST is set to an
unexpected value. However, we found a spurious interrupt which caused
the SoC to enter the ISR with SMBST=0. Because the spurious interrupt
will not break the I2C operation, this commit limits the error log to
print if SMBST is not equivalent to 0 to prevent a false alert.

Signed-off-by: Andrew McRae <amcrae@google.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-02-22 10:09:36 -08:00
Tomislav Milkovic
b2231c9d85 drivers: clock_control: stm32h7: select max clock freq for STM32H7B3
STM32H7B3 supports max SYSCLK and AHB clock frequencies of 280 MHz,
and max APB frequency of 140 MHz

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
2022-02-22 10:34:56 -05:00
Henrik Brix Andersen
de45e8ec72 drivers: can: use separate log modules for each driver
Use separate log modules for each CAN driver similar to other
sub-systems/driver classes.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-22 10:34:04 -05:00
Ryan McClelland
2eaede53af drivers: adc: add ads1x1x driver
This adds support for the ads101x (ads1013, ads1014, ads1015) and
ads111x (ads1113, ads1114, ads1115) family of i2c adc devices.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2022-02-22 10:49:39 +01:00
Sebastian Bøe
85c4f5dd55 kconfig: drivers: crypto: Remove EXPERIMENTAL
The crypto driver API is 6 years old, has 5 different implementations,
and is widely used.

Remove the EXPERIMENTAL marking from the API. Each implementation may
still choose to mark itself as EXPERIMENTAL.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2022-02-21 22:20:51 -05:00
Dawid Niedzwiecki
abb090094d i2c_emul: init i2c config
Initialize the i2c config of the emulator based on the clock_frequency
property.

The emulator can be used without calling the i2c_configure function, but
the i2c_get_config would return an error. With this change, it is
possible to get the config prior to the i2c_configure call.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2022-02-21 22:18:16 -05:00
Jay Vasanth
9f3d90e283 drivers: bbram: Add bbram driver for mec device
Add bbram driver for Microchip mec device

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-02-21 22:17:52 -05:00
Tim Lin
58d928932a ITE: drivers/i2c: disable pre-defined of hardware slave A
This register is a pre-define hardware slave A and can be accessed
through I2C0. It is not currently used, so it can be disabled to
avoid illegal access.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-02-21 22:16:37 -05:00
Gerard Marull-Paretas
d6c2c9eb9e drivers: memc: mcux_flexspi_hyperram: use DEVICE_DT_GET
The controller device can be obtained at compile time, so use
DEVICE_DT_GET.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
ca7f291dd4 drivers: lora: sx12xx: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
dc2c889948 drivers: lora: sx127x: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
4bcbbe571e drivers: lora: sx126x: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
a7ae33de7f drivers: led_strip: ws2812_gpio: drop redundant dev_cfg helper
Helpers like dev_cfg have been removed from all in-tree drivers, this
one was missed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
e2431fa25b drivers: led_strip: ws2812_gpio: use gpio_dt_spec
Simplify device driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
9395ee4a04 drivers: led: lp5562: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
97cd2a7321 drivers: led: lp503x: constify device config
Device configuration was not declared as const, fix this.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
e6830dac47 drivers: led: lp503x: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
a5b68f51ea drivers: led: lp3943: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
071b80290c drivers: kscan: ft5336: simplify device definition
Use the IF_ENABLED macro helper to conditionally initialize the int_gpio
field. This avoids duplication of initialization code.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
97eb6a3154 drivers: kscan: ft5336: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
f52b5adf81 drivers: kscan: ft5336: use gpio_dt_spec
Simplify implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
0ddb8b5d62 drivers: interrupt_controller: intc_ioapic: use DEVICE_DT_GET_OR_NULL
The device instance can be obtained at compile time. Here
DEVICE_DT_GET_OR_NULL is used as the following code seems to accept a
NULL condition, meaning instance is optional.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
b15fb9cb2f drivers: ieee802154: rf2xx: use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
ec63ea78cd drivers: ieee802154: mcr20a: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
4231c92cb8 drivers: ieee802154: mcr20a: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec. Most internal
functions now take a device reference to simplify the operation, since
config did not exist before.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
5314690c3b drivers: ieee802154: mcr20a: define as DT device
The device already has a DT compatible (and uses DT properties).
Instantiate the device using the DT-based macros and remove hardcoded
name.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
adf8e4d723 drivers: ieee802154: dw1000: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
fe851d30de drivers: ieee802154: dw1000: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec. Note that driver
has 2 SPI configurations, identical except the speed. For this reason,
the slow config is still kept in RAM and copied from the one obtained
via the SPI dt_spec macros. A better solution would be to have macros
that allow to override the SPI frequency, but this can be improved
later. Most internal helpers have been adjusted to accept a device
reference to make SPI (and future GPIO) transition easier.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
7c0d4f0382 drivers: i2c: slave: eeprom: use i2c_dt_spec
Simplify implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
be63d6addc drivers: i2c: gpio: use gpio_dt_spec
Simplify the implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
2c5de11a8b drivers: gpio: sx1509: use gpio_dt_spec
Simplify implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
e1992d5c54 drivers: gpio: sx1509: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
1d449c2924 drivers: gpio: pca95xx: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
80ee515c9c drivers: gpio: pca95xx: use gpio_dt_spec
Simplify implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
5af7fe66a4 drivers: flash: mcux_flexspi_nor: use DEVICE_DT_GET
Controller device can be obtained at compile time, so make
implementation more efficient thanks to that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
391112dab8 drivers: flash: mcux_flexspi_mx25um51345g: use DEVICE_DT_GET
Controller device can be obtained at compile time, so make
implementation more efficient thanks to that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
c70f296d63 drivers: flash: mcux_flexspi_hyperflash: use DEVICE_DT_GET
The controller device instance can be obtained at compile time using
DEVICE_DT_GET, so do that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
54177fd8ff drivers: ethernet: dsa_ksz8xxx: use DEVICE_DT_GET
Use DEVICE_DT_GET instead of device_get_binding, since the device
reference can be obtained at compile time.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
6c11b6c9bf drivers: ethernet: dsa_ksz8xxx: use gpio_dt_spec
The reset GPIO information can be obtained at compile time, so use
gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
cc3952e266 drivers: dma: iproc_pax: use DEVICE_DT_GET
The PCIe device can be obtained at compile time, so make code more
efficient thanks to that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
db00924764 drivers: display: ssd16xx: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec. To simplify
migration, all internal functions now take a device reference instead of
device data. As a result, the redundant config pointer in data has been
removed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
0fa2c45037 drivers: display: ls0xx: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec. As a result, the
driver data structure has become unused and so removed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
42bbb30ecf drivers: display: gd7965: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec. Note that as a
result, the driver data structure has become obsolete/unused and so has
been entirely removed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
069bf6be44 drivers: display: st7789v: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
065f8645fb drivers: display: st7789v: use spi_dt_spec
Simplify driver implementation by using spi_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
cd1fb2972e drivers: display: st7735r: use gpio_dt_spec
Simplify the driver implementation by using gpio_dt_spec. Note that most
internal functions have been changed to accept a device instance instead
of data/config references to make transition easier and to align with
most other drivers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
082f593966 drivers: dac: dacx3608: use i2c_dt_spec
Simplify driver implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
6067d16ce2 drivers: counter: maxim_ds3231: use gpio_dt_spec
Simplify implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
85d0ef6e55 drivers: counter: maxim_ds3231: use i2c_dt_spec
Simplify implementation by using i2c_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
aa431f636e drivers: nrf_clock_calibration: use DEVICE_DT_GET_OR_NULL
An optional reference to the temperature sensor can be obtained at
compile time, update implementation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
03ab730347 drivers: can: mcp2515: use gpio_dt_spec
Use struct gpio_dt_spec to simplify driver implementation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
b61df8281c drivers: bluetooth: hci: spi: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
cc85c6c518 drivers: bluetooth: hci: spi: use spi_dt_spec
Use spi_dt_spec to simplify driver implementation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
924a63a8e7 drivers: audio: tlv320dac310x: constify device config access
The device configuration field access was dropping const qualifier for
no reason, don't do that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
198afb71fa drivers: audio: tlv320dac310x: use i2c_dt_spec
Use struct i2c_dt_spec to simplify code. This change also allows to drop
device_get_binding usage.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
30acb4efdd drivers: audio: tlv320dac310x: use gpio_dt_spec
Use `struct gpio_dt_spec` and so remove usage of device_get_binding.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas
9691d6110a drivers: audio: mpxxdtyy: drop device_get_binding
The bus device can be obtained at compile time, so use DEVICE_DT_GET
instead. Device configuration is now used to store the bus device
reference.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Sylvio Alves
bf08b5f0ed drivers: uart: esp32: fix driver initialization id number
The select uart instance used in uart driver initialization won't
work as expected because the index used was not correct. This
fixes the macro call to use proper index value.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-21 22:12:55 -05:00
Sylvio Alves
d29b98dbea drivers: gpio: esp32: check pin number range
As a complement of 7689abee34,
which fixed an issue where gpio number could errouneously be
set to a number greater than 32 in DTS, there is also another
situation where driver instance can be configured with a pin number
greater than 32.
This PR adds another check in GPIO driver to confirm
whether the PIN number is within valid bounds.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-21 22:12:55 -05:00
Andy Ross
066e4da281 drivers/xtensa_sys_timer: Change default timer ID
Use index zero, not one.  The Xtensa tools emit the timers in priority
order, and as mentioned in the kconfig warnings using high priority
timers doesn't work.  This also makes room for using software
interrupts that can preempt a timer interrupt for test purposes.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-02-21 22:10:03 -05:00
Aymeric Aillet
513389b659 drivers: adc: lmp90xxx: do not use generated macros
Do not used generated macro from devicetree subsys directly
in driver.
Remove definition of it's own "FOREACH_STATUS_OKAY".
Redefine "DT_DRV_COMPAT" for each supported compatible string.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-02-21 22:09:27 -05:00
Gerard Marull-Paretas
f8423a1b45 drivers: serial: xmc4xxx: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
4ee2f327bd drivers: serial: xlnx_ps: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
b6404df1ab drivers: serial: stellaris: remove unused definitions
The register definitions are not used by the driver (struct _uart is
used instead).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
ece65d7a74 drivers: serial: stellaris: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only. Since the config struct can now store a pointer to
the UART structure, casts from address to (struct _uart*) are no longer
needed. UART_STRUCT has also been dropped in favor of using the config
pointer directly now that it is possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
cb982cd669 drivers: serial: pl011: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only. Since the config struct can now store a pointer to
the UART structure, casts from address to (struct pl011_regs *) are no
longer needed. PL011_REGS has also been dropped in favor of using the
config pointer directly now that it is possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
dd3e3a7ee2 drivers: serial: numicro: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only. Since the config struct can now store a pointer to
the UART structure, casts from address to (UART_T *) are no longer
needed. UART_STRUCT has also been dropped in favor of using the config
pointer directly now that it is possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
863a661f70 drivers: serial: npcx: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only. Since the config struct can now store a pointer to
the UART structure, casts from address to (struct uart_reg *) are no
longer needed. HAL_INSTANCE has also been dropped in favor of using the
uart field from the config struct now that it is possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
dbdaf8ddba drivers: serial: msp432p4xx: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
14dda3af08 drivers: serial: msp432p4xx: remove unused sys_clk_freq
The variable is not used by the driver, so there is no need to
initialize it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
8e26bfcca2 drivers: serial: cmsdk_apb: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only. Since the config struct can now store a pointer to
the UART structure, casts from (uint8_t *) to (struct uart_cmsdk_apb*)
are no longer needed. UART_STRUCT has also been dropped in favor of
using the config pointer directly now that it is possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
c5ef13266a drivers: serial: cc32xx: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
1e6b251913 drivers: serial: cc13xx_cc26xx: drop usage of uart_device_config
Create a driver specific configuration structure, containing the
required fields only.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
70eefdbac9 drivers: serial: altera_jtag: remove unused config
The driver configuration was not used, so just remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
e101cc78e9 drivers: serial: stm32: store IRQ config function in a single place
When CONFIG_PM=y, the IRQ function also needs to be stored, something
the "generic" uart_device_config cannot support. This uses the config
irq_config_func field to store the function in all situations, thus
removing unnecessary logic and finally dropping uart_device_config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Gerard Marull-Paretas
32a3a028f2 drivers: serial: stm32: store USART instance
Instead of using "generic" uart_device_config fields, store the right
pointer to avoid unnecessary casts. This change makes code simpler and
more idiomatic.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Dino Li
36164c29c1 espi: it8xxx2: enable configuration of Chromebook
This enables the below configuration so the AP and EC are able to
communicate over eSPI:

CONFIG_ESPI_PERIPHERAL_EC_HOST_CMD
CONFIG_ESPI_PERIPHERAL_ACPI_SHM_REGION
CONFIG_ESPI_PERIPHERAL_CUSTOM_OPCODE

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-02-21 22:01:48 -05:00
Ryan Erickson
a9804002e2 modem: hl7800: Use built in socket restore on boot
When sleep modes are used, configure sockets
to restore on boot. Letting the HL7800 manage
this means the driver does not have to do it.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-21 22:01:23 -05:00
Ryan Erickson
cdff607d74 modem: hl7800: Make sleep mode configurable
Allow application to choose between 3 different low power levels of modem.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-21 21:57:52 -05:00
Jun Lin
6faa8fcd8d driver: clock_control: npcx: power down some modules by default
This commit sets the power down bit of the module SDP, UART3, UART4,
and I3C by default. The module's driver should take the responsibility
to clear it to turn on the power. It helps reduce the power consumption
when an application doesn't use these modules.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-02-21 21:55:16 -05:00
Björn Stenberg
a59ce01118 drivers: eth: native_posix: Add support for setting ethernet MAC address
If CONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=n and
CONFIG_ETH_NATIVE_POSIX_MAC_ADDR="", the MAC address can be set with a
net_mgmt call before the driver is initialized.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
2022-02-21 21:54:05 -05:00
Tim Lin
4381841bd8 ITE: drivers/adc: fix the sampling flow of ADC
The ADC sampling of it8xxx2 needs to read each channel in sequence,
so it needs to wait for an interrupt to read data in the loop
through k_sem_take().

In test_adc.c, k_timer_start() is used in the interval test, so we
need to use polling wait instead of k_sem_take() to wait, otherwise
it will cause kernel panic.

k_is_in_isr() can determine whether to use polling or k_sem_take()
at present.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-02-21 21:01:43 -05:00
Dino Li
abf6fdfed1 it8xxx2: changing PLL sequence is high priority
This makes the sequence completed before hardware devices
initialization.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-02-21 21:00:55 -05:00
Tom Burdick
e8389f2f53 dma: intel_adsp: Reduce irq setup code
Makes the IRQ_CONNECT macro statically declarable for Xtensa (nothing
prevented it except its structuring). Allows for IRQ_CONNECT usage
on a xtensa only platform to be declared statically avoiding the
fluff of setting up and enabling irqs for cavs gpdma.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-02-21 20:59:08 -05:00
Tom Burdick
1e9ada4eb9 dma: cavs: Add gpdma derivative of dw dma for cavs
Intel's adsp needs to set, at a minimum, a clocking bit before the driver
can initialize the designware dma controller. In many ways it is the
designware dmac IP but with additional registers and functionality added
on top of it. So the code structure here follows how the hardware
appears to be designed, layered on top of the designware driver.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-02-21 20:59:08 -05:00
Tom Burdick
f9acacfd11 dma: dw: Common dw dma driver functionality
Move most of the designware driver into a common compile unit with a
a header that exposes the common functionality.

This allows for derivative hardware, such as that in intel's adsp (cavs)
to use the common functionality while extending.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-02-21 20:59:08 -05:00
Jose Alberto Meza
f7b5d4b06a drivers: peci: xec: Handle corner case for PECI recovery
Handle case where PECI recovery occurs in ISR context.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-02-21 20:58:26 -05:00
Wouter Cappelle
e7d5b172d0 STM32L5: flash: enable support for DBANK == 0
STM32L5 has option to disable dual bank support.
When this is disabled, the flash page size is changed
from 2k pages to 4k pages. This PR adds support for this
diversity.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-02-21 20:56:58 -05:00
Wouter Cappelle
13faa9aa71 drivers: entropy: stm32: Add power management constraints
Add power management constraints to the entropy driver.
This prevents the hardware block to lose it's clock when
going into any stop mode of the cpu, which would cause the
clock error flag to be set while filling the pool.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-02-21 20:56:28 -05:00
Jose Alberto Meza
00304fbe2d drivers: espi: xec: support for eSPI slaves with long initializations
Add Kconfig switch to disable automatic eSPI slave boot
acknowledgement.
This allows to perform lenghty operations before continue any eSPI
handshake with eSPI master.

Required for eSPI SAF boot configuration.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2022-02-21 20:55:48 -05:00
Fabio Baltieri
61ef77a736 pwm: npcx: only reconfigure PWM if necessary
Currently pwm_npcx_pin_set() disables and reconfigures the PWM
controller every time its called, causing the PWM line to pulse even if
only the duty cycle is changed.

Modify the function so that controller is only disabled if any of the
configuration has to be changed, only set the new DCR otherwise.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-02-21 20:54:42 -05:00
Lukasz Maciejonczyk
57b55c382f drivers: ieee802154_nrf5: fix CSL for multicore devices
Due to serialization restrictions radio api calls cannot be nested, any
violation of this rule leads to a deadlock. This commit fixes the bug
by transferring the nested radio api call to ot_radio_workq.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-02-21 20:54:03 -05:00
Aymeric Aillet
17d5c4ca88 drivers: i2c: rcar: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.
Follows #41918.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-02-21 20:49:41 -05:00
Aymeric Aillet
e3621e6e00 drivers: serial: rcar: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.
Follows #41918.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-02-21 20:49:41 -05:00
Aymeric Aillet
bc789793be drivers: gpio: rcar: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.
Follows #41918.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-02-21 20:49:41 -05:00
Aymeric Aillet
69506e19e0 drivers: can: rcar: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.
Follows #41918.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-02-21 20:49:41 -05:00
Katsuhiro Suzuki
feaf0070fc boards: riscv: hifive_unleashed: add GPIO support
This patch adds GPIO and 96board LS (Low Speed)iexpansion  connector
support for SiFive HiFive Unleashed and also enables GPIO basic test.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2022-02-21 20:46:47 -05:00
Ruibin Chang
5f3bba54e8 ITE drivers/pwm: support tests/drivers/pwm/pwm_api
Add pwm-0 to support tests/drivers/pwm/pwm_api.

Solve tests code runtime error on it8xxx2_evb:
1.If the pwm channel target frequency is < 1, then we will
  return an error code.

2.If the target_freq is <= 324Hz, we will configure that this pwm
  channel need to output in EC power saving mode.
  In test_pwm_cycle() case, the period is 64000, then the
  target_freq is 8000000 / 64000 = 125Hz and <= 324Hz, so we will
  switch the prescaler clock source from 8MHz to 32.768kHz.
  Then the target_freq is 32768 / 64000 = 0.512Hz and < 1Hz,
  this will return an error code. In order to get the same
  target_freq, we always return PWM_FREQ in
  pwm_it8xxx2_get_cycles_per_sec().

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-02-21 20:44:41 -05:00
Jay Vasanth
f6394e0d54 Microchip: MEC172x: kscan driver
Update keyscan driver to support MEC172x device

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-02-21 20:44:17 -05:00
Jay Vasanth
4120a889a4 Microchip: MEC172x: watchdog driver
Update wdt driver to support MEC172x device

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-02-21 20:42:18 -05:00
Yong Cong Sin
e15f6f121f drivers: modem: gsm: add handler for +CME ERROR
The driver enabled extended error code (AT+CMEE=1) during
setup but is missing a handler for the +CME ERROR, fix that.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-21 20:40:22 -05:00
Sjors Hettinga
60beb291df drivers: gsm: Wait for NET_EVENT_IF_DOWN in in gsm_ppp_stop
Waits until the network interface goes down before switching the
GSM_MUX. It uses the NET_MGMT_EVENT to signal a semaphore to
contiue when closed. This allows for the LCP state machine to
properly terminate. When skipping this wait, the second time
connecting, the connection might fail.
Tested on a real modem.

Fixes GSM PPP behavior in combination with: #41802

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
2022-02-21 20:39:44 -05:00
Bartosz Bilas
db2b6de0b8 drivers: sensor: lis2dh: convert to spi_dt_spec
Convert lis2dh driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-02-21 19:43:55 -05:00
BJ Chen
59cd9fd551 ITE: drivers/peci: Add PECI driver module of ITE IT8xxx2
Added the PECI driver tested with the samples/drivers/peci.

Signed-off-by: BJ Chen <bj.chen@ite.com.tw>
2022-02-21 19:43:40 -05:00
Andrei-Edward Popa
6d5ec5a0d5 drivers: i2c: added slave support for DW
added slave mode support for I2C designware chip

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-21 19:42:07 -05:00
Andrei-Edward Popa
e1f91db622 drivers: i2c: i2c_dw: added pinctrl support
added pinctrl support for designware i2c driver

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-21 19:42:07 -05:00
Yuriy Vynnychek
a8619169c4 drivers: pinmux: remove Telink B91 driver
Removed Telink B91 driver since it is replaced by Pincrl.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Yuriy Vynnychek
f47d8568f2 drivers: spi: telink_b91: replace Pinmux by Pinctrl
Updated driver to use new Pinctrl driver.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Yuriy Vynnychek
b7f1b58810 drivers: serial: telink_b91: replace Pinmux by Pinctrl
Updated driver to use new Pinctrl driver.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Yuriy Vynnychek
4089ef71e5 drivers: pwm: telink_b91: replace Pinmux by Pinctrl
Updated driver to use new Pinctrl driver.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Yuriy Vynnychek
693833eb5e drivers: i2c: telink_b91: replace Pinmux by Pinctrl
Updated driver to use new Pinctrl driver.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Yuriy Vynnychek
b49dd6b1b4 drivers: pinctrl: introduce new Telink B91 Pinctrl driver
Pinctrl driver basic support for Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Dawid Niedzwiecki
42d1d9c17c eeprom/at2x: add config to disable handling WP
There is a part of the AT2X driver that handles controlling WP pin
connected to the EEPROM chips, but in some systems, the WP line can be
controlled by another component.

Check if any AT2X node defines wp-gpios, if not - do not compile the
code related to WP to save space.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2022-02-21 19:41:18 -05:00
Sylvio Alves
6ba6894580 drivers: wdt: esp32: code refactor to use hal calls
Update WDT driver to use hal calls, which
brings proper unification among socs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-21 19:40:17 -05:00
Bartosz Bilas
46a1c2d16f drivers: sensor: ism330dhcx: convert to spi_dt_spec
Convert ism330dhcx driver to use spi_dt_spec helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-02-21 19:38:46 -05:00
Henrik Brix Andersen
7815de13c3 drivers: can: mcp2515: reduce the number of tx buffers to 1
Reduce the number of TX buffers in use on the MCP2515 from 3 to 1 in
order to avoid CAN frame priority inversion.

The MCP2515 is unable to do internal TX frame arbitration based on the
CAN-ID of the frame. Priority must be set per TX buffer and the priority
cannot be rewritten unless the frame transmission is aborted.

Fixes: #26541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-21 19:37:35 -05:00
Henrik Brix Andersen
2bd18c6cfd drivers: can: mcan: switch from tx fifo to tx queue
Switch the Bosch M_CAN driver from TX FIFO mode to TX Queue mode in
order to avoid priority inversion of CAN frames.

Fixes: #26541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-21 19:37:35 -05:00
Henrik Brix Andersen
64c7f75916 Revert "drivers: can: stm32: Change TX priority to chronological order"
This reverts commit 82a1661c99.

Fixes: #26541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-21 19:37:35 -05:00
Henrik Brix Andersen
9c768d83bf Revert "drivers: can: mcux: Persuade the driver to send in chronological order"
This reverts commit ec0e199206.

Fixes: #26541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-21 19:37:35 -05:00
Ryan Armstrong
c124f40f14 drivers: i2c: replace DEV_NAME macros
Similar to commit be32e33774, this
replaces the use of DEV_NAME macros with dev->name directly. This also
fixes #42996 for i2c_sam_twi.c in particular.

Signed-off-by: Ryan Armstrong <git@zerker.ca>
2022-02-21 19:35:55 -05:00
Andrzej Głąbek
e57d6368d0 drivers: i2c_nrfx_twim: Fix frequency configuration
Change the way this shim driver configures the I2C frequency, so that
it is possible to use also 1 MHz on nRF5340 (the nrfx driver performs
extra initialization steps for this frequency, hence it needs to be
reinitialized when the shim is reconfigured).
Correct the shim to handle selection of 1 MHz (or FAST_PLUS) bitrate
both through dts and I2C API.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-02-15 19:00:38 +01:00
Sylvio Alves
dce4f6a5f5 drivers: pinmux: esp32: check pullup/pulldown configuration
There are some pins that do not support internal pullup/pulldown.
This PR make sure to check that and return error if needed.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-15 12:58:37 -05:00
Sylvio Alves
7689abee34 drivers: gpio: esp32: fix pin number value
ESP32 has 2 GPIOs: gpio0 and gpio1.
Zephyr DTS model requires pin definition in dts file
from 0 to 31, meaning that when some pin within gpio1 range
is required, gpio driver needs to increament this value
by 32, required by LL API.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-15 12:58:37 -05:00
Hake Huang
d517947de4 driver: eth_mcux: fixing build error on rt11xx
in rt11xx series the ringbuffer is > 1

fixing: #42793

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-02-14 10:16:01 -06:00
Xabier Marquiegui
52be66919e net: gptp: convert clock sync ratio from float to double
Using clock sync ratio as double instead of float improves
synchronization smoothness

Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Xabier Marquiegui
62db8ca0e6 driver: eth_mcux: gptp: limit rate_adjust range
Limit gptp range_adjust range for improved performance.

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Xabier Marquiegui
d4c4a14737 driver: eth_mcux: gptp: enable pps output
Enable pps output for gptp accuracy measurements.

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Xabier Marquiegui
7454a92754 driver: eth_mcux: realtime optimizations
mcux enet driver updates:
a) add mutex to access the ptp timer variables
b) use thread for rx(cooperative) andfor tx cleanup(cooperative)
c) use a thread for ptp inner clock updater(pre-empty)

This patch fixes the following issue:

```
ENET_SendFrame error: 4004
```

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Co-authored-by: Seb Laveze <sebastien.laveze@nxp.com>
Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Daniel DeGrasse
0694e47f97 drivers: mcux_gpt_timer: Fix rounding error on tick boundary
GPT timer driver was announcing progress to the kernel too soon when an
announcement was requested via sys_clock_set_timeout() on a tick
boundary. Fix rounding to add a tick worth of cycles.

Fixes #42665

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-02-11 09:07:40 -06:00
Daniel DeGrasse
41a63f48fd samples: task_wdt: Increase min watchdog timeout
MCUX watchdog timer supports min window of 500ms. Increase maximum task
watchdog timeout window to 500ms by default, so that this sample can run
on iMX RT SOCs. Also update iMX RT watchdog driver to reject timeout
maximums under 500ms with a useful error message

Fixes #40153

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-02-09 14:07:26 -06:00
Gerard Marull-Paretas
83cccdf757 drivers: display: st7789v: fix function argument
The st7789v_transmit function accepts a device, not device data. As a
result, driver could not be compiled when reset GPIOs were not defined
in Devicetree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-08 07:31:07 -05:00
Gerard Marull-Paretas
0cb5e2155e drivers: display: gd7965: fix syntax error
The configuration initializer had a syntax error (missing =). The driver
could not be compiled as a result.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-08 07:31:07 -05:00
Andrzej Głąbek
9b9de62046 drivers: spi_nrfx_spi: Fix compilation error
Fix a copy/paste mistake introduced by commit
fdc25cd44c.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-02-08 07:29:33 -05:00
Francois Ramu
2b8df6b160 tests: drivers: flash running on disco stm32 board with qspi
Restore the testcase to run on the qspi nor-flash controller
of the disco_l475_iot1 board
of the disco stm32f746 board

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-02-08 07:03:12 -05:00
Francois Ramu
2f4cfca6fd drivers: flash: stm32 qspi flash driver valid read or write operations
Like the stm32 flash driver, in case of QSPI nor flash controller
the read or write or erase returns '0' if data is of null size.
This avoids useless QPSI low level access to the controller.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-02-08 07:03:12 -05:00
Carlo Caione
9397dafa95 syscon: Compile the generic driver only when selected
Currently the generic driver is always unconditionally compiled. Fix
this by compiling it only when needed.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-02-07 09:27:41 -05:00
Andrzej Głąbek
c80589af56 drivers: uart_nrfx_uarte: Fix RX auto disabling routine
This is a follow-up to commit 11bbdb030d.

When RX is automatically disabled because all provided RX buffers have
been filled up, the rx_enabled flag needs to be cleared, otherwise it
will be impossible to enable RX again.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-02-05 06:25:46 -05:00
Andrei-Edward Popa
e11077d7a5 drivers: serial: rpi_pico: replaced high level API functions
replaced high level API functions with register access

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-05 06:18:44 -05:00
Andrei-Edward Popa
5e8b0723e2 drivers: serial: added UART interrupts for Raspberry Pi Pico board
added UART interrupts driver for Raspberry Pi Pico board
moved baudrate from config to data structure

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-05 06:18:44 -05:00
Andrei-Edward Popa
2fc2928fa5 drivers: serial: rpi_pico: check if baudrate was set by the API function
if peripheral clock is not configured, uart init API function returns 0,
so we need to check the return value of this function

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-05 06:18:44 -05:00
Guillaume Lager
4d777b43fd drivers: modem: Fix loop variables type
int was used regardless of the type used in the
end-loop condition

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2022-02-04 11:19:28 +01:00
Wouter Cappelle
c9c32b2391 driver: entropy: stm32: Fix health dts properties
The properties from dts to driver were not translated
correctly from - to _. This PR fixes this

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-02-04 11:14:44 +01:00
Ryan Erickson
a9eead1824 modem: hl7800: only send null packet for TCP
Only TCP sockets should send a NULL packet
if the server closes the connection or there
is a socket error.
UDP sockets do not need to do this because
they are connectionless.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-04 10:57:15 +01:00
Attie Grande
24478c8a4d drivers: adc: adc_sam0: Change local variables to lower case
Local variables should not be in capitals.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-02-04 10:49:09 +01:00
Attie Grande
e4d4eaca03 soc: atmel_sam0: Implement fixup.h for ADC driver
The ADC driver now supports three different implementations. To maintain
readability, this patch implements an adc_fixup.h that permits more
generic access to relevant registers.

This patch also introduces support for a new third shape ADC - as found
in the SAML21 for example.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-02-04 10:49:09 +01:00
Attie Grande
d45a9a11b7 drivers: adc: adc_sam0: Fix interpretation of channels
Previously this was expected to be equal to 1 at all times. This doesn't
play well with the sample or other users (e.g: adc_shell). Instead, we
should count the number of active channels in the bitfield, and ensure
that only one is identified.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-02-04 10:49:09 +01:00
Yong Cong Sin
731241f8d0 kernel: workq: Fix type errors in delayable work handlers
A common pattern here was to take the work item as the subfield of a
containing object. But the contained field is not a k_work, it's a
k_work_delayable.

Things were working only because the work field was first, so the
pointers had the same value. Do things right and fix things to
produce correct code if/when that field ever moves within delayable.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-02-02 18:43:12 -05:00
Daniel DeGrasse
419dc385f2 drivers: usdhc: Add log for DAT3 detection
Add log to tell user when DAT3 detection method is in use

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-02-02 16:59:30 +01:00
Yonatan Schachter
a2aa02dbc8 drivers: gpio: Added support for raspberry pi
Added GPIO support for the RP2040 SoC. Only one
core is supported.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-02-02 16:23:35 +01:00
Yonatan Schachter
cd7bd5f450 drivers: serial: Added support for raspberry pi
Added a serial driver for the RP2040. Only polling
API is supported.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-02-02 16:23:35 +01:00
Yonatan Schachter
fd59038312 drivers: pinctrl: Added pinctrl driver for RPi Pico
Added a pinctrl driver for the Raspberry Pi Pico series

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2022-02-02 16:23:35 +01:00
Krzysztof Chruscinski
2c044c8162 drivers: serial: nrfx_uarte: Add support for read only TX buffers
UARTE does not support RO TX buffers. Added cache buffer to the
driver which is used when provided buffer is not from RAM.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-02 12:47:46 +01:00
Francois Ramu
860bd87ca9 drivers: uart stm32 F4X, F1X, F2X have a sw sequence to clear error flags
Gives more explanation on uart_stm32_err_check function.
On stm32 F4X, F1X, and F2X, when clearing the usart Error Flag
(PE, ORE, FE, NE), the  LL Clear function applies a software sequence
which reads the usart SR then the usart DR.
Consequently the RXNE flag is affected (cleared) by the
uart_stm32_err_check function call.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-02-01 16:21:38 -05:00
Marius Scholtz
56ebbb4603 drivers: serial: atmel_sam: Fix api to work with modbus
This patch adds fixes to the api so that it behaves as expected.
1 - The irq_tx_ready now only returns true if the tx interrupt is
enabled.
2 - The irq_tx_complete now functions as expected and returns true
only once all characters have been transmitted

Signed-off-by: Marius Scholtz <mariuss@ricelectronics.com>
2022-02-01 16:19:24 -05:00
Marcin Niestroj
becc1efe51 drivers: lora: shell: fix 'long' specifier in shell_error()
Replace '%s' with '%ld', so that 'long' value is properly printed with
shell_error(). This suppresses following warning:

  zephyr/drivers/lora/shell.c:181:23: warning: format '%s' expects \
      argument of type 'char *', but argument 4 has type 'long int' \
      [-Wformat=]
    181 |    shell_error(shell, "Invalid bandwidth: %s", lval);
        |                       ^~~~~~~~~~~~~~~~~~~~~~~  ~~~~
        |                                                |
        |                                                long int

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2022-02-01 14:25:38 -06:00
Jani Hirsimäki
89978203f6 drivers: net: ppp: asynch api: use microseconds
Updated uart_rx_enable() and uart_tx() to use timeout given
in microseconds. Previously argument was given in milliseconds.
API change was done in:
https://github.com/zephyrproject-rtos/zephyr/pull/39041

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2022-02-01 13:31:20 +01:00
Joakim Andersson
d8dd0ed912 drivers: clock_control: Remove unused header file
Remove unused header file nrf_gpio.h which is not used by the
clock control driver.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2022-02-01 11:31:36 +01:00
Andrzej Puzdrowski
23b6e51e73 drivers/flash: remove flash_write_protection API
This API was designed to be removed in Zephyr 2.8

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-02-01 10:46:28 +01:00
Andrzej Puzdrowski
bbe4f87d09 drivers/flash/flash_ite_i8xxx2: remove write_protection handler
The handler was reworked to internal function and it
is called from the erase and the write
procedures automatically now.

This change was made due to deprecation of the flash write-protection
API.

Explanation for so late removal:
Reworked callback was introduced despite that the API had been
already deprecated at the addition time.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-02-01 10:46:28 +01:00
Andrzej Głąbek
aa3b86600d drivers: flash: nrf_qspi_nor: Fix setting of the base clock divider
On nRF53 Series SoCs, the highest SCK frequencies can only be achieved
when the HFCLK192M clock divider is changed from the default /4 setting.
Such change results in increased power consumption, so the divider needs
to be changed only for periods when it is actually necessary.
This commit modifies the driver behavior so that it changes the divider
only when a QSPI bus operation is performed.
However, when XIP accesses to the flash chip are also used, it may be
needed to keep the divider changed even when the driver is idle so that
the XIP access speed is not reduced, hence a custom API function that
allows forcing this is introduced for the driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-02-01 10:31:50 +01:00
Jordan Yates
fdc25cd44c spi: nrfx_spi*: only run uninit if configured
Only run the `uninit` function if the SPI instance has previously been
configured. This stops an assertion in the HAL drivers from triggering
due to running `uninit` without a previous `init`.

Fixes #42299.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-31 12:14:05 +01:00
Sylvio Alves
ef3ecbe596 uart: esp32: fix baudrate return value
HAL call function used to retrieve the configured baudrate
returns the real calculated value, which might not be exactly as
the configured. For baudrate of 115200, HAL api
returns 115201, which then causes uart_basic_api test
to fail. Instead of returning the calculated baudrate value,
returns the configured one.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-28 19:13:20 -05:00
Jeremy Wood
833d6c2315 drivers: can: m_can: fix reconfiguring bitrate
Set enable configuration change bit in can_mcan_set_timing() because
the NBTP register can only be changed if we're in init mode AND
configuration change bit is set, per MCU docs.

Signed-off-by: Jeremy Wood <jeremy@bcdevices.com>
2022-01-28 15:46:17 +01:00
Piotr Mienkowski
1ed5ba7720 drivers: i2s_sam_ssc: fix cache coherency in dma_rx_callback
Invalidate the cache before the RX data block is passed to the DMA
engine and not after it is received. If the RX data block contains
dirty cache lines they can be flushed anytime, overwriting legitimate
data that have been prefilled by the DMA module.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2022-01-28 10:07:25 +01:00
Piotr Mienkowski
a922fd1b2f drivers: qdec_sam: disable index signal
`qdec_sam` driver supports currently only position measurement and does
not support reading of the index signal. Unfortunately, the index
signal was internally enabled in the driver. If the pin to which the
index signal was connected was used by another driver it could lead to
a false detection of the signal change. Detection of the index signal
change resets the position measurement.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2022-01-28 10:07:06 +01:00
Hake Huang
b9dfe371f5 driver: i2s: fix i2s_mcux_sai build warning
remove unused args

fixing: #42179

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-28 10:06:53 +01:00
Hake Huang
086f6ea77a driver: clock: fix freq get error for clock audio
using the clock root api to get rate

fixing: #42179

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-28 10:06:53 +01:00
Piotr Mienkowski
072275217b drivers: eth_sam_gmac: fix eth_sam_gmac_set_config()
Fix handling of the return value by `eth_sam_gmac_set_config` function.
The function is used as a backend by
`net_mgmt(NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, ...)` to change the
interface MAC address at run time.

Tested on sam_e70_xplained board.

Fixes #42151

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2022-01-28 10:06:41 +01:00
Daniel DeGrasse
17979bdfb7 drivers: regulator: pmic: remove unneeded NULL check
Remove unneeded NULL check in pmic init function. Not required as
device_is_ready() will handle NULL device structs.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-28 10:06:21 +01:00
Daniel DeGrasse
3a4594e444 drivers: regulator: Remove non-const usage of config struct
Config struct in pmic regulator driver was being used as a non-constant
value when an array defined at compile time was cast to a struct used at
runtime. Move this pointer to the data struct in pmic driver.

Fixes #41951

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-28 10:06:21 +01:00
Wealian Liao
7dc9143227 drivers: nct38xx: Drop DRV_CONFIG/DRV_DATA usage
Stop using DRV_CONFIG/DRV_DATA macros and use dev->data and dev->config
instead.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-28 10:06:05 +01:00
Wealian Liao
6d6c5e1155 drivers: npcx: Drop DRV_CONFIG/DRV_DATA usage
Stop using DRV_CONFIG/DRV_DATA macros and use dev->data and dev->config
instead.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-28 10:06:05 +01:00
Wealian Liao
3565f71a72 drivers: npcx: Correct the macro parentheses
This corrects the following:
1. The priority of type cast is lower than member access. So don't need
the redundant parentheses.
2. The macro should be added to the parentheses.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-28 10:06:05 +01:00
Daniel DeGrasse
2ac1b42952 drivers: usb_dc_mcux: Move mcux callback handler out of ISR context
MCUX usb ISR was making usb callbacks directly, which caused assertion
failures when a callback attempted to lock a mutex. Move USB callback
handler to separate thread, and make ISR notify thread via message
queue.

Fixes #40638

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-28 10:05:47 +01:00
Henrik Brix Andersen
2aed5a1237 drivers: can: remove CAN_BUS_UNKNOWN CAN controller state
The CAN_BUS_UNKNOWN CAN controller state is only used to indicate that
the current CAN controller state could not be read.

Remove it and change the signature of the can_get_state() API function
to return an integer indicating success or failure.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-28 10:05:29 +01:00
Andrea Campanella
b2190fd703 drivers: serial: stm32: Add Line Break Detection
The current driver doesn't handle the LBD flag, this leads
uart_stm32_err_check to return always true if a Line Break
is detected.

This PR adds Line Break Detection and the related flag clearing,
F0 series it's excluded from the changes.

Fixes zephyrproject-rtos#41339

Signed-off-by: Andrea Campanella <andrea.campanella@helvar.com>
2022-01-28 10:05:18 +01:00
Christian Taedcke
3b271006cb drivers: spi_gecko: fix duplicated variable declaration
The commit 44679c7bd8 introduced this
duplicated declaration of the local variable data.

This commit fixes this issue.

Fixes #42117

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2022-01-27 05:23:18 -05:00
David Leach
8ab9ac2668 drivers: counter: mcux_ctimer: fix config used as non-const
The initialization code was updating the freq field in the const
declared config block at runtime because the frequency is not
known at compile time. Add a get_freq() api call to handle any
runtime requests for frequency.

fixes #41953

Signed-off-by: David Leach <david.leach@nxp.com>
2022-01-25 18:16:42 -06:00
Daniel DeGrasse
3603b6d501 drivers: dma: mcux_lpc_dma: Fix data variable name
Device 'data' variable name was incorrect due to recent treewide naming
cleanups. Fix variable name to fix build error.

Fixes #42118

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-25 14:09:30 -06:00
Tomasz Bursztyka
7bbf818cc5 drivers/dma: Fix conficting types for a variable name
Let's have dev_data for dev->data so it will not conflict with struct
call_back data variable.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-24 10:23:05 -05:00
David Leach
eb9a97299d driver: edma: Fix MCUX NULL parameter check before dereference
Coverity identified valid error where the routine does a NULL
check for two different pointers after they have been dereferenced.

fixes #39868
fixes #39874

Signed-off-by: David Leach <david.leach@nxp.com>
2022-01-22 16:56:21 -05:00
Alex Sergeev
205b7f24fd drivers: ethernet: stm32: Bugfix PTP clock read on second boundary
Current version of STM32 PTP clock reads current PTP time by querying
second and nanosecond registers sequentially. It is possible for second
to roll over between reading second and nanosecond registers, causing
returned time to be off by a second. This bugfix resolves that issue.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2022-01-21 15:27:21 -05:00
Yong Cong Sin
41bff12625 drivers: modem: gsm: Use K_KERNEL_* macros
GSM workq is a system only thread, use K_KERNEL_* macros
instead of K_THREAD_*

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-21 14:39:30 -05:00
Marius Scholtz
38d684f8f1 drivers: counter: sam: expose RC reg to DT
Exposes the RC register so that the initial value can be set in
the device tree. This is useful in the case where the timer
generates an event but an interrupt is not required.
e.g generate event to sample adc on RC register match.

Tested on Atmel SMART SAM E70 Xplained Ultra board

Signed-off-by: Marius Scholtz <mariuss@ricelectronics.com>
2022-01-21 14:25:49 -05:00
Julien Massot
71fcd696e0 drivers: gpio: rcar: set default according to dt enabled
Set GPIO_RCAR to true if renesas,rcar-gpio status is okay.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-21 14:25:25 -05:00
Julien Massot
a2fb8918ba drivers: gpio: rcar: depends on R-Car soc family
Make it consistent with other drivers, prepare for
future Gen4 introduction.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-21 14:25:25 -05:00
Julien Massot
b2811153c9 drivers: i2c: rcar: set default according to dt enabled
Set I2C_RCAR to true if renesas,rcar-i2c status is okay.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-21 14:25:25 -05:00
Julien Massot
86a2f81c14 drivers: can: rcar: set default according to dt enabled
Set CAN_RCAR to true if renesas,rcar-can status is okay.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-21 14:25:25 -05:00
Julien Massot
2d6ed8c083 drivers: serial: rcar: set default according to dt enabled
Set UART_RCAR to true if renesas,rcar-scif status is okay.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-21 14:25:25 -05:00
Sylvio Alves
aea53f41c1 esp32: fix uart and gpio driver priority to enable console
Current gpio and uart initialization level is set to
PRE_KERNEL_2, which won't let uart_console subsystem
to init its hook properly as it has same level.
Prioritize uart and gpio so that the console hooks
are properly initialized.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-21 13:16:55 -05:00
Sylvio Alves
c409a4656f drivers: uart: esp32: use DEVICE_DT_INST_DEFINE()
Current uart driver implementation is incompleted regarding the
usage of DT_INST_FOREACH_STATUS_OKAY. If uart0 and uart2 are selected,
build breaks due to peripheral number ordering, which would be
0 and 1 in this case. This fix PR fix this by re-working the macros
and setting proper uart peripheral instances in DTSI, required for signal
routing configuration.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-21 13:16:55 -05:00
Hake Huang
ef0b87c4de driver: sai: add RT11XX support
RT11xx series use CCMV2 need special processing

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-21 11:26:45 -06:00
Hake Huang
0525ad3d46 clock: ccmv2: add SAI CCM clocks for RT11xx
add SAI CCMV2 clocks for RT11xx series

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2022-01-21 11:26:45 -06:00
Immo Birnbaum
1b088adbdf drivers: serial: xlnx_ps: update referenced SoC configuration items
Update the Kconfig configuration items used to determine if the current
target is based on the Zynq-7000 SoC family as part of the re-organi-
zation of the Zynq-7000 SoC configuration data.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@Weidmueller.com>
2022-01-21 11:34:09 -05:00
Immo Birnbaum
99a6598b98 drivers: ethernet: xlnx_gem: update referenced SoC configuration items
Update the Kconfig configuration items used to determine if the current
target is based on the Zynq-7000 SoC family as part of the re-organi-
zation of the Zynq-7000 SoC configuration data.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@Weidmueller.com>
2022-01-21 11:34:09 -05:00
Sylvio Alves
b777b1dd6f counter: esp32: fix build failure and warnings
PR #41918 introduced a few warnings and build failure due to
missing data cofniguration and DEV_CFG() removal.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-21 11:27:48 -05:00
Sylvio Alves
224ec1e835 uart: esp32: move hal instance to data level
After #41918, DEV_CFG removal triggered discard qualifer warning
during build. As uart_hal functions don't required const qualifier
and uart_context_hal_t has modified data, this PR moves hal instace
to data struct instead of config struct.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-21 11:27:48 -05:00
Sylvio Alves
64755b6453 gpio: esp32: remove discard qualifier warning
After #41918, build started to warn discard qualifer
in config struct. This adds const into those structs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-21 11:27:48 -05:00
Nazar Palamar
29eec8b3f7 Bluetooth: H4: added support for HCI vendor-specific Setup feature.
Updated H4 driver to initialize setup function. Finally bt_h4_vnd_setup
function must be implemented in vendor-specific HCI extension module if
CONFIG_BT_HCI_SETUP is enabled.

BT_HCI_SETUP feature is useful when the BT Controller requires execution
of the vendor-specific commands sequence to initialize the BT Controller
before the BT Host executes a Reset sequence.
To enable this feature the CONFIG_BT_HCI_SETUP should be enable.

Fixes #41140

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-01-21 15:04:15 +02:00
Nazar Palamar
c77a546f14 Bluetooth: hci: added HCI vendor-specific Setup function feature
- Added config BT_HCI_SETUP to enable HCI vendor-specific Setup feature,
- Added pointer to 'setup' function in bt_hci_driver structure.

BT_HCI_SETUP feature is useful when the BT Controller requires execution
of the vendor-specific commands sequence to initialize the BT Controller
before the BT Host executes a Reset sequence. To enable this feature the
CONFIG_BT_HCI_SETUP should be enable.

Fixes #41140

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-01-21 15:04:15 +02:00
Milind Paranjpe
25e6803705 drivers: flash: Eliminate warning when compiling with GCC
Address the issue mentioned in zephyrproject-rtos#7412

Using printf() with "%x" to print an off_t value produces the
following warning:

format '%x' expects 'unsigned int', argument has type 'long int'
  228 |  LOG_DBG("Erasing sector at 0x%08x", offset);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~
      |                                      |
      |                                      off_t {aka long int}

In newlib off_t is long. Even though both int and long are 4 bytes wide
in the architecture in use, GCC wants to see "%lx" to printf() a long.
Using "%"PRIx32 still produces the same warning because PRIx32
(from inttypes.h) still expands to simply an "x" and not "lx".

PR zephyrproject-rtos#40004 has solved this by casting offset to
ssize_t. The same solution is emulated here.

Signed-off-by: Milind Paranjpe <milind@whisper.ai>
2022-01-20 13:42:35 -06:00
Martin Koehler
d176158273 drivers: gpio: Fix NO_PINT_INT
Fixed #41945
NO_PINT_INT can have the same value as a specific pin.
E.G. For 1 byte pint_pin_int_t it equaled interrupt1.
Now is instead always 1 higher than the highest pin.
Expects fsl to keep setting values from 0 to
(number of connected outputs - 1)

Signed-off-by: Martin Koehler <koehler@metratec.com>
2022-01-20 13:40:18 -06:00
Sylvio Alves
eec068b8a5 soc: esp32c3: fix cpu vendor name
Build shows warning due to incompatible
CPU vendor name. This fixes it and applies
necessary changes in files.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-20 13:33:29 -05:00
Gerard Marull-Paretas
20d0260753 drivers: dma: mcux_lpc: fix variable name clash
data was already used by the struct call_back, rename device data to
`dev_data`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-20 07:41:26 -06:00
Jeremy Wood
1caa7f6cb9 drivers: can: m_can variant for STM32H7
* New m_can driver variant for STM32H7, as it uses the complete m_can
register set.
* Fix definitions for CAN_MCAN_RXF0S_F0FL, CAN_MCAN_TXEFC_EFSA_POS.

Signed-off-by: Jeremy Wood <jeremy@bcdevices.com>
2022-01-19 16:07:54 -05:00
Julien Massot
03135f4604 drivers: pinctrl: pfc_rcar: fix bank and bit parsing
Bank and Bit has been inverted at some point.
Fix that !

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-19 16:06:46 -05:00
Mahesh Mahadevan
aeabe6c70c driver: clock: Update MCUX Syscon clock control driver
1. Update to add support for Flexcomm8-13.
2. Fix the clock control driver, the enclosing #define
   was incorrect.
3. Identify HS_SPI port using the appropriate Register
   define

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-01-19 13:35:09 -06:00
Lukasz Maciejonczyk
253c59c0e5 drivers: ieee802154_nrf5: fix condition for mac keys and frame counter
For multicore devices like nRF53, shim layer part of setting mac keys
and frame counters is called on application core where
CONFIG_NRF_802154_ENCRYPTION is disabled (the define concerns radio
driver for net core). This commit replaces
CONFIG_NRF_802154_ENCRYPTION with CONFIG_IEEE802154_2015.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-01-19 14:16:23 -05:00
Henrik Brix Andersen
778e0ebd92 drivers: can: stm32fd: mark internal functions as static
Mark the internal STM32FD CAN driver functions as static.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 14:14:57 -05:00
Remy Luisant
6a12fb20ab timer: Add tickless support for the MIPS CP0 timer
This commit adds support for tickless operation on the MIPS CP0 timer.
The code closely follows the Xtensa and RISCV timer drivers.

All tests pass.

Signed-off-by: Remy Luisant <remy@luisant.ca>
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
2022-01-19 13:48:21 -05:00
Antony Pavlov
9175ed8244 timer: add support for MIPS CP0 timer
This commit adds a kernel device driver for the MIPS CP0 timer.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
2022-01-19 13:48:21 -05:00
Neil Armstrong
8e0f3d1e5d pcie: controller: add non-recursive pcie busses enumeration
In order to preserve stack, this replaces the single-bus enumeration
loop by a stack based non-recursive pcie hierarchy iteration.

Each stack entry contains a bridge bus enumeration state.

When a bridge endpoint is detected on the current bus, it is
configured and this new bus is pushed on top of the stack in
order to be enumerated at next loop.

When enumeration ends on the bus, the current bus state is
removed from the stack to continue enumeration on the previous
bus.

This enumeration affects a sequential bus number to each new
bus detected in the same order as Linux & U-Boot does.

In this hierarchy:
       [0         1          2   ...   31]
        |         |          |
        EP        |          |
                  |          |
        [0   1  ... 31]   [0  ... 31]
         |   |             |
         |  EP             |
         |              [0 ... 31]
     [0 ... 31]          |
      |                 EP
     EP

We will get the following BDFs enumeration order:
 00:00.0	Endpoint
 00:01.0	Bridge => Bus primary 0 secondary 1
 01:00.0	Bridge => Bus primary 1 secondary 2
 02:00.0	Endpoint
 ... Bus secondary 2 => subordinate 2
 01:01.0	Endpoint
 ... Bus secondary 1 => subordinate 2
 00:02.0	Bridge => Bus primary 0 secondary 3
 03:00.0	Bridge => Bus primary 3 secondary 4
 04:00.0	Endpoint
 ... Bus secondary 4 => subordinate 4
 ... Bus secondary 3 => subordinate 4

The gives the following primary/secondary/subordinate map:
 Bus 0 [0         1              2   ...   31]
        |         |              |
        |      [0:1->2]      [0:3->4]
   EP 00:00.0     |              |
                  |              |
  Bus 1 [0   1  ... 31]  Bus 3 [0  ... 31]
         |   |                  |
         |  EP 01:01.0          |
     [1:2->2]                [3:4->4]
         |                      |
         |            Bus 4  [0 ... 31]
Bus 2 [0 ... 31]              |
       |                     EP 04:00.0
      EP 02:00.0

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Neil Armstrong
e937eb97c4 pcie: controller: add Type 1 bridge configuration
This adds setup of Type 1 bridge endpoints in two steps, first when
endpoint is detected and secondly when enumerating the next endpoint.

First, the code configures the bus primary & secondary number and 0xff
as subordinate to redirect all PCIe messages to this bus.

Then memory & I/O base are programmed by getting the current allocation
bases.

Finally, now right away, we program the subordinate to the max bus
number under the bridge, here the same, and the memory & I/O limit,
here lower than the base.

This doesn't make the bridge totally usable, enumeration would work
bus not for nested bridges and BARs wouldn't be accessible.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Neil Armstrong
b79d66a712 pcie: controller: split out endpoint enumeration code
In order to prepare support for bridges enumeration, split out the
actual endpoint enumeration code out of the enumeration loop.

Pass a skip_next_func boolean to indicate if the current endpoint
is multifunction of not, to continue to next dev or next function.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Neil Armstrong
a1b20d3dd9 pcie: controller: prepare to enumerate bars for Type 1 endpoints
The Type 1 endpoints has 2 BARs are the same position as the Type 0
BARS 0 & 1, so reuse the generic_pcie_ctrl_type0_enumerate_bars()
for both types by passing the number of possible BARs on the endpoint.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Neil Armstrong
b2d6096eb5 pcie: ecam: implement callback to get allocation base
Implement callback to get allocation base similar to the
pcie_ecam_region_allocate callback.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 13:37:36 -05:00
Jordan Yates
ccdc009077 drivers: power_domain: gpio controlled domain
Initial implementation of a simple GPIO controlled power domain.
It exposes no API of its own, all functionality is contained inside
the runtime power management callbacks.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-19 13:35:32 -05:00
Julien Massot
a6d7adf990 drivers: can: rcar: add support for CAN_ERROR_WARNING
Add support for CAN_ERROR_WARNING CAN controller state.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-19 18:34:26 +01:00
Henrik Brix Andersen
7c41d34339 drivers: can: mcp2515: add support for CAN_ERROR_WARNING
Add support for CAN_ERROR_WARNING CAN controller state.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 18:34:26 +01:00
Henrik Brix Andersen
7b9996c130 drivers: can: mcan: add support for CAN_ERROR_WARNING
Add support for CAN_ERROR_WARNING CAN controller state.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 18:34:26 +01:00
Henrik Brix Andersen
616c03aa20 drivers: can: stm32: add support for CAN_ERROR_WARNING
Add support for CAN_ERROR_WARNING CAN controller state.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 18:34:26 +01:00
Henrik Brix Andersen
d66bfd7f77 drivers: can: mcux: flexcan: add support for CAN_ERROR_WARNING
Add support for CAN_ERROR_WARNING CAN controller state.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-19 18:34:26 +01:00
Gerard Marull-Paretas
435213a753 drivers: remove redundant data/config casts
Some drivers explicitely casted data/config from void * to the
corresponding type. However, this is unnecessary and, in many drivers it
has been misused to drop const qualifier (refer to previous commits).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
30971b51ba drivers: sensor: sbs_gauge: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
5efb4610cf drivers: clock_control: esp32: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
51e552a9a3 drivers: display: st7735r: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
b9319e57cb drivers: sensor: lm75: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
1aeec129fc drivers: regulator: pmic: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
50720eb0cb drivers: misc: ft8xx: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
93b3cba2f1 drivers: adc: ite_it8xxx2: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
93d48baa16 drivers: i2s: litex: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
63d696e3b8 drivers: dma: iprox_pax_v1/2: constify device config access
`const` was missing from one device config access.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
8398105d82 drivers: fix style issues
Fix issues reported by checkpatch.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
ee434ebdee drivers: watchdog: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
468de7eb29 drivers: spi: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
a6614968a8 drivers: serial: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
2c103a25cc drivers: sensor: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
9b92dfeca8 drivers: ieee802154: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
c5b596a0bf drivers: i2c: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
33a3be6818 drivers: flash: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
3dc5c01aee drivers: entropy: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
fb3a313f82 drivers: counter: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
ba8f7a2dd8 drivers: wifi: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data
and dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
b00150339a drivers: watchdog: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
44679c7bd8 drivers: spi: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data
and dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
1674fec5b6 drivers: serial: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
e8c15f68b2 drivers: sensor: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
1de05e6095 drivers: pwm: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
ccdaf45ba5 drivers: pinmux: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
f215b3a2f3 drivers: neural_net: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
253ab20508 drivers: mdio: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
d231c11ec8 drivers: led: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
150d4b73bb drivers: ipm: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
c2078bd3d0 drivers: interrupt_controller: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
72a0d68284 drivers: i2s: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
be32e33774 drivers: i2c: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
ae5ebe8e51 drivers: gpio: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
fb23084be1 drivers: flash: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
6f6a178390 drivers: ethernet: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
d3443cc8c1 drivers: espi: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
250fd0e23b drivers: entropy: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
f5effdde6c drivers: eeprom: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
d2118eb1bc drivers: dma: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
3b6201e23a drivers: dac: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
c4550bc931 drivers: counter: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
03cc904d60 drivers: console: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
ddf9fc4f9f drivers: clock_control: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
6378fcd0be drivers: can: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
224958c537 drivers: audio: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas
6745333511 drivers: adc: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data
and dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Krzysztof Chruscinski
ec9a32481b drivers: timer: nrf_rtc_timer: Add z_nrf_rtc_timer_capture_task_address_get
Add function for getting address of RTC capture task.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-19 17:46:28 +01:00
Neil Armstrong
9463525347 pcie: controller: rename generic_pcie_ to pcie_generic_
As suggested by Tomasz Bursztyka, it's clearer to move generic after the
domain prefix, here pcie.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 09:47:59 -05:00
Neil Armstrong
6595ca1a35 pcie: controller: rename xlate to translate
As suggested by Tomasz Bursztyka, translate is clearer than xlate in
the PCIe controller functions and callbacks names.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2022-01-19 09:47:22 -05:00
Lukasz Maciejonczyk
7bdb1c2a82 drivers: ieee802154_nrf5: fix sleep call for csl
When the csl is active the nrf_802154_sleep() is called unnecessary.
This commit fixes it.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2022-01-19 09:32:02 -05:00
Daniel Leung
9e688e3956 drivers: mm: add driver for Intel Audio DSP
This adds the driver for the memory mapping hardware
on Intel Audio DSP.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-18 19:18:30 -05:00
Daniel Leung
11c3b1d379 drivers: mm: add skeleton build files and common funcs
This adds skeleton Kconfig/CMakeLists.txt and common implementation
of some sys_mm_drv_*() functions.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-18 19:18:30 -05:00
Anas Nashif
01b7800bc8 include: remove deprecated headers
Remove all deprecated headers which were moved to a different location.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-01-18 19:17:50 -05:00
Daniel DeGrasse
59f9dfae58 drivers: timer: mcux_gpt: Enable GPT timer to run in doze mode
GPT timer must continue running in low power modes, as it is the system
wakeup source. Set configuration to ensure peripheral will not stop
running in low power modes.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 14:09:45 -05:00
Bartosz Bilas
ca96286c22 drivers: ethernet: dsa_ksz8xxx: remove duplicated headers
drivers/spi.h header is included when CONFIG_DSA_SPI
is enabled so there is no necessity to do that once again.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-01-18 13:23:16 -05:00
Bartosz Bilas
8779972955 drivers: ethernet: dsa_ksz8xxx: convert to spi_dt_spec
Convert dsa_ksz8xxx driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-01-18 13:23:16 -05:00
Andrei Emeltchenko
c493825ac1 edac: ibecc: Add LOG_INF for indication initialization
Add LOG_INF() to indicate that IBECC driver is initialized.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-01-18 13:22:53 -05:00
Henrik Brix Andersen
296d368047 drivers: can: mcan: remove unused NUM_TX_EVENT_FIFO_ELEMENTS macro
Remove the unused NUM_TX_EVENT_FIFO_ELEMENTS helper macro. There is no
dts property for setting the TX event FIFO size.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-18 13:15:05 -05:00
Aymeric Aillet
37f5fe5e82 drivers: serial: RCar add pinctrl support
Get pin configuration from device tree to
set alternate pin function.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-01-18 13:04:53 -05:00
Ruibin Chang
40bb3d808a ITE drivers/watchdog: cleanup it8xxx2 watchdog driver
Stop using DRV_CONFIG, DRV_DATA, DRV_REG macros.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-01-18 12:14:26 -05:00
Ruibin Chang
1a11a3362e ITE drivers/watchdog: support tests/drivers/watchdog/wdt_basic_api
Add watchdog0 to support tests/drivers/watchdog/wdt_basic_api.

Solve tests code runtime error on it8xxx2_evb:

1.When run the wdt tests api, we shouldn't reduce the warning
timer time, so I add config WDT_ITE_REDUCE_WARNING_LEADING_TIME,
this config will be enabled only on platform EC.

2.Upper limit window timeouts can't be 0 when we install timeout.

3.Since we support wdt_it8xxx2_disable(), then we should support
flag WDT_OPT_PAUSE_HALTED_BY_DBG, too. Watchdog can be stopped
by IT8XXX2_WDT_EWDSCEN bit of ETWCTRL reg.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-01-18 12:14:26 -05:00
Gerard Marull-Paretas
ddc168fa78 pm: s/PM_DEVICE_(DT_(INST))_REF/PM_DEVICE_(DT_(INST))_GET
In order to align with macros used to obtain a device reference (e.g.
DEVICE_DT_GET), align the PM macros to use "GET" instead of "REF". This
change should have low impact since no official release has gone out yet
with the "REF" macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-18 12:14:06 -05:00
Daniel DeGrasse
0fddb3e458 soc: rt11xx: Enabled GPTP module clock
gPTP module clock is enabled for rt11xx. gPTP is not working correctly
on the RT10xx or RT11xx series, but this module clock needs to be
enabled

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 12:13:24 -05:00
Daniel DeGrasse
5fe5161721 drivers: eth_mcux: Update for RT11xx SOC
RT11xx soc has multi ring enet IP, which has different HAL functions.
Update eth_mcux driver to account for this

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 12:13:24 -05:00
Daniel DeGrasse
594e11a540 drivers: eth_mcux: Enable specifying PHY addr for enet module
PHY addr is not always 0 on boards with multiple PHYs. Allow specifying
via devicetree.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-01-18 12:13:24 -05:00
Gerson Fernando Budke
58936e7639 soc: arm: atmel_sam: samv71: Fix SPI build dependency
The SAM spi driver depends on GPIO driver to work. It seems that this
dependency chain it is not handled. This select GPIO driver when SPI
driver is enabled. It rework GPIO and SPI Kconfig to select driver by
devicetree and drop entries at Kconfig.defconfig.series file.

Fixes #41525

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2022-01-18 12:12:52 -05:00
Przemyslaw Bida
b5e34561eb net: openthread: Fix warinig in nrf5_config_mac_keys.
This commit fixes compilation warning (unused variable)
generated in nrf5_config_mac_keys function, when the ASSERT
macros were disabled.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2022-01-18 10:40:53 -05:00
Alexander Wachter
6e5c8a339d drivers: can: Add frontend for Atmel SAM M_CAN controller
This commit adds a frontend for the generic Bosch m_can driver
for Atmel SAM series.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-01-18 10:39:55 -05:00
Alexander Wachter
4e903cd4fe drivers: can: mcan: Add headers for types used in this file
Some includes that resolve types used in this file were missing.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-01-18 10:39:55 -05:00
Alexander Wachter
c5ad0b425e drivers: can: mcan: fix array index in cache handling param
filter_nr was renamed to filter_id. This change was not included
in the cache handling PR.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-01-18 10:39:55 -05:00
Benedikt Schmidt
6c60664281 drivers: clock_control: stm32h7: systick activation
Do not enable systick in the clock control initialization of
a STM32H7.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-01-18 10:36:07 -05:00
Attie Grande
ce07d834a5 drivers: i2c: sam0: Return the bus to idle when a transaction fails
If a transaction fails, the bus was not being returned to idle. This
increases power consumption, and can cause the following transaction to
be misinterpreted.

By issuing a STOP command on error, we can ensure that the bus returns
to idle correctly.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-01-18 10:28:31 -05:00
Attie Grande
aed55b6cb9 drivers: i2c: sam0: Ensure the bus returns to idle after a read
When calling i2c_transfer(), the bus failes to enter the idle state when
performing a read, or an unacknowledged write. This increases power
consumption, and can cause the following transaction to be
misinterpreted.

This behaviour was observed on a SAML21 part. There appears to be a race
condition between the peripheral setting CLKHOLD, and the command being
correctly set up - so now we wait for the CLKHOLD field to be set before
issuing the STOP command, and this resolves this issue.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-01-18 10:28:31 -05:00
Sylvio Alves
40ad264a47 drivers: uart: fix esp32 TX checks
This fixes both TX ready and completed uart
calls to meet valid condition.

Closes #41526
Closes #41624

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-18 10:28:00 -05:00
Henrik Brix Andersen
e8df8a5790 drivers: can: mcux: flexcan: rework transmit error handling
Rework the transmit error handling in the NXP MCUX FlexCAN driver:
- Frame transmission must be automatically retried in case of lost
  arbitration or missing acknowledge.
- Abort any pending TX frames when bus-off state is entered.
- Fail early in can_send() if in bus-off state.

Fixes: #19502

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-17 21:09:17 -05:00
Henrik Brix Andersen
b6f6069b99 drivers: can: stm32: add support for disabling automatic retransmissions
Add support for disabling automatic retransmission of CAN frames
(similar to CAN "one-shot" mode in the Linux kernel).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-17 21:09:17 -05:00
Attie Grande
36ebb7a2bc drivers: i2c: fixup comments outlining command arguments
Some comments were missing, and others were misleading. This is now
resolved.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2022-01-17 15:43:20 -05:00
Julien Massot
15f4bbf86b drivers: can: RCar add pinctrl support
Get pin configuration from device tree to
set alternate pin function.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-17 21:00:58 +01:00
Julien Massot
feb6e2504e drivers: pinctrl: add Renesas RCar PFC driver
Introduce Pin Function Controller for Renesas R-Car family.
This first implementation support to set a given pin as gpio
or peripheral (GPSR), to set a peripheral function to a
pin (IPSR), to set pull-up, pull-down (PUEN, PUD).
In addition this driver allows to set driving capabilies(DRVCTRL).

Pins are identified thanks to the per SoC binding for
pin definition which also contains pin alternate function
parameters.

Some pins can also have driving capabilities, some have bias
capabilities.
In order to find the correct bias and drive registers pfc_r8a77951.c
describes the different registers.
Each SoCs or package will need to define getters
for these registers: pfc_rcar_get_bias_regs() and
pfc_rcar_get_drive_regs().

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2022-01-17 21:00:58 +01:00
Tim Lin
013bc73e40 ITE: cleanup: drivers/bbram: correct the default configuration format
1. Rename DT_COMPAT_ST_BBRAM_IT8XXX2 to COMAPT_ITE_IT8XXX2_BBRAM
2. The default configuration "$( )" should be a parentheses instead
   of curly brackets. The BBRAM for it8xxx2 can be driven after
   correcting.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-17 11:52:13 -05:00
Tim Lin
95ba8e3fe4 ITE: drivers/bbram: add magic number to compare in initial
BBRAM content should be cleared when boot from cutoff. Compare magic
number to decide whether to clear entire BBRAM.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-17 11:52:13 -05:00
Maureen Helm
e0cb96c4e3 drivers: flash: Refactor drivers to use shared init priority
Refactors all of the on-chip flash drivers to use a shared driver class
initialization priority configuration, CONFIG_FLASH_INIT_PRIORITY, to
allow configuring flash drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers.

Driver-specific options for SPI-based flash drivers are left intact
because they need to be initialized at a different priority than on-chip
flash drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-01-17 11:51:09 -05:00
Jedrzej Ciupis
81ea529960 drivers: ieee802154: extend support for nRF53
This commit updates the ieee802154 driver to match the current feature
set of the nRF 802.15.4 radio driver for nRF53 SoCs.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2022-01-17 11:50:38 -05:00
Alexander Wachter
41643b0fac drivers: can: stm32fd: fix type of clock rate
the rate_tmp varaiable was int, but should be const uint32_t.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-01-17 11:50:06 -05:00
Alexander Mihajlovic
cfce5afcd9 drivers: adc: stm32: Clear ADRDY before waiting
Clear ADRDY before enabling ADC to ensure the subsequent
wait for ADRDY does not stop prematurely in case ADRDY
was already set.

The "ADC on-off control" sections of the following reference manuals
were consulted. That gives at least one instance per series affected
by this change, even if not every affected MCU is covered.

- RM0438 (STM32L552xx and STM32L562xx)
- RM0351 (STM32L47xxx, STM32L48xxx, STM32L49xxx and STM32L4Axxx)
- RM0434 (STM32WB55xx and STM32WB35xx)
- RM0454 (STM32G0x0)
- RM0440 (STM32G4 Series)
- RM0399 (STM32H745/755 and STM32H747/757)
- RM0433 (STM32H742, STM32H743/753 and STM32H750)
- RM0453 (STM32WL5x)

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-01-17 11:48:30 -05:00
Alexander Mihajlovic
e521c7d49e drivers: adc: stm32: Add function to enable ADC consistently
Use a wrapper for LL_ADC_Enable that also waits for ADRDY if required
by the SoC to make sure it's properly enabled everywhere this is done.

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-01-17 11:48:30 -05:00
Henrik Brix Andersen
d5fb436f73 drivers: can: shell: catch up with recent CAN API naming changes
Rename CAN RX filter shell commands to catch up with the CAN API naming
changes in 8af4bb722d.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-17 11:48:02 -05:00
Francois Ramu
d65a74e2dd drivers: spi: stm32 spi drivers supports the frame format
the stm32 spi drivers now takes the DTS frame_format property
from the include/ drivers/spi.h
It will be possible to select the Motorola (default)
or TI from the DTS entry of the device,
when soc supports it, else a run time error is raised.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-17 11:46:14 -05:00
Manojkumar Subramaniam
ae0ce3a2b9 drivers: clock_control: stm32h7: Support SoC STM32H7A3XX / STM32H7A3XX-Q
clock requirement

Introduce a new group of clock setting to fit in this series of SoC

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2022-01-17 11:45:21 -05:00
Ruibin Chang
336d0f67b3 ITE drivers/kscan: support tests/driver/kscan/kscan_api
Add kscan0 to support tests/driver/kscan/kscan_api.

When running the tests code on it8xxx2_evb, it shows fatal
error: IRQ is enabled. We find that once polling_task() is
created and executed, the KSI interrupt will be enabled and
before we call irq_connect_dynamic(), so we switch both
function sequence.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-01-17 11:44:05 -05:00
Jordan Yates
8173277cc1 drivers: adc: test driver
Add a dummy driver for the `vnd,adc` compatible to allow compilation of
drivers utilising an ADC when running "build_all" tests.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-17 08:13:41 -05:00
Daniel Leung
44462723f5 timer: hpet: make legacy interrupt routing optional
On some platforms, HPET is not wired to trigger IRQ 2.
This would make HPET non-functional if the legacy
interrupt routing bit is set in the global config
register. This adds a DTS flag so the driver won't
set the bit to enable legacy interrupt.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-14 14:46:21 -05:00
HaiLong Yang
5a7aeb9439 drivers: i2c: introduce GD32 I2C driver
Add an interrupt driven i2c driver for gd32 i2c peripheral.

The transmit and reception method refer from GD32 SoCs user manual.
Particularly, reception method choose the solution B.

There have some wait for state ready logic in the driver. It cause by
i2c device internal state change slower than i2c driver.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2022-01-14 10:42:24 -06:00
Sebastian Bøe
0cae1d8928 drivers: flash: Refactor boundary checking
We will soon need to do more boundary checking to test whether we are
reading secure or non-secure memory.

Refactor the boundary checking in preparation for this.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2022-01-14 09:57:04 -06:00
Dominik Chat
3e6ab47455 sensors: Implement MPU9250 driver
MPU9250 driver for 9-axis
gyroscope, accelerometer, magnetometer

Signed-off-by: Dominik Chat <dominik.chat@nordicsemi.no>
2022-01-14 12:33:04 +01:00
Krzysztof Chruscinski
ee43b3a51b drivers: gpio: nrf: Free channel when pin is reconfigured
GPIOTE channel was not freed when pin was reconfigured. This lead to
channel pool draining when pin was frequently reconfigured.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-14 12:28:21 +01:00
Wouter Cappelle
c3ca3aa27d sensors: STM32: Add support for L5 die temp sensor
This PR adds the different handling of temperature sensor for the
STM32L5 soc. In this soc, there are some calibration settings which
need to be applied for temperature conversion.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-01-13 10:34:10 +01:00
Wouter Cappelle
ba12740049 sensors: STM32: code formatting of stm32_temp with sample
clang format on stm32_temp.c & the sample

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-01-13 10:34:10 +01:00
Wouter Cappelle
c9e7ca3cac sensors: STM32: Prepare for different handling of temp conversions
moving the conversion from adc value to the get function
which will be used for different handling of stm32 temp sensors

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-01-13 10:34:10 +01:00
Tom Burdick
0e96f59e83 dma: Add suspend resume implementation for edma
Implement the suspend and resume transfer api calls for NXP's eDMA.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-01-12 17:33:48 -05:00
Daniel Leung
9c4fb66a8b i2s: i2s_litex: fix doc styling on two copy functions
Just minor styling changes to capitalize the first character
and removing the trailing comma on the brief doc description
on two copy functions.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Daniel Leung
bae4847b51 drivers: i2s/i2s_litex: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Daniel Leung
bff37a3a6c drivers: serial: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Daniel Leung
44ee482b0a drivers: console: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Daniel Leung
0e1d5a48a9 drivers: timer: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Daniel Leung
975e257f2c drivers: interrupt_controller: remove @return doc for void funcs
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Henrik Brix Andersen
e919db3222 drivers: can: add user_data to state change callback
Add optional user data argument to can_set_state_change_callback() to
comply with Zephyr API design guidelines.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-11 11:54:04 +01:00
Alexander Mihajlovic
673806aef1 drivers: spi: stm32: Skip pinctrl setup for subghzspi
Subghzspi instances cannot have any pinctrl configs,
they are blacklisted by the dts binding. This caused an
initialization failure of the spi_ll_stm32 driver for
subghzspi instance because no "default" pinctrl was found.

This commit solves the problem by skipping the pinctrl setup
for subghzpi devices. The use_subghzpi_nss property is used
to identify a subghzspi device, as this is a required boolean
property only available in the subghzspi binding this is a
perfect indicator for such instances.

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-01-11 11:52:59 +01:00
Tim Lin
263fd9d1d1 ITE: cleanup: it8xxx2: drivers/intc rename the function
The function should be renamed ite_intc_irq_polarity_set.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-11 11:52:35 +01:00
Tim Lin
d676b51485 ITE: drivers/i2c: add the API of get configuration
This commit adds the API of get_config that will make test of
tests/drivers/i2c/i2c_api pass on it8xxx2_evb board.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-11 11:51:04 +01:00
Marius Scholtz
14e15df00f drivers: arm: stm32: adc: Added Shared IRQ
Certain stm32 soc's have a single shared irq for all adc channels
on those soc's only a single channel is supported.

Added a Kconfig that enables a shared irq for stm32f2x, stm32f4x,
stm32f7x soc's. The shared IRQ uses a flag to limit the number of
interrupts defined to only 1. A shared irq handler is added which
determines which ADC instance the interrupt is for, it then calls
into the existing interrupt.

Signed-off-by: Marius Scholtz <mariuss@ricelectronics.com>
2022-01-11 11:50:43 +01:00
Gerard Marull-Paretas
1e81e7cded drivers: pwm: gd32: enable gd32vf103
Add dependency on SOC_SERIES_GD32VF103. The driver is compatible as is
with this series.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-11 11:50:35 +01:00
Gerard Marull-Paretas
cdcd11aac0 drivers: gpio: gd32: enable gd32vf103
The device implemented by this driver is also available on GD32 RISC-V
MCUs.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-11 11:50:35 +01:00
Gerard Marull-Paretas
c4269ba947 drivers: interrupt_controller: gd32_exti: enable gd32vf103
The device implemented by this driver is also available on GD32 RISC-V
MCUs.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-11 11:50:35 +01:00
Gerard Marull-Paretas
07eee1bc79 drivers: interrupt_controller: gd32_exti: isr may be unused
The gd32_exti_isr function may be unused if the GPIO driver is not
enabled but EXTI is (no IRQ will connect to it). This may be improved in
the future by requiring explicit enablement of the exti DT node.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-11 11:50:35 +01:00
Tim Lin
45b6aa4c3b ITE: drivers/i2c: add the compatibility of GPIO F2/F3 for i2c3
The default I2C channel 3 is used by alternate function of GPIO H1/H2
Krabby uses GPIO F2/F3 as I2C channel 3, so we need to add the
compatibility of the GPIO F2/F3.

TEST=test on it8xxx2_evb:
zmake configure -b zephyr/projects/it8xxx2_evb/

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-11 11:49:16 +01:00
Jaremy J. Creechley
3ac2ca2aa5 net: socket: extend posix compatability SO_<opts>
Adding these definitions help ease of porting POSIX applications.

They currently do nothing in the core network stack and will
return an error if used. However, they help port some POSIX
without changing these. In particular, this enables using the
Nim programming language's standard library with Zephyr.

- The values copy Linux amd64, similar to the other SO_OPTIONS
- Add SO_SNDBUF to fix simplelink wifi
- Use compat options in simplelink wifi

Signed-off-by: Jaremy J. Creechley <jaremy.creechley@panthalassa.com>
2022-01-11 11:48:16 +01:00
Jonathan Hahn
32f9dcf328 drivers: uart: Add support for st single wire mode
An additional devicetree poperty `single-wire` is added
to uart and usart bindings of stm32. The driver checks this value
during initialization and enables the single wire mode when set.

Signed-off-by: Jonathan Hahn <Jonathan.Hahn@t-online.de>
2022-01-11 11:47:47 +01:00
Gerard Marull-Paretas
10fb5789ef drivers: serial: ns16550: use pm_state_cpu_get_all
Use pm_state_cpu_get_all to obtain CPU states instead of using extra ROM
duplicating existing information already holded by the PM subsystem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-11 10:46:20 +01:00
Jani Hirsimäki
b204c26e94 drivers: net: ppp: async uart support
Implemented an option to use asyncronous uart api
(CONFIG_NET_PPP_ASYNC_UART).

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2022-01-10 09:43:10 -06:00
Henrik Brix Andersen
93c6b7413b drivers: can: add NXP LPC MCAN front-end for the Bosch MCAN driver
Add a NXP LPC MCAN-specific front-end for the generic Bosch MCAN
driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-01-10 12:00:20 +01:00
Henrik Brix Andersen
abaf7cc70d drivers: clock_control: lpc: syscon: add MCAN clock support
Add support for the LPC MCAN clock to the LPC SYSCON clock controller
driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-01-10 12:00:20 +01:00
Henrik Brix Andersen
064720a2f0 drivers: can: mcan: fix CAN_MCAN_TXEFC_EFSA_POS value
The Event FIFO start address (EFSA) field within the Tx event FIFO
configuration register (TXEFC) occupies bit 15:2.

Change the CAN_MCAN_TXEFC_EFSA_POS definition to reflect this.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-01-10 12:00:20 +01:00
Henrik Brix Andersen
8af4bb722d drivers: can: rename API functions for better consistency
Rename a few CAN API functions for clarity and consistency with other
Zephyr RTOS APIs.

CAN_DEFINE_MSGQ() becomes CAN_MSGQ_DEFINE() to match K_MSGQ_DEFINE().

can_attach_isr() becomes can_add_rx_filter() since a filter callback
function is not an interrupt service routine (although it is called in
isr context). The word "attach" is replaced with "add" since filters are
added, not attached. This matches the terminology used is other Zephyr
APIs better.

can_detach() becomes can_remove_rx_filter() to pair with
can_add_rx_filter().

can_attach_msgq() becomes can_add_rx_filter_msgq() and documentation is
updated to mention its relationship with can_add_rx_filter().

can_register_state_change_isr() becomes can_set_state_change_callback()
since a state change callback function is not an interrupt service
routine (although it is called in isr context). The word "register" is
replaced with "set" since only one state change callback can be in
place.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-10 10:44:37 +01:00
Francois Ramu
1da200bf16 drivers: spi: stm32h7 spi drivers with DMA transfer
This patch controls the SPI of the stm32H7 mcu when using
the DMA transfer. Starting and ending the transfer
are specific according to the RefMan.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-07 15:06:28 -06:00
Francois Ramu
ca3c2cf1f9 drivers: spi: stm32 spi instance of stm32H7 mcu
A generic function is used to give the register address to the DMA.
The SPI of the stm32H7 serie has two data registers for Tx and Rx
When the DMA is getting the address it differs between Rx and Tx.
As the stm32cube/stm32h7xx/drivers/include/stm32h7xx_ll_spi.h
has no such LL functions, the register address is get direclty.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-07 15:06:28 -06:00
Francois Ramu
0ce796398a drivers: spi: stm32 ll driver disable the instance after completion
The spi_stm32_complete() is checking spi flags which are valid when the
intance is still enable: disable afterwards. No more need to disable
the DMA transfer then

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-07 15:06:28 -06:00
Francois Ramu
081e2d5a54 drivers: spi: stm32 driver with dma checking spi busy status flag
Defines a function to control the spi busy state during DMA transfer.
After the DMA Tx, the spi might still have some data to Transmit.
The driver must wait for the SPI Tx before sending the next packet.
This is not required for the Rx part as the DMA Rx is already done.
Some mcus like stm32H7 have a TX complete bit, other must wait for the
TXE and BSY line.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-07 15:06:28 -06:00
Gerard Marull-Paretas
0cb9a1b4cb drivers: pwm: gd32: initial version
Initial version of a PWM driver for GigaDevice GD32 SoCs. Only PWM
output is supported for now (no capture support).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-07 14:58:27 -06:00
Wealian Liao
7add8f7fa0 drivers: adc: npcx: Fix register offset
NPCX7/9 has a different ADC register structure. NPCX7 has 3 threshold
detectors from offset 0x14 & has 10 input channels. NPCX9 has 6
threshold detectors from offset 0x60 & has 12 input channels.

This commit fixes the NPCX ADC register structure.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-07 11:21:29 -05:00
Tomasz Bursztyka
1ae95546c8 drivers/interrupt_controller: Add a VT-D option to disable src id check
Theoretically, source id check is not mandatory in the context we use
VT-D here (i.e. non VM one, just multi-vector MSI support)

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
4090962386 drivers/interrupt_controller: Add source id to VT-D interrupt remap
Change the API and apply that change where relevant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
811fc76780 drivers/interrupt_controller: Fix IRTE delivery mode on VT-D
Only allow FIXED or LOW_PRIO modes.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
92884ba44a drivers/interrupt_controller: Add VT-D context cache invalidation
Not sure this is requered as we do not mangle with domains, but let's
make sure this cache is clear.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
f44062a8e6 drivers/interrupt_controller: Fix command write in VT-D
A surprising issue: while sys_set_bit() on VTD_GCMD_REG work on
apollo_lake, it seems to create border effect on elkhart_lake: it may
reset some previous bit to 0.

So switching to full write of the register at once, which works for
both.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
49a4bb32da drivers/interrupt_controller: Enable VT-D by default under condition
VT-D will only be enabled if MSI multi-vector will also be requested,
on x86_64, for all boards BUT QEMU ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
cf18ecd09f drivers/interrupt_controller: No VT-D if no PCIE MSI multi-vector
There is no point to enable VT-D if PCIE MSI multi-vector support is not
requested, as VT-D is uniquely being used to remap MSI multi-vector
based interrupts.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
666318e9b7 drivers/interrupt_controller: Use proper destination mode on VT-D
Let's always use logical Destination ID.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
5ae4402fe0 drivers/interrupt_controller: Fix MMIO mapping
Those MMIO registers might be mapped in RAM and thus it's
really important to keep storage space for such mapping.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
0c4cecae5e drivers/interrupt_controller: Add a timeout check on VT-D QI operation
QI operation are not supposed to last forever.
It's not an actual timeout based on clock, but a dummy counter instead.
That's because system clock might not have beed initialized yet, since
VT-D's init comes first (and that same init will use QI...)

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
82961458de drivers/interrupt_controller: Simplify IRTE structure for readability
Let's avoid l/h accessors, and directly have all bits into one
structure.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
149cef11ce drivers/interrupt_controller: VT-D may manipulate the cache
Depending on a VT-D capability, it might be necessary to flush objects
from the cache.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
25640f65c9 drivers/interrupt_controller: VT-D IRTE table should be 4kb aligned
As specified by the IRTA location.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
2c904b379b drivers/interrupt_controller: Adding QI support in VT-D
Looks like it's mandatory to invalidate the Interrupt Entry Cache in
VT-D and the only way to do so is to enable Queued Interface.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
97c299e0df drivers/interrupt_controller: Align VT-D helper function name
All are 32/64 differentiated, so does vtd_read_reg.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
610aeb9d42 drivers/interrupt_controller: Intel VT-D init should happen after ioapic
Or then it will badly crash trying to set up the fault event isr
handler.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
640e651cd8 drivers/interrupt_controller: Add fault event support on Intel VT-D
IR faults are non-recoverable, so it's good to know why. Thus let's
handle the fault event and print the fault.

Other faults are printed as well.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
a8c8abd27e drivers/interrupt_controller: Write IRTE as 64bits blocks in VT-D
Looks like a source of fault if pieces of IRTE are written instead of
the whole 64 bits block it belongs to.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
2efd874dcc drivers/interrupt_controller: Make IOAPIC VT-D aware when relevant
If VT-D's interrupt remapping is in place, all IOAPIC RTEs need to get
remapped as well (or then they will be simply blocked).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
edef8e6b0d drivers/interrupt_controller: Expanding VT-D public API
Adding a way to pre-install the irg/vector on an irte and a way to get
an irte based on irq/vector.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
1a1bc0d242 drivers/interrupt_controller: Make VT-D remap generic and handle flags
This will not only be used by MSI remapping but by all relevant
interrupts.

Fix also IRTE settings:
- handle x2apic for destination id
- destination mode is always logical (as for IOAPIC)

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
2b1cbcbddc drivers/interrupt_controller: Fix VT-D remap destination on XAPIC
CPU-ID is written in a different format in case of XAPIC.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
e2b4f7e50f drivers/interrupt_controller: Fix VT-D EIME value
It's the 11th bit and not 11.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
aa6112d0af drivers/interrupt_controller: Enable xapic pass-through in intel vt-d
In XAPIC mode, it's possible to tell VT-D to let interrupt in compatible
format passing through.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
4047b793c8 drivers/interrupt_controller: Generate proper MSI address on VT-D
SHV bit depends on the number of vectors allocated.
If it's facing a multi-vector MSI array, it will set the bit.
If not the bit must be 0.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
6ed593f861 drivers/pcie: Extending parameters to pcie_msi_map
n_vector will be necessary for VT-D actually.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
25b8df0bdb drivers/pcie: Even single MSI based interrupt needs to be remapped
Refactor to handle this case. This is valid only when MSI multi-vector
feature is enabled.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
f7a2ff4f8d drivers: Fixing the 2 drivers for PCIe IRQ connection
Now these 2 drivers should be working properly in case of IRQ remapping.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
b5fecc5ff8 drivers/pcie: Add a function for dynamic PCIe IRQ connection
The is meant to fix a chicken & egg issue with MSI interrupt remapping.
Currently, drivers first connect the irq (by-passing any possible MSI
remapping), so the IRQ ends-up being remapped at the IOAPIC level which
is not what we want.

So adding a dedicated function to properly handle this case. This is
valid only for runtime dynamic IRQ connection obviously.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Tomasz Bursztyka
fbb2f1511c drivers/pcie: Add a function to know MSI/MSI-x support of an endpoint
And since it does yet another round of pcie_get_cap() on PCIE_MSI_CAP_ID
and PCIE_MSIX_CAP_ID, let's factorize that into a utility function and
change the relevant places to use that function instead.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-01-07 10:47:27 -05:00
Herman Berget
6ede31428d Bluetooth: Host: Reassemble extended advertising reports
The host reassembles fragmented advertising reports from the controller.

Non-complete advertising reports from different advertisers may not be
interleaved. If non-complete advertising reports from an advertiser
is received while advertising reports from another advertiser is
reassembled, an error message is logged and the advertising report is
discarded. Future scan results may be incomplete.

Advertising reports from legacy PDUs or complete extended advertising
reports may be interleaved as these do not require reassembly.

If the controller sends more advertising data than fits in the
reassembly buffer, the data is truncated. Further advertising reports
from the advertiser are discarded until the final complete advertising
report is received and discarded.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-01-07 15:35:39 +02:00
Jordan Yates
c8d1e134ae gpio: emulated: default Kconfig value
Enable the emulated GPIO driver by default if instances exist in
devicetree. This removes the need to manually enable `CONFIG_GPIO_EMUL`
when `CONFIG_GPIO` is enabled.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-06 11:56:15 -05:00
Andy Ross
e4a455b25d drivers/cavs_timer: Cleanup & simplification pass
General refactoring to clean up and futureproof this driver.

Remove false dependency on CONFIG_CAVS_ICTL.  This requires the CAVS
interrupt mask API, but doesn't touch the interrupt controller driver.

Remove a racy check for simultaneous interrupts.  This seems to have
been well intentioned, but it's needless: the spinlock around the
last_count computation guarantees that colliding interrupts will
correctly compute elapsed ticks (i.e. the last will compute and
announce zero ticks, which is correct and expected).  And this opened
a tiny window where you could incorrectly ignore a just-set timeout.

Factor out the specific registers used (there are only five) into
pointer-valued macros instead of banging them directly.

Unify interrupt initialization for main and auxiliary cores.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-01-05 15:01:45 -05:00
Daniel Leung
40138c96b2 interrupt_controller: dw: use finalstatus instead of maskstatus
Instead of using maskstatus to see if an interrupt has fired,
use finalstatus instead. It has been observed that some
controllers do not update maskstatus correctly with incoming
interrupts, but finalstatus works fine.

FYI, the DW driver in Linux is also using finalstatus.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-05 15:01:45 -05:00
Erwan Gouriou
c4ae984a2d drivers/clock_control: stm32u5: Use LL API to set MSI as PLL srce
Recent changes in this function made the code now compatible
with the use of LL API to perform this configuration.
Use it to simplify the driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-01-05 14:59:34 -05:00
Dino Li
a89e60d7d8 gpio: it8xxx2: open source configuration isn't supported
This makes test of tests/drivers/gpio/gpio_api_1pin happy
on it8xxx2_evb.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-01-05 14:58:22 -05:00
Yong Cong Sin
e77d87da65 drivers: modem: gsm: Fix NULL being passed to rssi_handler
Fix hard fault due to NULL being passed as argument into
rssi_handler, which now derives the gsm_modem struct pointer from
the argument.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-05 14:57:16 -05:00
Gerard Marull-Paretas
6adda40775 drivers: pinctrl: gd32: do not disable clock
Disabling clock may conflict with concurrent usage of GPIOs and pins in
AF mode. This can be improved once a proper clock control API is in
place.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-04 20:49:00 -05:00
Gerard Marull-Paretas
b9127e48e6 drivers: gpio: gd32: initial version
Add GPIO driver for Gigadevice SoCs. The driver supports devices with
the AF and AFIO models.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-04 20:49:00 -05:00
Gerard Marull-Paretas
996a708abd drivers: interrupt_controller: initial support for GD32 EXTI
Add initial support for the GigaDevice External Interrupt Controller.
This driver is required to manage GPIO interrupts. Only EXTI lines 0 to
15 are supported for now (no LVD, RTC, etc.). Driver can be extended in
the future to add support for extra EXTI lines.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-01-04 20:49:00 -05:00
Lukasz Majewski
5599f1b3ab qspi: stm32: Add support for 4 IO read and program (4READ/4PP)
This change provides support for 4 IO read (via 4READ command) and
program (via 4PP). Flash memory pins SIO[0123], CLK and CS are used.

All of them are controlled by stm32 QSPI IP block.

The instruction code for fast reading as well as number of latency
cycles required are read from SFDP structure provided by flash memory.
The number of required read latency cycles when performing reading
is the sum of SPI-NOR memory mode bits and wait states (also named
as 'dummy cycles').

It also has been assumed that memory, which supports fast read (4READ),
also will support fast programming (4PP command) as this information is
not available in SFDP.

One also need to enable the QUAD IO support in board's device tree by
defining 'spi-bus-width = <4>' property. It is required as it may
happen that not all QSPI dedicated pins are used (for example only two
of them are available).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
c1b60e7fb6 qspi: stm32: Add code to switch flash memory to use 4 SIO pins
For proper operation of QUADSPI IP block, both sides of communication;
NOR flash memory and STM32 controller need to support 4 IO
transmission.

After this change the QSPI stm32 driver is able to program NOR flash
memory to switch itself to use all 4 IO lines (SIO[0123]) to transmit
and receive data.

The QE bit (in SPI-NOR's Status Register) is the non-volatile one, so
setting it is done only once (at first boot of the device).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
029f49fc99 spi: Provide definition for SPI-NOR flash memory control register
This commit provides define for reading the control register (CR) on
the flash memory.
In that register the information about 4B addressing is stored.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
08b5a082f9 qspi: stm32: Extend the driver to support 4 byte addressing
After this change the stm32 quadspi driver supports the 4 bytes
addressing if the memory supports it.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
07be9301b9 qspi: stm32: Add support for 'reset-gpios' property in 'stm32-qspi-nor'
Some flash memories connected to QUADSPI IP block on stm32[fh]7 devices
require proper reset pulse before configuration.

This patch adds two new properties - the 'reset-gpios' phandle,
which allows specifying GPIO pin for RESETn pulse and
'reset-gpios-duration', which provides the time (in ms) for reset
duration.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
44676a9d3e qspi: stm32: Add support for 'flash-id' property in 'stm32-qspi' banks
The 'flash-id' property defines the number of QSPI's dedicated GPIO
bank (and flash ID), which will be used to communicate with flash
memory.

For example, on stm32h7xx it is possible to use 'quadspi_bk1_*' and
'quadspi_bk2_*' set of pins, so one may need to select between them
when required.

By default - pins from 'quadspi_bk1_*' bank are used, so the
'flash-id = <2>;' property, when your use case (e.g. PCB design)
requires it, forces usage of 'quadspi_bk2_*' pins.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Lukasz Majewski
4a124b1ace kconfig: stm32: Select CONFIG_USE_STM32_HAL_MDMA when QSPI is used
The stm32 HAL code for qspi (SHA1: 5c8275071ec1cf160bfe8c18bbd93):
stm32cube/stm32h7xx/drivers/src/stm32h7xx_hal_qspi.c implicitly
depends on the stm32h7xx_hal_mdma.c driver as it uses unconditionally
'HAL_MDMA_Abort_IT()' function.

To avoid build breaks - no matter if QSPI IP block works with DMA
or interrupts - the CONFIG_USE_STM32_HAL_MDMA shall be defined.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2022-01-04 20:47:29 -05:00
Jun Lin
803a4ff620 driver: timer: npcx: fix the racing condition when getting current uptime
In npcx_itim_evt_isr, it updates the cyc_sys_announced variable and
then calls sys_clock_announce() to update the kernel curr_tick variable.
If an ISR handler with higher priority preempts the timer ISR after the
sys_clock_announce is updated and before the sys_clock_announce() is
called, it will read the wrong time when calling k_uptime_get() because
the cyc_sys_announced and the curr_tick are not synchronized.
The commit fixes the problem by raising the timer's interrupt priority
to the highest one (i.e. 1 in npcx's configuration).

This commit also moves the computation of the delta cycle inside the
spinlock in sys_clock_elapsed() to prevent another potential racing
condition.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-04 20:46:26 -05:00
Henrik Brix Andersen
99a310b29b drivers: can: loopback: convert the CAN loopback driver to dts
Convert the CAN loopback driver from being configured via Kconfig to
multi-instance configured via devicetree.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-04 15:13:40 -06:00
Yong Cong Sin
19910666e0 drivers: modem: gsm: Cancel the work when stopped
gsm_ppp_stop should cancel possible running work items.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2022-01-04 15:03:06 -06:00
Yong Cong Sin
d9ea07b7bd drivers: modem: gsm: convert work to delayable work
The 'work' argument of a delayable work's handler should be
converted to delayable work before passing into the CONTAINER_OF
macro.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-04 15:03:06 -06:00
Yong Cong Sin
b2b9343c95 drivers: modem: gsm: declare structs in gsm_modem
Move the declarations of a few structs into the struct
gsm_modem

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-04 15:03:06 -06:00
Jedrzej Ciupis
fcda8699cb drivers: timer: extend nrf_rtc_timer
This commit introduces the following changes:

* nrf_rtc_timer is extended with a capability to handle RTC overflow,
allowing it to operate on absolute RTC ticks, rather than relative
ticks.
* overflow handling is ZLI-proof and relies on the sys clock
handler being executed twice every RTC counter's overflow.
* callbacks are given an absolute RTC tick value as a parameter instead
of CC register's value. The absolute RTC tick value is the RTC counter
value set during CC channel configuration extended to 64 bits.
* in case the timer's target time is in the past or is the current tick,
the timer fires as soon as possible, however still from the RTC's ISR
context.
* in case an active timer is set again with the same target time, it is
not scheduled again - only its event data is updated. Otherwise, the
timer is scheduled as usual.
* a scheduled timer can be aborted.
* system clock functions are now using 64 bit values internally.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2022-01-04 17:44:32 +01:00
Emil Gydesen
0921979adc Bluetooth: Drivers: Fix bad return for bt_esp_evt_recv
Instead of returning NULL, the function had a `continue`.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-04 10:09:51 -05:00
Sylvio Alves
92fb477641 drivers: uart: esp32: fix poll in return value
ESP32 uart_poll_in should return 0 on success and not
the total amount of data read.

This also adds a check in fifo_fill call to
avoid negative values, otherwise it would send garbage
to uart

Closes #41352

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-04 10:07:15 -05:00
Jordan Yates
1bb7aa21b8 lora: sx126x: don't re-enable interrupt in sleep
Don't re-enable the DIO1 interrupt when the modem is in sleep mode. This
fixes the power regression introduced in Zephyr v2.7.0 #41026.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-04 10:02:24 -05:00
Alexander Wachter
66fef31236 drivers: can: mcan: Add cache handling
The msg_sram resides in the sram region, where the
m_can controller direcly access it. Whenever the driver
writes to the msg_sram and operations are triggered, the
cache needs to be invalidated.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2022-01-04 09:14:16 -05:00
Francois Ramu
e9b9e4c6ad drivers: adc: driver setting the oversampling for stm32wl
RM 0453: the sw is allowed to write the Oversampling
ratio or shift of the ADC Config.Reg.2 only when ADSTART = 0
(no conversion is on-going). So disabling it will be stopped.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-04 09:12:08 -05:00
Francois Ramu
c918c4f1d9 drivers: adc: driver setting the resolution for stm32wl
RM 0453: the sw is allowed to write the Data Resolution bits
of the ADC Config.Reg.1 only when ADEN = 0 (ADC disable).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-01-04 09:12:08 -05:00
Jordan Yates
6ec3967eaa drivers: gpio: test driver
Add a dummy driver for the `vnd,gpio` compatible to allow compilation of
drivers utilising GPIO when running "build_all" tests.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-01-04 09:10:40 -05:00
Yong Cong Sin
900757c3e2 drivers: watchdog: STM32G0X: clock DBGMCU before configuring
Enable the clock for the DBGMCU peripherals so that it can be
configured.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-04 09:08:00 -05:00
Tim Lin
f554fcbe4c ITE: drivers/flash: add the API of page_layout
This commit adds the API of page_layout that will make test of
test/drivers/flash pass on it8xxx2_evb board.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-01-04 09:05:45 -05:00
TOKITA Hiroshi
3787e5aab3 drivers: dac: Adds DAC support for gd32vf103
Enable DAC driver with gd32vf103 SoC.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-01-04 11:49:14 +01:00
Henrik Brix Andersen
b1b77c1774 drivers: can: change can_tx_callback_t function signature
Change the can_tx_callback_t function signature to use an "int" (not an
uint32_t) for representing transmission errors.

The "error" callback function parameter is functionally equivalent to
the return value from can_send() and thus needs to use the same data
type and needs to be able to hold negative errno values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-01 07:40:29 -05:00
Yong Cong Sin
522eff91e5 drivers: modem: gsm: Use dedicated workq
The driver performs AT commands configurations using the
system workqueue, this can delay the workqueue by up to 6
seconds to wait for the modem replies, which isn't ideal.

This PR creates a dedicated workqueue for the gsm, and
provides a helper function to reschedule work items to the
gsm workqueue.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-01 07:40:13 -05:00
Sylvio Alves
94327512a3 drivers: i2c: esp32: split stop command into a new transmission
STOP command was issued in the same transmission message
and as from esp-idf, this should be moved into a new
transmission.

Although it works in most scenarios, SHT3X sensor is one
case that presents reading error.

Closes #41385

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-01-01 07:39:41 -05:00
Gerard Marull-Paretas
5dc6ed3ce3 pinctrl: require ; after PINCTRL_DT_(INST_)DEFINE macros
The PINCTRL_DT_(INST_)DEFINE macros already defined the trailing ;,
making its usage inconsistent with other macros such as
DEVICE_DT_DEFINE.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-01 07:39:08 -05:00
Christoffer Zakrisson
8367df2956 drivers: i2c: sam0 Fix i2c NACK on receive
PR #38482 made the sam0 i2c send NACK when receiving a single message

Fixes #38878
Fixes #41016

Signed-off-by: Christoffer Zakrisson <rustypig91@gmail.com>
2022-01-01 07:21:22 -05:00
Gerard Marull-Paretas
8b95b259cd drivers: gpio: stm32: replace SYS_DEVICE_DEFINE with SYS_INIT
SYS_INIT can be used for the same purpose, what is being run is simply
an initialization hook.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-24 20:59:10 -05:00
Tim Lin
f9bf14f79a ITE: drivers/serial: add console input expired
If there are no console messages input at an interval of 15
seconds, the system will be able to enter suspend mode.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-12-24 20:54:16 -05:00
Emil Gydesen
b988c803f6 Bluetooth: drivers: Add length checks before net_buf_add_mem
Add length checks before calls to net_buf_add_mem
for dynamically sized data.

This should give a better error response than hitting
the __ASSERT in net_buf_simple_add.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-12-24 20:50:03 -05:00
Hake Huang
2cbdd12e9c driver: i2s: fixing build error
some build error due to adding rt11xx support without testing

update mclk enable to avoid add pinmux driver

note:
  some other PRs still in progress to full enable i2s on rt platform

this fixing: #41153

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-12-23 13:25:43 +01:00
Carlo Caione
67ef1df950 mbox: Enforce callback registration before enabling the channel
Specify in the API that the callback must be registered before the
channel is enabled, fix the NRFX IPC driver to be compliant and change
the MBOX sample.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-12-23 12:38:21 +01:00
Mateusz Kwiatkowski
e8c12f2af0 drivers: wifi: eswifi: fix socket poll timeout
Fix a problem introduced in 6ea54db334 that caused the poll operation to
take 10x more time than intended.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
2021-12-23 11:19:00 +01:00
Aditya Bhutada
e4481f82cb drivers: adc: adc_mchp_xec: update configuration register clk times
MCHP ADC configuration register need to be updated with appropriate
clock time values for high & low time clock.

Signed-off-by: Aditya Bhutada <aditya.bhutada@intel.com>
2021-12-22 13:47:18 -05:00
Henrik Brix Andersen
f92542ecf3 drivers: can: deprecate the can_attach_workq() API call
Deprecate the can_attach_workq() API call.

This API is limited in its functionality (it does not work with
userspace, it uses one common buffer size for all work queue instances).

Similar functionality can easily be implemented using the
can_attach_msgq() API along with the generic triggered work API
(e.g. using k_work_poll_submit()).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-22 18:04:02 +01:00
Henrik Brix Andersen
a1cff6f4a9 drivers: can: shell: convert from can_attach_workq() to triggered work
Convert the CAN shell from using can_attach_workq() to using
can_attach_msgq() and triggered work via k_work_poll_submit().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-22 18:04:02 +01:00
Krzysztof Chruscinski
11bbdb030d uart: nrfx_uarte: Return error when re-enabling RX
Driver was not behaving according to API description and
was not returning -EBUSY when uart_rx_enable() was called
on already enabled receiver.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-22 15:50:57 +01:00
Andrzej Głąbek
ea81b4b812 drivers: display_nrf_led_matrix: Correct calculation of pixel period
This is a follow-up to commit 4dfab40cac.

The calculation of the pixel period is done incorrectly and results
in higher than configured refresh frequency if pixels are refreshed
in groups. Fix that and lower the base frequency for the timer and
PWM so that wider range of refresh frequency can be used also with
the pixel grouping.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-12-22 15:50:44 +01:00
Marcin Niestroj
54a785b886 drivers: wifi: esp_at: don't send AT+CWLAP during initial setup
Sending AT+CWLAP was introduced with commit f2859f9501 ("drivers:
wifi: esp_at: changes to scanning") as a way to easily test introduced
changes, rather than on purpose. Remove that now, as there is no
particular reason to send it and additionally it breaks setup phase:

  <err> modem_cmd_handler: command AT+CWLAP ret:-5
  <err> wifi_esp_at: Init failed -5

with ESP-AT firmware v2.1.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-12-22 12:17:04 +01:00
Tomasz Bursztyka
c1bc5db795 drivers/pcie: Use the generic arch-interface for allocating IRQs
PCIE now uses the new interface. And pcie_alloc_irq() is only made
available when CONFIG_PCIE_CONTROLLER is unset. So only for x86 atm.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-12-22 12:16:52 +01:00
Ryan McClelland
dacae94761 drivers: avoid i2c_burst_write where possible
i2c_burst_write can have portability issues with certain i2c
peripherals that can fail when this api is called. This fixes the case
where this can be easily replaced with i2c_write in mcp230xx,
pca95xx, stmpe1600, max17055, and tmp112.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-12-22 12:14:42 +01:00
Krzysztof Chruscinski
22c4c888a5 drivers: gpio: nrfx: Use mask to determine if sense is used
So far driver was using SENSE mechanism for all or none edge
interrupts. This was not convenient since in some modules may
require IN event to be used and other did not. Converting it to
use a mask specified in the device tree. Pins indicated in the
mask will use sensing.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-22 12:03:00 +01:00
Andrzej Głąbek
4dfab40cac drivers: display_nrf_led_matrix: Add option to light LEDs in groups
Add a new DT property named "pixel-group-size" that allows users to
configure the driver to refresh the matrix by illuminating multiple
LEDs in particular rows simultaneously. This way the maximum possible
brightness of the LEDs can be increased (as they can be lit longer)
and the timer interrupt handler is executed less frequently, what
results in decreased CPU load, but more GPIOTE/PPI channels needs to
be allocated if the PWM peripheral cannot be used. Thus, it is left
to users to select the configuration that suits them best.

Update definitions of both the bbc_microbit boards with this new
property, using the maximum available group size (to achieve maximum
possible brightness). For v2, no new resources are used (only all
channels in the already used PWM peripheral are now utilized).
For v1, two more GPIOTE and PPI channels are allocated.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-12-21 17:53:38 +01:00
Marcin Niestroj
2f4fbc7621 drivers: serial: nrfx_uart: fix pin disconnect in suspend when !PINCTRL
Fix pin disconnection when COFNIG_PINCTRL=n, so that less power is used
in suspended state. This seems to be a copy-paste kind of bug, since
when both resuming and suspending the same configuration was applied.

Fixes: 5567d7ae07 ("drivers: serial: nrfx_uart: add support for
  pinctrl")

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-12-21 17:13:06 +01:00
Alexandre Bourdiol
dc3b2321f3 drivers: entropy: stm32: add health configuration support
Some STM32 series need to configure health test register
for proper RNG behavior.
In addition, some also require to write a Magic number
before writing the configuration.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-12-21 17:09:02 +01:00
Johann Fischer
44585b7fc5 drivers: mb_display: rework bbc:microbit display support
Rework bbc:microbit display support to use nRF LED matrix
display controller driver and allow to use it with
bbc:microbit v2 board.

This patch turns the driver into a higher level driver
using the display controller API. Code that directly
accesses hardware (GPIO) is removed.
This driver is reworked to be more generic. It still
has a lot of potential for improvement, but it requires
changes in all applications that use this tool.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-21 17:06:03 +01:00
Johann Fischer
de072e47b0 drivers: nrf_led_matrix: enable driver if compatible is enabled
Enable nRF LED matrix display controller driver if compatible
devicetree node is enabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-21 17:06:03 +01:00
Carles Cufi
38ce8d615d Revert "drivers: timer: extend nrf_rtc_timer"
This reverts commit 26e297572a.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-20 21:04:26 +01:00
Yong Cong Sin
26f7b9c1ea drivers: sensor: Add MH-Z19B CO2 sensor driver
Add MH-Z19B CO2 sensor driver.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
Co-Authored-By: Azamlukman <azamlukmanabdullah@gmail.com>
2021-12-20 18:47:47 +01:00
Michael Schmidt
557870c05f drivers: virt_ivshmem: Allow multiple instances of ivShMem devices.
- Supporting multiple instances of ivShMem virtual devices.
- Introduces DT based configuration for ivShMem devices.
- Add DTS overlay file to test new multiple ivshmem instance capability.
- Enable BDF unspecified device initialization.
  (limited to one instance. An improved version of pcie_bdf_lookup()
  will come soon that fixes this limitation)
- Make PCIE DTS file macros available for a proper ivshmem device
  properties parsing.

Sample for dts file:
pcie0 {
	label = "PCIE_0";
	#address-cells = <1>;
	#size-cells = <1>;
	compatible = "intel,pcie";
	ranges;
    ivshmem0: ivshmem@800 {
	    compatible = "qemu,ivshmem";
	    reg = <PCIE_BDF_NONE PCIE_ID(0x1af4,0x1110)>;
	    label = "IVSHMEM";
	    status = "okay";
    };
};

Signed-off-by: Michael Schmidt <michael1.schmidt@intel.com>
2021-12-20 19:42:27 +02:00
Dominik Ermel
8e001191ce drivers/flash/nrf_qspi_nor: Default write_from_nvmc buffer size to 4
The commit changes the default size of write_from_nvmc,
defined by CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE, to 4,
making the write_from_nvmc operation enabled by default.
The Kconfig description for the option has been changes more clearly
describe how does the option impact compilation.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-12-20 17:52:00 +01:00
TOKITA Hiroshi
7e80c74f95 drivers: serial: Add USART support for GD32V
Modifying configuration to enable with gd32vf103

- Add usart definition to devicetree.
- Define USART_STAT as alias of USART_STAT0 if not defined it.
- Enable USART if SOC_SERIES_RISCV_GIGADEVICE_GD32VF103.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
TOKITA Hiroshi
5c7a0ef888 drivers: interrupt-controller: add Nuclei ECLIC driver
Add support for the ECLIC interrupt controller
which is used with the Nuclei processor core.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
TOKITA Hiroshi
949d4b91d9 drivers: pinctrl: Support pinctrl with GD32VF103
Change the settings to support pinctrl on the GD32VF103.

- Split soc/arm/gigadevice/common/pinctrl_soc.h
  and put it into include/dt-bindings.
- Leave some definitions that can't handle with device tree compiler
  in pinctrl_soc.h.
- Remove dependency to SOC_FAMILY_GD32 because always enabled it
  if GD32_HAS_AF(IO)_PINMAX was selected.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
TOKITA Hiroshi
d79d4f0bea riscv_machine_timer: Enable to use divided clock for the machine timer
GD32V SoC uses divided clock from core-clock for machine timer clock.
Add config of clock divide factor to support GD32V.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2021-12-20 17:51:30 +01:00
Lukas Gehreke
53dea67733 drivers: modem: Added simcom sim7080 modem driver.
Implemented driver for the simcom sim7080 modem.
This driver features Socket offloading, TCP, UDP, DNS,
SMS, GPS and FTP.

Signed-off-by: Lukas Gehreke <lk.gehreke@gmail.com>
2021-12-20 17:48:47 +01:00
Alexander Wachter
11d340f9c5 drivers: can: m_can: fix alignmed issues
Make sure that all access to the msg_sram
is 32 bit aligned.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-12-20 17:46:24 +01:00
Jun Lin
c097b8f80e drivers: uart: npcx: fix the coding style
Fix the coding style by clang-format.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-12-20 17:43:58 +01:00
Jun Lin
db74010cc7 drivers: uart: npcx: use PM constraint for the receiving
In this commit, the driver sets the PM constraint to prevent the system
from entering the suspend state for a CONFIG_UART_CONSOLE_INPUT_EXPIRED
period when data come in. The constraint releases after the
CONFIG_UART_CONSOLE_INPUT_EXPIRED time expires, .

With this change, the PM policy doesn't have to check the timestamp
by calling npcx_power_console_is_in_use() explictly. So the related
npcx_power_console_is_in_use*() functions can be removed.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-12-20 17:43:58 +01:00
Pete Dietl
2b62282d46 drivers: sensors: tmp112 fix config register updating
The function that sets the driver's state of the sensor's
config register has a bug. This commit fixes that.

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2021-12-20 17:42:33 +01:00
Francois Ramu
188c8c47a8 drivers: spi: stm32 spi driver using ll_func as defined in the header
Instead of checking the SPI register flags, the spi_ll_stm32.h
has dedicated functions for that purpose.
They are abstracting the STM32 registers of SPI instance.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-12-20 17:42:17 +01:00
Jedrzej Ciupis
26e297572a drivers: timer: extend nrf_rtc_timer
This commit introduces the following changes:

* nrf_rtc_timer is extended with a capability to handle RTC overflow,
allowing it to operate on absolute RTC ticks, rather than relative
ticks.
* overflow handling is ZLI-proof and relies on the sys clock
handler being executed twice every RTC counter's overflow.
* callbacks are given an absolute RTC tick value as a parameter instead
of CC register's value. The absolute RTC tick value is the RTC counter
value set during CC channel configuration extended to 64 bits.
* in case the timer's target time is in the past or is the current tick,
the timer fires as soon as possible, however still from the RTC's ISR
context.
* in case an active timer is set again with the same target time, it is
not scheduled again - only its event data is updated. Otherwise, the
timer is scheduled as usual.
* a scheduled timer can be aborted.
* system clock functions are now using 64 bit values internally.

Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Paweł Kwiek <pawel.kwiek@nordicsemi.no>
2021-12-20 16:25:49 +01:00
Carles Cufi
02cee09308 drivers: bluetooth: spi: Check lengths in incoming headers
So far the lengths provided in event and ACL packets were not being
checked at all, which could have caused an overflow if the contents were
not to fit inside the net_buf.
Check the length and discard the packet when it doesn't fit.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-20 15:24:02 +01:00
Armando Visconti
34fed86b2b drivers/sensor: lsm6dso: Add power mode properties to DTS
Add power mode properties for bot accelerometer and gyrometer
to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-12-18 07:58:50 -05:00
Armando Visconti
18e8cadaf9 drivers/sensor: lsm6dso: Move odr/range Kconfig property into dts
Move odr and range properties for both accelerometer and gyro
from Kconfigs to Device Tree.
Fixes #41117

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-12-18 07:58:50 -05:00
Jimmy Johnson
5fda6a3b2f sample: sensor: tmp108: Add ti tmp108 sample
This sample writes the tmp108 temperature to the console
once every 3 seconds. There are macro definitions included
for turning off and on alerts if that is set up, and
also using low power one shot mode.

Signed-off-by: Jimmy Johnson <catch22@fastmail.net>
2021-12-17 21:15:25 +01:00
Jimmy Johnson
5c28b218fa drivers: sensor: add ti tmp108 driver support
Adding support for the TI TMP108 temperature sensor. This includes
over/under temp interrupt support as well as one shot, continuous
conversion and power down modes.

Signed-off-by: Jimmy Johnson <catch22@fastmail.net>
2021-12-17 21:15:25 +01:00
Felipe Neves
d170079815 wifi: esp32: disable wifi driver
when SMP support is selected.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-12-17 13:59:31 -05:00
Abel Radenac
e8fa6b3f08 drivers: dma_stm32: init DMA struct in dma_stm32_configure
The init struct for DMA peripheral is allocated in stack
and must be initialized (e.g. with LL_DMA_StructInit here)
to avoid loading undefined values in the DMA peripheral
registers.

Signed-off-by: Abel Radenac <a.radenac@lacroix-sofrel.com>
2021-12-17 11:52:22 -06:00
Gerard Marull-Paretas
9f5de86e8a drivers: display: st7735r: replace non-existing DT_INST_HAS_PROP
DT_INST_HAS_PROP macro is not available, DT_INST_NODE_HAS_PROP needs to
be used instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
56e325ca83 drivers: wifi: esp_at: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
4b511eb520 drivers: syscon: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
e3d4c2c278 drivers: serial: nrfx_uart: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
5350121e64 drivers: serial: gd32: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
ad0855187a drivers: sensor: tmp112: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
677050d46d drivers: sensor: max17262: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
bda8878b03 drivers: pwm: stm32: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
45a3985170 drivers: pwm: nrf5_sw: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
59fe6b8235 drivers: kscan: it8xxx2: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
fa63671ff7 drivers: i2s: mcux_sai: use instance based macros
Replace usages of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
b9d573f622 drivers: gpio: nct38xx_alert: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
56c2c1f7c1 drivers: gpio: mcp23sxx: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
38e827dab1 drivers: gpio: mcp230xx: use instance based macros
Replace usage of DT_DRV_INST(n) with instance based macros where
possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
4e7b4e65af drivers: gpio: mchp_xec_v2: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
eb9eae4efc drivers: flash: spi_nor: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
0fb27f3adb drivers: flash: nrf_qspi_nor: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
3ef533341b drivers: flash: at45: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
7a4d3f72f9 drivers: ethernet: phy_mii: use instance based DT macros
Replace usages of DT_DRV_INST(n) with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
b7ee4e2951 drivers: eeprom: emulator: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
d4a5a633a6 drivers: dma: mcux_edma: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
0feb972a30 drivers: counter: sam_tc: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
6512eddc5c drivers: counter: rtc_mcp7940n: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
fa67177a7f drivers: counter: mcux_pit: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas
159c2ed574 drivers: counter: ll_stm32_timer: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Andrzej Głąbek
e7f7e955b3 drivers: display: Add support for LED matrix driven by nRF SoC GPIOs
Add a display driver and the corresponding devicetree binding for a LED
matrix with rows and columns driven by nRF SoCs GPIOs. Such matrix can
be found, for example, in the BBC micro:bit boards.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-12-17 15:48:08 +01:00
Julien D'ascenzio
4f9c79c867 drivers/uart: stm32: don't call k_yield on poll_out
Some tests like:
    tests/kernel/sched/metairq/kernel.scheduler.metairq
    tests/kernel/profiling/profiling_api/kernel.common.profiling
    tests/kernel/sched/schedule_api/kernel.scheduler
    tests/kernel/sched/schedule_api/kernel.scheduler.multiq
    tests/kernel/profiling/profiling_api/kernel.common.profiling
    tests/kernel/workq/work_queue/kernel.workqueue

don't support that the current thread change when writing a message with
printk (which uses poll_out). So, we remove the call to k_yield which is
useful only for optimizing cpu usage by forcing a thread change if the
usart send stack is full.

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2021-12-16 20:42:00 -05:00
Gerard Marull-Paretas
3e9d8da9ec drivers: use DT_INST_PARENT
Replace usages of DT_PARENT(DT_DRV_INST(idx)) with more idiomatic
DT_INST_PARENT(idx).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 11:10:01 -06:00
Gerard Marull-Paretas
a6398f0932 drivers: gpio: stm32: improve initialization
Call `gpio_stm32_clock_request` unconditionally with "true" if no
runtime PM is enabled, "false" otherwise. In case the GPIO was enabled
(e.g. by a bootloader), the device will be left in proper state when
runtime PM is enabled.

Also added pm_device_runtime_init_suspended to indicate that device is
in a suspended state (will prevent pm_device_runtime_enable to suspend
the device again).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
776ecf4b73 drivers: gpio: stm32: do not expose gpio_stm32_clock_request
The function is only used by the driver itself. This likely comes from
pre-runtime PM API usage.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
a9ae700695 drivers: gpio: stm32: introduce gpio_stm32_configure_raw
Make gpio32_stm32_configure use runtime PM API (so that it can be used
externally without further effort). The raw version of the function (no
PM put/get) has been introduced for internal use.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
a7a6a86505 drivers: gpio: stm32: use synchronous put
The suspend operation for this device is a clock gating operation (i.e.
fast), so use synchronous put to skip unnecessary overhead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
392b20f2a5 drivers: pinmux: stm32: remove runtime PM get/put guards
The PM runtime API (get/put) provides an inline implementation when not
built-in. Such implementation always returns 1, so it is safe to not
guard PM runtime calls and check for < 0.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
Gerard Marull-Paretas
53f17da351 drivers: gpio: stm32: remove runtime PM get/put guards
The PM runtime API (get/put) provides an inline implementation when not
built-in. Such implementation always returns 1, so it is safe to not
guard PM runtime calls and check for < 0.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 10:41:04 +01:00
HaiLong Yang
ba9c3a4d88 drivers: dac: introduce gd32 dac driver
Add DAC driver for gd32 series SoCs.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2021-12-16 10:13:56 +01:00
Jun Lin
f7c2f4fd94 driver: i2c: npcx: adjust parameters for better I2C timing at 100 KHz
The original parameter (k1) setting may let the I2C frequency be a
little bit higher than 100k Hz, which causes the timing Tsu:sta (set-up
time for a repeated START) to violate the spec. This change fixes the k1
parameter and also changes the HLDT to the suggested value in the
datasheet.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-12-15 14:56:36 -06:00
Pete Dietl
bc1b262885 drivers: adc: stm32: Disable ADC before calibration
The STM32 docs state that the ADC may not be calibrated unless
the ADC is disabled (ADEN=0). This commit implements this constraint

Fixes #40936

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2021-12-15 14:39:31 -06:00
Andy Ross
9ac2c214eb soc/intel_adsp: Remove adsp/io.h
More dead code.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-12-14 18:43:05 -06:00
Flavio Ceolin
18b932f10d pm: device_runtime: Return possible error on enable
Change the function pm_device_runtime_enable() to return 0 on
success or an error code in case of error.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-14 19:23:05 -05:00
Bartosz Bilas
0bd304f9d9 drivers: sensor: ina23x: add support for INA237
Add the new driver for INA237 variant which is
quite similar to the already supported INA230.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-12-14 13:48:54 -06:00
Bartosz Bilas
2df7140947 drivers: sensor: ina230: driver refactoring
Create an explicit ina230 driver which is supposed to
work with 230 and 231 variants. While at it switch
to i2c_dt_spec helpers and change device-tree node
names to use - instead of _ in order to follow
convention.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-12-14 13:48:54 -06:00
Bartosz Bilas
f50c7ab542 drivers: sensor: ina23x: add ina23x common module
That's needed to not duplicate code between INA230/231
and the upcoming INA237 variant.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-12-14 13:48:54 -06:00
Yuriy Vynnychek
8ef807f624 drivers: ieee802154: b91: Fix Set Channel API and ACK detection
- B91 SoC requires to set RX mode again if channel is changed
- Fixed wrong ACK packet detection, mask should be used

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-12-14 13:47:25 -06:00
Yuriy Vynnychek
a696a55e3b drivers: serial: b91: fifo_fill API update to check fifo size
Updated fifo_fill API to check TX/RX data registers size

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-12-14 13:47:25 -06:00
Guillaume Lager
ba7e70e0bc drivers: console: gsm_mux: fix length indicator
The MSB and LSB were inverted for length > 127
Fixes #41077

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-12-14 13:44:48 -06:00
Johann Fischer
72cbc04a73 drivers: ramdisk: add checks for the upper boundary
Add checks for the upper boundary in access_read/access_write
instead of the homeopathic ASSERTS.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-14 13:40:47 -06:00
Armando Visconti
56b435f2bf drivers/sensor: lps22hh: Move odr Kconfig property into dts
Move odr options from Kconfigs to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-12-14 09:11:15 -06:00
Armando Visconti
177b53a944 drivers/sensor: lps22hh: Add multi-instance support
This commit aligns lps22hh sensor driver to latest multi
instance sensor driver model.

In particular it makes use of the stmemsc common routines
and move ctx handler inside struct config, so that the
bus_init routines can be totally avoided.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-12-14 09:11:15 -06:00
Johann Fischer
64751220bd drivers: usb: allow to disable option USB_DEVICE_REMOTE_WAKEUP
This flag may cause host to more ambitious power saving behavior,
not all Zephyr USB classes or applications may be ready for this
now. Allow to disable option USB_DEVICE_REMOTE_WAKEUP.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-14 09:08:58 -05:00
Alex Sergeev
40b81e6b76 drivers: ethernet: stm32: PTP L2 timestamping support
Add support for IEEE 1588-2008 (PTP L2) for STM32F7 and STM32H7
families.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2021-12-13 22:19:25 -05:00
Dino Li
03fea69272 driver: espi: it8xxx2: enable CONFIG_ESPI_FLASH_CHANNEL
This enable eSPI flash channel.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-12-13 20:33:47 -05:00
Ryan McClelland
ecf99abc17 drivers: gpio: set all on-chip gpios to PRE_KERNEL_1/2 init
PRE_KERNEL_1 is to be used for devices that have no dependencies
and do not use kernel features, such as those that rely solely on
hardware present in the processor/SOC. This commit updates these
gpios to initialize during the PRE_KERNEL_1 rather than the
POST_KERNEL. Some SoC drivers are moved to PRE_KERNEL_2 due
to dependencies.

A lot of 'other' drivers can depend on GPIOs though phandles
(such as reset lines, data or command gpios, etc...). Most of these
drivers that would need this would come up on the POST_KERNEL,
and it's likely the driver may not be up yet as it should be defined.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-12-13 20:31:28 -05:00
Daniel DeGrasse
1328abe052 drivers: disk: USDHC: Update USDHC driver to pass disk test
USDHC driver did not pass disk test (failed during multiple writes). Add
logic to wait for the SD card to be idle before reading new data, so
that the test will pass. Also, add logic to reject OOB reads and writes
to the disk.

Fixes #39942

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:30:06 -05:00
HaiLong Yang
b009cc2e18 drivers: pinctrl: add gd32f350 gpio opspeed check
Add compile time check for gd32f350 gpio opspeed.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2021-12-13 20:27:30 -05:00
HaiLong Yang
3b72a9b2bd drivers: serial: gd32 usart support GD32F350
GD32 HAL use two USART status register name, USART_STAT and USART_STAT0.
This add a redefine to make USART_STAT as defaut name.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2021-12-13 20:27:30 -05:00
Daniel DeGrasse
fa56e9ee2b drivers: mcux_gpt_timer: Added GPT timer for HW clock
Added a driver to enable the GPT timer on RT1xxx parts to be used
instead of systick as a clock source. The timer is set to run in reset
mode, and uses the low frequency 32kHz oscillator for power savings

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:13:21 -05:00
Aymeric Aillet
903c78c207 driver: i2c: TCA954X: Add support for TCA9548A
Add support for the 8 channels TCA9548A I2C mux.
Added a new binding ti,tca9548a binding inheriting
properties from ti,tca954x-base and defining its own compatibles fields.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-13 18:07:08 +01:00
Aymeric Aillet
ee1d849c4e driver: i2c: TCA954X: Add support for "reset-gpios"
Add an optional "reset-gpios" phandle-array
field to the driver common yaml.
The reset GPIO channel and pin can be defined
in device tree as a node property.
The driver then deassert the reset signal at mux
initialization if a "reset-gpios" has been specified.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-13 18:07:08 +01:00
Aymeric Aillet
50540ed594 driver: i2c: TCA9546A: Rename to TCA954x
Prepare the driver to upcoming support of more mux references.
Rename all TCA9546A related files to TCA954x.
Keep ti,tca9546a and ti,tca9546a-channel compatible
for backward compatibility reasons.
New tca954x-base binding embedding common properties,
tca9546a binding inherits from it and define its own compatibles fields.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-13 18:07:08 +01:00
Armando Visconti
13bf2e5e48 drivers/sensor: stmemsc: make use of i2c/spi dt APIs
Make use of the i2c and spi DT APIs introduced in
2946a535 and c894ad12 that get i2c_dt_spec and spi_dt_spec
as input arguments.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-12-13 10:21:43 -06:00
Kent Hall
ba37d5935e drivers: counter: Counter API implementation for STM32F4 Series (TIMER).
- Shim for counter API using LL_TIM driver.
- Supports all general-purpose (TIMx) timers.

Signed-off-by: Kent Hall <kjh2166@columbia.edu>
2021-12-11 14:20:17 -05:00
Carles Cufi
2bc9cb4691 sensor: bmi160: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c: In function
bmi160_gyr_channel_get:
/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c:795:23: error: taking
address of packed member of struct <anonymous> may result in an
unaligned pointer value [-Werror=address-of-packed-member]
  795 |           data->sample.gyr, val);
      |           ~~~~~~~~~~~~^~~~
/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c: In function
bmi160_acc_channel_get:
/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c:807:23: error: taking
address of packed member of struct <anonymous> may result in an
unaligned pointer value [-Werror=address-of-packed-member]
  807 |           data->sample.acc, val);
      |           ~~~~~~~~~~~~^~~~

To avoid the warning, make the struct non-packed, since it is not
necessary in this case given that a union already guarantees that the
pointer to the union points to each member of the union equally..

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi
710e03b990 gpio: sx1509b: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/drivers/gpio/gpio_sx1509b.c: In function
'port_write':
/__w/zephyr/zephyr/drivers/gpio/gpio_sx1509b.c:456:19: error: taking
address of packed member of 'struct sx1509b_pin_state' may result in an
unaligned pointer value [-Werror=address-of-packed-member]
  456 |  uint16_t *outp = &drv_data->pin_state.data;

To avoid the warning, use an intermediate void * variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Johann Fischer
307c13b218 drivers: display: remove unused Kconfig options
remove unused options SDL_DISPLAY_* and DUMMY_DISPLAY_*.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Johann Fischer
2d175d14f3 drivers: display_dummy: rework to obtain configuration from devicetree
Add bindings for dummy display controller.
Rework dummy display controller driver to obtain
configuration from devicetree. Remove unnecessary casts,
add multi-instance support.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Johann Fischer
dee50e9aae drivers: display_sdl: rework to obtain configuration from devicetree
Add bindings for SDL based display controller.
Rework SDL based display controller driver to obtain
configuration from devicetree. Remove unnecessary casts,
add multi-instance support.

Add display controller node and chosen property
to native_posix devicetree.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Johann Fischer
5e722c4368 drivers: ssd16xx: fix driver initialization
ssd16xx driver is not well designed and does not pass configuration
via device->config but via struct ssd16xx_data, this was not taken
into account in the commit 4d6d50e2bc
("display: ssd16xx: convert to spi_dt_spec").

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Glauber Maroto Ferreira
d8bafe47e6 esp32: drivers: gpio: remove pin offset
this allows using a pin numbering scheme as per Espressif's
documentation and HAL usage, where pin counting does not wrap
up when reaching a given number.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-12-09 19:57:10 -05:00
Erwan Gouriou
6787566e3d drivers/clock_control: u5: Add utility to set voltage scaling
Voltage scaling computation should be done in multiple cases.
Add a function that takes into account all cases.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-12-09 19:45:41 -05:00
Brad Rushbrook
6d0e83f89e eth: Add promiscious mode support to stm32 ethernet abstraction
Simply adds the definitions in the stm32 hal to define ethernet
promiscious mode.

Signed-off-by: Brad Rushbrook <rushybrook@gmail.com>

Fixes error and resetting promisc mode, adds support for STM23H7x

Signed-off-by: Brad Rushbrook <rushybrook@gmail.com>

Co-authored-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>

Readability improvement; coding-style compliance

Signed-off-by: Brad Rushbrook <rushybrook@gmail.com>

Co-authored-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-12-09 19:32:25 -05:00
Henrik Brix Andersen
f499559434 drivers: can: deprecate the use of CAN-specific error return values
Deprecate the use of CAN-specific error return values and replace them
with standard errno values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-09 12:37:40 -05:00
Wealian Liao
3cdf684cd9 driver: timer: npcx_itim: Add timer initialization
The init responsibility moves to the drivers themselves. The npcx itim
initialize doesn't work now. This adds timer initialization for npcx
itim to fix it.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-12-09 11:13:06 -06:00
Pete Dietl
a1bf02e519 drivers: sensors: tmp112: Remove extra I2C reads
The original code erroneously used:
uint16_t *val;
sizeof val
instead of:
sizeof *val;
This commit fixes this problem and removes an unnecessary
buffer from the stack

Signed-off-by: Pete Dietl <petedietl@gmail.com>
2021-12-09 10:27:47 -06:00
Bartosz Bilas
cf8e974bec drivers: sensor: max6675: convert to spi_dt_spec
Convert max6675 driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-12-09 10:21:13 -06:00
Bartosz Bilas
68080c1269 drivers: sensor: icm42605: convert to spi_dt_spec
Convert icm42605 driver to use spi_dt_spec helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-12-09 10:20:41 -06:00
Krzysztof Chruscinski
c27ac38cf8 drivers: gpio: nrfx: Implementation based on new nrfx_gpiote driver
Converting driver to shim which is using nrfx_gpiote driver
underneath.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-12-09 16:51:28 +01:00
Mahesh Mahadevan
0a2464b89f drivers: ethernet: Add support for new PHY API
SDK 2.10 changed the PHY API. These updates are
needed as part of moving to SDK 2.10

1. add phy / mdio ops init
2. update PHY_Read/Write HAL call

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-12-09 09:18:10 -06:00
Sylvio Alves
81f5ced9fe drivers: gpio: esp32: use rtcio to config pins
Set gpio driver to use RTCIO interface to configure
output strength of necessary output pins.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-12-08 17:19:21 -05:00
Sylvio Alves
f00a0a9e06 drivers: pinmux: esp32: use rtcio to control pull up/down
Set pinmux driver to use RTCIO interface for to handle
dedicated IOs pull-up/down configuration.
Without this, some GPIOS won't have pull-up enabled
properly.

Also, current implementation automatically disables
output pin when input pin is set. It also performs the
oppositte. This PR changes it only to enable what is
requested, either input or output.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-12-08 17:19:21 -05:00
Sylvio Alves
23d581d44c drivers: i2c: esp32: remove unused irq_line and add end packet
irq_line and irq_enabled call is not necessary as the interrupt
allocater enables it during its initialization.

it also adds end packet to all write transmission instead
of only at the end (burst data scenario)

Add check in gpio configuration check to avoid wrong gpio pins

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-12-08 17:19:21 -05:00
Johann Fischer
eeb4434d2e drivers: ieee802154_dw1000: use dedicated workqueue
Driver has dedicated workqueue for IRQ processing.
Submit work to dedicated workqueue intead of system workqueue.
It also fixes driver functionality when NET_TC_TX_COUNT is set to 0.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-08 10:06:20 -05:00
Gennady Kovalev
b49766f001 drivers: clock_control: More power supply modes for STM32H7
STM32H7 has different power supply modes but now Zephyr supports just LDO
and direct SMPS. This commit introduses POWER_SUPPLY_CHOICE configuration
parameter and add support for missed power supply modes.

Signed-off-by: Gennady Kovalev <gik@bigur.com>

Fixes #40730.
2021-12-08 09:12:12 -05:00
Julien D'ascenzio
e4234aeb89 drivers/uart: stm32: fix dead lock on poll_out
A dead lock could happen if 2 threads with differents priorities use
poll_out. In fact, the lock data->tx_lock could be lock by a thread with
lower priority and then a thread with higher priority can't take the
lock. There was a race condition here:

/* Wait for TXE flag to be raised */
while (1) {
	if (atomic_cas(&data->tx_lock, 0, 1)) {
		/* !!!!!!!! RACE CONDITION !!!!!!!!!!!!!!
		if (LL_USART_IsActiveFlag_TXE(UartInstance)) {
			break;
		}
		atomic_set(&data->tx_lock, 0);
	}
}

To fix race condition, the interrupts are locked in poll_out.

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2021-12-08 08:56:18 -05:00
Peter Johanson
a5ad94f20f driver: gpio: mcp23xxx: Refactor to generic.
Refactor the mcp230xx driver to generically also support
SPI IO expanders, renaming it to mcp23xxx in the process.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2021-12-08 08:55:28 -05:00
Guillaume Lager
972e5d0274 sensor: eeprom: Add TMP116 EEPROM access
eeprom access is supported by using
either custom or eeprom API

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-12-08 07:51:46 -06:00
Jay Vasanth
fd43c725d2 drivers: spi: Add MEC172x QMSPI-LDMA driver
Add driver for MEC172x QMSPI with local DMA(LDMA). The driver
support SPI asynchronous operation.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2021-12-08 08:43:05 -05:00
Daniel DeGrasse
20eed64030 drivers: edma: update MCUX dma driver for multi-instance
Updates mcux edma driver to handle multiple DMA instances correctly.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:40:06 -05:00
Daniel DeGrasse
11e4690bdd drivers: clock_control: Add LPSR clock for EDMA
Adds ccm clock config for EDMA1 clock

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:40:06 -05:00
Daniel DeGrasse
4d4939c4e1 boards: mimxrt1060_evk_cm7: Enable DMA controller on RT1160 EVK
DMA controller is enabled and tested for cortex M7 core. The M7 core was
tested on the loop and channel link transfer tests.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:40:06 -05:00
Daniel DeGrasse
cae297d917 drivers: pca9420: added support for current limit setting on PCA9420
Added ability to set VIN current limit when using the pca9420 PMIC

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Daniel DeGrasse
423dff8a51 drivers: pca9420: Added voltage level support for PCA9420
This commit adds support for editing the voltage levels on the buck
regulators on the PCA9420 PMIC

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Daniel DeGrasse
130f6eb816 drivers: regulator: add i2c regulator driver
This commit adds a generic i2c regulator driver, and enables the NXP
PCA9420 PMIC IC using this driver. The regulator driver also exposes an
additional API in include/drivers/regulator/consumer.h, which allows
drivers to implement support for adjusting voltage levels and current
limits, if their device supports it.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
Daniel DeGrasse
b18aefdfd3 dts: rt685: enabled flexcomm15
the RT685 contains an additional flexcomm peripheral, that supports
only I2C. This commit adds this peripheral to the device tree,
and enables pins and clocks for flexcomm15.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-08 08:27:44 -05:00
c6a74a5e5f drivers/flash: sam0: only use a semaphore if multitasking is enabled
This lets the driver be used in single threaded applications such as a
bootloader.

Signed-off-by: Michael Hope <mlhx@google.com>
2021-12-07 19:29:07 -05:00
Henrik Brix Andersen
b21a91e468 drivers: can: catch up on API naming changes
Catch up on the CAN driver API argument naming changes:
- Unify naming of callback function pointers as "callback".
- Unify naming of user-specified callback function arguments as
  "user_data".
- Instances and pointers to struct zcan_frame are named "frame",
  not "msg", to avoid confusion with the CAN message queue support.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-07 15:39:06 -05:00
Dmytro Firsov
31b4e4124d xenvm: drivers: serial: Add consoleio Xen serial driver for Domain 0
This commit adds Xen consoleio serial driver. It is needed to receive
kernel messages from Zephyr in case it runs as Xen privileged domain
(Dom0). There is no console ring buffer for such domain, so regular
uart_hvc_xen driver can not be used (privileged domain input/output
are possible only through consoleio interface).

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2021-12-07 12:15:38 -05:00
Dmytro Firsov
d63a10da54 xenvm: drivers: serial: add interrupt-driven API for Xen PV console
This commit adds support of interrupt-driven API for UART-like Xen PV
console driver. It is implemented via Xen event channels. It allows to
send and receive data by chunks (not single symbols) and without
polling.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2021-12-07 12:15:38 -05:00
Dmytro Firsov
01a9b117fe xenvm: arm64: add Xen Enlighten and event channel support
This commit adds support of Xen Enlighten page and initial support for
Xen event channels. It is needed for future Xen PV drivers
implementation.

Now enlighten page is mapped to the prepared memory area on
PRE_KERNEL_1 stage. In case of success event channel logic gets
inited and can be used ASAP after Zephyr start. Current implementation
allows to use only pre-defined event channels (PV console/XenBus) and
works only in single CPU mode (without VCPUOP_register_vcpu_info).
Event channel allocation will be implemented in future versions.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2021-12-07 12:15:38 -05:00
Ryan McClelland
4e5bd204fd drivers: gpio: revert kconfig init priority for off-chip gpios
In #40140, all on-chip gpios where made to use `CONFIG_GPIO_INIT_PRIORITY`.
The lmp90xxx and sx1509b are off-chip gpios. This commit reverts those
changes for these two devices.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-12-07 09:53:45 -06:00
Pieter De Gendt
4d161a3b23 drivers: counter: NXP SNVS rtc: Add support for NXP imx SNVS RTC
Adds a driver using the SNVS high power and optionally low power
RTC instances. A device specific function `mcux_snvs_rtc_set` is
provided to update the current counter value.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-12-07 09:45:43 -06:00
Keith Short
f7005599ff spi: npcx_fiu: Update the SPI context
Update the SPI context during all transceive functions. This fixes a
deadlock where SPI transactions failed to give back the semaphore.

Verified on NPCX9 based Chromebook.

Signed-off-by: Keith Short <keithshort@google.com>
2021-12-07 09:44:34 -06:00
Casper Meijn
2b618bdb5c drivers: display: st7789v: Use device * for internal functions
The internal functions of this driver needed either `device *`
or `st7789v_data *` as argument. Standardize to
using `device *`.

Signed-off-by: Casper Meijn <casper@meijn.net>
2021-12-07 09:38:43 -06:00
Daniel DeGrasse
57f35bbf5a drivers: USDHC: Enable detection using DAT3 pulldown
Enable USDHC host to detect inserted SD card via DAT3 line pulldown.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-06 15:27:25 -05:00
Daniel DeGrasse
4712913872 drivers: USDHC: Update USDHC driver for RT11xx SOCs
RT11xx USDHC lacks some watermarking features that RT10xx SOCs include.
Place #ifdef guards around these features.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-06 15:27:25 -05:00
Alexander Wachter
3f500df975 drivers: can: can_net: Fix build issue after #38501
Fixing build issue introduced by PR #38501

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-12-06 08:15:14 -05:00
Casper Meijn
7dfdaf4ab7 drivers: display: st7789v: Remove explicit cast
Remove explicit cast of `data`.

Signed-off-by: Casper Meijn <casper@meijn.net>
2021-12-06 08:04:26 -05:00
Marc Reilly
54b6d26242 drivers: spi: add spi-bitbang driver
This adds an spi master mode driver via bitbanged gpio. Only syncronous
transfers are implemented. Clock signal timing is accomplished via busy
waits, the gpios are manipulated via the standard gpio interface; these
two factors limit the frequency at which it can operate - but here
a simple and generic implementation was chosen over performance.

The driver supports the various clock polarity and phase
configurations, and can also work with word sizes which are non
multiples of 8bits, currently up to 16 bits.

A sample program is also added demonstrating basic use of the driver
with 9bit data words.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2021-12-06 07:29:45 -05:00
Gerard Marull-Paretas
5ab7d35e7c pm: state: PM_STATE_DT_ITEMS_LIST->PM_STATE_LIST_FROM_DT_CPU
Rename the PM_STATE_DT_ITEMS_LIST macro to PM_STATE_LIST_FROM_DT_CPU to
make its purpose more clear. Similar naming scheme is found e.g. in the
GPIO API.

Associated internal macros and docstrings have been adjusted, too.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 12:33:57 -05:00
Gerard Marull-Paretas
493b6786ab drivers: timer: fix MISRA 5.7 violation
A couple of drivers violated MISRA 5.7 rule (Tag name should be unique),
triggering CI compliance errors.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Gerard Marull-Paretas
7d1bfb51ae drivers: timer: cortex_m_systick: improve ISR installation
A Cortex-M specific function (sys_clock_isr()) was defined as a weak
function, so in practice it was always available when system clock was
enabled, even if no Cortex-M systick was available. This patch
introduces an auxiliary Kconfig option that, when selected, the ISR
function gets installed. External SysTick drivers can also make use of
this function, thus achieving the same functionality offered today but
in a cleaner way.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Gerard Marull-Paretas
78dc8ce338 drivers: timer: improve sys_timer_disable usage
- Remove the weak symbol definition
- Notify about the capability of disabling via a selected Kconfig option
  (CONFIG_SYSTEM_TIMER_HAS_DISABLE_SUPPORT)
- Provide a dummy inline function when the functionality is not
  available

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Gerard Marull-Paretas
24a169e329 drivers: timer: split Kconfig
Split Kconfig into individual files for each driver. This improves
overall readability of the Kconfig options.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Gerard Marull-Paretas
b1ced75386 drivers: timer: move initialization setup to drivers
The weak symbol sys_clock_driver_init has been removed, therefore moving
the init responsability to the drivers themselves. As a result, the init
function has now been made static on all drivers and moved to the
bottom, following the convention used in other areas.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-04 07:34:53 -05:00
Tom Burdick
7b1349cfe6 stats: i2c: I2C stats
Adds the ability for I2C drivers to report synchronous transfer stats
using a I2C specific macro to define the device instance.

The macro creates a container for device_state which allows for per
instance device class common data structure to be used in the device
class api (ex: i2c.h). This is used to maintain per driver instance
stats for all i2c drivers. This is a reusable idea across other device
classes as desired.

Using Kconfig device class stats may be turned on/off individually
this way as well, in this case I2C_STATS.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2021-12-04 07:22:56 -05:00
Daniel DeGrasse
b0dfda1584 drivers: pwm_mcux: Update MCUX pwm driver to use clock bindings
MCUX PWM driver used hardcoded clock source. update driver to use clock
bindings to determine PWM peripheral clock frequency.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-03 16:44:12 -06:00
Bryce Wilkins
219bf88fe8 drivers: spi: Add optional delays to mcux flexcomm spi driver
Adds optional device tree properties to insert delays between spi chip
select assert/deassert and the clock edges, and also between spi
frames and transfers to the mcux flexcomm spi driver. If the properties
are not set, no additional delay is inserted.

Verified expected behavior on mimxrt685_evk and check with a scope
that the pre- and post-delay could be changed from the device tree
properties.

Signed-off-by: Bryce Wilkins <bryce.wilkins@gmail.com>
2021-12-03 16:42:10 -06:00
Sören Tempel
fd089b361d uart: sifive: align txcnt of UART1 with UART0
The UART1 is not actually accessible on the HiFive1 since the
QFN48 package for the FE310, used by this board, does not expose the
required pads. However, it is still possible to use the UART1 on HiFive1
emulators (e.g. using UART0 for debugging and UART1 for SLIP).

Unfortunately, the UART0 and UART1 currently have different default
configurations when it comes to the configured transmission watermark
(txcnt). With a txcnt of zero (the default for UART1) the UART is not
actually usable (see #18118). Contrary to UART0 (see #23699), the UART1
does therefore not work by default on Zephyr which took me some time to
figure out.

This commit aligns the default UART1 configuration with the UART0,
thereby making it work by default.

Signed-off-by: Sören Tempel <tempel@uni-bremen.de>
2021-12-02 11:42:46 -06:00
Tim Lin
f52ff1a79e drivers/serial: uart_ns16550: add power management constraint API
Instead of busy wait until completed transaction, the constraint set
is used before enabling tx interrupt to not allow system to enter
suspend when tx is transmitting.

Application defined policy should use the pm_constraint_get function
to check if given state is enabled and could be used.

TEST=Test on hayato board(soc:it8xxx2), the logs print normally before
system enters suspend.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-12-02 10:53:19 +01:00
Hake Huang
9672180327 driver: i2s: add i2s driver for mcux
add i2s driver for mcux

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-12-02 10:50:21 +01:00
Hake Huang
0e9d491f47 driver: clock: nxp-mcux add clock support for i2s
add mcux ccm clock setting for i2s

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-12-02 10:50:21 +01:00
Ryan McClelland
b15b16d59a drivers: i2c: fix i2c_gpio log typo
Fix typo with error logging the gpio pin name for sda

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-12-01 14:51:59 -06:00
Lukasz Majewski
90f36ac16d net: dsa: ksz8794: Fix the port numbering for DSA tag setting
After the commit "dts: ksz8974: change port number to start at zero."
(SHA1: aa6217697e)

the lan ports are numbered starting from zero (not as previously from
one), so code assigning tags shall take this into account.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Lukasz Majewski
cb4f7bc15c net: dsa: ksz8794: Fix the port numbering for this ETH switch IC
After the "dts: ksz8974: add support for ksz8863"
(SHA1: b0e4886dfa) commit the port numbering
for KSZ8794 was wrong.

This IC has 3 ETH ports (with linear offset), with port 4 being the
"master" with non linear offset (i.e. 0x50 instead of linear 0x40).

Such situation can be explained with similarity of this IC to ksz8795,
which has 4 LAN ports, and then the 0x40 offset is used.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Lukasz Majewski
ab1f0b55d5 net: dsa: ksz8794: Use CONFIG_DSA_KSZ_TAIL_TAGGING in preprocessor macros
The name of macro to enable tail tagging support in DSA KSZ driver is
CONFIG_DSA_KSZ_TAIL_TAGGING, not DSA_KSZ_TAIL_TAGGING.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Lukasz Majewski
5b957e4e46 net: dsa: ksz8794: Remove check for CPU port in the switch setup
The check for CPU port on the KSZ8794 when the switch is initialized,
is not required as the last port number is always smaller than the CPU
port.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-12-01 13:58:08 -06:00
Wealian Liao
230378aebe driver: uart_npcx: Fix uart to use PM constrain
The device PM callback needs to be used only to suspend/resume devices.
If the system cannot be suspended because UART is in a particular
state, the pm_constraint_set/release API should be used. For NPCX UART,
the chip can't enter low power idle state until UART completes the data
transmission.
This commit changes NPCX UART to use pm_constraint_set/release & fixes
UART lost data from low power idle.

Fix #40621

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-12-01 13:49:17 -06:00
Konrad Sikorski
cb410abec0 drivers: i2c: fix esp32 i2c driver unwilled STOP and repeated START
- added messages check and fix before transfer
- fixed START and STOP signal generation conditions
- fixed semaphore release for empty messages

Signed-off-by: Konrad Sikorski <znfgnu@gmail.com>
2021-12-01 12:27:45 -05:00
Dino Li
584e38c9b4 cleanup: espi: it8xxx2: eliminate DRV_CONFIG() and DRV_DATA() macros
The two macros aren't required in the file.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-12-01 12:23:28 -05:00
Torsten Rasmussen
0c66240908 drivers: nrf5: kconfig: add missing dependency for TEMP_NRF5
Fixes: #40538

The TEMP_NRF5 setting requires MULTITHREADING, therefore add this
dependency to Kconfig.

The TEMP_NRF5 supports an alternative driver implementation using the
TEMP_NRF5_FORCE_ALT setting.
Because it cannot be known whether an alternative implementation has
the same dependency, then the MULTITHREADING is OR'ed with
TEMP_NRF5_FORCE_ALT, as to allow enabling of TEMP_NRF5 if an alternative
driver is provided.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-12-01 16:10:59 +01:00
Antonio Tessarolo
cc1cd4d65b arm: Nxp imx6sx added PWM support
This commit adds support for IMX6SX PWM.
The PWM module is the same module present on the IMX7D and so dts
bindings has been renamed following the one present on linux.

Signed-off-by: Antonio Tessarolo <anthonytexdev@gmail.com>
2021-11-30 11:54:11 -06:00
Daniel DeGrasse
7b74dbb405 drivers: spi_mcux_lpspi: Added DMA support to NXP LPSPI driver
Adds DMA support to NXP's LPSPI driver. This can be enabled by selecting
the KConfig symbol CONFIG_SPI_MCUX_LPSPI_DMA, and requires the LPSPI
instances enabled in the devicetree to have valid DMA instances
assigned.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-11-30 10:57:17 -06:00
Lukasz Majewski
aa464a9d67 spi: Fix the Pcs setup for NXP's K6xF processors
Without this change, when DTS SPI device node has node ID = <0>, the
value of 0 is assigned during SPI configuration and written to
whichPcs member in master_config structure.
This value wrongly overrides the default value read from NXP's DSPI
HAL (kDSPI_Pcs0 = 1U << 0).

Such situation occurs on ip_k66f board, where the DSA device -
controlled via SPI has the node ID equal to 0 (i.e. reg = <0>).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-11-30 09:55:46 -06:00
Dominik Ermel
c4a6137834 drivers/flash/nrf_qspi_nor: Fix qspi_sfdp_read error path
The commit fixes processing of a return value from the ANOMALY_122_INIT
call.

Fixes #39923

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-30 11:46:22 +01:00
Francois Ramu
701d6bd087 drivers: watchdog: stm32G0 window watchdog during debug
This commit is enabling the Debug support clock
like the stm32L0 or F0, the APB peripheral clock enable register 1
has a bit to clock DBGMCU before use.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-29 18:26:47 -05:00
Francois Ramu
4145c83c82 drivers: watchdog: stm32MP1 window watchdog during debug
This commit is controlling the WWDG during the Stop mode in debug.
WWDG1 is frozen while the core is in Debug mode, setting the bit
of the DBGMCU APB1 peripheral freeze register (DBGMCU_APB1FZ2)
for the stm32MP1 soc devices.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-29 18:26:47 -05:00
Francois Ramu
0d84e7b2bc drivers: watchdog: stm32H7 window watchdog during debug
This commit is controlling the WWDG during the Stop mode in debug.
WWDG1 is frozen while the core is in Debug mode, setting the bit
of the DBGMCU APB3 peripheral freeze register (DBGMCU_APB3FZ1)
for the stm32H7 soc devices.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-29 18:26:47 -05:00
Markus Brüx
c56851a5cb drivers: sensor: lis2dh: Allow power-down mode
Remove check if frequency is equal to zero. A value of `ODR = 0` is
explicitly allowed by manufacturer / datasheet.
This has prevented applications from using the lis2dh power-down-mode,
which is set via `ODR = 0`.

For reference see "Table 28. Data rate configuration" in datasheet p.33.

Fixes #35486.

Signed-off-by: Markus Brüx <markus.bruex@grandcentrix.net>
2021-11-29 18:19:18 -05:00
Thomas Stranger
aef64fcb17 drivers: sensor: shtcx: fix
This commit fixes humidity value and model dependent timing parameters.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-29 18:18:42 -05:00
Casper Meijn
889ab9107e drivers: display: st7789v: Make naming consistent
The names of `struct st7789v_data` varied a bit in the driver code.
Make the name consistently `data`.

Signed-off-by: Casper Meijn <casper@meijn.net>
2021-11-29 16:29:55 +01:00
Ruibin Chang
fad78a2c07 ITE drivers/sensor: add tachometer driver for it8xxx2_evb
Add tachometer driver for it8xxx2_evb.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2021-11-29 08:25:19 -05:00
Alexandre Bourdiol
102ac1ae36 drivers: clock_control: stm32u5: set voltage scaling VOS for MSIS
In case of MSIS selected as system clock source it is necessary
to set Voltage scaling (VOS) when freqency is greater than 24MHz

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-29 05:27:19 -05:00
Alexandre Bourdiol
ffb6a31819 drivers: clock_control: stm32u5: keep reset values of MSI trimming
When MSI trimming values where set to 0,
and MSIS is used as system core clock and MSI > 4 MHz,
it causes uart to fail.
There is no need to set thoses trimming values.
So keep the default reset value. (keep ST Factory calibration)

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-29 05:27:19 -05:00
Alexandre Bourdiol
2d223bdc8f drivers: clock_control: stm32u5: rework MSIS as system clock source
Because on stm32u5 MSIS is the default clock after reset,
changing MSIS range means immediate frequency change.
Thus it is important to do it after flash latency change
in case of higher new frequency.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-29 05:27:19 -05:00
Gerard Marull-Paretas
89a4f36fc8 device: remove inclusion of pm/device.h
The device PM subsystem _depends_ on device, not vice-versa. Devices
only hold a reference to struct pm_device now, and initialize this
reference with the value provided in Z_DEVICE_DEFINE. This requirement
can be solved with a forward struct declaration, meaning there is no
need to include device PM headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-29 11:08:38 +01:00
Dino Li
f1f0dadad3 driver: espi: it8xxx2: enable ESPI_OOB_CHANNEL
This enable eSPI out-of-band channel.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-11-26 10:26:52 -05:00
Erwan Gouriou
6026d3c5bf drivers/pinmux|pinctrl: stm32f1: Fix broken cast in remap
remap information is coded in 10 bits, uint16_t should be used
to cast it.

Fixes #40688

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 10:25:41 -05:00
Gerard Marull-Paretas
ed67eb28b8 drivers: gpio: nrfx: adjust initialization level and priority
Make nrfx GPIO driver part of the PRE_KERNEL_1 initialization stage. As
a result, the GPIO driver can now be initialized before UART if
required, a device that is also initialized during PRE_KERNEL_1.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 14:20:51 +01:00
Gerard Marull-Paretas
5567d7ae07 drivers: serial: nrfx_uart: add support for pinctrl
This patch adds support for the new pinctrl API to the UART driver. The
old pin property based solution is still kept so that users have time to
transition to the new model.

Notes:

- A new property to disable RX has been introduced: disable-rx. It is no
  longer possible to do it automatically depending on pin information,
  since it's not available when using pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 14:20:51 +01:00
Gerard Marull-Paretas
3b7215e160 drivers: serial: nrfx_uarte: add support for pinctrl
This patch adds support for the new pinctrl API to the UARTE driver. The
old pin property based solution is still kept so that users have time to
transition to the new model.

Notes:

- Some build assertions cannot be performed since the driver does not
  have direct access to pin settings anymore. As a result user will not
  be notified if HWFC is enabled but RTS/CTS pins are not configured.
- Hardware flow control can be enabled regardless of pin configuration,
  it is now up to the user to configure RTS/CTS pins in DT.
- Some RX enable checks that were performed using pin information has
  been replaced with a DT property that informs if RX is enabled or not.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 14:20:51 +01:00
Gerard Marull-Paretas
6399ad50f4 drivers: pinctrl: nrf: add support for uart/uarte peripheral
Add support for configuring UART/UARTE peripheral pins.

Co-authored-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 14:20:51 +01:00
Gerard Marull-Paretas
22c8c02145 drivers: pinctrl: nrf: initial support
Add initial support for nRF pin controller driver. The implementation in
this patch does not yet support any peripheral. Only states
representation and basic driver functionality is introduced.

Note:
The nrf_pin_configure function has been marked as __unused since it may
not be used in certain scenarios until all peripherals are supported by
the pinctrl driver. For example, if only UART/E is supported but the
board does not enable UART, the function will never get called. However,
that board will likely have other peripherals that will gain support in
the future.

Thanks to Marti Bolivar for bindings documentation.

Co-authored-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 14:20:51 +01:00
Johann Fischer
5aedcabf51 drivers: spi_context: fix null pointer dereferencing
commit 54907c7014
("drivers: spi: spi_context: improve support of multiple cs gpios")
added function to initialize all CS GPIOs defined in devicetree.
This function, spi_context_cs_configure_all, is intended to be
called during SPI driver initialization (POST_KERNEL init level).
It is also obvious that a SPI driver was not used at that time,
and no bus configuration (struct spi_config) is assigned to
SPI bus (spi_context.config).

The spi_context_cs_configure_all function has a homeopathic
ASSERT to validate CS levels, which causes a null pointer
dereferencing by ctx->config->operation if asserts are
enabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-26 11:47:27 +01:00
Erwan Gouriou
eff3ad6df7 drivers/pwm: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.
Since STM32F1 series require pinctrl option and required register
address is parent timer address in place of own node register address,
use PINCTRL_DT_INST_CUSTOM_REG_DEFINE in place of usual
PINCTRL_DT_INST_DEFINE for this specific series.

Additionally, remove the automatic selection of PINMUX API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
90b0e92540 drivers/usb/device: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Additionally, rename usb_pinctrl to usb_pcfg to better fit
new pinctrl API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
8bd410a589 drivers/spi: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
ab893d5fef drivers/memc: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
79943f647f drivers/i2s: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
f21de9dfe6 drivers/i2c: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
cec2cb69dd drivers/flash: qspi stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
18ae799b73 drivers/ethernet: dwmac_stm32h7x: use new pinctrl API
Use the new pinctrl API to configure pins.

Additionally, rename eth0_pins to eth0_pcfg to better fit
new pinctrl API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
87438e4587 drivers/ethernet: stm32_hal: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
d55905b2f7 drivers/disk: sdmmc: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
956afc3a08 drivers/dac: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
65d222b0ab drivers/fdcan: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
337c9b96e9 drivers/can: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Erwan Gouriou
93956b2073 drivers/adc: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-26 11:36:42 +01:00
Gerard Marull-Paretas
21a271962c drivers: serial: stm32: use new pinctrl API
Use the new pinctrl API to configure pins.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 11:36:42 +01:00
Gerard Marull-Paretas
9c10e1e988 drivers: pinctrl: stm32: initial version
Add initial version for STM32 pinctrl driver. Driver has been written
re-using many of the already existing parts in
drivers/pinmux/pinmux_stm32.c.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-26 11:36:42 +01:00
Krzysztof Chruscinski
9886bdc0c8 drivers: pwm: pwm_nrf5_sw: Use runtime resources allocation
Use nrfx_gpiote and nrfx_ppi allocators to allocate channels
at runtime instead of fixed, device-tree based allocation which
is harder to maintain.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-26 09:31:54 +01:00
Neil Armstrong
f8f2936dba pcie: add initial controller support
This adds :
- Generic PCIe Controller layer implementing the current PCIe API
- Generic PCIe Controller in ECAM mode driver

The Generic PCIe Controller layer provides:
- Configuration space read/write
- single bus endpoint enumerations
- Endpoint I/O, MEM & MEM64 BARs allocation
- Endpoint I/O, MEM & MEM64 BARs get & translation for drivers

The Generic PCIe Controller in ECAM mode driver provides:
- Raw DT RANGES properties into usable PCIe regions
- Configuration space read/write into ECAM config space
- PCIe regions allocation & translation

The limitations are:
- No support for PCIe prefetchable regions
- No support for PCIe bus configuration (only bus0 is supported)
- No support for multiple controllers (no domain-id in BDF)

Support has been designed to initially support Root Complexes with
Root Complex Integrated Endpoint, which was designed for Embedded
Systems with internal-only PCIe Endpoints on bus 0.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-11-25 18:37:15 +01:00
Robert Lubos
666e9f80d6 net: ipv6: Remove in6_addr from packed net_ipv6_hdr struct
Replace unpacked in6_addr structures with raw buffers in net_ipv6_hdr
struct, to prevent compiler warnings about unaligned access.

Remove __packed parameter from `struct net_6lo_context` since the
structure isn't really serialized.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-25 10:46:35 -05:00
Robert Lubos
064200b420 net: ipv4: Remove in_addr from packed net_ipv4_hdr struct
Replace unpacked in_addr structures with raw buffers in net_ipv4_hdr
struct, to prevent compiler warnings about unaligned access.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-25 10:46:35 -05:00
Jeremy Bettis
5ec3cd68ff gpio_emul: Fix bug with input & output pins
Change gpio_emul_input_set_masked_pend to log when it returns an error.
Changed all calls to gpio_emul_input_set_masked* to check the return
value.

Changed the function gpio_emul_input_set_masked_pend to apply the mask
to the provided values and not return an error if there are excess
values. In almost every call to that function, the value wasn't being
limited to bits set in the mask, so they were failing if there was more
than one gpio configured for INPUT|OUTPUT with a value of 1.

Fixes #40646

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2021-11-25 10:36:25 -05:00
Ryan McClelland
b7bedb5c1e drivers: fix double promotion warnings
With -Wdouble-promotion added to the warning base, fix warnings given
by the compiler.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-11-24 17:14:25 -05:00
Flavio Ceolin
6451626ce7 pm: Use pm_device_action_run instead of state_set
Since drivers implement a callback based on action and not the state,
we should be using the API based on the action instead of the one based
on the state.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-24 14:21:50 -05:00
Flavio Ceolin
80d26d996e drivers: led_pwm: Fix log message
The log message was using the uninitialized variable state.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-11-24 14:21:50 -05:00
Raúl Sánchez Siles
f35cdfc1e4 drivers: usb_dc_native_posix fill in data amount
Fill in received bytes in USBIP_RET_SUBMIT packet

Currently this field is unconditionally set to 0 and therefore not
filled in conveniently. This may mislead the USB host which is correctly
acknowledged that the transaction was sucessful but it cannot check the
actual received bytes.

Test application:

```python
import usb

data = (0xFF, 0xFF)
print("Opening loopback device")
device = usb.core.find(idVendor=0x2FE3, idProduct=0x0009)
print("Writing test data", data)
written = device.write(0x1, data)
print("Written", written, "bytes")
```

Before:
```
$ ./test_loopback.py
Opening loopback device
Writing test data (255, 255)
Written 0 bytes
```

After:
```
$ ./test_loopback.py
Opening loopback device
Writing test data (255, 255)
Written 2 bytes
```

Signed-off-by: Raúl Sánchez Siles <rsanchezs@k-lagan.com>
2021-11-24 17:55:04 +01:00
Johann Fischer
48362df588 drivers: usb_dc_sam_usbhs: default to full-speed
Use DT_INST_ENUM_IDX_OR and always default to full-speed
if CONFIG_USB_DC_HAS_HS_SUPPORT is not set or maximum-speed
property is not defined.
Remove low-speed setting since device stack does not support it.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-24 12:28:02 +01:00
Johann Fischer
cf8d7764da usb: fix bulk endpoint configuration for high-speed capable device
In the current USB device support, the sizes of bulk endpoint
are mostly configure through Kconfig and do not care if a device
is high-speed capable. The information if a USB device controller
supports high-speed comes from devicetree. Add a Kconfig option to
map this information and configure bulk endpoint sizes
accordingly.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-24 12:28:02 +01:00
HaiLong Yang
5e035b0f4e drivers: serial: gd32 usart add interrupt support
Add interrupt support for gd32 usart driver.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2021-11-23 13:25:43 -05:00
HaiLong Yang
9418a4f763 drivers: serial: gd32 usart parity bit config
Initialize parity bit(Default NONE) from DTS.

Signed-off-by: HaiLong Yang <cameledyang@pm.me>
2021-11-23 13:25:43 -05:00
Robert Lubos
f3a9b8c83d net: l2: Add symbols for custom IEEE802154 L2
Define a custom IEEE802154 based L2. The user can then use those symbols
to implement their own 802.15.4 based L2, based on those symbols, w/o a
need to modify the Zephyr tree.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-23 13:25:01 -05:00
Robert Lubos
5cf235e601 drivers: ieee802154_nrf5: Add Kconfig to configure FCS inclusion policy
Some 802.15.4 L2 implementations expect that FCS length is included in
the overall packet length while others not. Allow to configure this
behavior, based on the selected upper layer.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-23 13:25:01 -05:00
Robert Lubos
9a319226f8 net: ieee802154: Add common config for all 802154 L2s
Introduce a common config for all 802.15.4 based L2 implementations.
This way, any custom 15.4 L2 implementation will be able to
automatically enable use 15.4 driver, w/o a need to modify the actual
Kconfig.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-23 13:25:01 -05:00
Andy Ross
a7af0acfc2 soc/intel_adsp: Clean up IPM compiler guards
The CAVS_IDC_IPM driver happens to be used only on non-2.5 hardware,
but it's best to be clear in the conditional compilation when we're
talking about hardware-dependencies and when we mean software
configuration.  This was mixed up in a few spots.

Also fix a warning that creeps in on non-default drivers choices about
an undeclared ipm function.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-23 13:23:54 -05:00
Andy Ross
430cbf430a soc/intel_adsp: Eliminate platform configuration headers
All the in-use contents of these files have now been moved to the
intel_adsp core, and they are configured via devicetree and kconfig.
Remove the legacy headers.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-23 13:23:54 -05:00
Andy Ross
ed9434c812 soc: intel_adsp: Clean up shim driver
Each platform was defining its own shim.h header, with slightly
variant field definitions, for a register block that is almost
completely compatible between versions.  This is made worse by the
fact that these represent an API imported fairly early from SOF, the
upstream version of which has since diverged.

Move the existing shim struct into a header ("cavs-shim.h") of its
own, remove a bunch of unused symbols, fill in definitions for some
registers that were left out, correct naming to match the hardware
docs in a few places, make sure all hardware dependencies are source
from devicetree only, and modify existing usage to use the new API
exclusively.

Interestingly this leaves the older shim.h header in place, as it
turns out to contain definitions for a bunch of things that were never
part of the shim register block.  Those will be unified in separate
patches.

Finally: note that the existing IPM_CAVS_IDC driver (soon to be
removed from all the intel_adsp soc's) is still using the old API, so
redeclare the minimal subset that it needs for the benefit of the
platforms in transition.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-23 13:23:54 -05:00
Andy Ross
ab1baca03f drivers/ipm: Remove intel_adsp_mailbox driver
This is dead code.  It's based on the cAVS "IPC" mechanism to allow
communication to and from the host CPU.  But there is no test rig in
the Zephyr tree for the protocol defined.  And in fact the only
Zephyr-based user of the IPC mechanism (Sound Open Firmware) has its
own IPC driver and speaks its own protocol with the host kernel.  That
driver needs to migrate into Zephyr soon and this legacy bit is just
confusing.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-23 13:23:54 -05:00
Andy Ross
b6a32e9550 drivers: cavs_timer: Use the new interrupt controller API
Recent work to this platform added a new, cleaner low level API to the
interrupt controller.  Replace the hand-cooked register access with
that.  This is still not as good as having proper multicore support in
the intc_cavs driver, but it's at least better.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-23 13:23:54 -05:00
Wealian Liao
1a3a7b1d5e driver: gpio: nct38xx: Improve kconfig prompt
As per the guidelines:
https://docs.zephyrproject.org/latest/guides/build/kconfig/tips.html#prompt-strings
This improves the NCT38XX Kconfig prompt string.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-11-23 13:19:21 -05:00
Pawel Dunaj
7ba38d8b26 drivers: pwm: Restore default on re-initialization
Device data is cleared on deinitialization. This operation removes
some important information. Let's restore the defaults each time
the device is initialized.

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2021-11-23 17:00:56 +01:00
Ron Smith
863fef4a54 drivers: serial: uart_sam0: fix |= incorrectly clearing all INTFLAGS.
fix uart_sam0_irq_update to only clear the RXS bit by writing only the
RXS bitflag to the INTFLAG register. Performing an |= opperation
with the bitflag for RXS incorrectly clears all pending interrupts set
since writing 1 to a INTFLAG clears that bit field. This causes a race
condition on when TXC will be cleared before all bytes have finished
being clocked out on tx and TXC being set 1 again. If tx finishes first,
any driver using uart_irq_tx_complete will deadlock the system.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-11-23 10:40:13 -05:00
Ron Smith
847b3205d6 drivers: serial: uart_sam0: add uart_irq_tx_complete method for sam0.
sam0 does not currently have a uart_irq_tx_complete method for interrupt
driven mode.
This is especially important since the sam0 platform has seperate
interrupt signals for TX data register empty and TX complete therefore
the TX register being empty does not nessisarily mean the data has been
shifted out.
Drivers should check uart_irq_tx_complete if it needs to guarantee
that the data has been fully transmitted in a hardware agnostic way.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-11-23 10:40:13 -05:00
Erwan Gouriou
097cb02e59 drivers/pinmux: stm32f1: Rework pinmux remap information encoding
Aim of this change is to remove the need for the pinmux driver
on stm32f1 series to access the base address of the pinmux owner
device.

This is achieved by a modification in the device tree pin definition.
Instead of providing a generic information on type of the remap
(such as NO_REMAP, PARTIAL_REMAP, FULL_REMAP), the remap field
encodes all the information required to perform the remap register
configuration:
-Address of the targeted remap register in AFIO peripheral
-Position of the remap configuration in the remap register
-Mask used for the remap configuration encoding
-Value of the expected remap configuration.

All the possible remap configurations are encoded and predefined
in a new stm32f1-afio.h dt-bindings include.

To match this new configuration, all stm32f1 -pinctrl.dtsi should
be regenerated to use these new remap definitions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-23 10:37:01 -05:00
Erwan Gouriou
c35ed25a63 drivers/pinmux: stm32: Rework pinmux macro definitions
Review pinmux macro definition to a more portable format,
in preparation for new remap information encoding on stm32f1 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-23 10:37:01 -05:00
Nicolas Pitre
e915dcad13 ethernet: dwmac: fix promiscuous mode
The dedicated PR (Promiscuous Mode) bit should be used instead of
the RA (Receive All) bit.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-11-23 10:31:29 -05:00
Julien D'ascenzio
d42cef17b0 uart_stm32: Fix conflit between poll_out and irq API
A lock was added to manage situation where the API poll_out and irq API
are used in same time.

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2021-11-23 09:13:21 -05:00
Guillaume Lager
4c986a266f drivers: sensor: tmp112: Add default device initialization
This allow to have a smaller driver footprint when a single
configuration is required.

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-11-23 13:12:39 +01:00
Guillaume Lager
cd207ca0bc drivers: sensor: tmp112: correct type
TMP112 registers are 16bit so there is no reason to use int64_t for
register values

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-11-23 13:12:39 +01:00
Daniel DeGrasse
e70907f52d drivers: mcux_flexspi: Default logging to disabled when XIP is used
Program flow will behave incorrectly (memory and instruction fetches
return invalid data) if Flexspi is accessed by the Flexspi driver while
being used as XIP memory by the Cortex M7.

Set logging to disabled by when XIP mode is used in the memc and
flexspi drivers, and warn the user if they attempt to enable it.

Fixes #40133

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-11-22 22:27:13 -05:00
Tilmann Unte
38e89c90a5 drivers: pwm: stm32: add pwm capture support
Extends STM32 PWM driver to support capturing pulse width, period,
or both.

The approach used is based on the PWM Input sections in reference
manual RM0351 by ST in the chapters on timers.
The LL library by ST is used for all extensions to the driver.

Only the disco_l475_iot1 board was available for testing on hardware,
using tests/drivers/pwm/pwm_loopback.
Since timers are a generic component, it is assumed that other STM32
boards will behave the same

Fixes #39394

Signed-off-by: Tilmann Unte <unte@es-augsburg.de>
2021-11-22 22:24:45 -05:00
Yong Cong Sin
a6ebcddc54 driver: serial: uart_stm32: Calculate suitable PRESCALER value
Current driver set a fixed prescaler value for the lpuart
that caused certain baudrate configurations to fail due to
LPUARTDIV overflow the LPUART_BRR register.

This PR attempt to calculate a suitable PRESCALER for the
selected baudrate, throws error and return if it couldn't get
an optimal one.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-11-22 22:21:20 -05:00
Gerard Marull-Paretas
285f55899b drivers: serial: gd32: use pinctrl
Use the pinctrl API to configure peripheral pins.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-11-22 16:30:28 -05:00
Gerard Marull-Paretas
f8017dc5ad drivers: pinctrl: gd32: initial support for AFIO based SoCs
Add a pin control driver for GD32 SoCs using the AFIO model.

Thanks to Gerson Fernando Budke for testing and implementation
suggestions.

Co-authored-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-11-22 16:30:28 -05:00
Gerard Marull-Paretas
543a3843ff drivers: pinctrl: gd32: initial support for AF based SoCs
Add a pin control driver for GD32 SoCs using the AF model.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-11-22 16:30:28 -05:00
Sylvio Alves
b9ae272ade drivers: clock: esp32c3: fix clock basis
Clock ISR was running 2x the frequency.
Also fixes clock_get_cycle which was returning
wrong values.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-22 08:30:15 -05:00
Johann Fischer
f2e45d75a7 drivers: usb_dc_native_posix: check return value from recv()
Check return value from recv() passed by usbip_recv().

Fixes: #39849
Fixes: #39869
Coverity-CID: 240221
Coverity-CID: 240244

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-22 09:11:41 +01:00
Sylvio Alves
779ef06a5b drivers: spi: esp32: fix CS gpio initialization
SPI_CONTEXT_CS_GPIOS_INITIALIZE call was not considering
proper SPI driver instance ID.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-20 11:56:55 -05:00
Sylvio Alves
71d3609e16 drivers: spi: esp32: fix frequency config
Current implementation is using hardcoded frequency
and not the one provided by the spi api.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-20 11:56:55 -05:00
Andrei Emeltchenko
343033fc34 edac: ibecc: Exclude LOG_ERR() from branch coverage
It does not make sense to use branch coverage with macro LOG_ERR().
It is still covered with line coverage.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-11-20 11:54:32 -05:00
Andrei Emeltchenko
d11fae6d06 edac: ibecc: Return -ENODATA on zero log
Return -ENODATA when we read zero log.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-11-20 11:54:32 -05:00
Andrei Emeltchenko
e1ffce9ec3 edac: ibecc: Add header guards and move definition
Add header guards for ibecc.h to be used in tests.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-11-20 11:54:32 -05:00
Wealian Liao
5a9bc389f0 driver: gpio: nct38xx: Add NCT38XX gpio driver support
NCT38XX series, which are i2c-based chips, support a different number
of GPIO functionality. For NCT3807, it has 2 GPIO ports on the same i2c
device address. For NCT3808, it has 2 GPIO ports on different i2c
device addresses. This commit adds NCT38XX GPIO driver support &
provides the interrupt handler for the share alert pin.

The following is NCT3807 devicetree node example:
```
&i2c0_0 {
	nct3807_0: nct3807@70 {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "nuvoton,nct38xx-gpio";
		reg = <0x70>;
		label = "NCT3807_0";

		gpio@0 {
			compatible = "nuvoton,nct38xx-gpio-port";
			reg = <0x0>;
			label = "NCT3807_0_GPIO0";
			gpio-controller;
			#gpio-cells = <2>;
			ngpios = <8>;
			pin_mask = <0xff>;
			pinmux_mask = <0xf7>;
		};

		gpio@1 {
			compatible = "nuvoton,nct38xx-gpio-port";
			reg = <0x1>;
			label = "NCT3807_0_GPIO1";
			gpio-controller;
			#gpio-cells = <2>;
			ngpios = <8>;
			pin_mask = <0xff>;
		};
	};
};
```

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-11-20 08:00:38 -05:00
Ruibin Chang
3ab081efe9 ITE drivers/pwm: cleanup it8xxx2 pwm driver
1.Putting the PWM_CHANNEL_X, PWM_PRESCALER_CX information
  in the description.
2.Use the common definition EC_FREQ.
3.Use the common macro IT8XXX2_DT_ALT_ITEMS_LIST.
4.Stop using DRV_CONFIG, DRV_REG macro.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2021-11-19 10:24:11 -06:00
Tomasz Bursztyka
01b9813d73 drivers/spi: Return an error on SPI_HALF_DUPLEX for relevant drivers
This feature will need to be, however, implemented driver by driver
afterwards.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-19 11:50:38 +01:00
Tomasz Bursztyka
d5de0788ad drivers/sensors: Enable 3-wire SPI access to HTS221 sensor driver
HTS221 is a humidity and temperature sensor (thus HTS) that can be wired
on i2c or SPI bus. On SPI bus however, it uses the 3-wire mode, aka:
half-duplex.

Now that SPI API exposes half duplex operation, let's enable the SPI bus
on that sensor.

Let's move to a better DTS integrated driver as well, and also use
stmemsc interface.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-19 11:50:38 +01:00
Tomasz Bursztyka
f6be2835bd drivers: Apply SPI API change to relevant places
Mostly drivers, but also one sample and one test.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-19 11:50:38 +01:00
Tomasz Bursztyka
f8cc93de8c spi: Add a configuration option for half/full duplex mode
This is meant to expose half/full duplex configuration option on regular
configuration. So far, dual/quad/octal are not exactly supported, as it
would require extensions to the SPI buffer for a full support.

So moving these modes to an extended operation attribute
(32 vs 16 bits), disabled by default.

And exposing half/full duplex configuration bit. Full duplex being the
default option.

Fixes #19134

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-19 11:50:38 +01:00
Gerard Marull-Paretas
88a69674c0 drivers: use new PM macros
Port some drivers to the recently introduced macros to showcase its
usage and be able to do some initial testing (nRF52840).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-19 10:11:32 +01:00
Gerard Marull-Paretas
f4417dab46 device: remove PM capability from SYS_DEVICE_DEFINE
The macro already mentions in the docstrings that PM is not supported:

"Invokes DEVICE_DEFINE() with no power management support".

This patch removed the PM entry from the macro and ajusts its uses.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-19 10:11:32 +01:00
Gerard Marull-Paretas
c78c312c82 drivers: interrupt_controller: i/loapic: use DEVICE_DEFINE
Define the device using DEVICE_DEFINE macro, so that a single option can
be used regardless of PM being enabled or not.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-19 10:11:32 +01:00
Bartosz Bilas
a82ccba9ea drivers: flash: cast offset value into ssize_t
To fix compiler warnings cast offset value into ssize_t.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-11-18 19:13:22 -05:00
Gerard Marull-Paretas
c759a35d08 drivers: use DT_INST_ENUM_IDX(_OR) macros
Replace `DT_ENUM_IDX(_OR)(DT_DRV_INST(...),` pattern with
`DT_INST_ENUM_IDX(_OR)(...,`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-18 19:12:07 -05:00
Johann Fischer
fdcc104455 usb: remove Kconfig option USB_UART_CONSOLE
Since there are no more users and dependencies of
Kconfig option USB_UART_CONSOLE in the tree,
remove the remains and the option USB_UART_CONSOLE.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-18 14:29:18 +01:00
Johann Fischer
6fd0843809 drivers: console: limit scope of CONFIG_USB_UART_CONSOLE
Do not change init level and priority of console driver
if Kconfig option CONFIG_USB_UART_CONSOLE is enabled because
commit 37f4d9ba63
("usb: cdc_acm: rework cdc_acm_poll_out to non-blocking")
changed CDC ACM UART driver so that it more closely mimics
the real controller and CDC ACM UART driver now uses the same
init level and priority as regular serial driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-18 14:29:18 +01:00
Manojkumar Subramaniam
86a6280ed7 drivers: clock_control: stm32h7: Add logic to handle SMPS config
Some STM32 SoC supports an internal SMPS

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2021-11-18 13:56:39 +01:00
Thomas Stranger
cfac53b76f drivers: flash: stm32g0: dual bank handling
This commit fixes dual bank flash handling on stm32g0 targets.
In contrast to other Series (G4, L5) the flash page size does not change
in single bank configuration (2KiB in both configurations).

nSWAP_BANK:
While the reference manual(RM) only documents:
"This bit selects the bank that is the subject of empty check upon boot"
as expected, this behaves similar to BFB2 on G4 and SWAP_BANK on L5.
It has been observed that this bit swaps the address mapping of bank1
and bank2, regardless of DUAL_BANK bit being set or not.
As documented in the RM the nSWAP_BANK bit is ignored when the BOOT_LOOK
bit is set. This applies to the empty check as well as the address
mapping.

On this Series FLASH_CR_BKER must be set in single-bank as well as
dual-bank configuration for erase operations on bank2 regardless of
the swap status.

On a G0B1RE (dev-id: 0x467) I could not observe a difference between
DUAL_BANK flash option bit set and not.
It this may be different on 256KiB Flash targets.
The HAL indicates that "FLASH_SALES_TYPE_0" only uses a single bank if
OB_DUAL_BANK_VALUE is not set, but as I don't know which SoC this is
and I can't test the behaviour and the driver does not take this into
account.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-17 11:06:59 -05:00
Thomas Stranger
5bf11c250d drivers: flash: stm32g0: preparation for dual bank handling
This commit makes no functional changes, it only refactors the
driver such that dual bank flash handling can be easily added.

Instead of using HAL macros directly in the code, new macros
with STM32G0 prefix are defined.
The erase_page function gets passed the offset instead of the page,
and the FLASH CR reg is written once with all erase parameters.
flash_stm32_wait_flash_idle is already called before each
write to CR, consequently it is also made sure CFGBSY flag
is not set.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-17 11:06:59 -05:00
Thomas Stranger
4c862c14c1 drivers: flash: stm32: wait for CFGBSY & BSY2 in wait_flash_idle
Some series (namely g0, u5, wb, wl, ?) use CFGBSY to indicate
that FLASH_CR is not ready to be modfied.

This commit adds this flag additionally to other the flash busy flags,
in flash_stm32_wait_flash_idle such that the driver waits before
trying to modify PG, PNB[6:0], PER, and MER bits in FLASH_CR.

Additionally, dual bank variants of STM32G0 have a seperarate BSY2 flag
for flash bank two.
Until now this was not yet checked in flash_stm32_wait_flash_idle.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-17 11:06:59 -05:00
Thomas Stranger
f15f9dfd72 flash: stm32: fix g0 error flags and move ifdef-ery to header
In STM32G0 HAL FLASH_FLAG_xxx defines don't follow the pattern of
other Series to simply redefine the FLASH_SR_xxx Msk.
Instead an ID for the SR reg and the position of the Error flag
are defined.

As a result error checking in flash_stm32_check_status was not working
until this fix on stm32g0 series.

In order to avoid complexity in the driver, the ifdef-ery of the flags
was moved to the header file.
Other series except g0 use FLASH_FLAG_xxx defines, because those
are valid for both cores in dual core(wl) and in secure/non-secure
targets(l5,u5).
FLASH_STM32_SR_ERRORS mask is introduced to check for any active error
in the SR.

The flags for SIZERR, MISERR, FASTERR are newly introduced.
the latter two are only required once fast programming is used,
which is not yet the case for any series.

The FLASH_SR_OPTVERR flag (option validity flag) is also present
in the SR, but is not added.
Also ecc errors are generally not checked, but these are in a different
register.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-17 11:06:59 -05:00
Thomas Stranger
519f5ffcde drivers: flash: stm32: mv security-mode dependent defines to header
An attempt to simplify the ifdef-ery around FLASH_SR is made.
Define Registers and flags in the header file instead of including
several individual operations in the driver.

FLASH_FLAG_BSY is not only defined for STM32L5, but also other series.
Therefore use this flag instead of FLASH_SR_BSY.
Only the g0 series definition is not valid in our context,
therefore use FLASH_SR_BSY1 instead.

No functional changes, only refactoring.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-11-17 11:06:59 -05:00
Jani Hirsimäki
d2a7d29a08 drivers: net: ppp: configurable autostart
New Kconfig CONFIG_PPP_NET_IF_NO_AUTO_START
to have an option to disable of starting of the PPP networking interface
right after the init.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2021-11-16 21:25:47 -05:00
Tim Lin
e29a15c0e3 ITE: drivers/serial: add the UART driver for the PM callback function
IT8XXX2 uses shared ns16550.c driver which does not provide a power
management callback(pm_action_cb), so create driver to handle
IT8XXX2 specific UART features.

note: pm_action_cb(old name: pm_control_fn)

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-11-16 21:23:42 -05:00
Wealian Liao
1b416f7fd1 driver: gpio: npcx: Fix API header
For port_set_bits_raw(), port_clear_bits_raw(), and port_toggle_bits(),
the second parameter sould be gpio_port_pins_t type. Currently, it
doesn't have other side effect, but it sould be fix. This commit fixes
it.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-11-16 21:22:48 -05:00
Alexandre Bourdiol
3a60344522 drivers: pwm: stm32: move "st,prescaler" to timers instead of pwm
Prescaler was misplaced in pwm binding, instead of timers binding.
For example, TIM6/TIM7 doesn't have PWM capability,
but have a prescaler.
This change also prepares the introduction of timer based counter
(which requires prescaler at timer level)
For compatibility reason temporarily use pwm prescaler if it exists,
otehrwise use timers prescaler.
And thus avoid to avoid breaking boards out of tree.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-11-16 09:55:30 -06:00
Lucas Dietrich
f7f0bc7022 drivers: can: Fixed timeout values comparison
Trivial fix of compilation error "invalid operands to binary "
when CONFIG_CAN_AUTO_BUS_OFF_RECOVERY = n

Fixes #40290

Signed-off-by: Lucas Dietrich <ld.adecy@gmail.com>
2021-11-16 10:14:02 -05:00
Lukas Gehreke
0544f5dbc3 drivers: gpio: Added mcp230xx GPIO driver.
Added driver for the mcp230xx series I2C-based GPIO chips.

Signed-off-by: Lukas Gehreke <lk.gehreke@gmail.com>
2021-11-16 10:13:14 -05:00
Jay Vasanth
70d4559fdf Microchip: MEC172x: eSPI driver
Updates to MEC172x eSPI driver to support ACPI shared
memory region and EC Host Command Subsystem through
ACPI_EC1 and Embedded Memory Interface (EMI).

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2021-11-16 10:43:42 +01:00
Maureen Helm
836651b453 drivers: gpio: Refactor drivers to use shared init priority
Refactors all of the on-chip GPIO drivers to use a shared driver class
initialization priority configuration, CONFIG_GPIO_INIT_PRIORITY, to
allow configuring GPIO drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

Most drivers previously used CONFIG_KERNEL_INIT_PRIORITY_DEFAULT or
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, therefore the default for this new
option is the lower of the two, which means earlier initialization.

Driver-specific options for off-chip I2C- or SPI-based GPIO drivers are
left intact because they often need to be initialized at a different
priority than on-chip GPIO drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-11-15 14:38:55 -05:00
Christopher Friedt
7c6039a1d2 drivers: serial: nrfx: refactor for atomic_t as long
This driver aliases a regular `int` to `atomic_t` but that
should be updated to `long` with the change to `atomic_t`.

Added a comment to highlight that the variable was aliased.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-15 09:59:01 -05:00
Christopher Friedt
3e86c627f7 kernel: atomics: update print specifiers for atomic_t
The print specifier for `atomic_t` should be updated
to `%ld`, `%lu`, or `%lx` to account for the type
change of `atomic_t` to `long`.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-15 09:59:01 -05:00
Andy Ross
0b400d86c0 drivers/timer/cavs_timer: Fix race in k_cycle_get_64()
In commit 918a574c88 ("clock: add k_cycle_get_64") this driver was
augmented with a count64() method to get a 64 bit cycle output from
the two-32-bit-word device registers.

Unfortunately it appeared to be trying to use a spinlock around the
two (low/high) reads to protect against overflow.  But that doesn't
work: spinlocks protect against other CPU code using the same
spinlock, not against a hardware counter that is incrementing in real
time!

Thankfully there was already a count() routine in place that does a
detect-overflow-and-retry loop to solve this.  Use that.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-11-15 09:54:31 -05:00
Emil Gydesen
12decc70d0 Bluetooth: ISO: Add bitmask for retrieving iso header lenght
Add a macro to retrieve the iso data load length (the
length stored in the iso header) with a bit mask that
ensures that we only take the first 14 bits.

This is to remove any RFU bits that may have been set.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-12 14:52:33 +01:00
Rafał Kuźnia
e1ba2f75cf drivers: ieee802154: nrf5: fix NULL pointer dereference
When a frame is sent with a cleared ACK request bit, the transmit
metadata contains a NULL pointer to the ACK frame.

The pointer must not be dereferenced in such case.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-11-12 14:51:54 +01:00
Dino Li
6d8f1bf6d9 soc: it8xxx2: add support for eSPI driver
This supports eSPI slave, virtual wire, and peripheral functions.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-11-12 14:51:10 +01:00
Felipe Neves
b50cb2a537 drivers: counter: esp32: add support for esp32c3
to the unified esp32 counter driver.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-11-11 19:14:15 -05:00
Wouter Cappelle
ebed957005 modem: Update modem sockets poll to allow eventfd
The modem sockets poll implementation does not allow
a combination of poll on modem sockets and on other sockets
like eventfd. This blocks trivial application signalling. Current
users are using a poll timeout, which needs to check if other
work needs to be done in the thread (eg: lwm2m engine).
To allow proper signalling with eventfd, the non offload poll
methods needs to work for the modem sockets.
This commit is implementing this for POLLIN.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2021-11-11 19:12:46 -05:00
Henrik Brix Andersen
2e8cc9f9b0 drivers: gpio: add combined drive strength flags and mask
Introduce combined GPIO drive strength flags for GPIO controllers only
supporting either default or alternative drive strength regardless if
the pin is driven to a high or a low level.

Fixes: #30329

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-11 07:20:12 -05:00
Alex Sergeev
1c53e68459 drivers: ethernet: mcux: Bugfix ptp_clock_adjust
ptp_clock_adjust() API call for mcux driver has a bug where
increment gets compared with an unsigned int, causing it to
always return -EINVAL.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2021-11-11 07:05:22 -05:00
Johan Hedberg
224468f35b Bluetooth: drivers: h4: Fix uart_fifo_fill return value handling
The return value of uart_fifo_fill could potentially be negative, so
make sure the code doesn't do anything bad in that case.

Fixes #39823

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-11-10 14:17:50 +01:00
Johan Hedberg
cc2d5f8a45 Bluetooth: drivers: h4: Fix uart_fifo_read return value handling
Make sure negative error returns from uart_fifo_read() are correctly
handled.

In the same go, the logic of reading packet headers (ACL/event/ISO) is
refactored into its own helper function. This also fixes having an
appropriate name for the variable that tracks how many header bytes have
already been read (it was called "to_read" and now it's called
"bytes_read").

Fixes #39805

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-11-10 14:17:50 +01:00
Nick Ward
fa94be591d drivers: spi_nrfx_spim: workaround for nRF52832 errata anomaly 58
See:
https://infocenter.nordicsemi.com/index.jsp?topic=%2Fstruct_nrf52%2Fstruct%2Fnrf52832_errata.html
https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_3_Errata_v1.0.pdf

Code derived from the example PAN 58 workaround code.

Adds a new nRF SPIM Devicetree binding property called
anomaly-58-workaround that allows the workaround to be enabled
if required per SPIM instance.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2021-11-09 20:04:45 -05:00
Daniel Leung
40c2b1e99c uart: add API support for wide data
This adds API to support datum more than 8-bit wide. Drivers are
still responsible for the implementation.

Fixes #31914

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-11-09 19:44:38 -05:00
Dominik Ermel
bd6cc1fe35 drivers/flash/nrf_qspi_nor: Modify qspi_erase loop condition
The commit removes an error check from the erase loop and instead
add breaks in places where errors that would break an execution of
the loop occur.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-09 16:02:26 -06:00
Francois Ramu
2185863d3b drivers: adc: add the stm32U5 devices to the adc driver
The STM32U5x device has ADC instance of different versions
similar to the stm32H7 about the oversampling.
ADC1 of 14bit resolution has a ratio from 1..1024 on OSR[9:0]
ADC4 of 12bit resolution has a ratio on OVSR[2:0]

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-09 15:59:23 -06:00
Francois Ramu
e26fcc47b9 drivers: adc: stm32 oversampling includes the ADC of the stm32U5 soc
This commit extends the configuration of the oversampling
ratio and shift for the stm32U5xx soc, depending on the
ADC instance: ratio is a value from 1..1024 or a LL_ADC_OVS_RATIO_x
to be used with the stm32Cube LL function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-09 15:59:23 -06:00
Francois Ramu
cf60639390 drivers: serial: stm32 usart driver clears the RXNE through flag
For some stm32 soc devices, the USART (or UART) flag RXNE is cleared
by the LL_USART_ClearFlag_RXNE function which directly writes
the RXNE bit of the Status register. This is the case with the
stm32F1x, stm32F2x,stm32F4x, stm32L1x.
Some other are using the Rx Data Flushing function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-09 15:43:48 -05:00
Sylvio Alves
b0c48a2182 drivers: uart: esp32: set device to initialize pre-kernel
Uart post kernel initialization does not allow starting shell
properly. This issue was added in UART unifying PR.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-09 15:18:15 -05:00
Emil Lindqvist
38eed4a49e sara-r4: increase socket processing prio
Higher socket processing prio is required for offloaded sockets.

Resolves #40074

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-11-09 14:40:54 -05:00
Bartosz Bilas
ee95b5317a drivers: sensor: lsm6dsl: improve driver initialization
Take into account the return code of the bus_init function
and propagate codes from the init* functions to the user
instead of hardcoded -EIO. While at it set the ERROR
level message to the logs.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-11-09 08:32:13 -06:00
Andrzej Głąbek
760adff120 drivers: spi_context: Correct alignment of LOG_DBG() parameters
so that the call looks nicer.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-09 12:46:08 +01:00
Andrzej Głąbek
688d81813e drivers: spi_context: Fix handling of zero-length buffers
In some cases, it is quite useful to have the possibility to also
include zero-length buffers in a buffer set used in transfers
(for example, when frames in a protocol consist of several parts,
of which some are optional). So far, the behavior of spi_context
update functions was that the transfer in a given direction was
finished when a zero-length buffer was encountered in the buffer
set. Change those functions to simply skip such buffers. Correct
in the same way also the spi_context_buffers_setup() function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-09 12:46:08 +01:00
Andrzej Głąbek
3489ca9da2 drivers: spi_context: Do not use transfer timeout in slave mode
Do not use any timeout in the slave mode, as in this case it is not
known when the transfer will actually start and what the frequency
will be.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-09 12:46:08 +01:00
Henrik Brix Andersen
5bc0451f72 drivers: can: remove DT_CHOSEN_ZEPHYR_CANBUS_LABEL macro
Remove the DT_CHOSEN_ZEPHYR_CANBUS_LABEL macro and replace it with
DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus)) were possible.

Where both devicetree CAN controllers and Kconfig specified CAN loopback
controllers are supported, the macro is replaced with
DT_LABEL(DT_CHOSEN(zephyr_canbus)) for now.

This is the first pass for removing the requirement for devicetree
labels for CAN controllers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-09 11:19:50 +01:00
Ryan Erickson
270608139f modem: hl7800: remove NEWLIB_LIBC dependency
Zephyr LIBC minimal has definitions for struct tm.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-11-09 11:19:02 +01:00
Ruibin Chang
e505f2476a ITE drivers/timer: update timer_init() definition
Update timer_init() definition.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2021-11-09 11:18:42 +01:00
Lukasz Maciejonczyk
c930262fd8 drivers: ieee802154: nrf5: refactor storing mac keys
This commit makes nrf5_config_mac_keys function more generic.
Is uses lookup table for storing keys to override. It removes old keys
before storing new ones.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-11-09 11:18:31 +01:00
Andrzej Głąbek
f7466d28fd drivers: spi_nrfx_spim/spi: Fix initialization of CS GPIOs
This is a follow-up to commits 99daca9bba
and ae03c0a6bf.

nRF SPI driver shims cannot use devicetree instance indexes, they need
to use the DT_NODELABEL macro and SoC peripheral instance indexes.
Correct the macros used in initialization of CS GPIOs in those shims.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-09 11:11:19 +01:00
Benjamin Lindqvist
0ab1bf42b3 drivers: sensor: lis2dh: Level triggered interrupts
Both DRDY and motion interrupts behaves like level signals since they
remain asserted until they're cleared. Configuring them as edge
interrupts is dangerous because if we ever miss an interrupt, it may
never get cleared and thus will never trigger again.

Treating them as edge signals seems to have no advantages, other than
being marginally simpler to implement.

The patch has gotten many hours of run-time on real hardware using a
nRF52-based board and a LIS3DH with both interrupts connected and
heavily utilized.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2021-11-08 15:37:57 -06:00
Christopher Friedt
918a574c88 clock: add k_cycle_get_64
This change adds `k_cycle_get_64()` on platforms that
support a 64-bit cycle counter.

The interface functions `arch_k_cycle_get_64()` and
`sys_clock_cycle_get_64()` are also introduced.

Fixes #39934

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-08 13:41:53 -05:00
Bartosz Bilas
f445cb9a7e drivers: ieee802154_rf2xx: convert to use spi_dt_spec
Convert ieee802154_rf2xx driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-08 11:06:16 -05:00
Johann Fischer
02c32d4474 usb: move USB_DEVICE_REMOTE_WAKEUP option to drivers
Kconfig USB_DEVICE_REMOTE_WAKEUP option depends only on
USB device controller capability, but is not controlled
by the USB device controller drivers configuration.
Move USB_DEVICE_REMOTE_WAKEUP option to drivers and
make it promptless.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-08 17:01:32 +01:00
Erwan Gouriou
08bb61e0ff drivers/disk: sdmmc: stm32: DMA header requested on L4/F7 series
Even if not used DMA HAL is required in L4/F7 SD HAL driver.
Add them for these specific series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-08 10:58:49 -05:00
Felipe Neves
857a188c76 drivers: watchdog: esp32: enabled esp32c3
support for the unified esp32 wdt driver.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-11-08 10:56:28 -05:00
Yuriy Vynnychek
4ae0165c8b drivers: ieee802154: b91: Kconfig update with new params.
Added SET_TXRX_DELAY_US and CCA_RSSI_THRESHOLD params to Kconfig.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-11-08 09:31:53 -05:00
Alexander Wachter
ecd7c23daa drivers: hwinfo: shell: Add reset cause shell command
This commit adds shell commands for the reset cause API
- show: show the persistent reset cause
- clear: clear the persistent reset cause
- supported: list all supported reset causes

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2021-11-07 14:55:52 -05:00
Alexander Wachter
5db37b12a3 drivers: hwinfo: shell: rename args to satisfy rule 5.7
This commit changes the shell argument name from shell to sh
to satisfy the warning
"Violation to rule 5.7 (Tag name should be unique) tag: shell"

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-11-07 14:55:52 -05:00
Henrik Brix Andersen
c817a09b0a canbus: rename zephyr,can-primary chosen property to zephyr,canbus
Rename the Zephyr chosen property for specifying the default CAN bus
controller from "zephyr,can-primary" to "zephyr,canbus".

The "zephyr,can-primary" property name was selected in antipation of
adding support for redundant CAN networks, which we have yet to
add. Meanwhile, the "primary" term causes confusion for non-redundant
CAN bus configurations (and the "can" term doesn't match the name of the
Zephyr CAN bus subsystem).

The CAN in Automation (CiA) 302-6, which deals with CANopen network
redundancy, uses the terms "default interface" and "redundant
interface". If/when we add support for redundant CAN networks, the
"zephyr,canbus" chosen property can be supplemented with a
"zephyr,canbus-redundant" chosen property.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-07 09:05:39 -05:00
Bartosz Bilas
ee7cd10563 drivers: modem: improve modem context RSSI member
The previous bf68b67 commit incorrectly passes minfo.mdm_rssi
value to the modem context data_rssi member during the driver
initialization which causes the `modem info` shell command
to return 0 as RSSI value. Fix that by changing data_rssi
modem ctx member to a pointer that is assigned to the RSSI
variable stored within the modem driver context structure.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-07 15:02:43 +02:00
Andrei-Edward Popa
5413661a81 boards: xtensa: add ledc support to the esp32 board
add ledc to board dtsi file,
change compatible and device define in pwm driver,
add yaml for board ledc support,
fix missing include for board in gpio include

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2021-11-07 05:36:42 -05:00
Jan Zyczkowski
d435340f1b drivers: led_pwm: Decrease power consumption
Changed pwm_pin_set_cycles into pwm_pin_set_nsec
to decrease power consumption. Changed default
value for period to 100000. There is no need in having
period for pwm leds equal to 100 cycles as human eye has ~100 fps.

Signed-off-by: Jan Zyczkowski <jan.zyczkowski@nordicsemi.no>
2021-11-06 21:38:35 -04:00
Guillaume Lager
ec0d5b6e8d driver: modem: Fix mux device name comparison
CONFIG_UART_MUX_DEVICE_NAME is used as a prefix for the uart muxes
name. Pointer comparison will always return false

Fix #39774

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-11-06 10:20:42 -04:00
Jair Jack
8e95b95bb4 drivers: modem: gsm: Fix to COPS cmd parse info
drivers: modem: gsm: Quectel EC21 and BG9x act as a gsm modem without
problem, but COPS commands can returns just one value with 'mode'.

Format and oper are not mandatory. This modification reads 'mode'.
Also a modification on modem_cmd_read_cops_cmd is needed.

Signed-off-by: Jair Jack <jack@icatorze.com.br>
2021-11-06 10:20:11 -04:00
Sylvio Alves
ab91612a6d driver: esp32: I2C code refactoring
Use i2c_hal functions to enable support for
multiple SoCs.

Use DT compat to enable I2C from device
tree configuration

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-05 14:07:09 -04:00
Daniel N. Hansten
48a1e76e83 drivers: led: pca9633: add support for multiple devices
PCA9633 driver does not cunnetly support multiple devices.
Updated the driver to use DT_INST_FOREACH_STATUS_OKAY to
configure all devices defined in the device tree.
Convert driver to use `i2c_dt_spec` helpers.

Fixes #40076

Signed-off-by: Daniel N. Hansten <dnh2000@gmail.com>
2021-11-05 10:27:48 -05:00
Dino Li
963d05bd52 timer: it8xxx2: enable free run timer overflow interrupt
The ISR will be called on each overflow.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-11-05 03:03:16 -04:00
Sylvio Alves
27e44acda1 clock: esp32: unify clock control for all espressif socs
This joins all clock control handling to same source
by using hal clock functions. It also brings ESP32C3
clock support.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-04 15:21:26 -04:00
Francois Ramu
2ebf885ab0 drivers: usb device driver for the stm32u5 soc family
This commit enables the HSI48 clock for the stm32U5 soc family
to use the USB device peripheral.
Enable the VDD USB voltage supply.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-04 10:25:17 -05:00
Bartosz Bilas
41325bd1fb drivers: spi: remove spi_context_cs_configure function
Since cs gpios are initialized during driver initialization
remove spi_context_cs_configure that is not longer need.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
7ba48aa7a9 drivers: spi_xlnx_axi_quadspi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
258f2d85f7 drivers: spi_xec_qmspi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
997723b760 drivers: spi_sifive: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
81a3900b35 drivers: spi_sam0: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
61646649a1 drivers: spi_sam: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
05f326c96e drivers: spi_rv32m1_lpspi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
97d3de2349 drivers: spi_psoc6: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
225f0b3825 drivers: spi_oc_simple: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
99daca9bba drivers: spi_nrfx_spim: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
ae03c0a6bf drivers: spi_nrfx_spi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
054fb71bf0 drivers: spi_mcux_lpspi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
ab2d23c5f4 drivers: spi_mcux_flexcomm: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
0ccdd5f263 drivers: spi_mcux_dspi: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
bcd0364ab8 drivers: spi_gecko: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
f40be1f17f drivers: spi_esp32_spim: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
70a65b229b drivers: spi_dw: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
37925430b1 drivers: spi_cc13xx_cc26xx: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
b370fb8fad drivers: spi_b91: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
388a33c188 drivers: spi_ll_stm32: initialize all cs gpios during init
In case when we have multiple devices connected to the
one SPI interface the initial state of CS gpios after
MCU reset is floating and it might be low that prevents us from
communicating between particular devices. Fix that by
initializing all provided cs gpios and setting them as inactive.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
54907c7014 drivers: spi: spi_context: improve support of multiple cs gpios
Add extra cs_gpios and num_cs_gpios members into
spi_context structure that will be used to
initialize all defined cs gpios during the driver
initialization using SPI_CONTEXT_CS_GPIOS_INITIALIZE macro.
While at it add a new spi_context_cs_configure_all
function that allows the user to configure
all available cs gpios in inactive mode.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Bartosz Bilas
ea25b92cd9 drivers: spi: use dedicated init priority
A couple of SPI drivers use CONFIG_KERNEL_INIT_PRIORITY_DEVICE
as init priority for driver initialization. Let's change
it to the dedicated CONFIG_SPI_INIT_PRIORITY to make it
compatible with other ones.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 16:23:05 +01:00
Tomasz Bursztyka
23a0ce4ff3 drivers/pcie: Add PTM root device driver as well as implement PTM API
Any exposed PTM root device will by default see their root capability
enabled so they will become PTM responder.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-04 11:06:02 -04:00
Tomasz Bursztyka
766f567bfc drivers/pcie: Add PCIE logging module
Such module is missing and will prove to be useful for future features
and/or printing out debug messages on existing ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-04 11:06:02 -04:00
Francois Ramu
95e2c39497 drivers: uart stm32 flushing Rx register once the RXNE irq is enabled
When the "Read data register not empty" irq occurs,
this commit is cleaning the RXNE flag by flushing the RX register
since the Receive Data Reg. (USART_RDR) has not be read previously
This could be the case when aborting a Rx for example.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-04 09:45:11 -05:00
Erwan Gouriou
608b358d6b drivers/disk: sdmmc: stm32: err var init is not required
err is set unconditionally in these functions.
No need to initialize it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-04 09:40:47 -04:00
Erwan Gouriou
34a50e313d drivers/disk: sdmmc: stm32: Enable hw fc only after card init
During SDMMC card init, HW_FC is disabled by default, overwriting
driver configuration.
To avoid this, move HW FC configuration after card init.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-04 09:40:47 -04:00
Andrzej Głąbek
527315d451 drivers: flash: nrf_qspi_nor: Add support for device power management
Deinitialize the nrfx_qspi driver for periods when the device
is suspended. For flash chips with "has-dpd" property set, when
suspending/resuming the device, issue also the enter/exit Deep
Power-down Mode command, respectively.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-04 13:28:55 +01:00
Andrzej Głąbek
70efbcc15e drivers: flash: nrf_qspi_nor: Clean up handling of DT properties
Use the read-only device config structure (so far used only for storing
the flash chip size and its JEDEC ID) to store the nrfx_qspi driver
configuration (it is not modified after initialization, so there is no
need to keep it in RAM) and fill it with settings read from devicetree,
processing them all at compile time (e.g. use the DT_STRING_UPPER_TOKEN
macro instead of switch-case blocks for getting values of "readoc" and
"writeoc" properties).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-04 13:28:55 +01:00
Maureen Helm
32b4950c61 drivers: eeprom: Refactor drivers to use shared init priority
Refactors all of the EEPROM drivers to use a shared driver class
initialization priority configuration, CONFIG_EEPROM_INIT_PRIORITY, to
allow configuring EEPROM drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The
exceptions are at2x and emul drivers which have dependencies on SPI,
I2C, or flash drivers and must therefore initialize later than the
default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-11-04 07:33:01 -04:00
Dominik Ermel
c716514ca7 drivers/flash/nrf_qspi_nor: Remove qspi_nor_read_id param flash_id
The commit removes redundant flash_id argument that the function
can obtain itself from dev.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-04 07:23:43 -04:00
Dominik Ermel
f7ebbc5374 drivers/flash/qspi_nor_flash: Remove dev null check
The commit removes dev != NULL check from qspi_nrfx_configure.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-04 07:23:43 -04:00
Bartosz Bilas
7e43332436 drivers: adc: mcp320x: convert to spi_dt_spec
Convert mcp320x driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-11-04 07:18:09 -04:00
Julien D'ascenzio
7b21050f19 drivers/uart: stm32: fix a bug during transmission
If a transmission is made with poll_out and immediately after an other
transmission is made with interrupt api the transmission is locked.
We fix this behavior by clearing the tx_poll_stream_on flag during the
irq_tx_enable function

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2021-11-04 07:13:11 -04:00
Gerard Marull-Paretas
811a09bd83 drivers: serial: npcx: drop inline attribute for PM action callback
Making function inline doesn't provide any benefit here, and is
inconsistent with all other definitions.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas
cb329bbefe drivers: sensor: bme280: make PM action callback static
The PM action callback is never accessed externally, so make it static.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas
4baf1e01ff drivers: use common PM action callback naming
The PM callback is no longer referenced as "pm_control" but
"pm_action_cb", so reflect this new naming on the callbacks.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas
01430da395 drivers: video: ov2640: remove deprecated PM macro
Use NULL if no PM is available.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas
dd9d0560d1 drivers: spi: esp32_spim: use NULL for PM callback
A non-existing definition was being used (probably a misspelled
deprecated macro).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas
79effd7d1a drivers: sensor: si7210: make PM callback static
The PM action callback is not used externally, so make it static.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Sylvio Alves
d5aa5c2a77 drivers: esp32: uart: use hal functions
In order to have Espressif SoCs working with
the same uart drivers, all low level functions
are now replaced to hal_espressif HAL calls.

This also changes pinmux, gpio and uart
init order to meet its dependencies.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-03 16:47:32 -04:00
Gerard Marull-Paretas
1cee284a46 pm: device: runtime: use pm_device_runtime* namespace
Move all PM device runtime API calls from pm_device* to the
pm_device_runtime* namespace.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 16:37:33 -04:00
Erwan Gouriou
e19716e5c9 include/driver/clock_control: stm32: Remove STM32_PLL_PREDIV1
Make the code coherent with the comment:
purely remove STM32_PLL_PREDIV1.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-03 16:19:06 -04:00
Erwan Gouriou
ace71a98a4 drivers/clock_control: stm32: Remove CLOCK_STM32_ Kconfig symbols
Remove deprecated Kconfig based STM32 clock configuration system.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-03 16:19:06 -04:00
Andrzej Głąbek
eafafa2816 drivers: spi_nrfx_spis: Fix handling of buffer lengths
Do not limit the length of the prepared transfer to the shorter of
provided TX and RX buffers if both are used. The SPIS peripheral
cannot handle scattered buffers anyway, so there is no point in
getting the common part of TX and RX buffers for a partial transfer,
like it is done for SPI and SPIM peripherals; everything what is
possible needs to be transferred in one shot. For the same reason,
there is no point in calling spi_context_buffers_setup() and using
the related part of the spi_context structure, hence the call is
removed and buffer pointers are used directly.
Also return an error if a requested transfer length exceeds the SPIS
peripheral hardware limit, instead of silently limiting the transfer
like it was done so far.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-11-03 17:34:35 +01:00
Armando Visconti
aa3f3d943a drivers/sensor: lsm6ds0: Fix SENSOR_DEG2RAD_DOUBLE macro
In order to convert from degrees to radiants the SENSOR_DEG2RAD_DOUBLE
macro must divide the argument by 180 degrees and multiply by PI
radiants, and not the other way around. Please note that same macro
is already defined in the correct way in other sensor drivers as well.
(Fix #39483)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-11-03 08:16:45 -05:00
Robert Lubos
17856620cf drivers: ieee802154_cc1200: Fix unchecked return value coverity issue
Verify the return value of `gpio_add_callback()` call.

CID: 240678

Fixes #39825

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-03 11:17:58 +01:00
Robert Lubos
cf49c8676c drivers: ieee802154_cc2520: Fix unchecked return value coverity issue
Verify the return value of `gpio_add_callback()` calls.

CID: 240700

Fixes #39806

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-11-03 11:17:58 +01:00
Henrik Brix Andersen
0acb38adf1 drivers: gpio: mcux: add drive strength flags support
Add support for setting high/low GPIO output drive strength.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-02 22:25:33 -04:00
Andrew Hedin
52c298e0e3 drivers: sensors: lis2dh: Add ability to read temperature
Allow user to read temperature from LIS2DH family of sensors.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2021-11-02 22:23:39 -04:00
Erwan Gouriou
9f6246c325 drivers/disk: sdmmc_stm32: Add Hardware FC Kconfig option
Add a Kconfig symbol to enable use of SDMMC hardware flow control.
In specific cases, this feature could help to avoid FIFO ovderrun
and underrun errors.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-02 22:20:36 -04:00
Erwan Gouriou
8bd5549021 drivers/disk: sdmmc_stm32: Convert driver to IT driven mode for r/w
Add IT driven read/write access.
2 new semaphores are added to protect IT driven procedures.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-11-02 22:20:36 -04:00
Dawid Niedzwiecki
65277d4770 i2c: emul: Add get_config function
Add get_config function to I2C emulator.

Also update tests using I2C emulator to use i2c_get_config.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-11-02 16:46:33 +01:00
Dawid Niedzwiecki
51c3e0de79 i2c: npcx: Add get_config function
Add get_config function to NPCX I2C driver. The master mode is hardcoded
and get the speed from a controller.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-11-02 16:46:33 +01:00
Dawid Niedzwiecki
72486b6971 i2c: Add get_config to I2C API
Some applications need to get the current I2C configuration. Add a
proper callback to I2C API under Kconfig option not to change
applications that don't need this feature.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-11-02 16:46:33 +01:00
Francois Ramu
a1e7c4dbfa drivers: clock control disable AHB3 clock in stm32_clock_control_off
This commit is fixing the error on clock control for the AHB3
in the stm32_clock_control_off function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-02 13:24:10 +01:00
Nicolai Glud
8773c31047 drivers: flash: the chosen_flash variable was not read properly
This fixes an issue with code relocation.

Signed-off-by: Nicolai Glud <nicolai.glud@prevas.dk>
2021-11-02 13:23:56 +01:00
Krzysztof Chruscinski
9174cd8dbc drivers: watchdog: Add software watchdog based on counter
Added watchdog implementation which is using counter device
to implement watchdog driver API. Watchdog timeout is called from
counter interrupt context. Some counter implementations support
using ZLI interrupt level which can be use here as well. Watchdog
like this can be used along hardware watchdog to cover for its
limitations, i.e. Nordic watchdog resets unconditionally after
62uS after triggering watchdog interrupt. It is not enough time
to dump logging data.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-02 13:22:58 +01:00
Henrik Brix Andersen
351d065f63 drivers: pwm: mcux: ftm: return -EBUSY if PWM capture in progress
Return -EBUSY (not 0) from pwm_pin_enable_capture() if PWM capture is
already in progress.

Fixes: #39817

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-01 22:11:04 -04:00
Jun Lin
5d72417df4 drivers: spi: npcx: add SPI support to access the SPI flash
The FIU/UMA module in the NPCX chip provides an dedicated SPI interface
to access the SPI flash. This commit adds the driver support for it.
With this commit, the application can call the flash APIs
(via spi_nor.c) to access the internal flash of NPCX EC chips.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Change-Id: I32bbf09f6e014b728ff8e4692e48151ae759e188
2021-11-01 21:48:20 -04:00
Felipe Neves
0a0fed7879 drivers: spi: esp32: add esp32c3 support
to the esp32 spi unified driver

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-11-01 21:47:26 -04:00
Carlo Caione
c03519fffc mbox: ipc: s/_MBOX_NRFX/_MBOX_NRFX_IPC/
Use a more precise Kconfig symbol name to avoid namespace conflicts when
more NRFX-dependent drivers will be added.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-11-01 11:30:59 -04:00
Henrik Brix Andersen
2d7cabb970 drivers: flash: spi_flash_at45: remove unused variable
Remove unused variable.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-11-01 10:33:09 -04:00
Jacob Siverskog
861787602e ite: drivers/i2c: fix potential NULL pointer dereference
reorganize code so that null pointer check is done prior to accessing
element.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2021-10-29 22:55:50 -04:00
Maureen Helm
b539699a98 drivers: dma: Refactor drivers to use shared init priority
Refactors all of the DMA drivers to use a shared driver class
initialization priority configuration, CONFIG_DMA_INIT_PRIORITY, to
allow configuring DMA drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

Most drivers previously used CONFIG_KERNEL_INIT_PRIORITY_DEFAULT or
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, therefore the default for this new
option is the lower of the two, which means earlier initialization.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-29 22:55:03 -04:00
Maureen Helm
b071588265 drivers: display: Refactor drivers to use shared init priority
Refactors the remaining display drivers that didn't already use the
shared driver class initialization priority configuration,
CONFIG_DISPLAY_INIT_PRIORITY.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-29 22:55:03 -04:00
Felipe Neves
4c069b9894 drivers: serial: add support for esp32c3
into esp32_serial unified driver

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-29 16:09:09 -04:00
Bartosz Bilas
84dc576670 drivers: sensor: lsm6dsl: convert to use spi_dt_spec and i2c_dt_spec
Convert lsm6dsl driver to use `spi_dt_spec` and `i2c_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-29 12:21:27 -05:00
Dmytro Firsov
d9a3efb834 xenvm: drivers: serial: Implement serial interface to Xen PV console
This commit adds minimal support of Xen hypervisor console via UART-like
driver. Implementation allows to use poll_in/poll_out char interface for
uart_console.c driver directly to HV console instead of using Xen
virtual PL011 UART. Future implementation will support interrupt driven
interface on Xen event channels, currently it is under development.

Also this commit introduces early console_io Xen interface, which allows
to receive printk/stdout messages quickly after start, but requires Xen,
built with CONFIG_DEBUG option.

Signed-off-by: Dmytro Firsov <dmytro_firsov@epam.com>
2021-10-29 15:23:33 +02:00
Martin Jäger
5511cba5fe drivers: can: Add get_max_filters API
The maximum number of concurrent filters depends on the hardware and
the driver implementation. This API allows the application to obtain
the maximum number of available filters.

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-10-28 13:56:58 -04:00
Ryan Holleran
cbb0585e0b drivers: sensor: fxos8700: Keep current power mode when setting ODR
Setting the power mode to enabled causes other initialization to not
occur. Restore the power mode set upon entry when exiting.

Signed-off-by: Ryan Holleran <rhollerar@gmail.com>
2021-10-28 10:10:52 -05:00
Daniel Schultz
dbf2d02747 drivers: led: Fix warnings in shell_print
Change format in various shell_error calls from int to long unsigned
int.

Warning:

    warning: format '%d' expects argument of type 'int', but argument
    6 has type 'long unsigned int'

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
2021-10-28 10:38:01 -04:00
Jakub Rzeszutko
36f907e43c driver: qdec - fix step limits
Corrected the condition that checks the maximum number of steps
allowed.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2021-10-28 08:29:59 -05:00
Bartosz Bilas
0a7d8d4452 drivers: sensor: bmp388: convert to spi_dt_spec
Convert bmp388 driver to use spi_dt_spec helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-10-28 08:29:07 -05:00
Bartosz Bilas
022bc83351 drivers: sensor: ms5607: convert to spi_dt_spec
Convert ms5607 driver to use spi_dt_spec helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-10-28 08:28:26 -05:00
Immo Birnbaum
811d77a88a drivers: serial: xlnx_xuartps: Fix interrupt-driven operation
Fixes interrupt-driven operation. With the previous way of
handling the TX FIFO and the interrupt flags, the operation
of the UART was prone to stalling when using it as the
console I/O device.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2021-10-28 15:26:50 +02:00
Immo Birnbaum
fe33a24721 drivers: serial: xlnx_xuartps: enable this driver for Zynq-7000 series SoCs
Enable this driver to be used in conjunction with Xilinx Zynq-7000
series SoCs.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2021-10-28 15:26:50 +02:00
Immo Birnbaum
266875ead0 drivers: ethernet: xlnx_gem: Zynq-7000 support for the Xilinx GEM driver
Add support for the Xilinx Zynq-7000 SoC family to this driver. This
includes some SoC-specific register accesses when setting an updated
TX clock divider, also, the device tree binding now supports higher
MDC clock divisor values when the current target SoC is a Zynq rather
than a ZynqMP.

With regards to the use of this driver in a QEMU simulation of the
Zynq-7000, the Kconfig file is modified so that the driver is not
enabled unless QEMU networking is set to Ethernet mode.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2021-10-28 15:26:50 +02:00
Immo Birnbaum
315ad1d6e6 drivers: timer: arm_arch_timer: Workaround for Cortex-A9 erratum 740657
Modification of the ARM architected timer driver and its configuration
data in order to address an erratum which exists at least in the Cor-
tex-A9 CPU, and which can also be observed in the QEMU implementation
of the Cortex-A9.

Comp.: ARM Cortex-A9 processors Software Developer Errata Notice
ARM document ID032315
Erratum 740657

This erratum causes a spurious interrupt pending indication with the
interrupt controller if no new compare value is written within the
timer ISR before the interrupt is cleared. This is usually the case
in tickless mode. If the spurious interrupt is not prevented, the
timer ISR will be called twice, but on second execution, the pending
flag is not set within the timer's register space. Not handling this
issue will lead to erratic tick announcements to the kernel.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2021-10-28 15:26:50 +02:00
Glauber Maroto Ferreira
1af506dd32 soc: riscv: esp32c3: drivers: flash: add support
to host SPI Flash driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-28 06:47:21 -04:00
Glauber Maroto Ferreira
dcf26d72f5 soc: esp32s2: drivers: flash: add support
to host SPI Flash driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-28 06:47:21 -04:00
Gerson Fernando Budke
45d60c4d4c drivers: serial: Add gd32 uart driver
Introduce minimal serial driver support for gigadevice soc.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-10-28 11:17:25 +02:00
Jordan Yates
3b8e2f8983 drivers: regulator: convert to gpio_dt_spec
Convert regulator_fixed GPIO usage to utilize `struct gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-28 11:15:12 +02:00
Felipe Neves
1e328fe109 clock_control: esp32c3: added clock control
gating driver support for esp32c3 SoC family

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-27 15:09:08 -04:00
Marek Pieta
07b9e4e992 drivers: led_pwm: Fix power management action callback
A single PWM driver can be used for multiple LED numbers. In that
case -EALREADY may be reported. It should be ignored.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-10-27 13:45:43 -04:00
Carlo Caione
012591c4a5 mbox: Introduce MBOX NRFX IPC driver
Rewrite the NRFX IPC driver to properly support multi-channel addressing
leveraging the newly introduced MBOX APIs.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-10-27 18:27:21 +02:00
Carlo Caione
1976f33e87 drivers: mbox: Introduce MBOX driver class
One limitation of the current IPM API is that it is assuming that the
hardware is only exporting one single channel through which the data can
be sent or signalling can happen.

If the hardware supports multiple channels, the IPM device must be
instantiated (possibly in the DT) several times, one for each channel to
be able to send data through multiple channels using the same hw
peripheral. Also in the current IPM API only one callback can be
registered, that means that only one driver is controlling all the
signalling happening on all the channels.

This patch is introducing a new MBOX API that is supporting
multi-channel signalling and data exachange leveraging and extending the
previous (and outdated) IPM API.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-10-27 18:27:21 +02:00
Nicolas Pitre
bc41234104 ethernet: Synopsys DesignWare MAC driver
This is a driver for the Synopsys DesignWare MAC. It should work
with the "DesignWare Cores Ethernet Quality-of-Service" versions 4.x
and 5.x.

This driver uses a zero-copy strategy, meaning that the hardware
reads and writes data directly from/to packet fragment buffers
provided by the network subsystem without first copying the data into
a dedicated DMA bounce buffer.

Platform specific setup is necessary for the hardware to work.
Currently, only the STM32H7X series is implemented and tested.
While this part needs refinement, this driver performs better and uses
far less code space than the HAL-based alternative.

Not yet implemented:

- MDIO (it is WIP, currently relying on default PHY config)
- PTP support
- VLAN support
- various hardware offloads (when available)

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-10-27 10:43:05 -04:00
Maureen Helm
9eef764c65 drivers: dac: Refactor drivers to use shared init priority
Refactors all of the DAC drivers to use a shared driver class
initialization priority configuration, CONFIG_DAC_INIT_PRIORITY, to
allow configuring DAC drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The
exceptions are dacx0508, dacx3608, and mcp4725 drivers which have
dependencies on SPI or I2C drivers and must therefore initialize later
than the default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-27 10:58:33 +02:00
Maureen Helm
1788b036fb drivers: sensor: Fix ina219 driver when device pm enabled
Fixes a build error in the ina219 sensor driver when device power
management is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-26 20:51:13 -04:00
Maureen Helm
be38a87089 drivers: sensor: Fix bq274xx driver when device pm enabled
Fixes a build error in the bq274xx sensor driver when device power
management is enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-26 20:51:13 -04:00
Henrik Brix Andersen
91233dba70 drivers: entropy: add driver for the neorv32 trng
Add entropy driver for the NEORV32 True Random Number Generator (TRNG).

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-26 17:53:15 -04:00
Bartosz Bilas
7965d7582b drivers: wifi: eswifi: convert to spi_dt_spec
Convert eswifi driver to use `spi_dt_spec` helpers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-10-26 17:40:54 -04:00
Jordan Yates
526b3e9605 lora: asynchronous packet reception
Adds functionality to receive LoRa packets asynchronously. Reception
runs continuously until cancelled by another call to `lora_recv_async`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-26 15:48:09 +02:00
Jay Vasanth
c214c59548 Microchip: MEC172x: eSPI driver
MEC172x eSPI driver, eSPI pin programming, interrupt updates related
to eSPI and other updates for MEC172x eSPI driver.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2021-10-26 09:27:20 -04:00
Bartosz Bilas
bf68b670f1 drivers: modem: gsm: extend modem info struct about RSSI value
Add RSSI member into gsm_ppp_modem_info structure in order to
get that information using the gsm_ppp_modem_info function.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-26 14:47:38 +03:00
Bartosz Bilas
5107691441 drivers: modem: gsm: allow the user to get modem information
Make modem_info structure public in order to allow the user
to get modem information using gsm_ppp_modem_info function.
Move modem info query commands into separate function
that's called only once during gsm configuring because
there is no necessity to re-querying modem since
they should not change.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-26 14:47:38 +03:00
Bartosz Bilas
cb30cc5f8c drivers: modem: gsm: move header file into modem directory
There is a specified location for modem drivers so move this
header right there.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-26 14:47:38 +03:00
Robert Lubos
a2e619ec8b drivers: uart_nrfx_uarte: Use predefined data pointer where applicable
After recent changes in the driver, the predefined `data` pointer in
`uarte_nrfx_pm_control()` would not be used in CONFIG_UART_ASYNC_API
configuration. Fix this by replacing `get_dev_data()` calls with
predefined data pointer where applicable.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-10-25 19:26:43 -04:00
Francois Ramu
3ee3a46b6a drivers: adc: stm32h7 adc driver has a range for oversampling ratio
On the stm32H7 family, there are ADC which have Oversampling ratio
of 10 bits OSVR[9:0] in the CFGR2 register. It means that oversampling
512x or 1024x are possible.
Other values are not allowed as the oversampling field of the struct
adc_sequence (adc.h) is 2^oversampling.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-25 19:15:03 -04:00
Francois Ramu
0af4a393ee drivers: adc: stm32h7 adc driver has a different oversampling ratio
The adc_stm32_oversampling function is used to configure
the ratio and shift for each sequence->oversampling
depending on the soc serie and ADC instance in the serie
In the stm32H7 serie, only ADC3 of ADC_VER_V5_V90 version
have a LL_ADC_OVS_RATIO_x contant (other a 9bit value).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-25 19:15:03 -04:00
Francois Ramu
41bfec7c52 drivers: adc: stm32h7 adc driver using LL function
Change the access to the PCSEL register by using the LL function
because on the STM32H7xx soc, some devices have no PCEL register
especially on ADC3 of the stm32H723.
The LL function manages this difference.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-25 19:15:03 -04:00
Gerard Marull-Paretas
329f2453c5 drivers: pinctrl: add support for dynamic pin control
Add support for dynamic pin control, that is, allow to change device pin
configuration at runtime. Because no device de-initialization is
available yet, this API has limited usage options, e.g. modify pin
configuration at early boot stage (before device driver is initialized)

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-25 15:26:47 -05:00
Gerard Marull-Paretas
4040df096f drivers: pinctrl: initial skeleton
Initial skeleton for pinctrl drivers. This patch includes common
infrastructure and API definitions for pinctrl drivers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-25 15:26:47 -05:00
Henrik Brix Andersen
adfd34ed08 drivers: entropy: introduce shared init priority and logging
Introduce Kconfig for setting the driver initialization priority across
the entropy drivers and add a call to the logging template.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-25 08:34:29 -05:00
Gerard Marull-Paretas
6869743e28 sensor: qdec_nrfx: fix PM callback signature
The PM action callback had an incorrect signature, probably a leftover
from the actions conversion.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-25 08:30:58 -05:00
Jordan Yates
fab00d086e ieee802154: cc2529: convert to _dt_spec
Convert cc2529 driver to `spi_dt_spec` and `gpio_dt_spec`. Required a
whole driver conversion from passing around the driver data struct to
passing around the driver itself.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-25 09:01:05 -04:00
Jordan Yates
eecb6cdaf3 ieee802154: cc1200: convert to _dt_spec
Convert cc1200 driver to `spi_dt_spec` and `gpio_dt_spec`. Required a
whole driver conversion from passing around the driver data struct to
passing around the driver itself.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-25 09:01:05 -04:00
Jordan Yates
21e99902d1 gpio: mcp23s17: convert to spi_dt_spec
Convery mcp12s17 GPIO driver to `spi_dt_spec`. Also perform some minor
cleanup on non-standard device data pointers.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-25 09:01:05 -04:00
Jordan Yates
49fbee42e0 flash: spi_flash_at45: convert to spi_dt_spec
Convert spi_flash_at45 driver to use `spi_dt_spec` helpers.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-10-25 09:01:05 -04:00
Torsten Rasmussen
bd61122aa2 kconfig: drivers: experimental settings now uses select EXPERIMENTAL
With the introduction of `EXPERIMENTAL` and `WARN_EXPERIMENTAL` in
Zephyr all drivers settings having `[EXPERIMENTAL]` in their
prompt has has been updated to include `select EXPERIMENTAL` so that
developers can enable warnings when experimental features are enabled.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-25 10:46:48 +02:00
Torsten Rasmussen
36f5600387 kconfig: net: experimental settings now uses select EXPERIMENTAL
With the introduction of `EXPERIMENTAL` and `WARN_EXPERIMENTAL` in
Zephyr all subsys/net and drivers/ethernet/Kconfig.e1000 settings
having `[EXPERIMENTAL]` in their prompt has has been updated to include
`select EXPERIMENTAL` so that developers can enable warnings when
experimental features are enabled.

The following settings has EXPERIMENTAL removed as they are considered
mature:
- NET_OFFLOAD
- NET_PROMISCUOUS_MODE

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-25 10:46:48 +02:00
Torsten Rasmussen
8aa7a653d1 kconfig: gpio: remove experimental on GPIO_EMUL setting
The setting GPIO_EMUL is no longer considered experimental.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-25 10:46:48 +02:00
Torsten Rasmussen
b87d8e7d7d kconfig: uart: remove experimental on UART_ASYNC_API setting
The setting UART_ASYNC_API is no longer considered experimental.
Also remove `new` from title and help test as the feature no longer can
be considered new.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-25 10:46:48 +02:00
Maureen Helm
43fa7ce53f drivers: console: Refactor drivers to use shared init priority
Refactors all of the console drivers to use a shared driver class
initialization priority configuration, CONFIG_CONSOLE_INIT_PRIORITY, to
allow configuring console drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEFAULT to preserve
the existing default initialization priority for most drivers.

The driver-specific option, CONFIG_NATIVE_POSIX_CONSOLE_INIT_PRIORITY,
is left intact because the native posix console driver needs to
initialize after the UART console driver when both drivers are enabled.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-23 20:44:49 -04:00
Maureen Helm
165963c115 drivers: counter: Refactor drivers to use shared init priority
Refactors all of the counter drivers to use a shared driver class
initialization priority configuration, CONFIG_COUNTER_INIT_PRIORITY, to
allow configuring counter drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The
exceptions are the maxim_ds3231 and mcp7940n drivers which have a
dependency on a SPI driver and must therefore initialize later than the
default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-23 20:44:49 -04:00
Maureen Helm
e297f8ee26 drivers: can: Refactor drivers to use shared init priority
Refactors all of the CAN drivers to use a shared driver class
initialization priority configuration, CONFIG_CAN_INIT_PRIORITY, to
allow configuring CAN drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The exception
is the mcp2515 driver which has a dependency on a SPI driver and must
therefore initialize later than the default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-23 20:44:49 -04:00
Andrei Auchynnikau
3b3a30612f drivers: add adc driver for the NXP RT series
adc driver is based on the NXP MCUX hal library

Signed-off-by: Andrei Auchynnikau <ovchinnikov@strim-tech.com>
2021-10-22 15:43:36 -05:00
Armando Visconti
ea6ad7337c drivers/sensor: lis2ds12: Move odr Kconfig property into dts
Move odr options from Kconfigs to Device Tree. Moreover add
in DT a power-mode option to select among 4 possible values
(PD, LP, HR, HF). The power mode cannot be currently set from
sensor APIs.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-22 09:06:07 -05:00
Armando Visconti
e0f06e23ef drivers/sensor: lis2ds12: Move range Kconfig property into dts
Converts lis2ds12 range options (2g, 4g, 8g, 16g) from Kconfig
to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-22 09:06:07 -05:00
Armando Visconti
f3ad909abd drivers/sensor: lis2ds12: Add multi-instance support
This commit aligns lis2ds12 sensor driver to latest multi
instance sensor driver model.

In particular it makes use of the stmemsc common routines
and move ctx handler inside struct config, so that the
bus_init routines can be totally avoided.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-22 09:06:07 -05:00
Armando Visconti
1c0acad364 driver/sensor: lis2ds12: make use of STdC definitions
Port the lis2ds12 sensor driver on top of the lis2ds12_StdC
HAL interface (in modules/hal/st/sensor/stmemsc/).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-22 09:06:07 -05:00
Armando Visconti
dabaaa1e5d drivers/sensor: stmemsc: make use of spi_dt_spec and i2c_dt_spec
Make use of the new DT facilities that introduced two new
bus structures, spi_dt_spec and i2c_dt_spec, as well as the
macros, SPI_DT_SPEC_INST_GET and I2C_DT_SPEC_INST_GET, to
retrieve info from DT.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-22 09:06:07 -05:00
Bartosz Bilas
919b3f9165 drivers: sensor: ina23x: fix sample fetching
Fix the usage of sensor shell module that calls sensor_sample_fetch
function with SENSOR_CHAN_ALL id which is not supported and
causes the following error:

uart:~$ sensor get INA237 current
Failed to read sensor: -134
channel idx=31 current =   0.000000

Fix that by adding support for SENSOR_CHAN_ALL channel id.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-22 08:51:30 -05:00
Torsten Rasmussen
587285e4de kconfig: canbus: experimental settings now uses select EXPERIMENTAL
With the introduction of `EXPERIMENTAL` and `WARN_EXPERIMENTAL` in
Zephyr all subsys/canbus, subsys/net/l2/canbus, and drivers/can settings
having `[EXPERIMENTAL]` in their prompt has has been updated to include
`select EXPERIMENTAL` so that developers can enable warnings when
experimental features are enabled.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-22 13:59:21 +02:00
Torsten Rasmussen
9a2be89557 kconfig: bluetooth: experimental settings now uses select EXPERIMENTAL
With the introduction of `EXPERIMENTAL` and `WARN_EXPERIMENTAL` in
Zephyr all subsys/bluetooth and drivers/bluetooth/hci settings having
`[EXPERIMENTAL]` in their prompt has has been updated to include
`select EXPERIMENTAL` so that developers can enable warnings when
experimental features are enabled.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-22 13:59:21 +02:00
Neil Armstrong
71766f5c05 interrupt_controller: gicv3_its: Implement Indirect Two-level table
When the ITS is configured with a large number of DeviceID bits,
up to 32, the Device Translation Table can be configured as
"indirect" mode consisting of a 2-level table with the first
level entries pointing to a second level table for each
group of DeviceIDs.

This is necessary to support platforms with DeviceID bits > 16.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-10-21 10:56:15 -04:00
Sylvio Alves
944b6d0486 soc: esp32: use same rom func prefix
This sets esp32 to use common rom functions
prefix among SoCs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-10-21 10:55:45 -04:00
Sylvio Alves
b0717d518e drivers: gpio: esp32: use dts and improve code checks
This PR updates GPIO driver to use DTS information
regarding gpio availability.

This also fixes interrupt handling and
also removes kconfig definition for GPIO port.

A few configuration checks were also added to
improve code usage.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-10-21 10:53:34 -04:00
Sylvio Alves
7c10e0d947 pinmux: esp32: add missing pull down call
When configuring pin as pull up, pull down needs
to be disabled first.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-10-21 10:53:34 -04:00
Erwan Gouriou
aa144ca3f0 drivers/usb: stm23: Fix deprecated macro declaration
Use of '__DEPRECATED_MACRO' was not compatible with the way macro
is used later in this driver.
Remove it and keep the warning as vector for deprecation information.

Additionally, replace DT_NODE_HAS_PROP with DT_INST_PROP as
using the former is not recommended with boolean properties.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-21 05:53:52 -05:00
Kumar Gala
fb4d68973f shell: Fix various build issues with string formattors
We get a few different CI failures associated with data type
differences on various platforms.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-10-20 10:54:38 -05:00
Maureen Helm
b0cdef3c25 drivers: adc: Refactor drivers to use shared init priority
Refactors all of the ADC drivers to use a shared driver class
initialization priority configuration, CONFIG_ADC_INIT_PRIORITY, to
allow configuring ADC drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The
exceptions are lmp90xxx, mcp320x, and mcux_adc16 drivers which have
dependencies on GPIO, SPI, and/or DMA drivers and must therefore
initialize later than the default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-20 07:33:44 -04:00
Wouter Cappelle
96f9f6e6d2 modem: clang-format the modem_socket files
Running clang-format on the modem socket files

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2021-10-20 07:30:46 -04:00
Wouter Cappelle
287481ef0a modem: Rework the modem_sockets poll behavior
The current modem sockets poll implementation has 2 limitations
as of today:
- not following posix spec wrt timeout of -1 (should be forever,
  but as today it's was returning immediately)
- not able to poll from multiple threads on different sockets
  on the same modem.
This pull request should implement these limitations.

Signed-off-by: Wouter Cappelle <wouter.cappelle@crodeon.com>
2021-10-20 07:30:46 -04:00
Timo Teräs
1eb6831ddd drivers: uart_ns16550: Fix dts hw_flow_control mapping to config
DT_INST_NODE_HAS_PROP() returns true always since the boolean
tag is valid. Use DT_INST_PROP_OR() to get the real value.

Fixes: baecd7e55a drivers: uart_ns16550: Remove CMake-based templating
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2021-10-20 07:13:42 -04:00
Henrik Brix Andersen
267a83e94b drivers: can: flexcan: fix timing parameter limits
Fix the limits for the timing parameter calculations.

The lower limit for the phase_seg2 value is wrongly specified as 1 to 7,
but 1U is substracted before writing it to the CTRL1:PSEG2 register
field. This results in register field values between 0 and 6, but 0 is
an invalid value for the PSEG2 register field.

The upper limits for several of the timing parameters are wrong as well,
but this does not result in invalid register field values being
calculated. It can, however, result in not being able to meet CAN timing
requirements.

The confusion in specifying the limits likely stems from the timing
calculations and timing limits using the "physical" values, whereas the
registers fields all use the "physical" value minus 1. When the
datasheet says "The valid programmable values are 1-7", the
corresponding limits should be set to 2 to 8 to take the "minus 1" into
account.

Fixes: #39541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-10-20 07:06:56 -04:00
Maureen Helm
ed9cb841c3 drivers: clock_control: Refactor drivers to use shared init priority
Refactors all of the clock control drivers to use a shared driver class
initialization priority configuration,
CONFIG_CLOCK_CONTROL_INIT_PRIORITY, to allow configuring clock control
drivers separately from other devices. This is similar to other driver
classes like I2C and SPI.

Most drivers previously used CONFIG_KERNEL_INIT_PRIORITY_OBJECTS or
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, therefore the default for this new
option is the lower of the two, which means earlier initialization.

The even lower defaults for STM32 and Arm Beetle are preserved by
SoC-family level overrides.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-19 23:05:25 -04:00
Nicolai Glud
81cdf7a455 drivers: flash: added flexspi hyperflash.
This enables accessing the hyperflash through the flash api.

Added a feature to memc_mcux_flexspi that waits for flexspi bus to be
quiet.

Signed-off-by: Nicolai Glud <nicolai.glud@prevas.dk>
2021-10-19 16:42:12 -05:00
Bartosz Bilas
fd316a5452 drivers: sensor_shell: add missing power sensor channel
There is no power channel within the name array that
is used by e.g INA23X so let's add it to have support
in sensor shell commands.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-10-19 07:15:55 -04:00
Henrik Brix Andersen
d711d224c2 drivers: serial: neorv32: use shared serial driver init priority
Use the shared CONFIG_SERIAL_INIT_PRIORITY for driver initialization
priority.

Override the default value for the NEORV32 SoC to ensure the serial
driver is initialized after the syscon driver by default.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-19 06:44:46 -04:00
Ryan Erickson
d6adbf9d0e modem: hl7800: fix IPv6 socket creation
When creating a socket, be sure to check the address
family and set the correct address family option in
the AT command.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-10-18 17:58:15 -04:00
Andrzej Głąbek
40329881bf soc: nrf52: Add Kconfig option for enabling REG0 DC/DC converter
Add a Kconfig option, similar to the one that is already available
for nRF5340, that allows enabling the REG0 (VDDH) DC/DC converter
in nRF52840. Make use of this option in Nordic boards: nRF52840 DK
and nRF52840 Dongle.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-10-17 11:49:26 -04:00
Josh Hansen
ae4f68c16d drivers: dma: stm32 Fix for STM32F1 SoCs
Not all STM32 parts have at least 5 DMA interrupt vectors for DMA2. In
particular, some STM32F1 XL-density devices only have 4 DMA2 interrupt
vectors, with Channels 4 and 5 sharing the same vector. Added
#if DT_INST_IRQ_HAS_IDX(1, 4) to prevent compiler errors on these SoCs.

Signed-off-by: Josh Hansen <jhansen3141@gmail.com>
2021-10-17 10:58:39 -04:00
Maureen Helm
ad1450510a drivers: serial: Refactor drivers to use shared init priority Kconfig
Refactors all of the serial drivers to use a shared driver class
initialization priority configuration, CONFIG_SERIAL_INIT_PRIORITY, to
allow configuring serial drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The one
exception is uart_lpc11u6x.c which previously used
CONFIG_KERNEL_INIT_PRIORITY_OBJECTS.

This change was motivated by an issue on the frdm_k64f board where the
serial driver was incorrectly initialized before the clock control
driver.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2021-10-17 10:58:09 -04:00
Henrik Brix Andersen
3e70c4fcc9 drivers: gpio: add neorv32 gpio driver
Add GPIO driver for the open-source NEORV32 RISC-V compatible processor
system (SoC).

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-15 09:46:53 -04:00
Henrik Brix Andersen
c6ada02210 drivers: serial: add neorv32 uart driver
Add UART driver for the open-source NEORV32 RISC-V compatible processor
system (SoC).

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-10-15 09:46:53 -04:00
Andrzej Głąbek
56162a48eb drivers: i2c: nrfx: Add implementation of i2c_recover_bus API function
Both nRF I2C drivers (i2c_nrfx_twi and i2c_nrfx_twim) perform the bus
recovery procedure in reaction to timeout (500 ms) of any requested
message transfer. Add implementation of the I2C API recovery function
in both these drivers so that it is also possible to execute this
procedure directly.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-10-15 13:56:20 +02:00
Pavlo Hamov
18f26b843c drivers: wifi: esp32: fix memmory corruption
Size of data pointer for event revival must be at least sizeof
event queue item.
Update to send whole event (id + event)

Signed-off-by: Pavlo Hamov <p.hamov@venstar.com>
2021-10-14 16:35:17 -04:00
Krzysztof Chruscinski
eb3375f47c shell: Add __printf_like to shell_fprintf
Add __printf_like modifier to validate strings used by shell.
Fixing warnings triggered by this change.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-14 16:32:19 -04:00
Andrei Emeltchenko
443143b5ec edac: Make edac_ibecc_init() function static
Make function edac_ibecc_init() static.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-10-14 12:11:09 -04:00
Pavlo Hamov
39d6d0db4e drivers: watchdog: esp32s2 add support
Add support of esp32s2 WDT1 & WDT2 using base esp32 driver

Use dts to determine WDT driver state

Signed-off-by: Pavlo Hamov <p.hamov@venstar.com>
2021-10-13 10:14:35 -04:00
Pavlo Hamov
89e907d4f0 drivers: serial: esp32: Unify serial driver for esp32 & esp32s2
1) Allow use of interrup driven instance.
   ROM implementation could be selected via dts compatiable.

2) Use UART rx fifo and timeout interrupt for end of message detection.
   Added to decrease interrupts count on data reception

3) Use ESP_LL api.

Signed-off-by: Pavlo Hamov <p.hamov@venstar.com>
2021-10-13 10:14:23 -04:00
Krzysztof Chruscinski
2453f16099 drivers: clock_control: nrf: Fix calibration dependencies
When CLOCK_CONTROL_NRF_FORCE_ALT is enabled then calibration is
performed outside of the driver. In that case certain Kconfig
options where present which were dedicated for case when calibration
is performed by the driver. Side effects of those options lead to
conflicts when CLOCK_CONTROL_NRF_FORCE_ALT was enabled. Fixed
those conflicts by introducing Kconfig option which indicates
whether calibration is performed by the driver or not.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-13 06:23:05 -04:00
Luc Viala
a94c2bc78b usb: stm32l5: add configuration to enable HSI48 clock
Add configuration to enable HSI48 clock when using USB from STM32L5
board

Signed-off-by: Luc Viala <luc.viala19@gmail.com>
2021-10-13 06:15:58 -04:00
Huang Qi
a6342b11c6 drivers: display: Fix typo in Kconfig.ssd1306
Model descriptions in Kconfig.ssd1306 should be ssd1306 instead of
ssd16xx, these may be copied from driver for ssd16xx.

Signed-off-by: Huang Qi <no1wudi@qq.com>
2021-10-13 06:14:41 -04:00
Robert Lubos
4e9b9a7fdf drivers: net: loopback: Register loopback IP address to the interface
Regsiter loopback IPv4/IPv6 to the loopback interface during
interface initialization.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-10-13 11:17:51 +02:00
Pavel Hübner
f3dd088a99 drivers: sht3xd: Add names to choices in Kconfig
Unless a choice is named, its default value
cannot be changed in another Kconfig file.

Signed-off-by: Pavel Hübner <pavel.hubner@hardwario.com>
2021-10-12 09:21:08 -05:00
Luis Ubieda
a717820f74 drivers: bmi270: Added inter-write delays required to configure device.
- Per datasheet (Rev 1.0, Page 29): When enabling adv_power_save, there
needs to be a 1ms inter-write registers delay. With this addition, the
driver will work at SCLK frequencies faster than 100kHz.
- Added helper function reg_write_with_delay() to factor these writes.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2021-10-12 08:54:00 -05:00
Siew Chin Lim
0c34373720 drivers: clock_control: Add clock driver for Intel SoC FPGA Agilex
Add clock driver for Intel SoC FPGA Agilex.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
2021-10-12 08:37:03 -04:00
Krzysztof Chruscinski
c590b3545a drivers: serial: Use microseconds to represent timeout
Updated uart_rx_enable() and uart_tx() to use timeout given
in microseconds. Previously argument was given in milliseconds.
However, there are cases when milliseconds granularity is not
enough and can significantly reduce a throughput, e.g. 1ms is
100 bytes at 1Mb.

Updated 4 drivers which implement asynchronous API. Updated
places where API was used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-12 12:26:56 +02:00
Pavel Hübner
7504265e47 drivers: lis2dh: Add names to choices in Kconfig
Unless a choice is named, its default value
cannot be changed in another Kconfig file.

Signed-off-by: Pavel Hübner <pavel.hubner@hardwario.com>
2021-10-11 21:04:09 -04:00
Yuriy Vynnychek
1242f5129d drivers: serial: b91: irq_tx_ready update to check TX IRQ
Updated b91_irq_tx_ready API to check TX IRQ enabled.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-10-11 21:02:21 -04:00
Glauber Maroto Ferreira
7468121f19 esp32s2: drivers: spi: add driver support
and hooks to spi_loopback test.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-10 14:52:41 -04:00
Glauber Maroto Ferreira
26131ba5d4 esp32: drivers: spi: driver refactoring
in preparation to support other esp32-family socs

on top of existing driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-10 14:52:41 -04:00
Glauber Maroto Ferreira
fb1632925e soc: esp32: partial code standardization
Replaces the prefixes of gpio_matrix_in and gpio_matrix_out
to unify those function calls on all supported socs.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-10 14:52:41 -04:00
Andrzej Głąbek
165c14dc60 drivers: pwm_nrfx: Fix handling of zero length periods
When the driver was called to set the period length for a channel
to 0, it set the COUNTERTOP register in the PWM peripheral to 0,
what resulted in an undefined behavior of the peripheral (and lack
of the STOPPED event sometimes).
The PWM API does not precise how should a zero length period be
handled; some drivers return the -EINVAL error in such case, some
do not. This patch fixes the pwm_nrfx driver so that it does not
change the previously used COUNTERTOP register value when the period
length is set to 0, and because the pulse cycles are always limited
by the driver to period cycles (so 0 in this case), in result the
relevant channel is simply deactivated. This allows users to switch
off a channel by requesting the pulse width to be set to 0 without
providing a non-zero period in such call.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-10-08 13:06:40 +02:00
Tim Lin
41c9b71450 ITE: soc: add cpu idle task
Implement the CPU idle task. The system should enter this task when
there is no any task to ensure power saving.

Tested on it8xxx2_evb board. It will reduce 12.5mA when system enters
the CPU idle task.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-10-08 13:01:06 +02:00
Erwan Gouriou
19a40a15b6 drivers/usb: stm32: Deprecate 'enable-pin-remap'
'enable-pin-remap' is deprecated in favor of 'remap-pa11-pa12' from
'st-stm32-pinctrl'.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-07 15:38:53 -04:00
Gerard Marull-Paretas
f3fbff6ecb drivers: pinmux: stm32: remove unused init priority
The device initialization priority is not used, so remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-07 15:38:53 -04:00
Erwan Gouriou
e1b905d6bc drivers: pinmux: stm32: add support for PA11/12 remap.
STM32G0/F0 SoCs allow to remap PA11/12 to PA9/10. Some boards
were manually configuring this remap. This patch centralizes this
functionality to the pinmux driver, allowing boards to enable the
remap directly in board dts file.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-07 15:38:53 -04:00
Erwan Gouriou
1ec41ce922 drivers/clock_control: stm32u5: Fix VCO setting
When existing stop mode 1&2, VCO is set to range 4
and should be set back to range 1 to allow full speed
operations.
Rather than setting VCO at startup, set it inside clock
setting procedure so that it could done
in clock reset procedure when existing stop modes.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-07 15:38:40 -04:00
Erwan Gouriou
dcac61631d drivers/timer: stm32 lptim: Update for u5 series support
Adapt lptim driver implementation to support stm32u5 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-07 15:38:40 -04:00
Jani Hirsimäki
f2859f9501 drivers: wifi: esp_at: changes to scanning
If CONFIG_WIFI_ESP_AT_SCAN_MAC_ADDRESS: mac addr included in
scanning results.
if CONFIG_WIFI_ESP_AT_SCAN_PASSIVE: passive scanning is used instead of
default active scanning.
If CONFIG_WIFI_ESP_AT_SCAN_RESULT_RSSI_ORDERED: scanning response
ordered by RSSI.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2021-10-07 10:55:37 +02:00
Armando Visconti
a2f3ea5d19 drivers/sensor: lsm6dso: Prevent device entering I3C
On LSM6DSO sensor the INT1 pin is used for both generating the drdy
interrupt and for switching to I3C hotjoin mode just after reset if
it is at logical '1' level. It might happen that after a board
reset the logical level '1' is preserved (maybe a level shifter)
forcing the LSM6DSO to enter erroneously in I3C mode, breaking any
attempt to communicate with it. (Fix #38902)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-10-06 22:22:09 -04:00
Marcin Niestroj
87ac114571 drivers: wifi: esp_at: fix connect to open network
According to ESP-AT documentation ([1] for version before 2.0 and [2]
for version 2.1) of AT+CWJAP command, both SSID and PSK are required.
Even for newest ESP-AT release 2.2 ([3]) "," (comma) is needed even if
SSID or PSK are not explicitly provided.

Send 'AT+CWJAP="SSID",""' instead of 'AT+CWJAP="SSID"' when connecting
to open WiFi network, to follow AT commands documentation.

Tested with ESP-AT firmware 2.1.

[1] https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf
[2] https://github.com/espressif/esp-at/blob/release/v2.1.0.0_esp8266/docs/en/AT_Command_Set/Wi-Fi_AT_Commands.md#atcwjapconnects-to-an-ap
[3] https://github.com/espressif/esp-at/blob/release/v2.2.0.0_esp8266/docs/en/AT_Command_Set/Wi-Fi_AT_Commands.rst#refatcwjap-wifi-at-connect-to-an-ap

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-10-06 20:44:34 -04:00
Daniel Leung
ed83474b10 interrupt_controller: remove CONFIG_DW_ICTL_OFFSET
This kconfig is only used for one board and is simply an alias
to another kconfig. So remove CONFIG_DW_ICTL_OFFSET and apply
the value directly to the other kconfig.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-10-06 19:43:48 -04:00
Marcin Niestroj
47e10a6830 drivers: lora: fix RtcGetCalendarTime()
Uptime in milliseconds is assigned to uint32_t variable, which results
in integer overflow after enough time has expired. Additionally
milliseconds part (which should be 0-999) is assigned directly from
uptime, without subtracting full seconds.

Fix both issues by using int64_t variable and calculating milliseconds
with modulo.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-10-05 19:24:58 -04:00
Felipe Neves
ed55ee95e9 boards: riscv: esp32c3: added button support
in samples for esp32c3 devkitm_board using GPIO9

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-05 19:24:38 -04:00
Felipe Neves
9768e98001 drivers: gpio_esp32: added support for esp32c3
in the gpio drivers and pinmux for esp32 chip series

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-05 19:24:38 -04:00
Jordan Yates
29773391c7 spi: convert CS usage to gpio_dt_spec
Convert all CS control logic to be based on the `gpio_dt_spec` member
instead of the standalone `port`, `pin` and `flags` members.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Co-authored-by: Jordan Yates <jordan.yates@data61.csiro.au>
Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
Co-authored-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-10-05 19:24:18 -04:00
Francois Ramu
33e0f1a87a drivers/spi: stm32u5 spi support
Add the specific driver functions for the SPI
of the stm32u5 device.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-05 19:23:37 -04:00
Manojkumar Subramaniam
d79d26f1ae drivers: serial: stm32: renable IT RXNE as part of graceful disable
async_rx_disable does not re-anable RXNE interrupt, it was disabled
during async_rx_enable

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2021-10-05 19:19:16 -04:00
Igor Knippenberg
bd7b7a6423 drivers: sensors: fdc2x1x: removed unused fdc2x1x_data
Removing two unused "struct fdc2x1x_data" to fix warnings
when compiling with PM_DEVICE=y.

Signed-off-by: Igor Knippenberg <igor.knippenberg@gmail.com>
2021-10-05 13:13:46 -04:00
Evgeniy Paltsev
6807e02655 ARC: IRQ: drop excessive PM_DEVICE hooks
All ARC CPUs (supported by Zephyr) don't lose core interrupt
controller configuration after switching to sleep mode / modes,
so we don't need to save & restore it's configuration with PM.

This PM code most likely was added for Arduino 101 (Genuino 101)
board which isn't supported by Zephyr anymore - so we can drop
it.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-05 07:48:47 -04:00
Evgeniy Paltsev
e1455fafdf ARC: IRQ: drop unused _VectorTable declaration
We don't use '_VectorTable' in the driver, so let's drop it's
declaration.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-05 07:48:47 -04:00
Daniel Leung
ef0d955758 uart: ns16550: add workaround to re-enable interrupts in ISR
In some configurations (e.g. edge interrupt triggers),
an interruptible event occurs during ISR and the host interrupt
controller does not see the new event due to IIR is constantly
asserting interrupts. For example, the callback handles RX and
then TX. If another character comes in before end of TX processing
(TX interrupt still asserts while raising RX interrupt), the host
interrupt controller may not see this new event. So if needed,
the IER is being toggled to re-assert interrupts at the end of ISR
to nudge the host interrupt controller to fire the ISR again.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-10-04 20:49:13 -04:00
Krzysztof Chruscinski
cf3dabedaf drivers: gpio: nrf: Remove CONFIG_GPIO_NRF_P0 and CONFIG_GPIO_NRF_P1
Remove Kconfig options for enabling device instances in favor of
taking that information only from device tree. Prior to that
change there was a mix of devicetree and Kconfig.

Bring back use of CONFIG_GPIO_NRF_INIT_PRIORITY.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-10-04 20:48:20 -04:00
Bartosz Bilas
d6792dd7be drivers: gsm_ppp: introduce modem on/off callbacks
Allow the user to register function callbacks that
are executed during gsm modem configuring and stopping.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2021-10-04 20:46:04 -04:00
Tim Lin
213c0c43e6 ITE: soc: pull-down GPIO L/K groups and set GPIOH7 output low at default
GPIO L/K groups:
On IT81202 (128-pins package), the pins of GPIO group K and L aren't
bonding with pad. So we configure these pins as internal pull-down
at default to prevent leakage current due to floating.

GPIOH7:
On IT81202/IT81302, the GPIOH7 isn't bonding with pad and is left
floating internally. We need to enable internal pull-down for the pin
to prevent leakage current, but IT81202/IT81302 doesn't have the
capability to pull it down. We can only set it as output low,
so we enable output low for it at initialization to prevent leakage.

After setting: power saving=2.26mA

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-10-04 20:41:37 -04:00
Kevin Townsend
21321fba1c drivers: sensor: lsm303dlhc_mag: Fix gain factor
The magnetometer on the LSM303DLHC has a different gain conversion
factor for LSB to Gauss for the Z axis than it does for X, Y. This
commit takes into account the different conversion factors, and
adds the correct coefficients for each gain setting and axis.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
2021-10-04 20:40:43 -04:00
Francois Ramu
1ebd6b579e driver: clock: stm32 clock control supports ahb_prescaler
This constraint on the AHB prescaler is removed.
The ahb-prescaler is allow from 1-512.
For stm32 common and stm32U5 devices.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-04 20:37:09 -04:00
Gerard Marull-Paretas
f371ae3cc5 drivers: pinmux: stm32: remove pre-DT API
Remove APIs used in the pre-DT era. In case manual access is required,
`stm32_dt_pinctrl_configure` can still be used as a shortcut with data
initialized in the expected format.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-10-04 20:36:17 -04:00
Tim Lin
15106009c5 ITE: drivers/i2c: returning negative values for error
Fixes: #38959

Currently, the I2C driver returns I2C status register value as error
code when error happen. This PR fixes returning system number and
the return values is negative for error.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-10-04 12:53:50 -04:00
Francois Ramu
e763061876 drivers: pinmux stm32F1 remap IP without changing the SWJ_CFG
Change the REMAP bits of the AFIO_MAPR of the stm32F1x soc
with local MACRO without changing the SWJ_CFG (write-only bits).
The serial wire JTAG configuration is taken from the Z_AFIO_REMAP
(value of the CONFIG_GPIO_STM32_SWJ_xxx))
and not read from the MAPR register.
It accesses to the MAPR register directly instead of LL functions.
Note that Remapping on the MAPR2 is not to change.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-10-04 11:44:22 -04:00
Erwan Gouriou
6b0199ac7d drivers/timers: stm32_lptim: Set LSI as default LPTIM clck source
Timer STM32 LPTIM currently supports 2 clocks sources: LSE & LSI.
LSE (external) is defined as default but its availability depends
on board support package and then may not be available.

This ends up in situations where users have LSE implicitly selected
while no crystal is available on board, leading to non functional
LPTIM.

To avoid this situation, makes LSI clock, which is always available
(since internal to the SoC), the default LPTIM source clock.
Then, default case will be functional. Users will then be able to
select LSE if needed.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-10-04 08:24:03 -04:00
Flavio Ceolin
d55c9b6d54 console: uart: Don't re-define functions as macros
Some functions were being re-defined as macros if certain conditions
were not met.

Fix violations to rule 5.5

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-02 14:34:14 -04:00
Flavio Ceolin
419fabdad0 console: uart: Remove unnecessary macro
console_input_init is only used in the same scope it is implemented.
There is not need to have it defined elsewhere.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-10-02 14:34:14 -04:00
Felipe Neves
949a6a8e53 interrupt-controller: intc_esp32c3: make logs optional
Allowing cleaner debug experience and preventing unwanted
outputs during debug.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-02 14:33:24 -04:00
Felipe Neves
16be75b68f dts: added dts binding for esp32c3
interrupt controller, also places its relevant
peripheral sources allowing drivers to use the
DT macros instead of espressif headers.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-02 14:33:24 -04:00
Felipe Neves
b97c2da2f2 interrupt_controller: intc_esp32c3: added intc driver
For esp32c3 and replaces the hardcoded interrupt
attaching procedures with this new driver.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-10-02 14:33:24 -04:00
Sjors Hettinga
7f9b4d807c drivers: modem: Fix reference to stack in modem_context_sprint_ip_addr
Changes the modem_context_sprint_ip addr to write into a provided
buffer. This approach fixes a referencing to a non existing stack
variable, without using a lot of stack space.
Tested using the by building all used modems and tested on HW using
IPv4.

Fixes: #38459

Signed-off-by: Sjors Hettinga <s.a.hettinga@gmail.com>
2021-10-01 11:06:32 -04:00
Glauber Maroto Ferreira
c7ce4b2016 esp32s2: drivers: entropy: add support
also needed for wifi driver support.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-01 10:51:37 -04:00
Eduardo Montoya
f397e9b6c2 drivers: nrf5: fixes for the CSL Receiver
Introduce fixes for making the CSL Receiver to properly schedule
the reception window.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-10-01 11:37:38 +02:00
Sylvio Alves
69311ccc3d soc: esp32: update clock configuration calls
Removed duplicated calls in clock subsystems.
Move proper includes to soc specific.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-09-30 21:42:20 -04:00
Christopher Friedt
c4ecd78ce1 Revert "drivers: spi: stm32 can support TI mode for the SPI frame format"
This reverts commit d563313ab1.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-09-30 16:04:37 -04:00
Felipe Neves
d4ed7f69d4 drivers: entropy: esp32: enable rng driver
for esp32c3 allowing wifi subsystem to use inside
its driver.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-09-30 06:39:55 -04:00
Francois Ramu
d563313ab1 drivers: spi: stm32 can support TI mode for the SPI frame format
Depending of the soc and SPI peripheral, the Frame-Format of the
SPI can be configured to support TI or Motorola protocol.
This is configured through a new DTS property.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-09-29 14:47:31 -04:00
Andrzej Głąbek
5473b22275 drivers: i2s_nrfx: Fix a few minor fixes
- correct the names of buffers used by message queues so that it
  is possible to have multiple instances of the driver (in case
  such need appears in the future)
- make `stop` and `discard_rx` normal structure members, not bit
  fields, as they are modified in the interrupt handler and that
  could lead to overwriting of other bit fields located in the
  same memory unit
- add a log message providing the actual frame clock (WS) frequency
  (i.e. PCM rate) that the driver was able to configure (due to
  hardware limitations, it is not always possible to achieve the
  exact requested frequency and the driver selects the closest one
  available, so make it more visible to users

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-29 14:46:29 -04:00
Andrzej Głąbek
953f35f130 drivers: i2s_nrfx: Do not enforce two channels for I2S format
Remove unnecessary condition that effectively limits the usability
of the I2S format to two channels mode only.
Although the description of the `i2s_config` structure contains
a remark that for the I2S format the specified number of channels
is ignored and always two are used, in fact only one other in-tree
driver (i2s_sam_ssc) applies such limitation.
The nRF I2S hardware has no problem with handling the I2S format
with audio data for only one channel, so there is no need for having
this limitation in the driver, and without such mode of operation of
the driver it is impossible to feed it with PCM data directly from
the PDM peripheral working in one channel mode.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-29 14:46:29 -04:00
Pieter De Gendt
4e2bb0e762 drivers: hwinfo: add reset cause support for iMX RT series
Add a shim driver to get/clear the reset reason on NXP i.MX
RT controllers

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-09-29 14:44:21 -04:00
Robert Lubos
0dbdcc770d net: sockets: Add socket processing priority
When creating a socket, all of the registered socket implementation are
processed in a sequence, allowing to find appropriate socket
implementation for specified family/type/protocol. So far however,
the order of processing was not clearly defined, leaving ambiguity if
multiple implmentations supported the same set of parameters.

Fix this, by registering socket priority along with implementation. This
makes the processing order of particular socket implementations
explicit, giving more flexibility to the user, for example when it's
neeed to prioritze one implementation over another if they support the
same set of parameters.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-28 20:11:26 -04:00
Dawid Niedzwiecki
1031cfd51e drivers: serial: ns16550: fill full fifo
Put the maximum number of bytes into Tx FIFO in the fill_fifo routine
to reduce CPU usage.

Previously, the THRE bit was checked in a loop, but, according to doc -
"In the FIFO mode, it is set when the XMIT FIFO is empty, and is
cleared when at least one byte is written to XMIT FIFO.", so only one
byte was transferred every interrupt. That was generating a big amount
of interrupts, which consumes CPU time.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-09-28 20:10:00 -04:00
Markus Fuchs
a283cb3311 drivers: Update drivers to use new multicast monitor API
Update drivers regarding latest multicast group join/leave monitor
changes which now supports both IPv6 and IPv4 multicast addresses.

Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
2021-09-28 20:04:49 -04:00
Alex Sergeev
851cccb67e drivers: ethernet: mcux: generalize gPTP code to support PTP L2
Update eth_mcux.c to use CONFIG_NET_L2_PTP instead of CONFIG_NET_GPTP.

Signed-off-by: Alex Sergeev <asergeev@carbonrobotics.com>
2021-09-28 20:01:16 -04:00
Gerard Marull-Paretas
222a21dd72 drivers: pinmux: stm32: use DEVICE_DT_GET_OR_NULL
Use existing Devicetree macro to obtain optional references to GPIO
ports.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-28 20:00:00 -04:00
Ruibin Chang
d16ae76d30 ITE drivers/kscan: add keyboard scan driver for it8xxx2_evb
Add keyboard scan driver for board it8xxx2_evb.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-09-28 19:53:15 -04:00
Dennis Ruffer
fe1b167760 gpio: shell: Change shell *shell to shell *sh
To fix MISRA Rule 5.7 violation

Signed-off-by: Dennis Ruffer <daruffer@gmail.com>
2021-09-28 19:51:33 -04:00
Dennis Ruffer
95bab86051 gpio: shell: Use macro SHELL_CMD_ARG to check parameters count
The args_number and args_no structures could be removed
But other parameter checks we still preserved.

Signed-off-by: Dennis Ruffer <daruffer@gmail.com>
2021-09-28 19:51:33 -04:00
Dennis Ruffer
9b3dfe7443 gpio: shell: Replace gpio listen with blink
This is a frequently used command during hardware bringup
The listen command was not actually implemented
Also uncrustified and check_compliance.py

Signed-off-by: Dennis Ruffer <daruffer@gmail.com>
2021-09-28 19:51:33 -04:00
Neil Armstrong
a737999b5b interrupt_controller: gicv3: add Interrupt Translation Service support
This implements support for the optional Interrupt Translation Service
(ITS) module of the GICv3 Interrupt Controller.

The current implementation is designed for MSI/MSI-X interrupt delivery
in mind.
The gicv3 driver calls each ITS INVALL command when LPI interrupts are
enabled/disabled.
A simple atomic integer is used to allocate unique LPI INTIDs to ITS
users.
CPUs numbers are directly mapped as ICIDs into the Collections Table.

As a limitation it doesn't support indirect Device table to simplify
implementation but may use a large amount of memory.

INV, DISCARD, MOVI and MOVALL commands are not implemented.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-28 19:45:29 -04:00
Neil Armstrong
e819bd8f34 interrupt_controller: gicv3: add support for LPIs
The LPI (Locality-specific Peripheral Interrupts) are edge-triggered
message-based interrupts that can use an Interrupt Translation
Service (ITS) to route an interrupt to a specific Redistributor and
connected PE.

This implement the necessary LPI support when an ITS is enabled.

The LPI states are stored in memory-backed tables.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-28 19:45:29 -04:00
Jonathan Hahn
c9f87969c2 drivers: sensor: add I3G4250D Gyro driver
Implements a shim layer driver using st hal for
I3G4250D gyro, mounted for example on stm32f3_disco_E.
No support for triggers included yet.

Signed-off-by: Jonathan Hahn <Jonathan.Hahn@t-online.de>
2021-09-28 19:44:26 -04:00
Carlo Caione
d5556cafed arm_arch_timer: Fix ticks count on !CONFIG_TICKLESS_KERNEL
When SMP is enabled all the cores are announcing a tick and this is
causing too many ticks to be announced. Announce the tick even if this
is zero.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-09-28 19:40:01 -04:00
Torsten Rasmussen
34e346de14 Revert "drivers: pinmux: build as static library"
This reverts commit 43309296b8.

Fixes: #38403

The referred commit introduced `zephyr_library()` for pinmux drivers but
also resulting in #38403 because several boards has `CONFIG_PINMUX=y`
without selecting any pinmux drivers from `drivers/pinmux` thus
generating the following warning:
> No SOURCES given to Zephyr library: drivers__pinmux
>
> Excluding target from build.

This commit reverts the changes so that this warning disappears.
This results in pinmux drivers from `drivers/pinmux` to be located in
libzephyr.a which is messy, but has been so for a long time, even before
Zephyr 1.14 LTS.

The future pinctrl API will be designed in such a way that this problem
will not occur. Thus the old behavior is acceptable until the transition
to pinctrl API has completed.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 14:33:16 +02:00
Erwan Gouriou
5c23fa9f9d drivers/gpio: stm32f1: AFIO init should happen before GPIO inits
GPIO initialization was moved to PRE_KERNEL_1 with commit
590162a5cc06c72b70dee93f410b878bc0935f1f.
This had the consequence of having AFIO init done after GPIO init
as a consequence, this sequence ends up with AFIO clock disabled,
and hence negative impact on AFIO expected services.

Additionally, to save some flash, compile out afio init when not
required.

Fixes #38870

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-28 06:19:08 -04:00
Torsten Rasmussen
d800b4a4d7 drivers: gpio: remove unused GPIO selection
Fixes: #38403

Removing unneeded `imply GPIO` and `CONFIG_GPIO=y` occurrences where no
files are added to the gpio zephyr library.

Also removed `CONFIG_GPIO=y` occurences where this is handled by
defconfigs for the soc or board.

Selection of GPIO without selecting any drivers results in the warning:

> No SOURCES given to Zephyr library: drivers__gpio
>
> Excluding target from build.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 12:13:23 +02:00
Torsten Rasmussen
e8eb8a8c2c drivers: ethernet: remove dedicated drivers__ethernet__native_posix lib
Fixes: #38403

The two eth_native_posix.c and eth_native_posix_adapt.c are now added
to the common drivers__ethernet Zephyr library.

Instead of creating a dedicated library for just two files those files
are now added to the common ethernet library, see also #8826.
Instead, the dedicated compile definitions required for those files are
specified using COMPILE_DEFINITIONS on the source files.

This also avoids the following warning as the ethernet library is no
longer empty.

> No SOURCES given to Zephyr library: drivers__ethernet
>
> Excluding target from build.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 12:13:23 +02:00
Torsten Rasmussen
8e64038559 drivers: net: adding NET_DRIVERS menuconfig
Fixes: #38403

Adding NET_DRIVERS menuconfig so that network drivers are grouped
together in its own menu entry under drivers, similar to most other
drivers.

This further has the advantages that `CONFIG_NET_DRIVERS` can be used
for testing to determine if network drivers has been selected.

This changed revealed a dependency loop where both `select` (for SLIP)
and `depends` (for PPP) which both depends on NET_DRIVERS` where in use
in the dependency tree for Qemu networking, especially NET_SLIP_TAP.

This is handled by defaulting `NET_DRIVERS` to `y` when building for a
Qemu target.
`SLIP` had a dependency to `!QEMU_TARGET || NET_QEMU_SLIP`. This is
changed so that SLIP prompt depends on `!QEMU_TARGET` which provides
full user control in hardware but makes the symbol promptless on Qemu
targets.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 12:13:23 +02:00
Torsten Rasmussen
6ebe0b8425 drivers: create BT_DRIVERS Kconfig entry
Fixes: #38403

Changing Bluetooth drivers from being a menu into a menuconfig.
This aligns the Bluetooth driver configuration with other driver
configurations as well as provides a setting which identifies if
Bluetooth drivers has been enable.

This further helps to avoid empty Zephyr libraries for bluetooth
samples.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 12:13:23 +02:00
Francois Ramu
acad37196d drivers: adc: stm32 adc disable causing endless loop
Setting Oversampling also applies on stm32L5 but disabling
the ADC will cause endless loop except for the stm32L0 serie.
Errata applies only on stm32G0 soc series when
writing ADC_CFGR1 register.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-09-28 06:12:47 -04:00
Steven Lemaire
cc5f769436 drivers: serial: gecko: add hw flow control support for EFR32 Series 2
Add hardware flow control support for the EFR32MG21 and other modules
using GPIO_USART_ROUTEEN_RTSPEN (and GPIO_USART_ROUTEEN_CTSEN) instead
of the Kconfig SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION.

The driver already contained the section settings the RTS and CTS pins
for modules using the GPIO_USART_ROUTEEN_(RTS|CTS)PEN define, but it was
not compiling because of an #ifdef checking only for
CONFIG_SOC_GECKO_HAS_INDIVIDUAL_PIN_LOCATION and not both.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2021-09-28 11:39:02 +02:00
Dino Li
29d039335f cleanup: soc: it8xxx2: remove unnecessary code
Code removed:
- IT8XXX2 doesn't support soc level software interrupt hence remove
  them.
- To use common macro to access csr (control status register).
- To remove CONFIG_RISCV_HAS_PLIC related code. IT8XXX2 uses its own
  interrupt controller code.
- To remove ite_write and ite_read. We don't use them anymore.

Code changed:
- Return true from arch_irq_is_enabled() when external interrupt-enable
  bit, and SOC's IER are both true.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-09-28 11:36:23 +02:00
Glauber Maroto Ferreira
e605efc698 esp32s2: drivers: clock_control: add support
add clock control driver support for esp32s2 SoC.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-09-27 22:02:08 -04:00
Glauber Maroto Ferreira
d15d3de5fc esp32: drivers: clock_control: code refactoring
code refactoring.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-09-27 22:02:08 -04:00
Christoffer Zakrisson
2ec4986d57 drivers: i2c: sam0: Continue write/read if next message allows it
Update sam0 i2c driver to directly send/receive next message if it is
in the same direction and the current message has no stop or restart
flags. Seems like in some drivers this is the expected behaviour.

Fixes #36857

Signed-off-by: Christoffer Zakrisson <rustypig91@gmail.com>
2021-09-27 10:13:19 -04:00
Gerard Marull-Paretas
f647a5c8ec drivers: display: st7789v: remove incorrect error check
The st7789v_transmit function does not return any error code (void), so
ret = st7789v_transmit(...) is wrong.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-27 08:24:21 -04:00
Xabier Marquiegui
3566cf11ba drivers: eth: e1000: only enable e1000 clock on e1000 configured
e1000 clock should only be enabled by default if e1000 driver is
configured

Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2021-09-24 17:05:11 -04:00
Steven Lemaire
2aa0bb2422 drivers: i2c: gecko: fix typo of the BUILD_ASSERT
In the macro I2C_VALIDATE_LOC, there was a typo preventing the
compilation.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2021-09-24 14:08:42 -04:00
Ryan Erickson
1715e39414 modem: hl7800: separate IO interrupt config
The interrupt config flags for an IO should be separate
from the standard IO configs because the interrupt config
is a separate API.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-24 11:30:37 -04:00
Krzysztof Chruscinski
8e66894d4e drivers: regulator: Fix k_work_schedule return code handling
k_work_schedule may return other non-negative value than 0.
When driver was adapted to the new k_work API that was not
taken into account.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-24 06:36:50 -04:00
Yong Cong Sin
6083b89553 drivers: modem: gsm_ppp: Add support for Quectel modems
Add support for Quectel modem in gsm_ppp modem driver.

The CMUX cmd is based on MUX application notes v1.0(2020-09-22)
for BG95, BG77 and BG600L. Tested and working on EC21e.

As the gsm_ppp doesn't do power control, it is required to power
on the modem manually in the application.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-23 08:40:10 -04:00
Andrzej Głąbek
36451e6b54 drivers: spi_nrfx_spi: Change the way the nrfx driver is configured
Apply the same changes as the previous commit made in the spi_nrfx_spim
shim, to keep these two shims aligned.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-23 08:39:37 -04:00
Andrzej Głąbek
2a199afac3 drivers: spi_nrfx_spim: Change the way the nrfx driver is configured
According to the nRF5340 PS, for 32 Mbps high-speed SPI using SPIM4,
drive configuration H0H1 must be used. The underlying nrfx_spim driver
does it properly in its initialization function, so change the shim to
(re)initialize the driver when the SPI configuration is to be changed
(only then the speed to use is known), to avoid the need of duplicating
the corresponding code in the shim itself.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-23 08:39:37 -04:00
Andrzej Głąbek
5f1581bb05 drivers: spi_nrfx_spim: Fix limiting of SPIM frequency on nRF5340
According to the nRF5340 PS, SPIM4 only supports 32 Mbps when
the application core is running at 128 MHz. This patch adds
the corresponding check.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-23 08:39:37 -04:00
Ryan Erickson
e1eb55d7f7 modem: hl7800: sync APN for PDN and GPRS connection
Ensure the GPRS connection APN settings match the PDP
context. This it best to ensure proper IP connectivity.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-23 04:15:55 -04:00
Ryan Erickson
bd24fba6c4 modem: hl7800: ensure IP family set correctly
Ensure that the IP family is synchronized between the PDP
context and the GPRS connection.
There were cases where they could get out of sync.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-23 04:15:55 -04:00
Ryan Erickson
e8e9d83ab7 modem: hl7800: Add address family config
Add ability to set the IP address family with Kconfig.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-23 04:15:55 -04:00
Ryan Erickson
3fb82291d2 modem: hl7800: Fix IPv6 operation
Assign the IPv6 address from the LTE network to the
network iface.
Configure DNS resolver with IPv6 DNS address from the
LTE network.
Fix socket AT commands to account for IPv6 addresses.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-23 04:15:55 -04:00
Ryan Erickson
a28a20b50f modem: hl7800: Only reconfig DNS if iface up
In the DNS work callback ensure the iface is up
(on the LTE network) before trying to reconfigure the
DNS resolver with the DNS address.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-23 04:15:55 -04:00
Fabio Baltieri
23fbb19ed5 drivers: sx126x_stm32wl: clear the radio IRQ before reenabling it
The stm32wl version of the sx126x driver disables the NVIC interrupt in
the radio isr to prevent retriggering while the event gets handled in
the workqueue. Since the interrupt condition is still present while the
line is disabled, the interrupt pending bit remains set in the NVIC, so
after the handler finished, when irq_enable() gets called, the interrupt
fires immediately again with no status bit set in the radio registers.

Apart from the no-op interrupt, this has the side effect of bringing
the radio out of sleep as soon as the interrupt bit are read and
cleared, which increases the idle state power consumption.

Adding a NVIC_ClearPendingIRQ() before irq_enable() seems to fix the
problem. It should not cause any issue with missing interrupt events, as
if there are pending bit on the Radio, the NVIC pending bit would be
re-set immediately.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-09-22 21:10:05 -05:00
Yuval Peress
a1f6d97978 drivers: syscon: Add support for multiple regions
1. Add support for multiple syscon entries (as a side effect, this also
   fixed syscon.c implementations which weren't being linked to their
   syscon.h counterparts).
2. Add support for different width registers in syscon.
3. Add tests for syscon

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-09-22 10:32:11 -04:00
Ryan Erickson
7cf0a5c4a1 modem: hl7800: fix gpio with interrupts init
Need to use gpio_pin_interrupt_configure for any IO
that uses interrupts.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-22 06:36:11 -04:00
David Leach
3ea7fbc662 display: st77xx: Move initialization to POST_KERNEL
These are the only two display drivers initializing in APPLICATION.
Dependency exposed with LVGL with initialization at same level and
priority.

Fixes #38690

Signed-off-by: David Leach <david.leach@nxp.com>
2021-09-21 19:42:36 -04:00
Flavio Ceolin
80681d2984 stm32: gpio: Fix device runtime pm
When CONFIG_PM_DEVICE_RUNTIME is enabled, if a pin is configure as
input after an output pin has already being configured the device is
wrongly suspended.

Fixes #38433

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-09-21 11:38:06 -04:00
Erwan Gouriou
79ff645390 drivers/uart: stm32: Simplify code around pm_constraints handling
Now that we're clearer around pm constraints management in various
TX cases (poll streams, irq driven or async), make some code
simplifications to ease readability.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-21 10:47:56 -04:00
Erwan Gouriou
a3de3df5dc drivers/uart: stm32: Fix pm_constraint handling
Introduce new logic to set/release pm_constraint during serial TX
transactions.

First change is to introduce an internal flag and utility functions
to control the set/release constraint balancing per uart device.
This way, whatever the mix of transactions or API calls, we
ensure a single uart device can only do 1 or 0 to the PM state
constraint. Constraint can't then be set more than once, released w/o
having been set or released more than it was set.

The last part of the change reworks the triggers for constraints
set/release operations.
In order not to disturb driver operations, if irq driven mode or PM is
enabled, don't enable TC interrupt handling by default.
Instead, map the pm_constraint setting to the way TC flag is handled
in normal mode of operations (irq driven or async).
As a consequence, in irq driven mode, pm_constraint is set/released on
tx_enable/tx_disable api calls, which gives API user full control
on transaction protection vs low power operations.
Finally, we emulate the same behavior on TX poll transaction, by
enabling TC irq at the start of a stream and disabling TC irq once
stream is completed. This is controlled with a dedicated device flag.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-21 10:47:56 -04:00
Andrzej Głąbek
5601805695 drivers: i2c_nrfx_twim: Add handling of buffers located in flash
TWIM peripherals cannot perform write transactions from buffers
located in flash. The content of such buffers needs to be copied
to RAM before the actual transfer can be requested.
This commits adds a new property (zephyr,flash-buf-max-size) that
informs the driver how much space in RAM needs to be reserved for
such copying and adds proper handling of buffers located in flash.
This fixes an issue that caused that e.g. the DPS310 sensor driver
did not work on nRF SoCs that only have TWIM, not TWI peripherals.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-21 13:44:06 +02:00
Andrzej Głąbek
99ce264df7 drivers: i2c_nrfx_twim: Use concatenation buffer by default
Issue an error logging message when the i2c_nrfx_twim driver lacks
a concatenation buffer big enough to properly handle a call to
i2c_burst_write() function, to give the user a hint what is wrong.

Also use by default a 16-bytes long concatenation buffer for every
instance of the i2c_nrfx_twim driver. Such value should cover most
of the simple uses of the i2c_burst_write() function, like those
in the stmemsc sensor drivers, and when a longer buffer is needed,
the user will be provided with the above message pointing to the
property that should be adjusted.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-21 13:44:06 +02:00
Berend Ozceri
357ec64b36 drivers: timer: Fix RISC-V machine timer count drift due integer math
If CYC_PER_TICK does not divide the (now - last_count) quantity exactly with integer math, the subsequent multiplication before incrementing last_count causes a drift. This commit eliminates the redundant division-followed-by-multiplication and fixes https://github.com/zephyrproject-rtos/zephyr/issues/37852

Signed-off-by: Berend Ozceri <berend@recogni.com>
2021-09-20 19:50:40 -04:00
Ryan Erickson
42075342a8 modem: hl7800: fix PSM
Fix power-save-mode (PSM) operation.
When in PSM, do not bring the networking interface down
when an out-of-coverage event occurs.
When PSM goes into hibernate, this will cause an
out-of-coverage event to occur, even though the device
still has access to service.
Keeping the networking interface in the up state
allows an app to send data whenever it needs to.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-20 12:24:40 -04:00
Ryan Erickson
38c8d4729f modem: hl7800: remove DTR control
Using DTR to control sleep modes is a legacy mode
of operation. Remove control of DTR IO.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-20 12:24:40 -04:00
Ryan Erickson
982c072221 modem: hl7800: change sleep mode
Sleep mode 0 (driven by DTR) is only recommended for use
as a legacy option.
Sleep mode 1 is recommend by Sierra Wireless.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-20 12:24:40 -04:00
Julien D'ascenzio
ca7899afa9 drivers: spi: stm32: Fix forever lock when configure failed
On transceive, if the SPI configure failed, the SPI wasn't release.

Signed-off-by: Julien D'ascenzio <julien.dascenzio@paratronic.fr>
2021-09-20 10:17:56 -04:00
Ron Smith
683dbc4573 drivers: serial: uart_sam0: Fix async tx done event triggering to early.
uart_sam0_dma_tx_done callback triggers when the last byte
is transferred from the tx sram buffer to the sercom DATA register.
However the byte has yet to be transmitted completely which can lead to
incorrect event handling if UART_TX_DONE is expected to signal
the end of transmission.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-09-19 19:31:25 -04:00
Ron Smith
a0d92453d8 drivers: serial: uart_sam0: move err_check methodout of if guard
Fixes a compile error for the err_check function not being found if
if CONFIG_UART_INTERRUPT_DRIVEN is not enabled.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-09-19 19:31:25 -04:00
Ron Smith
4f9ac180b4 drivers: dma: dma_sam0: change sam0 DMA to higher priority init.
fixes peripheral drivers such as async uart that rely on dma being
ready failing because dma is not initialized yet.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-09-19 19:31:25 -04:00
Francois Ramu
97c031822b drivers: adc: stm32 disable the ADC before setting the Oversampling
On those STM32 series, setting of this feature is conditioned to
the ADC state: it is allowed to set/reset the oversampler (OVSE bit)
and set the Oversampling ratio (OVSR bits) in the ADC_CFGR2 register
only when ADC is disabled or enabled without conversion on going.
Then is the ADC re-enabled.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-09-18 09:02:31 -04:00
Francois Ramu
572ab24241 drivers: adc: stm32 disable the ADC before setting the Resolution
On those STM32 series, setting of this feature is conditioned to
the ADC state: it is allowed to write the Data resolution (RES bits)
in the ADC_CFGR1 register only when ADC is disabled (ADEN=0).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-09-18 09:02:31 -04:00
Vinayak Kariappa Chettimada
19fe102862 Bluetooth: Controller: Propagate ticks_drift in the ticker callback
The ticker `ticks_drift` is propagated via the ticker
elapsed callback, in order to provide necessary information
to correctly calculate total elapsed durations by states and
roles that use ticker extensions to mitigate scheduling
collisions by drifting within a permitted window.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-17 14:30:07 +02:00
Mahesh Mahadevan
a90c4c38a1 drivers: disk: Fix USDHC driver to return 0 on success
The function usdhc_board_access_init was returning a non-zero
value as the variable "ret" is also used to store the GPIO
level for card-detect.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-09-17 08:12:22 -04:00
David Leach
fb5192656a drivers: eth: mcux: Fix PTP clock init priority dependency
The net_core device initialization has a subtle dependency
on the PTP clock initialization. Adding a Kconfig and set
it to a priority level less than net_core. This will ensure
the initialization sequence.

Fixes #38571

Signed-off-by: David Leach <david.leach@nxp.com>
2021-09-17 10:56:35 +02:00
Xavier Chapron
f83bb02cbf drivers: modem: sara-r4: Replace snprintf calls by snprintk
Snprintf calls should be avoid when not necessary, instead snprintk
should be used as it offers the same functionnalities at a lower cost
in flash.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2021-09-16 09:33:28 -04:00
Yong Cong Sin
495f6b7ccc drivers: modem: bg9x: Fix unused configs
Fix Kconfig so that unused configs won't be compiled.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-15 11:30:03 -04:00
Tomasz Bursztyka
d8484e2ea5 drivers/ivshmem: MSI API change was not applied in this drivers
commit id ec2b9d42af missed that ivshmem
uses pcie_msi_enable as well, thus fixing it now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-09-15 13:42:22 +03:00
Gerard Marull-Paretas
a7f13755ed drivers: serial: stm32: remove unnecessary flag clear
According to reference manual, use of TC is "to avoid corrupting the
last transmission when the USART is disabled or enters Halt mode.". It
is safe to remove it since it is not checked when CONFIG_PM=n.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-13 17:53:19 -04:00
Gerard Marull-Paretas
e3f4907efe drivers: serial: stm32: use PM constraints to prevent suspension
In the current implementation the STM32 UART driver required to enable
`CONFIG_PM_DEVICE` when `CONFIG_PM=y` to function properly. The main
reason is that in some situations, like in polling mode, transmissions
are not fully synchronous. That is, a byte is pushed to the _queue_ if
it is empty and then the function returns without waiting for it to be
transmitted to the wire. This makes sense to make things like per-byte
transmission efficient. However, this introduces a problem: the system
may reach idle state, and so enter low power modes before the UART has
actually finished the last data in the queue. If this happens,
communications can be interrupted or garbage data may be put into the
UART line.

The proposed solution in this patch uses PM constraints to solve this
problem. For the IRQ/DMA case it is easy since we can set the constraint
before transmission start, and when the completion (TC) interrupt is
received we can clear it. However, the polling mode did not have the
capability to signal the completion. For this case, a simpler IRQ
routine is provided to just release the constraint. As a result, the PM
hooks are not required and so system can operate with just `CONFIG_PM`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-13 17:53:19 -04:00
Dawid Niedzwiecki
3e696a0f84 drivers: serial: ns16550: fix uart initialization
Do not set DLAB bit in Line Control Register when the access to
the baud rate divisor registers is not needed.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-09-13 07:06:33 -04:00
Nick Ward
ecbfc1172a drivers: watchdog: fix missing stm32 LOG_LEVEL macro
Without this a user can't enable logging for the STM32 wdt driver.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2021-09-10 10:57:57 -04:00
Yong Cong Sin
293af9e823 drivers: modem: gsm_ppp: Fix ppp_dev
ppp_dev should be pointing to the net/ppp driver.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-09-08 10:49:45 -04:00
Bartosz Bilas
6badb7f1b8 drivers: sensors: sht3xd: allow multiple instances
Make this driver multi-instance.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-09-08 09:49:34 -04:00
Andy Ross
795d36f811 drivers/timer/cavs_timer: Don't suppress smp_timer_init()
This function wasn't being defined when SMP_BOOT_DELAY was set or when
SMP wasn't enabled.  There's no reason for either, then function
doesn't depend on any kconfig-dependent build-time state, and (given
that we use -ffunction-sections) it won't appear in output binaries
unless called.

And there are use cases (e.g. z_smp_start_cpu()) where we need that
function even when BOOT_DELAY is enabled.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-07 14:23:31 -04:00
Francois Ramu
5199e1bfa9 drivers: clock control stm32wb has MSI clock range to set
When the MSI clock is selected as source on the stm32wbx device,
the MSI has a range to choose the MSI input frequency.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-09-07 11:31:56 -04:00
Jiafei Pan
6f1dc5d3a9 drivers: gicv3: set SPI's affinity when it is enabled
When affinity routing is enabled for Non-secure state
( GICD_CTLR.ARE_NS is '1'), need to set routing information
for the SPI interrupt.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2021-09-07 11:31:22 -04:00
Gerard Marull-Paretas
051e9989bb drivers: pinmux: stm32: fix remap equality check
The equality check for remap was not being performed since the local
variable remap was assigned to the value being checked just before the
check. Some minor simplifications have been performed (fixed variable
types).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-07 07:56:21 -04:00
Torsten Rasmussen
e1481fee4a drives: cmake: zephyr_library_property(ALLOW_EMPTY TRUE) on drivers lib
This commit now sets the Zephyr library property `ALLOW_EMPTY` to
silence the warning:
`No SOURCES given to Zephyr library: drivers__interrupt_controller`

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-07 11:42:47 +02:00
Gerard Marull-Paretas
d092945e86 drivers: pinmux: stm32: remove redundant include
stddef.h is already included by zephyr/types.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-06 12:23:30 -04:00
Gerard Marull-Paretas
5ef11520f2 drivers: pinmux: stm32: remove declaration of missing function
stm32_get_port_clock function is not defined anywhere, so remove its
declaration.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-06 12:23:30 -04:00
Gerard Marull-Paretas
902f963151 drivers: pinmux: stm32: remove unused pinmux struct
The struct stm32_pinmux_conf structure (and stm32_pin_func_t type)
are not used, so remove them.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-06 12:23:30 -04:00
Glauber Maroto Ferreira
8dff10dfbe esp32s2: drivers: counter: add support
by bringing up on top of existing counter driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-09-06 10:02:57 -04:00
Armando Visconti
c3050a5aab drivers/sensor: lps22hh: Fix int32 overflow in the val2 part
The val2 calculation was done using (1000000 / 40960) as
multiplying factor, which was sometimes leading to a
int32 overflow. So, let's use the equivalent (but smaller)
(3125 / 128).

Fix #38090

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-09-06 03:31:50 -04:00
Andrei Emeltchenko
12f67c11cd pcie: shell: Print more MSI-X information
For pcie ls command print more detailed MSI / MSI-X information.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-09-03 10:09:05 -04:00
Andrei Emeltchenko
bf4d79a3db pcie: shell: Print 64 bit BARs
Print full 64 bit BARs.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-09-03 10:09:05 -04:00
Jake Swensen
6c2dca08f8 counter: ds3231: replace repeated bit manipulation with bcd functions
The driver code for the Maxim DS3231 has repeated code for bit
manipulation to transform time data between binary and binary coded
decimal. Use the new BCD header functions instead.

Signed-off-by: Jake Swensen <jake@swensen.io>
2021-09-03 10:06:07 -04:00
Mateusz Sierszulski
c09dfb3bf6 drivers: fpga controller: add shell support
This adds shell support for FPGA drivers.

Signed-off-by: Mateusz Sierszulski <msierszulski@internships.antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2021-09-03 09:54:00 -04:00
Mateusz Sierszulski
a64ce1fc6b drivers: fpga controller: add eos_s3 fpga driver
This adds driver for EOS_S3 SoC FPGA.

Signed-off-by: Mateusz Sierszulski <msierszulski@internships.antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2021-09-03 09:54:00 -04:00
Mateusz Sierszulski
2c718b2726 drivers: fpga controller: add fpga api
This adds new FPGA controller which allow to control FPGA chips.

FPGA controller has been created to enable bitstream loading
into the reprogrammable logic. It adds completely new API,
which enables to check status of the FPGA chip, power it on
or off and reset it.

Signed-off-by: Mateusz Sierszulski <msierszulski@internships.antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2021-09-03 09:54:00 -04:00
Katsuhiro Suzuki
763428d5a4 drivers: serial: sifive: support SiFive Freedom series SoCs
This patch changes condition of 'depends on' of sifive UART driver
to support other SoCs of SiFive Freedom series.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-09-03 09:52:26 -04:00
Andrzej Głąbek
1bf7c391b8 drivers: audio: dmic: Add support for nRF PDM peripherals
Add a shim that allows using the nrfx PDM driver via the Zephyr API.
Add also missing devicetree nodes representing the PDM peripherals
in the nRF52 Series SoCs.
Extend the "nordic,nrf-pdm" binding with a new property that allows
specifying the clock source to be used by the PDM peripheral (so that
it is possible to use HFXO for better accuracy of the peripheral clock
or, in the nRF53 Series SoCs, to use the dedicated audio oscillator).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-09-03 09:34:06 -04:00
Tim Lin
f9a8a1dc0b ITE: soc: it8xxx2: move the timer registers to header file
The free run timer will be used to count before entering hibernate
mode. Move the related registers to the head file for accessing.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-09-03 08:07:08 -04:00
Neil Armstrong
95315239d8 pcie: use newly introduced IDs define for MSI/MSI-X
Remove the locally MSI/MSI-X capabilities ID define and use the
newly introduced one from the PCI Code and ID Assignment
Specification Revision 1.11 document header.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-02 19:37:56 -04:00
Neil Armstrong
99c2279abf pci: add Extended PCI(e) capability offset get
Extend the PCIe API to find Extended Capabilities in the PCI Express
Extended Capabilities located in Configuration Space at offsets 256
or greater.

Note: the Root Complex Register Block is not supported

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-02 19:37:56 -04:00
Hake Huang
ef410ee732 drivers: spi: Update mcux driver to support edma
enable spi driver to support dspi edma

add support for shared dma mux spi port

for shared spi port we need judge the irq source

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-09-02 15:50:52 -05:00
Hake Huang
cc1801440f spi: mcux: update driver init priority
use the CONFIG_SPI_INIT_PRIORITY to init device driver

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-09-02 15:50:52 -05:00
Christopher Friedt
650b111ba5 drivers: flash: Kconfig.sam: -depends on and +dfu sample exclude
The additional depends on SOC_FAMILY_SAM was redundant.

Add sam4l_ek to dfu sample exclude since it was failing on
arduino_due.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-09-02 13:23:47 -04:00
Grixa Yrev
27ac1cb012 drivers: can: mcux_flexcan: fix irq connect
IRQ_CONNECT macro last argument is architecture-specific flag,
but now there is instance id at this place.

This PR set architecture-specific flag to 0.

Signed-off-by: Grixa Yrev <GrixaYrev@yandex.ru>
2021-09-02 06:46:10 -04:00
Gerson Fernando Budke
bca28015e3 drivers: adc: adc_sam0: Fix result ready interrupt
Atmel sam0 adc peripheral have multiple interrupt vectors for same5x
devices.  This configure interrupt vector by name to ensure that proper
interrupt handle will be executed.

Fixes #37779

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-09-02 06:45:35 -04:00
Gerard Marull-Paretas
f667b09ade drivers: display: ssd1306: add missing error handling
gpio_pin_configure_dt call was not being checker for errors.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-02 06:42:31 -04:00
Gerard Marull-Paretas
d65b7191d5 drivers: i2c: tca9546a: fix mutex initializer
The mutex initializer was only initializing the first instance of the
driver.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-02 06:42:31 -04:00
Gerson Fernando Budke
626b1b79df drivers: flash: Kconfig.sam: Fix depends on
The Kconfig refactor that replaces some single-symbol 'if's with
'depends on' added a second entry.  That entry allows flash driver
be selected for SoC's without support.  This fixes the 'depends on'
entry to allows only SAME/V SoCs.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-09-01 20:52:50 -04:00
Mahesh Mahadevan
35fca50dce drivers: i2s: Update MCUX Kconfig
Move SoC specific configs to the soc folder

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-09-01 14:39:03 -04:00
Mahesh Mahadevan
91f172e4ad drivers: dma: Zero-initialize memory allocated using kmalloc
The code was wrongly calling DMA_Abort on a channel
that not initialized. This fixes Issue#38078

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-09-01 12:34:50 -04:00
Ryan Erickson
ef322d9e16 drivers: modem: hl7800 Add Site Survey
Add API to determine nearby cell towers and their signal
strength.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 12:33:29 -04:00
Erwan Gouriou
b14a3cb2b3 drivers/gpio: stm32: Fix for stm32u5 support
W/o this fix issues could be seen on pins higher than 8

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-01 10:30:38 -04:00
Ryan Erickson
aba8a21001 drivers: modem: hl7800: Add Position over LTE (PoLTE)
Position over LTE (PoLTE) can be used to locate a device as
an alternative to GNSS.
Increase RX thread stack size for PoLTE processing.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 09:33:46 -04:00
Ryan Erickson
f094346e18 drivers: modem: hl7800: Add GNSS support
Add API to use GNSS on the HL7800 modem.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 09:33:46 -04:00
Ryan Erickson
e29dbf5d04 drivers: modem: hl7800: Add airplane mode
Add API to set HL7800 to airplane mode.
Also add option to boot into airplane mode.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 09:33:46 -04:00
Ryan Erickson
11e992099b drivers: modem: hl7800: Add delayed start
Allow application control for starting modem driver.
This allows network attach to be randomized.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 09:33:46 -04:00
Ryan Erickson
7cfedb915b drivers: modem: hl7800: fix COPS handler
Add support for handling the +COPS=? response
to the +COPS command handler.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-01 08:37:49 -04:00
Yuriy Vynnychek
fde0b96bb7 drivers: i2c: introduce new Telink B91 I2C driver
I2C driver basic support for Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-09-01 06:36:56 -04:00
Andrzej Puzdrowski
e7ac7269cf drivers/flash/flash_simulator: allow to disable statistic
So fare flash simulator had been forced to use the statistic
subsystem.

This patch introduces CONFIG_FLASH_SIMULATOR_STATS which allow to select
whether the statistic is involved in flash_simulator operations.

This patch allows to reduce flash footprint when the statistic is
not required.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-09-01 12:10:19 +02:00
Sigvart Hovland
ad4daa722a drivers: flash: add specific api for access flash_simulator RAM
For getting the address of the RAM region in the application we need to
extend the api for the flash_simulator.

This path introduce flash_simulator_get_memory() call which allow to
do so.

Signed-off-by: Sigvart Hovland <sigvart.m@gmail.com>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-09-01 12:09:58 +02:00
Ron Smith
e54d2553f3 drivers: serial: uart_sam0: Correct check for interrupts enabled
Fixes the issue where uart_sam0_irq_tx_ready would return true if
the INTFLAG was set even though the INTSET bit for the given
interrupt was not enabled yet through uart_sam0_irq_tx_enable.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-09-01 11:50:51 +02:00
Ron Smith
18830991e1 drivers: serial: uart_sam0: Update to correct bitmask
Update uart_sam0_irq_tx_enable to use the correct INTENSET bitmask.

Signed-off-by: Ron Smith <rockyowl171@gmail.com>
2021-09-01 11:50:51 +02:00
Ryan Erickson
1c14a4b1ba modem: hl7800: reconfig IP connection on startup
For low power operation, set the IP connection reconfig
flag when receiving a startup report.
This will ensure the GPRS connection is reconfigured
before any socket operations take place.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-31 19:27:23 -04:00
Ryan Erickson
ac751b7bcc drivers: modem: hl7800: Query IMSI
Add API to query SIM card IMSI.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-31 19:25:13 -04:00
Ryan Erickson
d83aaef031 drivers: modem: hl7800: Add retries to get IP address info
Allow command retries when querying IP address info.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-31 17:34:53 -04:00
Yong Cong Sin
9d2f8a1124 drivers: modem: gsm_ppp: Use DTS
Convert the gsm_ppp driver to use DTS.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-08-31 17:33:34 -04:00
Ryan Erickson
61ef41fc24 drivers: modem: hl7800: Add query carrier config
Add API to query the carrier config of the HL7800.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-31 17:30:46 -04:00
Andrew Hedin
6fb6533a48 drivers: modem: hl7800: Fix generation of FOTA complete event
FOTA complete event is now generated and can be used by application.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2021-08-31 17:30:15 -04:00
Andrew Hedin
fd864c61bb drivers: modem: hl7800: Allow operation without a SIM card
Allow the driver to run if a SIM card is not present.
This allows public HL7800 APIs like firmware updates
to be used even if no network is available.
Remove duplicate query ICCID command.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2021-08-31 16:29:31 -04:00
Daniel Leung
89ddd0bfd2 usb: usb_dc_mcux: use K_HEAP_DEFINE_NOCACHE()
This changes "__nocache K_HEAP_DEFINE()" to use the new
K_HEAP_DEFINE_NOCACHE() macro. This fixes a build error
as K_HEAP_DEFINE() is specifying its own linker section
so that it is no longer possible to specify another
linker section.

Fixes #38108

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-31 16:29:11 -04:00
Daniel Leung
ef795f6fd1 flash: spi_nor: fix building on XCC
For some reason, XCC fails to build complaining segfault
during CGPREP phase. Adding an assignment to a volatile
return value seems to fix this. This provides an easily
revertable commit to workaround the issue.

Fixes #37734

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-31 07:36:28 -04:00
Rafał Kuźnia
3053a931a3 drivers: ieee802154: reverse ack data ext addr string
When ack data for extended address is set with the
nrf_802154_ack_data_set function, the extended address
must be reversed to the IEEE 802.15.4 address transmit
order in order to be properly matched.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-08-31 12:09:39 +02:00
Gerard Marull-Paretas
5f9fddd9d5 drivers: sensor: adxl362: improve error handling
Error handling was missing in numerous places, mostly on GPIO related
callbacks. Some error codes were not correct (-EINVAL vs -ENODEV) and in
some cases error was not propagated correctly.

Fixes #38117

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-30 17:53:24 -04:00
Gerard Marull-Paretas
35e7acb703 drivers: sensor: adxl372: add missing error handling
Error handling was missing in numerous places, mostly for GPIO related
callbacks. An assertion has been used in the context of thread callback.

Fixes #38132

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-30 17:53:24 -04:00
Martí Bolívar
21c6ca9487 drivers: sensor: clean up zephyr_library calls, again
Apply the same fix in bd8afe9365
(" drivers: sensor: clean up zephyr_library calls") to remove
redundant code in the sensor driver build system files. Additional
instances of the antipattern have crept in.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-30 17:07:51 -04:00
Gerard Marull-Paretas
546dd95ed5 drivers: sensor: sgp40: fix ticks variable types
The result of temperature and relative humidity ticks ranges from 0 to
65535 which is the range of a uint16_t variable. Intermediate tmp
variable type has also been adjusted.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-30 13:42:18 -04:00
Martí Bolívar
7a77a31436 dts: fix location of stm32-specific property
The max-erase-time property was introduced for the STM32 flash driver,
but it was inserted as an optional property in the generic
soc-nv-flash binding which is used by other SoCs.

Make it a required property in a new st,stm32-nv-flash binding
instead, since it is at present a vendor specific property.

Update the DTS files accordingly. Keep the existing "soc-nv-flash"
value in the compatible list in each case, so that DT_HAS_COMPAT(...
soc_nv_flash) tests on these nodes will still succeed, but put it
after a newly added "st,stm32-nv-flash" compatible, so that the
SoC-specific binding will be used as it is discovered first by the DT
tooling.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-30 13:40:30 -04:00
Jim Shu
45bcef1de9 drivers: gpio: add andes atcgpio100 GPIO driver
Add atcgpio100 GPIO driver for andes_v5 soc series.

Signed-off-by: Jim Shu <cwshu@andestech.com>
2021-08-30 13:40:14 -04:00
Johann Fischer
010b448454 drivers: usb_dc_nrfx: add logging for NRFX_USBD_EP_ABORTED event
Add logging for NRFX_USBD_EP_ABORTED event inside
control transfer events handling, otherwise "Unexpected event"
error message in this regard confuses the users.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-30 13:37:14 -04:00
Yuval Peress
74b9a607b4 drivers: bbram: Add it8xxx2 BBRAM driver implementation
Note that the it8xxx2 does not support a status register so that
functionality is omitted.

This change also adds driver tests that build both the npcx and it8xxx2
drivers.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-08-30 11:35:23 -04:00
Yuval Peress
cbe4803812 drivers: bbram: fix npcx driver and update Kconfig defaults
There was a typo that snuck into the bbram driver for npcx.
Fix the driver and update the Kconfig to automatically include the
driver if the compatible string exists in the dts. This ensures that
the driver is built when building the npcx evbs.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-08-30 11:35:23 -04:00
Fabio Baltieri
466ca63c2b drivers: ipm: set IPM_STM32_HSEM default from the device tree
Change IPM_STM32_HSEM Kconfig definition so that it picks the correct
default automatically depending on which cpu node is enabled in the
device tree, rather than relying on board specific Kconfig overrides.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-08-30 09:33:32 -04:00
Daniel Leung
ec2b9d42af pcie: msi: pci_msi_enable() to take IRQ as parameter
This changes pci_msi_enable() to take IRQ number as a function
parameter. The old behavior relies on putting the IRQ number
into the interrupt line register in the PCI config space
during IRQ allocation, and reading it back when enabling IRQ.
However, the interrupt line register is only required to be
read-/writable when legacy interrupt is supported on the device.
Otherwise it has undefined behavior. On ACRN, they don't even
care about this register and always wires it to 0x00.
So this commit changes the behavior in pci_msi_enable() to not
require reading back the interrupt line register and instead
takes the IRQ number via function parameter.

Fixes #36765

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-30 13:04:36 +03:00
Glauber Maroto Ferreira
489c012198 esp32: drivers: interrupt_controller: make it common for xtensa socs
by including interrupt allocation feature whenever an Xtensa-based
Espressif SoC is selected.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Glauber Maroto Ferreira
2689a6ee0a esp32s2: drivers: gpio: add gpio support
through the reuse of current gpio driver.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Glauber Maroto Ferreira
2c031caed0 esp32s2: drivers: interrupt_controller: add interrupt allocation support
through the reuse of current esp32 interrupt allocator.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Glauber Maroto Ferreira
219fe5339d esp32s2: drivers: pinmux: add pinmux support
on top of esp32 pinmux driver code.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Glauber Maroto Ferreira
7da555621c esp32: drivers: gpio: code refactoring
to ease driver code reuse between socs.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Glauber Maroto Ferreira
17f3792abf esp32: drivers: pinmux: code refactoring
to make use of Espressif's hal in order to ease both
driver maintenance and code reuse between socs.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-27 17:34:41 -04:00
Mahesh Mahadevan
2dbfb229ef drivers: counter: Remove unused macros
CTIMER_CLOCK_SOURCE macros have been moved to
soc.c file.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-27 13:47:04 -05:00
Francois Ramu
e90c47fbc4 drivers: dma: stm32 initialize a dma_stm32_data structure
In the dma.h there is a dma_ctx structure using a magic code
to be identify. This structure must be prepared as a new
element of the dma_stm32_data.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-27 13:08:33 -04:00
Leonard Pollak
dcff99eeaf drivers: sensor: sgp40: fix rounding errors
This fixes/improves the rounding errors that are introduced
through the truncation of integer division.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-08-27 13:07:54 -04:00
Arvin Farahmand
276996d754 drivers: eth_sam_gmac: use PHY driver
This commit removes PHY and MDIO specific code from the ATSAM
Ethernet driver and instead relies on a separate PHY driver to
handle the PHY.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-08-27 11:43:48 -04:00
Arvin Farahmand
f845cddcf7 drivers: Add Ethernet PHY API
This commit adds support for Ethernet PHY drivers via a PHY API.

It also includes a driver for a generic MII compliant PHY
which supports most PHYs on the market.

Separating PHY driver from the SoC specific Ethernet driver
simplifies the Ethernet driver code and enables code re-use.
Drivers for specific PHYs with more advanced features, such as
RGMII delay in PHY can be developed independent of the Ethernet
MAC driver.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-08-27 11:43:48 -04:00
Arvin Farahmand
2bec7587e9 drivers: mdio: add shell
MDIO shell support.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-08-27 11:43:48 -04:00
Arvin Farahmand
c4cb45eaac drivers: mdio: add Atmel SAM MDIO driver
MDIO driver for ATSAM platform with Ethernet.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-08-27 11:43:48 -04:00
Arvin Farahmand
419b103dd6 drivers: Add mdio API
This commit adds support for MDIO bus. The bus is used by Ethernet
MACs to communicate with PHYs.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-08-27 11:43:48 -04:00
Gerard Marull-Paretas
936f3523d3 drivers: sensor: fxas21002: check gpio calls return code
Some GPIO related calls were not being checked for error.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
50a31d2f36 drivers: sensor: bmg160: check gpio calls return code
Some GPIO related calls were not being checked for error.

This patch also fixes coverity issue 236651.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
7e57a8720d drivers: sensor: bmi160: check gpio calls return code
Some GPIO related functions were not being checked for errors.

This patch fixes coverity issue 236653.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
18732a5c74 drivers: sensor: fxos8700: check gpio calls return code
Some GPIO related calls were not being checked for errors.

This patch fixes coverity issue 236650.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
6cfab29e19 drivers: sensor: adt7420: check gpio add callback return code
gpio_add_callback was not being error-checked. Some other minor cleanups
(rc var to the top, remove redundant log).

This patch fixes coverity issue 236649.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
2682879df5 drivers: sensor: sx9500: check gpio calls return code
Some GPIO related calls were not being checked for error.

This patch fixes coverity issue 236648.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
53231c8bfe drivers: sensor: bmp388: check gpio calls return code
Some GPIO related calls were not being checked for error.

This patch fixes coverity issue 236647.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
09048f843a drivers: sensor: sgp40: fix humidity formula
Fix the formula used to compute RH/ticks formula according to the Table
9 of the datasheet.

This patch also fixes coverity issue 238360.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
9dab2b3c5c drivers: sensor: sgp40: fix temperature formula
Fix the formula that computes T/ticks according to the details found on
Table 9 of the datasheet.

This patch fixes coverity issue 238343.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 18:40:08 -04:00
Gerard Marull-Paretas
086cfb3913 drivers: i2s: nrfx: fix incorrect direction check
I2S direction was not checked correctly in the i2s_nrfx_configure
function.

This patch also fixes coverity issue 238365.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 16:47:27 -04:00
Piotr Mienkowski
2f17bd8e6b drivers: Add Atmel SAM DAC (DACC) driver
Add Digital-to-Analog Converter driver (based on DACC module) for Atmel
SAM MCU family. Only SAME70, SAMV71 series devices are supported in
this version.

Tested on Atmel SMART SAM E70 Xplained board.

Origin: Original

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-08-26 16:46:16 -04:00
Gerson Fernando Budke
1c43138333 drivers: usb: dc: sam: Add full driver fsm
Add sam4l full finite state machine based on Atmel Software Framework.
This allows driver detect protocol errors and sync all requests.  This
version is compliance with Linux USB tests.

Note: Tests are timing sensitive and log may affect results.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-08-26 14:03:44 -04:00
Gerson Fernando Budke
670c067563 drivers: usb: dc: sam: Add atmel USBC controller
Add atmel USBC device controller.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-08-26 14:03:44 -04:00
Yuval Peress
ab6e724ab4 emul: espi: Add ACPI Shared Memory functions
Add the bare minimum to set and access the ACPI shared memory via the
eSPI emulator.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-08-26 13:14:05 -04:00
Martí Bolívar
2b9d477576 adc: npcx: use new DT pinctrl accessors
Update to use the new APIs.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-25 18:09:00 -04:00
Martí Bolívar
831332068b pwm: it8xxx2: use new DT pinctrl accessors
Update to use the new APIs.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-25 18:09:00 -04:00
Henrik Brix Andersen
a2791ccfef drivers: interrupt_controller: plic is independent of risc-v privileged
The RISC-V Platform-Level Interrupt Controller (PLIC) was moved from the
RISC-V Privileged Specification v1.11 to a separate specification
(see https://github.com/riscv/riscv-plic-spec).

Reflect this by not automatically enabling the PLIC interrupt controller
driver for all RISC-V privileged SoCs, but only for SoCs with the
CONFIG_RISCV_HAS_PLIC Kconfig option enabled.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-08-25 18:06:34 -04:00
Johann Fischer
9ad610d1a7 bluetooth: remove Kconfig options CONFIG_BT_*_ON_DEV_NAME
Follow up on commit bfd45e5b8c
("drivers: remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME")
Remove Kconfig options
CONFIG_BT_UART_ON_DEV_NAME and CONFIG_BT_MONITOR_ON_DEV_NAME
since all UART drivers are converted to devicetree and we can just use
DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_uart)) and
DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_mon_uart)).

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-25 18:05:17 -04:00
David Leach
d3cd0d2f9a drivers: adc: add LPADC driver support to mimxrt685 platform
Add LPADC support to the mimxrt685 platform.

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-25 18:02:00 -04:00
Scott Worley
145673d57a Microchip: MEC172x: I2C driver
Microchip MEC172x series I2C driver implementing controller
and target modes. The driver implemenents its own I2C port
pin control functions and does not depended upon pinmux. Future
updates will make use of PINCTRL when that subystem is finalized.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-25 13:07:45 -04:00
Alexandre Bourdiol
4b7e9368bc drivers: spi: spi_ll_stm32: not all stm32l1 MCU have SPI_CR2_FRF
After update of stm32 cube l1 V1.10.3,
SPI_CR2_FRF doesn't exist for all stm32L1 MCU,
thus LL_SPI_SetStandard() is also not defined for all stm32l1 MCU.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-08-24 22:14:20 -04:00
Erwan Gouriou
3e2672b13f drivers/clock_control: stm32: STM32WB: No HSE by-pass
HSE by-pass capability is not available on STM32WB.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-08-24 22:14:20 -04:00
Alexandre Bourdiol
29d1e90a8d drivers: bluetooth: hci: ipm_stm32wb: macro renamed CFG_BLE_OPTIONS
Adapt to stm32hal stm32wb cube update v1.12.0

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-08-24 22:14:20 -04:00
Toby Firth
893bfc0fc1 drivers: counter: added ctimer driver for lpcexpresso55s69
Added shim driver for the CTIMERs for the lpcexpresso55s69 board.

Fixes: #22705

Signed-off-by: Toby Firth <tobyjfirth@gmail.com>
2021-08-24 17:13:22 -04:00
Aurelien Jarno
698a28663c drivers/sensor: Add basic Silabs Si7210 support
This adds basic support for the Silabs Si7210 hall effect magnetic
position and temperature sensor. It is able to get magnetic field and
temperature in the default scale of the sensor (depending on the
variant). It also supports going into sleep mode without measurements
through the device power management infrastructure.

It is most notably missing support for scale change, measurement
averaging and filtering, and alert pin configuration (threshold,
hysteris, tamper).

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-08-24 10:16:19 -05:00
Vojislav Milivojevic
fcfb1d9872 drivers: sensors: fix of sensor channel get for z axis
the correct value is returned when using sensor channel get function to
read z-axis value

Signed-off-by: Vojislav Milivojevic <milivojevicvoja@yahoo.com>
2021-08-24 09:40:26 -05:00
Ruibin Chang
2877bdcdfe ITE drivers/watchdog: reduce interval of warning timer
Reduce interval of warning timer, so we can print more
warning messages (ex. MEPC, task ID...) before watchdog reset.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-08-24 07:31:08 -04:00
Ruibin Chang
f2b9ba1b2c ITE drivers/timer: add disable event timer control
We add disable event timer at the beginning of critical section
for two reason:
1.For K_TICKS_FOREVER case: since no future timer interrupts
are expected or required, so we disable the event timer.
2.Others case: according it81202 spec, when timer enable bit
from 0->1, the timer will reload counts and start countdown.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-08-24 07:30:47 -04:00
Erwan Gouriou
d40910097a drivers/clock_control: stm32wl: Consider new options for HSE clock
On STM32WL, HSE clock can take 2 specific options:
-hse-tcxo
-hse-div2
Enable support for these options.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-08-24 07:19:12 -04:00
Johann Fischer
bfd45e5b8c drivers: remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME
Remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
92a00ee39b drivers: uart_altera_jtag_hal: use DEVICE_DT_INST_DEFINE()
The conversion to devicetree seems to be half lost
for this driver. There are already bindings and nodes for
compatible "altr,jtag-uart", update driver to use it.
Remove last mention of CONFIG_UART_CONSOLE_ON_DEV_NAME.

Resolves #37207

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
c179d83e72 drivers: uart_mcumgr: remove CONFIG_UART_MCUMGR_ON_DEV_NAME
Remove CONFIG_UART_MCUMGR_ON_DEV_NAME and use
DEVICE_DT_GET(DT_CHOSEN(zephyr_uart_mcumgr)).
Add usb.overlay, which contains chosen node and cdc-acm-uart node,
to smp_svr sample.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Johann Fischer
e78b0785b3 console: remove device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME)
Remove device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME)
and use DEVICE_DT_GET(DT_CHOSEN(zephyr_console)) to get
chosen "zephyr,console" node.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Leonard Pollak
d6eb80ac27 drivers: sensor: INA219: added support
This adds support for the TI INA219 Zero-Drift, Bidirectional
Current/Power Monitor with I2C Interface

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-08-23 10:32:07 -05:00
Yong Cong Sin
cf3b18bec0 drivers: usb: device: Add support for USB on STM32G0X
Patches to support USB_DRD_FS on STM32G0 series.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-08-23 08:24:46 -04:00
Ryan Erickson
2e045a0ed6 drivers: modem: hl7800: null terminate DNS server list
bugfix: NULL termination is required by
dns_resolve_reconfigure API so null terminate the DNS
server list.
Fix checkpatch warning.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-20 14:10:22 -05:00
Marcin Niestroj
c910138ade drivers: lora: sx12xx: fix atomic include
Include sys/atomic.h instead of sys/atomic_builtin.h, so that build for
platforms with non-default atomic implementation will still succeed.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-08-20 11:32:45 -04:00
Ryan Erickson
8d6832b256 drivers: modem: hl7800: socket RX could drop data
net_buf_skipcrlf() will remove all \r\n characters from the buffer.
If the data after CONNECT\r\n contained \r or \n it would
be removed, resulting in dropped data.
Fix this to only remove two bytes to ensure data is not dropped.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-20 06:33:31 -04:00
Ryan Erickson
6ef958c2e1 drivers: modem: hl7800: keep socket data if EOF not found
Change socket RX trailer (EOF) missing to warning and
keep socket RX data instead of discarding.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-20 06:33:31 -04:00
Tomasz Bursztyka
f70ecc1099 drivers/pcie: Improve and fix MBAR retrieval depending on use cases
So far pcie_get_mbar() has been the only way to retrieve a MBAR. But
it's logic does not fit all uses cases as we will see further.
The meaning of its parameter "index" is not about BAR index but about
a valid Base Address count instead. It's an arbitrary way to index
MBARs unrelated to the actual BAR index.

While this has proven to be just the function we needed so far, this has
not been the case for MSI-X, which one (through BIR info) needs to
access the BAR by their actual index. Same as ivshmem in fact, though
that one did not generate any bug since it never has IO BARs nor 64bits
BARs (so far?).

So:

- renaming existing pcie_get_mbar() to pcie_probe_mbar(), which is a
  more relevant name as it indeed probes the BARs to find the nth valid
  one.
- Introducing a new pcie_get_mbar() which this time really asks for the
  BAR index.
- Applying the change where relevant. So all use pcie_probe_mbar() now
  but MSI-X and ivshmem.

Fixes #37444

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-08-20 06:30:20 -04:00
Francois Ramu
c4161024c4 drivers: dma: stm32 dma of type V1 with mux
This is the configuration of the stm32h723 where the
dma1 & dma2 of type V1 with a MUX. Even if DMA is of type V1,
the 'feature' does not exist with DMAMUX

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-20 06:28:32 -04:00
Yuriy Vynnychek
b7f99d4a47 drivers: serial: b91: full duplex mode support
Improved fifo_fill API: stop and return on RX.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-20 06:23:24 -04:00
David Leach
b6a3dc8d71 drivers: can: mcux_flexcan: Update to support rt1170
The RT1170 platform adjusted the result parameter in the callback
function to be a uint64_t. The adjustment is to conditionally change
the callback definition and then cast the result value to a size that
fits the reported values across the various SOCs.

With error results, cast result to uint64_t and modified the called
function to print a uint64_t value.

With the RX/TX status, result is a MB value that doesn't exceed 64
so the result value is cast down to a uint32_t.

Fixes #37691

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-20 06:16:24 -04:00
Mahesh Mahadevan
e3a14d9cb9 drivers: usb: Rename NXP EHCI driver
Rename to usb_dc_mcux as this driver is used for both
EHCI and LPC USB controllers

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-19 17:19:11 -04:00
Mahesh Mahadevan
3982708359 drivers: usb: Add support for NXP LPC USB controller
1. Add support for NXP LPC USB controller
2. Do not check the return value from the
   kUSB_DeviceControlRun command as not all SDK drivers
   return a value
3. Use the kUSB_DeviceControlPreSetDeviceAddress
   command to set device address

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-19 17:19:11 -04:00
Yuriy Vynnychek
87018c50cc drivers: spi: introduce new Telink B91 SPI driver
SPI driver basic support for Telink B91 SoC.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-19 17:18:23 -04:00
Alexandre Bourdiol
482198bf79 drivers: clock_control: stm32: enable PWR clock unconditionally
Enable PWR clock unconditionally for L4, L5 and U5
like it is done on other stm32 series

Fixes #37781

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-08-19 08:51:10 -05:00
Jordan Yates
dfc16827d6 flash: spi_nor: re-enable write protection
Turn write-protection back on after a write, instead of disabling it
again.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-18 20:10:59 -04:00
Dino Li
9c47f314a5 flash: it8xxx2: add a short delay before #CS be driven high
The delay will ensure last byte has been latched in before

This also change the method of reading status register from re-send
read status command on each read to read status register continuously.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-08-18 20:10:05 -04:00
Daniel Leung
ab87df9f75 sensor: grove: fix cmake empty library warning
When there is no grove sensor driver enabled, cmake warns
that the library has no sources. Fix that by adding
a new kconfig to be used by CMake to selectively
include the grove directory.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-18 19:08:41 -05:00
Daniel Leung
e4da47ca8f drivers: sensor: fix cmake empty library warning
When there is no sensor driver enabled, cmake warns that
the library has no sources. Fix that by wrapping cmake
library instructions inside kconfig.

Fixes #37765

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-18 19:08:41 -05:00
Daniel Leung
4c3a023a0c drivers: console: fix cmake empty library warning
When there is no console driver enabled, cmake warns that
the library has no sources. So only include the console
directory when CONFIG_CONSOLE is enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-18 19:08:41 -05:00
Alexander Wachter
3262eb416f drivers: sensors: tmp116: Use compile time i2c device
Use the compile-time devictree macro to obtain the i2c dev.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-08-18 09:27:29 -05:00
Alexander Wachter
704ec188f2 drivers: sensors: tmp112: Allow multiple instances
Allow to instanciate multiple instance.
Use compile-time defined i2c device instance.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-08-18 09:27:29 -05:00
Sylvio Alves
d04a58bd1e clock: esp32: fix dt node path
Latest node linux prefix update commit
missed esp32 clock entry.

ref: 7cf99aa2f2

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-08-18 06:41:13 -05:00
Jordan Yates
3cec3ac2a4 lora: detect failed transmissions
Detect failed transmissions using `lora_send` by only waiting for some
multiple of the actual on-air time before giving up.

We use this instead of the inbuilt TxTimeout functionality because the
value of this timeout is set by `lora_configure`, and therefore doesn't
change with different packet lengths. This is a limitation of the
underlying `RadioSend` function, not the Zephyr driver.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-18 05:16:46 -04:00
Jordan Yates
93b4dbcc19 lora: lora_send blocks until completion
Change the behaviour of `lora_send` to block until the transmission
completes. The current asynchronous behaviour is exposed through the
new function `lora_send_async`. This naming convention brings LoRa in
line with other asynchronous subsystems.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-18 05:16:46 -04:00
Mahesh Mahadevan
387e6a676f drivers: disk: Update NXP USDHC driver
1. Do not throw an error when FSL_FEATURE_USDHC_HAS_HS400_MODE
   is defined
2. Add support for the case when the card detect is handled
   by the USDHC module

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-17 17:53:31 -04:00
Mahesh Mahadevan
f28672a448 drivers: clock_control: Update LPC clock driver for USDHC
Add support to get USDHC clock frequency

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-17 17:53:31 -04:00
Mahesh Mahadevan
27c73d3841 drivers: lpc_gpio: Fix warning when interrupt is not defined
Unused variable warnings were seen when the GPIO interrupt
property was not defined.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-17 17:53:31 -04:00
Martí Bolívar
bcf8e560c5 dts: rename 'nios2,i2c' compatible to 'altr,nios2-i2c'
The original NIOS-II developer and former vendor is Altera, which is
now part of Intel. Let's not add a new vendor prefix for something
that already exists and has been acquired; move it to use the existing
'altr,' prefix instead.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-17 17:51:57 -04:00
Martí Bolívar
f78d4be329 dts: fix 'grove,foo' compatibles by using 'seeed,grove-foo'
Rename:

- grove,light to seeed,grove-light
- grove,temperature to seeed,grove-temperature

The "grove" brand applies to a family of products by Seeed (sic):

https://www.seeedstudio.com/category/Grove-c-1003.html

Therefore we should use the existing vendor seeed.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-17 17:51:57 -04:00
Martí Bolívar
b4042154bf dts: fix 'colorway' compatibles
I can't find any reference anywhere showing that the manufacturer of
the LPD8803 or LPD8806 LED scripts is a company called 'colorway'.

Use 'greeled' instead; these seem to actually be manufactured by
GreeLed corporation.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-17 17:51:57 -04:00
Martí Bolívar
98f43ba0be dts: fix max30101 compatible
It should be "maxim,max30101", because the vendor prefix for this
company is "maxim", not "max".

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-17 17:51:57 -04:00
Martí Bolívar
3910c35193 dts: fix u-blox sara r4 compatible
It should be "u-blox,sara-r4", because the vendor prefix for this
company is "u-blox", not "ublox".

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-17 17:51:57 -04:00
Tim Lin
6a1262198a ITE: drivers/i2c: it8xxx2: move pinctrls macro to soc_dt.h
This PR will change accessing the related pinctrl macro from soc_dt.h
And the pinctrl of SCL and SDA were got from pinctrl-0 and pinctrl-1,
respectively. Change it to get from pinctrl-0 only.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-08-17 17:51:17 -04:00
Leonard Pollak
9a59d30517 drivers: sensor: SHT4X: convert to i2c_dt_spec
Convert sht4x driver to `struct i2c_dt_spec`.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-08-17 12:40:17 -05:00
Leonard Pollak
adc5604c5c drivers: sensor: SGP40: convert to i2c_dt_spec
Convert sgp40 driver to `struct i2c_dt_spec`.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-08-17 12:40:17 -05:00
Dominik Ermel
f7ac14ddc7 mgmt/mcumgr: Allow using UART async API
The commit provides preliminary support for async UART within
mcumgr.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-08-17 17:12:34 +02:00
Robert Szczepanski
55e3c732d0 drivers: video: ov2640: add driver for ov2640 image sensor
This adds the driver for Omnivision OV2640 image sensor.

The driver provides support for 10 different resolutions in range from
160x120 to 1600x1200 in both JPEG and RGB565 pixel formats. There are
also mutliple configuration options, e.g. hflip, vflip, saturation and
brightness control.

Signed-off-by: Robert Szczepanski <rszczepanski@antmicro.com>
2021-08-17 09:18:38 -04:00
Daniel Leung
eb0060cd7b drivers: display: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Also sort the entries alphabetically.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
8dd6540e02 display: change init priority config to 85
Some display drivers may actually be initialized after LittlevGL
as those drivers and LittlevGL's lvgl_init() all have SYS_INIT()
at APPLICATION and init priority the same as application init
priority. Depending on how the final binary is linked, these
drivers may initialize after lvgl_init() resulting in it not
able to find a display driver. This changes the value of
CONFIG_DISPLAY_INIT_PRIORITY so that the display drivers that
make use of this kconfig are initialized a bit earlier to
ensure that they are actually initialized before lvgl_init().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
0464524986 drivers: pm_cpu_ops: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
59a16f71d5 drivers: sys_con: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
94514726b2 drivers: watchdog: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
25b47290bd drivers: usb: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
6ed46e3412 drivers: ptp_clock: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
43309296b8 drivers: pinmux: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
28021b8484 drivers: net: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
0f0c17880e drivers: modem: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
2880a49198 drivers: memc: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
08a2be839c drivers: led_strip: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
583d392477 drivers: led: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
95782108dd drivers: ieee802154: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
6edd223772 drivers: hwinfo: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
cbbc6c2102 drivers: flash: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
e912a0533a drivers: ethernet: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Note that the include to subsys has been moved from
under the drivers into subsys, as it is actually
the subsystem's job to make sure the include
directories are correct.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
77dd3daaaf drivers: edac: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
f6a3dcf282 drivers: disk: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
71bd37efb2 drivers: clock_control: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
a062463d7b drivers: can: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
bcdff8220a drivers: sensors: build as static libraries
Instead of putting object files inside libzephyr.a, simply
build a separate static library for the top level of sensor
drivers. Also, for those that were not building its own
static library, make them do so as majority of sensor
drivers are building their own static libraries.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
378ad046c8 drivers: bluetooth: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Note that the include to subsys/bluetooth has been
moved from under drivers/bluetooth to subsys/bluetooth,
as it is actually the subsystem's job to make sure
the include directories are correct.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
579ca90e25 drivers: wifi: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
941eb9696a drivers: pcie: build as static library
Instead of putting the object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
2fccd97f0c drivers: i2c: slave: group into i2c static library
This changes the build command so the I2C EEPROM slave
is being grouped into the I2C static library.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
9cef5d5981 drivers: console: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Also sort the entries alphabetically.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
32f094f8fa console: semihosting: remove unused include
Content in kernel_arch_interface.h is not being used.
So remove the #include.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
29ec31bff3 console: native_posix: change init priority to 99
This changes the init priority of native posix console to 99.
When building for native_posix, it is usually assumed that
the output would be stdout. With old priority at 60, UART
console, for example, can be initialized later which means
printk() would not go to stdout. So changing the native posix
console to be (hopefully) initialized last.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
f0b3146ff5 drivers: timer: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Also sort the entries alphabetically.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Daniel Leung
9fa5437447 drivers: interrupt_controller: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Also sort the entries alphabetically.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Francois Ramu
744e1dc692 drivers: serial: stm32 uart defines dma slot with macro
The STM32_DMA_SLOT macro from include/drivers/dma/dma_stm32.h
must be used here, especially for dma of type v2bis.
In this case, the dma-cell is not defined and slot is null.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-16 19:35:36 +02:00
Martin Jäger
ecef16aa86 bluetooth: hci: esp32: Fix DBG logging
The log level was always set to debug. Defining BT_DBG_ENABLED same
as for other bluetooth files allows to switch off debug log messages.

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-08-16 11:44:10 +02:00
Fabio Baltieri
d6731819e3 drivers: sx126x_standalone: use the correct dev_data for dio1 callback
The current code uses dev->data for finding back the instance data
structure in various places, but for the dio1 irq callback, dev refers
to the GPIO device node (not the LORA radio one), so dev->data returns a
pointer to the GPIO data rather than a "struct sx126x_data".

Fix that by using CONTAINER_OF to find back the correct structure from
the callback pointer.

The bug was introduced in:

  74efaa920a drivers: sx126x: refactor few functions for stm32wl support

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-08-16 04:57:41 -04:00
Watson Zeng
fc8dc62310 drivers: gpio: cy8c95xx: use LOG_DBG instead of LOG_INF
LOG_INF: It's meant to write generic user oriented messages.
LOG_DBG: It's meant to write developer oriented information.

use LOG_DBG instead of LOG_INF to hide debug message.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-08-15 21:13:14 -04:00
David Leach
f3435b75ef hal: nxp: Update to SDK 2.10.0
Updating to the SDK 2.10.0 for select platforms.

west.yml:
- Update to point to the NXP HAL update with SDK 2.10.0 files
- modules/tee/tfm needed to be updated to synchronize the
  LPCXPRESSO55S69 platform SDK to version 2.10.0 to be in sync
  with Zephyr usage of SDK 2.10.0

drivers/counter/counter_mcux_pit.c:
- underlying SDK 2.10.0 adjusted the setting by -1 so need
  to adjust the reported value set by +1

drivers/ethernet/eth_mcux.c:
- SDK2.10 ethernet driver provided an assert test that highlighted
  we were using the wrong clock source on various platforms.

drivers/memc/memc_mcux_flexspi.c:
- SDK2.10 added compile time conditional on whether a field was
  defined for the flexspi configuration structure.

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-13 15:37:48 -05:00
Mahesh Mahadevan
a69bd75bd8 modules: hal_nxp: Move NXP USB file to modules folder
Move USB file to from modules/hal_nxp to zephyr/modules
folder

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-13 12:51:46 -04:00
Sylvio Alves
907b5d9e7f drivers: spi: set max chunk len for esp32
Max SPI chunk len was missing from the
implementation, causing SPI to hang up in some
conditions.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-08-12 16:22:34 -05:00
Mark Wang
857b8508d0 drivers: serial: NXP: Enable flow control for uart_mcux_lpuart
add flow_ctrl filed and give it initialized value
    based on hw_flow_control.
Initialize mcux lpuart based on flow_ctrl

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2021-08-12 14:49:09 -05:00
Daniel Leung
8b8e8f99ba display: introduce CONFIG_DISPLAY_INIT_PRIORITY
This introduces a new kconfig CONFIG_DISPLAY_INIT_PRIORITY
to specify the initialization priority for display devices.
Most of the display devices are using APPLICATION and
CONFIG_APPLICATION_INIT_PRIORITY which is not entirely
appropriate for devices. Due to linking order, the display
device may be initialized after application code at same
init level and priority. This results in the display device
not ready to be used for application code. So this kconfig
option allows the display devices to be initialized earlier
if needed.

For the drivers using CONFIG_APPLICATION_INIT_PRIORITY,
they have been changed to use CONFIG_DISPLAY_INIT_PRIORITY
instead.

Note that the default value for CONFIG_DISPLAY_INIT_PRIORITY
is the same as CONFIG_APPLICATION_INIT_PRIORITY at 90 to
avoid any functional changes.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-12 17:00:39 +02:00
Scott Worley
19dd46ef68 Microchip: MEC172x: ADC driver
Add ADC driver version 2 for MEC172x using new in-tree headers
and device tree properties. Update the ADC shell for the new driver.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-11 19:44:31 -04:00
Flavio Ceolin
2aa67efd7a drivers: gpio_emul: Add dummy pm support
Add a simple device PM support to be used for tests.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-11 19:39:13 -04:00
Dong Wang
a56c42574e timer: hpet: make it support EHL/PSE CPU
Add config macro to set interrupt as level triggered for ARM CPUs
Merge all timer configures into one place, then no need to overwrite
hpet_timer_conf_get/set() functions in SoC layer
Make hpet_timer_comparator_set() as the only register access function
to implemented in the SoC layer

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2021-08-11 11:30:05 -04:00
Dong Wang
eeb15aa393 timer: hpet: enable 64 bit mode for better usages
Get longer maximum timeout
Make HPET counter usable as timestamp

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2021-08-11 11:30:05 -04:00
Piotr Mienkowski
6c699239f9 drivers: flash_sam: fix flash_sam_write_page
According to Atmel SAM datasheet when writing data to the latch buffer
"32-bit words must be written continuously, in either ascending or
descending order. Writing the latch buffer in a random order is not
permitted." To enforce the requirement we need to call a memory barrier
instruction after copying every word of data to the latch buffer. In
the absensce of __DSB() call the ARM processor is free to change order
of AHB transfers. This has caused the driver to occasionally corrupt
data programmed in the flash.

Fixes #37515

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-08-11 11:29:04 -04:00
Neil Armstrong
72bb75a360 pcie: msi: fix MSI-X fallback to MSI
When enabling MSI & MSI-X, the code seemed to handle fallback to MSI
when MSI-X is not available, but the logic uses MSI-X even if not
available and the MSI path never gets used.

Fixes: a2491b321e ("drivers/pcie: Add support for MSI-X")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-08-10 14:46:22 -04:00
Neil Armstrong
f9c3ade883 pcie: msi: add missing mem_manage.h include for MSI-X
When building on non-X86 platforms K_MEM_PERM_RW gets undefined.

Fixes: a2491b321e ("drivers/pcie: Add support for MSI-X")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-08-10 14:46:22 -04:00
Christopher Friedt
5c7f395f8f Revert "include: driver: sensor: add tank level channel in units of percent"
This reverts commit f51aec4307.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-08-10 09:44:48 -05:00
Jordan Yates
3682eb9714 sensor: bmi160: convert to _dt_spec
Convert bmi160 driver to use `spi_dt_spec`, `i2c_dt_spec` and
`gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
757bb42d5f sensor: bme280: convert to _dt_spec
Convert bme280 driver to use `spi_dt_spec` and `i2c_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
75682f7d0e sensor: adxl372: convert to _dt_spec
Convert adxl372 driver to use `spi_dt_spec` and `gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
534bfbda8a sensor: adxl362: convert to _dt_spec
Convert adxl362 driver to use `spi_dt_spec` and `gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
941a1af0e3 led_strip: lpd880x: update to spi_dt_spec
Convert lpd880x to use `spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
7065aec5e2 led_strip: ws2812: convert to spi_dt_spec
Convert ws2812 LED strip driver to `spi_dt_spec`. Also moves the init
function implementation outside the declaration macro.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
8d84626cab led_strip: apa102: convert to spi_dt_spec
Convert apa102 LED strip driver to `spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 22:40:18 -04:00
Jordan Yates
3085c4d070 ethernet: w5500: convert to _dt_spec
Convert w5500 ethernet driver to `spi_dt_spect` and `gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 19:50:53 -04:00
Jordan Yates
128e8a4a6f ethernet: enc424j600: convert to _dt_spec
Convert enc424j600 ethernet driver to `spi_dt_spect` and `gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 19:50:53 -04:00
Jordan Yates
a94cfb42a3 ethernet: enc28j60: convert to _dt_spec
Convert enc28j60 ethernet driver to `spi_dt_spect` and `gpio_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 19:50:53 -04:00
Jordan Yates
c634a79344 eeprom: at2x: convert to _dt_spec
Convert the at2x eeprom driver to `spi_dt_spec` and `i2c_dt_spec`.
I2C functions are not fully converted due to the non-standard addressing
scheme.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 19:50:53 -04:00
Jordan Yates
7b42f8960a display: ssd1306: convert to _dt_spec
Convert the ssd1306 driver to `spi_dt_spec` and `i2c_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-09 19:50:53 -04:00
Henrik Brix Andersen
eb616130d7 drivers: sensor: add driver for the LM77 temperature sensor
Add sensor driver for the LM77 temperature sensor.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-08-09 19:50:29 -04:00
Nick Ward
f51aec4307 include: driver: sensor: add tank level channel in units of percent
Provides an enum for tank level sensor drivers.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2021-08-09 16:24:50 -04:00
Scott Worley
ad19104f28 Microchip: MEC172x: Add UART driver
Microchip XEC has been using the standard NS16550 driver.
Using the standard NS16550 driver requires extra HW programming
for XEC UART in board level and did not support XEC GIRQ interrupt
programming. We add an XEC specific driver and remove UART specific
register programming from the board level and implement interrupt
support. Also, by implementing a SoC specific driver we can add
driver PM in the future.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-09 16:21:33 -04:00
Sylvio Alves
d608e79777 drivers: esp32: fix data range check
Fix if content fits in a single write page.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-08-09 13:19:20 -04:00
Glauber Maroto Ferreira
8e865a7a88 esp32s2: drivers: serial: add minimal uart driver
based on uart rom functions, also enable console driver
on top of this driver, which enables logging

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-08-09 13:03:14 -04:00
Imre Lagas
ee3f50fdeb drivers: gpio: Add fxl6408 driver
Add a driver for the fxl6408 gpio-expander using gpio api.

Origin: original

Signed-off-by: Imre Lagas <Imre_Lagas@hotmail.com>
2021-08-09 13:02:20 -04:00
Aurelien Jarno
117090c1a2 drivers: sensors: ti_hdc20xx: add support for DRDY/INT pin
Add optional support for the DRDY/INT pin. This avoids waiting a fixed
time for the temperature and humidity conversion to finish.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-08-09 11:32:43 -04:00
Aurelien Jarno
28f9a7614b drivers: sensors: ti_hdc20xx: reset the device during init
Soft-reset the TI HDC20XX sensor during init to bring all registers in a
known and consistent state.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-08-09 11:32:43 -04:00
Aurelien Jarno
28e7cfd037 drivers: sensors: ti_hdc20xx: convert to i2c_dt_spec
Convert ti_hdc20xx temperature and humidity sensor driver to
`i2c_dt_spec`.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-08-09 11:32:43 -04:00
Aurelien Jarno
7ebae7f569 drivers: sensors: ti_hdc20xx: use uint16_t variables to store the samples
The temperature and humidity samples are 16 bits long and can therefore
fit in a uint16_t variable. This save 4 bytes of RAM.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-08-09 11:32:43 -04:00
HaiLong Yang
559e1269e7 drivers: ipm: add driver based on stm32 hsem
Some STM32 SOC, like stm32h745 and stm32h747 doesn't have IPCC.
Provide a STM32 HSEM based ipm driver for these SOC.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2021-08-09 16:11:28 +02:00
Jordan Yates
d2363be091 lora: sx12xx_common: thread safe RX
Make the `lora_recv` operation thread safe by copying memory directly
in the callback instead of deferring copying to the original caller.

To ensure pointer validity, this requires performing operations "inside"
the `modem_release` context.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-08 04:19:27 -04:00
Jordan Yates
586a4bfc7d lora: sx12xx_common: thread-safe API
Ensure that the modem is not asked to perform new operations before the
previous operation completes.

An atomic variable is used instead of a mutex as multiple threads need
to release the lock. A semaphore isn't used as there is no indication
whether `k_sem_give` gives the semaphore or not, which is required to
determine if `Radio.Sleep()` should be run.

`Radio.Sleep()` is only ever run by the context that successfully
releases the modem usage, to guard against double calls.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-08 04:19:27 -04:00
Jordan Yates
4b370fb5e3 lora: sx12xx_common: transition to k_poll_signal
Transition the receive synchronisation method from a single driver
semaphore to a function specific k_poll_signal. This is required to
allow the modem to be released without introducing race conditions on
the signalling mechanism.

Without this change, the RX can either be signalled before the modem is
released, unblocking the calling thread before the modem is put back to
sleep, or after the modem is released, in which case a second thread
could start using the semaphore before the original thread is signalled.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-08 04:19:27 -04:00
Jordan Yates
f397361c8a lora: sx12xx_common: sleep after RX timeout
If no packet was received in the provided timeout, manually transition
to sleep mode. If a packet was received, the rx_done callback
automatically transitions the modem to sleep.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-08 04:19:27 -04:00
Mulin Chao
ab87854d9b driver: serial: replace suffix nuvoton with numicro
Replace the suffix "nuvoton" with "numicro" for Nuvoton microcontroller
serial driver.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-08-07 20:37:24 -04:00
Yuval Peress
268f9bf163 nuvoton: battery-backed ram
Add bindings and entry for the battery-backed ram in the nuvoton
npcx. This commit is an upstream port of
https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/dts/bindings/cros_bbram/nuvoton,npcx-cros-bbram.yaml;l=1;drc=e9af813c36b7b411bf2a01cbc1b09d5fdec49b8a

Along with a bit of cleaning up and an emulator.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-08-07 20:32:33 -04:00
Przemyslaw Bida
678a170925 net: openthread: Add capability to disable properly CSL.
This commit adds capability to disable CSL sampling by setting
CSL period to 0.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2021-08-07 20:27:25 -04:00
Scott Worley
114b84a58b Microchip: XEC GPIO driver interrupt enable fix part 2
Fixes issue 34879
This PR updates previous PR's 37138 and 37139.
Refer to issue 34879 for information from MCHP HW
designers. A delay after enabling interrupts is a
more appropriate work-around than depending upon
behavior of ARM DMB instruction.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-07 20:24:37 -04:00
Felipe Neves
2474c9b3f3 soc: riscv: esp32c3: added initial support for ble
subsystem by linking esp32 vhci adapter to the
espressif ble controller adapter

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-08-07 19:59:27 -04:00
David Leach
569a1a0a5d soc: arm: nxp_imx: rt: Configure settings for TRNG IP
RT platforms that support TRNG IP (rt10xx and rt6xx) need to set
RNG and CSRNG to Xoroshiro and CTR_DRBG respectively instead of
using TRNG as random source.

Fixes: #37307

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-06 20:29:59 -04:00
Andrzej Głąbek
3842babc79 drivers: serial: nrf: Make pull-ups on UART pins configurable
This is a follow-up to commit 3656ba5ae9.

Do not enforce pull-up resistors to be enabled on RXD and CTS pins
in nRF UART drivers, as in certain hardware designs this may be
undesirable or may even make certain hardware not working.
Instead, provide devicetree properties that allow enabling of those
resistors when it is actually needed.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-08-06 19:17:26 -04:00
Jan Pohanka
1df0569001 drivers: ethernet: eth_stm32_hal.c: add wait time for buffer allocation
Driver's RX thread can wait some time before a free buffer is available.
When resources are limited we can easily run out of them.

Fixes #36891.

Signed-off-by: Jan Pohanka <xhpohanka@gmail.com>
2021-08-05 11:32:42 -04:00
Krzysztof Chruscinski
0419ff72aa drivers: counter: nrfx_timer: Add option to use ZLI interrupt
Extended driver configuration in device tree to enable ZLI interrupt.
When zli is set in the device tree then event handlers for alarm and
top is called in ZLI interrupt context. It means that kernel primitives
cannot be used there.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-08-05 16:17:23 +02:00
Krzysztof Chruscinski
53333d58bf drivers: counter: nrfx_rtc: Add option to use ZLI interrupt
Extended driver configuration in device tree to enable ZLI interrupt.
When zli is set in the device tree then event handlers for alarm and
top is called in ZLI interrupt context. It means that kernel primitives
cannot be used there.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-08-05 16:17:23 +02:00
Yuriy Vynnychek
84db9cd36a drivers: pwm: introduce new Telink B91 PWM driver
PWM driver basic support for Telink B91 SoC.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-05 16:11:41 +02:00
Dario Binacchi
c3ee515865 drivers: can: stm32: fix typo in a comment
Replace 'mailbix' with 'mailbox' in drivers/can/can_stm32.c.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-08-05 16:11:11 +02:00
Dario Binacchi
f4e9ec5392 drivers: can: stm32: drop exit from sleep mode
Before entering initialization mode, we left sleep mode, then request
to leave again sleep mode before returning from can_stm32_init() is
useless.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-08-05 16:11:11 +02:00
Dario Binacchi
b1097df26e drivers: can: stm32: remove useless mcr setting
Disabling the time-triggered communication mode (TTCM) is done twice in
the setting of the master control register (MCR). So, let's remove the
second.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-08-05 16:11:11 +02:00
Guillaume Lager
ca5921845d driver: i2c: Add TCA9546a I2C switch driver
The driver only support use case where the channels are used in mutual
exclusion.
Origin: Original

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-08-05 11:48:30 +02:00
Scott Worley
c66250f5ba drivers: GPIO: Microchip: Fix GPIO interrupt enable spurious interrupt
Fix for issue 34879.
Microchip MEC GPIO hardware can trigger a spurious interrupt when
interrupt detection is set to edge mode especially falling edge mode.
Clearing the status immediately after enabling interrupt detection does
not work because the hardware takes a small number of AHB clocks to
set the status. After interrupt detection enable we use an ARM data
memory barrier to insure the write completes before clearing spurious
status and enabling the interrupt in the GIRQ.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-05 11:29:35 +02:00
Jordan Yates
fdeaa9103e random: deprecate XOROSHIRO_RANDOM_GENERATOR
Deprecate the xoroshiro128+ PRNG algorithm in favour of xoshiro128++.
xoshiro128++ is a drop-in replacement which is invisible from the user
perspective.

xoroshiro128+ is unsuitable because it is explicitly a floating-point
PRNG, not a general-purpose PRNG. This means that the lower 4 bits of
the output are actually linear, not random (from the designers,
https://prng.di.unimi.it/). This means 1/8th of the generated data is
not random.

Additionally, xoroshiro128+ is not a 32bit algorithm, it operates on
64bit numbers. For the vast majority of Zephyr devices, this makes the
PRNG slower than it needs to be. The replacement (xoshiro128++) is
32bit, with no loss in state space (still 128 bit).

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-05 11:24:44 +02:00
Krishna Mohan Dani
365ff6db9f drivers/flash: stm32l5: Adding flash driver for stm32l5x series
This commit adds flash driver in non-secure mode for stm32l5x
series with icache enabled. This commit also adds a flash
programming error status check applicable for all platforms
except stm32f1 series.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-08-04 10:26:06 -05:00
Yuriy Vynnychek
3e4e9496a1 drivers: entropy: introduce new Telink B91 Entropy driver
Entropy driver basic support for new Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-04 15:45:32 +02:00
Gerard Marull-Paretas
7ccc1a41bc pm: use actions for device PM control
Instead of passing target states, use actions for device PM control.
Actions represent better the meaning of the callback argument.
Furthermore, they are more future proof as they can be suitable for
other PM actions that have no direct mapping to a state. If we compare
with Linux, we could have a multi-stage suspend/resume. Such scenario
would not have a good mapping when using target states.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
6d273f49bd pm: fix incorrect usages of PM_DEVICE_STATE_OFF
According to the documentation the OFF state has to be used when the
devices is fully turned off, ie, power removed. Most drivers were using
a sort of fall-through for all non-active states, leading to behaviors
not following the specifications.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
495672ab62 pm: cleanup pm control callback implementations
- Return -ENOTSUP if the requested state is not supported
- Remove redundant "noop style" functions.
- Use switch everywhere to handle requested state (not necessary in all
  drivers, but better take off with consistency in place after current
  changes).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
d41dadc569 pm: rename PM_DEVICE_STATE_SUSPEND to PM_DEVICE_STATE_SUSPENDED
The verb tense for the suspended state was not consistent with other
states. The likely reason: state was being used as a command/action.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
56a35e5682 pm: converge to suspend state for low power modes
The difference between low power and suspend states is a thin blur line
that is is not clear and most drivers have used indistinctly. This patch
converges to the usage of the suspend state for low power, since
contrary to the low power state, it is used by both system and runtime
device PM. The low power state is still kept, but its future is unclear
and needs some discussion.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
c6cce80ac4 pm: remove incorrect usages of force suspend
Some devices are using PM_DEVICE_STATE_FORCE_SUSPEND as a sort of low
power state, something that is not correct. In fact, this state is not
an actual state and will be eventually moved, if found necessary, to an
action or command.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
920f30cc0e pm: simplify state change check logic
The device PM control function will only be called if the requested
state is different from the current one. A significant amount of drivers
were checking for state changes, now unnecessary. This patch removes all
this redundant logic.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
11eef4d8c8 pm: device: remove pointer usage for state
Since the state is no longer modified by the device PM callback, just
use the state value.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
9e7d545bb4 pm: device: remove ctrl_command callback argument
The ctrl_command is not used anymore, so remove it from the callback
signature.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
da0ff4ae46 pm: device: remove usage of ctrl_command
The callback is now invoked to set the device PM state in all cases, so
the usage of ctrl_command is redundant.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Gerard Marull-Paretas
c2cf1ad203 pm: device: remove usage of local states
The device PM subsystem already holds the device state, so there is no
need to keep duplicates inside the device. The pm_device_state_get has
been refactored to just return the device state. Note that this is still
not safe, but the same applied to the previous implementation. This
problem will be addressed later.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-04 08:23:01 -04:00
Yuriy Vynnychek
1c0ed94601 drivers: ieee802154: introduce new Telink B91 IEEE802154 driver
IEEE802154 driver basic support for Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-08-04 11:58:02 +02:00
Jordan Yates
6cf6d515b1 sensor: sht3xd: convert to i2c_dt_spec
Convert sht3xd driver to `struct i2c_dt_spec` as a demonstration.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 19:05:14 -04:00
Jordan Yates
7bdb22941c sensor: bme680: convert to i2c_dt_spec
Convert bme680 driver to `struct i2c_dt_spec` as a demonstration.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 19:05:14 -04:00
Scott Worley
2070c0997f Microchip: MEC172x: Update pinmux driver
Update the Microchip XEC pinmux driver to use system I/O
routine for read/write of registers instead of direct use
of volatile and CMSIS defines. Add GPIO port number to
bindings instead of using hard coded value from chip headers.
Modify SoC DTSI pinmux syntax, requires "pinmux: pinumx {..."
or the DT macros will not work. Since pinmux is used by MEC152x
we update its chip pinmux DT.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-03 19:04:56 -04:00
John Kjellberg
f452a086fb drivers: led: Add LED driver support for TLC59108
Add support for TI TLC59108 an I2C 8-bit LED driver.
Supported blinkink period: 41ms to 10730ms
Supported brightness value: 0 to 100%

This driver supports the following APIs:

1. led_blink
2. led_set_brightness
3. led_on
4. led_off

This is a modified version of the NXP PCA9633 driver.

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>
2021-08-03 19:03:29 -04:00
Johann Fischer
ae074e81d4 usb: remove Kconfig option CONFIG_USB
The USB configuration option is actually a global switch
to enable USB drivers in general, but currently only
the device controller drivers are meant.

USB device controller drivers also have USB_DEVICE_DRIVER option.
Thus the option USB is actually redundant and can be replaced
by the self-explanatory option USB_DEVICE_DRIVER.
The name USB itself is not unique and should not be used as an
configuration option.

With these changes the option USB_DEVICE_DRIVER generally
enables USB device controller drivers. The option USB_DEVICE_STACK
enables USB device support. It is sufficient to enable only option
USB_DEVICE_STACK because it selects USB_DEVICE_DRIVER.

CONFIG_USB Kconfig option is temporary added to subsys/usb/Kconfig.
This is necessary to pass CI and will be removed again
when the USB configuration has been adapted in modules.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-03 19:00:12 -04:00
Felipe Neves
d368087fc0 drivers: serial: added minimal uart driver for esp32c3
based on uart rom functions, also enable console driver
on top if this driver enabling logging

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-08-03 11:20:06 -05:00
Francois Ramu
bfeb9b4684 drivers: adc: stm32h7 has a different oversampling config API
The LL_ADC_ConfigOverSamplingRatioShift function for
the stm32H7xx soc serie differs from other for the 'ratio':
"This parameter can be in the range from 1 to 1024"
Note that in the stm32h7xx_ll_adc.c the LL_ADC_OVS_RATIO_xxx value is
defined for ADC of type ADC_VER_V5_V90.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-03 10:34:49 -05:00
Jun Lin
2b1841ef3e driver: eSPI: npcx: select the host interface to eSPI explicitly
Set the host interface type to eSPI if it is not configured by the
booter.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-08-03 13:59:42 +02:00
Jordan Yates
4d6d50e2bc display: ssd16xx: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
f1f8ccc388 display: ls0xx: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
bd980f3506 display: gd7965: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
80dabf52eb display: st7735r: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
e49c7f1780 dac: dacx0508: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
a8aa97b5d0 can: mcp2515: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Jordan Yates
c5868310ca adc: lmp90xxx: convert to spi_dt_spec
Convert SPI usage to `struct spi_dt_spec`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-03 13:58:39 +02:00
Johann Fischer
6954554284 drivers: usb: use new USB framework header
Use macros and types from usb/usb_ch9.h header where it
is possible. This patch also adds local macros, USB_REQTYPE_GET_DIR
and USB_REQTYPE_GET_TYPE, which is an intermediate solution and
these will be removed later.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-03 13:20:07 +02:00
David Leach
bdd536a09e watchdog: add watchdog driver support to mimxrt685 platform
Add watchdog support to the mimxrt685 platform.

The mimxrt685 platform is excluded from the watchdog
test case because the test case uses variables in the
noinit section that need to be retained through a reset
but the rt685 does not retain this memory through a
reset.

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-02 13:21:20 -05:00
Kumar Gala
a1a895e331 drivers: modem: Fix compiler warning
When building tests/drivers/build_all/modem on native_posix_64 we get:

	modem_cmd_handler.c:545:9: error: ret may be used
	uninitialized in this function
	[-Werror=maybe-uninitialized]

Fix by adding simple initialization of ret = 0 at start of function.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-08-02 11:32:02 -05:00
Kieran Mackey
19f7af11fa drivers: gpio: Add PCA953X driver (gpio port expander)
The Texas Instruments TCA9538 is an 8 pin GPIO port expander.
It operates on an I2C bus with 2 configurable address pins. The
device has an interrupt output pin that is asserted when any pin
configured as an input changes state.

Added under the PCA953X name to allow other similar parts to
use the same driver.

Signed-off-by: Kieran Mackey <kieran.mackey@lairdconnect.com>
2021-07-31 14:56:34 -04:00
Efrain Calderon
5274aa5dc2 drivers: bme280: fetch data after measurement is done
After powering-on the sensor, and before every measurement, it loads
the NMV. We must wait until this process is completed otherwise
we will read weird values.
Since it was observed that the time may be a bit long after a cold
start, it is more convinient to just wait until the sensor iready,
without a timout.

Signed-off-by: Efrain Calderon <efrain.calderon@aquarobur.com>
2021-07-30 20:15:56 -04:00
Efrain Calderon
c009450d44 drivers: bme280: do soft reset after boot
To ensure that we have the same behaviour with a power cycle
and by pressing the reset button, we can perform soft reset
in `bme280_chip_init()`.

Signed-off-by: Efrain Calderon <efrain.calderon@aquarobur.com>
2021-07-30 20:15:56 -04:00
Efrain Calderon
86e656b640 drivers: bme280: fix: build broken after PM changes
The driver did not build with PM_DEVICE enabled.
commit to blame: cc2f0e9c08

Signed-off-by: Efrain Calderon <efrain.calderon@aquarobur.com>
2021-07-30 20:15:56 -04:00
Tim Lin
733cd7ccd8 ITE: drivers/adc: it8xxx2: access pinctrl_0 property from soc_dt.h
This PR will cleanup related pinctrl_0 property which has been
moved to soc_dt.h

TEST=alternate function is as intended.
console command: md .b 0xf01650 8
00F01650: 00 00 00 00 80 00 00 80
TEST=read adc
console command: adc
ADC_VBUS_C0 = 11330 mV
ADC_BOARD_ID_0 = 2997 mV
ADC_BOARD_ID_1 = 1318 mV
ADC_AMON_BMON = 68166 mV
ADC_VBUS_C1 = 12270 mV
ADC_PMON = 32 mV
ADC_PSYS = 32 mV

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-30 19:54:56 -04:00
Yuriy Vynnychek
fe0b9e85a3 drivers: flash: introduce new Telink B91 Flash driver
Flash driver basic support for Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-07-30 19:53:04 -04:00
Kieran Mackey
94e006f0fc drivers: counter: add driver for Microchip MCP7940N RTCC
Microchip MCP7940N is a Real-Time Clock/Calendar. It operates on a I2C
bus. It can be used to set a calendar time and has two alarm channels.
When an alarm is asserted the state of the MPF pin of the MCP7940N will
change (depending on gpio active high/active low setting) to trigger an
interrupt.

Signed-off-by: Kieran Mackey <kieran.mackey@lairdconnect.com>
2021-07-30 19:51:29 -04:00
Gerson Fernando Budke
62ba4723d4 drivers: serial: uart_sam0: Add pinctrl support
Add Atmel sam0 sercom[uart] pinctrl bindings and implements pinctrl at
driver level.  It changes all sam0 boards to use new feature and remove
pinmux driver dependency for sercom[uart].  The samples that require a
binding were update to keep consistency and avoid errors.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-07-30 14:37:20 -05:00
Gerson Fernando Budke
6de5f4d729 soc: atmel_sam0: common: Add soc_port
Introduce soc_port common functions.  The sam0 pinmux driver was
refactored to use soc_port_pinmux_set common function.

This create the common base to implement sam0 pinctrl functions.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-07-30 14:37:20 -05:00
Mahesh Mahadevan
5f636286d3 drivers: pwm: Add PWM support for NXP LPC devices
Add PWM support using the LPC SCTimer module

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-07-30 13:08:03 -05:00
Gerard Marull-Paretas
6c3beb928e pm: adjust busy check API call return types and naming
Busy check APIs now return boolean type. Due to that change, the
function names have also been adjusted. The common name pattern for
boolean check type APIs is "PREFIX_is_CONDITION". For example,
"pm_device_is_busy".  pm_device_busy_check has been renamed to
pm_device_is_busy and pm_device_any_busy_check to pm_device_is_any_busy.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-30 09:28:42 -04:00
Gerard Marull-Paretas
70322853a8 pm: device: move device busy APIs to pm subsystem
The following device busy APIs:

- device_busy_set()
- device_busy_clear()
- device_busy_check()
- device_any_busy_check()

were used for device PM, so they have been moved to the pm subsystem.
This means they are now prefixed with `pm_` and are defined in
`pm/device.h`.

If device PM is not enabled dummy functions are now provided that do
nothing or return `-ENOSYS`, meaning that the functionality is not
available.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-30 09:28:42 -04:00
Aurelien Jarno
9ecdd78961 drivers: sensors: ti_hdc20xx: update temperature conversion formula
TI recently released a new version of the HDC2080 datasheet, which
slightly update the temperature conversion formula, with a temperature
offset of -40.5°C instead of -40°C. Adjust the code accordingly.

In addition the datasheet also describes a voltage dependent
compensation of -0.08°C/V above 1.8V, however it's not something easily
doable with the current sensor framework, so just ignore that part.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-07-30 07:06:18 -04:00
Scott Worley
4cb0020614 modules: hal_microchip: Update Microchip HAL to version 1.2.1
Microchip HAL update used by MEC152x projects with eSPI
definition changes. Remove hack from XEC ESPI driver since
the missing symbol is in the HAL.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-07-29 18:27:30 -04:00
Dominik Ermel
8489b49599 drivers/flash: Add missing flash_get_parameters user space handler
The flash_get_parameters has been missing user space handler,
the commit fixes that.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-07-29 18:26:28 -04:00
Aurelien Jarno
58b8c4006e drivers: adc: STM32: add support for oversampling
The STM32 G0, G4, H7, L0, L4, WB and WL series have hardware support for
oversampling. This patch adds support for it, using the oversampling
value provided in the adc sequence. The result is shifted right
accordingly to not change the resolution of the measured value, like it
is done on other ADC drivers.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-07-29 11:48:41 -04:00
Daniel N. Hansten
88604971cd drivers: led: pca9633: exit sleep mode on init.
Driver does not correctly take ic out from sleep mode on init.
Added logic to update mode register on init to take the leddriver
out from sleep mode.
See datasheet for register details.
Fixes #37180

Signed-off-by: Daniel N. Hansten <dnh2000@gmail.com>
2021-07-29 11:01:02 -04:00
Erwan Gouriou
06b94f20aa drivers: gpio & interrupt_controller: Add stm32 u5 support
Add changes to STM32 GPIO and Interrupt controller driver
to support stm32u5 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-29 07:28:32 -05:00
Erwan Gouriou
9e351db03e drivers/clock_control: stm32: Add stm32u5 support
Add clock_control driver to stm32u5 support.
For this series, now deprecated STM32 clock Kconfig symbols
are not added.
Due to a divergence in MSI clock definition, PLL1 use
instead of PLL and lack of sufficient abstraction abstraction
for these a dedicated file has been added.
This should be reshuffled:
- once a better abstraction is provided by LL API for these
- when some stm32 clock control driver rework will be done
after complete removal of Kconfig STM32 clock symbols.

Tested in MSI, HSI, PLL based HSI and PLL based MSI.
Not tested on HSE due to lack of compatible hardware.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-29 07:28:32 -05:00
Dino Li
f2cd50d8ea gpio: it8xxx2: disable irq before configuring pin interrupt
Fixed the following assertion causing by high level functions
enable gpio interrupt at the same pin at least two times:

ASSERTION FAIL [!arch_irq_is_enabled(irq)]
@ ZEPHYR_BASE/arch/common/sw_isr_common.c:84 IRQ xxx is enabled

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-28 21:10:40 -04:00
Marcin Niestroj
301243ed06 drivers: wifi: esp_at: fix race condition when waiting for 'SEND OK'
This is more or less the flow of AT+CIPSEND:

  RX                         TX
  --                         --
                             AT+CIPSEND=<...>
  OK
  >
                             <data to be sent>
  SEND OK / SEND FAIL

'sem_response' semaphore is released by receiving 'OK'. Then after
receiving '>' (which releases 'sem_tx_ready' semaphore) actual data is
sent. Waiting for 'SEND OK' or 'SEND FAIL' is implemented by waiting on
'sem_response' (the same as for 'OK'), which mean that resetting this
semaphore just after sending all data is racy.

Fix that race condition by resetting 'sem_response' just after receiving
'OK', so that neither 'SEND OK' nor 'SEND FAIL' will appear yet (they
will not be sent as long as we won't send whole payload).

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-28 21:08:51 -04:00
Marcin Niestroj
01852138ae drivers: wifi: esp_at: fix race condition when waiting for '>'
Sending AT+CIPSEND=<...> command results in following reply:

  OK
  >

modem_cmd_send_nolock() invocation was setting command handlers for '>',
but as 'OK' was received first, it was handled as a generic reply. After
receiving 'OK' this function was unsetting command handlers. Then
modem_cmd_handler_update_cmds() was called once again in order to
register '>' handler once again. There was a small period of time where
'>' was not being handled at all.

Fix that race condition by using just introduced modem_cmd_send_ext(),
which allows to leave commands handlers in place and get rid of race
condition where expected command could be missed.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-28 21:08:51 -04:00
Marcin Niestroj
1a4cb7e0e3 drivers: modem: add modem_cmd_send_ext()
There are currently modem_cmd_send() and modem_cmd_send_nolock()
functions, each with slightly different behavior regarding acquiring (or
not) sem_tx_lock. Introduce a generic function that will allow caller to
select behavior using flags.

While at it, add possibility to disable setting and unsetting command
handlers. This will be useful in situations when there are multiple
replies expected one after the other coming as a response to single
command. This is the case for example with ESP-AT driver, which expects
following data as response to AT+CIPSEND command:

  OK
  >

where 'OK' is handled by static CMD_RESP (so releasing response
semaphore right away), while '>' is handled by dynamic
CMD_HANDLER (which is releasing another semaphore). Keeping command
handlers in place allows to receive '>' without race condition because
of small period of time where command handlers are not set.

Convert modem_cmd_send_nolock() and modem_cmd_send() to static inline
functions, as they are just a specific invocation of
modem_cmd_send_ext() function.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-28 21:08:51 -04:00
Andrzej Głąbek
32da1078da drivers: i2s: Add support for nRF I2S peripherals
Add a shim that allows using the nrfx I2S driver via the Zephyr API.
Add also missing devicetree nodes representing the I2S peripherals
in the nRF52 Series SoCs.
Extend the "nordic,nrf-i2s" binding with a new property that allows
specifying the clock source to be used by the I2S peripheral (so that
it is possible to use HFXO for better accurracy of the peripheral clock
or, in the nRF53 Series SoCs, to use the dedicated audio oscillator).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-07-28 18:41:26 -04:00
Scott Worley
6976800cf0 Microchip: MEC172x GPIO driver version 2
Create version 2 of the MEC GPIO driver to support MEC172x to not
interfere with MEC152x. When the MEC172x ECIA interrupt aggregator
driver is ready, this driver will use ECIA for registering GPIO
interrupt callbacks instead of maintaining its own interrupt table.
Add V2 DT binding.
Add the Kconfig configuration settings for the MEC172x GPIO
V2 driver at the SoC and board level.
Add port id to DT allowing use of DT FOR EACH macro in the driver.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-07-27 18:01:55 -04:00
Sam Hurst
1382d64ed5 drivers: sensor: Add driver for TI INA23x
This driver supports the TI INA230 and INA231 Bidirectional Current
and Power Monitors. The devices work on the I2C interface and are
created from DT nodes with a compatible property matching "ti,ina23x".

The following datasheets were referenced while developing the driver:
https://www.ti.com/product/INA230
https://www.ti.com/product/INA231

Twister passed:
twister -T tests/drivers/build_all/sensor/

Testing was performed on the stm32g071b_disco board with the following:
Load:    ~170 ohms
Voltage: 5V

Measured Values:
Voltage: 5.1 V
Current: 0.032 A
Power:   0.157 W

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2021-07-27 17:59:23 -04:00
Felipe Neves
3917203d52 driver: timer: esp32c3: added tickless support
For esp32c3 system timer clock driver enabling tickless mode
kernel

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-07-27 17:42:01 -04:00
Piotr Mienkowski
4566d0ec58 drivers: i2s_sam_ssc: use dma_reload() to continue transfer
Use `dma_reload()` instead of `dma_config()` within DMA callbacks. This
significantly shortens time required to reconfigure DMA engine to
transmit / receive the next data block and allows to configure higher
I2S bus data rates.

The maximum I2S data rate supported by the driver is still lower than
that of underlying hardware. To fully support hardware capabilities the
I2S driver would have to use scatter-gather / linked-list DMA transfer.
This is currently not supported by the DMA driver.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-07-27 09:52:07 -04:00
Piotr Mienkowski
4b36416720 drivers: dma_sam_xdmac: add dma_reload function
Add implementation of `dma_reload()` function.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-07-27 09:52:07 -04:00
Scott Worley
dd1a9559be Microchip: XEC RTOS timer: Add MEC172x support to driver
Update Microchip XEC RTOS timer driver adding MEC172x support and
using more device tree properities in the driver. We must also update
the XEC counter driver to use the new GIRQ DT properties.
Add new properties to RTOS timer and RTC timer YAML. These two timers
are linked due to option using a high speed timer for kernel busy wait.
Add Kconfig logic for XEC RTOS timer to MEC172x SoC.
Enable the Microchip XEC RTOS timer in the MEC172x evaluation board.
Add device tree nodes for most peripeherals.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-07-27 09:29:34 -04:00
Jun Lin
c51a4ecd42 driver: eSPI: unify the bit fields of ACPI/KBC event data
The KBC/ACPI event data is 4-byte in width and composed of
event/data/type fields. However, the field position is defined by each
chip vendor via macro and not unified in the current implementation.
The commit uses the structure bit field to define and unify the field
position. It helps the application access it with a common approach.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-07-26 22:50:44 -04:00
Arvin Farahmand
c95e0825d2 dsa: updated api to use net_if
Change DSA API to use `net_if` directly to make API calls instead of
indirectly via `dsa_context` and `switch_id`.
Remove unused `switch_id`, `switch_enable_port`, and `dsa_get_context`.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
9cb353a97e dts: ksz8974: rename driver to ksz8xxxx
Renamed driver to reflect that it supports different KSZ8 series chips.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
b0e4886dfa dts: ksz8974: add support for ksz8863
Add DSA support for KSZ8863 chip.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
47f4a86835 dts: ksz8974: improve slave interface initialization
Changed slave interface initialization code to be more generic and less
dependent on a specific number of ports.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
cb3aa1b1b5 dts: ksz8974: add private data structure for each device
Added a private structure pointer to each DSA device to store device
specific data.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
fe4f6969ac dts: ksz8974: fix compilation error if no tail tagging is enabled.
Compiling the driver without `CONFIG_DSA_KSZ8794_TAIL_TAGGING` would
generate an error.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
aa6217697e dts: ksz8974: change port number to start at zero.
Changed port numbers to start at zero since they're used as indexes
into various arrays in the code.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Arvin Farahmand
b164baa3e9 dts: ksz8974: code clean-up
Removed superfluous port status read.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-07-26 19:37:22 -04:00
Andrzej Puzdrowski
f6641d70d5 drivers/eeprom/eeprom_emulator: fix mutex usage with rambuf
In the eeprom read operation, when rambuf was available
mutex was not unlocked after the read. Consequence of that is
that device was blocked after that read for incoming operations.

This commit fixes the issue

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-07-26 12:27:22 -04:00
Scott Worley
6b3749d2ff Microchip: MEC172x Add aggregated interrupt driver
Add driver implementation and header files for a MEC172x
aggregated interrupt driver. Enable the parent(ECIA) node
to have the driver initialize interrupt hardware for use.
Enable child nodes for those GIRQs used for aggregation.
Refer to chip documention for the list of GIRQs restricted
to aggregation and those which support direct mode.
Add chip level device tree node for MEC172x EC interrupt
aggregator parent and GIRQ children. Each child node contains
a list of sources representing the source bit position in the
GIRQ registers.
Add DT bindings for ECIA and GIRQ nodes.
Add build file(s) and configuration items for the MEC172x ECIA
aggregated interrupt driver. Add and enable the MEC172x interrupt
driver on the MEC172x evaluation board(EVB). Enable parent node to
initialize ECIA hardware. Child nodes are left disabled until a
future driver needs them.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-07-26 12:24:52 -04:00
Oliver Yang
d5af33eaf0 drivers: clock_control: stm32h7: fix comment mistake 'bansk'
Change comment word 'bansk' to 'banks'.

Signed-off-by: Oliver Yang <cameledyang@pm.me>
2021-07-26 12:23:41 -04:00
Piotr Mienkowski
1145986096 drivers: Add Atmel SAM counter (TC) Driver
Add basic counter driver based on Timer Counter (TC) module for Atmel
SAM family.

Remarks:
- The driver is not thread safe.
- The driver does not implement guard periods.
- The driver does not guarantee that short relative alarm will trigger
  the interrupt immediately and not after the full cycle / counter
  overflow.

Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-07-26 05:13:40 -04:00
Piotr Mienkowski
1d199ca5ac drivers: qdec_sam: align naming of TcChannel in TC
Change naming of TC_CHANNEL to TcChannel in Tc struct to align with
a new convention used by samv71, samv71b series.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-07-26 05:13:40 -04:00
Thomas Stranger
95b7385bf1 drivers: entropy: stm32: don't use zero value
According to the Reference Manual of several series(G0,L5,WL,WB,...)
RNG_DR register value should only be used if it is different from 0:
"Because when it is the case a seed error occurred between RNG_SR
polling and RND_DR output reading (rare event)."

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-26 04:36:56 -04:00
Thomas Stranger
95c3916c60 drivers/entropy: stm32 add seed error recovery
This commit introduces an automatic recovery procedure in cases an
entropy source error was detected.
- On Series with soft reset support a soft rest is executed.
- On Series w/o soft reset support the pipeline is cleared by reading
  the RNG_DR 12 times.

With this changes the check for seed errors uses SEIS flag instead
of the SECS flag.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-26 04:36:56 -04:00
Ruibin Chang
21f0f958fe ITE drivers/ite_it8xxx2_timer: re-write ite timer driver
Re-write ite timer driver.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-07-24 21:26:49 -04:00
Ruibin Chang
78ef5ace6a ITE drivers/intc_ite_it8xxx2: correct logic operation
Interrupt polarity register don't support rising and
falling edge triggered at the same time, so I correct
logic operation to match this.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-07-24 21:26:49 -04:00
Thomas Stranger
bb9fd7377b drivers/crypto: stm32: add support for socs with AES IP
This commit adds crypto support for several series which have
the same/very similar or same AES IP.
This includes G0, G4, L5, WL.
WB is also very similar but, expects the app to load the key via CKS.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-23 16:25:27 -04:00
Guennadi Liakhovetski
45b70e1500 smp: limit the scope of some SMP-only functions
z_smp_init() is only available if CONFIG_SMP is defined,
smp_timer_init() also depends on two Kconfig parameters. Also make it
conditional in cavs_timer.c. Also clarify some SMP-related comments
there.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-07-23 16:06:54 -04:00
Tim Lin
f72b32f7fd ITE: drivers/i2c: disable the interrupt
The irq will be enabled at the condition of start or repeat
start of I2C. If timeout occurs without being wake up during
suspend(ex: interrupt is not fired), the irq should be
disabled immediately.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-22 17:36:41 -04:00
Tim Lin
ebc49ba1f1 ITE: drivers/i2c: remove redundant printk
This printk has been printed in i2c_recovery_bus routine,
so here is redundant.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-22 17:36:41 -04:00
Leonard Pollak
2d0fd2554a drivers: sensor: SHT4X Added support
This adds support for Sensirion's SHT4X temperature and
humidity sensor.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-07-22 10:17:13 -04:00
Leonard Pollak
0d7cb32c58 drivers: sensor: SGP40 Added support
This adds support for Sensirion's SGP40 multipixel gas sensor.

Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
2021-07-22 10:17:13 -04:00
Luka Lopotar
7b67e239fe sensor: bq274xx: Add power management and shutdown mode
Add support for power management and the shutdown mode for bq274xx fuel
gauge sensor. This now allows boards that have any kind of low power
mode to turn on or off the sensor.

Tested on a Company's custom board with bq27421 sensor on it.

Signed-off-by: Luka Lopotar <luka.lopotar@greyp.com>
2021-07-22 06:21:25 -04:00
Francois Ramu
325edf23d7 drivers: dma: stm32 source_periph incorrectly set in dma_stm32
The flag source_periph seems to be incorrectly set in dma_stm32.
In case the transfer direction is from periph to mem, then the
stream->source_periph is 1 (true) else it is false.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 06:06:11 -04:00
Francois Ramu
8fe0831c6b include: dt-bindings: remove dma header for stm32 soc
All the macro for dma-cells are now in the
include/drivers/dma/dma_stm32.h header file.
So the include/dt-bindings/dma/stm32_dma.h is no more
useful and removed from #include.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 04:52:53 -04:00
Francois Ramu
30fd0228ae drivers: dma of the stm32 refactored macro for the dma-cells
The macro to set the element of the dma-cells for each peripheral
are defined in the dma_stm32 header file
and used in the periph driver (as dma client)

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 04:52:53 -04:00
Francois Ramu
dcefbd67ed drivers: dma: stm32 dma driver for a new dma version
This is the dma V2bis which is particular DMA V2 instance for
stm32F1 and STM32L1 soc series. This DMA does not use the dma slot
Otherwise it is similar to version V2.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 04:52:53 -04:00
Francois Ramu
6312b7383d drivers: dma: stm32 dma driver using DT compat macro
Controlling the DMA offset  for the request, relies on the
dma version different from V1

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-07-22 04:52:53 -04:00
Scott Worley
d3f6b54f8e Microchip: MEC172x clock control driver
Implement a clock control driver for Microchip MEC172x handling
configuring the 32 KHz input sources for the PLL and peripheral-32k
clock domains. MEC172x differs from MEC152x. MEC152x had one 32K source
for both PLL and peripherals. MEC172x allows the two domains to use
independent 32 KHz sources. Device tree updated to provide addresses
of hardware used by the driver.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-07-21 17:46:07 -04:00
Alexander Wachter
f87135bbee drivers: clock_control: clock_stm32g4: Fix ifdef STM32_LSE_CLOCK
the macro STM32_LSE_CLOCK is always defined and therefore systems
without lse crystals hang on startup.
Used #if instead of #ifdef.

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2021-07-21 06:29:31 -04:00
Yuriy Vynnychek
15818a8245 drivers: serial: introduce new Telink B91 Serial driver
Serial driver basic support for new Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-07-21 05:37:12 -04:00
Yuriy Vynnychek
6c76b416ee drivers: pinmux: introduce new Telink B91 Pinmux driver
Pinmux driver basic support for new Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-07-21 05:37:12 -04:00
Yuriy Vynnychek
215cdc7a3c drivers: gpio: introduce new Telink B91 GPIO driver
GPIO driver basic support for new Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-07-21 05:37:12 -04:00
Sylvio Alves
e01f18441e intr: esp32: conf log default level
Only enable interrupt allocator logs if config is set

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-07-20 20:01:47 -04:00
Sylvio Alves
e57e6dc7cf drivers: flash: esp32: Add cache flush and guard calls
Add cache flush and guard calls in write and
erase api.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-07-20 20:01:35 -04:00
Dino Li
ce7c7bb5f9 it8xxx2: intc: protect interrupt enable registers of soc
Because these two functions are called from threads and ISR.
And they run a bit-wise OR operation on the interrupt registers.
So protect them to prevent race condition between thread and ISR
context where causing an interrupt won't enable as expected.

eg.
- Pseudo code of thread enable IER1's bit1:
1. load word from IER1 (0x40) and write into CPU register S1
   => S1=0x40
2. Or S1's bit1
   => S1=0x42
(But if an interrupt is triggered here)
3. Store word to IER1 from S1
   => IER1=0x42
(IER1 will be 0x42 not 0x43, IER1's bit0 is disable again due to the
race condition above)

-Pseudo code of ISR enable IER1's bit0
1. load word from IER1 (0x40) write into CPU register S2
   => S2=0x40
2. Or S2's bit0
   => S2=0x41
3. Store word to IER1 from S2
   => IER1=0x41
4. Go back to thread.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-20 20:00:39 -04:00
Alexander Wachter
2daad1dab9 drivers: sensors: Add driver for LM75
This commit adds a driver implementation for the LM75 I2C temperature
sensor.

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2021-07-20 16:15:32 -05:00
Crist Xu
04ab2400e6 driver: adc: an adc driver for rt1170
reuse the lpc's lpadc driver for rt1170, modify the dts and add
some macro to shield some code of LPC series. Also add the
board support inside the tests/drivers/adc/adc_api/src/test_adc.c,
and a dts node:zephyr,user inside
samples/drivers/adc/boards/mimxrt1170_evk_cm7.overlay

Signed-off-by: Crist Xu <crist.xu@nxp.com>
2021-07-20 13:15:58 -05:00
Daniel Leung
f7d82da541 timer: hpet: convert register access to functions
This converts register access from macro to functions.
This allows SoCs to override these functions if needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-07-20 13:35:14 +02:00
Daniel Leung
b9cc043434 timer: hpet: don't force TIMER_READS_ITS_FREQUENCY_AT_RUNTIME
This allows the HPET timer to use kconfig to specify clock
frequency instead of relying on calculation at runtime.
When the frequency is known at build, this allow the toolchain
to optimize some calculations.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-07-20 13:35:14 +02:00
Daniel Leung
fc5f698551 timer: hpet: allow overriding MIN_DELAY
This renames MIN_DELAY to HPET_CMP_MIN_DELAY, and also allows it
to be overridden. The default delay is for HPET with relative
high frequency, and may not suitable for all HPET
implementations.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-07-20 13:35:14 +02:00
Daniel Leung
aadcd10a6e timer: hpet: extract Counter Clock Period into a macro
This extracts the hard-coded value into a macro which can be
overridden. This is in preparation for SoCs where the period
is not in femptoseconds.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-07-20 13:35:14 +02:00
Simon Guinot
4de1b6be21 led_strip: ws2812: claim compatibility with Everlight B1414
This patch states that the Everlight B1414 LED controller is compatible
with the Worldsemi WS2812. Some information about it is added to the
WS2812 DT binding and driver Kconfig files.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-07-20 13:35:02 +02:00
Simon Guinot
dc92d1d559 led_strip: ws2812: use k_usleep() for reset delay
Since this driver is working reliably, let's use k_usleep() instead of
k_busy_wait() (as suggested in a TODO comment) to latch and reset the
LED strip controller.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-07-20 13:35:02 +02:00
Simon Guinot
17c0ddfe9c led_strip: ws2812: allow to configure reset delay
Some devices compatibles with the WS2812 IC have a different reset/latch
delay.

This patch introduces the "reset-delay" optional property for the WS2812
DT binding and adds support to the ws2812_spi driver. This new property
allows to configure the reset/latch delay of a WS2812 compatible LED
strip controller from its DT node.

If omitted the driver uses 8 microseconds by default (which is good for
the WS2812 IC).

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-07-20 13:35:02 +02:00
Simon Guinot
4ada0bbd6e led_strip: ws2812: allow to configure channel mapping
Some devices compatibles with the WS2812 IC have a different channel to
color mappings (e.g. RGB, BGR, RGBW, etc).

This patch introduces the "color-mapping" required property for the
WS2812 DT binding and adds support to the ws2812_gpio and ws2812_spi
drivers. This new property allows to configure the color to channel
mapping of a WS2812 compatible LED strip controller from its DT node.

Since this property also allows to know if a white channel is available,
then this patch removes the "has-white-channel" property.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-07-20 13:35:02 +02:00
Krzysztof Chruscinski
c44a46f1f5 drivers: serial: nrfx_uarte: Fix race condition in async isr
When DMA switches from one buffer to another ENDRX followed by
RXSTARTED is generated. Code flow assumes that ENDRX will be
handled before RXSTARTED but this may not be the case if there
is a short between ENDRX and RXSTARTED and event occurs after
ENDRX event check but before RXSTARTED event check. In that case,
RXSTARTED event is handled first. Such case may happen if there
is a higher priority interrupt that may preempt UARTE interrupt
handler.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-20 13:31:25 +02:00
Andrzej Głąbek
7cae49d22c drivers: clock_control_nrf: Add configuration of HFCLKAUDIO frequency
Add a new property to the "nordic,nrf-clock" binding to allow
configuration of the HFCLKAUDIO frequency.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-07-20 10:13:56 +03:00
Maureen Helm
ceacc177ef drivers: gpio: Refactor mcux lpc driver to use DT_INST_FOREACH
Refactors the mcux lpc driver to use DT_INST_FOREACH_STATUS_OKAY instead
of hardcoding each instance. Tested with samples/basic/button and
samples/basic/blinky on mimxrt685_evk_cm33.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-07-19 20:00:54 -04:00
Kumar Gala
f829697931 drivers: i2c: rcar: Fix possible compiler warning
In certain build cases we get the following compiler warning:

i2c_rcar.c: In function 'i2c_rcar_transfer_msg':
i2c_rcar.c:168:6: warning: 'ret' may be used uninitialized in
                  this function [-Wmaybe-uninitialized]

Fix this by initializing ret to 0 at start of function.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-07-19 17:54:38 +02:00
Jedrzej Ciupis
a55c0b0531 drivers: ieee802154: align with API changes
This commit aligns the nRF5 ieee802154 driver with the latest
API changes necessary to handle security-related flags properly.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2021-07-19 18:15:56 +03:00
Krzysztof Chruscinski
482fae74a8 drivers: timer: nrf_rtc_timer: Fix race condition
RTC interrupt was reading CC value and passing it to the handler.
However, higher priority interrupt could preempt RTC interrupt
and set new CC value. In that case CC value read in the RTC
interrupt context was not the one that triggered the interrupt.
Added fallback to COUNTER value if that case is detected.

Using COUNTER is not as precise as CC because it returns time
when event was handled and not when event occured but it is the
only option since CC value is overwritten.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-07-19 12:02:27 +02:00
Johann Fischer
8cbef2da24 drivers: console: update USB_UART_CONSOLE description
Remove outdate text and add note what the option in
the console driver does.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-07-19 04:02:07 -04:00
Gerson Fernando Budke
3771b968f0 drivers: eth: sam: Replace constants by devicetree values
The zephyr sam gmac driver don't get register address and, in some
cases, peripheral id from devicetree.  This replace headers constants
in favor of devicetree values.

This fix wrong Atmel SAME7x/SAMV7x gmac register address and add
missing peripheral id property for SAM family.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-07-16 21:34:43 -04:00
Gerson Fernando Budke
49eb184ea4 dts: eth: sam: Split generic GMAC compatible
The current GMAC compatible not allow especialize properties by SoC
family.  Split current generic Atmel GMAC compatible into two new
compatibles which are defined by SoC families.  This increase the
freedom and avoid odd situations.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-07-16 21:34:43 -04:00
Carlo Caione
bc30598456 drivers: syscon: Add generic syscon API
A syscon device is a device managing a memory region containing a set of
registers that are not cohesive enough to represent as any specific type
of device. We need a driver for that because several other drivers could
use the same region at the same time and we need to io-map the region at
boot for MMU enabled platforms.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-07-16 21:31:38 -04:00
Sylvio Alves
4d37aa828a driver: wifi: add esp event task name
When enabling shell and retrieving thread information,
esp wifi event task name was empty.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-07-16 18:59:57 -04:00
John Kjellberg
0647b2e0a8 disk: Add support for MCUs with SDIO drivers.
Use abstracted define to cover more MCUs.

Signed-off-by: John Kjellberg <kjellberg.john@gmail.com>
2021-07-16 18:57:17 -04:00
Mahesh Mahadevan
5c818f7f55 drivers: counter: Add counter for rt600
Add a RTC based counter for MXRT600

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-07-16 18:56:15 -04:00
Erwan Gouriou
04e70a482d drivers/gpio: stm32: Move gpio_stm32_configure to void
No check is done on this function,
so no error can be returned.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-16 07:21:07 -04:00
Erwan Gouriou
b26a898705 drivers/gpio: stm32: Move driver initialization to PRE_KERNEL_1
Assuming gpio devices are required by pinmux which is used
by any device make it a device that is initialized in preliminary
steps of platform init.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-16 07:21:07 -04:00
Erwan Gouriou
7e8c497d40 drivers/pinmux: stm32: Group gpio devices usability checks
Move GPIO devices clock handling in stm32_pin_configure function
which is also used in stm32_setup_pins.
Additionally, add device usability check to be sure gpio driver
was initialized before being used by pinmux pseudo driver.

Last, going from the assumption that GPIO devices should be
initialized before being used by pinmux, then there is no need
to enable clock in case CONFIG_PM_DEVICE_RUNTIME=n.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-16 07:21:07 -04:00
Glauber Maroto Ferreira
c5361d2416 esp32: interrupt_controller: clean redundant configs
Remove config entries now selected on SoC definition.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
35c8cb7b37 esp32: drivers: interrupt_controller: review SPI interrupt usage
Review SPI interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
378278f61d esp32: drivers: interrupt_controller: review I2C interrupt usage
Review I2C interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
4108ca1060 esp32: drivers: interrupt_controller: review GPIO interrupt usage
Review GPIO interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
57bf89d65e esp32: drivers: interrupt_controller: review UART interrupt usage
Review UART interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
0cf0830ead esp32: drivers: interrupt_controller: review WDT interrupt usage
Review WDT interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
b6d61587c2 esp32: drivers: interrupt_controller: review Timer's interrupt usage
Review Timer interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Glauber Maroto Ferreira
9ae5fd1b34 esp32: drivers: interrupt_controller: add interrupt allocation support
Add interrupt allocation support for ESP32.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Fabio Baltieri
accb71ec9e drivers: sx126x: add support for the stm32wl chip
Add support for the STM32WL integrated radio, based on the sx1262. The
STM32WL implementation does not use any GPIO, and the signals are routed
to other units of the SoC and accessed with the ST HAL.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-15 21:30:28 -04:00
Fabio Baltieri
2916133b06 drivers: sx126x_standalone: convert to gpio_dt_spec APIs
Convert the standalone part of the sx126x driver to the new gpio_dt_spec
APIs. This allows moving the specific GPIOs in that part of the driver
and out of struct sx126x_data.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-15 21:30:28 -04:00
Fabio Baltieri
74efaa920a drivers: sx126x: refactor few functions for stm32wl support
Move few functions around in preparation of adding the STM32WL variant
of the driver.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-15 21:30:28 -04:00
Fabio Baltieri
624886156a drivers: spi_ll_stm32: add SUBGHZSPI support
This adds support for controlling the SUBGHZSPI NSS line in STM32WL
devices. This is a special dedicated SPI port only connected to the
radio device internally, chip select happens through a bit in the PWR
module. Adding a special dt-property to identify the port, it all gets
built out on non-WL devices.

Deduplicate the existing dts bindings in the process, and add the new
one for the special spi with the new property.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-15 21:30:28 -04:00
Sylvio Alves
c58a218720 drivers: i2c: fix timing and stop bit
Current impĺementation fails due to missing stop bit
when reading data. This fixes it and refactor the implementation
by adding k_busy_wait when waiting I2C bus completion.

Also, this implementation is based on esp-idf v3.0.
It will be refactored based on latest esp-idf v4.3 using proper
low level calls.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>

Fixes #34015
2021-07-15 19:28:16 -04:00
Titouan Christophe
8e3ab9248f drivers: gpio: add new driver for STMPE1600 gpio expander
The STMPE1600 is an I2C based GPIO expander. This initial patch
only supports reading from/writing to the pins on the STMPE1600,
and there is currently no support for interrupts.

Signed-off-by: Titouan Christophe <moiandme@gmail.com>
2021-07-15 19:23:16 -04:00
Carlo Caione
f4db14f349 dts: Introduce DT_STRING_TOKEN and DT_STRING_UPPER_TOKEN
To be able to get a tokenize DT string without the quotes. Deprecate
also DT_ENUM_TOKEN and DT_ENUM_UPPER_TOKEN.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-07-15 18:12:51 -05:00
Dino Li
b316d18cb0 drivers: gpio: it8xxx2: add support for GPIO_VOLTAGE_ flags
Support GPIO_VOLTAGE_1P8, GPIO_VOLTAGE_3P3 flags on IT8xxx2 chips.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-15 13:53:54 -05:00
Armando Visconti
59812961f2 drivers/sensor: lis2mdl: Fix errors when CONFIG_PM_DEVICE=y
Fix a couple of issues related to Power Management:

    1. A build error because 'dev' was used even if not declared
       in the caller routine scope
    2. The lis2mdl power management init specific routine was
       not declared in in the device instance definition

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-07-15 11:50:00 -04:00
Marcin Niestroj
26bd4fb45e drivers: modem: operate on device pointers instead of names
So far modem API used UART device names / labels. Change API to operate
on device pointers instead, so that we stop using device_get_binding()
in modem core and in some DT compatible modem drivers.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-07-15 11:48:00 -04:00
Stancu Florin
67360416f2 drivers: ieee802154: cc13xx_cc26xx: add subghz power saving
When stopping the interface, also abort the RX routine and enable RF
power saving. Will re-start RX on iface start.

Also fixed a bug with `cmd_fs` crashing at RF wakeup because `rf_mode`
was allocated on stack.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2021-07-15 07:04:46 -04:00
Marcin Niestroj
d08c6ee113 drivers: net: ppp: fix removing CRC16 from packet
CRC16 was removed by simply decreasing length of the last fragment by 2.
This worked as long as last fragment was longer than 1 byte. If not,
then last fragment was corrupted (its length ended up being 65535),
leading to undefined behavior.

Fix CRC16 removal by utilizing recently introduced
net_pkt_remove_tail(), that properly handles multiple fragments.

Reported-by: Jim Paris <jim@jim.sh>
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-07-15 06:54:33 -04:00
Pieter De Gendt
aedc51aca8 drivers: flash: mcux flexspi nor: Fix write on arbitrary offset
If a write offset isn't a multiple of the nor page size, and the
length is too large to fit within a single page, it could wrap around
in that page.

Tested on i.MX RT1064 internal flash using NVS settings

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-07-15 06:47:53 -04:00
Thomas Stranger
d25d385145 drivers: sensor: sht3xd: use sys functions for crc and byteorder
replace custom crc8 with sys/crc8
use sys_put/sys_get helpers for byteorder specific operations

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-15 06:44:34 -04:00
Thomas Stranger
22c8d9973b drivers: sensor: shtcx: add driver supporting shtc1 and shtc3
Add driver for sensirion consumer humidity sensor line.
Supports shtc1 and shtc3, but only shtc3 is tested.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-15 06:44:34 -04:00
Manivannan Sadhasivam
fa2d1ea422 drivers: spi: Use timeout for transfer completion
Instead of waiting forever for the SPI transfer to complete, let's use
a timeout value and bail out if elapsed. The timeout value logic is,

xfer_len/frequency + tolerance

Tolerance value can be modified using a Kconfig symbol,
CONFIG_SPI_COMPLETION_TIMEOUT_TOLERANCE. It defaults to 200ms.

Fixes: #33192

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2021-07-15 06:43:23 -04:00
Erwan Gouriou
7650d917a2 drivers/clock_control: stm32: Fixes around LSE clock
Fix macro used in g4 file to enable LSE clock.
Then, to avoid no-op configurations, generate an error
when MSI Hardware auto calibration is selected but LSE
clock is not enabled.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-15 10:13:01 +03:00
Tahir Akram
608ad430f3 drivers: modem: RSSI measurement for PPP link
This PR addresses radio signal stength measurement during
and before PPP session. The PR provides provides facility
of readout for both +CSQ and +CESQ versions depending
upon the modems. This PR follows the idea of rssi readout
of PR#35496. Additionally, reliable Cell info update
is also ensured.

Signed-off-by: Tahir Akram <mtahirbutt@hotmail.com>
2021-07-14 21:06:30 -04:00
Aymeric Aillet
573d77cff2 drivers: i2c: add Renesas R-Car driver
This patch add support for I2C on the Renesas R-Car.

This I2C hardware block can be found on various Renesas R-Car
SoC series.

It allows to perfom read and write on I2C buses in an
interrupt based way on R-Car Gen3 H3ULCB board.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-07-14 20:58:50 -04:00
Henrik Brix Andersen
21806b569f drivers: timer: add NXP LPTMR timer driver
Add NXP Kinetis Low Power Timer (LPTMR) OS timer driver shim. Since the
LPTMR does not support asynchronous changes to the timer period, only
non-tickless mode is supported.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-07-14 22:54:34 +03:00
Gerard Marull-Paretas
84b8f5e62c drivers: display: ili9xxx: remove unnecessary casts
The config/data casts are not strictly necessary. Furthermore, config
was being casted to non-const.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-07-14 13:19:32 -05:00
Gerard Marull-Paretas
4d32558038 drivers: display: ili9xxx: use spi_dt_spec
Use the recently introduced struct spi_dt_spec to store SPI information
and operate with it.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-07-14 13:19:32 -05:00
Gerard Marull-Paretas
51e53ee73f drivers: display: ili9xxx: use gpio_dt_spec
Use the recently introduced struct gpio_dt_spec to store GPIO
information and operate with them.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-07-14 13:19:32 -05:00
Johann Fischer
0500ec214c drivers: usb_dc_mcux_ehci: use K_NO_WAIT in k_heap_alloc()
This is called in ISR context and timeout must be set
to K_NO_WAIT.

Reported-by: Pieter De Gendt <pieter.degendt@basalte.be>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-07-14 13:05:18 -05:00
Johann Fischer
8eeec634ea drivers: usb_dc_mcux_ehci: fix style
Fix style, two lines are indented too far.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-07-14 13:05:18 -05:00
Thomas Stranger
94f7ed356f drivers: serial: add a dummy driver for vnd,serial
This commit adds a serial dummy driver compatible to vnd,serial.
This is needed that devices can access the uart device in tests
like tests/drivers/build_all/... .

Add myself as codeowner to avoid complicance check failure.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-14 11:10:08 -05:00
Tim Lin
abe27c5bca ITE: driver/i2c: add I2C recovery function
Use GPIO output high and low to simulate I2C start and stop
conditions to restore i2c to normal.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-14 07:32:16 -04:00
Tim Lin
8fdcc11d6b ITE: drivers/i2c: create pinmux phandle to the I2C driver node
Create the pinmux phandle to the I2C driver node in the
devicetree. When the pinmux_pin_set function in
i2c_it8xxx2_init can refer to the setting of this phandle.
It is more flexible to use.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-14 07:32:16 -04:00
Rup Gajurel
113413ad43 drivers: ethernet: stm32: add support for disabling auto-negotiation
drivers: support disabling auto-negotiation for stm32 eth drivers

Signed-off-by: Rup Gajurel <rup@fb.com>
2021-07-14 07:28:57 -04:00
Gerson Fernando Budke
0ff3616bdf drivers: usb: device: Rename usb_dc_sam to usb_dc_sam_usbhs
The SoC driver name is 'USB High-Speed Interface (USBHS)'. This rename
from usb_dc_sam to usb_dc_sam_usbhs allowing add others SoC drivers
like 'USB Device Port (UDP)' that is found at SAM4S/E variations.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-07-14 07:23:38 -04:00
Dino Li
7d5411d6e0 soc: it8xxx2: introduce SOC_IT8XXX2_PLL_FLASH_48M option
Enable SOC_IT8XXX2_PLL_FLASH_48M at default to reduce latency of
fetching code from flash.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-13 09:44:29 -04:00
Watson Zeng
1103402e90 driver: gpio: add initial support for synopsys creg gpio
Add single-register MMIO GPIO driver for complex cases where
only several fields in register belong to GPIO lines and each GPIO
line owns a field with different length and on/off value.

Such CREG GPIOs are used in Synopsys em_starterkit and HSDK boards.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-07-13 09:42:59 -04:00
Aymeric Aillet
54c481980e drivers: uart: Add "Interrupt driven" to R-Car
This commit add the support of "Interrupt driven UART"
to the R-Car UART driver and enable it in the related
Kconfig.

The driver is supporting nearly all the methods that are
described in the "Interrupt driven UART" part of the
uart_driver_api.

This new version of the driver has been tested on
H3ULCB board by running "uart_basic_api" test suite.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-07-13 09:42:22 -04:00
Thomas Stranger
a587c25156 drivers: entropy: add support for stm32wl and stm32g0
This commit adds entropy support for stm32wl and stm32g0.

Pll is used as clock source and has to be enabled,
other clock sources are not supported at the moment.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-13 09:37:48 -04:00
Thomas Stranger
7422ce6265 drivers/clock_control: stm32wl set cpu2 prescaler only for STM32WL5X
To support single core stm32wlex series, cpu2 prescaler is set
only on dual core soc variants.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-07-13 09:37:29 -04:00
Gerard Marull-Paretas
26ad8376bd pm: remove callback from control function
The callback is not used anymore, so just delete it from the pm_control
callback signature.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-13 09:36:45 -04:00
Gerard Marull-Paretas
217e610d8f pm: remove redundant callback usage
the device PM callback is not used anymore by the device PM subsystem,
so remove it from all drivers/tests using it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-13 09:36:45 -04:00
Huifeng Zhang
7bf6d88029 driver: pm_cpu_ops: change PM_CPU_OPS_PSCI's dependency
Armv8-A and Armv8-R both support PSCI. So PM_CPU_OPS_PSCI's
dependency should be "ARM64" rather than "ARMV8-A".

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2021-07-13 09:30:29 -04:00
Johan Hedberg
b10287cd69 drivers: edac: Fix PCIe Kconfig dependency
It's not possible to build the IBECC driver without PCIe support.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-07-12 20:02:00 -04:00
Gerard Marull-Paretas
165ae60e40 drivers: pinmux: stm32: fix name clashes with G4 series
There is a name clash when using G4 series LL TIM driver depending on
the inclusion order of the LL TIM and pinmux headers. If the LL headers
are included after pinmux is included, AF1 and AF2 definitions used by
pinmux clash with the AF1 and AF2 TIMx register names.

In order to solve this problem with minimum impact, the following has
been done:

1. Prefix the AFx and ANALOG definitions with STM32
2. In order to avoid changing all *-pinctrl.dtsi files, the STM32_PINMUX
   macro contatenates STM32_ with the provided mode.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-07-12 16:03:18 -05:00
Jun Lin
1974ea97a4 driver: clock: npcx: add a option to generate LFCLK via XTSOC
This commit adds a new Kconfig option CLOCK_CONTROL_NPCX_EXTERNAL_SRC.
With this option enabled, the internal 32.768 KHz clock (LFCLK) is
generated by the on-chip Crystal Oscillator (XTOSC). Otherwise, the
LFCLK is generated by the Low-Frequency Clock Generator (LFCG).

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-07-12 23:34:42 +03:00
Marcin Niestroj
c28d372d33 drivers: pwm: nrf_sw: drop deprecated 'timer-instance' DT prop
This property has been marked as deprecated in 2.5.0 and was replaced by
'generator' property.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-07-12 08:20:47 -05:00
Laczen JMS
294e2df2d9 flash_page_layout: refactor flash_page_get_info
refactor flash_page_get_info to simplify and to avoid using mixing the
usage of an off_t (offs) and an uint32_t (page_index).

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2021-07-10 14:48:22 -04:00
Krishna Mohan Dani
ca0b261b7f drivers/dma: STM32: Initialising DMA_InitStruct with 0 for stm32l5xx
In stm32l5xx soc, the LL_DMA_InitTypeDef has 2 more fields
(DoubleBufferMode and TargetMemInDoubleBufferMode) that must be
initialised with 0 else the configuration is wrong and gives
wrong values to the LL_DMA_Init function. Due to this the test
tests/drivers/dma/loop_transfer too would fail.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-07-10 12:43:19 -04:00
Flavio Ceolin
db9756045e drivers: intc_arcv2_irq_unit: Fix arc_v2_irq_unit_device_ctrl
Fix some leftovers from the pm_device_state changes.

Fixes build problem introduced in
cc2f0e9c08.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-07-09 12:51:36 -05:00
Dino Li
cb307e2c64 driver: intc: it8xxx2: wait until two equal interrupt values are read
This change ensures the CPU won't get an interrupt number which is
being generated.

it8xxx2 has a limitation for interrupt vector register.
CPU may read incorrect interrupt number in ISR.

The following is an example that got incorrect interrupt number:
1. Register IVECT = 0x10. (no interrupt pending/IVECT_OFFSET_WITH_IRQ)
2. Chip INT6 interrupt occurs (IVECT = 0x16) and jump to ISR.
3. Read interrupt vector register to determine interrupt number.
4. Higher priority interrupt occurs (for example: INT158, IVECT = 0xAE)
while the CPU is reading the interrupt vector register for EC INT6,
CPU may end up with an incorrect interrupt number between 0x16 and 0xAE.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-09 12:45:01 -05:00
Erwan Gouriou
491775549d drivers/clock_control: stm32: Fix macro to get HCLK freq
__LL_RCC_CALC_HCLK1_FREQ is only available for WL and WB series,
for other series __LL_RCC_CALC_HCLK_FREQ should be used.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-09 12:42:00 -05:00
Abram Early
bdae64279e drivers: flash: nrf_qspi_nor: Configurable RXDELAY
The nRF QSPI has a configurable delay from the rising
clock signal to the actual sample point measured in
clock cycles. This commit exposes that delay as a DTS
parameter without modifying existing behavior.

Signed-off-by: Abram Early <abram.early@gmail.com>
2021-07-09 12:23:45 -05:00
Dominik Ermel
f36569db0d drivers/flash/nrf_qspi_nor: Fix get_parameters layout dependency
The definition of qspi_flash_get_parameters, that implements
the mandatory get_parameters API call for the driver, was incorrectly
placed within block conditionally compiled when
CONFIG_FLASH_PAGE_LAYOUT is defined.
The commit fixes the issue that was causing compilation error
when the config has not been set.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-07-09 12:19:06 -05:00
Krishna Mohan Dani
b09e6fb3c5 drivers/entropy: stm32: selecting the right rng clock source
This commit selects LL_RCC_RNG_CLKSOURCE_CLK48 as a clock source
to rng peripheral. LL_RCC_RNG_CLKSOURCE_CLK48 is CLK48 divided by 3.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-07-09 09:19:39 -05:00
Aurelien Jarno
0d543f1742 drivers/sensor: Add basic TI HDC20XX support
Add basic support for TI HDC20XX series (e.g. HDC2010, HDC2021, HDC2022,
HDC2080). It is able to get temperature and humidity in the default
14-bit resolution. Triggers, resolution selection, interrupt line, auto
measurement mode are currently not supported.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-07-09 07:48:15 -04:00
Andrei Emeltchenko
f818d8770b pcie: msi: Map only actual table
Map only actual table of size n_vector * PCIE_MSIR_TABLE_ENTRY_SIZE.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-07-08 14:36:32 -04:00
Henrik Brix Andersen
b7b7709eec drivers: hwinfo: add NXP MCUX RCM hwinfo driver
Add driver shim for the NXP MCUX Reset Control Module (RCM) for
determining reset cause.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-07-08 09:33:32 -05:00
Crist Xu
c21bfdca9c driver: gpt: the gpt driver for the rt1170
reuse the gpt driver for the rt10xx, and add the related code

Signed-off-by: Crist Xu <crist.xu@nxp.com>
2021-07-07 20:59:42 -04:00
Felipe Neves
600f8c64e1 soc: riscv: esp32c3: use the new esp_rom prefix
For esp32c3 related ROM located functions instead
of esp32c3_rom.

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-07-07 20:58:50 -04:00
Felipe Neves
132ab922a8 drivers: timer: esp32c3: add esp32c3 systimer driver to CODEOWNERS
Also added maintainer to the entry

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-07-07 20:58:50 -04:00
Felipe Neves
5d736766ed soc: esp32c3: added initial soc support files for esp32c3
by adding the soc specific files such: soc initialization code,
linker scripts and support for esp32c3 devkitm

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-07-07 20:58:50 -04:00
Sylvio Alves
4303cfdb3c hal: esp32: driver changes to allow HAL update
hal_espressif repository was updated from esp-idf v4.2
to esp-idf v4.3 to allow latest Espressif chips integration.
As a consequence, it added a few changes in drivers
and peripherals. To maintain bisectability, changes in this
PR cannot be split. Here are some details:

wifi: update linker script by adding libphy and new attributes.

spi: update some APIs and fixed missing wait_idle check

west.yml: esp32: update hal to new version

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-07-07 15:01:16 -04:00
Gerard Marull-Paretas
cc2f0e9c08 pm: use enum for device PM states
Move all PM_DEVICE_STATE_* definitions to an enum. The
PM_DEVICE_STATE_SET and PM_DEVICE_STATE_GET definitions have been kept
out of the enum since they do not represent any state. However, their
name has not been changed since they will be removed soon.

All drivers and tests have been adjusted accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-07-07 14:13:12 -04:00
Marcin Niestroj
66766581c9 drivers: wifi: esp_at: notify send() caller about pending close
If stream socket is marked as pending close, make sure that send()
caller gets notified about it, so that application layer can decide to
stop trying to send anything more.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-07 08:25:34 -04:00
Marcin Niestroj
1ab0848eab drivers: wifi: esp_at: close stream socket after failure to send
So far send errors were silently ignored. This is okay for
UDP (datagram) sockets, as there is no guarantee that packets will
actually be sent successfully. In case of TCP (stream) stream sockets
however, application layer expects network stack to send requested data
as stream, without losing any part of it.

In case of send errors on stream sockets mark that socket to be closed
and stop sending any subsequent network packets, so that data stream
won't have any holes.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-07 08:25:34 -04:00
Mahesh Mahadevan
c3567c6f33 tests: arch: arm_irq_vector_table: Update to run on MXRT685
Fix for Issue#35658.
Update the custom vector table to add the OS Event timer
interrupt which is used on RT685 as the kernel system timer

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-07-07 08:25:06 -04:00
Krishna Mohan Dani
4c38ca1625 drivers/flash: stm32: Gets maximum erase time from device tree
This commit removes the huge if condition section and is
replaced with DT APIs to get the maximum erase time of a
stm32 flash from dtsi.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-07-06 19:02:19 -04:00
Sidhdharth Yadav
bdf425cd5c drivers: adc: Adding CONFIG_SOC_SERIES_STM32L5X in stm32l5 series
Allowing ADC to build in stm32l5 series.

Signed-off-by: Sidhdharth Yadav <sidhdharth.yadav@hcl.com>
2021-07-06 18:03:22 -04:00
Aurelien Jarno
2a96cc0347 drivers: adc: STM32: fix support for internal voltage reference source
Commit c045cbd336 added support for internal voltage reference source,
but in practice only the temp sensor is supported. Fix that.

Also change the code to keep the existing paths so that VREFINT and
TEMPSENSOR can be used at the same time.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-07-06 18:01:57 -04:00
Tomasz Michalec
becfed481e drivers: i2c: emul: Link emulators to correct bus
Fix i2c emulated bus initialisation code to use children of specific i2c
bus DTS node instead of first i2c bus instance.

Signed-off-by: Tomasz Michalec <tm@semihalf.com>
2021-07-06 15:19:40 -05:00
Dario Binacchi
c3a067e841 drivers: adc: stm32: fix f3x series
The patch fixes driver compile errors and ADC management for the f3x
series. It was developed and tested for the stm32f373 variant.

Tested-by: Dario Binacchi <dariobin@libero.it>
Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-07-06 15:08:04 -05:00
Fabio Baltieri
9c82898127 drivers: stm32_lptim_timer: add support for STM32WL series
Add the lptim1 device node definition and enable the corresponding
exti interrupt in sys_clock_driver_init().

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-07-06 09:51:22 -04:00
Anas Nashif
0898388080 Revert "drivers: ieee802154: configure IE header injection for nRF5"
This reverts commit bde592e91a.

This is causing build failures. Original PR #36008.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-07-05 18:54:35 -04:00
Tim Lin
91a6b286c9 ITE: drivers/i2c: it8xxx2: add mutex lock
Add mutex lock to prevent race conditions.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-07-03 08:03:10 -04:00
Jordan Yates
fb76f47f86 flash: spi_nor: convert to spi_dt_spec usage
Converts the spi_nor flash driver to use `spi_dt_spec` as a
demonstration of the simplifications that the API enables.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-07-02 21:34:16 -04:00
Jun Lin
55f21ab846 drivers: PS/2: npcx: Replace device_get_binding with DEVICE_DT_GET
Replace device_get_binding() with DEVICE_DT_GET to obtain the PS/2
controller and clock control device objects. It helps to improve the
efficiency for driver initialization as DEVICE_DT_GET is processed
at the link time rather than run time.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-07-02 15:41:28 -04:00
Jun Lin
ba39c47187 driver: PS/2: npcx: add driver support for Nuvoton npcx family
The PS/2 module in npcx provides a hardware accelerator mechanism
including an 8-bit shift register, a state machine, and control logic
that handle both the incoming and outgoing data. The hardware
accelerator mechanism is shared by 4 PS/2 channels. To support it,
this CL separates the PS/2 driver into channel and controller drivers.
The controller driver is in charge of the PS/2 transaction. The channel
driver is in charge of the connection between the Zehpyr PS/2 API
interface and controller driver.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-07-02 15:41:28 -04:00
Lukasz Maciejonczyk
bde592e91a drivers: ieee802154: configure IE header injection for nRF5
Pass enh ack data injection arguments to the nRF5 radio driver.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-07-02 13:32:10 -04:00
Henrik Brix Andersen
fe2075d140 shell: modules: promote edac mem shell subcommand to root shell command
Promote the "edac mem" shell subcommand to a generic "devmem" root shell
command. This command is useful for poking around registers and memory
outside of the EDAC drivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-07-02 13:21:25 -04:00
Henrik Brix Andersen
fadc5d15a3 drivers: adc: mcux_adc16: reduce log verbosity
Reduce the initialization done log message from informational to debug.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-07-01 17:04:04 -05:00
Ruibin Chang
d0ce9bb877 ITE drivers/pwm: add PWM for it8xxx2
Add pulse width modulator (PWM) for it8xxx2.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-07-01 13:21:06 -04:00
Dino Li
ee3ccc9696 driver: gpio: it8xxx2: enable gpio_driver_config
Fix assertion of unsupported pin.

This change also remove ngpios field.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-07-01 11:39:08 -04:00
Benedikt Schmidt
08a39c37dd boards: arm: add STM32H735G discovery kit
Add the STM32H735G discovery kit to the available boards.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2021-07-01 08:49:26 -05:00
Andrei Emeltchenko
882600834e edac: shell: Use helper functions for shell devmem command
Using helper functions decreases function complexity numbers reported
by static code analyzers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
fee256bc72 edac: shell: Print exact error with shell error message
Include to shell_error() also exact error.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
228232e29d edac: shell: Check error for log clear functions
Check errors returned by edac_ecc_error_log_clear() and
edac_parity_error_log_clear().

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
9da4e3f3dc edac: ibecc: Reduce CCM number using fallthrough
Reduce CCM number reported by Coverity by using __fallthrough.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
50c47267b4 edac: ibecc: Strip debug information
Remove debug information increasing code coverage.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
07d524357e edac: ibecc: Simplify PCI probing
Use only one pcie_conf_read() instead of several reads and make code
more readable.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
b1d79776c7 edac: ibecc: Simplify NMI handling
Refactor NMI handling making it clearer and fix return code for other
NMI source.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
b6c75cfd34 edac: ibecc: Use boolean expressions in if conditions
Use only boolean in if conditions as new coding style implies.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
9bad08e3e7 edac: shell: Use boolean expressions in if conditions
Use only boolean in if conditions as new coding style implies.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
daf8095851 edac: shell: Replace ret with err
Replace ret with err for simple int type errors.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
661eb79f6f edac: Use TODO instead of workaround in comment
Using TODO is more appropriate since workaround implies working around
a bug.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
7293587725 edac: Use -ENOSYS for not implemented mandatory API functions
Use standard Zephyr way for not implemented mandatory API functions.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
0eb48e30c6 edac: shell: Use new EDAC API in shell
Use new EDAC API in shell.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Andrei Emeltchenko
6622eccddb edac: Refactor EDAC API
Refactor EDAC API making it more clear, removing unneeded typedefs and
using check for optional and assert for mandatory APIs.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-06-30 18:29:21 -04:00
Flavio Ceolin
fbd2d2f557 drivers: ps2: Build syscall handlers
syscall handler were not being built at all !!

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-30 10:44:44 -04:00
Flavio Ceolin
297fb5a90f drivers: ps2: Fix wrong cast
ps2_read() syscall was casting the value to uint32_t *

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-30 10:44:44 -04:00
Flavio Ceolin
407ea645a0 drivers: ps2: Fix syscalls handlers
This driver was using a very old macro to declare a syscall. Fix
syscall handlers.

Fixes #23745

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-30 10:44:44 -04:00
Martí Bolívar
bd8afe9365 drivers: sensor: clean up zephyr_library calls
In drivers/sensor/CMakeLists.txt, we have various lines like this:

    add_subdirectory_ifdef(CONFIG_FOO foo)

Then drivers/sensor/foo/CMakeLists.txt says:

    zephyr_library()
    zephyr_library_sources_ifdef(CONFIG_FOO foo.c)

This is redundant; the foo/CMakeLists.txt won't be added to the build
system unless CONFIG_FOO=y in the first place, so there's no need for
extra boilerplate testing it again.

Remove all these unnecessary instances in each sensor driver's
CMakeLists.txt using this pattern:

    zephyr_library()
    zephyr_library_sources(foo.c)

In a couple of places, the '.c' extension is missing. Add them in for
consistency when that happens.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-06-30 09:36:33 -04:00
Krivorot Oleg
1d55d929db drivers: display: ili9xxx: add support for ILI9341 controller
Add support for the ILI9341 display controller.

Signed-off-by: Krivorot Oleg <krivorot.oleg@gmail.com>
2021-06-29 16:02:44 -04:00
Krzysztof Chruscinski
520ba93f5d drivers: serial: nrfx_uarte: Fix race condition in async isr
RXTO event is generated always after ENDRX and driver relies
on assumption that ENDRX event is handled before RXTO. However,
when interrupt is preempted after ENDRX check returned false
and RXTO event is already set handling order would be swapped.

Added addtional check to handle RXTO event only if ENDRX is not
set. If ENDRX is set, it means that it is not yet handled. RXTO
event is not cleared and interrupt will be triggered again and
ENDRX event will be handled first.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-06-29 11:31:31 -04:00
Armando Visconti
fa423d30a2 drivers/sensor: lis2dw12: Preserve APIs error code
Return the same error code returned by HAL i/f APIs.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
40f843ae54 drivers/sensor: lis2dw12: Set tap triggers only if detection is on
Set single/double tap triggers only if tap detection is enabled.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
de0ff0c354 drivers/sensor: lis2dw12: Fix the logic to set TAP interrupt
The lis2dw12 sensor can generate the TAP interrupt only on INT1,
while DRDY can be generated on both. The int-pin DT property
specifiy on which pin the DRDY (and not the TAP) can be generated.

This commit fix the way the trigger is set: first the driver checks
the trigger type (DRDY or TAP), then it uses the int-pin information
only in DRDY case but allows setting TAP regardless of int-pin (it
always routes it on INT1).

The previous code was first checking int-pin: if it was INT2 then
the driver refused setting TAP triggers.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
9217e37901 drivers/sensor: lis2dw12: Add multi-instance support
This commit aligns lis2dw12 sensor driver to latest multi
instance sensor driver model.

In particular it makes use of the stmemsc common routines
and move ctx handler inside struct config, so that the
bus_init routines can be totally avoided.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
77b74f1b85 drivers/sensor: lis2dw12: Remove odr values from Kconfig
Remove all odr values from Kconfig and always init it
at 12.5Hz. It is responsibility of application to set
the rate to a different value using SENSOR_ATTR_SAMPLING_FREQUENCY.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
344e06025d drivers/sensor: lis2dw12: Move range Kconfig property into dts
Converts lis2dw12 range options (2g, 4g, 8g, 16g) from Kconfigs
to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
a783a062f8 drivers/sensor: lis2dw12: Move power Kconfig property into dts
Move lis2dw12 power-mode option from Kconfigs to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
56ce558094 drivers/sensor: lis2dw12: Move trigger pulse Kconfig property into DT
Move lis2dw12 trigger pulse configurations from Kconfigs to Device Tree.
Moreover the dts properties have been renamed as 'tap', which sounds a
better name to immediately catch the feature behind it. Since tap
threshold cannot be zero, this value (which is the default in dts
binding) is used to enable/disable the device feature per each axis.
The event can be generated on INT1 only.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
8609733e76 drivers/sensor: lis2dw12: use gpio_dt_spec oriented macros
Use gpio_dt_spec structure (and related APIs) in config for configuring
the gpio used for drdy and pulse interrupts.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Armando Visconti
351b28e122 drivers/sensor: lis2dw12: move int-pin in DTS binding
Take the int-pin information (i.e. what pin between INT1
and INT2 the drdy is attached to) directly from DT.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-29 11:31:06 -04:00
Fabio Baltieri
239bd4a8ce drivers: stm32-fmc: enable MEMC_STM32 default based on dt
Default the option MEMC_STM32 to "y" when the device node is defined and
enabled, so that the driver is selected automatically when the board
supports it and MEMC is enabled.

Remove the default conditional on serise as it's redundant with the one
in soc/arm/st_stm32/common/Kconfig.defconfig.series.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-29 11:30:35 -04:00
Mahesh Mahadevan
0057c5753b drivers: hwinfo: Update i.MX RT Hwinfo driver
Add support for RT1170. The fuse register that holds
the unique device ID is different as compared to the
RT10XX series

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-06-29 11:30:00 -04:00
Ryan QIAN
2883d727a7 drivers: clock_control: add ccm driver for rt117x
- add ccm driver for rt117x

Signed-off-by: Ryan QIAN <jianghao.qian@nxp.com>
2021-06-29 11:30:00 -04:00
Mahesh Mahadevan
94bbf23e7c drivers: igpio: Do not require GPIO interrupts to be present
Some SoC's do not have a GPIO interrupt connected

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-06-29 11:30:00 -04:00
Tim Lin
442f68378c ITE: drivers/i2c: it8xxx2: no need to reset bus if there is any error
The transaction is dropped on any error(timeout, NACK, fail,
bus error, device error).

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-06-28 20:11:45 -04:00
Wealian Liao
1cb8f7c369 driver: uart: npcx: Fix building of kernel.timer.tickless
UART CR_SIN interrupt enable/disable are invoked when CONFIG_PM enable.
This removes the guard for UART CR_SIN interrupt enable/disable to fix
the build issue.

Fixed #36520

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-06-28 20:11:25 -04:00
Watson Zeng
a6cc3f1838 dts: designware-gpio: remove reduplicative property bits
bits property indicates the number of in-use slots of available slots
for GPIOS. We have a similar property ngpios in gpio-controller.yaml,
we will use ngpios to calculate port_pin_mask. Let's remove bits and
only use ngpios.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-06-28 13:53:57 -05:00
Alexandre Bourdiol
64d2449185 drivers: flash: stm32f7: Flush ART cache before Flash erase
Similar to #32218 and #34032
Flush ART cache before erase operation
(preparing ART activation)

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-28 14:17:40 -04:00
Alexandre Bourdiol
5e11fbfbe1 drivers: flash: stm32g4: implement data cache errata
Disable data cache to avoid the silicon errata ES0430 Rev 7 2.2.2
"Data cache might be corrupted during Flash memory read-while-write
operation"

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-28 14:17:40 -04:00
Alexandre Bourdiol
feacc2e16e drivers: flash: stm32f4: implement data cache errata
Disable data cache to avoid the silicon errata ES0206 Rev 16 2.2.12
"Data cache might be corrupted during Flash memory read-while-write
operation"

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-28 14:17:40 -04:00
Alexandre Bourdiol
5650609c4c drivers: flash: stm32f4: Flush ART caches before Flash erase
Similar to #32218 and #34032
Flush ART caches before erase operation
(preparing ART activation)

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-28 14:17:40 -04:00
Fabio Baltieri
5efea4283c drivers: flash: stm32f4: Flush caches after erase
This implement the same flush cache functionality already present in the
other stm32 series flash drivers, used to avoid bus errors when writing
big chunks of data to the flash.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-28 12:35:41 -04:00
Fabio Baltieri
f0c4040159 drivers: flash_stm32: enable flash_stm32l4x for STM32WL series
The flash_stm32l4x driver seems to work out of the box on the WL series.

This just adds the necessary config changes to let the driver build and
run when SOC_SERIES_STM32WLX is selected.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-28 12:35:41 -04:00
Aurelien Jarno
b94edd2393 drivers/sensor: ms5607: fix compensation for temperature < 20C
When the temperature is lower than 20C, adc_temperature is smaller than
(data->t_ref << 8), which should yield a negative value for dT. While dT
and adc_temperature are correctly declared as signed, the subtrahend is
wrongly casted to unsigned, yielding insanely high temperature values.
Fix that by casting it to int32_t instead of uint32_t.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-06-28 11:53:56 -04:00
Yasushi SHOJI
ebf35f8f93 drivers: can: Kconfig.rcar: Make options depend on its driver
Need this so that the option won't pop out without R-Car selected.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2021-06-28 10:40:18 -05:00
Tim Lin
aec4c4977d ITE: drivers/i2c: it8xxx2: i2c reset to show the device address
This change has more detail about providing the I2C peripheral
device's address to help pinpoint any issues that are device
specific and not bus specific.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-06-27 23:03:00 -04:00
Fabio Baltieri
ba786843af drivers: i2c_npcx_port: convert the driver to use DEVICE_DT_GET
Use DEVICE_DT_GET instead of device_get_binding to obtain the controller
node, so that the device address gets resolved at link time.

This means we can move the pointer form the data to the config
structure, and get rid of the data structure and associated boilerplate
entirely.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2021-06-27 23:02:39 -04:00
Fabio Baltieri
3af832868c drivers: npcx: convert NPCX drivers clock client to DEVICE_DT_GET
Convert the various device_get_binding() calls used to get the device
clock node to use DEVICE_DT_GET. The latter is processed at link time,
so it should be a bit more efficient.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2021-06-27 23:02:39 -04:00
Abram Early
bd09d4ff3f drivers: can: Timestamps depend on driver select
Instead of explicity ORing together the compatible drivers,
CAN_RX_TIMESTAMP now depends on CAN_HAS_RX_TIMESTAMP
which is selected by the drivers primary Kconfig option. In addition,
stm32fd does not need to select this option since it selected by
the underlying M_CAN driver.

Signed-off-by: Abram Early <abram.early@gmail.com>
2021-06-25 10:42:49 -04:00
Fabio Baltieri
93554f050b drivers: timer: make lptim depend on the dt node
The stm32_lptim driver is hardcoded to use lptim1.

Make the Kconfig option depend on the presence of the node label in the
devicetree, so that there's one less list of supported SoC to keep track
of.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-24 21:06:25 -04:00
Kumar Gala
b12c6dbeec drivers: hwinfo: Fix building of NXP LPC syscon driver
The NXP LPC syscon driver failed to build on several platforms for
various reasons.  We need dts support on LPC55s1x and LPC55s2x, the
driver doesn't seem like it will work on LPC54114 so we exclude it
there for now.

Additionally, fix a dtc warning on LPC55s6x based on unit-address in
the node naming needing to be lowercase.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-24 12:39:18 -05:00
Eduardo Montoya
0f73fbdbfe drivers: ieee802154: add CSL receiver for nRF5
Implement CSL receiver functionality in nRF5 radio driver.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-06-24 11:31:24 -04:00
Jordan Yates
7eb48adb52 drivers: led_gpio: use gpio_pin_set_dt
Use the simpler version of `gpio_pin_set` to demonstrate usage.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-06-24 06:40:00 -05:00
Mahesh Mahadevan
6dbffcb2a8 hwinfo: Support NXP LPC family
add hwinfo driver support for NXP's LPC family.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-06-23 18:24:08 -05:00
Radoslaw Koppel
2d2bc55f51 drivers: pwm: pwm_nrfx: Fix driver suspending
This commit clears current settings of the PWM perihperal
that are stored inside device structure.
This makes sure that PWM period and prescaler is configured
as expected after driver was suspended.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2021-06-23 03:56:30 -05:00
Wealian Liao
b4faf7fe63 driver: uart: npcx: Fix CR_SIN interrupt storm
NPCX WIMU CR_SIN is used to wake up soc from NPCX sleep power state.
The wake-up IRQ enabled when UART init. It causes the wake-up IRQ to
generate many extra interrupt events, which causes the system too busy
to handle other events. This PR moves the UART wake-up IRQ enabling
from UART init to npcx_power_enter_system_sleep() to avoid the
interrupt storm.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-06-22 20:31:09 -04:00
Tim Lin
ef3c8507a6 ite: drivers/flash: add flash driver for it8xxx2
Add flash driver for it8xxx2. The driver can implement
flash read, write and erase that will be mapped to the
ram section for executing.

TEST="flash write 0x80000 0x10 0x20 0x30 0x40 ..."
     "flash read 0x80000 0x100"
     "flash erase 0x80000 0x1000"

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-06-22 15:15:20 -04:00
Lukasz Maciejonczyk
fa1407129d drivers: ieee802154: add support for secured transmission in nRF5
Configure radio driver with MAC key pairs and frame counter.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-06-22 08:22:02 -04:00
Immo Birnbaum
dabe728eef drivers: ethernet: add support for Xilinx GEM controller
Add support for the Xilinx GEM Ethernet controller, which is integrated
in both the Xilinx Zynq and ZynqMP (UltraScale) SoC families. The driver
supports the management of a PHY attached to the respective GEM's MDIO
interface.

This driver was developed with ultimately the Zynq-7000 series in mind,
but at the time being, it is limited to use in conjunction with the
ZynqMP RPU (Cortex-R5) cores. The differences are minor when it comes
to the adjustment of the TX clock frequency derived from the current
link speed reported by the PHY, but for use in conjunction with the
Zynq-7000, some larger adjustments will have to be made when it comes
to the placement of the DMA memory area, as this involves the confi-
guration of the MMU in Cortex-A CPUs.

The driver was developed under the qemu_cortex_r5 target. The Marvell
88E1111 PHY simulated by QEMU is supported by the driver.

Limitations currently exist when it comes to timestamping or VLAN
support and other minor things. Those haven't been implemented yet,
although they are supported by the hardware. In order to be fully
supported by the ZynqMP APU, 64-bit DMA address descriptor format
support will be added.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2021-06-21 20:11:00 -04:00
Mulin Chao
fbf5b8e8de dts: pcc: npcx: add properties of pcc node to configure clock settings
This CL introduces six properties, clock-frequency, core-prescaler,
apb1/2/3/4-prescaler in pcc (Power and Clock Controller) node to
configure clock settings. It also removed the original Kconfig options
used for the same purpose.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-21 18:47:31 -04:00
Mulin Chao
6885afe432 driver: timer: npcx: add check for system kernel timer frequency
In npcx series, we use ITIM64 as system kernel timer. Its source clock
frequency must equal to CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC. This CL
added check during initialization to prevent ambiguous condition.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-21 18:47:31 -04:00
Mulin Chao
009388a321 soc: npcx: rename OSC_CLK as OFMCLK
Rename OSC_CLK as OFMCLK to meet npcx datasheet. The Oscillator
Frequency Multiplier Clock (OFMCLK), which is derived from
High-Frequency Clock Generator (HFCG), is the source clock of cortex-m4
core and most of NPCX hardware modules.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-21 18:47:31 -04:00
Crist Xu
530db5154e lpadc: a bug fix for the drivers/adc_mcux_lpadc.c
it need to be a && between two condition, to satisfy
the comment: only 12 / 13 bit resolution is supported,
if FSL_FEATURE_LPADC_HAS_CMDL_MODE is not defined. not
using ||.

Signed-off-by: Crist Xu <crist.xu@nxp.com>
2021-06-21 14:19:29 -05:00
Kumar Gala
28e4af6176 drivers: sensor: iis2iclx: Fix compile warning
Fix compile warning with clang and extraneous parentheses

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-21 10:08:24 -05:00
Kumar Gala
deb689f0f9 drivers: sensor: max17055: Fix compile error with clang
Since we are writing a register it makes more sense for the type
to be unsigned.  This hopefully address a compile warning we get
with clang:

error: implicit conversion from 'int' to 'int16_t' (aka 'short')
changes value from 32768 to -32768 [-Werror,-Wconstant-conversion]

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-21 10:08:24 -05:00
Kumar Gala
83cfcd41fc drivers: sensor: icm42605: Fix build issues
If CONFIG_ICM42605_TRIGGER is not set the driver doesn't build.  There
are a few places that need ifdefs based on CONFIG_ICM42605_TRIGGER for
the driver to build correctly.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-21 10:08:24 -05:00
Krzysztof Chruscinski
3656ba5ae9 drivers: serial: nrfx: Add pullups to RXD and CTS
Configured UART/UARTE input pins to have pullups. Otherwise when
uart is disconnected pins are floating and generate receiver
errors.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-06-18 23:49:36 +02:00
Francois Ramu
2790d2ac4c drivers: bluetooth: hci driver for stm32wb includes clock control
The definition of the STM32_LSE_CLOCK is given by the
drivers/clock_control/stm32_clock_control.h
to the hci/ipm_stm32wb driver

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-06-18 07:59:48 -05:00
Aurelien Jarno
9d0169deaf drivers/sensor: ms5607: Add I2C support
Add I2C support to the MS5607 driver, which mostly consist in adding the
I2C transfer functions.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-06-18 11:23:07 +02:00
Aurelien Jarno
593ec46c0a drivers/sensor: ms5607: Add multi-instance support
Add multi-instance support to the MS5607 driver. This is needed to
easily add I2C support later. It also simplifies a bit the driver
initialisation by using more static values.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-06-18 11:23:07 +02:00
Armando Visconti
098a5f51aa drivers/sensor: Clean unused axis structures
axis1bit16 and axis3bit16 unions are no longer used
and can be deleted from all .h files that are referencing
them.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-18 11:22:58 +02:00
Armando Visconti
7f9e3af932 modules/hal_st: Align sensor drivers to stmemsc HAL i/f v2.00
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v2.00.

Requires https://github.com/zephyrproject-rtos/hal_st/pull/7
(merged as 575de9d461aa6f430cf62c58a053675377e700f3)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-18 11:22:58 +02:00
Henrik Brix Andersen
93587e9178 drivers: led: ht16k33: reprocess keyscan events in case of i2c error
Reprocess keyscan event processing in case of an I2C bus read
error. Otherwise, the HT16K33 will be stuck (when used in IRQ mode, not
in polling mode) and no new IRQs will be delivered.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-06-18 11:22:40 +02:00
Henrik Brix Andersen
588d22a755 drivers: ht16k33: convert keyscan driver from gpio API to kscan API
Convert the keyscan portion of the Holtek HT16K33 driver to adhere to
the kscan API instead of the GPIO API.

When this driver was introduced the kscan API was not present. The
keyscan driver was therefore implemented as a GPIO interrupt driver.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-06-18 11:22:40 +02:00
Kumar Gala
7e52ee7fe1 drivers: pwm: Fix compile issues with Atmel SAM PWM driver
The was a missing comma in the DEVICE_DT_INST_DEFINE macro and the
SAME71 HAL tweaks the name of a struct so we have to work around that.

Fixes #36095

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-18 11:22:27 +02:00
Ilya Tagunov
63dbc1f4e0 drivers: lora: sx126x: cosmetic fixes
Fix minor cosmetic issues discovered while updating driver.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2021-06-18 11:22:03 +02:00
Ilya Tagunov
05957b66cb lorawan: update LoRaMac-node and move CMakeLists.txt to the main repo
Update the LoRaMac-node library to the last stable release and fix
the Zephyr glue code to match it. Move CMakeLists.txt to the main
Zephyr repository to simplify loramac-node module maintenance.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2021-06-18 11:22:03 +02:00
Ruibin Chang
d45668480a ITE driver/watchdog: add watchdog timer for it8xxx2
Add watchdog timer for it8xxx2.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-06-18 11:21:53 +02:00
Parthiban Nallathambi
dac8a6ef7d ethernet: w5500: reset_gpio isn't mandatory
reset_gpio pin isn't mandatory for function w5500.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2021-06-17 18:38:15 -05:00
Gerard Marull-Paretas
8f0657a1c4 drivers: kscan: increase init priority
Make kscan init priority higher, since it is lower than some buses like
I2C, making some devices to fail initialization if not tuning
priorities.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-06-17 07:31:41 -05:00
Chris Coleman
cb1d588ea7 drivers: wifi: eswifi: Fix err log & NET_SOCKETS_OFFLOAD=n config
Change Highlights:

- Fix error check after `k_work_reschedule_for_queue`. A value of 1
  means job was scheduled which was resulting in a ton of "<err>
  wifi_eswifi: Rescheduling socket read error" logs getting printed
  due to the erroneous check
- When using the B-L475E-IOT01A, attempts to use a TLS socket result
  in a hang when socket offload is enabled so I'd like to have a way
  to disable the option. To accomplish this, I I switched the
  `CONFIG_NET_SOCKETS_OFFLOAD=n` Kconfig option from `select` to
  `imply`.
- There was a missing `net_context_set_state()` call when
  `CONFIG_NET_SOCKETS_OFFLOAD=n`. I applied the same fix from #30664
  for this case to fix the issue.

Signed-off-by: Chris Coleman <chris@memfault.com>
2021-06-17 12:41:03 +02:00
Krishna Mohan Dani
27435cf6e5 drivers/flash: STM32: Adding flash driver for nucleo_f207zg
This commit adds the flash driver for nucleo_f207zg platform.
This has been tested with flash test application.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-06-17 12:40:39 +02:00
Jukka Rissanen
2758aeedbc drivers: modem: gsm: Ignore semaphore take return value
We do not need the return value of k_sem_take() so ignore it.

Coverity-CID: 236602
Fixes #36313

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-06-16 22:12:40 -04:00
Flavio Ceolin
0ea0344328 drivers: fxos8700: Remove unnecessary cast
Change a variable type in fxos8700_set_odr to avoid unnecessary cast.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-16 11:13:45 -05:00
Flavio Ceolin
54d33990f3 drivers: fxos8700: Make internal function static
fxos8700_set_odr is used only inside this file and don't need to be
exported.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-16 11:13:45 -05:00
Flavio Ceolin
e31d2ab6b4 drivers: fxos8700: Fix sensor_attr_set behavior
It is necessary to put the device in standby to change the contents of
CTRL_REG1. This register is used to change the sampling frequency.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-16 11:13:45 -05:00
Pieter De Gendt
46643dcb05 sensor: bq274xx: fix sleep logic when polling after softreset
The bq274xx fuel gauge does a softreset when configuring, after
which the device is polled and sealed. However the sleep logic
was inverted so the poll became blocking.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-06-16 10:39:44 +02:00
Lasse Sangild
ec174d41b6 drivers: adc: stm32: Perform calibration if set in sequence
The calibration bit previously did nothing.

Move calibration to allow call in start_read.

Signed-off-by: Lasse Sangild <lsangild@gmail.com>
2021-06-16 10:39:18 +02:00
Lasse Sangild
e4463a7d9e drivers: adc: stm32: Add STM32h7xx linearity calibration
The STM32H7 series has a special ADC, which is calibrated
on the factory. The calibration values are stored in flash
and must be retrieved upon powering up the device.

Failure to calibrate the device leads to missing codes in
the ADC readings.

Fixes #35529

Signed-off-by: Lasse Sangild <lsangild@gmail.com>
2021-06-16 10:39:18 +02:00
Aymeric Aillet
de2e14177b drivers: uart: rcar: Fix typo in conf phase
Fix typo in configuration phase to prepare the driver
for incoming add of Interrupt driven uart mode.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-06-15 20:13:55 -05:00
Rafał Kuźnia
3aae1f64a3 drivers: ieee802154: fix unintentional case fall-through
This commit fixed buggy fall-throughs introduced with
recent changes to nRF5 shim layer.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-06-15 14:26:01 +03:00
Piotr Mienkowski
aaf64e0bdf soc: atmel_sam: Add _INST to ATMEL_SAM_DT_PIN* macros
The macros are used to get the pin(s) of a given driver instance. Add
_INST prefix to match convention used by the devicetree.h. The original
macros can now be used to obtain pin(s) of an arbitrary device instance
identified by the nodelabel.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-06-14 09:50:41 -05:00
Hans Wilmers
0a345df211 drivers: modem: ublox-sara-r4: query for operator and cell info
Query the numerical network operator id, location area code (LAC)
and cell id. Following AT commands are used:

  AT+COPS?
  AT+CEREG?

Functionality is enabled by CONFIG_MODEM_CELL_INFO=y.

Tested with uBlox SARA-R410M-02B.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2021-06-14 15:19:13 +02:00
Hans Wilmers
09fd688d23 drivers: modem: gsm_ppp: query for operator and cell info
Query the numerical network operator id, location area code (LAC)
and cell id. Following AT commands are used:

  AT+COPS?
  AT+CEREG?

Functionality is enabled by CONFIG_MODEM_CELL_INFO=y.

Tested with uBlox SARA-R410M-02B.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2021-06-14 15:19:13 +02:00
Hans Wilmers
120b2165ec drivers: modem: implement operator id and cell info
Implement numerical network operator id, location area code (LAC)
and cell id in modem context and modem shell.

Please note that the functionality to query these values must be
implemented in the modem driver.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2021-06-14 15:19:13 +02:00
Jukka Rissanen
0b36b22146 drivers: eth: Enable TXTIME and PTP clock properly
Mark qemu_x86 and native_posix drivers to support both
TXTIME and PTP clock so that we can use txtime sample application
for testing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-06-14 07:00:10 -04:00
Johan Stridkvist
b3389d4a5b soc: nrf53: Tune capacitor for LFXO for nRF53 and update accuracy
Switch from using internal 6pf to internal 7pf load capacitor for LFXO.
Use a default clock accuracy of 50PPM as this matches lab results.

50PPM should be sufficient for common operating temperatures of
25degC +- 15.

Signed-off-by: Johan Stridkvist <johan.stridkvist@nordicsemi.no>
2021-06-12 08:52:00 -05:00
Lukasz Maciejonczyk
8196770737 drivers: ieee802154: propagate frame counter to upper layer
When frame counter is managed by the radio driver the upper layer
needs to be informed about the frame counter changed. The upper layer
looks for the most recent frame counter in the transmitted frame,
this is why the tx_payload need to be updated after processed by
the radio driver.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-06-12 08:51:26 -05:00
Kumar Gala
fb57b23a37 drivers: hwinfo: Exclude GECKO driver on EFR32MG21
The EFR32MG21 doesn't have a RMU and thus the driver isn't relevant for
that SoC series.  Add a Kconfig exclusion so the driver isn't available
on EFR32MG21 SoCs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-12 08:48:16 -05:00
Jose Alberto Meza
03ce67f153 drivers: espi: eSPI host DnX propagation fixes
Correct MEC15xx HAL value for DnX warn.
For consistency add automatic ack into the driver.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2021-06-11 17:45:16 -04:00
Kumar Gala
f1affb5e67 drivers: hwinfo: gecko: Fix build
Fix how HAS_BROWNOUT so things build correct and without warnings.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-06-11 16:23:05 -05:00
Luc Viala
7105875ff4 driver/uart: add enum parity element on devicetree bindings
It helps configurations of the parity mode for uart interfaces

Signed-off-by: Luc Viala <lviala@zaack.io>
2021-06-11 08:53:10 -05:00
Tim Lin
8ea58d4389 ite: drivers/adc: create pinmux phandle to the ADC driver node
Create the pinmux phandle to the ADC driver node in the
devicetree. When the pinmux_pin_set function in
adc_it8xxx2_channel_setup can refer to the setting of
this phandle. It is more flexible to use.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-06-11 15:47:25 +02:00
Erwan Gouriou
88cf73d58f drivers/pinmux: stm32: Remove unused definition
`STM32_PINMUX_NAME` is not used anymore.
Removed

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-06-11 08:04:39 -05:00
Erwan Gouriou
fcc3177509 drivers/pinmux: stm32: Move stm32 driver from stm32/
Since we removed various series headers, move stm32 driver
under main driver/pinmux folder.
Take this change into account into various drivers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-06-11 08:04:39 -05:00
Erwan Gouriou
00e1adda5c drivers/pinmux: stm32: Remove deprecated pinmux series headers
These headers were deprecated since release V2.5.0.
Users are expected to use dts based configuration API.
Remove these headers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-06-11 08:04:39 -05:00
Jedrzej Ciupis
15fef0d2f5 drivers: ieee802154: extend capabilities
This commit extends the capabilities of the nRF IEEE 802.15.4 radio
driver with IEEE802154_HW_TX_SEC capability.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2021-06-11 07:35:53 -05:00
Henrik Brix Andersen
35733ca385 drivers: timer: hide CONFIG_APIC_TIMER_IRQ_PRIORITY when not applicable
Make the APIC_TIMER_IRQ_PRIORITY Kconfig depend on APIC_TIMER ||
APIC_TSC_DEADLINE_TIMER to hide it in menuconfig when not applicable.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-06-10 18:15:01 -04:00
Yonatan Schachter
782c9b7973 drivers: hwinfo: Added Gecko support for reset cause
This commit provides implementations for the reset cause
API functions as part of hwinfo.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2021-06-10 17:10:28 -04:00
Alexandre Bourdiol
f021fa8e80 drivers: flash: stm32f4: Remove useless definition and use CMSIS
Remove useless definiton STM32F4X_SECTOR_MASK and use CMSIS instead.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-10 15:53:41 -05:00
Alexandre Bourdiol
6798135694 drivers: flash: stm32f7: Remove useless definition and use CMSIS
Remove useless definiton STM32F7X_SECTOR_MASK and use CMSIS instead.
By the way fix bug as '|' should be in fact '&',
but thanks to '~' inversion, '|' is now good.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-06-10 15:53:41 -05:00
Rafał Kuźnia
cab64a9c61 drivers: ieee802154: copy back the TX buffer into the upper layer
Copy back the TX buffer content back into the upper layer
in case of a TX failure.

This is necessary in when frame encryption by the radio driver
is used. The shim layer for the nRF5 driver has a buffer, that
is used by the driver to authenticate and encrypt the frame
in-place. In case of a TX failure, the buffer contents
are propagated back to the upper layer. The upper layer
must use the same secured frame for retransmission.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-06-10 11:03:40 +03:00
Rafał Kuźnia
9070190bc6 drivers: ieee802154: add option to retransmit a frame
Use the nrf_802154_retransmit_csma_ca_raw and
nrf_802154_retransmit_at_raw API to retry the frame transmission
after a failed attempt.

The retry must be performed only in response to
a nrf_802154_transmit_failed event.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-06-10 11:03:40 +03:00
Lingao Meng
9644e9bc99 drivers: Fix missing auto_attach_cmd
When run native posix with `-attach_uart_cmd=<cmd>`,
should attach cmd by arguments.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-06-09 16:18:17 +02:00
Lukasz Maciejonczyk
4113a43bff drivers: ieee802154: fix serialization issue in nRF5
Function 'nrf_802154_transmitted_timestamp_raw' is not serialized and
connot be used for multi-core devices yet.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-06-09 16:11:58 +03:00
Jamie McCrae
6637c5bb4a drivers: ethernet: enc424j600: Add config get support for driver
This allows the current speed of the connection (100Mbps/10Mbps) and
if it is operating in half or full duplex to be queried

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-06-09 11:45:10 +03:00
Jamie McCrae
5719e545af drivers: ethernet: enc424j600: Reduce interrupt command lengths
The enc424j600 chipet has 1-byte commands to enable or disable
interrupts which an be used rather than the currently used 4-byte
commands to speed the process up by a factor of 4x

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-06-08 15:42:59 -05:00
Fabio Baltieri
b06f4a5e72 drivers: flash_stm32_v1: fix a potential unaligned access
The flash write function casts a void * to flash_prg_t, which can be 2,
4 or 8 bytes long depending on the SoC. This can trigger a hard fault
exception if data is not aligned, such as when passing a constant string
from settings_save_one().

Copying the chunk of data to a temporary variable on the stack to avoid
the problem.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-08 11:15:59 -05:00
Marcin Niestroj
0b59257d93 drivers: wifi: esp32: create event handling thread in runtime
Commit 95b916d104 ("drivers: wifi: esp32: fix reconnect issue")
switched from thread created at runtime to statically defined thread.
The difference is mainly visible for simple applications that use
CONFIG_NET_CONFIG_AUTO_INIT=y, where networking setup code is executed
before main() and any statically defined threads. All ESP32 events are
just queued and never handled, so conditions enforced by
CONFIG_NET_CONFIG_NEED_IPV4=y are never met (e.g. Zephyr networking
layer is never informed about being connected).

Switch back to thread created at runtime, which starts at the moment
when k_thread_create() is invoked. This allows ESP32 event processing to
happen just after ESP32 WiFi driver gets initialized and before Zephyr
network auto initialization code (CONFIG_NET_CONFIG_AUTO_INIT=y).

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-06-08 11:15:38 -05:00
Henrik Brix Andersen
a25afdd470 drivers: eeprom: at2x: convert to new DT helper macros
Simplify the the AT2x EEPROM instance initialization macro a bit by
converting it to use the new DT helper macros for SPI and GPIO.

This also saves a few bytes when only AT24 support is enabled.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-06-08 16:09:39 +02:00
Eduardo Montoya
ae44b30b41 drivers: ieee802154: include timestamp in acks
Fill the ACK timestamp field in nRF5 driver. This is required by
OpenThread for the proper CSL transmitter functioning.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-06-08 04:54:38 -05:00
Arvin Farahmand
98a0ccd5c5 drivers: hwinfo: Add reset cause support
Add `hwinfo_get_reset_cause` and `hwinfo_clear_reset_cause` to retrieve
and to clear cause of system reset on supported platforms.

Different platforms can provide different causes of reset, however
there is a great deal of overlap. `enum reset_cause` can be expanded in
the future to support additional reasons, as additional platforms are
supported.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-06-08 10:16:17 +02:00
Jose Alberto Meza
c85e11c05b drivers: espi: Propagate eSPI host DnX warning to driver's client
Propagate Download and Execute (DnX) entry warning.
Add missing handler for SUS warning power down ack.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2021-06-07 23:52:17 -04:00
Daniel Leung
4e1692f85a serial: introduce CONFIG_UART_USE_RUNTIME_CONFIGURE
This kconfig option enables runtime configuration of UART
controllers. This allows application to call uart_configure()
to configure the UART controllers and calling uart_config_get()
to retrieve configuration. If this is disabled, UART controllers
rely on UART driver's initialization function to properly
configure the controller. The main use of this option is mainly
code size reduction.

Fixes #16231

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-06-07 12:09:01 +02:00
Mulin Chao
a31378dec1 driver: clock: npcx: add apb4 clock support for npcx9 series.
Add apb4 clock support for npcx9 and later series.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-07 12:06:33 +02:00
Mulin Chao
87f29ef5bb driver: adc: npcx: replace constant value with DT_INST_PROP_LEN macro.
In this CL, instead of a constant value, we use the length of property
'pinctrl-0' of adc0 to indicate the number of ADC channels in different
npcx series.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-07 12:06:33 +02:00
Julien Massot
3ced1ddb85 drivers: can: Add Renesas R-Car driver
This driver is for classic CAN, it makes use of CAN interface
in FIFO mode.

This driver support Standard ID as well as Extended ID.

Tested on H3ULCB, Ebisu platform, with external adapter and
in loopback mode.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2021-06-07 12:06:21 +02:00
Julien Massot
d79044cd2b drivers: can: mcp2515: move filter_match function
Move filter match function to can_utils.h, so that it
can be reused for Renesas driver.

Preserve copyright from Karsten Koenig.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2021-06-07 12:06:21 +02:00
Fabio Baltieri
03adc1e2bb drivers: clock_stm32: add APB3 support for STM32WL
STM32WL series have an extra APB3 bus with the SUBGHZSPI device on it.
Add the relevant code to enable and disable that clock, and to obtain
the actual clock rate. This is enough to run the STM32 SPI driver
against it.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-07 12:04:15 +02:00
Fabio Baltieri
fbf2f81c43 drivers: stm32_adc: add STM32WL family support
Add ADC support for the STM32WL family, this seems to work following
most of the L0X code path.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-07 12:04:15 +02:00
Fabio Baltieri
cb355f6e6c drivers: stm32_rtc: add STM32WL family support
Add RTC counter support for the STM32WL family.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-06-07 12:04:15 +02:00
Tim Lin
958c79ea5a ite: drivers/i2c: it8xxx2: Don't check bus busy during repeat start
If the transaction of write to read is divided into two transfers,
the second transfer will go to check bus busy and cause i2c reset.
This change adds flag to eliminate this situation.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-06-04 16:30:45 -05:00
Armando Visconti
fcb0953309 drivers/sensor: lis2mdl: Add multi-instance support
Add multi-instance support and make use of the stmemsc i2c/spi
read/write routine that has been introduced to simplify the ST
sensor drivers code.

Moreover, move spi-full-duplex property from Kconfig inside Device
Tree, so that each LIS2MDL instance can be configured selectively
in accordance to how it is used in h/w.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-04 16:29:45 -05:00
Robert Szczepanski
ba56d751c0 drivers: gpio_litex: add support for changing IRQ type
LiteX GPIOIn module provides possibility to change IRQ mode
and edge via CSRs. This commit adds support for that feature.

Signed-off-by: Robert Szczepanski <rszczepanski@internships.antmicro.com>
2021-06-04 16:24:52 -05:00
Robert Szczepanski
639e1d1b36 drivers: gpio_litex: add support for disabling IRQs and update devicetree
This adds missing option to disable IRQs.
Devicetree is modified to match previous commit with custom IRQ CSR
addresses.

Signed-off-by: Robert Szczepanski <rszczepanski@internships.antmicro.com>
2021-06-04 16:24:52 -05:00
Raptor Engineering Development Team
0061a61f14 drivers: gpio_litex: make IRQ CSR addresses adjustable for user
This adds an option to set IRQ pending and IRQ enabled CSR adresses
in devicetree since these can be custom in LiteX.

Signed-off-by: Raptor Engineering Development Team <support@raptorengineering.com>
2021-06-04 16:24:52 -05:00
Robert Szczepanski
cf385b0a15 drivers: gpio_litex: add support for litex_vexriscv GPIO interrupts
This commit adds support for GPIO interrupts in GPIO driver for Litex
SoC Builder.

Signed-off-by: Robert Szczepanski <rszczepanski@internships.antmicro.com>
2021-06-04 16:24:52 -05:00
Henrik Brix Andersen
2dc90a0825 drivers: adc: mcp320x: convert to new DT helper macros
Simplify the the MCP320x instance initialization macro a bit by
converting it to use the new DT helper macros for SPI.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-06-04 16:19:01 -05:00
Henrik Brix Andersen
7c6c65e384 drivers: gpio: lmp90xxx: convert to new DT helper macros
Convert from using device_get_binding() to DEVICE_DT_GET().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-06-04 16:18:51 -05:00
Henrik Brix Andersen
31fc67d9ae drivers: adc: lmp90xxx: convert to new DT helper macros
Simplify the LMP90xxx instance initialization macro a bit by converting
it to use the new DT helper macros for SPI and GPIO.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-06-04 16:18:51 -05:00
Guillaume Lager
42835a780a drivers: sensor: tmp116: Check that a new value is available
Add a check to ensure that the conversion is complete before reading

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-06-04 16:18:33 -05:00
Guillaume Lager
c40f0ec108 drivers: sensor: tmp116: Fix compilation error
commit d31ed3be04 enabled multiple
instances but when multiple instances are actually used the code does
not compile

Signed-off-by: Guillaume Lager <g.lager@innoseis.com>
2021-06-04 16:18:33 -05:00
Mulin Chao
a8a217f22d dts: npcx: replace series-prefix 'npcx7-' with famliy-prefix 'npcx-'
This CL replaces series-prefix "npcx7-" with family-"npcx-" for npcx dts
nodes such as 'espi-vws-map' and 'miwus-int-map'. Since we plan to
introduce the npcx9 and later series, adding a new node such as
npcx9-espi-vws-map for each series is more complicated and not
necessary.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-06-04 16:14:48 -05:00
Anas Nashif
24bd45b287 pm: do not use deprecate Kconfig
CONFIG_DEVICE_POWER_MANAGEMENT is deprecated, use CONFIG_PM_DEVICE
instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-06-04 12:19:38 -05:00
Stancu Florin
8ebb641ef7 drivers: cc13xx_cc26xx: fix pm.h not included
Fixes #35916.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2021-06-04 10:24:10 -05:00
Gerard Marull-Paretas
45a6de6804 drivers: fix pm callback signature
For some reason a few drivers were not converted to the new device PM
callback signature. The reason may be because the device PM part is
compiled only when CONFIG_PM_DEVICE=y, a condition not enabled in CI by
default.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-06-04 08:16:49 -05:00
Christoph Steiger
6ce18c6e6a drivers: can: mcan: Fix DBTP sjw register writes
The data-sjw value was incorrectly written to the NBTP register when it
should be written to the DBTP register.

This fixes a regression introduced by
5e0ca9b41e.

Signed-off-by: Christoph Steiger <c.steiger@lemonage.de>
2021-06-04 08:12:12 -05:00
Armando Visconti
e879be1dbb drivers/sensor: lis2mdl: Fix temperature sample handling
The lis2mdl temperature samples work with a level of 25 Celsius.
When temperature goes below that level the samples become negative
and there was an issue in properly propagating the sign.

Fix #35910

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-03 09:44:31 -05:00
Armando Visconti
4e8c809d74 drivers/sensor: lps22hh: Fix the raw to kPa sample conversion
The lps22hh 24 bit raw sample is left aligned, which means that
it needs to be right-shifted by 8 before applying conversion.
Moreover the conversion has been simplified for clarity.

Fix #35871

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-03 09:30:42 -05:00
Armando Visconti
282a644b0e drivers/sensor: lis2dh: use gpio_dt_spec oriented macros
Use gpio_dt_spec structure and related macros for both drdy
and AnyMotion interrupts, to have a more compat, readable and
safe code. Moreover, skip setting DRDY or AnyMotion trigger
from application if the corresponding irq-gpios has not been set.

(This commit also fixes #34794)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-06-02 08:51:14 -05:00
Alexander Wachter
5e0ca9b41e drivers: can: sjw == 0 in can_set_timing should not change sjw
If the supplied sjw in the timing parameters is zero,
the sjw parameter should not be changed.
This fixes the uninitialized swj in can_set_bitrate.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-06-01 07:29:36 -05:00
Henrik Brix Andersen
9138e87925 drivers: i2c: gpio: fix compilation
Fix the compilation of i2c_gpio.c after the gpio_config() syscall was
removed.

Fixes: 3632815e2e

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-06-01 07:27:27 -05:00
Kumar Gala
7f77240126 drivers: gpio: mcux_lpc: Convert driver to use devicetree port prop
Move to using port property for a few cases in which we need to know
which specific hardware port a device is for.  This allows us to
remove the PORT0/1 Kconfig options.  This also fixes the issue that
assumed pio0 would map to DT_INST(0) and pio1 would map to DT_INST(1)

Fixes #35693

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-31 17:45:05 +02:00
Krzysztof Chruscinski
edff2b020f drivers: serial: nrf_uarte: Fix async/int TX api in inactive state
Currently zephyr has no means to control access to the uart
driver when it is inactive, e.g. shell is not aware of uart
being in idle state and calls asynchronous api. Add early
return to TX starting procedure if device is idle.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-28 10:06:15 -05:00
Krzysztof Chruscinski
8e6898ef14 drivers: flash: nrf_qspi_nor: Fix no multithreading compilation
Fixing error introduced in 951e72b947
where ifdef was converted to IS_ENABLED. Ifdef was required because
element in the struct does not exist when multithreading is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-28 15:32:43 +02:00
Affrin Pinhero
2c61c06a0e drivers/ADC: STM32: This solves coverity reported in ADC driver.
This commit it to resolve following bugs:
* Operands don't affect result.
* Logical dead code in stm32_adc driver.
Above mentioned bugs were solved by adding parenthesis and
changed the method of comparing. Since comparison of ADC
channel_id with the channel may cause loss of value.
So instead of direct comparison, introduced a mechanism to
convert channel constant to a decimal using
__LL_ADC_CHANNEL_TO_DECIMAL_NB() and strips away
the INTERNAL_CH bit and then compare with channel_id.

fix:
* zephyrproject-rtos/zephyr#35130
* zephyrproject-rtos/zephyr#35136

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
2021-05-27 15:55:19 -05:00
Thomas Stranger
12c80eba71 drivers: can: init timing.sjw also in canfd mode
This commit resolves the undefined behviour caused by missing timing.sjw
initialization.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-27 15:54:30 -05:00
Eduardo Montoya
9c6895105d drivers: ieee802154: fix ACK length handling
OpenThread expects the FCS field at the end of the ACK frame to be
passed with `otPlatRadioTxDone`.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-05-27 12:59:06 -05:00
Emil Lindqvist
9b7d9d43b8 drivers: modem: ublox-sara-r4: implement F_GETFL in ioctl
Zephyr sees fnctl as an alias of ioctl, and so the F_GETFL
request should be handled here as well.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-05-27 15:44:03 +02:00
Sylvio Alves
95b916d104 drivers: wifi: esp32: fix reconnect issue
Device won't reconnect automatically even if
AP station is available. This fix adds the carrier event, indicating
that network is present again enabling DHCP bound event.
Also, internal wifi event callback was added into wifi
driver to enable proper event handling.

Update west.yml to bring exposed wifi event callback.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>

Fixes #33843
2021-05-27 08:23:06 -05:00
Flavio Ceolin
15b071d821 drivers: can: Fix compilation issue
Remove extra (and syntactically wrong) semicolon.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-27 07:05:34 -05:00
Flavio Ceolin
18e9ec70d6 drivers: can: can_set_bitrate is not a syscall
There was a verification function for can_set_bitrate calling a syscall
implementation. But, can_set_bitrate is not a syscall and does not need
to be because it is accessing the driver through other syscalls.

Fixes #34734

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-27 07:05:34 -05:00
Krzysztof Chruscinski
909fbb2086 drivers: console: rtt: Add no multithreading support
Avoid calling k_sleep when multithreading is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-27 13:33:02 +02:00
Casper Bonde
afe469eac7 Bluetooth: ISO: Speed up BT ISO data processing
For the native posix build the sleep calls used in tasks will stall
the zephyr instance which sets an upper limit on the data processing
interval to once every 20-30 millisecond.
This change reduces the duration of the sleep calls and increases the
TICKS_PER_SECOND to allow for shorter sleeps. This is needed to
support the data rates needed for LE Audio streaming. The rate is
tuned to support up to bidirectional 5ms ISO-intervals.
This change also increases the ISO buffer count from 1 to 5 to
allow for some buffering in the controller, which is needed for
gapless playback and/or use of burst number larger than 1.

Signed-off-by: Casper Bonde <casper_bonde@bose.com>
2021-05-27 13:16:40 +02:00
Scott Worley
825170e00b drivers: pinmux: mchp: Update pinmux based on latest HAL
Microchip HAL 1.2.0 fixed a bug in the define of GPIO
control register MUX field. The incorrect MUX defined
cleared by GPIO input pad disable field by accident.
After the MUX definition was corrected the pinmux driver
must be modified to mask off the input pad disable for
the pin to be operational.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-05-26 19:09:47 -05:00
Piotr Mienkowski
a323a41fc2 sensor: qdec_sam: use compatible atmel,sam-tc-qdec
Change the drivers's compatible from atmel,sam-tc to atmel,sam-tc-qdec.
The atmel,sam-tc should be reserved for the future counter driver.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-05-26 18:13:10 -05:00
Affrin Pinhero
c1daae647e driver/spi: STM32 Revert while loop on tx only
This commit reverted while loop on tx only.
This commit solves SPI loopback failure and SPI wrong behaviour on RX.
fix:
* zephyrproject-rtos/zephyr#35297
* zephyrproject-rtos/zephyr#35539

Revert "drivers/spi: STM32: This solves SPI infinite loop on Tranceive"

This reverts commit 50c2acbc03e7a48a09880b6fcb8c22256bffa70c.

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
2021-05-26 10:38:21 -05:00
Flavio Ceolin
d67a5786bc pm: device_runtime: Change API behavior s/_sync/_async
Most APIs have the default synchronous and an asynchronous version
with the sufix _async because that is the most common use.

All devices in tree right now are using the synchronous version, so
just change it to be consistent with the rest of the system.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Krzysztof Chruscinski
951e72b947 drivers: flash: nrf_qspi_nor: Fix no multithreading configuration
File was failing to compile when multithreading was off.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-26 11:51:23 +02:00
Kamil Panek
8a23205a22 drivers: wifi: eswifi: fix swapped protocols in eswifi_off_getaddrinfo
As a result, when values returned by getaddrinfo were used, the wrong
socket was created.

Signed-off-by: Kamil Panek <kamil.panek@wbudowane.pl>
2021-05-25 16:59:17 -05:00
Gerard Marull-Paretas
01565fa17d drivers: adc: lmp90xxx: check read REG_ADC_DONE error code
Check the error code returned when reading REG_ADC_DONE, return if
non-zero.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-25 12:53:35 -05:00
Gerard Marull-Paretas
2352da2e56 drivers: adc: lmp90xxx: fix incorrect buffer size
sizeof() reported the size of the val pointer, not the variable size.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-25 12:53:35 -05:00
Arvin Farahmand
d1d494e2b7 drivers: flash: bugfix: set atmel SAM0 write-block-size
`write-block-size` property in multiple Atmel SAM SoCs was either
missing or set incorrectly.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-05-25 11:59:45 -05:00
Watson Zeng
f05593e726 arc: interrupt_controller: increase irq unit priority
arc_v2_irq_unit_init function will init all interrupts and disable
they, we must make sure we call it first before we use interrupts.
so we need to increase its priority to highest in PRE_KERNEL_1 stage.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-05-25 07:37:02 -05:00
Anas Nashif
108129cf7d tracing: fix conflict with RTT locking
Make custom RTT locking configurable and select it where it is needed.
When using RTT for tracing we want to use the default locking.

Update both segger and tracerecorder modules to support that.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-05-25 07:36:38 -05:00
Andrzej Głąbek
457a28bf78 drivers: nrf_rtc_timer: Remove unnecessary locking
As per description of the sys_clock_elapsed() function, "the kernel
will call this with appropriate locking, the driver needs only provide
an instantaneous answer". Remove then the unnecessary locking from the
function, as it only adds an undesirable delay.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-05-24 23:53:18 -04:00
Maksim Masalski
0f5aab1182 drivers: change suffix ull to ULL
Replace suffix ull to ULL to increase code readability and prevent
unexpected behaviours, because the lowercase character l shall not be
used in a literal suffix

Found as a coding guideline violation (MISRA R7.3) by static
coding scanning tool.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2021-05-21 18:13:01 -04:00
Johann Fischer
de974efebb drivers: eth_enc424j600: explicitly disable INTIE after reset
After system reset (SETETHRST) interrupt enable register (EIE)
has the default value 0x8010 and global interrupt enable flag (INTIE)
is set. This is not desired and the INTIE flag should be set only at
the end of the initialization.

Disable INTIE flag and set desired interrupts sources in
a single write command just right after system reset.

Resolves: #35091

Reported-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-05-21 07:35:19 -04:00
Johann Fischer
6de9c18f03 drivers: eth_enc424j600: terminate driver thread only when debugging
The controller has several interrupt sources which are signaled
via a single INT pin. Only the interrupt sources that are explicitly
switched on during controller initialization may generate an interrupt
signal. Currently there are only PHY Link Status Change Interrupt
and RX Packet Pending Interrupt enabled. So there is no other reason why
an interrupt can be triggered.

Terminate interrupt handling thread on unknown interrupt
only when debugging, as there are concerns that stopping
thread in the field is going too far.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-05-21 07:35:19 -04:00
Francois Ramu
aa2e915fbf drivers: dma: stm32 dmamux has request 0 for mem-to-mem
The request ID = 0 is allowed for mem-to-mem data
transfer through the DMAMUX.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-05-21 04:55:02 -05:00
Krzysztof Chruscinski
7d61be9e79 drivers: serial: nrf_uarte: Fix uart_callback_set unsupported handling
Function should return -ENOTSUP when asynchronous api is not
supported by the device.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-21 04:53:19 -05:00
Krzysztof Chruscinski
8af5dbc977 drivers: serial: nrf_uarte: Fix power management transitions
Deadlock may occur when uart device was put to low power state
while uart_poll_out was in progress. Poll out pends until uarte
is ready to send new byte and it is detected by endtx and txstopped
events being set. When uarte was disabled while poll_out was pending
events were never set and that lead to deadlock. Added a step
in going to low power state in which CPU waits for txstopped event
and only after that uarte peripheral is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-21 04:53:19 -05:00
Armando Visconti
468c553190 drivers/sensor: iis2iclx: (FIX) enable interrupt selectively
(same considerations as commit 2f01479b)
In a multi-instance driver it may happen that on some h/w
one device should use interrupts and a second device should use
polling mode. So, CONFIG_IIS2ICLX_TRIGGER is not enough to discriminmate
if interrupt inizialization routine should be called or not; the choice
is now based whether the "irq-gpios" property is present in the DT
for that particular instance or not.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-20 17:55:08 -04:00
Armando Visconti
1f851bc268 drivers/sensor: lsm6dso: use gpio_dt_spec oriented macros
Use gpio_pin_configure_dt() and gpio_pin_interrupt_configure_dt()
for drdy_gpio: they result in a more readable code.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-20 17:55:08 -04:00
Simon Guinot
1945f70eee drivers: dma: stm32: fix build for STM32F0 MCUs
The STM32F0 MCUs (except STM32F030XC) don't have a DMA channel selection
register (DMA_CSELR). This patch fixes the build of the dma_stm32 driver
for them.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-05-20 13:24:18 -05:00
Simon Guinot
aa8e34302a drivers: systick: fix cycle count in sys_clock_set_timeout()
With this patch the sys_clock_set_timeout function counts the cycles
elapsed while computing the systick timer's new load (tickless mode).
This cycles are then added to the total cycle count instead of being
lost.

This patch mitigates uptime drifting in tickless mode (especially when
high frequency timers are registered).

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-05-20 08:44:55 -05:00
Alexander Wachter
1c792fb0b5 drivers: sensors: sbs-gauge: add CHAN_ALL to fetch
Add the SENSORS_CHAN_ALL to the fetch function.

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2021-05-19 08:56:21 -05:00
Shlomi Vaknin
1b4f7e5651 drivers: uart: stm32: fix handling interrupt and async api in isr
When using the uart driver with interrupt and async api
at the same time (instance for interrupt and instance for async),
the transmission complete interrupt was handled in the async
handling section, even when interrupt driven api is used.
This caused transmission to not work properly in interrupt mode.
The fix is to move the interrupt mode handling to the begginning
of the isr. If async mode is used then interrupt mode code
will not be run.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-05-19 08:12:55 -05:00
Ryan Erickson
a1498f3e40 drivers: modem: hl7800: +KSRAT dependent on firmware version
The reboot option of the +KSRAT command is only
supported by newer firmware.
Add a check to determine what version of the command
to use when setting the RAT.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-05-19 08:09:37 -05:00
Marek Pieta
3851a14ff8 drivers: led_pwm: Update pm_control function
Change updates pm_control function to make it compatible with new
API.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-05-19 07:52:02 -05:00
Simon Guinot
df01148aeb drivers: led_pwm: fix device name fallback
If the label property is missing in a "pwm-leds" compatible DT node
(which is almost always the case), then the device name is now set to
DT_NODE_FULL_NAME instead of "LED_PWM_$inst" previously.

This allows applications to use the DEVICE_DT_NAME macro to retrieve
the device name instead of gessing an arbitrary string.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-05-19 11:56:01 +02:00
Daniel Leung
7295c19893 gpio: intel: fix reg address for Apollo Lake
On Apollo Lake, each GPIO controller has more than 32 pins.
But Zephyr API can only manipulate 32 pins per controller.
So the workaround is to divide each hardware GPIO controller
into 32-pin blocks so each block has a GPIO driver instance.
Compounding to the issue is that there cannot be two device
tree nodes with same register address. So another workaround
is to increment the register addresses by 1 for each block.
So when mapping the address, the lowest 8-bit needs to be
masked to get the actual hardware address.

Fixes #28551

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-05-18 20:45:55 -04:00
Armando Visconti
b430b8d6a6 drivers/sensor: iis2iclx: Fix shub for multi-instance case
In case of multi-instance the driver tries to discover whether
there are devices attached to SDx/SCx sensorhub bus. If not it
just turns the shub_inited variable (inside data structure) to false
and skips doing any further sensorhub related action for that
particular IIS2ICLX device instance, regardless the fact that the
macro CONFIG_IIS2ICLC_SENSORHUB is enabled.

Moreover, the info found during the enumeration process for a
particular instance (number and types of attached devices) must be
saved inside the per-instance data structure, so that more than one
IIS2ICLX device can be used as a sensorhub without interfering with
the others.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-18 11:18:08 -05:00
Armando Visconti
1325525e3b drivers/sensor: lsm6dso: Fix shub for multi-instance case
In case of multi-instance the driver tries to discover whether
there are devices attached to SDx/SCx sensorhub bus. If not it
just turns the shub_inited variable (inside data structure) to false
and skips doing any further sensorhub related action for that
particular LSM6DSO device instance, regardless the fact that the macro
CONFIG_LSM6DSO_SENSORHUB is enabled.

Moreover, the info found during the enumeration process for a
particular instance (number and types of attached devices) must be
saved inside the per-instance data structure, so that more than one
LSM6DSO device can be used as a sensorhub without interfering with
the others.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-18 11:18:08 -05:00
Alexandre Bourdiol
d915eb8252 drivers: ethernet: stm32: enable IRQ at the end of iface init
This avoid IRQ to be handle before iface init is finished
(especially before iface address is set)
Fixes #32771

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-05-17 10:59:43 -04:00
Jukka Rissanen
546b79e6bb drivers: uart_mux: Fix compilation after logging changes
The logging macros use _Generic() atm and it started to complain
when we are trying to print pointer value of gsm_dlci and gsm_mux
structs. Cast the pointer value to (void *) to overcome this.

Fixes #35329

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-05-17 10:57:53 -04:00
Krzysztof Chruscinski
0ee3da91ac drivers: serial: nrf_uarte: Fix checkpatch issues
Fixing checkpatch issues. No functional changes.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-17 16:23:11 +02:00
Krzysztof Chruscinski
1ddfea32bf drivers: serial: nrf_uarte: Add missing check for async API
uarte_enable function was not supporting a case when async
api was enabled but instance did not use it. Added runtime
check for async instance presence.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-17 16:23:11 +02:00
Krzysztof Chruscinski
485f593bb7 drivers: serial: nrf_uart: Disable uart when fifo_fill not used
Driver was failing when interrupt mode was enabled for given
instance but interrupt driven TX part was not used. In that
case uart was not disabled after sending a byte which resulted
in continuous interrupt triggering. Added check for
fifo_fill_lock which is set when uart_fifo_fill is used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-17 16:23:11 +02:00
Sylvio Alves
384d05932f driver: uart: esp32: DT fix to allow uart2
UART2 would not be available with current DT implementation.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-05-14 16:41:03 -04:00
Ryan Erickson
62ccddb035 drivers: modem: hl7800: fix update RAT
The default behavior of the +KSRAT= command has
changed to not reboot the HL7800.
Adjust the command so the reboot takes place properly.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-05-14 08:25:49 -05:00
Kumar Gala
21d1ad3762 drivers: gpio: gpio_cy8c95xx: Add error check of i2c_reg_read_byte
Check return value from i2c_reg_read_byte and error out if it
received an error

Fixes #35155

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-14 02:56:31 -05:00
Alexandre Bourdiol
c3d35d89a3 drivers: bluetooth: hci: increase spi_rx_stack
Thread analyze:
 BT SPI RX : STACK: unused 216 usage 296 / 512 (57 %)

Fixes #34601

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-05-13 22:07:45 -04:00
Kieran Mackey
5e10e77b69 drivers: dac: mcp4725: remove usage of device_pm_control_nop
Fixes issue #35263

Signed-off-by: Kieran Mackey <kieran.mackey@lairdconnect.com>
2021-05-13 22:04:14 -04:00
Tim Lin
5f5fb7d792 ite: drivers/adc: it8xxx2: fix adc driver flow
This commit fixes the ADC driver flow. And add internal
reference voltage to ADC driver API. And correct the
data buffer that only need to store raw data.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-05-13 11:54:05 -04:00
Tim Lin
bb40d93f27 ite: drivers/i2c: it8xxx2: fix slave address from 7-bit to 8-bit
This commit fixes the slave address from 7-bit to 8-bit.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-05-13 11:52:53 -04:00
Tim Lin
7b0a89e4c3 ite: drivers/i2c: it8xxx2: fix i2c_reset issue
After i2c_reset, there is still no external pull-up I2C bus,
and finishing off the rest of loop causes the code to hang
indefinitely.
This patch fixes that if I2C bus is not available(No external
pull-up), dropping the transaction.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-05-13 11:52:53 -04:00
Gerard Marull-Paretas
7268b6fe01 drivers: timer: sys_clock: return -ENOSYS if not implemented
-ENOSYS should be returned if the operation is not implemented. This
issue was causing some PM tests to fail, as -ENOSYS was expected.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-13 07:16:02 -05:00
Armando Visconti
24f345ee3e drivers/sensor: iis2mdc: use gpio_dt_spec oriented macros
Use gpio_pin_configure_dt() and gpio_pin_interrupt_configure_dt()
for drdy_gpio: they result in a more readable code.

Moreover, this commit includes also the fix for PR #35156
(i.e. CID 235979, add check for gpio_pin_configure() return val).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-12 23:34:46 -05:00
Prema Jonathan van Win
76dee395d8 drivers: serial: stm32: Fixes uart_event_tx len calculation
Resetting the dma_tx.buffer_length after the dma_tx.counter
calculation, instead of before.
We need to reset the buffer_length when the transmission is finished,
but in order to give the correct value to the uart_event_tx struct,
we use the dma_tx.buffer_length in the calculation of the
dma_tx.counter, used for the len of the event (number of bytes sent).
I found this problem, when I wanted to use the uart_event_tx.len for
freeing the used space inside a ring buffer (ring_buf_get_finish),
and it didn't work, I logged the values of the uart_event_tx struct,
and found out it always was 0, because the buffer_length was 0,
and the whole buffer was transmitted (stat.pending_length also 0).

Signed-off-by: Prema Jonathan van Win <jonathanvanwin@gmail.com>
2021-05-11 13:03:20 -05:00
Affrin Pinhero
0129884062 drivers/spi: STM32: This solves SPI infinite loop on Tranceive
This commit loops on rx not empty only if rx_buf is enabled.
And if rx_buf is not enabled, it loops on tx empty status.

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
2021-05-11 13:01:57 -05:00
Tomasz Chyrowicz
13303c4351 drivers: serial: nrf uarte: Fix for the RX byte counter
In case of the following sequence of UART events:
 - UART_ENDRX
 - UART_RXRDY
 - TIMER_RXTIMEOUT

The application receives one more byte that was received,
due to RX counter alignment upon ENDRX event.

The proposed fix moves the RX byte counter alignment to the
RX timeout event handler.

Signed-off-by: Tomasz Chyrowicz <tomasz.chyrowicz@nordicsemi.no>
2021-05-11 13:01:29 -05:00
Daniel Leung
84a6a292c0 timer: hpet: mark functions as boot/pinned/isr
This marks the data and functions into appropriate
linker sections.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-05-10 16:00:43 -05:00
Daniel Leung
1ad7349d17 intc: ioapic: mark data and functions as boot/pinned
This marks the data and functions into appropriate
linker sections.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-05-10 16:00:43 -05:00
Daniel Leung
e4987484de intc: loapic: mark data and functions as boot/pinned
This marks the data and functions into appropriate
linker sections.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-05-10 16:00:43 -05:00
Daniel Leung
08d6386f3c intc: system_apic: mark functions as boot/pinned
This marks the functions into appropriate linker sections.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-05-10 16:00:43 -05:00
Kumar Gala
4ee61309b1 drivers: gpio: Fix when psoc6 gpio driver is built
Add check to see that the GPIO devicetree node is actually enabled
before we build the PSoC6 GPIO driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-10 13:47:11 -05:00
Kumar Gala
706de953ab drivers: serial: uart_miv: Fix build errors
If we try and build the MiV uart driver with interrupt support enabled
we get some errors related to code that hasn't been updated.  Fix the
compile errors and add SERIAL_SUPPORT_INTERRUPT to the Kconfig to
hopefully catch these issues in the future

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-10 13:15:50 -05:00
Eug Krashtan
05d798e3a9 drivers: sensor: STM32 die temperature driver
STM32 internal temperature sensor driver.
This sensor can be used to measure the temperature of the CPU
and its surroundings.

Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
2021-05-08 10:18:09 -05:00
Eug Krashtan
c045cbd336 drivers: adc: STM32 Add common path
Enable common path for internal voltage voltage
reference source.

Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
2021-05-08 10:18:09 -05:00
Kumar Gala
0b83a7e5ce drivers: gpio: Fixup missed PM conversion
In the power mgmt conversion of void *context to uint32_t *state this
driver got missed and shows build errors with power mgmt is enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-08 09:59:07 -05:00
Carlo Caione
e2333269ae cache: Introduce external cache controller system support
The cache API currently shipped in Zephyr is assuming that the cache
controller is always on-core thus managed at the arch level. This is not
always the case because many SoCs rely on external cache controllers as
a peripheral external to the core (for example PL310 cache controller
and the L2Cxxx family). In some cases you also want a single driver to
control a whole set of cache controllers.

Rework the cache code introducing support for external cache
controllers.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-05-08 07:00:33 +02:00
Armando Visconti
2f01479b56 drivers/sensor: lsm6dso: (FIX) enable interrupt selectively
In a multi-instance driver it may happen that on some h/w
one device should use interrupts and a second device should use
polling mode. So, CONFIG_LSM6DSO_TRIGGER is not enough to discriminmate
if interrupt inizialization routine should be called or not; the choice
is now based whether the "irq-gpios" property is present in the DT
for that particular instance or not.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-07 20:53:47 -04:00
Armando Visconti
cacee210ad drivers/sensor: lsm6dso: move ctx structure inside struct config
Move ctx structure from struct data to struct config, so that
it can be filled at compile time and we could get rid of the bus
init routines.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-07 20:53:47 -04:00
Armando Visconti
99308c514a drivers/sensor: iis2iclx: clean unused leftovers
Remove few unused declarations.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-07 20:53:47 -04:00
Wealian Liao
42aeaccb3e driver: clock: npcx: Add valid clock checking
NPCX clock has some limitations about the frequency range &
synchronization between core clock & other clocks. Add build assert to
check whether NPCX clock setting correct. This also fixed soc_clock.h
to consist with datasheet.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-05-07 20:52:55 -04:00
Flavio Ceolin
0c607adb63 pm: device: Align state names with system states
Change device pm states to the same pattern used by system power
management.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 18:35:12 -04:00
Kumar Gala
27e33e25c9 drivers: modem: Fix build errors on 64-bit platforms
If the modem drivers are built on a 64-bit platform we get errors with
the logging code due to use of size_t.  Update to use %zX to handle this
correctly between 32-bit and 64-bit platforms.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-07 16:08:09 -05:00
Flavio Ceolin
7eba310220 power: device: void *context -> uint32_t *state
The context parameter used across device power management is
actually the power state. Just use it and avoid a lot of
unnecessary casts.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-07 16:55:31 -04:00
Andy Ross
662b0bf765 drivers/timer: Add x86 APIC TSC_DEADLINE driver
Modern hardware all supports a TSC_DEADLINE mode for the APIC timer,
where the same GHz-scale 64 bit TSC used for performance monitoring
becomes the free-running counter used for cpu-local timer interrupts.
Being a free running counter that does not need to be reset, it will
not lose time in an interrupt.  Being 64 bit, it needs no rollover or
clamping logic in the driver when presented with a 32 bit tick count.
Being a proper comparator, it will correctly trigger interrupts for
times set "in the past" and thus needs no minimum/clamping logic.  The
counter is synchronized across the system architecturally (modulo one
burp where firmware likes to change the adjustment value) so usage is
SMP-safe by default.  Access to the 64 bit counter and comparator
value are single-instruction atomics even on 32 bit systems, so it
beats even the RISC-V machine timer in complexity (which was our
reigning champ for "simplest timer driver").

Really this is just ideal for Zephyr.  So rather than try to add
support for it to the existing APIC driver and increase complexity,
make this a new standalone driver instead.  All modern hardware has
what it needs.  The sole gotcha is that it's not easily emulatable
(qemu supports it only under kvm where they can freeload on the host
TSC) so it can be exercised only on hardware platforms right now.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-05-07 16:48:58 -04:00
Saurabh Jagdhane
7b15b855d7 drivers: memc: Update driver to support XIP on mimxrt685_evk.
Enable XIP based on SoC specific option.

Signed-off-by: Saurabh Jagdhane <saurabh.jagdhane@nxp.com>
2021-05-07 15:44:19 -05:00
Saurabh Jagdhane
721e3406e6 drivers: flash: Enable FlexSPI XIP on mimxrt685_evk.
Move LUT to driver.
Update CMake to include SoC specific driver.
Fix mimxrt685_evk LUT header spacing.

Signed-off-by: Saurabh Jagdhane <saurabh.jagdhane@nxp.com>
2021-05-07 15:44:19 -05:00
Eug Krashtan
793e2c1891 drivers: flash: at45: Add Reset and WP pins
Adding Reset and Write-protect pins initialization during AT45 driver
start-up. Usually these pins are driven high when not used.
The AT45 device incorporates an internal power-on reset circuit, so
there is no initial on-off reset sequence.

Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
2021-05-07 14:57:08 -05:00
Piotr Mienkowski
3632815e2e api: gpio: do not support INT flags in gpio_pin_configure
To keep compatibility between the old GPIO API implementation and a new
one introduced in the Zephyr 2.2.0 release the gpio_pin_configure()
function was accepting interrupt flags. In the new API implementation
interrupt flags are only accepted by gpio_pin_interrupt_configure()
function.

This temporary support for INT flags in gpio_pin_configure should have
been removed in the Zephyr 2.4.0 release.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-05-07 12:42:08 -05:00
Thomas Stranger
8f559a3260 drivers: interrupt_controller: intc_shared: cond. forward sense cell
The shared interrupt controller depended on interrupt-cell sense
to inialize the interrupt using IRQ_CONNECT.
Forward the "sense" property only conditionally to be able to
use the driver all drivers that don't define it.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-07 12:41:04 -05:00
Thomas Stranger
dedd444fb7 drivers: interrupt_controller: intc_shared: clients array size from dts
The size of the array holding the client information is determined
from the number of dt supports dep ordinals.
Finally remove the Kconfig symbol for the number of clients.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-07 12:41:04 -05:00
Thomas Stranger
a0bea0812a drivers: intc: intrc_shared: get client count from SUPPORTS_DEP_ORDS
The intc_shared driver used kconfig to set the number of clients.
This commit changes the driver to determine the number of clients
per instance using supports ordinals information from device tree.

Leave the kconfig symbol for the number of clients, it now only defines
the array size in driver data and therefore an upper limit of how
many clients can be defined in dts.
It will be removed later with changes of driver data struct.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-07 12:41:04 -05:00
Thomas Stranger
23982030a8 drivers: interrupt_controller: intc_shared: convert to multi instance
The intc_shared driver until now had the possibility to enable
up to two instances of the driver using the symbols SHARED_IRQ_0
and SHARED_IRQ_1.
This commit removes those Config options, and instead instantiates the
driver using DT_INST_FOREACH_STATUS_OKAY macro.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-07 12:41:04 -05:00
Alexander Wachter
f1754b19eb drivers: can: Implement stm32fd driver
This driver is the SoC specific implementation of the
Bosch M_CAN IP.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-05-07 12:36:10 -05:00
Alexander Wachter
1c50ef6c43 drivers: can: Implement Bosch M_CAN driver
Implementation of the Bosch M_CAN IP driver.
This driver is just the base for a specific SoC implementation.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-05-07 12:36:10 -05:00
Alexander Wachter
2ccbfd661e drivers: can: Add Kconfig option for CANFD datalenght
Add Kconfig option to select appropriate can data field length

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-05-07 12:36:10 -05:00
Guennadi Liakhovetski
faecc4c235 ipm: cavs: (cosmetic) fix indentation
Add a missing TAB.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-07 12:44:34 -04:00
Rodrigo Brochado
037f994ed2 drivers: flash: Add workaround for anomaly 122 on nrf52840
The energy consumption on nrf52840 is unnecessarily high when
CONFIG_NORDIC_QSPI_NOR is used due to Anomaly 122. The nrf_qspi_nor
driver is unitialize after QSPI usage and initialize before using
it again.

Semaphore objects are used to allow multiple threads exclusive access
and efficient usage.

The main assumption made was that all QSPI API is stateless, in the
sense that it is not required to store any peripheral state before
uninit. Also, the QSPI driver was supposed to be synchronous, except
for the erase operation, in which the nrf signals its start, instead of
its end. While the flash is performing the erase, an uninit followed
by an init doesn't work. For that reason, polling is done before
every uninit.

Tests were made with a simple LittleFS application in a custom board
using flash MX25R3235F and another with the LittleFS flash sample
using nrf52840 DK that has a MX25R6435F. Current consumption dropped
from 630 uA to ~10uA in both cases.

Signed-off-by: Rodrigo Brochado <git.rodrigobrochado@gmail.com>
2021-05-07 10:26:21 -05:00
Xavier Chapron
e845878870 drivers: i2c_nrfx_twi: Add recover when I2C transfer timeout
Previously to this commit, nothing was done to restore the bus to an
healthy level.
However, I2C devices sometimes needs help to recover from an aborted
transaction.
Therefore, we now add a call to nrfx_{twi, twim}_bus_recover().

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2021-05-07 10:24:41 -05:00
U Divya
04b885d4e3 drivers: gpio: Fixed pin number check condition
Fixed check condition for GPIO pin number.
This check is done
before reading or writing value for the pin.

Verified on ehl_crb.

Signed-off-by: U Divya <u.divya@intel.com>
2021-05-07 09:45:50 -04:00
U Divya
86fa606a0c drivers: gpio: Add GPIO driver for Intel Elkhart Lake
Added support for GPIO driver for Intel Elkhart Lake
board.
The GPIO driver will support pin value read/write operations,
pin direction and interrupt configuration. ACPI enumeration
support and support for different GPIO communities is also
present.

Verified on ehl_crb.

Signed-off-by: U Divya <u.divya@intel.com>
2021-05-07 09:45:50 -04:00
U Divya
f6436a14d8 drivers: gpio: Generic GPIO driver for Intel SoC
Modified GPIO driver for Intel APL SoC to have a
generic driver for all Intel SoC.

Signed-off-by: U Divya <u.divya@intel.com>
2021-05-07 09:45:50 -04:00
Tomasz Michalec
d83647dea6 drivers: adc: add ADC emulator
ADC emulator is designed to be used in tests on native_posix board. It
supports 1-16 bit resolution range and all GAINs from enum adc_gain.
Reference voltages and number of emulated channels are set through dts.
Using special API from drivers/adc/adc_emul.h it is possible to set
constant voltage value returned by given ADC channel or set custom
function which allows to simulate complex output.
Also reference voltages can be changed in runtime using the API.

The CL also includes:
- Add adc definitions of ADC emulator in
  tests/drivers/adc/adc_api/src/test_adc.c for supporting test suites.
- Add test for ADC emulator API in tests/drivers/adc/adc_emul/

Signed-off-by: Tomasz Michalec <tm@semihalf.com>
2021-05-07 15:27:37 +02:00
Hake Huang
c1080f3ceb adc: adc dma driver
add dma support to adc driver
add HW trigger dma support
using new dma api to request dma channel

tested on frdm_k82f and frdm_k64f

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-05-07 08:23:49 -05:00
MORGER Patrick
0e1d16bf03 drivers: sensors: smart-battery with SBS 1.1 compliant fuel gauge
Implementation of a SBS 1.1 compliant fuel gauge driver

Signed-off-by: MORGER Patrick <patrick.morger@leica-geosystems.com>
2021-05-07 07:55:23 -05:00
Dong Wang
7989302e6a interrupt_controller: ioapic: support more device power states
do nothing when enter or resume from DEVICE_PM_LOW_POWER_STATE

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
2021-05-07 13:11:14 +02:00
Marcin Niestroj
eb78d70805 drivers: wifi: esp: stop using pkt->work in TX path
Usage of k_work object from within net_pkt results in undefined behavior
in case when net_pkt is deallocated (by net_pkt_unref()) before work has
been finished.

Use per socket k_work object (sock->send_work) to submit send work and
put net_pkt objects onto k_fifo (sock->tx_fifo). Add a helper function
esp_socket_queue_tx() for that, which will make sure that packets are
enqueued only when send work handler will be successfully submitted (so
that all packets are consumed/dereferenced).

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-05-07 13:10:01 +02:00
Aymeric Aillet
c5a057bc63 drivers: serial: add Renesas R-Car driver
This patch add support for polling based UART
on the Renesas R-Car SCIF (Serial Communication Interface
with FIFO)

This hardware block can be found on various Renesas R-Car
SoC series.

It allows to get console on R-Car Gen3 H3ULCB board.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-05-07 13:08:48 +02:00
Krzysztof Chruscinski
6a5d828948 drivers: serial: nrf_uarte: Conditionally call PPI driver
Avoid calling PPI driver when enhanced poll functionality is
disabled. Fixing a case when driver failed to compile when
enhanced poll is disabled for all instances.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-07 12:11:32 +02:00
Erwan Gouriou
47c9ac5c69 drivers/gpio: stm32: Don't perform clock gating with VddIO2
In some cases, VddIO2 is required to get port working.
Looking in details, VddIO2 should be set on start up
but not toggled on/off in PM use cases.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-06 14:31:13 -04:00
Erwan Gouriou
46f33bcd3e drivers/pinmux: stm32: Enable PM_DEVICE_RUNTIME services
Add PM_DEVICE_RUNTIME support

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-06 14:31:13 -04:00
Erwan Gouriou
13de6e3b24 drivers/gpio: stm32: Enable PM_DEVICE services
Implement power mgmt hooks to support PM_DEVICE and
PM_DEVICE_RUNTIME.
In case of PM_DEVICE_RUNTIME, clock is requested for bank writes
so it is requested before configuring and released only if pin
is not configured as output.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-06 14:31:13 -04:00
Marcin Niestroj
b4854debd1 drivers: wifi: esp_at: rename driver from esp
Recently WiFi ESP32 driver (utilizing WiFi radio in ESP32 SoC) was
introduced into drivers/wifi/esp32/ and it already caused confusion as
there was existing drivers/wifi/esp/ directory for ESP-AT
driver (utilizing external WiFi chip, by communicating using AT commands
from any serial capable platform). So question has arisen whether it is
good to merge both, while they are totally different drivers.

Rename ESP-AT driver to be placed in drivers/wifi/esp_at/, so that it is
easier to figure out difference between "esp32" and "esp_at" just by
looking at driver name. Rename also DT compatible and all Kconfig
options for the same reason.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-05-06 13:21:39 -04:00
Glauber Maroto Ferreira
84f599b228 esp32: i2c: fix: fixed error status handling
Fixed error status handling on ESP32's I2C.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-05-06 13:20:45 -04:00
Kieran Mackey
38ed9c885e drivers: dac: added driver for Microchip MCP4725
The MCP4725 is a single channel 12 bit DAC. It is controlled via I2C.

Signed-off-by: Kieran Mackey <kieran.mackey@lairdconnect.com>
2021-05-06 11:07:33 -05:00
Andrzej Głąbek
96f20cfb99 drivers: i2c_nrfx_twim: Remove extra path for zero-length transfers
nrfx 2.5.0 release includes the patch in the nrfx_twim driver that
fixes the driver behavior for zero-length transfers. No need to keep
the same fix in the shim layer.
This effectively reverts cb86a2b306.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-05-06 17:46:14 +02:00
Emil Lindqvist
f3f8af4cc2 drivers: modem: ublox-sara-r4: make reset pin optional
Remove reset pin requirement from devicetree as this
is not required for modem functionality, and is not
used in the driver anyways.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-05-06 09:44:19 -05:00
Thomas Stranger
04ee034f4b drivers/dma: stm32 fix dmamux request id valid check
The request id is given by the DMA request MUX id which start at offset
1 and are vaid until req_nb + gen_nb.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 09:28:33 -05:00
Jedrzej Ciupis
0923e32fe7 drivers: ieee802154: Udpate nRF IEEE 802.15.4 radio driver
This commit updates the revision of hal_nordic component
and introduces necessary changes to the IEEE 802.15.4 driver
to match latest nRF IEEE 802.15.4 radio driver API.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2021-05-06 08:46:47 -05:00
Andrzej Puzdrowski
df726f5afe drivers/flash/nrf_qspi_nor: fixed bad type casting
nrf_qspi_write_t was used instead of nrf_qspi_readoc_t in casting.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-05-06 08:32:19 -05:00
Mulin Chao
f7f93d2207 driver: uart: npcx: Support APB clock of uart module up to 20MHz.
Suport npcx UART module's APB clock up to 20MHz.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-05-06 08:15:39 -05:00
Mulin Chao
2a86c3ba9d driver: i2c: npcx: support APB clock of i2c modules up to 20MHz.
Support APB clock of npcx i2c modules up to 20MHz and add releted timing
settings.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-05-06 08:15:39 -05:00
Marcin Niestroj
a8e6fc0b83 drivers: wifi: esp: do not wait at the end of ESP chip reset
esp_reset() is called from net_if init function, which holds net_if lock
after commit 24b49f4399 ("net: if: Add locking"). At the end of
esp_reset() there is a blocking wait on `sem_if_up` semaphore. This
semaphore can be release only by esp_init_work(). esp_init_work()
however blocks on net_if operations, because net_if init function (which
invokes esp_reset() underneath) is still holding net_if lock. As a
result there is a deadlock, because esp_reset() and esp_init_work() are
both waiting on each other.

Remove waiting for `sem_if_up`, so that net_if init can exit and release
net_if lock.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2021-05-06 07:42:55 -05:00
Katsuhiro Suzuki
f8e9b505c9 drivers: spi: sifive: fix bug of transferring multiple bufs
This patch fixes a bug of SPI driver for SiFive FE310.
Current implementation sends/receives only first buffer even if
an user passed two or more struct spi_buf to driver.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-05-06 07:41:16 -05:00
Thomas Stranger
136a83ae5c drivers/clock_control: stm32: rename macros to avoid z_ namespace
A few macros used the reserved z_ prefix, this commit refactors
the driver to avoid them.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
743336943a drivers/clock: fix stm32 flash latency calculation in init function
This commit fixes the flash latency calulation in clock_control_init
for stm32wb and stm32wl series:
For these series new_hclk_freq can't be used to set the flash latency,
because the flash clk uses a different prescaler.

Without this fix, the flash latency could be set to an inadequat value
in cases wehere the new AHB3/AHB4 prescaler is different from the
new cpu1 prescler.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
fca13b8de5 drivers/clock_control: stm32 wb, wl: fix missing init of rcc prescalers
This commit adds missing initialization of rcc prescalers for
stm32wb and stm32wl series when hse or hsi are selected as
system clock.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
844277f4aa drivers/clock_control: fix: stm32wb series has only a single msi range
stm32wb only has a single msi clock range, in contrast to wl, l4, l5
which have a second range that is active after exit from standby mode.
This difference must be taken account of in the driver.

This commit abstracts __LL_RCC_CALC_MSI_FREQ macro such that all series
can be supported, additionally the switch to the msirange
(LL_RCC_MSI_EnableRangeSelection) is now only executed on series
that support it.

As a result stm32wb socs can use msi as sysclock.
The same should be done for stm32l0, but this commit series limits
the scope of socs to avoid getting too bloated.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
42a47a58ea drivers/clock: stm32wl config restructure cpu2 prescaler assignment
This commmit restructures the clock_controller code such that the cpu2
prescler assignment later can be excluded for single core socs.

The stm32wl mcu line has variants with a single cortex-m4 core
(stm32wle5), therefore the prescaler for the second clock should
only be set for dual core socs.
This commit still checks for the complete series
(CONFIG_SOC_SERIES_STM32WLX) as the single core variants are not
yet introduced, later the condition should check for a flag like
CONFIG_SOC_STM32WL5X instead.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
f46b20da2f drivers/clock_control: stm32 fix struct wrongly dereferenced
This commit fixes several occurences where a struct members is wrongly
dereferenced, which causes a compile error in case the msi clock is used
as system clock.
Only affects stm32wb and stm32wl with MSI selected as sysclock.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:36:05 -05:00
Thomas Stranger
0014193193 drivers/dma: stm32 dmamux: use util_listify to gen. func/dma_chan arrays
This commit continues simplifying the generation of
isActiveFlag/clearFlag funtion pointer array for the request generators
and does the same for the table_ll_channel.
Additionally move struct dmamux_stm32_channel to c file.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:10:02 -05:00
Thomas Stranger
d7fb6fa9f1 drivers/dma: stm32 dmamux: fix isActiveFlag/clearFlag function array len
This commit uses dt property dma-channels instead of ll defines to
make sure every soc has correct number of function pointers defined.

While commit 5f6218a tried to fix this for g0 series, this caused
regression for other series(e.g. stm32g431). Using UTIL_LISTIFY and
dt properties this should finally be fixed and reduce boilerplate code.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-05-06 07:10:02 -05:00
Arne Edholm
2b864edbcd serial: nrfx_uarte: check size before writing to buffer
NRFX UARTE would write to user supplied buffer on IRQ without checking
whether or not the supplied buffer had available space left to write
one char

Signed-off-by: Arne Edholm <arne.edholm@assaabloy.com>
2021-05-06 11:34:50 +02:00
Mahesh Mahadevan
84e7807190 drivers: timer: MXRT600 OS timer to wake platform from deep sleep
Enable OS Timer interrupt to wake up platform from deep sleep
mode

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-05-05 22:28:44 -05:00
Joakim Andersson
597080204e drivers: Bluetooth: Update H5 driver to new delayable work API.
Update the Bluetooth H5 driver to use the new delayable work API.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-05 19:44:09 -04:00
Gerard Marull-Paretas
56f1a8ce98 pm: rename PM_DEVICE_GET/SET_POWER_STATE to PM_DEVICE_STATE_GET/SET
Adjust name to be consistent with device PM naming conventions.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas
7988ab4a26 pm: rename device_set/get_power_state to pm_device_set/get
Make name consistent with other device PM APIs.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas
dbf46b3815 pm: rename device_pm_cb to pm_device_cb
Prefix all device PM functions/data structures with pm.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas
2c7b763e47 pm: replace DEVICE_PM_* states with PM_DEVICE_*
Prefix device PM states with PM.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Gerard Marull-Paretas
3863be02a5 drivers: replace power/power.h with pm/device.h
Drivers need access to the device PM API, so just include pm/device.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-05-05 18:35:49 -04:00
Erwan Gouriou
07e5644ac6 drivers/pwm: stm32: Leftovers in clock_control conversion to dts
Fix omissions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-05 16:51:02 -05:00
Erwan Gouriou
edaeef1cea drivers/clock_control: stm32h7_m4: Don't rely on rcc "clocks" property
In prts of the code, we use rcc node "clocks" property to testify the
use of device tree for clocks configuration.
This doesn't work in case of stm32h7 m4 targets as for those,
"upstream rcc" clock configuration, such as sysclk source selection,
is done on m7 core and hence rcc node doesn't have a "clocks"
property.
To work around this, use alternate "d1cpre" property in case of
stm32h7 targets.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-05 16:34:37 -05:00
Erwan Gouriou
05b7476664 drivers/clock_control: stm32mp1: Exclude deprecated symbols definition
Cortex-M4 stm32mp1 zephyr relies on chip Cortex-A for clock
configuration.
No change is then required for conversion to dts based clocks
configuration, but we do need to exclude use of newly deprecated
Kconfig symbols.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-05 16:34:37 -05:00
Erwan Gouriou
6d33d6944b drivers/clock_control: stm32: Add CLOCK_CONTROL_STM32_HAS_DTS
Add new symbol CLOCK_CONTROL_STM32_HAS_DTS to exclude definition
of other CLOCK_CONTROL_STM32_* symbols when dts based configuration
is in use.
CLOCK_CONTROL_STM32_HAS_DTS is defined based on availability of
"clocks" property in rcc node.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-05 16:34:37 -05:00
Erwan Gouriou
e1f9d8ead4 drivers/clock_control: stm32: Move CLOCK_STM32_HSE_CLOCK definition
Symbol CLOCK_STM32_HSE_CLOCK will remain in use in context of stm32
clock_control configuration using device tree, cf commit
a7989f64a3.

In preparation for next change, separate it from the others symbols
definition. Also make it non dependent from other Kconfig symbols.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-05 16:34:37 -05:00
Ryan Erickson
5af20cd258 drivers: modem: hl7800: fix fault with IPv6 address
If modem receives an IPv6 address, buffer overrun
would occur. Fix this by checking string length to
ensure what type of IP address needs to be parsed.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-05-05 13:39:50 -05:00
Ryan Erickson
c9b8f89b80 drivers: modem: hl7800: fix potential buffer overrrun
Correct destination buffer size when processing
RX messages from modem.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-05-05 13:39:50 -05:00
Kumar Gala
293802c407 sensor: max17262: Fix CI build failure
device_pm_control_nop has been marked deprecated so we get a CI
build error due to its use.  Replace with NULL to fix the issue.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-05 14:13:21 -04:00
Kumar Gala
6f8f08a6a3 drivers: i2s: i2s_sam_ssc: Fix build issue
Change to make i2s_config const missed a case in the SAM driver.
Without this we get build errors when building in CI.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-05-05 13:01:01 -05:00
Jennifer Williams
ca75bbef3c tests: boot_time: remove all the code and instrumentation feeding into test
Remove the config BOOT_TIME_MEASUREMENT and corresponding #ifdef'd code
throughout (kernel/init.c, idle.c, core/common.S , reset.S, ... ) which
hold the extern hooks for z_timestamp_main and z_timestamp_idle in the
removed boot_time test suite.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2021-05-05 10:41:15 -04:00
Gerson Fernando Budke
d999531f7f drivers: spi: Add cypress PSoC-6 scb spi driver
Add Cypress PSoC-6 SCB[spi] driver.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-05-05 16:01:28 +02:00
Gerson Fernando Budke
7a1f26b005 drivers: ieee802154: rf2xx: Add pan coordinator mode
Enable pan coordinator mode.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Gerson Fernando Budke
0ae119ef3f drivers: ieee802154: rf2xx: Add promiscuous mode
The current rf2xx driver not implement any configuration.  Add
the minimal structre to implement rf2xx driver configuration and
implement IEEE802154_CONFIG_PROMISCUOUS mode.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Gerson Fernando Budke
2f3644ee0c drivers: ieee802154: rf2xx: Add tx mode CCA
Configure transceiver to create a 0 period backoff and perform only one
time the CCA without transmission retires for failures.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Gerson Fernando Budke
195800145e drivers: ieee802154: rf2xx: Add tx mode direct
The current RF2XX driver only support IEEE802154_TX_MODE_CSMA_CA.  Add
IEEE802154_TX_MODE_DIRECT to allow transmit packets immediately without
performing random backoff, CCA and retransmission process.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-05-05 15:55:45 +02:00
Matija Tudan
d2c503f202 sensor: add MAX17262 fuel gauge driver and sample application
The MAX17262 is an ultra-low power fuel-gauge IC which implements the
Maxim ModelGauge m5 algorithm. The IC monitors a single-cell battery
pack and supports internal current sensing for up to 3.1A pulse
current. The IC provides best performance for batteries with 100mAhr
to 6Ahr capacity.

Signed-off-by: Matija Tudan <mtudan@mobilisis.hr>
2021-05-05 15:54:29 +02:00
Tim Lin
caa3328cc7 ite: drivers/pinmux: modify pinmux driver
Modify the pinmux control method and add support the fun3
& fun4 alternation function.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-05-05 08:45:16 -04:00
Fabio Baltieri
525a235fb3 clock_control: stm32f1: fix STM32_PLL_XTPRE check
This is always defined since:

755d09e149 include/drivers/clock_control: stm32: Update for STM32F1
support

So the condition has currently no effect and causes the prescaler to
always be set to /2.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-05-05 08:42:53 -04:00
Eduardo Montoya
a47677da06 net: openthread: add CSL transmitter API
This commit implements the OpenThread APIs to pass MAC keys and
frame counter to the radio layer in order to process the
transmission security. This is needed for the correct functioning
of a CSL transmitter.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-05-05 14:33:47 +02:00
Raphael Löffel
3abd88a64e drivers/flash: stm32h7: Fixed range validation
The range validation routine is not able to detect unaligned memory
blocks as it should.

Signed-off-by: Raphael Löffel <loeffel@rte-ag.ch>
2021-05-05 11:00:20 +02:00
Armando Visconti
f0332eb5d3 drivers/sensor: iis2dlpc: use common stmemsc routine
This commit aligns iis2dlpc sensor driver to latest multi
instance sensor driver model.

In particular:

    1. make use of some few DT helpers:
        - get bus devices with DEVICE_DT_GET
        - get SPI information with SPI_CONFIG_DT_INST
        - get drdy gpios with GPIO_DT_SPEC_GET

    2. make use of the stmemsc common routines and move ctx
       handler inside struct config, so that the bus_init
       routines can be totally avoided.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-04 22:41:56 -04:00
Göran Weinholt
afc8c2528e drivers: flash: stm32h7x: handle ECC errors on read
The STM32H7x flash has an integrated ECC that can correct single
errors and detect double errors. When a double ECC error is detected,
the DBECCERR1/2 flag is raised and there is a bus fault.

We now mask this bus fault and check the error flags. ECC errors are
logged with the offset of the data. Single ECC errors cause a warning
to be logged and double ECC errors return -EIO.

Fixes #33140.

Signed-off-by: Göran Weinholt <goran.weinholt@endian.se>
2021-05-04 13:03:31 -05:00
Erwan Gouriou
7ce1d02ba6 drivers/clock_control: stm32f1: Add explicit case for PLL source HSI
Now that we have specific bindings for STM32F100 devices,
we need dedicated treatment for PLL source HSI case.
Otherwise, we end up using undefined symbol STM32_PLL_PREDIV1.

Please note that previous code compiled, it was assigning
a wrong value to prediv. This had no consequence because
prediv value is forced in Cube LL functions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-04 13:02:26 -05:00
Erwan Gouriou
785ecf0991 drivers/clock_control: stm32f1: Deal with stm32f100xx devices
According to RM0041.pdf clock tree for stm32f100xx devices is
different from both STM32F10X density and connectivity lines devices,
but is a combination of both.

Rework symbols definitions so that STM32F100xx is neither of those
and uses:
- CLOCK_STM32_PLL_MULTIPLIER as on SOC_STM32F10X_DENSITY_DEVICE
- CLOCK_STM32_PLL_PREDIV1 as on SOC_STM32F10X_CONNECTIVITY_LINE_...

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-04 13:02:26 -05:00
Martí Bolívar
5cb95c4ce6 drivers: led_gpio: minor tweaks
Two minor tweaks and a semantics change:

- fix a whitespace nit
- use gpio_pin_configure_dt()
- turn the LED on in case the percentage is nonzero

The last change patterns this driver after behavior in the Android
lights HAL, which recommends analogous behavior when the user requests
a color change in a non-RGB LED:

    Do your best here. [...] If you can only do on or off, 0 is off,
    anything else is on.

    https://source.android.com/reference/hal/structlight__state__t

I think this behavior makes more sense.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-04 16:01:30 +02:00
Mahesh Mahadevan
cccb15e687 drivers: flash: MCUX: Split the relocate define based on target memory
Use the CODE_DATA_RELOCATION_SRAM config to indentify code relocated
to SRAM so we can setup the MPU for the SRAM region used for code
relocation.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-05-04 15:46:52 +02:00
Armando Visconti
4da8a13d76 drivers/i2s/ i2s_ll_stm32.c: Fix wrong DMA burst length value
'0' is not a valid value for DMA burst length. Set it to '1'
to perform a SINGLE transfer.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-04 08:33:46 -05:00
Armando Visconti
1870ecc206 drivers/audio: Kconfig: Fix dmic INIT_PRIORITY default value
The AUDIO_DMIC INIT_PRIORITY definition is set to 60 by default,
but this value is causing dmic drivers to be initialized prior to
i2s, to which they are dependent from.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-05-04 08:33:46 -05:00
Ruibin Chang
37de0c4987 drivers/interrupt_controller/intc_ite_it8xxx2: global ite_intc_isr_clear()
We need to clear interrupt status, before we enable the interrupt.
So I let ite_intc_isr_clear() to be global function.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-05-03 19:58:40 -04:00
Andrzej Głąbek
7fcf78073b drivers: i2s: Add missing const qualifiers
The i2s_config structure passed to the i2s_configure() function is
not supposed to be modified by the driver. Similarly, the structure
returned by the i2s_config_get() function is not supposed to be
modified outside the driver.
Decorate the pointers to those structures with the const qualifier
and correct one driver that actually modified the structure passed
to i2s_configure().

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-05-03 19:57:49 -04:00
Andrzej Głąbek
e4c7f4d62a drivers: i2s: Introduce the I2S_DIR_BOTH enumeration value
Introduce a new enumeration value that allows setting configuration
and triggering commands for both I2S streams simultaneously.
Such possibility is especially important on hardware where the streams
can be only enabled/disabled (but not started/stopped) independently,
like it is in nRF SoCs.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-05-03 19:57:49 -04:00
Arvin Farahmand
a687610b80 drivers: uart_sam0: add support for collision detection error
Automatic collision detection for half-duplex mode can be enabled
by setting `collision-detection` proprety for uart hardware
in the dts file. If the transmitted bit does not match the received
bit an error is raised. This is useful in RS-485 half-duplex mode.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-05-03 19:57:07 -04:00
Guennadi Liakhovetski
aef4edddfa cavs: idc: export cavs_idc_smp_init()
Currently cavs_idc_smp_init() is called from a system
initialisation sequence, which only runs on the main CPU.
However, it must also run on secondary CPUs if those are
powered on later instead of simultaneously with the main
CPU.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-03 17:13:01 -04:00
Guennadi Liakhovetski
a871f0be49 xtensa: cavs: fix irq_enable() argument
irq_enable() should be called with the composite IRQ code as its
argument, not just the Xtensa proper part of it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-03 17:13:01 -04:00
Erwan Gouriou
d0644ceff0 drivers: clock_control: stm32h7: Use dts based configuration macros
Update stm32h7 clock_control driver to make use of macros allowing
dts based configuration in coexistance with existing Kconfig method.

Note: Use of IS_ENABLED is removed as it generates warnings in
checkpatch. This checkpatch behavior needs to be reviewed but may
first require a little clean up of IS_ENABLED macro.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-03 10:56:05 +02:00
Sylvio Alves
a3c35c93ff driver: esp32: add bluetooth support
Add support to BLE and BR/EDR feature.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-04-30 16:51:30 -04:00
Peter Bigot
5189f804a4 drivers: flash: spi_nor: unconditionally provide config pointer
Information about which block protect bits are set on power-up is not
inferable from SFDP content, so we need the devicetree config pointer
to get the has-lock property value even when SFDP data is read at
runtime.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-30 13:10:23 -05:00
Mulin Chao
0d50628af9 driver: gpio: npcx: force io type as open-drain if select to 1p8v.
During configuring the low-voltage power supply of IO pads, the npcx
GPIO driver needs to set the related PORTx_OUT_TYPE bit to 1, i.e.
select to 'Open Drain IO type', also. This CL provides a mechanism that
configuring these bits via 'def-lvol-io-list' node automatically in case
the flag of gpios that have been configured to low-voltage power supply
doesn't contain GPIO_OPEN_DRAIN.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-04-30 12:38:59 -05:00
Mahesh Mahadevan
478822f74c drivers: i2s: Do not support 8-bit word size in LPC I2S driver
The memory block passed by the user to the i2s_write function is
tightly packed next to each other.
However for 8-bit word_size the I2S hardware expects the data
to be in 2bytes which does not match what is passed by the user.
This will be addressed in a separate PR once the zephyr API committee
finalizes on an I2S API for the user to probe hardware variations.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-04-30 12:02:55 -05:00
Mahesh Mahadevan
712317c2e3 drivers: i2s: Add support for I2S driver for LPC devices
This uses the API's provided by the SDK I2S driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-04-30 12:02:55 -05:00
Mahesh Mahadevan
b88d8070d7 drivers: dma: Update the LPC DMA driver
1. Update the SDK API's called in the configure implementation.
The DMA_PrepareTransfer and DMA_SubmitTransfer SDK functions
are not recommneded for use. Replaced the call to these SDK
functions with other SDK API's.
2. Fix the implementation the configure function when multiple
blocks are used.
3. Update the dma_reload implementation. The old reload function
would simply abort the transfer. The new implementation reloads
the DMA buffers for transfer.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-04-30 12:02:55 -05:00
Erwan Gouriou
391cd36e70 drivers/clock_control: stm32 l0/l1: Update for DT based configuration
Add required changes to support DT based configuration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-29 16:41:26 +02:00
Erwan Gouriou
0710aa69c3 include/drivers/clock_control: stm32: Update for F0/F3/G0/G4 support
Update macros for STM32F0/F3/G0/G4 clock configuration.
Additionally update matching drivers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-29 16:41:26 +02:00
Erwan Gouriou
755d09e149 include/drivers/clock_control: stm32: Update for STM32F1 support
Add missing macros fro STM32F1 clock configuration

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-29 16:41:26 +02:00
Erwan Gouriou
99f211b668 drivers/clock_controller: stm32: Prepare for dts based configuration
To allow transition to device tree based clock configuration on
stm32 targets, rework clock_control driver to use intermediate
STM32_ macros initially defined as the equivalent Kconfig macros
for now.
Propagate the change in all code using these macros.

The reason to introduce these new macros instead of configuring
Kconfig flags using dt kconfigfunctions is that we'll need
to be able to inform users that Kconfig flags are deprecated
once the whole family conversion is done, to encourage
out of tree users to adopt this new configuration scheme.

Note: For now STM32H7 series and code is excluded.
This is the same for some series specific code such as
PLL mul/div for L0/L1 and XTRE prescaler on F1 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-29 16:41:26 +02:00
Johann Fischer
26f2e33227 drivers: usb_dc_nrfx: add attached event delay
Add configurable attached event delay. Delay can be used to give
USB Charging Controller time for initialization.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-04-29 09:55:28 -04:00
Arvin Farahmand
008bfeb43e drivers: uart_sam0: add error support
Adds support for enabling and detecting errors to uart.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-04-29 09:54:54 -04:00
Alexandre Bourdiol
630156a4e6 drivers: clock_control: stm32wl doesn't have HSE bypass
LL_RCC_HSE_EnableBypass() doesn't exist on stm32wl,
but can be replaced by LL_RCC_HSE_EnableTcxo()

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-04-29 09:49:53 -04:00
Krzysztof Chruscinski
fe8fe41571 drivers: serial: nrf_uarte: Support for no multithreading
Don use k_sleep when multithreading is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-29 14:50:35 +02:00
Krzysztof Chruscinski
40315adeb2 drivers: clock_control: nrf: Supoprt no multithreading
Add support to no multithreading configuration.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-29 14:50:35 +02:00
Marcin Niestroj
ba391b80b0 drivers: modem: hl7800: use dns_resolve_reconfigure() API
Use recently introduced API, which takes care of gracefully closing any
pending DNS requests and replacing existing DNS server list with new
one.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-04-29 08:00:09 -04:00
Marcin Niestroj
bb8b8b8b5f drivers: wifi: esp: use dns_resolve_reconfigure() API
Use recently introduced API, which takes care of gracefully closing any
pending DNS requests and replacing existing DNS server list with new
one.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-04-29 08:00:09 -04:00
Daniel Leung
5d6c5d5517 counter: callback null check to use NULL instead of numeric zero
Using 0 instead of NULL is a violation of MISRA rule 11.9.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-29 07:16:37 -04:00
Gerard Marull-Paretas
d51acd4e88 drivers: gpio: cy8c95xx: remove usage of device_pm_control_nop
Replace usage of deprecated device_pm_control_nop with NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 20:40:00 -04:00
Gerard Marull-Paretas
f163bdb280 power: move reboot functionality to os lib
Reboot functionality has nothing to do with PM, so move it out to the
subsys/os folder.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 20:34:00 -04:00
Gerard Marull-Paretas
2ca00a8aef drivers: regulator: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:43:29 -04:00
Gerard Marull-Paretas
3b18fe0af7 drivers: pwm: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:43:29 -04:00
Gerard Marull-Paretas
7d10f84ca9 drivers: ps2: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:43:29 -04:00
Gerard Marull-Paretas
26bca11dc8 drivers: pm_cpu_ops: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:43:29 -04:00
Gerard Marull-Paretas
693629ade3 drivers: pinmux: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:43:29 -04:00
Gerard Marull-Paretas
3aa700358b drivers: i2c: ite_it8xxx2: fix typo
Remove '&' from previous usage of `device_pm_control_nop`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:42:59 -04:00
Gerard Marull-Paretas
861eac31b8 drivers: dma: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:41:29 -04:00
Gerard Marull-Paretas
6b05c6e06e drivers: display: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:41:29 -04:00
Gerard Marull-Paretas
374d46c235 drivers: disk: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:41:29 -04:00
Gerard Marull-Paretas
ed97e6d106 drivers: dac: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:41:29 -04:00
Gerard Marull-Paretas
bf7a396538 drivers: sensor: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 15:30:03 -04:00
Jordan Yates
ed20c06908 spi: spi_nrfx_spim: limit clock frequency by inst
Limit the maximum SPI frequency to that supported by the instance
hardware. This stops peripherals supporting >8MHz on slow instances
from wrapping around on the clock frequency for undefined behaviour.

Fixes #34402

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-04-28 19:49:57 +02:00
Gerard Marull-Paretas
942cb4ea81 drivers: watchdog: wdt_esp32: fix coding style issues
Some lines were unnecessarily > 100 columns. They produced compliance
failures.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:39 -04:00
Gerard Marull-Paretas
0efc185018 drivers: wifi: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:39 -04:00
Gerard Marull-Paretas
621d1d45f2 drivers: watchdog: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:39 -04:00
Gerard Marull-Paretas
d24c234a5b drivers: virtualization: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:39 -04:00
Gerard Marull-Paretas
8b79a7ec6e drivers: video: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:39 -04:00
Gerard Marull-Paretas
90118b265f drivers: spi: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:39 -04:00
Gerard Marull-Paretas
a4081b66d8 drivers: serial: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:39 -04:00
Gerard Marull-Paretas
aa1c8e2ee9 drivers: peci: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:24 -04:00
Gerard Marull-Paretas
6e7539502b drivers: pcie: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:24 -04:00
Gerard Marull-Paretas
4f202c9c87 drivers: neural_net: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:24 -04:00
Gerard Marull-Paretas
e07a36cf0a drivers: net: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:24 -04:00
Gerard Marull-Paretas
126e1eead8 drivers: modem: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:24 -04:00
Gerard Marull-Paretas
d8de6f7b44 drivers: memc: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:24 -04:00
Gerard Marull-Paretas
b735f5eb15 drivers: sensor: iis2iclx: use GPIO_DT_SPEC_INST_GET
Replace GPIO_DT_SPEC_GET for GPIO_DT_SPEC_INST_GET.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 18:17:23 +02:00
Gerard Marull-Paretas
87a8119105 drivers: sensor: iis2mdc: use GPIO_DT_SPEC_INST_GET
Replace GPIO_DT_SPEC_GET for GPIO_DT_SPEC_INST_GET.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 18:17:23 +02:00
Gerard Marull-Paretas
c065738d6c drivers: sensor: lsm6dso: use GPIO_DT_SPEC_INST_GET
Replace GPIO_DT_SPEC_GET for GPIO_DT_SPEC_INST_GET.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 18:17:23 +02:00
Gerard Marull-Paretas
ba5511ea1f drivers: sensor: bmp388: use GPIO_DT_SPEC_INST_GET
Replace GPIO_DT_SPEC_GET for GPIO_DT_SPEC_INST_GET.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 18:17:23 +02:00
Gerard Marull-Paretas
496cdac71d drivers: lora: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 11:25:42 -04:00
Gerard Marull-Paretas
233fbf44c9 drivers: led_strip: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 11:25:42 -04:00
Gerard Marull-Paretas
40e9cb675c drivers: led: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 11:25:42 -04:00
Gerard Marull-Paretas
5f4fedc3c3 drivers: kscan: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 11:25:42 -04:00
Gerard Marull-Paretas
4663b07850 drivers: ipm: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 11:25:42 -04:00
Gerard Marull-Paretas
e6170a4dbc drivers: interrupt_controller: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:55:49 -04:00
Gerard Marull-Paretas
ed4dd0e9bb drivers: ieee802154: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:55:49 -04:00
Gerard Marull-Paretas
c650523870 drivers: i2s: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:55:49 -04:00
Gerard Marull-Paretas
a8245f78a1 drivers: i2c: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:55:49 -04:00
Gerard Marull-Paretas
1b5542056b drivers: gpio: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:55:35 -04:00
Gerard Marull-Paretas
faeaea112e drivers: flash: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:55:35 -04:00
Gerard Marull-Paretas
27ed0fa0c5 drivers: ethernet: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:55:22 -04:00
Gerard Marull-Paretas
94edcb7a4e drivers: espi: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:55:22 -04:00
Gerard Marull-Paretas
9e2f38d78e drivers: entropy: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:55:22 -04:00
Gerard Marull-Paretas
36b8f96ddc drivers: eeprom: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:55:22 -04:00
Gerard Marull-Paretas
673b44ad30 drivers: ec_host_cmd_periph: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:55:22 -04:00
Gerard Marull-Paretas
20e6048a49 drivers: crypto: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:54:58 -04:00
Gerard Marull-Paretas
f9928479a1 drivers: counter: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:54:58 -04:00
Gerard Marull-Paretas
fdfca41e63 drivers: console: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:54:58 -04:00
Gerard Marull-Paretas
62afdca908 drivers: clock_control: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:54:58 -04:00
Gerard Marull-Paretas
51574420fe drivers: can: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:54:22 -04:00
Gerard Marull-Paretas
173dc5ef84 drivers: audio: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:54:22 -04:00
Gerard Marull-Paretas
510aacc45d drivers: adc: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 10:54:22 -04:00
Watson Zeng
8c8afa82b9 drivers: gpio: add initial support for cy8c95xx I/O expander
add initial support for cy8c95xx I/O expander,
no interrupt support currently.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-04-28 10:53:52 -04:00
Thomas Stranger
4cd7ff65da drivers/flash: STM32: use clk dt definitions in h7 flash driver
This commit replaces driver hard coded clk bus and enr definitions with
definitions from device tree.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-28 09:06:42 -05:00
Thomas Stranger
859b6d5bfe drivers/flash: STM32: Fix flash_stm32_priv definition for h7 series
This commit fixes missing pclken member if used for h7 series.
Additionally to the check if instance 0 of compatible
st_stm32_flash_controller has defined a clock,
this needs to be checked for compatible st_stm32h7_flash_controller.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-28 09:06:42 -05:00
Mulin Chao
1cc73074d0 driver: gpio: npcx: fixed leakage current in npcx7 series.
It was found that npcx7 series' GPIOs which support low-voltage power
supply, there is an excessive power consumption if they are selected to
low-voltage mode and their input voltage is 1.8V.

To avoid this excessive power consumption, this CL suspends the
connection between IO pads and hardware instances before ec enters deep
sleep mode. Then restore them after waking up.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-04-28 07:06:41 -04:00
Hou Zhiqiang
198dc6b975 intc: gic: Don't enable the interrupt routing to cores disable in DT
Change to use macro DT_FOREACH_CHILD_STATUS_OKAY to avoid routing the
interrupts to the disabled cores.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2021-04-27 13:32:55 -04:00
William MARTIN
e61b957a0f drivers/i2s: stm32: Fix pinmux
Update the I2S_INIT macro to correct the i2s_pins loading.

Signed-off-by: William MARTIN <william.martin@power-lan.com>
2021-04-27 13:29:26 -04:00
Gerson Fernando Budke
2bd130112a drivers: serial: psoc6: Add interrupts support
Current Cypress PSoC-6 serial driver only works using polling mode.
Add serial driver interrupt routines to allow use of interrupts.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-04-27 09:27:45 -05:00
Gerson Fernando Budke
e6cba8d9c8 drivers: serial: psoc6: Rework to support pinctrl
The current serial driver uses hard code configuration.  Rework driver
to use pinctrl and enable full configuration from device tree.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-04-27 09:27:45 -05:00
Marek Pieta
a712c3622d drivers: led: Add LED GPIO driver
Change introduces LED GPIO driver.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-04-27 16:21:48 +02:00
Peter Bigot
c26cdb7409 drivers: flash: spi-nor: add support for 4-byte addressing
Add a function that uses the JESD216 SFDP BFP DW16 Enter 4-Byte
Addressing parameter to put the device into 4-byte addressing mode if
one of the entry modes that's supported by the driver is available on
the device.

Perform the transition if SFDP data is provided (either by devicetree
or at runtime), or if a special devicetree property provides the entry
mode descriptor.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-27 14:21:15 +02:00
Peter Bigot
6c4312605c drivers: flash: jesd216: improve support for address size selection
Add a helper function to decode the address byte support data from the
SFDP BFP.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-27 14:21:15 +02:00
Peter Bigot
e0f514f670 drivers: flash: spi_nor: support 32-bit addresses in access method
Support both 24-bit and 32-bit address values when constructing the
device command.  Note that some commands require 24-bit address
regardless of mode, and some require 32-bit addresses regardless of
mode, so provide command-specific overrides of a generic (but not yet
configurable) default address size.

With this we no longer need a special interface for READ_SFDP which
uses a 24-bit address but with a wait state introduced by clocking out
a fifth command byte.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-27 14:21:15 +02:00
Peter Bigot
cde962e789 drivers: flash: spi_nor: refactor to allow more access options
This driver abstracts most access through a generic function that
supports both read and write with and without address components in
the command.  Rework this so that instead of distinct arguments
specifying the combination of features there's a flag set that will
allow more combinations to be specified.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-27 14:21:15 +02:00
Mario Jaun
c276088567 drivers: ethernet: stm32: SRAM3 / MPU configuration
Fixes #29915.

Implements the memory layout and MPU configuration for Ethernet buffers
for STM32H7 controllers as recommended by ST. 16 KB of SRAM3 are
are reserved for this. The first 256 B are for the RX/TX descriptors and
configured as strongly ordered, shareable memory. The rest is for RX/TX
buffers and configured as non cacheable memory. This configuration is
automatically applied for H7 chips if the SRAM3 memory is enabled in the
device tree.

Signed-off-by: Mario Jaun <mario.jaun@gmail.com>
2021-04-27 14:16:35 +02:00
Erwan Gouriou
a7989f64a3 drivers/clock_control: stm32: Configure CLOCK_STM32_HSE_CLOCK using dt
Kconfig symbol is used in hal_stm32 module to define Cube HAL
symbol HSE_VALUE (cf hal_stm32/stm32cube/CMakeLists.txt).
Due to this specific usage, this symbol should be kept. As a
consequence it could not be replaced by dts equivalent but we can
use dts to configure it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Erwan Gouriou
2691541ad2 drivers/clock_controller: stm32: Prepare for dts based configuration
To allow transition to device tree based clock configuration on
stm32 targets, rework clock_control driver to use intermediate
STM32_ macros initially defined as the equivalent Kconfig macros
for now.
Propagate the change in all code using these macros.

The reason to introduce these new macros instead of configuring
Kconfig flags using dt kconfigfunctions is that we'll need
to be able to inform users that Kconfig flags are deprecated
once the whole family conversion is done, to encourage
out of tree users to adopt this new configuration scheme.

Note: For now STM32H7 series and code is excluded.
This is the same for some series specific code such as
PLL mul/div for L0/L1 and XTRE prescaler on F1 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Jukka Rissanen
ccadbe2e7d drivers: eth: e1000: Add simulated PTP clock device
For testing purposes, add simulated PTP clock device to e1000
Ethernet driver that is used in qemu_x86 board. The PTP clock
does nothing useful as there is no real hw behind this device.
We just emulate the clock in order to do some SO_TXTIME testing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
476b1885ce drivers: eth: mcux: Separate PTP clock from gPTP support
It is possible that user wants to access PTP clock but does
not need gPTP support. The networking txtime sample does exactly
this.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
567860a5e2 drivers: eth: gmac: Separate PTP clock from gPTP support
It is possible that user wants to access PTP clock but does
not need gPTP support. The networking txtime sample does exactly
this.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jim Paris
e729e6db10 drivers: nrf: avoid UARTE pm infinite loop
If there is a UARTE receive error (e.g. framing or break), the RXTO
event may never come.  Check error event too, to avoid an infinite loop.

Signed-off-by: Jim Paris <jim@jim.sh>
2021-04-27 09:53:04 +02:00
Peter Bigot
d364062b9b serial: sam0: Conversion of k_work API
Replace all existing deprecated API with the recommended alternative.

Fixes #34102

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-04-26 14:17:28 -04:00
Thomas Stranger
1e3512c94e drivers/dma: stm32: don't omit IRQ status check in dma_is_irq_active
Fix stm32_dma_is_irq_active not checking the IRQ status(IsEnabled) for
active interrupts.
While the transfer-complete, half-transfer comp.  and transfer-error
is_XX_irq_active() functions check for IRQ status (IsEnabled),
ORing the result with dma_stm32_is_gi_active() overrides the
status check as gi is always 1 in case any of these flags is active.
Related to commit 96c92ed93f.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-26 14:16:03 -04:00
Thomas Stranger
e53ee41338 driver: dmamux: use LL_DMAMUX_CHANNEL_X flag to check if channels exists
Use LL_DMAMUX_CHANNEL_x defines instead of DMAMUX_CSR_SOF7x to check
if corresponding LL_DMAMUX_IsActiveFlag_SOx and LL_DMAMUX_ClearFlag_SOx
inline functions exist and should be added to func_ll_is_active_so[]
and func_ll_clear_so[].
The HAL of some socs uses the same flag to decide which registers exist
on a specific soc. And the same defines are used for table_ll_channel[]
initializations.

This is necessary because DMAMUX_CSR_SOF5 and DMAMUX_CSR_SOF6 were
wrongly added in the HALs soc header file for some stm32g0 socs,
therefore without this change some stm32g0 socs couldn't compile.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-26 14:16:03 -04:00
Thomas Stranger
5a475d7cc2 drivers/dma: stm32: add support for stm32g0 series
Update the existing driver to support STM32G0 series.
It enables the DMA_STM32_SHARED_IRQS flag for g0 series, such that
all interrupts are handled in a shared isr to avoid irq conflicts.
The shared isr is extended to be able to handle irqs from more than one
dma instance.

Furthermore the config_irq function of instance 1, which connects to the
irqs, was reworked to avoid irq conflicts when 2 dma instances on
stm32f0, or stm32g0 are enabled:
While dma1 has one exclusive irq for channel 1, and one irq for dma1
channels 2 and 3, all other channels share the same irq.
Therefore it is currently not possible to enable dma2 without enabling
dma1 at the same time, without getting an build errror due to an irq
conflict.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-26 14:16:03 -04:00
Thomas Stranger
73374fbfa9 driver: dmamux: enable clocks only if node has clocks property defined
Not all STM32 Series can enable a dedicated clock for dmamux.
In stm32g0 series for example the clock is enabled automatically
as long as either DMA1 or DMA2 is enabled.
This commit changes dmamux driver to cope with socs that don't have
defined a clocks property. Therefore it moves the config(and data)
struct into the c file to be able to use DT_INST_NODE_HAS_PROP macro.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-26 14:16:03 -04:00
Jiafei Pan
77da035141 drivers: gicv3: fix getting rdist base address
In SMP, MPID is mybe not equal to cpu logic ID, so can't
use MPID to get rdist base address from gic_rdists[], this
patch get logic ID from arch_curr_cpu()->id, and
find current CPU's rdist base address from:
gic_rdists[cpu_logic_id]

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2021-04-26 13:42:43 +02:00
Andrzej Głąbek
8e9884f937 drivers: i2c: nrfx: Print nrfx error codes as hexadecimal numbers
so that it is easier to find their meaning in nrfx_error.h

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-04-26 13:41:41 +02:00
Andrzej Głąbek
cb86a2b306 drivers: i2c_nrfx_twim: Fix handling of zero-length transfers
For a zero-length transfer, the STOP task is not triggered
automatically by the shortcut with the event that signals
the transfer end because such event is not generated.
Trigger this task "manually" to prevent the driver getting
stuck after the address byte is acknowledged.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-04-26 13:41:41 +02:00
Eduardo Montoya
8ff12f3ace net: openthread: enable CSL delayed transmissions
Add support for delayed transmission of frames for the CSL
Transmitter OpenThread function.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-04-26 13:40:43 +02:00
Sylvio Alves
fe621f7071 wifi: esp32: allow wifi symbols into flash
When BT and WiFi coexists, IRAM usage increases a lot.
Add configuration that allow wifi symbols
to be placed in flash, freeing space in IRAM.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-04-26 13:39:21 +02:00
Mulin Chao
1a2e59b2e9 driver: wdt: npcx: replace critical sections with timeout mechanism.
TWDT0 is loaded with a new value and the counter restarts counting with
it by written RST bit in Timer Control register (T0CSR) to 1. Then, the
RST bit in T0CSR register is cleared automatically on the 2nd rising
edge of T0IN clock. Since TWCP is set to 1:32, the maximum time that RST
bit is unset is 32 * (1 / 32768) ~= 980us.

Polling this bit within a critical section in current npcx watchdog
driver isn't a good approach since it might block the other interrupts
need to service them in time. This CL introduces a timeout mechanism and
removes the critical section to improve this disadvantage. Consider the
clock tolerance, 2 ms is a suitable timeout value for RST bit. We also
remove polling for WD_RUN bit in T0CSR. Npcx watchdog needs serval LFCLK
(32k Hz) clocks to stop watchdog. 1 ms is long enough for the timeout
mechanism.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-04-23 15:03:15 -05:00
Krishna Mohan Dani
5de1b09cc0 drivers/flash: STM32: Adding condition to enable HSI clock for L1 series.
This commit adds changes to enable HSI clock for stm32l1 series.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-04-23 14:59:06 +02:00
Krishna Mohan Dani
3374bc128a drivers/flash: STM32: Getting clock settings from DT.
This commit uses DT APIs to get the flash clock settings.

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-04-23 14:59:06 +02:00
Hake Huang
b609242903 dma: add request channel and release channel helper
add two dma api for dynamic channel reqest and release

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-04-23 14:58:40 +02:00
Dino Li
0ab51ff657 drivers: gpio: ite_it8xxx2: enable more gpio groups
This change enables A, C, D, E, G, H, I, J, K, and L groups,
and fix gpio interrupt function.

This change also pull (and rename) dt-bindings/irq.h to
dt-bindings/interrupt-controller/ite-intc.h, because it is
chip-specific.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Change-Id: Ifee039981c2cc4cf5980e663702a9921e629fc1e
2021-04-23 06:31:56 -04:00
Mulin Chao
f16f37f86a driver: pwm: npcx: Add output open drain support
NPCX PWM supports output buffet select to push-pull or open-drain. Add
output buffer select option 'drive-open-drain' in devicetree for NPCX
PWM. If set, the PWM output will be configured as open-drain. If not
set, defaults to push-pull.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-04-22 18:03:38 -04:00
Mulin Chao
440d9dc5d4 driver: itim: npcx: check ITEN bit to prevent return fake error.
During polling ITEN bit to make sure ITIM timer is enabled, we might
have the chance that npcx_itim_evt_enable() return fake error when
timeout expired but ITEN bit is set already if CONFIG_ZERO_LATENCY_IRQS
is enabled. (Since SVCall's interrupt priority is not the highest, the
other interrupts with IRQ_ZERO_LATENCY flag could preempt CPU resource
at this moment.)

In order to prevent return fake error code, this CL adjusts the check
conditions for ITEN bit and timeout.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-04-22 18:03:06 -04:00
Wealian Liao
abb94b1198 soc: power: npcx: Clear host access IRQ pending bit before enabling
NPCX host access IRQ enables before entering deep sleep. The pending
bit lets chip wake up from sleep immediately. Clear host access IRQ
pending bit before enabling.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-04-22 18:02:36 -04:00
Johan Hedberg
9e9a990ba0 drivers: uart_ns16550: Fix naming for struct uart_ns16550_dev_data_t
Rename uart_ns16550_dev_data_t to uart_ns16550_dev_data since it's not a
typedef.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-04-22 15:30:24 -05:00
Johan Hedberg
baecd7e55a drivers: uart_ns16550: Remove CMake-based templating
With some additional macro-magic we can remove the CMake-based header
file template feature, and instead take advantage of the usual
DT_INST_FOREACH_STATUS_OKAY() macro.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-04-22 15:30:24 -05:00
Johan Hedberg
8cfa5deb16 drivers: uart_ns16550: Remove support for hard-coded PCIe interrupts
There are no boards that need hard-coded interrupts so just remove this
build-time conditional branch. The way going forward is that all PCIe
devices should always use PCIE_IRQ_DETECT.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-04-22 15:30:24 -05:00
Kumar Gala
e1032ad2c3 include: Move emul.h to drivers/emul.h
Move emul.h out of the top level include/ dir into
include/drivers/emul.h and deprecated the old location.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-04-22 12:51:01 -04:00
Sidhdharth Yadav
e2a29bf6a4 drivers: pwm: Adding a flag to allow build for stm32l1 series
Include a flag to allow build for stm32l1 series

Signed-off-by: Sidhdharth Yadav <sidhdharth.yadav@hcl.com>
2021-04-22 11:29:34 +02:00
Julien Massot
d86c61fd57 drivers: gpio: add Renesas RCar gpio
Add GPIO controller driver that can be found on Renesas
RCar gen3 soc series.

Controller can handle up to 32 GPIOs per banks.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2021-04-22 10:38:45 +02:00
Julien Massot
20fdb6cbfb drivers: timer: add R-Car cmt driver
Compare Match Timer is a 32 bit compare match timer
that can be found on various Renesas R-Car SoC.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2021-04-22 10:38:45 +02:00
Julien Massot
2ad6e4e376 drivers: clock_control: add R-Car CPG MSSR driver
Clock Pulse Generator, Module Standby Software Reset, are registers
presents in Renesas Gen3 SoC series.

MSSR is used to supply clock to the different modules, shuch as timer,
or UART, it's also possible to issue a reset the different module.

CPG registers allow to get the rate or to set some divider like for
the CAN clock.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2021-04-22 10:38:45 +02:00
Armando Visconti
8717654c1d drivers/sensor: iis2iclx: move ctx structure inside config
Move ctx structure from struct data to struct config, so that
it can be filled at compile time and we could get rid of the bus
init routines.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-21 20:41:46 -04:00
Armando Visconti
6fa0d01c5f drivers/sensor: iis2iclx: Use DT helper for gpio_drdy
Use gpio_dt_spec structure and populate it using GPIO_DT_SPEC_GET
macro.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-21 20:41:46 -04:00
Johan Hedberg
776fbf2d26 drivers: i2c_dw: Remove CMake-based templating
With some additional macro-magic we can remove the CMake-based header
file template feature, and instead take advantage of the usual
DT_INST_FOREACH_STATUS_OKAY() macro.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-04-21 20:40:52 -04:00
Johan Hedberg
3cdb5c76dd drivers: i2c_dw: Remove support for hard-coded PCIe interrupts
There are no boards that need hard-coded interrupts so just remove this
build-time conditional branch. The way going forward is that all PCIe
devices should always use PCIE_IRQ_DETECT.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-04-21 20:40:52 -04:00
Mahesh Mahadevan
243d6a2ed1 drivers: timer: Add MCUX OS timer
Add OS timer for the MCUX SoC's

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-04-21 20:40:24 -04:00
Yong Cong Sin
084a8b6bf4 drivers: modem: BG9X wait for RDY instead of polling AT.
BG9X wait for RDY instead of polling AT.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-04-21 17:04:40 +03:00
Jiafei Pan
460a962b87 interrupt_controller: gic: distribute interrupts to cpu listed in dts
We only need to distribute interrupts to CPU Cores with the count
of CONFIG_MP_NUM_CPUS, and get Core's MPID from CPU nodes in dts.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2021-04-21 09:02:50 -04:00
Johann Tael
5425700e74 drivers: modem: ublox-sara-r4: add TLS offload support
Currently it's able to connect to google iot. All other use cases are
untested.

Signed-off-by: Johann Tael <jntael@gmail.com>
2021-04-21 11:13:34 +03:00
Martí Bolívar
15f9ae0e0b dts: nrf: revert i2c sda-gpios, scl-gpios changes
These changes turn out to have been incompatible with the way pinctrl
drivers are going to work, so we need to go back to what we had before
until we can agree on a better approach.

Squash of the following reverts:

Revert "boards: nrf: fix deprecated I2C properties"

This reverts commit 2a4ac9ac02.

Revert "samples: switch nrf overlays to sda-gpios, scl-gpios"

This reverts commit 01bb08e7d8.

Revert "boards: nrf: switch to sda-gpios, scl-gpios"

This reverts commit 17a66304c4.

Revert "i2c: nordic: switch to phandle arrays for pinmux"

This reverts commit 821c03a14a.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-04-20 18:32:04 +02:00
Johann Fischer
583334b606 drivers: usb_dc_nrfx: clear endpoint flags during ep_disable()
If a loaded endpoint was disabled and then reconfigured,
it is not possible to start an IN transfer and
usb_dc_ep_write() returns -EAGAIN.

Call ep_ctx_reset() to clear endpoint operations flags
and reset buffer after endpoint is disabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-04-20 15:04:47 +02:00
Francois Ramu
bce0d52664 drivers: flash: stm32wb: Flush caches after erase
This commit fixes sporadic kernel panics when writing big data chunks
to the flash. (data bus errors). Just like the stm32g4 does.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-04-20 12:44:14 +02:00
Francois Ramu
3620f3fcee drivers: flash: stm32g0: Flush caches after erase
This commit fixes sporadic kernel panics when writing big data chunks
to the flash. (data bus errors). Just like the stm32g4 does
but on instruction cache.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-04-20 12:44:14 +02:00
Frank Li
42333dc282 driver: usdhc: add option to disable 1.8v
When 1.8V is disabled, sdhc can only
communicate at low speed. But this can
save the external circuit for switching
between 3.3V and 1.8V, which is very
practical in costdown scenarios.

Signed-off-by: Frank Li <lgl88911@163.com>
2021-04-19 08:25:55 -05:00
Peter Bigot
67808279fb drivers: flash: spi_nor: support devices that default to protect blocks
Some SPI NOR devices, particularly Atmel and SST, power-up with block
protect bits set in the status register.  These bits must be cleared
before any erase or program operation can succeed.  However, blindly
clearing bits in SR is wrong as some of these are non-volatile and
control chip behavior, including quad-enable.

Add a devicetree flag to identify device-specific BP bits in the status
register that should be cleared on startup only for devices that need
them, and when set do the clear during initialization.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-16 12:23:06 +02:00
Peter Bigot
060204a6ae drivers: flash: spi_nor: document caller requirements
Add the standard note to two functions that require the caller to have
first acquired the device.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-16 12:23:06 +02:00
Peter Bigot
01fbe40fd4 drivers: flash: spi_nor: clean up ready detection
Reads would wait until the device was ready before issuing the first
command; writes and erases did not.  Fix this documenting and changing
so that wait-for-ready is invoked only where needed, i.e. to confirm
that a WRITE_STATUS, ERASE, or PROGRAM operation has completed before
proceeding to allow more commands to be submitted.  This matches Linux
spi_nor driver behavior.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-16 12:23:06 +02:00
Armando Visconti
2846283f84 drivers/sensor: iis2mdc: (FIX) Remove SPI Full Duplex mode
The IIS2MDC sensor does not support the SPI 4 wires. So, remove
it from the driver.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-16 12:21:11 +02:00
Armando Visconti
4df7af583a drivers/sensor: iis2mdc: Add multi-instance support
Make this driver multi-instance and use the new API.
This commit makes use of the new helpers introduced in #30536.

In particular:
    - get bus devices with DEVICE_DT_GET
    - get SPI information with SPI_CONFIG_DT_INST
    - get drdy gpios with GPIO_DT_SPEC_GET

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-16 12:21:11 +02:00
Johann Fischer
b142a47f73 drivers: regulator: enable driver when compatible node is defined
Add regulator compatibility string to Kconfig.fixed file
and allow fixed regulator driver to be enabled when compatible
node is defined. However, remove this option from common Kconfig
as it is legitimate to enable/disable regulator support.

Change menuconfig REGULATOR_FIXED to config since this
menu nesting is not necessary.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-04-16 09:45:35 +02:00
Pieter De Gendt
3ee5f427e6 drivers: flash: mcux flexspi nor: copy data to RAM buffer on write
This feature prevents issues when trying to write data to the flash
device that is located on or addressed at the same flash device.

An example is the mcuboot logic that writes a magic number to
the secondary partition header.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-04-15 16:26:39 -05:00
Pieter De Gendt
bd67c2375f drivers: flash: mcux flexspi nor: Fix write if size > SPI_NOR_PAGE_SIZE
This fixes a bug in the write function of the MCUX FlexSPI flash driver
if the length of the data is larger than a single page.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-04-15 16:26:39 -05:00
Pieter De Gendt
add98e766a drivers: flash: Support i.MX FlexSPI NOR driver with XIP
This change allows writing to the flash while running in XIP mode,
and enables mcuboot or NVS settings to be used on i.MX RT socs.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-04-15 16:26:39 -05:00
Peter Bigot
2ac596b91a usb: conversion of k_work API
Replace all existing deprecated API with the recommended alternative.

Be aware that this does not address architectural errors in the use
of the work API.

Fixes #34092

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-04-15 12:29:34 -04:00
Peng Li
e28b7e04e2 driver: serial: fixed the buffer underflow issue when clearing the port.
Set DLAB bit before reading RDR to avoid buffer underflow.

Signed-off-by: Peng Li <lipengit@gmail.com>
2021-04-15 17:19:12 +02:00
Dominik Ermel
eb37fd0b30 drivers/flash_simulator: Rename FLASH() macro to MOCK_FLASH()
The change is done to avoid redefinition errors while attempting
to enable flash_simulator with stm32 platform (stm32f4_disco)
which exports its own definition of FLASH macro, from stm32f407xx.h.
Unfortunately the stm32 definition is visible within flash_simulator
via inclusion of device.h.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-04-15 17:15:34 +02:00
Robert Lubos
a586f5818c drivers: ieee802154_nrf5: Remove unnecessary NULL pointer check
After changes in commit a42d6c98d3, the
pkt can no longer be a NULL pointer. Remove the unnecessary NULL pointer
check to silence the Coverity.

Coverity ID: 219536
Fixes #32912

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-15 14:45:50 +03:00
Sergey Ustinov
73db443320 drivers: can: can_mcp2515: fix BRP bits value
Fixes #33978.
8b6c1bd commit set 'presacaler' in BRP(Baud Rate Prescaler) bits.
It's wrong, because these bits from CNF1 register use 'prescaler - 1'.
MCP2515(DS20001801J) datasheet 'REGISTER 5-1: CNF1: CONFIGURATION
REGISTER 1 (ADDRESS: 2Ah)'.

Signed-off-by: Sergey Ustinov <originalustinov@gmail.com>
2021-04-15 12:25:23 +02:00
Kumar Gala
b55ad01898 drivers: gpio: mcux: Set pin mux config to GPIO
Set the PCR[MUX] field to kPORT_MuxAsGpio as part of configuring a GPIO
pin.  This removes the need to explicitly call pinmux_pin_set() in board
code.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-04-15 12:25:05 +02:00
Arvin Farahmand
835b875c17 drivers: ethernet: eth_sam_gmac: allow changing mac address
Support setting MAC address manually at runtime for Atmel SAM Ethernet
driver. The MAC address can be set using an ethernet management
request, e.g. (`net_mgmt(NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, ...)`).

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-04-15 10:43:21 +03:00
Francois Ramu
962d6b1082 drivers: serial: uart_stm32 converted to use the new kwork API.
The structure is now k_work_delayable.
The init function is now k_work_init_delayable.
The submit function is now the k_work_reschedule.
The cancel function is now the k_work_cancel_delayable.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-04-14 18:21:33 +02:00
Shlomi Vaknin
95143fc98e drivers: dma: stm32: add support for stm32h7
Add the missing parts for adding support
to stm32h7 dma driver.
The fix is to make dmamux driver work with
dma v1 driver.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-04-14 18:18:12 +02:00
Peter Bigot
188cb2cb7c net: Conversion of k_work API
Replace all existing deprecated API with the recommended alternative.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-14 07:07:40 -04:00
Peter Bigot
4f6a365f4f drivers: console: mux: Conversion of k_work API
Replace all existing deprecated API with the recommended alternative
for gsm_mux and uart_mux drivers.

Fixes #34103

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-14 07:07:40 -04:00
Peter Bigot
cc090726e6 drivers: modem: rote conversion of k_work API
Replace all existing deprecated API with the recommended alternative.

Be aware that this does not address architectural errors in the use
of the work API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-14 07:07:40 -04:00
Peter Bigot
9fcd75160e drivers: wifi: rote conversion of k_work API
Replace all existing deprecated API with the recommended alternative.

Be aware that this does not address architectural errors in the use
of the work API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-14 07:07:40 -04:00
Peter Bigot
74f776c29c drivers: ieee802154: rote conversion of k_work API
Replace all existing deprecated API with the recommended alternative.

Be aware that this does not address architectural errors in the use
of the work API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-14 07:07:40 -04:00
Peter Bigot
659fe50ff0 drivers: ethernet: rote conversion of k_work API
Replace all existing deprecated API with the recommended alternative.

Be aware that this does not address architectural errors in the use
of the work API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-14 07:07:40 -04:00
Jose Alberto Meza
74d55c6b5e drivers: espi: xec: Reduce buffer allocation to minimum required
Update eSPI buffer to values required per eSPI specification.
Allow applications to override as needed.
Guarantee buffers are not allocated at all if channels are
disabled.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2021-04-13 18:29:35 -04:00
Pawel Dunaj
1caf5fd21e drivers: led_pwm: Handle power state changes
Suspend/resume PMW device when PWM LEDs are suspended/resumed.

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2021-04-13 16:21:07 -04:00
Jiafei Pan
46d7de1aad interrupt_controller: gic: add SMP support
Add the function to raise SGI, and initialize GICC for secondary
Cores.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2021-04-13 15:09:23 -04:00
Henrik Brix Andersen
e8ffafae12 drivers: intc: shared_irq: remove internal structs from header
Move the internal structs used by the generic, shared interrupt driver
from the public header file into the implementation file.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-04-13 13:03:33 -04:00
Tim Lin
cd96046bee ite: drivers/adc: add adc drivers on it8xxx2_evb platform
This commit is about the it8xxx2 analog to digital converter
driver. Support 8 channels ch0~ch7 and 10-bit resolution.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-04-13 13:01:56 -04:00
Yong Cong Sin
f40cd8b718 drivers/i2c: Reset i2c of STM32F1 series to enter master mode properly
Reset the I2C of the STM32F1 series to enter master mode properly.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-04-13 13:00:36 -04:00
Jaxson Han
36006ed1ba drivers: gicv3: GIC with single secure mode
The Cortex-R 64-bit processor only supports GIC with single
security mode

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2021-04-13 07:47:44 -04:00
Morten Priess
385f232ae2 Bluetooth: controller: Propagate ticker force to ULL
The ticker 'force' flag is propagated via the ticker elapsed callback,
in order to provide necessary information for collision resolving in the
link layer.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2021-04-13 12:15:12 +02:00
Kim Bøndergaard
6adafaeb02 driver: display: Add support for st7735r based LCDs
First version of a driver for the st773r LCD controller.
Based on st7789v

Signed-off-by: Kim Bøndergaard <kim@fam-boendergaard.dk>
Signed-off-by: Kim Bøndergaard <kibo@prevas.dk>
2021-04-12 16:42:00 -04:00
Kumar Gala
c7412bb0c4 drivers: uart: uart_cmsdk_apb: Fix compile warning.
If we are building the driver with CONFIG_UART_INTERRUPT_DRIVEN=n
we need to ifdef around the decleration of uart_cmsdk_apb_isr()
or we'll get a compiler warning.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-04-12 12:06:56 -05:00
Loic Poulain
fd777c39ad drivers: video: sw_generator: Fix missing parameter
k_work_cancel_delayable_sync requires a second parameter for state
synchronization.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2021-04-10 07:52:30 -04:00
Mulin Chao
13b9f8aa52 driver: wdt: npcx: correct the drawing of npcx watchdog module.
The source clock of the watchdog module is selected to the input of T0
timer, not output. Correct the drawing in case confusing the users.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-04-09 14:50:37 -04:00
Mulin Chao
105af6f357 pm: power: npcx: add console expired mechanism.
This CL adds support for console expired mechanism. It implements the
notification to power management module that the module for console is
in use. If the interval that module doesn't receive any input message
exceeds CONFIG_SOC_POWER_CONSOLE_EXPIRED_TIMEOUT, the power management
module is allowed to enter deep sleep mode. This mechanism gives a
window in which the users can organize console input.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-04-09 14:50:24 -04:00
Mulin Chao
d68cc3dce6 console: introduce UART console input expired mechanism options.
This CL introduces two configuration options which allows a notification
to the power management module that the UART console module is in use
now. If the interval of console module doesn't receive any input message
exceeds expired timeout, the power management module is allowed to enter
sleep/deep sleep state and turn off the clock of console module.

This mechanism gives a window in which the users can organize input
message if CONFIG_PM is enabled.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-04-09 14:50:24 -04:00
Wealian Liao
7b7129ba9f driver: wdt: npcx: Remove watchdog reset waiting loop in ISR
NPCX watchdog driver has a WDT_NPCX_DELAY_CYCLES for delay the watchdog
reset time after the watchdog timeout. For some systems, users would
like to use the watchdog timeout ISR but don't reset the chip
immediately. Let the system have the final chance to ongoing the system
before the real hardware reset time. Removing the watchdog reset
waiting loop in ISR lets users decide whether wait for watchdog reset
by themself.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-04-09 14:50:05 -04:00
Loic Poulain
ffd3d42569 drivers: video: Conversion of k_work API
Replace deprecated API with the recommended alternative.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2021-04-09 11:55:59 -04:00
MORGER Patrick
4a26fe7032 drivers: led: fix function name of led_set_color()
Project will not build if e.x. CONFIG_USERSPACE=y is set

Signed-off-by: MORGER Patrick <patrick.morger@leica-geosystems.com>
2021-04-09 10:44:26 -05:00
Thomas Stranger
980fb6c0df drivers/watchdog: wwdg stm32: fix to support all available prescalers
As older series supported only 4 different prescaler values the
highest prescaler value was hardcoded. Newer series support 8
programmable prescaler values, therefore take the allowed values from
ll_wwdg header file.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-09 13:23:38 +02:00
Thomas Stranger
e85b929cc6 drivers/watchdog: wwdg stm32: fix prescaler setup for newer series.
Series STM32G0, STM32G4, STM32H7, STM32L5, STM32WB, STM32WL have
a newer wwdg ip and store the prescaler value not in bits[8:7],
but bits bits[13:11], use the definitions from ll to account for that.

Remove IS_WWDG_PRESCALER, this is not required as the prescaler
is not calculated, but known valid prescaler values are tested until a
valid counter is found.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-09 13:23:38 +02:00
Hake Huang
81ed02d341 dma: mcux edma driver support multi-channel
1. remove redundant protection on channel status
2. update link interface to support major and minor link

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-04-08 16:38:49 +02:00
Christian Taedcke
f8f120c5a5 drivers: eeprom: shell cmd fill can now fill whole eeprom
Modified eeprom shell fill command to be able to fill the complete
eeprom. The code of the fill command is now similar the new eeprom
read command.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2021-04-08 09:59:42 +02:00
Christian Taedcke
a86c31d802 drivers: eeprom: shell cmd read can now read whole eeprom
Modified eeprom shell read command to be able to read out the complete
eeprom. The code of the read command is now very similar the flash
read command.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2021-04-08 09:59:42 +02:00
Lukasz Majewski
344397fba5 fix: dsa: Initialize ethernet contexts for DSA switch lan interfaces
After the commit c1f7b9f45a ("net: l2: ethernet: fix k_work API usage
in carrier on/off handling") each ethernet interface (including DSA
ports) shall first call ethernet_init() before carrier_on_of() function
is called.

As DSA ethernet interfaces (lan{123}) have their own k_work item to
monitor the carrier status (by reading switch IC registers), it was
necessary to move functions, which initialize it after the code which
sets up necessary interfaces (i.e. call ethernet_init(iface)).

In that way the error when accessing uninitialized members of ethernet
context is avoided.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-04-07 14:17:05 +02:00
Emil Obalski
cd465ff8c4 drivers: sensors: Support XYZ accel get for adxl362.
Add a possibility to get values of accelerometer measurement for
all 3 axis of accelerometer with one channel_get().

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2021-04-06 18:46:03 -05:00
Armando Visconti
c4b35c1d36 drivers/sensor: lsm6dso: Add multi-instance support
Make this driver multi-instance and use the new API.

This commit makes use of some DT macro helpers
In particular:
    - get bus devices with DEVICE_DT_GET
    - get SPI information with SPI_CONFIG_DT_INST
    - get drdy gpios with GPIO_DT_SPEC_GET

Moreover the driver is now using the stmemsc common
routines as requested in issue #33440 and it avoids
the unnecessary declaration of both ctx_i2c and ctx_spi
in the data structure.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-06 15:34:01 +02:00
Armando Visconti
36eceba7e4 drivers/sensor: lsm6dso: move int-pin in DTS binding
Take the int-pin information (i.e. what pin between INT1
and INT2 the drdy is attached to) directly from DT.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-06 15:34:01 +02:00
Frank Li
6f97f52f34 driver: usdhc: modify LOG message
LOG API will auto add \r\n at output end,
remove the \r\n at the end of debug messge.

Fix misspelled.

Signed-off-by: Frank Li <lgl88911@163.com>
2021-04-06 08:13:24 -05:00
Frank Li
664aaf0bdc driver: usdhc: fix spec 1.0 sdcard can't work
The SD Card below Physical Layer 1.10 does not support CMD6.
When usdhc_sd_init is executed, it will fail to exit due to
execution of CMD6, causing the SD Card to not work normally.

For different SD Card Physical Layer specifications,
the following modifications have been made:
Version 1.10 and above support CMD6.
Version 3.0 and above support CMD6 Group 3 (driver strength
and current limit) .

Signed-off-by: Frank Li <lgl88911@163.com>
2021-04-06 08:13:24 -05:00
Benjamin Lindqvist
28ac1f70bf drivers: modem: gsm_ppp: proper attach retry
In a previous commit, a check was added to ensure modem was properly
attached to packet service before initializing PPP. Failure to perform
this check can lead to the dreaded 'NO CARRIER' issue.

While this is a nice idea, the implementation was lacking because when
the check failed, the entire modem initialization procedure was
restarted from square one. For modems/bearers that were slow to attach,
this is potentially disastrous. The proper solution is to loop only the
'AT+CGATT?' part until it succeeds, or fails N times.

This commit implements this looping behavior (using the work queue).

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2021-04-06 15:37:11 +03:00
Maureen Helm
5cc20faa2f drivers: flash: Fix FlexSPI NOR log module
Fixes the FlexSPI NOR flash driver to register a new log module rather
than declare membership in the FlexSPI controller module, which was
recently moved from drivers/flash to drivers/memc.

This fixes build errors with the mimxrt1064_evk board in:
  - samples/drivers/flash_shell
  - samples/subsys/fs/littlefs

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-04-06 04:23:51 -05:00
Hayden Ball
64995e2a54 max17055: Set battery parameters from device tree
Currently the MAX17055 driver assumes that a battery matching the
default characteristics is used.

This change allows battery characteristics to be specified in device
tree and writes them to the MAX17055 on initialization.

Existing default values are maintained for backwards compatibility.

Initialization routine taken from MAX17055 Software Implementation
Guide, document UG6365.

Signed-off-by: Hayden Ball <hayden@playerdata.co.uk>
2021-04-05 15:29:00 -05:00
Sun Amar
252f1b8e0d gecko pwm: add pwm driver for the gecko.
pwm driver + Kconfig and Cmake files for the
efr32 soc family.

Signed-off-by: Sun Amar <sun681@gmail.com>
2021-04-02 18:45:33 -04:00
Pieter De Gendt
7f46a59a42 drivers: memc: Introduce i.MX RT FlexSPI HyperRAM driver
Add the FlexSPI HyperBUS driver to support HyperRAM external
devices.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-04-02 10:36:22 -05:00
Pieter De Gendt
acca3c126c mcux flexspi: move bus driver to drivers/memc
Initially the flexspi device only supported a flash driver for
external NOR flash. As the controller supports HyperBus devices,
which can be either volatile or non-volatile, the driver iss moved
to drivers/memc.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-04-02 10:36:22 -05:00
Corey Wharton
e3c94d381a driver: sensor: Add support for BMP388 pressure sensor
Adds support for Bosch's BMP388 pressure sensors connected either
by a I2C or SPI bus.

Signed-off-by: Corey Wharton <coreyw7@fb.com>
2021-04-02 08:06:46 -05:00
Kumar Gala
8cae466100 drivers: pinmux: remove drivers/pinmux/pinmux.h
The file is only really used on STM32 SoCs so we can move the contents
that are relevant into pinmux_stm32.h and remove the file.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-04-02 07:42:18 -04:00
Ryan Erickson
78200f1812 drivers: modem: hl7800: use new work queue API
Implement new work queue API changes.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-04-02 07:24:46 -04:00
Armando Visconti
8b7a1a78c0 drivers/sensor: iis2iclx: Fix sensorhub building
The iis2iclx driver was not building correctly when
CONFIG_IIS2ICLX_SENSORHUB was enabled.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-01 15:34:36 -05:00
Armando Visconti
aae2161542 drivers/sensor: iis2iclx: avoid using both ctx_i2c and ctx_spi
The STMEMSC HAL i/f requires every driver using it to define
for each instance a stmdev_ctx_t structure, which is used to
export the hardware specific APIs to handle i2c and spi busses
operations. Since this structure is bus agnostic, there is no
need to declare it twice for both i2c and spi. Instead, declare
only one structure, which will be populated either with i2c APIs
or with spi APIs according to where that particular instance is
declared inside the DT.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-01 15:34:36 -05:00
Armando Visconti
9e50268c96 drivers/sensor: iis2iclx: Make use of stmemsc common routines
Make use of the stmemsc i2c/spi read/write routine that
has been introduced to simplify the ST sensor drivers code.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-01 15:34:36 -05:00
Armando Visconti
253cbfd0aa drivers/sensor: stmemsc: Add common i2c/spi read/write routines
Add common i2c/spi read/write routines for the benefit of those
ST sensor drivers who make use of the stmemsc HAL i/f.

Add generic stmemsc_cfg_i2c and stmemsc_cfg_spi structures which
contains all relevant information required by i2c/spi low level
routines, such as:

    - the pointer to the bus device
    - the I2C slave address (if instance is on I2C bus)
    - the spi_config structure (if istance is on SPI bus)

This level of abstraction allows the re-use of the i2c/spi read/write
routines among all stmemsc based sensor driver without the need to
reference the specific sensor data and or config structures.

The STMEMSC HAL source code is located here:
     zephyrproject-rtos/modules/hal/st/sensor/stmemsc/

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-01 15:34:36 -05:00
Shlomi Vaknin
e9efa8a77c dma: stm32: enable half transfer interrupt
Enable half transfer interrupt of the dma controller
in case the channel was enabled in circular mode.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-04-01 07:32:22 -05:00
Nicolas VINCENT
573eec1014 drivers: serial: stm32 databits depends on parity
On stm32, the M bits defines the length of the frame between the start
bit and the stop bit, eventually including the parity bit when enabled.
Fix configuration of databits to set correct M bits when parity is
enabled.
This commit tries to address issue zephyrproject-rtos/zephyr#33351

Signed-off-by: Nicolas VINCENT <nicolas.vincent@vossloh.com>
2021-04-01 07:30:05 -05:00
Anas Nashif
5fa12073cb drivers: remove what appears to be code from comments
Some tools consider this as commented code because of the ifdef, so
remove that and fix a coding guideline violation.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-01 05:34:17 -04:00
Anas Nashif
0630452890 x86: make tests of a value against zero should be made explicit
Tests of a value against zero should be made explicit, unless the
operand is effectively Boolean. This is based on MISRA rule 14.4.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-01 05:34:17 -04:00
Jani Hirsimäki
5d76e8aca8 net: ppp: dialup enablers
Introducing PPP dialup features to enable e.g. usage of nrf9160
based board as a dialup modem for transferring ip data over PPP
 (e.g. windows dial up), i.e. usage of Zephyr PPP as a server for
 providing MTU/MRU, IP address and DNS addresses for a PC:
- PPP LCP MRU option (configurable)
- PPP server: IPCP ip and dns address peer options to enable
providing IP and DNS addresses for PPP peer.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2021-04-01 09:43:56 +03:00
Christian Taedcke
ebcc316e1c drivers: watchdog: mcux_wwdt: fix validating window min vs max
The comparison was inverted before so configuring a valid window
providing min and max was not possible.

Now the comparison is corrected and only done if the watchdog is used in
windowed mode.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2021-03-31 14:15:27 -05:00
Henrik Brix Andersen
a865b1bb49 soc: arm: nxp: ke1xf: use clock nodes for NXP Kinetis SCG clocks
Use a combination of fixed-clock and fixed-factor-clock devicetree
nodes for describing the clock dividers/multipliers of the NXP Kinetis
System Clock Generator (SCG) present in the KE1xF SoC series.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-03-31 11:56:13 -05:00
Masoud Shiroei
ef2a590281 drivers: sensor: lis2mdl: Add single mode operation
Support single mode operation by enabling it and
making the driver to use the interrupt to findout
when the data is ready for fetch. The sample fetch
will be blocked for a specified maximum time untill
the interrupt happens.

* Make operation mode configurable in DTS file
* Make offset cancellation configurable in DTS file
* Use single common .yaml file for both i2c and spi
* Store above configurations in dev->config_info

Signed-off-by: Masoud Shiroei <masoud.shiroei@assaabloy.com>
2021-03-31 08:08:35 -04:00
Masoud Shiroei
02238adf2a drivers: sensor: lis2mdl: Fix all log messages
Remove unnecessary "\n" at the end of logs.

Change LOG_DBG to LOG_ERR wherever is appropriate

Signed-off-by: Masoud Shiroei <masoud.shiroei@assaabloy.com>
2021-03-31 08:08:35 -04:00
Zisis Adamos
7235b09bb2 drivers: uart: stm32: Fixes timing of TX_DONE generation.
Corrects TX_DONE generation occuring to early
on async api.
Fixes #33866
Signed-off-by: Zisis Adamos <zisarono@gmail.com>
2021-03-31 08:06:12 -04:00
JuHyun Kim
b486c35bc9 driver: sensor: icm42605: Fixed Dereference afterr null check issue
Fixed Coverity CID: 219524 : Dereference after null check
For fix this issue added null check before call function pointer

Fixes #32913

Signed-off-by: JuHyun Kim <jkim@invensense.com>
2021-03-30 08:17:47 -04:00
Vinayak Kariappa Chettimada
cd798202cb Bluetooth: controller: Fix flash driver sync regression
Fix flash driver sync regression introduced due to changed
default ULL_HIGH in the commit 30634334a8 ("Bluetooth:
controller: Fix ULL_HIGH priority to be lower than LLL").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 10:55:36 +02:00
Andrzej Puzdrowski
6acc4a2521 drivers/flash/flash_stm32g4x: fixed build issue
This driver file couldn't be compiled due the syntax error.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
bd48673fb5 drivers/eeprom/eeprom_emulator: remove flash_write_protection_set() usage
This patch removes scenario which was testing deprecated
API behaviors. Needed as As flash_write_protection_set() was
deprecated and became no-operation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
e55532c639 drivers/flash/flash_shell: remove flash_write_protection_set() usage
This patch removes scenario which was testing deprecated
API behaviors. Needed as As flash_write_protection_set() was
deprecated and became no-operation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
1960a5d234 disk/disk_acces_flash: remove flash_write_protection_set() usage
This patch removes scenario which was testing deprecated
API behaviors. Needed as As flash_write_protection_set() was
deprecated and became no-operation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
7d53e0118b drivers/flash: removed write protection API implementations
flash_write_protection_set() API was deprecated so driver
implementation interface is left behind as well.

This patch removes all implementation pointed by the interface
'struct flash_driver_api.write_protection'.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
7c01b18de7 drivers/flash/flash_simulator: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

As CONFIG_FLASH_SIMULATOR_ERASE_PROTECT become a dead option.
this commit removes it as well.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
7f01abadde drivers/flash/soc_flash_nios2_qspi: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
0172cc159d drivers/flash/flash_stm32_qspi: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
14e7c5a5aa drivers/flash/flash_stm32h7x: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
6e4cdb0c99 drivers/flash/flash_stm32: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
fb6e824456 drivers/flash/flash_gecko: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
bcfd9e8daf drivers/flash/soc_flash_sam0: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
95d75bbbab drivers/flash/soc_flash_sam: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

Write procedure was fixed so it doesn't lock the driver after
failure anymore.

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
72394f783a drivers/flash/soc_flash_rv32m1: integrate WP service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
8e3eb3c740 drivers/flash/soc_flash_lpc: integrate protection service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
5d5018e4e5 drivers/flash/soc_flash_mcux: integrate protection service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
48c7e0dd94 drivers/flash/spi_nor: integrate protection service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
e034d7fd07 drivers/flash/nrf_qspi_nor: integrate protection service into write/erase
Flash write protection services were integrated into erase and write
procedures. This is step required for fixing following issue:
Multi-threading flash access is not supported by
flash_write_protection_set().

flash_write_protection_set() will be deprecated.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Jeremy Wood
5164d65269 drivers: usb: device: Add support for USB FS on STM32H7.
* Assumes that the USB2_OTG peripheral is being used in FS mode, as on
  the NUCLEO-H743/753.
* Disable ULPI on USB2_OTFG, enable FS clk.
* Enable USB voltage detect and disable USB reg, per STM app notes.

Signed-off-by: Jeremy Wood <jeremy@bcdevices.com>
2021-03-29 13:42:46 -04:00
Petri Oksanen
4c88abcf7f drivers: nrf: uarte: rx flush amount calculation
The NRF UARTE has an undocumented feature that when you flush the RX
FIFO, the RXAMOUNT register is not cleared to zero if the FIFO is in
fact empty. This fix is correcting something that was most likely a
typo.

Signed-off-by: Petri Oksanen <petri@iote.ai>
2021-03-29 14:16:50 +02:00
Francois Ramu
9d2aead97b drivers: timer: st_stm32: add lptimer management to stm32l5 series
This patch introduces the support of the LowPower Timer
for the STM32L5xx from STMicroelectronics.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-03-26 18:06:01 -04:00
Gustavo Romero
5f40b5d4f9 drivers: uart: uart_cmsdk_apb: Fix uart_irq_is_pending
Currently CMSDK uart_irq_is_pending does not use RX and TX interrupt
bits found in INTSTATUS register to check for pending interrutps but
rather it checks for pending interrupts indirectly by checking if RX and
TX buffers are, respectively, full and empty, i.e. it checks bits 0 and
1 in STATE register instead of bits meant for interrupt status found in
INTSTATUS register.

That is particularly problematic because although a RX interrupt implies
a RX buffer full and a TX interrupt implies a TX buffer empty, the
converse is not true. For instance, a TX buffer might be empty for all
data was processed (sent to serial line) already and no further data was
pushed into TX buffer so it remained empty, without generating any
additional TX interrupt. In that case the current uart_irq_is_pending
implementation reports that there are pending interrupts because of the
following logic:

/* Return true if rx buffer full or tx buffer empty */
return (UART_STRUCT(dev)->state & (UART_RX_BF | UART_TX_BF))
                                != UART_TX_BF;

which will return 1 (true) if STATE[0] = 0 (TX buffer is empty), since
UART_TX_BF = 1, so STATE[0] != UART_TX_BF, which is true (assuming here
for the sake of simplicity that UART_RX_BF = 0, i.e. RX buffer is empty
too).

One of the common uses of uart_irq_is_pending is in ISR in contructs
like the following:

while (uart_irq_update(dev) && uart_irq_is_pending(dev)) {
  if (uart_irq_rx_ready(dev) == 0) { // RX buffer is empty
    continue;
  }
  // RX buffer is full, process RX data
}

So the ISR can be called due to a RX interrupt. Upon finishing
processing the RX data uart_irq_is_pending is called to check for any
pending IRQs and if it happens that TX buffer is empty (like in the case
that TX interrupt is totally disabled) execution gets stuck in the while
loop because TX buffer will never transition to full again, i.e. it will
never have a chance to have STATE[0] = 1, so STATE[0] != UART_TX_BF is
always true.

This commit fixes that undesirable and problematic behavior by making
uart_irq_is_pending use the proper bits in the interrupt status register
(INTSTATUS) to determine if there is indeed any pending interrupts.

That, on the other hand, requires that the pending interrupt flags are
not clearly automatically when calling the ISR, otherwise
uart_irq_is_pending() will return immediatly false on the first call
without any data being really processed inside the ISR. Thus, because
both RX and TX buffer (FIFO) are only 1 byte long, that commit clears
the proper interrupts flags precisely when data is processed (fifo_read
and fifo_fill) or when the interrupts are disabled (irq_rx_disable and
irq_tx_disable).

Finally, that commits also takes the chance to update some comments,
specially regarding the need to "prime" when enabling the TX interrupts
(in uart_cmsdk_apb_irq_tx_enable()). The need to "prime" can be verified
in the CMSDK UART reference implementation in Verilog mentioned in the
"Arm Cortex-M System Design Kit" [0], on p. 4-8, section 4.3,
in cmsdk_apb_uart.v. In that implementation it's also possible to verify
that the FIFO is only 1 byte long, justifying the semantics that if
buffers are not full (STATE[0] or STATE[1] = 0) they are _completly_
empty, holding no data at all.

[0] https://documentation-service.arm.com/static/5e8f1c777100066a414f770b

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
2021-03-26 08:39:33 -04:00
Rich Barlow
9f2a65e74e disk: sdhc: Switch to clock frequency from DTS
The "spi-max-frequency" property already exists, but was unused. This
now sets the SPI clock frequency to this value (limited to 24MHz) once
initialisation is complete.

Due to the nature of the SPI API, it is necessary to have two separate
configuration structures to switch clock speed as some SPI drivers only
compare pointers to detect changes.

Fixes: #32996

Signed-off-by: Rich Barlow <rich@bennellick.com>
2021-03-26 08:34:43 -04:00
Flavio Ceolin
169144afa1 drivers: flash: Fix variable type
erase_page returns a negative value in case of error. We should
not use an unsigned type.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-26 07:13:13 -04:00
Flavio Ceolin
799147f43a drivers: ethernet: Fix variable type
net_recv_data returns an int, so we should not use an unsigned type.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-26 07:13:13 -04:00
Flavio Ceolin
6771f7bb90 drivers: hwinfo: Remove invalid comparison
size_t is never lesser than zero. Just remove it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-26 07:13:13 -04:00
Flavio Ceolin
6f629b1727 drivers: flash: Fix variable type
erase_sector returns a signed type and we should not use
an unsgined type.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-26 07:13:13 -04:00
Mulin Chao
291c61fd47 driver: timer: npcx: fix dead code flow for K_TICKS_FOREVER.
Fix dead code flow if ticks is K_TICKS_FOREVER.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-03-26 07:03:09 -04:00
Christian Taedcke
b0b20112e8 drivers: sensor: ccs811: fix sw reset delay
Before this change, the sw reset did not work after power-on, because
I2C commands are only accepted after 20msec (t_START after power-on).

Now the 20msec delay is moved before performing the reset to ensure that
the SW reset command can be executed. An additional 2msec delay is added
after the reset (see datasheet t_START after reset).

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2021-03-25 16:58:42 -05:00
Flavio Ceolin
9fd4ea91b7 coccinelle: Remove extra semicolon
coccicheck --mode=patch --cocci=semicolon.cocci

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-25 11:35:30 -05:00
Krzysztof Chruscinski
ab49673bc8 drivers: timer: nrf_rtc_timer: Change type of channel argument
There was an inconsistency in the API as z_nrf_rtc_timer_chan_alloc
returned int but other function were using uint32_t for channel
argument. Updated api to use int32_t everywhere.

Update nrf_802154 driver which was using this api to use int32_t.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-25 15:54:49 +01:00
Francois Ramu
1804d7f5f0 drivers: clock_control of the stm32mp1 remove unknown bits
The bit RCC_MC_APB3ENSETR_PMBCTRL and RCC_MC_AHB5ENSETR_AXIMC
does not exist in the stm32mp1xx ref manual anymore.
They are not present in the stm32mp1xx_ll_bus.h (v1.4.0).

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-03-25 08:58:10 -05:00
Kumar Gala
0bb4665df7 include: Move ptp_clock.h to drivers/ptp_clock.h
Move ptp_clock.h out of the top level include/ dir into
include/drivers/ptp_clock.h and deprecated the old location.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-25 10:09:33 +02:00
Johann Fischer
63ca48a7a9 drivers: usb_dc_native_posix: use ep_dir and ep_idx in usbip_send_common
Use ep_idx in usbip_send_common() instead of endpoint address
and get direction from endpoint address.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-24 15:02:49 +01:00
Johann Fischer
735ba17cad drivers: usb_dc_native_posix: read setup packet as part of submit struct
USB setup packet is a part of USBIP_CMD_SUBMIT, but missing
in struct usbip_submit. This patch fixes it and removes
usbip_skip_setup() and adds an additional integrity check
in handle_usb_control().

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-24 15:02:49 +01:00
Johann Fischer
6c214f796e drivers: usb_dc_native_posix: rework how OUT endpoint data is passed
The transfer length is not stored and processed properly.
Use struct usb_ep_ctrl_prv, which we already have, to store
the transfer length and data. Move usbip_recv() to
handle_usb_control() and handle_usb_data(),
and explicitly copy USB setup packet.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-24 15:02:49 +01:00
Johann Fischer
77c2c1230b drivers: usb_dc_native_posix: do not use IN callback without reason
Call the IN callback only if data in usb_dc_ep_write()
is actually written to the intermediate buffer and sent.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-24 15:02:49 +01:00
Johann Fischer
16cd3be690 drivers: usb_dc_native_posix: rework handle_usb_control/handle_usb_data
Use pointer to struct usb_ep_ctrl_prv, which allows to remove
a few variables and simplifies subsequent improvements.

Use consistently ep_idx in handle_usb_control() instead of
ntohl(hdr->common.ep).

Revise logging so that it is clearer what event is being processed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-24 15:02:49 +01:00
Robert Lubos
e45de8d703 drivers: modem: wncm14a2a: Explicitly ignore unused return value
Coverity complains about unchecked return value for `k_sem_take` which
is called with `K_FOREVER` and thus cannot expire/timeout. Explicity
ingore the return value to silence Coverity.

CID: 219676
Fixes #33019

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-03-24 12:23:55 +01:00
Kumar Gala
19121106f0 pinmux: s1000: Change to use ENOTSUP
Changed to use -ENOTSUP instead of -ENOSYS to be consistent with
other driver APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-23 15:46:10 -05:00
Kumar Gala
2235c71ced drivers: wifi: Remove unncessary zephyr_include_directories
Several wifi drivers add some form of zephyr_include_directories(.)
which isn't needed since the headers in the specific driver dir get
included via #include "foo.h".  So we can remove any uses of
zephyr_include_directories(.)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-23 13:14:38 -05:00
Kumar Gala
95e4b3eb2c arch: arm: Add initial support for Cortex-M55 Core
Add initial support for the Cortex-M55 Core which is an implementation
of the Armv8.1-M mainline architecture and includes support for the
M‑profile Vector Extension (MVE).

The support is based on the Cortex-M33 support that already exists in
Zephyr.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-23 13:13:32 -05:00
Johann Fischer
45d468bfdb include: move disk driver interface to own header
Move disk driver interface to own header and
separate disk access interface and disk driver interface.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Johann Fischer
e3e25d0a58 drivers: usdhc: fixup i.MX RT related code after driver relocation
Fixup i.MX RT related code after driver relocation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Johann Fischer
69a5f07d16 drivers: disk: cleanup after driver relocation
Add common SDMMC_LOG_LEVEL and SDMMC_VOLUME_NAME.
Initialize drivers at POST_KERNEL level.
Update CODEOWNERS after sdmmc drivers relocation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Johann Fischer
03101e75d8 disk: move disk and sdmmc controller drivers to drivers/disk
The files disk_access_usdhc.c, disk_access_spi_sdhc.c,
disk_access_stm32_sdmmc.c, disk_access_ram.c and
disk_access_flash.c are actually drivers for block devices and SD/MMC
controllers. This patch moves this drivers to drivers/disk and
reworks the configuration so that the drivers are selected when
the corresponding node is enabled.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-03-23 12:16:01 +01:00
Steven Daglish
8f13b7860e sensor: mcp9808: Bug fix for setting resolution
Resolution currently only gets set if CONFIG_MCP9808_TRIGGER is also
set. If CONFIG_MCP9808_TRIGGER is not set, resolution gets not to '0'.

This small bug fix moves resolution to before CONFIG_MCP9808_TRIGGER is
checked, so that the resolution is changed as required.

Signed-off-by: Steven Daglish <s.c.daglish@gmail.com>
2021-03-23 12:13:45 +01:00
Pieter De Gendt
000924c8eb sensor: bq27421: lazy configure fuel gauge
The BQ274XX driver init function performs a lot i2c transfers
that slow down booting the system. We can do this lazely on the
first sample request to speed up the boot.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-03-23 12:13:20 +01:00
Anas Nashif
5d6c219210 drivers: device: do not reuse tag name 'device'
Do not reuse tag name (misra rule 5.7).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-22 19:48:14 -04:00
Andrei Emeltchenko
365be4540b edac: ibecc: Add supported SKU device IDs
List all supported device IDs found in External Design Specification
Volume 1 which have IBECC supported.

Fixes #33543

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-03-22 13:05:01 -04:00
Flavio Ceolin
a6183cff87 pm: docs: sys_suspend -> pm_system_suspend
Change references to an old function name.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-22 12:42:30 -04:00
Hubert Miś
7d8f78a08b drv: display: Initial FT800 display driver
This patch includes initial support for FT800 display driver.
It includes basic features. It can be easily extended with more
FT800 display list and co-processor features.

Signed-off-by: Hubert Miś <hubert.mis@gmail.com>
2021-03-19 19:05:53 +01:00
Sylvio Alves
856ff7db3d wifi: esp32: remove posix api dependency
HAL was updated so that POSIX API is not a dependency anymore.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-03-19 17:27:40 +02:00
Anas Nashif
c076d94eec kernel: remove tickless idle
This feature predated the tickless kernel and has been in legacy mode
for a while. We now have no drivers or systems that do not support
tickless, so remove this option and cleanup the code to only use
tickless.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Anas Nashif
a518f48796 clock: renmae z_timeout_end_calc -> sys_clock_timeout_end_calc
Do not use z_ for internal APIs, z_ is for private APIs within one
subsystem only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Anas Nashif
fe0872c0ab clocks: rename z_tick_get -> sys_clock_tick_get
Do not use z_ for internal APIs, z_ is for private APIs within one
subsystem only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Anas Nashif
ffd01833d3 clock: z_clock_device_ctrl -> sys_clock_device_ctrl
Do not use z_ for internal APIs, z_ is for private APIs within one
subsystem only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Anas Nashif
771cc9705c clock: z_clock_isr -> sys_clock_isr
Do not use z_ for internal APIs, z_ is for private APIs within one
subsystem only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Anas Nashif
38eca45b32 drivers: arcv2_timer0: fix comment
Comment talking about z_timer_int_handler which does not exist, replace
with timer_int_handler.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Anas Nashif
12b53d121e clock: rename z_timer_cycle_get_32 -> sys_clock_cycle_get_32
This is another API that is being used in all timer drivers and is not
internal to the clock subsystem. Remove the leading z_ and make promote
it to a cross-subsystem API.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Anas Nashif
9c1efe6b4b clock: remove z_ from semi-public APIs
The clock/timer APIs are not application facing APIs, however, similar
to arch_ and a few other APIs they are available to implement drivers
and add support for new hardware and are documented and available to be
used outside of the clock/kernel subsystems.

Remove the leading z_ and provide them as clock_* APIs for someone
writing a new timer driver to use.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-19 11:22:17 -04:00
Raveendra Padasalagi
e2b51da6f5 drivers: dma: paxdma: increase bd buffers.
Increase BD buffers from 7 to 9 to handle 1024 block
counts having mega/normal src,dst bd combinations in one request.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-19 09:32:08 -04:00
Raveendra Padasalagi
9adbc5a616 drivers: dma: paxdma: Sync payload as separate packet
Sync packet is always CARD to HOST and if it's combined with HOST
to CARD transfers in one single RM header packet, it's not allowed
due to RM implementation constraints. RM implementation allows same
type of data transfer direction in all the BD's populated under one
header BD.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-19 09:32:08 -04:00
Raveendra Padasalagi
32d62972ce drivers: dma: paxdma: Use uncached sync bufer
Use uncached memory for sync payload buffer.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-19 09:32:08 -04:00
Kumar Gala
607469616d counters: Remove deprecated APIs
Remove support for counter_read and counter_get_max_relative_alarm as
they have been deprecated for at least 2 releases.  As part of the
removal of counter_get_max_relative_alarm remove the code in all
counter drivers that implemented the API.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-18 19:35:14 -04:00
Scott Worley
dde796a1c9 drivers: gpio: mchp: Fix pin configure after disconnect
GPIO driver properly disconnects a pin. On subsequent pin
configure calls the driver does not clear the GPIO pin's
power gate field resulting in the pin remaining disconnected.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-03-18 14:55:44 -04:00
Giancarlo Stasi
39a3b3c71e drivers: entropy: stm32: fix discarding of false negative rng values
Function random_byte_get() returns only the least significant byte of
the 32-bit random datum, as this is the used value, so avoiding that
higher numbers are interpreted as negative error codes and their value
is not discarded.

Signed-off-by: Giancarlo Stasi <giancarlo.stasi.co@gmail.com>
2021-03-18 08:47:09 -04:00
Shlomi Vaknin
41ca34a752 drivers: stm32: rtc: Add option to keep rtc value
Add option to keep rtc value between resets.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-03-18 08:46:30 -04:00
Piotr Mienkowski
f5163e2ce2 drivers: sensor: Add Atmel SAM QDEC (TC) Driver
Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-03-18 10:20:17 +01:00
Jun Lin
2638f2ecc4 npcx: move scfg driver from pinctrl to soc/arm/nuvoton_npcx/common
In NPCX chips, System Configuration module can configure not only
pinctrl but also misc. functionality such as glue and flash write
protection. This change moves the scfg driver from the pinctrl folder
to soc/arm/nuvoton_npcx/common and renames it to avoid confusion.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-03-17 18:47:32 -04:00
Wealian Liao
5835928423 drivers: watchdog: npcx: mask the WDRST_STS when accessing T0CSR
Register T0CSR bit 4 is WDRST_STS which is used to check whether the
chip has watchdog reset from the last power-up or vcc1_rst. WDRST_STS
hardware is design to write one clear. For the original
read-modify-write, it will reset the WDRST_STS unexpected. Add a mask
to avoid it.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-03-17 17:49:17 -04:00
Mulin Chao
8c76688b5f soc: power: npcx: solve an interrupt storm caused by host access.
This CL solves an interrupt storm caused by plenty of host access
messages when system is in S0. It only turns on the host access
interrupt before ec enters sleep and turns it off after leaving
sleep.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-03-17 15:32:14 -04:00
Xavier Chapron
30c9588aaa drivers: modem: ublox-sara-r4: Fix dereference before null check
Fixes #32916

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2021-03-17 07:25:59 -05:00
Igor Knippenberg
79a3d1b85a drivers: sensors: fdc2x1x: Add driver for Texas Instruments FDC2X1X
Adds support for the Texas Instruments FDC2X1X Capacitance-to-Digital
Converter for Proximity and Level Sensing Applications.

Signed-off-by: Igor Knippenberg <igor.knippenberg@gmail.com>
2021-03-17 11:35:17 +01:00
Jeremy Wood
901cd5745e drivers: clock_control: Add support for STM32H753XX.
Added support for STM32H753XX by adding CONFIG_SOC_STM32H753XX to list
of H7 SoC with maximum 480MHz SYSCLK.

Signed-off-by: Jeremy Wood <jeremy@bcdevices.com>
2021-03-17 11:34:20 +01:00
Julien D'Ascenzio
e1d22a0b61 drivers: i2c_ll_stm32_v2: Add timeout on transfer
When, due to EMC, a spike happens on the SCL line the driver stay in
BUSY state. It could be reproduced by forcing the SCL temporarily to
ground. It's probably a behavior relating to the operation of
multi-master.
By adding a timeout to the msg_read and msg_write function we can
detect that something went wrong, and when that happens we force the
end of communication.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2021-03-17 11:34:08 +01:00
Thomas Stranger
8397cae10e drivers: clock_control: stm32: rm Kconfig for APB2 prescaler on g0 serie
stm32g0 series does not have apb2 prescaler, reflect that in kconfig.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-03-17 11:30:20 +01:00
Thomas Stranger
dde018ce64 drivers: clock_control: stm32g0: add support for g051, g0b1, g0b0 socs
Sets CLOCK_STM32_PLL_Q_DIVISOR for all g0x1 socs and g0b0.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-03-17 11:30:20 +01:00
Thomas Stranger
d9f5581499 drivers: gpio: add definition for stm32g0 porte
Advanced stm32g0 socs additionally have gpio port e.
This commit adds the missing definition for the port.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-03-17 11:30:20 +01:00
Kumar Gala
48d01cfcb3 drivers: pcie: endpoint: Convert dma to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the dma controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-17 11:28:31 +01:00
Marcin Niestroj
9fd26627bb drivers: gpio_nrfx: support edge interrupts using GPIO SENSE
Currently level interrupts are implemented using GPIO SENSE, but edge
interrupts using GPIOTE events. Using GPIOTE events results in increased
power consumption according to product specifications and erratas of
some nRF MCUs. In case of nRF52832 it is <20uA in System ON Idle and
~400-450uA when used in conjunction with SPI or TWI.

Add a user configurable option to select between GPIOTE events and GPIO
SENSE mechanism, for implementing edge interrupts. Selecting GPIO SENSE
option will allow to reduce power consumption in scenarios mentioned by
nRF MCUs erratas.

Additionally GPIO SENSE mechanism (as opposed to GPIOTE event) allows to
detect state changes of pins configured as output.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-03-16 10:02:42 +01:00
Pieter De Gendt
bbdeee65a3 i2c-mcux-lpi2c: take semaphore during transfer
Ported commit 49a3ce5881

Transfer locking is required if multiple devices use the same i2c bus.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-03-15 10:24:03 +01:00
Tomasz Bursztyka
915f4ac3c7 drivers/interrupt_controller: Get the IOAPIC RTEs dynamically
The fixed number of 24 RTEs is a legacy thing, and long gone by now.
IOAPICs expose the maximum number of RTEs they have via the version
register, so let's use it.

This avoids to manually tweak a Kconfig option (which is now removed)
and fixes the RTE number for all x86 targets relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-03-12 09:23:08 -05:00
Benjamin Lindqvist
4626a577c4 drivers: modem: gsm_ppp: Kconfig for autostarting ppp
Autostarting PPP is far from controversial. There are many, many reasons
someone could have for wanting to control exactly when PPP starts. Power
management, NET_EVENT race condition avoidance and any application not
requiring constant and instant use of networking just to name a few.

This commit introduces a Kconfig setting, GSM_PPP_AUTOSTART, which
controls whether gsm_ppp should connect and initialize PPP at boot. It
is set to "y" as default to minimize surprises for legacy code.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2021-03-12 13:27:22 +02:00
Guðni Már Gilbert
6145ab537f drivers: modem: fix coverity issue
Added (void) cast to supress coverity report. The usage of K_FOREVER
tells me we're not interested in the returned value.

Coverity-CID: 219653
Fixes #33034

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2021-03-11 10:08:19 -05:00
Wojciech Tatarski
35dd66b6c4 drivers: gpio: add EOS S3 GPIO driver
Add GPIO driver for QuickLogic EOS S3 SoC.

Co-authored-by: Jan Kowalewski <jkowalewski@antmicro.com>

Signed-off-by: Wojciech Tatarski <wtatarski@antmicro.com>
Signed-off-by: Jan Kowalewski <jkowalewski@antmicro.com>
2021-03-11 08:58:20 -05:00
Guðni Már Gilbert
bf93d4f1a0 drivers: ethernet: gmac: fix coverity issue
If return value is negative (failed) then log the error with a
message.

Coverity-CID: 219519
Fixes #32927

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2021-03-11 08:49:10 -05:00
Armando Visconti
de707b6870 drivers/sensor: iis2iclx: fix multi-instance using new helpers
This commit simplifies the Device Tree configuration by using
the new helpers introduced in #30536.

In particular:
    - get bus devices with DEVICE_DT_GET
    - get SPI information with SPI_CONFIG_DT_INST

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-03-10 06:11:45 -05:00
Jose Alberto Meza
0bcb0081cc drivers: gpio: mchp: Add support for GPIO disconnected flag
Currently, if GPIO_DISCONNECTED flag is used pin remains as input,
this causes some additional power to be drain which is
undesired.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2021-03-10 06:10:39 -05:00
Mulin Chao
2134f9b72d driver: clock: npcx: remove useless operands.
Remove useless operands since 'bit' field of npcx_clk_cfg structure is
only 3-bit depth and always under 8.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-03-09 10:33:16 -05:00
Mulin Chao
0012ba5a38 driver: espi: npcx: prevent changing data content in host write func.
This CL prevents changing data content in the write function of host
interface by declaring it as constant pointer.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-03-09 10:31:05 -05:00
Mulin Chao
b6ad85cdd9 driver: host_sub: npcx: remove self-assignment for clearing status.
This CL removes self-assignment of SMC_STS register for clearing its
status.

Fixes #33089.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-03-09 10:06:26 -05:00
Erwan Gouriou
7dc6b03df3 drivers/watchdog: wwdg_stm32: Check return value of clock_control_on
In function wwdg_stm32_init, return value of clock_control_on
was not checked.
This is reported as an issue by coverity (CID 219600).
Fix this.

Fixes #33067

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-09 09:08:40 -05:00
Erwan Gouriou
ddeff276a4 drivers/gpio: stm32: Check return value of clock_control_on api call
In function gpio_stm32_enable_int, retiurn value of clock_control_on
was not checked.
This is reported as an issue by coverity (CID 219652).
Fix this.

Fixes #33035

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-09 09:08:40 -05:00
Satoshi Ikawa
f47f23f1a0 drivers: i2c_dw: Convert to use register for RX/TX buffer depth
RX/TX buffer depth are configurable parameters of DW_apb_i2c.

Change code from using fixed value I2C_DW_FIFO_DEPTH to using
register ic_comp_param_1 for RX/TX buffer depth.

Signed-off-by: Satoshi Ikawa <ikawa.satoshi@socionext.com>
2021-03-09 14:16:35 +01:00
Guðni Már Gilbert
15d1ea544b drivers: sensor: bmi160: Fix bug where undersampling is not set
Fix #32774

Bit position BIT(7) is 1000 0000 in binary which is actually the
bit positon 128. BIT(7) can be used as a mask, but we need to define
the position specifically as the integer 7.

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2021-03-09 14:16:24 +01:00
Kumar Gala
b9ed2d33fd drivers: spi: Remove unused Kconfig symbols
Remove SPI_[0-8] and SPI_[0-8]_OP_MODES Kconfig symbols as no driver
uses them anymore.  We also cleanup board and sample code to remove
use of these symbols.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-09 04:53:46 -05:00
Mulin Chao
97db5d74c7 driver: espi: npcx: fix out-of-bounds read in espi_vw_generic_isr.
Fix out-of-bounds read in espi_vw_generic_isr func.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-03-09 04:51:50 -05:00
Kumar Gala
0f0308c197 drivers: spi: sam0: Convert dma to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the dma controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-08 18:22:27 -06:00
Kumar Gala
c2f7382007 drivers: uart: sam0: Convert dma to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the dma controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-08 18:22:27 -06:00
Kumar Gala
d7da73f432 drivers: i2c: sam0: Convert dma to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the dma controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-08 18:22:27 -06:00
Mikkel Jakobsen
93dc7e9b44 drivers: clock_control: mcux_mcg: add MCGOUTCLK define
Add MCGOUTCLK define to kinetis_mcg.h to make it possible to
use \`<&mcg KINETIS_MCG_OUT_CLK>\` in device tree.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@prevas.dk>
2021-03-08 12:18:33 -06:00
Andy Ross
eb1ef50b6b arch/xtensa: General cleanup, remove dead code
There was a bunch of dead historical cruft floating around in the
arch/xtensa tree, left over from older code versions.  It's time to do
a cleanup pass.  This is entirely refactoring and size optimization,
no behavior changes on any in-tree devices should be present.

Among the more notable changes:

+ xtensa_context.h offered an elaborate API to deal with a stack frame
  and context layout that we no longer use.

+ xtensa_rtos.h was entirely dead code

+ xtensa_timer.h was a parallel abstraction layer implementing in the
  architecture layer what we're already doing in our timer driver.

+ The architecture thread structs (_callee_saved and _thread_arch)
  aren't used by current code, and had dead fields that were removed.
  Unfortunately for standards compliance and C++ compatibility it's
  not possible to leave an empty struct here, so they have a single
  byte field.

+ xtensa_api.h was really just some interrupt management inlines used
  by irq.h, so fold that code into the outer header.

+ Remove the stale assembly offsets.  This architecture doesn't use
  that facility.

All told, more than a thousand lines have been removed.  Not bad.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-03-08 11:14:27 -05:00
Erwan Gouriou
d2a2b7cb56 drivers/gpio: stm32: Set SWJ higher prio vs device pin configuration
Serial Wire JTAG configuration option is made available
under condition that SPI_3 was not enabled on SOC_STM32F103XE.
Besides being obsolete there are various other potential conflicts
with other periphals, and it is not possible to explicit them all.

To make it more coherent remove such condition, assume that user
needs to take care of such pin conflict and express SWJ as having
precedence over peripheral devices pin configuration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-08 08:37:01 -06:00
Krzysztof Chruscinski
f075fee107 drivers: serial: nrfx_uarte: Add low power mode
Lowest power consumption can be achieved when uarte peripheral
is disabled when not used. In low power mode, need for both
directions is tracked and if both are no in use peripheral is
disabled. TX disabling is instant but RX requires flushing RX
fifo because data in hardware fifo is lost when peripheral is
re-enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-08 12:51:50 +01:00
Krzysztof Chruscinski
fb28f911da drivers: serial: nrfx_uarte: Refactor driver
Refactored driver to prepare for low power extension. Functional
change is limited to handling of RX_DISABLED event which is now
generated from RXTO interrupt context after RX is stopped. Previously,
RX was not stopped after the transfer.

Rx flushing function contains hardware limitation workaround.
Workaround is applied only if flushed data is not discarded.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-08 12:51:50 +01:00
Krzysztof Chruscinski
f93c700d5d drivers: uart: nrfx_uarte: Refactor driver configuration
Merged existing options into single word with flags.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-08 12:51:50 +01:00
Benjamin Lindqvist
254c126236 drivers: modem: optional factory reset at modem boot
Some modems, under some conditions, have a tendency to get stuck without
a connection due to cached state. We have observed this on some Simcom
LTE modems after large cellular outages. The modems are unable to escape
their cached state for some reason unless they're factory reset (or a
cache clearence is forced in some other way).

This commit allows for the modem to be factory reset at each boot. This
minimizes dependencies on external state by ensuring each power-up is as
similar as possible.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2021-03-06 09:09:35 -06:00
Glauber Maroto Ferreira
d8f6e66588 esp32: drivers: spi_flash: add host flash support
Add support for ESP32 host flash chip

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-03-06 09:34:35 -05:00
Watson Zeng
faba1100ea drivers: i2c: DW i2c: use 32 bit access instead of 16 and 32 bit mix
Current DW I2C driver uses 32 bit access for some registers and
16 bit access for others. So if DW I2C IP is connected via bus
which doesn't support 16 bit access we will get bus error.

Fix that by switching to 32 bit access only instead of 16
and 32 bit mix.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2021-03-06 09:33:24 -05:00
Erwan Gouriou
0392127997 drivers/clock_control: stm32: Missing include in stm32 header
As this header declares a function that uses a cube defined structure
as argument, it should include the matching header.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-06 09:32:05 -05:00
Peng Fan
db71e4dac7 timer: arm: implement smp_timer_init
Implement smp_timer_init to initialize arch timer of secondary cores.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2021-03-06 07:36:37 -05:00
Peng Fan
e6392301f8 timer: arm: implement arch_busy_wait
To take the usage of arm arch counter 64bit capability, implement
custom arch_busy_wait

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2021-03-06 07:36:37 -05:00
Peng Fan
5c1c5bbb5e interrupt_controller: intc_giv3: support SMP
Add SMP support.
Note: there is still limitation that we rely on NUM CPUs.
And all cpus must be from 0,1,2 and ....

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2021-03-06 07:36:37 -05:00
Tofik Sonono
1337f7fe24 drivers: native_posix: fix for native posix counter
There was an error in the ordering of the parameters in the
DEVICE_DT_DEFINE for the native POSIX counter. This made a project
using a counter built for native posix not being able to compile.
This commit switches places for ctr_init and device_pm_control_nop.

Signed-off-by: Tofik Sonono <tofik@sonono.me>
2021-03-05 18:18:38 +01:00
James Harris
b10428163a kernel: sem: add K_SEM_MAX_LIMIT
Currently there is no way to distinguish between a caller
explicitly asking for a semaphore with a limit that
happens to be `UINT_MAX` and a semaphore that just
has a limit "as large as possible".

Add `K_SEM_MAX_LIMIT`, currently defined to `UINT_MAX`, and akin
to `K_FOREVER` versus just passing some very large wait time.

In addition, the `k_sem_*` APIs were type-confused, where
the internal data structure was `uint32_t`, but the APIs took
and returned `unsigned int`. This changes the underlying data
structure to also use `unsigned int`, as changing the APIs
would be a (potentially) breaking change.

These changes are backwards-compatible, but it is strongly suggested
to take a quick scan for `k_sem_init` and `K_SEM_DEFINE` calls with
`UINT_MAX` (or `UINT32_MAX`) and replace them with `K_SEM_MAX_LIMIT`
where appropriate.

Signed-off-by: James Harris <james.harris@intel.com>
2021-03-05 08:13:53 -06:00
Krzysztof Chruscinski
7074254937 drivers: clock_control: nrf: Change CLOCK_CONTROL_NRF_FORCE_ALT
Added CLOCK_CONTROL_NRF_FORCE_ALT dependency to some options which
are not valid when clock is controlled by out-of-tree driver.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-05 15:28:13 +03:00
Krzysztof Chruscinski
e60d4f58e7 drivers: clock_control: nrf: modify Kconfig accuracy
Modified CLOCK_CONTROL_NRF_ACCURACY to represent integer value of
LF clock accuracy.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-05 15:28:13 +03:00
Krzysztof Chruscinski
a29420a463 drivers: clock_control: nrf: Add assert on unexpected event
Added assert when calibration event triggered but calibration disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-03-05 15:28:13 +03:00
Rafał Kuźnia
ff1594cf05 drivers: ieee802154: Fix problem with binding IRQ handlers in shim layer
The shim layer could in some circumstances not be properly
configured which would result in an unbound radio interrupt
handler.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2021-03-05 12:56:15 +01:00
Ievgenii Meshcheriakov
ec4a6c7ccf drivers/flash/soc_flash_nrf: Include additional headers
Include <soc.h> to make the header file self-sufficent.

Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
2021-03-04 13:55:56 +01:00
Pete Skeggs
ecfda097d1 bluetooth: hci: h4: Add thread name
Add a name to the h4 rx thread.

It's useful to put a name on each thread for debugging, e.g., with the
shell's kernel threads command.

Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
2021-03-04 13:17:02 +01:00
Arjun Jyothi
4fe04c84d4 drivers: dma: pl330: Zero initialize the ch_handle
Zero initialize the ch_handle in dma_pl330_configure().
The memset in dma_pl330_config_channel()is incorrect,
as the ch_handle is already populated with valid values and
the dma_pl330_config_channel() is overwriting with zeros.

Signed-off-by: Arjun Jyothi <arjun.jyothi@broadcom.com>
2021-03-04 12:59:46 +01:00
Raveendra Padasalagi
3c420566bd drivers: dma: pl330: remove callback
Removed dma callback in start() API, since dma
completion happens synchronously.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-04 12:59:46 +01:00
Raveendra Padasalagi
3bb095e710 drivers: dma: pl330: increase timeout
Increase timeout value related to dma completion status.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-04 12:59:46 +01:00
Raveendra Padasalagi
f86889e7ec drivers: dma: pl330: fix warnings
Fix compile warnings in PL330 DMA driver.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-04 12:59:46 +01:00
Carlo Caione
0f9406277d aarch64: pm_cpu_ops: Introduce pm_cpu_ops subsystem
AArch64 has support for PSCI. This is especially useful for SMP because
PSCI is used to power on the secordary cores.

When the PSCI driver was introduced in Zephyr it was designed to rely on
a very PSCI-centric subsystem / interface.

There are two kinds of problems with this choice:

1. PSCI is only defined for the non-secure world and it is designed to
   boot CPU cores into non-secure state (that means that PSCI is only
   supposed to work if Zephyr is running in non-secure state)

2. There can be other ways or standards used to start / stop a core
   different from PSCI

This patch is trying to fix the original wrong assumption by making the
interface / subsystem a generic one, called 'pm_cpu_ops', and using PSCI
only as an actual driver that is a user of this new interface /
subsystem.

For now the new subsystem is only exposing two methods: cpu_on and
cpu_off, others will probably follow according to the needs.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-03-04 06:53:19 -05:00
Carlo Caione
a2226f5200 aarch64: Fix registers naming in cpu.h
The name for registers and bit-field in the cpu.h file is incoherent and
messy. Refactor the whole file using the proper suffixes for bits,
shifts and masks.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-03-04 06:51:48 -05:00
Raja D. Singh
554101ed70 drivers: wifi: winc1500: Add new config flag
There is a hardcoded macro in Winc1500 HAL SPI driver
that would prevent the driver from working.
This macro is now defined only based on KConfig entry.
This KConfig entry is by default not set.
To enable, set "CONFIG_WINC1500_DRV_USE_OLD_SW=y"
in proj.conf or board.conf

Signed-off-by: Raja D. Singh <rdsingh@iotwizards.com>
2021-03-04 09:34:00 +02:00
Peter Bigot
571f9dbbd9 drivers: regulator: update to new delayable work API
Replace legacy API with new API.  Note that this driver uses the
schedule, not reschedule, API, since triggers for delay never overlap.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Erwan Gouriou
bb014514e0 drivers/gpio: stm32: Use gpio device as gpio_stm32_configure arg
Now that pinmux driver holds a table of GPIO device pointers,
use gpio device as the single source of trust for gpio_base
and remove use of port_base and related code.
This way, gpio_stm32_configure could directly take gpio device
pointer as argument.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 12:13:34 -06:00
Erwan Gouriou
8d97f67159 drivers/pinmux: stm32: Control GPIO clock with central function
Use new gpio_stm32_clock_request function for GPIO clocks control.
To do this a new table of GPIO devices is set up at build time.
It is then used to populate targeted device when calling
gpio_stm32_clock_request.

Clean up remaining clock handling related code in the file.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 12:13:34 -06:00
Erwan Gouriou
6b2ccbb721 drivers/gpio: stm32: Add port clock handling function
As a preparation for GPIO ports clocks power management,
add a dedicated central function fog GPIO ports clock toggling.

This function is made accessible to other users (pinmux).

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 12:13:34 -06:00
Erwan Gouriou
888a24f76d drivers/gpio: stm32: Review code for Port G clock on L4/L5
On L4/L5 device, GPIO port G benefits from a dedicated supply
rail that should be enabled independently.
Review the code around this:
-Compile only when port G is enabled
-Assume that PWR clock is ON, as it is enabled as part of clock init

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 12:13:34 -06:00
Kumar Gala
403e6e3517 drivers: i2c: nios2: get IRQ and IRQ priority from DTS
Move the I2C IRQ information to devicetree similar to what most all
other drivers are doing.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 11:55:03 -06:00
Piotr Mienkowski
b22df38d30 drivers: i2s_sam_ssc.c: store *dev_dma in flash
The DMA module the i2s_sam_ssc relies on cannot change during the
runtime. Store pointer to dev_dma in flash, not in RAM. The new
implementation saves 40 bytes of flash and 32 bytes of RAM.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-03-03 16:16:33 +03:00
Erwan Gouriou
d19741f1ec drivers/flash: stm32 qspi: Use new DT_DMA helper macro
New DT_DMA helper macros to directly access dma device.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 07:24:56 -05:00
Erwan Gouriou
13c2351524 drivers/serial: stm32: convert dma to new DT_DMA helper macros
New DT_DMA helper macors are available to access DMA node
identifier. Use them

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 07:24:56 -05:00
Erwan Gouriou
d8348b0e5e drivers/spi: stm32: Minor init code refactoring
Minor changes to init code indentation.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 07:24:56 -05:00
Erwan Gouriou
375db6e080 drivers/spi: stm32 convert dma to new DT_DMA helper macros
New DT_DMA helper macors are available to access DMA node
identifier. Use them

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 07:24:56 -05:00
Glauber Maroto Ferreira
c344d0d74d esp32: drivers: counter: add support for general-purpose counters
Adds support for ESP32 general-purpose Counters

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-03-03 13:02:02 +01:00
Kumar Gala
c308c4b1f6 drivers: dma: nios2_msgdma: Fix typo in irq priority
Extracting priority from the devicetree should specify instance 0, not
'inst'.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 06:28:34 -05:00
Kumar Gala
c320bb0522 drivers: ethernet: remove stale Kconfig IRQ priority
Either get priority from devicetree (liteeth) or remove Kconfig symbols
that aren't used anywhere for IRQ priority (gecko, stm32_hal).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-03 12:16:06 +03:00
Eduardo Montoya
53fd3ae573 drivers: ieee802154: nrf5: load EUI64 from UICR
Add `IEEE802154_NRF5_UICR_EUI64_ENABLE` option to allow loading EUI64
from UICR registers.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2021-03-03 10:40:29 +02:00
Andrzej Głąbek
1314ab5404 drivers: gpio: Add support for PCAL6408A I/O expander
Add GPIO driver and devicetree binding for the PCAL6408A 8-bit I2C-bus
I/O expander.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-03-03 11:38:03 +03:00
Yuval Peress
7162786f83 uart-npcx: forward poll requests to fifo when running interrupt mode
Looking at the data sheet for the npcx section 4.15.5 CR_UART Core
Registers, the UICTRL register that is used in the npcx poll
functions is invalid when running in FIFO mode. Instead, calls to
uart_npcx_poll_in and uart_npcx_poll_out should be redirected to
their respective FIFO read/fill functions (when using interrupts).

Changes:
- When calling uart_poll_in: forward the request to uart_fifo_read.
- When calling uart_poll_out: loop until uart_fifo_fill returns
  non-0 (we wrote 1 byte).

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-03-02 20:33:25 -06:00
Yuval Peress
1154c49878 uart-npcx: re-organize interrupt driven functions.
Simple reorg of the function declarations. This change moves
the interrupt driven functions declared at the bottom of the
uart_npcx.c file to the top, clustered under the same ifdef.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-03-02 20:33:25 -06:00
Jose Alberto Meza
a19fa8ba0c drivers: i2c: mchp: Restore I2C logging control
Fix CONFIG_I2C_LOG_LEVEL_XXX not having effect.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2021-03-02 20:29:26 -06:00
Kumar Gala
d521129c4f dma: Kconfig remove unused kconfig symbols
All dma drivers are devicetree based now so we can remove the last
bits of Kconfig associated with the old driver style.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 20:28:35 -06:00
Kumar Gala
767ba47423 drivers: spi: spi_dw: Move to devicetree detection
We can utilize the devicetree macros to determine which instances to
enable.  This will allow us to phase out the per instance Kconfig
symbols.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 20:06:38 -06:00
Kumar Gala
c0d82cf434 drivers: spi: spi_dw: set op-mode to master-only always
Nothing sets the op mode to anything but master.  For now default the
mode to master-only and we can determine a devicetree property in the
future if we need to support other configurations.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 20:06:38 -06:00
Kumar Gala
1957fe2417 drivers: spi: spi_dw: determine num IRQs from devicetree
Replace Kconfig symbols SPI_DW_PORT_n_INTERRUPT_SINGLE_LINE with just
seeing how many IRQs are defined in the devicetree to determine single
or multiline interrupt support.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 20:06:38 -06:00
Kumar Gala
b08c5d2bb8 drivers: spi: spi_dw: Remove clock gate support
The SoC that utilized the clock support isn't supported in Zephyr
anymore and there are no users of this code.  Remove it for now as it
should get converted to utilize devicetree if needed in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 20:06:38 -06:00
Kumar Gala
5d02978640 audio: intel_dmic: get dma properties from devicetree
Move to using devicetree to get dma controller and dma channel
information.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 14:59:17 -05:00
Peter Bigot
291b9b5dae Revert "drivers/timer/hpet: Extend qemu workaround"
This reverts commit 4ae44dd712.

See: https://github.com/zephyrproject-rtos/zephyr/issues/32724

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-03-02 14:51:29 -05:00
Kumar Gala
ea98cc3c87 sensors: grove: temp: Convert to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the io-channels/adc controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 11:28:30 -06:00
Kumar Gala
ae75e604d6 sensors: grove: light: Convert to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the io-channels/adc controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 11:28:30 -06:00
Kumar Gala
afffb3b17e sensors: nxp_kinetis_temp: Convert to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the io-channels/adc controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 11:28:30 -06:00
Katsuhiro Suzuki
def53e3205 drivers: timer: reduce max cycles of riscv machine timer
If next_timeout() returns INT_MAX and pass it to
z_clock_set_timeout(), and machine goes to freeze or slow down.
Bad scenario as follows:

- If an argument int32_t ticks is set large value 0xffffffff,
    ticks = MAX(MIN(ticks - 1, (int32_t)MAX_TICKS), 0);
  replaces it into MAX_TICKS.
- uint32_t cyc will be set near by 0xffffffff
  (this is 0xfffd7280 in 100 ticks per second).
- Add adjustment to cyc, adjustment max value is MAX_CYC.
  (cyc = 0xffff14fd)
- Over 0x80000000 value of uint32_t is considered as negative
  value of int32_t.
    if ((int32_t)(cyc + last_count - now) < MIN_DELAY)
  This condition is always true.
- Because cyc += CYC_PER_TICK will get overflow, driver sets mtimecmp
  near value of current mtime.
  (cyc = 0x00007fc0)
- Next timer interrupt will happen soon after return from interrupt
  handler.
- By repeating these events, machine cannot go to next instruction,
  and it's going to freeze or slow down.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-03-02 11:39:04 -05:00
Raveendra Padasalagi
b71bdad7bb drivers: pcie: endpoint: Use DEVICE_DT_INST_GET() API
Replace current use of DEVICE_GET() with DEVICE_DT_INST_GET().

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-03-02 10:03:34 -06:00
Kumar Gala
b60b4be4e3 drivers: dma: nios2_msgdma: Conver to devicetree
Conver the NIOS-II mSGDMA driver to be devicetree based.  Add node for
dma controller into nios2f.dtsi.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-02 08:36:58 -06:00
Shlomi Vaknin
23bb30a73a stm32: dmamux: change initialization order to PRE_KERNEL_1
When running the tests of the async api of uart
on nucleo-l4r5zi we get MPU fault.
The reason is ordering initialization. The uart and dma
drivers are initialized PRE_KERNEL_1 while dmamux is
initialized POST_KERNEL.
Thus, the function device_get_binding fails since the
dmamux device is not ready to be used.

Fixes: #32715.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-03-01 15:41:11 -06:00
Kumar Gala
263ac3e9e5 drivers: pinmux: mcux_lpc: Convert to using devicetree
Convert driver and users of pinmux on mcux lpc platforms to getting
basic port info from devicetree (register address, label)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-01 12:04:53 -06:00
Martí Bolívar
821c03a14a i2c: nordic: switch to phandle arrays for pinmux
Deprecate the scl-pin and sda-pin properties in the devicetree.
Provide new scl-gpios and sda-gpios properties instead.

This lets the user specify SCL and SDA like this:

   &i2c0 {
         scl-gpios = <&gpio0 1 0>;
         sda-gpios = <&gpio1 4 0>;
   };

Instead of having to use:

   &i2c0 {
         scl-pin = <1>;
         sda-pin = <36>;
   };

Provide error checking and understandable error messages for invalid
configurations.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-01 16:59:56 +01:00
Carlo Caione
90859c6bf3 aarch64: smccc: Decouple PSCI from SMCCC
The current code is assuming that the SMC/HVC helpers can only be used
by the PSCI driver. This is wrong because a mechanism to call into the
secure monitor should be made available regardless of using PSCI or not.

For example several SoCs relies on SMC calls to read/write e-fuses,
retrieve the chip ID, control power domains, etc...

This patch introduces a new CONFIG_HAS_ARM_SMCCC symbol to enable the
SMC/HVC helpers support and export that to drivers that require it.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-03-01 09:26:56 -05:00
Kumar Gala
3b8ea186fd spi: mcux flexcomm: Convert dma to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the dma controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-28 18:19:18 -06:00
Armando Visconti
79c709bf02 drivers/sensor: ism330dhcx: Move INT_PIN Kconfig attr into DT
Convert ism330dhcx INT_PIN attribute from Kconfigs to Device
Tree binding properties. Here int-pin has been defined as
enum with two possible values: 1 and 2.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-02-28 16:47:15 -05:00
Armando Visconti
e97424e23d drivers/sensor: ism330dhcx: Move accel/gyro odr Kconfig attr into DT
Convert ism330dhcx accel and gyro odr attributes from Kconfigs to Device
Tree binding properties.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-02-28 16:47:15 -05:00
Armando Visconti
404ab86cb5 drivers/sensor: ism330dhcx: Move accel/gyro range Kconfig attr into DT
Converts ism330dhcx accel and gyro range attributes from Kconfigs to
Device Tree binding properties.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-02-28 16:47:15 -05:00
Matija Tudan
f2b679d4b7 drivers: dac: dacx3608: fix I2C read error
This commit fixes I2C error while reading chip ID in the
init function.

Signed-off-by: Matija Tudan <mtudan@mobilisis.hr>
2021-02-28 16:46:04 -05:00
Kumar Gala
34861b592b i2s: stm32: Convert dma to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the dma controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-28 16:37:22 -05:00
Kumar Gala
19356a0a01 i2s: cavs: Convert dma to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the dma controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-28 16:37:22 -05:00
Kumar Gala
6c9c7ec759 i2s: atmel sam ssc: Convert dma to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the dma controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-28 16:37:22 -05:00
Ilya Tagunov
62d4c6947c drivers: lora: sx127x: rework SX1276 driver to add SX1272 support
SX1272 chip is very similar to the already supported SX1276;
unfortunately, Semtech provides a completely separate driver
for this one. This commit marks an attempt to avoid code
duplication by means of some not-very-pretty ifdefery.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2021-02-28 16:36:35 -05:00
Jack Rosenthal
ea9866dc86 shell: add an option for minimal default configuration
The default shell configuration has heavy flash and memory requirements,
requiring project maintainers to set many configuration options to "n"
to keep flash and memory requirements within reason.

This adds a new configuration option, CONFIG_SHELL_MINIMAL, which will
disable flash and memory heavy options by default, and allow project
maintainers to select/imply only the options they want.

On a quick test from an ARM board I'm working on, enabling this option
cut flash space requirements by ~8 KB, and memory requirements by ~1 KB.

Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
2021-02-27 10:26:33 +01:00
Kumar Gala
46fbc8ab50 i2s: cavs: Remove stale assert
There is no longer a mem_block pointer in the stream struct so the
assert NULL check isn't relevant anymore.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-26 14:21:59 -06:00
Shubham Kulkarni
e16e606923 esp32: add esp32 wifi driver
add support for esp32 wifi

Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
2021-02-25 17:00:20 -05:00
Thomas Stranger
49b490161d drivers: dmamux_stm32: compile time dmamux channels initialization
Move dmamux_stm32_channels struct from device data to device
configuration and initialize the dmamux channel - dma channel
assignment during build time,
as this association is hardwired in all known series.
The information is taken from dma_offset and dma_requests device tree
properties. The current implementation is valid for series with either
a single or two dma peripherals and a single dmamux peripheral.
Both dmas can independently enabled.
As the driver uses multi-instance DT_INST_DEFINE, also macros for a
second dmamux are are added that should allow easier extension to a
second dmamux instance.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-02-25 21:57:59 +03:00
Mulin Chao
db87ee2039 driver: itim: npcx: use timeout mechanism instead of unbounded loop.
Use timeout mechanism instead of unbounded loop during enabling ITIM32
module which source clock is LFCLK (32KHz).

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-25 02:44:01 -05:00
Adam Serbinski
c70fc85909 drivers: sensors: mpu6050: add support for mpu9250
mpu9250 is a single package that contains both an mpu6050 6-axis
motion sensor and an ak8963 magnetometer. The two parts have
separate i2c addresses, yet despite the common mpu6050 component,
it has a different value in the "WHOAMI" register -- 0x71 instead
of 0x68.

This adds the additional chip id value in order to enable the use
of mpu9250.

Signed-off-by: Adam Serbinski <adam@serbinski.com>
2021-02-24 17:52:47 -06:00
Andy Ross
4ae44dd712 drivers/timer/hpet: Extend qemu workaround
Qemu when running more than one processor has a known synchronization
bug where counter values read from the HPET (notionally a single
global device) can be seen going "backwards" when read from different
CPUs.

There was a pre-existing workaround in the ISR that knew about this,
but the problem can crop up anywhere the counter value is used.  In
particular I caught it aliasing with the "max_ticks" computation in
z_clock_set_timeout(), where it would cause a rollover and the
resulting negative comparator value would result in no end of
hilarity.

Wrap all access to the counter register with a counter() inline that
(when the workaround is enabled) forces the result to be monotonic by
clamping it to a minimum of one more than the previously read value.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-02-24 16:39:15 -05:00
Kumar Gala
f2ebf488d7 drivers: led_pwm: Convert to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the pwm controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-24 13:45:46 -06:00
Pavlo Hamov
5ae781d7d0 drivers: watchdog: cc32xx: Add support
Impelement watchdog for ti_cc32xx family

Signed-off-by: Pavlo Hamov <pasha.gamov@gmail.com>
2021-02-24 08:35:27 -06:00
Nicolas Pitre
90f4f50d4b console: semihosting: add Aarch64 support
This also makes it into arch_printk_char_out() which gets linked
in place of the weak symbol version, meaning printk() is usable
as soon as the stack is set up.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-02-24 08:01:18 -05:00
Robert Lubos
56f9efdebf drivers: ieee802154_nrf5: Fix initialization order
The driver was reworked recently so that driver capabilites are
obtained at runtime. The function to obtain the capabilities was
called after L2 initialization though, which is invalid as L2
initialization code already depends on certain driver capabilites.

Move the capability initializer to an earliest possible stage
(i. e. just after the core driver is initialized) to fix the issue.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-02-24 14:16:08 +02:00
Johann Fischer
627c04f962 drivers: usb_dc_stm32: remove confusing comments
The comments at the beginning of the file are not quite correct
and instructions regarding configuration are not necessary at all.
Also remove the redundant first line.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-02-24 12:01:50 +01:00
Martí Bolívar
4a381fce6b drivers: bme280: clean up array usage
Use sizeof() and ARRAY_SIZE() to have more single points of truth.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-02-23 10:34:19 -05:00
Martí Bolívar
bfff50127f drivers: bme280: factor out bus I/O routines
Move the SPI and I2C bus I/O bits into their own files. This makes
this driver more similar to other sensor drivers.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-02-23 10:34:19 -05:00
Martí Bolívar
8c2709e81a drivers: bme280: get dependencies straight from DT
Now that we have various convenience macros in drivers/spi.h and
device.h defined, we can resolve some longstanding TODO items in how
this driver gets a hold of the devices it depends on:

- get bus devices with DEVICE_DT_GET
- get SPI chip select information with SPI_CONFIG_DT_INST

The results are shorter on boilerplate, save RAM, and improve boot
time.

The same techniques could be reused by other device drivers.

These changes require that the SPI bus and GPIO (for device CS)
devices used to interface with the BME280 are defined in devicetree.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-02-23 10:34:19 -05:00
Martí Bolívar
7bbead6786 drivers: i2c: add dummy driver for vnd,i2c
We will need this to be able to DEVICE_DT_GET() bus devices from
tests/drivers/build_all in an upcoming commit.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-02-23 10:34:19 -05:00
Martí Bolívar
63471ba93b drivers: spi: add dummy driver for vnd,spi
We will need this to be able to DEVICE_DT_GET() bus devices from
tests/drivers/build_all in an upcoming commit.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-02-23 10:34:19 -05:00
Thomas LE ROUX
f360718d0b drivers: modem: Fix PDP context management for BG9X
The PDP context might be active.
If that's the case, the AT+QIACT command returns an error.
It's then not possible to succeed at setting up the module.

Furthermore, we apply the logic described in the Quectel Documentation :
- If there is an issue 3 consecutive times on activating/deactivating
the context, we restart the module.
- If the AT+QIDEAT command returns an error, we restart the module.

This PR is bug-fix aimed.
We leave parameterization of context ID for future enhancement.

Signed-off-by: Thomas LE ROUX <thomas.leroux@smile.fr>
2021-02-23 12:01:27 +02:00
Bosch Sensortec
aabbc52351 driver: sensor: bmi270 Added support
Added driver support for the BMI270 IMU

Signed-off-by: Bosch Sensortec <github@bosch-sensortec.com>
2021-02-22 17:58:00 -05:00
Mulin Chao
7c9d3f44f0 driver: sensor: npcx: add tachometer sensor support.
In NPCX7 series, it contains two tachometer (TACH) modules that contains
two Independent timers (counter 1 and 2). They are used to capture a
counter value when an event is detected via the external pads (TA or
TB).

The CL also includes:
— Add npcx tachometer device tree declarations.
— Zephyr sensor api implementation for tachometer.
— Enable "tach1" device in npcx7m6fb.dts for testing.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-22 17:56:19 -05:00
Sun Amar
1be7937f4e hwinfo: support exx32 family
add hwinfo driver support for the
exx32 gecko family.

Signed-off-by: Sun Amar <sun681@gmail.com>
2021-02-22 17:44:33 +03:00
Sylvio Alves
679e36bf54 clock: esp32: fix wrong clock assert
guarantee proper clock bank is used

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-02-22 08:17:04 -05:00
Glauber Maroto Ferreira
74922049ba drivers: spi: esp32: add basic SPI master support
Include SPI master support for blocking and asynchronous calls.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-02-22 08:17:04 -05:00
Kumar Gala
5a9f997a80 drivers: serial: stm32: Fix compile issues
The stm32 uart driver fails to build on certian platforms due to
changes introduced by:

commit 3c18bcbf77
Author: Francois Ramu <francois.ramu@st.com>
Date:   Wed Jan 27 10:27:33 2021 +0100

    drivers: serial: stm32 restore uart after lowpower

Fix this by adding some ifdef's around the code that is specific to the
given platforms that the code works on.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-21 22:28:16 -05:00
Fabio Baltieri
951c99c61a driver: uart_npcx: do not check for irq enable in irq ready functions
Current implementation of uart_npcx_irq_{tx,rx}_ready always returns
false if the respective interrupt enable bit is not set, which means
that the api cannot be used if the interrupts are temporarily disabled
for whatever reasons, breaking patterns such as [1].

Other uart drivers also seems to not have this check, this patch removes
it from the NPCX driver too.

[1] https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/console/uart_console.c#L549

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2021-02-21 22:27:45 -05:00
Mulin Chao
715efe25cd driver: uart: npcx: Add pm_deivce support for uart driver.
Since the uart device clock will be stopped after ec entered sleep or
deep sleep state and restore its clock automatically, there is no need
to implement code for suspending and resuming devices manually.

The driver still needs to check the current status of uart device when
it wants to change its power state to LOW or SUSPEND power state. It is
crucial to forbid ec enters sleep or deep sleep state when uart device
is busy with transmitting data. Or we will observe broken characters on
the uart console.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-19 22:39:53 -05:00
Mulin Chao
1f731c6c02 driver: soc: power: npcx: Add power managerment support.
This CL introduces power management driver that improves the efficiency
of ec operation by adjusting the chip’s power consumption to the level
of activity required by the application in npcx series.

The following list summarizes the main properties of the various chip
power states. Please refer the power.c file for more detail.

Main power states in npcx series include:
- Active: Core, RAM and modules operate at the clocks generated by PLL.
- Idle: Enter this state when the Core executes WFI or WFE instruction.
- Sleep: clock is stopped for most of modules but PLL is enabled.
- Deep Sleep: As Sleep mode but PLL is disabled.
- Standby: All power rails are turned off besides standby and battery
  power rails.

And this CL implements one power state, PM_STATE_SUSPEND_TO_IDLE, with
two sub-states for Zephyr power management system.
Sub-state 0 - "Deep Sleep" mode with “Instant” wake-up if residency
              time is greater or equal to 1 ms
Sub-state 1 - "Deep Sleep" mode with "Standard" wake-up if residency
              time is greater or equal to 201 ms

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-19 22:39:53 -05:00
Mulin Chao
e5caae8e0a driver: timer: npcx: add system kernel timer support.
This CL introduces a kernel device driver implemented by the internal
64/32-bit timers in Nuvoton NPCX series. Via these two kinds of timer,
the driver provides an standard "system clock driver" interface.

It includes:
 - A system timer based on an ITIM64 (Internal 64-bit timer) instance,
   clocked by APB2 which freq is CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC.
 - Its prescaler is set to 1 and provide the kernel cycles reading
   without handling overflow mechanism.
 - A event timer based on an ITIM32 (Internal 32-bit timer) instance,
   clocked by LCLK which frequency is 32KHz and still activated when ec
   entered "idle/deep idle" power state for better power consumption.
 - Its prescaler is set to 1 and provide timeout event mechansim.
 - Compensate system timer which clock is gating for better power
   consumption after ec left"idle/deep idle" power state.

This CL passed starve, timer_api, and timer_monotonic test suites.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-19 22:39:53 -05:00
Alexandre Bourdiol
59ce5af11b drivers: i2c: add support of STM32WL
Add I2C support to STM32WL

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-02-19 22:39:24 -05:00
Alexandre Bourdiol
096c34114b drivers: interrupt_controller add STM32WL support
Add STM32WL support to interrupt_controller driver

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-02-19 22:39:24 -05:00
Alexandre Bourdiol
91b4350969 drivers: gpio add STM32WL support
Add STM32WL support to gpio driver

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-02-19 22:39:24 -05:00
Alexandre Bourdiol
6e5b0d01f5 drivers: clock_control: add STM32WL support
Add STM32WL support to clock_control driver

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-02-19 22:39:24 -05:00
Francois Ramu
fc41846935 drivers: clock: stm32 clock control with low power modes
This will export the stm32_clock_control_init function
to restore the clocks after the low power modes.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-02-19 22:38:50 -05:00
Francois Ramu
3c18bcbf77 drivers: serial: stm32 restore uart after lowpower
This adds a function to control the uart device during lowpower modes

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-02-19 22:38:50 -05:00
Henrik Brix Andersen
71d7f3f916 drivers: sensor: mcux_acmp: fix expansion-to-defined warning
Rework the checks for INPSEL, INNSEL, and C0_OFFSET_BIT presence to
avoid warnings when -Wexpansion-to-defined is enabled.

The warning was enabled in c7bc6380bd.

Fixes #32475.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-02-19 13:15:47 -05:00
Pavlo Hamov
8e02c4cdf4 shell: adc: support cc322xx
Control cc322xx ADC from shell

Signed-off-by: Pavlo Hamov <pasha.gamov@gmail.com>
2021-02-19 10:43:58 -06:00
Pavlo Hamov
ee6ec8d4f3 drivers: adc: cc32xx: Add support
Support 4 channels in IRQ mode. Sync/Async

Signed-off-by: Pavlo Hamov <pasha.gamov@gmail.com>
2021-02-19 10:43:58 -06:00
Göran Weinholt
62954da76c drivers: flash: stm32h7: fix clearing of erased sector number
This fixes the logic in erase_sector() for clearing the previous
sector number. The logic was reversed, clearing bits it should not
clear and keeping previous bits of the sector number. In practice this
does not seem to have had any effect on the current functionality, but
it will start to matter later if e.g. flash interrupts are enabled.

Signed-off-by: Göran Weinholt <goran.weinholt@endian.se>
2021-02-19 10:02:28 -05:00
Andrei Emeltchenko
3f4a41946a edac: shell: Add test_default command
Add setting default inject test parameters.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-02-19 16:06:29 +02:00
Andrei Emeltchenko
4bbcd1433e edac: shell: Update shell commands comments
Correct commands descriptions in comments

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-02-19 16:06:29 +02:00
Laczen JMS
decf521660 drivers: eeprom: add emulated eeprom in flash
Modifications to incorporate latest write to new flash area
Modification to avoid writing garbage to new flash area when compactor
is called during init.
Modifications to allow erase at partition size instead of eeprom
pagesize.
Modifications to better separate rambuf usage from flash usage.
Corrected some errors in compactor

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2021-02-19 14:06:15 +01:00
Laczen JMS
232272cff8 drivers: eeprom: EEPROM emulation in flash memory
This driver emulates a EEPROM device in flash.

Reworked implementation with modified flash layout.

The emulation represents the EEPROM in flash as a region that is a
direct map of the eeprom data followed by a region where changes to
the eeprom data is stored. Changes are written as address-data
combinations. The size of such a combination is determined by the
flash write block size and the size of the eeprom (required address
space), with a minimum of 4 byte.
The eeprom page needs to be a multiple of the flash page. Multiple
eeprom pages is also so supported and increases the number of writes
that can be performed.

The eeprom size, pagesize and the flash partition used for the eeprom
are defined in the dts. The flash partition should allow at least two
eeprom pages. For fast read access a rambuffer can be enabled for the
eeprom (by setting the option rambuf in the dts).

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2021-02-19 14:06:15 +01:00
Kumar Gala
dd58d5e47f drivers: eth: mcux: Convert clock control to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-19 05:36:35 -06:00
Erwan Gouriou
832a0ec049 drivers/clock_control: stm32f1: Reinstanciate CLOCK_STM32_PLL_XTPRE
This reverts commit "drivers/clock_control: Remove useless
CLOCK_STM32_PLL_XTPRE config" 9be1f7e22f3b3c42009eeba15061cad3c0988b22.

Fixes #32382

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-02-19 05:22:36 -06:00
Kumar Gala
c9bfb25184 drivers: counter: mcux: Convert clock control to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-19 05:03:11 -06:00
Kumar Gala
99d1b292cc drivers: watchdog: NXP: Convert clock control to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-19 05:02:52 -06:00
Kumar Gala
9dfd87b931 device: esp32: Convert clock control to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-18 12:42:53 -06:00
Kumar Gala
2a69690823 drivers: i2c: NXP: Convert clock control to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-18 12:27:59 -06:00
Andriy Gelman
c348a05d5a drivers: can: Fix sample point calculation
CAN_SYNC_SEG and ts1 are in common units. Both need to be scaled by 1000
to calculate the sample point.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2021-02-18 12:04:09 -05:00
Kumar Gala
7ee312ec57 drivers: spi: NXP: Convert clock control to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-18 10:53:27 -06:00
Kumar Gala
2aae5a56e3 drivers: can: mcux: Convert clock control to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-18 10:48:47 -06:00
Kumar Gala
0eead3aab6 drivers: pwm: NXP: Convert clock control to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-18 10:47:15 -06:00
Kumar Gala
09c054b13c drivers: serial: NXP: Convert clock control to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-18 10:39:07 -06:00
Kumar Gala
3a8fffb9c3 device: rv32m1: Convert clock control to use DEVICE_DT_GET
Replace device_get_binding with DEVICE_DT_GET for getting access
to the clock controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-18 09:26:39 -06:00
Mulin Chao
ff3fd6dc37 driver: i2c: npcx: fix a glitch on SCL before stop condition.
In the npcx i2c FIFO mechanism, the hardware will release SCL bus
immediately after the driver reads data from FIFO. That's why we need
to hold SCL bus before configuring the next transaction. Once it was
done, the driver release the bus for the next transaction.

But during the last transaction, the driver releases SCL first then
starts a STOP condition. At this moment, the SCL is pulled high by PU
resistance and driven to low for generating STOP condition later. This
additional clock might influence some i2c devices if they don't reset
their state machine after receiving STOP.

This CL fixes this issue by two steps:
1. Distinguish that it's the last read transaction with STOP condition?
2. If so, issue STOP condition before reading FIFO instead of holding
   SCL bus. Then the hardware will generate it immediately after reading
   FIFO.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-18 08:54:48 -06:00
Gerard Marull-Paretas
0b07077a5c drivers: pwm: stm32: fix expansion-to-defined warning
The definition to check if timers have up to 6 channels was causing
warnings when -Wexpansion-to-defined was enabled.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-02-18 07:19:39 -05:00
Kumar Gala
c1e1273df2 drivers: serial: native_posix: Convert 2nd UART to be devicetree based
The first uart instance was already devicetree based.  To be consistent
convert the second instance to also be devicetree based.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-18 09:06:21 +01:00
Harry Jiang
5adaba0760 drivers: watchdog: iwdg_stm32: Add support for STM32H7xx SoC
Add the IWDG driver support for STM32H7xx SoC.

Signed-off-by: Harry Jiang <explora26@gmail.com>
2021-02-17 16:19:21 -06:00
Erwan Gouriou
5d2150efa4 drivers/interrupt_controller: stm32: Make use of DEVICE_DT API
Convert stm32 interrupt controller driver to DEVICE_DT API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-02-17 14:26:23 -06:00
Ioannis Glaropoulos
95e6da4716 drivers: sensor: nrf: fix dependencies for QDEC_NRFX
QDEC_NRFX shall depend on either HAS_HW_NRF_QDEC,
or HAS_HW_NRF_QDEC0, since in the nRF5340 Application
core definition we select HAS_HW_NRF_QDEC0 instead of
HAS_HW_NRF_QDEC.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-02-17 22:34:20 +03:00
Gerard Marull-Paretas
cbc340c10c drivers: sensor: add support for MAX6675
Add support for MAX6675 cold-junction-compensated K-thermocouple to
digital converter.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-02-17 14:33:29 +01:00
Diwakar C
c860b86822 driver: peci: Wait until rx fifo gets filled up
While running certain peci command, observed when FW attempts
to read last byte (Response FCS), PECI host controller returned
“Read FIFO” empty. Since “Read FIFO” is empty FW didn’t read
the response FCS.

Due to this issue, FW getting corrupted response from the PECI
controller for all the subsequent PECI commands.

To address this issue, FW waits for “Read FIFO” filled up by
the PECI controller.

Signed-off-by: Diwakar C <diwakar.c@intel.com>
2021-02-17 04:05:11 -05:00
Kumar Gala
b275fec8c4 soc: stm32: convert to use DEVICE_DT_GET for clocks
Convert from device_get_binding to DEVICE_DT_GET.  In doing this we
no longer need the label in the devicetree node so we remove that.

Removed all __ASSERT_NO_MSG(clk) since we'll get a build error if
DEVICE_DT_GET cant be satisfied, and the clock control api's will
handle reporting if the device_is_ready.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-16 17:01:37 -06:00
Clotilde Sattler
be170fb619 sensor/lsm6dsl: add missing ODR FIFO bit in mask
This fixes a missing bit in the registers description
which results to wrong FIFO ODR configuration
when trying to configure a FIFO ODR higher than 833Hz

Signed-off-by: Clotilde Sattler <clotilde.sattler@stimio.fr>
2021-02-16 16:33:00 -06:00
Jacob Siverskog
503f572227 drivers: sensor: icm42605: initialize variables
initialize variables to avoid or:ing with uninitialized variable.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2021-02-16 16:04:02 -06:00
Jacob Siverskog
4b5a2b989e drivers: modem: quectel-bg9x: fix potential null pointer dereference
reorganize code so that null pointer check is done prior to accessing
element.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2021-02-16 19:31:11 +02:00
Kumar Gala
c54005235c riscv: ite: it8xxx2: Rework device_get_binding for pinmux
Switch to use DEVICE_DT_GET instead of device_get_binding for pinmux
device.  As part of this change drop the "label" property from
the pinmux devicetree node and update the binding and dts files to
reflect that.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-16 09:45:57 -05:00
Andrzej Głąbek
f8036bfae3 drivers: ieee802154_nrf5: Fix inclusion of ieee802154_radio.h
This is a follow-up to commit 9f56cc5531.

Add net/ in the inclusion of ieee802154_radio.h so that the file can
be successfully included.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-02-16 07:57:15 -06:00
Jacob Siverskog
6e0ef1cdd9 drivers: usb: stm32: fix potential null pointer dereference
perform null pointer check before dereferencing.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2021-02-16 15:27:59 +03:00
Kumar Gala
b063fe2a06 drivers: uart: uart_cmsdk_apb: fix interrupt handling
The CMSDK uart interrupts for TX and RX can either be treated as a
signel interrupt line or distinct interrupts for TX & RX.  In the case
that they were distinct we didn't get the ifdef correct based on DTS.

If we have 2 interrupts in DTS we assume they are for TX & RX and thus
build the interrupt support for distinct TX & RX ISRs.

Also, cleanup handling of UART_2..UART_4 to be similar to how
UART_0/UART_1 code is using DT_INST_IRQN(x).

Fixes #30770
Fixes #25601

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-15 13:24:05 -05:00
Peter Bigot
4ee876b797 drivers/i2c: stm32_v1: remove unused variable
A recent patch removed use of the cfg structure, but left a pointer to
it defined which causes build failures.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-02-15 16:35:30 +03:00
Kumar Gala
ba6138d13d drivers: clock_control: npcx: Convert to use DEVICE_DT_INST_DEFINE
The NPCX clock driver was already using devicetree, just need to make a
small tweak to use DEVICE_DT_INST_DEFINE and update NPCX_CLK_CTRL_NAME
to match the label for the "nuvoton,npcx-pcc" clock controller.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-15 08:33:28 -05:00
Kumar Gala
f6b7dd09ec pinmux: sifive: Convert SiFive pinmux to be devicetree based
Add a simple pinctrl node for the IOF registers under the GPIO
controller node to be used by the pinmux driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-15 08:33:00 -05:00
Marcin Niestroj
283f25f596 drivers: wifi: eswifi: Convert driver to new DT device macros
Convert eswifi driver:

    NET_DEVICE_OFFLOAD_INIT -> NET_DEVICE_DT_INST_OFFLOAD_DEFINE

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-02-15 08:31:52 -05:00
Marcin Niestroj
5701ebb036 drivers: wifi: esp: Convert driver to new DT device macros
Convert esp driver:

    NET_DEVICE_OFFLOAD_INIT -> NET_DEVICE_DT_INST_OFFLOAD_DEFINE

DT label is already required, so use it and drop CONFIG_WIFI_ESP_NAME
option.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-02-15 08:31:52 -05:00
Marcin Niestroj
1e15ca94ff drivers: modem: wncm14a2a: Convert driver to new DT device macros
Convert wncm14a2a driver:

    NET_DEVICE_OFFLOAD_INIT -> NET_DEVICE_DT_INST_OFFLOAD_DEFINE

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-02-15 08:31:52 -05:00
Marcin Niestroj
2ae9c262c9 drivers: modem: quectel-bg9x: Convert driver to new DT device macros
Convert quectel-bg9x driver:

    NET_DEVICE_OFFLOAD_INIT -> NET_DEVICE_DT_INST_OFFLOAD_DEFINE

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-02-15 08:31:52 -05:00
Marcin Niestroj
a2d940ab80 drivers: modem: hl7800: Convert driver to new DT device macros
Convert hl7800 driver:

    NET_DEVICE_OFFLOAD_INIT -> NET_DEVICE_DT_INST_OFFLOAD_DEFINE

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-02-15 08:31:52 -05:00
Marcin Niestroj
dd55786ffc drivers: modem: ublox-sara-r4: Convert driver to new DT device macros
Convert ublox-sara-r4 driver:

    NET_DEVICE_OFFLOAD_INIT -> NET_DEVICE_DT_INST_OFFLOAD_DEFINE

DT label is already required, so use it and drop
CONFIG_MODEM_UBLOX_SARA_R4_NAME option.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-02-15 08:31:52 -05:00
Kumar Gala
4276d7d247 pinmux: hsdk: Convert ARC HSDK pinmux to be devicetree based
Add a simple pinctrl node for the CREG GPIO MUX register to be used
by the pinmux driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-15 08:29:56 -05:00
Julien Massot
f7e3f4f2d3 arch: arm: cortex_a_r: add support for arm arch timer
This include make possible to use the arm_arch_timer on
platform such as Cortex-A9 or Cortex-R7 which has support for
ARM Global Timer.

The global timer is a 64 bit incrementing counter, memory-mapped
in the private memory region.

Signed-off-by: Julien Massot <julien.massot@iot.bzh>
2021-02-15 08:28:51 -05:00
Guillaume Paquet
143a776657 boards: arm: nordic: Add BG96 to RAK5010 board
Add BG96 in board description
Add W Disable Pin in BG96 descriptor

Signed-off-by: Guillaume Paquet <guillaume.paquet@smile.fr>
2021-02-15 08:25:46 -05:00
Johan Hedberg
935ebc0134 drivers/virtualization: Take advantage of pcie_bdf_lookup()
Use the new pcie_bdf_lookup() API instead of having a custom lookup
function.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-02-15 08:23:05 -05:00
Johan Hedberg
d01fa56f6a drivers: pcie: Introduce API to look up devices by ID
In some cases we cannot know the BDF up-front, so provide a way to
look it up based on the vendor and device ID.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-02-15 08:23:05 -05:00
Johan Hedberg
14da6014a3 drivers: pcie: Move MAX_BUS/DEV/FUNC defines to pcie.h header file
These have been redefined in various places - better to have them in a
single place that different users can use.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-02-15 08:23:05 -05:00
Scott Worley
2b926db4e1 drivers: espi: Microchip eSPI add SAF support
Add ESPI SAF features to the Microchip eSPI driver as
a separate file. ESPI SAF depends upon the core eSPI
driver adding the ability to attach the system SPI
flash to the EC eSPI endpoint instead of the host
eSPI controller.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-02-15 08:22:01 -05:00
Steven Daglish
5427d6bbc7 sensor: mcp9808: Adding temperature resolution to MCP9808 sensor driver
During the driver init, the function will set the sensor resolution
based on the driver's dts variable "resolution"

The driver's device tree has been updated to include the value
"resolution".

The default is set to the highest resolution of 0.0625C.

Moved mcp9808_reg_write from mcp9808_trigger.c to mcp9808.c

This allows resue of the same function in both the trigger and
resolution functions.

Function name changed to xxx_16bit to distinquish it from the 8
bit write function that will added.

Signed-off-by: Steven Daglish <s.c.daglish@gmail.com>
2021-02-15 08:13:17 -05:00
Mulin Chao
ea00ff32fe driver: intc: npcx: remove 'interrupt disable' in miwu configure func.
In this CL, npcx_miwu_interrupt_configure is no longer responsible for
turning the interrupt off. Although the default state of WK_EN is
disabled, the users still have the chance to configure them when WK_EN
is enabled via npcx_miwu_irq_enable(). Hence, this CL also ensures that
WK_EN is disabled before configuring them.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-15 08:11:06 -05:00
Mulin Chao
9e68b1c351 driver: gpio: npcx: simpler approach for GPIO_INT_MODE_DISABLED.
This CL uses a simpler configuration approach that turns GPIO's
interrupts off instead of calling npcx_miwu_interrupt_configure
with NPCX_MIWU_MODE_DISABLED.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-15 08:11:06 -05:00
Czeslaw Makarski
9f56cc5531 drivers: ieee802154: Make HW Radio Capabilities runtime
This commit introduces runtime query of the HW Capabilities of
the nRF IEEE 802.15.4 Radio Driver.

Signed-off-by: Czeslaw Makarski <Czeslaw.Makarski@nordicsemi.no>
2021-02-15 08:10:19 -05:00
Czeslaw Makarski
3e1c2b7808 drivers: ieee802154: Remove obsolete Kconfig entry.
This commit removes obsolete Kconfig entry.

Signed-off-by: Czeslaw Makarski <Czeslaw.Makarski@nordicsemi.no>
2021-02-15 08:10:19 -05:00
Pawel Kwiek
f88cc17627 drivers: ieee802154: Enable CSMA-CA on serialized host
This commit enables CSMA-CA on the serialized host.

Signed-off-by: Pawel Kwiek <pawel.kwiek@nordicsemi.no>
2021-02-15 08:10:19 -05:00
Flavio Ceolin
3f87c5a0f4 power: Rename constraint API
Replace pm_ctrl_* with pm_constraint.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-02-15 08:08:36 -05:00
Pavlo Hamov
ae07aad3ed drivers: uart_cc32xx: use device tree iteration
Add posibility to configure UART_X device
based on board dts config.

Enable uart clock only if node is enabled

Signed-off-by: Pavlo Hamov <pasha.gamov@gmail.com>
2021-02-15 08:08:21 -05:00
Ioannis Glaropoulos
d92e4fb850 boards: nrf: remove support for deprecated board nRF5340 PDK
nRF5340 PDK board was deprecated in v2.5.0 release
and is removed now from the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-02-15 07:59:43 -05:00
Armando Visconti
69269c52e8 drivers/sensor: iis2iclx: Move odr Kconfig property into dts
Move iis2iclx odr options from Kconfigs to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-02-15 07:58:36 -05:00
Armando Visconti
5ebada58a7 drivers/sensor: iis2iclx: Move range Kconfig property into dts
Converts iis2iclx range options (500mg, 1g, 2g, 3g) from Kconfigs
to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-02-15 07:58:36 -05:00
Marcin Niestroj
fe6266ea7d drivers: wifi: esp: fix hostname configuration
By the time hostname configuration was implemented, driver was switching
only between STA and STA+AP modes. After dynamic selection between NONE,
STA, AP and STA+AP was implemented (commit referenced below), hostname
configuration no longer takes effect when ESP chip obtains address over
DHCP (and sends hostname in the DHCP request).

Set hostname each time after enabling STA mode, so that it takes effect
in DHCP requests.

Fixes: 03ce61004b ("drivers: wifi: esp: control CWMODE depending on
  current needs")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-02-14 22:12:47 -05:00
Kumar Gala
8b932fbabc drivers: i2c: Add some Kconfig depends
Add some simple depends so we limit various I2C drivers to the SoC
families that the drivers are relevant to.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-14 18:31:55 -05:00
Erwan Gouriou
6288af6f75 drivers/i2c: stm32_v1: TX IRQ enable called twice in a row
On I2C V1 parts, LL_I2C_EnableIT_TX() translates to EVT and BUF
IRQ enabling.
In stm32_i2c_msg_write function, LL_I2C_EnableIT_TX is called right
after stm32_i2c_enable_transfer_interrupts which already enables BUF
IRQ, which starts the transfer.
As a consequence it could happen that transfer is already complete
at the time LL_I2C_EnableIT_TX is called. This case is not expected
by remaining part of the code which loops forever waiting for BUF IRQ
to be raised.
Remove the superfluous LL_I2C_EnableIT_TX call.

Fixes: #32265

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-02-14 18:29:29 -05:00
Andrzej Puzdrowski
516d4c6ad8 drivers/flash/soc_flash_nrf: suspend POFWARN before engage
nRF52840, nRF52810, nRF52811 and nRF52805 are affected by anomaly 242.
This patch introduces workaround for this anomaly as follow:
Power-fail comparator is disabled before any attempt to erase or write.
Either erase or write is not proceed if EVENT_POFWARN is
already asserted.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-02-14 18:23:12 -05:00
Andrzej Puzdrowski
a7e3e22282 drivers/flash/soc_flash_nrf: support in-progress abort
Introduce support for situation when synchronization back-end
aborts operation before it is done. synchronization API will
transfer operation return code to the driver shim back.

Additionally:
FLASH_OP_ONGOING value was switched to be positive in order to
not been mislead with a negative error code.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-02-14 18:23:12 -05:00
Jose Alberto Meza
d38d913452 samples: drivers: espi: Showcase OOB Rx asynchronous handling
Add example to handle OOB host responses asynchronously.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2021-02-14 18:22:47 -05:00
Jose Alberto Meza
2a56743def drivers: espi: xec: Add support for host-initiated traffic
Keep OOB Rx channel and interrupt always enabled.

Send callback when packet is received in OOB Rx channel
if asynchronous host-initiated handling is enabled.

Note that driver doesn't perform any buffering from packets,
so access to OOB Rx channel is gated by client's driver
packet retrieval.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2021-02-14 18:22:47 -05:00
Jose Alberto Meza
88b7c6ad44 drivers: espi: config: Support for host-initiated eSPI traffic
Currently assumption is all OOB traffic over eSPI bus is always client
initiated.
Add option for systems where host can initiate OOB traffic.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2021-02-14 18:22:47 -05:00
Antonis Sioutas
b36538d5a4 drivers: counter: stm32: Fix alarm time calculation
The calculated alarm time starts from 2000 but the gmtime_r needs as
input the time from epoch (1970). This causes the alarm time to be
miscalculated due to leap years, as 2000 is a leap year and 1970 is not.
To fix the issue, the 2000 timestamp can be added to the input time of
gmtime_r.

Fixes #32260

Signed-off-by: Antonis Sioutas <antonis.si510@gmail.com>
2021-02-14 18:20:11 -05:00
Erwan Gouriou
5e561708c4 drivers/uart: stm32: Fix comparisons to have constants on right side
Fixes: "WARNING:CONSTANT_COMPARISON: Comparisons should place the
constant on the right side of the test"

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-02-14 16:38:04 -05:00
Erwan Gouriou
32fe2976f3 drivers/uart: stm32: Report 9bits transactions as not supported
STM32 uart driver doesn't support 9bits transactions in any case,
so remove case were it was declared as supported.

Fixes #31799

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-02-14 16:38:04 -05:00
Alexander Wachter
09fea5cc5e drivers: flash: stm32g4: Flush caches after erase
This commit fixes sporadic kernel panics when writing big data chunks
to the flash. (data bus errors)
Reference manual:
If an erase operation in Flash memory also concerns data in the data
or instruction cache, you have to make sure that these data are
rewritten before they are accessed during code execution.
If this cannot be done safely, it is recommended to flush the caches
by setting the DCRST and ICRST bits in the Flash access control
register (FLASH_ACR).

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2021-02-11 13:55:35 -05:00
Krzysztof Chruscinski
820d828947 drivers: serial: nrfx_uarte: Add missing check
If statement was unconditionally reading a field from async struct
while pointer to this struct may be null if asynchronous API is
enabled but given driver instance is not using it.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-02-11 08:52:36 -05:00
Anas Nashif
5d1c535fc8 license: add missing SPDX headers
Add SPDX header to files with existing license.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-02-11 08:05:16 -05:00
Kumar Gala
0944d07b55 drivers: sensor: icm42605: Fix use of deprecated API
Driver uses DEVICE_AND_API_INIT which is deprecated so convert
to using DEVICE_DT_INST_DEFINE instead.

Fixes #32151

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-10 18:21:20 -05:00
Kumar Gala
651898e13d drivers: sensor: icm42605: Fix build issues
There are several different issues when trying to build the icm42605
sensor driver:

* Missing entry in drivers/sensor/CMakeLists.txt
* Issues with #ifndef in header files
* Issues with const usage
* Missing function prototypes in headers
* Fix use of LOG_MODULE_REGISTER v LOG_MODULE_DECLARE
* Add missing dts node to tests/drivers/build_all/spi.dtsi

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-10 18:21:20 -05:00
Keith Short
5ece02d5dd npcx: fix NPCX PWM driver with PWM_POLARITY_INVERTED
Update NPCX PWM driver so PWM can be turned off as the first call when
PWM_POLARITY_INVERTED is used.

Signed-off-by: Keith Short <keithshort@google.com>
2021-02-10 10:51:55 -05:00
Jordan Yates
e756ad6c0f lora: sx126x: disable DIO1 in sleep mode
Disable the DIO1 interrupt when the sx126x modem is in sleep mode.
On nRF hardware, this lets the `GPIOTE` hardware be switched off, saving
15uA.

Fixes #31569.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-02-10 08:55:15 -05:00
Jordan Yates
6776535322 lora: sx126x: update modem state on transitions
Update the global state of the modem on calls to `SX126xReset` and
`SX126xWakeup`. This stops `SX126xCheckDeviceReady` sending spurious SPI
commands on every transieve before `SX126xSetOperatingMode` is called.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-02-10 08:55:15 -05:00
Kumar Gala
937dad2cb7 drivers: dma: iProc PAX: Fix use of deprecated APIs
Drivers are using DEVICE_AND_API_INIT which is deprecated so convert
the iproc_pax dma drivers over to using DEVICE_DT_INST_DEFINE and
DEVICE_DT_INST_GET.

Fixes #32153

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-10 07:16:11 -05:00
Peter Bigot
90d8c8d9cd drivers: i2c: litex: remove redundant null pointers
The callback pointers for uninitiated operations are implicitly null;
making them explicit only confuses maintainers searching for drivers
that implement the API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-02-09 13:59:17 -05:00
Christoph Reiter
1b5f134477 drivers: sensor: dps310 fix out of bounds write
Fixes a copy-paste error which results in an out of bounds write on the
stack.

Signed-off-by: Christoph Reiter <christoph.reiter@infineon.com>
2021-02-09 10:44:43 -05:00
Henrik Brix Andersen
5b9b52b925 drivers: adc: lmp90xxx: initialise all instances
Iterate through all lmp90xxx device instances found in the devicetree
and initialise all of them.

Fixes #32046.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-02-07 09:48:44 -05:00
Alexander Wachter
09ef2e667f drivers: can: common: Fix uninitializes sjw
Fix coverity CID 216784.
SJW was not initialized in the tmp_res, but got copied
to the result pointer, which overwrites the value.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-02-06 16:21:09 -05:00
Mulin Chao
40cadb320e driver: i2c: npcx: Prevent transaction result overwritten by recovery.
This CL prevents the transaction result overwritten by the recovery
function. Even if the recovery mechanism succeeds, the upper layer still
needs to know why the transaction failed.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-05 12:24:52 -05:00
Mulin Chao
c3beabd3c8 driver: i2c: npcx: clear status register by setting a single bit.
Since all fields' type in SMBST is R/W1C and RO, setting a single bit to
clear a specified event is a more suitable solution. Or we might clear
the other pending bits that occurred at the same moment unexpectedly.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-05 12:24:52 -05:00
Mulin Chao
7c8cb78b23 driver: i2c: npcx: reset i2c semaphore before start transaction.
This CL reset i2c event-completed semaphore before starting
transactions. Some interrupt events such as BUS_ERROR might change its
counter when i2c bus is idle. It causes that the driver cannot wait
for the event completed and return immediately.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-05 12:24:52 -05:00
Shlomi Vaknin
5ccb89c3bc dma: stm32: remove dump stream info in irq
Remove printing dma stream info in irq context.
This is printed in case of error.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2021-02-05 12:24:20 -05:00
Marcin Niestroj
70efb83fd2 drivers: wifi: esp: process received packets in esp_rx thread
So far received packets were parsed (at AT command level) and allocated
in [esp_rx] thread. Then they were submitted to [esp_workq] thread for
processing (calling application callback).

This flow results in following deadlock when esp_workq thread waits on
response to some AT command:

  - [esp_rx] waits on allocation of new RX packet
  - [esp_workq] waits for [esp_rx] to process response to AT command
    that was just sent
  - blocked [esp_workq] prevents processing and deallocating RX packets
  - [esp_rx] times out on allocation and closes socket

Process RX packets directly from [esp_rx] thread to prevent above
deadlock.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-02-05 11:42:03 -05:00
Tomasz Bursztyka
e69c357e78 drivers/virtualization: Fix ivshmem PCIE reg bar lookup on ivshmem-plain
This is a fix for ACRN targets. Qemu ivshmem original specs do not
states that, if ivshmem-plain is selected, bar0 (the register bar) will
not be present. It just says that bar2 will only be sufficient.
And that is what happens on qemu: whether ivshmem-plain or
ivshmem-doorbell is selected, bar0 is always present no matter what.

This does not seem to be the case in ACRN which does not expose the
bar0 if ivshmem-plain is selected.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-02-05 07:18:49 -05:00
Jordan Yates
238067dfc1 serial: uart_nrfx_uarte: graceful async power down
Gracefully shutdown the UARTE peripheral when the async API is used.
Failure to do so results in the driver being unusable when powered back
up as the required events (ENDTX & TXSTOPPED) are not set. This also
ensures that the last byte sent out via `poll_out` is properly output
on the serial line before powering down.

Fixes #31930.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-02-04 14:41:09 -05:00
Jordan Yates
5979b0085f serial: uart_nrfx_uarte: update state when enabled
Update the drivers power state knowledge immediately after calling
`nrf_uarte_enable`. This ensures that the state is correct regardless of
which path the function exits by.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-02-04 14:41:09 -05:00
Alexander Shuklin
6831b8b15e Drivers: serial: Fix stm32 uart async api callback
Fixes the bug when driver changes offset after
the callback call. When you have the ready event
you suppose no changes in driver data after that.
Fixes #31973

Signed-off-by: Alexander Shuklin <jasuramme@gmail.com>
2021-02-04 14:00:09 -05:00
Andy Ross
71fd58ccac drivers/cavs_timer: Fix multiword race with timer counter
The count register is 64 bits, but we're a 32 bit CPU that can only
read four bytes at a time, so a bit of care is needed to prevent
racing against a wraparound of the low word.  Wrap the low read
between two reads of the high word and make sure it didn't change.

Fixes #31599

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-02-04 13:10:25 -05:00
Erwan Gouriou
96c92ed93f drivers/dma: stm32: Don't omit IRQ status check
When checking for IRQ flags, we should also check
for IRQ status (IsEnabled ?).
If this is not done we can end up in Half Transfer
interrupt processing while it is not enabled.

Additionaly always use the id translation function
in LL API calls.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-02-04 12:35:04 -05:00
Jan Tore Guggedal
e7a335fb9d drivers: sensor: adxl362: Fix unused variable warnings
This patch fixes warnings for unused variables when acceleremoter
range and sampling frequency are set to values different from
the defaults.

Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
2021-02-04 10:36:38 -05:00
Krzysztof Chruscinski
4c0266fcf1 drivers: serial: nrfx_uarte: Fix power management
Power consumption was still high after putting uarte device into off
state. It was caused by ENDRX interrupt that was triggered after
calling STOPRX. ENDRX event was called with 0 amount but interrupt
got triggered and fifo_read was starting RX again.

Added disabling RX interrupt before disabling UARTE and reenabling at
device activation.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-02-04 10:26:55 -05:00
Emil Lindqvist
35b609be5a drivers: flash: stm32h7: fix int/long int warnings
Some format strings were causing warnings.
As elsewhere in this file, offset is type-casted (or not,
depending on compiler) to long int, and then %ld is used in
format string.

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-02-04 10:07:08 -05:00
Andrei Emeltchenko
8a71b16f93 edac: Update shell commands
Add error_type and trigger shell commands and remove outdated ctrl.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-02-04 09:37:42 -05:00
Andrei Emeltchenko
47dd65bc97 edac: Rename PCI_ENDPOINT to PCI_HOST_BRIDGE
Use PCI_HOST_BRIDGE macro.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-02-04 09:37:42 -05:00
Andrei Emeltchenko
c0dd472cd7 edac: Do not use BDF and PCI IDs from DTS
Use autoconfiguration instead of DT hardcoding.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-02-04 09:37:42 -05:00
Andrei Emeltchenko
89a253b052 edac: Use Device Tree values for BDF and PCI VID
Start using DTS values for PCI Vendor ID and PCI BDF. For the PCI
Device ID we do not use DTS since this would require changing overlay
for different SKU board.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-02-04 09:37:42 -05:00
Flavio Ceolin
9c55e2b551 drivers: bme280: Replace deprecated Kconfig option
Use CONFIG_PM_DEVICE instead of using CONFIG_DEVICE_POWER_MANAGEMENT.

Fixes: #31920

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-02-03 16:13:44 -05:00
Maureen Helm
53b08ecbfd drivers: serial: Don't condition uart_irq_rx_ready on irq enabled
The function uart_irq_rx_ready() should return true if there is data in
the receive buffer, regardless of whether the irq is enabled. Fix the
mcux and rv32m1 shim drivers to implement this behavior correctly.

Prior to this change:
- irq_rx_full() checks if RX data is available
- irq_rx_ready() checks if RX data is available and interrupts are
  enabled

After this change:
- irq_rx_full() checks if RX data is available
- irq_rx_ready() renamed to irq_rx_pending() to avoid confusion with the
  API ready() function
- API ready() implementation switched to use irq_rx_full()

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-02-03 08:36:23 -05:00
Kumar Gala
6defabebad drivers: can: Fix building with socket_can_generic.h
socket_can_generic.h makes some assumptions that are not always valid
for various drivers with regards to numbering.  To clean this up we
add defines for SOCKET_CAN_NAME_0 and SOCKET_CAN_NAME_2 in addition to
SOCKET_CAN_NAME_1.

We also move struct socket_can_context into the drivers themselves
since they know best how many CAN interfaces are getting supported and
what naming/number convention they'd have.

Additionally, this also exposes a few other build issues with the
can_mcux_flexcan driver that get fixed.

Finally, we remove the platform_allow from samples/net/sockets/can
since it is no longer needed.

Fixes #31733

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-02 16:46:28 -05:00
Marcin Niestroj
4431ae5119 drivers: wifi: esp: support using DNS servers from ESP
ESP fetches DNS servers from local network by using DHCP. There is an AT
command to get those DNS addresses. Use that to provide DNS addresses
for Zephyr's DNS resolver.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-02-02 14:02:45 -05:00
NavinSankar Velliangiri
99a0c416bf drivers: can: mcp2515: Enable CAN_NORMAL_MODE
Enable CAN_NORMAL_MODE after configuring the CNF1, CNF2, CNF3 register.

Signed-off-by: NavinSankar Velliangiri <navin@linumiz.com>
2021-02-02 14:01:41 -05:00
Erwan Gouriou
9abff32bdc drivers/watchdog: stm32: Select watchdog using compatible
Rather than Kconfig vendor symbols, select stm32 watchdog using
compatible.
So user only has to enable the requested node and set
CONFIG_WATCHDOG=y.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-02-02 08:15:51 -05:00
Erwan Gouriou
1c9041c3aa drivers/watchdog: window-watchdog stm32: Fix timeout computing
Fix the timeout computation to provide more accurate timeouts
versus requested timeout.
Additionally, the error margin is reworked in order to:
- be relative to the application requested timeout (10% tolerance)
- exclude timeouts inferior to application request

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-02-02 08:15:51 -05:00
Laczen JMS
0e6a2e0390 drivers: eeprom simulator fix range error
This PR fixes a bug in the eeprom simulator making the last byte
part of the readable/writeable range

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2021-02-02 07:36:13 -05:00
Mulin Chao
ddd73ca508 driver: espi: add more KBC 8042 support in npcx series.
This CL added more additional details for KBC (Keyboard and Mouse
Controller) bus in espi_event structure. It helps the application to
handle different 8042 events in the callback function.

The format of event data for KBC 8042 protocol is:
[23:16] - 8042 event type: 1: Input buf full, 2: Output buf empty.
[15:8]  - 8042 data: 8-bit 8042 data.
[0:7]   - 8042 protocol type: 0: data type, 1: command type.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-02-01 21:42:44 -05:00
Hake Huang
a50b69dfb7 drivers: mcux_flexcan driver errata
in NXP flexcan driver we need add ERRATA for
ERRATA 5461 and 5829, reproted in #31555

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-02-01 08:35:14 -05:00
Marcin Niestroj
3f1d1f5773 drivers: wifi: esp: suppress warning logs when socket was closed
Socket can be closed either by Zephyr or by peer. In the former case ESP
WiFi chip still notfies about closed socket, which currently results in
printing warning log:

  <wrn> wifi_esp: Link X already closed

Change level of this log from warning to debug, so that driver users are
not concerned about situation that is a normal behaviour.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-31 10:21:52 -05:00
Jordan Yates
fb71ad5bb6 lora: sx12xx_common: force sleep on boot
Force sx12xx modems into sleep mode on boot. This is the default state
of the modem when not being used due to the TX/RX complete callbacks.
This reduces current consumption by 600uA before the modems are used
for the first time.

As sleep is the normal state after TX/RX when using the LoRa API, it is
garaunteed that this will not change the behaviour of application code.
LoRaWAN starts by calling Radio.Init(), which resets the modem, so any
sleep configuration we do here is discarded.

Fixes #31567.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-01-31 10:20:53 -05:00
Hayden Ball
893857b48a max17055: Fix current conversion from MAX17055 unit to milliamps
`SENSOR_CHAN_GAUGE_AVG_CURRENT` is currently treated as a capacity
by the MAX17055 driver, however the unit conversion is different
for current and must be calculated separately.

Add a separate method to convert a current reading to milliamps
from 1.5625 uV/R_SENSE units, instead of the 5uVH/R_SENSE conversion
that was previously used.

Tested by comparing value read and converted from MAX17055 with
value from an external power profiling kit.

Signed-off-by: Hayden Ball <hayden@playerdata.co.uk>
2021-01-30 10:45:39 -05:00
Erwan Gouriou
6a012301e6 drivers/adc: stm32: Use bitfield for multiple channels detection
For multiple channels detection, channels variable was compared with
the output of find_lsb_set which actually is a decimal number.
Since channel is a bitfield the comparison was not behaving as
expected (detecting several channels while only one channel was used).

Rework the code to use the already existing bitfield "index" for
the test.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-29 16:57:04 -05:00
Alexandre Bourdiol
96c7852318 drivers: clock_control: Kconfig.stm32l4_l5_wb fix serie differences
Take into account PLL configuration differences,
depending on sSTM32 serie.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-01-29 08:04:13 -05:00
Marcin Niestroj
2a6ddd2d3b drivers: wifi: esp: fix AT+CWMODE_CUR compatibility with ESP AT 1.7
There was a regression when implementing automatic AT+CWMODE{,_CUR}
handling based on driver needs. ESP AT 1.7 firmware does not support
AT+CWMODE_CUR=0, which means that radio needs to be either in STA, AP or
STA+AP mode (no NONE state available).

Fix ESP AT 1.7 compatibility by keeping radio in STA mode whenever it is
not used.

Move also first AT+CWMODE_CUR invocation before AT+CWDHCP_CUR, so that
the latter executes successfully with ESP AT 1.7.

Fixes: 03ce61004b ("drivers: wifi: esp: control CWMODE depending on
  current needs")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-28 17:23:06 -05:00
Armando Visconti
4141705ad3 drivers/sensor: Fix typos in iis2dlpc/iis2iclx/lsm6dso
The ',' character was used as line terminator instead of ';'
in SPI routines. The three affected drivers were not showing
any issue, but the typo is fixed for clarity.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-28 13:56:42 -05:00
Rubin Gerritsen
4f034740eb sensor: nrf5: temp: Allow alternative temp driver
This allows out-of-tree libraries to implement their own temperature
driver.

We allow selecting TEMP_NRF5 to aviod dependency loops

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-28 08:19:34 -05:00
Rubin Gerritsen
bf5d48af84 drivers: clock_control: Clock calibtration with alt driver
With this change it is possible to share all configurations
related to CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION without
including the clock calibration configurations.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-28 08:19:34 -05:00
Rubin Gerritsen
2a95e9a136 drivers: clock_control: Clock calibration depends on RC
Clock calibration should only be used when RC source is used.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-28 08:19:34 -05:00
Jedrzej Ciupis
1d922f4995 drivers: gpio_nrfx: Allocate GPIOTE channels with nrfx
The GPIO driver uses a proprietary GPIOTE channel allocator.
This commit makes it use the allocation mechanism provided by nrfx.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2021-01-28 08:19:16 -05:00
Flavio Ceolin
4ab6dd003e timer: arm: Mark ticks as unused
When TICKLESS_KERNEL is disabled the parameter ticks is not used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-27 16:55:58 -05:00
Flavio Ceolin
cd0caced65 timer: arm: idle is used when CONFIG_TICKLESS_KERNEL
Only mark idle parameter unused when building without TICKLESS_KERNEL
enabled.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-27 16:55:58 -05:00
Flavio Ceolin
345849052a timer: arm: Fix idle usage option
idle is only considered in other timer implementations if ticks ==
K_TICKS_FOREVER but in arm_arch_timer. Just fix it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-27 16:55:58 -05:00
Francois Ramu
1280e9817c drivers: timer: stm32 lptim fix Potentially overflow
Fix Unintentional integer overflow in the calculation
Integer handling issues (OVERFLOW_BEFORE_WIDEN)
Potentially overflowing expression

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-01-27 14:45:20 -05:00
Ryan Erickson
f1f309d56b drivers: modem: hl7800: fix buffer null termination
Fix possibility of no_id_resp_cmd buffer missing a
null terminator.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-01-27 08:03:45 -05:00
Ryan Erickson
a7b61fa2a8 drivers: modem: hl7800: fix possible null reference
Ensure sock is not referenced if it is null.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-01-27 08:03:24 -05:00
Nicolai Glud
fc03bd2b86 drivers: wifi: winc1500: Updated driver capabilities.
Added ap_enable and ap_disable api. The driver will open create an
access point with DHCP Server ip 192.168.1.1 and no security.

Added a small fix for the AF_INET issue.

Added parent and remote to accept routine context.

Added put implementation.

Signed-off-by: Nicolai Glud <nicolai.glud@prevas.dk>
2021-01-26 17:43:45 -05:00
Marcin Niestroj
705eb1d2b0 drivers: wifi: esp: access socket type and ip_proto from net_context
net_context contains both net_sock_type and net_ip_protocol, which are
static during the lifetime of net_context. net_context has basically the
ownership of esp_socket, so we can be sure 'type' and 'ip_proto' are
always accessible through net_context API.

Remove 'type' and 'ip_proto' members from 'esp_socket' structure, as
those are already accessible by net_context API.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-26 14:47:46 -05:00
Marcin Niestroj
cad292e17f drivers: wifi: esp: add thread-safety on esp_socket operations
Change type of esp_socket->flags from uint8_t to atomic_t, so that read
and write access to those flags is done in atomic (thread-safe) manner.

Introduce esp_socket_ref() and esp_socket_unref() functions, which
operate on atomic refcount variable. esp_socket_ref() role is to
increase refcount if it was already non-zero. If it was zero then NULL
is returned, which means that socket is not used by net_context at the
moment.

Role of refcount:
 * socket instance is assured to be between net_offload->get() and
   net_offload->put() when refcount > 0,
 * makes sure that socket instance can be used (its members can be
   dereferenced) when refcount > 0,
 * 'context' member is always valid and its members can be dereferenced
   when refcount > 0.

esp_socket_get() gets unused socket, as previously. Additionally it sets
refcount to 1 at the end of call, which basically means that from that
point such socket can be referenced by other parts of the driver. Each
esp_socket_get() call should be followed by esp_socket_unref() and
esp_socket_put() to properly invalidate socket and prevent other parts
of driver from using it.

Add ESP_SOCK_WORKQ_STOPPED flag, which is now used to prevent scheduling
more work into driver workqueue. This flag is set in net_offload->put()
callback, so that no more socket work (such as processing RX/TX packets
or closing socket because of errors) is submitted after that.

Introduce mutex lock, which has following role:
 * protects dst, connect_cb + conn_user_data, recv_cb + recv_user_data,
 * assures that checking ESP_SOCK_WORKQ_STOPPED flag and actually
   submitting (or not if net_offload->put was already called) new socket
   work to workqueue is done in atomic way.

As there is a mechanism to prevent submitting new work items to
workqueue when net_offload->put() has been executed, then there is no
need to explicitly call esp_socket_ref() in esp_workq thread. This is
because one reference is being held by net_context (after calling
net_context->get()). This is why all the esp_socket_in_use() were simply
dropped. Code running from esp_rx thread on the other hand always uses
esp_socket_ref_from_link_id() helper function (which is backed by
esp_socket_ref()), so that it replaces previous esp_socket_in_use()
calls and additionally makes sure that socket stays valid ("in use")
until esp_socket_unref() is called.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-26 14:47:46 -05:00
Andrzej Puzdrowski
b9d492e4d2 drivers/flash: select to allow flash write by MPU on ARM SoCs
Added selection of MPU_ALLOW_FLASH_WRITE.
Using a flash driver while MPU is enable without
this option on doesn't make sense at all.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-01-25 08:59:01 -05:00
Matija Tudan
1463596205 drivers: dac: added driver for TI DACx3608
The DAC53608 and DAC43608 (DACx3608) are lowpower, eight-channel,
voltage-output, 10-bit or 8-bit digital-to-analog converters (DACs)
respectively. They support I2C with a wide power supply range
from 1.8 V to 5.5 V, and a full scale output voltage range of
1.8 V to 5.5 V. The DACx3608 also includes per channel, user
programmable, power down registers.

Signed-off-by: Matija Tudan <mtudan@mobilisis.hr>
2021-01-24 14:28:05 -05:00
Volodymyr Babchuk
4fb1ee771a drivers: pl011: add SBSA mode
ARM Server Base System Architecture defines Generic UART interface,
which is subset of PL011 UART.

Minimal SBSA UART implementation does not define UART hardware
configuration registers. Basically, only FIFOs and interrupt management
operation are defined.

Add SBSA mode to PL011 UART driver, so it can be used at SBSA-compatible
platforms, like Xen guest.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
2021-01-24 13:59:55 -05:00
Shubham Kulkarni
d621dad21b soc/esp32: Move logging library to IRAM with CONFIG_LOG_MINIMAL
This commit updates linker script to move minimal log module to internal
RAM

Signed-off-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
2021-01-23 08:43:10 -05:00
Martin Jäger
3c7b2771b1 drivers: adc: stm32: Fix sequence configuration
The STM32 driver currently does not support reading a sequence of
multiple ADC channels. Only the first channel of the sequence was
read and the rest was silently ignored.

Fix: Return an error if reading multiple channels is requested.

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-01-23 08:27:46 -05:00
Andrei Gansari
6587c93aa9 drivers: soc_flash_lpc: LPC legacy flash driver
Older LPC platforms use Flash IAP with a command style firmware command.
Tested on LPC54114 platform.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2021-01-23 08:01:00 -05:00
Robert Lubos
a42d6c98d3 drivers: ieee802154_nrf5: Block on net_pkt allocation in the RX path
Currently, if no net_pkt's are available, the radio driver RX thread
drops the 802.15.4 frame silently. This causes undesired behaviour,
where we can drop the packet which has already been acknowledged at
the 802.15.4 level.

Fix this, by blocking the RX thread if no net_pkt is avaliable. The
packets received while the RX thread is blocked will be accumulated in
the underlying nRF 802.15.4 driver, and eventually when it runs out of
internal buffers before the thread is unblocked, it'll stop
acknowledging the incoming frames.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-01-22 18:48:18 +02:00
Maureen Helm
2c46824824 drivers: flash: Fix flash shell to work without dts chosen node
The flash shell can work with any flash driver instance, not just the
one chosen by zephyr,flash-controller. It's helpful for the flash shell
to use this instance by default, but not required. We can switch
instances at runtime with the "flash set_device" command.

Fix the flash shell so it can build when there isn't a chosen
zephyr,flash-controller available.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-01-22 11:11:54 -05:00
Maureen Helm
b0bd5a6ece drivers: flash: Introduce i.MX RT FlexSPI driver
Introduces a new flash driver for the FlexSPI peripheral on i.MX RT
SoCs. The hardware provides a flexible sequence engine (LUT) that
supports various types of external devices, including serial NOR flash,
serial NAND flash, HyperBus (HyperFlash/HyperRAM), and FPGAs. It
supports up to four connected devices in single/dual/quad/octal modes
and provides memory-mapped read/write access to these devices through
the AHB bus.

The driver implementation consists of a shared controller for each
FlexSPI peripheral instance, and protocol-specific device drivers for
each external device. The controller provides a private interface for
multiple devices to access the FlexSPI peripheral registers. FlexSPI
devices provide the public flash driver interface to applications or
subsystems like storage or flash file systems; they also provide
protocol-specific LUT sequences to the controller.

Currently the only device type supported is QSPI NOR flash, but other
types like HyperFlash will be added later.

XIP is not yet supported, as this requires additional work to relocate
code to RAM and managing interrupts.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-01-22 11:11:54 -05:00
Xavier Chapron
47da2bed27 drivers: modem: sara-r4: Add sanity timeout for @ prompt
This wait on @ prompt was added in
fa3d586483.
The situation were the @ prompt is never received should not occurs,
however it's definitively safer to catch it instead of having a
deadlock.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2021-01-22 10:04:11 -05:00
Hake Huang
3940b407d9 driver: update gpt driver to support internal divider by dts
using dts support gpt clock source and divider

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-01-22 08:34:49 -06:00
Hake Huang
2a6657f952 clocks: ccm add gpt clock control into ccm driver
add clock frequence support for gpt

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-01-22 08:34:49 -06:00
Flavio Ceolin
d21cfd5f36 power: Remove power management conditionals from code
Remove conditionals (PM_DEEP_SLEEP_STATES and PM_SLEEP_STATES) from
power management code. Now these features are always available when
power management is enabled.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-22 09:31:20 -05:00
Flavio Ceolin
579f7049c7 power: Move pm subsystem to new power states
Migrate the whole pm subsystem to use new power states information
from power_state.h and get states and residency properties from
device tree.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-22 09:31:20 -05:00
Marcin Niestroj
956923f8e5 drivers: wifi: esp: schedule each RX packet on separate work
So far a dedicated FIFO was used for all RX packets, which was consumed
in single submitted work. This work was also responsible for closing
socket and notifying uppper network layers if some errors occurred
previously or socket was simply closed by peer. There is however a
potential race condition in scenario described below:

  esp_rx thread             | esp_workq thread
  --------------------------|-----------------------------
                            | ---- esp_recv_work ----
                            | handle RX packets from FIFO
                            |
  ---- on_cmd_ipd ----      |
  put new RX packet to FIFO |
  ---- on_cmd_ipd ----      |
                            |
  ---- on_cmd_closed ----   |
  mark socket as closed     |
  ---- on_cmd_closed ----   |
                            |
                            | handle close
                            | ---- esp_recv_work ----

In this case we assume that esp_workq was preempted just after
processing all RX packets from FIFO and before checking if socket was
closed. In such scenario RX packet put to FIFO just before doing close
is going to be unhandled, so application layer will miss part of the
data.

Change the way RX packets are scheduled to workqueue, by using the
already available net_pkt->work objects (used for example in native TCP
stack). Create a separate work for closing connection. As a result all
RX packets and close handlers are on the same queue and there is no risk
of handling close events before handling all previously received data.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-22 12:02:10 +01:00
Marcin Niestroj
dca2fd8042 drivers: wifi: esp: flush socket work items in socket put
There might be some scheduled work related to socket currently requested
to be destroyed/closed. Schedule a dummy work to make sure all
previously running work items in workqueue are finished.

When talking about TX packets, this makes sure that all previously
scheduled data is actually sent (flushed) before closing socket.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-22 12:02:10 +01:00
Marcin Niestroj
74e4f77fb4 drivers: wifi: esp: initialize per socket work structures only once
It is enough to initialize work structures once during driver init,
because work handlers do not change during driver lifetime.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-22 12:02:10 +01:00
Marcin Niestroj
7067373797 drivers: wifi: esp: always use net_pkt->work for sending
Currently there are two code paths when sending packets:
asynchronous (using workqueue) when zero timeout was specified and
synchronous in other cases. This doesn't seem to be justified, so
convert code to always schedule packet sending using workqueue.

Each net_pkt has an embedded work item, so use it instead of esp socket
specific work that was shared across all sent packets. This gives a
possibility to schedule multiple packets for sending.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-22 12:02:10 +01:00
Marcin Niestroj
90bb0847e4 drivers: wifi: esp: use context->send_cb and context->user_data
Callback and user data are saved in net_context structure. Those members
are used by native networking stack (net_if), so simply follow the same
pattern.

First of all this allows to reduce runtime information for driver socket
instance. Second and most important benefit is that it allows to move
send handling entirely to workqueue thread.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-22 12:02:10 +01:00
Anas Nashif
c31ce55c58 timer: TICKLESS_CAPABLE is now without prompt
TICKLESS_CAPABLE is now selectable only and without prompt, so remove it
from _defconfig files and select it directly by the timer.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-21 22:51:19 -05:00
Flavio Ceolin
c408765d70 timer: legacy_api: Fix a build dependency in legacy_api header
z_timer_idle_enter is declared only when CONFIG_TICKLESS_IDLE is
selected. This function is not implemented anywhere, but the only
driver including this header is not TICKLESS_CAPABLE. So, no undefined
reference will happen.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-21 17:20:32 -05:00
Flavio Ceolin
1dd2d414b8 kernel: build: Make TICKLESS_CAPABLE a hidden option
TICKLESS_CAPABLE is an option that has to be selected by the target.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-01-21 17:20:32 -05:00
Armando Visconti
45d0508bdf drivers/sensor: iis2dlpc: Add multi-instance support
Make this driver multi-instance and use the new API.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-21 16:49:55 -05:00
Martin Åberg
40ab00ac3d drivers/apbuart: add TX FIFO interrupt support
Use TX FIFO level interrupt if available in hardware. It matches the
Zephyr UART API and avoids "bootstrapping" which is needed when using
the TX edge interrupt ("TI"). TX FIFO has room for up to 32 characters
and will typically reduce the number of interrupts.

Details:
APBUART can be synthesized with or without support for TX/RX FIFO.
Edge interrupts which fire when TX holding register changes and RX data
available are always available, independent of the FIFO configuration.
If FIFO is made available at synthesis time, two additional interrupts
become available: TX FIFO half-empty and RX FIFO half-full. These
are level interrupts.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-21 15:53:03 -05:00
Martin Åberg
ec138d6256 drivers/apbuart: Fix interrupt-driven operation
This commit aligns the GRLIB APBUART driver with the Zephyr UART API
and fixes an issue where TX interrupt could previously be lost. It
was typically seen during interactive operation in the Zephyr shell.

There is an expectation in the Zephyr UART API that TX ready (i.e. TX
buffer space available) interrupt is a level interrupt, i.e. always
active while there's TX buffer space available. In particular, there's
an expectation that after uart_irq_tx_enable(), the TX interrupt will
immediately fire (assuming free TX buffer space is available).

The APBUART "Transmitter interrupt (CTRL_TI)" does not directly fulfill
this expectation because it is edge triggered and fires when the TX
holding register moves from being non-empty to empty. The solution
is to "bootstrap" interrupt processing by calling user-defined ISR
in irq_tx_enable().

This fix is similar to commit 49bb163756 ("drivers: serial:
uart_cmsdk_apb: Fix interrupt-driven operation").

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-21 15:53:03 -05:00
Robert Lubos
075445b811 drivers: ieee802154_nrf5: Allocate net_pkt from correct pool
The driver allocated packet from the TX pool on its RX path. Fix this
by using a correct allocator function.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-01-21 21:27:14 +02:00
Gerson Fernando Budke
84d6a78ad1 drivers: gpio: Add Cypress PSoC-6 gpio driver
Introduce PSoC-6 GPIO support.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-01-21 17:33:11 +01:00
Rohit Gujarathi
6910725ad9 drivers: display: Added Sharp memory display drivers.
Added support for sharp memory displays of the series
LS0XX.

Signed-off-by: Rohit Gujarathi <gujju.rohit@gmail.com>
2021-01-21 17:26:37 +01:00
Marcin Niestroj
a471e55da0 drivers: wifi: esp: always request MRU bytes with AT+CIPRECVDATA
ESP chip send number of available RX data using
+IPD=<sock>,<avail_bytes> command. This exact number (truncated to MRU)
was used to read data with AT+CIPRECVDATA=<sock>,<num_of_bytes>.

Use always MRU when sending AT+CIPRECVDATA=<sock>,<mru> request. When
there are less bytes available, then +CIPRECVDATA will just return less
bytes, which is fine for the driver.

There are two advantages to this new behavior:
 * there is no need to follow how many bytes were notified by +IPD
   message, thus reducing implementation size,
 * when data is constantly received by ESP chip, then the last number of
   bytes notified by +IPD is no longer up-to-date when sending a
   AT+CIPRECVDATA; always requesting MRU number of bytes allows to
   always receive maximum currently available number of bytes buffered
   by ESP chip.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-21 15:43:47 +02:00
Marcin Niestroj
831a5f0e55 drivers: wifi: esp: rely on +IPD after each +CIPRECVDATA
Dump of communication between ESP chip and Zephyr shows that
+IPD:<sock>,<bytes_avail> is always received after +CIPRECVDATA. This
means that we don't need to update sock->bytes_avail in esp_workq
thread. Additionally there is no need to schedule next AT+CIPRECVDATA
request, as that will be done by +IPD handler anyway.

Relying on +IPD to be received after each +CIPRECVDATA (as long as there
is some more data to be received) allows to simplify operations on
sock->bytes_avail. From now on only esp_rx thread will update its value
and schedule AT+CIPRECVDATA in esp_workq thread. Then in
sock->bytes_avail will be treated as "readonly" in esp_workq
thread. This allows to prevent race condition when both esp_rx and
esp_workq threads could potentially update value of sock->bytes_avail
value at the same time.

<sock>,CLOSED message is received always after retrieving all data from
ESP chip (using AT+CIPRECVDATA), so there is no need to check whether
there are more bytes to be received before marking socket as closed in
Zephyr driver.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-01-21 15:43:47 +02:00
Andrei Emeltchenko
73bf31f028 edac: Remove magic numbers
Use proper defines instead of magic numbers.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko
311732a0a0 edac: Replace DEVICE_AND_API_INIT with DEVICE_DEFINE
Since DEVICE_AND_API_INIT was recently deprecated replace with correct
version.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko
f4582b9478 edac: Add error data information to callback parameter
Add extra error data information to callback parameter. Add tests for
testing the data provided.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko
ae25a9926c edac: Remove extra logging
Remove unneeded extra logging.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko
064c9fe40f edac: Use helpers to read / write IBECC registers
Use helpers ibecc_{read,write}_reg{32,64}.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko
2dc413aa74 edac: Split EDAC set ctrl to set error_type and error_trigger
Split setting EDAC IBECC ctrl to setting error_type and
error_trigger to make it easier for other platforms.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko
f80628ba96 edac: Generalize EDAC API
Replace addr with param1 and addr_mask with param2 for get / set types
of functions. Those names are more general and allow to implement
error injections for other platforms.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko
f7f2dd85be edac: shell: Add EDAC shell
Add EDAC shell module which would be included in the EDAC sample.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko
2b30d04eef edac: ibecc: Add EDAC IBECC driver
Add In-Band ECC driver. Supported in ehl_crb board.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Andrei Emeltchenko
d4d278da0a edac: Add Zephyr EDAC configuration
Add Kconfig for EDAC.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-01-21 08:34:07 -05:00
Dawid Niedzwiecki
d1948dc164 emul: espi: Add support for eSPI emulators
Add an emulation controller which routes eSPI traffic to attached
emulators depending on the selected chip(mostly host).
This allows drivers for eSPI peripherals to be tested on systems
that don't have that peripheral attached, with the emulator handling
the eSPI traffic.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-01-20 17:49:19 -05:00
Rajavardhan Gundi
945dc6ea72 drivers: i2c_mchp_xec: Set Default Configuration
The default configuration is made to be "master" at
"standard speed". This makes it possible to use the
driver without having to configure it.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2021-01-20 14:16:27 -05:00
Rajavardhan Gundi
8751816745 drivers: i2c_mchp_xec: Enable slave mode support
Enable slave support for I2C device instances. Slave mode is
interrupt based, wheras master mode is still based on polling.

Remove ENI bit in master configuration since it is not needed for
master mode.

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@intel.com>
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2021-01-20 14:16:27 -05:00
JuHyun Kim
cc56fb5247 drivers: sensor: Initial driver of Invensense ICM42605
Initial driver and sample application of
TDK Invensense ICM42605 6-axis motion sensor.
This driver provide DTS for nRF52 DK board DTS setting.

Providing features are below.

Sensor data streaming - Accel, gyro
Tap, Double tap triggering.
Set/Get FSR, ODR by set attr API
Support multi instance feature.

Signed-off-by: JuHyun Kim <jkim@invensense.com>
2021-01-20 10:41:04 -06:00
Kumar Gala
d382868216 i2s: cavs: Fix build issues with driver
Move i2s_cavs_irq_connect_##n up so its available later when used.  This
fixes compile issues with the driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-01-20 09:13:29 -06:00
Henrik Brix Andersen
8167134f05 drivers: pwm: add driver for the NXP Kinetis Pulse Width Timer (PWT)
Add PWM capture driver for the NXP Kinetis Pulse Width Timer (PWT).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-01-20 08:05:57 -06:00
Pawel Sagan
0ce0f63036 drivers: ethernet: Verify returned value from net_if_set_link_addr
This commit verifies if the mac configuration is done correctly
during liteeth setup, and prompts a warning when not.

Signed-off-by: Pawel Sagan <psagan@antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2021-01-20 13:54:32 +02:00
Pawel Sagan
4324356a6e drivers: ethernet: Add timeout when waiting for LITEETH_TX_READY
This commit eliminates an inifite waiting for the TX ready flag
in the eth liteeth driver, exiting with error after a defined
number of attempts.

Signed-off-by: Pawel Sagan <psagan@antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2021-01-20 13:54:32 +02:00
Lukasz Majewski
6b440a1a13 eth: mcux: Add support for Distributed Switch Architecture devices
This patch adds support for DSA devices - like ksz8794 switch to the
mcux Kinetics driver.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-01-20 10:03:42 +02:00
Lukasz Majewski
ca5e3ea654 eth: Add support for Distributed Switch Architecture [DSA] switches
This patch add support for DSA switches to Zephyr.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-01-20 10:03:42 +02:00
Lukasz Majewski
23961f75a6 drivers: ethernet: Add support for KSZ8794 DSA device
This patch adds support for Microchip's KSZ8794 DSA device, which for
switch and PHY control uses SPI communication.

This driver also provides support for handling tail tagging added and
decoded in the KSZ8794 device as well as modifying entries in the
static MAC address table.

It is also possible to use GPIO pin to reset KSZ8794 switch.
When the "reset-gpios" property is not defined, software based reset
is performed instead.

The KSZ8794 can now be used on boards which have SPI CS only available
as GPIO pin.

Signed-off-by: Stefan Bigler <stefan.bigler@securiton.ch>
Signed-off-by: Lukasz Majewski <lukma@denx.de>
2021-01-20 10:03:42 +02:00
Hubert Miś
5548917e69 bluetooth: hci: rpmsg: Use RPMsg Service
This patch modifies Bluetooth HCI RPMsg drivers and samples to use
RPMsg Service instead of configuring OpenAMP directly in the driver
or the sample.

Co-authored-by: Piotr Szkotak <piotr.szkotak@nordicsemi.no>
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
2021-01-19 22:07:09 +01:00
Johan Hedberg
05f8dd9ab9 drivers: i2c_dw: Remove hard-coded instance count assumption
Introduce a Kconfig variable that the SoC can set to indicate the
number of instances in Device Tree. This also fixes the accuracy of
the Elkhart Lake instance count where the code was previously assuming
up to 12 instances even though DT lists 15 nodes.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-19 14:52:29 -05:00
Johan Hedberg
704ddaa9c3 drivers: i2c_dw: User proper PCIe DT hierarchy
Move all PCIe-based DT nodes under a PCIe bus and take advantage of
the DT_ANY_INST_ON_BUS_STATUS_OKAY() and DT_INST_ON_BUS() macros.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-19 14:52:29 -05:00
Henrik Brix Andersen
1491fb9de1 drivers: pwm: remove dw and pca9685 drivers
Remove DW and PCA9685 PWM controller drivers as they are unmaintained
and broken.

Both drivers lack support for the pwm_get_cycles_per_sec_t API function
which was introduced in commit 56e0b53c6e
in 2016.

Fixes #18607, #18608

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-01-19 09:04:52 -05:00
Antonio Tessarolo
f4acdc2729 NXP: Enable I2C for imx6sx
This commit add support for i2c on imx6sx.
I2C support is based on imx7d and requires NXP HAL.
The Device Tree binding is also changed to better reflect that i2c
driver support both imx6sx and imx7d.

Signed-off-by: Antonio Tessarolo <anthonytexdev@gmail.com>
2021-01-18 17:01:34 -05:00
Raveendra Padasalagi
228a3cffd6 drivers: dma: Add iProc PAXDMA driver
Add PAX[PCIE<->AXI] DMA driver which supports DMA
transfers between host and target memory over PCIe link.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2021-01-18 16:58:55 -05:00
Peter Bigot
28447c84c3 drivers: flash: nrf_qspi: support JESD216 API
Refactor slightly so we can read SFDP tables with this driver.  Note
that the SFDP read command requires long frame mode transfers as data
exceeds 8 bytes.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot
2d375e23ea drivers: flash: nrf_qspi: cleanup JEDEC ID length
QSPI doesn't have a different length expectation than normal SPI, so
introducing a new name for an existing name is unnecessary.  Also
replace the constant with the actual buffer size where appropriate, in
somebody changes the the buffer definition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot
3e46ae1acb drivers: flash: nrf_qspi: rework handling of quad-enable bit
Kconfig allowed selecting any bit in the status register as the QE
bit, and defaulted it to 6.  Devices need not require a QE bit at all,
and where JESD216 defines QE bit location the only place in first SR
byte that it can be is bit 6.  Further, the code unconditionally wrote
the value 0x40 without respecting configuration of other bits.  Some
of those bits control write protection of block-protected areas and
should not be changed.

Remove the Kconfig, instead using the jedec,jesd216-controlled
devicetree property.  Allow the driver to recognize whether or not
setting the bit is required, and when it is only use bit 6.  Only
update if the setting does not match the configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot
2bf39aead6 drivers: flash: nrf_qspi: shorten internal function names
These are so long they can mandate line length mitigation.  Avoid that.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot
2bfe69d020 drivers: flash: nrf_qspi: detect unsupported cinstr commands
The interface used to send commands supports only a command followed
by 8 bytes of data transfer.  Reject attempts to do more, as the
result will be a successful transfer of only the first 8 bytes.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot
60885270d1 drivers: flash: nrf_qspi: make cinstr wrapper more flexible
Not all special commands require that a write-enable be issued first.
Allow the caller to decide.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot
5fd3246a62 drivers: flash: jesd216: add support for DW16 decoding
DW16 provides information on mechanisms to enter and exit 4-Byte
address modes, returning the device to reset state, and how to
manipulate the values in the first status register.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot
52545411d2 drivers: flash: jesd216: add support for DW15 decoding
DW15 provides information on entry and exit from QSPI modes.  In
particular, it specifies whether and how the status register must be
updated for this feature.

Add a JESD216 devicetree property for the Quad Enable Requirements
value.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Johan Hedberg
4fa0a9b4b2 drivers: serial: ns16550: Remove hard-coded max instance count
Instead of having a hard-coded maximum instance count, introduce a
Kconfig variable for it. The inclusion of the per-instance header
files is solved by having them chain-include each other with a
pre-processor condition that checks if the current header file is the
last one or not.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00
Johan Hedberg
048dcea54b drivers: serial: ns16550: Remove reg-shift instance count assumption
The reg-shift support was quite broken in that the code only looked
for this property on instance 0. Now we support the property on any
node which might declare it.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00
Johan Hedberg
0cb118968d drivers: serial: ns16550: Remove DLF & PCP instance count assumptions
Take advantage of DT_INST_FOREACH_STATUS_OKAY() to look for DLF and
PCP properties on any matching nodes with "okay" status.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00
Johan Hedberg
4cc0391a1f drivers: uart: ns16550: Clean up Kconfig dependency usage
Use a dependency block instead of specifying a UART_NS16550 dependency
for each individual opton. This doesn't save many lines right now, but
may do so once more options are added.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00
Johan Hedberg
1d5d5fcf49 drivers: uart: ns16550: Move all PCIe-using nodes to a PCIe bus in DTS
The existing method of testing for any of the first four DT instances
having the pcie property feels a bit clumsy and will get more so when
support for more than four UARTs is added. A much more cleaner way to
do this (and more correct probably as well) is to list any PCIe-based
UART nodes under a pcie bus in the Device Tree hierarchy.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-18 15:45:58 -05:00
Mulin Chao
b7ec2cd5de driver: gpio: add 1p8v level detection support in npcx series.
Part of GPIO pads in npcx series support low-voltage (1.8V) level
detection. In order to introduce this feature, this CL adds a new
NPCX-specific controller property, lvol_io_pads, in devicetree file.
For example, here is devicetree fragment which turn on low-voltage
support of i2c1_0 port.

/ {
      def_lvol_io_list {
          compatible = "nuvoton,npcx-lvolctrl-def";
          lvol_io_pads = <&lvol_io90   /* I2C1_SCL0 1.8V support */
                          &lvol_io87>; /* I2C1_SDA0 1,8V support */
     };
  };

Then these pads will turn on 1.8V level detection during initialization.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-01-18 19:09:34 +01:00
Jacob Siverskog
290d64cb4e sensor: shell: add missing va_ends
each call to va_start must have a corresponding call to va_end.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2021-01-18 19:08:04 +01:00
Shlomi Vaknin
b4afd1aecf drivers: serial: implement stm32 uart async api
Add initial implementation of the uart async api
for stm32 mcus. This uses the dma controller
in normal mode for reception. In addition, to detect
reception of bytes we enable the idle line detection
interrupt.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
Signed-off-by: Jun Li <jun.r.li@intel.com>
Signed-off-by: Giancarlo Stasi <giancarlo.stasi.co@gmail.com>
2021-01-18 19:07:29 +01:00
Carlo Caione
57f7e31017 drivers: PSCI: Add driver and subsystem
Firmware implementing the PSCI functions described in ARM document
number ARM DEN 0022A ("Power State Coordination Interface System
Software on ARM processors") can be used by Zephyr to initiate various
CPU-centric power operations.

It is needed for virtualization, it is used to coordinate OSes and
hypervisors and it provides the functions used for SMP bring-up such as
CPU_ON and CPU_OFF.

A new PSCI driver is introduced to setup a proper subsystem used to
communicate with the PSCI firmware, implementing the basic operations:
get_version, cpu_on, cpu_off and affinity_info.

The current implementation only supports PSCI 0.2 and PSCI 1.0

The PSCI conduit (SMC or HVC) is setup reading the corresponding
property in the DTS node.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-01-18 19:06:53 +01:00
Armando Visconti
e4f95863f9 drivers/sensor: iis2dlpc: Move trigger pulse Kconfig property into DT
Move iis2dlpc trigger pulse configurations from Kconfigs to Device Tree.
Moreover the dts properties have been renamed as 'tap', which sounds a
better name to immediately catch the feature behind it. Since tap
threshold cannot be zero, this value (which is the default in dts
binding) is used to enable/disable the device feature per each axis.
The event can be generated on INT1 only.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-18 09:21:00 -06:00
Armando Visconti
6ceffe8a94 drivers/sensor: iis2dlpc: Simplify the switch on trigger type
Simplify the switch case on trigger types (SENSOR_TRIG_DRDY and
SENSOR_TRIG_TAP) inside iis2dlpc_enable_int().

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-18 09:21:00 -06:00
Armando Visconti
d2e8b0cc6e drivers/sensor: iis2dlpc: Move drdy_int info into DT
The IIS2DLPC drdy interrupt can be routed to either INT1 or
INT2 pin. Currently the selection is done by Kconfig configuration.
This commit is instead moving it into Device Tree as 'drdy-int'.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-18 09:21:00 -06:00
Katsuhiro Suzuki
586fa78ea3 drivers: gpio: sifive: use interrupt-cell to set IRQ priority
This patch replace CONFIG_GPIO_SIFIVE_N_PRIORITY into interrupt-cell
of device-tree to set IRQ priority.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-01-16 17:22:08 -05:00
Katsuhiro Suzuki
eb86d1eec1 drivers: serial: sifive: use interrupt-cell to set IRQ priority
This patch replace CONFIG_UART_SIFIVE_PORT_0_IRQ_PRIORITY into
interrupt-cell of device-tree to set IRQ priority.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-01-16 17:22:08 -05:00
Erwan Gouriou
2b0311d903 drivers/serial: stm32: Revert change in uart_irq_rx_ready
In #31192 stm32 uart driver uart_irq_rx/tx_ready functions were
modified to take into account status of irq.
While it seems wlecome for TX (based on uart client's implementation),
this is not correct for RX.
Revert change in uart_stm32_irq_rx_ready function.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-15 13:19:39 -05:00
Mulin Chao
ab199d87da driver: host-subs: replace defined() macro with IS_ENABLED().
Replace marco function, defined(), with IS_ENABLED() in host sub-devices
driver implementation. In this PR, we won't replace the macros which
cause -Wimplicit-function-declaration warning if related configuration
is not enabled or its type is not boolean..

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-01-15 11:39:45 -05:00
Emil Gydesen
69d8b0a0b4 drivers: bluetooth: hci: Add support for ISO packets in rpmsg
This adds supports for ISO packets so then can be transmitted and
received with rpmsg driver.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-01-15 11:39:09 -05:00
Xinrong Han
898b1736b5 drivers: led: ht16k33: fix a typo
Fix a typo to make the LOG_ERR info right.

Signed-off-by: Xinrong Han <hanxr19@mails.tsinghua.edu.cn>
2021-01-15 11:38:39 -05:00
Mulin Chao
1c21ca829b drivers: wdt: add watchdog driver support for NPCX7 series.
In npcx7 series, the Timer and Watchdog module (TWD) generates the
clocks and interrupts used for timing periodic functions in the system.
It also provides watchdog reset signal generation in response to a
failure detection.

The CL also includes:
    — Add npcx watchdog device tree declarations.
    — Zephyr watchdog api implementation.
    — Add Watchdog definitions for npcx7 series in
      tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c for
      supporting test suites.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2021-01-15 11:27:10 -05:00
Tim Lin
981166eb8e drivers/i2c: add i2c driver on it8xxx2 platform
This commit is about the it8xxx2 i2c master driver which
includes six SMBus channels. The enhanced channel i2c3,
i2c4, i2c5 are controller which are designed to support
the I2C protocol.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-01-15 11:22:57 -05:00
Kumar Gala
b09f543673 watchdog: sifive: Remove use of DEVICE_DT_INST_DECLARE
DEVICE_DT_INST_DECLARE is no longer needed and this one case was missed
in the cleanup to remove it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-01-15 10:55:20 -05:00
Erwan Gouriou
dc110506d9 drivers/flash: flash_stm32_qspi: Set DMA as optional
In order to ease reuse on other series, set DMA as optional
and use IT if no DMA channel is specified in the qspi node.

Tested on disco_l475_iot1

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-15 10:29:30 -05:00
Erwan Gouriou
9bfb889088 drivers/flash: stm32: Add qspi-nor flash-controller
Add support for DMA based STM32 QSPI NOR flash controller.
Driver configures both NOR flash and also QSPI hardware block.
Reuses existing jesd216 library.

QSPI hardware block handling is done through the use of Cube HAL API.
This requires the use of HAL interface also for DMA besides zephyr
DMA driver.
Zephyr DMA driver is used only for IRQ routing while HAL driver
handles the IP block. To achieve this it is required to:
-Configure both Cube and Zephyr drivers at init.
-Inform Zephyr driver that current channel handling will be done
by another instance and only a limited configuration should be done.
For this last part, a unused parameter is overridden in order to
transmit the information.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-01-15 10:29:30 -05:00
Erwan Gouriou
d43200e9c4 drivers/dma: stm32: Preparation for QSPI DMA mode support
In preparation for QSPI DMA mode:
-Add a possibility to override driver by the HAL DMA. In that case
stream is set as busy and no configuration nor treatment is done.
In case of interrupt, flags clearing is let to HAL.
-Treat Half Transfer interrupt prior to Transfer Complete for the
cases were both IRQ are both raised at the time IRQ handler is called

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-15 10:29:30 -05:00
Piotr Mienkowski
7b38a5feb9 drivers/clock_control: stm32: Add AHB3 bus support
AHB3 bus support is added for compatible series.
Additionaly, fix condition for AHB2 support and fix
formatting

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2021-01-15 10:29:30 -05:00
Erwin Rol
4cc15d73dd drivers: dmamux: Remove need for kmalloc
Use file static variable for the channel config data, instead
of a dynamic array allocated with kmalloc.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2021-01-15 10:27:43 -05:00
Kumar Gala
02703e60d9 device: Remove DEVICE_DT_DECLARE / DEVICE_DT_INST_DECLARE
Now that we generate a header that extern's all possible devicetree
based device struct we can remove DEVICE_DT_DECLARE and
DEVICE_DT_INST_DECLARE as they aren't needed anymore.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-01-15 07:16:21 -06:00
Emil Lindqvist
09e9736b4b drivers: modem: ublox-sara-r4: remove redundant wait after sendto
According to AT commands manual, no wait after prompt '@'
is required if using AT+USOST commmand (aka. sendto,
only used with UDP).

Signed-off-by: Emil Lindqvist <emil@lindq.gr>
2021-01-15 12:41:25 +02:00
Guillaume Paquet
6e7a2ecf1e drivers: modem: Fix UDP management in BG96 modem
Fix UDP test in connect and send to be able to send in TCP

Signed-off-by: Guillaume Paquet <guillaume.paquet@smile.fr>
2021-01-15 08:45:51 +02:00
Katsuhiro Suzuki
a688b4da73 drivers: watchdog: implement SiFive FE310 watchdog driver
This patch adds watchdog driver for HiFive1 rev.B that has SiFive
Freedom E310 SoC.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-01-14 21:31:05 -06:00
Sylvio Alves
232851a428 xtensa: remove core-macros.h from xtensa HAL
core-macros.h includes other files not part of the xtensa HAL, make this
esp32 specific

Fixes #31301

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-01-14 09:40:08 -05:00
Alexandre Bourdiol
48a60c5315 drivers: flash: stm32h7: compilation issue. Fix typo
REAL_FLASH_SIZE renamed to REAL_FLASH_SIZE_KB

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-01-14 08:11:33 -06:00
Sylvio Alves
57c7dfbbc3 drivers: entropy: esp32: update register call
Update entropy driver to use proper registers

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-01-13 09:10:46 -05:00
Mahavir Jain
29f87c3a0f boards: esp32: add XIP support and enable bootloader build
Disable RTC WDT enabled (by default) by 2nd stage bootloader in ESP-IDF.
This WDT timer ensures correct hand-over and startup sequence from
bootloader to application.

Enabling bootloader caused system clock initialization to fail
when clock rate is greater then 80MHz. This also fixes
esp32 clock source code.

Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2021-01-13 09:10:46 -05:00
Hans Unzner
9bde4c76c3 drivers: stm32: adaption for use with STM32F410RB
-The STM32F410RB has no AHB2 bus so LL_AHB2_GRP1_EnableClock() and
  LL_AHB2_GRP1_DisableClock() should not be called for this soc.
-The interrupt table had to be changed because of no OTG_FS_WKUP_IRQn
  (no USB OTG at all).

Signed-off-by: Hans Unzner <hansunzner@gmail.com>
2021-01-13 09:07:52 -05:00
Andrzej Głąbek
d855d47288 drivers: crypto_nrf_ecb: Convert to use devicetree
Convert the driver so that it creates its instance basing on DT.
Remove no longer needed Kconfig option CRYPTO_NRF_ECB_NAME.
Also update accordingly the crypto sample.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-01-13 12:57:13 +01:00
Mulin Chao
d7976753a8 driver: i2c: fix recovery mechanism in npcx series.
Since the PU power rail of i2c bus might be gone at the initial state
after ec powered up, we might have no chance to get STOP condition. This
is because no i2c transactions occurred before its power rail is
restored. But it's crucial to reset the whole i2c module after i2c bus
is back to the idle state.

The original test suite for i2c recovery mechanism didn't consider this
case that initial i2c bus is low before ec powered on. Hence, this CL
fixed this symptom by:

1. Force i2c modules must proceed 'reset' step no matter we received
   STOP condition or not.
2. Use Boolean for condition check to prevent misusage and meet MISRA.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-01-12 23:30:58 -05:00
Giancarlo Stasi
af4c1cf58e drivers/timer: stm32_lptim: Fix stm32 ll header list
LPTIM stm32 ll header list was not adequate for debug builds.
Add _system.

Signed-off-by: Giancarlo Stasi <giancarlo.stasi.co@gmail.com>
2021-01-12 15:09:16 -06:00
Henrik Brix Andersen
38279ef365 drivers: pwm: mcux_ftm: add PWM capure support
Add PWM capture support to the NXP MCUX FlexTimer driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-01-12 19:43:06 +01:00
Henrik Brix Andersen
77b8440fd1 drivers: pwm: add API for capturing pwm pulse width and period
Extend the PWM API with optional API functions for capturing PWM pulse
width and period cycles.

Fixes #26026.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-01-12 19:43:06 +01:00
Alexander Wachter
d7a5b9f43d drivers: can: flexcan: Fix incorrect timing.
The timing values need to be subtracted by one.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2021-01-12 09:34:45 -06:00
Gerard Marull-Paretas
084c810820 drivers: clock_control: add support for PLL3 on STM32 H7
Add support for enabling and configuring PLL3 on STM32 H7 series. PLL3
is used as a clock source by certain peripherals, e.g. LTDC.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-01-12 06:49:10 -05:00
Gerard Marull-Paretas
3c1ef8852e drivers: clock_control: provide function to compute PLL VCO input range
Provide a utility function to compute PLL VCO input range so that it
can be re-used for other PLLs.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-01-12 06:49:10 -05:00
Alexandre Bourdiol
b6b77312ee drivers: flash: flash_stm32h7x.c: manage bank1/2 discontinuity
When flash is Dualbank and flash size is lower than 512K,
then there is a discontinuity between bank1 and bank2.
Also take into account bank swap capability.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-01-12 06:48:47 -05:00
Erwan Gouriou
37c7b89e43 drivers/serial: stm32: Force oversampling value
When setting baudrate register, baudrate value is computed according
to the oversampling given value, which is default boot time
value (16).
In case oversampling value has been changed by bootloader (as in case
of TFM bootloader), a desynchronsation happens between OVR and BRR
values and the ouptut baudarate is incorrect.
For oversampling register before setting the baudrate to avoid this
situation.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-12 06:48:16 -05:00
Nicolas VINCENT
eb534d39d2 driver: uart stm32: Check irq enabled in API calls
When calling irq_rx_ready or irq_tx_ready API, return the logical AND
between the irq status and the enable of that irq.

Signed-off-by: Nicolas VINCENT <nicolas.vincent@vossloh.com>
2021-01-11 16:55:29 -05:00
Erwan Gouriou
b226f1d446 drivers/dma: stm32: Base Konfig symbols on dts compatible status
In order to simplify the handling of DMA_STM32_V1/V2 and DMAMUX_STM32
symbols, set them directly based on related compatible status.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-11 16:49:39 -05:00
Erwan Gouriou
a214f41992 dts/arm/st: Split "st,stm32-dma" compatible into -v1 and -v2
2 versions of DMA hardware blocks could be found across stm32 series.
In order to simplify the handling of matching Kconfig symbols,
make this visible in dts files by creating "st,stm32-dma-v1" and
"st,stm32-dma-v2" and set them accordingly in dtsi files.

Duplicate and update related bindings to reflect that new state.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-11 16:49:39 -05:00
Guennadi Liakhovetski
bfe9008262 cavs: (cosmetic) clean up and simplification of intc_cavs.c
1. don't use "inline" in .c, let the compiler decide
2. remove superfluous parentheses
3. simplify a function by directly returning the result of a boolean
operation

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-01-11 16:10:23 -05:00
Guennadi Liakhovetski
80f9daab9f cavs: disable all interrupts when configuring interrupt controllers
Some interrupts can be enabled by the ROM, e.g. the timer interrupt.
When then in Zephyr the interrupt controller is enabled, before
individual interrupts are configured, interrupts can arrive and lead
to the spurious interrupt handler being invoked. Fix thid by
disabling all child interrupts when configuring cAVS interrupt
controllers.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-01-11 16:10:23 -05:00
Maciej Kurc
086503abd5 drv: BME280 driver power management
Support for the OFF device power state to the BME280 sensor driver.

Signed-off-by: Maciej Kurc <mkurc1234@gmail.com>
2021-01-11 10:13:26 -06:00
Erwan Gouriou
03dcfeea0a drivers/clock_control: stm32h7: Fix line break on #error
Line break on #error directive is confusing github and ending up
breaking syntax highligthing in github UI which makes me nervous
during review.
Convert error message to a one liner.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-10 18:13:39 -05:00
Krzysztof Chruscinski
f3910fd716 drivers: timer: nrf_rtc_timer: Increase half tick busy wait
Due to clock discrepancy, busy waiting for 15us was not covering for
half tick in certain cases. Busy wait runs from HF clock source.

Increased to 19us to cover it. Anyway, this case is hit very rarely,
only when there was aborted, not-cancelled compare value that was
about to expire. Because of that, increase shall not impact the
performance.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-01-10 18:12:57 -05:00
Aurelien Jarno
35adb6e2c4 drivers: usb_dc_sam: get the maximum speed from DT as enum
For historical reasons, the maximum speed of the Atmel SAM USB
controller is done by comparing the maximum-speed property string from
the DT using strncmp at runtime.

Now that the DT_ENUM_IDX macro exists, we can use it to get the
maximum-speed property at build time and without string comparison.
Unsupported speed can also be reported at build time.

Note that the default speed in case the optional maximum-speed property
isn't present in the DT is changed from full-speed to high-speed to
match the property description. This is a no-op in practice as this
properties is defined at the soc level.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-01-10 18:11:37 -05:00
Karsten Koenig
f06fec0ef7 drivers: can: mcp2515: Remove MCP2515 specifics
CAN_MCP2515_MAX_FILTER is not needed anymore and was probably just a
misunderstanding. Aligned it with the other CAN drivers.
This also was the last difference in the mcp2515 specific config for the
can sample, so that can be deleted as well.

Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
2021-01-10 16:06:47 -05:00
Andrei Gansari
274afd4122 drivers: ipm_mcux: add support for LPC55S69
Adds definitions for LPC55S69 SoC.
Definitions for Core 0 and Core 1.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2021-01-10 15:38:54 -05:00
Attie Grande
78627a5feb usb: stm32: added support for USB Device mode on STM32F105xx parts
The STM32F105xx USB clock goes through a prescaler either PLL1 x2 /2
or PLL1 x2 /3, the output of this must be 48 MHz. As such, the output
of PLL1 must be 48 MHz or 72 MHz.

NOTE: This requires that the system is running from PLL1 (PLLCLK).
      Support for running from PLL2 will be implemented in the future.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2021-01-10 12:42:40 -05:00
Julien D'Ascenzio
f1963dd599 drivers: can: stm32: fix bus-speed
Set the prescaler in register BTR according to the configured bitrate in DTS.
This bug appeared in commit 8b6c1bd4b7

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2021-01-10 11:09:37 -05:00
Peter Andersson
71b3ce259f ipm: Fixed linker error in drivers/ipm/ipm_handlers.c
```
/home/humanentity/zephyr/drivers/ipm/ipm_handlers.c:23: undefined reference to 'z_impl_max_data_size_get'
```

The error shows when having CONFIG_BT=y and CONFIG_USERSPACE=y, and
is easily reproduced by adding
```C
CONFIG_USERSPACE=y
```
to `samples/bluetooth/peripheral/prj.conf` and building the sample.
E.g.
```
$ west build -p auto -b nrf5340pdk_nrf5340_cpuapp samples/bluetooth/peripheral
```

Signed-off-by: Peter Andersson <pelleplutt1976@gmail.com>
2021-01-10 11:08:38 -05:00
Peter Bigot
70ac3387ce drivers: gpio_ite_it8xxx2: fix use of uninitialized variable
Retain the assumption that the loop will assign a pointer, but
initialize it pointer first to eliminate build warnings.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-09 15:14:50 -06:00
Armando Visconti
34a677d05a drivers/sensor: iis2dlpc: Move power Kconfig property into dts
Move iis2dlpc power-mode option from Kconfigs to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-08 09:16:35 -06:00
Armando Visconti
e9b93f99a5 drivers/sensor: iis2dlpc: Remove odr values from Kconfig
Remove all odr values from Kconfig and always init it
at 12.5Hz. It is responsibility of application to set
the rate to a different value using SENSOR_ATTR_SAMPLING_FREQUENCY.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-08 09:16:35 -06:00
Armando Visconti
e8bbcb9284 drivers/sensor: iis2dlpc: Move range Kconfig property into dts
Converts iis2dlpc range options (2g, 4g, 8g, 16g) from Kconfigs
to Device Tree.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-08 09:16:35 -06:00
Erik Robstad
1feb49fd22 drivers: Dev. spec. PWM functionality for SX1509B
Add device specific functions for initiating
and controlling PWM output pins.

Signed-off-by: Erik Robstad <erik.robstad@nordicsemi.no>
2021-01-08 15:52:42 +01:00
Thomas Stranger
4ed375040e drivers: adc: stm32: add support for stm32g0 series
Adds support for ADC on G0 series.
Simple implementation: sequencer not fully configurable,
and only one common sampling time.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-01-07 15:50:22 -06:00
Lingao Meng
8b54f08a69 drivers: bluetooth: Add discard mechanism to avoid waiting timeout
The Bluetooth receiving thread may not be able to process broadcast
packets because the system API(bt_hci_cmd_send_sync) is in block state.
If HCI driver is still waiting buffer for adv report, an assertion will
be triggered.

Fixes: #30955

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-01-07 14:44:13 +02:00
Akseli Peltola
3bcb1efc33 modem: fix socket descriptor leak
z_free_fd() is called twice then you close(). For example in ublox sara
r4 driver offload_close() calls modem_socket_put() where z_free_fd() is
called first time. Then this same function is called another time in
socket.c in z_impl_zsock_close() after this function has called
offload_close() in ublox sara r4 driver. This causes socket
descriptor leak.

Fixes #26819

Signed-off-by: Akseli Peltola <peltsu1324@gmail.com>
2021-01-07 10:36:19 +02:00
Peter Bigot
b34d055926 drivers: flash: spi_nor: correct log message
Flash size is specified in bits by SFDP and devicetree, but the stored
flash size is in bytes.  Correct the divisor.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-06 16:01:04 -06:00
Frank Li
e80506b754 drivers: video: ov7725: add sensor driver for ov7725
This patch adds the driver for Omnivision OV7725
Color CMOS VGA Sensor.

The driver currently provides a simple capture
function, the output format only provides
RGB565,640x480.

Signed-off-by: Frank Li <lgl88911@163.com>
2021-01-06 08:33:38 -06:00
Francois Ramu
d695746ee6 soc: arm: stm32g4 add rtc feature on this serie
This patch enables the rtc clock on the stm32g4 soc
from STMicroelectronics.
Even if the set by default (reset value of theRCC_APB1ENR)
the bit is marked as 1.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-01-06 08:09:47 -06:00
Francois Ramu
f3c681166b drivers: clock_control: stm32g0 soc enables the PWR clock
After system reset, the PWR interface clock must be enabled
by setting the PWREN bit of the RCC_APBENR1
This sequence is needed to use the RTC.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-01-06 08:09:47 -06:00
Francois Ramu
c86aefd3bb drivers: counter: rtc for stm32g0 soc series
This patch set the EXTI line 19 as the RTC
on the stm32g0x serie from STMicroelectronics.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-01-06 08:09:47 -06:00
Daniel Leung
afefcd118f neural_net: intel_gna: convert driver to use device-tree
This converts the intel_gna driver to use device tree instead of
kconfig for device configuration.

Fixes #30872

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-01-06 05:59:21 -06:00
Kumar Gala
4dd143f26f driver: i2c: npcx: Convert drivers to new DT device macros
Convert i2c npcx drivers from:

DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
DEVICE_GET -> DEVICE_DT_GET

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-01-05 13:19:32 -06:00
Daniel Leung
e36ef3e302 audio: intel_dmic: convert to use devicetree
This converts the intel_dmic driver to use devicetree.

Fixes #30870

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-01-05 12:08:51 -06:00
Xavier Naveira
bb18fa0b35 drivers: sensor: adxl362: make time configurable via KConfig
The thresholds for activity/inactivity in the adxl362 acceleromter have
two parameters that can be configured. Currently the threshold is
configurable via the KConfig variables CONFIG_ADXL362_ACTIVITY_THRESHOLD
and CONFIG_ADXL362_INACTIVITY_THRESHOLD which configure repectively the
value in the THRESH_ACT and THRESH_INACT registers.
The other parameter that can be configured is the time by changing the
values in the registers TIME_ACT and TIME_INACT, but this values are
hardcoded to 1 (see lines 653 and 675 in adxl362.c), this patch adds
support for configuring those values in KConfig as
CONFIG_ADXL362_ACTIVITY_TIME and CONFIG_ADXL362_INACTIVITY_TIME.

Signed-off-by: Xavier Naveira <xnaveira@gmail.com>
2021-01-04 09:57:14 -06:00
Marek Pieta
f5a38cb5be drivers: usb_dc_nrfx: Use mem_slab for fifo elements
mem_slab can be used instead of heap, because all allocated
elements have the same size.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-01-04 16:26:02 +01:00
Marek Pieta
5dbca81f1a drivers: usb_dc_nrfx: Use static memory for out endpoints
Change switches to using static memory for out endpoints. Using
heap is not necessary, because number of out endpoints is defined
in DTS.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-01-04 16:26:02 +01:00
Fabio Baltieri
3cc5ae6405 drivers: display: add inversion support for ili9xxx displays
Add a new display-inversion property to ili9xxx based display drivers to
send a "Display Inversion ON (0x21)" command during initialization.

This seems to be required for some ILI9xxx based displays to work
correctly, such as BuyDisplay ER-TFT028A2-4 (ILI9341 basd IPS display).

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-01-04 16:24:06 +01:00
Jordan Yates
8e2b2fe595 serial: CONFIG_USB_CDC_ACM adds file to library
It is possible to use the UART abstraction for USB communications
without any of the dedicated UART drivers being enabled. This currently
causes a compilation error because CMake throws an error if a library
has no sources. The empty file forces there to be at least one file in
the library when `CONFIG_USB_CDC_ACM` is enabled.

Removing `select CONFIG_SERIAL_HAS_DRIVER` from `CONFIG_USB_CDC_ACM` is
not a valid solution as this symbol is required by `CONFIG_UART_CONSOLE`
and therefore `USB_UART_CONSOLE`.

Fixes #31067.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-01-04 16:20:43 +01:00
Peter Bigot
26927fcc2c gpio: esp32: retrieve pinmux from devicetree reference
Need to declare the device before the pointer can be obtained, and to
validate the device before trying to use it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-27 18:19:27 +01:00
Andy Ross
c2c6bee036 drivers/timer: Remove legacy APIC driver
For a while now, we've had two APIC drivers.  The older was preserved
initially as the new (much smaller, "new style") code didn't have
support for Quark interrupt handling.  But that's long dead now.  Just
remove it.

Note that this migrates the one board using this driver (acrn) to
CONFIG_APIC_TIMER instead.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-27 18:19:17 +01:00
Christopher Friedt
c0a2e41a75 gpio: emul: support configurable interrupt capabilities
This change adds support for configurable interrupt capabilities
in the emulated GPIO controller via Devicetree bindings.

Fixes #26477

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-12-27 18:15:33 +01:00
Christopher Friedt
724ee49173 gpio: add driver for emulated GPIO
The emulated GPIO controller will aid in automated
integration testing.

Fixes #26477

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-12-27 18:15:33 +01:00
Mulin Chao
f3ea7f5819 driver: i2c: add i2c support in npcx series.
The NPCX SMB modules provides full support for a two-wire SMBus/I2C
synchronous serial interface. Each SMBus/I2C interface is a two-wire
serial interface that is compatible with both Intel SMBus and Philips
I2C physical layer. There are 8 SMBus modules and 10 buses in NPCX7
series.

In NPCX7 series, the SMB5 and SMB6 modules contain a two-way switch to
support two separate SMBus/I2C buses (ports) with one SMB module
(controller) Please refer Section 4.7.2 in the datasheet. In order to
support it, this CL seperates the i2c driver into port and controller
drivers. The controller driver is in charge of i2c module operations
and internal state machine. The port driver is in charge of pin-mux
and connection between Zehpyr i2c api interface and controller driver.

All of modules have separate 32-byte transmit FIFO and 32-byte receive
FIFO buffers. These FIFO buffers reduce firmware overhead during long
SMBus transactions by allowing the Core to write or read more than one
data byte at a time to/from the SMB module.

The CL also includes:
— Add npcx i2c port/controller device tree declarations.
— Zephyr i2c api implementation.
— Add "i2c-0" aliases in npcx7m6fb.dts for i2c test suites.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-12-27 18:15:14 +01:00
Mulin Chao
e258690655 driver: npcx: add glue module support in npcx series.
The System Glue module includes the three major functions:
— Power Switch Logic (PSL)
— SMBus multi-bus, wake-up support
— Simple Debug Port (SDP)

In NPCX7 series, the SMB5 and SMB6 modules contain a two-way switch to
support two separate SMBus/I2C buses (ports) with one SMB module
(controller). Since a single SMB module is able to serve only one
SMBus/I2C bus at a time, SMB_SEL registerin Glue module is used to
control theconnection of I2Cn_0 and I2Cn_1 interface pins to the SMBn
module (where n is 5, 6).

This CL provides a soc specific pin-control function called
"soc_pinctrl_i2c_port_sel" to switch buses (port) of the same SMB module
(controller). It will be used in the following i2c driver.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-12-27 18:15:14 +01:00
Daniel Leung
cc9b64080a pwm: convert Synopsys DesignWare PWM to use devicetree
This converts the Designware PWM driver to use devicetree
for device information.

Fixes #30869

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-12-20 13:32:15 -05:00
Mulin Chao
fa7843d12c driver: espi: add notification and opcodes for ec host command support.
This CL add a new notification event, ESPI_PERIPHERAL_EC_HOST_CMD, and
two response opcodes, ECUSTOM_HOST_CMD_GET_PARAM_MEMORY and
ECUSTOM_HOST_CMD_SEND_RESULT, to connect with host command sub-system
between host and ec.

It also introduced three configurations to increase the flexibility of
ec host command settings:
1. ESPI_PERIPHERAL_HOST_CMD_DATA_PORT_NUM:
   Host I/O peripheral port number for ec host command data. The default
   value is 0x0200.
2. ESPI_PERIPHERAL_HOST_CMD_PARAM_PORT_NUM:
   Host I/O peripheral port number for ec host command parameters. The
   default value is 0x0800.

3. ESPI_NPCX_PERIPHERAL_HOST_CMD_PARAM_SIZE:
   Host I/O peripheral port size for ec host command in npcx series. The
   valid value in npcx ec series for this option is
   8/16/32/64/128/256/512/1024/2048/4096 bytes. The default value is 256
   bytes.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2020-12-20 13:05:50 -05:00
Mulin Chao
988a7a4826 driver: espi: add acpi and customized op codes for lpc r/w request func.
This CL introduces two kinds of op codes for espi_api_lpc_read_request
and espi_api_lpc_write_request Zephyr espi api functions.

One is for supporting ACPI and shared memory region to access ACPI data.
The other is customized for certain platforms such as Chromebook and so
on.

This CL also introduced the following configurations to add the
flexibility of these settings.

1. ESPI_PERIPHERAL_ACPI_SHM_REGION_PORT_NUM:
   Host I/O peripheral port number for shared memory region. The default
   value is default 0x0900

2. ESPI_NPCX_PERIPHERAL_ACPI_SHD_MEM_SIZE:
   Host I/O peripheral port size for shared memory in npcx series.
   Please notice the valid value in npcx ec series for this option is
   8/16/32/64/128/256/512/1024/2048/4096 bytes. The default value is 256
   bytes.

This CL also turn off hardware-wire feature which generates VW events
that connected to hardware signals such as SMI and SCI. We will set
VW output events directly via espi_api_send_vwire() api function.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2020-12-20 13:05:50 -05:00
Puranjay Mohan
d31ed3be04 drivers: sensor: tmp116: Add support for SENSOR_ATTR_OFFSET.
TMP117 from TI is a sensor similar to tmp116, but it has more precision
and it also supports the offset register.
Add support for SENSOR_ATTR_OFFSET, which is used by TMP117 to the
pre-exisiting tmp116 driver.

This commit also enables multiple instances and adds TMP117 to Kconfig.

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
2020-12-20 13:02:21 -05:00
Shlomi Vaknin
cad96852a2 drivers: dma: stm32: add get_status to dmamux driver
Add `get_status` function to dmamux driver api.
This uses the regular dma driver `get_status` function.

Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
2020-12-20 13:00:46 -05:00
Martin Jäger
6181184163 drivers: flash: stm32g4x: fix LOG_ERR compiler warning
off_t can be 32-bit or 64-bit depending on the platform. STM32 flash
addresses are always 32-bit so it's safe to use long here.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-12-20 12:40:19 -05:00
Peter Bigot
d03dbab105 drivers: led: fix led_pwm initialization
The PM control function and the init function were swapped.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-20 10:30:29 -06:00
Kumar Gala
609844d56e drivers: pinmux: Convert drivers to new DT device macros
Convert pinmux drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT{_INST}_DEFINE

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:06:45 -05:00
Kumar Gala
2d754333ad drivers: interrupt_controller: Convert drivers to new DT device macros
Convert interrupt_controller drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

etc...

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:06:25 -05:00
Kumar Gala
078368efcf drivers: dma: pl330: Convert drivers to new DT device macros
Convert dma pl330 driver from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_NAME_GET -> DEVICE_DT_INST_DECLARE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:05:14 -05:00
Kumar Gala
673a81eabb pinmux: Convert drivers to be devicetree based
Convert drivers to use pinmux devicetree node to create pinmux device
object.

On intel S1000 we add 'label' as a required property and set it to
'PINMUX' to match CONFIG_PINMUX_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:04:23 -05:00
Kumar Gala
c5582358f6 drivers: dma: Convert drivers to new DT device macros
Convert dma drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:03:23 -05:00
Kumar Gala
85518d177e drivers: kscan: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:02:19 -05:00
Kumar Gala
50b52279e9 drivers: crypto: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:01:58 -05:00
Kumar Gala
ce6088380f drivers: ethernet: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:01:24 -05:00
Kumar Gala
e2268e1ac4 drivers: ieee802154: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert drivers to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:01:06 -05:00
Kumar Gala
19ecf1f19f drivers: video: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:00:43 -05:00
Kumar Gala
e23238da1a drivers: counter: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:00:23 -05:00
Kumar Gala
c372f4ef7d drivers: pwm: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:00:00 -05:00
Kumar Gala
8d96e8741b drivers: pinmux: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 19:59:41 -05:00
Kumar Gala
14d5c2fa8f drivers: serial: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 19:59:21 -05:00
Kumar Gala
f062fbe856 drivers: serial: uart_lpc11u6x: Convert drivers to new DT device macros
Convert uart_lpc11u6x drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
    DEVICE_GET -> DEVICE_DT_GET

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 19:58:33 -05:00
Kumar Gala
92d62cd839 drivers: flash: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert soc nios2 qspi to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 19:57:52 -05:00
Kumar Gala
37e30726c8 drivers: dma: nios2_msgdma: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 12:19:35 -05:00
Kumar Gala
437e168ed4 drivers: neural_net: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert intel gna driver to DEVICE_DEFINE instead of
DEVICE_AND_API_INIT so we can deprecate DEVICE_AND_API_INIT in the
future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 12:19:12 -05:00
Kumar Gala
d59b4a2aaf drivers: ipm: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert NRFx IPC to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 12:18:49 -05:00
Kumar Gala
f3cb1c9c3d drivers: clock_control: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 04:53:45 -06:00
Kumar Gala
e1c47a9bb7 drivers: led: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert LED PWM driver to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 04:53:13 -06:00
Kumar Gala
03a1d04c84 drivers: display: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 13:25:46 -06:00
Kumar Gala
5ab2e4acdd drivers: can: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 13:25:34 -06:00
Kumar Gala
a6800aa9f5 drivers: console: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 13:25:22 -06:00
Daniel Leung
0d4dbfc4ad drivers: i2s_cavs: convert to use device tree
This converts the i2s_cavs driver to use device tree
instead of kconfig for device configuration.

Fixes #30750

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-12-18 09:29:20 -05:00
Kumar Gala
463d028a53 drivers: i2c: eeprom: Convert drivers to new DT device macros
Convert i2c slave eeprom driver from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 08:01:59 -06:00
Kumar Gala
727932fd51 drivers: ipm: cavs_idc: Convert drivers to new DT device macros
Convert ipm cavs_idc driver from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 08:01:59 -06:00
Kumar Gala
d31e4b3d27 drivers: gpio: ite_it8xxx2: Convert drivers to new DT device macros
Convert gpio ite_it8xxx2 driver from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 08:01:59 -06:00
Kumar Gala
6efb17a821 drivers: ieee802154: Convert drivers to new DT device macros
Convert ieee802154 drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    NET_DEVICE_INIT -> NET_DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 07:59:07 -06:00
Kumar Gala
0519a6a0e7 drivers: can: Convert drivers to new DT device macros
Convert CAN drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 07:58:23 -06:00
Kumar Gala
7c699348a8 drivers: dma: mcux_edma: Convert drivers to new DT device macros
Convert dma mcux_edma driver from:

    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 07:54:48 -06:00
Kumar Gala
1b40faef7a drivers: memc: Convert drivers to new DT device macros
Convert memc drivers from:

    DEVICE_DEFINE -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 07:53:15 -06:00
Kumar Gala
80b4ec0ee1 drivers: pinmux: pinmux_mcux: Remove Kconfig options
We now get the specific port and name from devicetree so remove the
Kconfig options.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 07:52:52 -06:00
Kumar Gala
c9aa36ff39 drivers: pinmux: pinmux_mcux: Convert to devicetree
Use a similar model to the pinmux_rv32m1 driver for kinetis pinmux
driver.  We handle one subtle difference between clock on the KE1xF v
other SoCs.

As the Kconfig and devicetree label names are the same we maintain the
Kconfig options in the driver until all board users are converted over
to use devicetree instead of Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 07:52:52 -06:00
Dan Kalowsky
553a6e34a8 drivers: i2c_dw: add 4 additional ports
Add an additional 4 ports for upcoming Arm based server that will have a
total of 12 I2C ports.

Similar to the original 8 ports, these additional 4 ports will not be
enabled unless specified at configuration time.

Signed-off-by: Dan Kalowsky <dkalowsky@amperecomputing.com>
2020-12-17 21:52:41 -06:00
Kumar Gala
ae9e086802 drivers: ethernet: Convert drivers to new DT device macros
Convert ethernet drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE
    ETH_NET_DEVICE_INIT -> ETH_NET_DEVICE_DT_INST_DEFINE
    NET_DEVICE_INIT -> NET_DEVICE_DT_INST_DEFINE

etc...

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-17 11:02:11 -06:00
Martin Jäger
d6648b6124 drivers: pwm: stm32: add support for L0 series
The STM32L0 series MCUs have quite basic timer features only, so we
remove some unavailable configuration options. They were properly
initilized by the LL StructInit functions for other MCUs anyway.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-12-17 10:25:34 -05:00
Henrik Brix Andersen
a3629990ea drivers: sensor: add NXP MCUX ACMP driver
Add driver for the NXP MCUX Analog Comparator (ACMP) IP.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-12-17 08:54:33 -06:00
Kumar Gala
8e55cfab96 drivers: i2s: Convert drivers to new DT device macros
Convert i2s drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT{_INST}_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-17 09:21:02 -05:00
Kumar Gala
c6f1fc6171 drivers: audio: Convert drivers to new DT device macros
Convert audio drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-17 09:21:02 -05:00
Peng Fan
4deba2616c drivers: interrupt_controller: make GICv3 work for NS-EL1
Configure SPIs/SGI1 as NS interrupt
Enable ARE_NS, G1NS

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-12-17 08:08:00 -05:00
Volodymyr Babchuk
35efb15637 arch: arm: timer: mask interrupt in ISR
As timer interrupt is level triggered, we need to mask it before leaving
ISR or it will be delivered again.

Also, Xen automatically masks timer interrupt when it injects IRQ to
a guest, so we need to unmask it again, when setting new timeout.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-12-17 08:08:00 -05:00
Rajavardhan Gundi
af2ba71e18 drivers: i2c_mchp_xec: fix incorrect timeout value
Use WAIT_COUNT instead of TIME_OUT.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2020-12-17 08:06:39 -05:00
Marcin Niestroj
b2b8554da8 drivers: wifi: esp: deduplicate RX data processing
Deduplicate final part of RX data processing for two supported cases:
passive (+CIPRECVDATA) and non-passive (+IPD). Move implementation to
esp_socket module, as this is strictly related to socket.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-17 14:38:02 +02:00
Marcin Niestroj
1886d8c835 drivers: wifi: esp: rework +IPD handling
Split +IPD message handling into smaller logical functions, so it is
much easier to follow code and further improve it. Make sure to do as
much parsing work as possible, before accessing esp_socket object. This
will allow to introduce thread-safety locking just in the critical parts
in subsequent commits.

Prefer early return from function over goto to return instruction,
whenever cleanup code is not needed.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-17 14:38:02 +02:00
Marcin Niestroj
d60bd57cb3 drivers: wifi: esp: rework +CIPRECVDATA handling
Current on_cmd_ciprecvdata handler is a bit overwhelming to follow.

Add a cmd_ciprecvdata_parse() helper, which is responsible only for
parsing received metadata (message offset and length), leaving socket
instance untouched.

Consume received payload later on, just after verifying that socket is
in valid state.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-17 14:38:02 +02:00
Alexander Wachter
f6ef508f6f tests: drivers: can: timing
Added tests for the timing algorithm.
The tests calculate timings for some bitrates with sample-points
and verify the results.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-12-17 11:07:53 +01:00
Alexander Wachter
b6ec3cb59e drivers: can: Compile time check of can timing not set
Check if the timing is not set from device tree and exclude
sample-point algorithm if it is not used from device-tree.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-12-17 11:07:53 +01:00
Alexander Wachter
05275ecf6e drivers: can: rework zcan_frame and zcan_filter
Reordering of the struct elements to match the Linux format.
The __packed() is not necessary anymore.
std_id and ext_id is merged to id in the frame and filter.
Additionally, the frames are ready for CAN-FD.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-12-17 11:07:53 +01:00
Alexander Wachter
8b6c1bd4b7 drivers: can: Rework can_configure API
The previous API can't change the sampling-point and only allowed
bitrates that fit the time segments.
The new API allows for shifting the sampling-point and adjusts the
number of time quantum in a bit to all more possible bitrates.
The functions to calculate the timings are moved to the can_common file.
They can be used for all drivers.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-12-17 11:07:53 +01:00
Marcin Niestroj
caa35d1a3a drivers: wifi: esp: don't queue send after socket connect
After a synchronous (timeout > 0) connection attempt was made, it was
being checked if there is some packet to be sent. If positive, then a
send work was queued.

This behavior makes little sense, as TCP connection is not even
considered established at this point (from net_context perspective) if
function has not returned yet. Additionally it differs from
asynchronous (timeout == 0) connection attempt. In case of UDP (and
calling esp_connect() from esp_sendto()) sock->tx_pkt is assured to be
NULL. Drop this piece of code as it doesn't seem to be justified.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-17 11:42:51 +02:00
Marcin Niestroj
1814e2c8f1 drivers: wifi: esp: unify log level
2 (out of 3) components used CONFIG_WIFI_LOG_LEVEL, while the last one
didn't specify explicit log level. Always use CONFIG_WIFI_LOG_LEVEL in
all components.

While at it switch to LOG_MODULE_REGISTER(<module>, <log_level>), which
is a more compact way to define log level.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-17 11:42:32 +02:00
Marcin Niestroj
add649adcd drivers: wifi: esp: calculate size of each command buffer
Calculate size based on the real message, instead of assuming some
arbitrary size. This consumes slightly less stack space, but more
importantly gives an idea what has been taken into account when
calculating the size.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-17 11:42:16 +02:00
Marcin Niestroj
dd8aade16d drivers: wifi: esp: drop unused esp_socket members
No reason to occupy RAM if there is no use of stored information.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-17 11:41:56 +02:00
Marcin Niestroj
bef25cd97d drivers: wifi: esp: support 32-bit length in +IPD
+IPD,<sock>,<bytes_avail> command in passive mode notifies about ESP
internal buffer usage level. Hence value of <bytes_avail> can exceed
4 digit value, which currently results in failure.

+IPD message is used in driver only for scheduling AT+CIPRECVDATA
command and actual value of <bytes_avail> doesn't really
matter. Increase maximum supported value that can be received from
9999 (maximum 4 digits) to 4294967295, which is maximum value of 32-bit
unsigned integer.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-17 11:41:26 +02:00
Kumar Gala
8893ad55db drivers: ipm: Convert drivers to new DT device macros
Convert ipm drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 18:48:33 -05:00
Tomasz Bursztyka
4ee5101021 drivers/virtualization: Make ivshmem driver userspace ready
Exposing its public API to userspace.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-16 18:47:35 -05:00
Tomasz Bursztyka
899fb1af16 drivers/virtualization: Add a shell module for the ivshmem driver
This easily permits to test ivshmem and basic functionality of a custom
protocol passing through.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-16 18:47:35 -05:00
Tomasz Bursztyka
d48d5d6147 drivers/virtualization: Add doorbell support for ivshmem driver
This basically adds support for an interrupt based ivshmem variant
called "ivshmem-doorbell".

This allows, via MSI-X, to get multiple vectors for notifications, get
assigned and ID and being able to send a message to another ID (another
VM).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-16 18:47:35 -05:00
Tomasz Bursztyka
d11f2f184d drivers/virtualization: Adding ivshmem driver
This is placed into drivers/virtualization as it does not belong to any
existing subsystem.

This is only the ivshmem-plain variant.

This device is provided by qemu or ACRN, and can be used to share memory
either between the host and the VM or between VMs. Here if zephyr is
used as a VM, it will be able to take advantage of such feature.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-16 18:47:35 -05:00
Peter Bigot
96fa707e0c Revert "drivers: move eeprom_slave driver to tests directory"
This reverts commit cabbd916cf.

This is considered to be useful enough that it should be restored
as a stable Zephyr API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-16 16:39:49 -05:00
Kumar Gala
20689c17d4 drivers: clock_control: stm32: Convert drivers to new DT device macros
Convert clock_control drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE

As part of this we also changed STM32_CLOCK_CONTROL_NAME to be based on
devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 15:23:39 -06:00
Kumar Gala
57a402cd0a drivers: clock_control: Convert drivers to new DT device macros
Convert clock_control drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT{_INST}_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 15:23:39 -06:00
Kumar Gala
d1cc8357d8 drivers: pcie: Convert drivers to new DT device macros
Convert pcie drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 13:51:53 -05:00
Kumar Gala
725aa46922 drivers: kscan: Convert drivers to new DT device macros
Convert kscan drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 13:51:53 -05:00
Kumar Gala
a4c4999254 drivers: crypto: Convert drivers to new DT device macros
Convert crypto drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 13:51:53 -05:00
Rajavardhan Gundi
f387c59ad5 drivers: espi_mchp_xec: Implement support for flash erase
Flash erase is required to be done before doing flash write.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2020-12-16 13:51:12 -05:00
Rajavardhan Gundi
3f13487753 drivers: i2c_mchp_xec: changes to address i2c failure
The i2c controller reset sequence is revamped to address
i2c failures which require a reset. Also, more time is
given for i2c slave device to read data by waiting longer.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2020-12-16 12:51:05 -05:00
Kumar Gala
5f605fd5ab drivers: sensor: Convert drivers to new DT device macros
Convert sensor drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 12:19:32 -05:00
Kumar Gala
b3939b651e drivers: eeprom: Convert drivers to new DT device macros
Convert eeprom drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 12:18:59 -05:00
Kumar Gala
f3a33b4fdc drivers: video: Convert drivers to new DT device macros
Convert video drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 12:18:02 -05:00
Kumar Gala
bdb773c1c4 drivers: display: Convert drivers to new DT device macros
Convert display drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_DEFINE -> DEVICE_DT_INST_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 12:18:02 -05:00
Kumar Gala
e03181a981 drivers: led_strip: Convert drivers to new DT device macros
Convert led_strip drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-16 11:10:08 -06:00
Andrew Boie
d2ad783a97 mmu: rename z_mem_map to z_phys_map
Renamed to make its semantics clearer; this function maps
*physical* memory addresses and is not equivalent to
posix mmap(), which might confuse people.

mem_map test case remains the same name as other memory
mapping scenarios will be added in the fullness of time.

Parameter names to z_phys_map adjusted slightly to be more
consistent with names used in other memory mapping functions.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-12-16 08:55:55 -05:00
Cheryl Su
da1b3c39c5 drivers/pinmux: it8xxx2 pinmux driver
This driver is setting the it8xxx2 register GCR1-15.
It's for selecting the pin function.
User would set pin at pinmux.c (under board/).

Signed-off-by: Cheryl Su <Cheryl.su@ite.com.tw>
2020-12-16 08:47:36 -05:00
Cheryl Su
df6125f70d drivers/timer: it8xxx2 platform driver/timer
This commit is about the it8xxx2 timer driver.

We use the timer 5 as system timer for count time,
so the timer interrupt is trigged by it.

Signed-off-by: Cheryl Su <cheryl.su@ite.com.tw>
2020-12-16 08:47:36 -05:00
Cheryl Su
362eb1cdff drivers/interrupt: it8xxx2 driver interrupt-control
This commit is about platform it8xxx2 interrupt.
The interrupt irqs should reference the datasheet.

Signed-off-by: Cheryl Su <cheryl.su@ite.com.tw>
2020-12-16 08:47:36 -05:00
Cheryl Su
6804e8ff40 drivers/gpio: it8xxx2 platform gpio driver
This commit is about platform it8xxx2 gpio.
The devicetree use key and led as example.
Users can change it to meet their needs.

Signed-off-by: Cheryl Su <Cheryl.su@ite.com.tw>
2020-12-16 08:47:36 -05:00
Kumar Gala
93c6e1d2f6 drivers: counter: Convert drivers to new DT device macros
Convert counter drivers to use new DT variants of the DEVICE APIs.
    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
    DEVICE_GET -> DEVICE_DT_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 18:30:06 -05:00
Kumar Gala
c17b6a2584 drivers: flash: Convert drivers to new DT device macros
Convert flash drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
    DEVICE_DEFINE -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 18:29:51 -05:00
Kumar Gala
f9e2c6fa8e drivers: led: Convert drivers to new DT device macros
Convert led drivers to use new DT variants of the DEVICE APIs.
    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:58:00 -06:00
Kumar Gala
c49b162214 drivers: uart: Convert drivers to new DT device macros
Convert uart drivers from:

	DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
	DEVICE_GET -> DEVICE_DT_INST_GET
	DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:28:49 -06:00
Kumar Gala
055a01b962 drivers: ps2: Convert drivers to new DT device macros
Convert ps2 drivers to use new DT variants of the DEVICE APIs.
    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
    DEVICE_GET -> DEVICE_DT_GET

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:17:59 -06:00
Kumar Gala
640437003f drivers: peci: Convert drivers to new DT device macros
Convert peci drivers from:

	DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:17:59 -06:00
Kumar Gala
3dfcdd81e1 drivers: espi: Convert drivers to new DT device macros
Convert espi drivers to use new DT variants of the DEVICE APIs.
    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
    DEVICE_GET -> DEVICE_DT_GET

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:17:59 -06:00
Kumar Gala
c8fd75ba29 drivers: ec_host_cmd_periph: Convert drivers to new DT device macros
Convert ec_host_cmd_periph drivers from:

	DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:17:59 -06:00
Kumar Gala
f19e36f4a6 drivers: lora: Convert drivers to new DT device macros
Convert lora drivers from:

        DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:17:59 -06:00
Marcin Niestroj
bc5a6164c9 drivers: pwm: nrf_sw: support generating PWM based on RTC
So far nRF's TIMER was used for generating PWM signal. Add support for
generating PWM based on RTC, which is sourced by 32KHz low frequency
crystal. This allows to use low frequency PWM with much lower power
consumption, because high frequency clock path can be disabled.

Don't support RTC clock prescaler, because maximum 512s period covers
most use cases. This allows to adjust pulse and period cycles to the
fact that CLEAR task event is generated always one LFCLK cycle after
period COMPARE value is reached.

Also update hal_nordic revision, as it contains updated check for PPI
channels conflict when RTC is used to generate PWM.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-15 15:19:43 +01:00
Marcin Niestroj
0d58960abb drivers: pwm: nrf_sw: convert to timer phandle instead instance number
So far 'timer-instance' DT property was the way to configure TIMER which
was used for generating PWM signal. Replace that by using 'generator'
phandle, so we get prepared for supporting RTC instances as PWM signal
generator.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-15 15:19:43 +01:00
Marcin Niestroj
4f868cd9fa drivers: pwm: nrf_sw: drop broken runtime timer clock scaling
There is some kind of runtime clock scaling implemented when period
cycles exceed 16-bit value. This is broken, because configured PWM has
far higher frequency in that case. Replace that mechanism with simply
veryfying if requested PWM period does not exceed 16-bit value.

Suggested-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-15 15:19:43 +01:00
Kumar Gala
6808d29baf drivers: dac: Convert drivers to new DT device macros
Convert dac drivers from:

        DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 08:04:04 -06:00
Peter Bigot
54d8c40340 drivers: video_common: fix build errors on mimxrt1064_evk
Add a missing keyword in a variable declaration and correct the type
in a missed declaration.  Also use a more appropriate upper bound in a
loop.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-15 11:22:22 +01:00
Puranjay Mohan
acfb2ace1d drivers: sensor: tmp116: Correct dev_name to tmp116
The dev_name field in DEVICE_AND_API_INIT() call should match the
driver's name. Tmp116 driver had a wrong dev_name field.

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
2020-12-15 11:21:04 +01:00
Peter Bigot
c70cc93833 drivers: i2c_gecko: refactor to unify device definition
Switch to iterated definition based on indexes.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-15 11:19:26 +01:00
Marcin Niestroj
94be9b387a drivers: pwm: nrf_sw: use Nordic HAL to configure GPIO
Use Nordic HAL to configure GPIO output. This adds support for P1 GPIOs,
when pin numbers above 31 are used.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-14 20:23:43 -05:00
Marcin Niestroj
1b680c8234 drivers: modem: wncm14a2a: set NET_CONTEXT_CONNECTED state
Set NET_CONTEXT_CONNECTED when stream socket got connected. This fixes
TCP connection when using wncm14a2a modem driver, which got broken after
sockets layer started to validate net_context connection state before
allowing to receive any data.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-14 18:15:49 +02:00
Marcin Niestroj
27b268f350 drivers: wifi: eswifi: set NET_CONTEXT_CONNECTED state
Set NET_CONTEXT_CONNECTED when stream socket got connected. This fixes
TCP connection when using eswifi WiFi driver, which got broken after
sockets layer started to validate net_context connection state before
allowing to receive any data.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-14 18:15:49 +02:00
Marcin Niestroj
65dd0f47ed drivers: wifi: winc1500: set NET_CONTEXT_CONNECTED state
Set NET_CONTEXT_CONNECTED when stream socket got connected. This fixes
TCP connection when using winc1500 WiFi driver, which got broken after
sockets layer started to validate net_context connection state before
allowing to receive any data.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-14 18:15:49 +02:00
Marcin Niestroj
9af6b9ed62 drivers: wifi: esp: set NET_CONTEXT_CONNECTED state
Set NET_CONTEXT_CONNECTED when stream socket got connected. This fixes
TCP connection when using ESP WiFi driver, which got broken after
sockets layer started to validate net_context connection state before
allowing to receive any data.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-14 18:15:49 +02:00
Erwan Gouriou
905f496603 dts: stm32h7: Remove zephyr,flash-controller support on M4 core
Flash controller support is not yet ready on M4 core.
Remove the chosen declaration to make it clear.

Additionally, generate a build error if this driver is compiled
on M4 core.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-12-14 16:47:05 +01:00
Erwan Gouriou
5664dddf53 drivers/flash: stm32h7: Cache handling is limited to M7 core
There is no cache management on M4 side of the flash controller.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-12-14 16:47:05 +01:00
Nicolas VINCENT
5b463353d7 drivers/flash: add support for stm32h7 devices
Fixes #29831: Implements flash driver for stm32h7 devices.
The driver is independant from the other stm32 families (flash_stm32.c),
only the header interface is (mainly) common.

Signed-off-by: Nicolas VINCENT <nicolas.vincent@vossloh.com>
2020-12-14 16:47:05 +01:00
Sylvio Alves
6d8fe6eae9 drivers: gpio: esp32: fix DT device macro
ESP32 build fails due to missing underline.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2020-12-14 08:21:03 -06:00
Alberto Escolar Piedras
fe516b93a9 board: native_posix: Add test for k_busy_wait and cpu_hold
Add a new test for k_busy_wait and cpu_hold

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-12-14 12:32:11 +01:00
Alberto Escolar Piedras
6d3476117b posix: Add cpu_hold() function to better emulate code delay
In native_posix and nrf52_bsim add the cpu_hold() function,
which can be used to emulate the time it takes for code
to execute.
It is very similar to arch_busy_wait(), but while
arch_busy_wait() returns when the requested time has passed,
cpu_hold() ensures that the time passes in the callers
context independently of how much time may pass in some
other context.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2020-12-14 12:32:11 +01:00
Krzysztof Chruscinski
4def9a386b drivers: timer: nrf_rtc_timer: Fix non tickless sys clock handling
When tickless mode was disable, sys clock timeout handler was calling
public API function for setting new compare value. Public API function
asserts when chan 0 is used which is reserved for system clock.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-12-13 19:28:08 -05:00
Krzysztof Chruscinski
702f574dfd drivers: timer: nrf_rtc_timer: Fix comparison in z_nrf_rtc_timer_get_ticks
Test was failing due to wrong type conversion.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-12-13 19:28:08 -05:00
Krzysztof Chruscinski
b417f68609 drivers: timer: nrf_rtc_timer: Add clearing of previous CC event
Added clearing of CC event which may occure due to previous
CC value which was closed to current counter value.

Fixed int_mask initialization.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-12-13 19:28:08 -05:00
Kumar Gala
acf1939a4c drivers: entropy: Convert drivers to new DT device macros
Convert entropy drivers to use new DT variants of the DEVICE APIs.
    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
    DEVICE_GET -> DEVICE_DT_GET

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-13 19:27:01 -05:00
Maureen Helm
b0653e13dc drivers: sensor: Fix fxas21002 gyro units
Fixes the fxas21002 sensor driver to provide gyro channel data in
radians/sec instead of degrees/sec.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-12-13 19:26:10 -05:00
Joakim Andersson
a7fd4eab5c drivers: counters: Fix TIMER0 and RTC0 with Bluetooth controller
Fix TIMER0 and RTC0 being selectable when using out-of-tree Bluetooth
controller.
Generalize the Kconfig to have the features that use the HW peripheral
select them as reserved to make the dependencies more manageable.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-12-13 19:25:49 -05:00
Kumar Gala
569155701c drivers: gpio: Convert drivers to new DT device macros
Convert gpio drivers to use new DT variants of the DEVICE APIs.
    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
    DEVICE_GET -> DEVICE_DT_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-13 19:24:24 -05:00
Anas Nashif
0c68ceff77 console: uart_mux: improve Kconfig dependencies
Put everything inside an if, we should not see anything related to
uart_mux in generated .config if it is not enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-11 16:49:41 -05:00
Carlo Caione
0d1a6dc27f intc: gic: Use SYS_INIT instead of custom init function
The GIC interrupt controller driver is using a custom init function
called directly from the prep_c function. For consistency move that to
use SYS_INIT.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-12-11 10:17:27 -05:00
Kumar Gala
843d3f74da drivers: i2c: i2c_sifive: Fix build issue
Add a missing ',' in DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-11 09:13:02 -06:00
Kumar Gala
4e6d79cd43 drivers: pwm: pwm_mcux_tpm: Fix build failure
Add a missing ',' in DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-11 08:32:14 -06:00
Jacob Siverskog
393e9d4a28 drivers: video: fix potential NULL pointer dereference
this bug was introduced when transitioning to k_heap usage.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2020-12-11 08:18:42 -06:00
Kumar Gala
e376b9417b drivers: watchdog: Convert drivers to new DT device macros
Convert watchdog drivers to use new DT variants of the DEVICE APIs.
    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
    DEVICE_GET -> DEVICE_DT_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-11 08:14:23 -06:00
Peter Bigot
65a4910f97 drivers: pwm: fix nrfx pwm device definition
Driver does not use the numeric index directly to identify devicetree
instance nodes.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-11 09:02:35 -05:00
Kumar Gala
3216856ea1 drivers: spi: cc13xx_cc26xx: Fix compile error
The cc13xx_cc26xx driver uses "inst" so we need to use
DEVICE_DT_INST_DEFINE instead of DEVICE_DT_DEFINE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-11 03:34:50 -06:00
Kumar Gala
0e01bc5eed drivers: i2c: stm32: Convert drivers to new DT device macros
Convert i2c drivers from:

DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
DEVICE_GET -> DEVICE_DT_GET

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-10 16:40:11 -06:00
Kumar Gala
071e7adefb drivers: i2c: Convert drivers to new DT device macros
Convert i2c drivers from:

DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
DEVICE_GET -> DEVICE_DT_INST_GET
DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-10 16:40:11 -06:00
Martin Jäger
b0db87193e drivers: flash: stm32g4x: Fix include for dual bank
The LL header include was missing for the functions used for STM32G474
MCUs with dual bank feature.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-12-10 16:21:35 -06:00
Peter Bigot
ecc44b16ca drivers: display: mcux_elcdif: fix k_heap call
Rework in #28611 left an old argument in place and missed a type check.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-10 16:18:10 -06:00
Kumar Gala
5a70f54f62 drivers: spi: spi_nrfx_spis: Fix compile error
The spi_nrfx_spis driver uses nodelabel so we need to use
DEVICE_DT_DEFINE instead of DEVICE_DT_INST_DEFINE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-10 11:34:56 -06:00
Gaspard Rigolot
2e024f5ed9 drivers: sensor: dps310 fix pressure and temperature registers
The two registers were inverted.

Signed-off-by: Gaspard Rigolot <gaspard.rigolot@stimio.fr>
2020-12-10 08:59:32 -06:00
Kumar Gala
03ad31b0e4 drivers: spi: Convert drivers to new DT device macros
Convert spi drivers from:

DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
DEVICE_GET -> DEVICE_DT_INST_GET

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-10 08:53:24 -06:00
Kumar Gala
2f9573406d drivers: adc: Convert drivers to new DT device macros
Convert adc drivers to use new DT variants of the DEVICE APIs.
    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
    DEVICE_GET -> DEVICE_DT_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-10 08:48:17 -06:00
Kumar Gala
d3790cec95 drivers: pwm: Convert drivers to new DT device macros
Convert pwm drivers to use new DT variants of the DEVICE APIs.
        DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-10 07:25:29 -05:00
Alexandre Bourdiol
522cda3f7d divers: flash: flash_stm32: add flash configuration check
Add weak function to check flash configuration.
On stm32g4: single bank configuration not supported
when dual bank capable.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-12-10 13:00:04 +01:00
Alexandre Bourdiol
7f62a92917 drivers: flash: flash_stm32g4x.c: take into account bank swap
When erasing flash page, take into account a potential bank swap.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-12-10 13:00:04 +01:00
Alexandre Bourdiol
496e2cab3d drivers: flash: flash_stm32g4x.c: rework flash_stm32_block_erase_loop
Remove hardcode bank1 page limit (128) which is not always valid
(not valid for soc stm32g474rct)
Manage bank1/2 discontinuity when flash is Dualbank and
flash size is lower than 512K.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-12-10 13:00:04 +01:00
Alexandre Bourdiol
a993601179 drivers: flash: flash_stm32g4x.c: manage bank1/2 discontinuity
When flash is Dualbank and flash size is lower than 512K,
then there is a discontinuity between bank1 and bank2.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-12-10 13:00:04 +01:00
Krzysztof Chruscinski
f8723bd37f drivers: clock_control: nrf: Add audio clock support to nrf53
Added support for audio clock in nrf53.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-12-10 12:58:49 +01:00
Anas Nashif
e0f3833bf7 power: remove SYS_ and sys_ prefixes
Remove SYS_ and sys_ from all PM related functions and defines.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Anas Nashif
dd931f93a2 power: standarize PM Kconfigs and cleanup
- Remove SYS_ prefix
- shorten POWER_MANAGEMENT to just PM
- DEVICE_POWER_MANAGEMENT -> PM_DEVICE

and use PM_ as the prefix for all PM related Kconfigs

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Kumar Gala
06a5946266 drivers: Convert to use new DEVICE_DT_INST_* macros
Move users that are DEVICE_DT_DECLARE(DT_DRV_INST(n, ...)) to
DEVICE_DT_INST_DECLARE(n, ...) and similar for DEVICE_DT_DEFINE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-09 14:06:48 -06:00
Mulin Chao
c45e7f3c96 driver: host_uart: Add host-uart device in npcx.
In order to prevent user turns on the pin-mux of devices has io-pads
unexpectedly, this CL added a new device definition for host uart
device. The pin-mux of host uart interface is enabled only if we set its
status as "okay" in dts file of board folder.

The following npcx7 drivers will meet:
1. Default status property of npcx devices with io-pads such as espi,
   pwm, uart, host uart and so on should be "disabled".
2. Switch pin-mux by changing status property to "okay" in dts file of
   board folder.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2020-12-09 00:46:57 -05:00
Mulin Chao
daa48daf52 soc: replace DT_ with NPCX_DT_ prefix for all macros in soc_dt.h
This CL replaces all DT_ prefix with NPCX_DT_ for all macros used
for providing npcx device information in soc_dt.h It avoided the
ambiguity with the DT_ prefix for system DT macros/defines.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2020-12-09 00:46:57 -05:00
NavinSankar Velliangiri
79119439a7 drivers: can: add network interafce for mcp2515
Prevoiusly there is no network interface for mcp2515 driver.
This is solved by calling the NET_DEVICE_INIT macro in mcp2515 driver.

fixes: #30432

Signed-off-by: NavinSankar Velliangiri <navin@linumiz.com>
2020-12-08 09:30:46 -05:00
Tomasz Bursztyka
a2491b321e drivers/pcie: Add support for MSI-X
It's disabled by default. When enabled, and if the device exposes both
MSI and MSI-X capabilities: MSI-X will be selected and MSI disabled on
the device.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-08 09:29:20 -05:00
Tomasz Bursztyka
557b17076f drivers/interrupt_controller: Add Intel VT-D interrupt remapping driver
Such interrupt remapping controller may be found along with Intel VT-D
hardware. Its base-address is via ACPI, and it enables up to 64K
interrupt indexes.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-08 09:29:20 -05:00
Tomasz Bursztyka
4199cd38f1 drivers/pcie: Add support for MSI multi-message
This enables software MSI "multi-vector" feature, letting the user to
register an isr handler per-MSI message.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-08 09:29:20 -05:00
Tomasz Bursztyka
6e56157008 drivers/pcie: Move PCIE code to relevant place
Though it was noted that pcie_get_cap() is only used by MSI code so far,
there is no need to put it in msi code. If unused, linker will nuke it.
So let's move things to where it belongs to.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-08 09:29:20 -05:00
Krzysztof Chruscinski
5b7fc3816d drivers: timer: nrf_rtc_timer: Fix int_mask initialization
Variable was not properly initialized when custom channels were
disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-12-08 09:23:57 -05:00
Maciej Fabia
1ca9b38946 drivers: ieee802154: nrf5: Add support for tx in the future
Add support for transmission modes that send a packet
at a specific time in the future.
Remove TXTIME, TXTIME_CCA, CSMA_CA capabilities and their calls when
they are not supported by selected drivers. Add TXTIME flag in
get_capabilites function.

Signed-off-by: Maciej Fabia <maciej.fabia@nordicsemi.no>
Signed-off-by: Pawel Kwiek <pawel.kwiek@nordicsemi.no>
2020-12-08 14:52:08 +02:00
Rubin Gerritsen
75de21b3d6 drivers: bluetooth: Add timeout to rpmsg init
Previously, when opening the Bluetooth driver on the app core of
nRF53, the application could hang forever. This would happen if
the network core was not flashed or flashed with the wrong firmware.

This commit improves the user experience timing out if the net core
is not replying. 3 seconds is considered to be more than enough to boot
the network core.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-12-08 12:41:21 +02:00
Andy Ross
fcd392f6ce kernel: subsys: lib: drivers: Use k_heap instead of z_mem_pool wrappers
Use the core k_heap API pervasively within our tree instead of the
z_mem_pool wrapper that provided compatibility with the older mempool
implementation.

Almost all of this is straightforward swapping of one alloc/free call
for another.  In a few cases where code was holding onto an old-style
"mem_block" a local compatibility struct with a single field has been
swapped in to keep the invasiveness of the changes down.

Note that not all the relevant changes in this patch have in-tree test
coverage, though I validated that it all builds.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00
Andy Ross
6965cf526d kernel: Deprecate k_mem_pool APIs
Mark all k_mem_pool APIs deprecated for future code.  Remaining
internal usage now uses equivalent "z_mem_pool" symbols instead.

Fixes #24358

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00
Anas Nashif
2a19ad8068 Revert "drivers/flash: add support for stm32h7 devices"
This reverts commit 0964331df2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-07 19:02:48 -05:00
Nicolas VINCENT
0964331df2 drivers/flash: add support for stm32h7 devices
Fixes #29831: Implements flash driver for stm32h7 devices.
The driver is independant from the other stm32 families (flash_stm32.c),
only the header interface is (mainly) common.

Signed-off-by: Nicolas VINCENT <nicolas.vincent@vossloh.com>
2020-12-07 16:16:11 -05:00
Mulin Chao
507f31472c driver: clock_controller: return values of clock_control apis directly.
return values of clock_control_on()/clock_control_get_rate() directly in
case overwriting error codes.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-12-07 12:11:17 -05:00
Mulin Chao
14b98135fd driver: npcx7: fixed typo in Kconfig.npcx files.
Fixed typo in Kconfig.npcx files.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2020-12-07 12:11:17 -05:00
Mulin Chao
a279b4cfb7 drivers: adc: add adc support in npcx7 series
NPCX7 includes a 10-bit resolution Analog-to-Digital Converter (ADC). Up
to 10 voltage inputs can be measured and a internal voltage reference
(VREF), 2.816V (typical) is used for measurement. It can be triggered
automatically in Autoscan mode. Each input channel is assigned a
separate result register, which is updated at the end of the conversion.

The CL also includes:
— Add npcx adc device tree declarations.
— Zephyr adc api implementation.
— Add adc definitions of npcx7 in
  tests/drivers/adc/adc_api/src/test_adc.c for supporting test suites.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-12-07 12:11:17 -05:00
Thomas Stranger
2ef06a5280 drivers: clock_control: Fix missing ifdefs for stm32wb, stm32g0
Some Clocks have ifdefs only for clock_control_on but are missing
them for clock_control_off.
Additionally return ahb_clock clock frequency for stm32g0
STM32_CLOCK_BUS_IOP in stm32_clock_control_get_subsys_rate.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2020-12-07 09:10:38 -06:00
Lukasz Majewski
bcbe4e8f1f eth: mcux: Fix proper handling of the 'local-mac-address' property
After the change SHA1: 3498d43784 the
local-mac-address property is no longer parsed correctly when it is
defined in the '&enet` DTS node on k6x SoCs (e.g. frdm_k64f and
ip_k66f).

The problem is with value to which the
NODE_HAS_VALID_MAC_ADDR(DT_DRV_INST(n)) macro is resolved.

If the 'local-mac-address' is present it returns
'(!((0 == 0) && (0 == 0) && (18 == 0) && (19 == 0) && (0 == 0) && \
 (16 == 0)))' [*], otherwise it is 0.

As COND_CODE_{01} only accepts 0 or 1 as its first argument, it all
worked until the 'local-mac-address' was not defined. When present
the first argument to COND_CODE_{01} macro was [*] and it caused
build break.

Fixes issue: #30354
https://github.com/zephyrproject-rtos/zephyr/issues/30354

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2020-12-07 12:56:32 +01:00
Krzysztof Chruscinski
2db49c4b99 drivers: serial: nrfx_uarte: Fix race condition in TX path
If interrupt handler contains while loop which depends on
uart_irq_tx_ready() and uart_fifo_fill is called inside this
loop then if TXSTOPPED event occurs while code executes the
loop then uart_irq_tx_ready() will return true but uart_fifo_fill
will fail to write any bytes. That is because fifo_fill_lock is
cleared in handling of TXSTOPPED. To solve that added clearing
the lock inside uart_irq_tx_ready() if STOPPED event is detected
there.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-12-07 12:56:22 +01:00
Marcin Niestroj
5cbf2ec1f7 drivers: modem: fix sending with zero timeout and no semaphore
There was a regression introduced when reordering function parameters
check. It is valid to pass NULL semaphore with zero timeout, so fix
parameter check to respect that.

Fixes: 67976f8686 ("drivers: modem: verify send semaphore before
  taking any action")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-07 10:25:56 +02:00
Pawel Czarnecki
ed6c0103a9 drivers: clock control: Add LiteX clock control driver
This commit adds LiteX SoC Builder clock control driver for MMCM
module. It gives ability to change frequency, phase and duty cycle
on up to 7 clock outputs.

Signed-off-by: Pawel Czarnecki <pczarnecki@internships.antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2020-12-06 12:35:16 -05:00
Martin Jäger
916dd0f6c4 drivers: watchdog: iwdg_stm32: Fix timeout calculation
CONFIG_IWDG_STM32_TIMEOUT allowed values of 100 us for initial watchdog
timeout, which was actually rounded to zero in the driver, which uses
milliseconds resolution for timeouts. This resulted in the reload value
being set to maximum possible (calculation: 0U - 1).

This commit updates the calculation of timeout minimum and maximum
values considering the actual LSI frequency of the used MCU.

As the resolution of CONFIG_IWDG_STM32_TIMEOUT in microseconds doesn't
make sense if the driver supports only milliseconds, it is renamed to
IWDG_STM32_INITIAL_TIMEOUT (this prevents accidental wrong settings in
existing firmware) and the unit is changed to ms.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-12-04 23:09:42 -05:00
Xavier Chapron
d66d748b71 drivers: modem: sara-r4: Improve offload_sendmsg() support
Previously, msghdr was handled by forwarding each msg_iov to
offload_sendto() one by one.
This is not optimal, as msg_iov payload might have been sent
simultaneously which would be faster.
With this commit, send_socket_data() expect payload to be formated as
struct msghdr which can be used directly by both offload_sendto() and
offload_sendmsg().

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-12-03 17:37:48 -05:00
Xavier Chapron
6020d4ce53 drivers: modem: sara-r4: Add Kconfig to configure RSSI work
This comit introduce two new Kconfig which allow to configure RSSI
polling work.
One Kconfig allow to completely disable the polling.
The other one allow to sonfigure the polling period.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-12-03 17:37:48 -05:00
Xavier Chapron
fa3d586483 drivers: modem: sara-r4: Add direct CMD to catch @ when sending data
Replace hard coded wait by real detection of '@'.
This make sure that datasheet timings are correctly followed.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-12-03 17:37:48 -05:00
Xavier Chapron
7129aff701 drivers: modem: sara-r4: Sanitize send_socket_data() semaphore handling
Reset of the sem_response semaphore should be done before sending data.
This prevent any potential race conditions between the rx thread and the
thread running send_socket_data().

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-12-03 17:37:48 -05:00
Xavier Chapron
900d48c88b drivers: modem: modem_socket: Reset all socket data upon socket_put
Some data where not properly reset on socket_put() and not correctly
initialized at socket creation. Which means we were potentially re-using
data from previous use of this socket.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-12-03 17:37:48 -05:00
Xavier Chapron
3d61989bc7 drivers: modem: modem_cmd_handler: Allow dynamic number of commands args
This is necessary to allow parsing of commands with dynamic number of
arguments.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-12-03 17:37:48 -05:00
Xavier Chapron
7d67991a91 drivers: modem: modem_socket: Fix blocking modem_socket_poll
Before this commit, if a socket had received data before calling the
poll function, then the poll was waiting for either new data or a
timeout.
With this fix, polled socket are check for pending data before the
semaphore wait.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-12-03 17:37:48 -05:00
Tomasz Bursztyka
a035c2199e drivers/pcie: Fix constant qualifier for endpoint driver
Found it via running coccinelle script in:
e18fcbba5a

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-03 09:42:26 -05:00
Tomasz Bursztyka
8d694d11b6 drivers/sensor: Fix device attribute names for lis2mdl and fxos8700
Found it via running coccinelle script found in:
af6140cc0d
and 98d9b01322

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-03 09:42:26 -05:00
Tomasz Bursztyka
e2847552fc drivers/sensor: Fix constant qualifier for lis2mdl PM function
Found it via running coccinelle script in:
e18fcbba5a

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-03 09:42:26 -05:00
Krzysztof Chruscinski
79e63b4216 drivers: timer: nrf: Extended driver with vendor specific API
Extended nrf_rtc_timer driver to expose API for using RTC for
other purposes. System timer is using one compare channels,
other channels may be used through this API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-12-03 14:05:30 +01:00
Gerson Fernando Budke
752f00c959 drivers: gpio: sam: Add sam4l SoC support
Add initial version of SAM4L GPIO driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-12-02 11:48:43 -06:00
Lukasz Majewski
db6015b53b eth: mcux: Replace DT_ALIAS() macro with DT_NODELABEL() for fixed link
After the commit SHA1: 370d02743a the
alias for 'eth' was removed. As a result DT_ALIAS(eth) for the mcux
enet driver was not providing a valid DTS node reference.

As a result the 'fixed-link' child node property was not recognized at
all.

The 'enet' is a valid DTS label for mcux enet driver, so lets use it
instead.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2020-12-02 09:28:44 -06:00
Erwan Gouriou
e0b35dd0d5 drivers/timer: stm32_lptim: Fix stm32 ll header list
LPTIM stm32 ll header list was not adequate.
Remove _system and add _bus, _rcc and _pwr.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-12-01 17:59:53 -05:00
Yuval Peress
beaf0230ba drivers: sensors: bmi160: Fix issue with sample read
When testing the bmi160 I've come across an issue where the readings
didn't make sense to me. The issue comes from reading the
BMI160_SAMPLE_BURST_READ_ADDR which is 0x0C assuming both accelerometer
and gyroscope. At this point we would normally read 12 bytes
(2 bytes per sample * 3 axes * 2 sensors). This reading takes place in
bmi160_sample_fetch and begins writing to data->sample.raw

Without this change, the first byte written is actually to the dummy
byte which effectively gets tossed. The issue is that this is the
GYR_X<7:0>(LSB) according to the BMI160 data sheet. When we later call
either bmi160_gyr_channel_get or bmi160_acc_channel_get we're looking
at sample.gyr and sample.acc (which is effectively shiften by 1 byte).

This change gets rid of the dummy byte which re-alignes gyr with the
start of the raw buffer.

Signed-off-by: Yuval Peress <peress@chromium.org>
2020-12-01 17:58:06 -05:00
Peter Bigot
01da5ab1fc drivers: flash: spi_nor: fix bound for parameter headers
The exclusive bound for parameter headers needs to be incremented as
the nph parameter is not the number of parameter headers: 0 means one
header.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 17:57:20 -05:00
Bilal Wasim
503a70a40a drivers: modem: Add support for quectel bg95
Adding support for Quectel BG95 Modem offloaded driver
to zephyr.

The driver currently implements only the
client side functions of the "socket_op_vtable", and
so cannot be used for cases where Zephyr acts as a
server. Moreover the driver only supports TCP for now.

Looking through the guides, the same driver should be
usable for BG96 (and other modems) except for the modem
boot-up sequence. Hence its named as "bg9x" instead of
"bg95".

Tested extensively with Zephyr acting as MQTT endpoint
and publishing / subscribing data to / from an MQTT
broker.

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-12-01 17:43:59 -05:00
Peter Bigot
d721b7a6ab drivers: spi: convert nrf drivers to dt device defines
Use the devicetree node as the source of object name and other
information used when defining the device structure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 15:19:22 -05:00
Peter Bigot
cf33927933 drivers: serial: convert nrf drivers to dt device defines
Use the devicetree node as the source of object name and other
information used when defining the device structure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 15:19:22 -05:00
Peter Bigot
f3db8f5acc drivers: sensor: ccs811: convert to dt device defines
Use the devicetree node as the source of object name and other
information used when defining the device structure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 15:19:22 -05:00
Peter Bigot
d9e45b579a drivers: regulator: convert to dt device defines
Use the devicetree node as the source of object name and other
information used when defining the device structure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 15:19:22 -05:00
Peter Bigot
63043bc5ac drivers: i2c: convert nrf drivers to dt device defines
Use the devicetree node as the source of object name and other
information used when defining the device structure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 15:19:22 -05:00
Peter Bigot
1240c28bce drivers: gpio: convert nrf driver to dt device defines
Use the devicetree node as the source of object name and other
information used when defining the device structure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 15:19:22 -05:00
Peter Bigot
13048b1a5a drivers: flash: convert spi-nor drivers to dt device defines
Use the devicetree node as the source of object name and other
information used when defining the device structure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 15:19:22 -05:00
Peter Bigot
7f1b18da70 drivers: clock_control: convert nrf to dt device defines
Use the clock devicetree node as the source of object name and other
information used when defining the device structure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 15:19:22 -05:00
Abhishek Shah
4d7e88b4dc drivers: pcie_ep: iproc: Remove sys_read8 from unmap API
Originally, sys_read8 to the mapped address was added part of
the unmap API to protect OMAP mapping, i.e. in case of PCIe writes,
OMAP should not be overwritten before writes are completed.

Now that we have added dummy PCIe read in the common APIs, namely
pcie_ep_xfer_data_memcpy and pcie_ep_xfer_data_dma, for the purpose
of flushing PCIe writes; the purpose of protecting OMAP *also*
gets satisfied, randering PCIe read in the unmap useless,
so remove the same.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-12-01 14:56:59 -05:00
Abhishek Shah
f66e5c4cb0 drivers: pcie_ep: Add API to achieve data transfer with system DMA
Introduce common API to achieve data transfer using system DMA.
"System DMA" uses the outbound memory mapped Host address,
it cannot understand Host/PCIe address.

This API will take of mapping the Host address, completing
the data transfer to/from Host memory and unmapping the window;
thus providing abstraction to the user.

Since v1:
- refactored code for the cases where we have valid mapped_addr
  to improve error management logic

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-12-01 14:56:59 -05:00
Abhishek Shah
077522e6bb drivers: pcie_ep: iproc: Add support for PL330 DMA
Once host memory is mapped to outbound memory, PL330 can be used to
transfer data between outbound memory and local memory.

Add API for the same, we get pl330 device as well as channels to be
used for tx/rx from DT and use DMA public APIs for data transfer.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-12-01 14:56:59 -05:00
Peter Bigot
7a23490087 drivers: counter: stm32_rtc: remove dependency on maximal libc
mktime() was being used to convert from struct tm to time_t, but
Zephyr now has functions for that.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 14:54:12 -05:00
Peter Bigot
509a26304b drivers: counter: stm32_rtc: clarify epoch for time_t vs RTC
time_t always measures as seconds since 1970-01-01T00:00:00Z.  Fix a
comment that identified the wrong epoch year, and document what the
value of the offset means.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-01 14:54:12 -05:00
Marcin Niestroj
03ce61004b drivers: wifi: esp: control CWMODE depending on current needs
So far ESP chip was configured directly into STA mode. This works fine,
but consumes lots of power because of enabled WiFi radio, even when it
is not actively used.

Enter NONE mode during initialization, so WiFi radio will be
disabled. Switch between NONE, STA, AP and STA+AP modes depending on
what driver is currently doing (e.g. enable STA only when scanning,
connecting and being connected to AP).

AT+CWAUTOCONN=0 command fails when in NONE mode, so workaround that by
entering temporarily into STA and then switching back to NONE.

Add also a warning log when switching mode was not successful, to ease
debugging possible issues.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-01 11:16:36 -05:00
Marcin Niestroj
575fe89303 drivers: wifi: esp: improve readability of CWMODE changes
AT+CWMODE command controls in which mode (NONE, STA, AP, STA+AP) ESP
chip is operating. Add helper macros to replace usage of magic
numbers (0-3), hence improve readability. Add also a esp_mode_switch()
helper function, which allows to conveniently switch to chosen mode.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-01 11:16:36 -05:00
Marcin Niestroj
964775fafc drivers: wifi: esp: change internal API to work with multiple flags
Change internal API operating on ESP driver flags to support multiple
bitwise ORed flags at once. This allows to improve resulting code when
multiple flags are read or modified at once.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-01 11:16:36 -05:00
Marcin Niestroj
347c2501d7 drivers: wifi: esp: add esp_cmd_send() helper function
All except one invocations of modem_cmd_send() pass the same interface,
command handler and semaphore. Create a helper function in order to make
invocations slightly more readable.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-01 11:16:36 -05:00
Marcin Niestroj
135bbd5ae4 drivers: wifi: esp: stop locking scheduler when sending data
Locking scheduler was a workaround for issue that was just solved.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-01 11:15:19 -05:00
Marcin Niestroj
9fe279f744 drivers: modem: don't clear out cmd handlers if they were not setup
There is no point in clearing out command handlers if they were not
setup properly. Just skip to next instruction.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-01 11:15:19 -05:00
Marcin Niestroj
eae32b7e7a drivers: modem: fix race condition when waiting on cmd reply
Command was sent first, then a semaphore was reset. This semaphore could
be released by received reply even before semaphore was reset. This is
quite unlikely, but possible result of race condition.

Move k_sem_reset() call before attempt to send command over modem
interface. This makes sure that receiving reply momentarily after
sending request will always be handled properly.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-01 11:15:19 -05:00
Marcin Niestroj
67976f8686 drivers: modem: verify send semaphore before taking any action
Semaphore argument is checked only after requested command is already
sent over modem interface. It makes little sense to return -EINVAL when
half of the requested operation (send) has already been done.

Check timeout and semaphore arguments just on the beginning of
function. Return -EINVAL early, before sending any data or taking any
locks.

Clear out 'sem' variable when there is no need to wait. Use this
variable later on as an indication to actually wait on semaphore or not.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-01 11:15:19 -05:00
Marcin Niestroj
5e3d542862 drivers: modem: hl7800: don't cleaup net_context members
There is no reason to clenaup members of net_context structure, as those
should be (and are) managed by net_context_put() implementation.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-01 11:13:48 -05:00
Marcin Niestroj
33a90f20e9 drivers: modem: wncm14a2a: don't cleaup net_context members
There is no reason to clenaup members of net_context structure, as those
should be (and are) managed by net_context_put() implementation.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-01 11:13:48 -05:00
Marcin Niestroj
aa07f8a442 drivers: wifi: winc1500: remove unused send_cb and send_user_data
Both 'cb' and 'user_data' parameters for send/sendto were saved as
'send_cb' and 'send_user_data' members in socket information. None of
them are actually used, so drop them.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-01 10:06:43 +02:00
Fabio Utzig
294ca18f09 drivers: flash: stm32l1: add initial L1x support
Enable L1x flash erase/program using the stm32_v1 driver.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-11-30 15:49:15 -06:00
Alexander Wachter
4dcf614784 include: drivers: pinmux: stm32: Add missing C linkage
The C linkage for C++ was missing in pinmux_stm32.h

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2020-11-30 18:47:08 +01:00
Martin Jäger
9e316e6040 drivers: interrupt_controller: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
d5aff7ba3c drivers: clock_control: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
0636b42c81 drivers: usb: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
004bee1fa8 drivers: flash: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
b7a6087769 drivers: ipm: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
53af1aab62 drivers: timer: stm32_lptim: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
00ac525603 drivers: dma: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
3ef8451e82 drivers: counter: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
92e16191ac drivers: gpio: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
c512a908c8 drivers: spi: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
f8710aa722 drivers: i2s: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
42eb8d7336 drivers: i2c: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
fc1c284c9c drivers: pwm: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
39d388287f drivers: hwinfo: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
505861e822 drivers: entropy: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
d73bfcbdc8 drivers: iwdg: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
c3c3073c95 drivers: wwdg: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
f31fa1e61e drivers: dac: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Martin Jäger
7f68c0aa2c drivers: adc: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Antonio Tessarolo
38566ef482 Driver i2c_imx: changed read and write transmission size type
imx_msg transmission size type is uint32_t:
changed imx_read and imx_write signature accordingly.
Removed also two unused variables.

Signed-off-by: Antonio Tessarolo <anthonytexdev@gmail.com>
2020-11-30 15:49:38 +01:00
Antonio Tessarolo
0a2456c0eb i2c_imx: Fix system fault when there is no data to send
When there is no data to send (e.g. i2c message with NULL buffer and
len=0), i2c_imx driver locks itself in isr handling forever.
So if there is no data to send, only device's address must be written
on bus. This fixes i2c_shell's scan command on both imx7 and imx6sx.

Signed-off-by: Antonio Tessarolo <anthonytexdev@gmail.com>
2020-11-30 15:49:38 +01:00
Erik Larson
c47c115c28 drivers: gpio: gpio_cc13xx_cc26xx: Add drive strength configurability
Add support for the GPIO_DS_ALT_LOW and GPIO_DS_ALT_HIGH gpio flags.

Fixes #30219

Signed-off-by: Erik Larson <erik@statropy.com>
2020-11-30 15:49:20 +01:00
Peter Bigot
bc33ef4d42 drivers: flash: nrf_qspi_nor: remove multithreading dependency
Replace semaphores with an atomic ready flag when used without
multithreading enabled.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-11-28 07:20:27 -05:00
Carles Cufi
ebf2e76740 drivers: console: Fix path to mcumgr header
The mcumgr header files are now in include/mgmt/mcumgr/, so reflect this
change in the UART console implementation.

Fixes #30261.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-11-27 18:18:50 +01:00
Tomasz Bursztyka
9bf3c62a4a drivers/pcie: Fix function that looks up for mbar
An address might be made for 64bit though it's lower 32 bits are made of
0. Also Simplifying the overall by removing a useless variable.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-11-27 09:58:08 -05:00
Krzysztof Chruscinski
751bdf483b drivers: serial: nrfx: Skip poll out when device is not active
Added early return from uart_poll_out when uart device is not in
active state. Poll_out is used from many contexts by multiple users
and currently here is no mechanism in power management to disable
them (console, logger when going to inactive power state.

Additionally, moved setting new state when disactivating the device to
ensure that no poll_out will happen after disabling the UARTE.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-11-26 19:08:01 +02:00
Francois Ramu
e7f222a3b6 drivers: dma: stm32 dma source and dest data size must be equal
It raises an error in case the source data width differs
from the dest data width.
The dma_stm32_width_config function is no more useful: removed.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-11-26 14:18:28 +01:00
Alexander Kozhinov
8882841bcd drivers: clock_control: stm32h7
increase max clock values according to stm32h723

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-11-25 15:07:59 +02:00
Johann Fischer
5cd66c69c6 drivers: usb_dc_nrfx: remove k_mem_pool_free for IN endpoints
Usage of mem_pool for all IN endpoints was removed in
commit b3c63425a0 ("usb: driver: Reduce Endpoint buffer pool.")
Remove also k_mem_pool_free for all IN endpoints.

Fixes: #30213

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2020-11-25 14:23:48 +02:00
Gerard Marull-Paretas
e83fab32d7 drivers: serial: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-11-24 17:22:27 +01:00
Gerard Marull-Paretas
e671d363b8 drivers: memc: stm32: initial support for stm32 FMC
This commit adds a new driver category for memory controller
peripherals. There is no API involved for now, as it has not been found
necessary for first implementation.

STM32 Flexible Memory Controller (FMC) is the only controller supported
for now. This peripheral allows to access multiple types of external
memories, e.g. SDRAM, NAND, NOR Flash...

The initial implementation adds support for the SDRAM controller only.
The HAL API is used, so the implementation should be portable to other
STM32 series. It has only been tested on H7 series, so for now it can
only be enabled when working on H7.

Linker facilities have also been added in order to allow applications to
easily define a variable in SDRAM.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-11-24 16:33:17 +01:00
Peter Bigot
5263289631 drivers: regulator: avoid improper access to internal structures
Nothing in the API description the delayed work structure sanctions
direct reference to internal fields.  Do not assume that a delayed
work item can be submitted without delay by invoking k_work_submit()
with a reference to the contained work item.  Instead submit with the
delayed API and no wait.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-11-24 13:04:48 +02:00
Marcin Niestroj
c934e74bf9 drivers: modem: gsm_ppp: constify modem_cmd and setup_cmd structures
Constifying global data allows to save lots of RAM. This improvement
allows to save 224 bytes of RAM when compiled on ARM, with default
configuration.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-11-24 12:59:50 +02:00
Marcin Niestroj
ddf2278c3f drivers: modem: ublox-sara-r4: constify modem_cmd and setup_cmd structures
Constifying global data allows to save lots of RAM. Defining data inside
function as 'static const' allows on the other hand to save stack usage
and reduced code size (because data doesn't have to be copied on stack
in runtime).

This improvement allows to save 448 bytes of RAM and 88 bytes of ROM
when compiled on ARM, with default configuration.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-11-24 12:59:50 +02:00
Marcin Niestroj
e0a418c1e3 drivers: wifi: esp: constify modem_cmd and setup_cmd structures
Constifying global data allows to save lots of RAM. Defining data inside
function as 'static const' allows on the other hand to save stack usage
and reduced code size (because data doesn't have to be copied on stack
in runtime).

This improvement allows to save 640 bytes of RAM and 64 bytes of ROM
when compiled on ARM.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-11-24 12:59:50 +02:00
Marcin Niestroj
1d25e9c6ae drivers: modem: constify modem_cmd and setup_cmd structures
modem_cmd and setup_cmd structures are used only to store static
information about commands to be sent and replies to be
received. Reference it as const, so that it is possible to define const
instances and save some RAM space by placing those definitions entirely
in ROM.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-11-24 12:59:50 +02:00
Erik Larson
0a0404df29 drivers: ieee802154: cc13xx_cc26xx: raw mode support
This change adds IEEE802154_RAW_MODE support for the
cc1352r.

This allows using the cc1352r 2.4 GHz radio and Sub Ghz
radio as a transceiver (PHY) instead of using L2 networking.

Signed-off-by: Erik Larson <erik@statropy.com>
2020-11-23 09:46:49 +02:00
Kumar Gala
1e674ad815 drivers: spi: mcux_flexcomm: Fix build failure
Change to spi_context_lock missed one spot in the flexcomm driver and
this causes a build issue.  Pass spi_cfg to spi_context_lock to fix
the issue.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-11-20 13:59:24 -05:00
Maureen Helm
57b756b442 debug: tracing: Add Segger RTT and SystemView linker section options
Enables optionally placing Segger RTT and SystemView data in the DTCM
linker section instead of the default data section. This is needed on
SoCs in the i.MX RT series that use cacheable external SDRAM to store
data.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-11-20 12:54:09 -06:00
Maximilian Bachmann
3c8e98cb39 drivers/pcie: Change pcie_get_mbar() to return size and flags
currently pcie_get_mbar only returns the physical address.
This changes the function to return the size of the mbar and
the flags (IO Bar vs MEM BAR).

Signed-off-by: Maximilian Bachmann <m.bachmann@acontis.com>
2020-11-20 09:36:22 +02:00
Francois Ramu
720863217d drivers: dma : stm32 with dmamux has a special offset
This new offset value in the dma config is made to
build the table of dma mux_channels with a dmamux.
Range depends on the nb of channels for selected dma instance

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-11-19 17:04:25 -05:00
Jose Alberto Meza
387e3e4477 drivers: peci: xec: Enhance PECI bus recovery mechanism
Perform FIFO flush in write failure case
Perform full PECI HW block reset if multiple consecutive
failures are observed
Remove trailing \n from logging messages

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-11-19 17:00:16 -05:00
Peter Bigot
bce3a70ec5 regulator: check manager init for failure
Use the return value to verify success when assertions are enabled.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-11-19 12:36:44 -05:00
Gerson Fernando Budke
bc00f19724 drivers: i2c: Introduce SAM4L i2c TWIM driver
The SAM4L have a unique I2C driver.  It shares simultaneously pins for
both master and slave controllers.  Each controller have their own
instance.  This introduces the TWIM controller that handles only the
master part.

The TWIM controller uses no copy and the driver was prepared to work
with both 7 and 10 bits address.  The controller can handler up to 256
bytes for a single transfer allowing long data communication with
almost no CPU intervention.

The driver was wrote specifically to Zephyr.  It receives a transfer
list of from upper layers to a specific device on the bus.  It programs
the first and second transfer, if it exists, before start.  At end of
full read/write interrupt, will program the next data block.  This
process repeats until all transfers be executed.  The driver uses
interrupt from TWIM to check for erros or program next tranfer.

Future work can enable low power mode on the driver allowing long
transfers with low power consumption.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-11-19 10:52:49 -06:00
Harry Jiang
de729882a0 drivers: spi: spi_ll_stm32: Fix the master mode not work.
On the STM32MP1 and STM32H7 Series SoC, if slave select pin control by
software on master mode operation, the SS input/output polarity (SSIOP)
should be set to high level avoid the mode fault (MODF) error.

Signed-off-by: Harry Jiang <explora26@gmail.com>
2020-11-19 12:35:12 +01:00
Harry Jiang
85e0e21390 drivers: spi: spi_ll_stm32: Add support for STM32H7xx SoC
Add SPI driver support for STM32H7xx SoC.

Signed-off-by: Harry Jiang <explora26@gmail.com>
2020-11-19 12:35:12 +01:00
Erwan Gouriou
6c7380183e drivers/bluetooth: ipm_stm32: Wake up C2 at init
When C2 is powered on, flash erase/write operation requires C1
to share a flash mutex with C2. This can only be done if IPM
communication is set up (SHCI).
Instead of configuring C2 (BLE controller) at on ble open,
do it at driver start up.
This allows flash operations before ble_open.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-19 12:35:01 +01:00
Stefan Bigler
596cad8231 spi: fix locking for SPI_LOCK_ON using synchronous API
Keep locking for SPI_LOCK_ON from the first call of transceive until
spi_release release the lock. Use owner parameter to in the spi_context
to store the owner of the lock.
The locking is in line with the SPI_HOLD_ON_CS

Signed-off-by: Stefan Bigler <stefan@bigler.io>
2020-11-19 12:34:44 +01:00
Jukka Rissanen
84e74b6a88 drivers: uart: Remove extra warn print from native_posix
Sometimes native_posix UART driver starts to flood the output
by printing hundreds of lines like this

    np_uart_poll_out: a character could not be output

Remove the warning as it makes the output very hard to read
without giving much useful information.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-19 08:46:51 +01:00
Henrik Brix Andersen
c6f1469bf6 drivers: pwm: add driver for the Xilinx AXI Timer
Add PWM controller driver for the Xilinx AXI Timer v2.0 IP.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-11-17 19:30:20 -05:00
Henrik Brix Andersen
d31a1dc91b drivers: counter: add driver for the Xilinx AXI Timer
Add counter driver for the Xilinx AXI Timer v2.0 IP.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-11-17 19:30:20 -05:00
Marcin Niestroj
980636dad3 drivers: wifi: esp: support hostname configuration
Configure hostname by issuing AT+CWHOSTNAME="<hostname>" command. Do it
just after setting link address, which is used to generate hostname
postfix when CONFIG_NET_HOSTNAME_UNIQUE=y.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-11-17 19:21:43 -05:00
Maureen Helm
18d7058ac8 drivers: sensor: Rework fxos8700 driver to use DT_INST_FOREACH
Reworks the fxos8700 sensor driver to use DT_INST_FOREACH_STATUS_OKAY.
This allows it to support multiple instances, however only a single
instance was tested with the frdm_k64f board.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-11-17 16:51:50 -05:00
Maureen Helm
e015561c44 drivers: sensor: Fix fxos8700 device driver_api/data attributes
Fixes the fxos8700 sensor driver to reflect recent changes in the
generic device driver structure, renaming driver_data and config_info to
data and config respectively. These instances in the fxos8700 sensor
driver were missed because we haven't enabled the magnetic vector
magnitude function in CI.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-11-17 16:51:50 -05:00
Maureen Helm
84cc60e53c drivers: sensor: Convert fxos8700 vector mag Kconfigs to dts properties
Converts fxos8700 magnetic vector magnitude options from Kconfigs to
optional device tree properties.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-11-17 16:51:50 -05:00
Maureen Helm
cb98e9aa11 drivers: sensor: Convert fxos8700 power mode Kconfigs to dts property
Converts fxos8700 power mode options (normal, low noise low power, high
resolution, low power) from Kconfigs to an optional device tree
property.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-11-17 16:51:50 -05:00
Maureen Helm
6199de14c4 drivers: sensor: Convert fxos8700 range Kconfigs to dts property
Converts fxos8700 range options (2g, 4g, 8g mode) from Kconfigs to an
optional device tree property.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-11-17 16:51:50 -05:00
Maureen Helm
d4b9d197f3 drivers: sensor: Convert fxos8700 pulse Kconfigs to dts properties
Converts fxos8700 pulse detection options from Kconfigs to optional
device tree properties.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-11-17 16:51:50 -05:00
Andrzej Puzdrowski
832a896988 drivers/flash/nrf_qspi_nor: determine RAM source using nrfx
The driver was using CONFIG_SRAM_BASE_ADDRESS as the value used to
recognize whether source buffer is in RAM. This label provide the
base address of the image SRAM, and not the base of actual HW SRAM.

This patch uses nrfx_is_in_ram() instead.

fixes #29467

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-11-17 16:51:08 -05:00
Gerson Fernando Budke
3f4c1c9df2 drivers: flash: spi nor: Add missing flash layout conf
The at45 and nor spi flash drivers needs flash layout to work.
Probably tested were conducted with SoC that already selects
the FLASH_HAS_PAGE_LAYOUT for internal flash drivers.  This add
the missing dependency.

Fixes #28094.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-11-17 16:44:03 -05:00
Peter Bigot
ab9f7497ba shell: shell: select FP formatting support
This module needs to format floating point values in shell print
statements, which requires FP format support.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-11-17 14:44:59 -06:00
Armando Visconti
46b12406de drivers/sensor: lis2dh: Fix multi-instance leftovers
Introduced two per instance booleans, which get set using DT info:

  1. is_lsm303agr_dev: if the device is a LSM303AGR_ACCEL, then
     the scale values have to be changed.

  2. Handle disconnect-sdo-sa0-pull-up if present in ntsnace DT.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-11-17 14:44:18 -06:00
Armando Visconti
d962e3590f drivers/sensor: lis2dh: Fix interrupt handling for multi instance
Handle interrupts correctly for multi instance, checking per
device DT bindings instead of global Kconfig definitions.

The old interrupt behaviour has been maintained, fixing DRDY to
be on INT1 and Any Motion event on INT2.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-11-17 14:44:18 -06:00
Emil Obalski
773f02e6e9 usb: drivers: Fix ZLP handling for Nordic driver.
ZLP - zero length packet is used to indicate that the device
has no more data to send. If the Host asks for more data that the
device can provide and the data size is mutliplication of Endpoint
wMaxPacketSize then the device must terminate the data transfer
with ZLP.

Until this patch Nordic device driver controller was not aware of
the requested data length and could not determine when the ZLP was
required.

This patch introduces a fix that prevents the driver from starting
setup stage before the ZLP is being send.

For consistance with the Zephyr USB stack sending ZLP must be
issued from the stack level. Making trans_zlp flag true results
in blocking the driver from starting setup stage without required
ZLP.

After the data transfer finishes the driver will be prepared for ZLP
and will call back the stack to start writing ZLP. After the ZLP
is being send the driver will automatically start status stage and
end the Control Transfer.

This patch also removes CONFIG_USB_DEVICE_DISABLE_ZLP_EPIN_HANDLING
and aligns Nordic driver with others.

Without this patch the issue could occur when handling get requests.
Typical case is string descriptor of length equal to wMaxPacketSize.
Hosts usually asks for wLength = 255 Bytes when string descriptors
are being requested. In that case to successfully finish the data
stage of the Control transfer the device must send wMacPacketSize
Bytes of actual string descriptor and then ZLP to indicate that no
more data are present. After ZLP the status stage may start and the
request is finished successfully.

Without this patch the driver will not send ZLP making it unable
to end the Control Request successful - this may lead to failing
'Device Descriptor Test' from USB3CV test tool.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-11-17 18:06:26 +01:00
Emil Obalski
2eb2bc325e usb: drivers: Save setup packet in the driver structure.
This patch adds setup packet copy in the Nordic device
controller driver (ubs_dc_nrfx.c). This patch is required
for subsequent patch that fixes isssues with ZLP handling.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-11-17 18:06:26 +01:00
Emil Obalski
b3c63425a0 usb: driver: Reduce Endpoint buffer pool.
IN Endpoints does not require to have initialized internal
buffer. The data send are not copied to the internal buffer
anymore. This patch reduces memory usage for IN Endpoints.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-11-17 18:06:26 +01:00
Emil Obalski
8dacb99e5e usb: drivers: Do not fragment IN transfers for Nordic.
Nordic device driver controller (usb_dc_nrfx.c) was fragmenting
IN transfers longer than wMaxPacketSize long using its
internal buffers. Buffers were reserved for each endpoint.
Because the Low level driver (nrfx) is capable of handling
fragmentation, there is no need to do it at the driver
controller level. Data pointer is used directly to create
the nrfx transfer. Endpoint buffers are not required anymore
and could be dropped.

This patch removes fragmentation of in transfers and omits
usage of internal endpoint buffers. Buffer could be later
freed by subsequent patches.

Nordic low level usbd driver is also capable of adding ZLP
if required however for consistance with the Zephyr USB device
stack ZLP must be triggered from stack level.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-11-17 18:06:26 +01:00
Krzysztof Chruscinski
e612587e28 drivers: clock_control: nrf: Add handling of HFCLK192M_STARTED event
An event was not handled by the clock control resulting in assert
and lack of notification about clock readiness.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-11-17 11:32:10 +01:00
Jukka Rissanen
b16602afb5 drivers: modem: gsm: Fix DEVICE_DEFINE() data ptr
The commit 5e97d779bb ("device: convert DEVICE_INIT to DEVICE_DEFINE
or SYS_DEVICE_DEFINE") did not convert the gsm_ppp.c properly. The
power management parameter was not set to NULL but was pointing to
the data pointer.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-16 14:26:37 -05:00
Czeslaw Makarski
63fe072a1d drivers: ieee802154: Deny use of nRF FICR registers in NS domain
This commit introduces the catch that prevents building of
IEEE 802.15.4 nRF driver in case the non-secure domain of the core
is used.

Signed-off-by: Czeslaw Makarski <Czeslaw.Makarski@nordicsemi.no>
2020-11-16 15:24:03 +01:00
Jedrzej Ciupis
15fdd7175b drivers: ieee802154: Add support for IEEE 802.15.4 for nRF5340
This commit introduces support for IEEE 802.15.4 on nRF5340.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2020-11-16 15:24:03 +01:00
Czeslaw Makarski
b6b613d4db modules: nordic: Introduce nRF IEEE 802.15.4 Service Layer selection
This patch introduces the nRF IEEE 802.15.4 Service Layer configuration.

Signed-off-by: Czeslaw Makarski <Czeslaw.Makarski@nordicsemi.no>
2020-11-16 15:24:03 +01:00
Johan Hedberg
f004410aa1 drivers: pcie: Rename pcie_wired_irq to pcie_get_irq
This reflects better the actual purpose of the API.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-11-14 11:13:00 +02:00
Johan Hedberg
e2b243893d drivers: i2c: dw: Update to use new pcie_alloc_irq API
Take advantage of the new pcie_alloc_irq() API so that we get a valid
IRQ on platforms where the IRQ register is not pre-populated with a
valid value up front.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-11-14 11:13:00 +02:00
Johan Hedberg
3203fd3200 drivers: serial: ns16550: Update to use new pcie_alloc_irq API
Use the new pcie_alloc_irq() API so that we get a valid IRQ on
platforms where the IRQ registers do not contain valid values up
front.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-11-14 11:13:00 +02:00
Johan Hedberg
9e4dfd8f4e drivers: pcie: Add support for IRQ allocation management
There are x86 platforms where the IRQ configuration register for PCIe
is not pre-populated and the OS needs to assign a number dynamically
by writing to the register.

In order to allocate interrupts we have to know which ones have been
hard-coded in device tree. We accomplish this by collecting these
values through the IRQ_CONNECT() macro and placing them in a dedicated
linker section (in ROM).

The full set of allocated interrupts are managed through a bitmap, and
the pre-allocated values (from the linker section) are inserted into
this upon initial runtime access.

This patch introduces a new pcie_alloc_irq() API that drivers can use
to allocate interrupt line numbers. The two in-tree drivers that were
using this API (I2C and UART) are converted to use the new API.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-11-14 11:13:00 +02:00
Martin Åberg
bb5a565aaa timer: Add support for GRLIB GPTIMER
This adds support for GRLIB GPTIMER general purpose timer used in
LEON3/4/5 systems.

One of the GPTIMER subtimers is used to generate periodic interrutps
for announcing ticks. Another subtimer is used as upcounter for the
cycle_get_32() service.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2020-11-13 14:53:55 -08:00
Martin Åberg
ae309f8597 serial: apbuart interrupt support
Adds driver support for APBUART transmitter and receiver
interrupts. Compatible with APBUART implementations without HW FIFO
interrupt, for example QEMU.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2020-11-13 14:53:55 -08:00
Martin Åberg
4888afd793 serial: Add support for GRLIB APBUART
This adds support for the GRLIB APBUART UART peripheral commonly used in
LEON3/4/5 systems.

Driver features:
- Auto-detecting debug FIFO, if configured by GRMON
- Setting and getting UART transfer attributes
- Hardware FIFO if available
- Any number of APBUART devices based on devicetree
- Error status indication
- Polled operation

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2020-11-13 14:53:55 -08:00
Martin Åberg
1a3784d6b7 intc: Add support for GRLIB IRQMP
This adds support for the GRLIB IRQMP interrupt controller commonly used
in LEON3/4/5 systems.

The driver supports the 15 SPARC interrupts and 16 extended interrupts.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2020-11-13 14:53:55 -08:00
Andreas Dröscher
49a3ce5881 i2c-mcux: take semaphore during transfer
Neither i2c_transfer in i2c.h nor i2c_mcux_transfer in i2c_mcux.c
have any sort of locking. If e.g. an i2c eprom is updated using a
shell and simultaneously another thread access a lm75 then one
of the two transfers will fail or produce a random result.

This changes addresses this issue by that all i2c_msgs of one
i2c_transfer are completed before allowing a subsequent transfer
to start.

The code has been validated on a FRDM_K64F.

Signed-off-by: Andreas Dröscher <github@anticat.ch>
2020-11-13 09:14:09 -06:00
Vinayak Kariappa Chettimada
cb1cf54406 drivers: Bluetooth: rpmsg: Fix typo in BT_QUIRK_NO_AUTO_DLE use
Use CONFIG_BT_QUIRK_NO_AUTO_DLE as quirk option's
conditional compilation check.

Regression introduced in commit bd7ee86496 ("drivers:
Bluetooth: rpmsg: Add missing BT_QUIRK_NO_AUTO_DLE").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-13 10:13:22 +01:00
Emil Obalski
1ebe1573da usb: nordic: Clear STALL when Endpoint is enabled.
Endpoint STALL should be cleared when Endpoint is enabled.
In particular when the HOST performs SetInterface requests
and Endpoints associated with that Interface are enabled
STALL should be cleared.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-11-12 08:59:08 -06:00
Justin Brederveld
28297adde4 drivers: flash: stm32f4: Don't invert an already inverted mask
Clearing the PSIZE bits in the FLASH CR should not invert the mask
defined in stm32f4xx_hal_flash.h (#define CR_PSIZE_MASK 0xFFFFFCFFU)

Signed-off-by: Justin Brederveld <jmbrederveld@gmail.com>
2020-11-12 08:56:06 -06:00
Andrzej Głąbek
74930b9256 soc: nrf53: Add enabling of LFXO pins (XL1 and XL2)
Add a Kconfig option (enabled by default) the enables the low-frequency
oscillator (LFXO) functionality on the XL1 and XL2 pins in the nRF53
SoC initialization routine. This cannot be done in the clock control
driver, as it was done so far, because that won't work in a setup where
the application core image does not use the system clock at all.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-11-12 14:23:33 +01:00
Mohamed ElShahawi
9d1c47521f drivers: wifi: esp DHCP/Static IP Support
- Add ESP DHCP Support
- Add ESP Static IP Support including
 KConfig entries for configuring IP,Gateway and netMask

Signed-off-by: Mohamed ElShahawi <ExtremeGTX@hotmail.com>
2020-11-12 07:59:10 +02:00
Christopher Friedt
c80fe8ae69 drivers: ieee802154: cc13xx_cc26xx: use multi-protocol radio patch
This change enables the multi-protocol rf patch to be used for
the cc13xx_cc26xx IEEE 802.15.4 2.4 GHz PHY, which allows both
the 2.4 GHz and Sub GHz PHY to be used simultaneously.

Eventually, BLE will also work simultaneously on 2.4 GHz (with
arbitration).

Fixes #29883

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-11 17:03:21 +02:00
Ievgenii Meshcheriakov
03b57ac058 drivers: sock_flash_nrf: Report errors to log
Report errors using logging subsystem so it is easier to
see the error location while debugging code.

Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
2020-11-11 08:30:50 -05:00
Armando Visconti
c380142920 drivers/sensor: iis2iclx: add multi-instance
Make this driver multi-instance and use the new API.

Notes for sensorhub mode:
In case of multiples devices it is possible that some of them
has i2c slaves attached to it (sensorhub mode) but not the
others. Since the driver is configured in the same way for
all the instances (CONFIG_SENSORHUB=y), the routine that initialize
the sensorhub part does not fail anymore in case no slaves
are found for a particular instance. Instead, those non-sensorhub
driver instances will set the shub_inited flag to false and
will totally ignore the feature.

Notes for triggers:
In case of multiples devices the device pin the interrupt wire is
attached to can be different (INT1 or INT2 pin). So, this
information has been moved in DTS and then stored in the
specific instance config structure.
Currently the driver is able to handle a sngle interrupt line
at a time attached to either INT1 or INT2.
MOreover, the interrupt initialization for a driver instance proceed
only if the drdy has been configured in its DT, else it returns ok.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-11-11 13:17:18 +01:00
Gerard Marull-Paretas
4812bb5175 drivers: display: ili9xxx: add support for ILI9488 controller
Add support for the ILI9488 display controller.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-11-10 15:52:12 -06:00
Gerard Marull-Paretas
acb0cd65ca drivers: display: ili9xxx: generalize ILI display driver
Make driver generic for multiple ILI displays. The adopted strategy is
to share all driver code except register initialization, which has been
found to have some specific registers/values depending on the
controller.

The driver has been adjusted to support multiple compatibles.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-11-10 15:52:12 -06:00
Andrzej Głąbek
be02edb050 drivers/flash/nrf_qspi_nor: Add support for nRF53 Series SoCs
Improve the way the nrf_qspi_nor driver configures the SCK frequency,
to properly support QSPI also on nRF53 Series SoCs that use a different
base clock frequency (96 MHz).
Add also a relevant configuration in the spi_flash sample so that it
can run on the nRF5340 DK.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-11-10 21:01:37 +02:00
Kumar Gala
5e97d779bb device: convert DEVICE_INIT to DEVICE_DEFINE or SYS_DEVICE_DEFINE
Convert handful of users of DEVICE_INIT to DEVICE_DEFINE or
SYS_DEVICE_DEFINE to allow deprecation of DEVICE_INIT.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-11-10 08:38:09 -06:00
Jose Alberto Meza
df43f17883 drivers: espi: xec: Avoid flash interrupt by ROM bootloader activity
When MEC15xx boots in MAFS, ROM bootloader performs activity over
eSPI flash channel prior to FW is loaded.
Need to clear STS_DONE during early eSPI driver initialization,
before enabling interrupts to avoid unexpected ISRs in FW.

Otherwise this would cause flash_lock semaphore to be incremented
due to ROM activity and result in FW's first espi flash request
to return immediately even before eSPI bus transaction completes.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-11-09 16:01:16 -08:00
Diwakar C
909072d012 peci: driver: Ping cmd fail due to improper tx len and wait handling
In current implementation, for Ping command, write data/payload is
queued in FIFO infinitely eventhough Ping command have write length
of '0'.

This issue is addressed in this patch.

Signed-off-by: Diwakar C <diwakar.c@intel.com>
2020-11-09 15:49:19 -06:00
Christopher Friedt
ec0e737b0c drivers: ieee802154: cc13xx_cc26xx: sub-ghz support
This change adds IEEE 802.15.4g (Sub GHz) support for the
cc1352r.

The 2.4 GHz radio and the Sub GHz radio are capable of
operating simultaneously.

Fixes #26315

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-09 10:25:24 +02:00
Fabio Utzig
0f1517a490 doc: fix broken rST syntax in Kconfig help
Update usage of literal syntax in Kconfig file from markdown to
proper rST.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-11-07 08:29:57 -06:00
Yurii Gubin
f700d74884 drivers: sensor: lsm6dsl: fixed irq_pin for interrupt handling
Obtaining irq_pin from dev leads to disabling interrupts
on unpredictable pin, as dev points to GPIO, not LSM6DSL.

Fixes #29721

Signed-off-by: Yurii Gubin <y.gubin@gmail.com>
2020-11-06 12:48:33 -06:00
Kumar Gala
b4a3880a75 drivers: remove unnecessary use of DEVICE_AND_API_INIT
For drivers that support CONFIG_DEVICE_POWER_MANAGEMENT there are some
cases that look like:

  #ifdef CONFIG_DEVICE_POWER_MANAGEMENT
    DEVICE_DEFINE()
  #else
    DEVICE_AND_API_INIT()
  #endif

There is no need to special case this as the pm_control_fn argument to
DEVICE_DEFINE will just be ignored in the
!CONFIG_DEVICE_POWER_MANAGEMENT case.  So we can cleanup the code a
little and remove the #else cases for the drivers that do this.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-11-06 09:42:47 -06:00
Pavel Král
97696f3ed0 uart: native_posix: Add support for pts readiness
Option to pause writing to the pseudo terminal until it is ready to
receive data. Useful for pseudo terminal synchronization with other
host processes.

Signed-off-by: Pavel Král <pavel.kral@omsquare.com>
2020-11-06 12:29:57 +01:00
Christian Taedcke
8910d1c59f drivers: ethernet: stm32: Add missing net_if_set_link_addr() call
When setting the MAC address, the ethernet driver has to call
net_if_set_link_addr() with the updated address. This was missing and is
added now.
See e.g.
https://github.com/zephyrproject-rtos/zephyr/pull/28874

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-11-06 10:11:10 +02:00
Trond Einar Snekvik
86c793af3f sys: util: Replace MIN(MAX(a, b), c) with CLAMP
Replaces all existing variants of value clamping with the MIN and MAX
macros with the CLAMP macro.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-05 12:12:17 +01:00
Abhishek Shah
1ecdbacc9d drivers: pcie_ep: iproc: clear pvm interrupts before handling
We should clear the pvm interrupts (snoop and pcie pmon lite interrupt)
at source before handling them.

This will make sure that we do not lose any interrupts that may have
been asserted to interrupt controller during the handling routine.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-11-05 10:18:20 +01:00
Marcin Niestroj
2bab204ba3 drivers: wifi: esp: increase default RX net_pkt allocation timeout
So far there was 100ms timeout on allocation of RX net_pkt. This is too
little for cases when lots of data are incoming on pretty
fast (e.g. 1Mbps) UART interface and application layer does not consume
received network packets fast enough. Up to now in such cases all
incoming data was processed from UART and there was no data loss when
utilizing hardware flow control. However there was high chance that data
processed from UART could not be passed further to network stack,
because of the 100ms net_pkt allocation timeout. This happens for
example when low priority application does not have enough time to run.

Increase default RX net_pkt allocation timeout from 100ms to 5s, so
there is much more time to process network packets. Such timeout should
not harm, because only a dedicated RX thread will be suspended for that
time, resulting in suspending UART traffic if hardware flow control is
supported.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-11-04 09:02:04 +02:00
Marcin Niestroj
469053cc22 drivers: wifi: esp: allow to configure RX net_pkt allocation timeout
There is now a hardcoded 100ms timeout on allocating new net_pkt for
received data. Move that configuration to Kconfig, so that value can be
tuned according to application needs.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-11-04 09:02:04 +02:00
Mohamed ElShahawi
d90da6fc9b drivers: wifi: rename WiFi kconfig prompt
use same naming convention for kconfig drivers entries

Signed-off-by: Mohamed ElShahawi <ExtremeGTX@hotmail.com>
2020-11-03 19:18:37 +02:00
Marcin Niestroj
8027612529 drivers: wifi: esp: close stream socket on allocation failure
There is no reason to keep active stream socket when there was some data
loss. Mark such socket for closing and close it when all (so far)
received packets have been processed.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-11-03 09:28:45 -06:00
Erwan Gouriou
aea89e565d drivers/pinmux: stm32: Deprecate SDMMC related macros
Following migration of all in-tree boards to device tree bindings
for SDMMC pins configuration, deprecate SDMMC related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
3289802268 drivers/pinmux: stm32: Deprecate I2S related macros
Following migration of all in-tree boards to device tree bindings
for I2S pins configuration, deprecate I2S related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
8c4c37e6f5 drivers/pinmux: stm32: Deprecate USB related macros
Following migration of all in-tree boards to device tree bindings
for USB pins configuration, deprecate USB related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
543b9e3ced drivers/pinmux: stm32: Deprecate ETH related macros
Following migration of all in-tree boards to device tree bindings
for ETH pins configuration, deprecate ETH related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
e992659260 drivers/pinmux: stm32: Deprecate ADC related macros
Following migration of all in-tree boards to device tree bindings
for ADC pins configuration, deprecate ADC related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
377f24a8d1 drivers/pinmux: stm32: Deprecate SPI related macros
Following migration of all in-tree boards to device tree bindings
for SPI pins configuration, deprecate SPI related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
164050f781 drivers/pinmux: stm32: Deprecate I2C related macros
Following migration of all in-tree boards to device tree bindings
for I2C pins configuration, deprecate I2C related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
c8065601af drivers/pinmux: stm32: Deprecate DAC related macros
Following migration of all in-tree boards to device tree bindings
for CAN pins configuration, deprecate DAC related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
3d5280503e drivers/pinmux: stm32: Deprecate CAN related macros
Following migration of all in-tree boards to device tree bindings
for serial pins configuration, deprecate CAN related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
5652b4a698 drivers/pinmux: stm32: Deprecate (LP)U(S)ART related macros
Following migration of all in-tree boards to device tree bindings
for serial pins configuration, deprecate (LP)U(S)ART related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
6a03627d1f drivers/pinmux: stm32: Deprecate PWM related macros
Following migration of all in-tree boards to device tree bindings
for pwm pins configuration, deprecate PWN related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Maureen Helm
3498d43784 drivers: ethernet: Rework mcux driver to use DT_INST_FOREACH
Reworks the mcux ethernet driver to use DT_INST_FOREACH_STATUS_OKAY and
eliminate a lot of duplicate code between instance 0 and instance 1.

Renames the ERR_MISC interrupt to ERR due to an issue with the
underscore in the device tree preprocessor macros.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-11-03 11:05:55 +01:00
Gerson Fernando Budke
d8c9cb8d89 drivers: wifi: eswifi: Add uart bus interface
Add uart bus interface to extended esWIFI driver.  This enables all
Inventek modules with IWIN AT Commands firmware.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2020-11-03 11:05:43 +01:00
Gerson Fernando Budke
f479f60f84 drivers: wifi: eswifi: Drop WIFI_ESWIFI_NAME config
The WIFI_ESWIFI_NAME config would be uselful when there is no device
tree alternative.  The esWIFI driver already is on device tree and the
label property exists.  This remove WIFI_ESWIFI_NAME Kconfig variable
and switch to device tree equivalent.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2020-11-03 11:05:43 +01:00
Gerson Fernando Budke
6bb879e72a drivers: wifi: eswifi: Drop global data visibility
Remove global access to structure eswifi_spi_data variable.  Instead,
add a method to pass access to that structure.  This allows better
control to the data bus variable.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2020-11-03 11:05:43 +01:00
Gerard Marull-Paretas
6b81695946 drivers: pwm: stm32: fix timer clock calculation
Calculation of the timer clock was wrong for some F4/F7/H7 series.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-11-03 11:03:54 +01:00
Christopher Friedt
bb7c58f65e ieee802154: cc13xx_cc26xx: workaround for issue in ti driver
This is a temporary workaround for an issue in TI's RF Driver
API. A subsequent release of the SimpleLink SDK will mitigate
the need for it and it can be reverted when hal/ti receives
that update.

Fixes #29418

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-03 11:03:35 +01:00
Christopher Friedt
8e2978d577 drivers: ieee802154: cc13xx_cc26xx: use ti rf driver api
This change reworks the cc13xx_cc26xx IEEE 802.15.4 driver to use
the TI RF driver API that is available in modules/hal/ti.

There are a number of benefits to using TI's API including
 - a stable multi-OS vendor library and API
 - API compatibility with the rest of the SimpleLink SDK and SoC family
 - potential multi-protocol & multi-client radio operation
   (e.g. both 15.4 and BLE)
 - coexistence support with other chipsets via gpio
 - vetted TI RF driver resources, such as
   - the radio command queue
   - highly tuned / coupled RTC & RAT (RAdio Timer) API

Fixes #26312

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-03 11:03:35 +01:00
Armando Visconti
667db2db88 drivers/sensor: lsm6dsl: Fix build when irq_gpios is not in DT
In case of h/w setup with multiples device instances it is possible
that some of them wants to use triggers but not the others (no
interrupt line.

Since Kconfig configuration is the same way for all the instances
(CONFIG_LSM6DSL_TRIGGER=y), the driver behaves differently according
to how the device instance has been configured in the DT.
If irq-gpios is present, then the driver initialize the interrupt
part, else it skip irq init and returns ok, but data->gpio != NULL
xis checked in trigger_set() API.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-11-02 10:00:07 -06:00
Stephane D'Alu
61b0009bdf sensor_shell: added missing sensor channel.
Synchronized with list of channel defined in sensor.h

Signed-off-by: Stephane D'Alu <sdalu@sdalu.com>
2020-11-02 09:52:54 -06:00
Alexandre Bourdiol
c47a5d4a36 drivers: pwm: pwm_stm32.c: enable ARR preload
Enable ARR preload so that period or pulse updates are taken
into account synchronously with update event
(at the end of a ongoing period)
And thus avoid undetermined intermediate pulse.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-10-30 15:59:32 +01:00
Gerard Marull-Paretas
c8687bc2e4 drivers: ethernet: stm32: add support for DT pinctrl
Add support for configuring Ethernet pins using DT pinctrl entries. Note
that F1 series pinctrl support is not handled as the driver does not
support F1.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-10-30 15:54:13 +01:00
Ryan Erickson
d3dcf49735 drivers: modem: hl7800: Make RX net_bufs configurable
Make receive network buffer count and size
configurable via kconfig.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-10-30 10:09:48 +02:00
Andreas Dröscher
a812f3d7b6 adc-mcux: add support for adc16 channel multiplex
Channels 4..7 are multiplexed on adc16. The NXP HAL exposes
ADC16_SetChannelMuxMode but this function is not yet included
in Zephy. The following patch adds channel-mux-b to the dts
enabling the use of the alternate channels of 16 bit adc.

Signed-off-by: Andreas Dröscher <github@anticat.ch>
2020-10-29 13:43:24 -05:00
Mahesh Mahadevan
7ad4eb4e40 drivers: eth_mcux: Update to match changes to the SDK driver
1. Merged the single/multiple ring(s) APIs, now these APIs
can handle both which requires passing a ring id.
2. Updated timestamp handling to match the new timestamp
implementation in the SDK driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-10-29 13:28:44 -05:00
Guillaume Lager
de1b7e48d1 eeprom: at2x: Add support for at24cXX
Those devices can use several I2C address in order to address more
than 256 Bytes using 8bit addressing. Also several physical component
can be used as a contiguous memory.

Signed-off-by: Guillaume Lager <guillaume.lager@gmail.com>
2020-10-28 17:03:47 +01:00
Emil Obalski
33fdaac74d drivers: usb: Start Nordic driver workqueue at USB init.
This patch makes the initialization of workqueue earlier
for Nordic driver. Without this change Nordic devices
will fail tests/subsys/usb/device test as it is resetting
USB and by that will try to start already started workqueue
thread. This may lead to Zephyr fatal error.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-10-28 17:02:22 +01:00
Simon Guinot
525a588db4 drivers: led: add driver for PWM LEDs
This driver supports the PWM driven LEDs. The devices are created from
the DT nodes with a compatible property matching "pwm-leds". For each
child node a LED is created and its "pwms" phandle's node is used to
retrieve the PWM configuration: channel, period and flags. If some of
this properties are missing (it is the case for some PWM controllers),
then reasonable default values are used.

This driver implements the following LED API methods:

- led_on
- led_off
- led_blink
- led_set_brightness

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-10-28 10:44:46 -05:00
Erwan Gouriou
344ff12c37 drivers/i2s: stm32: Convert to dt based pinctrl configuration
Convert STM32 I2S driver to dt based pinctrl configuration

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-28 09:29:56 -05:00
Alexandre Bourdiol
d9798b9022 modules: Delete switches USE_STM32_HAL_RCC and USE_STM32_HAL_RCC_EX
With STM32Cube updates
https://github.com/zephyrproject-rtos/hal_stm32/pull/75
'..._hal_rcc.c' and '..._hal_rcc_ex.c' are now systematically
compiled, due to more and more dependencies from HAL IP on rcc.
So USE_STM32_HAL_RCC and USE_STM32_HAL_RCC_EX becomes useless.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-10-28 09:28:15 -05:00
Peter A. Bigot
f951566e56 drivers: regulator: add GPIO-controlled regulator driver
This provides structure for the regulator device hierarchy and a
driver for GPIO-controlled regulators along with its binding.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-10-28 15:22:53 +01:00
Simon Glass
0b1a7d109d drivers: sensor: bmi160: Add support for I2C
At present this driver only supports SPI. Add support for I2C as well,
following the model of BME280.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Simon Glass
0de655e371 drivers: sensor: bmi160: Prepare to support I2C
At present this driver only supports SPI. Refactor it so that SPI is
just one of the options. This does not change any functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Simon Glass
1f1f695ae2 drivers: sensor: bmi160: Rename 'spi' to 'bus'
This member holds the SPI bus pointer. Change its name to make that
more obvious and so that it can be used for an I2C bus also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Simon Glass
28f8ddae0b drivers: sensor: bmi160: Use only one read/write function
At present there are three separate read functions and two write
functions. This makes it harder to provide an interface that can work
with either SPI or I2C.

Use bmi160_read() for all reads and create a new bmi160_write()
function for all writes.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Simon Glass
226cacbc3d drivers: sensor: bmi160: Move SPI config to config
At present this driver only supports a single instance. It sets up some
of its config in the init routine. It is better to put config in
constant data so that multiple instances can be supported and RAM space
is minimised.

Update the driver accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Simon Glass
57fdcd4018 drivers: sensor: bmi160: Use 'data' for the data pointer
Currently a 'bmi160' pointer is used to point to the driver data. This
confusing, as the driver uses both data and config. Rename the variable
to 'data' like the bme280 driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Simon Glass
a32f87b1e0 drivers: sensor: bmi160: Define accessors for the bmi160
Add inline functions to obtain the data and configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Simon Glass
c3823b9144 drivers: sensor: bmi160: Shorten the structs a bit
This driver uses verbose names for the config and data structures, which
makes it harder to see which one we are talking about. Shorten it, like
the bme280 driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Marcin Niestroj
5fa69327f2 drivers: modem: ublox-sara-r4: allocate in modem_cmd_handler with K_NO_WAIT
All net_bufs allocated to modem_cmd_handler's data->rx_buf are consumed
synchronously in ublox-sara-r4.c in the same thread. This means that
allocating them with timeout makes no sense, because timeout
will *always* be hit when there are no more buffers in net_buf_pool.

Get rid of the unnecessary timeout, as it doesn't help and just slows
down processing of incoming data, increasing possibility of data
overrun.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-27 09:32:51 -05:00
Marcin Niestroj
94caa8f2fd drivers: modem: gsm: allocate in modem_cmd_handler with K_NO_WAIT
All net_bufs allocated to modem_cmd_handler's data->rx_buf are consumed
synchronously in gsm_ppp.c in the same thread. This means that
allocating them with timeout makes no sense, because timeout
will *always* be hit when there are no more buffers in net_buf_pool.

Get rid of the unnecessary timeout, as it doesn't help and just slows
down processing of incoming data, increasing possibility of data
overrun.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-27 09:32:51 -05:00
Marcin Niestroj
b3272f3fe8 drivers: wifi: esp: allocate in modem_cmd_handler with K_NO_WAIT
All net_bufs allocated to modem_cmd_handler's data->rx_buf are consumed
synchronously in esp.c in the same thread. This means that allocating
them with timeout makes no sense, because timeout will *always* be hit
when there are no more buffers in net_buf_pool.

Get rid of the unnecessary timeout, as it doesn't help and just slows
down processing of incoming data, increasing possibility of data
overrun.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-27 09:32:51 -05:00
Marcin Niestroj
318cbe649a drivers: modem: cmd_handler: rework reading from interface
So far a dedicated buffer was used for data read from modem
interface. New net_bufs were allocated and filled later, which means
that data was lost when no more net_bufs were available in the pool.

Prevent data loss by allocating net_buf before attempting any read on
modem interface. Process incoming data in a loop as long as reading from
interface results in new data. Also remove dedicated buffer
(data->read_buf) and directly fill net_buf content instead. As a side
effect there are less memory copy operations and RAM usage is reduced.

Pre-allocated net_buf is now always appended to data->rx_buf. When there
was no (more) data read from interface to such net_buf, then this empty
net_buf will be on the end of data->rx_buf fragment list. Update
skipcrlf() and findcrlf() implementations to explicitly check for each
net_buf length, instead of blindly assuming them to have at least single
byte.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-27 09:24:38 -05:00
Marcin Niestroj
3d659a35bb drivers: modem: cmd_handler: split cmd_handler_process() implementation
cmd_handler_process() does two major things:

 - reads data from modem interface and fills data->rx_buf,
 - processes data in data->rx_buf.

Split implementation accordingly to two separate functions, which
improves readability (less automatic variables to follow at once) and
simplifies refactoring of each action.

No functional change was intended in this commit.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-27 09:24:38 -05:00
Cassini Zhuang
3d3119b1e7 drivers/i2c: i2c_gpio:init at POST_KERNEL
This is to make the gpio-i2c initialization occur after the GPIO pin
clock initialization.

Signed-off-by: Cassini Zhuang <cassini.zhuang@hansonggroup.com>
2020-10-26 09:01:09 -04:00
Parthiban Nallathambi
88034a9dad ethernet: w5500: remove comparing uint64, int64
z_tick_get returns signed int. Adapt comparision
statement for remaining time computation.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-10-26 07:35:46 -04:00
Parthiban Nallathambi
9a581642d1 ethernet: w5500: use bit fielding number for mode
bit field access with WRITE_BIT needs bit number, not the
value after BIT(mr).

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-10-26 07:35:46 -04:00
Kumar Gala
9f97a1c8ab drivers: modem: wncm14a2a: fix build if CONFIG_MODEM_SIM_NUMBERS=n
If CONFIG_MODEM_SIM_NUMBERS is 'n' than the data_imei field of struct
modem_context doesn't exist, so add ifdef protection for that case.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-23 08:53:38 -05:00
Bent Ove Stinessen
72d5dee2e3 drivers: gpio_pca95xx: Add GPIO driver enable interrupt support
Allows the use of pin interrupt and callbacks for pca95xx family
GPIO expander chips with an interrupt line.

Enable config flag and define a gpio pin for the expander interrupt-
line (INT) in devicetree and the driver will accept pin interrupt
configurations for the expander gpio pins.

Level triggering is supported through emulation.
A worker is used to avoid waiting for I2C in ISR.

Example devicetree node:
	gpioext0: tca9539@77 {
		compatible = "nxp,pca95xx";
		label = "GPIO_EXT_0";
		reg = <0x77>;
		interrupt-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
		gpio-controller;
		#gpio-cells = <2>;
		ngpios = <16>;
	};

Fixes: #27561

Signed-off-by: Bent Ove Stinessen <bent@norbit.no>
2020-10-23 13:47:41 +02:00
Clotilde Sattler
168f8bec6d nrfx_spi and nrfx_spim: Fix SPI assert and busy error
This removes a semaphore unlock in init_spi function
which causes risks of competitive access

Signed-off-by: Clotilde Sattler <clotilde.sattler@stimio.fr>
2020-10-23 12:53:19 +02:00
Crist Xu
237b34ef2d watchdog: Add watchdog driver
Add watchdog driver for the RT1050/60

Signed-off-by: Crist Xu <crist.xu@nxp.com>
2020-10-23 12:52:13 +02:00
Gerard Marull-Paretas
e807769dce drivers: display: ili9340: align register names
Align register names with the ones found in the datasheet. It is easier
to follow datasheet if names are the same.

Some other minor enhancements have also been introduced (comments, use
BIT for bit fields...).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-10-22 15:31:18 -05:00
Erwan Gouriou
a1cb59398b drivers/usb: stm32: Add support for pinctrl configuration
Enable configuration of USB signals in stm32 driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-22 10:34:14 -05:00
Erwan Gouriou
5a9eff1e1a drivers/usb: stm32: Clean up related to DT api usage
Few adjustments made to make the code a bit more readable.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-22 10:34:14 -05:00
Andrzej Głąbek
a97611a399 drivers: usb_dc_nrfx: Correct the nrfx_power driver configuration
The initial configuration provided for the nrfx_power driver cannot
contain just default values, as that mean that DC/DC converters are
to be disabled, while those converters may be (and they actually are
by default for many boards) enabled through Kconfig.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-10-22 14:08:13 +02:00
Abhishek Shah
b53f62d259 drivers: pcie_ep: iproc: Add MSI-X PVM feature for Viper
Add support for interrupt driven MSI-X PVM feature for Viper.
Function mask bit update is tracked with snoop interrupt
and vector mask bit update is tracked with pcie pmon lite
address range access detection interrupt.
Both the interrupts are required to enable this feature.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-10-22 11:07:39 +02:00
Abhishek Shah
7309322319 drivers: pcie_ep: iproc: move msi(x) functions
drivers: pcie_ep: iproc: move msi/msix functions to a separate
file. This increases readability and modularity.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-10-22 11:07:39 +02:00
Abhishek Shah
8d226c595d drivers: pcie_ep: iproc: shorten file names
File names such as pcie_ep_bcm_iproc.c / pcie_ep_bcm_iproc_regs.h
seem unnecessarily long, same with CONFIG symbols' names.
Let's shorten them by replacing 'bcm_iproc' with simply 'iproc'.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-10-22 11:07:39 +02:00
Abhishek Shah
9b09125fe8 drivers: pcie_ep: iproc: enable reset interrupts conditionally
Reset interrupts should be enabled only if corresponding interrupt
lines are active.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-10-22 11:07:39 +02:00
Abhishek Shah
4a2870f0a2 drivers: pcie_ep: iproc: update registers for v2 IP
Update registers for iproc v2 PCIe EP IP

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-10-22 11:07:39 +02:00
Nicolai Glud
9ed7b6bd3c drivers: wifi: winc1500: removed semaphore on accept.
Listen func goes through a chain of calls to call winc1500_accept.
This is done to install the accept callback and should not block.
This fixes #28953 where winc1500 driver blocks on listen.

Signed-off-by: Nicolai Glud <nicolai.glud@prevas.dk>
2020-10-21 12:54:38 -05:00
Mulin Chao
d55aa5a71b driver: npcx7: replace platform specific functions with 'npcx_' prefix.
Replace all platform specific functions with 'npcx_' prefix.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-10-21 12:49:02 -05:00
Andrzej Głąbek
a36c66dd40 drivers: uart_nrfx_uart: Replace k_delayed_work with k_timer
There is no need to involve a work queue to control timeouts in
the uart_nrfx_uart driver. Kernel timers are sufficient for those
tasks, and the uart_nrfx_uarte driver may serve as a proof of this.
Replace then those uses of work queue with timers, for consistency
and simplicity, also to avoid potential issues with cancellation of
the delayed work queue items.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-10-21 17:55:18 +02:00
Philémon Jaermann
cbed8815a2 drivers: sensor: Use macro parameter to dereference device
The TACH_XEC_DATA macro was not using its parameter
to retrieve the data structure.
It was working by chance so far.

Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
2020-10-21 08:29:36 -04:00
Gerson Fernando Budke
03ef8feeb6 drivers: hwinfo: Add cypress psoc6 hwinfo support
Introduce Cypress PSoC-6 hwinfo driver.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2020-10-21 07:20:13 -05:00
Erwan Gouriou
12ef6b7d17 drivers/gpio: stm32: Fix formatting
Fix formatting for lines > 80 chars

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-21 06:43:42 -05:00
Erwan Gouriou
23f7eb0721 drivers/gpio: stm32f1: Revert gpio register programming re-ordering
In #29055, GPIO registers programming order was modified in order
to avoid late glitch generation when programming pins at device
driver init.
The issue had been seen on non F1 device, but it made sense
to be applied on F1 series as well.
After test, it appears that it doesn't and initial F1 code was fine.
New code is generating glitch on I2C bus.
Revert the change for F1 series.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-21 06:43:42 -05:00
Mahesh Mahadevan
cb715fc813 drivers: dma: Update NXP LPC driver for SPI peripheral
1, Change the allocation of DMA descriptors for the case
when multiple buffers are used for DMA transfer. This was
tested during SPI DMA transfers
2. Add support for the case when source and destination
addresses should not be incremented.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-10-21 06:26:40 -05:00
Mahesh Mahadevan
10809b5402 drivers: spi: Update MCUX Flexcomm driver to add DMA support
Add DMA support to the MCUX Flexcomm SPI driver

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-10-21 06:26:40 -05:00
Marin Jurjevic
a2efd284c8 drivers: pinmux: stm32 Fix return stm32_dt_pinctrl_remap value
Fix incorrect return value check when converting pinctrl
format to existing pin config format

Signed-off-by: Marin Jurjevic <marin.jurjevic@hotmail.com>
2020-10-21 06:18:51 -05:00
Anas Nashif
f92d0a4eee interrupt controller: set PER_CPU_OFFSET for new SoCs
Add missing SoCs and set PER_CPU_OFFSET

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-21 06:38:53 -04:00
Andy Ross
ad4116cafb soc: intel_s1000: Catch up with API skew
The header scheme for the IPM_CAVS_IDC driver changed and this legacy
platform (which is really a very close cousin of intel_adsp/cavs_v15)
broke.  Fix things up.  Longer term we should unify the two.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-10-21 06:38:53 -04:00
Anas Nashif
dc9127e93a ipm: cavs_idc: use the IPC/IDC definitions in SoC
The SoC definitions have the necessary IPC/IDC bits so there is
no need to define them separately.

Originally-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-21 06:38:53 -04:00
Andy Ross
544a38ee62 soc/xtensa/intel_adsp: Upstream updates
Significant rework of the Intel Audio DSP SoC/board layers.  Includes
code from the following upstream commits:

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Thu Jun 25 16:34:36 2020 +0100

    xtesna: adsp: use 50k ticks per sec for audio

    Audio needs high resolution scheduling so schedule to nearest 20uS.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andy Ross <andrew.j.ross@intel.com>
 Date:   Wed Jun 24 13:59:01 2020 -0700

    soc/xtensa/intel_adsp: Remove sof-config.h includes

    This header isn't used any more, and in any case shouldn't be included
    by SoC-layer Zephyr headers that need to be able to build without SOF.

    Signed-off-by: Andy Ross <andrew.j.ross@intel.com>

 Author: Andy Ross <andrew.j.ross@intel.com>
 Date:   Sat Jun 20 15:42:58 2020 -0700

    soc/intel_adsp: Leave interrupts disabled at MP startup

    This had some code that was pasted in from esp32 that was inexplicably
    enabling interrupts when starting an auxiliary CPU.  The original
    intent was that the resulting key would be passed down to the OS, but
    that's a legacy SMP mechanism and unused.  What it actually did was
    SET the resulting value in PS.INTLEVEL, enabling interrupts globally
    before the CPU is ready to handle them.

    Just remove.  The system doesn't need to enable interrupts until the
    entrance to the first user thread on this CPU, which will do it
    automatically as part of the context switch.

    Signed-off-by: Andy Ross <andrew.j.ross@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 23 13:57:54 2020 +0300

    dts: intel_cavs: Add required label

    Add required label fixing build for CAVS15, 20, 25.
    Fixes following errors:
    ...
    devicetree error: 'label' is marked as required in 'properties:' in
    bindings/interrupt-controller/intel,cavs-intc.yaml,
    but does not appear in
    ...

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 23 15:19:56 2020 +0300

    soc: cavs_v18: Remove dts_fixup and fix build

    Remove unused now dts_fixup.h and fix build with the recent code base.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 23 15:12:25 2020 +0300

    soc: cavs_v20: Remove dts_fixup and fix build

    Remove unused now dts_fixup.h and fix build with the recent code base.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 23 14:59:23 2020 +0300

    soc: cavs_v25: Remove dts_fixup fix build

    Remove unused now dts_fixup and fix build with the latest code base.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Fri Jun 12 12:29:06 2020 +0300

    soc: intel_adsp: Remove unused functions

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Jun 10 17:53:58 2020 +0300

    soc: intel_adsp: Clean up soc.h

    Remove unused or duplicated definitions.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Jun 10 17:02:23 2020 +0300

    soc: intel_adsp: De-duplicate soc.h

    Move soc.h to common SOC area.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Jun 10 15:54:19 2020 +0300

    soc: intel_adsp: Remove duplicated io.h

    Move duplicated io.h to common SOC area.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Fri Jun 12 12:39:46 2020 +0300

    cmake: Correct SOC_SERIES name for byt and bdw

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Fri Jun 12 12:39:02 2020 +0300

    soc: intel_adsp: Build bootloader only for specific SOCs

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Thu Jun 11 13:46:25 2020 +0100

    boards: xtensa: adsp: add byt and bdw boards WIP

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andy Ross <andrew.j.ross@intel.com>
 Date:   Wed Jun 10 10:01:29 2020 -0700

    soc/intel_adsp: Make the HDA timer the default always

    The CAVS_TIMER was originally written because the CCOUNT values are
    skewed between SMP CPUs, so it's the default when SMP=y.  But really
    it should be the default always, the 19.2 MHz timer is plenty fast
    enough to be the Zephyr cycle timer, and it's rate is synchronized
    across the whole system (including the host CPU), making it a better
    choice for timing-sensitive applications.

    Signed-off-by: Andy Ross <andrew.j.ross@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Jun 10 15:21:43 2020 +0300

    soc: cavs_v25: Enable general samples build

    Enables general samples build for SOC cavs_v25.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Jun 10 15:13:53 2020 +0300

    soc: cavs_v20: Enable general samples build

    Enable general sample build.

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Jun 10 14:35:13 2020 +0300

    soc: cavs_v18: Fix build general samples

    Fix building general samples for CAVS18.

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Jun 10 14:22:40 2020 +0300

    soc: intel_adsp: Add support for other SOCs

    Support other SOCs in the "ready" message to the Host.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Jun 10 13:25:39 2020 +0300

    soc: intel_adsp: Move adsp.c to common SOC area

    Move adsp.c to common and clean makefiles.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 9 17:18:18 2020 +0300

    boards: intel_adsp: Remove dependency on SOF

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Tue Jun 9 14:29:44 2020 +0100

    soc: xtensa: cavs: build now good for cavs20 + 25

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 9 15:57:01 2020 +0300

    soc: cavs_v15: Fix build for hello_world

    Fix build for other then audio/sof targets.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 9 14:50:12 2020 +0300

    sample: audio/sof: Remove old overlays

    Removing old overlays used to switch logging backend.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon Jun 8 15:02:01 2020 +0300

    soc: intel_adsp: Correct TEXT area

    Correct HEADER_SPACE and put TEXT to:
    (HP_SRAM_WIN0_BASE +  HP_SRAM_WIN0_SIZE + VECTOR_TBL_SIZE)

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 9 14:44:47 2020 +0300

    soc: intel_adsp: Trivial syntax cleanup

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 9 14:41:07 2020 +0300

    soc: intel_adsp: Fix bootloader script path

    Make it possible to find linker script if build is done not inside
    ZEPHYR_BASE.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Tue Jun 9 12:10:17 2020 +0100

    soc: xtensa: cavs20/25: fix build with new headers - WIP

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 9 13:35:38 2020 +0300

    soc: intel_adsp: Fix include headers

    Fixes include headers

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Tue Jun 9 10:38:50 2020 +0100

    soc: xtensa: cav18: updated headers- WIP

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andy Ross <andrew.j.ross@intel.com>
 Date:   Fri May 1 15:29:26 2020 -0700

    soc/xtensa/intel_adsp: Clean up MP config logic

    CONFIG_MP_NUM_CPUS is a platform value, indicating the number of CPUs
    for which the Zephyr image is built.  This is the value kernel and
    device code should use to predicate questions like "is there more than
    one CPU?"

    CONFIG_SMP is an application tunable, controlling whether or not the
    kernel schedules threads on CPUs other than the first one.  This is
    orthogonal to MP_NUM_CPUS: it's possible to build a "SMP" kernel on a
    uniprocessor system or have a UP kernel on a MP system if the other
    cores are used for non-thread application code.

    CONFIG_SCHED_IPI_SUPPORTED is a platform flag telling an SMP kernel
    whether or not it can synchronously signal other CPUs of scheduler
    state changes.  It should be inspected only inside the scheduler (or
    other code that uses the API).  This should be selected in kconfig by
    soc layer code, or by a driver that implements the feature.

    CONFIG_IPM_CAVS_IDC is a driver required to implement IPI on this
    platform.  This is what we should use as a predicate if we have
    dependence on the IPM driver for a platform feature.

    These were all being sort of borged together in code.  Split them up
    correctly, allowing the platform MP layer to be unit tested in the
    absence of SMP (c.f. tests/kernel/mp), and SMP kernels with only one
    CPU (which is pathlogical in practice, but also a very good unit test)
    to be built.

    Also removes some dead linker code for SMP-related sections that don't
    exist in Zephyr.

    Signed-off-by: Andy Ross <andrew.j.ross@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Jun 8 16:41:55 2020 +0100

    soc: xtensa: bootloader - use linker script

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Jun 8 16:26:18 2020 +0100

    soc: xtensa: further fix headers - WIP

    Simplify the directory structure, WIP for cavs20 and cavs25

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon Jun 8 12:59:30 2020 +0300

    soc: cavs_v15: Remove unneeded include

    Remove include fixing build.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Sun Jun 7 12:37:35 2020 +0100

    soc:xtensa: adsp: remove sof specific code from soc headers

    TODO: v1.8+

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Marc Herbert <marc.herbert@intel.com>
 Date:   Thu Jun 4 23:19:37 2020 -0700

    intel_adsp_*/doc: fix duplicate .rst labels

    Quick fix purely to make the build green again.

    Signed-off-by: Marc Herbert <marc.herbert@intel.com>

 Author: Marc Herbert <marc.herbert@intel.com>
 Date:   Thu Jun 4 22:34:40 2020 -0700

    samples/audio/sof: use OVERLAY_CONFIG to import apollolake_defconfig

    This reverts commit 21f16b5b1d29fca83d1b62b1b75683b5a1bc2935 that
    copied it here instead.

    Signed-off-by: Marc Herbert <marc.herbert@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Fri Jun 5 12:34:48 2020 +0300

    soc: intel_adsp: Move soc_mp to common

    Moving soc_mp to common SOC area, it still needs fixes for taking
    number of cores from Zephyr Kconfig, etc.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Thu Jun 4 16:05:06 2020 +0300

    soc: intel_adsp: Move memory.h from lib/

    For those files from SOF referencing platform/lib/memory.h we have
    include.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Thu Jun 4 15:20:09 2020 +0300

    soc: intel_adsp: Rename platform.h to soc.h

    Rename to prevent including it from SOF.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Thu Jun 4 11:47:55 2020 +0300

    soc: intel_adsp: Move headers

    Move headers to more convenient place

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Thu Jun 4 11:21:51 2020 +0300

    soc: intel_adsp: More SOC cleaning

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Marc Herbert <marc.herbert@intel.com>
 Date:   Mon Jun 1 15:31:34 2020 -0700

    samples/audio/sof: import sof/src/arch/xtensa/  apollolake_defconfig

    Import modules/audio/sof/src/arch/xtensa/configs/apollolake_defconfig
    into prj.conf and new boards/up_squared_adsp.conf

    Signed-off-by: Marc Herbert <marc.herbert@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed Jun 3 15:07:40 2020 +0100

    soc:xtensa: adsp: let SOF configure the DSP for audio

    Let SOF do this for the moment.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed Jun 3 15:06:20 2020 +0100

    soc: xtensa: cavs: remove headers similar to cavs15

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Jun 3 15:58:38 2020 +0300

    soc: intel_adsp: Move ipc header to common

    Remove duplicated headers from CAVS to common SOC part

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Jun 3 13:02:09 2020 +0300

    soc: cavs_v15: Remove unneeded headers

    Remove also from CAVS15.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 2 18:34:11 2020 +0300

    Remove more headers

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed Jun 3 14:12:09 2020 +0100

    soc: xtensa: remove cavs sod headers for drivers and trace.

    Duplicate cavs15 headers.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed Jun 3 14:05:12 2020 +0100

    samples: move sof dai, dma and clk configs to SOF

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 2 17:38:45 2020 +0300

    soc: intel_adsp: Remove more duplicated headers

    Remove more headers

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Tue Jun 2 15:50:03 2020 +0100

    samples: sof: remove pm realted files.

    Use the SOF versions.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 2 16:55:40 2020 +0300

    WIP: Strip lib from include path

    WIP, pushed for sync

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 2 14:44:33 2020 +0300

    soc: intel_adsp: Remove more headers

    Remove even more common headers

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Jun 2 14:00:47 2020 +0300

    soc: intel_adsp: Remove SOF headers

    The headers would be used by audio/sof app directly from SOF module.

 Author: Andy Ross <andrew.j.ross@intel.com>
 Date:   Sat May 30 11:01:26 2020 -0700

    soc/intel_adsp: Alternative log reading script

    This script speaks the same protocol and works with the same firmware,
    but:

    * Is a single file with no dependencies outside the python3 standard
      library and can be run out-of-tree (i.e. with setups where the
      firmware is not built on the device under test)

    * Operates in "tail" mode, where it will continue polling for more
      output, making it easier to watch a running process and acting more
      like a conventional console device.

    * Has no dependence on the diag_driver kernel module (it reads the DSP
      SRAM memory directly from the BAR mapping in the PCI device)

    * Is MUCH smaller than the existing tool.

    Signed-off-by: Andy Ross <andrew.j.ross@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Thu May 28 16:17:51 2020 +0300

    Decrease HEP pool size to 192000

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Fri May 29 10:27:00 2020 +0100

    soc: xtensa: cavs25: complete support for cavs25

    Builds, not tested on qmeu due to missing SOF ROM (TODO)

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Fri May 29 10:24:26 2020 +0100

    soc: xtensa: cavs20: complete cavs20 support

    Now boots on qemu.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Fri May 29 10:22:13 2020 +0100

    soc: xtensa: cavs18: complete boot support

    Now boots on qemu.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Fri May 29 10:19:23 2020 +0100

    soc: xtensa: cavs15: use cavs15 instead of apl as linker soc name

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Fri May 29 10:16:06 2020 +0100

    TODO: samples: sof: work  around missing trace symbols.

    Disable local trace.
    Needs trace updates finished before this can be removed.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed May 27 15:57:19 2020 +0100

    dts: xtensa: rename apl to cavs15 DTS

    This DTS is used by more than APL SOC. i.e. all CAVS15 SOCs

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed May 27 15:52:20 2020 +0100

    west: commands: sign: Add signing support for other CAVS targets

    Sign for CAVS15, CAVS18, CAVS20 and CAVS25 SOCs

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed May 27 15:50:07 2020 +0100

    boards: xtensa: cavs: used Zephyr mask macro

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed May 27 15:49:46 2020 +0100

    soc: xtensa: move code to SOF

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Tue May 26 11:40:36 2020 +0100

    soc: xtensa: use SOF versions of clk

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon May 25 18:38:45 2020 +0300

    soc: intel_adsp: Send FW ready for non SOF configuration

    Configure windows and send FW ready when used without SOF, should be
    loaded with fw_loader script.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon May 25 18:02:22 2020 +0300

    soc: intel_adsp: Use SOF version of the file

    Use exact copy from SOF module.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon May 25 17:47:27 2020 +0300

    soc: intel_adsp: Clean up include headers

    Remove SOF mentions from the SOC headers.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon May 25 17:43:05 2020 +0300

    soc: intel_adsp: Move SOF specific code to samples/audio/sof

    Move SOF specific code to the SOF sample.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon May 25 17:39:42 2020 +0300

    soc: intel_adsp: Use SOF module's version of mem_window.c

    Use exact copy from SOF module.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon May 25 17:36:41 2020 +0300

    soc: intel_adsp: Use exact copy from SOF module

    Use SOF module verion of the clk.c

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon May 25 14:03:35 2020 +0300

    soc: xtensa: Add {SOC_FAMILY}/common/include path

    Add ${SOC_DIR}/${ARCH}/${SOC_FAMILY}/common/include path if exist.
    Fixes issues for xtensa SOCs.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon May 25 16:18:50 2020 +0100

    soc: xtensa: cavs common: fix headers for build

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon May 25 16:10:57 2020 +0100

    soc: xtensa: adsp: add so_inthandlers.h for Intel platforms

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon May 25 16:08:26 2020 +0100

    cmake: xtensa: select correct compiler per CAVS target.

    TODO: what about XCC ?

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue May 19 14:59:26 2020 +0300

    boards: up_squared_adsp: Move SOF configuration to samples

    Move SOF-specific configuration to samples/audio/sof prj.

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Fri May 15 15:29:50 2020 +0300

    soc: intel_adsp: Move SOF code to modules/audio/sof

    Move SOF dependent code out of SOC area.

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Thu May 14 17:30:38 2020 +0300

    Move task_main_start() to audio/sof sample

    Start task_main_start() from main of audio/sof sample.

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed May 13 15:37:20 2020 +0300

    Rename up_xtreme_adsp to intel_adsp_cavs18

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon Apr 27 14:12:59 2020 +0300

    Add sample audio/sof for SOF initialization

    Add dedicated sample where we put SOF specific initialization.

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon May 11 18:49:36 2020 +0300

    WIP: soc: cavs_v18: Cleanup

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon May 11 15:44:06 2020 +0300

    soc: cavs_v15: Move soc init to common part

    Moving SOC init to the right place.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Mon May 11 15:02:28 2020 +0300

    soc: intel_adsp: Move common part to special dir

    Moving common part to common/adsp.c

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Fri May 8 14:37:50 2020 +0300

    boards: up_xtreme_adsp: Add initial up_xtreme_adsp board

    Add initial board copying existing up_squared_adsp board and using
    CAVS1.8 SOC family.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Thu May 7 15:30:51 2020 +0300

    soc: intel_adsp: Generalize bootloader

    Move bootloader to soc/xtensa/intel_adsp making it available for other
    boards.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Tue May 5 21:31:00 2020 +0100

    boards: xtensa: up_squared: Add support for all CAVS

    Add boot support for all CAVS versions. TODO: needs to be made common

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Tue May 5 21:25:34 2020 +0100

    soc: xtensa: intel_adsp: Manage cache for DMA descriptors

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon May 4 21:10:50 2020 +0100

    soc: xtensa: adsp: use 24M567 clock

    Use audio clock

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon May 4 10:04:01 2020 +0100

    xtensa: soc: adsp: enable system agent

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Sun May 3 15:03:07 2020 +0100

    soc: xtensa: intel_adsp: increase mem pool to 192k

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Sun May 3 15:02:31 2020 +0100

    soc: xtensa: intel_adsp: re-enable DMA trace

    Buffer will be empty (as trace items sent to Zephyr LOG) but
    logic is running.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Sun May 3 11:18:55 2020 +0100

    soc: xtensa: intel: dont use uncache region yet.

    Some code was still using this region. Use later.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Sun May 3 10:07:28 2020 +0100

    soc: xtensa: intel_adsp: fix notifier init

    Topology now loads.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Fri May 1 21:18:38 2020 +0100

    boards: up2: Need to use sof config for bootloader

    This will need uncoupled at some point. For testing today.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Fri May 1 21:16:38 2020 +0100

    boards: up2: increase heap to 128k

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Thu Apr 30 11:35:19 2020 +0300

    boards: up_squared_adsp: Use bigger HEAP

    Use HEAP from old demo.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Fri May 1 16:06:32 2020 +0100

    soc: xtensa: intel_adsp: Fix config.h naming collisions

    Rename sof version to sof-config.h

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Thu Apr 30 11:22:42 2020 +0300

    Small cleanups

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Apr 29 22:00:44 2020 +0300

    tests: sof/audio: Test ll scheduler

    Add more tests for scheduler.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Apr 29 18:38:35 2020 +0300

    tests: Add first schedule test

    Add initial test for testing scheduling.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed Apr 29 13:36:23 2020 +0100

    soc: xtensa: rmeove build warnings

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Apr 28 18:04:33 2020 +0300

    soc/intel_adsp: Register sof logging

    Register sof logging for tracing

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Apr 28 14:16:55 2020 +0300

    boards: up_squared_adsp: Define HEAP_MEM_POOL_SIZE

    Define HEAP_MEM_POOL_SIZE when SOF enabled.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Apr 28 10:09:20 2020 +0300

    tests: audio/sof: Add interrupt API for testing

    Add initial interrupt API for testing.

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Apr 27 15:54:28 2020 +0100

    soc: xtensa: adsp: Update linker script for SOF sections.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Apr 27 11:20:01 2020 +0100

    soc: xtensa: adsp: send SOF FW metadata as boot message

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Sun Apr 26 21:47:20 2020 +0100

    soc: xtensa: adsp: re-enable all SOF IP init.

    Do all SOF IP init.

    TODO: ATOMCTL, WFI on LX6

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Sat Apr 25 15:30:40 2020 +0100

    soc: xtensa: irq: Make sure IPC IRQ is registered.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Apr 22 20:56:09 2020 +0300

    tests: sof: Enable console

    Enable console for the test.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Apr 22 17:57:22 2020 +0300

    soc: cavs_v15: Fix XTENSA_KERNEL_CPU_PTR_SR

    Use correct value for XTENSA_KERNEL_CPU_PTR_SR.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Wed Apr 22 14:48:31 2020 +0300

    tests: audio/sof: Add tests for alloc API testing

    Add initial tests for allocation API testing. Can be extended for
    other later.

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Apr 21 17:49:32 2020 +0300

    logging: Enable xtensa simulator backend for ADSP

    Enable xtensa simulator backend for SOC_FAMILY_INTEL_ADSP.

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Apr 20 20:58:30 2020 +0100

    soc: xtensa: add common cpu logic

    Support for additional cores.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
 Date:   Tue Apr 21 10:11:07 2020 +0300

    Update west.yaml to point to the latest repo

    Update west.yaml

    Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Apr 20 16:17:01 2020 +0100

    soc: xtensa: cavs: Fix build for clk.c on cavs18+

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Apr 20 16:05:31 2020 +0100

    soc: xtensa: cavs15: removed unused headers.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Apr 20 16:05:09 2020 +0100

    soc: xtensa: cavs25: align with SOF headers

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Apr 20 16:03:52 2020 +0100

    soc: xtensa: cavs20: align with SOF headers

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Apr 20 16:03:09 2020 +0100

    soc: xtensa: cavs18:  Align with SOF headers.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Apr 20 11:42:39 2020 +0100

    west: sof: Updated to latest version.

    Now builds, links and runs SOF code (but not to FW ready).

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Sun Apr 19 13:28:53 2020 +0100

    xtensa: intel adsp: build in SOF symbols if CONFIG_SOF

    Code now fully links against SOF. Needs to be run tested.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Daniel Leung <daniel.leung@intel.com>
 Date:   Wed Apr 15 10:19:28 2020 -0700

    DO NOT MERGE: temporarily add thesoftproject as remote for sof module

    Signed-off-by: Daniel Leung <daniel.leung@intel.com>

 Author: Daniel Leung <daniel.leung@intel.com>
 Date:   Wed Apr 15 10:33:40 2020 -0700

    ipm: cavs_idc: use the IPC/IDC definitions in SoC

    The SoC definitions have the necessary IPC/IDC bits so there is
    no need to define them separately.

    Signed-off-by: Daniel Leung <daniel.leung@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed Apr 15 14:30:20 2020 +0100

    TODO: config: Use static config for SOF module.

    TODO: needs to be generated as part of SOF kconfig

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Fri Apr 10 21:56:07 2020 +0100

    HACK: Add SOF into build

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed Apr 15 13:55:15 2020 +0100

    west: modules: Add SOF audio module.

    Add support for building SOF as a Zephyr module. This is the starting
    point for add SOF audio into Zephyr. Currently builds but does not use
    any symbols yet.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed Apr 15 13:48:48 2020 +0100

    WIP soc: adsp-cavs15: Use same include directory structure as SOF

    Use the same directory structure as SOF to simplify porting and allow
    SOF to build without Zephyr until porting work is complete.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed Apr 15 13:43:44 2020 +0100

    WIP soc: adsp-common: Use same include directory structure as SOF

    Use the same directory structure as SOF to simplify porting and allow
    SOF to build without Zephyr until porting work is complete.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Mar 16 14:36:32 2020 +0000

    WIP: soc: adsp-common: cache is common across all Intel ADSP platforms

    De-duplicate soc.h cache definitions.
    TODO: this needs done for other common functions.
    TODO: need to fix include path

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Mar 30 11:07:43 2020 -0700

    WIP: soc: cavs25: Import SOF SoC support

    SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Mar 30 11:07:12 2020 -0700

    WIP: soc: cavs20: Import SOF SoC support

    SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Mar 30 11:06:40 2020 -0700

    WIP: soc: cavs18: Import SOF SoC support

    SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Daniel Leung <daniel.leung@intel.com>
 Date:   Mon Mar 30 12:37:17 2020 -0700

    soc: intel_adsp: use main_entry.S in common for cavs_v15

    The files are identical anyway.

    Signed-off-by: Daniel Leung <daniel.leung@intel.com>

 Author: Daniel Leung <daniel.leung@intel.com>
 Date:   Mon Mar 30 11:38:14 2020 -0700

    soc: intel_adsp/cavs_v15: link common code

    Let cavs_v15 link against the code compiled under common/.

    Signed-off-by: Daniel Leung <daniel.leung@intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Mar 16 13:08:28 2020 +0000

    WIP: soc: common: Import SOF SoC support

    SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Mar 16 14:37:32 2020 +0000

    WIP soc: adsp-cavs15: build power down support

    Build the power down support for CAVS1.5

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Mar 16 12:40:17 2020 +0000

    WIP: soc: cavs15: Import SOF SoC support

    SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Mar 16 14:30:08 2020 +0000

    soc: cavs15: Add missing SHIM registers.

    SOF commit 2746df76b98f21d3e0b2c5cd4fe405c9a42014a4

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Mon Mar 9 15:43:01 2020 +0000

    xtensa: intel_adsp/cavs_v15: fix usage of LP SRAM power gating

    Remove LSPGCTL as it can cause confusion, use SHIM_LSPGCTL instead.

    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
 Date:   Wed Feb 26 15:28:48 2020 +0000

    boards: up_squared_adsp: Use local xtensa HAL instead of SDK HAL

    SDK HAL is deprecated for Intel ADSP SoCs so fix and use local HAL
    module.

    Signed-off-by: Daniel Leung <daniel.leung@intel.com>
    Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

 Author: Daniel Leung <daniel.leung@intel.com>
 Date:   Mon Mar 30 10:45:15 2020 -0700

    soc: add Intel Audio DSP SoC family

    This creates a SoC family for the audio DSPs on various
    Intel CPUs. The intel_apl_adsp is being moved into
    this family as well, since it is part of the CAVS v1.5
    series of DSPs.

    Signed-off-by: Daniel Leung <daniel.leung@intel.com>

 Author: Daniel Leung <daniel.leung@intel.com>
 Date:   Mon Mar 30 11:29:02 2020 -0700

    soc: xtensa: add CMakeLists.txt

    Add CMakeLists.txt under soc/xtensa so that CMakeLists.txt
    inside each SoC directory will be included, similar to
    what ARM and RISCV have.

    Signed-off-by: Daniel Leung <daniel.leung@intel.com>

 Author: Andy Ross <andrew.j.ross@intel.com>
 Date:   Wed Jun 17 12:30:43 2020 -0700

    Revert "boards: up_squared_adsp: Add flasher script"

    This reverts commit 80f295a9dd.

 Author: Andy Ross <andrew.j.ross@intel.com>
 Date:   Wed Jun 17 12:30:32 2020 -0700

    Revert "boards: up_squared_adsp: Update logtool tool"

    This reverts commit 7770d182c1.

 Author: Andy Ross <andrew.j.ross@intel.com>
 Date:   Wed Jun 17 12:30:23 2020 -0700

    Revert "soc: intel_adsp: Generalize bootloader"

    This reverts commit d6a33ef467.

 Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>

    soc: xtensa; intel: remove sof-config.h - SQUASH

    No longer used.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-10-21 06:38:53 -04:00
Andy Ross
ec6a98e5e1 drivers/timer/cavs_timer: Prevent spurious interrupts
The HDA wall clock timer is a 64 bit timer with 64 bit compare
registers, but it's being used from a 32 bit CPU.  Writing the
comparator piecewise with a 64 bit C assignment will write the low
dword first, opening the possibility that the hardware will see time
go "backwards" and trigger an interrupt incorrectly.

Disable the enable bit while setting the comparator.

Found by inspection.  In practice this will be very rare, and spurious
timer interrupts are supposed to be benign anyway (though they can
result in timeout expirations being misaligned to ticks, which might
be surprising to applications).  Best to get it right.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-10-21 06:38:53 -04:00
Benjamin Lindqvist
e7df25c848 drivers: modem: gsm_ppp: lock modem when required
If other threads are accessing the modem concurrently during gsm_ppp
initialization, they can easily corrupt UART comms. Normally this is not
noticable since those services are usually started only after modem
setup has been completed. But with the new gsm_ppp stop/start
functionality, the need of synchronizing concurrent access in a
structured way has arisen.

This commit ensures modem_cmd_handler is locked when concurrent access
to the modem UART would interfere with the driver, or otherwise cause
problems. Since the semaphore is not available during this period, all
essential calls to modem_cmd_send has been replaced with the non-locking
equivalents.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-10-21 10:15:45 +03:00
Benjamin Lindqvist
820bb07c81 drivers: modem: cmd_handler: Allow locking TX
A semaphore is used by modem_cmd_handler to protect against concurrent
UART access. This is only used for the duration of sending a command,
but there are cases when one wants to prevent UART access for other
reasons, such as when powering off the modem.

This commit exposes functionality for hogging this semaphore without
having to send a command. Furthermore, a non-locking equivalent for
modem_cmd_handler_setup_cmds is added which was previously missing.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-10-21 10:15:45 +03:00
Gerard Marull-Paretas
de8134a42e drivers: pwm: stm32: fix timer instance access
The parameters of the associated PWM timer were not being picked up
properly, as it was assumed that parent index is the same as the child
index. This is not necessarily true if other timer nodes are active and
not being used for PWM.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-10-20 09:56:26 -05:00
Erwan Gouriou
84d2211057 drivers/pinmux: stm32f1: Revise timers possible remap values
Only pinctrl for tim2 can have a REMAP_FULL value.
Usual value is REMAP_1.
Fix this

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-20 09:09:29 -05:00
Erwan Gouriou
fa190589a9 drivers/pinmux: stm32: remap code should be guarded under node status
CAN remaps were guarded by CMSIS defines which are always defined
for a given SoC.
Though under this control, we're using DT_ macros that expect
a certain node to be available, which otherwise leads to cmopilation
issue.
Align CAN node remap code on other peripherals code and check for
node availability.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-20 09:09:29 -05:00
Erwan Gouriou
0b9c584ec1 drivers/pinmux: stm32: Provide unique API to stm32_dt_pinctrl
Set stm32_dt_pinctrl_configure function as the unique entry point
to STM32 DT pinctrl management.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-20 09:09:29 -05:00
Erwan Gouriou
f44e931b0c drivers/pinmux: stm32: Get remap functions visible across family
Move pinctrl remap functions out of stm32f1 definition in order
to get it available to all series.
Allows use of more IS_ENABLED macros in calling drivers and make
code more readable.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-20 09:09:29 -05:00
Erwan Gouriou
0143b5e3de drivers/pinctrl: stm32f1: Provide a function which centralize remap
Centralize AFIO remapping into one single function.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-20 09:09:29 -05:00
Marcin Niestroj
668cbe19a3 drivers: wifi: esp: support power-gpios to enable ESP module
Add power-gpios device-tree binding property to power on module before
communicating with it. This pin is called CHIP_PU in case of ESP32{,-S2}
and CHIP_EN in case of ESP8266. Dedicated reset pin is available only on
the latter, however Espressif recommends (in ESP8266 Hardware Design
Guidelines) to use CHIP_EN instead. Follow those recommendations and use
power-gpios to reset chip if that is provided over device-tree.

Configure power-gpios and reset-gpios as inactive by default, so that
chip becomes ready after executing esp_reset() function, either if one
or both are provided over device-tree.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-20 07:32:01 -05:00
Marcin Niestroj
2e648d4872 drivers: wifi: esp: rename wifi-reset-gpios to reset-gpios
Most DT bindings use reset-gpios name when there is a pin to reset whole
chip. Rename wifi-reset-gpios to reset-gpios to be more consistent
between various drivers. Additionally this prevents confusion, as
somebody might think that this pin resets only WiFi, which is not true.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-20 07:32:01 -05:00
Nicholas Lowell
c0d156cf73 driver: gpio: proper Kconfig shell dependency
make gpio shell depend on main shell to prevent misconfigurations

Signed-off-by: Nicholas Lowell <nlowell@lexmark.com>
2020-10-20 07:23:55 -05:00
Marco Peter
493a6d8a78 drivers: ssd1306: remove SPI operation flags
Remove two operation flags in the SPI configuration
instance, which disturb software controlled chip select
lines (CS never gets released).

Signed-off-by: Marco Peter <marco@peter-net.ch>
2020-10-19 18:49:29 +02:00
Marco Peter
aff97fe7f6 driver: ssd1306: Add chip select flags for SPI
This adds the chip select device tree flags to the
spi_cs_control instance.

Signed-off-by: Marco Peter <marco@peter-net.ch>
2020-10-19 18:49:29 +02:00
Jukka Rissanen
cc230815cb drivers: gsm: Add GSM modem device name
Application might need to know the GSM modem device name so
provide it in the header file.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-10-19 18:29:02 +02:00
Benjamin Lindqvist
449fc7bb1c net: ppp: Avoid wrapping each byte in muxing headers
When PPP is muxed, using uart_poll_out resulted in each byte getting
wrapped in a muxing header. This led to UART bombardment which
can quickly cause some modems to hang and panic. This was observed
regularly using a SIMCOM7600E modem.

A perfect fix would involve rewriting ppp.c, uart_mux.c and
modem_iface_uart.c to all use another UART API, but that would be more
invasive by several orders of magnitude than this one, which utilizes
the fact that the uart_mux implementation of uart_fifo_fill does NOT
require ISR context. Since the Zephyr UART API states that the behavior
of uart_fifo_fill outside of ISR context is implementation defined, this
should be kosher.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-10-19 18:29:02 +02:00
Benjamin Lindqvist
54cb2bcd41 drivers: modem: gsm_ppp: Enable start/stop
These changes enable applications to restart the networking stack which
was previously not possible without rebooting the device. This was a
major show-stopper because it made power management impossible, and
furthermore made it impossible to recover from a bad modem state without
rebooting.

This has been verified to work on a SIMCOM7600E modem, both with and
without CONFIG_GSM_MUX enabled.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-10-19 18:29:02 +02:00
Benjamin Lindqvist
966932a033 drivers: modem: add forgotten log_strdup call
The char pointer that is logged could get scoped out and so should be
strduped before logging.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-10-19 18:29:02 +02:00
Erwan Gouriou
d4e390ce63 drivers/spi: stm32: Convert to devicetree pinctrl generation
Convert STM32 SPI driver to device pinctrl configuration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-19 10:24:01 -05:00
Ryan Erickson
0e86699223 drivers: modem: hl7800: only set DNS addr if not set
Only set the DNS resolver server address if one has not been specified.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-10-19 15:22:33 +03:00
Marek Porwisz
886cf7a9f3 drivers: ieee802154: nrf5: Add support for failed rx notification
Thread implements couple of counters that require notification of failed
frame reception.
Implemented RX failed notification.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2020-10-19 12:50:02 +03:00
Benjamin Lindqvist
598adb8830 drivers: modem: gsm_ppp: hold off ppp until we're attached to nw
Attempting to initialize PPP without first ensuring we're attached to
the network packet service will sometimes lead to "NO CARRIER" errors
when we initialize PPP with the modem. This has been observed
reproducibly on some SIMCOM7600E modems.

This commit holds off on PPP initialization until modem has reported
that it is indeed attached by using the "AT+CGATT?" command (see 3GPP TS
27.007)

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-10-17 16:36:07 +03:00
Raveendra Padasalagi
ea2107c429 drivers: dma: pl330: const-ify device instance
Fix compilation issue associated with const-ifying
pl330 device instance.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2020-10-16 06:50:49 -05:00
Kumar Gala
ccc16a41bd drivers: i2c: Move Kconfig I2C instances to esp32
The only user of the I2C instances is the esp32 driver.  Move the
Kconfig symbols down to the esp32 Kconfig for the instances it needs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-16 06:36:18 -04:00
Scott Worley
03e510d68b gpio: mchp_xec: fix glitch setting pin to output
A GPIO's parallel output bit in the parallel output
registers is read-only until the AOD bit is set to 1
in the pin's control registers. The proper sequence to
preset the state of an output pin is:
Configure pin as input with AOD=1 in the control register
Set pin state in the parallel output register
Set direction to output in the pin's control register.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2020-10-15 22:07:34 -04:00
Mahesh Mahadevan
c6b3316947 drivers: Update Flexcomm SPI driver for clock control
Use the clock API to get the spi clock frequency

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-10-15 11:17:24 -05:00
Mahesh Mahadevan
3eb3b58bb4 drivers: Update Flexcomm Serial driver for clock control
Use the clock API to get the serial clock frequency

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-10-15 11:17:24 -05:00
Mahesh Mahadevan
8927985c70 drivers: Update Flexcomm I2C driver for clock control
Use the clock API to get the I2C clock frequency

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-10-15 11:17:24 -05:00
Mahesh Mahadevan
c7b0b43ec6 drivers: Add NXP LPC clock control driver
Add clock control driver for NXP LPC devices that use
the MCUX SDK drivers

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-10-15 11:17:24 -05:00
Armando Visconti
1921a2d84e drivers/sensor: add support to IIS2ICLX accelerometer
The IIS2ICLX is a high-accuracy. ultra-low noise, low-power
two-axis linear accelerometer which can be interfaced through
either I2C or SPI bus.
Its high accuracy, stability over temperature and repeatability
make IIS2ICLX particularly suitable for inclination measurement
for industrial applications (inclinometers).

https://www.st.com/resource/en/datasheet/iis2iclx.pdf

This driver is based on stmemsc i/f v1.03.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-10-15 09:57:47 -05:00
Ryan Erickson
e36fc53fa6 drivers: modem: hl7800: fix file open in fw update
File open function for firmware update
requires a flags parameter to be passed in.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-10-15 08:46:41 -05:00
Łukasz Mazur
705e1a4610 SPI: Refactoring in SPI with DMA (peripheral switching on/off)
Moved enabling SPI peripheral in front of the buffers loop.
Removed SPI DMA switching on in front of the buffers loop.

Signed-off-by: Łukasz Mazur <lukasz.mazur@hidglobal.com>
2020-10-15 14:11:46 +02:00
Łukasz Mazur
f091aab0d7 SPI: Do not disable SPI peripheral while switching DMA buffers
Removed SPI peripheral disabling when switching DMA to another buffer.
When using hardware chip select this would cause to stop driving
CS pin when swhitching buffers. This is different (and wrong) than
when used software CS.

Fixes #28833

Signed-off-by: Łukasz Mazur <lukasz.mazur@hidglobal.com>
2020-10-15 14:11:46 +02:00
Kumar Gala
c22e34397e drivers: serial: stm32: set default parity in driver
Have the driver default to UART_CFG_PARITY_NONE if no parity property
exists rather than using default in binding.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-15 04:01:22 -05:00
Andrei Gansari
801e2dba42 drivers: fix gpio_mcux_lpc_port_set_masked_raw
Fixes gpio_mcux_lpc_port_set_masked_raw function inside gpio_mcux_lpc
driver. Writing masked data is correctly done using device registers.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-10-14 15:21:34 -05:00
Armand Ciejak
430c229568 eth: mcux: Use different RX and TX buffers for each instance
Before the same buffers were used by both instances leading to
data corruption.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-14 07:19:09 -05:00
Martin Jäger
72d395a897 drivers: adc: stm32: add support for pinmux
Add support for DT based pinmux configurations.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-10-14 07:15:12 -05:00
Jakub Rzeszutko
6ed13678b8 adc_shell: rework commands
ADC shell commands can be only executed on the property label
existing in the device tree. It is realized by the dynamic subcommand
returning existing ADC Label.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2020-10-14 14:12:54 +02:00
Jakub Rzeszutko
333e5e0166 adc_shell: extend channel command
The channel command has been extended with subcommands: id, positive,
and negetive. Some boards require positive input configuration before
measurement can be started.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2020-10-14 14:12:54 +02:00
Jakub Rzeszutko
fb653608b4 adc_shell: use shell to validate arguments count
Use dedicated shell macros so argument count can be validated before
the command handler is executed. This change simplifies the command
handlers implementation inside the adc_shell file.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2020-10-14 14:12:54 +02:00
Jakub Rzeszutko
ceb3c4c576 adc_shell: introduce dictionary commands
Changed gain and reference commands to dictionary commands.
This change removes an obsolete look-up table (string <-> value)
for gain and reference commands.
Now, each modification of gain or reference value will require only
a dictionary command update.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2020-10-14 14:12:54 +02:00
Erwan Gouriou
91e9fde778 drivers/serial: stm32f1: REMAP_FULL is not a possible remap value
'remap' value can never be REMAP_FULL for usart.
Fix this value depending on the usart instance.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-14 07:11:46 -05:00
Krzysztof Chruscinski
b5919479c4 drivers: clock_control: nrf: Change errno for clock_control_async_on
Aligned returned errno with API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-10-14 14:06:56 +02:00
Krzysztof Chruscinski
a348cec400 drivers: clock_control: Change clock_control_async_on parameters
Stable API change: modify parameters of clock_control_async_on which
previously took a structure which contains list node, callback and user
context. Removing list node and replacing structure with two parameters:
callback and user context. List node is removed because it has no use
in current API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-10-14 14:06:56 +02:00
Krzysztof Chruscinski
db6bfde8b3 drivers: serial: nrfx_uarte: Refactoring poll_out
Refactoring poll_out to be ready for handling preemption. uart_tx and
uart_fifo_fill modified so they are resilient to being preempted by
uart_poll_out.

Refactored uart_poll_out implementation to be common for interrupt
driven API and asynchronous API. In both APIs active state is detected
by evaluating state of ENDTX and TXSTOPPED events. If anyone is set it
means that new transfer can be started.

Patch is fixing existing issues:
- potential bytes dropping with flow control enabled
- busywaiting for ENDTX (asynchronous API) - poor performance
- potential bytes dropping during preemption
- potential uart_tx returning -EBUSY when interrupted poll_out

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-10-14 14:06:25 +02:00
Thorvald Natvig
4d0750920b drivers: ethernet: eth_gecko: Fetch MAC address from device info
If neither a random address nor a specific local address is in the
device tree, then use the MAC address from the device information page.

Signed-off-by: Thorvald Natvig <thorvald@natvig.com>
2020-10-14 12:31:49 +03:00
Ryan Erickson
72d54055a3 drivers: modem: hl7800: UDP socket not closed
Ensure UDP socket is always closed when offload_put is called.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-10-14 12:30:45 +03:00
Armando Visconti
de5135b05e modules/hal_st: Align sensor drivers to stmemsc HAL i/f v1.03
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v1.03.

Requires https://github.com/zephyrproject-rtos/hal_st/pull/5
(merged as b52fdbf4b62439be9fab9bb4bae9690a42d2fb14)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-10-13 09:46:08 -05:00
Armando Visconti
4250028483 drivers/sensor: iis2mdc: Fix the temperature in celsius
Fix the formula to translate raw temperature read from
register to Celsius.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-10-13 09:46:08 -05:00
Armando Visconti
99b97f5ff4 drivers/sensor: ism330dhcx: Fix init routines order
The interrupt enabling routine was called before the
chip enabling routine resulting in a runtime failure
when triggers are set.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-10-13 09:46:08 -05:00
Martin Jäger
109a624c85 drivers: can: stm32: add support for pinmux
Add support for DT based pinmux configurations.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-10-13 13:13:08 +02:00
Toby Firth
dc37f988e0 drivers: adc: added support adc driver for lpcexpresso55s69
Added shim driver for the LPADC for lpcexpresso55s69 board.

Fixes #22703.

Signed-off-by: Toby Firth <tobyjfirth@gmail.com>
2020-10-12 14:59:40 -05:00
Mulin Chao
4260cac1e4 drivers: espi: npcx7: fix wrong comparison in vw generic isr.
This CL fixed the wrong comparison during searching the vw signal
that issued interrupt from MIWU in espi_vw_generic_isr().

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-10-12 14:47:33 -05:00
Martin Jäger
1de10bdb9b drivers: dac: stm32: add support for pinmux
Add support for DT based pinmux configurations.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-10-12 08:49:36 -05:00
Erwan Gouriou
b74a2162cb soc/arm: stm32: swap argument order in ST_STM32 PINCTRL macros
In order to be in line with other DT_INST macros in zephyr code base,
swap the arguments order in following macro definitions:
*ST_STM32_DT_PINCTRL
*ST_STM32_DT_INST_PINCTRL
Update the users accordingly.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-09 11:52:59 +02:00
Erwan Gouriou
b38d84fef4 drivers/i2c: stm32: Add pinctrl configuration at driver init
Convert driver to pcintrl configuration using pcintrl helper
macros.
Pinctrl init sequence has to be done before bus_mutex initialization.

Driver dts bindings are updated to reflect usage of pinctrl-x
properties

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-09 11:52:59 +02:00
Erwan Gouriou
2d3cda7663 soc/arm: stm32: use _INST_ namespace in devicetree pinctrl helpers
Current set of helpers provided for STM32 pinctrl devicetree are
using device instance as input.
In order to prepare for next version that will take node identifier
as input, change existing set of macros using _INST_ namespace.

Additionally rename NODE_ID_FROM_PINCTRL to
ST_STM32_DT_INST_NODE_ID_FROM_PINCTRL.

Finally update existing macros users to this new name scheme.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-09 11:52:59 +02:00
Erwan Gouriou
02bd657ce3 drivers/gpio: stm32: Change order of registers configuration
During implementation of i2c pinctrl configuration within i2c driver,
it appears that current order of register configuration used to
generate a spike on I2C bus, leading to broken configuration with
I2C device.
Reverse the order so that pin mode setting is done only after pupd,
speed and type are set, in order to avoid generating unwanted
artefacts on the bus.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-09 11:52:47 +02:00
Armand Ciejak
1faf2a92d7 eth: mcux: Fix typo in define name
VALN -> VLAN

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-09 11:50:50 +02:00
Armand Ciejak
90262c9a95 eth: mcux: Rename eth_* to eth* to be have consistent naming
Both eth_* and eth* were used before.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-09 11:50:50 +02:00
Armand Ciejak
df119d2bbf eth: mcux: Enable PTP IRQ only if the ptp node is enabled
This covers the case of 1 controller having PTP enabled and
the other not.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-09 11:50:50 +02:00
Armand Ciejak
c627ef37ed eth: mcux: Make consistent use of #if defined
As well as #ifndef.
Apply it for all CONFIG_* defines.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-09 11:50:50 +02:00
Armand Ciejak
cd35b17879 eth: mcux: Rework MAC address assignment functions
Do not override OUI of the local MAC address in the devicetree.
Simplify the mac address assignment conditions. Each interface has
its own function. Code duplication will be eliminated with the
use of DT_INST_FOREACH_STATUS_OKAY in a later commit to completely
remove duplicated code.
The 3 possible MAC address assignment (local, random and unique)
are covered and have been tested.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-09 11:50:50 +02:00
Armand Ciejak
fde702359e eth: mcux: Do not call eth_name() when dev->name can be used
Spare a function call.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-09 11:50:50 +02:00
Armand Ciejak
55b88eef22 eth: mcux: Do not compile phy_state_name() if not used
This is better than declaring it unused.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-09 11:50:50 +02:00
Armand Ciejak
8b38a67ca2 eth: mcux: Replace hard-coded eth_context.clock
This fixes wrong value for i.MX RT.
This is one less hard-coded value in eth_N_context structures.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-09 11:50:50 +02:00
Armand Ciejak
ac31c4e458 eth: mcux: Get rid of CONFIG_ETH_MCUX_*
Use node's status in device tree instead.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-09 11:50:50 +02:00
Antoine Zen-Ruffinen
dd72f1f4e6 eth: mcux: Implement set_config
This allows setting the MAC address at run time.

Signed-off-by: Antoine Zen-Ruffinen <antoine@riedonetworks.com>
Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-10-09 11:50:50 +02:00
Eric Hay
e51b24b429 drivers: clock_control: stm32g0: Enable the Q divisor on g0X1 variants
The PLL Q divisor does not exist on stm32g0X0 variants. It should only
be configured for g0X1 variants.

Signed-off-by: Eric Hay <EHay@sierrawireless.com>
2020-10-09 11:49:39 +02:00
Eric Hay
5f42ba52d8 soc: arm: stm32g0: add STM32G070 SoC series
This commit adds support for the STM32G070xx SoCs
by STMicroelectronics.

Signed-off-by: Eric Hay <EHay@sierrawireless.com>
2020-10-09 11:49:39 +02:00
Kuba Sanak
52a8020398 drivers: lora: Add CheckRfFrequency callback to SX1276 driver
CheckRfFrequency was not assigned correctly to the Radio. This lead
to the system hang when the loramac library tries to call a relevant
Radio method when processing a join-accept message

Signed-off-by: Kuba Sanak <contact@kuba.fyi>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-10-08 12:15:38 +02:00
Manivannan Sadhasivam
4d1d1bb330 drivers: lora: Add missing function definitions & callbacks for LoRaWAN
For preparing the radio drivers (specifically SX1276) for LoRaWAN
support, let's add missing function definitions and callbacks required
by the stack.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-10-08 12:15:38 +02:00
Manivannan Sadhasivam
47a262f28b drivers: lora: hal_common: Offload calling TimerIrqHandler to work queue
Since TimerIrqHandler() API does SPI transactions, it is not advised to
call from an IRQ context. Hence, offload it to a work queue.

Reported-by: Andreas Sandberg <andreas@sandberg.pp.se>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-10-08 12:15:38 +02:00
Manivannan Sadhasivam
0668e2b795 drivers: lora: Only create loramac-node library if not done before
The loramac-node library definition will also be created by
'subsys/lorawan' for the LoRaWAN support. Hence, just add the source
files if the previous declaration of the library is found else create
a new one.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-10-08 12:15:38 +02:00
Peter Bigot
2ffbad4941 drivers: counter: stm32: hide irrelevant options
CONFIG_COUNTER_RTC_STM32_BACKUP_DOMAIN_RESET=y was showing up in
configs for non-STM32 boards.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-10-07 15:26:03 -05:00
Gerard Marull-Paretas
af1b9442ca drivers: pwm: stm32: add support for pinmux
Add support for DT based pinmux configurations.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-10-07 12:27:37 -05:00
Gerard Marull-Paretas
aa45e0a90c drivers: pwm: stm32: remove data and config helpers
Now that Zephyr names have been made short and nice the need of these
helpers is less justified.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-10-07 12:27:37 -05:00
Mulin Chao
50753c1d7d drivers: npcx: Add const modifier for hal instances and so on.
Add const modifier for hal instances, clock devices pointer, and module
base address in npcx drivers to prevent driver functions change them
unexpectedly.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-10-06 18:16:02 -05:00
Mulin Chao
dd99fbebe6 drivers: pwm: add pwm driver support in NPCX7 series
In npcx7 series, there're 8 Pulse Width Modulator (PWM) modules and each
one support generating a single 16-bit PWM output. A 16-bit clock
prescaler (PRSCn) and a 16-bit counter (CTRn) determine the cycle time,
the minimal possible pulse width, and the duty-cycle steps.

Beside introducing pwm driver for Nuvoton NPCX series, this CL also
includes:

1. Add PWM device tree declarations.
2. Zephyr PWM api implementation.
3. Add aliases in npcx7m6fb_evb board device tree file for supporting
   samples/basic/blinky_pwm application and pwm test suites

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-10-06 18:16:02 -05:00
Krzysztof Chruscinski
ca786ce0ed drivers: timer: nrf_rtc_timer: Use interrupt priority from DT
Changed fix interrupt priority to the one from DT.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-10-06 15:34:34 +02:00
Erwan Gouriou
c495d4b985 drivers/serial: stm32f1: Disable remap when not required
Make sure remap is disabled when not requested.
This should have no impact on current cases but is important
when dynamic pin configuration will be used.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-06 04:58:38 -05:00
Ryan Erickson
2d7ccb59a9 drivers: modem: hl7800: Fix cases where socket would not close
There are cases where the socket would not be closed.
offload_put function will now always close the socket
properly.

Remove error log messages as they are redundant.
on_cmd_sock_error_code handles printing errors.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-10-05 15:41:03 -05:00
Andrzej Głąbek
26e6e7ad1f drivers: adc: Improve the default routine providing sampling intervals
This part of common code for ADC drivers, the adc_context_enable_timer()
function, was still converting sampling interval values to milliseconds
(the only option available at the time this code has been created) when
setting up the kernel timer, consequently limiting the maximum sampling
frequency to 1000 samples per second. This patch switches the routine
to specifying the interval in microseconds, to remove this limitation.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-10-05 14:45:37 -05:00
Simon Glass
442f38d610 emul: Add an emulator for the Bosch BMI160 accelerometer
This emulator supports enable functionality to start up the device and
read a few samples. It connects itself to any BMI160 device it finds in
the device tree. The SPI emulation controller driver is used to direct
SPI messages from the BMI160 driver to the BMI160 emulator.

Add a few more definitions to the header file, as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-05 15:33:00 -04:00
Simon Glass
a1d8e55cad emul: spi: Add support for SPI emulators
Add an emulation controller which routes SPI traffic to an attached
emulator. Only one emulator is supported per bus at present, since
chip-selction functionality is not present.

This allows drivers for SPI peripherals to be tested on systems that
don't have that peripheral attached, with the emulator handling the SPI
traffic.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-05 15:33:00 -04:00
Simon Glass
5a9f389159 drivers: sensor: bmi160: Use more constants for reg access
At present register access is a mix of constants and open-coded values
in the driver. Add a few more constants to clean this up.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-05 15:33:00 -04:00
Simon Glass
2c73f3ed4c drivers: sensor: bmi160: Add a constant for number of axes
Define a constant instead of using an open-coded value.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-05 15:33:00 -04:00
Simon Glass
e944855bbc drivers: sensor: bmi160: Move the ready bit into the header
This should be accessible to all files that need register access. Move
it into the header.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-05 15:33:00 -04:00
Marcin Niestroj
ad0dc48067 drivers: modem: ublox-sara-r4: inform modem_context about HW flow control
If HW flow control is enabled, then modem_context framework won't drain
UART FIFO blindly, but will stop when there is no more space in RX
ring_buf. This prevents data loss by "pausing" incoming data on hardware
level.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-05 17:04:52 +03:00
Marcin Niestroj
f27de1f1bb drivers: wifi: esp: inform modem_context about HW flow control
If HW flow control is enabled, then modem_context framework won't drain
UART FIFO blindly, but will stop when there is no more space in RX
ring_buf. This prevents data loss by "pausing" incoming data on hardware
level.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-05 17:04:52 +03:00
Marcin Niestroj
05eb9644dc modem: iface_uart: improve RX flow with HW flow control
So far all received bytes over UART where blindly drained and pushed to
ring_buf. This approach is okay for UART devices without configured HW
flow control, as it basically decouples data processing from ISR handler
and gives more time before data overrun. However when HW flow control
is enabled, such behavior somehow suppresses UART flow control
advantage, because data can overrun when pushing to ring_buf.

Allow drivers utilizing modem_context framework to pass information
about whether HW flow control is enabled or not. If it is enabled, then
read data from UART FIFO to the point when RX ring_buf is totally filled
and follow such situation by disabling RX interrupt. Incoming data will
be paused on HW level, so there is lots of time for RX thread to process
ring_buf content. Reenable RX interrupts after all data in ring_buf is
processed, so that number of context switches is kept at minimum level.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-05 17:04:52 +03:00
Marcin Niestroj
763bd27c75 modem: iface_uart: use ring_buf_{claim,finish} API
This API allows to drop use of preallocated isr_buf. Most importantly as
a result RAM usage is reduced for each driver utilizing modem_context
framework. Additionally there is less copying done in ISR context, as
data is direcly read from UART FIFO to ring_buf.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-05 17:04:52 +03:00
Ievgenii Meshcheriakov
5cb09fe0fb drivers: flash: Restore write protection in flash_shell
Restore the flash write proectction after disabling it for
flash write and erase shell commands.

Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
2020-10-02 12:06:28 -04:00
Ievgenii Meshcheriakov
4fc093ee58 drivers: flash_shell: Fix write protection in the test command
Flash drivers are free to re-enable write protection after a write or
erase operation is complete. Therefore write protection has to be
disabled before any such operation.

Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
2020-10-02 12:06:28 -04:00
Ievgenii Meshcheriakov
cf523e449e drivers: flash: Pass bool to flash_write_protection_set()
The second argument of this foonction is a bool, so passing 0 and 1
is incorrect.

Coccinelle script:

    @@
    expression e;
    @@
    flash_write_protection_set(e,
    (
    - 0
    + false
    |
    - 1
    + true
    )
     )

Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
2020-10-02 12:06:28 -04:00
Mahesh Mahadevan
133705f497 drivers: spi: Set the spi_config before calling Chip select configure
This was accidentally moved to after calling chip select configure

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-10-02 11:47:23 +02:00
Giancarlo Stasi
ba7ef854d8 drivers: stm32: fix MSI PLL mode enabling
1. clock: move the call for MSI hardware auto calibration enabling
    before the control of MSI enable to ensure its execution in all
    cases.
 2. counter: add call for MSI hardware auto calibration enabling after
    the LSE enabling and after possible backup domain reset that may
    clear MSIPLLEN.

Signed-off-by: Giancarlo Stasi <giancarlo.stasi.co@gmail.com>
2020-10-02 11:46:22 +02:00
Yiyu Zhu
741d8eee7a i2c: power on reset for certain stm32 devices
Described in ES096 2.14.7,
F101X8/B, F102X8/B, and F103X8/B
might not be able to enter i2c master mode on power-up.
Force reset help to mitigate this issue.

Signed-off-by: Yiyu Zhu <smallzzy@outlook.com>
2020-10-02 11:44:17 +02:00
Xavier Chapron
824f423e54 misc: Replace assert include and calls by sys/__assert.h equivalent
Replace all calls to the assert macro that comes from libc by calls to
__ASSERT_NO_MSG(). This is usefull as the former might be different
depending on the libc used and the later can be customized to reduce
flash footprint.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-10-02 11:42:40 +02:00
Pawel Czarnecki
8f9c4e2a1b drivers: gpio: litex_vexriscv: adapt to changes in CSR accessors
This adapts the driver to changes in the LiteX CSR accessors API
introduced in the previous commit.

Signed-off-by: Pawel Czarnecki <pczarnecki@internships.antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2020-10-02 11:36:16 +02:00
Tobias Svehagen
0d50372ce9 drivers: modem: Add debug log for matching direct cmds
Add a log message for when a direct cmd is matched to ease debugging.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-10-02 11:35:47 +02:00
Parthiban Nallathambi
c2ee9f5c3e drivers: eth: add driver for w5500 Ethernet Controller
Add driver for w5500 Ethernet Controller

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-10-02 11:34:57 +02:00
Marco Peter
03f256505c drivers: ssd1306: Add SPI support
This change allows to use SSD1306 based displays to be used on the
SPI bus as well.
Adding SPI shield.
Tested on SSD1306 and SSD1309 based displays using I2C.
Tested on SSD1309 based display using SPI.

Signed-off-by: Marco Peter <marco@peter-net.ch>
2020-10-02 11:33:26 +02:00
Marco Peter
fd2087e080 drivers: ssd1306: Optimize display commands
This change removes the interleaving control
frames.
Additionally all I2C accesses are centralized in
one single function.

Signed-off-by: Marco Peter <marco@peter-net.ch>
2020-10-02 11:33:26 +02:00
Mulin Chao
99c208f36a soc: npcx7: add comments for macro funcs used for device tree files.
This CL adds more comments for each macro functions used for device tree
file for better explanations. It also changes all hex values in soc.c to
lower case.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-10-02 11:33:15 +02:00
Mulin Chao
e42a3a5a96 drivers: espi: add host sub-modules support for NPCX7 series.
This CL contains the drivers of NPCX Host Sub-Modules that serve as an
interface between the Host and Core domains. For most of them, the Host
can configure these modules via eSPI(Peripheral Channel)/LPC by
accessing 'Configuration and Control register Set' which IO base address
is 0x4E as default. And the interrupts in core domain help handling any
events from host side.

In this commit, we introduced six host sub-modules. It includes:
 1. Keyboard and Mouse Controller (KBC) interface.
 2. Power Management (PM) channels.
 3. Shared Memory mechanism (SHM).
 4. Core Access to Host Modules (C2H).
 5. Mobile System Wake-Up functions (MSWC).
 6. Serial Port (Legacy UART)

The tasks in application layer such as 8042, ACPI and host command can
cooperation with this driver by connecting api or callback functions.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-10-02 11:33:15 +02:00
Mulin Chao
be217e4a3a drivers: eSPI: add eSPI driver support for NPCX7 series.
In npcx7 series, all of them support the Intel Enhanced Serial
Peripheral Interface (eSPI) Revision 1.0. This specification provides a
path for migrating host sub-devices via LPC to a lower pin count, higher
bandwidth bus. In addition to Host communication via the peripheral
channel, it provides virtual wires support, out-of-band communication,
and device mastering option over the Chipset SPI flash.

Becisdes introducing eSPI device in npcx7, this CL also includes:

1. Add eSPI device tree declarations.
2. Add npcx7-espi-vws-map.dtsi to present the relationship between eSPI
   Virtual-Wire signals, eSPI registers, and wake-up input sources.
3. Zephyr eSPI api implementation.
4, Add OOB (Out of Band tunneled SMBus) support.
5. Add configuration files for eSPI test suites.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-10-02 11:33:15 +02:00
Mulin Chao
e12d1ae851 drivers: eSPI: fixed build error in eSPI socketpair test suite.
Fixed build error in in eSPI socketpair test suite since wrong function
name for eSPI flash channel api.

This CL also fixed [-Werror=unused-function] warning by adding inline
attribute in case someone includes "espi_utils.h" and doesn't call
espi_manage_callback() function.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-10-02 11:33:15 +02:00
Emil Hammarstrom
7743b1e553 drivers: sensor: lis2mdl: Add device power management
The power draw of this magnetometer is significant,
device power management is needed for our use-cases.

Signed-off-by: Emil Hammarstrom <emil.hammarstrom@assaabloy.com>
Change-Id: I71158e629e93b491c6d673aa81001b7a7099f654
2020-10-02 11:32:59 +02:00
Erwan Gouriou
346d2ab92f drivers/uart: stm32f1: Add remap support for dt configured pinctrl
On stm32f1 series, device pinctrl configuration could be modified
thanks to remapping capability.
Remapping allows to provide alternate pinctrl configuration to a
peripheral device and applies to all impacted pins.

So, specifically for stm32f1 series, apply remapping when required
before proceeding with pin configuration.
Additionally, because remapping is defined individually for each pin,
apply a function on pinctrl configuration to check remapping setting
coherency accorss pins.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou
f100e2c09e drivers/pinmux: stm32f1: Update dt to gpio encoding function
Based on pinmux data encoded in dt bindings some stm32f1 post
processing is required to eventually fit into data structures
expected in gpio_stm32_configure function.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou
e9eec5a5d1 include/dt-bindings/pinctrl: stm32: Rename stm32-pinctrlf1
Rename header file stm32-pinctrlf1.h to more appropriate
stm32f1-pinctrl.h

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou
252a623ca2 drivers/serial: stm32: Enable use of dt pinctrl as serial signals
When available, use dt pinctrl to configure a variable number of
serial signals.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou
d1afd83df0 drivers/pinmux: stm32: provide dt pinctrl to gpio driver interface
Provides tool set to be used by device drivers in order to be able
to configure device signals.
This does not involve the implementation of a dedicated pinctrl
driver. In this regard, this is equivalent to implementation used
for treatment of current pinmux.c files.

Since STM32F1 uses a different GPIO configuration scheme, its
support is exlcuded for now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou
ccd6b72bc0 drivers/serial: stm32: Fix indentation in STM32_UART_INIT
Looks better this way

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou
b9e59b5e9d drivers/pinmux: stm32: minor fixes
Update stm32_pin_configure prototype to use more appropriate
unsigned arguments
Additionally, fix documentation for z_pinmux_stm32_set function

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Jan Pohanka
74dbcfebab drivers: wifi: fix simplelink driver to use zsock_ functions
This fix removes dependency on CONFIG_POSIX_API
or NET_SOCKETS_POSIX_NAMES.

Signed-off-by: Jan Pohanka <xhpohanka@gmail.com>
2020-10-01 17:35:45 +03:00
Marcin Niestroj
c083548f80 drivers: wifi: esp: support reconfiguration of UART baudrate
Allow to reconfigure UART baudrate on ESP and on host MCU, so a
non-default baudrate can be used for communication. This option helps
for example to increase network bandwidth without touching ESP chip
firmware.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-09-30 17:05:22 +03:00
Marcin Niestroj
f05fe8c082 drivers: wifi: esp: support configurable modem buffers size and count
Add Kconfig options to configure modem command handler buffer size and
count. This will allow to fine tune those based on UART baudrate, system
load and available memory.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-09-30 17:04:43 +03:00
Marcin Niestroj
cfedf80009 drivers: wifi: esp: support configurable modem ring buffer size
Add new Kconfig option to configure modem UART interface handler ring
buffer size. This will allow to lower ring buffer to save some resources
or increase it in case high network bandwidth is utilized (with high
UART baudrate).

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-09-30 17:04:43 +03:00
Maciej Fabia
06b44b12c7 drivers: ieee802154: Add more error codes to nrf5 driver tx
Add separate error codes in tx function for busy channel error
and ACK-related errors.

Signed-off-by: Maciej Fabia <maciej.fabia@nordicsemi.no>
2020-09-30 14:32:19 +03:00
Gerard Marull-Paretas
cd68e5819f drivers: display: ili9340: remove old hardcoded configurations
Remove Adafruit/Seeed TFT hardcoded settings. Note that undocumented
ILI9340/1 settings have been removed (maybe Seeed is using another ILI
variant?).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Gerard Marull-Paretas
afc63664f2 drivers: display: ili9340: move display function control to DT
Move display function control (DISCTRL) register settings to DT.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Gerard Marull-Paretas
6a76ae82c0 drivers: display: ili9340: move frame rate control register to DT
Move FRMCTR1 register settings to DT.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Gerard Marull-Paretas
4895620eb0 drivers: display: ili9340: move VCOM parameters to DT
Move VCOM control 1/2 register values to DT.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Gerard Marull-Paretas
a1ce0c851d drivers: display: ili9340: move gamma parameters to DT
Move gamma curve and correction registers GAMSET, PGAMCTRL and NGAMCTRL
to DT.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Gerard Marull-Paretas
c02e50a09d drivers: display: ili9340: add support for pwctrl in DT
Add support for setting PWRCTRL1/2 registers via DT.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Gerard Marull-Paretas
8593959ccf drivers: display: ili9340: add support for rotation
Add support for setting display rotation (0, 90, 180 and 270) using
DeviceTree.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Gerard Marull-Paretas
347e0f2bdc drivers: display: ili9340: add support for configuring pixel format
Move pixel format setting (RGB565/RGB888) to DeviceTree. Add support for
changing pixel format at runtime.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Gerard Marull-Paretas
5cc4cec488 drivers: display: ili9340: code reorganization
Moved initialization function to the bottom.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Gerard Marull-Paretas
b406527a66 drivers: display: ili9340: code cleanup
Multiple enhancements towards better code readability and consistency:

- sorted headers
- define and reference magic constants
- adjust some names
- add U suffix to unsigned constants
- move hw reset to a function
- remove non-needed initialization code from seeed tft

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Gerard Marull-Paretas
2d4ec8fca9 drivers: display: ili9340: improve error handling
Add error handling to multiple areas of the code and improve log
messages.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Gerard Marull-Paretas
26c3b99b55 drivers: display: ili9340: convert to multi-instance
Make ILI9340 driver compatible with multiple device instances.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-09-29 14:18:05 -05:00
Rick Talbott
60e5e79ca1 drivers: mcux: imx rt flexcan support
Adds imx rt support.
Allows n-number of can interfaces based on device-tree.
Adds a "common" irq name.
Added CAN bus pins and dts for 1060 and 1064 EVK.

Signed-off-by: Rick Talbott <rtalbott@fastmail.com>
2020-09-29 14:03:10 -05:00
Jesper Derander
5b80d4eac8 drivers: serial: uart_mcux_lpuart: Add configure functions
This enables support for the confgure and config_get functions in
the UART API, allowing users to change baudrate, parity, stop bits,
data bits and flow control in runtime.

Signed-off-by: Jesper Derander <jesper.derander@endian.se>
2020-09-29 13:42:39 -05:00
Brian Kubisiak
a84a0e6671 drivers: pinmux: stm32f0: Add additional I2C pins.
Add additional pinmux definitions for I2C1 and I2C2 that are used
on the stm32f030 series SoCs. Additionally, correct the PF0 and PF1 I2C
functions, which were swapped.

Signed-off-by: Brian Kubisiak <brian@kubisiak.com>
2020-09-28 14:00:43 -05:00
Audun Korneliussen
1e227d1576 drivers: serial: nrf_uarte: Reset rx byte counters
Reset rx byte counters when hw timer/counter is disabled.

Fixes issue where disabling and re-enabling async uart rx can produce
"UART_RX_RDY" events with invalid data when power management is used.

Signed-off-by: Audun Korneliussen <audun.korneliussen@nordicsemi.no>
2020-09-28 12:15:52 +02:00
Armando Visconti
fe6a73669d drivers: sensor: hts221: Add checks for drdy_gpios macros
To avoid build errors enable the trigger only if DRDY gpio is
defined in DTS. Fix #28443

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-09-24 09:51:08 -05:00
Stephan Walter
381cac1a35 drivers: nrf_qspi: fix devicetree opcode references
The condition used to detect presence of optional devicetree
properties that specify read and write opcodes was inadvertently
changed to something that will never be true.  Update the check and
the property extraction to restore the original behavior.

Fixes #28635.

Signed-off-by: Stephan Walter <stephan@walter.name>
2020-09-23 13:27:46 -05:00
Armando Visconti
4df0d019fd drivers/sensor/lsm6dsl: Fix read/write bus API in shub code
The ce0cc3a7 commit (lsm6dsl: make the driver multi-instance) changes
all bus API signature, which now requires a "const struct device *dev"
and not a "struct lsm6dsl_data *data". By mistake the shub part was
left unchanged. Fix: #28565

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-09-23 13:17:06 -05:00
Krzysztof Chruscinski
03f4a648b1 drivers: clock_control: nrf: Fix waiting for LF clock
Algorithm for waiting for clock stabilization was failing in case when
it was waiting for clock availablity and clock was already available
before function was called. That is because nrfx_clock_is_running
was returning false because XTAL was already started but not yet
running.

Added a check for current LF source, if XTAL is picked that indicates
that RC is already running because of two stage startup procedure.

Added documentation of lfclk_spinwait with explanation of two stage
approach.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-09-22 09:58:19 +02:00
Johann Fischer
612ba4390b drivers: eth_enc424j600: initialize device pointer
Initialize device pointer in driver's context.

It was not done quite right in commit a1708cf2f2
("drivers: ethernet: Fix device instance const qualifier loss"),
and then completely removed in commit 113d9274ea
("drivers: ethernet: remove stray expression")'

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-09-21 16:45:03 -05:00
David Komel
92499fc9d1 drivers: net: slip: Allow slip to co-exist with other interfaces
This commit fixes the following issue:
When using slip without TAP, i.e. CONFIG_SLIP_TAP=n (default), while
another ethernet interface is enabled and sets CONFIG_NET_L2_ETHERNET=y.

This causes ethernet_init() to be wrongly called with struct dummy_api
instead of struct ethernet_api.
ethernet_init() expects struct ethernet_api (by cast), so we end up
with the get_capabilities field pointing to garbage!
Actually, as we are using the dummy api, we don't need to call
ethernet_init() at all.

Sole dependency on CONFIG_NET_L2_ETHERNET is wrong because it
can be enabled by another interface.

Signed-off-by: David Komel <a8961713@gmail.com>
2020-09-21 10:02:06 -05:00
Ievgenii Meshcheriakov
b7c9d9d34f drivers/flash/soc_flash_nrf: Enable ticker radio sync only with Zephyr LL
Ticker API is part of Zephyr software BLE Link Layer.

Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
2020-09-21 13:06:16 +02:00
Ievgenii Meshcheriakov
d27c32efc3 drivers/flash/soc_flash_nrf: Rename config option SOC_FLASH_NRF_RADIO_SYNC
Call it SOC_FLASH_NRF_RADIO_SYNC_TICKER so it is not too generic.

Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
2020-09-21 13:06:16 +02:00
Ievgenii Meshcheriakov
70c5371666 drivers/flash/soc_flash_nrf: Name flash sync choice
Named choice is needed in order to be able to extend it
in other modules.

Closes: #28559

Signed-off-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@nordicsemi.no>
2020-09-21 13:06:16 +02:00
Armando Visconti
ce0cc3a7cc drivers: sensor: lsm6dsl: make the driver multi-instance
Make this driver multi-instance and use the new API.
Fixes #28390

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-09-18 22:08:44 -04:00
Paul Fagerburg
a8639a0432 drivers/pinmux/stm32: add/fix pinmux for F103xG
* Add missing the PINMUX macros for UART5 pins.
* Correct a typo in STM32F1_PINMUX_FUNC_PC5_ADC12_IN15; the macro
 used PC4 instead of PC5 for ADC12_IN15.

Signed-off-by: Paul Fagerburg <pfagerburg@google.com>
2020-09-18 14:25:55 -05:00
Erwan Gouriou
8b47e563e2 dts/Kconfig: Remove HAS_DTS_I2C
HAS_DTS_I2C is now selected by I2C and
always used as I2C && HAS_DTS_I2C.

It could then be purely removed.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-09-18 13:34:44 -05:00
Jukka Rissanen
060d36537a drivers: eth: Fix return value if we run out of bufs in TX
The correct return value is -ENOBUFS if we run out of network
buffers when sending the packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-17 09:31:10 +02:00
Ryan Erickson
5ac21bd604 drivers: modem: hl7800: fix dts binding
Fix hl7800 vendor prefix to match existing Sierra Wireless entry.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-09-16 14:21:41 -05:00
Ryan Erickson
7b5714669c drivers: modem: hl7800: add IPv6 support
Add support for dual mode IPv4/IPv6 stack.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-09-16 14:21:41 -05:00
Ryan Erickson
03e62be290 drivers: modem: hl7800: do not require DEVICE_POWER_MANAGEMENT
Remove requirement for DEVICE_POWER_MANAGEMENT,
the driver does not need it to operate.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-09-16 14:21:41 -05:00
Ryan Erickson
ad04354110 drivers: modem: hl7800: remove VLA
Remove variable length array from function to comply with MISRA checks.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-09-16 14:21:41 -05:00
Ryan Erickson
c74166ed5e drivers: modem: hl7800: modem receiver IMEI
Modem receiver IMEI data field is only available
when CONFIG_MODEM_SIM_NUMBERS.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-09-16 14:21:41 -05:00
Ryan Erickson
2e7b263013 drivers: modem: hl7800: struct device data renamed
change struct device->driver_data to new name of struct device->data.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-09-16 14:21:41 -05:00
Ryan Erickson
61ce2dc681 drivers: modem: hl7800: RTC only available with newlibc
RTC API is only available if NEWLIB_LIBC is available.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-09-16 14:21:41 -05:00
Vinayak Kariappa Chettimada
bd7ee86496 drivers: Bluetooth: rpmsg: Add missing BT_QUIRK_NO_AUTO_DLE
Add BT_QUIRK_NO_AUTO_DLE quirk option for HCI rpmsg driver
when the Zephyr open source BLE controller is used.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-16 12:02:32 +02:00
Rajavardhan Gundi
7d3dde5e5e drivers: peci: xec: Fix error recovery handling
Fix the error recovery mechanism that makes use of a temp variable
to avoid coverity issue without breaking error recovery.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2020-09-15 12:35:15 -05:00
Tomasz Bursztyka
ed98883795 device: Fixing new left over device instance made constant
Recent addition that went under the radar.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-15 09:18:43 -05:00
Andrzej Głąbek
a3430c2caf drivers: spi: nrfx: Restore recently changed spi_context function
Function spi_context_longest_current_buf() has been introduced in
commit ddef35c1da for the purpose of
getting the longest possible (potentially partial) SPI transfer
for which all currently active directions have a continuous buffer.
Such transfer can be done with taking advantage of a DMA that cannot
use scattered buffers (and this is the case for nRF SPI drivers with
which this function has been introduced).
Unfortunately, because of its inadequate name, later on this function
has been incorrectly used in other SPI drivers for getting the longer
of TX/RX buffers. And commit afc480f12b
recently "fixed" the implementation of this function, assumably to
adjust it to those incorrect uses, but this way it has also broken
the nRF SPI drivers.
Instead of restoring the original implementation of the function in
question, this commit adds a new one with functionality equivalent
to that original but with a hopefully less misleading name, and this
function is used in the nRF SPI drivers.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-09-15 15:59:18 +02:00
Emil Obalski
dc79b37167 usb: nrf: Do not allow to clear STALL or dtoggle for ISO ep.
Isochronous transactions do not support handshake phase
so in particular the ISO endpoint cannot be STALLed.
Isochronous transactions do no support data toggle sequencing
and should only send DATA0 PID.

Taking into consideration those requirements do not try to
clear dtoggle or STALL an ISO Endpoint in nRF USBD driver.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-09-15 10:15:20 +02:00
Roman Vaughan
4000e2849d drivers: led_strip: APA102 use CS flags from devicetree
The pull request #26269
drivers: SPI: Adds CS flags from devicetree
missed out on the APA102 led_strip driver, most likely due to the driver
not utilising the chip select signal until #25310
drivers: led_strip: Add support for external SPI CS on APA102 LED strips

Signed-off-by: Roman Vaughan <nzsmartie@gmail.com>
2020-09-14 18:35:26 -05:00
Andrzej Głąbek
b197fb0bbe drivers: spi: Kconfig.nrfx: Use RAM buffers for SPIMs by default
Enable by default the use of RAM buffers in the spi_nrfx_spim.c
driver for copying TX data located in flash (as SPIM peripherals
cannot transfer directly form flash). Without this patch, users can
get confused, especially when SPI transaction is used by an upper
level driver which does not check all error codes.
For size of the buffer, use the value used so far in the reel_board
default configuration and in the SPI loopback test, i.e. 8 bytes.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-09-14 16:02:59 -05:00
Armando Visconti
4ea9a8bd95 drivers: sensor: lis2dh: make the driver multi-instance
Make this driver multi-instance and use the new API.
Fixes #27753.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-09-14 13:28:45 -05:00
Alexandre Bourdiol
41621ba0bf drivers: dma: dma_stm32_v2: typo in compilation switch
For example, LL_DMA_IFCR_CTEF6 doesn't exist,
it must be replaced by LL_DMA_IFCR_CTEIF6.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-11 09:31:27 -05:00
Alexandre Bourdiol
4dbd96900d drivers: dma: dma_stm32: can't use device_get_binding() during init
Not possible to use device_get_binding() because we are
currently initializing DMA_1 device, so it is not ready and
device_get_binding() will fail.
Directly use string compare is more efficient.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-11 09:31:27 -05:00
Krzysztof Chruscinski
d58841a1bd drivers: clock_control: nrf: Fix nrf53 LFXO pin configuration
Pins used for external LF clock source must be configured as
used by peripheral to allow using LFXO on network side.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-09-11 15:55:54 +02:00
Vincent Wan
23b54832f8 drivers: wifi: simplelink: reimplement getaddrinfo
Reimplement getaddrinfo to call SlNetUtil_getAddrInfo from the TI HAL
for a more robust implementation that supports both client and server
modes, and performs better error-checking.

Fixes #11890

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-09-11 15:29:03 +03:00
Jeremy LOCHE
1740dfc8c2 drivers: bluetooth: hci_spi: fix init priority
Fixes #28275 by adding bluetooth HCI spi driver priority lower
(75 instead of 50) than SPI (70) to avoid device_get_binding
to return NULL because the device was not initialized.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-09-10 15:57:54 -05:00
Krzysztof Chruscinski
dcaead68c7 drivers: clock_control: nrf: Improve waiting for LF clock
Enabled going to idle when waiting for low frequency clock.
Added 2 stages of starting LF clock when XTAL is used. First
stage is starting RC and then when it is ready XTAL is started.
It is done to get event/interrupt when RC is ready which means
that LF clock is available (but not stable).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-09-10 21:31:01 +02:00
Krzysztof Chruscinski
c69a27b789 drivers: timer: nrf: Add configurable clock startup mode
Added configuration for approach to starting system clock source.
There are 3 options: no wait, wait untill available, wait until
stable.

Added support for those modes in clock control driver which handles
low frequency source clock.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-09-10 21:31:01 +02:00
Andrzej Puzdrowski
285d8786ee drivers/flash/nrf_qspi_nor: corrects write-block-size to 4B
The driver is able to write with 32-bits word alignment of size
and offset, apart form sub-word writes for which it can write
part of word to aligned offset (which is a hack).

fixes #26729

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-09-10 12:10:26 -05:00
Kumar Gala
184a25769c arm: systick: default CORTEX_M_SYSTICK based on dts
Use setting from devicetree to drive the default setting for
CORTEX_M_SYSTICK.  We update the dts files to default systick to be
enabled since the major of cortex-m platforms utilize it by default
(except on Nordic SoCs, TI CC13x2/CC26x2 and MEC1501 in which we
default to disabled).

Fixes #25299

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-09-10 09:49:00 +02:00
Abhishek Shah
e628dbb069 drivers: watchdog: cmsdk: rename wdog_cmsdk_apb_enable
Rename wdog_cmsdk_apb_enable to wdog_cmsdk_apb_setup,
this API is supposed to be called during driver probe based on
CONFIG_WDOG_CMSDK_APB_START_AT_BOOT (enabled by default).

Fixes: 03c7d9bd49 ("drivers: wdog: Update CMSDK Wdog driver")

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-09-09 17:19:43 +02:00
Abhishek Shah
7f6676b556 Revert "drivers: watchdog: Remove useless Kconfig entry"
This reverts commit 45832ac1d6.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-09-09 17:19:43 +02:00
Erwan Gouriou
1cb7ae8142 drivers/entropy: stm32: fix error erasing
"unused value" issue reported by Coverity (CID: 214211).
This is actually a true bug as reported error is erased
and not taken into account.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-09-09 14:10:07 +02:00
Peter Bigot
d6fa062a7d drivers: pcie: endpoint: fix ISR prototype
Two optional ISR handlers need the void *arg converted to const struct
device *dev.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-08 18:10:22 -05:00
Abram Early
c7cec489de drivers: winc1500: Fix signed/unsigned comparison
The value from socket() was directly assigned to offload_context, which
was treated as a unsigned integer when compared. This prevented the
following if statement from catching any errors, leading to random RAM
access. This is fixed by using an intermediate with the same type as the
return value, which is then assigned to offload_context after error
checking.

Signed-off-by: Abram Early <abram.early@gmail.com>
2020-09-08 18:06:30 -05:00
Peter Bigot
113d9274ea drivers: ethernet: remove stray expression
An unnecessary expression that doesn't compile was inadvertently
introduced in the device constification PR.  Remove it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-08 09:36:54 +03:00
Emil Obalski
613726728f usb: clock_control: Fix symbol when getting mgr for HFCLK
When getting a hfxo manager for USB sybsystem incorrect symbol
was checked. This lead to always enabling HFCLK, even for nRF5340
which needs HFCLK192M.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-09-07 16:47:02 +02:00
Anas Nashif
6e27478c3d benchmarking: remove execution benchmarking code
This code had one purpose only, feed timing information into a test and
was not used by anything else. The custom trace points unfortunatly were
not accurate and this test was delivering informatin that conflicted
with other tests we have due to placement of such trace points in the
architecture and kernel code.

For such measurements we are planning to use the tracing functionality
in a special mode that would be used for metrics without polluting the
architecture and kernel code with additional tracing and timing code.

Furthermore, much of the assembly code used had issues.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-09-05 13:28:38 -05:00
Johann Fischer
362d8b27a7 drivers: usb_dc_mcux_ehci: fix endpoints index assignment
MCUX EHCI USB device controller supports a specific
number of bidirectional endpoints. Bidirectional means
that an endpoint object is represented to the outside
as an OUT and an IN Eindpoint with its own buffers
and control structures.

ep_abs_idx index refers to the corresponding control
structure, for example:

 EP addr | ep_idx | ep_abs_idx
-------------------------------
 0x00    | 0x00   | 0x00
 0x80    | 0x00   | 0x01
 0x01    | 0x01   | 0x02
 0x81    | 0x01   | 0x03
 ....    | ....   | ....

The NUM_OF_EP_MAX (and number of s_ep_ctrl) should be double
of num_bidir_endpoints. There is also no need to reserve
endpoint addresses for this controller type.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-09-05 10:49:37 -05:00
Gerson Fernando Budke
bca8e83cab drivers: hwinfo: sam: Add sam4l hwinfo support
Add initial version.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-09-04 16:29:19 -05:00
Luiz Augusto von Dentz
f93c4dece0 Bluetooth: userchan: Add support for ISO packets
This adds supports for ISO packets so then can be transmitted and
received with userchan driver.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-09-04 21:03:13 +02:00
Luiz Augusto von Dentz
bfe580bbbe Bluetooth: H5: Add support for ISO packets
This adds supports for ISO packets so then can be transmitted and
received with H5 driver.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-09-04 21:03:13 +02:00
Luiz Augusto von Dentz
720bbe208e Bluetooth: H4: Add support for ISO packets
This adds supports for ISO packets so then can be transmitted and
received with H4 driver.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-09-04 21:03:13 +02:00
Jett Rink
703fe86220 ec_host_cmd_periph: add device API
The host command peripheral device API abstracts how an embedded
controller sends and receives data from a host on a bus. Each bus like
eSPI, SPI, or I2C would implement their own host command peripheral
device. Each hardware device would then handle the necessary hardware
access to send and receive data over that bus.

The chosen host command peripheral device will be used by the host
command handler framework to send and receive host data correctly.

Signed-off-by: Jett Rink <jettrink@google.com>
2020-09-04 14:50:45 -04:00
Carles Cufi
c37e167b8c drivers: eswifi: Fix macro names for offloading
When offloading only ZSOCK_POLLIN and DNS_EAI_MEMORY are available, so
use those instead of the standard ones.

Fixes #28069.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-09-04 14:47:57 -04:00
Richard Osterloh
0a0026afe2 drivers: sensor: Add VCNL4040 driver
Add support for Vishay VCNL4040 proximity and light sensor

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
2020-09-04 13:03:12 -05:00
Francois Ramu
fafb72f8ed drivers: dma: dmamux init needs k_malloc
The dmamux requires HEAP size definition, so that k_malloc
is valid. The HEAP size config is defined in the common for
any stm32 soc instead of specific to dma Kconfig

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-09-04 10:42:18 -05:00
Jan Pohanka
e4fe99590c drivers: clock_control: stm32h7 use a macro to define VCO_INPUT_RANGE
VCO input frequency can be checked and set during compile time.
It unfortunately does not work for output frequency because macros in
HAL are defined together with uint32_t type.

This also fixes wrong check in case of HSI used as PLL source.

Signed-off-by: Jan Pohanka <xhpohanka@gmail.com>
2020-09-04 17:03:57 +02:00
Krzysztof Chruscinski
8f2754e027 drivers: usb: device: nrf: Add support for hf192m clock
Added support for nrf53 where hf192m clock must be used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-09-04 16:36:05 +02:00
Krzysztof Chruscinski
17f70df01e drivers: clock_control: nrf: Add support for clk192m
Add support for 192M clock.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-09-04 16:36:05 +02:00
Andrzej Puzdrowski
6167dbc195 drivers/flash/soc_flash_nrf: remove timeslice terminology from driver
timeslice terminology were used in connection with synchronization
using ll BLE ticker.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-09-04 16:08:42 +02:00
Andrzej Puzdrowski
affbafac26 drivers/flash/soc_flash_nrf: introduce synchronization api usage
Rework ticker synchronization using newly introduced
radio synchronization API.
In kconfig synchronization using ll ticker become choice
option.

If CONFIG_SOC_FLASH_NRF_PARTIAL_ERASE is enabled the erase
timing is changed so intervals become similar to slots duration.
Previously interval was always ~90 ms, which looks like it was kept
so disproportional by oversight while the partial erase was
introduced.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-09-04 16:08:42 +02:00
Andrzej Puzdrowski
4c2432fdd4 drivers/flash/soc_flash_nrf: implement ticker synch backend
Extract synchronization procedures using LL BLE controller
ticker to newly added synchronization API.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-09-04 16:08:42 +02:00
Andrzej Puzdrowski
f8fd2ba519 drivers/flash/soc_flash_nrf: introduce radio synchronization API
Introduced API which allows to decouple radio synchronization
mechanism from NVMC driver.
New API will allows to replace synchronization mechanism if required.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-09-04 16:08:42 +02:00
Andrei Emeltchenko
1971b14ca7 drivers: ipm-console: Remove unused config option
Remove now unused configuration option.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko
3b1775d0cc drivers: console: Add DTS defaults
Add default which takes the target device from DTS similar way to UART
console.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andrei Emeltchenko
8d69832bfd console: ipm_console: Add console over IPM
Add console over Inter Processor Mailboxes (IPM).
This is useful for AMP processors like ADSP found on up_squared board.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-09-04 07:55:52 -04:00
Andreas Sandberg
78cc7df60c drivers: lora: sx126x: Support software-managed RF switches
The SX126x supports using DIO2 to control an TX switch, but only if
the switch can be operated using a single control signal. Add support
for RF switches that are wired to a GPIO instead of the radio chip
itself. This makes it possible to use RF switches that require two
control signals (one for the RX port and one for the TX port) by
wiring them to two GPIOs on the MCU.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-09-04 12:36:53 +02:00
Erwin Rol
113b016b51 drivers: dma: stm32: change order of disabling and checking result
The stm32_dma_disable_stream first checked if the stream was
disabled and if so returned OK. If it wasn't disabled it
tried to disable it and returned -EAGAIN.

The function is used in loops that try to disable the stream
by calling this function and if it fails wait for 1ms and
retry.

Becuase this function the first time (if the stream wasn't
disabled already) fails there is always a 1 ms delay. For
the SPI driver, that has a RX and TX stream, this means
a 2ms delay between the last data and CS going high.

By first trying to disable the stream and than checking
if it succeded most of the time the first call disables
the stream and the 1ms delay isn't needed.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-04 12:00:37 +02:00
Erwin Rol
65434f58dd drivers: spi_ll_stm32: refactor DMA support
- Fix GPIO CS timing when using DMA. When using GPIO CS the
  CS select was enabled after the DMA started the transfer,
  resulting in the first few bits being transfered while
  CS was still disabled.

- Fix TX or RX only DMA transfers. When only a RX or only
  a TX transfer was requested the DMA never finished.

  For the RX only cause the size on the transfer was
  calculated by taking the TX buffer length (0), this
  caused problems.

  For the TX only transfer the RX buffer was set to NULL,
  this caused the DMA to acctually writing data to the
  adress 0x00000000. By using the dummy destination buffer
  it now only writes to valid memory.

- Add semaphore to signal that DMA is ready, instead of
  just busy waiting.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-04 12:00:37 +02:00
Marin Jurjevic
d73e438ee4 drivers: spi_flash_at45: Replace hardcoded sector size
Replace hardcoded sector size value in sample with sector-size
property added in dts binding file

Signed-off-by: Marin Jurjevic <marin.jurjevic@hotmail.com>
2020-09-04 11:58:22 +02:00
Kumar Gala
94353845f5 drivers: flash: stm32wb: Fix build error
When building flash shell sample we get:

flash_stm32wbx.c:23:10: fatal error: shci.h: No such file or directory
   23 | #include "shci.h"

Fix this by adding ifdef protection around inclusion of shci.h.

Fixes #28036

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-09-04 11:53:02 +02:00
Loic Poulain
4eba946e2b drivers: wifi: eswifi: Implement dns offload callbacks
Implement getaddrinfo and freeaddrinfo callbacks.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-09-04 09:51:09 +03:00
Loic Poulain
733af9a709 drivers: wifi: eswifi: Improve read work
Schedule read work every 100ms for better latency.
Reschedule read work directly in case of a packet is received
(fast dequeue).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-09-04 09:51:09 +03:00
Loic Poulain
6ea54db334 drivers: wifi: eswifi: fix socket poll
- Fix return value, must be number structures with events
- set revents flag

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-09-04 09:51:09 +03:00
Kumar Gala
50a24950eb drivers: video: mcux_csi: Fix compile error
Fix compile errors of the form:

video_mcux_csi.c: In function 'video_mcux_csi_init_0':
video_mcux_csi.c:422:40: error: 'const struct device' has no member
				 named 'driver_data'
  422 |  struct video_mcux_csi_data *data = dev->driver_data;
      |                                        ^~

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-09-03 18:08:08 -04:00
Daniel Leung
d1f57be7be i2s: cavs: cast device struct to void ptr for DMA user data
In the I2S CAVS driver, the DMA user data simply points to
the device struct. However, after the change to const-ify device
struct, this causes warnings from compiler because the user_data
assignment would discard the const qualifier. The user_data is
being used to point back to the device struct, and the DMA
callbacks are already casting the user data argument into
a const device struct. So it's a simple fix by casting
the device pointer to void pointer at device creation.

Fixes #28016

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-09-03 17:33:11 -04:00
Mulin Chao
2612c50daa drivers: clk_ctrl: npcx: fixed 'line length exceeds 80 columns' warning.
Fixed 'line length exceeds 80 columns' warning by shortening the clock
controller device name from NPCX_CLOCK_CONTROL_NAME to
NPCX_CLK_CTRL_NAME.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-03 21:53:35 +02:00
Andrzej Głąbek
460a97d378 drivers: usb_dc_nrfx: Enable and properly initialize nrfx POWER driver
This is a follow-up to commit 701e9befe4.

The NRFX_POWER Kconfig option should be enabled together with USB_NRFX,
not with CLOCK_CONTROL_NRF, as the USB driver is the actual user of
the nrfx POWER driver.

This patch adds also missing initialization of the nrfx POWER driver
and refactors a bit the usb_init() function introduced in the commit
mentioned above, so that it does not redefine the DT_DRV_COMPAT macro
and uses for conditional compilation the same Kconfig option that is
the dependency of NRFX_USBREG.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-09-03 21:52:52 +02:00
Jordan Yates
1d0acd2bb8 drivers: serial: uart_rtt async support
Add support for `CONFIG_UART_ASYNC_API` to the uart_rtt driver.
As RTT provides no mechanism for knowing when new data has arrived,
the reception commands all return errors.

This fixes hard faults when asynchronous calls are made on the uart_rtt
driver, in addition to providing a small level of functionality.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-09-03 21:51:28 +02:00
Jordan Yates
3e33d73381 drivers: serial: uart_rtt converted to devicetree
Instantiate RTT UART instances from devicetree nodes instead of from
Kconfig symbols. While RTT is implemented using software, not hardware,
it is emulating a hardware device, and thus should be configured through
devicetree. This allows the simulated UART device to be selected via
devicetree aliases and chosen nodes.

The following devicetree snippet will instantiate RTT channels 0 and 2
as UART devices.
```
/ {
	rtt0: rtt_terminal {
		compatible = "segger,rtt-uart";
		label = "rtt_terminal";
		status = "okay";
	};

	rtt2: rtt_secondary {
		compatible = "segger,rtt-uart";
		label = "rtt_app_specific";
		status = "okay";
	};
};
```

Fixes the RTT portion of #10621.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-09-03 21:51:28 +02:00
Erwin Rol
742256f8ed drivers: dma: stm32: only set mem pool size when using DMAMUX
The general DMA driver doesn't use kmalloc anymore so it doesn't
need a memory pool. The DMAMUX_SMT32 driver still uses kmalloc,
so move the HEAP_MEM_POOL_SIZE config under DMAMUX_STM32.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-03 21:50:58 +02:00
Erwin Rol
7b8b219d63 drivers: dma: stm32: check result of stream disabling
Use dma_stm32_disable_stream instead of stm32_dma_disable_stream
to check if the disabling of the stream really worked and if
not return an error.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-03 21:50:58 +02:00
Erwin Rol
2da881a0ed drivers: dma: stm32: prevent posible out of bound access
Set pointer to an array element only after checking the bounds
of the index.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-03 21:50:58 +02:00
Erwin Rol
3866b39bb2 drivers: dma: stm32: remove global function tables
Convert the driver from global function tables to functions
that use static const function tables.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-03 21:50:58 +02:00
Erwin Rol
b05dc440e0 drivers: dma: stm32: convert global conversion tables to functions
Convert global conversion tables for id-to-stream and slot-to-channel
to functions that use local const static conversion tables.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-03 21:50:58 +02:00
Erwin Rol
67f68e68f1 drivers: dma: stm32: refactor irq handling
- Remove the need for kmalloc
- On hardware that supports it use 1 IRQ handler per stream to
  determine the stream ID, so the ISR does not have to loop
  over all ID's to see which one is active. On hardware (like
  STM32L0 and STM32F0) where up to 7 streams share 3 IRQ's use
  the loop to check which stream is active.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-03 21:50:58 +02:00
Erwin Rol
c8ae070de7 drivers: dma: stm32: Improve code readability
Some small code readability changes.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-03 21:50:58 +02:00
Erwin Rol
1c6a405ccb drivers: dma: stm32: Use volatile for flag used in ISR
Use volatile for flag shared between normal code and ISR to
prevent the compiler from possibly optimizing it away.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-03 21:50:58 +02:00
Crist Xu
6fcd5b567e drivers: i2c: Fix mcux driver transfer status after NACK
Adds a delay after transferring zero-length messages to
correctly detect a NACK.

Signed-off-by: Crist Xu <crist.xu@nxp.com>
2020-09-03 21:50:18 +02:00
Jeremy LOCHE
ddcc385586 drivers: ethernet: stm32h7 reduce count of tx_buffer_def
Reduced the size of tx_buffer_def array to 1 to save
on function stack memory. Here only 1 buffer is
enough to call the transmit function.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-09-03 21:48:53 +02:00
Jeremy LOCHE
8e46f099bf drivers: ethernet: stm32h7 IT based ethernet TX
Modify the ethernet driver to use TX complete interrupts.
Adds HAL ethernet TX complete callback and locking semaphore.

Due to changing behavior/content of the TX DMA descriptors
on STM32H7 series, based on the state of the IP,
it is more reliable to wait for the TX complete interrupt to check
for DMA end of transmission event. This avoids polling the
DMA_DESC_OWN bit in the descriptors.

Improves reliability and performance of the ethernet peripheral.

Tested on CoapServer sample, Dumb HTTP server, telnet sample.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-09-03 21:48:53 +02:00
Martin Jäger
66dde3a968 drivers: dac: Enable for STM32F0 series
Add DAC nodes to devicetree, include LL headers in soc.h and add
pinmux defines for DAC.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-09-03 14:46:03 -05:00
Martin Jäger
1dab7751b5 drivers: dac: Enable for STM32G4 series
Add DAC nodes to devicetree, include LL headers in soc.h and add
pinmux defines for DAC.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-09-03 14:46:03 -05:00
Alexandre Bourdiol
980848af43 drivers: clock: stm32f7 needs power over-drive to reach 216Mhz
Assuming we stay on default Power Scale 1,
overdrive is required when System Core Clock frequency is higher
than 180MHz.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-03 14:45:24 -05:00
Erwan Gouriou
ce29baa0ef drivers/bluetooth: ipm_stm32wb.c: Increase RX thread stack size
Stack overflows where seen in heavy logging conditions since printk
modifications that increased "slightly" RAM consumption
(973487fdad).

Increase RX Thread stack size to avoid these overflows.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-09-03 14:22:33 -04:00
Jan Van Winkel
8ba99a40f8 drivers: kscan: sdl: Corrected device data access
Corrected compilation error due to incorrect device data member access.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2020-09-03 14:07:15 -04:00
Peter Bigot
6f51526980 drivers: gpio: sx1509b: fix interrupt handler argument
The handler is directly invoked so can take an appropriately qualified
pointer to const device.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-03 14:05:56 -04:00
Peter Bigot
d3e8d6c3f3 i2c_shell: restore documentation on scan technique
When this code was moved from a standalone sample to an optional shell
feature the documentation on how this works and caveats was lost.  Put
it back so it can be referenced in issue explanations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-03 08:52:19 -04:00
Peter A. Bigot
0839f38451 drivers: console: fix Kconfig DTS inference for mcumgr uart
The conversion last year mixed up uart-pipe with uart-mcumgr.  Revert
to the pre-conversion relationship.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-09-02 14:56:19 -05:00
Peter Bigot
669a0d6f5b drivers: eeprom: reduce priority of at2x initialization
The default priority for I2C controller initialization is POST_KERNEL
60 (SPI 70), while the default priority for device configuration is
POST_KERNEL 50.  Thus the EEPROM is being initialized before its
controller.  While for this driver that wouldn't be an issue recent
changes mean the device lookup returns NULL before the device is
initialized.

Change the AT2X priority to 75 so it falls between the I2C and SPI
drivers and the default ethernet priority (80), since some ethernet
controllers may store the MAC address in EEPROM.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-02 15:27:57 -04:00
Peter Bigot
478577e04a driver: interrupt_controller: miwu: fix build errors from device const
Declaration within a macro was missed during conversion.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-02 19:01:28 +02:00
Alexandre Bourdiol
51d4b4d5f4 drivers: flash: stm32wb: rework dualcore flash operation
Implement algorithm described in STM32 AN5289
with implementation proposed in STM32 Cube Application:
BLE_RfWithFlash

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-02 14:13:49 +02:00
Alexandre Bourdiol
5deb8ffe0c drivers: STM32: Rework CLK48 HSEM protection
Due to HSEM implementation #24862, USB CLK48 lock implementation
#25850 should be reworked.
And by the way, implement the same in entropy which is using the
same clock.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-02 14:13:49 +02:00
Tomasz Bursztyka
ef560e0a53 drivers: Manual const-ification of device driver instance
These are all the case that coccinelle cannot find as they are inside
macro declarations.

Fixed via:

git grep -rlz -E "\(struct device \*" |
	xargs -0 sed -i 's/(struct device/(const struct device/g'

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
4dcfb5531c isr: Normalize usage of device instance through ISR
The goal of this patch is to replace the 'void *' parameter by 'struct
device *' if they use such variable or just 'const void *' on all
relevant ISRs

This will avoid not-so-nice const qualifier tweaks when device instances
will be constant.

Note that only the ISR passed to IRQ_CONNECT are of interest here.

In order to do so, the script fix_isr.py below is necessary:

from pathlib import Path
import subprocess
import pickle
import mmap
import sys
import re
import os

cocci_template = """
@r_fix_isr_0
@
type ret_type;
identifier P;
identifier D;
@@
-ret_type <!fn!>(void *P)
+ret_type <!fn!>(const struct device *P)
{
 ...
(
 const struct device *D = (const struct device *)P;
|
 const struct device *D = P;
)
 ...
}

@r_fix_isr_1
@
type ret_type;
identifier P;
identifier D;
@@
-ret_type <!fn!>(void *P)
+ret_type <!fn!>(const struct device *P)
{
 ...
 const struct device *D;
 ...
(
 D = (const struct device *)P;
|
 D = P;
)
 ...
}

@r_fix_isr_2
@
type ret_type;
identifier A;
@@
-ret_type <!fn!>(void *A)
+ret_type <!fn!>(const void *A)
{
 ...
}

@r_fix_isr_3
@
const struct device *D;
@@
-<!fn!>((void *)D);
+<!fn!>(D);

@r_fix_isr_4
@
type ret_type;
identifier D;
identifier P;
@@
-ret_type <!fn!>(const struct device *P)
+ret_type <!fn!>(const struct device *D)
{
 ...
(
-const struct device *D = (const struct device *)P;
|
-const struct device *D = P;
)
 ...
}

@r_fix_isr_5
@
type ret_type;
identifier D;
identifier P;
@@
-ret_type <!fn!>(const struct device *P)
+ret_type <!fn!>(const struct device *D)
{
 ...
-const struct device *D;
...
(
-D = (const struct device *)P;
|
-D = P;
)
 ...
}
"""

def find_isr(fn):
    db = []
    data = None
    start = 0

    try:
        with open(fn, 'r+') as f:
            data = str(mmap.mmap(f.fileno(), 0).read())
    except Exception as e:
        return db

    while True:
        isr = ""
        irq = data.find('IRQ_CONNECT', start)
        while irq > -1:
            p = 1
            arg = 1
            p_o = data.find('(', irq)
            if p_o < 0:
                irq = -1
                break;

            pos = p_o + 1

            while p > 0:
                if data[pos] == ')':
                    p -= 1
                elif data[pos] == '(':
                    p += 1
                elif data[pos] == ',' and p == 1:
                    arg += 1

                if arg == 3:
                    isr += data[pos]

                pos += 1

            isr = isr.strip(',\\n\\t ')
            if isr not in db and len(isr) > 0:
                db.append(isr)

            start = pos
            break

        if irq < 0:
            break

    return db

def patch_isr(fn, isr_list):
    if len(isr_list) <= 0:
        return

    for isr in isr_list:
        tmplt = cocci_template.replace('<!fn!>', isr)
        with open('/tmp/isr_fix.cocci', 'w') as f:
            f.write(tmplt)

        cmd = ['spatch', '--sp-file', '/tmp/isr_fix.cocci', '--in-place', fn]

        subprocess.run(cmd)

def process_files(path):
    if path.is_file() and path.suffix in ['.h', '.c']:
        p = str(path.parent) + '/' + path.name
        isr_list = find_isr(p)
        patch_isr(p, isr_list)
    elif path.is_dir():
        for p in path.iterdir():
            process_files(p)

if len(sys.argv) < 2:
    print("You need to provide a dir/file path")
    sys.exit(1)

process_files(Path(sys.argv[1]))

And is run: ./fix_isr.py <zephyr root directory>

Finally, some files needed manual fixes such.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
5c9dd0de78 drivers: Apply dynamic IRQ API change
Switching to constant parameter.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
d00d86972a drivers: sensor: Fix device instance const qualifier loss
It is necessary to wrap the device pointer into data.
Which was done already on most of them when global trigger is enabled.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
162c0bd7fe drivers: serial: Fix device instance const qualifier loss
It is necessary to wrap the device pointer into data.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
7af23757bc drivers: kscan: Fix device instance const qualifier loss
SDL one needs to wrap device pointer into its data and xec do not need
to pass any argument to its thread.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
806b0ca0fb drivers: led: Fix device instance const qualifier loss in HT16K33
It is necessary to wrap the device pointer into data.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
d1c68de67e drivers: console: Fix device instance const qualifier loss in IPM driver
Passing the device's data and config is sufficient for the thread.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
7d8be66eba drivers: wifi: Fix device instance const qualifier loss in ESP
Passing the device's data was sufficient as only the data is being used
by the thread.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
f1c0f2d0f9 drivers: adc: Fix device instance const qualifier loss
It is necessary to wrap the device pointer into data.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
a1708cf2f2 drivers: ethernet: Fix device instance const qualifier loss
Passing driver's data to k_thread is sufficient for mcux.
On enc424j600, however, the device pointer is needed and thus is wrapped
into its data. But there seems to be a possible optimisation: all local
spi related function in fact only needs the device's data (context) and
so changing all spi related function to take the context would remove
the need to wrap the device pointer into its data.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
949b25cf68 drivers: ieee802154: Fix device instance const qualifier loss
In all of these drivers, passing the device's data was sufficient as
only the data is being used by thread.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
681fcd17b1 drivers: video: Fix device instance const qualifier loss in MCUX CSI
It is necessary to wrap the device pointer into data.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
e1c118f019 drivers: flash: Fix device instance const qualifier loss in NRF QSPI
Passing the device's data is sufficient to be used by the HAL callback
function.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
898f914df5 drivers: spi: Fix device instance const qualifier loss
Some needed to wrap the device pointer into device's data, where others
needed only device's data to be passed to HAL callback function.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
45832ac1d6 drivers: watchdog: Remove useless Kconfig entry
The function it would build is nowhere to be seen.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
4917f6f4da drivers: gpio: Fix device instance const qualifier loss
It is necessary to wrap the device pointer into data.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
d1aee6b87f drivers: dma: Fix device instance const qualifier loss in NIOS2 driver
Passing the device's config was necessary, and wrapping device inside
it.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
5fbc9346d0 drivers: can: Fix device instance const qualifier loss in MCUX Flexcan
It is necessary to wrap the device pointer into data, and pass the data
to the HAL callback function.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
206f4d61fc drivers: i2c: Fix device instance const qualifier loss
In all of these drivers, passing the device's data was sufficient as
only the data is being used by the HAL callback function then.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
f818ec2d8d drivers: ethernet: Remove ugly usage of a goto in enc*j* drivers
This is a working code, but it's harder to read. And for some reason
makes some semantic patches of coccinelle running forever.

So refactoring it.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Tomasz Bursztyka
7967aa6af0 drivers: gpio: Use DEVICE_AND_API_INIT for mmio32 driver
Let's set the api at built time, or this will create a bug once device
instance pointers become constant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Simon Glass
49f2167974 emul: i2c: Add support for I2C emulators
Add an emulation controller which routes I2C traffic to attached
emulators depending on the I2C address selected. This allows drivers
for I2C peripherals to be tested on systems that don't have that
peripheral attached, with the emulator handling the I2C traffic.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-01 14:30:46 -04:00
Erwin Rol
dce9580490 drivers: i2c_ll_stm32_v1: Reset i2c device on read/write error
Reset the i2c device when read or write return with an error
code. This is to bring the i2c hardware back into a known
state after a hardware error (like EMC spikes) caused
the device to lock up.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-09-01 09:21:44 -05:00
Joakim Andersson
9ac8dcf5a7 Bluetooth: Call bt_recv from priority higher that TX thread.
A build assert in dummy.c lists the following requirement:
[...] receive thread priority shall be higher than the Bluetooth
Host's Tx and the Controller's receive thread priority.
This is required in order to dispatch Number of Completed Packets
event before any new data arrives on a connection to the Host threads.

The drivers uses a priority that is equal to the Host TX thread,
and since they don't use the CONFIG define that is only available
to the controller then this BUILD_ASSERT will not catch the
requirement.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-01 15:15:36 +03:00
Alexandre Bourdiol
8098ecbc02 boards: arm: nucleo_g071rb enable PWM
Tested with tests/drivers/pwm/pwm_api/
(requires https://github.com/zephyrproject-rtos/zephyr/pull/27204)
and with oscillo.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-01 13:35:48 +02:00
Mulin Chao
b3188f1c32 drivers: npcx: replace type of register base address with uintptr_t
Replace npcx register base address type, uint32_t, with uintptr_t.
It is easier to know what type of base address and for linear
addresses treated as integral values.

This CL also modified IS_BIT_SET() macro function to fit MISRA code
guidelines.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Mulin Chao
1eca7ab46a drivers: npcx: remove suffix '_t' of device register structure.
Remove the '_t' suffix of device register structure since it is used
mainly with typedefs.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Mulin Chao
288e35ab1a driver: uart: add wake-up support for uart device.
This CL configures the UART wake-up event triggered from a falling edge
(START condition) on CR_SIN pin. It also includes:

1. Introduce wui_maps property in yaml file to present relationship
   between Wake-Up Input (WUI) and UART device.
2. Implement wake-up mechanism by MIWU api functions.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Mulin Chao
6deb68a517 driver: gpio: add gpio driver support in NPCX series
Add gpio support for Nuvoton NPCX series. This CL includes:

1. Add GPIO device tree declarations.
2. Introduce wui_maps property in yaml file to present relationship
   between Wake-Up
   Input (WUI) and 8 IOs belong to the device.
3. Zephyr GPIO api implementation.
4. GPIO callback functions implementation with MIWU api functions.
5. Overlay file for gpio basic tests

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Mulin Chao
84d90e456a driver: intc: add MIWU driver support in NPCX series.
The device Multi-Input Wake-Up Unit (MIWU) supports the embedded
controller (EC) to exit 'Sleep' or 'Deep Sleep' power state which allows
chip has better power consumption. Also, it provides signal conditioning
such as 'Level' and 'Edge' trigger type and grouping of external
interrupt sources of NVIC. The NPCX series has three identical MIWU
modules: MIWU0, MIWU1, MIWU2. Together, they support a total of over 140
internal and/or external wake-up sources.

In this CL, we use device tree files to present the relationship bewteen
MIWU and the other devices in different npcx series. For npcx7 series,
it include:
1. npcx7-miwus-int-map.dtsi: it presents relationship between MIWU group
   and NVIC interrupt in npcx7. Please notice it isn't 1-to-1 mapping.
2. npcx7-miwus-wui-map.dtsi: it presents relationship between input of
   MIWU and its source device such as gpio, timer, eSPI VWs and so on.

This CL also includes:
1. Add MIWU device tree declarations.
2. MIWU api function declarations and implementation to configure signal
   conditions and callback function mechanism. They can be be classified
   into two types. One is for GPIO which connects original gpio callback
   implemetation and the other is for generic devices such as timer,
   eSPI, and so on.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Alexandre Bourdiol
a6ad4ec95d drivers: entropy: stm32 full driver rework with software fifo
mimic nrf driver as suggested #27825

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-01 13:31:38 +02:00
Peter Bigot
b9e3226f60 i2c: bitbang: fix SDA pin configuration
The driver must be able to read from this pin as well as write to it.
If the driver doesn't support bidirectional configuration then fall
back to the legacy mode.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-31 13:07:24 +02:00
Ilya Averyanov
afc480f12b drivers/spi: spi_context_longest_current_buf fix
spi_context_longest_current_buf must return max buffer len.
Also remove redundant check

Signed-off-by: Ilya Averyanov <a1ien.n3t@gmail.com>
2020-08-31 13:05:50 +02:00
Krzysztof Chruscinski
17d7ad482a drivers: clock_control: Rename nrf_power_clock to clock_control_nrf
Renamed nrf clock control driver file since it does no long control
POWER peripheral.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-31 12:40:47 +02:00
Krzysztof Chruscinski
701e9befe4 drivers: clock_control: nrf: Move USB part to the USB driver
Removed all nrf_power/USB related stuff from clock control
driver to USB driver.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-31 12:40:47 +02:00
Krzysztof Chruscinski
d8da2e59c8 drivers: clock_control: nrf: Make use of related nrfx drivers
Update the driver implementation to use nrfx_clock and nrfx_power
drivers. Update also revisions of the hal_nordic and nrf_hw_models
modules, so that it is actually possible to use those drivers.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-08-31 12:40:47 +02:00
Ryan Erickson
eca8842b67 drivers: modem: add Sierra Wireless HL7800 Modem Driver
The driver utilizes the CONFIG_NET_OFFLOAD setting to avoid the
normal handling of IP packets, and instead uses a socket-like
UART interface to handle incoming and outgoing data via AT commands.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-08-31 10:46:33 +02:00
Jose Alberto Meza
01ddb4787d drivers: espi: xec: support for eSPI slaves with long initializations
Add Kconfig switch to disable automatic eSPI slave boot acknowledge.
This allows to perform lenghty operations before continue any eSPI
handshake with eSPI master.

Required for eSPI SAF boot configuration.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-08-30 08:22:11 -04:00
Mahesh Mahadevan
f75f8bec20 MXRT600: Add DMA support
Add DMA support for MCUX LPC SoC's

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-08-28 14:24:21 -05:00
Simon Guinot
21f4fef78b drivers: led: add shell support
This patch introduces the "led" shell command. This allows to run the
LED API functions (and to test the LED drivers) from the Zephyr shell.
The following subcommands are supported:

- on
- off
- get_info
- set_brightness
- set_color
- set_channel
- write_channels

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-08-28 15:04:35 +02:00
Simon Guinot
b37ea90335 drivers: led: add driver for TI LP503x controllers
This patch adds support for the Texas Instruments LP5030 and LP5036
I2C LED controllers. They are respectively providing up to 30 and 36
channels (i.e. 10 or 12 RGB LEDs).

In addition to the channel/color registers this LED controller provides
a per-LED brigthness register. This driver implements both LED-based and
channel-based API methods:

- led_on
- led_off
- led_get_info
- led_set_brightness
- led_set_color
- led_set_channel
- led_write_channels

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-08-28 15:04:35 +02:00
Simon Guinot
f59abf5916 drivers: led: introduce channel-dedicated syscalls
Some LED controllers are connected to a large number of LEDs (i.e.
array/strip of LEDs). A user may need to set several LEDs at the same
time. The LED oriented syscalls are not adapted to this task. Indeed a
call per LED is needed to configure a group of LEDs. To that end, this
patch adds the led_set_channel and led_write_channels syscalls to the
LED API. They offer direct access to the raw channels. They respectively
allow to set a single channel and to write several contiguous channels
(and therefore to configure a group of LEDs).

Moreover the addition of the led_write_channels syscall also aims at
closing the gap with the LED strip API.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
2020-08-28 15:04:35 +02:00
Simon Guinot
2e26262451 drivers: led: introduce led_set_color syscall
The led_set_color syscall adds support for multicolor (i.e.
multi-channel) LEDs to the LED API. It allows a user to set all the
colors/channels of a LED at once by passing a color array. Note that
this array must provide an entry per color/channel and must also be
ordered following the color mapping of the LED. This color mapping can
be either retrieved from the "color-mapping" DT property or from the LED
driver itself (by using the led_get_info syscall).

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-08-28 15:04:35 +02:00
Simon Guinot
713809f0ce drivers: led: introduce led_get_info syscall
When supported by the driver the led_get_info syscall allows a user
to retrieve the following information about each LED available:

- The LED label.
- The number of colors/channels.
- And for a multicolor LED a pointer to a channel-color mapping.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
2020-08-28 15:04:35 +02:00
Loic Poulain
377f6c2a31 drivers: wifi: eswifi: rework read work
Remove non necessary eswifi lock/unlock in read procedure (eswifi
lock support nesting).

Return NULL packet in case socket is closed by remote (tested with
net shell and net recv).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-08-28 13:18:31 +03:00
Laurent Meunier
1603c329bd drivers: i2c_ll_stm32_v2: add support for optional timing property
In case optional timings property has been defined in DT, let's use it
and look for a matching peripheral clock and i2c bus clock so that
timing value is used instead of using runtime algorithm.

If matching the current configuration, the value will be set directly to
the I2C_TIMINGR register through the LL API.

This property is only valid for I2C V2 peripheral, so the timing config
structure member is only added in case of CONFIG_I2C_STM32_V2. Also the
initialization of the member is done conditionnaly, only in case
it is defined in DT, otherwise timings table will be empty.

Signed-off-by: Laurent Meunier <laurent.meunier@st.com>
2020-08-28 11:36:58 +02:00
Peter Bigot
77aa89bcb5 drivers: flash: remove W25QXXDV driver
The spi_flash_w25qxxdv driver has been superseded by the generic
spi_nor driver for over a year.  The only non-refactoring change to
the W25Q driver in the last 18 months was done to support a backport
to 1.14.

All devices supported by spi_flash_w25qxxdv driver are expected to be
supported by the spi_nor driver, using the standard `jedec,spi-nor`
devicetree compatible.  No in-tree devicetree files make use of this
driver.

Remove the confusion about which driver to select by removing the
unmaintained redundant driver.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-27 17:39:21 +02:00
Alexandre Bourdiol
5ae149a17b board: arm: nucleo_f207zg: add DAC support
Add DAC support to nucleo_f207zg:

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-08-27 16:06:34 +02:00
Alexandre Bourdiol
7b8624a058 drivers: entropy: stm32: RCC_HSI48_SUPPORT not always defined
RCC_HSI48_SUPPORT is not always defined even if SOC support HSI48.
Ex: STM32H7 family which support HSI48 but doesn't have
switch RCC_HSI48_SUPPORT.
This switch is usefull when in the same STM32 family some soc have
HSI487 and some other soc not.

So instead, use CMSIS register defines (which depends on family)

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-08-27 14:14:35 +02:00
Flavio Ceolin
e1e4a402e2 drivers: timer: Explicitly setting argument as unused
Marking as unused (ARG_UNUSED) the parameter device in the
initialization function z_clock_driver_init when it is not used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-27 07:02:40 -04:00
Mahesh Mahadevan
99f24aeac6 MCUX Flexcomm SPI: Add Slave support
Add support for Slave mode in the mcux flexcomm spi driver

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-08-26 16:32:50 -05:00
Alexandre Bourdiol
f5e8c06628 drivers: i2c: fix STM32 implicit-fallthrough warning
Fall through is intentional,
so make sure compiler doesn't raise warning.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-08-26 13:17:57 -04:00
Pawel Sagan
cc30fb871b drivers: i2s: Add LiteX I2S controller driver
This introduces LiteX I2S driver supporting the following features:
    - 8,16,24,32 bit sample width,
    - mono/stereo sound,
    - different sample frequencies
    - big/little-endian data format,
    - concatenated channels mode (for selected sample widths only),
    - slave/master mode operation.

Signed-off-by: Pawel Sagan <psagan@internships.antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2020-08-26 08:17:42 -04:00
Pawel Sagan
fd2370be88 drivers: interrupt_controller: Remove unnecessary cast
This removes a cast when getting the isr eth address from the isr table.

Signed-off-by: Pawel Sagan <psagan@internships.antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2020-08-26 08:17:42 -04:00
Martin Jäger
202ca01dcb drivers: pinmux: stm32g4x: Add PWM8 defines
All positive PWM outputs of TIM8 added.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-08-26 12:33:07 +02:00
Henrik Brix Andersen
d5514752d0 drivers: spi: add driver for the Xilinx AXI Quad SPI IP
Add SPI driver for the Xilinx AXI Quad SPI IP. Despite the name, this IP
block supports both single, dual, and quad line widths.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-08-26 12:32:27 +02:00
Kwon Tae-young
2aeed81202 drivers: dac: Added driver for TI DACx0508
TI's DACx0508 is a DAC chip that supports SPI.
Gain and Reference can be set through the register.

Signed-off-by: Kwon Tae-young <tykwon@m2i.co.kr>
2020-08-26 12:24:43 +02:00
Jose Alberto Meza
b466db116a drivers: espi: xec: Fix eSPI frequency override during IO selection
Fix incorrect register update that results in unintentionally
in default eSPI frequency (20MHz) whenver IO mode is changed.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-08-25 09:32:29 +02:00
Flavio Ceolin
0aaae4a039 guideline: Make explicit fallthrough cases
-Wimplicit-fallthrough=2 requires a fallthrough comment or a compiler
to tells gcc that this happens intentionally.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-24 20:28:47 -04:00
Jamie McCrae
4cf1832fa8 drivers: sensors: sm351lt: Add new driver
Adds sm351lt magnetoresitive sensor driver.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2020-08-24 16:48:47 -05:00
Peter Bigot
c789ea87ef dts: nordic,nrf-twim: rename non-hardware property
As a general rule devicetree properties should correspond to hardware
description or configuration.  In cases where a Zephyr driver receives
instance-specific configuration data from a devicetree property that
property should be marked as being Zephyr-specific.  Rename
concat-buf-size to zephyr,concat-buf-size to follow this guideline.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:35:29 -05:00
Peter Bigot
afdb98a4a9 drivers: i2c_nrfx_twim: restore previous behavior without concat buffer
The Nordic TWIM peripheral generates a start condition for each bus
transaction.  Devices such as the SSD1306 display and some NXP sensors
can only tolerate the presence of a start condition and device address
after a stop condition.  Those devices will not operate correctly when
these signals are observed while the bus is already active.  This
motivated the addition of a RAM buffer into which message fragments
could be collected so TWIM can transmit them without injecting
unnecessary start conditions.

However many I2C devices interpret these signals as a repeated start
and ignore them and so function properly without a buffer
concatenating the message fragments.

There is no default for the concat-buf-size property, and the previous
strict requirement for one when performing scatter/gather I/O
transactions broke working drivers for devices that tolerate the
repeated starts.  Allow those drivers to work by respecting the
property description and attempting to concatenate messages only if a
buffer in which to place them has been provided.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:35:29 -05:00
Peter Bigot
faa855b9df drivers: i2c_nrfx_twim: refactor concat check logic
The condition of being either the last message or not concatenable to
the next message is the inverse of the condition of committing to
concatenate the next message.  The latter is arguably easier to
understand.  Reverse the logic, document the conditions, and simplify
the early continue.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:35:29 -05:00
Peter Bigot
1278c13d47 drivers: i2c_nrfx_twim: clean up when buffer capacity failure detected
Do the normal post-transfer shutdown and sync management when a
transaction is rejected due to insufficient buffer size rather than
returning with the peripheral left enabled and the transfer lock held.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:35:29 -05:00
Peter Bigot
d719801d1e drivers: i2c_nrfx_twim: correct concat buf bounds check
The original checked only the current message length against the
buffer size, not accounting for space already used.

Also improve the diagnostic to indicate how much space is required vs
given.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:35:29 -05:00
Peter Bigot
be8c59b4a4 drivers: i2c: nordic increase timeout to 500 ms
The 100 ms hard-coded timeout is too small to complete the transfer of
1025 bytes of SSD1306 data at 100 kHz.  Increase it to 500 ms to match
STM32 policy and fix this problem.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:31:21 -05:00
Erwin Rol
7bf50875c5 drivers: counter: stm32: Allow disabling backup domain reset
Allow the disabling of reseting of the backup domain. This gives
the possibility to keep the content of the 20 backup registers
and use them to store information that survives a reboot.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-08-24 16:27:13 -05:00
Andrei Emeltchenko
765305e697 ipm: ipm_intel_adsp: Add INTEL ADSP IPM driver
Add IPM driver for Host-DSP communication channel.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-08-24 13:38:33 -04:00
Roman Vaughan
127e82e3b8 drivers: can: Wait for MCP2515 to reset
The device may be prematurely configured before it is ready during
reset without first checking. After the driver writes to the registers
and normal mode gets selected, CANSTAT is read back to ensure the
device is now configured in normal mode (0x00). However, an
unresponsive device will be read as 0x00, the driver then assumes it is
configured correctly.

The MCP2515 will reset into configuration mode (0x04) to allow bit
timings to be configured. Adding a check for this mode prevents the
device from being misconfigured.

Signed-off-by: Roman Vaughan <nzsmartie@gmail.com>
2020-08-21 14:47:01 -05:00
Henrik Brix Andersen
768482cb6a drivers: adc: mcp320x: fix compilation when using spi cs-gpios
Fix compilation of the MCP320x ADC driver when using SPI cs-gpios.

Fixes 0f7acb1dc3.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-08-21 14:31:40 -05:00
Hake Huang
f6677b77fa counter: add pit counter driver
add Kinetis PIT as counter driver

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-08-21 14:27:59 -05:00
Marcin Niestroj
1e6679a23b drivers: console: uart_mux: consume ringbuf until it is empty
ringbuf claim API returns pointer to contiguous area. In cases when data
in ringbuf wraps the end of internal buffer, then single call to claim
data is not enough to get all data - there is remaining part on the
beginning of internal buffer. Those remaining bytes will need to wait
for next ISR handler to trigger workqueue. Theoretically this means that
data on the beginning of ringbuf can wait there forever.

Consume data from ringbuf in a loop, stopping only when claiming results
in empty buffer. This will make sure that there is no stale data in the
ringbuf.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-08-21 13:51:45 -04:00
Matija Tudan
efae88ce3a sensor: fxos8700: implement magnetic vector magnitude function
The magnetometer vector-magnitude function will generate an interrupt
when magnitude is greater than specified threshold value. The user
may program the threshold value to establish the conditions needed
to detect a magnetic vector-magnitude change event. Depending on the
values chosen for the reference values, this function may be
configured to detect a magnetic field magnitude that is above
a preset threshold (with reference values = 0), or a change in magnitude
between two magnetic vectors greater than the preset threshold
(with reference values non-zero).

Default configuration of M_VECM_CFG register (address 0x69) is 0x4e.

Signed-off-by: Matija Tudan <mtudan@mobilisis.hr>
2020-08-21 12:30:50 -05:00
Mahesh Mahadevan
dc294b8773 RT600: Fix IOCON setting
Enable input buffer for both input and output pins.
The buffer must be enabled when the pin is used as
an input. Enabling the buffer enables reading back
the GPIO value when configured as output

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-08-19 13:06:30 -05:00
Jukka Rissanen
60d2885e3c driver: eth: native_posix: Minimum RX sleep with gPTP
Sleep minimum time in RX when gPTP is enabled. Typically we
receive constant stream of gPTP protocol data so no need to
wait very long in that case and cause timeouts.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-19 12:47:09 -04:00
Jukka Rissanen
08da995bf9 net: eth: native_posix: Only claim VLAN support when applicable
Make sure that native_posix Ethernet driver is claiming to support
VLAN when the VLAN functionality is enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-19 12:47:09 -04:00
Jukka Rissanen
fe638d23fc net: native_posix: gptp: Add multiport support
Add gPTP multiport support to native_posix Ethernet driver.
This means that the driver is able to create more than one
network interface and enable gPTP to each of them. This requires
that net-tools is updated as it contains configuration file
for network interfaces in host side.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-19 12:47:09 -04:00
Christian Taedcke
e8a5039b70 drivers: serial: gecko: Replace custom macros with _CONCAT
Remove the macros CLOCK_ID_PRFX2 and CLOCK_ID_PRFX and replace them with
_CONCAT from common.h.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-08-19 11:33:39 -05:00
Timo Dammes
751efe1f6d drivers: uart_gecko: added support for hardware flow control
Added support for hardware flow control in EFM32 UART driver.

Signed-off-by: Timo Dammes <timo.dammes@lemonbeat.com>
Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-08-19 11:33:39 -05:00
Paul Sokolovsky
9ef03bb54c drivers: eswifi: Remove unused variable in ioctl routine
Variable "sd" is no longer referenced after refactoring in 2ed6b6a8ed.
It caused warning-as-error when building using sanitycheck, e.g. in CI.
This is 2nd fixed of the above refactor, after eb9a18432.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-08-19 14:35:10 +03:00
Erwin Rol
913c76864a drivers: pinmux: stm32: add SPI pinmux for F4 series
Add SPI NSS functionality on PB0, PD2, and PB14 pins.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-08-18 14:50:34 +02:00
Vincent Wan
eb9a184324 drivers: fix socket close() implementations for socket offloading
PR #27485 introduced new implementations for close() that do not build
correctly. This commit fixes the problem by re-implementing them.

Fixes #27587

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-08-18 10:41:01 +03:00
Göran Weinholt
1ccc65a9c9 drivers: modem: Get the IMSI and ICCID from the SIM
This adds an option to query the modem for the SIM's IMSI and ICCID
numbers, just like the modem's IMEI is queried today. This requires
the SIM to be present, which might not be the case for all
applications, so it can be disabled.

Signed-off-by: Göran Weinholt <goran.weinholt@endian.se>
Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-08-18 09:39:49 +02:00
Emil Obalski
0042e1e95f usb: nrf: Fix for remote wake up request.
Short explanation of remote wake up:

The device has a possibility to wake up the HOST by sending
the wake up request. The request must be previously
explicitly enabled by the HOST just before the SUSPEND.

The HOST enables the remote wake up functionality by sending
SET_FEATURE request with remote wake up flag set to 1.
This ususally happens just before the device is suspended.

About this PR:
When the device decides to wake up the HOST it sends proper request.
Nordic USB HW is creating an event when the request has been sent.

The Zephyr USB device stack must proerly react to this event and
change the state of the device from SUSPENDED. For example if the
device was previously in CONFIGURED state it will remain CONFIGURED.
For state changes refer to Chapter 9.1.1 form USB 2.0 specification.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-08-17 13:41:35 -04:00
Peter A. Bigot
368cf2fc45 drivers: flash: spi_nor: support serial flash API
Expose the internal JESD216 function used to read data from the SFDP
region, and another function to read the JEDEC ID.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-17 13:38:14 -04:00
Peter A. Bigot
6a1a246825 drivers: flash: add API to read JEDEC ID from compatible drivers
Some flash drivers are capable of issuing a JESD216 READ_SFDP command
to read serial flash discoverable parameters.  Allow applications and
utilities access to API that reads the JEDEC ID from those devices.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-17 13:38:14 -04:00
Peter A. Bigot
4eb8d9dd9e drivers: flash: add API to access SFDP region of serial flash devices
Some flash drivers are capable of issuing a JESD216 READ_SFDP command
to read serial flash discoverable parameters.  Allow applications and
utilities access to that capability where it's supported.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-17 13:38:14 -04:00
Peter A. Bigot
67e795107e drivers: flash: spi_nor: support multiple config sources
This commit reworks the SPI NOR driver to be more flexible in how
flash device configuration is obtained.  Three alternatives are
supported:

* MINIMAL takes only the flash size from devicetree.  The erase sizes
  are hard-coded to the traditionally supported instructures.

* DEVICETREE requires that the data from the device's JESD216 Basic
  Flash Parameters table be provided through devicetree.  This
  supports multiple page sizes and erase configurations, and lays a
  foundation for significant enhancements in the future including
  4-byte address, sleeping while waiting for operation completion, and
  other features that are described by JESD216 parameters.

* RUNTIME requires nothing from the devicetree node, instead reading
  the Basic Flash Parameters from the device at runtime.  It extends
  DEVICETREE by allowing the same firmware to run on boards with
  different flash chips.

For MINIMAL and DEVICETREE the JEDEC ID from the devicetree node is
checked against the value read at runtime to confirm that the device
configuration is accurate.

The default SFDP source is MINIMAL.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-17 13:38:14 -04:00
Peter A. Bigot
810920f8d5 drivers: flash: spi_nor: read erase support and page size from SFDP
Use the new SFDP infrastructure to read the supported erase type sizes
and commands from the Basic Flash Parameters block.  This removes the
need for explicit reference to most block sizes from this driver.

We're also seeing devices where the page size is not 256 bytes.
Accommodate them.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-17 13:38:14 -04:00
Peter A. Bigot
bfcd64c29d drivers: flash: jesd216: add JESD216 API for use in shared drivers
The spi_nor flash interface was designed for flash devices that use a
standard SPI interface to devices that are compatible with the Micron
M25P80 serial flash, identified in Linux as compatible jedec,spi-nor.

The JEDEC Serial Flash Discoverable Parameters standard (JESD216) was
designed to allow these devices to be self-describing.  As we are
increasingly being asked to support flash memories that do not use
"standard" erase sizes or commands we need data structures and helper
functions to extract information about a flash interface at runtime.
For some of these devices the commands hard-coded in the current
implementation are simply wrong.

Define generic structures that support the SFDP hierarchy and the core
Basic Flash Parameters table.  The description will also support
SPI-NAND and xSPI devices that conform to the JESD216 standards.

Add bitfield values and helper functions to extract some information
that drivers might need from JESD216 fields.  At this time only
information that is likely to be used is extracted; more may be added
in the future.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-17 13:38:14 -04:00
Peter A. Bigot
40a0d076e2 drivers: flash: nrf_qspi_nor: replace imported config struct
The one provided in the spi_nor.h header is inappropriate for this
device, which doesn't support be32k.  Also that definition is moving
into the spi_nor implementation file.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-17 13:38:14 -04:00
Erwin Rol
c792db6b32 drivers: ethernet: stm32: add name to rx thread
Give a name to the rx thread so it can be more easily identified
in tracers like SystemView.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-08-17 13:37:24 -04:00
Anas Nashif
e927f62c21 drivers: mcux_iuart: use new device structure member names
device structure members were renamed, update driver to use new names.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-15 11:54:58 -04:00
Parthiban Nallathambi
352e2a7ad4 drivers: wifi: eswifi: Coverity fix
Fix https://github.com/zephyrproject-rtos/zephyr/issues/27325
unchecked return value

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-08-14 18:50:17 -04:00
Manivannan Sadhasivam
1118428abb drivers: clock_control: Add support for MCUX CCM IUART clock
Add support for controlling the MCUX CCM IUART clock.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-08-14 14:51:50 -05:00
Manivannan Sadhasivam
0533d4eae1 drivers: serial: Add NXP IUART driver
Add IUART driver based on MCUX SDK. This driver is used to provide
serial console support on i.MX8M Mini SoC.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-08-14 14:51:50 -05:00
Henrik Brix Andersen
6ac911d585 drivers: gpio: add driver for the Xilinx AXI GPIO IP
Add driver for the Xilinx AXI GPIO v2 IP.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-08-14 13:35:39 -05:00
Henrik Brix Andersen
1cde72a35d drivers: serial: add driver for the Xilinx UART Lite IP
Add serial driver for the Xilinx UART Lite IP.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-08-14 13:35:39 -05:00
Jukka Rissanen
2ed6b6a8ed lib: fdtable: Add callback for close() calls
Do not route close() calls via ioctl() as that is error prone
and quite pointless. Instead create a callback for close() in
fdtable and use it directly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-14 09:47:51 -07:00
Richard Osterloh
702e8d0a31 drivers: pinmux: Fix NSS definitions for SPI
Complete hardware NSS multiplexing definitions for SPI

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
2020-08-14 18:02:28 +02:00
Andrew Boie
63c3e153d6 drivers: use node IDs for DEVICE_MMIO.*_INIT
There is nothing wrong with instance numbers and they are
recommended for use whenever possible, but this is an API
design problem because it's not always possible to get nodes
by instance number; in some cases, drivers need to get node
identifiers from node labels, for example.

Change these APIs (which are not yet in any Zephyr release)
to take node IDs instead of instance IDs.

Fixes: #26984

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-14 13:35:02 +02:00
Mulin Chao
1162747574 driver: serial: Add UART support in NPCX series.
Add UART support for Nuvoton NPCX series. This CL includes:

1. Add UART controller device tree declarations.
2. UART controller driver implementation.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-08-13 16:42:20 +02:00
Mulin Chao
9cb73abbdc driver: pinctrl: Add pin control support in NPCX series.
Add pin controller support for Nuvoton NPCX series
Add pin-mux controller support for Nuvoton NPCX series.

This CL includes:
1. Add pin controller device tree declarations and introduce alt-cells
   to select pads' functionality.
2. Add npcx7-alts-map.dtsi since the mapping between IO and controller
   is irregular and vary in each chip series.
3. Add nuvoton,npcx-pinctrl-def.yaml and its declarations to change all
   pads' functionality to GPIO by default.
4. Pinmux controller driver implementation.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-08-13 16:42:20 +02:00
Mulin Chao
0245a27bc5 driver: clock: Add clock controller support in NPCX series.
Add clock controller support for Nuvoton NPCX series. This CL includes:

1. Add clock controller device tree declarations.
2. Introduce clock-cells in yaml file clock tree to get module's source
clock and turn off/on the its clock
3. Clock controller driver implementation.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-08-13 16:42:20 +02:00
Kumar Gala
989ee98771 drivers: uart_mcux: Implement uart_config_get API
When uart_configure support was added uart_config_get was not
implemented.  Move the 'struct uart_config' to uart_mcux_data lets us
save the uart_config settings and easily return it in
uart_mcux_config_get.

Fixes: #27420

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-08-13 11:50:14 +02:00
Emil Obalski
80a89ef799 console: usb: Remove obsolete Kconfig option.
This patch removes unused Kconfig option from console
subsystem. If application wants to wait until the console
port is connected, enabled and ready to receive data
it should use uart_line_ctrl_get() API function and
check for DTR flag.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-08-13 11:49:47 +02:00
Emil Obalski
b552e60765 samples: usb: Make USB console samples call usb_enable()
usb_enable() must be called once by the application.
The application may want to register usb_dc_status_callback
and trace usb status codes (usb_dc_status_code).

After this patch all pre APPLICATION messages will be dropped
as USB console device is enabled in the application.

Application waits for console device until its ready by checking DTR
flag - uart_line_ctrl_get(). This function could be dropped but then
some log messages that were generated before USB device is ready
could also be dropped.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-08-13 11:49:47 +02:00
Peter Bigot
cabbd916cf drivers: move eeprom_slave driver to tests directory
This device isn't an actual hardware driver: it's a virtual EEPROM
that stores data in an instance-specific RAM buffer, with the data
exposed on an I2C bus as a I2C follower (slave) device that can be
controlled by another device acting as a leader (master) on that same
bus.

As such it's a reasonable example of how to write an I2C follower
driver, but it's not clear that it has a real use in applications.  A
Zephyr application that needs to emulate an EEPROM in a real-world
system would be unlikely to provide its data from a RAM buffer.

The sole in-tree reference is in the i2c_slave_api test, so move the
driver implementation into that test.

The Kconfig and hierarchy are being left in place until it is more
clear how this functionality should be selectable within Zephyr.  The
I2C_SLAVE symbol has been converted from menuconfig to config to
eliminate a Kconfig style diagnostic.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-13 11:49:12 +02:00
Erwin Rol
f2156b9d4a drivers: i2c_ll_stm32_v1: Reset i2c device on timeout
When, due to EMC, a spike happens on the SDA line the hardware hangs
and will not function anymore until the unit is reset.

By adding a timeout to the msg_read and msg_write function we can
detect that something went wrong, and when that happens reset
the I2C bus.

The reset will also reset all configuration, so before reseting
store all important registers and after reseting restore
those settings.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-08-12 14:53:37 -05:00
Erwin Rol
d49b3e1b68 drivers: i2c_ll_stm32_v1: clear stop bit befor setting start bit
Sometimes the stop bit is still set when starting the next transaction.
When that happens the hardware will generate a start directly followed
by a stop. This will not be detected by the driver and it will endlessly
wait for the next interrupt that will never come.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-08-12 14:53:37 -05:00
Jukka Rissanen
adf7291211 drivers: serial: native_posix: Add example using gnome-terminal
Add example how to use gnome-terminal when launching a new
terminal for attaching the UART.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-12 17:12:31 +02:00
Gerard Marull-Paretas
ca9dce0d7d drivers: kscan: generalize and improve FT5336 driver
The FT5336 driver has been improved and generalized so that multiple
Focaltech touch controllers can be supported using the same single
driver. According to specifications the following list of controller
variants should be supported: FT5x06, FT5606, FT5x16, FT6x06, Ft6x36,
FT5x06i, FT5336, FT3316, FT5436i, FT5336i and FT5x46.

Tested using ER-TFTM028-4 display module (FT6X06).

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-08-12 12:35:04 +02:00
Tomasz Bursztyka
98d9b01322 device: Apply driver_api/data attributes rename everywhere
Via coccinelle:

@r_device_driver_api_and_data_1@
struct device *D;
@@
(
D->
-	driver_api
+	api
|
D->
-	driver_data
+	data
)

@r_device_driver_api_and_data_2@
expression E;
@@
(
net_if_get_device(E)->
-	driver_api
+	api
|
net_if_get_device(E)->
-	driver_data
+	data
)

And grep/sed rules for macros:

git grep -rlz 'dev)->driver_data' |
	xargs -0 sed -i 's/dev)->driver_data/dev)->data/g'

git grep -rlz 'dev->driver_data' |
	xargs -0 sed -i 's/dev->driver_data/dev->data/g'

git grep -rlz 'device->driver_data' |
	xargs -0 sed -i 's/device->driver_data/device->data/g'

Fixes #27397

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-08-11 19:30:53 +02:00
Tomasz Bursztyka
af6140cc0d device: Apply config_info rename everywhere
Via coccinelle:

@r_device_config@
struct device *D;
@@

D->
-	config_info
+	config

And 2 grep/sed rules for macros:

git grep -rlz 'dev)->config_info' |
	xargs -0 sed -i 's/dev)->config_info/dev)->config/g'

git grep -rlz 'dev->config_info' |
	xargs -0 sed -i 's/dev->config_info/dev->config/g'

Fixes #27397

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-08-11 19:30:53 +02:00
Francois Ramu
b9c7c35db0 drivers: counter: rtc valid for stm32l1 soc series
The rtc counter is also built for the stm32l1 series
from STMicroelectronics.
The EXTI line 17 is mapped on RTC alarm pin

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-08-10 12:17:09 +02:00
Krzysztof Chruscinski
3867a165e5 drivers: serial: nrf_uarte: Remove counters reset from rx_enable
uart_rx_enable might be called after reception is stopped by lack
of buffers with flow control enabled. In that case there is a couple
of bytes kept in the HW FIFO. When HW TIMER is used for byte counting,
it is using RXDRDY event to count bytes. RXDRDY event is generated when
byte is received in RXD. RXD is the head of HW FIFO. When DMA ends and
ENDRX event is generated, transmitter still transmits until RTS line
goes high and transmitter reacts to it and stops transmitting. First
byte received after ENDRX lands in RXD (and generates RXDRDY event),
next by goes to RXD+1 (does not generate RXRDY event).

RXDRDY event after ENDRX is counted by the TIMER. If TIMER is reset
before restarting RX this byte is lost in the calculation. Because of
that byte counters cannot be reset before enabling RX thus move to
initialization. It applies only to HW counting but to keep it consistent
resetting was removed for both modes.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-10 10:59:37 +02:00
Kamil Kasperczyk
e4d20caee9 drivers: nrf: Added config option for OUI.
Support for defining vendor specific OUI (Organizationally
Unique Identifier) was added.

Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
2020-08-10 08:42:21 +03:00
Kamil Kasperczyk
be372872ea net: openthread: radio: Added sleep to tx as hw radio cap.
OT_RADIO_CAPS_SLEEP_TO_TX was added as a radio capability
for ieee802154 radio. Waiting on RX state before transmission
is alternative condition to OT_RADIO_CAPS_SLEEP_TO_TX support
as it was a result of OpenThread architecture and is actually
not needed in the Zephyr. Such change lets to start transmission
faster and lower SED device power consumption in active state
about 30%.

Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
2020-08-09 09:32:37 -04:00
Loic Poulain
ac45ad8830 drivers: wifi: eswifi: Fix unused variable in scan parsing
ret variable is not used.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-08-07 06:58:18 -05:00
Loic Poulain
5283a2be98 drivers: wifi: eswifi: fix dead code in ipv4 parsing
unsigned byte value is initialized to -1 and so never satisifies
the while condition, leading to broken ipv4 parsing (dead code).
Fix this by making byte value signed.

Reported by coverity #27326.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-08-07 06:58:18 -05:00
Gerson Fernando Budke
2610a376c0 drivers: eeprom: Fix at2x cs gpio flags macro typo
There is a typo on the macro that gets cs gpio flags. This fix the
issue.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-08-06 11:54:06 +02:00
Sven Herrmann
001ff9ffab Sensor: mpr: Fix indentation in comment
Fix indentation in ascii-style formula for register to value conversion.

Signed-off-by: Sven Herrmann <sven.herrmann@posteo.de>
2020-08-06 11:50:04 +02:00
Sven Herrmann
7e8759b9fa Sensor: mpr: Fix integer handling issue
Fixes #27044

Signed-off-by: Sven Herrmann <sven.herrmann@posteo.de>
2020-08-06 11:50:04 +02:00
Steven Lemaire
1b94666c21 drivers: serial: gecko: Avoid getting masked interrupts
The USART_IntGet() function seems to return masked interrupts in the
function uart_gecko_irq_tx_ready() where it should return only
non-masked interrupts. Using USART_IntGetEnabled() fixes this issue.

This issue was discovered when using the mcumgr UART backend in the
uart_mcumgr_isr() function.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2020-08-06 11:49:16 +02:00
Steven Lemaire
3d5f4187af drivers: counter: gecko rtcc: Add support for Gecko Series 2 SoC
The EFR32MG21 uses a different clock configuration than former SoCs.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2020-08-06 11:49:16 +02:00
Steven Lemaire
f93f41286e drivers: i2c: gecko: Add support for Gecko Series 2 SoC.
The EFR32MG21 uses a different kind of GPIO routing for peripherals.
It is based on the GPIO registers and no longer peripherals' registers.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2020-08-06 11:49:16 +02:00
Steven Lemaire
fc64f2c522 drivers: watchdog: gecko: Add support for Gecko Series 2 SoC
The EFR32MG21 uses a different kind of clock for watchdogs.
It requires an additional peripheral-id parameter in the dts to get the
proper clock as it is based on the watchdog's ID i.e., cmuClock_WDOG#.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2020-08-06 11:49:16 +02:00
Steven Lemaire
36dc92601b drivers: uart: gecko: Add support for Gecko Series 2 SoC.
The EFR32MG21 uses a different kind of GPIO routing for peripherals.
It is based on the GPIO registers and no longer peripherals' registers.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2020-08-06 11:49:16 +02:00
Steven Lemaire
deba608921 driver: gpio: gecko: Add support for Gecko Series 2 SoC
Use the GPIO API from emlib instead of accessing the register directly:
The emlib API is doing the checks and uses the proper registers
depending on the SoC used.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2020-08-06 11:49:16 +02:00
Steven Lemaire
da076456b1 drivers: flash: gecko: Add support for Gecko Series 2 SoC
The EFR32MG21 SoC uses MSC_LOCK_LOCKKEY_UNLOCK instead of
MSC_UNLOCK_CODE.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2020-08-06 11:49:16 +02:00
Greg Leach
41da0769c1 sensor: Add Silabs SI7055 support
Add support for the Silabs SI7055 temperature sensor

Signed-off-by: Greg Leach <greg.leach@lairdconnect.com>
2020-08-05 14:50:52 -05:00
Jeremy LOCHE
0fe6707199 drivers: clock_control: stm32h7 add HSI divisor support
Add HSI divisor support for clock tree configuration.
Removed HSI calibration trimming to comply with
common STM32 implementation and use reset default
configuration instead.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-08-05 16:22:53 +02:00
Jeremy LOCHE
ea6580cdcd drivers: clock_control: stm32h7 change set flash latency
Updated flash latency setting to comply with
common stm32 implementation and datasheet.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-08-05 16:22:53 +02:00
Jeremy LOCHE
f3bdf8ae91 drivers: clock_control: stm32h7 add preprocessor clock check
Adds preprocessor clock feasibility check to avoid setting
too high clocks to SYSCLK,AHB,APBx buses.

Also checks if CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
matches with the desired clock configuration by
the M7 core.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-08-05 16:22:53 +02:00
Jeremy LOCHE
63611264c4 drivers: clock_control: stm32h7 fixed inverted assertion
Fixed wrong usage of assertions.
Assertions should check that the value is in range and
not out of range.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-08-05 16:22:53 +02:00
Jeremy LOCHE
a686576348 drivers: clock_control: stm32h7 fix high frequency setting
Fixes #27212 by setting the AHB/APBx dividers
prior to configuring the PLL as clock source.

Prevents going over the limits of APBx clocks when
choosing the PLL as system clock source for
high frequencies (close to 480MHz)

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-08-05 16:22:53 +02:00
Vinayak Kariappa Chettimada
139eafacca drivers: flash: nrf: Fix regression with BT_CTLR_LOW_LAT option
Fix a regression that caused flashing on nRF51x Series to stall
the Bluetooth low energy controller and flashing under
BT_CTLR_LOW_LAT option.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-05 12:02:05 +02:00
2b6783aa15 drivers: dac: add a driver for the SAM0 DAC
The Atmel SAM0 DAC is a single channel 10 bit DAC with selectable
reference.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-08-04 16:08:48 -05:00
Lukasz Majewski
8f2a0fb37d eth: mcux: Add support to NXP's ENET for fixed link setup
This commit adds support for setting fixed configuration, read
from device tree, for ENET ETH interface and PHY.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2020-08-04 15:54:26 -05:00
Lukasz Majewski
1a5c47cf30 eth: mcux: Support devices not using SMI for PHY setup
Some ICs - like DSA switches (e.g. ksz8794) - do not use SMI to setup
and configure PHY.

This change introduces a new Kconfig define - CONFIG_ETH_MCUX_NO_PHY_SMI
- to allow replacing SMI communication with SPI or I2C.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2020-08-04 15:54:26 -05:00
Jiří Keresteš
3a87517c5e drivers: watchdog: mcux_wwdt: add driver for NXP LPC 55xxx WWDT
Adds shim driver for LPC 55xxx Windowed Watchdog Timer (WWDT).

Also updates the "Supported features" table in LPCXpresso55S69
board documentation page.

Fixes #22704.

Signed-off-by: Jiří Keresteš <jiri@kerestes.cz>
2020-08-04 15:13:25 -05:00
Andrew Boie
7d920ba39b drivers: use K_KERNEL_STACK macros
None of these threads run in user mode and we can save some
memory.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-04 12:16:43 -04:00
Simon Glass
6b50f643da drivers: i2c: Add a dump routine
Add a function to dump out a set of I2C messages. It uses debug logging
so it only useful for debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-04 17:50:39 +02:00
Jui-Chou Chung
ed642dcd24 drivers: spi: nrfx: Update get_nrf_spim_frequency for nRF5340 HS-SPI
Using SPIM_FREQUENCY_FREQUENCY_M32 to check if the device has HS-SPI and
able to use higher SPI clock than 8MHz.

Signed-off-by: Jui-Chou Chung <jui-chou.chung@nordicsemi.no>
2020-08-04 17:24:41 +02:00
Jeremy LOCHE
74fa8cef21 drivers: bluetooth: hci_spi: add missing gpio_dt_flags to spi_cs_config
Fixes #27280 by adding the new gpio_dt_flags to the
HCI spi cs config.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-08-04 16:18:54 +02:00
Martí Bolívar
5be0d00d41 treewide: remove unnecessary DT GPIO/PWM flags checks
Now that the relevant APIs generalize properly for bindings without
flags, we can remove some special case checks from the tree.

I couldn't find any more, but I did this kind of quickly, so it's
possible I missed some.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-04 07:35:26 -05:00
Rihards Skuja
4a16095e8a drivers: sensor: nrf5: only assert on errors
After changes made in ff089217cb, clock control release can now return
non-negative values on success.

Signed-off-by: Rihards Skuja <rihardssk@mikrotik.com>
2020-08-03 13:50:08 +02:00
Krzysztof Chruscinski
e4d14e8516 drivers: serial: nrf_uart: Improve detection of late uart_rx_buf_rsp
Removed potential race condition between uart being disabled and
rx_buf_rsp call.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-03 13:49:57 +02:00
Krzysztof Chruscinski
b5c6e2f263 drivers: serial: nrf_uarte: Detect late uart_rx_buf_rsp call
Added detection of uart_rx_buf_rsp call which happend to late when
uart is already disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-03 13:49:57 +02:00
Marcin Niestroj
4137d3380f net: ppp: select RING_BUFFER via Kconfig
PPP implementation uses ring_buffer API, but RING_BUFFER Kconfig option
was not selected so far. This resulted in linker errors about undefined
reference to `ring_buf_get_claim' and 'ring_buf_put'.

Add missing RING_BUFFER selection via Kconfig, so PPP driver is properly
built.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-08-01 08:13:50 -04:00
Carles Cufi
244f826e3c cmake: remove _if_kconfig() functions
This set of functions seem to be there just because of historical
reasons, stemming from Kbuild. They are non-obvious and prone to errors,
so remove them in favor of the `_ifdef()` ones with an explicit
`CONFIG_` condition.

Script used:

git grep -l _if_kconfig | xargs sed -E -i
"s/_if_kconfig\(\s*(\w*)/_ifdef(CONFIG_\U\1\E \1/g"

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-08-01 12:35:20 +02:00
Jordan Yates
8896da1d60 drivers: serial: uart_nrfx_uarte: init cleanup rx
When `CONFIG_UART_ASYNC_API` is enabled, cleanup any pending synchronous
receptions at initialization time. Pending receptions are present when
this driver is used with the default mcuboot application.

When `CONFIG_UART_ASYNC_API` is not enabled, RX is always enabled by
this driver. As mcuboot does not use the async API, and does not cleanup
the UART driver before jumping to the next application, that application
boots with RX still enabled. This results in a 500uA increase in current
consumption.

Fixes #26555

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-31 18:47:55 +02:00
Carles Cufi
c200b1c5e6 mgmt: Move mcumgr into its own folder
In order to be able to add more entries under 'subsys/mgmt', move the
current contents of it, which relate exclusively to MCUMgr, to its own
folder.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-07-31 08:46:53 -05:00
Loic Poulain
40e2d94bc8 drivers: wifi: eswifi: Fix parsing buffer-overflows
There are possible buffer overflows when parsing the ip address and
SSID. Ensure that we never overwrite the ip and SSID buffers.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-07-30 16:35:58 +03:00
Loic Poulain
e7c4d29c86 drivers: wifi: eswifi: Add debug shell
Add a esWiFi shell for device specific controls.
For now used to send at commands.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-07-30 16:35:58 +03:00
Loic Poulain
f851462f27 drivers: wifi: eswifi: Use log_strdup for strings
Use log_strdup() helper for logger string parameters.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-07-30 16:35:58 +03:00
Loic Poulain
0a1de7e96a drivers: wifi: eswifi: Stop client before starting
Stop any TCP/UDP client session before starting a new one.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-07-30 16:35:58 +03:00
Tomasz Bursztyka
3bc6c555a5 drivers: serial: Fix UART callback call in lpc11u6x driver
struct device * as well as void * are necessary now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 07:52:28 -05:00
Anas Nashif
b72a2fd8b6 drivers: arcv2_irq_unit: remove include
This include is not needed, code fails to build when configuration is
changed..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-07-30 08:00:03 -04:00
Tomasz Bursztyka
caf78ca11b drivers: ipm: Align all drivers using user_data for the callback
s/context/user_data

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:51:51 +02:00
Tomasz Bursztyka
c6706561b9 drivers: Apply IPM callback signature change where relevant
Of course IPM drivers now provide their device instance. There are 2
drivers using IPM callbacks as well, so they get the imp device instance
pointer now through the callback.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:51:51 +02:00
Tomasz Bursztyka
1580768fd3 drivers: dma: Align all drivers using user_data for callback
s/callback_arg/user_data

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:48:00 +02:00
Tomasz Bursztyka
3a3f10c06e drivers: dma: Align all drivers using dma_callback_t type
No need to re-declare such signature anymore.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:48:00 +02:00
Tomasz Bursztyka
6acee3dcba drivers: dma: Apply DMA callback change to relevant drivers
Now the dma device instance is passed as parameter to the callback.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:48:00 +02:00
Tomasz Bursztyka
7d1af02410 uart: Fix uart_irq_callback_set usage
It was already using uart_irq_callback_user_data_set below, now it also
uses uart_irq_callback_user_data_t as callback type, so let's normalize
the callbacks.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:43:12 +02:00
Tomasz Bursztyka
701869fc48 uart: Fix uart_irq_callback_user_data_set usage
Now providing the struct device * to the callback.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:43:12 +02:00
Tomasz Bursztyka
04d6d0b120 drivers: serial: Fix uart_irq_callback_user_data_t usage
Now providing the device pointer that calls the callback.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:43:12 +02:00
Tomasz Bursztyka
915608b80a drivers: serial: Fix uart_callback_t usage in relevant drivers
Now providing the device pointer that calls the callback.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-07-30 09:43:12 +02:00
Maxime Bittan
9ca6b704a7 drivers: i2c: Add support for LPC11U6X I2C controllers
This commit adds a driver for the LPC11U6X I2C controllers

Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
2020-07-29 20:12:24 +02:00
Simon Guinot
319d9d94a8 drivers: eeprom: add driver for NXP LPC11U6X
This patch adds adds an EEPROM driver supporting the on-chip EEPROM
found on NXP LPC11U6X MCUs. Note that this driver is only a wrapper
relying entirely on the IAP (In-Application Programming) EEPROM
commands.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-07-29 20:12:24 +02:00
Maxime Bittan
4edf475d1c drivers: serial: Add support for LPC11U6X UART controllers
This commit adds support for UART0-4 controllers present on
LPC11U6X MCUs.

Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
2020-07-29 20:12:24 +02:00
Simon Guinot
d3dd297619 drivers: gpio: add driver for NXP LPC11U6X MCUs
This patch adds a GPIO driver allowing to configure the GPIOs found on
the LPC11U6x MCUs.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-07-29 20:12:24 +02:00
Maxime Bittan
ed4511ea8c drivers: clock_control: lpc11u6x: Add support for clock controller
This commit adds basic support for the clock controller used in
lpc11u6x MCUs.

Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-07-29 20:12:24 +02:00
Simon Guinot
fb92dd1bc7 drivers: pinmux: add driver for NXP LPC11U6X MCUs
This patch adds a pinmux driver allowing to configure the IOCON (I/O
control) registers found on the LPC11U6x MCUs.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-07-29 20:12:24 +02:00
Simon Guinot
5f9b104db3 drivers: pinmux: sort entries in CMakeLists.txt and Kconfig
Sort source entries in CMakeLists.txt and Kconfig by alphabetic order.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-07-29 20:12:24 +02:00
Andrei Gansari
dc2efff38d drivers: spi_mcux_flexcomm: CS remains low until frame ends
Flexcomm's SPI SSEL (or CS) will be held until frame end.
FIFOWR[EOT] (kSPI_FrameAssert enum) is the register not set.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-07-29 08:00:23 -05:00
Andrei Gansari
b65c0ad8d7 drivers: eth_enc28j60: reverts part of 3722c64
Reverts part of 3722c643c9 commit.
Reverts dummy buffer and uses NULL pointers.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-07-29 08:00:23 -05:00
Pete Skeggs
d56e0b0b40 drivers: serial: nrfx: disable before setting pin config
Per the nrf9160 datasheet, UARTE must be disabled prior to configuring
PSEL.TXD, PSEL.RXD, PSEL.CTS, and/or PSEL.RTS.  This also ensures that
any prior running code, such as a bootloader, which leaves the UART
enabled will not prevent the Zephyr application from changing the
configuration.

Make a similar change also to the uart_nrf_uart.c driver for the
nRF5 series.

Fixes 27080

Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
2020-07-29 08:07:47 -04:00
Mahesh Mahadevan
5e2e7a0fcf drivers: gpio: Init the PINT module
Need to call PINT_Init to initialize the block
before using it. This fixes the issue seen on
RT600 with the button example

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-07-28 18:24:19 -05:00
Mahesh Mahadevan
23f97f52f7 pinmux: mxrt6xx: Update to support IOPCTL
Add changes for differences between IOPCTL and IOCON modules

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-07-28 18:24:19 -05:00
Mahesh Mahadevan
64d5afeb60 drivers: gpio: mcux_lpc: Update for RT600
- Use common clock names to avoid build error.
- Use GPIO_PortInit() to do reset/clock initialization. Only clock
  enable is not adequate for RT600.
- Update to support differences between IOCON and IOPCTL modules

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-07-28 18:24:19 -05:00
David Leach
f4caf7b890 drivers: wifi: eswifi: fix coverity Out-of-bounds access errors
There are multiple CID errors all based on the test of
'socket > ESWIFI_OFFLOAD_MAX_SOCKETS'. The test needs to
be '>=' in all cases.

Fixes: #27138
Fixes: #27139
Fixes: #27140
Fixes: #27141
Fixes: #27142
Fixes: #27143

Signed-off-by: David Leach <david.leach@nxp.com>
2020-07-28 07:03:55 -04:00
Jakub Rzeszutko
6011aee0d8 drivers: i2c: update i2c_shell commands
By fixing the issue: #21819 in the shell, it is no longer needed
to keep a workaround, which allows prompting i2c bus name.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
2020-07-27 08:50:52 -04:00
Vincent Wan
5014e7da44 drivers: wifi: resolve undefined macros when CONFIG_POSIX_API is set
When CONFIG_POSIX_API is set in lieu of CONFIG_NET_SOCKETS_POSIX_NAMES,
some macros such as POLLIN, POLLOUT and MSG_PEEK are undefined, and
the appropriate posix headers need to be included to access those.

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-07-27 13:28:06 +02:00
Filip Zajdel
33eabf6fc7 drivers: counter: Add native_posix counter hardware model and driver
Adds native_posix hw counter model and the counter driver.
Functionality is needed by software which is tested
on native_posix and has dependency on counter.
Hardware model was developed similarly to HW timer model.
The counter driver wraps HW counter functions and exposes
basic functionalities: starting, stopping, setting and cancelling
single channel alarms.
Code was tested against: tests/drivers/counter/counter_basic_api.

Signed-off-by: Filip Zajdel <filip.zajdel@nordicsemi.no>
2020-07-27 13:25:50 +02:00
Jeremy LOCHE
33abbbfd85 drivers: clock_control: stm32h7: Add HSE,HSI,CSI,PLL sysclk opt.
Add HSE,HSI,CSI,PLL as system clock options.
Also add correct configuration of the PLL.

New sysclk options:
- HSI with: CONFIG_CLOCK_STM32_SYSCLK_SRC_HSI=y
- HSE with: CONFIG_CLOCK_STM32_SYSCLK_SRC_HSE=y
- CSI with: CONFIG_CLOCK_STM32_SYSCLK_SRC_CSI=y
Existing sysclk options:
- PLL with: CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y

PLL clock options:
- More PLL source clocks:
Existing:
	1. HSE with: CONFIG_CLOCK_STM32_PLL_SRC_HSE=y
New:
	2. HSI with: CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
	3. CSI with: CONFIG_CLOCK_STM32_PLL_SRC_CSI=y
- PLL vco input range is auto-calculated based on PLL DIVM1

-> Example for sysclock 96MHz generated with PLL from HSI
CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=96000000
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
CONFIG_CLOCK_STM32_PLL_M_DIVISOR=4
CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=12
CONFIG_CLOCK_STM32_PLL_P_DIVISOR=2
CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=4
CONFIG_CLOCK_STM32_PLL_R_DIVISOR=2

Use LL_SetFlashLatency function from stm32h7xx_ll_utils.h
instead to setup the correct latency.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-07-27 13:24:27 +02:00
Jose Alberto Meza
f45f4fc0c9 drivers: espi: xec: Fix incorrect ACK to eSPI host about channel readiness
eSPI slave driver should only indicate that a channel is ready
after the eSPI master has enabled said channel.
However, this indication is incorrectly sent during eSPI reset
even before channel renegotiation starts.

Perform only channel-specific interrupts enabling inside
initialization functions.
Send Channel ready ack only after channel negotiation is received.
Add missing callbacks for channel events to notify client driver.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-07-26 09:02:35 -04:00
Jose Alberto Meza
f4cbec8924 drivers: espi: xec: Fix OOB transaction failure when perform back-to-back
Enable OOB Rx interrupt only when required.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-07-26 09:02:35 -04:00
Francois Ramu
c098aabcaa drivers: counter: rtc for stm32f0 doc series
This patch set the EXTI line 17 as the RTC
on the stm32f0x from STMicroelectronics.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-07-24 16:16:21 +02:00
Erwan Gouriou
c062cd260a drivers/ethernet: stm32: Enable Kconfig symbol ETH_STM32_HAL using dts
It should not be needed to configure ETH_STM32_HAL from boards.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-07-24 12:03:33 +02:00
Erwan Gouriou
04c1fcfde6 drivers/ethernet: stm32: Get static boot configuration from dts
Update stm32 ethernet driver to get basic boot configuration from
device tree.
So far information are:
- Label
- Base address
- IRQ number and prio
- Clock settings

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-07-24 12:03:33 +02:00
Tobias Svehagen
7ea0c19c55 drivers: wifi: esp: Retry command for getting IP settings
If AT_CIPSTA? command fails it is retried again after 5 seconds.

Fixes #25741

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-07-24 12:01:30 +02:00
Raveendra Padasalagi
f4a141639d drivers: dma: Add pl330 dma driver
Add PL330 dma driver support, this driver
- supports 32 bit memory to memory operation
- supports 36 bit memory to memory operation
  under a config flag DMA_64BIT
- supports secure channel

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2020-07-24 11:54:31 +02:00
Raveendra Padasalagi
306980816a dma: Support 64bit source/dest address
Add 64bit source_address/dest_address fields support.
This is needed in situation where DMA controller is capable
of handling more than 32bit source and destination addresses.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
2020-07-24 11:54:31 +02:00
Parthiban Nallathambi
d8e63e7161 drivers: wifi: eswifi: enable NET_SOCKETS_OFFLOAD by default
Enable NET_SOCKETS_OFFLOAD is default option for eswifi.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-24 11:13:31 +03:00
Parthiban Nallathambi
13808b7d83 drivers: wifi: eswifi: fix compilation warnings
Fix compilation warnings when CONFIG_NET_SOCKETS_OFFLOAD enabled

warning: passing argument 5 of '__eswifi_socket_new' makes pointer
 from integer without a cast [-Wint-conversion]
  395 |  idx = __eswifi_socket_new(eswifi, family, type, proto, 0x50CE);
      |                                                         ^~~~~~
      |                                                         |
      |                                                         int
eswifi.h:137:21: note: expected 'void *' but argument is of type 'int'
  137 |    int proto, void *context);
      |               ~~~~~~^~~~~~~
In function 'eswifi_socket_bind':
warning: comparison between pointer and integer
  461 |  if ((addrlen == NULL) || (addr == NULL) ||
      |

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-24 11:13:31 +03:00
Parthiban Nallathambi
0725719ada drivers: wifi: eswifi: Convert raw timeout values to use K_MSEC()
Use K_MSEC instead of raw timeout value.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-24 11:13:31 +03:00
Parthiban Nallathambi
1cb20aee34 driver: wifi: eswifi: use common log module
use common log module across all eswifi sources, which allows
to compile with CONFIG_NET_SOCKETS_OFFLOAD.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-24 11:13:31 +03:00
Simon Glass
5afdceee8c sensor: shell: Add a 'battery' command
It is useful to show sensor channels for a battery in cohesive block as
it is easier to read. Add a 'battery' command to handle this. It only
supports a single battery, relying on the device-tree alias to select
it.

uart:~$ battery
Temp:  23.55 C
V:     4.31 V
V-desired: 4.40 V
I:    574 mA (CHG)
I-desired:  2000 mA
Charging: Not Allowed
Charge: 100 %
V-design: 3.86 V
Remaining: 6764 mA
Cap-full: 6764 mA
Design: 6910 mA
Time full: 0h:00
Time empty: 0h:00

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-23 12:12:09 -04:00
Simon Glass
ee34aced6a sensor: max17055: Add MAX17055 driver
Add support for the Maxim MAX17055 fueld-gauge sensor.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-23 12:12:09 -04:00
Simon Glass
9b8c04401d sensor: shell: Show the error code when reading fails
The error code may give a clue as to what is wrong. Add it to the error
message.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-23 12:12:09 -04:00
Simon Glass
122d8fa6a9 sensor: shell: Allow output for fuel-gauge channels
Add names for more channels so that they can be shown, e.g.:

$ sensor get MAX17055
channel idx=38 gauge_voltage =   4.313906
channel idx=39 gauge_avg_current = 558.000000
channel idx=42 gauge_temp =  23.558558
channel idx=43 gauge_state_of_charge = 100.000003
channel idx=44 gauge_full_cap = 6766.000000
channel idx=45 gauge_remaining_cap = 6766.000000
channel idx=46 gauge_nominal_cap = 6910.000000
channel idx=50 gauge_time_to_empty =   0.000000
channel idx=51 gauge_time_to_full =   0.000000
channel idx=52 gauge_cycle_count =   0.100000
channel idx=53 gauge_design_voltage =   3.860000
channel idx=55 gauge_desired_charging_current = 2000.000000

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-23 12:12:09 -04:00
Peter Bigot
a1babb7f1f drivers: eeprom_slave: add const qualifier to read-only data
The EEPROM device doesn't mutate the source data it's given, so update
the API signature to reflect this fact.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-22 21:41:12 +02:00
Tobias Svehagen
71e7cd3f99 drivers: wifi: esp: Fix issue with incorrect tx timeout
It can happen that the command '>' is received between
modem_cmd_send_nolock and modem_cmd_handler_update_cmds. Since the
command handler for '>' is not set, sem_tx_ready will not be given
and _sock_send will timeout. Make sure the command handlers are set
before the send by also passing them to modem_cmd_send_nolock.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-07-22 15:06:41 +03:00
Henrik Brix Andersen
381a1cfcd2 drivers: dma: mcux_dma: add support for the NXP KE1xF
Add support for the NXP KE1xF SoC to the eDMA driver. The KE1xF supports
m2m DMA transfers from sources 60 to 63.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-07-21 08:56:51 -05:00
Henrik Brix Andersen
c89ef2f393 drivers: dma: mcux_emda: only enable nocache memory if supported
Only enable CONFIG_NOCACHE_MEMORY if supported by the SoC.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-07-21 08:56:51 -05:00
Alexander Kozhinov
92727e9846 drivers: ethernet: stm32: add stm32h7 support
add DTCM caching management in KConfig for stm32h7
add NOCACHE_MEMORY support for stm32h7 M7 CPU series
add HAL_RCC_EX support for stm32h7 series
implemented stm32h7 support within stm32 eth driver

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-07-21 15:12:18 +02:00
Alexander Kozhinov
ec25fa8592 drivers: ethernet: stm32: pre-add stm32h7 support
added changes that apply to other than stm32h7 series
and prepares stm32h7 series integration:

eth_tx/eth_rx: changed type of total_len
added necessary defines for
    tx_desc and own flag extractions
added read_eth_phy_register() function
    and corresponding defines
added ETH_DMA_MEM and CACHE defines
following memory buffers declarations moved out of
    its ifdef preprocessor macro:
        dma_rx_desc_tab, dma_tx_desc_tab,
        dma_rx_buffer, dma_tx_buffer
added hal_ret stm32 HAL status checks

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-07-21 15:12:18 +02:00
Alexander Kozhinov
3ad1f91a80 drivers: pinumx: stm32: pinmux_stm32h7: added ethernet pins
added ethernet pins definition for stm32h7 SoC series

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-07-21 15:12:18 +02:00
Jan Van Winkel
adecdd5d43 driver: display: Added extra asserts to SDL display
Added extra asserts to write function of SDL display driver to check if
write is within bounds.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2020-07-21 15:12:05 +02:00
Jan Van Winkel
814f94e053 driver: display: Added asserts to write of dummy driver
Added asserts to write function of dummy display driver to check if
write is within bounds

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2020-07-21 15:12:05 +02:00
Vincent Wan
53f408afe8 drivers: wifi: simplelink: enable IPv6 support
IPv6 support was not fully implemented in the driver and was disabled.
This commit completes the implementation and enables it when
configured.

Signed-off-by: Vincent Wan <vwan@ti.com>
2020-07-21 15:08:56 +02:00
Eugeniy Paltsev
dd49fb4da4 Serial: NSIM: remove legacy ARC-NSIM UART driver
After switching nSIM to 16550 UART model & driver there is no users
for ARC-NSIM UART. So remove it entirely.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-07-20 13:34:34 -04:00
Krzysztof Chruscinski
e82419074c drivers: led_strip: ws2812_gpio: Adapt to clock using onoff
Adapted to use onoff service for clock control

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-20 16:22:21 +02:00
Krzysztof Chruscinski
9e546fdf7e drivers: usb: device: nrf: Adapt to control clock using onoff
Change to use onoff service when controlling HFXO.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-20 16:22:21 +02:00
Krzysztof Chruscinski
554ff9d6d2 drivers: counter: nrfx_rtc: Adapt to clock control changes
Adapted nrfx_rtc counter to request clock through onoff API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-20 16:22:21 +02:00
Krzysztof Chruscinski
2881df3d0c drivers: timer: nrf: Adapt to clock_control changes
Adapted driver to clock_control changes (usage of onoff manager).
Since timer is permanenty requesting the clock, it is using API
dedicated for that: z_nrf_clock_control_lf_on().

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-20 16:22:21 +02:00
Krzysztof Chruscinski
ff089217cb drivers: sensor: nrf5: Adapt temp driver to use onoff for clock
Adapted driver to use onoff service for clock control.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-20 16:22:21 +02:00
Krzysztof Chruscinski
04e770b20c drivers: clock_control: nrf: Add clock status shell command
Added shell command to clock driver to get clock status.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-20 16:22:21 +02:00
Krzysztof Chruscinski
6f01c0bc79 drivers: clock_control: nrf: Add onoff service support
Updated nrf clock control driver to use onoff service for managing
multiple users.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-20 16:22:21 +02:00
Alexandre Bourdiol
d7fb61f224 drivers: flash: stm32wb: disable Page Erase at end of erase_page()
FLASH_TYPEERASE_PAGES is null and doesn't represent a bit in the
register, thus this instruction has no effect.
It must be replaced by FLASH_CR_PER which is the bit that should
be cleared.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-07-20 12:48:10 +02:00
Mateusz Syc
c3cc0c8787 drivers: flash: nrf_qspi_nor: supports non-aligned read
Added function read_non_aligned that reads data under
non-aligned flash addres to non-aligned read buffer of any size.

Signed-off-by: Mateusz Syc <Mateusz.Syc@nordicsemi.no>
2020-07-20 12:46:38 +02:00
Saravanan Sekar
9ac3c9d42a drivers: sensors: itds: Add support for WSEN-ITDS 3-axis accel sensor
Add support for wsen-itds 3-axis accel sensor, provides acceleration,
temperature data reading and supports configuring of output data rate,
operating mode and scale.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
2020-07-20 12:45:56 +02:00
Andrew Boie
d728bece0a drivers: ns16550: use DEVICE_MMIO where needed
This gets a little complicated as the driver could be
using PCI-E MMIO, MMIO specified by DTS, or I/O ports.
This driver doesn't use struct uart_device_config any
more.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Andrew Boie
9f84637499 gpio_intel_apl: use DEVICE_MMIO
Good example of the NAMED variants of the MMIO macros, since
an existing inheritance mechanism already took the first-member
slot of the dev_data/config structs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Andrew Boie
9e627ed6d2 drivers: i2c_dw: use device_mmio
Fairly straightforward example of how to deal with PCIe.
The code considers whether a particular instance is PCIe
or not on a per-instance basis, so DEVICE_MMIO_ROM is not
conditionally defined.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Andrew Boie
7f7d05c262 drivers: hpet: use device_mmio
Straightforward example on how to use the TOPLEVEL variants
of the DEVICE_MMIO macros.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Andrew Boie
ee3c50ba6d x86: apic: use device MMIO APIs
A hack was required for the loapic code due to the address
range not being in DTS. A bug was filed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Andrew Boie
d15a531197 drivers: eth_e1000: use device MMIO
The ethernet driver no longer continues to try to initialize
itself if PCIe probing fails.

This device is always PCIe so we don't need to reserve ROM MMIO
storage.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-17 11:38:18 +02:00
Marcin Niestroj
967f485f38 drivers: wifi: simplelink: fix typo in logged option name
Fix typo in logged Kconfig option name that is missing in used
configuration. This one was mostly problematic for developers wanting to
find such option in source tree using grep - NET_SOCKET_OFFLOAD was not
found in Kconfig files.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-16 07:19:56 -05:00
Abhishek Shah
08ed93fed9 drivers: pcie: refactor pcie directory to make RC and EP independent
With this refactoring of pcie directory, RC drivers are placed under
host/ directory, EP drivers are placed under endpoint/ directory and
they are completely independent of each other.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-07-14 19:35:31 -04:00
Andreas Sandberg
b5bff2cf48 drivers: lora: sx126x: Use the new pin helpers
User the new pin configuration helpers to reduce boilerplate.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-13 13:11:59 +02:00
Andreas Sandberg
2ebd80cd0e drivers: lora: sx126x: Don't initialize control pin to active
The antenna control GPIO was incorrectly initialized to active. This
is unnecessary since the HAL will activate the antenna switch when the
chip enters an active state.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-13 13:11:59 +02:00
Andreas Sandberg
23e4a8b64e drivers: lora: Move sx1276 pin helpers to sx12xx common
The new sx1276 pin configuration helpers can be used by the sx126x
driver as well. Move them to sx126xx_common.{c,h} to facilitate reuse.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-13 13:11:59 +02:00
Jeremy LOCHE
8344b8080b drivers: pinmux: corrected all USART6 alternate functions
Fixed AF for USART 6 on PC6/PC7 PG8/PG9/PG12/PG13/PG14/PG15
All RTS/CTS/RX/TX pins now have correct AF7 instead of wrong AF8.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-07-13 11:53:12 +02:00
Jeremy LOCHE
695bd85b99 drivers: pinmux: stm32h7: fix incorrect PG9/PG14 usart6 AF
Fixes AF of PG9/PG14 for usart6. Must be AF7 instead of AF8

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-07-13 11:53:12 +02:00
d1f4a91183 drivers: display: fix a typo in the ili9340 driver
The typo is inside an __ASSERT which is why the driver is normally OK.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-12 17:17:17 -04:00
Steven Slupsky
a18a73c19b drivers: wdt: sam0: fix register access in feed()
The wdt CLEAR register is a write synchronized register.
To avoid bus stall, check the status of SYNCBUSY before
accessing the register.

Use SYNCBUSY register for SAM E.
If the wdt is syncing, return -EAGAIN to avoid bus stall.

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
2020-07-11 12:40:18 -04:00
Armando Visconti
485f2d410c drivers/sensors: Add iis2dh accelerometer sensor support
Add support to STM IIS2DH the ultra-low-power highperformance
three-axis linear accelerometer.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-07-10 11:49:40 -05:00
Mieszko Mierunski
5d00616bf3 drivers: nrf: Add concatenation buffer to i2c nrfx TWIM driver.
Add option to concatenate i2c transfers. If concatenation buffer size is
provided then transfers will be concatenated as long as there is space
left in buffer.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2020-07-10 15:40:26 +02:00
Kamil Piszczek
d19e21fb01 drivers: bluetooth: rpmsg: validate heap size configuration
Added a build-time assert to check if heap memory configuration to
make sure that it can accomodate RPMsg queue allocations.

Ref: NCSDK-5479

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-07-10 13:13:46 +02:00
Alexandre Bourdiol
e520f35453 drivers: flash: stm32wb return in case of control register locked
In case of control register lock, driver should return the error
immediately. Otherwise, error is later overwritten by
'rc = flash_stm32_wait_flash_idle(dev);'

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-07-10 11:46:05 +02:00
Johann Fischer
6d76bd8a9f drivers: usb_dc_sam0: rename ep_num to common ep_idx
ep_idx is common used designator for endpoint index,
rename ep_num to ep_idx in usb_dc_sam0 driver.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-07-10 11:45:46 +02:00
Johann Fischer
b95558dd9f drivers: usb: unify endpoint helper macros
Unify endpoint index and direction helper macros
across all usb device drivers.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-07-10 11:45:46 +02:00
Vincent Wan
3b126e30e2 drivers: entropy: cc13xx_cc26xx: add power management support
This commit adds a dependency on the TRNG resource in the TI Power
module, prevents the system policy from entering standby when TRNG is
active, and adds support for device PM.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-07-10 11:45:31 +02:00
Henrik Brix Andersen
99c7597874 drivers: i2c: mcux: return to idle on failed transfers
Abort I2C transfers through the MCUX HAL if a transfer fails to avoid
deadlock in the driver/HAL.

Fixes #25098

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-07-09 16:03:01 -05:00
Marcin Niestroj
559cf02107 drivers: lora: sx1276: configure reset gpio only once
Reset gpio is configured during driver initialization. There is no
reason to do it repeat that process later, so replace
gpio_pin_configure() with gpio_pin_set().

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-09 13:47:42 +02:00
Marcin Niestroj
71bdb35191 drivers: lora: sx1276: rework gpio configuration
Introduce sx1276_configure_pin() helper macro, which hides lots of
boilerplate preprocessor and C code. Doing so allows to uncover
inconsistent gpio initialization flow and prevent such in future. Also
add error log whenever gpio_pin_configure() fails.

It seems like output of gpio_pin_configure() for several
gpios (antenna_enable, rfi_enable, rfo_enable) was assigned to variable,
but its values was never checked. Return value from gpio_pin_configure()
of tcxo_power gpio was even not catched. The only output gpio
configuration that was handled properly was actually reset gpio.

Fix that inconsistent behavior by always checking return value of
sx1276_configure_pin().

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-09 13:47:42 +02:00
Vinayak Kariappa Chettimada
eb2a64989b drivers: flash: nrf: Fix flash operation timeout
Fix flash operation timeout due to incorrect use of
secondary ticker to abort any radio in use. Ticker id 0
is reserved for split controller's pipeline preempt timeout.
Using the same ticker id caused the secondary ticker to
not be started if controller is using the same ticker id
for pipeline preempt timeout.

Fixes #26333.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-09 07:17:41 -04:00
Peter Bigot
2036bbcde4 drivers: sensor: bme280: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot
9acf7867ec drivers: spi_flash_at45: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot
eac3f249c2 drivers: eth_enc424j600: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot
598f4e242d drivers: eth_enc28j60: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot
ceb5c751b3 drivers: eeprom_at2x: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot
0f7acb1dc3 drivers: adc_mcp320x: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot
62e045f979 drivers: adc_lmp90xxx: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Marcin Niestroj
fdeed32844 adc: adc_shell: suppress -Wchar-subscripts with isdigit()
Suppress -Wchar-subscripts warnings when building with Newlib, by
casting isdigit() parameter to unsigned char.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-09 11:28:54 +02:00
Andrei Gansari
0d5e9f9620 drivers: soc_flash_mcux check before reading
LPC55xxx SoCs don't allow reading erased areas, the flash memory
controller (FMC) will trigger an ECC error for that area. To prevent
reading unwritten areas the low level FMC command of margin checking is
used, this will fail if the area to be read is not correctly written
(margin_check) or area is erased (blank_check).
In the case of an erased page, we return dummy data so the application
can program that area.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-07-09 11:28:25 +02:00
Alexandre Bourdiol
c8ceca2d53 drivers: STM32 dualcore concurrent register access protection with HSEM
In case of dualcore, STM32H7, STM32W and STM32MP1,
protect concurrent register write access with HSEM.
Done for following drivers:
clock_control, counter, flash, gpio, interrupt_controller

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-07-09 11:27:56 +02:00
Gerson Fernando Budke
92bb6afcdd drivers: ieee802154: rf2xx: Add CS gpio flags from DT
The generic SPI GPIO chip select support now respects devicetree flags
for signal active level. This pass DT information to driver instance to
ensure proper behavior.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-07-08 23:22:19 -04:00
Flavio Ceolin
c4f7faea10 random: Include header where it is used
Unit tests were failing to build because random header was included by
kernel_includes.h. The problem is that rand32.h includes a generated
file that is either not generated or not included when building unit
tests. Also, it is better to limit the scope of this file to where it is
used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-07-08 21:05:36 -04:00
Christian Taedcke
82de647e31 drivers: i2c_gecko: Fix mutation of config_info content
Since the i2c init structure is moved from config_info to the stack,
this change requires 12 bytes more stack during driver initialization.

This fixes #25255

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-07-08 16:10:54 -05:00
Raja D.Singh
bbabefb764 drivers: wifi: winc1500: Update to work with new timeouts
Change the driver to work without CONFIG_LEGACY_TIMEOUT_API option.

Signed-off-by: Raja D.Singh <rdsingh@iotwizards.com>
2020-07-08 15:38:43 -05:00
Marcin Niestroj
8ab0d153a2 drivers: wifi: esp: fix reset control logic and respect reset dts flags
wifi-reset-gpios flags were not respected so far. This means that
setting reset as active low (which is required in most cases for ESP
modules/chips) was done inside esp driver with inverted logic. Use dts
flags instead, so "active low" property is configured the same way as
for other drivers (i.e. in device-tree instead of driver).

This change also allows to configure reset as active high, in case where
ESP's nRST signal is somehow inverted on the board (behaving as RST
signal instead).

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-08 15:17:26 -05:00
Andy Ross
662835a798 drivers/serial/ns16550: Unbreak 64 bit MMIO addresses
PCI devices on 64 bit systems can be mapped anywhere, not just in the
lower 4G of memory.  Remove pointer size assumptions.

Also this removes the use of a struct uart_device_config to store the
(runtime) BAR address.  That struct has other stuff in it, and the
only thing we need is the single MMIO address.  It's also REALLY
confusing to have two "devconf" fields in the device storing values of
the same struct type, some fields of which are used from one of them
but some from the other!

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-07-08 12:34:09 +02:00
Andy Ross
43d84147d9 drivers/pcie: Fix BAR address size limitation
The PCI API was originally limited to 32 bit addresses.  Even though
it had code to skip over the high word in 64 bit BAR entries, it
refused to use it and returned a 32 bit value.  Some devices in the
wild have default mappings from the firmware for devices above 4G.

Also remove the "iobar" API.  It's dead code, we don't call it and we
don't test it.  IO space BAR entries are a legacy feature from way,
way back in PCI history (I genuinely have never heard of a real device
that uses them!).  And there's no difference in format between one of
these and a 32 bit "memory" BAR anyway, someone who actually had this
requirement could just use the existing API without worry.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-07-08 12:34:09 +02:00
Pawel Dunaj
af063ccd12 drivers: timer: nrf_rtc: Use correct macro when capping cycles
When checking the absolute value of cycles set to the comparator
use the MAX_CYCLES instead of MAX_TICKS.

The commit changes function names and comments to make it clear
where ticks (system ticks) and where RTC cycles are used.

Fixes #26701

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2020-07-08 12:33:08 +02:00
Simon Glass
9ff7dfce23 flash: Enhance 'flash read' to read a block of data
It is annoying to read just a single word at a time. Update this
command to print any amount of data. This uses byte format at present.

We could perhaps support something like:

   flash read.8
   flash read.16
   flash read.32

to chose the size.

Example output (with line breaks to keep within git-style limit):

$ flash read FLASH_CTRL 0 20
00000000: 20 25 00 20 1d 26 00 08  69 68 00 08 45 26 00 08
   | %. .&.. ih..E&..|
00000010: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
   |........ ........|

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-07 17:19:26 -04:00
Krzysztof Chruscinski
157f6f65d9 drivers: sensor: nrf5: temp_nrf5: Add mutex to temp_nrf5_sample_fetch
Added mutex to protect against access from various contexts.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-07 16:27:32 -04:00
Peter Bigot
dc14becd2d drivers: flash: nrf_qspi_nor: record dependency on multithreading
This driver blocks on a semaphore to receive notification when an
operation is complete, so requires CONFIG_MULTITHREADING=y.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-07 16:24:38 -04:00
Gerard Marull-Paretas
2ece951c1b drivers: pwm: stm32: fix polarity setting
PWM polarity was not being set correctly because flags were not checked
correctly.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-07-07 15:09:03 +02:00
Marcin Niestroj
68d0042138 drivers: console: gsm_mux: fix timeout after timeout API change
New timeout API uses opaque k_timeout_t type. Adjust code to work with
that properly.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-07 15:08:43 +02:00
Johann Fischer
d261de8960 drivers: dw1000: fix SPI GPIO CS
Since commit 5963ebaf33
("drivers: spi: CS configuration through devicetree")
the SPI GPIO CS flags are obtained from DT,
but the patch series has missed the necessary changes
for the ieee802154_dw1000 driver and decawave_dwm1001_dev board.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-07-07 15:08:16 +02:00
Sandeep Tripathy
b37ce93979 drivers: timer: fix tickless contineous interrupts
K_FOREVER/INT_MAX number of ticks needs delay cycles value of
maximum order and exceeds 'int32' range.
The typecast to 'int32' results in wrongly evaluating the value
as less than 'MIN_DELAY' and chooses 'MIN_DELAY' over the actual
delay cycles.

Cap the 'MAX_TICKS' to INT32_MAX.

fixes: #26632
Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-07-07 15:06:55 +02:00
Tyler Hall
62a13fb03b drivers: eeprom_at2x: guarantee retry until timeout
Make sure to retry at least once after the timeout elapses. Sample the
current time before starting the i2c transaction, and only give up if
the polling occurred after the timeout.

The timeout exists to allow the eeprom time to complete a write, during
which time it will nack transactions (at24) or the status register will
report busy (at25). If a transaction fails legitimately, but the 1ms
sleep overshoots the timeout expiration, we will not try again, which
fails to give the part the full grace period before declaring failure.

This is likely to happen in the last 1ms interval but also possible if
the eeprom thread is preempted. It is possible to only try once and give
up if the sleep lasts longer than the timeout, which fails to give the
part an adequate period to complete the write.

Waiting until the current time is after (not equal to) the timeout is
also important because we don't want to round up partial milliseconds if
the start time was sampled near the end of a millisecond boundary. The
timeouts of eeproms can be ~5ms.

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
2020-07-07 15:04:31 +02:00
Andrzej Głąbek
414c773c48 drivers: gpio_nrfx: Replace atomic_set_bit_to() with atomic_and()
A call to atomic_set_bit_to() was used for clearing bits in an atomic_t
variable that stores information about allocated GPIOTE channels.
This caused an issue to be reported by Coverity, as the function treats
its first parameter as an array and it was provided with a pointer to
a singleton.
This commit replaces that call with atomic_and(), to prevent the issue
from being reported and for consistency with the way bits are set for
allocated GPIOTE channels (what is done with a call to atomic_or()).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-07-06 16:47:03 +02:00
Andrzej Głąbek
5f6985ce64 drivers: uart_nrfx_uart: Fix disabling of TX IRQ
The STOPTX task cannot be triggered directly in the function that
disables TX interrupt because this task stops the UART transmitter
immediately, even if it is in the middle of shifting out a byte.
Instead, this task needs to be triggered in the interrupt handler,
when the end of transmission is signaled.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-07-06 16:34:53 +02:00
e68287dd90 drivers: spi: fix the fast path on the SAM0 driver
To keep the bus fully loaded, the SAM0 has a fast path that recognises
special cases like TX only, RX only, or TX/RX of the same size.
Commit #ea2431f32f7 accidentally disabled this.

This increases the utilisation from around 30 % to around 90 % at 48
MHz.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-06 10:02:14 -04:00
8181eede5d drivers: spi: ensure the first byte has been loaded in the TX fast path
The SAM0 has a data register and a shift register.  Data that is
written to the data register is transferred to the shift register by
the peripheral.

On the SAMD51, the CPU is fast enough that the first data write hasn't
been transferred to the shift register by the time the next data write
occurs, causing the second write to be dropped, causing the receiver
to wait forever.

Fix by spinning until the data register is empty.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-06 10:01:35 -04:00
dcf64c93e3 drivers: usb: switch the SAM0 driver from a custom allocator to the heap
Also automatically enable the heap if the USB device is selected.

Part of #23178

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-06 09:58:20 -04:00
Andreas Sandberg
8e8f14e333 drivers: lora: Add chip select flags to SX1276 driver
Add chip select flags from the device tree to the spi_cs_control
instance.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-06 09:57:45 -04:00
Andreas Sandberg
33d473d281 drivers: lora: Add chip select flags to SX126x driver
Add chip select flags from the device tree to the spi_cs_control
instance.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-06 09:57:45 -04:00
Tobias Schaffner
667f1e663d drivers: gd7965: use K_MSEC macro in k_sleep calls
The gd7965 driver still called ksleep with unsigned integers.
Use the K_MSEC makro instead.

Signed-off-by: Tobias Schaffner <tobiasschaffner87@outlook.com>
2020-07-06 09:57:14 -04:00
Parthiban Nallathambi
3e62d73368 drivers: wifi: eswifi: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.
ISM43362 chip select is ACTIVE_LOW.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-06 08:24:18 -05:00
Joakim Andersson
4be66bd33d Bluetooth: Fix host RX thread deadlock
Fix host RX thread being deadlocked. The deadlock occurs because the
RX thread is stuck waiting in conn_tx_alloc with K_FOREVER but if the
connection is disconnected only the RX thread can unblock it in the
handling of the disconnect event.

This commit fixes this deadlock by splitting the processing of the
disconnected event into two parts.
The part needed to unblock the RX is to release resources held by
unack'ed TX packets and mark the connection state as not connected
anymore.
The RX thread waiting for free_tx fifo and the TX thread waiting for
the bt_dev.le.pkts semaphore will both check the connected state after
having acquired them and will abort if disconnected.
The rest of the processing will be handled at normal RX thread
priority like normal.

Move the bt_recv_prio handling to the Bluetooth host when the host
has defined its own RX thread (CONFIG_BT_RECV_IS_RX_THREAD=n).
If the HCI driver has the RX thread (CONFIG_BT_RECV_IS_RX_THREAD=y),
then the responsibility to call bt_recv and bt_recv_prio correctly
falls to the HCI driver.
The helper function bt_hci_evt_is_prio() is replaced with
bt_hci_evt_get_flags() so that the HCI driver can do this correctly.
This decision to replace was made so that existing HCI drivers
maintained out-of-tree will fail at compile time with the new system.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>

Bluetooth: host: Move bt_recv_prio to host when RX thread is defined

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 11:15:39 +02:00
Ilya Tagunov
301208329b drivers: clock_control: stm32f0/f3: streamline PREDIV handling
We should not set PLLSRC bits here. It is done by
LL_PLL_ConfigSystemClock_* functions which are called later.
Also, PREDIV1 setting should not be restricted to HSE only.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2020-07-05 07:56:21 -04:00
Ilya Tagunov
907c545837 drivers: clock_control: stm32f0/f3: fix PREDIV options
Allow CLOCK_STM32_PLL_PREDIV1 option for STM32F3 series;
correct and extend option descriptions.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2020-07-05 07:56:21 -04:00
0bc3585800 drivers: timer: enable read synchronisation mode for the SAMD/E5x
The COUNT register on the SAMD/E5x RTC can only be read if the read
synchronisation mode is enabled.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-03 12:20:03 -04:00
89466d57ea drivers: timer: fix the use of K_FOREVER for the SAMD/E5x
Change K_FOREVER for K_TICKS_FOREVER.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-03 12:20:03 -04:00
Henrik Brix Andersen
6494ce2607 drivers: dac: mcux_dac32: add Kconfig option for enabling test output
Add a Kconfig option for enabling the DAC test output. On the NXP
KE1xF the DAC test output is internally routed to ADCx SE23.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-07-03 08:05:25 -04:00
Andreas Sandberg
69f0e3b15f drivers: flash: Add support for STM32L0X
Add support for STM32L0X using the generic STM32 backend. This is
quite a significant change since the L0 series uses a slightly
different flash controller. Refactor the generic backend to better
support different block sizes and the L0's register interface.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-03 08:05:03 -04:00
Andreas Sandberg
b9da052e51 drivers: flash: Remove redundant code in STM32 drivers
Several STM32 chips have identical chip-specific code that has been
duplicated in different source files. Unify the F0x, F1x, and F3x to
use a single implementation.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-03 08:05:03 -04:00
Johann Fischer
0a87f9359e drivers: uart_mcux: add UART set configuration function
Add UART set configuration function.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-07-02 11:09:09 -04:00
Marcin Niestroj
67f106820b net: ppp: consume ringbuf until it is empty
ringbuf claim API returns pointer to contiguous area. In cases when data
in ringbuf wraps the end of internal buffer, then single call to claim
data is not enough to get all data - there is remaining part on the
beginning of internal buffer. Those remaining bytes will need to wait
for next ISR handler to trigger workqueue. Theoretically this means that
data on the beginning of ringbuf can wait there forever, or simply to
the next timeout in PPP stack when data traffic continues.

Consume data from ringbuf in a loop, stopping only when claiming results
in empty buffer. This will make sure that there is no stale data in the
ringbuf.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-02 08:25:12 -05:00
Marcin Niestroj
a470d9deba net: ppp: fix consuming claimed area of ringbuf
Claimed ringbuf bytes were parsed until first frame was detected, but
remaining data in the claimed area was just ignored / lost.

Continue parsing bytes to the end of claimed area after each detected
frame.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-02 08:25:12 -05:00
Erwan Gouriou
6b72fbae7c drivers/clock_control: Remove useless CLOCK_STM32_PLL_XTPRE config
CLOCK_STM32_PLL_XTPRE Kconfig symbols was made to differentiate
code between F1 soc variants with XTRE and others.
It appears that specific XTRE code handling is already in place in
LL_PLL_ConfigSystemClock_* functions that are called afterwards.
Since this piece of code is not required anymore, let's remove
the symbol.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-07-02 08:14:45 -05:00
Tobias Svehagen
822df6eef6 drivers: wifi: esp: Improvements to ESP driver
- Fix passive mode protocol selection depending on AT versions
- Use Kconfig value for reset timeout
- Fix bug with parsing security from scan result
- Re-order some AT commands during init due to some commands having
  dependency on other commands

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-07-02 08:52:28 -04:00
Markus Becker
30389e01dd driver: ieee802154: rf2xx: implement setting tx power
Implemented rf2xx_set_txpower() in ieee802154_rf2xx.c by mapping dBm
values to RF2XX register values.

Signed-off-by: Kari Severinkangas <kari.severinkangas@tridonic.com>
Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-07-02 08:51:22 -04:00
Xavier Chapron
cecea7b536 drivers: i2c_nrfx_{twi, twim}: Remove potential I2C deadlock
Remove K_FOREVER wait on completion_sync.
In some situations (a short on I2C SDA line for example), this
semaphore will never be released and therefore we should not wait
it forever.
Instead we wait for a maximum of 100msec and return an error if we
weren't able to retrieve the semaphore.
In such situation, the program is not stuck anymore, but the I2C
driver must be uninit then init again to work again.

Fixes #25076.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-07-02 08:48:24 -04:00
Tobias Svehagen
edcee97346 drivers: wifi: esp: Fix bug with net_pkt_unref in tx path
The driver should only call net_pkt_unref on packets that get
successfully handled, ie where send/sendto return 0. If the packet
cannot be handled, net_context layer still owns the packet and should
take care or the unref.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-07-02 08:44:55 -04:00
Stephanos Ioannidis
75502d54b6 drivers: ethernet: sam_gmac: Add SOC_FAMILY_SAM0 dependency
The Atmel GMAC Ethernet driver may be used by both the SAM series
(e.g. SAM E70) and SAM0 series (e.g. SAM E54) SoCs.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-07-02 08:37:17 -04:00
Fabio Utzig
b6a14265e7 drivers: flash: at45: fix page-size writing wrap
When writing buffers larger then page-size, there is already a routine
that checks wrap around and adjusts offsets, but this routine was
missing incrementing the data pointer, which would results in
rewriting the same page-size bytes over and over. This adds the proper
increment code.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-07-02 08:33:40 -04:00
Fabio Utzig
f81c5190ec drivers: flash: at45: fix non-initialized warning
Silence a gcc warning due to possible return of unitialized variable in
erase function. This could only happen if size == 0, which doesn't seem
likely, but initializing the variable to zero should fix the issue.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-07-02 08:33:40 -04:00
Andreas Sandberg
6a4ebe5949 drivers: lora: Add SX126x LoRa radio support
Add support for the SX126x series of LoRa radios using the
LoRaMAC-Node HAL.

This driver currently makes the following assumptions:

  * DIO1 is used as an interrupt line.

  * There is an RF switch selecting between the TX and RX ports and
    that switch is controlled by DIO2.

  * There is either no TCXO or the TCXO is controlled by DIO3.

Specifically, the limitations above mean that modules that use GPIOs
to control the RF switch are currently not supported. Support for such
modules would need changes to the LoRaMAC-Node code.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-02 08:32:37 -04:00
Andreas Sandberg
ba330ec765 drivers: lora: Prepare Kconfig for additional radios
Add a new configuration option, LORA_SX12XX, that is shared for all of
the LoRaMAC-node-based radio drivers. By default, the appropriate
driver for the LoRa radio in the device tree is included is included
in the build.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-02 08:32:37 -04:00
Dominik Ermel
bec0c7f279 drivers/flash/flash_simulator: Fix flash_sim_write
flash_sim_write did not work correctly when simulating flash with
non-0xff erase value.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-07-02 08:24:19 -04:00
Roman Vaughan
ac6fec45e7 drivers: led_strip: Add support for external SPI CS on APA102 LED strips
Some boards may include an APA102 LED on an existing SPI bus. With
additional circuitry, chip select is supported where the APA102
lacks a built in CS pin.

This patch allows CS to be defined in the devicetree (through .dts
files) and utilised in the apa102.c driver if it's available. Preserving
old behaviour if no chip select is defined.

Signed-off-by: Roman Vaughan <nzsmartie@gmail.com>
2020-07-02 08:22:31 -04:00
Maureen Helm
10c1ded452 drivers: spi: Add optional delays to mcux dspi and lpspi drivers
Adds optional device tree properties to set delays between spi chip
select assert/deassert and clock edges in the mcux dspi and lpspi
drivers. If these properties are not set, then the minimum supported
delays are used.

Verified that tests/drivers/spi/spi_loopback/ still passes on
mimxrt1050_evk (lpspi driver) and frdm_k64f (dspi driver).

Measured with a scope that the pcs-sck-delay and sck-pcs-delay times on
the first spi transaction in the test are reduced from 7.82 us to 20 ns
on mimxrt1050_evk.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-07-02 07:57:36 -04:00
Jordan Yates
ab3e778f47 wifi: winc1500: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
ac66b76934 sensor: ms5607: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
f7e2265fb8 sensor: lsm6dsl: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
adf1c1cfe9 sensor: lis2ds12: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
3d490e0f6e sensor: adxl372: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
1dffc2870f sensor: adxl362: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
e7a5505e74 ieee802154: mcr20a: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
0d4417d187 ieee802154: cc2520: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
4f07fac5fc ieee802154: cc1200: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
ede1448b75 gpio: mcp23s17: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
667cc302fa display: ssd16xx: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
99a9d1cf06 display: gd7965: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
750ccd39dc can: mcp2515: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
a04d2f3989 sensor: lsm6dso: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
e186dcb34e sensor: lps22hh: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
9a6ec94aa7 sensor: lis2mdl: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
fc2783a017 sensor: lis2dh: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
f92714ecec sensor: ism330dhcx: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
88e4ddbbd4 sensor: lis2dw12: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
f622dcb1ec sensor: iis3dhhc: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
369f64f6ff sensor: iis2mdc: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
4f0a370c7f sensor: iis2dlpc: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
ab509ffc46 flash: spi_nor: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
57740d89e0 flash: w25qxxdv: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
26f83a0f1e display: st7789v: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
35f5b17b4d display: ili9340: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates
5963ebaf33 drivers: spi: CS configuration through devicetree
Add an additional option to the spi_cs_control struct that records how
the pin has been configured in devicetree. For drivers that are not
updated, the CS behaviour is the same as before (Push-Pull).

Use the devicetree knowledge with the GPIO subsystem so that the correct
physical pin levels for the CS pin are automatically selected.

Fixes #26267

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Saravanan Sekar
bda358a64f drivers: serial: add support for Nuvoton series UART
Add Nuvoton numicro series UART support, currently supports
only poll mode.

UART0 clock and pincontrol are directly configured, will be
replace when clock and gpio support is added.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
2020-07-01 21:09:25 +02:00
Abhishek Shah
ca523c1cf6 drivers: pcie: Do not enable PCIe RC module shell for endpoint
PCIe shell was enabled by default if shell is enabled in below commit:
commit ee985d81aa ("shell: enable modules by default if shell is
enabled").

However, this shell file has tests for PCIe RC, not applicable to EP.
So, should not be default enabled for PCIe EP.

If we add EP shell tests in future, they should be added under
drivers/pcie/endpoint/ directory.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-07-01 11:21:57 -04:00
e362f10d4c drivers: pwm: add a SAM0 TCC based PWM driver
This runs the Timer/Counter for Control in 'normal' PWM mode.  The
number of channels and counter width depends on the device and is
imported from DeviceTree.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-01 08:10:59 -05:00
Sandeep Tripathy
2e42a7028d drivers: interrupt_controller: gicv3: Skip typr for SGI
SGI are always edge triggered. Interrupt type configuration
is not available for SGI.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-07-01 08:02:57 -04:00
Sandeep Tripathy
8aa0248acd drivers: interrupt_controller: Add gicv3 SGI api
Add api to raise SGI to target cores in affinity level identified
by MPIDR. Currently only EL1S is supported.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-07-01 08:02:57 -04:00
Andy Ross
b466e579a3 drivers/timer/hpet: Disable FSB interrupts
The front side bus interrupt delivery feature is a somewhat obscure
part of PC history (in some sense a presaging of MSI interrupts) that
we don't use.

But it's part of the spec, works on hardware, has precedence over the
"legacy" interrupt routing feature we do use, and can be legally
enabled by firmware.

Disable at init time.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-06-30 21:37:54 -04:00
Kumar Gala
4cc93041db drivers: flash: atmel_sam: Fix build error
There is a typo in the function pointer assigned to get_parameters.  It
should be flash_sam_get_parameters.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-30 12:51:29 -05:00
Dominik Ermel
849a5432df drivers/flash/fash_simulator: Fix initialization for non-posix
Simulated flash, in non-POSIX compilation path, has been initialized to
incorrect value.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-29 15:48:45 -04:00
Sandeep Tripathy
ccb4b1ec47 drivers: interrupt_controller: GIC barrier before EOI
It is desired to have the peripheral writes completed to clear the
interrupt condition and de-assert the interrupt request to GIC before
EOI write. Failing which spurious interrupt will occur.

A barrier is needed to ensure peripheral register write transfers are
complete before EOI is done.

GICv2 memory mapped DEVICE nGnR(n)E writes are ordered from core point
of view. However these writes may pass over different interconnects,
bridges, buffers leaving some rare chances for the actual write to
complete out of order.

GICv3 ICC EOI system register writes have no ordering against nGnR(n)E
memory writes as they are over different interfaces.

Hence a dsb can ensure from core no writes are issued before the
previous writes are *complete*.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-06-28 23:47:58 -04:00
Marcin Niestroj
51666b8130 lora: select REQUIRES_FULL_LIBC when LORA=y
Right now we depend on NEWLIB_LIBC to build Zephyr with LORA=y. This
seems to be the only Kconfig option like that. Convert it to select
REQUIRES_FULL_LIBC instead, which will select NEWLIB_LIBC by default and
allow to use external libc as well.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-27 08:19:05 -04:00
laurence pasteau
0388a26a19 lis2dw12 : remove useless semi-colons
cleaning commit to remove useless semi-colons in lis2dw12 trigger

Signed-off-by: laurence pasteau <laurence.pasteau@stimio.fr>
2020-06-26 11:18:38 -05:00
laurence pasteau
ba3a6dce95 sensors : fix bad pin value when disabling interruption
In sensors drivers, in gpio callback function :
The device structure in parameter is related to the gpio device.

Signed-off-by: laurence pasteau <laurence.pasteau@stimio.fr>
2020-06-26 11:18:38 -05:00
Tomasz Bursztyka
8260736268 drivers: Remove useless device start/end pointers
Commit id a538dcd8f8 got rid of the usage of these pointers so they are
useless now and can be removed in this drivers.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-06-26 11:09:28 -05:00
Jiří Keresteš
0126c9f46a drivers: serial: Fix uart_poll_in() for mcux flexcomm driver
Replaces kUSART_RxFifoFullFlag with kUSART_RxFifoNotEmptyFlag to
prevent Rx FIFO overrun.

Signed-off-by: Jiří Keresteš <jiri@kerestes.cz>
2020-06-26 11:00:48 -05:00
Christian Taedcke
ba7a5408ab drivers: serial: gecko: Use init macros
Convert the present initialization code into initialization macros.
Since both the uart and the usart peripheral is implemented, two sets
of initialization macros are necessary.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-06-25 23:31:51 -05:00
Marcin Niestroj
3c55e1fcf3 lora: shell: use strtoul instead of strtoll
Parsed value is expected to be in range (0, UINT32_MAX). Use strtoul
instead of strtoll, so we better match its range. In a tested
configuration this saves 380 bytes of flash with newlib and arm32
target.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-25 16:17:27 -05:00
Rajavardhan Gundi
e71e803674 drivers: espi: Add support for ACPI_EC1 interface
This enables the ACPI_EC1 interface which is typically accessed
through ports 0x6A0 and 0x6A4 in Bios.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2020-06-25 17:05:43 -04:00
Andrzej Głąbek
c79620b722 drivers/flash/spi_flash_at45: Fix compilation errors
For some reason, use of the DT_NUM_INST macro in this driver was not
replaced with DT_NUM_INST_STATUS_OKAY. In consequence, this driver
could not be compiled successfully. Furthermore, because this now
undefined macro had been used inside UTIL_LISTIFY, gcc was not even
able to report an error, instead the compilation just "froze".
This patch replaces UTIL_LISTIFY(DT_NUM_INST()) with more appropriate
in this context DT_INST_FOREACH_STATUS_OKAY. It also adds an apparently
missing inclusion of sys/byteorder.h.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-06-25 19:33:41 +02:00
Anas Nashif
de57d60732 pcie: shell: add subcommands
pcie has an all in one command for listing pci devices. Make it support
additional commands and move lspcie to `pcie ls`.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-24 21:37:12 -04:00
Anas Nashif
ee985d81aa shell: enable modules by default if shell is enabled
If shell is enabled then enable all sub-shells if their dependencies are
satisfied. This was done for some modules and subsystems but was not
consistent.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-24 21:37:12 -04:00
Jukka Rissanen
da2db1ce53 drivers: eth: native_posix: Print errno when interface creation fails
Printing the file descriptor does not give any information when
the network interface creation fails, so print errno here instead.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-24 23:34:27 +03:00
ad7ea0d498 drivers: usb: fix usb_dc_ep_mps() for the SAM0 for IN endpoints
The driver was returning zero due to accessing the, say, 0x81'th
endpoint instead of the 0x01'th endpoint.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-06-24 21:00:59 +02:00
Venkataramana Kotakonda
69aa4eeee6 driver: espi: Enable espi uart port sirq based on uart mapping.
Espi has three uart port from 0 to 2 and uart sirq need to enabled for
the port which is active in the hardware. An active uart sirq shoudl be
enabled based on uart mapping configuration.

Signed-off-by: Venkataramana Kotakonda <venkataramana.kotakonda@intel.com>
2020-06-23 19:22:46 +02:00
Kwon Tae-young
a4d5207675 drivers: pinmux: stm32f7: CAN, SPI, I2C pinmuxes added
All pinmux supporting CAN, SPI and I2C of F7 series are added.
Since the F7 series supports up to two CANs,
the pin names of CANs have been changed.

Several minor pinmux errors have also been fixed.
Sorted by Alternate function.

Signed-off-by: Kwon Tae-young <tykwon@m2i.co.kr>
2020-06-23 19:05:26 +02:00
Giancarlo Stasi
259b30016b drivers: timer: stm32 lptim minor fix and optimization
Avoid reading LPTIM counter four times instead of three when second
read doesn't give same value. Use common code, avoid volatile for
local vars.

Signed-off-by: Giancarlo Stasi <giancarlo.stasi.co@gmail.com>
2020-06-23 19:05:16 +02:00
Giancarlo Stasi
82a08a7678 drivers: clock: stm32: fix Flash latency & clock settings for MSI & HSE
According to RM, when increasing the CPU frequency, the new number of
wait states to the Flash latency bits must be written and verified
before modifying the CPU clock source and/or the CPU clock prescaler,
to prevent NMI to occur; when decreasing the CPU frequency, after.
Tested with STM32L462 SOC and MSI with several frequencies, both
increasing and decreasing. HSE built, not tested.

Signed-off-by: Giancarlo Stasi <giancarlo.stasi@nexxiot.com>
2020-06-23 17:32:38 +02:00
Peter Bigot
a538dcd8f8 shell: refactor device_name_get implementation
Several shell modules use cloned code to iterate over all devices and
identify the nth instance that meets some criteria.  The code was
repetitive and included various errors.  Abstract to a helper function
that performs the check consistently.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-23 13:27:14 +02:00
Marcin Niestroj
af67b297a3 drivers: lora: sx1276: support antenna power enable
RF SPDT switches used for RX/TX selection have often power enable pin
connected to MCU's GPIO, so it is possible to disable it to save power
when not doing any data transfers. Add 'antenna-enable-gpios' property
to support such designs.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-23 13:08:06 +02:00
Marcin Niestroj
35328cc537 drivers: lora: sx1276: support TCXO power control
Add support for TCXO power control using GPIO pin. Some boards
(including B-L072Z-LRWAN1 already supported in Zephyr) need delay
applied after powering on TCXO, so add device-tree property allowing to
configure that as well. Cache information about TCXO power status, so
subsequent requests to enable it will not result in unnecessary delays.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-23 13:08:06 +02:00
Marcin Niestroj
2aa161a121 drivers: lora: sx1276: support RFI/RFO/PA_BOOST antenna selection
There are several antenna path designs on SX1276 compatible boards in
the wild. B-L072Z-LRWAN1 board has dedicated enable pins for RFI, RFO
and PA_BOOST. This is exactly what this patch allows to
configure. Second variant of antenna selection is done with a single
GPIO pin, which controls RF SPDT switches (input or output). This is
also supported, when either 'rfo-enable-gpios' or
'pa-boost-enable-gpios' property is provided alone (RFO/PA_BOOST is
selected only when transmitting, so there is no need for explicit
'rfi-enable-gpios' configuration).

Drop requirement for 'power-amplifier-output' DT property when there is
either 'rfo-enable-gpios' or 'pa-boost-enable-gpios' configured. Fail
using BUILD_ASSERT() when neither is specified.

Make the SX1276SetAntSw() logic similar to loramac-node examples
implementation, so RFO/PA_BOOST is enabled only in
RFLR_OPMODE_TRANSMITTER.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-23 13:08:06 +02:00
Marcin Niestroj
f08ef736a0 drivers: lora: sx1276: select PA output by dts property
PA selection mainly depends on board design. So it looks like
device-tree is a better mechanism than Kconfig in this case. Use string
property with two possible values: "rfo" and "pa-boost".

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-23 13:08:06 +02:00
Marcin Niestroj
d1ba1ca5a5 drivers: lora: sx1276: stop reading PA_CONFIG
All fields in PA_CONFIG register are set explicitly, so there is no need
to read this register first.

Suggested-by: Andreas Sandberg <andreas@sandberg.pp.se>
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-23 13:08:06 +02:00
Andreas Sandberg
8d332adf1a drivers: lora: sx1276: fix RFO TX power configuration
The PA_CONFIG register is currently not setup correctly for the RFO
path. The biggest problem is that the output power is incorrectly set
1dBm higher than requested. Additionally, the lower power levels are
not configured properly since the max power field in PA_CONFIG is
always configured for an output power between 0 and 15dBm.

To support lower than 0dBm, adjust the max power field in the
PA_CONFIG register to shift the output power range to -4--11 dBm when
the requested power is 0 or lower.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
[Marcin: rebase on master]
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-23 13:08:06 +02:00
Marcin Niestroj
ba0a791635 flash: shell: align test array on 4 bytes
Some flash controllers support operations only when buffers are word
aligned. An example of such is nRF QSPI, which checks input buffer using
nrfx_is_word_aligned() function inside nrfx_qspi_write().

Align test array on 4 bytes, so we will gain compatibility with more
flash controllers, including nRF QSPI.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-22 20:43:59 -04:00
Krzysztof Chruscinski
b8781e27b0 sys: util: Deprecate GET_ARGS_LESS_1 macro
GET_ARGS_LESS_N must be used instead.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-22 15:18:07 +02:00
Krzysztof Chruscinski
0afb3445a5 sys: util: Deprecate GET_ARG1 macro
GET_ARG_N(1,...) can be used instead.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-22 15:18:07 +02:00
Dominik Ermel
609b645ac7 drivers/flash: Move write_block_size into flash_parameters
With addition of flash_parameters structure, and supporting API call
to retrieve it, it is no longer needed to store write_block_size as
a part of flash_driver_api and it should be part of flash_parameters.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-22 14:35:03 +02:00
Dominik Ermel
6ea6321586 drivers/flash: Add support for flash_get_parameters to drivers
With addition of flash_get_parameters API call, it is needed to provide
support for the API to flash drivers.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-22 14:35:03 +02:00
Abhishek Shah
11972a48c2 drivers: pcie: ep: iproc: Add reset callback support
Add support to register callback function for each PCIe reset.
These callback functions are executed from corresponding
PCIe reset interrupt handler if registered.

Signed-off-by: Shivaraj Shetty <shivaraj.shetty@broadcom.com>
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-22 12:44:54 +02:00
Abhishek Shah
7d587abc6e drivers: pcie: ep: iproc: Add reset interrupt handlers
Add reset interrupt handlers for all three types of reset
interrupts that iProc PCIe EP can receive - namely PERST,
INB PERST and FLR.

Signed-off-by: Shivaraj Shetty <shivaraj.shetty@broadcom.com>
Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-22 12:44:54 +02:00
Gerard Marull-Paretas
76f0d72e5d drivers: pwm: stm32: add support for polarity
Add support for the polarity flag in the STM32 PWM driver.

STM32 boards using PWM have been updated accordingly.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-06-19 15:18:50 +02:00
Gerard Marull-Paretas
528a98ba3f drivers: pwm: stm32: refactor driver using LL API
The PWM drivers has been refactored using the HAL LL API. Not only that,
but the set pin_set function is now faster, as channel output compare is
just initialized if needed.

NOTE: Has been tested using H743zi board for now.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-06-19 15:18:50 +02:00
Henrik Brix Andersen
696fc3afbf drivers: sensor: add api function for getting a sensor attribute
Add an API function for getting the value of a sensor attribute.

Fixes #26167.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-06-17 17:13:14 +02:00
Flavio Ceolin
1cd5578539 serial: ns16550: Simplify poll out
Simplify poll_out loop.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-06-17 17:10:59 +02:00
Flavio Ceolin
459dde17e5 serial: ns16550: Fix poll in
poll_in was dropping all data and return just the last character.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-06-17 17:10:59 +02:00
Ioannis Glaropoulos
f1264b7e47 drivers: entropy: nrf5: add docs and a DSB in get_entropy_isr
Add a DSB before doing WFE in get_entropy_isr, to ensure
the memory transactions are complete.

Add a note clarifying a dependency for the existing solution
(dependency is satisfied by ARCH code but is good to state
clearly).

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-17 15:55:44 +02:00
Ioannis Glaropoulos
a182f74de9 drivers: entropy: nRF: clear NVIC pending before doing WFE on RNG IRQ
We need to clear the NVIC Pending bit for the RNG IRQ before
doing any WFEs and expect to wake up by RNG events. This is
because the event register will be set only if NVIC status
is changed from 0 to 1.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-06-17 15:55:44 +02:00
Johann Fischer
3f19918041 drivers: ssd16xx: add temperature sensor support
Appropriate WS can be loaded automatically if
the display controller has integrated temperature
sensor or an external sensor is connected.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-06-17 12:31:20 +02:00
Johann Fischer
ac19e0f263 drivers: ssd16xx: support to load default WS from OTP
Add support to load default WS from OTP.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-06-17 12:31:20 +02:00
Maureen Helm
4475959285 drivers: sensor: Check i2c device pointer is non-null in bq274xx
Fixes the bq274xx sensor driver to check the i2c device pointer is
non-null, rather than the bq274xx sensor device pointer. This appears to
be the originally intended check based on the LOG_ERR message.

Coverity CID: 210035

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-06-17 09:31:16 +02:00
Karsten Koenig
189ae8c890 drivers: spi: rv32m1_lpspi: Fix null tx
Initialize the dummy data transfer so spi transfer is defined even for
an undefined tx data buffer. This aligns the rv32m1 spi driver with the
mcux spi driver.

Signed-off-by: Karsten Koenig <karsten.koenig.030@gmail.com>
2020-06-17 09:30:12 +02:00
Andrei Gansari
3722c643c9 drivers: eth: enc28j60: Misc fixes
Aligns MAC registers to the latest reference manual.
Replaces NULL buffers as some SPI drivers will fail.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-06-17 08:52:42 +03:00
Thomas Stenersen
7a8ac5e2e6 Bluetooth: hci: Depend on SOC not BOARD
The CONFIG_BT_RPMSG_NRF53 should depend on the SOC, not the BOARD
definition. Otherwise this will break for custom boards.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2020-06-16 22:12:00 +02:00
Piotr Mienkowski
4b194eb4fc gpio: remove deprecated API functions/macros
This commit removes API functions and macros which were deprecated in
2.2 release. GPIO drivers are updated accordingly.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2020-06-16 19:13:05 +02:00
Krzysztof Chruscinski
8592d43191 drivers: uart: sam0: Reorder events on rx_disable
Modified order of reported events on rx disable to match API
description: first RX_RDY and then RX_BUF_RELEASED.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-16 19:11:57 +02:00
Krzysztof Chruscinski
6cb9199dfc drivers: uart: nrf_uart: Generate RX_RDY after rx_disable
So far, when rx_disable was called then received data was discarded.
This is currently not according to the API but it is needed if
rx_disabled is called due to out of band information about end of
packet.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-16 19:11:57 +02:00
Krzysztof Chruscinski
62087be265 drivers: uart: nrf_uarte: Generate RX_RDY after rx_disable
So far, when rx_disable was called then received data was discarded.
This is currently not according to the API but it is needed if
rx_disabled is called due to out of band information about end of
packet.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-16 19:11:57 +02:00
Markus Becker
51d84c9eb4 drivers: pinmux: stm32: add PWM pinmux on PA3 for F4 series
Add PWM2 CH4 functionality on PA3 pin.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-16 19:11:35 +02:00
Jun Li
486dab02ec dma: stm32: implement get_status api
get_status api is not implemented in stm32 dma driver
but it will be used by others like async uart driver.

Signed-off-by: Jun Li <jun.r.li@intel.com>
2020-06-16 10:55:19 -05:00
Daniel Leung
afc1b9de13 timer: hpet: enable level triggering
The HPET timer was hard-coded to support only edge triggering
interrupts. This adds the necessary bits to enable level
triggering for the timer.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-06-16 10:52:43 -05:00
Peter Bigot
78f14aa91d drivers: i2c_dw: remove inappropriate assignment of API pointer
This is set when the device is defined, and should not be modified.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-16 10:46:39 -05:00
Peter Bigot
3cb335d0df drivers: gpio_intel_apl: remove inappropriate assignment of API pointer
This is set when the device is defined, and should not be modified.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-16 10:46:39 -05:00
Jun Li
8f7832cfb2 dma: stm32: increase driver init priority
DMA driver shall be initialized before any of its
clients. Right now, its initialization priority is
lower than that of UARTs. So, increase its init
priority to support future async uart drivers.

Signed-off-by: Jun Li <jun.r.li@intel.com>
2020-06-16 16:37:24 +02:00
Mohamed ElShahawi
f9e0fa9af3 drivers: esp32/clock_control: support UART, I2C
- Change default CPU Clock to 240MHz
(PLL is activated)
- I2C, UART will use sysclk from clock driver
- esp32_enable_peripheral replaced by
clock_control_on

Signed-off-by: Mohamed ElShahawi <ExtremeGTX@hotmail.com>
2020-06-16 09:00:51 -05:00
Mohamed ElShahawi
4acac3e9ef drivers: esp32/clock_control: Add Clock Driver
- Support PLL for Higher Frequencies 80,160,240 MHz
- Support XTAL Frequencies 26MHz, 40MHz
- Clock Driver can't be disabled, because all of the other drivers
will depend on it to get their operating Frequency based on chosen
clock source (XTAL/PLL).

- Add needed references to BBPLL i2c bus ROM functions.
- Add `rtc` node to Device Tree.
- Since All Peripherals Frequency is depending on CPU_CLK Source,
`clock-source` property added to CPU node

Signed-off-by: Mohamed ElShahawi <ExtremeGTX@hotmail.com>
2020-06-16 09:00:51 -05:00
Henrik Brix Andersen
05da68c7cb drivers: sensor: shell: allow passing channel as number
Allow passing the channel as a number instead of a string in order to
support sensor-specific channels (channel SENSOR_CHAN_PRIV_START and
up).

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-06-15 12:59:20 -05:00
Jukka Rissanen
fc713d1f6b drivers: eth: e1000: Enable VLAN support
Enable VLAN support so that this driver can be used to test
the VLAN when using qemu_x86 board.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-15 18:24:20 +03:00
Adam Porter
722a85aea2 drivers: wifi: remove dependency on NET_SOCKETS_POSIX_NAMES
This change removes references to raw POSIX types and functions,
allowing the drivers to build without NET_SOCKETS_POSIX_NAMES.

After this, the dependency between NET_SOCKETS_OFFLOAD and
NET_SOCKETS_POSIX_NAMES can be removed.

See issue #26033 for additional context

Signed-off-by: Adam Porter <porter.adam@gmail.com>
2020-06-15 16:59:36 +02:00
18d3499dba drivers: usb: fix a buffer overflow in usb_sam0.c
The driver currently blindly copies all of the outgoing bytes into the
endpoint.  Instead, calculate the endpoint size and copy up to that
amount instead.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-06-15 16:56:05 +02:00
fe35269d12 drivers: usb: handle a null output arg on SAM0
The output parameter `ret_bytes` is optional and may be NULL.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-06-15 16:55:52 +02:00
Vincent Wan
e7a85ddef9 drivers: entropy: add get_entropy_isr() for CC13x2/CC26x2
A non-blocking, isr-safe version of get_entropy() is necessary in order
to be called during boot time before POST_KERNEL initialization.
Otherwise a crash is seen as the existing get_entropy() implementation
uses k_sem and relies on interrupts.

Fixes #18629

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-06-15 16:53:39 +02:00
Flavio Ceolin
83d0c0a53e serial: uart_xlnx_ps: Fix duplicate initialization
The uart configuration was initializing two fields of an union.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-06-15 16:53:20 +02:00
Jose Alberto Meza
a1b6dd51d0 drivers: espi: Add support for KBC status operations
In some systems, eSPI host perform operations directly over KBC HW
status.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-06-15 16:52:53 +02:00
Flavio Ceolin
b0d1abac9c drivers: uart_mux: Add missing verfification handler
Add the verifcation handler for the syscall uart_mux_find.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-06-13 16:37:58 -04:00
Abhishek Shah
ecc1673b78 pcie: endpoint: Add iProc PCIe EP driver
iProc PCIe EP IP is present in Broadcom PCIe offload chips.
Add iProc PCIe EP driver to provide basic PCIe EP functionality.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
Signed-off-by: Shivaraj Shetty <shivaraj.shetty@broadcom.com>
2020-06-13 01:35:19 -07:00
Abhishek Shah
3c2fa8cd51 pcie: endpoint: Introduce API to achieve PCIe data transfer
Introduce common API to achieve data transfer using memcpy
to/from outbound region of PCIe EP.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-13 01:35:19 -07:00
Abhishek Shah
ca17315d7f pcie: endpoint: Add public APIs for PCIe endpoint driver
Add public APIs for PCIe endpoint driver:
- EP configuration space read/write
- Mapping/Unmapping of Host buffer and PCIe outbound region
- Raise interrupt to Host
These are minimal base APIs to make PCIe EP functional.

Also, add a Kconfig and an empty CMakeLists.txt for drivers to extend.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-13 01:35:19 -07:00
Abhishek Shah
bee0fdea1e drivers: pcie: remove depends on X86
Remove depends on X86 for config PCIE,
Let the platforms select PCIE if they want to.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-06-13 01:35:19 -07:00
Hake Huang
999c59c1ec dma: add error check on peripheral to peripheral
add dma direction check for dma_sam0

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-06-12 13:03:28 -05:00
Hake Huang
10fc7a38cc dma: add EDMA MCUX support for RT and k6s
tested on mimxrt1060_evt
  MEMORY_NOCACHE is needed
test on frdmk64f
  special test slot need configure with
  CONFIG_DMA_TEST_SLOT_START

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-06-12 13:03:28 -05:00
Hake Huang
6bb555ce83 clock_control: add EDMA clock support
add clock rate for RT series from ipg
Kinetis does not need additional clock added

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-06-12 13:03:28 -05:00
Anas Nashif
2ca3473349 spelling: fix typo
Fix some random typos..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-06-12 11:53:41 -04:00
Peter Bigot
f2ac844cf7 drivers: flash: nrf_qspi_nor: optionally support write from NVMC
The Nordic QSPI peripheral uses DMA transfers so data to write must be
located in SRAM.  Add a Kconfig that enables copying data from NVMC to
a stack SRAM buffer so it can be written to flash.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-12 11:13:23 +02:00
Peter Bigot
16573923b3 drivers: flash: nrf_qspi_nor: support write of sub-word lengths
mcumgr and possibly mcuboot write single byte values to update the
state of objects.  Rather than fail to do the write of values too
short for this peripheral detect the situation and write from a stack
buffer that meets the length criteria.

Signed-off-by: Sigvart Hovland <sigvart.m@gmail.com>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-12 11:13:23 +02:00
Marcin Niestroj
5bf4ee4f6c drivers: flash: nrf_qspi_nor: support specifying only 2 io-pins
Currently user is forced to configure an array of 4 IO pins. This makes
no sense when there are only 2 IO pins connected on board.

Configure 3rd and 4th pin in internal structure as
NRF_QSPI_PIN_NOT_CONNECTED if only 2 were specified in device-tree.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-06-12 11:11:30 +02:00
Ilya Tagunov
b899bbf9b9 soc: stm32l1: Enable DAC support
Enable STM32 DAC driver for STM32L1 series.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2020-06-12 11:06:44 +02:00
Aurelien Jarno
6c798aa31c drivers: lora: sx1276: make GPIO CS pin optional
The cs-gpios pin on SPI controller is optional for SPI controllers that
can automatically control CS line.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2020-06-12 11:06:26 +02:00
Maureen Helm
c603aa8928 drivers: serial: Fix uart_irq_tx_complete() in remaining mcux drivers
Extends the fix in commit 2175675199 to
all other mcux serial drivers. They were incorrectly checking if the
transmit buffer was empty when they should have been checking if the
transmission is complete.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-06-12 09:49:42 +02:00
Robert Lubos
041252b764 drivers: serial: nrfx_uart: Fix s32_t usage
s32_t was used instead of int32_t after the type transition in Zephyr.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-06-11 13:20:17 -05:00
Andreas Sandberg
aec341e677 boards: arm: b_l072z_lrwan1: Enable the USB controller
The STM32L072CZ MCU has a built-in USB device controller which is
supported by Zephyr's USB STM32 driver. The b_l072z_lrwan1 board has a
micro-USB connector that is wired to the MCU via two solder bridges
(SB15 and SB16) that need to be closed to connect the data lines.

Update the board documentation to describe the solder bridges and
enable the USB controller in the device tree.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-06-11 13:11:59 -05:00
Andreas Sandberg
a36147c9cb drivers: lora: Factor out sx12xx common functionality
LoRa radios supported by LoRaMAC-Node have a lot of common
functionality. Zephyr's LoRa implementation for the SX1276 uses
LoRaMAC-Nodes Radio HAL to implement API functionality like send and
recv. The exact same functionality will be used by the SX126x
driver. Facilitate sharing by moving that to a separate source file.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-06-11 07:15:34 -04:00
Andreas Sandberg
69fac5c498 drivers: lora: Move board support to a separate file
The implementation of the board support routines is shared between all
LoRa drivers that use LoRaMAC-Node. Move them from the SX1276
implementation to a separate source file to facilitate reuse. Make
this source file conditional on CONFIG_HAS_SEMTECH_RADIO_DRIVERS since
it will be used by all LoRaMAC-Node-based drivers.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-06-11 07:15:34 -04:00
Andy Liu
2175675199 drivers: serial: Fix "mcux_lpuart_irq_tx_complete" returns wrong result
Use "kLPUART_TransmissionCompleteFlag" instead of
"kLPUART_TxDataRegEmptyFlag" to check if the tx transmition is finished.

The "kLPUART_TxDataRegEmptyFlag" would give a wrong result
even if the transmition isn't over.

Signed-off-by: Andy Liu <andy@madmachine.io>
2020-06-11 11:00:53 +02:00
Dimitris Tassopoulos
c2e9c1fa49 boards: nucleo_f401re: added pwm-led0
Added onboard led to the devicetree to be supported also with pwm-led0

Signed-off-by: Dimitris Tassopoulos <dimtass@gmail.com>
2020-06-11 10:58:58 +02:00
Maureen Helm
3dd3c6a393 drivers: i2c: Check non-null pointer before dereferencing in i2c shell
Fixes the i2c shell to check the device name pointer is non-null before
dereferencing it.

Coverity CID: 210558

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-06-10 18:33:42 -04:00
Lukasz Majewski
43427c4d49 clk: eth: Add ETH_MCUX_RMII_EXT_CLK option to enable external RMII clock
This option will configure MCUX block (by setting RMIISRC [19] bit to 1
in SIM_SOPT2 register) to use external clock source for RMII from
ENET_1588_CLKIN).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
2020-06-10 13:02:22 -05:00
Francois Ramu
0856e99155 drivers: timer: stm32 lptim stops counting on timeout FOREVER
When setting a timeout K_TICKS_FOREVER,the lptimer clock is stopped
(no reset of the lptim).
Then is the lptim possibly re-started when another source asks for.
The lptim clock must then be re-started and continue counting.
This is the case when wakeup from sleep mode, for example.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-06-10 09:33:40 -05:00
Krzysztof Chruscinski
1089b91ba2 drivers: gpio: nrf: Add mask to track GPIOTE usage
So far, register state was used to determine if GPIOTE channel is busy.
This leads to issues if channel is used in more customized way after
allocation. In particular, if it temporarly disabled since disabled
channel is treated as available and can be allocated to another user.

Added additional mask which tracks allocated channels. After allocation
user can reconfigure the channel.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-10 11:57:45 +02:00
Francois Ramu
732df68fff drivers: counter: rtc for stm32f2 soc series
This patch set the EXTI line 17 as the RTC alarm pin
on the stm32f2x serie from STMicroelectronics.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-06-10 09:40:21 +02:00
Adam Porter
9da0f2af31 drivers: modem: use zsock_ variants of socket API
By using the Zephyr-native zsock_ family of types and functions, these
drivers will be decoupled from NET_SOCKETS_POSIX_NAMES.

Signed-off-by: Adam Porter <porter.adam@gmail.com>
2020-06-10 09:27:51 +03:00
Krzysztof Chruscinski
43cad10f73 drivers: serial: nrf: Remove flow control configuration from kconfig
Removed flow control configuration from Kconfig and updated samples
to use device tree for that.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-09 19:06:16 +02:00
Krzysztof Chruscinski
176d2d9f85 drivers: serial: nrfx_uarte: Use hw-flow-control from device tree
Cleaned up flow control configuration. Added support for using only
cts or only rts.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-09 19:06:16 +02:00
Krzysztof Chruscinski
f86e61be93 drivers: serial: nrfx_uart: Use hw-flow-control from device tree
Cleaned up flow control configuration. Added support for using only
cts or only rts.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-09 19:06:16 +02:00
d0f87fa9d8 drivers: flash: report if the read returns an error
This matches the other commands that log on error.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-06-09 18:57:54 +02:00
Peter Bigot
204612b3b2 drivers: flash: at45: improve diagnostics/behavior of erase
Erase can only succeed if the address is sector-aligned, and the span
to erase is an integer multiple of the sector size.  Validate this
before starting the process of erasing things.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-09 10:30:03 -05:00
Peter Bigot
c11ef527b1 drivers: flash: nrf_qspi_nor: improve diagnostics/behavior of erase
Erase can only succeed if the address is sector-aligned, and the span
to erase is an integer multiple of the sector size.  Validate this
before starting the process of erasing things.

Also reduce the check that the affected region is within the device
span to its minimal equivalent conditions.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-09 10:30:03 -05:00
Peter Bigot
f6cfdf79ba drivers: flash: spi_nor: improve diagnostics/behavior of erase
Erase can only succeed if the address is sector-aligned, and the span
to erase is an integer multiple of the sector size.  Validate this
before starting the process of erasing things.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-09 10:30:03 -05:00
Andreas Sandberg
19c165a119 drivers: entropy: stm32: Add support for STM32L0 SoCs
Add the necessary clock configuration to support STM32L-based
SoCs. This change likely adds support for other STM32 SoCs as well
since the HSI48 clock is configured for all SoCs that support it
(except the STM32L4x) instead of just the STM32G4X.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-06-09 14:44:25 +02:00
Andreas Sandberg
f1d80b3f02 drivers: clock_control: stm32: Enable SYSCFG on STM32L0
The entropy driver needs to use the SYSCFG block to control VREF on
the STM32L0. Clock the block if the entropy driver has been enabled.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-06-09 14:44:25 +02:00
Aurelien Jarno
e4b62a8ce2 drivers: timer: lptim: depend on SYS_POWER_MANAGEMENT
The LPTIM driver is supposed to be only available when the SoC is
allowed to enter power sleep mode, as described in commit f30f5fff72
("drivers: timer: lptim is [EXPERIMENTAL] for stm32 soc series only").

For that it should depends on SYS_POWER_MANAGEMENT (which gates the
SYS_POWER_SLEEP_STATES and SYS_POWER_DEEP_SLEEP_STATES options) instead
of DEVICE_POWER_MANAGEMENT.

Fixes #25989

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2020-06-09 08:15:56 -04:00
Hubert Miś
7f66fd84e8 drivers: ieee802154: fix nrf5 initialization with external irq source
MPSL is a library that provides external radio IRQ source for the
802.15.4 driver. If this library is in use, the driver shall not
configure the radio IRQ.

Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
2020-06-09 13:46:39 +02:00
Markus Becker
f253096a9c net: ieee802154: Align thread names of radio drivers
The NRF5 and RF2XX drivers are using different thread names compared
to the other 802.15.4 drivers. Aligned the thread names to <chip>_rx.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-09 11:38:25 +02:00
Henrik Brix Andersen
0cf9be32c9 drivers: adc: lmp90xxx: set thread name
Set the thread name for the data acquisition thread in the TI LMP90xxx
ADC driver to aid in debugging and profiling.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-06-09 10:54:21 +02:00
Peter Bigot
bc34501892 drivers: use macro to define device structures
Replace individual device instance definitions with the macro that
expands to the equivalent change.

    F='struct device DEVICE_NAME_GET'
    git grep -l "$F" \
     | xargs sed -i -r \
       -e "s@$F"'\(([^)]*)\);@DEVICE_DECLARE(\1);@'

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-08 15:01:52 -04:00
Markus Becker
2115b575a4 net: ieee802154: Allow to disable auto-start of 802.15.4 interfaces
Some radio drivers need configuration before start-up. Up to now only
the RF2XX drivers allowed this, but other radio drivers need this as
well. In particular for setting EUI64 addresses.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-08 19:55:19 +03:00
Jukka Rissanen
d81be8fd9c drivers: modem: gsm: Do not reference possible null pointer
The ppp_dev was used even if its value could be NULL.

Fixes #25781
Coverity-CID: 210031

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-06-08 16:50:35 +03:00
Kumar Gala
a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Julien D'Ascenzio
37e50a6775 driver: timer: stm32_lptim: fix excess ticks
Some ticks are counted additionally when the autoreload
interrupts were too close together.
This patch improve the counts of the clock cycle.
lptim_fired worked badly in particular because the flag ARRM
was not raised when the interrupt was forced.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-06-04 22:10:45 +02:00
Julien D'Ascenzio
01ff7ba6e1 driver: timer: stm32_lptim: fix deadlock when waiting ARROK flag
If ticks is K_TICKS_FOREVER the register autoreload isn't set.
So, on the next call to the z_clock_set_timeout function
the wait for the flag ARROK will be infinite.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-06-04 22:10:45 +02:00
Krzysztof Chruscinski
dc9d373eab drivers: clock_control: nrf: Allow calibration disabling
Allow to disable calibration even though RC is used.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-06-04 11:20:01 +02:00
Andrew Boie
fed960b94a net: tag net socket objects
Used for permission validation when accessing the associated file
descriptors from user mode.

There often get defined in implementation code, expand the search
to look in drivers/ and subsys/net/.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-03 22:33:32 +02:00
Henrik Brix Andersen
974e05a9d8 drivers: can: flexcan: handle rx overflow and undhandled irqs
Add handling of RX overflows and IRQs reported as undhandled by the
NXP MCUX HAL.

Fixes: #22625

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-06-02 21:49:53 +02:00
Andrzej Głąbek
49627feb03 drivers: uart_nrfx_uarte: Prevent spurious UART_RX_BUF_REQUEST
This is a follow-up to commit cf7dd4981f.

When disabling RX, it is necessary to clear the RXSTARTED event after
the ENDRX_STARTRX shortcut is deactivated, as the event might already
have been generated at this point. If the event is not cleared and
the disabling of RX is done from the user handler called in the context
of the ENDRX interrupt, a spurious UART_RX_BUF_REQUEST event will be
generated (although RX is already disabled) for which a corresponding
call to uart_rx_buf_rsp() would fail, as the second buffer is already
set. Depending on the application implementation, this can result in
other unexpected problems.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-06-02 21:49:39 +02:00
Pete Johanson
f525a4b25a usb: stm32wb: Properly lock Sem5 before initializing USB.
* AN5289 notes that Sem5 should be held before configuring
  CLK48 for USB timing.

Signed-off-by: Pete Johanson <peter@peterjohanson.com>
2020-06-02 20:11:30 +02:00
Johann Fischer
6da7e41592 drivers: console: fix USB initialization
Initialize USB even if USB_UART_DTR_WAIT is not enabled.

Fixes: #25811

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-06-02 18:02:16 +02:00
Julien D'Ascenzio
edd72848fe driver: timer: stm32_lptim: don't reset backup domain
We don't need to reset backup domain to set LSE clock source.
It's dangerous to reset backup domain, it removes:
	- RTC configuration
	- backup registers
	- RCC Backup domain control register

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-06-02 17:13:49 +02:00
Peter Bigot
7d84d16aac drivers: flash: nrf_qspi_nor: clean up lock/unlock idioms
Having a completion wait function release a lock internally only when
the operation fails is confusing.  Remove that feature, and make the
lock and unlock operations explicit and paired.

This makes it much more clear how to properly handle transactions that
require multiple calls to the HAL.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-01 16:39:02 +02:00
Peter Bigot
5c80789f32 drivers: flash: nrf_qspi_nor: ensure source buffer is aligned
The stack buffer used to pad small reads must still be aligned to a
word address as the underlying driver uses DMA transfers with that
requirement.  Don't assume the compiler will naturally align it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-01 16:39:02 +02:00
Peter Bigot
ed7fe169af drivers: flash: nrf_qspi_nor: reject zero length transfers
The check for small transfers inadvertently allowed a transfer of zero
bytes, which should be an error (invalid parameter).

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-01 16:39:02 +02:00
Piotr Mienkowski
bf1eceeebc drivers: ublox-sara-r4: update to the new timeout api
Update to the new timeout api. This fixes compilation errors.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2020-06-01 12:30:40 +02:00
Martí Bolívar
3852e08126 drivers: spi_ll_stm32: fix COND_CODE_1 usage
The consequent and alternate expressions for COND_CODE_1 must be
enclosed in parentheses, like this:

COND_CODE_1(PREDICATE, (consequent), (alternate))

The parens are missing in exactly one place in the tree. Fix it.

Reported-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-29 23:07:19 +02:00
Francois Ramu
f30f5fff72 drivers: timer: lptim is [EXPERIMENTAL] for stm32 soc series only
Activation of the LPTIMER is valid for SLEEP MODE only
The choice of the lptim clock source is STM32_LPTIM_CLOCK
set the LSE in first position to have as default value

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Francois Ramu
7be27b5169 drivers: timer: stm32_lptim fix TICKLESS=n processing
based on PR#25412
Some kernel tests use `CONFIG_TICKLESS_KERNEL=n` with
`CONFIG_SYS_CLOCK_TICKS_PER_SEC=1` to detect when a test runs longer
than 1 second.  These tests break if a tick is announced every time a
timeout occurs.  Only announce if the measured duration since the last
tick is at least the duration of a tick.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Francois Ramu
29ea09ee52 driver: timer: stm32_lptim control the timer duration
This change makes the lptimer running with lower tick periods
and small tick values

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Francois Ramu
fcfcc1d6ea driver: timer: stm32_lptim set_timeout limit values
set the min and max values of the given ticks from 0
to LPTIM_TIMEBASE which is the full register value
In case the timeout is FOREVER, then lptimer is stopped

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Julien D'Ascenzio
3894c6ee50 driver: timer: fix accumulated counter increment
The current value of the counter must not be added to the accumulator.
It will be added when calling z_timer_cycle_get_32.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-05-29 14:13:05 +02:00
Francois Ramu
b0081d1f38 driver: timer: stm32_lptim: tickless mode without a compilation flag
In the timeout function, remove the compilation flag
and use the macro instead.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Julien D'Ascenzio
b976e76866 driver: timer: stm32_lptim: fix hang when no tickless
When the tickless kernel isn't used, we don't want to wait for ARROK.
This wait can be endless.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-05-29 14:13:05 +02:00
Julien D'Ascenzio
e20d7890ef driver: timer: stm32_lptim: fix autoreload value
Autoreload value must be decrement by one

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-05-29 14:13:05 +02:00
Vincent Wan
002de4decf drivers: spi: cc13xx_cc26xx: set power config based on SPI base addr
The power configuration is dependent on which SPI is physically used.
In order to allow DT_INST_FOREACH_STATUS_OKAY() to iterate through
instances without the assumption that index 0 corresponds to SPI0
(which would be incorrect in the case when only SPI1 is enabled),
we need to check the base address to identify which SPI is being dealt
with.

Fixes #25673

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-28 10:30:14 +02:00
Hans Wilmers
2972cdc763 drivers: modem: ublox-sara-r4: fix getaddrinfo
The implementation of offload_getaddrinfo in this driver failed
when the node it was called with was an IP address. This condition
was never detected, and as a consequence a DNS query was done on
the IP address instead of returning it directly.

Also, the port was set first after running the DNS query.
As a consequence, if the IP address would have been returned directly,
this would have been done without a port been set.

Both errors are fixed in this patch.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-05-27 18:35:39 +02:00
Krzysztof Chruscinski
d8560f698b drivers: clock_control: nrf: Fix error during initialization
Prevent usage of system work queue before it is ready by delaying
initialization of temperature device. Work queue is not used until
application stage.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-27 14:49:54 +02:00
Vincent Wan
e7ecdec536 drivers: uart: cc13xx_cc26xx: use PRE_KERNEL_1 init level for all UARTs
There does not seem to be a simple way to express the fact that UART1
can be initialized later at the POST_KERNEL level. The existing code
is wrong in the sense that it always initializes DT instance 1 later,
instead of doing it for UART1 (which may not be instance 1).

In addition, UART instances on other platforms are
also initialized at the PRE_KERNEL_1 level regardless of the instance
index, so let's do the same on this platform for consistency.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-27 14:17:20 +02:00
Vincent Wan
bacf412c7b drivers: uart: cc13xx_cc26xx: set power config based on UART base addr
The power configuration is dependent on which UART is physically used.
In order to allow DT_INST_FOREACH_STATUS_OKAY() to iterate through
instances without the assumption that index 0 corresponds to UART0
(which would be incorrect in the case when only UART1 is enabled),
we need to check the base address to identify which UART is being dealt
with.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-27 14:17:20 +02:00
Jakub Cebulski
265d2cfa69 drivers: litex_timer: Fix IRQ lock intolerance
This reimplements z_timer_cycle_get_32() so it works
when IRQs are locked and solves the hung
k_busy_wait() problem.

Fixes #23622.

Signed-off-by: Jakub Cebulski <jcebulski@internships.antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>

Co-authored-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2020-05-26 21:43:30 +02:00
Bilal Wasim
64d5192f60 drivers: wifi: eswifi: Fully populate sockaddr_in on async msg
Updating the eswifi driver to provide port information (along with
IP / net context) whenever an async message is received. This is
needed to fully populate the "remote" info in "net_context"
required whenever net_context_send is called.

Also adding code to populate "remote" info in "net_context"..

Tested with STM32 disco IOT kit. Fixes #25621

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-05-26 21:40:23 +02:00
Andrzej Głąbek
d000ff38dc drivers: serial: nrfx: Force poll_out when lock attempts are over
When the loop that tries to obtain the lock in poll_out() finishes
because of hitting the max number of trials (what normally should
never happen), force the lock to be taken instead of just giving up
with sending the data. The latter approach that was in use so far
could not deal with a situation when some thread was aborted while
keeping the lock. Other threads would then have no chance to send
anything with poll_out() until it was called from an ISR.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-05-25 18:46:28 +02:00
Flavio Ceolin
c07f71e3fe drivers: peci: Add verification handlers
Add verification handlers for syscalls defined in peci driver.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-05-25 18:06:22 +02:00
Andrzej Głąbek
f766a3e18b sensor: temp_nrf5: Allow use only when the TEMP peripheral is present
Correct dependency of the TEMP_NRF5 Kconfig option so that it can be
enabled only on nRF SoCs that feature the TEMP peripheral.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-05-25 16:03:02 +02:00
Erwan Gouriou
2716cbcaa6 drivers: susbsys: Check errors on devices selected using dt macro
Some Kconfig defined devices may be defined using dt_chosen_label
function. Since there is no way to ensure a device enabled in dts
is also defined in Kconfig, it may happen that instance is not
actually defined.
In this case device_get_binding might return 0, leading to undefined
behavior in the function that calls it.
When not already done, systematically check return of function
device_get_binding on devices defined through dt_chosen_label macro.
Trigger ASSERT when required and return error when possible.

Fixes #20068

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-25 11:43:14 +02:00
Emil Obalski
19f6ed02b8 usb: driver: Fix Nordic driver for fragmented control OUT transfers.
Nordic driver must allow read from control OUT endpoint by
itself. For data stage transactions with length > MPS (64Bytes)
this must be performed for each 64B + Residue data packet.

Residue - data packet with len < 64B.

The exact length of data transfer is known from wLength field
form setup packet in setup stage. Until now driver was incorrectly
initializing the length of the data stage and at some point will
not allow for next data stage.

This commit addresses the issue #23980.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-22 12:50:35 +02:00
Peter Bigot
de9ed4e6a1 kernel: sys_clock: update weak pm control function
The weak implementation returns 0 for all operations without doing
anything, which incorrectly suggests that an operation like
device_get_power_state() returned an accurate description of the
system clock power state.  Return -ENOTSUP instead.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-21 20:32:12 +02:00
Krzysztof Chruscinski
a719b8c5e4 drivers: timer: nrf: Remove RTC1 dependency
Removed RTC1 dependencies in the code. Single define picks the instance.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-21 17:43:08 +02:00
Krzysztof Chruscinski
699b717452 drivers: timer: nrf: Fix premature timeouts
If timeout is being overwrite exactly when previous one is expiring
then hardware event was cleared correctly but interrupt was already
triggered. Interrupt routine was assuming that compare event is set
and proceed with that assumption. However, in that corner case when
compare event was overwritten and event was cleared, that was not the
case.

As the outcome, timeout could be triggered prematurely. Fixed by
clearing pending interrupt after handling previous compare value.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-21 17:43:08 +02:00
Peter Bigot
bfb56c5e20 drivers: flash: nrf_qspi_nor: support read of sub-word lengths
mcuboot and possibly other tools read single byte values to determine
the state of objects.  Rather than fail to do the read of values too
short for this peripheral detect the situation and read into a stack
buffer that meets the length criteria, and on success copy the data
into the provided buffer.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-21 17:04:05 +02:00
Wayne Ren
bc6f11b730 drivers: arcv2_timer0: minor fix and optimization for SMP case
* still need to clear IP bit in timer irq handler

* last_time should be aligned to ticks, old code will miss some
cycles which are about (curret_time - last_time) % CYC_PER_TICK

* in timeout set, shorten the delay needed when tick is 0, this
 will improve the response of timer irq

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-21 12:37:41 +02:00
Wayne Ren
ac5dc1dd34 drivers: arcv2_timer0: back to use level triggered irq
the pulse triggered timer irq doesn't work for all targets. In
iotdk, we found the clear of IP bit will clear int request
when elapsed called in thread context. So come back to level
triggered way which is supported in all targets, and use the sw
triggered irq to remember the irq request which may be cleared
in non timer int handler.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-21 12:37:41 +02:00
Wayne Ren
f511d51ca3 drivers: arcv2_timer0: rename overflow_cyc to overflow_cycles
* rename overflow_cyc to overflow_cycles for better understanding
* use MIN macro to replace if .. else ..
* typo fix in comments

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-21 12:37:41 +02:00
Emil Obalski
2a2d92f9c2 usb: driver: nordic: Unlock mutex in case of error.
Mutex that was previously locked must be unlocked in case
of an error.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-21 11:02:02 +02:00
Henrik Brix Andersen
784c4728b5 drivers: pwm: mcux_ftm: allow configuring the clock prescaler
Allow configuring the clock prescaler divider for the NXP Kinetis
FlexTimer. Setting the prescaler to a lower value allows for much
higher resolution/accuracy for the generated PWM waveforms.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-20 19:03:14 +02:00
Jukka Rissanen
c6a19a2046 cmake: qemu: Allow user to add parameters to Ethernet TAP
User can now add extra Ethernet TAP parameters when starting QEMU.
This is useful if we want to set for example the MAC address
of the network interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-20 15:36:39 +02:00
Peter Bigot
edd9aecddf device: avoid casting away const from config_info pointer
Re-run the const_config_info Coccinelle patch to fix code.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-20 13:30:17 +02:00
Daniel Leung
74306a6578 gpio: intel_apl: fix incorrect address access
The address used to access to REG_MISCCFG is not correct.
So fix it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-19 19:19:51 +02:00
Daniel Leung
7cd0ef0939 gpio: intel_apl: fix ISR function signature
Fix build error regarding the function signature of ISR.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-19 19:19:51 +02:00
Daniel Leung
af43e14bd0 serial: ns16550: do not write to device cfg struct when PCIE=y
When PCIe is enabled for UART, the port address is probed during
initialization and is written back into the device config struct.
However, the device config struct is supposed to be const and
read only. This results in page faults when MMU is enabled as
the struct cannot be written into. So fix this by storing port
address in device data struct if a particular UART instance is
of PCIE.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-19 19:19:51 +02:00
Daniel Leung
36674f6bf8 serial: ns16550: return error when init fails
The init function returns successful even if the first
configuration function call fails. This may leave
a non-usable UART to be discoverable with
device_get_binding() which will definitely result
in lots of head scratching. So change the init function
to return properly.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-19 19:19:51 +02:00
Daniel Leung
cee9d9b039 timer: hpet: enable benchmarking during ISR
This adds the calls to read_timer_{start,end}_of_tick_handler()
to mark the start and end of ISR which will be used to display
the time spent in ISR with benchmarking tests.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-19 19:19:51 +02:00
Vincent Wan
f6bbad831a drivers: ieee802154: cc13xx_cc26xx: use HwiP_construct to connect CPE0
IRQ_CONNECT() can only be called at one location to connect the irq for
CPE0. This commit modifies the driver to call into the HwiP layer in TI
HAL so that TI's RF driver can do the same when connecting the irq.

Fixes #25216

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-19 17:28:29 +02:00
Vincent Wan
e21da06a16 drivers: ieee802154: fix build for cc13xx/cc26xx
New update of hal_ti requires DeviceFamily_CC13X2/DeviceFamily_CC26X2
to be defined in order to include the rfc.h header.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-19 17:28:29 +02:00
Peter Bigot
ec55314d28 drivers: timer: nrf_rtc: fix TICKLESS=n processing
Some kernel tests use `CONFIG_TICKLESS_KERNEL=n` with
`CONFIG_SYS_CLOCK_TICKS_PER_SEC=1` to detect when a test runs longer
than 1 second.  These tests break if a tick is announced every time a
timeout occurs.  Only announce if the measured duration since the last
tick is at least the duration of a tick.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-19 17:19:02 +02:00
Alexandre Bourdiol
5559430654 driver: counter: counter_ll_stm32_rtc.c: Add 1 tick to alarm
Add +1 tick to alarm in order to compensate the partially started tick.
Alarm will expire between requested ticks and ticks+1.
In case only 1 tick is requested, it will avoid that +1 Tick event
occurs before alarm setting is finished.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-05-19 14:48:49 +02:00
Bilal Wasim
190ade91b8 drivers: eth: stm32: Fix invalid assertion comparison
The check for assertion on the "config_func" was added to
validate that the function pointer is valid. However, in
the code we are invoking the "config_func" and comparing
its output with NULL. This causes build failures with
CONFIG_ASSERT=1. Caused by PR-25393.

Tested on Nucleo F767Zi board.

Fixes #25427

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-05-19 14:47:51 +02:00
Jennifer Williams
d2c74eb987 drivers: serial: uart: ns16550 add missing isr locking
The existing uart driver ns16550 did not have ISR locking that
effected IO APIC working in fixed delivery mode in SMP system
x86_64. This commit adds ISR locking mechanism using spinlock
for the interrupt related services.

The CONFIG_IPM_CONSOLE_STACK_SIZE is increased to lift
limitation of stack size experienced in IPM driver test with
this spinlock impelentation.

Fixes #23026

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2020-05-18 19:35:37 -04:00
Erwan Gouriou
ac98a786d4 drivers/spi: stm32: Fix use of single dma channel
Current dma struture code didn't allowed only rx channel removal,
disabling tx channel (in spi client node) was leading compilation
issue.
Fix this by moving conditional code inside SPI_DMA_CHANNEL macro and
get the part of code which is present or removed (SPI_DMA_CHANNEL_INIT)
outside of {}.
Additionally, fix indentation on '\' in whole instance init macros

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-18 19:14:37 +02:00
Bilal Wasim
10a05017bc drivers: eth: stm32: Fix driver crash caused by RX IRQ trigger
All initialization of the Ethernet interface is done in the
eth_initialize function which is invoked by the boot code.
This function sets up DMA, programs the Ethernet module and
enables IRQs. However, this function does not setup "netif"
interface info which is done when the ethernet device is
enumerated by the NET stack via the "iface_api.init" func.
However, after the eth_initialize func is called, it is
possible that the system receives RX interrupts, and the
"rx_thread" accesses the "netif" pointer to get iface info.
However, because the "netif" info is not necessarily
populated at this time, we get a crash (as OS does NULL
access).

Fixed by enabling Ethernet IRQ after the interface is
properly setup.

Tested on Nucleo F767Zi board.

Fixes #25408

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-05-18 19:11:40 +02:00
Sandeep Tripathy
17fcaa3fc4 drivers: timer: get ppi configuration from dt
Use device tree provided configurations for arm architecture timer
PPIs.

This fixes issue of timer ppi not working on most hardware where
edge-triggered PPI are not supported.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-05-18 11:07:57 +02:00
Daniel Leung
e4734e088a gpio: intel_apl: don't enable interrupt if line is output
Hardware does not seem to support triggering interrupts to
itself by setting line as both input/output and setting
output to desired level. So just say interrupt triggering
is not supported when line is set to output.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-16 19:56:19 +02:00
Wentong Wu
72227574d8 timer: remove QEMU_TICKLESS_WORKAROUND
Qemu icount mode enabled, remove QEMU_TICKLESS_WORKAROUND.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-14 13:52:07 +02:00
Marek Pieta
6da15634bf drivers: usb_dc_nrfx: Abort write on ep_ctx_reset
Change adds abort of ongoing write operation in ep_ctx_reset. This is
required to keep the state of Zephyr driver consistent with state of
nrfx driver. This fixes a bug where nrfx_usbd was stuck in busy state.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2020-05-14 13:28:46 +02:00
Christoph Reiter
d49e7da7da sensor: add sensor driver for Infineon DPS310
Add driver for Infineon DPS310 temperature and pressure sensor.

Signed-off-by: Christoph Reiter <christoph.reiter@infineon.com>
2020-05-14 11:02:29 +02:00
Daniel Leung
ba5b141e2f gpio: mchp_xec: fix erroneous interrupt triggers
If interrupt is previously enabled and triggering condition
changes, it might fire callback based on previous condition.
To avoid this issue, disable interrupt before trying to
change settings, and enable afterwards.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-14 10:48:26 +02:00
Martí Bolívar
6e8775ff84 devicetree: remove DT_HAS_NODE_STATUS_OKAY
Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an
undesirable API for the following reasons:

- it's inconsistent with the rest of the DT_NODE_HAS_FOO names
- DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand
  for macros which are equivalent to
  DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) &&
- DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck
- DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway
- it is seen as a somewhat aesthetically challenged name

Replace all users with DT_NODE_HAS_STATUS(..., okay), which is
semantically equivalent.

This is mostly done with sed, but a few remaining cases were done by
hand, along with whitespace, docs, and comment changes. These special
cases include the Nordic SOC static assert files.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 18:24:42 +02:00
Peter Bigot
4f16b419e8 device: avoid casting away const from config_info pointer
The driver-specific config_info structure referenced from the device
structure is marked const.  Some drivers fail to preserve that
qualifier when casting the pointer to the driver-specific structure,
violating MISRA 11.8.

Changes produced by scripts/coccinelle/const_config_info.cocci.

Some changes proposed by the script are not included because they
reveal mutation of state through the const pointer, though the
code works as long as the driver-specific object is defined without
the const qualifier.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-13 18:21:52 +02:00
Francois Ramu
1a163673c7 drivers: spi: driver reloading dma buffers in the main transceive loop
With this change, the spi transceive with dma function
waits for the spi busy flag reset and for the dma transfer end.
Then it reloads the channels until all buffers are consumed.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-13 16:22:10 +02:00
Francois Ramu
c83e2a41ae drivers: spi: driver dma callback function to set transfer flag
This change avoids the reload of the dma channel
in the callback function, just sets the corresponding Tx, Rx flag.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-13 16:22:10 +02:00
Johann Fischer
5a3d44256e drivers: usb_dc_sam: free endpoint memory on End of Reset event
Free endpoint memory on End of Reset event (EORST).

Fixes: #24626

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-05-13 11:13:36 +02:00
Johann Fischer
29d95ba1d4 drivers: usb_dc_sam: tweak logging for enable, disable, configure
Tweak logging for enable, disable, configure.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-05-13 11:13:36 +02:00
Gerson Fernando Budke
9a37154151 drivers: wifi: esp: Update to new timeout api
Update to new timeout api.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-05-12 17:18:34 +02:00
Anas Nashif
8ec88164ac i2c: shell: add braces around if statement
Add braces around if statements per coding guideline.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-10 17:49:30 +02:00
Simon Glass
9360150c0c i2c_shell: Add write/read multiple-byte commands
Allow writing multiple registers (or a single 16-bit register) and
reading multiple registers.

   i2c read I2C_2 36 40
   00000000: 12 34 00 00 0F 3D 80 80 AF 9C 17 00 90 01 00 00

   i2c write I2C_2 36 40 12 34 56 78 90 12 34 56 78 90

   i2c read I2C_2 36 40
   00000000: 12 34 00 00 90 12 80 80 AF 9C 17 00 90 01 00 00

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-10 17:49:30 +02:00
Anas Nashif
ffd568db09 i2c_shell: Add write_byte/read_byte commands
Add simple commands to read or write a single byte from a device
register.

   i2c write_byte I2C_2 36 b0 12
   i2c read_byte I2C_2 36 0
   Output: 0x82

I modified Anas' version to put args in variables first so that the code
is self-documenting.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-10 17:49:30 +02:00
Anas Nashif
0ecc71ccb2 i2c_shell: Tidy up the code style
Fix some code-style nits in this file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-10 17:49:30 +02:00
Xavier Chapron
2a8ff02ef2 drivers: Replace printf by printk when applicable
Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-05-09 21:25:33 +02:00
Kumar Gala
df56ce3efb drivers: ethernet: mcux: rework how unique mac is determined
Instead of having a Kconfig property, if there is no local-mac-address
property in the devicetree than we'll generate a unique MAC address
based on unique ID registers on the SoC.

We remove the local-mac-address properties in the SoC dtsi files to
match the default behavior that existed before (ie, unique MAC address)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 16:29:57 +02:00
Kumar Gala
b19cf0bed3 drivers: eth: Get Manual MAC address from devicetree
Move from a Kconfig to select/initialize the MAC address to using the
"local-mac-address" property in devicetree.  If the property is set the
drivers will initialize the mac-address from the devicetree (unless the
mac address is all 0's).  The MAC address might get overwritten by
either a driver specific means or by the setting of
"zephyr,random-mac-address" in the devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 16:29:57 +02:00
Kumar Gala
1de61b4c42 drivers: eth: Replace driver specific RANDOM_MAC Kconfig with devicetree
Utilize the devicetree property "zephyr,random-mac-address" to determine
if a driver should use a random mac address and remove the associated
Kconfig options that enabled this feature.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 16:29:57 +02:00
Kumar Gala
8178f76470 drivers: eth: Refactor generation of random mac into help function
Rather than having each driver have its own slightly different way of
generating a random mac address, add a helper function that they all can
call so we do it one way.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 16:29:57 +02:00
Parthiban Nallathambi
f4adfd52cb drivers: serial: add XMC seris UART support
Add infineon XMC4 series UART support. Driver supports
only poll mode using XMCLib.

Out of 4 available UART's on SoC, only UART1 is confgired
by default in UART mode until GPIO & pinctrl support.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-05-09 14:21:44 +02:00
Jose Alberto Meza
eaaf1af79e drivers: espi: mchp: Report correct length during OOB Rx operation
Use correct HAL macro to report amount of bytes received.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-05-09 07:20:13 -04:00
Erwan Gouriou
6ea53792f4 modules: stm32: Rename lib Kconfig symbol
Both ST and STM32 modules where using same HAS_STLIB Kconfig
symbol.
Now that each module is createing is own lib, we need to be able
to distinguish libs.

Depends on zephyrproject-rtos/hal_stm32/pull/52

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-09 13:08:42 +02:00
Albin Söderqvist
35c4838425 drivers: display: st7789v: add power management support
This adds sleep mode along with power managament control.

Signed-off-by: Albin Söderqvist <albin.soderqvist@endian.se>
2020-05-09 13:07:17 +02:00
Kumar Gala
db725c0ec9 drivers: Replace GPIO_CS Kconfig with devicetree detection
Use DT_INST_SPI_DEV_HAS_CS_GPIOS() in drivers to determine if we should
utilize CS_GPIO base SPI chipselect handling.  This allows us to remove
Kconfig option for this feature.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 13:07:05 +02:00
Bilal Wasim
1966d48498 drivers: wifi: eswifi: WiFi Scan completion indication
Updating the eswifi driver to indicate "scan completion"
to WiFi Management once scanning is done.

Tested with STM32 disco IOT kit.

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-05-09 13:06:26 +02:00
Zide Chen
e8b6b86704 interrupt_controller: device driver can configure IO APIC delivery mode
Currently all IO APIC interrupts are configured at fixed delivery mode,
which is good for HEPT timer interrupt but it imposes burdens to
device drivers to properly handle the repeated interrupt sent to all
processors.

This patch makes it more flexible so that device drivers can specify
the delivery mode it desires in the IRQ connect APIs.

- Don't hard code IOAPIC_FIXED in z_ioapic_irq_set(), meaning the
  IRQ delivery mode is passed in from the 'flags' argument and
  individual device driver needs to choose delivery mode for its own
  IO APIC interrupt.

- To support different delivery mode in different IO APIC interrupts,
  need to save and restore RTE[10:8] during IOAPIC suspend and resume.

If device driver doesn't pass either IOAPIC_FIXED or IOAPIC_LOWEST
in IRQ_CONNECT()/irq_connect_dynamic() alike APIs, the delivery mode
bit fields in the target RTE register are '0' which implies fixed mode.
If the device driver wants the interrupt to be delivered to one CPU
only, it needs to explicitly specify IOAPIC_LOWEST in one of the IRQ
connect APIs.

Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-08 22:32:39 -04:00
Zide Chen
ae1137f241 interrupt_controller: change IO APIC to logical destination mode
Currently IO APIC is working in physical destination mode, which
doesn't support interrupt to be delivered to multiple local APICs.
By definition only 4 bits [59:63] in IO APIC IOREDTBL register are
available for destination addresses and it contains an APIC ID only.

This patch changes it to logical destination mode so that IOREDTBL
can potentially define a set of processors and it's posible to deliver
interrupts to multiple APICs.

Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-08 22:32:39 -04:00
Zide Chen
d27f6cb5eb interrupt_controller: program local APIC LDR register for xAPIC
If IO APIC is in logical destination mode, local APICs compare their
logical APIC ID defined in LDR (Logical Destination Register) with
the destination code sent with the interrupt to determine whether or not
to accept the incoming interrupt.

This patch programs LDR in xAPIC mode to support IO APIC logical mode.

The local APIC ID from local APIC ID register can't be used as the
'logical APIC ID' because LAPIC ID may not be consecutive numbers hence
it makes it impossible for LDR to encode 8 IDs within 8 bits.

This patch chooses 0 for BSP, and for APs, cpu_number which is the index
to x86_cpuboot[], which ultimately assigned in z_smp_init[].

Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-08 22:32:39 -04:00
Kumar Gala
c2135f8721 devicetree: DT_NODE_HAS_COMPAT_STATUS_OKAY -> DT_NODE_HAS_COMPAT_STATUS
Swap this out and make the status a parameter.
Leave a couple of cases of DT_NODE_HAS_COMPAT().

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Martí Bolívar
17b8667197 dts: clean up some redundant DT checks
These are redundantly checking a node's status twice.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-08 19:37:18 -05:00
Martí Bolívar
7e0eed9235 devicetree: allow access to all nodes
Usually, we want to operate only on "available" device
nodes ("available" means "status is okay and a matching binding is
found"), but that's not true in all cases.

Sometimes we want to operate on special nodes without matching
bindings, such as those describing memory.

To handle the distinction, change various additional devicetree APIs
making it clear that they operate only on available device nodes,
adjusting gen_defines and devicetree.h implementation details
accordingly:

- emit macros for all existing nodes in gen_defines.py, regardless
  of status or matching binding
- rename DT_NUM_INST to DT_NUM_INST_STATUS_OKAY
- rename DT_NODE_HAS_COMPAT to DT_NODE_HAS_COMPAT_STATUS_OKAY
- rename DT_INST_FOREACH to DT_INST_FOREACH_STATUS_OKAY
- rename DT_ANY_INST_ON_BUS to DT_ANY_INST_ON_BUS_STATUS_OKAY
- rewrite DT_HAS_NODE_STATUS_OKAY in terms of a new DT_NODE_HAS_STATUS
- resurrect DT_HAS_NODE in the form of DT_NODE_EXISTS
- remove DT_COMPAT_ON_BUS as a public API
- use the new default_prop_types edtlib parameter

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Kumar Gala
5cf85fa229 drivers: move nxp_kinetis_temp to for-each style
Move to FOREACH to prepare for an upcoming patch.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-08 19:37:18 -05:00
Henrik Brix Andersen
338cecbe1a drivers: i2c: shell: add I2C bus recovery shell command
Add I2C shell command for initiating a bus recovery.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Henrik Brix Andersen
6aa8a83682 drivers: i2c: gpio: add bus recovery function
Add I2C bus recovery function to the I2C GPIO bitbang driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Henrik Brix Andersen
ec90af8e78 drivers: i2c: bitbang: add helper method for I2C bus recovery
Add I2C bitbang helper function for performing bus recovery.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Henrik Brix Andersen
71b893056f drivers: i2c: add I2C bus recovery API
Add API for recovering an I2C bus. This API can be used to recover
from situations where the I2C master and one or more I2C slaves are
out of synchronization (e.g. if the I2C master was reset in the middle
of an I2C transaction or if a noise pulse was induced on the SCL
line).

Fixes #23441.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Tomasz Bursztyka
c0ab0de8d1 drivers/interrupt_controller: Rename ioapic init function
The '_' is not necessary, plus it makes the sys init object name
aligning with all others.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
dfe938640b drivers/interrupt_controller: Fix loapic/ioapic header inclusion
s/init.h/device.h

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
48135cdd34 usermode: Rework Z_SYSCALL_SPECIFIC_DRIVER to fit with device refactoring
init_fn is not anymore part of struct device, so let's test instead the
driver's API structure pointer which is also unique per device driver.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka
8d7bb8ffd8 device: Refactor device structures
When the device driver model got introduced, there were no concept of
SYS_INIT() which can be seen as software service. These were introduced
afterwards and reusing the device infrastructure for simplicity.
However, it meant to allocate a bit too much for something that only
required an initialization function to be called at right time.

Thus refactoring the devices structures relevantly:
- introducing struct init_entry which is a generic init end-point
- struct deviceconfig is removed and struct device owns everything now.
- SYS_INIT() generates only a struct init_entry via calling
  INIT_ENTRY_DEFINE()
- DEVICE_AND_API_INIT() generates a struct device and calls
  INIT_ENTRY_DEFINE()
- init objects sections are in ROM
- device objects sections are in RAM (but will end up in ROM once they
  will be 'constified')

It also generate a tiny memory gain on both ROM and RAM, which is nice.

Perhaps kernel/device.c could be renamed to something more relevant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Emil Obalski
38aea280e7 usb: Sync receiving data from ISO OUT endpoint with SOF
This commit adds support for receiveing data from ISO OUT endpoint
for NRF devices. NRF USB IP core does not generate IRQ when
data are received on ISO OUT endpoint and it must be synchronized
with SOF event.

Enable SOF handling by default if usb audio is configured
with NRF devices.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Emil Obalski
9e998d108a drivers: usb: Correct naming for endpoint Transfer Type
This commit updates definitions to better match usb 2.0 spec.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Emil Obalski
79704fac5a usb: ISO endpoint size may not be power of 2.
By this commit exception for ISO endpoints is made when it comes
to its size. ISO endpoint buffer size for nrf devices is 1023 and
may be configured with variable length size. NRFX checks is size
is chosen accordingly and it is no reason to do it in SHIM.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Johann Fischer
dba19333d2 drivers: ssd16xx: rework initialization of the controller memory
Revise how the unusable memory area is treated.

Do not use SPI interface directly but ssd16xx_write_cmd().
This will allow a common SPI interface to be implemented
in the future.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-05-08 15:11:10 +02:00
Carles Cufi
b67a31e411 Bluetooth: controller: Remove legacy LL
Remove the legacy Link Layer implementation.

Closes #24187.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-08 15:07:00 +02:00
Alberto Escolar Piedras
cd0659e36f util.h: Remove INLINE definition and user
INLINE is a very common macro, just like MAX or MIN.
Defining it always can easily collide with libraries or
application headers.
And option would be to add a ifdef guard around it,
But it was used in only 1 place in Zephyr, instead
of keeping it just for that, remove it.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2020-05-08 08:37:21 -04:00
Sahaj Sarup
351f39f9cd board: arm: Add Support For 96Boards Aerocore2
Changes:

- Added all required board files in /boards/arm/96b_aerocore2
- Modified pinmux for stm32f4

Most of the changes in this PR is based on reverse-engineering of the
PCB layout and following commits in the PX4 firmware repository for
the same board. The manufacturer does not provide and or generate
schematics and pinout tables for this board.

This PR includes almost all of the interfaces connected to the STM32
MCU, the only thing not included is the J9 and J8 headers that connect
to a 96Boards baseboard.
These headers are not vital to the functionality of the Aerocore2.

Signed-off-by: Sahaj Sarup <sahaj.sarup@linaro.org>
2020-05-08 07:33:43 -05:00
Helge Juul
dc0c938359 boards: arm: stm32f746g_disco: enable sdmmc support
Update dtsi and pinmux macros for stm32f7 family. Add sdmmc1 to dts file
for stm32f746g_disco. Also add board specific configuration file for
fat_fs sample.

Signed-off-by: Helge Juul <helge@fastmail.com>
2020-05-08 10:53:10 +02:00
Anthony Brandon
a71f77e601 boards: arm: stm32l496g_disco: enable sdmmc support
Update the dtsi for stm32l471 (which the higher SoCs are based on) to
support the stm32-sdmmc disk access device. Enable the device for the
stm32l496g_disco board, and update the pinmuxing.
Note that the stm32l496g_disco board also has a card detect gpio
(MFX_GPIO8), but this is not supported yet. When not specified the
driver will assume a card is present.

Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
2020-05-08 10:53:10 +02:00
Erwan Gouriou
c4d9de1850 drivers/clock_control: stm32: msi: Enable MSI range config in PLL mode
When MSI clock is used a source of PLL, it should be possible to
select its frequency range. Fix this.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-08 00:34:34 -05:00
Erwan Gouriou
4b3d79f1bb drivers: stm32: Add pinmux headers for stm32l5
Copy/pasted from L4 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-08 00:34:34 -05:00
Erwan Gouriou
cdd5856167 driver/gpio: stm32: Add STM32L5 support
Add basic GPIO support. Regarding interface with EXTI,
STM32L5 is similar to STM32G0.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-08 00:34:34 -05:00
Erwan Gouriou
1f054a7b31 drivers/exti: stm32: Add support for STM32L5 series
Add support for stm32l5 socs on stm32 external interrupts driver

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-08 00:34:34 -05:00
Erwan Gouriou
f258199595 drivers/clock_control: Add clock_control on STM32L5 series
Add clock_control driver for STM32L5.
It's based on L4/WB driver since it is similar IP.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-08 00:34:34 -05:00
Robert Lubos
2c2771970e modules: mbedtls: Update mbedTLS commit and apply fixes
Update mbedTLS commit along with the following fixes:

* Fix naming inconsistencies in some cipher modes, to match core mbedTLS
  configs
* Add Kconfig to enable CTR cipher mode

Fixes #22421

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-05-07 23:46:08 -05:00
Hans Wilmers
fdd89efd3a drivers: modem: ublox-sara-r4: automatic setting of APN
During communication initialisation, the IMSI of the inserted SIM
card is evaluated to determine the APN. This is done by comparing
the first 5 characters of the IMSI to a list of known providers.
The list can be given in Kconfig.

To enable this functionality, set following bool in Kconfig:
MODEM_UBLOX_SARA_AUTODETECT_APN

To set a list of providers, set following string:
MODEM_UBLOX_SARA_AUTODETECT_APN_PROFILES

If the provider can not be found in the list, the APN given in
following entry is used as a fallback:
MODEM_UBLOX_SARA_R4_APN

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-05-07 23:36:10 -05:00
Hans Wilmers
cef334b5fe drivers: modem: ublox-sara-r4: automatic detection of modem type
The modem type (Sara R410 or Sara U201) is detected automatically after
hardware initialisation of the modem. Further initialisation and
functionality is then chosen depending on the detected modem type.

To enable this functionality, set following bool in Kconfig:
MODEM_UBLOX_SARA_AUTODETECT_VARIANT

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-05-07 23:36:10 -05:00
ZhongYao Luo
1811fff2dd console: Add semihosting console
Many chips have only one serial port. When the serial port is occupied
by other devices, there is a lack of a console to output debugging
information. Semihosting can provide a console. The disadvantage of
semihosting is that a debugger must be connected, so it can only be
used for online debugging.

Signed-off-by: ZhongYao Luo <LuoZhongYao@gmail.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 23:33:38 -05:00
Johann Fischer
8f983c3654 drivers: ieee802154: add Decawave DW1000 driver
Add initial support for Decawave DW1000
IEEE 802.15.4-2011 UWB transceiver.

Driver has basic functionality. Additional functions such
as reading out timestamps and delayed TX were implemented
for test purposes, but also require support in the 802154
subsystem.

Register, sub-register, and defaults defines in the file
ieee802154_dw1000_regs.h are taken from the Decawave's
DW1000 driver for the Mynewt OS.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-05-07 23:30:58 -05:00
Andrei Gansari
5b02519d8f drivers: entropy_mcux_rng LPC entropy
Added RNG device used by LPC family devices to generate random numbers.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-05-07 23:25:31 -05:00
Gerard Marull-Paretas
cfebfc188e drivers: adc: stm32: add support for H7 series
Add support for ADC on H7 series. Note that ADC1 and ADC2 share the same
register set, so it is added as "adc1_2".

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-05-07 23:01:59 -05:00
Francois Ramu
01e9983142 drivers: pinmux: stm32wb: use a pull-down for SPI SCK pin
Like stm32 L4 does,
when the STM32WBx SoC goes into STOP mode, the SPI device is disabled.
This cause the pins to not be drived anymore (i.e. they are floating)
except through their pull-up or pull-down.

From the logical point of view, the NSS pin is held high by a pull-up
so it's not a problem if the other pins are floating. However those pins
are floating input for the slaves, which increase their power
consumption.

The solution is to hold the state of the pins through a pull-up or a
pull-down. This is already done for the NSS and MOSI pins, but not for
SCK. Fix that by using pull-down on the SCK pin the same way it is
already done for the MOSI pin.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-07 23:00:32 -05:00
Kumar Gala
6ae8664889 drivers: i2s: i2s_sam_ssc: Convert to devicetree
Convert i2s_sam_ssc driver to utilize devicetree.  We replace Kconfig
options for specifying the DMA configuration (channel, DMA device name)
with getting that from devicetree.  We also get pincfg from devicetree,
however we still have Kconfig sybmols to specify if the RF or RK pin is
enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 22:24:58 -05:00
Kumar Gala
49bab484df drivers: dma: sam_xdmac: Convert to devicetree
Convert sam_xdmac driver to utilize devicetree.  As part of the
controller binding we specify that dmas should contain a channel and the
perid for the DMA transaction.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 22:24:58 -05:00
Carles Cufi
3954aa5a5a serial: sam0: Complete port to the new timeout API
The conversion in 9b096f40b6 left out a
few tidbits that were not converted properly. Complete the conversion
properly.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 22:00:39 -05:00
Kumar Gala
0a7d4e2135 devicetree: Change DT_FOREACH_IMPL_ to not insert semicolon
Remove semicolon between instance invocations of DT_FOREACH_IMPL_ and
thus DT_INST_FOREACH.  This provides more flexibility to the user.  This
requires we fixup in tree users to add semicolon where needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 20:03:56 -05:00
Jose Alberto Meza
06d4c6d8b3 drivers: espi: xec: Ensure OOB interrupts are not missed
MCHP Soc operation uses clear-on-write register for interrupt
status, read-OR-write operation may clear interrupts unintentional.
Fixes #24464

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-05-07 17:18:26 -07:00
Jose Alberto Meza
8fa9659aea drivers: gpio: xec: Apply initialization value after pin config.
Update GPIO grouped output after pin control is updated.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-05-07 15:35:55 -07:00
Andrei Gansari
ec7fad0853 drivers: spi_mcux_flexcomm clock increase
Attached Flexcomm SPI driver to the main clock used by the core.
This means setting the SPI clock the same value as the core clock.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-05-07 12:47:34 -05:00
Peter Bigot
93884a4fe1 coccinelle: run int_ms_to_timeout conversion semantic patch
This fixes some cases where an integer timeout received as a parameter
was not converted to a timeout before being used in standard API.

Changes to the POSIX library were not included as that's being
reworked in a separate PR.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-07 19:46:03 +02:00
Peter A. Bigot
e444274e95 drivers: counter: add Maxim DS3231 support
The DS3231 is an I2C real-time clock with internal temperature
compensated oscillator, maintaining civil time to 1 s precision with
nominal 2 ppm accuracy from 0-40 Cel.

The basic functionality is exposed as a counter that is always running
at 1 Hz.  Much more functionality is exposed as driver-specific API,
including the ability to translate between the time scale of the DS3231
and the time scale of the Zephyr uptime clock.  This allows correlation
of events in the system clock to UTC, TAI, or whatever time scale is
used to maintain the DS3231.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-07 19:45:06 +02:00
Andrzej Głąbek
8ee12207ff drivers: flash: Add driver for AT45 compatible SPI flash chips
Add a driver that can handle several instances of AT45 family chips,
which are enabled by specifying DT nodes for them with the "compatible"
property set to "atmel,at45" and other required properties like JEDEC
ID, chip capacity, block and page size etc. configured accordingly.

The driver is only capable of using "power of 2" binary page sizes in
those chips and at initialization configures them to work in that mode
(unless it is already done).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-05-07 14:51:10 +02:00
Wayne Ren
0156511e71 drivers: improve the arcv2_timer driver to update cycles correctly
referring the ARM's Systick driver, we did the following improvements:

* use 31 bits of 32-bit counter to avoid the rare but possible
  overflow of elapsed(). If 32 bits val are used, elpased() may
  return a wrong value. then wrong HW cycles.
* two ways to update the correct cycles
  - through systick timer irq
  - when systick timer irq cann't be handled because of irq
    locked/disabled, call z_timer_cycle_get_32->elapsed to update
    the correct cylces. no more than one counter-wrap is allowed.
* if elapsed() is not called too long (more than one counter-wrap) from
  systick tiemr irq or from z_timer_cycle_get_32. The lost of HW cycles
  is unavoidable.

* some detailed discussion can be found in #24332

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-07 14:49:31 +02:00
Joakim Andersson
293cd5664d drivers: can: Fix use of DT_HAS_DRV_INST which does not exist
Fix use of DT_HAS_DRV_INST which does not exist.
Use DT_HAS_NODE_STATUS_OKAY(DT_DRV_INST(n)) instead.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 07:49:16 -05:00
Andreas Sandberg
d8de33e966 drivers: lora: Add a shell for LoRa testing
Provide basic commands that are useful when testing a LoRa
radio. Currently, the shell supports:

> lora conf ...
> lora send ...
> lora recv ...
> lora test_cw ...

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-05-07 14:49:06 +02:00
Andreas Sandberg
d3c6cfc0ee drivers: lora: Add a continuous wave test API
Add an API to transmit a continuous wave at a fixed frequency. This
functionality is useful to test the radio in a lab setup.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-05-07 14:49:06 +02:00
Sandeep Tripathy
bd985dcd67 drivers: add GIC V3 driver
Add basic driver for GIC V3 interrupt controller.

This implementation supports
 - distributor, re-distributor and cpu interface initialization
 - configuration and handling of SPI, PPI and SGI.
 - V2 Legacy mode is not supported and uses system interface.

Current implementation supports GIC secure state only.
All interrupts are routed to Secure EL1 as 'irq' by configuring
them as Group1 Secure.

TODO:
- MPIDR based affinity routing setting.
- percpu redistributor probe
- message based SPI and SGI generation api
- EL1NS support. Legacy mode support.
- LPI/ITS is not supported.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-05-07 14:22:53 +02:00
Carles Cufi
94861a438b drivers: modem: Port to new timeout API
Port the internal modem API to the new timeout API, using the native
k_timeout_t.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi
9ba20dd48e drivers: audio: Port to the new timeout API
Port the I2S and DMIC drivers to the new timeout API so that they do
not need to enable legacy timeouts.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi
c61faf6c55 drivers: wifi: Port the simplelink wifi to the new timeouts API
Port the code so it uses the new timeouts API.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi
6aa8f11c93 drivers: video: Remove legacy timeout use
Stop using the legacy timeout option in the video drivers.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi
9b096f40b6 timeouts: Port UART async API to the new timeout API
Port the API to the new paradigm as to avoid having to select
LEGACY_TIMEOUT_API.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi
9b04a99243 timeouts: Port BBC micro:bit to the new timeout API
Port the BBC micro:bit display driver to the new timeout API exposed by
the kernel.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Kumar Gala
fbb1de6aac drivers: can: Remove per instance Kconfig symbols
All users of per instance CAN symbols are removed so we can remove them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 10:08:31 +02:00
Kumar Gala
aec38f3fda drivers: can: mcp2515: Convert from Kconfig to DT_NODELABEL
As we phase out per instance Kconfig symbols convert to utilize
DT_DRV_INST to initialize CAN instances.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 10:08:31 +02:00
Kumar Gala
9d4cdd732e drivers: can: mcux_flexcan: Convert from Kconfig to DT_NODELABEL
As we phase out per instance Kconfig symbols convert to utilize
DT_DRV_INST to initialize CAN instances.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 10:08:31 +02:00
Ioannis Glaropoulos
9b09f136f7 bluetooth: hci_rpmsg: check SHM_SIZE against shared mem size using DT
Add a build-time assert to check that the configured SHM_SIZE
does not exceed the memory allocated as shared memory. USe DT
to extract the shared memory size.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-05-07 10:07:00 +02:00
Adam Serbinski
26be827af8 flash: sam0: set write_block_size=1 when EMULATE_BYTE_PAGES is set
The sam0 has a page size of 64 bytes, making it incompatible with
the nvs driver that specifies a maximum write block size of
32 bytes. When CONFIG_SOC_FLASH_SAM0_EMULATE_BYTE_PAGES is set,
it should report a write block size of 1 byte, which is compatible
with nvs.

Signed-off-by: Adam Serbinski <aserbinski@gmail.com>
2020-05-07 10:06:17 +02:00
Kumar Gala
95b8355dd4 drivers: counter_mcux_gpt: Fix compile error
Return order to fix issue with __device_mcux_gptX' being undeclared.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 02:59:43 -05:00
Peter Bigot
7e35983977 drivers: flash: spi-nor: correct index into array property value
The dpd-wake-sequence has a value that is an array of three integers,
which was formerly indexed by a suffix on the property name.  This was
updated to new accessors but failed to separate the index from the
property name.  Update the access idiom.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-07 00:59:29 -05:00
Kumar Gala
a58777e251 drivers: dma: atmel_sam0: Convert to use devicetree macros for dma dev
Convert to using DT_INST_LABEL() in the dma driver and convert dma users
to use the DMA property macros to get the dma controller name.  We make
the assumption in the drivers that there is a single DMA controller
instance.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 00:49:32 -05:00
Kumar Gala
99d14e9075 adc: adc_shell: Fix compile error
Had an extra comma between macro and macro usage that casued the
following compile error:

	adc_shell.c:477:22: error: expected expression before ',' token

Easy fix to remove trailing comma in ADC_SHELL_COMMAND

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-06 23:56:33 -05:00
Vincent Wan
da60111949 drivers: spi: cc13xx_cc26xx: remove usage of CONFIG_SPI_0/1
Clean up as we wish to move away from using these Kconfig settings.
Also removing them from the boards' default config.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-06 17:48:13 -05:00
Martí Bolívar
87e1743ae0 devicetree: replace DT_HAS_DRV_INST with DT_INST_FOREACH
Make drivers multi-instance wherever possible using DT_INST_FOREACH.
This allows removing DT_HAS_DRV_INST in favor of making drivers just
do the right thing regardless of how many instances there are.

There are a few exceptions:

- SoC drivers which use CMake input files (like i2c_dw.c) or otherwise
  would require more time to convert than I have at the moment. For the
  sake of expediency, just inline the DT_HAS_DRV_INST expansion for
  now in these cases.

- SoC drivers which are explicitly single-instance (like the nRF SAADC
  driver). Again for the sake of expediency, drop a BUILD_ASSERT in
  those cases to make sure the assumption that all supported SoCs have
  at most one available instance is valid, failing fast otherwise.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-06 17:35:08 -05:00
Martí Bolívar
763a9433a7 counter: mcux_gpt: whitespace cosmetics
Discovered when making unrelated changes.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-06 17:35:08 -05:00
Alex Porosanu
f4c36b7beb drivers: pwm: add driver for NXP Kinetis TPM module
The TPM (Timer/PWM Module) is a 2- to 8-channel timer which supports
input capture, output compare, and the generation of PWM signals to
control electric motor and power management applications.

This patch adds the driver and the binding necessary for instantiating
the driver. The work is based on the RV32M1 driver for TPM done by
Henrik Brix Andersen. A later patch will enable this driver to be used
for the KW41Z SoC, if PWM support is requested.

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2020-05-06 11:33:37 -05:00
Pauli Salmenrinne
30003ffb86 drivers: serial: stm32: Support for parity in DTS for STM32 uart.
Add support for devicetree property 'parity' for stm32 serial devices.

Signed-off-by: Pauli Salmenrinne <susundberg@gmail.com>
2020-05-06 11:00:12 -05:00
Pete Johanson
91d6139338 boards: arm: nucleo_wb55rg: Enable USB for stm32wb.
* Define USB driver for base stm32wb device.
* Enable USB for the nucleo_wb55rg board.
* Properly initialize USB power + clock for the platform.

Signed-off-by: Pete Johanson <peter@peterjohanson.com>
2020-05-06 10:46:23 -05:00
Armando Visconti
fb815c65eb drivers/sensors: ism330dhcx: use endop bit in shub wait_completed
Use the endop bit in the status register (instead of using a k_sleep)
to wait until the current shub operation is completed.

Please note that the recent changes to k_sleep() API was also
breaking the compilation.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-05-06 10:33:07 -05:00
Kumar Gala
fdd85d5ad7 dts: Rename DT_HAS_NODE macro to DT_HAS_NODE_STATUS_OKAY
Rename DT_HAS_NODE to DT_HAS_NODE_STATUS_OKAY so the semantics are
clear.  As going forward DT_HAS_NODE will report if a NODE exists
regardless of its status.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-06 05:25:41 -05:00
Alexander Wachter
464f135ce6 canbus: Convert canbus driver and subsys to new timeout API
Convert all canbus related API/samples/tests/subsys
to the new timeout API with k_timeout_t.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-05-06 10:19:13 +02:00
Piotr Mienkowski
637dd67c66 drivers: i2s: fix i2s_handlers.c
Fix syntax error in i2s_handlers.c causing compile time error.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2020-05-06 09:47:42 +02:00
Kumar Gala
26bfddf1ee drivers: i2c: i2c_dw: Move to devicetree detection
We can utilize the devicetree macros to determine which instances to
enable.  This will allow us to phase out the per instance Kconfig
symbols.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-05 14:44:25 -05:00
Stephanos Ioannidis
2a710b1372 Revert "drivers: dma: sam0: fix DMA to peripheral transfer on SAMD5x"
This reverts commit 90cc723e65.

Using `DMAC_CHCTRLA_TRIGACT_BLOCK` breaks SERCOM UART peripheral DMA
operations (DMA-based asynchronous UART transmit operation only sends
the first byte and does not proceed any further).

The `DMAC_CHCTRLA_TRIGACT_BURST` with `DMAC_CHCTRLA_BURSTLEN(0)` is a
special case utilising the "internal FIFO", according to the datasheet
(see DS60001507E; 22.6.2.8), and should always be specified for
peripheral data transfer operations.

Also it is worth noting that Atmel and other third-party drivers use
the aforementioned "internal FIFO" configuration for peripheral data
transfers as well.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-05 13:53:49 -05:00
Abe Kohandel
8c7f63cf8d drivers: dma: stm32: DMA V1 channel direction
The channel direction for a V1 DMA is not allowed to be memory to memory
and there is a check in place for this. However, the check is being
performed on the stream prior to actually configuring the stream. This
results in the check always failing regardless of the channel direction.

The check has been modified to be performed on the incoming
configuration.

Signed-off-by: Abe Kohandel <abe@electronshepherds.com>
2020-05-05 13:48:09 -05:00
Henrik Brix Andersen
a638dc0a57 drivers: i2c: bitbang: fix repeated start condition
Fix I2C bit banging REPEATED START condition function by ensuring both
SDA and SCL are high before generating the REPEATED START.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-05 20:02:43 +02:00
Henrik Brix Andersen
d9c4b6f2d6 drivers: i2c: bitbang: fix stop condition
Fix I2C bit banging STOP condition function to not create a stray
START condition if SDA is high on entry. Instead, set SDA to LOW
before generating the STOP condition.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-05 20:02:43 +02:00
Kumar Gala
81e44f005e drivers: pwm: Remove per instance Kconfig symbols
There are now no users of the per instance Kconfig symbols so we can now
remove them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-05 12:46:57 -05:00
Francois Ramu
41df1c9380 drivers: dma: Enable dma and dmamux on stm32
This patch prepares the dma and introduces the dmamux on soc series
which supports this feature for memory/periph transfers.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-05 11:51:25 -05:00
Maureen Helm
d898ada917 drivers: kscan: Add debug logging output to ft5336 driver
Adds debug logging for row, column, and pressed values read in the
ft5336 touch controller driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-05 11:08:02 -05:00
Martin Jäger
e55483495e drivers: pinmux: stm32: Complete STM32F0 series
Fix some wrong assignments for SPI2 and add all other alternative
functions for USART, I2C, SPI and CAN according to STM32F091VC
datasheet, which is at the top end of this series.

https://www.st.com/resource/en/datasheet/stm32f091vc.pdf

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-05-05 11:06:47 -05:00
Gerard Marull-Paretas
c6b1375400 drivers: pwm: stm32: remove remaining Kconfig instances
Following other drivers, Kconfig based instances are now entirely
removed. In order to do this change, PWM nodes in board DT files have
been given a pwm{N} label so that both:

- DT API checks such as #if DT_HAS_NODE(DT_NODELABEL(pwmN)) can be
  used (N being PWM instance number).
- DT references can be written as pwms = <&pwmN x y>; instead of
  pwms = <&{/soc/timers@XXXXXXXX/pwm} x y>;

This approach is also used on the Linux Kernel.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-05-05 10:52:51 -05:00
Henrik Brix Andersen
f90f5d8da8 drivers: i2c: i2c_gpio: reformat comment
Reformat comment describing the I2C GPIO bit banging pre-requisites to
improve readability.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-05 10:17:23 -05:00
Henrik Brix Andersen
911b6a0e9f drivers: i2c: gpio: convert to using devicetree for instances
Convert the GPIO bit banging I2C controller driver to use devicetree
bindings for configuring instances.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-05 10:17:23 -05:00
Benjamin Valentin
8a99bd0da8 drivers: spi: spi_sam0: fix spi_sam0_fast_txrx()
The optimisation in `spi_sam0_fast_txrx()` is broken, loading
two bytes into the `DATA` register in rapid succession will lose
one byte.

This can be observed by running `tests/drivers/spi/spi_loopback`.
The test will get stuck in `spi_sam0_fast_txrx()` forever waiting
for the final byte.

Undo this small optimisation and only load the next byte into the
`DATA` register after the response has been received.

This fixes `tests/drivers/spi/spi_loopback`.

Signed-off-by: Benjamin Valentin <benpicco@googlemail.com>
2020-05-05 09:58:29 -05:00
Kumar Gala
b04b399d63 drivers: pwm: nrfx: Convert to use DTS NODELABEL for instance detection
Move to using NODELABEL references to enable driver instances for
PWM0..3.  This will allow us to remove per-instance PWM Kconfig symbols.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-05 08:40:19 -05:00
Francisco Munoz
51e82855b7 drivers: ps/2: Tune PS2 driver to support severval mice brands
The PS/2 driver was enabled with a single mouse and kb brand.
However, when plugging other mice brands, the interaction between the
driver and the device(mouse) was broken. A delay after inhibithing
the PS/2 instance helped the internal FSM to start the TX process.

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@intel.com>
2020-05-04 17:03:49 -05:00
Manivannan Sadhasivam
f619cbc6fb lora: sx1276: Add missing RtcTick2Ms function definition
RtcTick2Ms function is required for upcoming LoRaWAN support. Hence,
add definition for it.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-05-04 19:01:09 +02:00
Manivannan Sadhasivam
7be8debaab lora: Switch to new timeout API
Get rid of legacy timeout API and move to new timeout API for LoRa.
This involves changes to API, SX1276 driver and sample application.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-05-04 19:01:09 +02:00
Manivannan Sadhasivam
0f02adfb0e lora: Make the LoRa support Experimental
The LoRa APIs are expected to undergo some change as the usecase get's
increased. So let's mark it as experimental until the APIs got
stabililized.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-05-04 19:01:09 +02:00
Manivannan Sadhasivam
e177ab6c42 drivers: lora: Get rid of counter support
The RTC/Counter implementation doesn't fit for the upcoming LoRaWAN
as most of the Counter drivers in Zephyr works with 1s granularity
which is not enough for LoRaWAN stack. So, k_timer calls are used in
place of Counter's alarm and k_uptime_get() APIs are used in place of
Counter's time keeping.

While at it, lets also fixup the broken alarm implementation.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-05-04 19:01:09 +02:00
Kumar Gala
dff8715615 drivers: ethernet: sam_gmac: rework pin config
Reworked sam_gmac driver to get pin ctrl/mux configuration information
from the device tree instead of via Kconfig and defines in soc_pinmap.h

We remove defines from soc_pinmap.h that are no longer needed due to
getting all that information from devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 11:32:10 -05:00
Francois Ramu
469e505278 drivers: spi: control of the dma callback on spi client for stm32
The DMA callback function now controls the tx or rx buffers
and reload dma in case of multiple trnasfer before the transfer ends

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-04 09:46:07 -05:00
Francois Ramu
ce093dc35e drivers: spi: Enable dma transfer for SPI on stm32
Enable dma operations with or w/o a dmamux on STM32
for SPI periph/memory operations.
Use the pi dma client with dma macros

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-04 09:46:07 -05:00
Francois Ramu
bea0a95578 drivers: dma: stm32 dma_reload function must re-enable
This patch is disabling the dma channel before reloading
source and dest for memory and peripheral addresses
Then the channel is enabled to re-launch the transfer.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-04 09:46:07 -05:00
Kumar Gala
024ea0e44e adc: Kconfig: Remove per instance ADC_{0..2} Kconfig symbols
No code utilizes CONFIG_ADC_{0..2} so we can now remove the Kconfig
sybmols for them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 09:04:16 -05:00
Kumar Gala
897652a536 adc: adc_shell: Rework device name extraction from devicetree
Replace having dts_fixup.h files define DT_ADC_{0..2}_NAME with using
the new devicetree.h macros.  We test to see what driver compat is
enabled via DT_HAS_COMPAT and set DT_DRV_COMPAT to that compat.  Than we
can utilize the DT_INST_LABEL() macro to extract the name of the device.

We also replace the Kconfig ADC_{0..2} symbols with DT_HAS_DRV_INST.
This will allow us to remove those Kconfig symbols as this was the only
usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-02 10:27:07 -05:00
Jukka Rissanen
5a105a67af drivers: eth: gmac: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 14:19:18 -05:00
Henrik Brix Andersen
7ede80be46 tests: boards: board_shell: enable DAC commands
Enable DAC commands in the board_shell test application.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-05-01 12:35:50 -05:00
Henrik Brix Andersen
8a5ba4539c drivers: dac: add DAC shell commands
Add shell commands for controlling digital-to-analog (DAC) devices.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-05-01 12:35:50 -05:00
Henrik Brix Andersen
a0d88a61e9 drivers: dac: add driver for the NXP Kinetis DAC
Add driver shim for the NXP Kinetis Digital-to-Analog (DAC) module.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-05-01 12:35:50 -05:00
Henrik Brix Andersen
20b565a9f3 drivers: dac: add driver for the NXP Kinetis DAC32
Add driver shim for the NXP Kinetis Digital-to-Analog (DAC32) module.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-05-01 12:35:50 -05:00
Kumar Gala
1ce133d0fe drivers: usb: usb_dc_stm32: Rename defines to remove DT_ prefix
We want to limit DT_ prefix to macros from devicetree.h and generation.
So rename DT_USB* to just USB*.

Also fixup how USB_MAXIMUM_SPEED was defined.  We should only define it
if the property exists.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-01 07:49:00 -05:00
Jukka Rissanen
0576ce813f driver: modem: wncm14a2a: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen
db9b47f6fa drivers: ieee802154: mcr20a: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen
affe21c826 driver: wifi: eswifi: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen
104ffabab2 driver: eth: enc28j60: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen
7929f6c197 driver: eth: smsc911x: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen
a921091f4e driver: eth: mcux: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen
d5d31ef0c4 driver: eth: enc424j600: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Peter Bigot
52885d0576 coccinelle: run ms_timeout conversion semantic patch
Substitute integral constants where call sites passed named constants
that have timeout values as arguments to parameters that expect
millisecond durations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-30 18:26:26 +02:00
Henrik Brix Andersen
9ceb29ac56 dts: introduce shared binding for the NXP FlexTimer
Do not assume in the SoC level device trees that NXP Kinetis FlexTimer
nodes will always be configured as PWM. Instead, configure FlexTimer
nodes for PWM at the board level for NXP Kinetis boards.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-04-30 08:28:48 -05:00
Gerson Fernando Budke
351719ae0f drivers: wifi: esp: Add esp at version choice name
Add WIFI_ESP_AT_VERSION choice name to allows select version on
*.defconfig files.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-30 16:08:35 +03:00
Erwan Gouriou
de9fd59669 drivers/bluetooth: stm32wb: Fix loop
The goto instruction was removed when adding the RX thread.
While still working, this clearly break the clean handling of
error cases.
Re-instantiate the goto instruction.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-30 13:34:15 +02:00
Erwan Gouriou
73a19d4d20 drivers/bluetooth: stm32 ipm: Fix mutex on shared memory
ipm_busy is meant to be used as mutex on transport layer accesses.
Due to wrong configuration on rx_thread, imp_busy was a no-op.
Fix this.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-30 13:34:15 +02:00