Commit graph

7653 commits

Author SHA1 Message Date
Armando Visconti 485f2d410c drivers/sensors: Add iis2dh accelerometer sensor support
Add support to STM IIS2DH the ultra-low-power highperformance
three-axis linear accelerometer.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-07-10 11:49:40 -05:00
Mieszko Mierunski 5d00616bf3 drivers: nrf: Add concatenation buffer to i2c nrfx TWIM driver.
Add option to concatenate i2c transfers. If concatenation buffer size is
provided then transfers will be concatenated as long as there is space
left in buffer.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2020-07-10 15:40:26 +02:00
Kamil Piszczek d19e21fb01 drivers: bluetooth: rpmsg: validate heap size configuration
Added a build-time assert to check if heap memory configuration to
make sure that it can accomodate RPMsg queue allocations.

Ref: NCSDK-5479

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-07-10 13:13:46 +02:00
Alexandre Bourdiol e520f35453 drivers: flash: stm32wb return in case of control register locked
In case of control register lock, driver should return the error
immediately. Otherwise, error is later overwritten by
'rc = flash_stm32_wait_flash_idle(dev);'

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-07-10 11:46:05 +02:00
Johann Fischer 6d76bd8a9f drivers: usb_dc_sam0: rename ep_num to common ep_idx
ep_idx is common used designator for endpoint index,
rename ep_num to ep_idx in usb_dc_sam0 driver.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-07-10 11:45:46 +02:00
Johann Fischer b95558dd9f drivers: usb: unify endpoint helper macros
Unify endpoint index and direction helper macros
across all usb device drivers.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-07-10 11:45:46 +02:00
Vincent Wan 3b126e30e2 drivers: entropy: cc13xx_cc26xx: add power management support
This commit adds a dependency on the TRNG resource in the TI Power
module, prevents the system policy from entering standby when TRNG is
active, and adds support for device PM.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-07-10 11:45:31 +02:00
Henrik Brix Andersen 99c7597874 drivers: i2c: mcux: return to idle on failed transfers
Abort I2C transfers through the MCUX HAL if a transfer fails to avoid
deadlock in the driver/HAL.

Fixes #25098

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-07-09 16:03:01 -05:00
Marcin Niestroj 559cf02107 drivers: lora: sx1276: configure reset gpio only once
Reset gpio is configured during driver initialization. There is no
reason to do it repeat that process later, so replace
gpio_pin_configure() with gpio_pin_set().

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-09 13:47:42 +02:00
Marcin Niestroj 71bdb35191 drivers: lora: sx1276: rework gpio configuration
Introduce sx1276_configure_pin() helper macro, which hides lots of
boilerplate preprocessor and C code. Doing so allows to uncover
inconsistent gpio initialization flow and prevent such in future. Also
add error log whenever gpio_pin_configure() fails.

It seems like output of gpio_pin_configure() for several
gpios (antenna_enable, rfi_enable, rfo_enable) was assigned to variable,
but its values was never checked. Return value from gpio_pin_configure()
of tcxo_power gpio was even not catched. The only output gpio
configuration that was handled properly was actually reset gpio.

Fix that inconsistent behavior by always checking return value of
sx1276_configure_pin().

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-09 13:47:42 +02:00
Vinayak Kariappa Chettimada eb2a64989b drivers: flash: nrf: Fix flash operation timeout
Fix flash operation timeout due to incorrect use of
secondary ticker to abort any radio in use. Ticker id 0
is reserved for split controller's pipeline preempt timeout.
Using the same ticker id caused the secondary ticker to
not be started if controller is using the same ticker id
for pipeline preempt timeout.

