Commit graph

7653 commits

Author SHA1 Message Date
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
Michael Hope 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
Michael Hope 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
Michael Hope 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