Commit graph

3289 commits

Author SHA1 Message Date
Erwan Gouriou 2e20f49167 sensors: lis3mdl: provide name to Kconfig choice
In order to be able to default Kconfig "Trigger mode" choice
in a board Kconfig.defconfig, this commit provides it with a name.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-11-03 13:52:57 -05:00
Daniel Wagenknecht c404c3b241 i2c: fix issue of stm32-i2c-v2 (F0/F3/F7) driver hanging in endless loop
Fixes #4429
Driver didn't work properly when a transfer consisted of multiple
messages.
Fix doesn't use auto end mode anymore. msg_done function waits for
transfer to complete and issues stop condition if necessary.

Tested with stm32f3_disco board and samples/drivers/i2c_fujitsu_fram
example adapted to use I2C_1 as I2C_DEV

Signed-off-by: Daniel Wagenknecht <wagenknecht@clage.de>
2017-11-03 13:52:57 -05:00
Ramakrishna Pallala 56cab64d70 drivers: crypto: Fix the scope of ataes132a crypto_driver_api functions
Limit the scope of crypto_driver_api functions to driver file only.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-11-03 14:27:41 -04:00
Ramakrishna Pallala bb5a2985d1 drivers: crypto: Fix mbedtls Kconfig dependencies
Fix mbedtls shim driver Kconfig dependencies.

Limit the scope of crypto_driver_api functions to driver file only.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-11-03 14:27:41 -04:00
Ramakrishna Pallala 4742f8e010 drivers: crypto: Fix TinyCrypt Kconfig dependencies
Fix TinyCrypt shim driver Kconfig dependencies.

Limit the scope of crypto_driver_api functions to driver file only.

Remove dead code from crypto_tc_shim_priv.h

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2017-11-03 14:27:41 -04:00
Piotr Mienkowski 4487c935fe drivers: gpio: deprecate GPIO_PIN_ENABLE, GPIO_PIN_DISABLE
GPIO_PIN_ENABLE, GPIO_PIN_DISABLE configuration constants overlap
functionality provided by pinmux driver. They usage makes the API
inconsistent. They are almost uniformly ignored by the existing device
drivers. Only few of them take these constants into account.

This commit deprecates usage of the two configuration constants.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-11-02 18:46:30 -04:00
Leandro Pereira 1eed91f024 drivers: entropy: Only show STM32 entropy driver on if applicable
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-11-01 08:26:29 -04:00
Leandro Pereira 8b883a61a3 subsys/random: sys_rand32_get() implementation that uses entropy API
Instead of every hardware number generator driver providing an
implementation of this function, use the random device API to
centralize the implementation of this function.

This is a very simplistic function that can be seen as a stepping stone
to refactor the random number generation in Zephyr.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-11-01 08:26:29 -04:00
Leandro Pereira da9b0ddf5b drivers: Rename random to entropy
This should clear up some of the confusion with random number
generators and drivers that obtain entropy from the hardware.  Also,
many hardware number generators have limited bandwidth, so it's natural
for their output to be only used for seeding a random number generator.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-11-01 08:26:29 -04:00
Leandro Pereira adce1d1888 subsys: Add random subsystem
Some "random" drivers are not drivers at all: they just implement the
function `sys_rand32_get()`.  Move those to a random subsystem in
preparation for a reorganization.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-11-01 08:26:29 -04:00
Leandro Pereira 0dfee8f254 drivers: eth_enc28j60: Check return value of spi_transceive()
Coverity-ID: 178240
Coverity-ID: 178241
Coverity-ID: 178243

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-31 18:52:09 -04:00
Andrew Boie b7442a0a6b drivers: fix handler filenames
Fixes: #4654

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-31 12:51:22 -07:00
Anas Nashif 035814efc6 boards: move pinmux driver to board/soc dir
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-31 12:32:34 -04:00
Anas Nashif 4fb789701b drivers: pinmux: PINMUX_CC2650 depends on GPIO
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-31 12:32:34 -04:00
Anas Nashif 780324b8ed cleanup: rename fiber/task -> thread
We still have many places talking about tasks and threads, replace those
with thread terminology.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-30 18:41:15 -04:00
Andrew Boie b93f59e15c drivers: uart: add system call handlers
Certain interrupt-driven APIs were excluded as they are intended
only to be called from ISRs, or involve registering a callback
which runs in interrupt context.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie 0cb0447493 drivers: spi: add system call handlers
spi_transceive_async() omitted as we don't support k_poll objects
in user mode (yet).

The checking for spi_transceive() is fairly complex as we have to
validate the config struct passed in along with device instances
contained within it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie 9a3f3aa218 drivers: random: add random_get_entropy sys call
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie d3ec6654f5 drivers: gpio: add system call handlers
Many APIs had two versions, by port and by pin, which called the same
API with different parameters. This has been reorganized to reduce
the number of system calls.

Callback registration API skipped.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie 4d91f5abe9 drivers: pinmux: add system call handlers
pinmux_pin_get() needs memory validated for the func parameter since
it's a pointer that gets written to.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie 9ca42fb033 drivers: rtc: add system calls
rtc_set_config() omitted since it registers a callback.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie 2e60b24a80 drivers: ipm: add system calls
ipm_register_callback() omitted since it registers a callback.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie 66aefcfcf4 drivers: flash: add system calls
The page_layout API returns pointers to kernel memory and is not
exposed to user mode. This is fine for flash_get_page_count()
and flash_get_page_info APIs since these copy the values, but some
redesign work will be needed to get flash_page_foreach() working in
user mode since we do not want the callback running in a privileged
state.

Due to the way that (even unimplemented) system call prototypes are
generated, the definition of struct flash_pages_info needed to be
moved outside of the #ifdef.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie 678314b7b2 drivers: counter: add syscall handlers
counter_set_alarm() registers a callback and has been skipped.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie 9c37af10ec drivers: aio_comparator: add system calls
aio_cmp_configure() registers a callback and is skipped.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie 0f66b9f7d8 drivers: pwm: add system call handlers
pwm_pin_set_usec now defined in terms of the other two APIs.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie c93a4789cb drivers: adc: add system call handlers
Straightforward conversion for adc_enable/disable.

adc_read() uses a sequence table, which points to an array
of struct adc_seq_entry, each element pointing
to memory buffers. Need to validate all of these as being readable
by the caller, and the buffers writable.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie 2a2a855aa8 drivers: i2c: add system call handlers
i2c actually only has two entry points into the driver,
i2c_configure and i2c_transfer. All the other APIs are derived
from these.

All derived APIs now just call i2c_transfer() with appropriate args.

The handler for i2c_transfer() needs to examine the message array
and validate all the buffers involved depending on whether we are
reading or writing to them.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
Andrew Boie 74446381d1 sensors: move userspace handlers location
Place driver handlers with the drivers, not somewhere separate under
subsys/

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-10-30 13:20:19 -07:00
KaSroka bea5ccf7ea drivers: 15.4: nrf5: Add timeout when waiting for tx to complete
Waiting for tx to complete should timeout after 10ms
instead of blocking forever in case ack is not received.

Signed-off-by: Kamil Sroka <kamil.sroka@nordicsemi.no>
2017-10-30 12:03:03 +02:00
Andrei Emeltchenko fe9dee0107 usb: dw: Add sleep before FIFO flash
Adding sleep before TX FIFO flash fixes splitting networking packets
sent over USB endpoints making ECM broken since there is no flow
control other then frame sizes.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-10-28 14:38:19 -04:00
Andrei Emeltchenko b722dc589e usb: dw: Fix debug log specifier for FIFO not empty
The situation when FIFO is not empty is not a bug and it is spamming
console when only bugs are enabled.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-10-28 14:38:19 -04:00
Andy Ross 5aee94e4cf usb_dw_dc: Cleanup: write DIEPCTL register just once
The enable and clear NAK bit can be legally written together, do it in
just one write.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-10-28 14:38:19 -04:00
Andy Ross eebb17ca52 usb_dc_dw: Correctness: use bytewise I/O in FIFO fill
The Designware FIFO is filled in units of 32 bit words, but the buffer
we are passed is not guaranteed to be a multiple of 4 bytes long, nor
aligned on a 4-byte boundary.  So in theory we are reading 0-3 bytes
of unused garbage from the end of the array.

That's currently benign on supported platforms with this hardware,
which all support misaligned reads.  But not all do.  And the incoming
arrival of memory protection opens the possibility that those extra
bytes would cross a protection boundary and cause a crash or security
bug.

Do this right.

(Note that this is fixed to little endian byte order.  The Designware
databook is frustratingly silent on the endianness it expects, but
existing hardware I can see is definitely LE and I see a few spots in
the Linux dwc2 driver that likewise assume LE).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-10-28 14:38:19 -04:00
Andy Ross f591e58211 usb_dc_dw: Correctly assign endpoint FIFOs
The designware hardware in dedicated FIFO mode (which is all we
support right now for lack of shared-FIFO hardware) has one hardware
FIFO per IN (i.e. transmit) endpoint.  But it doesn't assign them on
its own, it's the drivers responsibility to populate the TxFNum field
of the DIEPCTL registers with integer indices corresponding to the
desired FIFO.

We weren't doing that, which meant that all IN endpoints were sharing
the same FIFO zero which is supposed to be dedicated to EP0 control
transfers.  The net effect is that sometimes outbound transfers would
be corrupted, showing data from the wrong endpoint.  More often that
not this would leak from control transfers over to the
higher-bandwidth bulk endpoints of the application, but occasionally
you'd see a control transfer itself get borked and the USB device
would glitch.

Get this right and set the FIFOs properly.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-10-28 14:38:19 -04:00
Andy Ross e6874a0c61 usb_dw_dc: Fix locking correctness
There is no particular reason this spot in usb_dw_tx() cannot be
reached by racing threads on the same endpoint, though existing API
usage in the tree is all unithreaded.  The FIFO state read at the top
of the function must still be true at the bottom or else the packet
byte count will be corrupt.

Also, as described in an existing comment, the databook has some
scary-sounding warnings about access to the registers during FIFO
operations, even if they "should" be on separate endpoints and
unrelated.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2017-10-28 14:38:19 -04:00
Johann Fischer d81b332b0d drivers: mcr20a: check AR bit and use appropriate TX sequence
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-10-28 14:22:46 -04:00
Johann Fischer 5db10d072f drivers: mcr20a: small improvements
Issue a error message, if the _mcr20a_read_reg fails.

Do not execute SPI burst read/write if the buffer is too small.

Unlock mutex if set_pan_id, set_short_addr or set_ieee_addr
fail.

Force abort of the sequence when the higher level changes the channel
even though a T or TR sequence is in progress.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-10-28 14:22:46 -04:00
Loic Poulain 85d916caa9 pinmux: stm32: Fix coding-style errors
checkpatch returns the following errors:
"ERROR:COMPLEX_MACRO: Macros with complex values
 should be enclosed in parentheses"

Let's fix all of them.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2017-10-28 13:34:02 -04:00
Marti Bolivar 669327137b drivers: led_strip: add WS2812-ish driver
The WS2812 LED driver IC has a one-wire interface which encodes bit
values as pulse widths.

The ICs themselves are basically shift registers. Roughly speaking, a
"short" pulse shifts in a zero bit, a "long" pulse shifts in a one
bit, and an inter-pulse gap exceeding a reset time threshold causes a
pixel to latch the shifted-in color values. Each chip has an output
pin for daisy chaining. Refer to the chip datsheets and comments in
Kconfig.ws2812 for more details.

To meet timing without hogging the core, this driver generates pulses
using SPI. To work, this requires the MOSI line to stay low between
SPI frames, and for inter-frame delays to be less than the reset pulse
time.