Fixes #26333.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-09 07:17:41 -04:00
Peter Bigot 2036bbcde4 drivers: sensor: bme280: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot 9acf7867ec drivers: spi_flash_at45: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot eac3f249c2 drivers: eth_enc424j600: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot 598f4e242d drivers: eth_enc28j60: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot ceb5c751b3 drivers: eeprom_at2x: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot 0f7acb1dc3 drivers: adc_mcp320x: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Peter Bigot 62e045f979 drivers: adc_lmp90xxx: respect devicetree cs-gpios flags
Forward flags cell from cs-gpios devicetree property into device SPI
configuration.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-09 06:07:07 -05:00
Marcin Niestroj fdeed32844 adc: adc_shell: suppress -Wchar-subscripts with isdigit()
Suppress -Wchar-subscripts warnings when building with Newlib, by
casting isdigit() parameter to unsigned char.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-09 11:28:54 +02:00
Andrei Gansari 0d5e9f9620 drivers: soc_flash_mcux check before reading
LPC55xxx SoCs don't allow reading erased areas, the flash memory
controller (FMC) will trigger an ECC error for that area. To prevent
reading unwritten areas the low level FMC command of margin checking is
used, this will fail if the area to be read is not correctly written
(margin_check) or area is erased (blank_check).
In the case of an erased page, we return dummy data so the application
can program that area.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-07-09 11:28:25 +02:00
Alexandre Bourdiol c8ceca2d53 drivers: STM32 dualcore concurrent register access protection with HSEM
In case of dualcore, STM32H7, STM32W and STM32MP1,
protect concurrent register write access with HSEM.
Done for following drivers:
clock_control, counter, flash, gpio, interrupt_controller

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-07-09 11:27:56 +02:00
Gerson Fernando Budke 92bb6afcdd drivers: ieee802154: rf2xx: Add CS gpio flags from DT
The generic SPI GPIO chip select support now respects devicetree flags
for signal active level. This pass DT information to driver instance to
ensure proper behavior.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-07-08 23:22:19 -04:00
Flavio Ceolin c4f7faea10 random: Include header where it is used
Unit tests were failing to build because random header was included by
kernel_includes.h. The problem is that rand32.h includes a generated
file that is either not generated or not included when building unit
tests. Also, it is better to limit the scope of this file to where it is
used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-07-08 21:05:36 -04:00
Christian Taedcke 82de647e31 drivers: i2c_gecko: Fix mutation of config_info content
Since the i2c init structure is moved from config_info to the stack,
this change requires 12 bytes more stack during driver initialization.

This fixes #25255

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-07-08 16:10:54 -05:00
Raja D.Singh bbabefb764 drivers: wifi: winc1500: Update to work with new timeouts
Change the driver to work without CONFIG_LEGACY_TIMEOUT_API option.

Signed-off-by: Raja D.Singh <rdsingh@iotwizards.com>
2020-07-08 15:38:43 -05:00
Marcin Niestroj 8ab0d153a2 drivers: wifi: esp: fix reset control logic and respect reset dts flags
wifi-reset-gpios flags were not respected so far. This means that
setting reset as active low (which is required in most cases for ESP
modules/chips) was done inside esp driver with inverted logic. Use dts
flags instead, so "active low" property is configured the same way as
for other drivers (i.e. in device-tree instead of driver).

This change also allows to configure reset as active high, in case where
ESP's nRST signal is somehow inverted on the board (behaving as RST
signal instead).

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-08 15:17:26 -05:00
Andy Ross 662835a798 drivers/serial/ns16550: Unbreak 64 bit MMIO addresses
PCI devices on 64 bit systems can be mapped anywhere, not just in the
lower 4G of memory.  Remove pointer size assumptions.

Also this removes the use of a struct uart_device_config to store the
(runtime) BAR address.  That struct has other stuff in it, and the
only thing we need is the single MMIO address.  It's also REALLY
confusing to have two "devconf" fields in the device storing values of
the same struct type, some fields of which are used from one of them
but some from the other!

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-07-08 12:34:09 +02:00
Andy Ross 43d84147d9 drivers/pcie: Fix BAR address size limitation
The PCI API was originally limited to 32 bit addresses.  Even though
it had code to skip over the high word in 64 bit BAR entries, it
refused to use it and returned a 32 bit value.  Some devices in the
wild have default mappings from the firmware for devices above 4G.

