Commit graph

7366 commits

Author SHA1 Message Date
Martí Bolívar 07044c621b drivers: ethernet: clean up sam_gmac Kconfig
Use the new path access helpers to avoid hard-coding devicetree paths
in Kconfig, which is a bit messy.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-28 12:11:14 -05:00
Joakim Andersson e9375a2814 Bluetooth: Remove bluetooth thread stack size analysis
Remove logging of individual threads spread out throughout the
bluetooth subsystem. The stacks can be analysed by enabling the
following options.

CONFIG_THREAD_ANALYZER=y
CONFIG_THREAD_ANALYZER_AUTO=y
CONFIG_THREAD_ANALYZER_RUN_UNLOCKED=y
Optional:
CONFIG_THREAD_NAME=y

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-28 09:11:13 -04:00
Daniel Leung 13ef99831a drivers: gpio: mchp_xec: Convert to using new device tree macros
Convert driver to use the new device tree macro's instead of
dts_fixup.h based macros. This moves us closer to removing both
dts_fixup.h and per instance Kconfig symbols.

The pinmux_mchp_xec is also being updated since it's using DT
from GPIO.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-04-28 07:43:31 -05:00
Daniel Leung 5692702248 drivers: pinmux: mchp_xec: Convert to using new device tree macros
Convert driver to use the new device tree macro's instead of
dts_fixup.h based macros. This moves us closer to removing both
dts_fixup.h and per instance Kconfig symbols.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-04-28 07:43:31 -05:00
Daniel Leung f59d56b534 drivers: spi: xec_qmspi: Convert to using DT_INST macros
Convert driver to use instance macro's instead of dts_fixup.h based
macros.  This moves us closer to removing both dts_fixup.h and per
instance Kconfig symbols.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-04-28 07:43:31 -05:00
Gerson Fernando Budke 9be1ba9e08 drivers: ieee802154: rf2xx: Add no auto start option
Add a Kconfig option that allows user to set any necessary config
using management interface before interface be operational. A use
case is set the EUI-64 address from an external EEPROM by the
NET_REQUEST_IEEE802154_SET_EXT_ADDR command. After all configs
are done net_if_up() can be invoked to bring interface up.

Fixes #23193.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-28 10:30:55 +03:00
Gerson Fernando Budke c755821608 drivers: ieee802154: rf2xx: Add local-mac-address
Add local-mac-address on DT and enable it on rf2xx driver. If user
define local-mac-address this value will be used as default mac address.
Otherwise driver automatically add a random mac address.

On application level user can change default mac address using net_mgmt
command with NET_REQUEST_IEEE802154_SET_EXT_ADDR parameter defined on
include/net/ieee802154_mgmt.h header.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-28 10:30:55 +03:00
Kumar Gala 7a15afc1d4 drivers: flash: replace DT_FLASH_DEV_NAME with DT macro
Replace DT_FLASH_DEV_NAME with DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL.
We now set zephyr,flash-controller in the chosen node of the device
tree to the flash controller device.

NOTE: For a SoCs with on die flash, this points to the controller and
      not the 'soc-nv-flash' node.  Typically the controller is the
      parent of the 'soc-nv-flash' node).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-27 18:43:20 -05:00
Erwan Gouriou 57a74653df drivers/bluetooth: ipm_stm32: Implement a RX thread
Fasten events handling by unloading callback treatment.
A RX thread is created. IPM RX events are dumped in a FIFO
which is processed in the thread context.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-27 19:02:14 +02:00
Vincent Wan 2599f705a8 drivers: cc32xx: use DT_INST_FOREACH to reduce code duplication
Use DT_INST_FOREACH macro to combine code used for multiple instances.
Remove unnecessary Kconfig options and dts fixups for GPIO instances.

A side-effect to using DT_INST_FOREACH is that GPIO ports A0 and A3
are now enabled, whereas they were originally disabled by default as
an optimization.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-04-26 06:05:10 -05:00
Vincent Wan 720ed0b15e drivers: cc32xx: Convert drivers to use more new DT_INST macros
Changing more of DT_* prefixed macros that refer to instances to use
DT_INST macros in GPIO, I2C and UART drivers.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-04-26 06:05:10 -05:00
Kumar Gala a49817d17e arm: Convert DT_DTCM_* to new devicetree.h macros
Convert various DT_DTCM_* macros to use DT_CHOSEN(zephyr_dtcm) and
associated macros from devicetree.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-26 06:04:46 -05:00
Kumar Gala 1192e32dac drivers: pinmux: sam0: Conver to new DT macros
Convert pinmux driver to use nodelabels to get references to devicetree
nodes using the new devicetree.h macros.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-25 13:47:39 -05:00
Kumar Gala 7249bfbc04 drivers: gpio: sam0: Convert to new DT macros
Convert gpio driver to use nodelabels to get references to devicetree
nodes using the new devicetree.h macros.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-25 13:47:10 -05:00
Kumar Gala 8eafcc32db drivers: counter: sam0_tc32: rework devicetree support
Rework the devicetree to utilize new DT_INST macros and extract per
instance data for clocks from devicetree.  Move the prescaler setting
from Kconfig to devicetree as well.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-25 13:33:56 -05:00
Kumar Gala 8aeb8a3814 soc: xtensa: rework DT_L2_SRAM and DT_L2_SRAM
Rename DT_L2_SRAM_* to just L2_SRAM_* and set it using new DT macros.
Do something similar for DT_LP_SRAM_* renamed to LP_SRAM_*

Updated the intel_gna driver as it used the DT_L2_SRAM_* defines.

This change also lets us remove dts_fixup.h on intel_s1000 and
intel_apl_adsp SoCs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-25 09:32:00 -05:00
Kumar Gala aa63b07019 drivers: spi: spi_sam0: rework devicetree support
Rework the devicetree to utilize new DT_INST macros and extract per
instance data for clocks and dma from devicetree.  We update the
atmel,sam0-spi binding for dma to replace the rxdma and txdma
properties with proper 'dmas' property.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-25 09:30:16 -05:00
Kumar Gala b8ade7856d drivers: i2c: i2c_sam0: rework devicetree support
Rework the devicetree to utilize new DT_INST macros and extract per
instance data for clocks and dma from devicetree.  We update the
atmel,sam0-i2c binding for dma to replace the dma property with
proper 'dmas' property.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-25 09:30:16 -05:00
Kumar Gala dbeb3ba32e drivers: spi: spi_sam: rework device tree support
Reworked spi_sam driver to utilize new DT_INST macros as part of
this rework we also now get pin ctrl/mux configuration information
from the device tree instead of via Kconfig and defines in soc_pinmap.h

We remove defines from dts_fixup.h and soc_pinmap.h and associated
Kconfig symbols that are no longer needed due to getting all that
information from devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-25 09:29:54 -05:00
Martí Bolívar 11fbc0b2fa drivers: i2c: nordic: move to new DT API
Keep existing per-instance Kconfig options around.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-24 19:46:18 +02:00
Martí Bolívar df8be2d2e0 drivers: i2c: nordic: cosmetics
Adjust whitespace.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-24 19:46:18 +02:00
Martí Bolívar eca99d810f drivers: watchdog: nordic: move to new DT API
Straightforward API conversion only.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-24 19:35:41 +02:00
Ryan Erickson 6243557e5f drivers: nrf: uarte: check if RXSTARTED before issue STOPRX
Only issue STOPRX is RX has started.
This prevents getting stuck in while loop.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-04-24 19:34:50 +02:00
Erwan Gouriou 5776c82c85 drivers/timer: stm32_lptim: Move to new DT api
Use NODELABEL macros rather than DT_INST as this driver is so far
limited to support of LPTIM1 instance.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-24 12:09:17 -05:00
Kumar Gala 7b2fde91d8 drivers: serial: uart_psoc6: Convert to new dt macros
Convert the driver to use the new dt macros.  As part of this change we
remove a bunch of defines that happened in dts_fixup.h that didn't
belong there.  Some of these should be converted to devicetree
properties at some point.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-24 10:57:33 -05:00
Martí Bolívar be84c4ebbf drivers: pwm: nordic: move to new DT API
DT API conversion only.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-24 17:00:13 +02:00
Pawel Dunaj ed5e247f63 drivers: gpio_nrfx: Pass only pins associated with handler
When notifying the handler that GPIO interrupt has occurred
pass only pins that are associated with this handler.

Fixes: #24634

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2020-04-24 16:56:10 +02:00
Mark Olsson 1ca4aedc35 tests: drivers: fixes for failing tests
Tests were failing as they were looking for an alias which didn't exist
Also, because some code in kscan_handlers.c wasn't compilable

Signed-off-by: Mark Olsson <mark@markolsson.se>
2020-04-24 09:49:46 -05:00
Kwon Tae-young 84817f4906 drivers: pinmux: stm32l4: I2C_1, CAN pinmuxes added
Add pin configuration for I2C_1 and CAN.

Signed-off-by: Kwon Tae-young <tykwon@m2i.co.kr>
2020-04-24 06:36:35 -05:00
Kumar Gala 8b6acb5e91 soc: arm: replace DT_CPU_CLOCK_FREQUENCY with new dt macros
Replace DT_CPU_CLOCK_FREQUENCY with a PATH based reference to cpu@0
(DT_PATH(cpus, cpu_0)) and than getting the clock_frequency property:

DT_CPU_CLOCK_FREQUENCY -> DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency)