There are other ways do it (PWM + DMA on some SoCs, GPIO bit-banging
if no other tasks need the core), but this is a reasonably
general-purpose implementation.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:23:30 -04:00
Marti Bolivar 658b673a83 drivers: led_strip: add LPD880x driver
LPD880x (e.g. LPD8803, LPD8806) devices are LED driver ICs which can
be controlled via a reduced SPI interface (clock and data only), and
support daisy chaining.

Add an led_strip driver for these devices.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:23:30 -04:00
Marti Bolivar b533841bf0 drivers: led_strip: add public API for addressable LED strips
This API covers drivers for strips, or strings, of individually
addressable LEDs. Both RGB and grayscale LED strip drivers can be
implemented within these APIs.

The API only provides for updating the entire strip, since not all
strips support updating individual LEDs without affecting the others.

Subsequent patches will add individual driver support.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-28 13:23:30 -04:00
Rajavardhan Gundi c24b77f84f i2c/i2c_dw: configure ic_tar based on ic_10bitaddr_master
This ensures DW_apb_i2c correctly transmits the slave address (7 or
10 bit) based on ic_10bitaddr_master when configured in master mode.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2017-10-28 07:22:28 -04:00
Rajavardhan Gundi 51e7fc7cf8 i2c/i2c_dw: correct the bitfield for ic_tar and ic_sar
The ic_tar and ic_sar were earlier set to 9 bits but now its
corrected to consider 10 bits.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2017-10-28 07:22:28 -04:00
Sebastian Bøe b7eaeb9f0a cleanup: Use quote include instead of system include
When the header file is located in the same directory as the source
file it is better to use a relative quote-include, e.g.

than a system include like

Avoiding the use of system includes in these cases is beneficial
because;

* The source code will be easier to build because there will be fewer
system include paths.

* It is easier for a user to determine where a quote-include header
  file is located than where a system include is located.

* You are less likely to encounter aliasing issues if the list of
  system include paths is minimized.

Authors:
Anas Nashif
Sebastian Bøe

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-28 07:11:53 -04:00
Jukka Rissanen dc3f2455d7 drivers: ieee802154: uart: Do not send FCS bytes to peer
No need to send FCS bytes as the monitor_15_4 is configured to not
expect them. If we change the monitor_15_4 to use them, then we would
need to put correct values into these two FCS bytes.
So cleanest solution is not to send FCS bytes at all.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-10-26 14:51:56 +03:00
Kumar Gala ace47887bd serial: atmel_sam3: remove driver as it was deprecated
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-10-26 06:10:21 +02:00
Kamil Sroka 652fbe6756 drivers: 15.4: nrf5: Fix warning during compilation
Fixes #4466

Signed-off-by: Kamil Sroka <kamil.sroka@nordicsemi.no>
2017-10-24 11:00:08 +03:00
Leandro Pereira fa92bfe3c1 drivers: gpio: gecko: GPIO driver ignores pull-up/pull-down settings
Fixes #4395.

Coverity-ID: 178059
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-24 08:49:41 +02:00
Leandro Pereira 5e2303d54e drivers: flash: stm32f4x: rc should be declared as int
`rc` gets assigned values from function returning `int` and not
`u32_t`.

Fixes #4051.

Coverity-ID: 177219
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-24 00:15:11 +02:00
Paul Sokolovsky 15c64b2c84 drivers: net: loopback: Network loopback interface driver
Loopback is a networking interface which doesn't actually transfer
any data via link layer externally, and instead just mirrors back
(i.e. any packet send to the loopback interface will be received from
it). This interface very useful for testing.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-10-23 15:10:00 +03:00
Paul Sokolovsky 0612651deb drivers: slip: Consolidate under drivers/net/
Make drivers/net/ be the place for misc networking-related drivers
(otherwise, we'd need to have a new dir per driver).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-10-23 15:10:00 +03:00
Maciej Debski eaff37e21f drivers: serial: provide support for stm32f0.
Fixes #3923

Signed-off-by: Maciej Debski <maciej.debski@rndity.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-10-23 12:31:47 +02:00
Maciej Debski f93e0bed4b drivers: pinmux: provide support for stm32f0 and nucleo f030r8 board.
Fixes #3923

Signed-off-by: Maciej Debski <maciej.debski@rndity.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-10-23 12:31:47 +02:00
Maciej Debski 0d80a3b574 drivers: interrupt_controller: provide support for stm32f0.
Fixes #3923

Signed-off-by: Maciej Debski <maciej.debski@rndity.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-10-23 12:31:47 +02:00
Maciej Debski 38b5d3c17e drivers: gpio: provide support for stm32f0.
Fixes #3923

Signed-off-by: Maciej Debski <maciej.debski@rndity.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-10-23 12:31:47 +02:00
Maciej Debski d0678201c3 drivers: clock_control: provide support for stm32f0.
Fixes #3923

Signed-off-by: Maciej Debski <maciej.debski@rndity.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-10-23 12:31:47 +02:00
Piotr Mienkowski 5bb0172839 drivers: i2c: deprecate usage of i2c_atmel_sam3 driver
Atmel SAM3X series has been recently converted to use ASF and
should now use common SAM family drivers. The i2c_atmel_sam3
I2C driver will be removed in the future.

This commit also changes the default I2C driver for Arduino Due
board from i2c_atmel_sam3 to i2c_sam_twi.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-10-23 10:18:08 +02:00
Piotr Mienkowski 26ba99e972 drivers: Add Atmel SAM family I2C (TWI) driver
Added I2C bus (TWI) driver for Atmel SAM MCU family. Only
I2C Master Mode with 7 bit addressing is currently supported.

Tested on Arduino Due board.

Origin: Original

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-10-23 10:18:08 +02:00
Adam Podogrocki 6d4da19602 iwdg: make independent watchdog driver compliant with STM32Cube LL API
Appropriate inclusion done for F1/F3/F4/L4 families in SoC tree.

JIRA: ZEP-2347

Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-10-23 09:51:16 +02:00
Erwan Gouriou da210ba0ba driver: serial: Move STM32 UART driver to LL API
STM32 UART driver was using a mix of LL/HAL APIs.  This commit removes
calls to HAL API and replaces them with LL APIs.  No functional change
have been seen during non regression testing.

But we could note a direct gain of 1Kb of ROM

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-10-20 12:28:11 -05:00
Yannis Damigos a172f72d84 boards: stm32f3_disco: Add I2C support
Add I2C support to STM32F3DISCOVERY board

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-10-20 12:28:11 -05:00
Yannis Damigos 1a85a80200 drivers: i2c_ll_stm32: STM32F0/3 set I2C clock source
STM32F0/3 I2C's independent clock source supports only
HSI and SYSCLK, not APB1. We force I2C clock source to SYSCLK.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-10-20 12:28:11 -05:00
Maureen Helm e0954d3118 serial: Refactor mcux lpsci shim driver to use clock control interface
Refactors the mcux lpsci shim driver to use the clock control interface
instead of calling CLOCK_GetFreq() directly. This will allow SoCs with
different clock architectures to reuse this driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-10-20 12:28:11 -05:00
Maureen Helm 17a6d29f67 serial: Refactor mcux lpuart shim driver to use clock control interface
Refactors the mcux lpuart shim driver to use the clock control interface
instead of calling CLOCK_GetFreq() directly. This will allow SoCs with
different clock architectures to reuse this driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-10-20 12:28:11 -05:00
Maureen Helm e042e249b1 serial: Refactor mcux uart shim driver to use clock control interface
Use the clock control interface instead of calling CLOCK_GetFreq()
directly. This will allow SoCs with different clock architectures to
reuse this driver.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-10-20 12:28:11 -05:00
Maureen Helm 7a60782f67 clock_control: Introduce mcux sim driver
Adds a new clock control driver for Kinetis SoCs that have the system
integration (SIM) module. This will allow mcux shim drivers, such as
uart and i2c, to abstract the call to CLOCK_GetFreq() behind the
clock_control interface and thus be reused for SoCs with different clock
architectures.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-10-20 12:28:11 -05:00
Ravi kumar Veeramally b2d3656c1d i2c: twihs_sam: fix mode config variable usage
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-20 13:22:25 -04:00
Leandro Pereira 803984837f drivers: i2c: esp32: Fix crash when enabling second I2C device
IRQ_CONNECT() was being expanded with the IRQ line for the first device
twice, causing spurious IRQs.

Should fix #4398.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-19 20:09:23 -04:00
Manivannan Sadhasivam 90d288be29 drivers: serial: Add MSP-EXP432P401R UART
This patch adds support for on board UART_0 on MSP-EXP432P401R-LAUNCHXL.
Driver makes use of driverlib available in ROM by default, thus saving
code space.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2017-10-19 12:16:11 -05:00
David B. Kinder 4600c37ff1 doc: Fix misspellings in header/doxygen comments
Occasional scan for misspellings missed during PR reviews

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-10-17 19:40:29 -04:00
Loic Poulain 8a11f91252 usb: Add support for STM32 family USB driver
This is a USB controller driver for STM32F4xx devices using
the STM32 Cube HAL_PCD framework. This has been tested with
the cdc_acm driver on a 96b_carbon board (STM32F401RE).

This is a refactoring of:
usb: usb_dc_stm: Add support for STM32Cube HAL_PCD USB driver
Signed-off-by: Christer Weinigel <christer@weinigel.se>
[daniel.thompson@linaro.org: Removed STM32F40(157) defconfig changes
together with STM32F4Discovery pinmux and defconfig changes, updated
clock settings and pad configuration to match latest mainline]
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
[giannis.damigos@gmail.com: Change uint*_t types to u*_t types,
change SYS_LOG_USB_DC_STM_LEVEL to SYS_LOG_USB_DRIVER_LEVEL and
update pinmux to match latest arm branch]
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2017-10-17 09:14:47 -04:00
Loic Poulain e9d9463ebc pinmux: stm32: stm32f4: Add USB FS pinmux
Add pinmux configuration for USB OTG Full Speed.
Ports 11 and 12 use alternate function 10 for DM/DP.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2017-10-17 09:14:47 -04:00
Kamil Sroka 22d02db46e drivers: ieee802154: nrf5: Fix typo
Signed-off-by: Kamil Sroka <kamil.sroka@nordicsemi.no>
2017-10-17 10:23:34 +03:00
Paul Sokolovsky a39ec5f72c drivers: slip: Rework logging to follow conventions
Previously, there was boolean CONFIG_SLIP_DEBUG, which effectively
switched between "logging off" and "debug-level logging". Instead,
switch to CONFIG_SYS_LOG_SLIP_LEVEL (the naming of the option follows
existing conventions) which allows to select any of the standard 5
logging levels.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-10-16 12:31:17 -04:00
Marti Bolivar 1f244a7b1e drivers: spi: fix SPI_QMSI_SS typo
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-16 11:58:50 -04:00
Marti Bolivar 5cb9578942 spi: stm32: fix clock prescaler calculation
The current prescaler calculation incorrectly fails to configure the
desired frequency when it is possible to match it exactly. Fix this.

Without this patch, if the user requests frequency N Hz, and there is
a SPI prescaler that can match this frequency exactly, the actual
frequency chosen by spi_stm32_configure() will be N/2 Hz.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-16 08:56:29 -07:00
Paul Sokolovsky 1ca4f1aa1d drivers: slip: Consistently log pkt/buf allocation failures
There are 3 cases of possible allocation failures, only 1 of them
was logged. Now, all the cases are logged: 1) failure to allocate
net_pkt; 2) failure to allocate very first net_buf for it; 3)
failure to allocate additional net_buf for it (this latter was
the only one logged previously).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-10-16 10:58:12 +03:00
Tomasz Bursztyka ea0aee2bb3 drivers/ieee802154: Stop exposing old radio API functions
set_ieee_addr, set_short_addr and set_pan_id are now unused by L2, so
removing their exposure through the radio API.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka 54b3d6b130 drivers/ieee802154: Implement radio API's set_filter() relevantly
Currently, all drivers seem to support hardware filtering.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka b2726e14a6 drivers/ieee802154: Implement get_capabilities in existing drivers
Further support will need work per-driver basis, as soon as the L2 will
be able to make usage of such support.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Tomasz Bursztyka 164cbec9d0 drivers/ieee802154: Set lqi/rssi to net_pkt, stop exposing get_lqi
Both values are now embedded into net_pkt, get_lqi will be removed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-13 13:48:32 +03:00
Andrzej Puzdrowski 296a355af5 drivers: flash: Add write-block-size values for SoCs
Write-block-size values were filled for nRF5, STM32, QMSI, MCUX and
w25qxxdv devices.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-10-11 11:19:15 -05:00
Kumar Gala 0bfd810d13 i2c: deprecate use of union dev_config
There are several issues with the dev_config union used as a
convenience when calling the i2c_configure api.  One, the union is well
name spaced protected and doesn't convey use with just i2c.  Second
there are assumptions of how the bits might get packed by the union
which can't be guaranteed.  Since the API takes a u32_t lets change in
tree uses to using the macros to setup a u32_t and make the union as
deprecated.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-10-11 10:45:12 -04:00
Jonas Pfaff b62a353551 drivers: adc: Add SAM ADC driver
Tested on Atmel SMART SAM E70 Xplained board