Also remove the "iobar" API.  It's dead code, we don't call it and we
don't test it.  IO space BAR entries are a legacy feature from way,
way back in PCI history (I genuinely have never heard of a real device
that uses them!).  And there's no difference in format between one of
these and a 32 bit "memory" BAR anyway, someone who actually had this
requirement could just use the existing API without worry.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-07-08 12:34:09 +02:00
Pawel Dunaj af063ccd12 drivers: timer: nrf_rtc: Use correct macro when capping cycles
When checking the absolute value of cycles set to the comparator
use the MAX_CYCLES instead of MAX_TICKS.

The commit changes function names and comments to make it clear
where ticks (system ticks) and where RTC cycles are used.

Fixes #26701

Signed-off-by: Pawel Dunaj <pawel.dunaj@nordicsemi.no>
2020-07-08 12:33:08 +02:00
Simon Glass 9ff7dfce23 flash: Enhance 'flash read' to read a block of data
It is annoying to read just a single word at a time. Update this
command to print any amount of data. This uses byte format at present.

We could perhaps support something like:

   flash read.8
   flash read.16
   flash read.32

to chose the size.

Example output (with line breaks to keep within git-style limit):

$ flash read FLASH_CTRL 0 20
00000000: 20 25 00 20 1d 26 00 08  69 68 00 08 45 26 00 08
   | %. .&.. ih..E&..|
00000010: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
   |........ ........|

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-07 17:19:26 -04:00
Krzysztof Chruscinski 157f6f65d9 drivers: sensor: nrf5: temp_nrf5: Add mutex to temp_nrf5_sample_fetch
Added mutex to protect against access from various contexts.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-07-07 16:27:32 -04:00
Peter Bigot dc14becd2d drivers: flash: nrf_qspi_nor: record dependency on multithreading
This driver blocks on a semaphore to receive notification when an
operation is complete, so requires CONFIG_MULTITHREADING=y.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-07-07 16:24:38 -04:00
Gerard Marull-Paretas 2ece951c1b drivers: pwm: stm32: fix polarity setting
PWM polarity was not being set correctly because flags were not checked
correctly.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-07-07 15:09:03 +02:00
Marcin Niestroj 68d0042138 drivers: console: gsm_mux: fix timeout after timeout API change
New timeout API uses opaque k_timeout_t type. Adjust code to work with
that properly.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-07 15:08:43 +02:00
Johann Fischer d261de8960 drivers: dw1000: fix SPI GPIO CS
Since commit 5963ebaf33
("drivers: spi: CS configuration through devicetree")
the SPI GPIO CS flags are obtained from DT,
but the patch series has missed the necessary changes
for the ieee802154_dw1000 driver and decawave_dwm1001_dev board.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-07-07 15:08:16 +02:00
Sandeep Tripathy b37ce93979 drivers: timer: fix tickless contineous interrupts
K_FOREVER/INT_MAX number of ticks needs delay cycles value of
maximum order and exceeds 'int32' range.
The typecast to 'int32' results in wrongly evaluating the value
as less than 'MIN_DELAY' and chooses 'MIN_DELAY' over the actual
delay cycles.

Cap the 'MAX_TICKS' to INT32_MAX.

fixes: #26632
Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-07-07 15:06:55 +02:00
Tyler Hall 62a13fb03b drivers: eeprom_at2x: guarantee retry until timeout
Make sure to retry at least once after the timeout elapses. Sample the
current time before starting the i2c transaction, and only give up if
the polling occurred after the timeout.

The timeout exists to allow the eeprom time to complete a write, during
which time it will nack transactions (at24) or the status register will
report busy (at25). If a transaction fails legitimately, but the 1ms
sleep overshoots the timeout expiration, we will not try again, which
fails to give the part the full grace period before declaring failure.

This is likely to happen in the last 1ms interval but also possible if
the eeprom thread is preempted. It is possible to only try once and give
up if the sleep lasts longer than the timeout, which fails to give the
part an adequate period to complete the write.