This lets us remove DT_CPU_CLOCK_FREQUENCY from dts_fixup.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-23 23:55:37 -05:00
Vincent Wan 0915ccca46 drivers: cc13xx_cc26xx: use DT_INST_FOREACH to reduce code duplication
Use DT_INST_FOREACH macro to combine code used for multiple instances.
Remove unnecessary Kconfig options for UART instances.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-04-23 17:29:53 -05:00
Vincent Wan 984988285b dts: bindings: cc13xx-cc26xx: add port info for uart tx and rx pins
Adding port information for uart tx and rx pins in dts, so that it can
be more systematically retrieved in the uart driver.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-04-23 17:29:53 -05:00
Vincent Wan 9d89ce1d6d drivers: cc13xx_cc26xx: Convert drivers to use more new DT_INST macros
Changing more of DT_* prefixed macros that refer to instances to use
DT_INST macros.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-04-23 17:29:53 -05:00
Kumar Gala 22e65cb9ba gpio: mcux: Convert convert to DT_INST defines
Convert driver to use DT_INST_ defines.  As part of this conversion we
remove the Kconfig options for per GPIO controller enables and instead
get that information from device tree.  This means we now disable each
GPIO controller by default in the DTS and have each board dts enable the
GPIO controller ports it needs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-23 17:07:41 -05:00
Andrzej Głąbek 7e050b4bd3 drivers: uart_nrfx_uarte: Fix implementation of uart_irq_tx_ready()
Although it is not clearly specified in the UART API, this function
is supposed to return 0 when the TX interrupt is disabled, regardless
of whether anything could fit into the TX buffer or not (this can be
concluded from looking at implementations of several samples and tests
present in the tree, also almost all UART drivers are implemented this
way).

The problem in the uart_nrfx_uarte driver case is that the flag that
allows generation of the TX interrupt is not cleared directly in the
uart_irq_tx_disable() function but this clearing is deferred to the
end of the current transmission, in case one is in progress, and hence
it is done in the interrupt handler. Consequently, when the interrupt
handler is not entered between calls to uart_irq_tx_disable() and
uart_irq_tx_ready() (e.g. when both functions are called in a loop
executed in the interrupt context), the latter may return an invalid
value.

Fix this problem by additionally checking if the TX interrupt was
requested to be disabled, not only if it is already disabled in
hardware.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-04-23 18:24:07 +02:00
Venkataramana Kotakonda e34133cd2c driver: espi: Re-enable bus interrupts after espi reset.
Espi bus interrupts need to re-enable after espi reset to get
all espi bus and vw signal interrupts.

Signed-off-by: Venkataramana Kotakonda <venkataramana.kotakonda@intel.com>
2020-04-23 18:22:49 +02:00
Venkataramana Kotakonda 7eccdf7b5c driver: espi: Enable OOB_RST_WARN virtual wire interrupt.
Epsi slave need to respond with an OOB_RST_ACK for OOB_RST_WARN sent by
master during host reset. Enable interrupt for OOB_RST_WARN to receive
signal changes and respond with ACK.

Signed-off-by: Venkataramana Kotakonda <venkataramana.kotakonda@intel.com>
2020-04-23 18:22:49 +02:00
Tobias Svehagen 688f506d4b drivers: spi: sifive: Fix bug with checking if tx fifo is full
The check of the SF_TXDATA_FULL flag is only done on the register
address and not on the actual register content.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-04-23 17:28:48 +02:00
Kumar Gala 9c6c1f966c drivers: ethernet: eth_mcux: Convert to using DT_INST macros
Convert driver to use instance macro's instead of dts_fixup.h based
macros.  This moves us closer to removing both dts_fixup.h and per
instance Kconfig symbols.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-23 07:40:37 -05:00
Kumar Gala 94fcf2efa1 drivers: adc: adc_sam_afec: rework device tree support
Reworked adc_sam_afec driver to utilize new DT_INST macros as part of
this rework we also now get pin ctrl/mux configuration information
from the device tree instead of via Kconfig and defines in soc_pinmap.h

We remove defines from dts_fixup.h and soc_pinmap.h and associated
Kconfig symbols that are no longer needed due to getting all that
information from devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-23 06:11:26 -05:00
Kumar Gala 085747e5fb drivers: usb: usb_dc_sam: Convert to DT_INST macros
Convert driver to use new DT_INST macros throughout.  We also remove
defines in dts_fixup.h as they are no longer needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-23 06:10:07 -05:00
Kumar Gala a3ec95caef drivers: gpio: gpio_sam: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.  We update one
sample app to use a nodelabel reference.  We also remove defines in
dts_fixup.h as they are no longer needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-23 05:59:50 -05:00
Kumar Gala 22a41e4eb7 drivers: usb: usb_dc_stm32: Convert DT_COMPAT_ define usage to new macros
Convert driver from using DT_COMPAT_ST_STM32_* to new macro
DT_HAS_COMPAT(st_stm32_*).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-23 05:58:17 -05:00
Kumar Gala 5999787e6e drivers: spi: spi_stm32: Convert DT_COMPAT_ define usage to new macros
Convert driver from using DT_COMPAT_ST_STM32_SPI_FIFO to new macro
DT_HAS_COMPAT(st_stm32_spi_fifo).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-23 05:58:17 -05:00
Kumar Gala bd639fc332 drivers: serial: uart_sam0: rework devicetree support
Rework the devicetree to utilize new DT_INST macros and extract per
instance data for clocks and dma from devicetree.  We update the
atmel,sam0-uart binding for dma to replace the rxdma and txdma
properties with proper 'dmas' property.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-22 21:34:21 -05:00
Anthony Brandon 7dd4cc5821 sensor: si7006: combined RH/T measurements
The Si7006-A20 rev. 1.2 datasheet, section 5.1.2. Measuring Temperature
says that:

"Each time a relative humidity measurement is made a temperature
measurement is also made for the purposes of temperature compensation of
the relative humidity measurement. If the temperature value is required,
it can be read using command 0xE0; this avoids having to perform a
second temperature measurement."

Respective improvement is implemented.

Signed-off-by: Max Payne <forgge@gmail.com>
Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
2020-04-22 15:51:15 -05:00
Max Payne 0bc4370689 sensor: si7006: fixed temperature conversion
The driver was incorrectly converting the temperature samples. According
to Si7006-A20 rev. 1.2 datasheet, section 5.1.2. Measuring Temperature,
the offset -46.85 must be applied.

Signed-off-by: Max Payne <forgge@gmail.com>
Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
2020-04-22 15:51:15 -05:00
Jose Alberto Meza 9538f7896e drivers: espi: xec: Add support for eSPI flash channel
Add driver implementation to support flash read/writ transactions
over eSPI bus.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-04-22 22:21:54 +02:00
Kamil Rakoczy 415065a5f3 Sensor: ADXL345: Fix ADXL345 driver
Fixes problems with ADXL345 3-axis I2C accelerometer
reported in #23577, #23581 and #23584.

Signed-off-by: Kamil Rakoczy <krakoczy@antmicro.com>
2020-04-22 19:28:47 +02:00
Kamil Rakoczy f0ffe33dfe Sensor: ADXL345: Fix ADXL345 device address
Fixes bad device address passed to i2c_reg_write_byte/i2c_reg_read_byte.

Signed-off-by: Kamil Rakoczy <krakoczy@antmicro.com>
2020-04-22 19:28:47 +02:00
Henrik Brix Andersen b29c15ed09 drivers: gpio: mcux_igpio: fix infinite loop
Avoid entering an infinite loop when configuring the the IGPIO IRQ.

Fixes 50129f8dd7
Fixes #24579

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-04-22 12:27:11 -04:00
Krzysztof Chruscinski 10d15d185b drivers: timer: nrf_rtc: Refactor alarm setting
User reported a flaw in the current algorithm which fails when Zero
Latency Interrupts (ZLI) are used. Ported algorithm from
counter_nrfx_rtc.c which covers all cases. Algorithm is lockless so
no distinction for ZLI is needed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-04-22 17:45:07 +02:00
Sven Herrmann bded58cee5 Sensor: mpr: Add Honeywell MPR driver
The Honeywell MPR sensor is a piezoresistive silicon pressure sensor,
which can be accessed via i2c.

https://sensing.honeywell.com/micropressure-mpr-series

Signed-off-by: Sven Herrmann <sven.herrmann@posteo.de>
2020-04-22 17:39:31 +02:00
Aurelien Jarno 298df51c0c drivers: pinmux: stm32l4: Add extra pins for I2C1
Add I2C1 SDA/SCL configuration on pins PA9 and PA10, as they are
currently only available on other pins.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2020-04-22 17:39:12 +02:00
Immo Birnbaum f88923a2ff drivers: serial: Xilinx UART run-time config, interrupt functionality
The driver was extended so that the tests/drivers/uart/uart_basic_api
test case now passes. The following modifications were made for the
following items of the test case:

* test_uart_configure
* test_uart_config_get

The driver was missing the support to re-configure the UART at run-time
as well as to obtain the current configuration at run-time via the
.configure and .config_get hooks provided within the UART driver API.
For the flow control setting, bit (mask) definitions were added for the
Modem Control Register. Both the configuration get and set functions
come with auxiliary functions that convert configuration register bit
masks to the UART driver API's enumeration types and vice versa.

For run-time configurability, the device's data struct is required un-
conditionally, previously, it was only available whenever interrupt-
driven mode was enabled. Consequently, the device initialization was
simplified to a single call of the DEVICE_AND_API_INIT macro, as the
existance of the device's data struct is now no longer conditional.