Origin: Original

Jira: ZEP-2507

Signed-off-by: Jonas Pfaff <jonas.pfaff@gmail.com>
2017-10-10 11:56:47 -05:00
Christian Taedcke 4b586157d6 drivers: serial: Add uart driver for Silabs EXX32 MCUs
Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2017-10-10 11:56:47 -05:00
Christian Taedcke 158b635b57 drivers: gpio_gecko: Add gpio driver for Silabs EXX32 MCUs
Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2017-10-10 11:56:47 -05:00
Tomasz Bursztyka 53ca9a3f9b drivers/spi: Run CS/GPIO logic only when relevant
If given gpio dev pointer is NULL, it will silently ignore the CS
control.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-10 09:42:45 -04:00
Tomasz Bursztyka 5f1360e27d drivers/bluetooth/spi: Do not initialize vendor attribute
As commit introducing it will be reverted.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-10 09:42:45 -04:00
Tomasz Bursztyka 24199b234c drivers/spi/stm32_ll: Configure NSS behavior according to cs pointer
If CS (Chip Select, known also as Slave Select...) is managed externaly
of the stm32_ll SPI controller, just config NSS line management
accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-10 09:42:45 -04:00
Leandro Pereira e1effa0e73 drivers: esp32: I2C driver implementation
Supports both master and slave mode, standard and fast modes,
configurable timeouts, and a few other tunable settings.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-09 20:53:22 -04:00
Leandro Pereira 5f22dab17a esp32: Prefix ROM routines with esp32_rom_
Also provide their prototypes in `soc.h`.  This should help
readability, since some ROM functions, with their names as provided by
Espressif, have sometimes the same prefix as Zephyr APIs.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-09 20:53:22 -04:00
Leandro Pereira 095424c416 drivers: gpio: esp32: Configure GPIO drive strength
Configuring an open drain driver is required by the I2C driver,
but the GPIO driver didn't support setting the drive strength.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-09 20:53:22 -04:00
Leandro Pereira fd25931228 drivers: gpio: esp32: Use PIN_FUNC_GPIO definition from ESP-IDF
PINMUX_FUNC_A is set to 0, which coincides with the GPIO function in
many of the ESP32 pins.  Use PIN_FUNC_GPIO by default inside the
GPIO driver, however, so the correct function is always selected.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-09 20:53:22 -04:00
Thiago Silveira 1d8c8ac3af clock_control: nrf5_power: Let the LF clock be configured at least once
If the LF clock was already started, but wasn't initialized with
_k32src_start yet, allow it to run once. This is needed because if a
soft reset is triggered while watchdog is active, the LF clock will
already be running, but won't be configured yet (watchdog forces LF
clock to be running).

If the LF clock isn't configured with _k32src_start, the nRF5 RTC
won't count and the whole system will malfunction, as the kernel
depends on the clock source being working properly.

Signed-off-by: Thiago Silveira <thiago@exati.com.br>
2017-10-08 23:05:34 -04:00
Marti Bolivar 4f8081b5e4 drivers: flash: add flash_page_foreach()
This patch adds a routine which can be used to iterate over all flash
pages on the device.

This can be also done by using flash_get_page_info_by_idx(), but that
would add an unnecessary loop over the layout array for each page.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-06 22:12:23 -04:00
Paul Sokolovsky 808b315cf6 arm: nxp: kw41z: Select IEEE802154_KW41Z driver for networking
802.15.4 is the networking hardware available in KW41Z SoC (and
supported by Zephyr). So, if networking in enabled, automatically
select the corresponding driver. This is similar to how frdm_k64f
automatically selects Ethernet driver, 96b_carbon selects BLE/IPSP
drivers, etc. (But we apply it on SoC level to reuse across the
boards.)

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-10-06 14:39:17 -05:00
Savinay Dharmappa 58d54c0f2d dts: x86: qemu_x86: Add device support for uart ns16550
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-10-06 08:35:42 -04:00
Tomasz Bursztyka eb7b29e5cf drivers/ieee802154: Fix regression in uart pipe driver
A wrong name replacement was applied during commit
db11fcd174

Fixes issue #4165

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-10-04 10:47:08 +03:00
David B. Kinder f00f58517b doc: replace UTF-8 chars
Some our Zephyr tools don't like seeing UTF-8 characters, as reported in
issue #4131) so a quick scan and replace for UTF-8 characters in .rst,
.h, and Kconfig files using "file --mime-encoding" (excluding the /ext
folders) finds these files to tweak.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-10-03 20:03:57 -04:00
Anas Nashif 3b7dd6ef4e i2c: fix include for i2c_bitbang in some drivers
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-03 14:50:14 -04:00
Anas Nashif 38e6e60dc5 spi: fix including spi_ll_stm32.h
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-03 14:50:14 -04:00
Jukka Rissanen 29fdc8f956 drivers: eth: mcux: Fix buffer overflow
If we were trying to send max MTU size data, then the temporary
frame_buf was overflowing because it only allocated 1500 bytes
for the buffer but then copied 1514 bytes into it (max mtu +
ethernet header).

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-09-30 13:38:12 -04:00
Maureen Helm f0d50979e8 mcux: nxp_kinetis: Move HAS_TRNG config to ext
SoCs outside the Kinetis family can have the TRNG module, so move the
HAS_TRNG config from arch/arm/soc/nxp_kinetis to ext/hal/nxp/mcux

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-09-25 12:31:59 -05:00
Maureen Helm 5ba9f26b46 mcux: nxp_kinetis: Move HAS_RNGA config to ext
SoCs outside the Kinetis family can have the RNGA module, so move the
HAS_RNGA config from arch/arm/soc/nxp_kinetis to ext/hal/nxp/mcux

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-09-25 12:31:59 -05:00
Maureen Helm 694c7f5ca4 mcux: nxp_kinetis: Move HAS_FTM config to ext
SoCs outside the Kinetis family can have the FTM module, so move the
HAS_FTM config from arch/arm/soc/nxp_kinetis to ext/hal/nxp/mcux

Note that 'select HAS_FTM' was previously missing from Kconfig.soc and
is now fixed.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-09-25 12:31:59 -05:00
Maureen Helm f7a37cea8d mcux: nxp_kinetis: Move HAS_ADC16 config to ext
SoCs outside the Kinetis family can have the ADC16 module, so move the
HAS_ADC16 config from arch/arm/soc/nxp_kinetis to ext/hal/nxp/mcux

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-09-25 12:31:59 -05:00
Maureen Helm fe4c3aacba mcux: nxp_kinetis: Move HAS_LPSCI config to ext
SoCs outside the Kinetis family can have the LPSCI module, so move the
HAS_LPSCI config from arch/arm/soc/nxp_kinetis to ext/hal/nxp/mcux

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-09-25 12:31:59 -05:00
Maureen Helm bbafc833db mcux: nxp_kinetis: Move HAS_LPUART config to ext
SoCs outside the Kinetis family can have the LPUART module, so move the
HAS_LPUART config from arch/arm/soc/nxp_kinetis to ext/hal/nxp/mcux

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-09-25 12:31:59 -05:00
Piotr Mienkowski d760dc2616 drivers: dma: remove deprecated API functions
This patch removes deprecated API functions and data types from
dma.h file as well as device drivers.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-09-22 07:50:20 -04:00
Piotr Mienkowski c1f8eb4182 drivers: sensor: clean up Kconfig files
- place all sensor Kconfig options in submenu
- separate device drivers and common options with a comment line
- align help text

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-09-21 15:47:58 -04:00
Andrei Emeltchenko 4efaefba5c usb: Allow to select configuration for composite devices
Composite multifunction USB devices should be able to know about
configuration change, implement it through existing callback.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-09-21 09:00:23 -04:00
Andrei Emeltchenko 5522875a75 usb: Correct length print modifier
Length should be logged in decimal notation.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-09-21 09:00:23 -04:00
Kumar Gala 83643a2266 drivers: i2c: remove usage of bitfield access for cfg
Cleanup I2C drivers to not use bitfield access for config information
and instead use accessor macros that use shifts & masks.  This is
cleanup towards removing the bitfield access in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-09-20 10:16:14 -05:00
Paul Sokolovsky db8f470d8d drivers: eth: mcux: Fix error status logging
With logging enabled, this leads to type mismatch warning, which is
promoted to error when building under CI.

Also, reomove extra "\n" from the logging messages.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-09-19 14:09:40 +03:00
Punit Vara 10c1799c88 drivers: bmc150_magn: Initialise driver with DEVICE_AND_API_INIT
Replace DEVICE_INIT with DEVICE_AND_API_INIT to reduce code size

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-17 10:26:52 -04:00
Punit Vara 54b1ff3bc1 driver: bmc150_magn: Use SYS_LOG_ERR instead of SYS_LOG_DBG for errors
Converts bmc150_magn error messages from SYS_LOG_DBG to SYS_LOG_ERR.

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-17 10:26:52 -04:00
Leandro Pereira 4547b5ca06 drivers: i2c: sbcon: Only show SBCon when building for ARM
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-09-17 09:28:30 -04:00
Tomasz Bursztyka 5405e93852 drivers/spi: Use sync_status relevantly in DW driver
Removing internal boolean in order to use the proper error code hold in
spi_context which was relevantly added in commit 6c717095b8.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-09-15 08:07:41 -04:00
Kumar Gala eb23cd2650 sensor: bmi160: Update Kconfig dependancy for SPI
The driver uses the SPI legacy API so make it depend on the SPI legacy
API being enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-09-13 11:30:35 -05:00
Ricardo Salveti 7714c9a7aa pwm: stm32: Fix check for APB prescale
RCC_HCLK_DIV1 translates to 0x0 while apb_psc uses the value defined
by CONFIG_CLOCK_STM32_APB1/2_PRESCALER (range from 1 to 16).

