Commit graph

7658 commits

Author SHA1 Message Date
Andrzej Głąbek f766a3e18b sensor: temp_nrf5: Allow use only when the TEMP peripheral is present
Correct dependency of the TEMP_NRF5 Kconfig option so that it can be
enabled only on nRF SoCs that feature the TEMP peripheral.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-05-25 16:03:02 +02:00
Erwan Gouriou 2716cbcaa6 drivers: susbsys: Check errors on devices selected using dt macro
Some Kconfig defined devices may be defined using dt_chosen_label
function. Since there is no way to ensure a device enabled in dts
is also defined in Kconfig, it may happen that instance is not
actually defined.
In this case device_get_binding might return 0, leading to undefined
behavior in the function that calls it.
When not already done, systematically check return of function
device_get_binding on devices defined through dt_chosen_label macro.
Trigger ASSERT when required and return error when possible.

Fixes #20068

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-25 11:43:14 +02:00
Emil Obalski 19f6ed02b8 usb: driver: Fix Nordic driver for fragmented control OUT transfers.
Nordic driver must allow read from control OUT endpoint by
itself. For data stage transactions with length > MPS (64Bytes)
this must be performed for each 64B + Residue data packet.

Residue - data packet with len < 64B.

The exact length of data transfer is known from wLength field
form setup packet in setup stage. Until now driver was incorrectly
initializing the length of the data stage and at some point will
not allow for next data stage.

This commit addresses the issue #23980.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-22 12:50:35 +02:00
Peter Bigot de9ed4e6a1 kernel: sys_clock: update weak pm control function
The weak implementation returns 0 for all operations without doing
anything, which incorrectly suggests that an operation like
device_get_power_state() returned an accurate description of the
system clock power state.  Return -ENOTSUP instead.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-21 20:32:12 +02:00
Krzysztof Chruscinski a719b8c5e4 drivers: timer: nrf: Remove RTC1 dependency
Removed RTC1 dependencies in the code. Single define picks the instance.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-21 17:43:08 +02:00
Krzysztof Chruscinski 699b717452 drivers: timer: nrf: Fix premature timeouts
If timeout is being overwrite exactly when previous one is expiring
then hardware event was cleared correctly but interrupt was already
triggered. Interrupt routine was assuming that compare event is set
and proceed with that assumption. However, in that corner case when
compare event was overwritten and event was cleared, that was not the
case.

As the outcome, timeout could be triggered prematurely. Fixed by
clearing pending interrupt after handling previous compare value.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-21 17:43:08 +02:00
Peter Bigot bfb56c5e20 drivers: flash: nrf_qspi_nor: support read of sub-word lengths
mcuboot and possibly other tools read single byte values to determine
the state of objects.  Rather than fail to do the read of values too
short for this peripheral detect the situation and read into a stack
buffer that meets the length criteria, and on success copy the data
into the provided buffer.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-21 17:04:05 +02:00
Wayne Ren bc6f11b730 drivers: arcv2_timer0: minor fix and optimization for SMP case
* still need to clear IP bit in timer irq handler

* last_time should be aligned to ticks, old code will miss some
cycles which are about (curret_time - last_time) % CYC_PER_TICK

* in timeout set, shorten the delay needed when tick is 0, this
 will improve the response of timer irq

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-21 12:37:41 +02:00
Wayne Ren ac5dc1dd34 drivers: arcv2_timer0: back to use level triggered irq
the pulse triggered timer irq doesn't work for all targets. In
iotdk, we found the clear of IP bit will clear int request
when elapsed called in thread context. So come back to level
triggered way which is supported in all targets, and use the sw
triggered irq to remember the irq request which may be cleared
in non timer int handler.

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-21 12:37:41 +02:00
Wayne Ren f511d51ca3 drivers: arcv2_timer0: rename overflow_cyc to overflow_cycles
* rename overflow_cyc to overflow_cycles for better understanding
* use MIN macro to replace if .. else ..
* typo fix in comments

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-21 12:37:41 +02:00
Emil Obalski 2a2d92f9c2 usb: driver: nordic: Unlock mutex in case of error.
Mutex that was previously locked must be unlocked in case
of an error.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-21 11:02:02 +02:00
Henrik Brix Andersen 784c4728b5 drivers: pwm: mcux_ftm: allow configuring the clock prescaler
Allow configuring the clock prescaler divider for the NXP Kinetis
FlexTimer. Setting the prescaler to a lower value allows for much
higher resolution/accuracy for the generated PWM waveforms.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-20 19:03:14 +02:00
Jukka Rissanen c6a19a2046 cmake: qemu: Allow user to add parameters to Ethernet TAP
User can now add extra Ethernet TAP parameters when starting QEMU.
This is useful if we want to set for example the MAC address
of the network interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-20 15:36:39 +02:00
Peter Bigot edd9aecddf device: avoid casting away const from config_info pointer
Re-run the const_config_info Coccinelle patch to fix code.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-20 13:30:17 +02:00
Daniel Leung 74306a6578 gpio: intel_apl: fix incorrect address access
The address used to access to REG_MISCCFG is not correct.
So fix it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-19 19:19:51 +02:00
Daniel Leung 7cd0ef0939 gpio: intel_apl: fix ISR function signature
Fix build error regarding the function signature of ISR.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-19 19:19:51 +02:00
Daniel Leung af43e14bd0 serial: ns16550: do not write to device cfg struct when PCIE=y
When PCIe is enabled for UART, the port address is probed during
initialization and is written back into the device config struct.
However, the device config struct is supposed to be const and
read only. This results in page faults when MMU is enabled as
the struct cannot be written into. So fix this by storing port
address in device data struct if a particular UART instance is
of PCIE.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-19 19:19:51 +02:00
Daniel Leung 36674f6bf8 serial: ns16550: return error when init fails
The init function returns successful even if the first
configuration function call fails. This may leave
a non-usable UART to be discoverable with
device_get_binding() which will definitely result
in lots of head scratching. So change the init function
to return properly.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-19 19:19:51 +02:00
Daniel Leung cee9d9b039 timer: hpet: enable benchmarking during ISR
This adds the calls to read_timer_{start,end}_of_tick_handler()
to mark the start and end of ISR which will be used to display
the time spent in ISR with benchmarking tests.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-19 19:19:51 +02:00
Vincent Wan f6bbad831a drivers: ieee802154: cc13xx_cc26xx: use HwiP_construct to connect CPE0
IRQ_CONNECT() can only be called at one location to connect the irq for
CPE0. This commit modifies the driver to call into the HwiP layer in TI
HAL so that TI's RF driver can do the same when connecting the irq.

Fixes #25216

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-19 17:28:29 +02:00
Vincent Wan e21da06a16 drivers: ieee802154: fix build for cc13xx/cc26xx
New update of hal_ti requires DeviceFamily_CC13X2/DeviceFamily_CC26X2
to be defined in order to include the rfc.h header.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-19 17:28:29 +02:00
Peter Bigot ec55314d28 drivers: timer: nrf_rtc: fix TICKLESS=n processing
Some kernel tests use `CONFIG_TICKLESS_KERNEL=n` with
`CONFIG_SYS_CLOCK_TICKS_PER_SEC=1` to detect when a test runs longer
than 1 second.  These tests break if a tick is announced every time a
timeout occurs.  Only announce if the measured duration since the last
tick is at least the duration of a tick.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-19 17:19:02 +02:00
Alexandre Bourdiol 5559430654 driver: counter: counter_ll_stm32_rtc.c: Add 1 tick to alarm
Add +1 tick to alarm in order to compensate the partially started tick.
Alarm will expire between requested ticks and ticks+1.
In case only 1 tick is requested, it will avoid that +1 Tick event
occurs before alarm setting is finished.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-05-19 14:48:49 +02:00
Bilal Wasim 190ade91b8 drivers: eth: stm32: Fix invalid assertion comparison
The check for assertion on the "config_func" was added to
validate that the function pointer is valid. However, in
the code we are invoking the "config_func" and comparing
its output with NULL. This causes build failures with
CONFIG_ASSERT=1. Caused by PR-25393.