Waiting until the current time is after (not equal to) the timeout is
also important because we don't want to round up partial milliseconds if
the start time was sampled near the end of a millisecond boundary. The
timeouts of eeproms can be ~5ms.

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
2020-07-07 15:04:31 +02:00
Andrzej Głąbek 414c773c48 drivers: gpio_nrfx: Replace atomic_set_bit_to() with atomic_and()
A call to atomic_set_bit_to() was used for clearing bits in an atomic_t
variable that stores information about allocated GPIOTE channels.
This caused an issue to be reported by Coverity, as the function treats
its first parameter as an array and it was provided with a pointer to
a singleton.
This commit replaces that call with atomic_and(), to prevent the issue
from being reported and for consistency with the way bits are set for
allocated GPIOTE channels (what is done with a call to atomic_or()).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-07-06 16:47:03 +02:00
Andrzej Głąbek 5f6985ce64 drivers: uart_nrfx_uart: Fix disabling of TX IRQ
The STOPTX task cannot be triggered directly in the function that
disables TX interrupt because this task stops the UART transmitter
immediately, even if it is in the middle of shifting out a byte.
Instead, this task needs to be triggered in the interrupt handler,
when the end of transmission is signaled.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-07-06 16:34:53 +02:00
Michael Hope e68287dd90 drivers: spi: fix the fast path on the SAM0 driver
To keep the bus fully loaded, the SAM0 has a fast path that recognises
special cases like TX only, RX only, or TX/RX of the same size.
Commit #ea2431f32f7 accidentally disabled this.

This increases the utilisation from around 30 % to around 90 % at 48
MHz.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-06 10:02:14 -04:00
Michael Hope 8181eede5d drivers: spi: ensure the first byte has been loaded in the TX fast path
The SAM0 has a data register and a shift register.  Data that is
written to the data register is transferred to the shift register by
the peripheral.

On the SAMD51, the CPU is fast enough that the first data write hasn't
been transferred to the shift register by the time the next data write
occurs, causing the second write to be dropped, causing the receiver
to wait forever.

Fix by spinning until the data register is empty.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-06 10:01:35 -04:00
Michael Hope dcf64c93e3 drivers: usb: switch the SAM0 driver from a custom allocator to the heap
Also automatically enable the heap if the USB device is selected.

Part of #23178

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-06 09:58:20 -04:00
Andreas Sandberg 8e8f14e333 drivers: lora: Add chip select flags to SX1276 driver
Add chip select flags from the device tree to the spi_cs_control
instance.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-06 09:57:45 -04:00
Andreas Sandberg 33d473d281 drivers: lora: Add chip select flags to SX126x driver
Add chip select flags from the device tree to the spi_cs_control
instance.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-06 09:57:45 -04:00
Tobias Schaffner 667f1e663d drivers: gd7965: use K_MSEC macro in k_sleep calls
The gd7965 driver still called ksleep with unsigned integers.
Use the K_MSEC makro instead.

Signed-off-by: Tobias Schaffner <tobiasschaffner87@outlook.com>
2020-07-06 09:57:14 -04:00
Parthiban Nallathambi 3e62d73368 drivers: wifi: eswifi: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.
ISM43362 chip select is ACTIVE_LOW.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-07-06 08:24:18 -05:00
Joakim Andersson 4be66bd33d Bluetooth: Fix host RX thread deadlock
Fix host RX thread being deadlocked. The deadlock occurs because the
RX thread is stuck waiting in conn_tx_alloc with K_FOREVER but if the
connection is disconnected only the RX thread can unblock it in the
handling of the disconnect event.

This commit fixes this deadlock by splitting the processing of the
disconnected event into two parts.
The part needed to unblock the RX is to release resources held by
unack'ed TX packets and mark the connection state as not connected
anymore.
The RX thread waiting for free_tx fifo and the TX thread waiting for
the bt_dev.le.pkts semaphore will both check the connected state after
having acquired them and will abort if disconnected.
The rest of the processing will be handled at normal RX thread
priority like normal.