Manually check if the defined prescaler is 1 or not and use that to
calculate the correct timer clock.

Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-09-13 10:07:44 -05:00
Ricardo Salveti 0b98b871aa pinmux: stm32: stm32f4: Add PWM3 channels on PC 6, 7, 8 and 9
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-09-13 10:07:44 -05:00
Ricardo Salveti 0dca1f5bd3 pwm: stm32: Add PWM 3 (TIM3)
Add support for TIM3 as it is widely available and pins available via
headers on several devices.

Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-09-13 10:07:44 -05:00
Michał Kruszewski 0fea242397 kconfig: adc: Extract platform specific configs to separate files.
It increases readability and order.

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
2017-09-13 09:56:25 -04:00
Michał Kruszewski 12faf2cf92 spi: Allow updating TX and RX of spi context by multiple words.
Previous approach allowed only single word update for single
function call. Updating context in ISR was inefficient for
controllers supporting automatic multiple data packets transaction.

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
2017-09-13 09:26:49 -04:00
Piotr Mienkowski af99f62237 drivers: i2c: hide I2C_x_DEFAULT_CFG for DTS drivers
I2C device drivers which support DTS have their default boot
configuration provided by DTS. The legacy I2C_x_DEFAULT_CFG
option in Kconfig is no longer required. This patch hides
this option from the Kconfig menu for I2C device drivers which
support DTS.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-09-13 07:38:59 -05:00
Jukka Rissanen c4efc11ffd drivers/eth/mcux: Catch IPv6 multicast group join/leave information
This information will be used to program the chip's receive filter.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-09-13 14:15:02 +03:00
Erwan Gouriou 8468db659b stm32f3_disco: Switch USART1(Console) to PC4/PC5
Default configuration for USART1 (Console output) on board
stm32f3_disco was set on PA9/PA10, which matches Rev-A/B
configuration. Though, on more recent configuration of the
board (Rev-C onward). USART1 is mapped to PC4/PC5.
This configuration has the benefit to support VCP, hence it
is chosen to be set by default.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-09-12 11:24:56 -04:00
Erwan Gouriou 30f5df2f91 pinmux: stm32: add SPI3 pin definitions for stm32l4
Add SPI3 pin definitions for PC10, PC11, PC12.
This is required to use SPI3 on disco_l475_iot1 board

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-09-12 11:24:56 -04:00
Kumar Gala 31745c69db pinmux: Move stm32 board pinmux files into board dirs
Move all STM32 based board pinmux files into the board dirs so we are
consistent across all the STM32 platforms/boards.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-09-12 11:24:56 -04:00
Timo Teräs 5829965278 serial/uart_ns16500: poll THRE to determine when data can be written
TEMT is Transmitter Empty bit which is set only when the full FIFO
is empty. It makes sense to poll for THRE (Transmitter Holding
Register Empty) which is set when UART can buffer new character
for transmission (there is room in FIFO). This allows using the
FIFO in full.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2017-09-12 11:24:56 -04:00
Timo Teräs 047a229985 serial/uart_ns16550: keep LCR settings when programming DLAB
The LCR register specifies the format of the asynchronous data
communication exchange. Keep the data/stop bit and parity settings
intact during baud rate change.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2017-09-12 11:24:56 -04:00
Anas Nashif b1991eba94 cleanup: remove the whitespaces before the # character
Indenting preprocessor directives reduces the code readability, because
it make preprocessor directives harder to spot.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 12:41:07 -04:00
Anas Nashif 8920cf127a cleanup: Move #include directives
Move all #include directives at the very top of the file, before any
code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-09-11 12:41:07 -04:00
Marti Bolivar c0672938da flash: stm32: stm32l4: add page layout support
L4 parts have a constant page size, so just rely on the HAL defines
that provide it, along with a read to the register which contains this
SoC's total size.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-09-11 11:41:57 -04:00
Marti Bolivar 32482e9cb8 flash: stm32: stm32f4: add page layout support
Add flash page layout support for STM32F4 SoCs.

This almost eliminates the need for flash_map.h, except for
STM32F4X_SECTOR_MASK, so delete the file and move the define into the
F4 implementation, to keep things simple.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-09-11 11:41:57 -04:00
Marti Bolivar 4fea6dfe76 flash: stm32: clean up L4/F4 internal API
This is a prep work commit for adding flash page layout support.

The internal flash APIs for STM32 on L4 and F4 are a bit
inconsistent. Some routines take a pointer to the private data, others
don't. Those that do take it as a last argument instead of a
first. Additionally, some APIs are declared in flash_stm32.h that
aren't ever used by the family-specific files.

Clean this up by making everything take a struct device*, and marking
routines static in the common driver code when possible.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-09-11 11:41:57 -04:00
Andrzej Puzdrowski a7863f2362 Drivers: flash: nrf5: Implement flash layout APIs
Added implementation of the flash layout API for the nRF5x series.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-09-11 11:41:57 -04:00
Andrzej Puzdrowski ce9f0b571e Drivers: flash: New API to obtain the flash layout
Added an internal function to obtain the flash page layout in
run-length encoded format. The API is simple and allows the actual
public API implementations to be simple and maintainable.
This feature can be enabled by using the FLASH_PAGE_LAYOUT Kconfig
option. This API is required for the implementation of flash file
system.

Added a public API to get flash page information (size and start offset)
by offset within the flash and by index of the page.
Added a generic implementation of the internal flash_get_page_info API.
Added an additional public API call to get the total count of pages in
the flash memory and its generic implementation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-09-11 11:41:57 -04:00
Punit Vara bd359d09c8 driver: sensor: Add BMM150 Geomagnetic sensor driver
This patch implements BMM150 driver with polling mode and its tested
with original BMM150 sensor hardware. Driver works on I2C
interface as of now.

Following datasheet is taken as reference while developing driver.
http://www.mouser.com/ds/2/783/BST-BMM150-DS001-01-786480.pdf

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-09-05 07:56:41 -04:00
Youvedeep Singh 91063a33a4 tests: benchmark: timing_info: Add support for nrf series processors
nrf SOC uses nrf rtc timer (not sys tick), which is 32kHz,
whereas CPU runs at higher speed (nrf52 runs at 64MHz).
So 32Khz is too slow to measure critical kernel parameters.

This patch does :-
1. Add support for nrf SOC for timing_info benchmarking.
2. Uses SOC timer to measure kernel parameters.

Jira: ZEP-2314

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-31 14:25:31 -04:00
Youvedeep Singh 76b577e180 tests: benchmark: timing_info: Change API/variable Name.
The API/Variable names in timing_info looks very speicific to
platform (like systick etc), whereas these variabled are used
across platforms (nrf/arm/quark).
So this patch :-
1. changing API/Variable names to generic one.
2. Creating some of Macros whose implimentation is platform
depenent.

Jira: ZEP-2314

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-31 14:25:31 -04:00
Jukka Rissanen 07b1376c31 drivers: ieee802154: cc2520: Fix compiler warning
The stack address was incorrectly specified when stack usage
was being debugged. This caused compiler to emit this warning

drivers/ieee802154/ieee802154_cc2520.c:1136:16: warning:
    dereferencing type-punned pointer will break strict-aliasing
    rules [-Wstrict-aliasing]
       ((struct cc2520_context *)(&__device_cc2520))->
                ^

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-08-30 11:54:43 -04:00
Tomasz Bursztyka b4f88d3982 drivers/ethernet: Fix a packet reception regression in ENC28J60 driver
Commit-id db11fcd174 broke the packet
reception logic in this driver.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-08-30 08:15:41 -04:00
Anas Nashif de8b88bb0b license: fix license identifiers
Also add copyright headers and license tags where missing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-29 07:42:09 -04:00
Leandro Pereira 8dc88069be drivers: watchdog: esp32: Acknowledge watchdog interrupt
If the interrupt isn't acknowledged, the callback will continue to be
called.

Jira: ZEP-2556
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-25 15:31:46 -04:00
Leandro Pereira 1861022148 drivers: watchdog: esp32: Reduce number of seals/unseals
Jira: ZEP-2556
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-25 15:31:46 -04:00
Leandro Pereira 9bacdbac30 drivers: watchdog: esp32: Always use Timer Group 1 for WDT
The FreeRTOS port by Espressif uses the same timer group.  Do the same
here.

Jira: ZEP-2556
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-25 15:31:46 -04:00
Kumar Gala 74020e5ce0 eth_enc28j60: Update Kconfig dependancy for SPI
The driver uses the SPI legacy API so make it depend on the SPI legacy
API being enabled.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-08-24 10:00:37 -04:00
Leandro Pereira 3d48ce8011 drivers: gpio: esp32: Properly convert interrupt triggering mode
Masks for level- and edge-triggering levels are 0, so the following
check will be always true:

    if ((flags & GPIO_INT_ACTIVE_LOW) == GPIO_INT_ACTIVE_LOW)

Invert the evaluation order, by checking the masks that are not 0
first.

Jira: ZEP-2557
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-23 10:28:59 -04:00
Leandro Pereira b4bfdaa31b drivers: gpio: esp32: Declare data struct only for enabled ports
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-23 10:28:59 -04:00
Yannis Damigos 4428022dce drivers: i2c_ll_stm32: Fix building for interrupt mode
The compilation of the i2c_ll_stm32 fails when we
enable the interrupt mode. The struct i2c_stm32_data
is needed to initialize the semaphore. This patch adds
the missing struct for interrupt mode.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-08-23 08:28:21 -05:00
Leandro Pereira 884a385fc6 drivers: serial: esp32: Return transmitted character on success
When transmitting to the UART interface using polled mode, the ESP32
driver would return 0 regardless of the success state.  Return the
character that has been transmitted to comply with the API.

Jira: ZEP-2552
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-22 16:38:27 -04:00
Leandro Pereira d52de29fba esp32: Fix redefinition of BIT() macro
Esp-idf defines the BIT macro that is also defined in Zephyr's
misc/util.h.  Fix the issue by including the esp-idf headers first, so
that a check in util.h won't redefine the macro if it's already
defined.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-19 07:50:18 -04:00
Tomasz Bursztyka 7abf3c5307 drivers/crypto: Add mbedTLS shim crypto driver
This exposes the CCM operations through generic Crypto API.

Change-Id: I09346e77bf8821c208305a7aa2805cf49cb42d71
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-08-17 22:20:23 -04:00
Andrzej Kaczmarek 5d8eadd7b1 drivers: crc: Add 'pad' parameter to crc16()
'pad' parameter controls whether crc16() should add padding at the end
of input bytes or not. This allows to compute CRC16 for data stored in
non-contiguous buffers where CRC value is calculated using subsequent
calls to crc16() with padding added only for last chunk.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2017-08-17 22:19:19 -04:00
Andrzej Kaczmarek 8f5420ff23 drivers: flash: Fix write_op unaligned access
data_addr is not guaranteed to be word-aligned so we need to read it in
a safe way, otherwise this can trigger hardfault on nRF51.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2017-08-17 10:54:37 -04:00
David B. Kinder a3e38685a7 doc: fix misspellings in Kconfig files
Also fixed missing newline at end of file

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-08-16 15:47:42 -04:00
Tomasz Bursztyka 05890b32b4 drivers/ieee802154: Fix licence headers in Kconfig files
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-08-16 11:44:39 -04:00
Kumar Gala 99c19c62e1 i2c: stm32: Remove usage of CONFIG_I2C_x_DEFAULT_CFG
Stop using CONFIG_I2C_x_DEFAULT_CFG to get the initial value.  Since we
only support master mode we always default to it for initial config and
we get the bitrate from the device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-08-16 10:03:34 -05:00
Kumar Gala 54933b3833 i2c: mcux: Remove usage of CONFIG_I2C_x_DEFAULT_CFG
Stop using CONFIG_I2C_x_DEFAULT_CFG to get the initial value.  Since we
only support master mode we always default to it for initial config and
we get the bitrate from the device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-08-16 10:03:34 -05:00
Kumar Gala 9935581d8a i2c: Add helper function to map from bitrate values to zephyr cfg
Add _i2c_map_dt_bitrate() that maps from a bitrate to the I2C zephyr
cfg bit fields used in i2c_configure().

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-08-16 10:03:34 -05:00
Marti Bolivar 272e8ffccd Bluetooth: hci: spi: add support for new SPI API
Add shim routines for the new SPI driver API.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-15 22:58:02 +03:00
Marti Bolivar bd5c2c07b3 Bluetooth: hci: spi: abstract out legacy SPI API
Some targets (e.g. STM32-based boards) only have SPI drivers using the
new API. To support both these and existing, legacy SPI drivers in the
SPI HCI driver, abstract out the SPI API into shim routines.