* test_uart_fifo_fill

For the user callback function of the test case to receive the initial
'Ready to TX' indication upon which the TX FIFO is filled, it is
necessary that uart_xlnx_ps_irq_tx_enable also sets the TX FIFO empty
bit in the Interrupt Enable Register. Consequently, the same modifi-
cation applies to the irq_tx_disable function.

* test_uart_fifo_read

During inital device configuration, the RX FIFO interrupt trigger
level has to be set to 1 byte for now, as the test case doesn't poll
the incoming data in a while()-loop, therefore, it misses the CR/LF
if more than one character is in the RX FIFO at the time of the
interrupt and neither CR nor LF is the first character.

Whenever the state of an interrupt is checked by the user callback
function (uart_xlnx_ps_irq_tx_ready, uart_xlnx_ps_irq_rx_ready),
the corresponding bits are cleared in the Interrupt Status Register,
re-enabling interrupts generated by the corresponding source.

Tested on QEMU (R5, A9) and actual Zynq7000 hardware.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2020-04-22 17:36:58 +02:00
Immo Birnbaum 80647b583f drivers: serial: Xilinx UART driver interrupt support feature flag
Added the SERIAL_SUPPORT_INTERRUPT feature flag to the driver's
configuration file. This flag was missing, although the driver
supports interrupt-driven operation.

Interrupt support is required for testcases using the UART_PIPE
feature on the upcoming Cortex-A9 targets (QEMU/Zynq-7000).

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2020-04-22 17:36:58 +02:00
Immo Birnbaum 24f3bce4f3 drivers: serial: Xilinx UART driver IRQ connect macro fix
Fix for the UART_XLNX_PS_IRQ_CONF_FUNC macro, which wraps IRQ_CONNECT
into a function for each device instance. This macro had device
instance #0 hardcoded at one point.

Interrupt support is required for test cases using the UART_PIPE
feature on the upcoming Cortex-A9 targets (QEMU/Zynq-7000).

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2020-04-22 17:36:58 +02:00
Peter Bigot 736860ac90 drivers: hwinfo: update mcux-sim implementation byte order
Following the practice for i.MX decoding assume the 32-bit identifier
values need to be converted to big-endian representation for
device-independent interpretation.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-22 17:31:56 +02:00
Peter Bigot 1668c21e17 drivers: hwinfo: update i.MX implementation byte order
Resources indicate that CFG2 holds the upper 32 bits, and CFG1 the
lower 32 bits, of a 64-bit unique identifier.  Store it in big-endian
format so it reads correctly when accessed as a byte sequence.

https://community.nxp.com/docs/DOC-94459

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-22 17:31:56 +02:00
Martí Bolívar a95e7c5424 drivers: uart: nordic: move to new DT API
Keep existing Kconfig in place.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-22 17:27:42 +02:00
Marc Reilly cf7dd4981f drivers: serial: nrf uarte: avoid dropping RX chars/overruns
In some cases (eg at high baud rate, no HW flow control, and when BLE
radio/ints running) data could be lost between when enough characters
have been RX'd to fill the DMA buffer and when the ENDRX event was
fired, where the the STARTRX task is invoked to start filling the next
buffer (which is set up earlier, but I think will not be filled until
STARTRX).
To fix this, the SHORT is enabled between ENDRX and STARTRX whenever the
'next' buffer is available, so that STARTRX is invoked automatically and
subsequent chars go into the next buffer via EasyDMA.
To make this work properly, uarte_nrfx_isr_async() now handles the ENDRX
event _before_ the STARTRX event.

There was also an issue in rx_timeout() where the received character
count (rx_total_byte_count) could be incremented greater than the actual
buffer size. This arises from rx_total_byte_count value coming from the
counting the RXDRDY events (either by PPI/timer counter or counting the
RXDRDY ints themselves) and so if chars are received in the rx_timeout()
(or before ENDRX is handled) the rx_timeout() could increment rx_offset
past the length of the buffer. This could result the remaining 'len'
being calculated incorrectly (an underflow due to unsigned - signed ,
where signed > unsigned).
To fix this, we now store the lengths of the buffers and don't invoke
the UART_RX_RDY callback when the buffers are full; its handled by
ENDRX.
(Also note that the buffer size should be available via the RXD.MAXCNT
register on the nrf, but this register is not exposed through the nrfx
HAL and is also double buffered, so it seemed clearer to just track the
buffer lengths explicitly here in the driver).

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>

for fixup

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2020-04-22 12:27:32 +02:00
Kumar Gala 45a014a883 drivers: intc: intc_cavs: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.  This allows us to
also remove dts_fixup.h that are no longer used.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-22 04:59:22 -05:00
Kumar Gala e53ddb5037 intc: intc_cavs: Replace DT_CAVS_ICTL_BASE_ADDR with new macros
Replace various drivers and soc code that use DT_CAVS_ICTL_BASE_ADDR
with DT_REG_ADDR(DT_NODELABEL(cavs0)).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-22 04:59:22 -05:00
Kumar Gala 492fbf7bba intc: intc_cavs: Use DTS labels for device names
Replace Kconfig device names with one's that come from device tree like
most all other devices do.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-22 04:59:22 -05:00
Kumar Gala a7e243bea4 drivers: i2c: i2c_sam_twihs: rework device tree support
Reworked i2c_sam_twi driver to utilize new DT_INST macros as part of
this rework we also now get pin ctrl/mux configuration information
from the device tree instead of via Kconfig and defines in soc_pinmap.h

We remove defines from dts_fixup.h and soc_pinmap.h and associated
Kconfig symbols that are no longer needed due to getting all that
information from devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-21 15:46:30 -05:00
Kumar Gala 5f94e593c0 drivers: i2c: i2c_sam_twi: rework device tree support
Reworked i2c_sam_twi driver to utilize new DT_INST macros as part of
this rework we also now get pin ctrl/mux configuration information
from the device tree instead of via Kconfig and defines in soc_pinmap.h

We remove defines from dts_fixup.h and soc_pinmap.h and associated
Kconfig symbols that are no longer needed due to getting all that
information from devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-21 15:46:30 -05:00
Martí Bolívar 18c9c8cf27 drivers: usb_dc_nrfx: move to new DT API
Close out the existing partial conversion to the new DT API.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-21 13:34:22 -05:00
Martí Bolívar 100187cb64 drivers: flash: nordic qspi: finish DT API conversion
Also convert bus node access to the new API.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-21 18:31:08 +02:00
Henrik Brix Andersen 42af963db2 drivers: can: shell: add command for configuring a CAN controller
Add shell command for configuring the mode and bitrate of a CAN
controller.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-04-21 18:26:16 +02:00
Hans Wilmers 5d6770aeea drivers: modem: ublox-sara-r4: implemented sendmsg
Implemented sendmsg

Tested using Sara U201 and the MQTT protocol library.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-04-21 17:37:08 +03:00
Hans Wilmers ed88088ba2 driver: modem: ublox_sara_r4: fixed closing UDP socket
Following issue is addressed in this bugfix:

When using offloaded sockets with modem ublox_sara_r4,
the socket is only closed if it is in connected state
at the time of the function call. When using UDP sockets,
this leads to a socket never being closed.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-04-21 17:37:08 +03:00
Hans Wilmers 71fa7ba5ad drivers: modem: ublox_sara_r4: fixed rssi for Sara U201
Calculation of RSSI was done incorrectly for Sara U201.

When evaluating +CSQ command responses, the RSSI can be calculated
from the first value, which is <signal_strength>. Instead, the
RSSI was calculated from the second value, which is <qual>.
With the subsequent mapping to RSSI, this results in a wrong
value for RSSI.

This is now corrected by using value <signal_strength> to calculate
the RSSI.

Tested using Sara U201.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-04-21 17:37:08 +03:00
Steven Slupsky b39423e0e2 drivers: modem: gpio api and string len
This commit references modem_pin() and modem_shell()

modem_pin(): use new gpio api
The existing pin driver does not respect gpio
configuration in device tree for active high / low
This commit allows for the device tree to determine the
active logic level.

modem_shell(): use correct string length
The ms_send macro uses iface.write() to send a string.
iface.write() requires the length of the string not the
size of the string.
This commit corrects the string length.

drivers: ublox-sara-r4: fix vint polling

This eliminates the implication that the enable and disable values can
be something other than 1 and 0, and fixes the code so it won't enter
an infinite loop if the GPIO read returns an error.

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
2020-04-21 17:02:22 +03:00
Kumar Gala bf0add1a34 drivers: serial: uart_sam0: Fix build error with CONFIG_UART_ASYNC_API
When we build this driver with CONFIG_UART_ASYNC_API enabled we get the
following build error:

uart_sam0.c: In function 'uart_sam0_init':
uart_sam0.c:558:35: error: redefinition of 'dev_data'
  558 |  struct uart_sam0_dev_data *const dev_data = DEV_DATA(dev);
uart_sam0.c:498:35: note: previous definition of 'dev_data' was here
  498 |  struct uart_sam0_dev_data *const dev_data = DEV_DATA(dev);

Fix this be removnig the duplicate at line 558.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-21 08:00:49 -05:00
Kumar Gala 5419a196b1 include/devicetree: dma: rename DMAS CELL macros
The macros should have been DMAS_CELL_ not DMAS_CELLS_ as this matches
the other devicetree macro naming convention.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-21 06:37:28 -05:00
Henrik Brix Andersen cb83b96a60 drivers: serial: mcux_lpuart: fix infinite loop
Avoid entering an infinite loop when configuring the the NXP Kinetis
LPUART IRQ.