Move the bt_recv_prio handling to the Bluetooth host when the host
has defined its own RX thread (CONFIG_BT_RECV_IS_RX_THREAD=n).
If the HCI driver has the RX thread (CONFIG_BT_RECV_IS_RX_THREAD=y),
then the responsibility to call bt_recv and bt_recv_prio correctly
falls to the HCI driver.
The helper function bt_hci_evt_is_prio() is replaced with
bt_hci_evt_get_flags() so that the HCI driver can do this correctly.
This decision to replace was made so that existing HCI drivers
maintained out-of-tree will fail at compile time with the new system.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>

Bluetooth: host: Move bt_recv_prio to host when RX thread is defined

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 11:15:39 +02:00
Ilya Tagunov 301208329b drivers: clock_control: stm32f0/f3: streamline PREDIV handling
We should not set PLLSRC bits here. It is done by
LL_PLL_ConfigSystemClock_* functions which are called later.
Also, PREDIV1 setting should not be restricted to HSE only.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2020-07-05 07:56:21 -04:00
Ilya Tagunov 907c545837 drivers: clock_control: stm32f0/f3: fix PREDIV options
Allow CLOCK_STM32_PLL_PREDIV1 option for STM32F3 series;
correct and extend option descriptions.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2020-07-05 07:56:21 -04:00
Michael Hope 0bc3585800 drivers: timer: enable read synchronisation mode for the SAMD/E5x
The COUNT register on the SAMD/E5x RTC can only be read if the read
synchronisation mode is enabled.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-03 12:20:03 -04:00
Michael Hope 89466d57ea drivers: timer: fix the use of K_FOREVER for the SAMD/E5x
Change K_FOREVER for K_TICKS_FOREVER.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-03 12:20:03 -04:00
Henrik Brix Andersen 6494ce2607 drivers: dac: mcux_dac32: add Kconfig option for enabling test output
Add a Kconfig option for enabling the DAC test output. On the NXP
KE1xF the DAC test output is internally routed to ADCx SE23.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-07-03 08:05:25 -04:00
Andreas Sandberg 69f0e3b15f drivers: flash: Add support for STM32L0X
Add support for STM32L0X using the generic STM32 backend. This is
quite a significant change since the L0 series uses a slightly
different flash controller. Refactor the generic backend to better
support different block sizes and the L0's register interface.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-03 08:05:03 -04:00
Andreas Sandberg b9da052e51 drivers: flash: Remove redundant code in STM32 drivers
Several STM32 chips have identical chip-specific code that has been
duplicated in different source files. Unify the F0x, F1x, and F3x to
use a single implementation.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-03 08:05:03 -04:00
Johann Fischer 0a87f9359e drivers: uart_mcux: add UART set configuration function
Add UART set configuration function.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-07-02 11:09:09 -04:00
Marcin Niestroj 67f106820b net: ppp: consume ringbuf until it is empty
ringbuf claim API returns pointer to contiguous area. In cases when data
in ringbuf wraps the end of internal buffer, then single call to claim
data is not enough to get all data - there is remaining part on the
beginning of internal buffer. Those remaining bytes will need to wait
for next ISR handler to trigger workqueue. Theoretically this means that
data on the beginning of ringbuf can wait there forever, or simply to
the next timeout in PPP stack when data traffic continues.

Consume data from ringbuf in a loop, stopping only when claiming results
in empty buffer. This will make sure that there is no stale data in the
ringbuf.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-02 08:25:12 -05:00
Marcin Niestroj a470d9deba net: ppp: fix consuming claimed area of ringbuf
Claimed ringbuf bytes were parsed until first frame was detected, but
remaining data in the claimed area was just ignored / lost.