Tested on Nucleo F767Zi board.

Fixes #25427

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-05-19 14:47:51 +02:00
Jennifer Williams d2c74eb987 drivers: serial: uart: ns16550 add missing isr locking
The existing uart driver ns16550 did not have ISR locking that
effected IO APIC working in fixed delivery mode in SMP system
x86_64. This commit adds ISR locking mechanism using spinlock
for the interrupt related services.

The CONFIG_IPM_CONSOLE_STACK_SIZE is increased to lift
limitation of stack size experienced in IPM driver test with
this spinlock impelentation.

Fixes #23026

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2020-05-18 19:35:37 -04:00
Erwan Gouriou ac98a786d4 drivers/spi: stm32: Fix use of single dma channel
Current dma struture code didn't allowed only rx channel removal,
disabling tx channel (in spi client node) was leading compilation
issue.
Fix this by moving conditional code inside SPI_DMA_CHANNEL macro and
get the part of code which is present or removed (SPI_DMA_CHANNEL_INIT)
outside of {}.
Additionally, fix indentation on '\' in whole instance init macros

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-18 19:14:37 +02:00
Bilal Wasim 10a05017bc drivers: eth: stm32: Fix driver crash caused by RX IRQ trigger
All initialization of the Ethernet interface is done in the
eth_initialize function which is invoked by the boot code.
This function sets up DMA, programs the Ethernet module and
enables IRQs. However, this function does not setup "netif"
interface info which is done when the ethernet device is
enumerated by the NET stack via the "iface_api.init" func.
However, after the eth_initialize func is called, it is
possible that the system receives RX interrupts, and the
"rx_thread" accesses the "netif" pointer to get iface info.
However, because the "netif" info is not necessarily
populated at this time, we get a crash (as OS does NULL
access).

Fixed by enabling Ethernet IRQ after the interface is
properly setup.

Tested on Nucleo F767Zi board.

Fixes #25408

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-05-18 19:11:40 +02:00
Sandeep Tripathy 17fcaa3fc4 drivers: timer: get ppi configuration from dt
Use device tree provided configurations for arm architecture timer
PPIs.

This fixes issue of timer ppi not working on most hardware where
edge-triggered PPI are not supported.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-05-18 11:07:57 +02:00
Daniel Leung e4734e088a gpio: intel_apl: don't enable interrupt if line is output
Hardware does not seem to support triggering interrupts to
itself by setting line as both input/output and setting
output to desired level. So just say interrupt triggering
is not supported when line is set to output.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-16 19:56:19 +02:00
Wentong Wu 72227574d8 timer: remove QEMU_TICKLESS_WORKAROUND
Qemu icount mode enabled, remove QEMU_TICKLESS_WORKAROUND.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-05-14 13:52:07 +02:00
Marek Pieta 6da15634bf drivers: usb_dc_nrfx: Abort write on ep_ctx_reset
Change adds abort of ongoing write operation in ep_ctx_reset. This is
required to keep the state of Zephyr driver consistent with state of
nrfx driver. This fixes a bug where nrfx_usbd was stuck in busy state.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2020-05-14 13:28:46 +02:00
Christoph Reiter d49e7da7da sensor: add sensor driver for Infineon DPS310
Add driver for Infineon DPS310 temperature and pressure sensor.

Signed-off-by: Christoph Reiter <christoph.reiter@infineon.com>
2020-05-14 11:02:29 +02:00
Daniel Leung ba5b141e2f gpio: mchp_xec: fix erroneous interrupt triggers
If interrupt is previously enabled and triggering condition
changes, it might fire callback based on previous condition.
To avoid this issue, disable interrupt before trying to
change settings, and enable afterwards.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-05-14 10:48:26 +02:00
Martí Bolívar 6e8775ff84 devicetree: remove DT_HAS_NODE_STATUS_OKAY
Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an
undesirable API for the following reasons:

- it's inconsistent with the rest of the DT_NODE_HAS_FOO names
- DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand
  for macros which are equivalent to
  DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) &&
- DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck
- DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway
- it is seen as a somewhat aesthetically challenged name

Replace all users with DT_NODE_HAS_STATUS(..., okay), which is
semantically equivalent.

This is mostly done with sed, but a few remaining cases were done by
hand, along with whitespace, docs, and comment changes. These special
cases include the Nordic SOC static assert files.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 18:24:42 +02:00
Peter Bigot 4f16b419e8 device: avoid casting away const from config_info pointer
The driver-specific config_info structure referenced from the device
structure is marked const.  Some drivers fail to preserve that
qualifier when casting the pointer to the driver-specific structure,
violating MISRA 11.8.

Changes produced by scripts/coccinelle/const_config_info.cocci.

Some changes proposed by the script are not included because they
reveal mutation of state through the const pointer, though the
code works as long as the driver-specific object is defined without
the const qualifier.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-13 18:21:52 +02:00
Francois Ramu 1a163673c7 drivers: spi: driver reloading dma buffers in the main transceive loop
With this change, the spi transceive with dma function
waits for the spi busy flag reset and for the dma transfer end.
Then it reloads the channels until all buffers are consumed.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-13 16:22:10 +02:00
Francois Ramu c83e2a41ae drivers: spi: driver dma callback function to set transfer flag
This change avoids the reload of the dma channel
in the callback function, just sets the corresponding Tx, Rx flag.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-13 16:22:10 +02:00
Johann Fischer 5a3d44256e drivers: usb_dc_sam: free endpoint memory on End of Reset event
Free endpoint memory on End of Reset event (EORST).

Fixes: #24626

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-05-13 11:13:36 +02:00
Johann Fischer 29d95ba1d4 drivers: usb_dc_sam: tweak logging for enable, disable, configure
Tweak logging for enable, disable, configure.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-05-13 11:13:36 +02:00
Gerson Fernando Budke 9a37154151 drivers: wifi: esp: Update to new timeout api
Update to new timeout api.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-05-12 17:18:34 +02:00
Anas Nashif 8ec88164ac i2c: shell: add braces around if statement
Add braces around if statements per coding guideline.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-10 17:49:30 +02:00
Simon Glass 9360150c0c i2c_shell: Add write/read multiple-byte commands
Allow writing multiple registers (or a single 16-bit register) and
reading multiple registers.

   i2c read I2C_2 36 40
   00000000: 12 34 00 00 0F 3D 80 80 AF 9C 17 00 90 01 00 00

   i2c write I2C_2 36 40 12 34 56 78 90 12 34 56 78 90

   i2c read I2C_2 36 40
   00000000: 12 34 00 00 90 12 80 80 AF 9C 17 00 90 01 00 00

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-10 17:49:30 +02:00
Anas Nashif ffd568db09 i2c_shell: Add write_byte/read_byte commands
Add simple commands to read or write a single byte from a device
register.

   i2c write_byte I2C_2 36 b0 12
   i2c read_byte I2C_2 36 0
   Output: 0x82

I modified Anas' version to put args in variables first so that the code
is self-documenting.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-10 17:49:30 +02:00
Anas Nashif 0ecc71ccb2 i2c_shell: Tidy up the code style
Fix some code-style nits in this file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-10 17:49:30 +02:00
Xavier Chapron 2a8ff02ef2 drivers: Replace printf by printk when applicable
Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-05-09 21:25:33 +02:00
Kumar Gala df56ce3efb drivers: ethernet: mcux: rework how unique mac is determined
Instead of having a Kconfig property, if there is no local-mac-address
property in the devicetree than we'll generate a unique MAC address
based on unique ID registers on the SoC.