Fixes 9a65318a5b.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-04-21 06:37:10 -05:00
Christoph Reiter c523e3606a drivers: i2c: nrfx: Fix log level is ignored
Fixes the problem that the log level set in Kconfig is ignored.

Signed-off-by: Christoph Reiter <christoph.reiter@infineon.com>
2020-04-20 23:55:46 +02:00
Kumar Gala 9a65318a5b drivers: uart: mcux_lpuart: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.  Removed per
instance Kconfig symbols and replaced with DT_NODELABEL references
where needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:50:45 -05:00
Erwan Gouriou 81f27c2265 boards: stm32: Use dt API for serial peripheral configuration
Replace use of Kconfig UART_X symbols by calls to DT API.
Clean driver from symbols definitions

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-20 15:27:56 -05:00
Erwan Gouriou 76313f06db drivers/serial: stm32: Remove calls to CONFIG_LPUART_1
Before removing CONFIG_LPUART_1 symbols in boards, remove its
use in serial driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-20 15:27:56 -05:00
Kumar Gala fac0d7d90e drivers: spi: mcux_lpspi: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:23:47 -05:00
Kumar Gala df302727dc drivers: spi: mcux_flexcomm: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:23:47 -05:00
Kumar Gala 1d33ed3dfc drivers: spi: mcux_dspi: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:23:47 -05:00
Kumar Gala 7a62ab7fdf drivers: i2c: mcux_lpi2c: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:23:47 -05:00
Kumar Gala 97544fb022 drivers: i2c: mcux_i2c: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:23:47 -05:00
Kumar Gala b07596bcea drivers: adc: mcux_adc12: create macro for device instantiation
Create a ACD12_MCUX_INIT macro that we can use with DT_INST_FOREACH for
device instantiation.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:23:47 -05:00
Kumar Gala bc4d12f8c8 drivers: adc: mcux_adc16: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.  We can remove
various defines from dts_fixup.h now as well.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:23:47 -05:00
Kumar Gala 7758f4a6f7 drivers: gpio: gpio_intel_apl: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.  We remove the
aliases and use nodelabel instead in the soc_gpio.h to determine the
label for the specific gpio controller.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:23:11 -05:00
Kumar Gala 576033f858 drivers: pinmux: intel_s1000: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.  This allows us to
also remove dts_fixup.h that are no longer used.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:21:39 -05:00
Peter Bigot 8c749ffc0a drivers: hwinfo: update stm32 implementation byte order
The unique identifier for this platform is a 96-bit value, where the
upper 56 bits provide an ASCII encoding of the lot number, and the
lower 40 bits provide the wafer number and X, Y position on the wafer.
Extract the value into big-endian form for device-independent
interpretation.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-20 19:04:26 +02:00
Viraaj Somayajula e850ced155 gpio: gpio_sx1509b: add support for interrupt functionality
enable the interrupt functionality for sx1509b gpio expander,
when the CONFIG_GPIO_SX1509B_INTERRUPT config is enabled.
The gpio pin used for interrupt should be configured in the
device tree sx1509b node before enabling the interrupt
configuration.

Signed-off-by: Viraaj Somayajula <sviraaj@zedblox.com>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-20 18:51:59 +02:00
Stephanos Ioannidis c442203c08 arch: arm: aarch32: Fix incorrect z_arm_{int,exc}_exit usage
In the ARM Cortex-M architecture implementation, the concepts of
"exceptions" and "interrupts" are interchangeable; whereas, in the
Cortex-A/-R architecture implementation, they are considered separate
and therefore handled differently (i.e. `z_arm_exc_exit` cannot be used
to exit an "interrupt").

This commit fixes all `z_arm_exc_exit` usages in the interrupt handlers
to use `z_arm_int_exit`.

NOTE: In terms of the ARM AArch32 Cortex-A and Cortex-R architecture
      implementations, the "exceptions" refer to the "Undefined
      Instruction (UNDEF)" and "Prefetch/Data Abort (PABT/DABT)"
      exceptions, while "interrupts" refer to the "Interrupt (IRQ)",
      "Fast Interrupt (FIQ)" and "Software Interrupt/Supervisor Call
      (SWI/SVC)".

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-20 18:22:46 +02:00
Kumar Gala adf3c236fc drivers: video: mcux_csi: Convert driver to DT_INST macro
Convert from using dts_fixup.h based macros to DT_INST macro.  This lets
us remove the dependancy on dts_fixup.h for this driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 11:08:46 -05:00
Kumar Gala 476e90a6a5 drivers: pwm: pwm_mcux: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.  We also remove dts_fixup.h defines that
are no longer needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 11:08:46 -05:00
Kumar Gala 50129f8dd7 drivers: gpio: mcux_igpio: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 11:08:46 -05:00
Martin Jäger 414527926d drivers: dac: Add support for STM32L0 series
First implementation for STM32L0 series MCUs to be used for testing.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-04-20 17:41:48 +02:00
Martin Jäger 33228f516b drivers: dac: Add API for DAC peripherals
DAC (digital to analog converter) peripheral driver with a generic API
suitable for most MCUs (only basic DAC features considered).

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-04-20 17:41:48 +02:00
Peter Bigot df106a1708 modem: gsm: correct timeout parameter to k_delayed_work_submit
The parameter is a k_timeout_t, not an integer in milliseconds.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-20 18:09:18 +03:00
Takumi Ando c2b2aad8ae soc: arm: stm32l1: Add UART4 and UART5 supports
Add UART4 and UART5 supports for STM32L1 series.

Signed-off-by: Takumi Ando <takumi@t15.red>
2020-04-20 15:54:22 +02:00
Maureen Helm b03e4312b3 drivers: i2c: Fix incorrect fast and fast+ mode bus speeds
Fixes the nxp and silabs i2c drivers to decode fast and fast+ mode bus
speeds as 400 kHz and 1 MHz respectively.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-04-20 15:54:04 +02:00
Bartlomiej Flak c0be43e9ab interrupt_controller: gic: Fix ICFGRn access and config
Fixing ICFGRn register access with `sys_{read,write}32`
since this register is not byte-accessible.
Type of `val` changed to u32 to match reg width.

Fixes #24339

Supersedes #24422

Signed-off-by: Bartlomiej Flak <flakbartlomiej@gmail.com>
2020-04-20 15:48:45 +02:00
Kumar Gala 78f29f84ee drivers: ipm: ipm_mcux: convert to new DT_INST macros
Convert from older DT macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 08:45:37 -05:00
Martí Bolívar 44cf00d6e1 drivers: spi: nordic: finish conversion to new DT API
The SPIM driver has been converted already. Convert the SPI and SPIS
drivers too. Leave existing Kconfigs in place.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-20 15:43:39 +02:00
Flavio Ceolin 1572106e68 sensor: lis3mdl: Check possible error in trigger_set
Check the return of i2c_burst_read return and in case of error return
early and propagate the error.

Fixes: #23294

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-04-20 15:43:23 +02:00
Martí Bolívar cd1387d6cf drivers: sensor: qdec_nrfx: move to new DT API
And add "quadrature decoder" to the binding description just have it
written down.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-20 15:43:01 +02:00
Peter A. Bigot 3d8125a47c drivers: flash: nrfx_qspi_nor: fix semaphore errors
The code generally invoked qspi_wait_for_completion() within a locked
region without verifying that an operation was successfully initiated.
This caused a deadlock whenever the operation failed, e.g. because the
data buffer was not 4-byte aligned.  Update that function to take the
result of the operation and either wait for completion or release the
lock, depending on its value.

Also uniformly use the correct type for Nordic HAL error values, and
refactor the erase module so that the correct values are displayed in
the diagnostic when something goes wrong.

Also check the alignment requirements for the flash address and
transfer size, which are highly constrained on this device.  This
driver also requires 4-byte aligned data buffer; this is checked in
the Nordic HAL.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-04-20 15:41:35 +02:00
Kumar Gala af5515e2e0 drivers: usb: device: kinetis: Convert driver to DT_INST macro
Convert from using dts_fixup.h based macros to DT_INST macro.  This
lets us remove the dependancy on dts_fixup.h for this driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-20 15:40:44 +02:00
Erwan Gouriou 65eacef644 drivers/flash: stm32: Use stm32 generic compat as driver compatible
Instead of various series compatibles, use single stm32 generic
compatible as reference for stm32 flash driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-20 03:51:36 -05:00
Kumar Gala e7c7f911a9 drivers: serial: usart_sam: rework device tree support
Reworked usart_sam driver to utilize new DT_INST macros as part of
this rework we also now get pin ctrl/mux configuration information
from the device tree instead of via Kconfig and defines in soc_pinmap.h

We remove defines from dts_fixup.h and soc_pinmap.h and associated
Kconfig symbols that are no longer needed due to getting all that
information from devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-18 17:04:08 -05:00
Kumar Gala fa8aa11f71 drivers: serial: uart_sam: rework device tree support
Reworked uart_sam driver to utilize new DT_INST macros as part of this
rework we also now get pin ctrl/mux configuration information from the
device tree instead of via Kconfig and defines in soc_pinmap.h