Continue parsing bytes to the end of claimed area after each detected
frame.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-07-02 08:25:12 -05:00
Erwan Gouriou 6b72fbae7c drivers/clock_control: Remove useless CLOCK_STM32_PLL_XTPRE config
CLOCK_STM32_PLL_XTPRE Kconfig symbols was made to differentiate
code between F1 soc variants with XTRE and others.
It appears that specific XTRE code handling is already in place in
LL_PLL_ConfigSystemClock_* functions that are called afterwards.
Since this piece of code is not required anymore, let's remove
the symbol.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-07-02 08:14:45 -05:00
Tobias Svehagen 822df6eef6 drivers: wifi: esp: Improvements to ESP driver
- Fix passive mode protocol selection depending on AT versions
- Use Kconfig value for reset timeout
- Fix bug with parsing security from scan result
- Re-order some AT commands during init due to some commands having
  dependency on other commands

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-07-02 08:52:28 -04:00
Markus Becker 30389e01dd driver: ieee802154: rf2xx: implement setting tx power
Implemented rf2xx_set_txpower() in ieee802154_rf2xx.c by mapping dBm
values to RF2XX register values.

Signed-off-by: Kari Severinkangas <kari.severinkangas@tridonic.com>
Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-07-02 08:51:22 -04:00
Xavier Chapron cecea7b536 drivers: i2c_nrfx_{twi, twim}: Remove potential I2C deadlock
Remove K_FOREVER wait on completion_sync.
In some situations (a short on I2C SDA line for example), this
semaphore will never be released and therefore we should not wait
it forever.
Instead we wait for a maximum of 100msec and return an error if we
weren't able to retrieve the semaphore.
In such situation, the program is not stuck anymore, but the I2C
driver must be uninit then init again to work again.

Fixes #25076.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-07-02 08:48:24 -04:00
Tobias Svehagen edcee97346 drivers: wifi: esp: Fix bug with net_pkt_unref in tx path
The driver should only call net_pkt_unref on packets that get
successfully handled, ie where send/sendto return 0. If the packet
cannot be handled, net_context layer still owns the packet and should
take care or the unref.

Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
2020-07-02 08:44:55 -04:00
Stephanos Ioannidis 75502d54b6 drivers: ethernet: sam_gmac: Add SOC_FAMILY_SAM0 dependency
The Atmel GMAC Ethernet driver may be used by both the SAM series
(e.g. SAM E70) and SAM0 series (e.g. SAM E54) SoCs.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-07-02 08:37:17 -04:00
Fabio Utzig b6a14265e7 drivers: flash: at45: fix page-size writing wrap
When writing buffers larger then page-size, there is already a routine
that checks wrap around and adjusts offsets, but this routine was
missing incrementing the data pointer, which would results in
rewriting the same page-size bytes over and over. This adds the proper
increment code.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-07-02 08:33:40 -04:00
Fabio Utzig f81c5190ec drivers: flash: at45: fix non-initialized warning
Silence a gcc warning due to possible return of unitialized variable in
erase function. This could only happen if size == 0, which doesn't seem
likely, but initializing the variable to zero should fix the issue.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-07-02 08:33:40 -04:00
Andreas Sandberg 6a4ebe5949 drivers: lora: Add SX126x LoRa radio support
Add support for the SX126x series of LoRa radios using the
LoRaMAC-Node HAL.

This driver currently makes the following assumptions:

  * DIO1 is used as an interrupt line.

  * There is an RF switch selecting between the TX and RX ports and
    that switch is controlled by DIO2.

  * There is either no TCXO or the TCXO is controlled by DIO3.

Specifically, the limitations above mean that modules that use GPIOs
to control the RF switch are currently not supported. Support for such
modules would need changes to the LoRaMAC-Node code.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-02 08:32:37 -04:00
Andreas Sandberg ba330ec765 drivers: lora: Prepare Kconfig for additional radios
Add a new configuration option, LORA_SX12XX, that is shared for all of
the LoRaMAC-node-based radio drivers. By default, the appropriate
driver for the LoRa radio in the device tree is included is included
in the build.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-07-02 08:32:37 -04:00
Dominik Ermel bec0c7f279 drivers/flash/flash_simulator: Fix flash_sim_write
flash_sim_write did not work correctly when simulating flash with
non-0xff erase value.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-07-02 08:24:19 -04:00
Roman Vaughan ac6fec45e7 drivers: led_strip: Add support for external SPI CS on APA102 LED strips
Some boards may include an APA102 LED on an existing SPI bus. With
additional circuitry, chip select is supported where the APA102
lacks a built in CS pin.

