Commit graph

7658 commits

Author SHA1 Message Date
Kumar Gala e7c7f911a9 drivers: serial: usart_sam: rework device tree support
Reworked usart_sam driver to utilize new DT_INST macros as part of
this rework we also now get pin ctrl/mux configuration information
from the device tree instead of via Kconfig and defines in soc_pinmap.h

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

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

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

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

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

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

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

At the same time move driver to also use DT_INST_FOREACH.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-17 16:00:34 -05:00
Aurelien Jarno 2a396561d4 drivers: pinmux: stm32l4: use a pull-down for SPI SCK pin
When the STM32L4x SoC goes into STOP mode, the SPI device is disabled.
This cause the pins to not be drived anymore (i.e. they are floating)
except through their pull-up or pull-down.

From the logical point of view, the NSS pin is held high by a pull-up
so it's not a problem if the other pins are floating. However those pins
are floating input for the slaves, which increase their power
consumption.

The solution is to hold the state of the pins through a pull-up or a
pull-down. This is already done for the NSS and MOSI pins, but not for
SCK. Fix that by using pull-down on the SCK pin the same way it is
already done for the MOSI pin.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2020-04-17 13:21:12 -05:00
Aurelien Jarno c695899e04 drivers: pinmux: stm32l4: use consistent config for SPI pins
Most of the MISO and MOSI SPI pins of STM32L4 SoCs are configured with
a pull-down except PE14 and PE15. Change them for consistency.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes: #24399

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

Tested on frdm_k64f, mimxrt1050_evk, and lpcxpresso54114_m4 boards.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

drivers: flash: sam0:  fix whitespace

Fix checkpass whitespace error.

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

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

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

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

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

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

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

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

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

Also update gpio_basic_api test to use DT_NODELABEL.

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

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

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

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

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

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

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

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

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

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

Fixes #23444, #24103

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

fixes #23997

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

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

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

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

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

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

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

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

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

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

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

* make some functions as in-line functions

* clean up and optimize the code comments

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-03 22:48:31 -04:00
Kumar Gala 9872dc16b5 drivers: sensors: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-03 16:42:01 -05:00
Frank Li 007aa031b5 drivers: gpio_mcux_igpio: fix code disabling the interrupt
When disabling the interrupt current implementation of the
gpio_pin_interrupt_configure function will first reconfigure the
interrupt to be active on gpio low level.
Since the pin interrupt is enabled if the gpio pin level happens
to be low at the time the interrupt will trigger immediately.
Rewrite the function to disable the interrupt in a safe manner.

Signed-off-by: Frank Li <lgl88911@163.com>
2020-04-03 16:39:19 -05:00
Johan Hedberg 71eb56a34c net: buf: Move LEGACY_TIMEOUT_API selection to specific subsystems
The net_buf subsystem is now fully compatible with the new timeout
API, so move the selection of the legacy API to those specific
subsystems that use net_buf and still need converting.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-04-03 23:17:53 +03:00
Vinayak Kariappa Chettimada 0d8eb1c5ad drivers: flash: nrf: Fix radio sync with BLE LL split controller
Delay radio abort called in the flash driver to emulate the
behavior of pre-empt timeout in Bluetooth LL split
controller. Without this, the driver aborted radio events
in its reserved time space.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-04-03 22:09:50 +02:00
Piotr Mienkowski 71c41e5024 drivers: wdt_gecko: select clock source explicitly
At present wdt_gecko driver supports ULFRCO as its only clock source.
Select the clock explicitly, do not rely on the default configuration
provided by the SiLabs header files. The default configuration is
changing between different SiLabs HAL versions.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2020-04-03 14:00:41 -05:00
Andrzej Głąbek 81fa7ed35b drivers/gpio/Kconfig.sx1509b: Enable driver automatically when needed
Enable the gpio_sx1509b driver by default when a "semtech,sx1509b"
compatible node is enabled in devicetree.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-04-03 14:47:32 +02:00
Andrzej Głąbek 011e9bac0b drivers: nrf: Remove no longer suitable dependencies on Kconfig options
Make I2C and SPI drivers for nRF SoCs no longer dependent on Kconfig
options that enable instances (i.e. I2C_x and SPI_x). Now these drivers
enable hardware instances when corresponding nodes in devicetree are
enabled (have status "okay").
For I2C, SPI, and UART drivers, instead of using Kconfig dependencies
to prevent enabling of hardware instances that cannot be used together
(e.g. SPIM1 and TWIM1), a file that signals invalid configurations with
build assertions is added to compilation.
Also dependencies on HAS_HW_NRF_* options are removed from Kconfigs
of I2C, SPI, and UART drivers, as for hidden options that activate
proper type of driver such dependencies are not actually helpful.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-04-03 14:47:32 +02:00
Andrzej Głąbek 97b07b943a drivers/serial/Kconfig.nrfx: Choose driver type basing on DT compatible
Remove prompts from Kconfig options `UART_x_NRF_UART*` that select
the type of nrfx driver (for UART or UARTE peripheral) to be used
for a given instance. This prevents the options from being modified
from configuration files.
Instead, make one of these options selected by default according to the
"compatible" property set for the corresponding UART node in devicetree.

This eliminates the need of changing both the "compatible" property in
devicetree and the Kconfig option selecting the driver type when a user
wants to switch between UART and UARTE for a given instance.

Since all `UART_x_NRF_UART*` options are made "hidden" by this commit,
all their occurrences in configuration files are removed.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-04-03 14:47:32 +02:00
Andrzej Głąbek bf0c4a841d drivers/i2c/Kconfig.nrfx: Choose driver type basing on DT compatible
Remove prompts from Kconfig options `I2C_x_NRF_TWI*` that select
the type of nrfx driver (for TWI or TWIM peripheral) to be used
for a given instance. This prevents the options from being modified
from configuration files.
Instead, make one of these options selected by default according to the
"compatible" property set for the corresponding I2C node in devicetree.

This eliminates the need of changing both the "compatible" property in
devicetree and the Kconfig option selecting the driver type when a user
wants to switch between TWI and TWIM for a given instance.

Since all `I2C_x_NRF_TWI*` options are made "hidden" by this commit,
all their occurrences in configuration files are removed.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-04-03 14:47:32 +02:00
Andrzej Głąbek cb0cb3f2e8 drivers/spi/Kconfig.nrfx: Choose driver type basing on DT compatible
Remove prompts from Kconfig options `SPI_x_NRF_SPI*` that select the
type of nrfx driver (for SPI, SPIM, or SPIS peripheral) to be used
for a given instance. This prevents the options from being modified
in configuration files.
Instead, make one of these options selected by default according to the
"compatible" property set for the corresponding SPI node in devicetree.

This eliminates the need of changing both the "compatible" property in
devicetree and the Kconfig option selecting the driver type when a user
wants to switch between SPI, SPIM, and SPIS for a given instance.

Since all `SPI_x_NRF_SPI*` options are made "hidden" by this commit,
all their occurrences in configuration files are removed.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-04-03 14:47:32 +02:00
Robert Lubos d657c6bf57 drivers: ieee802154_nrf5: Add CSMA CA transmit capability
Add CSMA CA capability for the `ieee802154_nrf5` radio driver along with
appropriate implementation in the `nrf5_tx` function.

Introduce 802.15.4 radio driver with CSMA/CA support enabled. Add help
text, mentioning a list of peripherals occupied by the radio driver.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-04-03 14:07:41 +03:00
Robert Lubos 1fb418df4c net: ieee802154_radio: Allow to specify TX mode
Even though radio driver can report in its capabilities that it does
support CSMA CA, there's no way in the driver to select how the frame
should be transmitted (with CSMA or without). As layers above radio
driver (Thread, Zigbee) can expect that both TX modes are available, we
need to extend the API to allow either of these modes.

This commits extends the API `tx` function with an extra parameter,
`ieee802154_tx_mode`, which informs the driver how the packet should be
transmitted. Currently, the following modes are specified:
* direct (regular tx, no cca, just how it worked so far),
* CCA before transmission,
* CSMA CA before transmission,
* delayed TX,
* delayed TX with CCA

Assume that radios that reported CSMA CA capability transmit in CSMA CA
mode by default, all others will support direct mode.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-04-03 14:07:41 +03:00
Kumar Gala 1951c79db4 drivers: gpio: cmsdk_ahb: Convert driver to be full DTS based
Convert driver to utilize the new DT_INST macros completely and remove
associated Kconfig symbols that now come from devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-03 04:11:36 -05:00
Kumar Gala 74d459fb66 drivers: serial: sifive: use DT_INST_LABEL macro
Replace a few cases that should have been DT_INST_LABEL instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-02 16:54:43 -05:00
Mark Olsson f79699108a drivers: kscan: add support for the interrupt on the ft5336
The ft5336 has an interrupt that can be used instead of polling
this commit adds support for using it but as an option to maintain
compatibility. Tested on the stm32f746g_disco board.

Signed-off-by: Mark Olsson <mark@markolsson.se>
2020-04-02 16:48:15 -05:00
Peter Bigot ecf3bdb5b3 coccinelle: re-run timeout conversion semantic patch
Run the int_literal_to_timeout Coccinelle script to fix places where
it is clear that an integer duration is being passed where a timeout
value is required.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-02 19:47:51 +03:00
Erwan Gouriou e26767fc06 drivers/gpio: stm32: Remove Kconfig based device declaration
Use device node declaration instead.
Clean up GPIO_STM32_PORT* Kconfig symbols.