We remove defines from dts_fixup.h and soc_pinmap.h and associated
Kconfig symbols that are no longer needed due to getting all that
information from devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-18 17:04:08 -05:00
Kumar Gala addaa802c1 drivers: audio: mpxxdtyy: Conver to use DT_ANY_INST_ON_BUS macro
Convert driver to use new DT_ANY_INST_ON_BUS(i2s) away from
DT_ST_MPXXDTYY_BUS_I2S.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-18 08:43:02 -05:00
Martí Bolívar 5dd0db3081 drivers: bluetooth: rpmsg_nrf53: use new DT API
Use DT_CHOSEN() to access the chosen node.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-18 07:52:05 -05:00
Kumar Gala 57784fb9d5 drivers: timer: xlnx_psttc: Convert driver to DT_INST macro
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-17 16:00:58 -05:00
Kumar Gala e8b6dd7f14 drivers: gpio: stellaris: Convert one missed old style DT macro
Convert one old style DT_INST_n_..._LABEL macro that got missed to
DT_INST_LABEL(n).

At the same time move driver to also use DT_INST_FOREACH.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-17 16:00:34 -05:00
Aurelien Jarno 2a396561d4 drivers: pinmux: stm32l4: use a pull-down for SPI SCK pin
When the STM32L4x 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: Aurelien Jarno <aurelien@aurel32.net>
2020-04-17 13:21:12 -05:00
Aurelien Jarno c695899e04 drivers: pinmux: stm32l4: use consistent config for SPI pins
Most of the MISO and MOSI SPI pins of STM32L4 SoCs are configured with
a pull-down except PE14 and PE15. Change them for consistency.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2020-04-17 13:21:12 -05:00
Martí Bolívar 75b42d8a37 drivers: gpio: nordic: move to new DT API
This keeps existing per-instance Kconfig in place, and only updates to
the new DT API.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-17 12:57:24 -05:00
Flavio Ceolin aeb70d5471 drivers: espi_mchp_xec: Update driver to espi API changes
espi driver API is passing struct by reference, just fixed this
driver to follow that changes.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-04-17 10:33:02 -07:00
Flavio Ceolin d62dd0737e drivers: espi: Change syscall APIs to pass structs by reference
Several functions that are syscalls were passing structs by value
instead of by reference. Just changed that and implemented missing
verfication handlers for them.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-04-17 10:33:02 -07:00
Flavio Ceolin a5b4e272e2 drivers: espi: Add some missing verification handlers
Add verification handlers for some syscalls that are just missing
that. Though there are syscalls still missing that but they need to be
fixed before adding verification handlers.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-04-17 10:33:02 -07:00
Martí Bolívar 3a8aabd774 drivers: counter: nrf: use new DT API
These drivers use legacy DT APIs to access data by node label. Update
them to use the new API.

Leave the existing Kconfig options in place. This helps with
bisectability in case of regressions and lets us proceed
incrementally. Removing the per-instance Kconfigs is also nontrivial
in these cases because of hard-coded dependencies in other subsystems.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-17 18:28:55 +02:00
Kumar Gala 1d605684ce drivers: usb: device: mcux_ehci: Convert driver to DT_INST macro
Convert from using dts_fixup.h based macros to DT_INST macro.  This lets
us remove the dependancy on dts_fixup.h for this driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-17 11:27:30 -05:00
Abe Kohandel 475bc0c962 drivers: i2s: stm32: Add I2S master clock output
Some external audio devices require a master clock to be provided by
the I2S peripheral to work correctly. To allow for the operation of
these devices the master clock output should always be enabled when in
master mode.

Specific applications requiring this signal to be output can configure
the desitnation pin via the pinmux driver.

Signed-off-by: Abe Kohandel <abe@electronshepherds.com>
2020-04-17 10:44:52 -05:00
Aurelien Jarno 7e7e79481f drivers: adc: adc_stm32: enable internal voltage reference source
Like other STM32 series the STM32L4x SoCs have an internal voltage
reference source that need to be enabled.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2020-04-17 17:30:44 +02:00
Kumar Gala c07ab7b5d2 drivers: display: mb_display: Convert to DT_LABEL() macro
Convert old dts_fixup.h style DT_GPIO_P0_DEV_NAME macro to new
DT_LABEL(DT_NODELABEL(gpio0))

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-17 17:22:53 +02:00
Kumar Gala 0b58ae65c8 drivers: gpio: mcux_lpc: Remove unused Kconfig symbols
CONFIG_GPIO_MCUX_LPC_PORT0_NAME and CONFIG_GPIO_MCUX_LPC_PORT1_NAME
aren't used anywhere so we can just remove them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-17 10:16:40 -05:00
Kuba Sanak bf2dccb0eb drivers: uart: samd0: add missing .configure API functionality
The UART driver for samd0 was is missing the .configure and
.config_get functionality expected from api for serial driver.
This commit fixes this by providing basic configuration

Signed-off-by: Kuba Sanak <contact@kuba.fyi>
2020-04-17 08:07:28 -04:00
Sean Nyekjaer ca3457c792 gpio: add driver for MCP23S17 GPIO chip
Adds a new gpio driver that can be used for all boards

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2020-04-17 05:56:05 -05:00
Stephanos Ioannidis 568466aa93 drivers: ethernet: sam_gmac: Add SAM E54 maximum queue count reference
This commit adds a reference to the SAM E54 maximum queue count value
in the device tree for specifying the range of `ETH_SAM_GMAC_QUEUES`
configuration.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-17 04:56:28 -05:00
Stephanos Ioannidis 5b248ce792 drivers: ethernet: eth_sam_gmac: Add SAM0 family support
This commit adds the GMAC driver support for the Ethernet-capable SAM0
family devices (SAM E53 and E54 at this time).

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-17 04:56:28 -05:00
Kumar Gala 762b521931 drivers: sensor: Fix missing DT_DRV_COMPAT
Some sensor drivers modify there struct's based on DT defines.  In those
cases we need to make sure that DT_DRV_COMPAT is set on all the source
files associated with that driver.  This updates any such files.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-17 03:32:19 -05:00
Francois Ramu 7ed83ded6d drivers: dma: initialize peripheral request dma on stm32
Set the peripheral ID for the Channel Selection register

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-04-17 03:13:02 -05:00
Francois Ramu a9f277a61b drivers: dma: control of null buffer address for stm32 dma transfers
Raise warning if the buffer address of the source or the dest is NULL

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-04-17 03:13:02 -05:00
Francois Ramu 60644a3e2c drivers: dma: irq handler of the dma_stm32
define the irq handler in case of DMA V1 or V2,
for the stm32x soc series
with DMA V1 raise Fifo Error if enabled
with V2, handle the Global Interrupt

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-17 03:13:02 -05:00
Francois Ramu e135bba72e drivers: dma: channel direction of the dma_stm32
Return an error if the direction of the channel is wrong

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-17 03:13:02 -05:00
Francois Ramu 1b0503d2cd drivers: dma: clean up header
Move tables declaration as they are only used locally for now

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-17 03:13:02 -05:00
Erwan Gouriou de4ba27539 drivers: dma: channel configuration for dma_stm32
Control values when configuring the dma channel
According to the soc specification,
the dma V2 channel counts from 1.
the dma V1 stream counts from 0.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-17 03:13:02 -05:00
Francois Ramu c4bf6ac1f9 drivers: dma: include duplicated
remove duplicates line

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-04-17 03:13:02 -05:00
Jukka Rissanen d75c83cdbe drivers: gsm_mux: Convert to use k_timeout_t
Convert to use k_timeout_t

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen 31ec75fca3 modem: shell: Add info command
Add an information command that currently will only prints
GSM muxing status.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen 775dcb222e modem: gsm: Initialize the modem UART separately
This is needed if muxing is enabled in which case we must
change the UART to muxing UART after the AT+CMUX command
has succeed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen be81b804f6 drivers: console: uart_mux: Use own workqueue
Instead of global workqueue, use own one so that the users of this
driver can more conveniently use global one. This means GSM modem
can work better with the UART muxing driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen 1d0a211b23 net: ppp: Create own workqueue for PPP
In order to avoid sleeping in global workqueue, use own
workqueue for PPP traffic.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen 492088b3fa net: ppp: Convert PPP driver to use normal UART APIs
This is needed so that we can support GSM 07.10 muxing protocol.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen eb1ad99cff drivers: modem: gsm: Add support for GSM 07.10 muxing protocol
Instead of using physical UART to connection to the modem, use
the GSM 07.10 muxing protocol and UART mux driver to create
virtual channels to the modem. This will allow simultaneous
PPP, AT and other type connections to the modem.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen 900c0e1c7f drivers: ppp: Enable PPP interface when connection is ready
By default PPP interface is not taken up automatically but only
after the PPP connection to modem is ready.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen 420b195b5e drivers: console: uart_mux: Initial UART muxing support
Create support for muxed UARTs which are attached to a real
UART and which use GSM 07.10 muxing protocol to create virtual
channels that can be run on top of the real UART.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Jukka Rissanen b5525a0f91 drivers: gsm_mux: Support GSM 07.10 muxing protocol
Add support to GSM 07.10 muxing protocol which is used to
share the same UART for PPP and AT commands among other things.
This allows e.g., the modem to send SMS and have PPP connection
active at the same time.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-17 10:15:54 +03:00
Vincent van der Locht d1f51db366 drivers: eth: Kconfig.sam_gmac: Add sam4e support for queues
Fixed the ETH_SAM_GMAC_QUEUES config by adding if-statements per SoC
series.