This patch allows CS to be defined in the devicetree (through .dts
files) and utilised in the apa102.c driver if it's available. Preserving
old behaviour if no chip select is defined.

Signed-off-by: Roman Vaughan <nzsmartie@gmail.com>
2020-07-02 08:22:31 -04:00
Maureen Helm 10c1ded452 drivers: spi: Add optional delays to mcux dspi and lpspi drivers
Adds optional device tree properties to set delays between spi chip
select assert/deassert and clock edges in the mcux dspi and lpspi
drivers. If these properties are not set, then the minimum supported
delays are used.

Verified that tests/drivers/spi/spi_loopback/ still passes on
mimxrt1050_evk (lpspi driver) and frdm_k64f (dspi driver).

Measured with a scope that the pcs-sck-delay and sck-pcs-delay times on
the first spi transaction in the test are reduced from 7.82 us to 20 ns
on mimxrt1050_evk.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-07-02 07:57:36 -04:00
Jordan Yates ab3e778f47 wifi: winc1500: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates ac66b76934 sensor: ms5607: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates f7e2265fb8 sensor: lsm6dsl: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates adf1c1cfe9 sensor: lis2ds12: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 3d490e0f6e sensor: adxl372: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 1dffc2870f sensor: adxl362: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates e7a5505e74 ieee802154: mcr20a: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 0d4417d187 ieee802154: cc2520: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 4f07fac5fc ieee802154: cc1200: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates ede1448b75 gpio: mcp23s17: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 667cc302fa display: ssd16xx: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 99a9d1cf06 display: gd7965: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 750ccd39dc can: mcp2515: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates a04d2f3989 sensor: lsm6dso: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates e186dcb34e sensor: lps22hh: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 9a6ec94aa7 sensor: lis2mdl: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates fc2783a017 sensor: lis2dh: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates f92714ecec sensor: ism330dhcx: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 88e4ddbbd4 sensor: lis2dw12: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates f622dcb1ec sensor: iis3dhhc: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 369f64f6ff sensor: iis2mdc: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 4f0a370c7f sensor: iis2dlpc: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates ab509ffc46 flash: spi_nor: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 57740d89e0 flash: w25qxxdv: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 26f83a0f1e display: st7789v: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 35f5b17b4d display: ili9340: Add chip select flags
Adds the chip select devicetree flags to the spi_cs_control instance.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Jordan Yates 5963ebaf33 drivers: spi: CS configuration through devicetree
Add an additional option to the spi_cs_control struct that records how
the pin has been configured in devicetree. For drivers that are not
updated, the CS behaviour is the same as before (Push-Pull).

Use the devicetree knowledge with the GPIO subsystem so that the correct
physical pin levels for the CS pin are automatically selected.

Fixes #26267

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-01 16:40:03 -05:00
Saravanan Sekar bda358a64f drivers: serial: add support for Nuvoton series UART
Add Nuvoton numicro series UART support, currently supports
only poll mode.

UART0 clock and pincontrol are directly configured, will be
replace when clock and gpio support is added.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
2020-07-01 21:09:25 +02:00
Abhishek Shah ca523c1cf6 drivers: pcie: Do not enable PCIe RC module shell for endpoint
PCIe shell was enabled by default if shell is enabled in below commit:
commit ee985d81aa ("shell: enable modules by default if shell is
enabled").

However, this shell file has tests for PCIe RC, not applicable to EP.
So, should not be default enabled for PCIe EP.

If we add EP shell tests in future, they should be added under
drivers/pcie/endpoint/ directory.

Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com>
2020-07-01 11:21:57 -04:00
Michael Hope e362f10d4c drivers: pwm: add a SAM0 TCC based PWM driver
This runs the Timer/Counter for Control in 'normal' PWM mode.  The
number of channels and counter width depends on the device and is
imported from DeviceTree.

Signed-off-by: Michael Hope <mlhx@google.com>
2020-07-01 08:10:59 -05:00