On some boards some gpio ports where disabled using Kconfig symbols.
Disable them now via device tree nodes in boards dts files.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-02 06:50:05 -05:00
Erwan Gouriou c4de0d3b5b drivers: gpio: Use new DT macros for device driver init
Kconfig based device declaration is kept as is.
Clean up the fixup files.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-02 06:50:05 -05:00
Kumar Gala 7879b67796 drivers: entropy: Add DTS support to native-posix fake entropy driver
Add a YAML and DTS node for fake entropy driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-02 06:42:26 -05:00
Tobias Svehagen 3b246fea6e drivers: wifi: esp: Fix DT_DRV_COMPAT to match binding
Change DT_DRV_COMPAT to espressif_esp to match the dts binding
"espressif,esp".

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-04-02 06:41:39 -05:00
Kumar Gala 9be31b5aa4 drivers: entropy: Convert drivers to use DT for label
Move towards use DTS for driver instance name instead of Kconfig sybmol.
This is towards phasing out CONFIG_ENTROPY_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-02 10:26:59 +02:00
Aurelien Jarno 78b5b2ef50 driver: timer: st_stm32: fix build with the new timeout API
Commit 7832738ae9 ("kernel/timeout: Make timeout arguments an opaque
type") changed the forever value for timer drivers to K_TICKS_FOREVER
from K_FOREVER.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2020-04-02 10:22:10 +02:00
Kumar Gala 0be9d2b18d drivers: entropy: rv32m1_trng: Add DTS support to rv32m1_trng driver
Add a YAML, DTS node and driver support to utilize data from devicetree
for register address and driver name.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-02 09:30:58 +02:00
Robert Lubos 111313581d net: ieee802154_radio: Enable ed_scan unconditionally
Energy scan procedure, while introduced specifically for OpenThread in
Zephyr, may also be used by other upper layers (like Zigbee).
Therefore, disable conditional inclusion of the `ed_scan` API.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-04-01 15:41:31 +03:00
Kumar Gala 36049b1657 drivers: Convert to use DT_INST_FOREACH
Convert drivers that have the following pattern:

   #if DT_INST_NODE_HAS_PROP(0, label)
   INIT_MACRO(0)
   #endif

   ...

   #if DT_INST_NODE_HAS_PROP(n, label)
   INIT_MACRO(n)
   #endif

to use DT_INST_FOREACH(INIT_MACRO) instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-31 19:29:22 -05:00
Kumar Gala cab9a229ff drivers: ipm: ipm_mhu: Fix typo bug in IRQ_CONNECT
The second paramater to IRQ_CONNECT for ipm_mhu_irq_config_func_0 should
be passing the priority, instead it passed the IRQ number.  Fix this to
pass priority (which matches ipm_mhu_irq_config_func_1).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-31 19:28:47 -05:00
Kumar Gala ff1eb62864 drivers: arm_cmsdk/arm: Convert drivers to new DT_INST macros
Convert older DT_INST_ macro use in arm_cmsdk/arm drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-31 19:28:47 -05:00
Daniel Leung 381271fd0d timer: mchp_xec_rtos: 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-03-31 19:52:21 -04:00
Andy Ross 7832738ae9 kernel/timeout: Make timeout arguments an opaque type
Add a k_timeout_t type, and use it everywhere that kernel API
functions were accepting a millisecond timeout argument.  Instead of
forcing milliseconds everywhere (which are often not integrally
representable as system ticks), do the conversion to ticks at the
point where the timeout is created.  This avoids an extra unit
conversion in some application code, and allows us to express the
timeout in units other than milliseconds to achieve greater precision.

The existing K_MSEC() et. al. macros now return initializers for a
k_timeout_t.

The K_NO_WAIT and K_FOREVER constants have now become k_timeout_t
values, which means they cannot be operated on as integers.
Applications which have their own APIs that need to inspect these
vs. user-provided timeouts can now use a K_TIMEOUT_EQ() predicate to
test for equality.

Timer drivers, which receive an integer tick count in ther
z_clock_set_timeout() functions, now use the integer-valued
K_TICKS_FOREVER constant instead of K_FOREVER.

For the initial release, to preserve source compatibility, a
CONFIG_LEGACY_TIMEOUT_API kconfig is provided.  When true, the
k_timeout_t will remain a compatible 32 bit value that will work with
any legacy Zephyr application.

Some subsystems present timeout (or timeout-like) values to their own
users as APIs that would re-use the kernel's own constants and
conventions.  These will require some minor design work to adapt to
the new scheme (in most cases just using k_timeout_t directly in their
own API), and they have not been changed in this patch, instead
selecting CONFIG_LEGACY_TIMEOUT_API via kconfig.  These subsystems
include: CAN Bus, the Microbit display driver, I2S, LoRa modem
drivers, the UART Async API, Video hardware drivers, the console
subsystem, and the network buffer abstraction.

k_sleep() now takes a k_timeout_t argument, with a k_msleep() variant
provided that works identically to the original API.

Most of the changes here are just type/configuration management and
documentation, but there are logic changes in mempool, where a loop
that used a timeout numerically has been reworked using a new
z_timeout_end_calc() predicate.  Also in queue.c, a (when POLL was
enabled) a similar loop was needlessly used to try to retry the
k_poll() call after a spurious failure.  But k_poll() does not fail
spuriously, so the loop was removed.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-03-31 19:40:47 -04:00
Andy Ross 32bb2395c2 timeout: Fix up API usage
Kernel timeouts have always been a 32 bit integer despite the
existence of generation macros, and existing code has been
inconsistent about using them.  Upcoming commits are going to make the
timeout arguments opaque, so fix things up to be rigorously correct.
Changes include:

+ Adding a K_TIMEOUT_EQ() macro for code that needs to compare timeout
  values for equality (e.g. with K_FOREVER or K_NO_WAIT).

+ Adding a k_msleep() synonym for k_sleep() which can continue to take
  integral arguments as k_sleep() moves away to timeout arguments.

+ Pervasively using the K_MSEC(), K_SECONDS(), et. al. macros to
  generate timeout arguments.

+ Removing the usage of K_NO_WAIT as the final argument to
  K_THREAD_DEFINE().  This is just a count of milliseconds and we need
  to use a zero.

This patch include no logic changes and should not affect generated
code at all.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-03-31 19:40:47 -04:00
Christian Hirsch d85b672368 drivers: sensor: ENS210: add single shot mode
Add possibility to change the measurement modes
of the temperature and humidity measurements to
continuous or single-shot mode or switch them off.

Signed-off-by: Christian Hirsch <christian.hirsch@tuwien.ac.at>
2020-03-31 15:11:43 +02:00
Stephanos Ioannidis 57c28c0d44 drivers: ethernet: sam_gmac: Convert to new DT_INST macros
This commit converts the Atmel SAM GMAC driver to use the new DT_INST
macro APIs.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-31 08:08:29 -05:00
Stephanos Ioannidis b5745a8350 drivers: ethernet: sam_gmac: Use device tree values
This commit updates the Atmel SAM GMAC driver to use the device tree
values for GMAC hardware configuration.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-31 08:08:29 -05:00
Vincent Wan 16fab6c4f8 drivers: cc13xx_cc26xx: guard references to sleep states
Use of macros such as SYS_POWER_STATE_SLEEP_2 needs to be guarded by
making sure CONFIG_SYS_POWER_SLEEP_STATES is defined.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-31 07:38:31 -05:00
Maureen Helm 10ffb888f0 drivers: gpio: Fix mcux lpc driver interrupts for port 1
The mcux lpc driver assumes that PINT interrupts are assigned to GPIO
port instances in groups of four, meaning that GPIO0 uses PIN_INT0-3 and
GPIO1 uses PIN_INT4-7. There was a mistake in the pin assignment
calculation that caused GPIO1 to incorrectly attach pins to PIN_INT0-3.

This caused the gpio isr to be invoked with what appeared to be the
wrong device argument and therefore not invoke any of the expected gpio
callbacks. But actually, it was the wrong irq that fired.

Found when adding support for the accelerometer interrupt on the
lpcxpresso55s69 board.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-03-31 14:05:16 +02:00
Oleg Zhurakivskyy 056d57a338 drivers: ieee802154: Add a missing include
Add a missing include of debug/stack.h in order to fix the
compilation warning on implicit declaration of log_stack_usage().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-31 07:18:06 +02:00
Oleg Zhurakivskyy b1e1f64d14 global: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT()
Replace all occurences of BUILD_ASSERT_MSG() with BUILD_ASSERT()
as a result of merging BUILD_ASSERT() and BUILD_ASSERT_MSG().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-31 07:18:06 +02:00
Kumar Gala f078f6527e drivers: ieee802154: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 17:04:32 -05:00
Kumar Gala 3501766231 drivers: led_strip: ws2812_gpio: Fixup one missed DT_INST conversion
Fixed one case in which the conversion to the new DT_INST macro's got
missed in the ws2812_gpio driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 14:49:58 -05:00
Kumar Gala 75e28f6de9 drivers: bluetooth: hci: spi: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 14:49:27 -05:00
Kumar Gala d86a5ebff3 drivers: lora: sx1276: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 14:48:46 -05:00
Kumar Gala 80f0db4bd6 drivers: uart: uart_xlnx_ps: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 14:48:09 -05:00
Kumar Gala 67d42d67f4 drivers: intc: intc_shared_irq: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 14:39:56 -05:00
Kumar Gala b00697a9b1 drivers: modem: wncm14a2a: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 14:38:58 -05:00
Kumar Gala 12e273a1d4 drivers: gpio: sx1509b: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 13:18:34 -05:00
Kumar Gala 7ea5f79ae2 drivers: wifi: winc1500: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 13:15:43 -05:00
Henrik Brix Andersen 5daf522997 drivers: eeprom: at2x: use new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-30 13:14:43 -05:00
Kumar Gala 379aac5c97 drivers: uart: uart_nsim: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 13:13:20 -05:00
Kumar Gala 7c6c0883e8 drivers: uart: uart_msp432p4xx: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 13:11:55 -05:00
Kumar Gala 7d566db04c drivers: intc: intc_swerv_pic: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 13:10:28 -05:00
Kumar Gala 73c1f8d63e drivers: spi: spi_oc_simple: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 13:09:34 -05:00
Kumar Gala bf4246ad6b drivers: modem: ublox-sara-r4: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 13:08:30 -05:00
Kumar Gala 329dbefb37 drivers: ethernet: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 13:01:22 -05:00
Francois Ramu 66fd31959c drivers: pinmux: stm32: add pin for UART5 on H7 series
Enable UART5 Rx and TX pins for H7 series:
H742, H743/753, H745/755, H747/757, H750.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-03-30 12:58:10 -05:00
Kumar Gala 88469b7010 drivers: litex: Convert litex drivers to new DT_INST macros
Convert older DT_INST_ macro use in litex drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 12:49:43 -05:00
Ioannis Glaropoulos ba6dc5bc25 drivers: dma: sam0: fix macro definition
Fix the definition of DMA_SAM0_IRQ_CONNECT
pre-processor directive, so that it calls
DT_INST_IRQ_BY_IDX macro instead of
DT_INST_IRQ_HAS_IDX macro.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-03-30 08:32:17 -05:00
Kumar Gala 0de3a33a83 drivers: i2c: i2c_dw: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 08:29:30 -05:00
Kumar Gala 0c4779d413 drivers: spi: spi_dw: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 08:29:30 -05:00
Kumar Gala e6e5d868e1 drivers: usb: usb_dw: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 08:29:30 -05:00
Kumar Gala f74ddd3f6d drivers: interrupt_controller: intc_dw: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 08:29:30 -05:00
Kumar Gala 526f6cadd7 drivers: gpio: gpio_dw: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 08:29:30 -05:00
Kumar Gala 1aa5b5a414 drivers: dma: dma_dw: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-30 08:29:30 -05:00
Kumar Gala 095205291e drivers: gpio_sifive: Fixup old DT_INST macro
Convert DT_INST_0_SIFIVE_GPIO0_IRQ_##n to use the new DT macros:
DT_INST_IRQ_BY_IDX(0, n, irq).  Also tweak a use of
DT_INST_IRQ_HAS_CELL(0, irq) to DT_INST_IRQ_HAS_IDX(0, 0) to match
style.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-29 09:10:56 -05:00
Peter A. Bigot 5a0039edb7 drivers: sifive: fix pending clear for falling edge
The wrong register was used clearing pending interrupts on falling
edge cases.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-03-29 09:10:18 -05:00
Kumar Gala 6c2451c5c0 adc: adc_lmp90xxx: Remove DT_INST_0_* comments
We have a number of cases that now look like:
   #if DT_HAS_COMPAT(ti_lmp90077)
   LMP90XXX_DEVICE(90077, 0, 16, 4);
   #endif /* DT_INST_0_TI_LMP90077 */

The DT_INST_0_TI_LMP90077 comment is stale, and doesn't add much since
the #if associated with the #endif is just 2 lines up.  Removing the old
comments seems the best cleanup.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-28 17:25:26 -05:00
Henrik Brix Andersen 23957a8938 drivers: adc: lmp90xxx: convert to new DT API
Use the new devicetree.h API instead of the legacy macros.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-28 10:22:23 -05:00
Henrik Brix Andersen ebc1eff7b5 drivers: gpio: lmp90xxx: convert to new DT API
Use the new devicetree.h API instead of the legacy macros.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-28 10:22:23 -05:00
Henrik Brix Andersen 3de3ad0ffc drivers: adc: lmp90xxx: prevent SPI transactions from ISR context
Add checks to prevent SPI transactions from being run in ISR
context. This affects both the LMP90xxx ADC and GPIO drivers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-28 10:22:23 -05:00
Henrik Brix Andersen ee97ab2bd8 drivers: adc: lmp90xxx: validate ADC sequence channels mask
Validate the channels mask passed from adc_read().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-28 10:22:23 -05:00
Henrik Brix Andersen 15be7a5723 drivers: adc: lmp90xxx: move calibration setup to acquisition thread
Move calibration setup SPI transaction to acquisition thread to allow
adc_read_async() to be called from ISR context.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-28 10:22:23 -05:00
Henrik Brix Andersen 64bed8add6 drivers: adc: lmp90xxx: make adc_context_start_sampling() ISR safe
Introduce a dedicated function for performing an entire LMP90xxx ADC
channel read and sample all channels in one go in the ADC acquisition
thread.

This removes the SPI transactions from adc_context_start_sampling()
which can be called in k_timer ISR context for consecutive ADC reads.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-28 10:22:23 -05:00
Henrik Brix Andersen 9909a46f1f drivers: adc: lmp90xxx: use common crc8 implementation
Use the common Zephyr CRC8 SW implementation instead of a
driver-specific implementation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-28 10:22:23 -05:00
Henrik Brix Andersen fce6a8b853 drivers: adc: lmp90xxx: do not exit acquisition thread on error
Keep the acquisition thread running even if an ADC reading failed.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-28 10:22:23 -05:00
Kumar Gala 0a74d12685 drivers: gpio: gecko: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-28 10:20:07 -05:00
Kumar Gala decb7a3c6d drivers: uart: uart_miv: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-28 10:18:02 -05:00
Kumar Gala 924d60f752 drivers: i2c: i2c_nios2: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-28 10:17:31 -05:00
Kumar Gala 0deff64454 drivers: display: ssd16xx: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 16:55:28 -05:00
Kumar Gala b29ff3d4d2 drivers: display: ssd1306: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 16:55:28 -05:00
Kumar Gala ac70d4b6ab drivers: display: gd7965: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 16:55:28 -05:00
Kumar Gala 09b1cd90d8 drivers: display: st7789v: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 16:55:28 -05:00
Kumar Gala ee4026baba drivers: display: ili9340: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 16:55:28 -05:00
Kumar Gala 70a0063b69 drivers: serial: uart_ns16550: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 16:54:50 -05:00
Kumar Gala 81ac58697e drivers: gpio: cc32xx: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 15:18:00 -05:00
Kumar Gala 9f6d9573fd drivers: ipm: fix build issue from DT macro conversion
Since idc_read/idc_write are used outside of the driver we can't use the
DT_INST_... form (that utilize DT_DRV_COMPAT) of the macro's in
ipm_cavs_idc_priv.h.  Use DT_INST(0, intel_cavs_idc) explicitly in the
header to fix the build issue.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 11:41:16 -05:00
Henrik Brix Andersen 85c996b016 drivers: counter: add NXP Kinetis LPTMR driver
Add counter driver for the NXP Kinetis Low Power Timer (LPTMR). The
driver can be configured either as 16 bit counter or 16 bit pulse
counter.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-27 11:17:58 -05:00
Kumar Gala 7fafce6eac drivers: video: mt9m114: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 11:06:06 -05:00
Kumar Gala 7264946c4a drivers: wifi: eswifi: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 11:05:19 -05:00
Kumar Gala 28870e7a32 drivers: atmel sam0: Convert atmel sam0 drivers to new DT_INST macros
Convert older DT_INST_ macro use in atmel sam0 drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 11:02:57 -05:00
Torsten Rasmussen d7862cf776 cmake: using ${ZEPHYR_BASE} instead of $ENV{ZEPHYR_BASE}
With the introduction of ZephyrConfig.cmake all parts of CMake code
should rely on the CMake ZEPHYR_BASE variable instead of the environment
setting.

This ensures that after the first CMake invocation, then all subsequent
invocation in same build folder will use same zephyr base.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Henrik Brix Andersen 53615ab11b drivers: adc: add Microchip MCP320x driver
Add driver for the Microchip MCP3204/MCP3208 12 bit ADCs with SPI
interface.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-27 16:17:06 +01:00
Kumar Gala 4d977e43ca drivers: flash: spi_nor: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 10:05:46 -05:00
Kumar Gala 11c8de15a8 drivers: flash: spi_flash_w25qxxdv: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 10:00:29 -05:00
Tomasz Bursztyka df368e8094 samples/net: Adding relevant parts to test PM on echo server
Just to get something to test for PM, via frdm_k64f board. So only this
board will get PM enabled.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-03-27 14:48:30 +02:00
Tomasz Bursztyka db6f896c00 drivers/ethernet: Add support for power management into MCUX
Requesting the clock controller to switch on or off the device.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-03-27 14:48:30 +02:00
Tomasz Bursztyka 697b63ea0f drivers/clock_gate: Support on/off operationf in mcux's SIM driver
Logic to enable/disable the relevant clock was fully missing.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-03-27 14:48:30 +02:00
Tomasz Bursztyka 4ae72db135 net: Enable PM settings on network devices
By changing the various *NET_DEVICE* macros. It is up to the device
drivers to either set a proper PM function or, if not supported or PM
disabled, to use device_pm_control_nop relevantly.

All existing macro calls are updated. Since no PM support was added so
far, device_pm_control_nop is used as the default everywhere.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-03-27 14:48:30 +02:00
Kumar Gala 63ccb98eee drivers: openisa: Convert openisa drivers to new DT_INST macros
Convert older DT_INST_ macro use in openisa drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 05:28:37 -05:00
Kumar Gala cdbc0f8c22 drivers: serial: uart_native_posix: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 04:55:43 -05:00
Kumar Gala 7c07c45a63 drivers: gpio: gpio_pca95xx: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 04:55:06 -05:00
Kumar Gala 683056a86d drivers: eeprom: eeprom_simulator: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 04:54:00 -05:00
Kumar Gala 0187a76bed drivers: eeprom_slave: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 04:53:38 -05:00
Kumar Gala d6e804ac4e drivers: ipm: ipm_cavs_idc: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 04:53:12 -05:00
Kumar Gala a464ae7163 drivers: wifi: esp: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-27 04:51:58 -05:00
Thomas Schmid 7f5bdfb2a4 drivers: flash: stm32: fix warnings about format specifiers
Newlibc defines off_t as long int. Change %d format specifier
to %ld for logging of offsets.

Signed-off-by: Thomas Schmid <tom@lfence.de>
2020-03-27 10:15:03 +01:00
Kieran Levin acac1584bc drivers: serial: add dts peripherals to stm32g0
Added device tree nodes and associated headers for
defined uarts on the stm32g0 and stm32g07x 8x parts.

Tested with uart on stm32g071rb disco board with usart3 going to stlink.
Using shell.

Signed-off-by: Kieran Levin <ktl@frame.work>
2020-03-26 22:45:01 +01:00
Kumar Gala 7a81cd9747 drivers: microchip: Convert microchip drivers to new DT_INST macros
Convert older DT_INST_ macro use in microchip drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 16:31:52 -05:00
Kumar Gala 3af49c5b55 drivers: atmel sam: Convert atmel sam drivers to new DT_INST macros
Convert older DT_INST_ macro use in atmel sam drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 16:31:31 -05:00
Kumar Gala 020a899ec3 drivers: sifive: Convert sifive drivers to new DT_INST macros
Convert older DT_INST_ macro use in sifive drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 16:06:09 -05:00
Kumar Gala 1c3ed6dab6 devicetree: Rename spi cs gpio macros
Rename the DT_*_CS_* macro's to DT_*_CS_GPIOS_* to be more clear.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 12:24:23 -05:00
Kumar Gala 989484b4bf drivers: stm32: Convert STM32 drivers to new DT_INST macros
Convert older DT_INST_ macro use in STM32 drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 12:22:12 -05:00
Kumar Gala f9efa0ce67 drivers: audio: mpxxdtyy: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 11:55:52 -05:00
Kumar Gala 15e1ef2d73 drivers: audio: tlv320dac310x: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 11:55:19 -05:00
Peter A. Bigot f56f5fabad gpio: sifive: fix interrupt handling
The primary problem was that the callback was being invoked twice,
which broke the tests.

A secondary issue is that when two level tests occur consecutively the
second will fail.  Instrumentation confirms that the registers are
being configured correctly, and ip indicates that the condition was
detected, but the interrupt does not occur.  Tests pass as long as no
level test precedes the failing test.

It's not clear whether this is an issue with the PLIC, or the GPIO
implementation (hardware or software).  As "normal" GPIO applications
appear to work we'll run with it and keep an issue open.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-03-26 11:11:02 -05:00
Robert Lubos cce9d19ca8 drivers: ieee80154_nrf5: Add support for PAN coordinator mode
Implement `IEEE802154_CONFIG_PAN_COORDINATOR` handling.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-03-26 17:42:40 +02:00
Robert Lubos f8092789b7 drivers: ieee80154_nrf5: Add support for promiscous mode
Implement `IEEE802154_CONFIG_PROMISCUOUS` handling.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-03-26 17:42:40 +02:00
Stephanos Ioannidis 22d0a1dfb3 drivers: ethernet: sam_gmac: Do not use "NTO" typedef style
The Atmel DFP headers define two "component typedef styles": RFO and
NTO; where the latter makes use of bit field structs to access hardware
registers.

The default component typedef style assumed by the DFP headers (i.e.
when `COMPONENT_TYPEDEF_STYLE` is not explicitly defined) is "RFO" and
this is indeed the component typedef style used throughout the Zephyr
Atmel SAM drivers, except in the particular instance which this commit
addresses.

The use of `GMAC_TA_Type` bit field struct, which is an "NTO" style
construct, is no longer possible with the latest DFPs because
conditional compilation checks for the bit field struct definitions
were added to restrict the use of such constructs to only when the
global component typedef style is set to "NTO".

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-26 09:23:48 -05:00
Stephanos Ioannidis c4479d0643 drivers: usb_dc_sam: Use mode-specific interrupt register fields
The new Atmel DFP USBHS component headers provide mode-specific
interrupt register field definitions that replace the generic
definitions (e.g. `USBHS_DEVEPTISR_RXSTPI` for a control endpoint is
now `USBHS_DEVEPTISR_CTRL_RXSTPI`).

This commit updates the Zephyr SAM USBHS driver to use the new
mode-specific interrupt register field definitions.

In addition, it maps the generic definitions to the mode-specific
definitions, as the revision A variant headers (e.g. same70a) in the
latest DFPs, at the time of writing, still provide only the generic
definitions.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-26 09:23:48 -05:00
Kumar Gala 8ea8925ebe drivers: esp32: Convert esp32 drivers to new DT_INST macros
Convert older DT_INST_ macro use in esp32 drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 08:49:11 -05:00
Kumar Gala b99ee328f8 drivers: serial: esp32: rename fake DT define
Rename DT_INST_{0,1,2}_ESPRESSIF_ESP32_UART_IRQ_0 defines to something
non-DT prefixed.  This way we know which defines are one's we generate
and which ones are driver created.  It should be easy enough to replace
these INST_{0,1,2}_ESPRESSIF_ESP32_UART_IRQ_0 define with DTS generated
one macros once esp32 has interrupt controller support in DTS.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 08:49:11 -05:00
Kumar Gala 4cb0a5d992 drivers: silabs: Convert silabs drivers to new DT_INST macros
Convert older DT_INST_ macro use in silab drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 05:26:23 -05:00
Kumar Gala e7df99d4ee drivers: cc13xx_cc26xx: Convert drivers to new DT_INST macros
Convert older DT_INST_ macro use in cc13xx_cc26xx drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 05:20:19 -05:00
Kumar Gala 3bc3f2af80 drivers: led_strip: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 05:19:00 -05:00
Kumar Gala 59379f9d53 drivers: kscan: ft5336: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 03:41:35 -05:00
Kumar Gala 4b9fe8a24e drivers: mcux: Convert MCUX drivers to new DT_INST macros
Convert older DT_INST_ macro use in MCUX drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 03:40:09 -05:00
Kumar Gala aa5adf3c79 drivers: stellaris: Convert stellaris drivers to new DT_INST macros
Convert older DT_INST_ macro use in stellaris drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 03:39:11 -05:00
Kumar Gala 0bf9e0da94 drivers: can: can_mcp2515: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 03:34:37 -05:00
Kumar Gala 5f3154ceff drivers: led: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 03:32:26 -05:00
Kumar Gala a6e94a38b3 drivers: gpio: ht16k33: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 03:31:28 -05:00
Kumar Gala 27bb8b9513 drivers: led: ht16k33: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 03:31:28 -05:00
Kumar Gala 227d5b1395 drivers: interrupt_controller: ioapic: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 03:29:23 -05:00
Kumar Gala 4c5f8acf4a drivers: timer: hpet: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 03:29:23 -05:00
Kumar Gala 16054e6d0f drivers: gpio: intel_apl: Convert to new DT_INST macros
Convert older DT_INST_ macro use the new include/devicetree.h
DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 03:29:23 -05:00
Daniel Leung 4b4593e76b interrupt_controller: cavs: add CPU offset for intel_apl_adsp
This adds the per CPU address offset for intel_apl_adsp, so
the correct base address can be calculated under SMP.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung 492e890cd6 ipm: add driver for the CAVS DSP Intra-DSP Communication (IDC)
This adds a rather primitive driver for use with the Intra-DSP
Communication (IDC) on the DSP on certain Intel SoCs. The IDC
generates interrupts from one core to another by writing to
certain registers. This is also being utilized as
the scheduler IPI since it can interrupt other cores.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung 6d49e7c692 timer: add CAVS DSP wall clock timer for Intel SoC
The DSP wall clock timer on some Intel SoC is a timer driven
directly by external oscillator and is external to the CPU
core(s). It is not as fast as the internal core clock, but
provides a common and synchronized counter for all CPU cores
(which is useful for SMP).

This uses the RISCV timer as base as it is using 64-bit
counter.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung e6d468ac22 interrupt_controller: cavs: add support in ISR for SMP
The CAVS interrupt controller has different base addresses for
each CPU. When running under SMP, the driver needs to look at
the correct address for the CPU the ISR is running so interrupts
can be dispatched correctly. This adds a function to calculate
the correct base address. Note that each supported SoC may have
different offsets so per SoC config will need to added. Support
for intel_s1000 is added as an example.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung b4a7eed82e interrupt_controller/dw_ictl: need to be initialized earlier
The dw_ictl interrupt controller is an interrupt aggregator
supporting multi-level interrupts. Therefore, it needs to be
initialized earlier than any downstream interrupt controllers
and devices.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Daniel Leung 518f329b3a interrupt_controller/cavs_ictl: need to be initialized earlier
The cavs_ictl interrupt controller is an interrupt aggregator
supporting multi-level interrupts. Therefore, it needs to be
initialized earlier than any downstream interrupt controllers
and devices.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-25 19:07:28 -04:00
Vincent Wan c806947d87 drivers: i2c: cc13xx_cc26xx: reset pin type when entering low power mode
It was observed that leaving the pin type configured for i2c for SDA
and SCL results in higher power consumption during standby. So we are
resetting the pin type when bringing the i2c into low power mode, and
setting it back to the correct type when exiting low power mode.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan f23940c678 drivers: i2c: cc13xx_cc26xx: add power management support
Add a dependency on the I2C resource in the TI Power module,
reconfigure the peripheral upon CPU exiting standby, and add
support for device PM.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan ddfb1b5ec7 drivers: spi: cc13xx_cc26xx: add power management support
Add a dependency on the SSI resource in the TI Power module, and add
support for device PM.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan e21bb3a812 drivers: serial: cc13xx_cc26xx: add power management support
Add a dependency on the UART resource in the TI Power module,
reconfigure the UART upon CPU exiting standby, and add support
for device PM.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Vincent Wan d2cf6c4a74 drivers: gpio: cc13xx_cc26xx: add power management support
Adding a dependency on the GPIO resource in the TI Power module, and
configuring the edge detection on pads as a wakeup source.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-03-25 16:21:33 -04:00
Christian Hirsch 6380c24626 drivers: sensor: BME280: add forced sampling mode
add the forced sampling mode, to take just a single
measurement when fatching a sample

Signed-off-by: Christian Hirsch <christian.hirsch@tuwien.ac.at>
2020-03-25 14:52:07 -05:00
Flavio Ceolin 81d96d6e9b drivers: counter: Fix get_value verification handler
z_vrfy_counter_get_value should check the size of memory pointed to
ticks and not the size of the pointer.

Fixes: #22431
Coverity CID :207984

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-03-25 16:25:45 +01:00
Kumar Gala 9ede3c9a97 drivers: serial: uart_pl011: remove shared irq support
The shared irq support isn't needed in this driver.  We just need to
deal with the fact that some SoCs have only a single interrupt line and
some have three interrupts.  We can just ifdef that based on
DT_NUM_IRQS.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-25 08:34:40 -05:00
Jukka Rissanen b50dabb9fd drivers: eth: enc28j60: Add VLAN support
Add Virtual LAN support to enc28j60 Ethernet driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-25 15:06:38 +02:00
Ismael Fillonneau 6fd5dd894e drivers: i2c: nrfx: Fix power management assert
Calling device_set_power_state() with DEVICE_PM_SUSPEND_STATE then
DEVICE_PM_OFF_STATE creates an assert in nrf driver

Signed-off-by: Ismael Fillonneau <ismael.fillonneau@stimio.fr>
2020-03-24 14:36:15 -05:00
Alexander Wachter 802552414c drivers: flash: stm32g4: Fix erase on wrong bank
In the default configuration of the stm32g4 is the dual bank mode.
In dual bank mode, the flash is split into two banks with 256k each.
The erase pages have a range form 0 to 127, where each page has 2k.
If one wants to erase an area above 256k, the driver has to switch
to bank 2 befor erasing. Otherwise it will erase the page moulo 127.

Signed-off-by: Alexander Wachter <alexander.wacher@leica-geosystems.com>
2020-03-24 14:25:47 -05:00
Alexander Wachter 7b9320beed drivers: flash: stm32: Introduce logs in the flash code
This commit introduces some logs in the stm32 flash implementation.
Thith the logs it is easier to locate problems when they arrise.

Signed-off-by: Alexander Wachter <alexander.wacher@leica-geosystems.com>
2020-03-24 14:25:47 -05:00
Peter A. Bigot 93309317d0 uart: sifive: fix interrupt-driven transmission
A txcnt of zero prevents transmission, as transmit requires the number
of entries in the transmit fifo to be strictly less than the txcnt
value.  Set the default to 1.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-03-24 13:28:58 -04:00
Piotr Mienkowski 8a9df52943 drivers: gpio_gecko: convert to DT_INST defines
Convert the driver to use DT_INST_ defines, update all dependent dts,
soc and board files.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2020-03-24 10:14:21 -05:00
Kumar Gala 8d2f22f9ea drivers: sensor: fxos8700: convert to new DT API
Use the new devicetree.h API instead of the legacy macros.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-24 10:11:20 -05:00
Kumar Gala 8f84520130 drivers: serial: uart_sifive: convert to new DT API
Use the new devicetree.h API instead of the legacy macros.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-24 10:11:20 -05:00
Martí Bolívar ffcf7cad6a drivers: spi: convert spi_nrfx_spim.c to new DT API
This allows us to start using DT_NODELABEL() to access SPIMs that way,
instead of via an alias.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-24 10:11:20 -05:00
Martí Bolívar f50b0689b5 drivers: serial: convert uart_nrfx_uart to new DT API
Use the new devicetree.h API instead of the legacy macros.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-03-24 10:11:20 -05:00
Jose Alberto Meza 04e190ab87 drivers: peci: xec: Re-add error recovery handling
Using temp variable to avoid coverity issue without breakin
error recovery.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-03-23 17:16:46 -07:00
Flavio Ceolin f0a4cb059d drivers: uart: Add uart_configure verification handler
uart_configure verification handler was missing what would cause a crash
if called from a user thread.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-03-23 15:23:50 -04:00
Flavio Ceolin 017c142fd2 drivers: uart: Add config_get verification handler
uart_config_get API was broken in USERSPACE because was lacking the
verification handler.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-03-23 15:23:50 -04:00
Anas Nashif 24f77ca167 drivers: peci: remove self-assignment
Assigning "base->ERROR" to itself has no effect.

Fixes #23586

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-23 14:10:58 -04:00
Pooja Karanjekar 558b904d80 drivers: entropy: gecko: Implement ISR specific get entropy call
Add the get_entropy_isr API function for the gecko entropy
driver. When the function is invoked without the ENTROPY_BUSYWAIT
flag, it returns whatever data is available in a non-blocking manner.

Signed-off-by: Pooja Karanjekar <pooja.karanjekar@lemonbeat.com>
2020-03-23 18:42:46 +01:00
Armand Ciejak 6c1afb0779 drivers: eth: mcux: Write correct data into PHY_CONTROL2_REG register
Starting a SMI write operation without waiting for completion of the
preceding SMI read operation cause the write operation to fail if
the time between the 2 operations it too short. This leads to the
PHY being in an unusable state on the MIMRT1060-EVK eval board.

In addition the value of the register was not used, as consequence
some bits were not preserved.

The solution is to do a read/modify/write to set only the
ref clock bit, which sets the PHY into 50MHz clock mode,
and keep the value of the other bits.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-03-23 09:05:17 -05:00
Armand Ciejak c168f45e60 drivers: eth: mcux: Prevent PHY entering factory test mode
Force PHY normal operation in eth_mcux_phy_setup in case strap-in
pins configure the PHY in factory test mode.

Signed-off-by: Armand Ciejak <armand@riedonetworks.com>
2020-03-23 09:01:15 -05:00
Erwan Gouriou 5cd10c70bd drivers/flash: stm32: DT_INST_0_SOC_NV_FLASH_LABEL is not dev name
Don't use DT_INST_0_SOC_NV_FLASH_LABEL as device name.
Use DT_FLASH_DEV_NAME instead

Fixes #23678

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-03-23 08:51:22 -05:00
Gerson Fernando Budke 8614ea8e0b drivers: ieee802154: rf2xx: Fix OT ACK handling
At OpenThread stack on ieee802154_radio_handle_ack method the
net_pkt_read fail because net_pkt_cursor wasn't proper initialized.
This ensures that net_pkt_cursor is initialized for any ack frame.

Another hidden problem fixed was the frags property on net_buf. Now
it is defined as NULL to ensures that no fragments are available.

The ack frame should be returned to OT only if requested. In this
case, the IEEE 802.15.4 Frame Control field from TX frag is now
verified for an ACK request and if OT requires ACK response it will
be proper handled and dispatched.

Fixes #23595

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-23 12:13:42 +02:00
Markus Becker a64880d9c0 drivers: ieee802154: Fix compile errors in RF2XX
Fix compile errors hidden behind ifdef.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-23 12:13:42 +02:00
Stephanos Ioannidis fc941d583e drivers: timer: xlnx_psttc_timer: Implement tickless support
This commit reworks the Xilinx TTC timer driver to use the "match" mode
instead of the "interval" mode which counts up to the specified value
and resets to zero.

Using the "match" mode ensures that the timer keeps counting even after
an interrupt is triggered, and facilitates the tickless mode support
implementation.

This also allows `z_timer_cycle_get_32` to return the correct cycle
count when interrupt is locked; thereby, fixing the k_busy_wait hang
issue.

Note that the TTC "match" mode emulation (and tickless timer operation)
is only stable when the QEMU icount mode is enabled.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-21 14:20:17 -04:00
Stephanos Ioannidis 7b1a6606ad drivers: timer: xlnx_psttc_timer: Use the current system timer API
This commit updates the 'xlnx_psttc_timer' to implement the current
system timer API.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-21 14:20:17 -04:00
Tobias Svehagen 7b5f6bc660 drivers: wifi: Add ESP8266 and ESP32 wifi modem driver
This adds support for the Espressif ESP8266 and ESP32 devices to be used
as peripherals on a UART.

There are two main AT command versions that can be selected, 1.7 and
2.0. Since they behave a bit different it is important to select the
one that matches the used in the firmware on your device.

When downloading large amounts of data it is highly recommended to
enable CONFIG_ESP_PASSIVE_TCP and flow control on the UART so that
data is not lost due to UART speed or receive buffer size.

Currently unsupported:
- Changing UDP endpoint with a sendto()
- Bind to a specific local port
- Server socket operations, ie listen() and accept()

Official AT firmware for ESP8266 and ESP32 can be found at:
https://github.com/espressif/esp-at

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-03-21 19:08:02 +02:00
Stephanos Ioannidis aa85756bf5 drivers: ethernet: eth_sam_gmac: Detect and report link status
This commit adds the "monitor task" to detect and report any changes
in the PHY link status to the operating system.

The monitor task is perodically executed to poll the link status from
the PHY and call `net_eth_carrier_{off,on}` based on the detected
link status change.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-21 15:37:59 +02:00
Stephanos Ioannidis d7a77fff99 drivers: ethernet: eth_sam_gmac: Do not force RMII
The `link_configure` function currently configures the `GMAC_UR`
register and forces the RMII interface.

This is not necessary because the `GMAC_UR` register is already
configured with an appropriate value based on `CONFIG_ETH_SAM_GMAC_MII`
in `gmac_init`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-21 15:37:59 +02:00
Stephanos Ioannidis 0e6be2e49b drivers: ethernet: phy_sam_gmac: Add link status query function
This commit adds the PHY link status query function that can be used
for detecting the Ethernet connection.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-21 15:37:59 +02:00
Armando Visconti a302786e9b drivers/sensor: add support to IIS2MDC magnetometer sensor
The IIS2MDC is a 3D digital magnetometer ultra-low power sensor
for industrial applications, which can be interfaced through
either I2C or SPI bus.

https://www.st.com/resource/en/datasheet/iis2mdc.pdf

This driver is based on stmemsc i/f v1.02.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-03-20 14:53:42 -05:00
Krzysztof Chruscinski 729a9b0050 drivers: serial: nrfx_uarte: Improve TX only mode
Added return -ENOTSUP in uart_rx_enable() if RX pin is disabled.
Fixed power management call where TASKRX was started even though
RX pin was disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-03-20 14:36:29 -05:00
Krzysztof Chruscinski 6a6063b57a drivers: serial: nrfx_uart: Allow TX only mode
Extended nrf_uart driver to support TX only.
When RX pin is not provided then RX is not started at all. This
allows to achieve low power with logging/console enabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-03-20 14:36:29 -05:00
Kumar Gala a288f07126 drivers: serial: uart_pl011: Unify uart clock from DT
Add a fixed clock to the qemu-virt-a53.dtsi to match how the musca dts
files work so we get the clock DT info in the same way in the driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-20 10:05:01 -05:00
Armand Ciejak 1f8c9c7efc drivers: eth: mcux: Print interface name in link status messages
Add interface name to link up/down information message
to help tracking which port is changing status.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak 309916930f drivers: eth: mcux: Fix wrong base address for second controller
Copy paste error, base address of second controller was set to the
same as the first one, corrected to ENET2.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak 7f4043099a drivers: eth: mcux: Print interface name instead of base register address
With Ethernet controller base address is not straight forward
to figure out if it is ENET or ENET2l, using name is much better.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak 7cddc83737 drivers: eth: mcux: Add eth1 for i.MXRT1060 family
Instantiate a second Ethernet device if CONFIG_ETH_MCUX_1 is set.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak 2ef7d4d66c drivers: eth: mcux: Add PHY address to eth_context
This will allow having a different PHY address for each controller.
It also avoids for the PHY address to be hard-coded in several
functions.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak 162ec3f9d5 drivers: eth: mcux: Add generate_mac function pointer to eth_context
This will allow for different configuration between ENET and ENET2.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak 0e31ed4912 drivers: eth: mcux: Add config_func to eth_context structure
This will allow having a different function for the second
port.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak b56043c530 drivers: eth: mcux: Add ENET base address to eth_context structure
This will allow using either ENET or ENET2.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Armand Ciejak e8cb6c69ab drivers: eth: mcux: Add ETH_MCUX_1 config
Add new config allowing to enable the second Ethernet port
on i.MX RT1060 SoC family.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-20 10:55:04 +01:00
Ryan Erickson 6a625c371f drivers: modem: wncm14a2a: fix RX socket src/dst port assignment
Source and destination ports should be set properly
when assembling the receive socket data.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-03-20 10:54:51 +01:00
Peter Bigot 414bdde2f0 drivers: flash: spi_nor: avoid coverity warning in untested code
Coverity doesn't invoke the build for this module with a configuration
that provides a non-zero delay for entering or releasing deep power
down, so it sees a check that a value known to be non-negative
magically became negative without being touched, and so screams about
dead code.

Refactor to make the adjustments unconditional which has the same
effect in any reasonable level of optimization while making it
slightly less obvious that the value may not change.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-03-19 17:13:52 -04:00
Pooja Karanjekar b49501e3c9 drivers: entropy: gecko: add entropy driver based on GECKO TRNG
Add entropy driver based on GECKO TRNG module along with device
tree support for EFM32PG and EFR32MG SOCs.

Signed-off-by: Pooja Karanjekar <pooja.karanjekar@lemonbeat.com>
2020-03-19 15:45:01 -05:00
Carles Cufi 6574efa232 drivers: Add missing debug/stack.h include
In order to use log_stack_usage(), inclusion of <debug/stack.h> is
required.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-03-19 18:45:13 +01:00
Carles Cufi 4b37a8f3a4 Revert "global: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT()"
This reverts commit 8739517107.

Pull Request #23437 was merged by mistake with an invalid manifest.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-03-19 18:45:13 +01:00
Carles Cufi 4810906030 Revert "drivers: ieee802154: Add a missing include"
This reverts commit 979ed4e1cd.

Pull Request #23437 was merged by mistake with an invalid manifest.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-03-19 18:45:13 +01:00
Oleg Zhurakivskyy 979ed4e1cd drivers: ieee802154: Add a missing include
Add a missing include of debug/stack.h in order to fix the
compilation warning on implicit declaration of log_stack_usage().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-19 15:47:53 +01:00
Oleg Zhurakivskyy 8739517107 global: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT()
Replace all occurences of BUILD_ASSERT_MSG() with BUILD_ASSERT()
as a result of merging BUILD_ASSERT() and BUILD_ASSERT_MSG().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-19 15:47:53 +01:00
Krzysztof Chruscinski a36a478954 drivers: clock_control: nrf: Reworked calibration to use k_timer
Reworked calibration to not use HW platform which is not available on
some platforms (nrf53) and does not bring any value compared to using
system timer. Switched to use k_timer. Additionally, improved
calibration algorithm to request also LF clock before starting
calibration. This simplifies the algorithm because it does not need
to support disabling low frequency clock which in calibration.

Tests has been updated and simplified. Former tests relied on HW timer
event.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-03-19 15:15:23 +01:00
Stephanos Ioannidis 495407aabc interrupt_controller: gic: Fix GICD_ICFGR field definition names
This commit fixes the field definition names for `GICD_ICFGR`, which
were incorrectly prefixed with `GICC_`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-19 14:15:40 +01:00
Marek Pieta 75e36ed352 drivers: pwm_nrfx: Wait until PWM is stopped before restarting it
Change adds waiting until PWM is stopped before restarting it. Without
the change, calling the pwm_nrfx_pin_set function multiple times in
quick succession could cause a race condition causing the PWM to
remain stopped in case it should be restarted.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2020-03-19 12:29:51 +01:00
Takumi Ando 8d106d198e drivers: adc: Add STM32L1X ADC support
Add ADC driver support for STM32L1X SoC series.

Signed-off-by: Takumi Ando <takumi@t15.red>
2020-03-19 03:10:39 -05:00
Armando Visconti c0f7a1ac6f drivers/sensor: add support to ISM330DHCX IMU sensor
The ISM330DHCX is a ultra-low power IMU with a 3D digital accelerometer
and 3D digital gyroscope tailored for Industry 4.0 applications, which
can be interfaced through either I2C or SPI bus.

https://www.st.com/resource/en/datasheet/ism330dhcx.pdf

This driver is based on stmemsc i/f v1.02.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-03-18 16:14:47 -05:00
Gerard Marull-Paretas 39b1f6cbba drivers: i2c: stm32: add support for H7 series
Enable I2C driver for STM32 H7 series.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-03-18 15:48:48 -05:00
Gerard Marull-Paretas f2b9e5235f drivers: pinmux: stm32: fix PB6 LPUART1 alt function on H7
LPUART1 TX alternate function number for PB6 was not correct in the
pinmux settings for H7 series.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-03-18 15:48:48 -05:00
Loic Poulain 27a587db3c drivers: video: sw_generator: Flagged signal management
Driver needs to deal with signal/poll only if CONFIG_POLL is enabled.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-03-18 15:40:55 -05:00
Loic Poulain f0c3ea63ef drivers: video: sw_generator: Fix capabilities
Add possibility to configure resolution from 64x64 to 1920x1080.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-03-18 15:40:55 -05:00
Loic Poulain 4884e6c29a drivers: video: mcux_csi: Flagged signal management
Driver needs to deal with signal/poll only if CONFIG_POLL is enabled.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-03-18 15:40:55 -05:00
Loic Poulain a2a230e8f9 drivers: video: mcux_csi: Fix unordered stream
With new NXP HAL, MCUX CSI does not necesseraly start the
capture into the first submitted buffer. However the driver
expects that buffers will be captured in submitted order.
Fix that.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-03-18 15:40:55 -05:00
Loic Poulain 199ccba5e4 drivers: video: Fix video buffer alignment
k_mem_pool_malloc reserves some space for block descriptor at the start
of the data block, causing misalignement of returned video buffer.

In our context we want to return a video buffer with aligment matching
the video buffer poll alignment config. Fix that by using the simpler
k_mem_pool_alloc function.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2020-03-18 15:40:55 -05:00
Mieszko Mierunski 0278f9bc72 drivers: nrf: Flush RX fifo in UARTE Async API.
After RX is disabled during receiving, some bytes are received to
internal fifo. To not interfere with further transactions fifo has to be
flushed.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2020-03-18 13:21:04 +01:00
Jukka Rissanen 36ddeaceca drivers: eth: stm32: Add VLAN support
Add Virtual LAN support to stm32 Ethernet driver. Refactor the
eth_iface_init() and move device configuration settings to
eth_initialize() as the eth_iface_init() is called multiple
times (once / configured VLAN).

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-18 12:44:19 +02:00
Kumar Gala 47968e30cf drivers: spi: dw: handle flags differences in driver
Towards cleaning up (and hopefully removing dts_fixup.h in the near
future).  We need to move the handling of different names for the irq
flag propety into the driver and out of dts_fixup.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-17 19:37:59 -04:00
Kumar Gala 78ae42d86b drivers: gpio: dw: handle flags differences in driver
Towards cleaning up (and hopefully removing dts_fixup.h in the near
future).  We need to move the handling of different names for the irq
flag propety into the driver and out of dts_fixup.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-17 19:37:59 -04:00
Francois Ramu 36ec040473 driver: pinmux: stm32f7 configure speed for SPI clock pins
This patch is setting the pin to very high speed for all
the SPI2 clock outputs, for the stm32f7 soc series.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-03-17 16:01:22 -05:00
Erwan Gouriou 9367c6ad3f drivers/usb: usb_dc_stm32: Convert to DT_INST
Convert usb_stm32 driver to use of DT_INST macros.

Since driver is compatible with 3 different dt compatibles and
compatible string is included in DT_INST macros, I've kept the
DT_USB_ compatible agnostic macros based on DT_INST ones, which
allowed to remove fixup definitions.
Use of DT_USB symbols is now limited to usb_dc_stm32.

Additionally, compatible "st,stm32-otgfs" is removed from list
of compatibles for usbotg_hs ips.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-03-17 11:03:10 -06:00
Erwan Gouriou 6275513051 drivers: serial: uart_stm32: convert to DT_INST defines
Convert driver to use DT_INST_ defines.
In the process, we've removed all UART/USART/LPUART code in
device instanciation code which had no impact.
Since all uart/usart/lpuart nodes declare compatibility with
st,stm32uart, DT_INST_X_ST_STM32_UART_FOO could be used.

Removed DT_UART fixup macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-03-17 11:03:10 -06:00
Erwan Gouriou c2f19dc52e drivers: spi: spi_stm32: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-03-17 11:03:10 -06:00
Erwan Gouriou d3664b063e drivers/spi: stm32: Modify use of "st,stm32-spi-fifo" compatible
On stm32 spi devices, there are 2 main IP variants, with and w/o
fifo. Fifo is not really used today, but still there is some
additional code handling fifo. Today this code is protected under
Kconfig symbol SPI_STM32_HAS_FIFO.
This code carries redundant information vs dedicated compatible
"st,stm32-spi-fifo", which is provided as unique driver compatible
for devices supporting this IP as opposed to use of "st,stm32-spi"
when fifo is not supported.

Having these 2 compatibles defined exclusively is not convenient for
migration to DT_INST as DT_INST macros contain compatible string and
hence it cannot be used to provide common compatible code for devices
defining different compatibles.

Based on these observations, review stm32 spi devices compatible
declarations. Devices supporting fifo will now declare both
compatibles, as proposed by dt spec: "[compatible] property value
consists of a concatenated list of null terminated strings,
from most specific to most general". Hence field will now be:
"st,stm32-spi-fifo", "st,stm32-spi"

This way, fifo enabled stm32 spi devices will generate both:
DT_INST_STM32_SPI_FOO and DT_INST_STM32_SPI_FIFO_FOO
As well as:
DT_COMPAT_ST_STM32_SPI and DT_COMPAT_ST_STM32_SPI_FIFO
So, DT_INST_STM32_SPI_FOO could be used for device initialization.
Also DT_COMPAT_ST_STM32_SPI_FIFO could be used for FIFO handling
code inside driver. Hence use it to replace Kconfig symbol
SPI_STM32_HAS_FIFO.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-03-17 11:03:10 -06:00
Erwan Gouriou ac516aa888 drivers: pwm: pmw_stm32: convert to DT_INST defines
Convert driver to use DT_INST_ defines.
Removed DT_FLASH_DEV fixup macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-03-17 11:03:10 -06:00
Erwan Gouriou 22af564f19 drivers: flash: flash_stm32: convert to DT_INST defines
Convert driver to use DT_INST_ defines.
Removed DT_FLASH_DEV fixup macros, except DT_FLASH_DEV_NAME
used in applications.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-03-17 11:03:10 -06:00
Erwan Gouriou f289a6f3be drivers: counter: rtc_stm32: convert to DT_INST defines
Convert driver to use DT_INST_ defines.
Removed DT_RTC_0 fixup macros but keep DT_RTC_NAME_0 as it is
still in use across RTC users.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-03-17 11:03:10 -06:00
Erwan Gouriou 0c9b537edf drivers: adc: adc_stm32: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-03-17 11:03:10 -06:00
Kumar Gala c44a4d84e0 drivers: watchdog: wwdg_stm32: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-03-17 11:03:10 -06:00
Jukka Rissanen 330eb0f6f9 drivers: ethernet: stm32: Remove frag debug print in RX
The RX fragment debug print does not work (compile error)
if memory allocation debugging is enabled, so disable it
for time being.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-17 13:13:58 +02:00
Kumar Gala 8bf05c7d61 drivers: serial: pl011: Fix typo bug in port1 support
In the DT_INST conversion we introduced a typo bug of accessing port0
instead of port1 in the IRQ config function.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-17 08:51:33 +01:00
Henrik Brix Andersen 2703d4cd20 drivers: pwm: mcux_ftm: configure pwm in ticks, not frequency/percent
Configure the PWM period and pulse width in timer ticks instead of
calculating the frequency and duty cycle for use in the higher level
MCUX API. This improves the resolution of the PWM output signal
considerably.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-16 17:34:54 -05:00
Armando Visconti e13205b256 drivers/sensor: add support to IIS2DLPC accelerometer sensor
The IIS2DLPC is a 3D digital accelerometer ultra-low power sensor
for industrial applications, which can be interfaced through either
I2C or SPI bus.

https://www.st.com/resource/en/datasheet/iis2dlpc.pdf

This driver is based on stmemsc i/f v1.02

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-03-16 10:42:28 -05:00
Tomasz Bursztyka 8da8b5c933 drivers/console: Removing left-over cmake directive about telnet
Telnet console was move as a shell backend and is not anymore part of
console drivers.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-03-16 11:29:54 -04:00
Gerard Marull-Paretas ff8fea4ebb drivers: counter: stm32: enable support for H7 series
Enable counter driver support for H7 series. Tested with H743ZI MCU
using samples/drivers/counter/alarm.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-03-16 10:23:13 -05:00
Andrew Boie 760644041c net: purge NET_STACK and other stack APIs
The current design of the network-specific stack dumping APIs
is fundamentally unsafe. You cannot properly dump stack data
without information which is only available in the thread object.

In addition, this infrastructure is unnecessary. There is already
a core shell command which dumps stack information for all
active threads.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-14 13:10:19 -04:00
Andrew Boie 2b38b3b33b drivers: winc1500: do not use net_analyze_stack
This API is unsafe. Use log_stack_usage() instead and
set the thread name.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-14 13:10:19 -04:00
Andrew Boie 00f46df6ad drivers: ieee802154: do not use net stack API
Use log_stack_usage() instead, which does the same thing,
safely.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-14 13:10:19 -04:00
Timo Teräs 1c3b46daff driver: uart: ns16550: store active configuration in dev data
Update device data with the activated configuration, so that it
will be remembered for follow up configuration get requests.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2020-03-14 02:22:05 +02:00
Timo Teräs 6fd168e9a1 driver: uart: ns16550: convert to DT_INST_*
Change to code to use the automatically generated DT_INST_*
defines and remove the now unneeded configs and fixups.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2020-03-14 02:22:05 +02:00
Timo Teräs e740818093 driver: uart: ns16550: convert custom init options to DTS flow control
The sole purpose of init options has been to enable hardware flow
control on NS16750 when asked. Use the proper DTS tags for this.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2020-03-14 02:22:05 +02:00
Jose Alberto Meza 55e6b294f2 drivers: peci: Add PECI driver for microchip XEC family
Add PECI driver that support PECI API.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-03-13 18:53:04 +02:00
Jose Alberto Meza 0de98c1bce drivers: peci: Add Kconfig for PECI driver
Add the Kconfig for generic PECI drivers.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-03-13 18:53:04 +02:00
Jose Alberto Meza 150eee0fb6 drivers: espi: xec: Extend automatic warning VWire ack mechanism.
Expand configuration mechanism for additional eSPI host warnings.
Notify client driver when sleep A virtual wire is received.
Simplify virtual wire interrupt enabling.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-03-13 10:34:49 -04:00
Dominik Ermel 94248dcb1d drivers/flash: Fix missing ticker stop on timeout
There is timeout guard, in form of k_sem_get within work_in_time_slice,
used to detect if flash operation takes longer than expected maximum
and to return error code in such case. The processing of this timeout
is missing cancellation of scheduled ticker job that would attempt to
perform another operation. This causes problem as context for ticker
is created, on stack, within erase/write_in_timeslice which
would conclude when timeout occurs, folding the stack in process.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-03-13 09:30:49 -05:00
Kamil Rakoczy 687d1040ac Sensor: ADXL345: Add ADXL345 driver
Add support for Analog Devices ADXL345 3-axis I2C accelerometer.

Signed-off-by: Kamil Rakoczy <krakoczy@antmicro.com>
2020-03-13 08:53:43 -05:00
Francisco Munoz 7357ae974f drivers: sensors: Add tachometer driver for MEC family
Introduce the tach driver for the microchip XEC SoCs.

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@intel.com>
2020-03-13 08:49:21 -05:00
Mieszko Mierunski f818cdc33d drivers: nrf: Fix UARTE TX hangs when using both polling and async API.
Added locking for TX transfers between async and polling API.
Added safety counters for checking if transmission finished.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2020-03-13 11:13:43 +01:00
Mieszko Mierunski 0ca40205e5 drivers: nrf: Fix UART TX hanging when using both polling and async API.
Add locking between async and polling tx transfers.
Add safety counters while waiting for transmission to finish.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2020-03-13 11:13:43 +01:00
Stephanos Ioannidis 50519ce7ba interrupt_controller: gic: Refactor GIC driver interface
The current Generic Interrupt Controller (GIC) driver makes use of the
multi-level interrupt mechanism and `irq_nextlevel` public interface.

This is a less-than-ideal implementation for the following reasons:

1. The GIC is often used as the main interrupt controller for the
  Cortex-A and Cortex-R family SoCs and, in this case, it is not a 2nd
  level interrupt controller; in fact, it is the root interrupt
  controller and therefore should be treated as such.

2. The only reason for using `irq_nextlevel` here is to interface the
  architecture implementation to the interrupt controller functions.
  Since there is no nesting or multiple instances of an interrupt
  controller involved, there is really no point in adding such an
  abstraction.

3. 2nd level topology adds many unnecessary abstractions and results
  in strange coding artefacts as well as performance penalty due to
  additional branching.

This commit refactors the GIC driver interface as follows:

1. Remove the current GIC driver interface based on the multi-level
  interrupt mechanism and the `irq_nextlevel` public interface.

2. Define the GIC driver interface in
  `include/drivers/interrupt_controller/gic.h` and allow the arch
  implementation to directly invoke this interface.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-13 09:59:59 +01:00
Jose Alberto Meza b803b32541 drivers: espi: Obtain correct Rx lenght during OOB transaction.
MEC15xx eSPI OOB RX length register holds received message length
and receive buffer length, need to extract rcvd msg length.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-03-13 01:45:18 +02:00
Jukka Rissanen f53d9756be board: arm: black_f407ve: Initial support
Add support for black_f407ve board which is based on
stm32f407xx soc.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-12 20:18:39 +02:00
Wayne Ren f700022a35 arch: arc: bug fixes for running just one core for a multicore target
for smp target, there is a case where just one core is running, then:
* during init, the master core will run, others cores will halt/sleep
* use timer driver for single core

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-03-12 13:02:17 -04:00
Markus Fuchs 5f197b6c52 drivers: crypto: stm32: Add CAP_NO_IV_PREFIX capability
Add CAP_NO_IV_PREFIX capability support to the STM32 CRYP crypto driver,
so the initialization vector does not have to be prefixed to the
plaintext/ciphertext buffer.

Signed-off-by: Markus Fuchs <markus.fuchs@de.sauter-bc.com>
2020-03-12 17:52:46 +01:00
Alexander Wachter 79ed6a7e53 drivers: can: loopback: Use thread to send frames.
The loopback driver is a simple driver that can be used to
test CAN subsystems. The actual implementation sends frames
in the same thread that calls the send function.
Some libraries have problems with that behavior.
This PR implements a dedicated thread that calls the callback
for the receiving functions and a msgq in between the sender
and the TX thread.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-03-12 16:10:09 +02:00
Andrzej Głąbek 2b2a3b030f drivers: spi: nrfx: Prevent double nrfx_spi[m]_uninit calls
Attempt to deinitialize an nrfx driver that is not initialized results
in an assertion failure reported by the driver. And such attempt could
happen in SPI shims when the power state was switched between states
other than ACTIVE.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-03-12 08:57:14 -05:00
Philémon Jaermann 73ae0d8410 driver: sensor: Add i2c_label and i2c_addr in the max30101_config struct
Set the label and addr from the device tree.

Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
2020-03-12 13:12:35 +02:00
Kumar Gala 256c9acace drivers: serial: stellaris: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-12 04:54:04 -06:00
Kumar Gala 9213024696 drivers: gpio: stellaris: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-12 04:54:04 -06:00
Kumar Gala dbcd856dc1 drivers: ethernet: stellaris: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-12 04:54:04 -06:00
Kumar Gala aa98c7ba17 drivers: serial: pl011: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-12 04:53:30 -06:00
Kumar Gala 0241ad8482 drivers: clock_control: beetle: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-12 04:53:30 -06:00
Daniel Leung 711f88a9bc timer: mchp_xec_rtos: convert to use DT_INST_ defines
Use DT_INST_* instead of the hard-coded macro from the HAL,
as DT_INST_* are preferred.

Fixes #17775

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-11 21:16:16 -04:00
Kumar Gala 4372efe4ef drivers: uart: miv: convert to DT_INST defines
Convert driver to fully use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 16:37:22 -06:00
Kumar Gala 836b485377 drivers: ethernet: e1000: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 16:36:21 -06:00
Kumar Gala df45e4df77 drivers: intc: ioapic: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 16:36:21 -06:00
Tobias Svehagen 990ab00e30 drivers: modem: Add support for commands that don't have a line ending
Some commands need to be processed before a "\r\n" is available and
there might also be commands that have "\r\n" as data but doesn't mean
the end of the command.

To solve this a MODEM_CMD_DIRECT has been added. cmd_handler_process()
will look for matching direct commands before checking if a whole line
is available for matching the normal commands.

A direct command can return either -EAGAIN, meaning that more data is
needed or it will return the number of bytes to skip forward, ie the
length of the command that was handled.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-03-11 23:48:06 +02:00
Francisco Igual 930c904c67 drivers: serial: esp32: Fix syntax error in file uart_esp32.c
Added missing comma. Made it impossible to compile a number of examples.

Signed-off-by: Francisco Igual <figual@ucm.es>
2020-03-11 13:42:50 -05:00
Pavlo Hamov 687f407f29 drivers: kscan: Introduce SDL mouse driver
Introduces a new SDL mouse driver for the keyboard scan (kscan)
interface. Driver is implemented as SDL event filter

Signed-off-by: Pavlo Hamov <pavlo_hamov@jabil.com>
2020-03-11 13:23:19 -05:00
Richard Osterloh 8ccccbb7f6 drivers: pinmux: Add SPI1 NSS config on PA15
Add alternative function 5 configuration for PA15
on STM32F4 devices.

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
2020-03-11 13:06:55 -05:00
Kumar Gala 490494c58f drivers: entropy: sam: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 70d78412f7 drivers: watchdog: sam: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 76e0cf63b3 drivers: ps2: mchp_xec: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala c68a1d427d drivers: espi: mchp_xec: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.  The driver mostly used DT_INST_ defines but
a few IRQ priority defines needed conversion.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 9a8831b781 drivers: counter: mchp_xec: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

As part of this change we utilize the device tree for GIRQ info and
rename timer3 to 2 since we are doing this by instance number.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 61d30ed927 drivers: intc: plic: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala c998b12652 drivers: clock_control: rv32m1_pcc: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala e2d71c9c77 driver: interrupt_controller: dw: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 69c5aa0b32 driver: spi: dw: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala bdcf87956b driver: gpio: dw: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 0c7a5fdf1c drivers: usb: usb_dw: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala f91b4dbe94 drivers: dma: dma_dw: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 505591d52a drivers: ieee802154: mcr20a: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  There was just one case for
CS_GPIOS that wasn't using DT_INST defines already.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 667f96389b drivers: uart: esp32: convert to DT_INST defines
Convert driver to fully use DT_INST_ defines.  Currently IRQs are not
generated from DTS on esp32 so we create #defines for what they should
look like.  Convert the IRQ defines to match DT_INST style so if/when
we have that info in DTS it will look the same.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 3e6614a330 drivers: uart: msp432p4xx: convert to DT_INST defines
Convert driver to fully use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala afca340fc0 drivers: uart: native_posix: convert to DT_INST defines
Convert driver to fully use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 1b0e654aec drivers: i2c: nios2: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala e04a367408 drivers: mcux_rtc: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  Replace dts_fixup.h use
for DT_RTC_0_NAME with DT_INST_0_NXP_KINETIS_RTC_LABEL to be
consistent.  Also, remove the aliases that had been used for this
driver in various nxp_k*.dtsi.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala a49de1543b drivers: entropy: mcux_trng: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala a9e68d61df drivers: clock_control: mcux_sim: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala a32eed06f7 drivers: clock_control: mcux_pcc: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 6ad07b6a2a drivers: clock_control: mcux_mcg: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala ee53047aff drivers: clock_control: mcux_ccm: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 41fcf784e9 drivers: mcux_gpt: convert to DT_INST defines
Convert driver to use DT_INST_ defines and remove Kconfig per instance
enablement in favor of DT_INST_ define existing.  Also, remove the
aliases that had been used for this driver in nxp_rt.dtsi.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala c3f4c1d02b drivers: watchdog: wdt_mcux: convert to DT_INST defines
Convert driver to use DT_INST_ defines.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 4a7c2921f8 drivers: modem: ublox-sara-r4: convert to DT_INST defines
Convert driver to use DT_INST_ defines.  The preferred defines for
drivers are DT_INST_.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Kumar Gala 46fe3046fe drivers: wifi: eswifi: Convert to use DT_INST defines
Use DT_INST define as this is the preferred set of defines to utilize
for drivers.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-11 07:59:38 -06:00
Andrei Emeltchenko f57f7d162c console: xtensa_sim_console: Cleanup and use static keyword
Cleanup xtensa_sim_console and use static keyword.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-03-11 09:17:38 -04:00
Andrei Emeltchenko caa95fc10d console: uart_console: Use static for static functions
Use static keyword for static functions.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-03-11 09:17:38 -04:00
Anas Nashif ab6179c6fe sensor: shell: return -ENODEV on binding errors
If we can't bind to a device, return -ENODEV and do not continue.

Fixes #22429
Coverity-ID: 207989

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-03-10 19:05:03 -04:00
Kumar Gala 18a30e9184 sensor: pms7003: Convert to DTS
Convert pms7003 sensor driver to utilize device tree.

DTS would look something like the following for the pms7003:

uart {
	pms7003: pms7003 {
		 status = "okay";
		 compatible = "plantower,pms7003";
		 label = "pms7003";
	};
};

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-10 14:15:22 -05:00
Kumar Gala 94322e503c sensor: ak8975: Convert to DTS
Convert ak8975 sensor driver to utilize device tree.

This also supports the ak8975 embedded in a invensense MPU9150.  In such
a case the device tree node should look something like, where the ak8975
is a child of the mpu9150.

        mpu9150@68 {
                compatible = "invensense,mpu9150";
                reg = <0x68>;
                label = "mpu9150";
                #address-cells = <1>;
                #size-cells = <0>;
                ak8975@c {
                        compatible = "asahi-kasei,ak8975";
                        reg = <0xc>;
                        label = "ak8975";
                };
        };

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-10 14:13:40 -05:00
Johan Hedberg 4bdb407d7d drivers: ieee802154_nrf5: Fix build failure
Fix build failure when CONFIG_NET_L2_OPENTHREAD is not enabled. The
failure looks as follows:

drivers/ieee802154/ieee802154_nrf5.c:187:12:
	warning: 'nrf5_energy_scan_start' defined but not used
	[-Wunused-function]
 static int nrf5_energy_scan_start(struct device *dev,
            ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-03-10 14:09:11 -05:00
Josh Gao b9d2028590 usb_dc_stm32: improve struct layout.
Put the one-byte sized fields next to each other to reduce padding.

Signed-off-by: Josh Gao <josh@jmgao.dev>
2020-03-10 18:32:47 +02:00
Josh Gao c4a7d96c04 usb_dc_stm32: reuse PMA buffer when possible.
Previously, endpoint configuration would reserve memory in the packet
memory area which would never be reclaimed. After this patch, endpoints
will reuse previously allocated memory when possible. We still leak
memory when reconfiguration increases the max packet size for a given
endpoint number, but this fixes the common case.

Bug: https://github.com/zephyrproject-rtos/zephyr/issues/23178
Signed-off-by: Josh Gao <josh@jmgao.dev>
2020-03-10 18:32:47 +02:00
Andrzej Głąbek 668d401293 modules: hal: nordic: Define NRFX_ASSERT as __ASSERT_NO_MSG
Update hal_nordic's revision, so that NRFX_ASSERT uses __ASSERT_NO_MSG
directly, not through the assert macro that comes from from libc,
as the definition of the latter might be different when some specific
libc version is used, and this could generate troubles.

Replace also uses of assert() with __ASSERT_NO_MSG() in nrfx driver
shims that use this macro without including the corresponding header
file (i.e. that implicitly rely on assert.h being included from
nrfx_glue.h, which is no longer the case).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-03-10 17:21:27 +01:00
Johann Fischer 085e58faf8 drivers: usb_dc_mcux_ehci: re-enable reception after clear stall
Re-enable reception after clear an endpoint stall.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer e0b2227c39 drivers: usb_dc_mcux_ehci: add checks for valid endpoint
Add checks for valid endpoint.
Fix controllerHandle check in usb_dc_detach().

Fixes: #19763

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer e9a35dd6f1 drivers: usb_dc_mcux_ehci: rework USB_DeviceNotificationTrigger()
Rework USB_DeviceNotificationTrigger(). Fix style.

Drop messages from USB_DeviceEhciCancel().
MCUX EHCI driver notifies about canceled transfers,
but there is no specific code for this event in
usb_device_callback_message_struct_t, the only way to
recognize it is to check the length value.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer c2d45640c2 drivers: usb_dc_mcux_ehci: rework ep_write/ep_read
Rework ep_write/ep_read. Fix style.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer 0958667125 drivers: usb_dc_mcux_ehci: rework endpoint enable/disable
Rework endpoint enable/disable. Fix style.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer 031d744b9a drivers: usb_dc_mcux_ehci: rework set/clear stall
Rework set/clear stall. Fix style.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer 4bbd5ae438 drivers: usb_dc_mcux_ehci: do not reconfigure active endpoint
Do not reconfigure active endpoint. Fix style.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer adf8cfdf3f drivers: usb_dc_mcux_ehci: fix style, rework usb_dc_detach()
Fix style, rework usb_dc_detach().

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer 6116a0388b drivers: usb_dc_mcux_ehci: fix style, rework usb_dc_attach
Fix style, rework usb_dc_attach.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer a6207db0f7 drivers: usb_dc_mcux_ehci: remove unnecessary cast
Remove unnecessary cast, fix style.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Johann Fischer b04715b3b9 drivers: usb_dc_mcux_ehci: fix style, variables name
Fix style, variables name, defines.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 16:04:50 +01:00
Jukka Rissanen ded0ea62a1 driver: modem: Print sent data if verbose debugging is enabled
User is currently able to enable verbose packet debugging for
received packets. This commit enables the same for sent packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-10 15:20:02 +02:00
Francois Ramu 3dfceded48 drivers: watchdog: disable iwdg at boot on stm32
With this patch, the specific flag IWDG_STM32_START_AT_BOOT
is replaced by the zephyr generic WDT_DISABLE_AT_BOOT.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-03-10 15:12:20 +02:00
Marek Porwisz 4ca9b42fbe drivers: ieee802154_nrf5: Implement energy scan function of the nrf5 driver
Implement function and necessary callbacks to handle Energy Scan feature
of the nRF radio driver needed by some radio stacks.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2020-03-10 14:59:10 +02:00
Johann Fischer 4253280525 drivers: usb_dc_nrfx: always reset data toggle in usb_dc_ep_enable
Data toggle should be reset after SetConfiguration or
SetInterface request.
Always reset data toggle in usb_dc_ep_enable.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-03-10 14:54:29 +02:00
Audun Korneliussen 388c6ea01f drivers: usb_dc_nrfx: Reset dtoggle when stall is cleared
USB Host expects dtoggle to be cleared after ClearFeature(Halt):

"[...] clearing the Halt feature via a ClearFeature(ENDPOINT_HALT)
request results in the endpoint no longer returning a STALL.
For endpoints using data toggle, regardless of whether an endpoint
has the Halt feature set, a ClearFeature(ENDPOINT_HALT) request always
results in the data toggle being reinitialized to DATA0."
- Subsection 9.4.5 of usb 2.0 spec (usb_20.pdf)

Signed-off-by: Audun Korneliussen <audun.korneliussen@nordicsemi.no>
2020-03-10 14:54:29 +02:00
Armando Visconti 1ebb708910 driver/sensors: lis2dh: Fix I2C and SPI bus communication
Add I2C and SPI bus communication routines in separate files,
and register one or the other as read/write callbacks based
on bus selection in DTS.

This commit is fixing issue #22348 as well, as the SPI part
is handling in the proper way the CS GPIO part.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-03-10 14:52:59 +02:00
Flavio Ceolin 86087f202a drivers: crypto: mbedtls: Remove dead code
mtls_session_setup checks early if the given mode is valid and return
an error if not. CRYPTO_CIPHER_MODE_CTR is not a valid one so there is
no needed to have it in the switch.

CID: 20600

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-03-10 14:51:33 +02:00
Stephanos Ioannidis 95deb43e6f drivers: serial: uart_sam: Fix irq_update API function
The `irq_update` UART API function must always return 1 according to
the API documentations.

This commit fixes the `irq_update` API function to unconditionally
return `1`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-10 14:50:58 +02:00
Stephanos Ioannidis afb51d2750 drivers: serial: usart_sam: Fix irq_update API function
The `irq_update` UART API function must always return 1 according to
the API documentations.

This commit fixes the `irq_update` API function to unconditionally
return '1'.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-10 14:50:58 +02:00
Stephanos Ioannidis 097cbc099f drivers: i2c: i2c_sam0: Fix interrupt connection
This commit fixes the multiple SERCOM interrupt handling for the SAM
D5x and E5x devices by replacing the obsolete device tree symbol with
the new `DT_INST` symbol.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-10 14:50:19 +02:00
Takumi Ando 2935e5dd59 drivers: counter: stm32: Add support for LSE bypass
This patch enables to use external source for LSE.

Signed-off-by: Takumi Ando <takumi@t15.red>
2020-03-10 14:47:41 +02:00
Takumi Ando 55fc05a757 drivers: counter: stm32: Fix compile error with STM32L1X
STM32L1X series also don't need to use
LL_RCC_LSE_SetDriveCapability().

Signed-off-by: Takumi Ando <takumi@t15.red>
2020-03-10 14:47:41 +02:00
Gerson Fernando Budke da72a3028e drivers: serial: Kconfig.usart_sam: Fix number of ports
Since driver is shared with other devices, it must be enabled
conditionally based on the number of instances. This avoid show
invalid options for devices with lower port count like SAM4S/SAM4E.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-10 14:43:36 +02:00
Gerson Fernando Budke 8480627d14 drivers: serial: Kconfig.uart_sam: Enable support to SAMV71
SAMV71 uses same driver of SAME70 and this enables the feature. Since
driver is shared with other devices, it must be enabled conditionally
based on the number of instances. This avoid show invalid options for
devices with lower port count like SAM4S/SAM4E.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-10 14:43:36 +02:00
Gerson Fernando Budke 24a7cdea98 drivers: gpio: gpio_sam.c: Add missing config
When added SAM4E and SAMV71 platform the huge amount of refactor left
out this two configurations. This add missing configuration for all
supported devices.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-10 14:43:36 +02:00
Gerson Fernando Budke 43babb5d5f drivers: i2s: Kconfig.sam_ssc: Enable support to SAMV71
SAMV71 uses same driver of SAME70 and this enables the feature.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-10 14:43:36 +02:00
Gerson Fernando Budke 8c6302253a drivers: flash: Kconfig.sam: Enable support to SAMV71
SAMV71 uses same driver of SAME70 and this enables the feature.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-10 14:43:36 +02:00
Jukka Rissanen c03336e442 cmake: Allow change of the QEMU Ethernet interface name
Instead of hardcoding the "zeth" network interface name, use the
name defined in Kconfig so that user can change it if needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-10 14:38:28 +02:00
Luuk Bosma 63b22d7015 drivers/ethernet/eth_gecko: auto-negotiate after link up
Move auto-negotiate sequence from driver initialization to link up event
Previously when booting without ethernet cable connected the
initialization would fail and never recover.
Now we can connect the ethernet cable any time and multiple times.

This also drastically reduces boot time to main.

Logging Link up and Link down events.
Logging speed and duplex from eth_gecko logger instead of eth_gecko_phy.

Signed-off-by: Luuk Bosma <l.bosma@interay.com>
2020-03-10 14:08:51 +02:00
Flavio Ceolin 6e25ebf269 drivers: modem: Remove invalid comparison
pin is an unsigned variable so there is no meaning check if it is less
than zero.

CID :208407
CID :208408
CID :208410

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-03-10 13:03:03 +02:00
Gerson Fernando Budke 2cfb11e050 drivers: ieee802154: rf2xx: Rem trx_state variable
The rx timeout timer callback need update trx_state variable and this
variable is protected by a mutex. Because of that, when compiling the
system with CONFIG_ASSERT=y the system reports 'ASSERTION FAIL
[!arch_is_in_isr()] @ ZEPHYR_BASE/kernel/include/ksched.h:262'.

This refactor the driver remove trx_state variable dependency and
consequently removes phy_mutex and rx timeout timer to be compliant
with kernel rules.

Fixes: #23198

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-09 14:17:06 +02:00
Gerson Fernando Budke be56e36fe4 drivers: ieee802154: rf2xx: Add RX improvements
The current version of at86rf2xx RX implementation don't uses advanced
capabilities offer by the transceiver. This access SRAM space to gatter
PHR information in parallel with transceiver frame reception. It allows
improve RX reception by handling properlly the frame protection feature
removing transceiver states changes.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-09 14:17:06 +02:00
Gerson Fernando Budke 287f654e68 drivers: ieee802154: rf2xx: Refactor rf2xx_thread_main
Current rf2xx_thread_main code have too many if/for/while imbrication.
Extract methods from rx2xx_thread_main for better readability.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-09 14:17:06 +02:00
Gerson Fernando Budke d4f39742ea drivers: ieee802154: rf2xx: Add SRAM read method
Add SRAM read method to enable advanced uses on at86rf2xx driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-09 14:17:06 +02:00
Armand Ciejak 38a2e2cf89 drivers: eth: mcux: Write correct data into override register
Do not use the content of the status register to write into the
override register because it may have unpredictable effect,
instead to a read/modify/write on the override register.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-07 09:23:47 +02:00
Armand Ciejak a3d413c51a drivers: eth: mcux: Fix PHY access in eth_mcux_phy_setup
It is necessary to poll the ENET_EIR_MII bit before reading
the data register as explained in the i.MX RT1060 reference
manual in chapter 41.7.17.4.
Use PHY_* functions from NXP HAL to correctly access the PHY
registers.

Signed-off-by: Armand Ciejak <armandciejak@users.noreply.github.com>
2020-03-07 09:23:47 +02:00
Andrew Boie d6d42bef97 drivers: gpio: fix syscall handlers
No driver object checks were being performed for 3 APIs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-07 09:22:50 +02:00
Andrew Boie f669b7cb9f drivers: kscan: fix syscall handlers
No check of the driver object was being performed for two
APIs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-03-07 09:22:50 +02:00
Daniel Leung c3701f51d7 adc: mchp_xec: right justify ADC output data under 10-bit res
This enables the ADC output data to be shifted right when using
10-bit resolution. Or else, data would be left justified as if
it's doing 12-bit ADC with the right 2 bits filled with zeroes.

Fixes #23202

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-03-06 19:29:09 +02:00
Stephanos Ioannidis 9aed7fb040 drivers: serial: uart_sam0: Fix interrupt connection
This commit fixes the multiple SERCOM interrupt handling for the SAM
D5x and E5x devices by replacing the obsolete device tree symbol with
the new `DT_INST` symbol.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-03-06 18:34:12 +02:00
Gerson Fernando Budke f7564323f5 drivers: eth: sam_gmac: Add priority queue checks
Improve priority queue conditional build. Now priority queue code is
enabled only if device have support to it. This enables GMAC driver
for devices with only one queue for RX/TX.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-04 23:11:42 +02:00
Gerson Fernando Budke 51f7fc8fba drivers: eth: eth_sam_gmac: Move queue init block
Move queue init block to avoid add many defines on code.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-04 23:11:42 +02:00
Gerson Fernando Budke 04e6045505 drivers: eth: eth_sam_gmac: Fix priority queues
The Atmel SAM SoC with ethernet port uses same GMAC driver. However,
there are differences between SoC GMAC implementation. Some SoCs have
priority queue and system can configure 0 up to 5, depending of SoC
version. This update current GMAC driver adding missing definitions.

Co-authored-by: Stephanos Ioannidis <root@stephanos.io>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-04 23:11:42 +02:00
Gerson Fernando Budke dc277a8733 drivers: eth: Kconfig.sam_gmac: Fix queue definitions
Add missing queue entries for sam gmac. This update the queue selection
to proper handle all supported SAM SoC that uses GMAC driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-03-04 23:11:42 +02:00
Daniel Glöckner 47ea3c4e2c drivers: eth: sam-e70: revision B has more queues
The first revision of the SAM E70 soc had three queues. The current
revision B has six queues. If we don't initialize all queues, the DMA
engine gets stuck when trying to read a descriptor from NULL. To enable
the initialization of the additional queues, the correct soc has to be
selected in the config options, f.ex. CONFIG_SOC_PART_NUMBER_SAME70Q21B
instead of CONFIG_SOC_PART_NUMBER_SAME70Q21.

Also rename GMAC_QUEUE_NO to GMAC_QUEUE_NUM as requested during review.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
2020-03-04 23:11:42 +02:00
Jaron Kelleher d63651dd01 riscv machine timer: Timer functions on long running platforms
When debugging on a long running platform, the MCU may get reset by
the debugger with an ndmreset toggle. Since there is no requirement
that this resets anything in particular on the platform, the CLINT
registers may not get reset. When this occurs with an mtime register
value that is larger than 32 bits the riscv machine timer will
continuously interrupt the system when the mtime register exceeds 32
bits in value. This is because the last_count value is used to update
the mtimecmp register, and its value is initialized to zero. Its
first update is with a 32-bit value, which loses information when the
mtime register exceeds 32 bits.

The proposed solution is to set the last_count value to the current
value in the mtime register when the timer is initialized. Since the
timer is fired at intervals that are less than 32 bits in value, the
next update of last_count will remain valid, and the system will
function as expected.

Signed-off-by: Jaron Kelleher <jkelleher@fb.com>
2020-03-04 23:08:49 +02:00
Piotr Mienkowski e609ad0c43 Revert "drivers: watchdog: Make WDT_DISABLE_AT_BOOT default to y"
This reverts commit 382e6fbccf.

Disabling watchdog at boot breaks watchdog API contract. Production
firmware should never ship with the option enabled. Unfortunately, this
is dangerosly easy to overlook. If left enabled, in the best case, it
will degrade functionality of the subsystem. In the worst case it
will leave watchdog permanently disbled.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2020-03-04 18:25:04 +02:00
Alexander Wachter a22f0ac1ab drivers: hwinfo: Don't disable CLOE on SAM3x seies
CLOE (Code Loop Optimization) does not exist on SAM3x.
Make the EEFC_FMR_CLOE disable depending on CONFIG_SOC_SERIES_SAM3X.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-02-27 21:14:54 +01:00
Alexander Wachter 4cfd4a707d SoC: stm32: Include LL utilities if HWINFO is selected
Include stm32XXxx_ll_utils.h in soc.h for every stm32 SoC,
if CONFIG_HWINFO_STM32 is selected.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-02-27 21:14:54 +01:00
Alexander Wachter e49de0d866 drivers: hwinfo: Exclude NRF53 non-secure from hwinfo driver
Make the NRF hwinfo driver depending on !TRUSTED_EXECUTION_NONSECURE
because the FICR registers are not accessible from the non-secure
world.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-02-27 21:14:54 +01:00
Alexander Wachter 39e4686d48 drivers: hwinfo: Introduce HWINFO_HAS_DRIVER Kconfig symbol
Introduce the HWINFO_HAS_DRIVER Kconfig symbol to get
the information if hwinfo is supported on the current platform.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-02-27 21:14:54 +01:00
Francois Ramu f41ff24a3a driver: clock: stm32: boost voltage when clock exceeds 80MHz
This patch activates the boost mode for the main regulator
when the system frequency above 80MHz for stm32l4Rx/stm32l4Sx
soc series.
To save power, the boost mode should be disabled below 80MHz.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-02-26 12:21:04 -06:00
Francois Ramu 5c0687e58b driver: clock: stm32: boost voltage when clock exceeds 150MHz
This patch activates the boost mode for the main regulator
when the system frequency above 150MHz for stm32g4xx soc series.
To save power, the boost mode should be disabled below 150MHz.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-02-26 12:21:04 -06:00
Francois Ramu 0b4fbb916e driver: watchdog: stm32 install watchdog
This patches add a delay after setting the watchdog
to wait for the register (Prescaler and Counter registers)
to be updated before leaving (until LL_IWDG_IsReady is true)

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-02-26 12:19:07 -06:00
Andrei Gansari a410486dca drivers: eth_mcux phy_setup moved after SMI init
SMI initialization is required to enable PHY communication.
PHY setups needs to run after SMI initialization.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-02-25 20:41:04 +02:00
Armando Visconti 0ba94d6d78 driver/sensor: lis3mdl: Fix DRDY interrupt
The LIS3MDL sensor provides two different pins for handling
interrupts: the DRDY, that triggers new data sample availability,
and INT, that goes off when data sample exceeds a given threshold.

The driver handled data ready triggers only, which does not
require sensor configuration at all. Moreover a dummy read is
required when the data ready is configured to re-trigger a new
interrupt.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-02-25 11:40:17 +01:00
Andrew Boie 271621fb99 revert: "change IO APIC to logical destination..."
This reverts commit e91e7fc3d5.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-02-19 14:40:19 -08:00
Andrew Boie 9062a5ee91 revert: "program local APIC LDR register for..."
This reverts commit 87b65c5ac2.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-02-19 14:40:19 -08:00
Zide Chen 87b65c5ac2 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-02-19 10:25:10 -08:00
Zide Chen e91e7fc3d5 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.

Also it changes delivery mode from fixed to lowest priority. The reason
being in fixed mode, the interrupt could be delivered to all CPUs
which put burden in software to handle repeated interrupts. While in
lowest priority mode, interrupt is delivered to one local APIC only.

Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-02-19 10:25:10 -08:00
Daniel Leung 55afe00195 interrupt_controller: dw: fix base address not defined in config
During driver rewrite, the field to specify the base address of
the interrupt controller was dropped, which results in error in
device initialization due to accessing random address (or null).
Fix it by specifying the base address.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-02-18 15:31:19 -06:00
Erwan Gouriou 557d263354 dts: stm32f3: Remap USB IRQ to avoid conflict with CAN
On stm32f302/3 series, USB and CAN_1 share same IRQ lines.
To use USB and CAN_1 together, USB IRQ could be remap to other
line numbers, on which there is no conflict.
Remap the USB IRQ lines by default:
-Assign remap number in matching dtsi files
-Perform remap before usb driver init

Additionally, fix compilation issue in usb driver.

Fixes #22343

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-18 18:44:42 +02:00
Vincent Wan a9bfd28a39 drivers: gpio_cc32xx: disable interrupts before changing interrupt type
Disabling gpio interrupts on the pin prior to changing its interrupt
type to level-based helps prevent spurious interrupts that would be
otherwise observed, if gpio interrupts were originally enabled when
gpio_cc32xx_pin_interrupt_configure() is invoked.

Fixes #22847

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-02-17 18:14:57 -06:00
Vincent Wan ce5c6843d3 drivers: gpio_cc32xx: avoid unnecessarily disabling interrupts in isr
In the gpio isr, gpio interrupts are disabled when invoking the
registered callbacks. This is unnecessary, and causes a problem if the
callback attempts to disable gpio interrupts by reconfiguring the pin
as in the test gpio_basic_api.

Fixes #22847

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-02-17 18:14:57 -06:00
Göran Weinholt d3ff59d383 drivers: gpio_pca95xx: add missing gpio_utils.h include
Include gpio_utils.h to fix a build failure:

gpio_pca95xx.c:490:20: warning: implicit declaration of
 function 'GPIO_PORT_PIN_MASK_FROM_NGPIOS'
 [-Wimplicit-function-declaration]
gpio_pca95xx.c:490:20: error: initializer element is not constant
   .port_pin_mask = GPIO_PORT_PIN_MASK_FROM_NGPIOS(
    DT_INST_##inst##_NXP_PCA95XX_NGPIOS), \

Signed-off-by: Göran Weinholt <goran.weinholt@endian.se>
2020-02-17 16:27:19 -05:00
Kumar Gala 93b78b7bf8 drivers: spi: sifive: Fix comment to match ifdef
The endif comment didn't match the actual ifdef define.  Fix the comment
to match.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-17 09:05:32 +01:00
Carles Cufi f55fcc9fd2 boards: frdm_kw41z: Override ADC vref choice properly
In order to overrdie a choice one needs to define it again. Override it
by redefining it in the .defconfig file.

See #22474.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-14 22:12:21 +02:00
Peter Bigot e83c9cc262 drivers: gpio_sx1509b: correct handling of initialized output
The data_first flag was intended to be set when the configuration
requires setting the output value before setting the direction.
Respect the intent.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-13 12:59:16 +02:00
Ulf Magnusson 378d6b137a kconfig: Replace non-defconfig single-symbol 'if's with 'depends on'
Same deal as in commit eddd98f811 ("kconfig: Replace some single-symbol
'if's with 'depends on'"), for the remaining cases outside defconfig
files. See that commit for an explanation.

Will do the defconfigs separately in case there are any complaints
there.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-12 10:32:34 -06:00
Peter Bigot a8d15c1279 sensors: grove_light: convert to devicetree bindings
Replace Kconfig configuration data with devicetree bindings using
(ADC) io channels.  Rework the sample to document expectations about
the relationship between the reference voltage and the divider input
voltage, and update the sensor configuration to support Nordic SAADC.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-12 10:31:26 -06:00
Peter Bigot bc60245787 sensors: grove_temperature: convert to devicetree bindings
Replace Kconfig configuration data with devicetree bindings using
(ADC) io channels.  Rework the sample to document expectations about
the relationship between the reference voltage and the divider input
voltage, and update the sensor configuration to support Nordic SAADC.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-12 10:31:26 -06:00
Ulf Magnusson 5c908c6c4f kconfig: rv32m1: Remove redundant ENTROPY_GENERATOR dependency
Kconfig.rv32m1 is already 'source'd within an 'if ENTROPY_GENERATOR', so
ENTROPY_RV32M1_TRNG does not need a 'depends on ENTROPY_GENERATOR'.

Flagged by https://github.com/zephyrproject-rtos/ci-tools/pull/128.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-12 10:30:12 -06:00
Erwan Gouriou d4f08c3fe2 drivers: interrupt_controller: stm32: Missing break statement
Fix missing break statement is missing in switch/case.

Fixes #22646

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-12 10:01:11 -06:00
Emil Obalski 3ed9dc3a24 usb: Fix for set/reset endpoints
setting/resetting endpoints is required when switching to alternate
interfaces. This is a common operation for usb audio class.

When audio device is enumerated host invokes set_interface request
to alternate with 0 endpoints associated. That operation lead to
disable never enabled endpoints. With previous solution error message
will appear.

This commit limits error messages to be present only if endpoint
was configured/enabled before and there was a problem when trying
to configure/enable it for the first time.

* Kinetis driver was updated with return error value when ep was
already configured/enabled.

* nxp driver updated with return error value when ep was already
enabled

* sam0 driver updated with return codes instead of magic numbers.

This is fix patch to  #21741

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-02-12 14:40:40 +02:00
Erwan Gouriou 157fb6af72 drivers/clock_control: stm32: HSE_BYPASS code cleanup
Rework CONFIG_CLOCK_STM32_HSE_BYPASS related code to make
this part of the code more readable.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-11 17:41:49 +02:00
Erwan Gouriou 9631709ca4 soc: stm32h7: Move PWR init code in soc init function
Move PWR init code out of clock control driver and
put SMPS related function under SMPS condition as it
is not supported by all soc variants of the series.

Fixes #22363

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-11 17:41:49 +02:00
Michael Scott e934825719 drivers: modem: sara-r4: fix APN setting for U2 modem
usage of AT+UPSD command per UBX-17003787(R15) command reference is:
AT+UPSD=<profile_id>, <param_tag>, <param_val>

For AT+UPSD=0, 1, "<value>": we are setting value to MCCMNO, which
is technically incorrect.  <param_tag> of 1 means:

1: APN - <param_val> defines the APN text string, e.g.
"apn.provider.com"; the maximum length is 99. The factory-programmed
value is an empty string.

Let's use APN here instead.  This fixes a +CME ERROR: 113 when
connecting with U2 modem.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/22689

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 20:00:15 +02:00
Jukka Rissanen 45eccbc5d7 drivers: modem: gsm: Command handlers should return value
GSM modem command handlers were missing a return value.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-02-10 19:52:33 +02:00
Jukka Rissanen b05e72f3bb drivers: modem: gsm: Add setting of MCC number
Add Kconfig option that allows user to set MCC (Mobile Country
Code). If user does not set it, then automatic operator
registration is used.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-02-10 12:32:24 +02:00
Jukka Rissanen 49724e25a0 drivers: modem: gsm: Add misc fixes like line ending char set
Misc fixes / enhancements to the GSM driver:
* set the \r as a line ending character
* make gsm_init() static as there is no need to expose it
* print the gsm context pointer at init
* set buffer allocation timeout to modem context so that it is
  not infinite

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-02-10 12:32:24 +02:00
Jukka Rissanen 4c1b0ab2a9 drivers: modem: gsm: Add context to DEVICE_INIT()
Instead of using global static variable "gsm" everywhere,
store the context when calling DEVICE_INIT(). Then in the device
init function get the context from the device struct. This way
it is possible to use the same functions for implementing two
gsm modem instances. Currently this is not fully possible because
the context is not passed via uart_pipe API and modem_cmd
callbacks. So some future work would still be needed.

In practice this commit does not change anything, it just makes
it a little bit easier to have two instance of this modem which
might be quite unlikely case. Anyway, the driver now follows the
same style how some other drivers are done like Ethernet etc.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-02-10 12:32:24 +02:00
Michael Scott b6b4396c48 drivers: modem: sara-r4: use +USO[RF|RD] based on proto
Regardless of whether from is set, let's use the correct socket read
commands for UDP and TCP.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott a6fc7f8669 drivers: modem: sara-r4: disable hex mode for binary data
Now that the u-blox driver can let cmd_handler know that it hasn't
received enough data, let's disable the hex mode for readying
binary data.

On the SARA-R4 this mode limits the receiving MTU to 512 which is
unacceptable.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 90c6dc5e7f drivers: modem: cmd_handler: add return value to modem commands
Some modem commands can determine if they have enough data pulled from
the modem to continue or not.  Let's allow those functions to return
EAGAIN which means there's more data needed from the modem.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 5185b8cf40 drivers: modem: cmd_handler: honor num of params in parse_params
Modem commands are setup with arg_count to denote the number of params
to parse before returning.  Let's honor that setting and return once
we've parse them.

This fixes a run-on bug where the parser would find as many of the
parameters via the supplied delimiter as it could.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 698661b56e drivers: modem: sara-r4: update functions to return POSIX values
The original Ublox SARA-R4 driver was written for the net_context
APIs.  As a result many of the return values are not POSIX standard.

Let's go through all of the socket offload functions and make sure
we return standard values (0 or -1) and set errno where appropriate.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 87481e8eef drivers: modem: sara-r4: handle read limits
SARA-R4 has a max read limit of 512 when using binary hex formatting.
Otherwise the max read limit is 1024.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 52afcc21d6 drivers: modem: sara-r4: fix error text in net_offload_dummy_get
Correctly tell the user that CONFIG_NET_SOCKETS_OFFLOAD needs to be
enabled.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 2be4f997b3 drivers: modem: sara-r4: use new socket functions
New socket functions were introduced to hide some of the modem_socket
internals:
- modem_socket_next_packet_size()
- modem_socket_wait_data()
- modem_socket_data_ready()

Let's use them.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 36e4fc7743 drivers: modem: sara-r4: manage sock->is_connected
Let's use sock->is_connected to check whether we need to clean up
the modem's socket.  It may have already been closed via URC.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 6c9bb48ce7 drivers: modem: sara-r4: use 120s connection timeout
SARA-R4 AT command manual states +USOCO has a max timeout of 120s.
Let's use that instead of the default 10s command timeout.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Göran Weinholt 8fb3f21e58 drivers: modem: sara-r4: support for 2G on the SARA R412M modem
The SARA R412M requires manual activation of the PDP context. It also
reports RSSI instead of RSRP when on 2G. An off-by-one in the RSRP
calculation was also fixed in this commit.

Signed-off-by: Göran Weinholt <goran.weinholt@endian.se>
2020-02-10 12:29:41 +02:00
Göran Weinholt bf59ceda0b drivers: modem: sara-r4: support for network indication on SARA modems
The u-blox SARA modems have the ability to output the network status
on a GPIO pin. This can be used to light up a LED when the modem is
connected to the network.

Signed-off-by: Göran Weinholt <goran.weinholt@endian.se>
2020-02-10 12:29:41 +02:00
Göran Weinholt ea99d34e00 drivers: modem: sara-r4: continually signal the modem to power off
The U2 modem will sometimes not power off even if we have given it the
signal to do so. We now signal it continually until the modem
indicates that power is off with VINT=0.

Signed-off-by: Göran Weinholt <goran.weinholt@endian.se>
2020-02-10 12:29:41 +02:00
Hans Wilmers 1db79054af drivers: modem: sara-r4: fix modem reset
This fixes two problems in modem_reset():

- mdata.net_iface is used without checking that it is valid.
  Now, we validate mdata_net_iface before usage, and give a warning
  if it was not set.

- if the modem does not perform network registration within the
  given time of 20s, in the previous implementation the driver
  gave up.
  Now, the driver disables RF for a second, enables it again and
  gives the modem another 20s to register. This has been seen
  to help in roaming situations.

Tested on Sara R4.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-02-10 12:29:41 +02:00
Hans Wilmers 97921368d3 drivers: modem: sara-r4: adjust send and receive lengths
- limit max. number of bytes when sending to socket
  The number of bytes sent to a socket in one transaction
  is limited to 512 in HEX mode (Sara-R4), and to 1024
  otherwise. This corresponds to numbers given in the
  manual for ublox cellular modems.

- report number of bytes actually sent, as reported by modem
  After writing data to a socket, we now return the number of
  bytes actually written, as reported by the modem.

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-02-10 12:29:41 +02:00
Michael Scott a18f78894f drivers: modem: sara-r4: make room for NUL in match_buf
In order to still process 128 bytes at a time, let's add 1 to the
length of match_buf which will be used to store a NUL char when
the match_buf is at max size (size - 1).

Otherwise we're processing 127 bytes at a time which is inefficient
compared to the data buffer sizes in net_buf.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 8ef2ae8ce5 drivers: modem: sara-r4: add offloaded DNS handling
SARA-R4 modem supports offloaded DNS via AT+UDNSRN command.
Let's implement it.

NOTE! On SARA-R4 a new firmware *IS* required to support this feature:
L0.0.00.00.05.08 [Apr 17 2019 19:34:02]

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 50d4e07d0c drivers: modem: sara-r4: remove interface up / down
Managing the interface up / down events from driver code (as opposed
to L2 layers) has been an issue for quite some time.  There are
race conditions which result in data aborts (referencing NULL
iface or NULL iface->if_dev) or ends up breaking ASSERT checks for
non-NULL iface.

Let's remove the handling for now and come up with something better
when a user actually needs it.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 1265843495 drivers: modem: sara-r4: cleanup offload_recvfrom timeout
In offload_recvfrom(), if we end up calling modem_cmd_send(),
then we should always wait for the results.  We've already
checked for MSG_DONTWAIT and made sure that there is data ready.
We just need to get it from the modem buffer at this point.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott ba34136581 drivers: modem: sara-r4: dont unblock on sockread
Users may be waiting for data via socket recv() function.  We
notify them that data is ready when URC is received from modem.

Once unblocked, we read the data from the modem buffer which
is handled via on_cmd_sockread_common().  At this point, we
don't need to unblock waiting users again.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 1f68802899 drivers: modem: sara-r4: space for NUL in buffer is optional
The hex_to_binary() function is incorrectly assuming all buffers
passed to recv() will have an additinal byte for storing a NUL
terminating char.  This should be optional as MQTT library uses
exact sized buffers for parsing socket data.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 179307c723 drivers: modem: sara-r4: return send bytes from send_socket_data
The send_socket_data() is incorrectly sending 0 as successful result.

The socket APIs require the number of bytes sent to be returned.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 82dc1665af drivers: modem: cmd_handler: fix findcrlf() indentation
Missed during previous rework.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 74bb1a9be9 drivers: modem: cmd_handler: remove extra comment
Remove extra comment left over from prototype driver.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 44e977c467 drivers: modem: cmd_handler: save 1 char for NUL in match_buf
For parsing purposes we need to add a NUL to the end of match_buf.

When there is no CR/LF in the incoming rx bufs then we fill match_buf
to its max size.  This ended up with an off by one error which was
overflowing match_buf into the following data.

To account for this, let's fill the buffer to size - 1 so that we
leave room for the NUL at the end and stop corrupting data.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott f4b49fbb90 drivers: modem: cmd_handler: cleanup parse_params()
- rename buf_len to match_len for clarity
- pass in modem_cmd_handler_data instead of buffer pointer directly
- buffer adjustments for the command length are kept inside
  parse_params()

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 889fc85f67 drivers: modem: socket: add is_connected field to modem_socket
Let's add a field which the drivers can use to keep track of whether
they are connected or not.  This will normally be enabled / disabled
in the socket connect and URC for socket close notify.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 25ce3bf3eb drivers: modem: socket: add modem_socket_next_packet_size
Let's hide the internals of sock->packet_sizes[] by adding a function
which returns the size of the next waiting packet.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott e23ada9d4a drivers: modem: socket: reset is_polled in modem_socket_put()
Let's make sure is_polled gets reset when we reset the socket.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 8908c61bcc drivers: modem: socket: add wait_data and data_ready functions
Let's hide the internals of the modem_socket's sem_data_ready and
poll handling with 2 new functions:
- modem_socket_wait_data: take a semaphore and wait for data
- modem_socket_data_ready: give back the data ready semaphore and
  unblock poll() users

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott 987837ecd8 drivers: modem: socket: introduce locking
Add lock behavior for functions in modem_socket, to prevent race
conditions when performing socket data maintenance.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Michael Scott d4b8b5fcf2 drivers: modem: socket: allow partial packet reads
Let's allow protocols to request portions of the current packet.

This is seen in the MQTT library when parsing headers for the type
and variable length of the packet.

This fixes basic parsing done in the MQTT library and probably others.

Signed-off-by: Michael Scott <mike@foundries.io>
2020-02-10 12:29:41 +02:00
Ulf Magnusson eddd98f811 kconfig: Replace some single-symbol 'if's with 'depends on'
I think people might be reading differences into 'if' and 'depends on'
that aren't there, like maybe 'if' being needed to "hide" a symbol,
while 'depends on' just adds a dependency.

There are no differences between 'if' and 'depends on'. 'if' is just a
shorthand for 'depends on'. They work the same when it comes to creating
implicit menus too.

The way symbols get "hidden" is through their dependencies not being
satisfied ('if'/'depends on' get copied up as a dependency on the
prompt).

Since 'if' and 'depends on' are the same, an 'if' with just a single
symbol in it can be replaced with a 'depends on'. IMO, it's best to
avoid 'if' there as a style choice too, because it confuses people into
thinking there's deep Kconfig magic going on that requires 'if'.

Going for 'depends on' can also remove some nested 'if's, which
generates nicer symbol information and docs, because nested 'if's really
are so simple/dumb that they just add the dependencies from both 'if's
to all symbols within.

Replace a bunch of single-symbol 'if's with 'depends on' to despam the
Kconfig files a bit and make it clearer how things work. Also do some
other minor related dependency refactoring.

The replacement isn't complete. Will fix up the rest later. Splitting it
a bit to make it more manageable.

(Everything above is true for choices, menus, and comments as well.)

Detected by tweaking the Kconfiglib parsing code. It's impossible to
detect after parsing, because 'if' turns into 'depends on'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-08 08:32:42 -05:00
Markus Fuchs ad8f011dcf drivers: crypto: crypto_mtls_shim: Add AES-GCM support
Add support for AES Galois/Counter Mode (GCM) of operation to the
mbed TLS shim driver.

Signed-off-by: Markus Fuchs <markus.fuchs@de.sauter-bc.com>
2020-02-08 13:40:33 +02:00
Mikkel Jakobsen 4adc40889d drivers: spi: spi_mcux_dspi: fix missing context unlock on busy bus
Error codes from DSPI_MasterTransferNonBlocking are now handled in
tranceive to ensure that the context is unlocked when an busy bus
is detected.

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@prevas.dk>
2020-02-08 11:41:21 +02:00
Andrew Boie efc5fe07a2 kernel: overhaul unused stack measurement
The existing stack_analyze APIs had some problems:

1. Not properly namespaced
2. Accepted the stack object as a parameter, yet the stack object
   does not contain the necessary information to get the associated
   buffer region, the thread object is needed for this
3. Caused a crash on certain platforms that do not allow inspection
   of unused stack space for the currently running thread
4. No user mode access
5. Separately passed in thread name

We deprecate these functions and add a new API
k_thread_stack_space_get() which addresses all of these issues.

A helper API log_stack_usage() also added which resembles
STACK_ANALYZE() in functionality.

Fixes: #17852

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-02-08 10:02:35 +02:00
Ulf Magnusson b9270c388d kconfig: Remove redundant SPI_DW dep on SPI_DW_ACCESS_WORD_ONLY
This symbol is already defined within an 'if SPI_DW'.

Flagged by https://github.com/zephyrproject-rtos/ci-tools/pull/128.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-08 09:58:33 +02:00
Alexander Wachter f590d4fadb drivers: lora: build with newlib
The loramac-node library uses math functions from math.h that
are not included in the minimal lib.
This commit changes the samples project config to always build
with newlib and adds a dependency to newlib.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-02-07 16:00:47 -06:00
Anas Nashif fad8701748 tracing: cleanup and split segger/rtt configuration options
Move rtt configuration options to drivers/debug and split the
systemview configuration.

drivers/debug will service for this class of drivers that are enabled in
debug mode only and provide a hardware interface to the system.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-02-07 15:58:05 -05:00
Markus Fuchs b0fcb0777c drivers: crypto: Add STM32 CRYP crypto driver
This patch adds crypto driver support for all STM32F4 devices providing
a CRYP peripheral.
This driver implements the AES ECB, CBC and CTR modes of operation.

It has been tested on a STM32F437 SoC running the Zephyr crypto driver
sample.

Signed-off-by: Markus Fuchs <markus.fuchs@de.sauter-bc.com>
2020-02-07 10:45:51 -06:00
Yannis Damigos a4b448ea59 uart_stm32: Fix flow misspelling
Fix flow misspelling.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2020-02-07 08:08:25 -06:00
Kumar Gala 6115346174 drivers: serial: stm32: Fix possible issue with mixed enum
When building with LLVM we get the following error:

uart_stm32.c:272:9: error: implicit conversion from enumeration type
'enum uart_config_parity' to different enumeration type
'enum uart_config_flow_control' [-Werror,-Wenum-conversion]
        return UART_CFG_PARITY_NONE;
        ~~~~~~ ^~~~~~~~~~~~~~~~~~~~

We shouldn't be mixing parity and flow control enum's.  Use
UART_CFG_FLOW_CTRL_NONE instead or UART_CFG_PARITY_NONE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-07 11:50:38 +01:00
Alberto Escolar Piedras 90d9eb2f50 native_posix: timer: Improve arch_busy_wait() doc
Expand a bit the native_posix arch_busy_wait()
documentation so it is clearer

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2020-02-07 11:48:41 +01:00
Andrew Boie 846034f678 drivers: loapic_timer: simplify TSC read
We have an inline function for this in x86's arch.h
that works for both 64 and 32-bit.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-02-06 23:07:37 -05:00
Kumar Gala 0e42d4838e flash: sam: Limit flash driver to SAME70 SoCs
The SAM flash driver was developed for the SAME70 SoCs and hasn't ever
been validated on the other SAM families (SAM3X, SAM4S).  If we try and
build on one of the other SoC families we get build errors.  So limit it
to just SAME70 for now.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-06 19:18:51 -05:00
Kumar Gala afc449ec79 flash: sam0: Fix build issue.
Fix stale DT define that causes driver not to build.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-06 19:18:51 -05:00
Jukka Rissanen 6009045902 drivers: modem: Fix gpio compile errors with modem shell
Compile errors because of missing include file and typos
when accessing variables in the modem_pin struct.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-02-06 12:33:20 +02:00
Jukka Rissanen cb4bf32f2c drivers: modem: gsm: Add support for getting modem info
Add callbacks to get the modem information which can then be
shown by modem shell.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-02-06 10:19:25 +02:00
Steven Slupsky d93fadc099 drivers: i2c_slave: eeprom: fixes incorrect declaration
This commit fixes an incorrect declaration of the buffer_size member
of the i2c_eeprom_slave_config struct.

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
2020-02-05 18:46:35 -05:00
Tobias Svehagen 8a9c9d43bf drivers: modem: Add support for different line endings
This makes it possible to handle devices that use different line
endings.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-02-05 23:31:56 +02:00
Henrik Brix Andersen e5f3279abb adc: common: handle gain of 128 in adc_gain_invert()
Add missing entry for ADC_GAIN_128 in the adc_gain_invert() function.

This fixes 4420c5ed40.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-02-05 14:28:09 -06:00
Erwan Gouriou 609f78b75c drivers/adc: stm32: Don't enable ADC instance by default in driver
ADC_1 peripheral instance was enabled by default in driver.
This is not the usual way to enable peripheral instances, as it
makes board configuration unclear.
Move activation in boards that are declaring ADC support.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-05 13:56:26 -06:00
Krzysztof Chruscinski ce766305b7 drivers: clock_control: Add subsys argument to the callback
Added subsys argument to the callback, updated one driver which
used it and test cases.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-02-05 17:07:01 +01:00
Gerson Fernando Budke 738f76736e drivers: spi: sam: Add sam4e chip select config
Add depends on SOC_SERIES_SAM4E to enable spi driver for sam4e soc.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-02-05 10:14:51 -05:00
Gerson Fernando Budke e3d35713f6 drivers: gpio: Add sam4e defines
Enable sam4e MCU gpio specifics.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-02-05 08:18:02 -06:00
Peter Bigot 7c95d503b0 gpio: clean up internal API function prototypes
Use gpio_pin_t uniformly when passing pin indexes to the driver.  Use
gpio_flags_t uniformly when passing flags to the driver.  Change name
of pin configuration function in API function table to be consistent
with other API functions.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 37239dbcbf gpio: rename typedef for devicetree flags
gpio_dt_flags_t is shorter and consistent with DT_ prefix.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot f017209821 gpio: use reduced-size role typedef for public API pin indexes
There is a typedef used to store pin indexes in configuration
structures.  For consistency it should also be used to identify pin
indexes in function prototypes.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot c7d526be04 gpio: remove port access op support
The only remaining port operations have dedicated API function table
entries.  Remove the defines for access op (mode), and remove support
for access op from all implementations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 1f9beb193f gpio: remove legacy read/write API functions
The last external reference to these was removed when the pin
write/read functions were deprecated.  Remove the syscall support, API
function table entries, and implementation from all drivers.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 1947481cce gpio: deprecate gpio pin callback enable and disable API
These have been replaced by the appropriate call to
gpio_pin_interrupt_configure().  While the disable function could be
implemented using the new functionality, the enable function cannot
because the interrupt mode is not available.  Consequently we cannot
replace these with equivalent functionality using the legacy API.

Clean up the internal implementation by removing the inaccessible
port-based enable/disable feature, leaving the pin-based capability in
place.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 4b25e75c8f drivers: sensor: lis3mdl: replace deprecated gpio_pin callback API
gpio_pin_disable_callback is to be replaced by
gpio_pin_interrupt_configure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot bcf4d1249e drivers: led: ht16k33: reorder pin interrupt configuration
Replace the enable callback API with the enable interrupt API, and do
it after the callback is installed.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot f591f3e0bf drivers: bluetooth: hci: replace deprecated gpio_pin callback API
gpio_pin_en/disable_callback are to be replaced by
gpio_pin_interrupt_configure.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot e63c6cc325 gpio: replace GPIO_INT_LEVEL flag
This will be deprecated, use the generalized mode flag or absence of
GPIO_INT_EDGE.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot d7c461b0da drivers: gpio_cc13xx_cc26xx: replace GPIO_PUD_PULL macros
GPIO_PUD_PULL_foo is now spelled GPIO_PULL_foo.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 099614b30a gpio: replace GPIO_DIR flags
GPIO_DIR_OUT is now GPIO_OUTPUT, similarly for GPIO_DIR_IN.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 2befa6a251 gpio: deprecate legacy gpio pin read/write functions
These have been replaced by get/set functions in both raw and
active-sensitive variants.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot ddc3f0699f gpio: replace gpio pin write/read with set/get
This API will be deprecated in favor of the new API that clearly
specifies whether it works on logical or physical levels.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Johann Fischer 8f09c42b2c drivers: gd7965: convert to new GPIO API
Convert GD7965 controller driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Tomasz Bursztyka 62b2cae2ae drivers/ieee802154: Adapt cc1200 driver to new GPIO API
Update to use new API for GPIO pin configuration and operation.  Fix
invalid arithmetic on void pointer.  Convert to support devicetree.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Tomasz Bursztyka 3587fe2fe3 drivers/ieee802154: Adapt cc2520 driver to new GPIO API
Update to use new API for GPIO pin configuration and operation.  Fix
invalid arithmetic on void pointer.  Mark all CC2520 GPIOs as required
in binding.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Tomasz Bursztyka a40e9d3762 drivers/wifi: Switch WINC1500 to new GPIO API
Use new API to configure and interact with GPIOs.  Move GPIO
initialization from sample into driver.  The existing physical/line
level control has been kept rather than converting to logical level
signals.

Also improve error messages.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 97106bf95e drivers: modem: clean up pin configuration
After startup ublox-sara-r4 code sets the MDM_POWER signal to input
using a deprecated configuration macro.  This was the only use of the
modem context API to configure a pin.

Refactor the API to not take the flags as an input but instead select
between the flags to be used when the pin is active and a disconnected
state.  Use this API instead of a separate direct configure call when
initializing the modem pins.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 9b0859566d drivers: sensor: bma280: convert to new GPIO API
Use the new pin and interrupt configuration API.

NOTE: Because hardware is not available this has been build-tested
only.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Henrik Brix Andersen 8553f421ca drivers: adc: lmp90xxx: update to use new GPIO API
Update the DRDYB pin interrupt handling code of the TI LMP90xxx ADC
driver to use the new GPIO API.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-02-05 12:00:36 +01:00
Henrik Brix Andersen 82ecb89dae drivers: gpio: lmp90xxx: update to use new GPIO API
Update the TI LMP90xxx GPIO driver to the new GPIO API.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-02-05 12:00:36 +01:00
Piotr Mienkowski e1c10f6454 drivers: ieee802154_rf2xx: convert to the new GPIO API
Use new GPIO configuration API, set pin active level in devicetree
source.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2020-02-05 12:00:36 +01:00
Peter Bigot 78f8f84517 drivers: lora: update for new GPIO API
Update the lora/sx1276 driver to the new GPIO API, using configured
active level and the replacement interrupt and active-sensitive set
APIs.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot ce6ffd21dc drivers: eeprom_at2x: update for new GPIO API
Document and assign write-protect signal as active low, and use the
active-sensitive API to control it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Carles Cufi 132bf05561 drivers: audio: tlv320dac310x: Convert to the new GPIO API
Convert to the new GPIO API using logical access, including setting the
GPIO line as active low in the Device Tree source.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot a748e577bd drivers: sensor: mpu6050: convert to new GPIO API
Use new configuration API, replace callback enable/disable with
interrupt enable/disable, and set active level in devicetree source.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Johann Fischer 2748a23c61 drivers: ssd16xx: convert to new GPIO API
Convert SSD16XX sensor driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Carles Cufi 8399224271 drivers: modem: wncm14a2a: Convert to the new GPIO API
Conver to the new GPIO API using raw access, since the driver
has its own macros to define signal levels.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Carles Cufi d7afd55a45 drivers: modem: ublox-sara-r4: Convert to the new GPIO API
Convert to the new API using raw access, since it's a common access
layer shared by multiple (right now only ublox-sara-r4) modems.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Johann Fischer 3eecab88e6 drivers: ieee802154_mcr20a: convert to new GPIO API
Convert MCR20A 802154 controller driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Carles Cufi 594ec75547 drivers: display: mb_display: Convert to the new GPIO API
Convert to the new GPIO API, use raw access since this is a low-level
GPIO-based driver.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 6ccaef981c drivers: sensor: lsm9ds0_gyro: convert to new GPIO API
Use the new pin and interrupt configuration API.

NOTE: Because hardware is not available this has been build-tested
only.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Johann Fischer 64f5e23b47 drivers: ili9340: convert to new GPIO API
Convert ILI9340 display driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Johann Fischer c671b75e13 drivers: st7789v: convert to new GPIO API
Convert ST7789V display driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Peter Bigot 2c9425fe77 drivers: sensor: tmp007: convert to new GPIO API
Use the new pin and interrupt configuration API.

NOTE: Because hardware is not available this has been build-tested only.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Johann Fischer 91fad730a6 drivers: enc28j60: convert to new GPIO API
Convert ENC28J60 controller driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Johann Fischer d3da608535 drivers: enc424j600: convert to new GPIO API
Convert ENC424J600 controller driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Peter Bigot 6980a04e8c drivers: sensor: sx9500: convert to new GPIO API
Use the new pin and interrupt configuration API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot f5c8291c56 drivers: sensor: bmc150_magn: convert to new GPIO API
Use the new pin and interrupt configuration API.

NOTE: Because hardware is not available this has been build-tested
only.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot cb37ed7830 drivers: sensor: bmg160: convert to new GPIO API
Use the new pin and interrupt configuration API.

NOTE: Because hardware is not available this has been build-tested
only.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot acb43b66da sensors: ccs811: update to new API
Update devicetree sources and bindings, switch to new GPIO API.  Use
devicetree property name to identify interrupt signal.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Johann Fischer 988a681a16 drivers: ssd1306: convert to new GPIO API
Convert SSD1306 sensor driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Peter Bigot 3154627a97 drivers: sensor: lis2dh: convert to new GPIO API
Use the new pin and interrupt configuration API.  Update all
devicetree bindings to add INT signal active level.  Document active
level.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 50d1bb16e3 sensor: adt7420: update for new GPIO API
Update sample overlays.  Add GPIO flags to configuration state.
Refactor to split out setup/handle/process phases.  Switch to new API
replacing callback dis/enable with interrupt dis/enable.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Yannis Damigos ee351328a4 usb_dc_stm32: Convert usb disconnect gpio to new gpio api
Convert usb disconnect gpio to new gpio api.
Updates device tree for the olimexino_stm32.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2020-02-05 12:00:36 +01:00
Erwan Gouriou 9222a4f9a3 drivers/gpio: stm32: Align arguments types on few api functions
Somehow, types used in some api functions where not in line with
api.
Fix this.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-05 12:00:36 +01:00
Peter Bigot 32ff5f1d1f drivers: gpio_stm32: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure.  This driver uses fixups to define a common name
based on the SOC series; until aliases for the new properties are
added the code assumes all pins are supported.

Since pin ordinal validation is now done directly in gpio API,
remove checks inside the driver itself.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-02-05 12:00:36 +01:00
Peter Bigot 9d6127606a drivers: gpio_stellaris: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 6ef8dbbae2 drivers: gpio_sifive: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot b943f71e19 drivers: gpio_sam0: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 02676d1b3c drivers: gpio_sam: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot afd987fe9f drivers: gpio_rv32m1: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 71873c8a16 drivers: gpio_pca95xx: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 7c175c5197 drivers: gpio_mcux_lpc: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot c446588523 drivers: gpio_mcux_igpio: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 56f975fbb4 drivers: gpio_mcux: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 5eebc35d8b drivers: gpio_mchp_xec: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 8236d8209a drivers: gpio_intel_apl: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the hard-coded device-specific pin count to
initialize it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot d869a6c766 drivers: gpio_imx: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.  Not all aliases appear to be present, but using instances breaks
because the ports used by different boards do not always start with
the first.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 84ee7341fe drivers: gpio_ht16k33: add hard-coded support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure.  The devicetree binding does not inherit from
gpio-controller, so the required property is not available there.  A
hard-coded value of 32 pins has been implemented to make the driver
function.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot a908db8d20 drivers: gpio_gecko: add hard-coded support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure.  This driver uses fixups to define a common name
based on the SOC; until aliases for the new properties are added the
code assumes all pins are supported.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 10075991cc drivers: gpio_esp32: add support for pin validation
Add a config structure for each port and use the devicetree GPIO pin
count to initialize it.  Simplify device initialization by using
instance number as only variation point.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot cbe207377e drivers: gpio_dw: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 432b33d3fe drivers: gpio_cmsdk_ahb: add support for pin validation
Replace the common data structure with the common config structure as
a prefix of the driver-specific config structure and use the
devicetree GPIO pin counts to initialize it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 13c6cac876 drivers: gpio_cc32xx: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 47eb2fa27a drivers: gpio_cc13xx_cc26xx: add support for pin validation
Add a config structure and use the devicetree GPIO pin count to
initialize it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot a8ba5fb1a5 drivers: gpio_sx1509b: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 63141c1a31 drivers: gpio_nrfx: add support for pin validation
Add the common config structure as a prefix of the driver-specific
config structure and use the devicetree GPIO pin counts to initialize
it.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot 9022d33fec drivers: gpio: add support for device-specific pin validation
Extend the driver data structure with a field that identifies the pins
supported by the device.  Document the fields and who is responsible
for maintaining them.

Update all configuration functions for specific pins to return an
error if the pin is not supported.

Update all set/get functions for specific pins to assert if the pin is
not supported.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Peter Bigot c273b5d885 drivers: sensor: mcp9808: update to new GPIO API
Since this was converted to the setup/handle/process idiom in master
the conversion is straightforward.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Armando Visconti 3fdcbe5a79 driver/sensor: lis2ds12: update to use new GPIO API
Get rid of all the deprecated functions and definitions
replacing them with the new ones.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-02-05 12:00:36 +01:00
Peter Bigot 6afbd053e4 drivers: sensor: isl29035: update to new GPIO API
Document alert pin behavior, switch to new API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-05 12:00:36 +01:00
Johann Fischer 664a1cf0db drivers: amg88xx: convert to new GPIO API
Convert AMG88XX sensor driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00
Johann Fischer afe53230b3 drivers: ti_hdc: convert to new GPIO API
Convert TI HDC sensor driver to new GPIO API.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-02-05 12:00:36 +01:00