There are no behavioral differences due to this patch. The next patch
will add support for the new API.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-15 22:58:02 +03:00
Gil Pitney 4f67a6c76d cc3200: Remove TI cc3200 SOC and LaunchXL board support
Per ZEP-1958, Phase 2 of adding CC3220sf LaunchXL support,
was to "deprecate the CC3200 launchxl support in Zephyr
(redundant to the CC3220)."

Effectively, the CC3220 SOC replaces the CC3200.

This patch removes the following:
* the imported CC3200 SDK
* CC3200 SOC, board, DTS files.
* adjusts other files where cc3200 was mentioned.

Also, it fixes explicit references to CC3200 in generic
CC32xx driver files.

Jira: ZEP-1958

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
2017-08-15 11:02:48 -05:00
Piotr Mienkowski 7756bbfd8c drivers: Add I2S (Inter-IC Sound) driver infrastructure
Only Kconfig/Makefile file for now.

Origin: Original

Jira: ZEP-230
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-08-14 11:14:34 -04:00
Andrzej Kaczmarek 246f4ee7db drivers: flash: Fix checking for radio idle state
ll_radio_state_is_idle() returns bool, not an error value - this means
it is non-zero on success.

Jira: ZEP-2445

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2017-08-14 11:08:17 -04:00
Carles Cufi d5c13a7530 Bluetooth: controller: Rename Kconfig prefix
Rename the BT_CONTROLLER prefix used in all of the Kconfig variables
related to the Bluetooth controller to BT_CTLR.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-08-14 15:44:56 +03:00
Youvedeep Singh a4063f5362 Timer: Add TICKLESS_KERNEL support for nrf_rtc_timer.
Add support for TICKLESS KERNEL in nrf_rtc_timer for Nordic family of
processors. This patch includes :-
 1. Programming RTC based on "next timer" value from timeout queue while
     A. exiting idle_exit.
     B. on RTC interrupt.
 2. Impliments some of functions which will be required by sys_clock and
    scheduler.

ZEP-1819

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-10 13:56:24 -04:00
Yannis Damigos 22912ffcf9 drivers: i2c_ll_stm32_v1: Fix RX for all receptions
This patch fixes the read operation of the I2C driver
for all the receptions (1-byte, 2-bytes, N-bytes when
N > 2)

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Tested-by: Yannis Damigos <giannis.damigos@gmail.com>
Tested-by: Martin Iñaki Malerba <inakimmalerba@gmail.com>
2017-08-10 12:45:44 -05:00
Yannis Damigos 9a9f65fd0c drivers: i2c_ll_stm32_v1: Fix TX if flag I2C_MSG_RESTART is set
In interrupt mode, the drivers entered a forever loop if the
I2C_MSG_RESTART flag was set. This patch fix this issue.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-08-10 12:45:44 -05:00
Yannis Damigos 654b3381aa drivers: i2c_ll_stm32_v1: Disable/enable only Buffer interrupts
The EVENT interrupt is generated when:
– SB = 1
– ADDR = 1
– ADD10= 1
– BTF = 1 with no TxE or RxNE event
– TxE event to 1 if Buffer interrupt enabled
– RxNE event to 1 if Buffer interrupt enabled

We need to disable and enable the Buffer TxE and RxNE interrupt
inside the EVENT ISR. The LL_I2C_{Enable,Disable}IT_TX and
LL_I2C_{Enable,Disable}IT_RX functions, used now, enable and
disable both Buffer and Event interrupt. This patch uses the
LL_I2C_EnableIT_BUF and  LL_I2C_DisableIT_BUF functions to
enable and disable the Buffer interrupt (TxE, RxNE).

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-08-10 12:45:44 -05:00
Wayne Ren f8d061faf7 arch: arc: add nested interrupt support
* add nested interrupt support for interrupts
   + use a varibale exc_nest_count to trace nest interrupt and exception
   + regular interrupts can be nested by regular interrupts and fast
interrupts
   + fast interrupt's priority is the highest, cannot be nested
* remove the firq stack and exception stack
   + remove the coressponding kconfig option
   + all interrupts (normal and fast) and exceptions will be handled
     in the same stack (_interrupt stack)
   + the pros are, smaller memory footprint (no firq stack), simpler
     stack management, simpler codes, etc.. The cons are, possible
     10-15 instructions overhead for the case where fast irq nests
     regular irq
* add the case of ARC in test/kernel/gen_isr_table

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-10 12:47:15 -04:00
Maureen Helm 469ddab780 pwm: Remove k64-specific driver and k20_sim.h
Now that we have an mcux shim driver, remove the old k64-specific
driver. Also remove include/drivers/k20_sim.h, since the old
k64-specific driver was the only thing left using it.

Jira: ZEP-2025

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-09 18:13:29 -04:00
Maureen Helm 060bf8ea6a pwm: Introduce new mcux ftm shim driver
Adds a shim layer around the mcux ftm driver to adapt it to the Zephyr
pwm interface.

Jira: ZEP-2025

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-09 18:13:29 -04:00
Maureen Helm bebc94e043 pwm: Add shared configs for log level and instances
Adds shared pwm driver configs for log level and instances

Jira: ZEP-2025

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-08-09 18:13:29 -04:00
Johann Fischer 868c3eadce drivers: dma: add Log level option to Kconfig
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-08-09 16:04:46 -05:00
Johann Fischer 92e24de7cd drivers: dma: restructure dma drivers Kconfig
Moves Kconfig options for each dma controllers into own Kconfig files.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-08-09 16:04:46 -05:00
Leandro Pereira db6ff4da60 drivers: random: Add ESP32 random number generator driver
The random number generator from ESP32 uses noise from Wi-Fi and
Bluetooth radios.  If these are off, a pseudo-random number is
generated instead; this is currently the case, but even though it's a
black box, it's arguably better than returning a timestamp as a
pseudo-random number generator.

According to the ESP32 Technical Reference manual, the RNG passed the
Dieharder Random Number Test suite (version 3.31.1)[1], but nothing has
been said about the quality of the PRNG.

The RNG register is read directly; no effort is made to use its
contents to feed an entropy pool in a way that's similar to /dev/random
on POSIX systems, as no such subsystem exists on Zephyr at the moment.

[1] http://webhome.phy.duke.edu/~rgb/General/dieharder.php

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-09 12:26:14 -07:00
Leandro Pereira d691045592 drivers: watchdog: Implement ESP32 watchdog driver
Zephyr's watchdog API is badly designed in the sense that it's a 1:1
abstraction on top of whatever Quark D2000 expects for its watchdog,
instead of expecting a generic timeout value.

This implementation tries as much as possible to calculate the watchdog
timeout in a way that's compatible with a Quark D2000 running at 32MHz;
a comment in adjust_timeout() explains this in more detail.

Jira: ZEP-2296
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-09 12:26:14 -07:00
Leandro Pereira c0c79a8041 drivers: gpio: esp32: Add ESP32 GPIO driver
This provides basic GPIO support, with interrupts, and the ability to
read and write to ports on a pin-by-pin basis.

Jira: ZEP-2286
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-09 12:26:14 -07:00
Leandro Pereira f3b05c6a58 drivers: pinmux: Add pin multiplexer driver for ESP32
This implements a driver for the pin multiplexer as present in the ESP32
SoCs.

All APIs are supported.

Jira: ZEP-2297
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-09 12:26:14 -07:00
Jukka Rissanen 55b8edc88e net: Fix LLVM compiler warnings
Jira: ZEP-2488
Jira: ZEP-2486
Jira: ZEP-2485
Jira: ZEP-2482
Jira: ZEP-2480

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-08-09 12:50:50 -04:00
Johan Hedberg 7a7c8a57f5 drivers/display: mb_display: Fix struct member alignment
The alignment went off because of the move to use internal fixed-size
integer types (instead of standard int types).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-09 12:23:28 -04:00
Sebastian Bøe c4176c6526 Kconfig: Hide the "Bluetooth Drivers" menu entry when BT_CONTROLLER
It used to be that there was a fairly empty "Bluetooth Drivers" menu
entry in the drivers menu. This entry was present even though there
was no drivers/bluetooth code being compiled in.

With this patch "Bluetooth Drivers" will no longer be present when
BT_CONTROLLER is enabled.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-08-09 19:06:14 +03:00
Sebastian Bøe 2120beebf4 Kconfig: Move BT_WAIT_NOP into subsys/bluetooth/host
The CONFIG_BT_WAIT_NOP define is used only by
zephyr/subsys/bluetooth/host/hci_core.c.

It is also the only config in drivers/bluetooth that is in use when
BT_CONTROLLER is enabled. Moving it into the bluetooth subsystem
allows us to restructure the drivers/kconfig code such that the entire
Bluetooth driver menu option is omitted when the BT_CONTROLLER is
enabled.

Moving it will also mean that all configs in drivers/bluetooth will
now be related to configuring the source code in drivers/bluetooth.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-08-09 19:06:14 +03:00
Michał Kruszewski ddef35c1da spi context: Add function for getting single transfer buffers length.
Added function helps setting the longest possible rx and tx buffers for
single SPI transfer. Each of these buffers is a continuous memory
region. It is useful for example when peripheral supports easyDMA.

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
2017-08-09 08:46:37 -04:00
Johan Hedberg 2975ca0754 Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_*
The API name space for Bluetooth is bt_* and BT_* so it makes sense to
align the Kconfig name space with this. The additional benefit is that
this also makes the names shorter. It is also in line with what Linux
uses for Bluetooth Kconfig entries.

Some Bluetooth-related Networking Kconfig defines are renamed as well
in order to be consistent, such as NET_L2_BLUETOOTH.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-09 11:14:19 +03:00
Sebastian Bøe 197e6e2ba3 Kconfig: Move BLUETOOTH_HCI_RESERVE into subsys/bluetooth/host
There are two kinds of HCI implementations. Bluetooth drivers in
 drivers/bluetooth that implement HCI by using a wired serial
 transport layer to talk to an external controller chip. And a
 bluetooth controller in subsys/bluetooth/controller that directly
 talks to an internal on-chip controller node.

Currently, when the the subsys/bluetooth/controller is used there
still exists exposed to the user a bluetooth driver configuration
menu, even though no external bluetooth driver is in use. This is due
to a dependency on certain configs in driver/bluetooth that are needed
even though no external controller is used.

This patch moves one of these configs, BLUETOOTH_HCI_RESERVE, from
drivers/bluetooth/hci/Kconfig to subsys/bluetooth/host/Kconfig such
that eventually we can omit the entire Bluetooth driver menu option.

This re-organization does not change when the config can be enabled.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-08-08 23:01:05 +03:00
Florian Vaussard 71b25a12c3 spim_nrf52: Prevent glitch on CS line in spim_nrf52_init()
The output state of the CS GPIO must be configured with a pull-up while
setting the GPIO as output. Otherwise the GPIO will be forced low,
before being set high by the call to spim_nrf52_csn(). This results in a
glitch of 1us on the CS line, which may confuse some ICs in the worst
case.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2017-08-08 11:20:46 -05:00
Florian Vaussard 9e0d1e4232 spim_nrf52: Fix fall-through in switch statement
When setting the SPIM speed to 8 MHz, the driver will return an error
due to a missing "break" causing the execution flow to reach the default
case.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2017-08-08 11:20:46 -05:00
Savinay Dharmappa 0b18f6dd39 drivers: gpio: Fix Coverity static scan issues
patch fix the dead code issue reported by coverity static scan
for gpio driver of cc2650 TI SOC. CC2650_IOC_NO_PULL macro
is defined Zero, bitwise and with any value would result to
zero,because of which only false condition of if is evaluated
but not the true condition.