We remove the local-mac-address properties in the SoC dtsi files to
match the default behavior that existed before (ie, unique MAC address)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 16:29:57 +02:00
Kumar Gala b19cf0bed3 drivers: eth: Get Manual MAC address from devicetree
Move from a Kconfig to select/initialize the MAC address to using the
"local-mac-address" property in devicetree.  If the property is set the
drivers will initialize the mac-address from the devicetree (unless the
mac address is all 0's).  The MAC address might get overwritten by
either a driver specific means or by the setting of
"zephyr,random-mac-address" in the devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 16:29:57 +02:00
Kumar Gala 1de61b4c42 drivers: eth: Replace driver specific RANDOM_MAC Kconfig with devicetree
Utilize the devicetree property "zephyr,random-mac-address" to determine
if a driver should use a random mac address and remove the associated
Kconfig options that enabled this feature.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 16:29:57 +02:00
Kumar Gala 8178f76470 drivers: eth: Refactor generation of random mac into help function
Rather than having each driver have its own slightly different way of
generating a random mac address, add a helper function that they all can
call so we do it one way.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 16:29:57 +02:00
Parthiban Nallathambi f4adfd52cb drivers: serial: add XMC seris UART support
Add infineon XMC4 series UART support. Driver supports
only poll mode using XMCLib.

Out of 4 available UART's on SoC, only UART1 is confgired
by default in UART mode until GPIO & pinctrl support.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2020-05-09 14:21:44 +02:00
Jose Alberto Meza eaaf1af79e drivers: espi: mchp: Report correct length during OOB Rx operation
Use correct HAL macro to report amount of bytes received.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-05-09 07:20:13 -04:00
Erwan Gouriou 6ea53792f4 modules: stm32: Rename lib Kconfig symbol
Both ST and STM32 modules where using same HAS_STLIB Kconfig
symbol.
Now that each module is createing is own lib, we need to be able
to distinguish libs.

Depends on zephyrproject-rtos/hal_stm32/pull/52

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-09 13:08:42 +02:00
Albin Söderqvist 35c4838425 drivers: display: st7789v: add power management support
This adds sleep mode along with power managament control.

Signed-off-by: Albin Söderqvist <albin.soderqvist@endian.se>
2020-05-09 13:07:17 +02:00
Kumar Gala db725c0ec9 drivers: Replace GPIO_CS Kconfig with devicetree detection
Use DT_INST_SPI_DEV_HAS_CS_GPIOS() in drivers to determine if we should
utilize CS_GPIO base SPI chipselect handling.  This allows us to remove
Kconfig option for this feature.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-09 13:07:05 +02:00
Bilal Wasim 1966d48498 drivers: wifi: eswifi: WiFi Scan completion indication
Updating the eswifi driver to indicate "scan completion"
to WiFi Management once scanning is done.

Tested with STM32 disco IOT kit.

Signed-off-by: Bilal Wasim <bilalwasim676@gmail.com>
2020-05-09 13:06:26 +02:00
Zide Chen e8b6b86704 interrupt_controller: device driver can configure IO APIC delivery mode
Currently all IO APIC interrupts are configured at fixed delivery mode,
which is good for HEPT timer interrupt but it imposes burdens to
device drivers to properly handle the repeated interrupt sent to all
processors.

This patch makes it more flexible so that device drivers can specify
the delivery mode it desires in the IRQ connect APIs.

- Don't hard code IOAPIC_FIXED in z_ioapic_irq_set(), meaning the
  IRQ delivery mode is passed in from the 'flags' argument and
  individual device driver needs to choose delivery mode for its own
  IO APIC interrupt.

- To support different delivery mode in different IO APIC interrupts,
  need to save and restore RTE[10:8] during IOAPIC suspend and resume.

If device driver doesn't pass either IOAPIC_FIXED or IOAPIC_LOWEST
in IRQ_CONNECT()/irq_connect_dynamic() alike APIs, the delivery mode
bit fields in the target RTE register are '0' which implies fixed mode.
If the device driver wants the interrupt to be delivered to one CPU
only, it needs to explicitly specify IOAPIC_LOWEST in one of the IRQ
connect APIs.

Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-08 22:32:39 -04:00
Zide Chen ae1137f241 interrupt_controller: change IO APIC to logical destination mode
Currently IO APIC is working in physical destination mode, which
doesn't support interrupt to be delivered to multiple local APICs.
By definition only 4 bits [59:63] in IO APIC IOREDTBL register are
available for destination addresses and it contains an APIC ID only.

This patch changes it to logical destination mode so that IOREDTBL
can potentially define a set of processors and it's posible to deliver
interrupts to multiple APICs.

Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-08 22:32:39 -04:00
Zide Chen d27f6cb5eb interrupt_controller: program local APIC LDR register for xAPIC
If IO APIC is in logical destination mode, local APICs compare their
logical APIC ID defined in LDR (Logical Destination Register) with
the destination code sent with the interrupt to determine whether or not
to accept the incoming interrupt.

This patch programs LDR in xAPIC mode to support IO APIC logical mode.

The local APIC ID from local APIC ID register can't be used as the
'logical APIC ID' because LAPIC ID may not be consecutive numbers hence
it makes it impossible for LDR to encode 8 IDs within 8 bits.

This patch chooses 0 for BSP, and for APs, cpu_number which is the index
to x86_cpuboot[], which ultimately assigned in z_smp_init[].

Signed-off-by: Zide Chen <zide.chen@intel.com>
2020-05-08 22:32:39 -04:00
Kumar Gala c2135f8721 devicetree: DT_NODE_HAS_COMPAT_STATUS_OKAY -> DT_NODE_HAS_COMPAT_STATUS
Swap this out and make the status a parameter.
Leave a couple of cases of DT_NODE_HAS_COMPAT().

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Martí Bolívar 17b8667197 dts: clean up some redundant DT checks
These are redundantly checking a node's status twice.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-08 19:37:18 -05:00
Martí Bolívar 7e0eed9235 devicetree: allow access to all nodes
Usually, we want to operate only on "available" device
nodes ("available" means "status is okay and a matching binding is
found"), but that's not true in all cases.

Sometimes we want to operate on special nodes without matching
bindings, such as those describing memory.

To handle the distinction, change various additional devicetree APIs
making it clear that they operate only on available device nodes,
adjusting gen_defines and devicetree.h implementation details
accordingly:

- emit macros for all existing nodes in gen_defines.py, regardless
  of status or matching binding
- rename DT_NUM_INST to DT_NUM_INST_STATUS_OKAY
- rename DT_NODE_HAS_COMPAT to DT_NODE_HAS_COMPAT_STATUS_OKAY
- rename DT_INST_FOREACH to DT_INST_FOREACH_STATUS_OKAY
- rename DT_ANY_INST_ON_BUS to DT_ANY_INST_ON_BUS_STATUS_OKAY
- rewrite DT_HAS_NODE_STATUS_OKAY in terms of a new DT_NODE_HAS_STATUS
- resurrect DT_HAS_NODE in the form of DT_NODE_EXISTS
- remove DT_COMPAT_ON_BUS as a public API
- use the new default_prop_types edtlib parameter

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Kumar Gala 5cf85fa229 drivers: move nxp_kinetis_temp to for-each style
Move to FOREACH to prepare for an upcoming patch.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-08 19:37:18 -05:00
Henrik Brix Andersen 338cecbe1a drivers: i2c: shell: add I2C bus recovery shell command
Add I2C shell command for initiating a bus recovery.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Henrik Brix Andersen 6aa8a83682 drivers: i2c: gpio: add bus recovery function
Add I2C bus recovery function to the I2C GPIO bitbang driver.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Henrik Brix Andersen ec90af8e78 drivers: i2c: bitbang: add helper method for I2C bus recovery
Add I2C bitbang helper function for performing bus recovery.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Henrik Brix Andersen 71b893056f drivers: i2c: add I2C bus recovery API
Add API for recovering an I2C bus. This API can be used to recover
from situations where the I2C master and one or more I2C slaves are
out of synchronization (e.g. if the I2C master was reset in the middle
of an I2C transaction or if a noise pulse was induced on the SCL
line).

Fixes #23441.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-09 01:15:30 +02:00
Tomasz Bursztyka c0ab0de8d1 drivers/interrupt_controller: Rename ioapic init function
The '_' is not necessary, plus it makes the sys init object name
aligning with all others.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka dfe938640b drivers/interrupt_controller: Fix loapic/ioapic header inclusion
s/init.h/device.h

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka 48135cdd34 usermode: Rework Z_SYSCALL_SPECIFIC_DRIVER to fit with device refactoring
init_fn is not anymore part of struct device, so let's test instead the
driver's API structure pointer which is also unique per device driver.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka 97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Tomasz Bursztyka 8d7bb8ffd8 device: Refactor device structures
When the device driver model got introduced, there were no concept of
SYS_INIT() which can be seen as software service. These were introduced
afterwards and reusing the device infrastructure for simplicity.
However, it meant to allocate a bit too much for something that only
required an initialization function to be called at right time.

Thus refactoring the devices structures relevantly:
- introducing struct init_entry which is a generic init end-point
- struct deviceconfig is removed and struct device owns everything now.
- SYS_INIT() generates only a struct init_entry via calling
  INIT_ENTRY_DEFINE()
- DEVICE_AND_API_INIT() generates a struct device and calls
  INIT_ENTRY_DEFINE()
- init objects sections are in ROM
- device objects sections are in RAM (but will end up in ROM once they
  will be 'constified')

It also generate a tiny memory gain on both ROM and RAM, which is nice.

Perhaps kernel/device.c could be renamed to something more relevant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Emil Obalski 38aea280e7 usb: Sync receiving data from ISO OUT endpoint with SOF
This commit adds support for receiveing data from ISO OUT endpoint
for NRF devices. NRF USB IP core does not generate IRQ when
data are received on ISO OUT endpoint and it must be synchronized
with SOF event.

Enable SOF handling by default if usb audio is configured
with NRF devices.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Emil Obalski 9e998d108a drivers: usb: Correct naming for endpoint Transfer Type
This commit updates definitions to better match usb 2.0 spec.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Emil Obalski 79704fac5a usb: ISO endpoint size may not be power of 2.
By this commit exception for ISO endpoints is made when it comes
to its size. ISO endpoint buffer size for nrf devices is 1023 and
may be configured with variable length size. NRFX checks is size
is chosen accordingly and it is no reason to do it in SHIM.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-05-08 15:12:27 +02:00
Johann Fischer dba19333d2 drivers: ssd16xx: rework initialization of the controller memory
Revise how the unusable memory area is treated.

Do not use SPI interface directly but ssd16xx_write_cmd().
This will allow a common SPI interface to be implemented
in the future.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-05-08 15:11:10 +02:00
Carles Cufi b67a31e411 Bluetooth: controller: Remove legacy LL
Remove the legacy Link Layer implementation.

Closes #24187.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-08 15:07:00 +02:00
Alberto Escolar Piedras cd0659e36f util.h: Remove INLINE definition and user
INLINE is a very common macro, just like MAX or MIN.
Defining it always can easily collide with libraries or
application headers.
And option would be to add a ifdef guard around it,
But it was used in only 1 place in Zephyr, instead
of keeping it just for that, remove it.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2020-05-08 08:37:21 -04:00
Sahaj Sarup 351f39f9cd board: arm: Add Support For 96Boards Aerocore2
Changes:

- Added all required board files in /boards/arm/96b_aerocore2
- Modified pinmux for stm32f4

Most of the changes in this PR is based on reverse-engineering of the
PCB layout and following commits in the PX4 firmware repository for
the same board. The manufacturer does not provide and or generate
schematics and pinout tables for this board.

This PR includes almost all of the interfaces connected to the STM32
MCU, the only thing not included is the J9 and J8 headers that connect
to a 96Boards baseboard.
These headers are not vital to the functionality of the Aerocore2.

Signed-off-by: Sahaj Sarup <sahaj.sarup@linaro.org>
2020-05-08 07:33:43 -05:00
Helge Juul dc0c938359 boards: arm: stm32f746g_disco: enable sdmmc support
Update dtsi and pinmux macros for stm32f7 family. Add sdmmc1 to dts file
for stm32f746g_disco. Also add board specific configuration file for
fat_fs sample.

Signed-off-by: Helge Juul <helge@fastmail.com>
2020-05-08 10:53:10 +02:00
Anthony Brandon a71f77e601 boards: arm: stm32l496g_disco: enable sdmmc support
Update the dtsi for stm32l471 (which the higher SoCs are based on) to
support the stm32-sdmmc disk access device. Enable the device for the
stm32l496g_disco board, and update the pinmuxing.
Note that the stm32l496g_disco board also has a card detect gpio
(MFX_GPIO8), but this is not supported yet. When not specified the
driver will assume a card is present.

Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
2020-05-08 10:53:10 +02:00
Erwan Gouriou c4d9de1850 drivers/clock_control: stm32: msi: Enable MSI range config in PLL mode
When MSI clock is used a source of PLL, it should be possible to
select its frequency range. Fix this.


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-08 00:34:34 -05:00
Erwan Gouriou 4b3d79f1bb drivers: stm32: Add pinmux headers for stm32l5
Copy/pasted from L4 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-08 00:34:34 -05:00
Erwan Gouriou cdd5856167 driver/gpio: stm32: Add STM32L5 support
Add basic GPIO support. Regarding interface with EXTI,
STM32L5 is similar to STM32G0.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-08 00:34:34 -05:00
Erwan Gouriou 1f054a7b31 drivers/exti: stm32: Add support for STM32L5 series
Add support for stm32l5 socs on stm32 external interrupts driver

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-08 00:34:34 -05:00
Erwan Gouriou f258199595 drivers/clock_control: Add clock_control on STM32L5 series
Add clock_control driver for STM32L5.
It's based on L4/WB driver since it is similar IP.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-08 00:34:34 -05:00
Robert Lubos 2c2771970e modules: mbedtls: Update mbedTLS commit and apply fixes
Update mbedTLS commit along with the following fixes:

* Fix naming inconsistencies in some cipher modes, to match core mbedTLS
  configs
* Add Kconfig to enable CTR cipher mode

Fixes #22421

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-05-07 23:46:08 -05:00
Hans Wilmers fdd89efd3a drivers: modem: ublox-sara-r4: automatic setting of APN
During communication initialisation, the IMSI of the inserted SIM
card is evaluated to determine the APN. This is done by comparing
the first 5 characters of the IMSI to a list of known providers.
The list can be given in Kconfig.

To enable this functionality, set following bool in Kconfig:
MODEM_UBLOX_SARA_AUTODETECT_APN

To set a list of providers, set following string:
MODEM_UBLOX_SARA_AUTODETECT_APN_PROFILES

If the provider can not be found in the list, the APN given in
following entry is used as a fallback:
MODEM_UBLOX_SARA_R4_APN

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-05-07 23:36:10 -05:00
Hans Wilmers cef334b5fe drivers: modem: ublox-sara-r4: automatic detection of modem type
The modem type (Sara R410 or Sara U201) is detected automatically after
hardware initialisation of the modem. Further initialisation and
functionality is then chosen depending on the detected modem type.

To enable this functionality, set following bool in Kconfig:
MODEM_UBLOX_SARA_AUTODETECT_VARIANT

Signed-off-by: Hans Wilmers <hans@wilmers.no>
2020-05-07 23:36:10 -05:00
ZhongYao Luo 1811fff2dd console: Add semihosting console
Many chips have only one serial port. When the serial port is occupied
by other devices, there is a lack of a console to output debugging
information. Semihosting can provide a console. The disadvantage of
semihosting is that a debugger must be connected, so it can only be
used for online debugging.

Signed-off-by: ZhongYao Luo <LuoZhongYao@gmail.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 23:33:38 -05:00
Johann Fischer 8f983c3654 drivers: ieee802154: add Decawave DW1000 driver
Add initial support for Decawave DW1000
IEEE 802.15.4-2011 UWB transceiver.

Driver has basic functionality. Additional functions such
as reading out timestamps and delayed TX were implemented
for test purposes, but also require support in the 802154
subsystem.

Register, sub-register, and defaults defines in the file
ieee802154_dw1000_regs.h are taken from the Decawave's
DW1000 driver for the Mynewt OS.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2020-05-07 23:30:58 -05:00
Andrei Gansari 5b02519d8f drivers: entropy_mcux_rng LPC entropy
Added RNG device used by LPC family devices to generate random numbers.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-05-07 23:25:31 -05:00
Gerard Marull-Paretas cfebfc188e drivers: adc: stm32: add support for H7 series
Add support for ADC on H7 series. Note that ADC1 and ADC2 share the same
register set, so it is added as "adc1_2".

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-05-07 23:01:59 -05:00
Francois Ramu 01e9983142 drivers: pinmux: stm32wb: use a pull-down for SPI SCK pin
Like stm32 L4 does,
when the STM32WBx SoC goes into STOP mode, the SPI device is disabled.
This cause the pins to not be drived anymore (i.e. they are floating)
except through their pull-up or pull-down.

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

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

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-07 23:00:32 -05:00
Kumar Gala 6ae8664889 drivers: i2s: i2s_sam_ssc: Convert to devicetree
Convert i2s_sam_ssc driver to utilize devicetree.  We replace Kconfig
options for specifying the DMA configuration (channel, DMA device name)
with getting that from devicetree.  We also get pincfg from devicetree,
however we still have Kconfig sybmols to specify if the RF or RK pin is
enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 22:24:58 -05:00
Kumar Gala 49bab484df drivers: dma: sam_xdmac: Convert to devicetree
Convert sam_xdmac driver to utilize devicetree.  As part of the
controller binding we specify that dmas should contain a channel and the
perid for the DMA transaction.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 22:24:58 -05:00
Carles Cufi 3954aa5a5a serial: sam0: Complete port to the new timeout API
The conversion in 9b096f40b6 left out a
few tidbits that were not converted properly. Complete the conversion
properly.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 22:00:39 -05:00
Kumar Gala 0a7d4e2135 devicetree: Change DT_FOREACH_IMPL_ to not insert semicolon
Remove semicolon between instance invocations of DT_FOREACH_IMPL_ and
thus DT_INST_FOREACH.  This provides more flexibility to the user.  This
requires we fixup in tree users to add semicolon where needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 20:03:56 -05:00
Jose Alberto Meza 06d4c6d8b3 drivers: espi: xec: Ensure OOB interrupts are not missed
MCHP Soc operation uses clear-on-write register for interrupt
status, read-OR-write operation may clear interrupts unintentional.
Fixes #24464

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-05-07 17:18:26 -07:00
Jose Alberto Meza 8fa9659aea drivers: gpio: xec: Apply initialization value after pin config.
Update GPIO grouped output after pin control is updated.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-05-07 15:35:55 -07:00
Andrei Gansari ec7fad0853 drivers: spi_mcux_flexcomm clock increase
Attached Flexcomm SPI driver to the main clock used by the core.
This means setting the SPI clock the same value as the core clock.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-05-07 12:47:34 -05:00
Peter Bigot 93884a4fe1 coccinelle: run int_ms_to_timeout conversion semantic patch
This fixes some cases where an integer timeout received as a parameter
was not converted to a timeout before being used in standard API.

Changes to the POSIX library were not included as that's being
reworked in a separate PR.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-07 19:46:03 +02:00
Peter A. Bigot e444274e95 drivers: counter: add Maxim DS3231 support
The DS3231 is an I2C real-time clock with internal temperature
compensated oscillator, maintaining civil time to 1 s precision with
nominal 2 ppm accuracy from 0-40 Cel.

The basic functionality is exposed as a counter that is always running
at 1 Hz.  Much more functionality is exposed as driver-specific API,
including the ability to translate between the time scale of the DS3231
and the time scale of the Zephyr uptime clock.  This allows correlation
of events in the system clock to UTC, TAI, or whatever time scale is
used to maintain the DS3231.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-07 19:45:06 +02:00
Andrzej Głąbek 8ee12207ff drivers: flash: Add driver for AT45 compatible SPI flash chips
Add a driver that can handle several instances of AT45 family chips,
which are enabled by specifying DT nodes for them with the "compatible"
property set to "atmel,at45" and other required properties like JEDEC
ID, chip capacity, block and page size etc. configured accordingly.

The driver is only capable of using "power of 2" binary page sizes in
those chips and at initialization configures them to work in that mode
(unless it is already done).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-05-07 14:51:10 +02:00
Wayne Ren 0156511e71 drivers: improve the arcv2_timer driver to update cycles correctly
referring the ARM's Systick driver, we did the following improvements:

* use 31 bits of 32-bit counter to avoid the rare but possible
  overflow of elapsed(). If 32 bits val are used, elpased() may
  return a wrong value. then wrong HW cycles.
* two ways to update the correct cycles
  - through systick timer irq
  - when systick timer irq cann't be handled because of irq
    locked/disabled, call z_timer_cycle_get_32->elapsed to update
    the correct cylces. no more than one counter-wrap is allowed.
* if elapsed() is not called too long (more than one counter-wrap) from
  systick tiemr irq or from z_timer_cycle_get_32. The lost of HW cycles
  is unavoidable.

* some detailed discussion can be found in #24332

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-07 14:49:31 +02:00
Joakim Andersson 293cd5664d drivers: can: Fix use of DT_HAS_DRV_INST which does not exist
Fix use of DT_HAS_DRV_INST which does not exist.
Use DT_HAS_NODE_STATUS_OKAY(DT_DRV_INST(n)) instead.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 07:49:16 -05:00
Andreas Sandberg d8de33e966 drivers: lora: Add a shell for LoRa testing
Provide basic commands that are useful when testing a LoRa
radio. Currently, the shell supports:

> lora conf ...
> lora send ...
> lora recv ...
> lora test_cw ...

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-05-07 14:49:06 +02:00
Andreas Sandberg d3c6cfc0ee drivers: lora: Add a continuous wave test API
Add an API to transmit a continuous wave at a fixed frequency. This
functionality is useful to test the radio in a lab setup.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-05-07 14:49:06 +02:00
Sandeep Tripathy bd985dcd67 drivers: add GIC V3 driver
Add basic driver for GIC V3 interrupt controller.

This implementation supports
 - distributor, re-distributor and cpu interface initialization
 - configuration and handling of SPI, PPI and SGI.
 - V2 Legacy mode is not supported and uses system interface.

Current implementation supports GIC secure state only.
All interrupts are routed to Secure EL1 as 'irq' by configuring
them as Group1 Secure.

TODO:
- MPIDR based affinity routing setting.
- percpu redistributor probe
- message based SPI and SGI generation api
- EL1NS support. Legacy mode support.
- LPI/ITS is not supported.

Signed-off-by: Sandeep Tripathy <sandeep.tripathy@broadcom.com>
2020-05-07 14:22:53 +02:00
Carles Cufi 94861a438b drivers: modem: Port to new timeout API
Port the internal modem API to the new timeout API, using the native
k_timeout_t.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi 9ba20dd48e drivers: audio: Port to the new timeout API
Port the I2S and DMIC drivers to the new timeout API so that they do
not need to enable legacy timeouts.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi c61faf6c55 drivers: wifi: Port the simplelink wifi to the new timeouts API
Port the code so it uses the new timeouts API.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi 6aa8f11c93 drivers: video: Remove legacy timeout use
Stop using the legacy timeout option in the video drivers.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi 9b096f40b6 timeouts: Port UART async API to the new timeout API
Port the API to the new paradigm as to avoid having to select
LEGACY_TIMEOUT_API.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Carles Cufi 9b04a99243 timeouts: Port BBC micro:bit to the new timeout API
Port the BBC micro:bit display driver to the new timeout API exposed by
the kernel.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Kumar Gala fbb1de6aac drivers: can: Remove per instance Kconfig symbols
All users of per instance CAN symbols are removed so we can remove them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 10:08:31 +02:00
Kumar Gala aec38f3fda drivers: can: mcp2515: Convert from Kconfig to DT_NODELABEL
As we phase out per instance Kconfig symbols convert to utilize
DT_DRV_INST to initialize CAN instances.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 10:08:31 +02:00
Kumar Gala 9d4cdd732e drivers: can: mcux_flexcan: Convert from Kconfig to DT_NODELABEL
As we phase out per instance Kconfig symbols convert to utilize
DT_DRV_INST to initialize CAN instances.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 10:08:31 +02:00
Ioannis Glaropoulos 9b09f136f7 bluetooth: hci_rpmsg: check SHM_SIZE against shared mem size using DT
Add a build-time assert to check that the configured SHM_SIZE
does not exceed the memory allocated as shared memory. USe DT
to extract the shared memory size.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-05-07 10:07:00 +02:00
Adam Serbinski 26be827af8 flash: sam0: set write_block_size=1 when EMULATE_BYTE_PAGES is set
The sam0 has a page size of 64 bytes, making it incompatible with
the nvs driver that specifies a maximum write block size of
32 bytes. When CONFIG_SOC_FLASH_SAM0_EMULATE_BYTE_PAGES is set,
it should report a write block size of 1 byte, which is compatible
with nvs.

Signed-off-by: Adam Serbinski <aserbinski@gmail.com>
2020-05-07 10:06:17 +02:00
Kumar Gala 95b8355dd4 drivers: counter_mcux_gpt: Fix compile error
Return order to fix issue with __device_mcux_gptX' being undeclared.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 02:59:43 -05:00
Peter Bigot 7e35983977 drivers: flash: spi-nor: correct index into array property value
The dpd-wake-sequence has a value that is an array of three integers,
which was formerly indexed by a suffix on the property name.  This was
updated to new accessors but failed to separate the index from the
property name.  Update the access idiom.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-07 00:59:29 -05:00
Kumar Gala a58777e251 drivers: dma: atmel_sam0: Convert to use devicetree macros for dma dev
Convert to using DT_INST_LABEL() in the dma driver and convert dma users
to use the DMA property macros to get the dma controller name.  We make
the assumption in the drivers that there is a single DMA controller
instance.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 00:49:32 -05:00
Kumar Gala 99d14e9075 adc: adc_shell: Fix compile error
Had an extra comma between macro and macro usage that casued the
following compile error:

	adc_shell.c:477:22: error: expected expression before ',' token

Easy fix to remove trailing comma in ADC_SHELL_COMMAND

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-06 23:56:33 -05:00
Vincent Wan da60111949 drivers: spi: cc13xx_cc26xx: remove usage of CONFIG_SPI_0/1
Clean up as we wish to move away from using these Kconfig settings.
Also removing them from the boards' default config.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-06 17:48:13 -05:00
Martí Bolívar 87e1743ae0 devicetree: replace DT_HAS_DRV_INST with DT_INST_FOREACH
Make drivers multi-instance wherever possible using DT_INST_FOREACH.
This allows removing DT_HAS_DRV_INST in favor of making drivers just
do the right thing regardless of how many instances there are.

There are a few exceptions:

- SoC drivers which use CMake input files (like i2c_dw.c) or otherwise
  would require more time to convert than I have at the moment. For the
  sake of expediency, just inline the DT_HAS_DRV_INST expansion for
  now in these cases.

- SoC drivers which are explicitly single-instance (like the nRF SAADC
  driver). Again for the sake of expediency, drop a BUILD_ASSERT in
  those cases to make sure the assumption that all supported SoCs have
  at most one available instance is valid, failing fast otherwise.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-06 17:35:08 -05:00
Martí Bolívar 763a9433a7 counter: mcux_gpt: whitespace cosmetics
Discovered when making unrelated changes.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-06 17:35:08 -05:00
Alex Porosanu f4c36b7beb drivers: pwm: add driver for NXP Kinetis TPM module
The TPM (Timer/PWM Module) is a 2- to 8-channel timer which supports
input capture, output compare, and the generation of PWM signals to
control electric motor and power management applications.

This patch adds the driver and the binding necessary for instantiating
the driver. The work is based on the RV32M1 driver for TPM done by
Henrik Brix Andersen. A later patch will enable this driver to be used
for the KW41Z SoC, if PWM support is requested.

Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
2020-05-06 11:33:37 -05:00
Pauli Salmenrinne 30003ffb86 drivers: serial: stm32: Support for parity in DTS for STM32 uart.
Add support for devicetree property 'parity' for stm32 serial devices.

Signed-off-by: Pauli Salmenrinne <susundberg@gmail.com>
2020-05-06 11:00:12 -05:00
Pete Johanson 91d6139338 boards: arm: nucleo_wb55rg: Enable USB for stm32wb.
* Define USB driver for base stm32wb device.
* Enable USB for the nucleo_wb55rg board.
* Properly initialize USB power + clock for the platform.

Signed-off-by: Pete Johanson <peter@peterjohanson.com>
2020-05-06 10:46:23 -05:00
Armando Visconti fb815c65eb drivers/sensors: ism330dhcx: use endop bit in shub wait_completed
Use the endop bit in the status register (instead of using a k_sleep)
to wait until the current shub operation is completed.

Please note that the recent changes to k_sleep() API was also
breaking the compilation.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-05-06 10:33:07 -05:00
Kumar Gala fdd85d5ad7 dts: Rename DT_HAS_NODE macro to DT_HAS_NODE_STATUS_OKAY
Rename DT_HAS_NODE to DT_HAS_NODE_STATUS_OKAY so the semantics are
clear.  As going forward DT_HAS_NODE will report if a NODE exists
regardless of its status.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-06 05:25:41 -05:00
Alexander Wachter 464f135ce6 canbus: Convert canbus driver and subsys to new timeout API
Convert all canbus related API/samples/tests/subsys
to the new timeout API with k_timeout_t.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2020-05-06 10:19:13 +02:00
Piotr Mienkowski 637dd67c66 drivers: i2s: fix i2s_handlers.c
Fix syntax error in i2s_handlers.c causing compile time error.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2020-05-06 09:47:42 +02:00
Kumar Gala 26bfddf1ee drivers: i2c: i2c_dw: Move to devicetree detection
We can utilize the devicetree macros to determine which instances to
enable.  This will allow us to phase out the per instance Kconfig
symbols.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-05 14:44:25 -05:00
Stephanos Ioannidis 2a710b1372 Revert "drivers: dma: sam0: fix DMA to peripheral transfer on SAMD5x"
This reverts commit 90cc723e65.

Using `DMAC_CHCTRLA_TRIGACT_BLOCK` breaks SERCOM UART peripheral DMA
operations (DMA-based asynchronous UART transmit operation only sends
the first byte and does not proceed any further).

The `DMAC_CHCTRLA_TRIGACT_BURST` with `DMAC_CHCTRLA_BURSTLEN(0)` is a
special case utilising the "internal FIFO", according to the datasheet
(see DS60001507E; 22.6.2.8), and should always be specified for
peripheral data transfer operations.

Also it is worth noting that Atmel and other third-party drivers use
the aforementioned "internal FIFO" configuration for peripheral data
transfers as well.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-05 13:53:49 -05:00
Abe Kohandel 8c7f63cf8d drivers: dma: stm32: DMA V1 channel direction
The channel direction for a V1 DMA is not allowed to be memory to memory
and there is a check in place for this. However, the check is being
performed on the stream prior to actually configuring the stream. This
results in the check always failing regardless of the channel direction.

The check has been modified to be performed on the incoming
configuration.

Signed-off-by: Abe Kohandel <abe@electronshepherds.com>
2020-05-05 13:48:09 -05:00
Henrik Brix Andersen a638dc0a57 drivers: i2c: bitbang: fix repeated start condition
Fix I2C bit banging REPEATED START condition function by ensuring both
SDA and SCL are high before generating the REPEATED START.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-05 20:02:43 +02:00
Henrik Brix Andersen d9c4b6f2d6 drivers: i2c: bitbang: fix stop condition
Fix I2C bit banging STOP condition function to not create a stray
START condition if SDA is high on entry. Instead, set SDA to LOW
before generating the STOP condition.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-05 20:02:43 +02:00
Kumar Gala 81e44f005e drivers: pwm: Remove per instance Kconfig symbols
There are now no users of the per instance Kconfig symbols so we can now
remove them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-05 12:46:57 -05:00
Francois Ramu 41df1c9380 drivers: dma: Enable dma and dmamux on stm32
This patch prepares the dma and introduces the dmamux on soc series
which supports this feature for memory/periph transfers.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-05 11:51:25 -05:00
Maureen Helm d898ada917 drivers: kscan: Add debug logging output to ft5336 driver
Adds debug logging for row, column, and pressed values read in the
ft5336 touch controller driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-05 11:08:02 -05:00
Martin Jäger e55483495e drivers: pinmux: stm32: Complete STM32F0 series
Fix some wrong assignments for SPI2 and add all other alternative
functions for USART, I2C, SPI and CAN according to STM32F091VC
datasheet, which is at the top end of this series.

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

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-05-05 11:06:47 -05:00
Gerard Marull-Paretas c6b1375400 drivers: pwm: stm32: remove remaining Kconfig instances
Following other drivers, Kconfig based instances are now entirely
removed. In order to do this change, PWM nodes in board DT files have
been given a pwm{N} label so that both:

- DT API checks such as #if DT_HAS_NODE(DT_NODELABEL(pwmN)) can be
  used (N being PWM instance number).
- DT references can be written as pwms = <&pwmN x y>; instead of
  pwms = <&{/soc/timers@XXXXXXXX/pwm} x y>;

This approach is also used on the Linux Kernel.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-05-05 10:52:51 -05:00
Henrik Brix Andersen f90f5d8da8 drivers: i2c: i2c_gpio: reformat comment
Reformat comment describing the I2C GPIO bit banging pre-requisites to
improve readability.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-05 10:17:23 -05:00
Henrik Brix Andersen 911b6a0e9f drivers: i2c: gpio: convert to using devicetree for instances
Convert the GPIO bit banging I2C controller driver to use devicetree
bindings for configuring instances.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-05 10:17:23 -05:00
Benjamin Valentin 8a99bd0da8 drivers: spi: spi_sam0: fix spi_sam0_fast_txrx()
The optimisation in `spi_sam0_fast_txrx()` is broken, loading
two bytes into the `DATA` register in rapid succession will lose
one byte.

This can be observed by running `tests/drivers/spi/spi_loopback`.
The test will get stuck in `spi_sam0_fast_txrx()` forever waiting
for the final byte.

Undo this small optimisation and only load the next byte into the
`DATA` register after the response has been received.

This fixes `tests/drivers/spi/spi_loopback`.

Signed-off-by: Benjamin Valentin <benpicco@googlemail.com>
2020-05-05 09:58:29 -05:00
Kumar Gala b04b399d63 drivers: pwm: nrfx: Convert to use DTS NODELABEL for instance detection
Move to using NODELABEL references to enable driver instances for
PWM0..3.  This will allow us to remove per-instance PWM Kconfig symbols.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-05 08:40:19 -05:00
Francisco Munoz 51e82855b7 drivers: ps/2: Tune PS2 driver to support severval mice brands
The PS/2 driver was enabled with a single mouse and kb brand.
However, when plugging other mice brands, the interaction between the
driver and the device(mouse) was broken. A delay after inhibithing
the PS/2 instance helped the internal FSM to start the TX process.

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@intel.com>
2020-05-04 17:03:49 -05:00
Manivannan Sadhasivam f619cbc6fb lora: sx1276: Add missing RtcTick2Ms function definition
RtcTick2Ms function is required for upcoming LoRaWAN support. Hence,
add definition for it.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-05-04 19:01:09 +02:00
Manivannan Sadhasivam 7be8debaab lora: Switch to new timeout API
Get rid of legacy timeout API and move to new timeout API for LoRa.
This involves changes to API, SX1276 driver and sample application.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-05-04 19:01:09 +02:00
Manivannan Sadhasivam 0f02adfb0e lora: Make the LoRa support Experimental
The LoRa APIs are expected to undergo some change as the usecase get's
increased. So let's mark it as experimental until the APIs got
stabililized.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-05-04 19:01:09 +02:00
Manivannan Sadhasivam e177ab6c42 drivers: lora: Get rid of counter support
The RTC/Counter implementation doesn't fit for the upcoming LoRaWAN
as most of the Counter drivers in Zephyr works with 1s granularity
which is not enough for LoRaWAN stack. So, k_timer calls are used in
place of Counter's alarm and k_uptime_get() APIs are used in place of
Counter's time keeping.

While at it, lets also fixup the broken alarm implementation.

Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
2020-05-04 19:01:09 +02:00
Kumar Gala dff8715615 drivers: ethernet: sam_gmac: rework pin config
Reworked sam_gmac driver to get pin ctrl/mux configuration information
from the device tree instead of via Kconfig and defines in soc_pinmap.h

We remove defines from soc_pinmap.h that are no longer needed due to
getting all that information from devicetree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 11:32:10 -05:00
Francois Ramu 469e505278 drivers: spi: control of the dma callback on spi client for stm32
The DMA callback function now controls the tx or rx buffers
and reload dma in case of multiple trnasfer before the transfer ends

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-04 09:46:07 -05:00
Francois Ramu ce093dc35e drivers: spi: Enable dma transfer for SPI on stm32
Enable dma operations with or w/o a dmamux on STM32
for SPI periph/memory operations.
Use the pi dma client with dma macros

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-04 09:46:07 -05:00
Francois Ramu bea0a95578 drivers: dma: stm32 dma_reload function must re-enable
This patch is disabling the dma channel before reloading
source and dest for memory and peripheral addresses
Then the channel is enabled to re-launch the transfer.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-04 09:46:07 -05:00
Kumar Gala 024ea0e44e adc: Kconfig: Remove per instance ADC_{0..2} Kconfig symbols
No code utilizes CONFIG_ADC_{0..2} so we can now remove the Kconfig
sybmols for them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 09:04:16 -05:00
Kumar Gala 897652a536 adc: adc_shell: Rework device name extraction from devicetree
Replace having dts_fixup.h files define DT_ADC_{0..2}_NAME with using
the new devicetree.h macros.  We test to see what driver compat is
enabled via DT_HAS_COMPAT and set DT_DRV_COMPAT to that compat.  Than we
can utilize the DT_INST_LABEL() macro to extract the name of the device.

We also replace the Kconfig ADC_{0..2} symbols with DT_HAS_DRV_INST.
This will allow us to remove those Kconfig symbols as this was the only
usage.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-02 10:27:07 -05:00
Jukka Rissanen 5a105a67af drivers: eth: gmac: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 14:19:18 -05:00
Henrik Brix Andersen 7ede80be46 tests: boards: board_shell: enable DAC commands
Enable DAC commands in the board_shell test application.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-05-01 12:35:50 -05:00
Henrik Brix Andersen 8a5ba4539c drivers: dac: add DAC shell commands
Add shell commands for controlling digital-to-analog (DAC) devices.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-05-01 12:35:50 -05:00
Henrik Brix Andersen a0d88a61e9 drivers: dac: add driver for the NXP Kinetis DAC
Add driver shim for the NXP Kinetis Digital-to-Analog (DAC) module.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-05-01 12:35:50 -05:00
Henrik Brix Andersen 20b565a9f3 drivers: dac: add driver for the NXP Kinetis DAC32
Add driver shim for the NXP Kinetis Digital-to-Analog (DAC32) module.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-05-01 12:35:50 -05:00
Kumar Gala 1ce133d0fe drivers: usb: usb_dc_stm32: Rename defines to remove DT_ prefix
We want to limit DT_ prefix to macros from devicetree.h and generation.
So rename DT_USB* to just USB*.

Also fixup how USB_MAXIMUM_SPEED was defined.  We should only define it
if the property exists.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-01 07:49:00 -05:00
Jukka Rissanen 0576ce813f driver: modem: wncm14a2a: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen db9b47f6fa drivers: ieee802154: mcr20a: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen affe21c826 driver: wifi: eswifi: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen 104ffabab2 driver: eth: enc28j60: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen 7929f6c197 driver: eth: smsc911x: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen a921091f4e driver: eth: mcux: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Jukka Rissanen d5d31ef0c4 driver: eth: enc424j600: Convert to use k_timeout_t
Convert the code to use k_timeout_t when applicable.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-01 10:50:03 +03:00
Peter Bigot 52885d0576 coccinelle: run ms_timeout conversion semantic patch
Substitute integral constants where call sites passed named constants
that have timeout values as arguments to parameters that expect
millisecond durations.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-30 18:26:26 +02:00
Henrik Brix Andersen 9ceb29ac56 dts: introduce shared binding for the NXP FlexTimer
Do not assume in the SoC level device trees that NXP Kinetis FlexTimer
nodes will always be configured as PWM. Instead, configure FlexTimer
nodes for PWM at the board level for NXP Kinetis boards.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-04-30 08:28:48 -05:00
Gerson Fernando Budke 351719ae0f drivers: wifi: esp: Add esp at version choice name
Add WIFI_ESP_AT_VERSION choice name to allows select version on
*.defconfig files.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-04-30 16:08:35 +03:00
Erwan Gouriou de9fd59669 drivers/bluetooth: stm32wb: Fix loop
The goto instruction was removed when adding the RX thread.
While still working, this clearly break the clean handling of
error cases.
Re-instantiate the goto instruction.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-30 13:34:15 +02:00
Erwan Gouriou 73a19d4d20 drivers/bluetooth: stm32 ipm: Fix mutex on shared memory
ipm_busy is meant to be used as mutex on transport layer accesses.
Due to wrong configuration on rx_thread, imp_busy was a no-op.
Fix this.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-30 13:34:15 +02:00
Joakim Andersson 405ae6bb65 Bluetooth: drivers: Convert bluetooth drivers to use k_timeout struct
Convert bluetooth drivers to use k_timeout struct

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:46:48 +03:00
Kumar Gala 50345848b4 drivers: flash: flash_simulator: Convert to new DT macros
Convert flash_simulator to use new DT macros and remove associated
defines in dts_fixup.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 04:47:44 -05:00
Kumar Gala aba7d63860 drivers: sensor: lis2dh: Rename defines to remove DT_ prefix
We want to limit DT_ prefix to macros from devicetree.h and generation.
So rename DT_LIS2DH_INT* to just LIS2DH_INT*.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 04:46:11 -05:00
Kumar Gala 669a5104d0 drivers: eeprom: at2x: Rename defines to remove DT_ prefix
We want to limit DT_ prefix to macros from devicetree.h and generation.
So rename DT_INST_AT2X* to just INST_DT_AT2X*.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 04:45:35 -05:00
Kumar Gala 8639469339 drivers: adc: adc_mcp320x: Rename defines to remove DT_ prefix
We want to limit DT_ prefix to macros from devicetree.h and generation.
So rename DT_INST_MCP320X* to just INST_DT_MCP320X*.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 04:45:35 -05:00
Alexandre Bourdiol 0c8c6d2bb2 drivers/clock_control: stm32H7 AHB clock computation depends on core
On cortex M4, AHB clock is equal to SystemCoreClock
On Cortex M7, AHB clock is equal to SystemCoreClock/HPRE
By the way, D1CPRE is of no use when starting from SystemCoreColck.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-04-29 15:18:18 -05:00
Ryan Erickson a757832110 drivers: modem: wncm14a2a: fully release TCP context
TCP contexts are referenced twice,
once for the app and once for the stack.
Since TCP stack is not used for offload,
unref a second time to release the context.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-04-29 23:14:29 +03:00
Kumar Gala 3f236f2183 can: dts: Convert can-primary alias to zephyr,can-primary chosen prop
Convert CAN to use a chosen node property that is similar to how we
handle zephyr,entroy or zephyr,flash-controller as the means to select a
specific peripheral instance utilized by a subsystem.

Replace references of the form:

alias {
	can-primary = &can1;
};

with:

chosen {
	zephyr,can-primary = &can1;
};

Replace various macro/define references with either
DT_CHOSEN(zephyr_can_primary) or replace DT_ALIAS_CAN_PRIMARY_LABEL
with DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-29 14:27:31 -05:00
Erwan Gouriou 7d1fc6d08c boards: stm23: Move IS pinmux to new DT API
Convert the board and clean up I2S driver from these symbols

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-29 13:13:58 -05:00
Alexandre Bourdiol d6e69383a3 drivers: STM32H7 dualcore EXTI management
Need to use specific EXTI API to configure the cortex M4 core.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-04-29 10:20:00 -05:00
Kumar Gala a918d301fe drivers: adc: adc_sam0: rework devicetree support
Rework the devicetree to utilize new DT_INST macros and extract per
instance data for clocks from devicetree.

We add a property ('calib-offset') for the SAM{D,E}5x family of SoCs
that is the bit position offset from ADC0 BIASCOMP in the NVM Software
Calibration Area Mapping.  For ADC0 this is typically 0 and for ADC1
this will be 14.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-29 08:02:36 -05:00
Kumar Gala d73ffa3855 drivers: uart: mcux_flexcomm: 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-28 16:54:30 -05:00
Kumar Gala fd021da59a drivers: uart: mcux_lpsci: 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-28 16:54:30 -05:00
Erwan Gouriou c9135686b2 drivers/can: stm32: Convert to DT macros
Use DT macros to configure stm32 can device instances.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-28 14:49:55 -05:00
Erwan Gouriou 826e24ca58 drivers/can: stm32: configure driver thanks to compatible
Remove need to configure from soc/

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-04-28 14:49:55 -05:00
Peter Bigot 82d4fcc1bf drivers: hwinfo: fix ESP32 implementation
Add the missing prefix z_ required to make the ESP32 version override
the weak implementation.

General practice in ESP32 seems to be to use the MAC address, so
extract that in its canonical byte order.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-04-28 15:32:53 -04:00
Martí Bolívar 07044c621b drivers: ethernet: clean up sam_gmac Kconfig
Use the new path access helpers to avoid hard-coding devicetree paths
in Kconfig, which is a bit messy.

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

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

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

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

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

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

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

Fixes #23193.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

Fixes: #24634

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

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

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

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

This lets us remove DT_CPU_CLOCK_FREQUENCY from dts_fixup.h.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Respective improvement is implemented.

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

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

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

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

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

Fixes 50129f8dd7
Fixes #24579

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

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

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

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

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

* test_uart_configure
* test_uart_config_get

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

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

* test_uart_fifo_fill

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

* test_uart_fifo_read

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

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

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

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

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

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

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

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

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

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

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

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

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

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

for fixup

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

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

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

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

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

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

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

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

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

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

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

Tested using Sara U201 and the MQTT protocol library.

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

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

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

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

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

Tested using Sara U201.

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

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

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

drivers: ublox-sara-r4: fix vint polling

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

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

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

Fix this be removnig the duplicate at line 558.

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

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

Fixes 9a65318a5b.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #24339

Supersedes #24422

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

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

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

Fixes: #23294

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

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

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

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

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

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

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

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

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

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

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

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

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

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

At the same time move driver to also use DT_INST_FOREACH.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes: #24399

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-16 14:09:23 +02:00