Signed-off-by: Vincent van der Locht <vincent@vlotech.nl>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-17 09:23:33 +03:00
Gerson Fernando Budke afcfd2b52c drivers: ethernet: eth_sam_gmac.c: Fix macro name
Fix macro name from disable_all_queue_interrupt to
disable_all_priority_queue_interrupt.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-17 09:23:33 +03:00
Gerson Fernando Budke 15c048a1dd drivers: eth: sam_gmac: Use DT max_frame_size option
This commit updates the Atmel SAM GMAC driver to select max frame size
value from the device tree. Now GMAC driver can operate with the three
different frame size options available.

The current supported values are: 1518, 1536 and 10240.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-17 09:23:33 +03:00
Gerson Fernando Budke 3c4fbfddf5 drivers: eth: sam_gmac: Fix phy layer setup
The current setup of physical layer forces RMII interface. The code was
refactored to have only one point to select proper phy interface. Now,
GMAC driver works with both RMII or MII interface. The phy connection
type is now selected by device tree. The default phy connection is RMII.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-17 09:23:33 +03:00
Gerson Fernando Budke 4df817d273 drivers: eth: Kconfig.sam_gmac: Fix NOCACHE dependency
The NOCACHE_MEMORY can be enabled only for those MCU that support data
cache. The currently SoC that doesn't have data cache is SAM4E.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-17 09:23:33 +03:00
Gerson Fernando Budke 84ecfd9b57 drivers: eth: sam_gmac: Add data cache checks
Improve data cache conditional build. Now data cache code is build
only if device have support to it. This enables GMAC driver for use
with devices that don't have data cache instructions.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-17 09:23:33 +03:00
Gerson Fernando Budke 8c2a1597db drivers: eth: eth_sam_gmac: Split DMA queue flags
This cleans up DMA flags by separating the necessary flags for devices
with one or multiple RX/TX queues.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-17 09:23:33 +03:00
Robert Lubos f1f2405eb1 drivers: ieee802154_nrf5: Handle frame pending bit mode
Configure FPB handling in the radio driver.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-04-17 09:17:38 +03:00
Robert Lubos c39d0b6914 drivers: ieee802154_nrf5: Notify about FPB value in ACK reponse
The radio driver will now notify the upper layer about Frame Pending Bit
value in the ACK response it sent.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-04-17 09:17:38 +03:00
Kumar Gala 2cd4681bd5 drivers: timer: sam0_rtc_timer: Fix incorrect DT_INST conversion
clock-generator is a normal property.  To access it we should use
DT_INST_PROP(0, clock_generator) and not DT_INST_CLOCKS_CELL().

Fixes: #24399

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-16 14:09:23 +02:00
Maureen Helm 1b6d4dd223 drivers: spi: Set dummy data in mcux drivers
Sets the "dummy data" value to send when the transmit buffer is null.
Fixes the spi_null_tx_buf test in tests/drivers/spi/spi_loopback on the
lpcxpresso54114 board.

Tested on frdm_k64f, mimxrt1050_evk, and lpcxpresso54114_m4 boards.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-04-16 06:01:43 -05:00
Kumar Gala f72bfda53c drivers: pwm: pwm_nrf5_sw: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-15 11:17:32 -05:00
Kumar Gala a152f147db drivers: ipm: ipm_nrfx_ipc: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-15 11:17:32 -05:00
Kumar Gala f04490e300 drivers: flash: nrf_qspi_nor: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-15 11:17:32 -05:00
Marcin Niestroj a150fb6bb7 drivers: lora: sx1276: call DIO handlers in workqueue
DIO handlers defined in loramac-node are quite complex. Additionally
they call read/write operations over SPI with the sx1276 chip. This
cannot work properly in interrupt context, so call DIO handlers in
system workqueue instead.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-04-15 08:30:11 -05:00
Marcin Niestroj 2c23465dbc drivers: lora: sx1276: check gpio controller when looking for triggered DIO
So far only GPIO pin number of registered DIO line was compared with
arguments passed to GPIO callback. This is not enough when multiple gpio
controllers are used for DIO lines. As an example when DIO0 is on PA1
and DIO1 is on PB1, then DIO0 handler is called all the time.

Compare GPIO controller (in addition to pin number) of DIO lines with
the argument passed to gpio callback, so proper DIO handler is used.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-04-15 08:30:11 -05:00
Marcin Niestroj 675c6bdaef drivers: lora: sx1276: constify dio gpio configuration
This information is filled during build time from device-tree. This is
not supposed to change in runtime, so make it const.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-04-15 08:30:11 -05:00
Marcin Niestroj 8cfef933d7 drivers: lora: sx1276: handle NULL callback in irqHandlers
Part of sx1276 driver which is in loramac-node module passes to Zephyr
irqHandlers with callbacks. Some of those callbacks can be NULL and this
is true now (with the current version of loramac-node) for DIO5. If we
define all 0-5 DIOs in dts, then this results in interrupts which are
unwanted. As we do not check that loramac-node callback is NULL, then we
crash trying to call it.

Check every handler during initialization and just skip initialization
of GPIO if it is NULL. This also prevents crashes, because there is no
way GPIO interrupt to be triggered in runtime for this DIO.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-04-15 08:30:11 -05:00
Marc Reilly eeedc828ae drivers: display: st7789v: set x-offset and y-offset properties properly
This sets the x-offset and y-offset info from the dts

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2020-04-15 08:25:19 -05:00
Marc Reilly de2f2cd14f drivers: display: st7789v: move PORCTRL setup to after CMD2EN
The PORCTRL setting command is in 'bank2' and so might not be changed on
the controller unless bank2 is enabled first.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
2020-04-15 08:25:19 -05:00
Erwan Gouriou c01c74c020 drivers/i2c: stm32: Use DT_NODELABEL_ macros
Make use of DT_NODELABEL macros to get device instances
information to configure drivers I2C instances.
This allows to remove I2C related lines in fixup.h files

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-15 08:21:30 -05:00
Erwan Gouriou 9580992b3e drivers/i2c: stm32: Configure driver by compatible
Use compatible information to configure i2c stm32.
With this, driver version selection is done thanks to compatible
and it is not needed anymore to do this via Kconfig symbol
selection under soc/

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-15 08:21:30 -05:00
Henrik Brix Andersen 1985ddf236 drivers: adc: lmp90xxx: convert to use k_msleep() instead of k_sleep()
Convert the LMP90xxx ADC driver from using k_sleep() to using
k_msleep() in order to resolve a compilation error caused by passing
an int to k_sleep().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-04-15 13:34:18 +02:00
Kumar Gala 8dc6f9f5dd drivers: flash: nrf: Conver to new DT macros
Convert driver from DT_FLASH_BASE_ADDRESS and DT_FLASH_DEV_NAME to use
DT_REG_ADDR and DT_INST_LABEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-15 06:22:40 -05:00
Kumar Gala 613dba7fac drivers: flash: stm32: Convert to new DT macros
Replace DT_FLASH_SIZE with new DT_REG_SIZE macro.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-15 06:22:40 -05:00
Kumar Gala f311c8ad60 drivers: flash: atmel sam: Fix DT_DRV_COMPAT setting
For a flash driver DT_DRV_COMPAT should be the compatible for the flash
controller and not the soc-nv-flash.  Change to driver to use the flash
controllers compatible and get the soc-nv-flash properties as a child of
that controller.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-15 06:22:40 -05:00
Kumar Gala 14b6b8b07c drivers: flash: silabs: Fix DT_DRV_COMPAT setting
For a flash driver DT_DRV_COMPAT should be the compatible for the flash
controller and not the soc-nv-flash.  Change to driver to use the flash
controllers compatible and get the soc-nv-flash properties as a child of
that controller.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-15 06:22:40 -05:00
Kumar Gala a61d2a281c drivers: flash: mcux: Fix DT_DRV_COMPAT setting
For a flash driver DT_DRV_COMPAT should be the compatible for the flash
controller and not the soc-nv-flash.  Change to driver to use the flash
controllers compatible and get the soc-nv-flash properties as a child of
that controller.