Jira ZEP-2469.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-08-08 09:42:14 -05:00
Youvedeep Singh 5efaca470c Timer Systick : Handle Systick timer rollback in tickless kernel Case
In Tickeless kernel Platform timekeeping is having error because
"_sys_clock_tick_count" is not getting updated correctly.
Currently "OVERFLOW" Flag (bit 16 in timer control register)
is reset before it is taken into account into _sys_clock_tick_count.

This patch sets a flag as soon as Timer Overflow occues and clears
it when time is accounted into _sys_clock_tick_count.

Jira : ZEP-2217

Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
2017-08-08 08:51:24 -04:00
Marti Bolivar f3b18bc2e9 drivers: spi: stm32: fix transmit/receive procedure
The transmit and receive procedure used in the STM32 SPI driver is not
correct.

On STM32F4, this is causing OVR errors (per the logged error mask) and
transmission of undesired 0x00 bytes (verified with a logic analyzer).

The root cause is that the receive register is not read (via DR, when
RXNE is set) each time the transmit register is written (also via DR,
when TXE is set). This clearly causes OVR errors when there is no
FIFO, as the receive register needs to be read each time a frame is
transceived, or the IP block has no way of knowing that the
overwritten data were not important.

Adapt the I/O procedure so that every DR write is matched by a DR
read, blocking until the relevant flags are set if necessary.

This behavior is suboptimal for targets such as STM32L4, where there
is a SPI FIFO. However, SPI I/O is broken on those targets, and this
patch fixes them as well. Further optimizations for targets with FIFOs
is left to future work.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar 4298772248 drivers: spi: stm32: add error checking to polled mode
With some other issues in polled mode now resolved, add error handling
and report a valid error status when releasing the context.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar d5ee0cfbf9 drivers: spi: stm32: remove extraneous unaligned macros
Byte access is always naturally aligned; there's no need to use
UNALIGNED_GET or UNALIGNED_PUT. Those would only be needed when
supporting 16-bit data frames.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar 78214d0569 drivers: spi: stm32: fix SPI being left on in slave mode
The current implementation unconditionally enables the SPI (sets
SPI_CR1_SPE) in transceive(), but disables it only in master mode.

The peripheral should only be enabled while the user has specifically
requested I/O. Fix this by always disabling the peripheral when I/O is
complete.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar b13b2c591e drivers: spi: stm32: factor out completion routine
Polled and IRQ-driven SPI I/O share code for cleanup and completion,
which can now be factored into its own routine.

This keeps a single point of truth for common paths, which will allow
a subsequent bug fix to happen in one place, and help avoid future
regressions.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar a6c481d36d drivers: spi: stm32: fix bugs in polled mode
In polled mode, the STM32 SPI driver is signaling completion when
there are no waiters:

- the only spi_context_wait_for_completion() caller in this driver is
  in the IRQ-driven portion of transceive() itself, which isn't
  compiled in polled mode.

- the "asynchronous completion + polled I/O" combination is not
  supported by the driver, so there are no other threads polling on
  this I/O we need to signal completion to.

What should be happening instead of signaling completion is releasing
the chip select pin, which polled I/O currently doesn't do.

Fix these issues.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar 7b0f0f801c drivers: spi: stm32: fix hardware NSS management
The LL_SPI_NSS_* macros used in spi_stm32_configure() when
hardware-based NSS management is requested are incorrect; fix them.

In master mode, this seems like a copy/paste error. The slave mode
case is likely due to following incorrect documentation in the ST LL
headers.

Note that in my testing on STM32F4, NSS appears to be open drain when
managed by hardware, making that configuration harder to test (and
probably less useful).

Details for the curious:

    The ST LL headers (for example stm32f4xx_ll_spi.h) claim
    LL_SPI_NSS_HARD_INPUT is to be used only in master mode, and
    LL_SPI_NSS_HARD_OUTPUT is to be used in slave mode.

    The opposite is true: when NSS is not handled by software, the SPI
    peripheral is responsible for driving NSS as an output, and the
    slave peripheral is responsible for reading it as an input.

    This is an error in the LL header files; the reference manuals and
    the other LL code make this clear.

    - The ST reference manuals specify that LL_SPI_HARD_OUTPUT (which
      corresponds to SSM unset, SSOE set) is a master-only
      configuration.  For example, STM32 RM0368 says:

        "NSS output enabled (SSM = 0, SSOE = 1)

        This configuration is used only when the device operates in
        master mode."

    - LL_SPI_HARD_INPUT (SSM unset, SSOE unset) is either a master or
      a slave configuration; in the slave case (which is what we're
      interested in here), it corresponds to the "usual" NSS
      input. RM0368, again:

        "NSS output disabled (SSM = 0, SSOE = 0)

        This configuration allows multimaster capability for devices
        operating in master mode. For devices set as slave, the NSS
        pin acts as a classical NSS input: the slave is selected when
        NSS is low and deselected when NSS high."

      The LL_SPI_StructInit() implementations similarly combine
      LL_SPI_MODE_SLAVE with LL_SPI_NSS_HARD_INPUT.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar 69bc5ebdf3 drivers: spi: stm32: add error checking to IRQ mode
Now that struct spi_context supports passing errors from
interrupt-driven I/O handlers to waiting threads, we can enable error
interrupts and propagate errors to spi_transceive() callers.

To make it easier for users to debug SPI-related issues, log any error
bits set in SR when failures occur.

A subsequent patch will add error checking to polled mode as well, but
other cleanups and fixes will go in first to make this easier.

Note that this breaks the spi_loopback test on some targets, but it's
not a regression, as it wasn't working properly anyway. Subsequent
patches the bugs that this error checking has exposed.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar 6c717095b8 drivers: spi: report synchronous completion status
The SPI API allows waiters to block until SPI I/O has completed. The
asynchronous subset of the API allows waiters to learn a status value
for the result of the I/O. However, the synchronous API does not allow
this.

Due to this limitation, synchronous API users cannot learn when
interrupt-driven I/O fails, which precludes proper error handling.

Resolve this limitation by adding a sync_status field to struct
spi_context, and using it to return operation results to the waiter.

Since there is only one status field, reduce the maximum number of
supported waiters from UINT_MAX to 1. This is not a problem for
current users, which all wait with the entire context locked.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar ec3aece97c drivers: spi: avoid undefined behavior
Void pointer arithmetic is undefined behavior (UB).

It's OK for struct spi_buf to contain a void *, because those values
are only ever stored, read, and compared. However, pointer arithmetic
is done on the tx_buf and rx_buf fields in struct spi_context, so
those need to be u8_t * to avoid UB.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Marti Bolivar 90ab8a6c6a pinmux: stm32: 96b_carbon: Add support for SPI
Add SPI pin mux tables for 96b_carbon. Note that SPI1 is for
internal use on the board connecting to the 96b_carbon_nrf51, while
SPI2 is broken out to an expansion header.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-08 07:45:35 -04:00
Anas Nashif 09bcd8ee74 Kconfig: make all syslog variables depend on SYS_LOG
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-08-04 14:34:54 -05:00
Sebastian Bøe 5eef82db68 kconfig: serial: esp32: Make driver depend on SOC_ESP32
The ESP32 UART driver can only be used on the ESP32 SoC AFAICT. But it
did not have a depend clause so it was polluting the options of other
platforms.

With this patch the ESP32 driver will no longer be exposed to users of
non-ESP32 devices.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2017-08-04 08:22:59 -04:00
Punit Vara f60fc94abd drivers: Add apds9960 sensor in polling mode
This patch implements following functionality in polling mode.

Ambient light
RGB light
proximity sensor

Following datasheet has been used to develop driver
https://docs.broadcom.com/docs/AV02-4191EN

Jira: ZEP-1552

Signed-off-by: Punit Vara <punit.vara@intel.com>
2017-08-03 15:29:35 -05:00
Erwin Rol d7c32cfcd7 drivers: pinmux: stm32f4: fix ethernet pin configs
The ethernet pins need the highest speed setting and no pull-up.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2017-08-02 12:28:11 -05:00
Erwin Rol cc40a5633d drivers: pinmux: stm32: make sure macro argument is used correctly
Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2017-08-02 12:28:11 -05:00
Nathan Loretan 88e166f6e9 drivers: spi: nRF5x: Fix clock polarity and phase config
Fix clock polarity and phase configuration by using correct
bit shifted configuration values.

Also, fixed SPIM1 config struct initialization that referred
to wrong SPI0 value.

Signed-off-by: Nathan Loretan <nathan.loretan@nordicsemi.no>
2017-08-01 12:51:06 -05:00
Leandro Pereira d5c283a82d drivers: crypto: Fix TinyCrypt shim
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-01 10:35:06 -04:00
Michał Kruszewski afa90859e9 nrf5: spi: Mark SPI drivers as conforming to legacy SPI API
Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
2017-07-31 10:05:19 -05:00
Jukka Rissanen 6bb446ed8e net: slip: Clarify slip settings in Kconfig
As SLIP TAP is now the default after the commit ca0ad13a61
("net: enable SLIP only on QEMU targets"), clarify the comments
and settings in various Kconfig files that talk about slip.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-28 10:45:47 +03:00
Leandro Pereira 732424f065 drivers, net: Clean up semaphore initialization
Change the common "init with 0" + "give" idiom to "init with 1".  This
won't change the behavior or performance, but should decrease the size
ever so slightly.