The soc_flash_mcux supports several possible compatible so handle that
as part of how we set DT_DRV_COMPAT.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-15 06:22:40 -05:00
Kumar Gala 3fa974cab0 drivers: flash: rv32m1: Fix DT_DRV_COMPAT setting
For a flash driver DT_DRV_COMPAT should be the compatible for the flash
controller and not the soc-nv-flash.  Change to driver to use the flash
controllers compatible and get the soc-nv-flash properties as a child of
that controller.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-15 06:22:40 -05:00
Kumar Gala 5a149dfca6 drivers: serial: uart_mcux: Convert to DT_INST
Convert driver to use new DT_INST macros throughout.  Removed per
instance Kconfig symbols and replaced with DT_NODELABEL references where
needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-14 17:52:31 -05:00
Martí Bolívar 8aadf89579 drivers: sensor: bme280: convert to new DT API
Make this multi-instance and use the new API.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-14 10:38:10 -05:00
Kumar Gala 8b56e7a63c drivers: usb_dc_nrfx: Convert driver to new DT_INST macros
Convert to using DT_LABEL(DT_INST()) to get label of the
nordic,nrf-clock device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-14 10:37:34 -05:00
Kumar Gala c835676822 drivers: timer: nrf_rtc: Convert driver to new DT_INST macros
Convert to using DT_LABEL(DT_INST()) to get label of the
nordic,nrf-clock device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-14 10:37:19 -05:00
Kumar Gala d798923c94 drivers: counter: nrfx_rtc: Convert driver to new DT_INST macros
Convert to using DT_LABEL(DT_INST()) to get label of the
nordic,nrf-clock device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-14 10:36:38 -05:00
Peter Bigot 95baa51de8 drivers: flash: spi-nor: fix unconditional use of BE32K
The 32 KiBy bulk erase command was being invoked without respecting
the flag that indicates it's supported.  Make the invocation
conditional.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-14 09:13:34 -05:00
Martí Bolívar b9fff2cee0 clock_control: nordic: move to new DT API
Use the new devicetree API to access dts data.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-14 06:32:25 -05:00
Martí Bolívar bbde37113f adc: nordic: move to new DT API and kconfig style
Use the new devicetree API. Remove per-board enabling of ADC_0 by
setting ADC_0 to default y when the 'adc' node label points at an
enabled node of the expected compatible (depending on SoC).

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-13 18:34:39 -04:00
Parthiban Nallathambi e65b14c2b6 sensor: bq274xx: Add BQ27421 driver
Add support for TI BQ27421 fuel gauge sensor

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
Signed-off-by: NavinSankar Velliangiri <navin@linumiz.com>
2020-04-13 11:50:41 -05:00
Francisco Munoz 4185da0a7e drivers: sensors: tach: Configurable pulses per cycle
Introduce a Kconfig option to be able to interpret rpm
values from several fans.

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@intel.com>
2020-04-13 11:34:13 -05:00
Kumar Gala 8b6930ebef drivers: entropy: Remove Kconfig HAS_DTS_ENTROPY
Now that all entropy drivers use DTS we can remove HAS_DTS_ENTROPY being
set everywhere as well as Kconfig ENTROPY_NAME since that is now coming
from DT_ENTROPY_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-13 09:14:21 -05:00
Erwan Gouriou 9ddc620182 drivers/i2s: stm32: i2s dma client configured using DT macros
Allows usage of optional dma channels

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-13 07:37:11 -05:00
Paolo Teti 51125b2890 drivers: adc: adc_shell: Kconfig ADC_SHELL must depends on SHELL
To avoid linking errors ADC_SHELL must depends on SHELL.

Signed-off-by: Paolo Teti <paolo.teti@gmail.com>
2020-04-12 12:02:46 -04:00
Steven Slupsky e55f1987a0 drivers: flash: sam0: fix unaligned memory read
Use the UNALIGNED_GET() macro instead of the
flash_sam0_read_unaigned_u32() function to ensure
word alignment of the source address.

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>

drivers: flash: sam0:  fix whitespace

Fix checkpass whitespace error.

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
2020-04-11 15:34:21 -04:00
Jose Alberto Meza f93c1926e6 drivers: espi: xec: Validate channels espi configuration
Ensure driver's client channel configuration selection is used.
Fixes: #24162

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-04-11 15:30:27 -04:00
Peter Bigot e9c5e4824c drivers: i2c: fix esp32 timeout parameter
The value is milliseconds and must be wrapped for use with the new
timeout API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-11 15:29:09 -04:00
Kumar Gala 3c96c08839 drivers: i2c: stm32: replace DT_I2C_._NAME with new macros
Replace DT_I2C_._NAME macro with DT_LABEL(DT_NODELABEL()) instead.  This
will allow us to remove all references to DT_I2C_._NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 15:11:18 -05:00
Kumar Gala adad8086a8 drivers: i2c: i2c_sam_twihs: replace DT_I2C_._NAME with new macros
Replace DT_I2C_._NAME macro with DT_LABEL(DT_NODELABEL()) instead.  This
will allow us to remove all references to DT_I2C_._NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 15:11:18 -05:00
Kumar Gala 0a408785ac drivers: i2c: i2c_sam_twi: replace DT_I2C_._NAME with new macros
Replace DT_I2C_._NAME macro with DT_LABEL(DT_NODELABEL()) instead.  This
will allow us to remove all references to DT_I2C_._NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 15:11:18 -05:00
Kumar Gala f928e1b144 drivers: gpio: rv32m1: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 14:38:04 -05:00
Kumar Gala 5dd1a79230 drivers: pwm: rv32m1_tpm: Use DT_INST_FOREACH
Convert driver to use DT_INST_FOREACH(TPM_DEVICE)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 14:38:04 -05:00
Kumar Gala 8f0018663f drivers: pinmux: rv32m1: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Updated the openisa,rv32m1_vega-pinmux binding to require the label
property and updated the rv32m1.dtsi to add label properties for the
pinmux nodes.

Also update gpio_basic_api test to use DT_NODELABEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 14:38:04 -05:00
Kumar Gala ec048128ae drivers: timer: rv32m1_lptmr: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 14:38:04 -05:00
Kumar Gala 8c60bc0b07 drivers: spi: rv32m1_spi: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 14:38:04 -05:00
Kumar Gala 03d48d894d drivers: serial: rv32m1_lpuart: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 14:38:04 -05:00
Kumar Gala e9aa9201c9 drivers: intc: rv32m1_intmux: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 14:38:04 -05:00
Kumar Gala 376c5a4e4f drivers: i2c: i2c_rv32m1_lpi2c: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-10 14:38:04 -05:00
Abe Kohandel 861548f12f drivers: dma: i2s: stm32: I2S Master DMA support
When configuring the I2S peripheral as a master, the DMA channel
direction must be configured to transfer data from memory to the
peripheral.

Currently the configuration of channel direction is always set for
peripheral to memory regardless of whether it is the TX or the RX
channel.

Signed-off-by: Abe Kohandel <abe@electronshepherds.com>
2020-04-09 19:57:08 +02:00
Steven Slupsky c54f7ec1fc drivers: hwinfo: fix endianness for sam0 and nrf
HWINFO drivers should be responsible for ensuring that
the data structure is a sequence of bytes. That is not
what the current sam0 and nordic drivers do. The drivers
read the data as u32_t and then memcpy the data to a
buffer. This ensures the data has the endianness of the
underlying MCU, which in this case is Cortex M0 which
is little endian.

This commit fixes the endianness so the data can be
interpreted as a "left to right sequence of bytes".

This commit updates the API doc to provide clarification
of the data structure.
Add to 2.3 release notes.

Fixes #23444, #24103

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
2020-04-09 19:30:32 +02:00
Robert Lubos a4f704d2ec drivers: ieee802154_nrf5: Handle RX timestamp
Obtain RX time from the radio driver. Fill the `net_pkt` with
a timestamp if `NET_PKT_TIMESTAMP` is enabled.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-04-09 16:56:11 +02:00
Robert Lubos 86f56fcd36 drivers: ieee802154_nrf5: Switch to ACK timeout at nRF driver level
nRF radio driver will call `nrf_802154_transmit_failed` callback in case
no ACK is received, so we do not need to set timeout at the shim layer
anymore.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-04-09 16:56:11 +02:00
Ivo Clarysse db400713ba drivers/flash: shell: Add optional device argument
Update `flash` shell commands to take an optional device argument,
instead of using the chosen flash device.

Signed-off-by: Ivo Clarysse <ivo@bcdevices.com>
2020-04-09 16:36:39 +02:00
Maureen Helm 3005094994 drivers: i2c: Add mcux flexcomm driver
Adds a shim layer around the mcux lpc flexcomm driver to adapt it to the
zephyr i2c interface. It leverages heavily from the existing mcux lpi2c
shim driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-04-09 08:52:13 -05:00
Kumar Gala a5daf74467 drivers: hwinfo: atmel_sam: Replace DT_FLASH define
Replace DT_FLASH_DEV_BASE_ADDRESS with new DT_REG_ADDR/DT_INST macro as
we phase out DT_FLASH define usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-09 08:41:09 -05:00
Kumar Gala c7f8b30f53 drivers: flash: openisa rv32m1: Replace DT_FLASH define
Replace DT_FLASH_SIZE with new DT_INST_REG_SIZE as we phase out
DT_FLASH define usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-09 08:41:09 -05:00
Kumar Gala 19e91ab9f2 drivers: flash: nxp mcux: Replace DT_FLASH define
Replace DT_FLASH_WRITE_BLOCK_SIZE with new DT_INST_NODE_HAS_PROP and
DT_INST_PROP macro as we phase out DT_FLASH define usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-09 08:41:09 -05:00
Kumar Gala 9a28ff317f drivers: flash: atmel_sam: Replace DT_FLASH define
Replace DT_FLASH_DEV_BASE_ADDRESS with new DT_REG_ADDR/DT_INST macro as
we phase out DT_FLASH define usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-09 08:41:09 -05:00
Kumar Gala 608dba486e drivers: flash: Use DT_INST_LABEL instead of DT_FLASH_DEV_NAME
Replace use of DT_FLASH_DEV_NAME with DT_INST_LABEL in drivers as we
want to phase out DT_FLASH_DEV_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-08 15:28:52 -05:00
Abe Kohandel d35567b375 drivers: dma: stm32: Stream disable success
When a DMA stream is successfully disabled, the function should
immediately return with a success status.

Signed-off-by: Abe Kohandel <abe@electronshepherds.com>
2020-04-08 12:21:05 -05:00
Serafin Leschke 2e5313dc56 soc: arm: st_stm32: stm32l0: Add RTC support
This commits adds support for the on chip RTC of the stm32l0 series

Signed-off-by: Serafin Leschke <serafin.leschke@bytesatwork.ch>
2020-04-08 12:18:16 -05:00
Abe Kohandel 5f3ed2660c drivers: pinmux: stm32: add pin for I2S3_WS on F4 series
Enable I2S3 WS functionality on PA15 pin

Signed-off-by: Abe Kohandel <abe@electronshepherds.com>
2020-04-08 12:07:14 -05:00
Maciej Fabia ae285ef4e6 drivers: crypto: add driver for nRF ECB
add driver for nRF AES Electronic CodeBook (ECB) peripheral

Signed-off-by: Maciej Fabia <maciej.fabia@nordicsemi.no>
2020-04-08 16:20:53 +02:00
Martí Bolívar bbd6473136 drivers: remove a couple of DT abstraction violations
DT_CALL_WITH_ARG() is an internal implementation detail that should
not be used outside of devicetree.h.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-08 09:00:38 -05:00
Peter Bigot 08fea84a30 drivers: flash: sam: fix timeout units
The duration is used in math with the uptime clock, not as a timeout.
Correct value expression and rename to clarify units.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-07 16:39:08 -05:00
Erwan Gouriou e4589b8657 drivers: flash: stm32: Use correct driver compatible
Use valid stm32 flash driver compatibles instead of flash
area compatible.
For 'write_block_size' property, use reference to soc-nv-flash.

fixes #23997

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-07 10:52:23 -04:00
Loic Poulain 420ad255a8 drivers: video: Add dedicated video init priority
Create a dedicated config symbol for video device initialization.
Generally, video device init is low priority comparing to standard
devices. Moreover some video device can rely on other device init,
like the csi mcux driver which rely on sensor and i2c init.

This fixes a crash in video capture sample, when camera sensor
(mt9m114) is not connected.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-04-07 09:44:14 -05:00
Kumar Gala 3d353a0e4f drivers: ethernet: sam_gmac: replace dt_int_val in Kconfig
Replace dt_int_val as its deprecated and meant to be removed with
dt_node_int_prop_int.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-07 08:21:04 -05:00
Marek Porwisz f6aa72a4d7 drivers: ieee082154_nrf5: Tx started notification
Notify about actual data transmission start.
Needed when ACK timeout is disabled in the radio driver.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2020-04-07 14:24:10 +03:00
Dominik Ermel 143f9bfd4e drivers/flash/nrfx: Enable partial erase of flash
When enabled, instead of erasing entire flash page at once, page will
be erased in defined time slices. Erasing single page stalls CPU
for significant time share (~80ms) and partial erase divides the
operation in to the shorter time periods, resuming CPU operation in
meantime and enabling better scheduling of time sensitive operations.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-04-06 22:12:33 -04:00
Steven Slupsky fbc72889af drivers: wdt_sam0: remove log message during boot
The recent change in 2.2.0 that disables the watchdog
on boot introduced a hard fault when a log message
is generated too early before even the RTC is
initialized.
This commit removes the log message.

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
2020-04-06 22:08:44 -04:00
Henrik Brix Andersen c8d26b4b14 drivers: sensor: nxp_kinetis_temp: add weighted average filter
Add an optional weighted average filter to the ADC readings in the NXP
Kinetis temperature sensor driver as recommended in NXP AN3031.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-04-06 15:39:36 -05:00
Henrik Brix Andersen 2a6aa0be88 drivers: sensor: nxp_temp_kinetis: fix potential overflow
Fix a potential 32 bit multiplication overflow (muliplying by 10000
instead of 1000000) and change the calculations and units accordingly.

Improve the code readability and traceability towards NXP AN3031 by
using the same variable name as in the application note.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-04-06 15:39:36 -05:00
Wayne Ren a6a015e90b driver: arcv2_timer: remove sys_clock_disable
sys_clock_disable now is only called in sys_reboot.
This API is outdated, no need to implement it and
there is a weak version.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-04-06 11:17:38 -07:00
Wayne Ren 8f76233029 arch: arc: optimize the arc v2 interrupt unit driver
* add interrupt lock in low level API to gurantee the
  correctness of operations.

* make some functions as in-line functions

* clean up and optimize the code comments

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-04-06 11:17:38 -07:00
Kumar Gala e268368fd4 drivers: sensor: st: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-06 12:41:43 -05:00
Marcin Niestroj 91fe6534da drivers: wifi: esp: Fix wifi-reset-gpios handling
wifi-reset-gpios is currently ignored after conversion to DT_INST
macros. Use wifi_reset_gpios instead of reset_gpios to fix the problem.

Fixes: a464ae7163 ("drivers: wifi: esp: Convert to new DT_INST
  macros")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-04-06 10:29:58 -05:00
Erwan Gouriou 7e1b1213d7 drivers/entropy: stm32: Enable driver based on compatible
To ease driver configuration, enable ENTROPY_STM32_RNG
only if device node  matching driver compatible is enabled.
No more need to enable config symbol under soc/


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-06 09:14:33 -05:00
Erwan Gouriou 92c4092283 drivers/entropy: stm32: Convert driver to dt based configuration
Convert stm32 entropy driver to configuration based on device tree.
Select HAS_DTS_ENTROPY symbols and configure CONFIG_ENTROPY_NAME
in fixup files.

Since rng node is not enabled (or available) on all boards, it could
happen that symbol ENTROPY_STM32_RNG is not enabled and hence
ENTROPY_HAS_DRIVER not selected which ends up with a symbol
ENTROPY_NAME defined throufg Kconfig selection. Thus, in fixup file,
CONFIG_ENTROPY_NAME is defined only if not already defined.

Additionally, update boards that used to configure entropy by default.
On these boards, enable rng device in device tree and remove Kconfig
related configuration (which should not be part of default
configuration).

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-06 09:14:33 -05:00
Kumar Gala 4e553f31fa drivers: gpio: use new ngpios macros for cases embedded in macros
Fixup cases of GPIO_PORT_PIN_MASK_FROM_NGPIOS(DT_INST_PROP(n, ngpios))
to use GPIO_PORT_PIN_MASK_FROM_DT_INST(n) instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-06 09:14:02 -05:00
Martí Bolívar 9f7cab0623 drivers: gpio: use new ngpios macros
Save some typing with sed:

$ git grep -E -l \
  'GPIO_PORT_PIN_MASK_FROM_NGPIOS\(DT_INST_PROP\(.*, ngpios\)\)' | \
  xargs sed -r -i \
  's/GPIO_PORT_PIN_MASK_FROM_NGPIOS\(DT_INST_PROP\(([0-9]+), ngpios\)\)/GPIO_PORT_PIN_MASK_FROM_DT_INST(\1)/'

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-06 09:14:02 -05:00
Martí Bolívar 46f47a63ba gpio_utils.h: add helpers for dt node -> port pin mask
This captures a common pattern.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-04-06 09:14:02 -05:00
Tobias Svehagen ac53a8788e drivers: wifi: esp: Use UART settings from bus node
With the introduction of the new device-tree macros it is now possible
to use the settings for speed and flow-control from the bus node instead
of having the same properties on the esp node itself.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-04-06 09:12:58 -05:00
Andrzej Głąbek 97e4c0cbad drivers: entropy_nrf5: Use device name and IRQ priority from DTS
Instead of using Kconfig options for setting the device name and IRQ
priority for the entropy_nrf5 driver, get these settings from the rng
node defined in DTS for a given SoC.

Provide also fixups for CONFIG_ENTROPY_NAME, until applications using
entropy drivers are converted to use DTS as well.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-04-06 09:10:43 -05:00
Ioannis Glaropoulos 88bf06bb01 boards: arm: nrf5340_dk_nrf5340: rename target to nrf5340pdk_nrf5340
We rename the nRF53 Dev Kit board target (nrf5340_dk_nrf5340)
to nrf5340pdk_nrf5340. We update all associated references
in the supportive documentation and all nRF5340-related
cofigurations and overlay files in the samples and tests
in the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-04-06 15:21:45 +02:00
Kumar Gala 6c6c1010bb drivers: counter: imx_epit: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Also update counter_basic_api test to use DT_INST and remove the
udoo_neo_full_m4.conf as its not longer needed since the per instance
Kconfig sybmols don't exist anymore.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-04 09:34:00 -05:00
Kumar Gala 7064bab954 drivers: i2c: i2x_imx: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-04 09:34:00 -05:00
Kumar Gala 5ed7b7e487 drivers: ipm: ipm_imx: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-04 09:34:00 -05:00
Kumar Gala f4b61c5505 drivers: gpio: gpio_imx: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Additionally remove udoo_neo_full_m4.conf from gpio_basic_api test since
the Kconfig symbols don't need to be set anymore.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-04 09:34:00 -05:00
Kumar Gala 7056c2304c drivers: serial: uart_imx: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-04 09:34:00 -05:00
Kumar Gala 9c229e9169 drivers: pwm: pwm_imx: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-04 09:34:00 -05:00
Kumar Gala 5a8a06661d drivers: gpio: cleanup select HAS_DTS_GPIO
All GPIO controller drivers support DTS so we can select HAS_DTS_GPIO
at the GPIO driver subsystem level rather than for each specific driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-04 09:27:12 -05:00
Gerard Marull-Paretas 4194360cb5 drivers: pwm: stm32: add support for H7 series
Enable PWM support for H7 series.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-04-04 15:00:11 +02:00
Kumar Gala 9cd8345e12 drivers: i2c: cleanup select HAS_DTS_I2C
We do 'select HAS_DTS_I2C' for I2C in general so we don't need specific
instances elsewhere anymore.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-03 22:48:31 -04:00