This change has been performed mechanically with the following
Coccinelle script:

    @@
    expression SEM;
    expression LIMIT;
    expression TIMEOUT;
    @@

    - k_sem_init(SEM, 0, LIMIT);
    - k_sem_give(SEM);
    + k_sem_init(SEM, 1, LIMIT);

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-07-27 15:23:07 -04:00
Kumar Gala 68732efe00 arm: nxp: mcux lpuart: Get IRQ info from DTS
Move to using the generated IRQ defines from the DTS instead of soc.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-27 09:27:47 -05:00
Kumar Gala 0ef91e4d07 arm: nxp: mcux uart: Get IRQ info from DTS
Move to using the generated IRQ defines from the DTS instead of soc.h.
This change also fixes a minor bug in that the error irq priority wasn't
getting correctly picked up from device tree.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-27 09:27:47 -05:00
Johann Fischer 3f05300924 drivers: mcr20a: allow use the driver with KW2xD devices
This patch allows the use of the MCR20A driver with KW2xD devices.
The clock output of the transceiver can be used as an input clock
for the PLL of the SoC. The hardware reset and CLK_OUT setup of
the transceiver should then be performed during the initialization
of the SoC. The driver is not allowed to do it again.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-07-27 11:21:04 +03:00
Johann Fischer 635216533c drivers: mcr20a: minor fixes and correction of the copyright header
Some patches have been lost during rebase before the initial commit,
this path fixes it.
- correct copyright in registers definition header file
- fix undefined macro inside CLK_OUT configuration
- use the return value of k_sem_take if there is a timeout

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-07-27 11:21:04 +03:00
Erwan Gouriou b452442256 drivers: pinmux: stm32: Clean up after rework
Following rework of pinmux driver for whole stm32 family,
remove call to stm32_get_pin_config which is no more
used.
Include dt-bindings stm32-pinctrl.h file to ensure coherency
between dts files and pinmux driver.
Due to change of "port" from enum to a series of define
(enum not accepted as dt binding), rework gpio_stm32_config
declaration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-07-26 15:16:52 -05:00
Erwan Gouriou 72d2960741 arch: arm: stm32f3: Rework pinmux handler
STM32F3 pinmux handler is reworked to support future pinmux dts
generation.
Preliminary change is done to move pin configuration
informations in a {pin, conf} structure closer to dts fields
"pins" array is removed as information is transfered to
"pinconf" array

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-07-26 15:16:52 -05:00
Erwan Gouriou 8763939763 arch: arm: stm32f4: Rework pinmux handler
STM32F4 pinmux handler is reworked to support future pinmux dts
generation.
Preliminary change is done to move pin configuration
informations in a {pin, conf} structure closer to dts fields
"pins" array is removed as information is transfered to
"pinconf" array

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-07-26 15:16:52 -05:00
Erwan Gouriou 8d0150000c arch: stm32f1: rework pinmux driver
Rework stm32f1 pinmux code for future dts based pinmux code
generation.
Pin configuration is now done directly thanks to gpio port
configuration. Reference to pseudo alternate functions are
now removed same as the use of pins[] array.
Pins function (uart tx for instance) is set implicitly by
defining gpio mode and configuration.
This behavior is specific to stm32f10x series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-07-26 15:16:52 -05:00
Erwan Gouriou 2366d23573 arch: arm: stm32l4: Rework pinmux driver
STM32L4 pinmux handler is reworked to support future pinmux dts
generation.
Preliminary change is done to move pin configuration
informations in a {pin, conf} structure closer to dts fields
"pins" array is removed and information is transferred to
"pinconf" array

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2017-07-26 15:16:52 -05:00
Marti Bolivar bdebff0caa drivers: ethernet: mcux: fix build warning
The ethernet HAL has a different uint32_t typedef than Zephyr's u32_t:
uint32_t in the HAL is long unsigned int, while in Zephyr it's
unsigned int. This is causing a build warning on GCC ("warning:
passing argument 2 of ‘ENET_GetRxFrameSize’ from incompatible pointer
type") when passing a u32_t* where ENET_GetRxFrameSize expects a
uint32_t*.

Add a cast to silence the warning.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-26 09:49:45 -05:00
Andrew Boie e8cede7940 net: fix references to stack buffers
The net_stack_analyze function wants to look at the stack buffer,
but it is making assumptions on where this data is that are no
longer valid. Change to use the proper APIs for referencing this.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-26 10:31:46 +03:00
Savinay Dharmappa be55f6644e drivers: gpio: Fix Coverity static scan issues
patch fix the dead code issue reported by coverity static scan
for gpio driver of cc2650 TI SOC. GPIO_DS_DFLT_LOW macro
is defined Zero, bitwise and with any value would result to
zero,because of which only false condition of if is evaluated
but not the true condition.This is a fix for jira ZEP-2355.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-07-20 11:50:51 -05:00
Michał Kruszewski fda632adec nrf5: uart: Add support for 300 and 600 baud rates.
Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
2017-07-20 07:30:04 -05:00
Kumar Gala 563f8f1464 i2c: mcux: Convert to supporting device tree
Update the MCUX I2C driver and related platforms to get their I2C
information from the device tree.  We also updated a few of the sensor
drivers found on the FRDM & Hexiwear boards to get their I2C bus name
from the device tree instead of directly from Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-19 14:28:08 -05:00
Yannis Damigos 5b3a71a810 i2c: stm32: Update driver to get I2C port base address from DT
Update the STM32 I2C driver to get I2C port base address
from the device tree

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-07-19 14:28:08 -05:00
Maureen Helm 8ff51559da adc: Introduce new mcux adc16 driver
Adds a shim layer around the mcux adc16 driver to adapt it to the Zephyr
adc interface.

Jira: ZEP-1396

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-07-19 14:28:08 -05:00
Maureen Helm 7bf0df3aec dts: Generate Kinetis adc settings from device tree
Adds common and Kinetis-specific adc device tree properties, and updates
all Kinetis SoC and board dts files to include adc nodes.

Jira: ZEP-1396

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-07-19 14:28:08 -05:00
Maureen Helm a8b1b7f118 adc: Introduce multiple instance configs
The Kconfig assumed that there would only ever be one instance of an
adc, but some Kinetis devices have multiple adc instances.

Jira: ZEP-1396

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-07-19 14:28:08 -05:00
Maureen Helm 615891dd1c adc: Simplify Kconfig dependencies
Remove repetitive dependencies on ADC and instead wrap everything in one
big if.

Jira: ZEP-1396

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-07-19 14:28:08 -05:00
Kumar Gala 710807fa1e i2c: Fix missing Kconfig !HAS_I2C_DTS dependencies
As I2C_0 (port 0) isn't used on the STM32 platforms we didn't exclude
the related Kconfig options if DTS was enabled.  However other SoCs
(like NXP) do use I2C_0 so we need to fixup the Kconfig dependencies

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-19 14:28:08 -05:00
Savinay Dharmappa c1e5cbfd41 devicetree: Generate BLUETOOTH_UART,UART_PIPE etc config from dt
patch uses chosen property zephyr,bt-uart, zephyr,uart-pipe
and zephyr,bt-mon-uart to determine the uart instance to be
used for bluetooth,uart_pipe and bluetooth_monitor and generate
appropriate configs.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-07-19 11:52:35 -04:00
Marti Bolivar 3ac9ca0859 spi: dw: fix spi_dw_init()
It is incorrect to call spi_context_release() on a
spi_dw_data object's ctx field before data->ctx->config is first
set in spi_dw_configure(). This is because spi_context_release()
reads ctx->config->operation. In particular, during spi_dw_init(),
calling spi_context_release() reads the uninitialized memory in
spi->ctx->config->operation.

Call spi_context_unlock_unconditionally() instead to properly increase
the semaphore count.

Without this patch, the first call to spi_transceive() can block
forever depending on the value of the uninitialized memory holding
spi->ctx->config->operation.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-14 18:10:38 +03:00
Marti Bolivar 6318750837 spi: stm32: fix spi_stm32_init()
It is incorrect to call spi_context_release() on an STM32
spi_stm32_data object's ctx field before data->ctx->config is first
set in spi_stm32_configure(). This is because spi_context_release()
reads ctx->config->operation. In particular, during spi_stm32_init(),
calling spi_context_release() reads the uninitialized memory in
data->ctx->config->operation.

Call spi_context_unlock_unconditionally() instead to properly increase
the semaphore count.

Without this patch, the first call to spi_transceive() can block
forever depending on the value of the uninitialized memory holding
data->ctx->config->operation.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-14 18:10:38 +03:00
Vinayak Kariappa Chettimada 9a13a0c732 Bluetooth: Add BUILD_ASSERT to check Tx and Rx thread priorities
Added BUILD_ASSERT check for Tx and Rx thread priorities.

The Tx thread priority shall be higher than Rx thread
priority in order to correctly detect transaction violations
in ATT and SMP protocols. The Number of Completed Packets
for a connection shall be processed before any new data is
received and processed for that connection.

The Controller's priority receive thread priority shall be
higher than the Host's Tx and the Controller's Rx thread
priority.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-07-12 13:50:51 +03:00
Erwin Rol e3d8a2b34d driver: eth_stm32_hal: make phy address configurable
Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2017-07-12 12:53:51 +03:00
Erwin Rol ad8f83733c driver: eth_stm32_hal: disable hardware multicast filtering
Until Zephyr has infrastructure to enable/disable the
reception of multicast frames we disable the hardware
multicast frame filter completly and pass all multicast
frames to the upper layer and let that deal with them.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2017-07-12 12:53:51 +03:00
Erwin Rol be88626695 pinmux: stm32: add ethernet controller pins
Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2017-07-12 12:53:51 +03:00
Erwin Rol 85efae6b3d pinmux: stm32: directly return error if stm32_get_pin_config fails.
Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2017-07-12 12:53:51 +03:00
Erwin Rol 6e3782480e driver: eth_stm32_hal: Initial STM32 HAL based Ethernet driver
Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2017-07-12 12:53:51 +03:00
Kumar Gala 65e72be8f7 devicetree: Generate CONFIG_UART_CONSOLE_ON_DEV_NAME from dt
We can use the chosen property "zephyr,console" to determine what uart
should be used as the console and find its name to generate a define for
CONFIG_UART_CONSOLE_ON_DEV_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-11 12:09:10 -05:00
Vinayak Kariappa Chettimada e81fb85cad clock_control: nRF5x: Select 251-500ppm as default for 32kHz RCOSC
Frequency tolerance for LFRC after calibration for nRF5x
Series ICs is between 251 and 500 ppm as per Product
Specification. For more details refer to:
http://infocenter.nordicsemi.com/

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-07-11 10:29:46 -05:00
Andrew Boie f253af2d30 drivers: timer: init earlier in boot sequence
By the time we get to POST_KERNEL, kernel services and kernel objects
should be available for use. This should include timers and the random
number generator, but we don't init the system clock until sometime
during the POST_KERNEL phase. Initialize it earlier.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-10 11:44:56 -07:00
Andrew Boie 65a9d2a94a kernel: make K_.*_INITIALIZER private to kernel
Upcoming memory protection features will be placing some additional
constraints on kernel objects:

- They need to reside in memory owned by the kernel and not the
application
- Certain kernel object validation schemes will require some run-time
initialization of all kernel objects before they can be used.

Per Ben these initializer macros were never intended to be public. It is
not forbidden to use them, but doing so requires care: the memory being
initialized must reside in kernel space, and extra runtime
initialization steps may need to be peformed before they are fully
usable as kernel objects. In particular, kernel subsystems or drivers
whose objects are already in kernel memory may still need to use these
macros if they define kernel objects as members of a larger data
structure.

It is intended that application developers instead use the
K_<object>_DEFINE macros, which will automatically put the object in the
right memory and add them to a section which can be iterated over at
boot to complete initiailization.

There was no K_WORK_DEFINE() macro for creating struct k_work objects,
this is now added.

k_poll_event and k_poll_signal are intended to be instatiated from
application memory and have not been changed.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-07-10 11:44:56 -07:00
Geoff Gustafson 1405627c37 net: context: Use K_NO_WAIT instead of 0 for timeout
Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
2017-07-10 10:59:28 +03:00
Johan Hedberg ca61452b8e Bluetooth: drivers: Make RX thread priority consistent
The controller and host-side RX threads recently had their priorities
lowered to 8. Make the driver RX threads consistent with this.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-07 10:43:58 -07:00
Yannis Damigos 1bc2fdc704 dts: arm: STM32 boards use DT to configure I2C
Configure I2C using DT for the following STM32 boards:

disco_l475_iot1
nucleo_f401re
96b_carbon
olimexino_stm32

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-07-07 10:31:34 -05:00
Justin Watson 0c6883f25a arm: dts: Modified Atmel SAM family processor's UART to DTS.
The SAM4S, SAM3X, SAME70 all use the uart_sam.c serial
driver. This patch puts the configuration in DTS and
out of Kconfig. The SAME70 uses the USART as well.
USART DTS support for the SAME70 is also in this patch.

Signed-off-by: Justin Watson <jwatson5@gmail.com>
2017-07-07 10:31:34 -05:00
Kumar Gala 9eddc82be3 i2c: remove I2C Slave Read config
The I2C Slave Read support isn't well defined and not actually supported
by any i2c driver at this point.  We can add this back when slave mode
is more thought out.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-07 10:01:38 -05:00
Erwin Rol 2fc9dc61d4 drivers: stm32: random: Initial STM32 random number generator driver
Add a STM32 LL based driver for the RNG processor. The RNG processor
is a random number generator, based on a continuous analog noise, that
provides a random 32-bit value to the host when read. The RNG passed
the FIPS PUB 140-2 (2001 October 10) tests with a success ratio of 99%.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2017-07-07 07:27:39 -05:00
Bogdan Davidoaia e392ef2285 drivers: ieee802154: kw41z: add support for KW40Z
Add support for KW40Z in the KW41Z IEEE 802.15.4 driver as both chips
expose almost the same radio registers.

Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-07-06 14:20:32 -05:00
Bogdan Davidoaia 3389ee4eb4 drivers: ieee802154: kw41z: fix issue in RX sequence
The chip seems to require a wait time before reading packet
data after the RX sequence done interrupt, as imidiate reading
of it will indicate a packet size of zero and cause the RX
sequence done to be continually retriggered.

In addition, the extra clearing of the interrupt flags can be
removed, as this is already done at the beginning of the isr.

Jira: ZEP-2278
Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-07-06 14:20:32 -05:00
Bogdan Davidoaia 2b1dfbcd7c drivers: ieee802154: kw41z: remove unnecessary cast for PKT_BUFFER_RX
The cast to u16_t in not needed as PKT_BUFFER_RX already is
of that type.

Signed-off-by: Bogdan Davidoaia <bogdan.davidoaia@linaro.org>
2017-07-06 14:20:32 -05:00
Anas Nashif 3ec3276163 kconfig: fixed stray Kconfig variables
Those were found using:

  ./scripts/checkconfig.py

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-06 10:34:41 -05:00
Kumar Gala 4c233bbc05 i2c: stm32: fix build issue
When building tests/kernel/test_build/test_debug on disco_l475_iot1 we
get the following build error:

drivers/i2c/i2c_ll_stm32_v2.c: In function ‘stm32_i2c_configure_timing’:
ext/hal/st/stm32cube/stm32l4xx/soc/stm32l4xx.h:207:38: error: ‘timing’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define WRITE_REG(REG, VAL)   ((REG) = (VAL))
                                      ^
drivers/i2c/i2c_ll_stm32_v2.c:265:8: note: ‘timing’ was declared here
  u32_t timing;
        ^~~~~~

Fix by initializing timing to 0.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-06 09:53:00 -05:00
Anas Nashif 4c56b90fd7 drivers: slip: move doxygen header
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif 9ed80ad82f drivers: ataes132a: Fix Kconfig name
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif 68d7a207ae ethernet: fix Kconfig option for ETHERNET
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Neil Armstrong ed608ba2d8 pinmux: stm32: nucleo_l432kc: Add SPI pins
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-07-01 08:36:51 -04:00
Neil Armstrong f7bee90a5f pinmux: stm32: nucleo_l476rg: Fix SPI Pinmux
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-07-01 08:36:51 -04:00
Erwan Gouriou a9b3ce3dc4 pinmux: stm32: nucleo_f334r8: add support for SPI
Following implementation of LL based SPI driver,
add SPI support on nucleo_f334r8 board of STM32F3 series.

Change-Id: Ifbe39b1f2cecdd7db23be9c6943a914a155ebd77
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-07-01 08:36:51 -04:00
Jorge Ramirez-Ortiz fbf21932d3 pinmux: stm32: nucleo_f401re: Add support for SPI
Add SPI pin for the nucleo_f401re pinmux.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-07-01 08:36:51 -04:00
Neil Armstrong 9033fb2f01 spi: add SPI driver for STM32 family
Add a SPI master and slave driver for the L4, F4 and F3 STM32
SoCs families.

Change-Id: I1faf5c97f992c91eba852fd126e7d3b83158993d
Origin: Original
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Tested-by: Lee Jones <lee.jones@linaro.org>
2017-07-01 08:36:51 -04:00
Jorge Ramirez-Ortiz dd2eeaf352 pinmux: stm32f4: Add SPI2 pins on PB12, PB13, PB14 & PB15
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-07-01 08:36:51 -04:00
Jorge Ramirez-Ortiz 3ebb412fa9 pinmux: stm32f4: Add SPI1 pins on PA4, PA5, PA6 & PA7
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2017-07-01 08:36:51 -04:00
Jorge Ramirez-Ortiz 21fbc9b07e drivers: i2c: stm32 LL F1/F4 (v1) STM32 F3/L4X (v2)
Supports STM32 F1/F4 (v1 controller) and STM32 F3/L4X (v2
controller)

v1 could also support L1X.
v2 could also support F7X.

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Reviewed-by: Yannis Damigos <giannis.damigos@gmail.com>
Tested-by: Yannis Damigos <giannis.damigos@gmail.com>
Tested-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
2017-07-01 08:36:51 -04:00
Yannis Damigos 4668ecbbd2 boards: arm: Add STM32F3DISCOVERY board
Add support for STM32F3DISCOVERY board.

Origin: original

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-07-01 08:36:51 -04:00
Yannis Damigos 6003b1d0d2 interrupt_controller: add STM32F303XC EXTI lines number
Add the EXTI lines number for the STM32F303XC

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2017-07-01 08:36:51 -04:00
Yannis Damigos 8a646c59bf pinmux: boards: add I2C to carbon/lf33fr8/f401re/olimexino
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
2017-07-01 08:36:51 -04:00
Yannis Damigos ecbb3b6c04 pinmux: stm32 F1X/F3X/F4X: add I2C
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
2017-07-01 08:36:51 -04:00
Kumar Gala ccff19ed21 serial: nsim: Add missing SERIAL_HAS_DRIVER in Kconfig
The nsim driver was missing the select for SERIAL_HAS_DRIVER

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-29 07:07:31 -04:00
Kumar Gala 461b5018d3 serial: introduce SERIAL_SUPPORT_INTERRUPT Kconfig option
As not all drivers support interrupts we don't have a means to know if
we can allow UART_INTERRUPT_DRIVEN to be enabled and thus various
Kconfig options that select UART_INTERRUPT_DRIVEN.  Some drivers have a
interrupts, however not all do.  So introduce a Kconfig option to let us
know what the driver actually supports.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-29 07:07:31 -04:00
Johann Fischer 3dd51d52a2 drivers: usb: use generic option name for log level
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-06-28 09:02:27 -04:00
Andrzej Puzdrowski 8b7a8448ab Drivers: flash: NRF5x: synchronous mode for co-operation with BLE radio
In added mode flash operation are performed in timeslice
(in radio idle time).
Kconfig for mode enabling CONFIG_SOC_FLASH_NRF5_RADIO_SYNC.

Erase and write API implementations were rewritten and preserved against
concurrent execution.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-06-28 12:29:50 +02:00
Siddharth Chandrasekaran f7705af136 boards: arm: Add support for STM32 Minimum Development Board
Add configuration, documentation, pinmux, fixup and dts support for
STM32F103x8 based Minimum System Development board.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2017-06-23 15:05:10 -05:00
Savinay Dharmappa 114db109ef samples: drivers/net: apps: Resolve Kconfig dependency
as config SPI_CS_GPIO was selecting GPIO instead it
should just depend on it. This patch is a fix for
ZEP-2071 jira.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-06-22 19:51:05 -04:00
Kumar Gala 49ebc09a52 clock: stm32: Cleanup use of C99 types
We introduced some see C99 types, so convert them over to the Zephyr
types.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-22 13:47:28 -04:00
Kumar Gala fb56b39cdd timer: xtensa_sys: Cleanup use of C99 types
We introduced some see C99 types, so convert them over to the Zephyr
types.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-22 13:47:28 -04:00
Kumar Gala 4b82e2bc75 flash: stm32l4x: Cleanup use of C99 types
We introduced some see C99 types, so convert them over to the Zephyr
types.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-22 13:47:28 -04:00
Kumar Gala b71b86ed03 spi: Cleanup use of C99 types
We introduced some see C99 types, so convert them over to the Zephyr
types.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-22 13:47:28 -04:00
Savinay Dharmappa 0ea423d976 drivers: serial: Add device support for serial driver
patch enables qmsi serial driver to pick baudrate and name
from device tree instead of Kconfig for UART0 and UART1
instance

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2017-06-22 10:23:39 -05:00
Inaky Perez-Gonzalez 271c518ec6 uart_esp32: alter the uart.h include order to avoid warning
The esp-idf package contains on the BSP a definition of the BIT macro
unconditionally #defined when rom/uart.h is #included. When Zephyr's
uart.h (which pulls in include/misc/util.h) that conditionally

This generates a compile warning on the re-definiton of BIT by the
esp-idf package.

Thus include uart.h after esp-idf's rom/uart.h to have BIT not
re-defined thanks to Zephyr's conditional definition.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-06-21 19:05:19 -04:00
Ivan Grokhotkov d58d5d1265 xtensa: esp32: configure default UART using ROM functions
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-06-21 12:35:49 -04:00
Leandro Pereira 37ea77173c drivers: esp32: Add minimal UART driver based on ROM routines
This is a minimal driver enabling console output during the port
bringup.  While the driver works, only one of the three UART devices
are supported, and there isn't any way to change any parameters or
use interrupts.  This will most likely be superceded by a proper
driver after the port has matured.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-06-21 12:35:49 -04:00
Anas Nashif 397d29db42 linker: move all linker headers to include/linker
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-18 09:24:04 -05:00
Geoffrey Le Gourriérec e8a766830f cc2650: Add pinmux driver.
Signed-off-by: Geoffrey Le Gourriérec <geoffrey.legourrierec@smile.fr>
2017-06-16 16:18:12 -04:00
Geoffrey Le Gourriérec 0a89e00080 cc2650: Add GPIO driver.
Signed-off-by: Geoffrey Le Gourriérec <geoffrey.legourrierec@smile.fr>
2017-06-16 16:18:12 -04:00
Geoffrey Le Gourriérec 4c24b1d857 uart: Use DTS labels for Stellaris driver.
Update driver to use DTS-generated #defines for port names,
and not obsolete Kconfig variables.

Signed-off-by: Geoffrey Le Gourriérec <geoffrey.legourrierec@smile.fr>
2017-06-16 16:18:12 -04:00
Michel Jaouen e9153979f0 flash: stm32: distinguish read/write for flash range valid
L4 write access requires 64 bits alignment
while L4 read access does not require any alignment.
To support specific check according to read/write,erase
a parameter is added to stm32_valid_range.

Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
2017-06-16 16:18:12 -04:00
Michel Jaouen 8ba73a79b3 flash: stm32: fix for l4 writing wrong data
L4 have 64 bits write access.
The cast to 64 bits data address in write_dword
requires 3 right shifts on i (byte index) else the
data taken are wrong for i different from 0

Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
2017-06-16 16:18:12 -04:00
Geoffrey Le Gourriérec 6341258ef5 drivers: serial: uart_stellaris: Remove UART_IRQ_FLAGS
We always have UART_IRQ_FLAGS set to 0, so just call IRQ_CONNECT with a
0 argument for the flags, and remove the UART_IRQ_FLAGS.  This is
towards support for using the driver on the TI CC2650.  (we add a
comment about that as well).

Signed-off-by: Geoffrey Le Gourriérec <geoffrey.legourrierec@smile.fr>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-06-16 16:18:12 -04:00
Shiksha Patel a931c8af0a pinmux: pinmux_dev_k64 driver and related references are removed.
Functionality of a pinmux driver is now a part of a regular
driver.

Signed-off-by: Shiksha Patel <shiksha.patel@nxp.com>
2017-06-16 16:18:12 -04:00
Andy Gross 4603565a81 rts: Kconfig: Add QMSI dependency on RTC options
This patch adds the QMSI as a dependency on options which only
pertain to QMSI related peripherals.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-06-15 16:14:59 -05:00
Andy Gross 2920815d23 bluetooth: hci: Kconfig: Fix dependency
This patch changes the BLUETOOTH_SPI to depend on SPI.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-06-15 16:14:59 -05:00
David B. Kinder 9faa5f2033 doc: spelling fixes in Kconfig files
regular spelling check on Kconfig.* files

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-06-12 19:40:51 -04:00
Andrew Boie 2d4a36fc1c drivers: use K_THREAD_STACK_DEFINE macros
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Jens Peter Schroer b676bfafc8 drivers: serial: uart_fe310: fix function definiton name for UART1 IRQ
This commit fixes the compilation error that occurs if both UART
ports on the FE310 SoC are enabled. The error occurs due to the
missing function definition of uart_fe310_irq_cfg_func_1 .

Signed-off-by: Jens Peter Schroer <jens@manetos.com>
2017-06-07 12:17:15 -05:00